aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorcodeworkx <codeworkx@cyanogenmod.org>2013-02-02 15:42:36 +0000
committercodeworkx <codeworkx@cyanogenmod.org>2013-02-02 15:57:14 +0000
commitf94d43cbae135178cebfb31edaebe77ec1234379 (patch)
treedc2ea3b81cde046dd6857f54e025d92fda97a427 /drivers/net
parent0ae432473697626c080dab8117049718f1c44441 (diff)
downloadkernel_samsung_smdk4412-f94d43cbae135178cebfb31edaebe77ec1234379.zip
kernel_samsung_smdk4412-f94d43cbae135178cebfb31edaebe77ec1234379.tar.gz
kernel_samsung_smdk4412-f94d43cbae135178cebfb31edaebe77ec1234379.tar.bz2
bcmdhd: update from jb update 7
Change-Id: I360e95d0616631fbdf67c35abdded88f62af3fa9
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/bcmdhd/Kconfig63
-rw-r--r--drivers/net/wireless/bcmdhd/Makefile277
-rw-r--r--drivers/net/wireless/bcmdhd/aiutils.c (renamed from drivers/net/wireless/bcmdhd/src/shared/aiutils.c)105
-rw-r--r--drivers/net/wireless/bcmdhd/bcmevent.c (renamed from drivers/net/wireless/bcmdhd/src/shared/bcmevent.c)29
-rw-r--r--drivers/net/wireless/bcmdhd/bcmsdh.c (renamed from drivers/net/wireless/bcmdhd/src/bcmsdio/sys/bcmsdh.c)81
-rw-r--r--drivers/net/wireless/bcmdhd/bcmsdh_linux.c (renamed from drivers/net/wireless/bcmdhd/src/bcmsdio/sys/bcmsdh_linux.c)120
-rw-r--r--drivers/net/wireless/bcmdhd/bcmsdh_sdmmc.c (renamed from drivers/net/wireless/bcmdhd/src/bcmsdio/sys/bcmsdh_sdmmc.c)72
-rw-r--r--drivers/net/wireless/bcmdhd/bcmsdh_sdmmc_linux.c (renamed from drivers/net/wireless/bcmdhd/src/bcmsdio/sys/bcmsdh_sdmmc_linux.c)83
-rw-r--r--drivers/net/wireless/bcmdhd/bcmsdspi_linux.c420
-rw-r--r--drivers/net/wireless/bcmdhd/bcmspibrcm.c1853
-rw-r--r--drivers/net/wireless/bcmdhd/bcmutils.c (renamed from drivers/net/wireless/bcmdhd/src/shared/bcmutils.c)47
-rw-r--r--drivers/net/wireless/bcmdhd/bcmwifi_channels.c (renamed from drivers/net/wireless/bcmdhd/src/wl/bcmwifi/src/bcmwifi_channels.c)227
-rw-r--r--drivers/net/wireless/bcmdhd/bcmwifi_channels.h (renamed from drivers/net/wireless/bcmdhd/src/wl/bcmwifi/include/bcmwifi_channels.h)87
-rw-r--r--drivers/net/wireless/bcmdhd/bcmwifi_rates.h306
-rw-r--r--drivers/net/wireless/bcmdhd/dhd.h (renamed from drivers/net/wireless/bcmdhd/src/dhd/sys/dhd.h)172
-rw-r--r--drivers/net/wireless/bcmdhd/dhd_bta.c (renamed from drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_bta.c)8
-rw-r--r--drivers/net/wireless/bcmdhd/dhd_bta.h (renamed from drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_bta.h)8
-rw-r--r--drivers/net/wireless/bcmdhd/dhd_bus.h (renamed from drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_bus.h)14
-rw-r--r--drivers/net/wireless/bcmdhd/dhd_cdc.c (renamed from drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_cdc.c)174
-rw-r--r--drivers/net/wireless/bcmdhd/dhd_cfg80211.c (renamed from drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_cfg80211.c)79
-rw-r--r--drivers/net/wireless/bcmdhd/dhd_cfg80211.h (renamed from drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_cfg80211.h)10
-rw-r--r--drivers/net/wireless/bcmdhd/dhd_common.c (renamed from drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_common.c)139
-rw-r--r--drivers/net/wireless/bcmdhd/dhd_custom_gpio.c (renamed from drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_custom_gpio.c)145
-rw-r--r--drivers/net/wireless/bcmdhd/dhd_custom_sec.c (renamed from drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_custom_sec.c)404
-rw-r--r--drivers/net/wireless/bcmdhd/dhd_dbg.h (renamed from drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_dbg.h)35
-rw-r--r--drivers/net/wireless/bcmdhd/dhd_linux.c (renamed from drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_linux.c)1822
-rw-r--r--drivers/net/wireless/bcmdhd/dhd_linux_sched.c (renamed from drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_linux_sched.c)8
-rw-r--r--drivers/net/wireless/bcmdhd/dhd_proto.h (renamed from drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_proto.h)14
-rw-r--r--drivers/net/wireless/bcmdhd/dhd_sdio.c (renamed from drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_sdio.c)1261
-rw-r--r--drivers/net/wireless/bcmdhd/dhd_sec_feature.h (renamed from drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_sec_feature.h)22
-rw-r--r--drivers/net/wireless/bcmdhd/dhd_wlfc.h (renamed from drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_wlfc.h)18
-rw-r--r--drivers/net/wireless/bcmdhd/dngl_stats.h (renamed from drivers/net/wireless/bcmdhd/src/dongle/dngl_stats.h)8
-rw-r--r--drivers/net/wireless/bcmdhd/dngl_wlhdr.h (renamed from drivers/net/wireless/bcmdhd/src/dongle/dngl_wlhdr.h)8
-rw-r--r--drivers/net/wireless/bcmdhd/hndpmu.c (renamed from drivers/net/wireless/bcmdhd/src/shared/hndpmu.c)24
-rw-r--r--drivers/net/wireless/bcmdhd/include/Makefile53
-rw-r--r--drivers/net/wireless/bcmdhd/include/aidmp.h (renamed from drivers/net/wireless/bcmdhd/src/include/aidmp.h)186
-rw-r--r--drivers/net/wireless/bcmdhd/include/bcm_cfg.h (renamed from drivers/net/wireless/bcmdhd/src/include/bcm_cfg.h)10
-rw-r--r--drivers/net/wireless/bcmdhd/include/bcm_mpool_pub.h (renamed from drivers/net/wireless/bcmdhd/src/include/bcm_mpool_pub.h)8
-rw-r--r--drivers/net/wireless/bcmdhd/include/bcmcdc.h (renamed from drivers/net/wireless/bcmdhd/src/include/bcmcdc.h)77
-rw-r--r--drivers/net/wireless/bcmdhd/include/bcmdefs.h (renamed from drivers/net/wireless/bcmdhd/src/include/bcmdefs.h)88
-rw-r--r--drivers/net/wireless/bcmdhd/include/bcmdevs.h495
-rw-r--r--drivers/net/wireless/bcmdhd/include/bcmendian.h (renamed from drivers/net/wireless/bcmdhd/src/include/bcmendian.h)16
-rw-r--r--drivers/net/wireless/bcmdhd/include/bcmnvram.h (renamed from drivers/net/wireless/bcmdhd/src/include/bcmnvram.h)67
-rw-r--r--drivers/net/wireless/bcmdhd/include/bcmpcispi.h (renamed from drivers/net/wireless/bcmdhd/src/include/bcmpcispi.h)8
-rw-r--r--drivers/net/wireless/bcmdhd/include/bcmperf.h (renamed from drivers/net/wireless/bcmdhd/src/include/bcmperf.h)8
-rw-r--r--drivers/net/wireless/bcmdhd/include/bcmsdbus.h (renamed from drivers/net/wireless/bcmdhd/src/include/bcmsdbus.h)39
-rw-r--r--drivers/net/wireless/bcmdhd/include/bcmsdh.h (renamed from drivers/net/wireless/bcmdhd/src/include/bcmsdh.h)23
-rw-r--r--drivers/net/wireless/bcmdhd/include/bcmsdh_sdmmc.h (renamed from drivers/net/wireless/bcmdhd/src/include/bcmsdh_sdmmc.h)32
-rw-r--r--drivers/net/wireless/bcmdhd/include/bcmsdpcm.h (renamed from drivers/net/wireless/bcmdhd/src/include/bcmsdpcm.h)10
-rw-r--r--drivers/net/wireless/bcmdhd/include/bcmsdspi.h (renamed from drivers/net/wireless/bcmdhd/src/include/bcmsdspi.h)52
-rw-r--r--drivers/net/wireless/bcmdhd/include/bcmsdstd.h (renamed from drivers/net/wireless/bcmdhd/src/include/bcmsdstd.h)105
-rw-r--r--drivers/net/wireless/bcmdhd/include/bcmspi.h (renamed from drivers/net/wireless/bcmdhd/src/include/bcmspi.h)8
-rw-r--r--drivers/net/wireless/bcmdhd/include/bcmspibrcm.h168
-rw-r--r--drivers/net/wireless/bcmdhd/include/bcmsrom_fmt.h607
-rw-r--r--drivers/net/wireless/bcmdhd/include/bcmsrom_tbl.h900
-rw-r--r--drivers/net/wireless/bcmdhd/include/bcmutils.h (renamed from drivers/net/wireless/bcmdhd/src/include/bcmutils.h)329
-rw-r--r--drivers/net/wireless/bcmdhd/include/dbus.h571
-rw-r--r--drivers/net/wireless/bcmdhd/include/dhdioctl.h (renamed from drivers/net/wireless/bcmdhd/src/include/dhdioctl.h)16
-rw-r--r--drivers/net/wireless/bcmdhd/include/epivers.h (renamed from drivers/net/wireless/bcmdhd/src/include/epivers.h)34
-rw-r--r--drivers/net/wireless/bcmdhd/include/hndpmu.h (renamed from drivers/net/wireless/bcmdhd/src/include/hndpmu.h)8
-rw-r--r--drivers/net/wireless/bcmdhd/include/hndrte_armtrap.h (renamed from drivers/net/wireless/bcmdhd/src/include/hndrte_armtrap.h)8
-rw-r--r--drivers/net/wireless/bcmdhd/include/hndrte_cons.h (renamed from drivers/net/wireless/bcmdhd/src/include/hndrte_cons.h)8
-rw-r--r--drivers/net/wireless/bcmdhd/include/hndsoc.h (renamed from drivers/net/wireless/bcmdhd/src/include/hndsoc.h)26
-rw-r--r--drivers/net/wireless/bcmdhd/include/linux_osl.h (renamed from drivers/net/wireless/bcmdhd/src/include/linux_osl.h)121
-rw-r--r--drivers/net/wireless/bcmdhd/include/linuxver.h (renamed from drivers/net/wireless/bcmdhd/src/include/linuxver.h)118
-rw-r--r--drivers/net/wireless/bcmdhd/include/miniopt.h (renamed from drivers/net/wireless/bcmdhd/src/include/miniopt.h)8
-rw-r--r--drivers/net/wireless/bcmdhd/include/msgtrace.h (renamed from drivers/net/wireless/bcmdhd/src/include/msgtrace.h)10
-rw-r--r--drivers/net/wireless/bcmdhd/include/osl.h (renamed from drivers/net/wireless/bcmdhd/src/include/osl.h)35
-rw-r--r--drivers/net/wireless/bcmdhd/include/packed_section_end.h (renamed from drivers/net/wireless/bcmdhd/src/include/packed_section_end.h)8
-rw-r--r--drivers/net/wireless/bcmdhd/include/packed_section_start.h (renamed from drivers/net/wireless/bcmdhd/src/include/packed_section_start.h)8
-rw-r--r--drivers/net/wireless/bcmdhd/include/pcicfg.h (renamed from drivers/net/wireless/bcmdhd/src/include/pcicfg.h)62
-rw-r--r--drivers/net/wireless/bcmdhd/include/proto/802.11.h2254
-rw-r--r--[-rwxr-xr-x]drivers/net/wireless/bcmdhd/include/proto/802.11_bta.h (renamed from drivers/net/wireless/bcmdhd/src/include/proto/802.11_bta.h)8
-rw-r--r--[-rwxr-xr-x]drivers/net/wireless/bcmdhd/include/proto/802.11e.h (renamed from drivers/net/wireless/bcmdhd/src/include/proto/802.11e.h)14
-rw-r--r--[-rwxr-xr-x]drivers/net/wireless/bcmdhd/include/proto/802.1d.h (renamed from drivers/net/wireless/bcmdhd/src/include/proto/802.1d.h)30
-rw-r--r--drivers/net/wireless/bcmdhd/include/proto/bcmeth.h (renamed from drivers/net/wireless/bcmdhd/src/include/proto/bcmeth.h)18
-rw-r--r--drivers/net/wireless/bcmdhd/include/proto/bcmevent.h342
-rw-r--r--drivers/net/wireless/bcmdhd/include/proto/bcmip.h (renamed from drivers/net/wireless/bcmdhd/src/include/proto/bcmip.h)112
-rw-r--r--drivers/net/wireless/bcmdhd/include/proto/bcmipv6.h104
-rw-r--r--drivers/net/wireless/bcmdhd/include/proto/bt_amp_hci.h (renamed from drivers/net/wireless/bcmdhd/src/include/proto/bt_amp_hci.h)8
-rw-r--r--drivers/net/wireless/bcmdhd/include/proto/eapol.h (renamed from drivers/net/wireless/bcmdhd/src/include/proto/eapol.h)10
-rw-r--r--drivers/net/wireless/bcmdhd/include/proto/ethernet.h (renamed from drivers/net/wireless/bcmdhd/src/include/proto/ethernet.h)50
-rw-r--r--drivers/net/wireless/bcmdhd/include/proto/p2p.h565
-rw-r--r--drivers/net/wireless/bcmdhd/include/proto/sdspi.h (renamed from drivers/net/wireless/bcmdhd/src/include/proto/sdspi.h)42
-rw-r--r--drivers/net/wireless/bcmdhd/include/proto/vlan.h (renamed from drivers/net/wireless/bcmdhd/src/include/proto/vlan.h)26
-rw-r--r--drivers/net/wireless/bcmdhd/include/proto/wpa.h (renamed from drivers/net/wireless/bcmdhd/src/include/proto/wpa.h)104
-rw-r--r--drivers/net/wireless/bcmdhd/include/proto/wps.h (renamed from drivers/net/wireless/bcmdhd/src/include/proto/wps.h)8
-rw-r--r--drivers/net/wireless/bcmdhd/include/sbchipc.h (renamed from drivers/net/wireless/bcmdhd/src/include/sbchipc.h)1513
-rw-r--r--drivers/net/wireless/bcmdhd/include/sbconfig.h (renamed from drivers/net/wireless/bcmdhd/src/include/sbconfig.h)232
-rw-r--r--drivers/net/wireless/bcmdhd/include/sbhnddma.h370
-rw-r--r--drivers/net/wireless/bcmdhd/include/sbpcmcia.h (renamed from drivers/net/wireless/bcmdhd/src/include/sbpcmcia.h)22
-rw-r--r--drivers/net/wireless/bcmdhd/include/sbsdio.h (renamed from drivers/net/wireless/bcmdhd/src/include/sbsdio.h)22
-rw-r--r--drivers/net/wireless/bcmdhd/include/sbsdpcmdev.h (renamed from drivers/net/wireless/bcmdhd/src/include/sbsdpcmdev.h)12
-rw-r--r--drivers/net/wireless/bcmdhd/include/sbsocram.h (renamed from drivers/net/wireless/bcmdhd/src/include/sbsocram.h)40
-rw-r--r--drivers/net/wireless/bcmdhd/include/sdio.h (renamed from drivers/net/wireless/bcmdhd/src/include/sdio.h)14
-rw-r--r--drivers/net/wireless/bcmdhd/include/sdioh.h (renamed from drivers/net/wireless/bcmdhd/src/include/sdioh.h)94
-rw-r--r--drivers/net/wireless/bcmdhd/include/sdiovar.h (renamed from drivers/net/wireless/bcmdhd/src/include/sdiovar.h)31
-rw-r--r--drivers/net/wireless/bcmdhd/include/siutils.h (renamed from drivers/net/wireless/bcmdhd/src/include/siutils.h)108
-rw-r--r--drivers/net/wireless/bcmdhd/include/spid.h165
-rw-r--r--drivers/net/wireless/bcmdhd/include/trxhdr.h (renamed from drivers/net/wireless/bcmdhd/src/include/trxhdr.h)8
-rw-r--r--drivers/net/wireless/bcmdhd/include/typedefs.h (renamed from drivers/net/wireless/bcmdhd/src/include/typedefs.h)54
-rw-r--r--drivers/net/wireless/bcmdhd/include/wlfc_proto.h (renamed from drivers/net/wireless/bcmdhd/src/include/wlfc_proto.h)50
-rw-r--r--drivers/net/wireless/bcmdhd/include/wlioctl.h (renamed from drivers/net/wireless/bcmdhd/src/include/wlioctl.h)593
-rw-r--r--drivers/net/wireless/bcmdhd/linux_osl.c (renamed from drivers/net/wireless/bcmdhd/src/shared/linux_osl.c)344
-rw-r--r--drivers/net/wireless/bcmdhd/sbutils.c (renamed from drivers/net/wireless/bcmdhd/src/shared/sbutils.c)10
-rw-r--r--drivers/net/wireless/bcmdhd/siutils.c (renamed from drivers/net/wireless/bcmdhd/src/shared/siutils.c)152
-rw-r--r--drivers/net/wireless/bcmdhd/siutils_priv.h (renamed from drivers/net/wireless/bcmdhd/src/shared/siutils_priv.h)12
-rw-r--r--drivers/net/wireless/bcmdhd/src/include/bcmdevs.h481
-rwxr-xr-xdrivers/net/wireless/bcmdhd/src/include/proto/802.11.h2240
-rw-r--r--drivers/net/wireless/bcmdhd/src/include/proto/bcmevent.h311
-rw-r--r--drivers/net/wireless/bcmdhd/src/include/proto/p2p.h564
-rw-r--r--drivers/net/wireless/bcmdhd/src/include/sbhnddma.h370
-rw-r--r--drivers/net/wireless/bcmdhd/src/wl/sys/wl_roam.c124
-rw-r--r--drivers/net/wireless/bcmdhd/uamp_api.h (renamed from drivers/net/wireless/bcmdhd/src/wl/sys/uamp_api.h)8
-rw-r--r--drivers/net/wireless/bcmdhd/wl_android.c (renamed from drivers/net/wireless/bcmdhd/src/wl/sys/wl_android.c)1181
-rw-r--r--drivers/net/wireless/bcmdhd/wl_android.h (renamed from drivers/net/wireless/bcmdhd/src/wl/sys/wl_android.h)8
-rw-r--r--drivers/net/wireless/bcmdhd/wl_cfg80211.c (renamed from drivers/net/wireless/bcmdhd/src/wl/sys/wl_cfg80211.c)4292
-rw-r--r--drivers/net/wireless/bcmdhd/wl_cfg80211.h (renamed from drivers/net/wireless/bcmdhd/src/wl/sys/wl_cfg80211.h)274
-rw-r--r--drivers/net/wireless/bcmdhd/wl_cfgp2p.c (renamed from drivers/net/wireless/bcmdhd/src/wl/sys/wl_cfgp2p.c)674
-rw-r--r--drivers/net/wireless/bcmdhd/wl_cfgp2p.h (renamed from drivers/net/wireless/bcmdhd/src/wl/sys/wl_cfgp2p.h)87
-rw-r--r--drivers/net/wireless/bcmdhd/wl_dbg.h (renamed from drivers/net/wireless/bcmdhd/src/wl/sys/wl_dbg.h)12
-rw-r--r--drivers/net/wireless/bcmdhd/wl_iw.c (renamed from drivers/net/wireless/bcmdhd/src/wl/sys/wl_iw.c)625
-rw-r--r--drivers/net/wireless/bcmdhd/wl_iw.h (renamed from drivers/net/wireless/bcmdhd/src/wl/sys/wl_iw.h)61
-rw-r--r--drivers/net/wireless/bcmdhd/wl_linux_mon.c (renamed from drivers/net/wireless/bcmdhd/src/wl/sys/wl_linux_mon.c)25
-rw-r--r--drivers/net/wireless/bcmdhd/wl_roam.c288
-rw-r--r--drivers/net/wireless/bcmdhd/wldev_common.c (renamed from drivers/net/wireless/bcmdhd/src/wl/sys/wldev_common.c)60
-rw-r--r--drivers/net/wireless/bcmdhd/wldev_common.h (renamed from drivers/net/wireless/bcmdhd/src/wl/sys/wldev_common.h)14
127 files changed, 20789 insertions, 10924 deletions
diff --git a/drivers/net/wireless/bcmdhd/Kconfig b/drivers/net/wireless/bcmdhd/Kconfig
index 2ec5aa8..2f801f2 100644
--- a/drivers/net/wireless/bcmdhd/Kconfig
+++ b/drivers/net/wireless/bcmdhd/Kconfig
@@ -1,32 +1,65 @@
+config BCM4330
+ tristate "Broadcom 4330 wireless cards support"
+ depends on WLAN
+ ---help---
+ This module adds support for wireless adapters based on
+ Broadcom 4330 chipset.
config BCM4334
- tristate "---Broadcom WiFi Driver for 4334"
+ tristate "Broadcom 4334 wireless cards support"
depends on WLAN
---help---
- Select this option to build Broadcom wlan driver
+ This module adds support for wireless adapters based on
+ Broadcom 4334 chipset.
-config BCM4330
- tristate "---Broadcom WiFi Driver for 4330"
+config BCM43241
+ tristate "Broadcom 43241 wireless cards support"
depends on WLAN
---help---
- Select this option to build Broadcom wlan driver
+ This module adds support for wireless adapters based on
+ Broadcom 43241 chipset.
-config BCM43241
- tristate "---Broadcom WiFi Driver for 43241"
+config BCMDHD_FW_PATH
+ depends on WLAN
+ string "Firmware path"
+ default "/system/etc/firmware/fw_bcmdhd.bin"
+ ---help---
+ Path to the firmware file.
+
+config BCMDHD_NVRAM_PATH
depends on WLAN
+ string "NVRAM path"
+ default "/system/etc/wifi/bcmdhd.cal"
+ ---help---
+ Path to the calibration file.
+
+config BCMDHD_WEXT
+ bool "Enable WEXT support"
+ depends on BCMDHD && CFG80211 = n
+ select WIRELESS_EXT
+ select WEXT_PRIV
+ help
+ Enables WEXT support
+
+config DHD_USE_STATIC_BUF
+ bool "Enable memory preallocation"
+ depends on BCMDHD
+ default n
---help---
- Select this option to build Broadcom wlan driver
+ Use memory preallocated in platform
+
+config DHD_USE_SCHED_SCAN
+ bool "Use CFG80211 sched scan"
+ depends on BCMDHD && CFG80211
+ default n
+ ---help---
+ Use CFG80211 sched scan
config BROADCOM_WIFI_RESERVED_MEM
bool "BROADCOM Reserved memory for wifi device"
- depends on (BCM4330 || BCM4334 || BCM43241)
+ depends on (BCM4330 || BCM4334 || BCM43241)
---help---
- This is a configuration for broadcom WLAN driver.
-
-config WLAN_COUNTRY_CODE
- tristate "---Broadcom WiFi Driver for 5GH channel setting"
- depends on WLAN
- default n
+ This is a configuration for broadcom WLAN driver.
config WLAN_REGION_CODE
int "---Region codes for Broadcom WiFi Driver"
diff --git a/drivers/net/wireless/bcmdhd/Makefile b/drivers/net/wireless/bcmdhd/Makefile
index 48e5226..51115ab 100644
--- a/drivers/net/wireless/bcmdhd/Makefile
+++ b/drivers/net/wireless/bcmdhd/Makefile
@@ -1,112 +1,160 @@
# bcmdhd
-DHDCFLAGS = -Wall -Wstrict-prototypes -Dlinux -DBCMDRIVER \
- -DBCMDONGLEHOST -DUNRELEASEDCHIP -DBCMDMA32 -DWLBTAMP -DBCMFILEIMAGE \
- -DDHDTHREAD -DDHD_GPL -DDHD_SCHED -DDHD_DEBUG -DBDC \
- -DDHD_BCMEVENTS -DSHOW_EVENTS -DDONGLEOVERLAYS -DBCMDBG \
- -DCUSTOMER_HW_SAMSUNG -DOOB_INTR_ONLY \
+#####################
+# SDIO Basic feature
+#####################
+
+DHDCFLAGS = -Wall -Wstrict-prototypes -Dlinux -DLINUX -DBCMDRIVER \
+ -DBCMDONGLEHOST -DUNRELEASEDCHIP -DBCMDMA32 -DBCMFILEIMAGE \
+ -DDHDTHREAD -DBDC -DOOB_INTR_ONLY \
+ -DDHD_BCMEVENTS -DSHOW_EVENTS -DBCMDBG \
-DMMC_SDIO_ABORT -DBCMSDIO -DBCMLXSDMMC -DBCMPLATFORM_BUS -DWLP2P \
- -DNEW_COMPAT_WIRELESS -DWIFI_ACT_FRAME -DARP_OFFLOAD_SUPPORT \
+ -DWIFI_ACT_FRAME -DARP_OFFLOAD_SUPPORT \
-DKEEP_ALIVE -DCSCAN -DPKT_FILTER_SUPPORT \
-DEMBEDDED_PLATFORM -DPNO_SUPPORT
-# distinguish between the 43xx chip
-ifeq ($(CONFIG_BCM4334),m)
-DHDCFLAGS += -DBCM4334_CHIP -DHW_OOB -DBCM4334_CHECK_CHIP_REV
-DHDCFLAGS += -DUSE_CID_CHECK -DCONFIG_CONTROL_PM
-DHDCFLAGS += -DPROP_TXSTATUS
-DHDCFLAGS += -DVSDB -DHT40_GO
-DHDCFLAGS += -DWL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST
-DHDCFLAGS += -DDHD_USE_IDLECOUNT
-DHDCFLAGS += -DSUPPORT_AMPDU_MPDU_CMD
-DHDCFLAGS += -DVSDB_DYNAMIC_F2_BLKSIZE -DSDIO_F2_BLKSIZE=512 -DVSDB_F2_BLKSIZE=64
-endif
-ifeq ($(CONFIG_BCM4334),y)
-DHDCFLAGS += -DBCM4334_CHIP -DHW_OOB -DBCM4334_CHECK_CHIP_REV
-DHDCFLAGS += -DUSE_CID_CHECK -DCONFIG_CONTROL_PM
-DHDCFLAGS += -DPROP_TXSTATUS
-DHDCFLAGS += -DVSDB -DHT40_GO
-DHDCFLAGS += -DWL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST
-DHDCFLAGS += -DDHD_USE_IDLECOUNT
-DHDCFLAGS += -DSUPPORT_AMPDU_MPDU_CMD
-DHDCFLAGS += -DVSDB_DYNAMIC_F2_BLKSIZE -DSDIO_F2_BLKSIZE=512 -DVSDB_F2_BLKSIZE=64
-endif
-ifeq ($(CONFIG_BCM4330),m)
-DHDCFLAGS += -DBCM4330_CHIP
-DHDCFLAGS += -DMCAST_LIST_ACCUMULATION
-DHDCFLAGS += -DCONFIG_CONTROL_PM
-DHDCFLAGS += -DROAM_ENABLE -DROAM_API -DROAM_CHANNEL_CACHE
-endif
-
-ifeq ($(CONFIG_BCM4330),y)
-DHDCFLAGS += -DBCM4330_CHIP
-DHDCFLAGS += -DMCAST_LIST_ACCUMULATION
-DHDCFLAGS += -DCONFIG_CONTROL_PM
-DHDCFLAGS += -DROAM_ENABLE -DROAM_API -DROAM_CHANNEL_CACHE
-endif
-ifeq ($(CONFIG_BCM43241),m)
-DHDCFLAGS += -DBCM43241_CHIP -DHW_OOB
-DHDCFLAGS += -DMCAST_LIST_ACCUMULATION
-DHDCFLAGS += -DMIMO_ANT_SETTING -DCONFIG_CONTROL_PM
-DHDCFLAGS += -fno-pic
-endif
-ifeq ($(CONFIG_BCM43241),y)
-DHDCFLAGS += -DBCM43241_CHIP -DHW_OOB
-DHDCFLAGS += -DMCAST_LIST_ACCUMULATION
-DHDCFLAGS += -DMIMO_ANT_SETTING -DCONFIG_CONTROL_PM
-endif
+#################
+# Common feature
+#################
+
+DHDCFLAGS += -DCUSTOMER_HW4
+DHDCFLAGS += -DBLOCK_IPV6_PACKET -DPASS_IPV4_SUSPEND
+DHDCFLAGS += -DSUPPORT_DEEP_SLEEP
+DHDCFLAGS += -DSIMPLE_MAC_PRINT
# For p2p connection issue
DHDCFLAGS += -DWL_CFG80211_GON_COLLISION
-DHDCFLAGS += -DWL_CFG80211_SYNC_GON_TIME
-#end p2p connection
+DHDCFLAGS += -DWL_SCB_TIMEOUT=10
# For Passing all multicast packets to host when not in suspend mode.
DHDCFLAGS += -DPASS_ALL_MCAST_PKTS
-#For INITIAL 2G scan features
-#select only one from USE_INIITAL_2G_SCAN and INITIAL_2G_SCAN_ORG
-
-#DHDCFLAGS += -DUSE_INITIAL_2G_SCAN
-DHDCFLAGS += -DUSE_INITIAL_2G_SCAN_ORG
+# Early suspend
+DHDCFLAGS += -DDHD_USE_EARLYSUSPEND
-DHDCFLAGS +=-DINITIAL_2G_SCAN_BY_ESCAN
+DHDCFLAGS += -DSUPPORT_PM2_ONLY
# For Scan result patch
DHDCFLAGS += -DESCAN_RESULT_PATCH
-
-ifeq ($(CONFIG_MACH_SAMSUNG_T1),y)
-DHDCFLAGS += -DUSE_CID_CHECK -DWRITE_MACADDR
-endif
-
-ifeq ($(CONFIG_MACH_U1_NA_SPR),y)
-DHDCFLAGS += -DRDWR_MACADDR
-endif
+DHDCFLAGS += -DDUAL_ESCAN_RESULT_BUFFER
DHDCFLAGS += -DROAM_ENABLE -DROAM_CHANNEL_CACHE -DROAM_API
+DHDCFLAGS += -DDISABLE_FW_ROAM_SUSPEND
# For Static Buffer
ifeq ($(CONFIG_BROADCOM_WIFI_RESERVED_MEM),y)
-DHDCFLAGS += -DCONFIG_DHD_USE_STATIC_BUF
+ DHDCFLAGS += -DCONFIG_DHD_USE_STATIC_BUF
+ DHDCFLAGS += -DENHANCED_STATIC_BUF
+ DHDCFLAGS += -DSTATIC_WL_PRIV_STRUCT
endif
# For CCX
ifeq ($(CONFIG_BRCM_CCX),y)
-DHDCFLAGS += -DBCMCCX
+ DHDCFLAGS += -DBCMCCX
endif
-# For SLP feature
-ifeq ($(CONFIG_SLP),y)
-DHDCFLAGS += -DSLP_PATH -DWRITE_MACADDR -DCUSTOMER_HW_SLP
+DHDCFLAGS += -DWL_CFG80211
+
+# SoftAP
+DHDCFLAGS += -DSUPPORT_AUTO_CHANNEL -DSUPPORT_HIDDEN_AP
+DHDCFLAGS += -DSUPPORT_SOFTAP_SINGL_DISASSOC
+DHDCFLAGS += -DUSE_STAMAC_4SOFTAP
+
+# DPC priority
+DHDCFLAGS += -DCUSTOM_DPC_PRIO_SETTING=98
+
+# WiFi turn off delay
+DHDCFLAGS += -DWIFI_TURNOFF_DELAY=100
+
+# WiFi Kernel thread type
+DHDCFLAGS += -DUSE_KTHREAD_API
+
+############
+# JellyBean
+############
+DHDCFLAGS += -DWL_ENABLE_P2P_IF
+DHDCFLAGS += -DMULTIPLE_SUPPLICANT
+DHDCFLAGS += -DWL_CFG80211_STA_EVENT
+
+#########################
+# Chip dependent feature
+#########################
+
+ifneq ($(CONFIG_BCM4334),)
+ DHDCFLAGS += -DBCM4334_CHIP -DHW_OOB -DSUPPORT_MULTIPLE_REVISION
+ DHDCFLAGS += -DUSE_CID_CHECK -DCONFIG_CONTROL_PM
+ DHDCFLAGS += -DPROP_TXSTATUS
+ DHDCFLAGS += -DVSDB -DHT40_GO
+ DHDCFLAGS += -DWL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST
+ DHDCFLAGS += -DDHD_USE_IDLECOUNT
+ DHDCFLAGS += -DSUPPORT_AMPDU_MPDU_CMD
+ DHDCFLAGS += -DVSDB_DYNAMIC_F2_BLKSIZE -DSDIO_F2_BLKSIZE=512 -DVSDB_F2_BLKSIZE=64
+ DHDCFLAGS += -DCUSTOM_GLOM_SETTING=5 -DENABLE_BCN_LI_BCN_WAKEUP
+ifeq ($(CONFIG_MACH_M3_JPN_DCM),y)
+ DHDCFLAGS += -DUSE_WEP_AUTH_SHARED_OPEN
+endif
+ DHDCFLAGS += -DROAM_AP_ENV_DETECTION
+ DHDCFLAGS += -DWES_SUPPORT
+ DHDCFLAGS += -DWL11U
endif
-# 5GHz channels setting
-ifeq ($(CONFIG_WLAN_COUNTRY_CODE),y)
-DHDCFLAGS += -DGLOBALCONFIG_WLAN_COUNTRY_CODE
+ifneq ($(CONFIG_BCM4330),)
+ DHDCFLAGS += -DBCM4330_CHIP
+ DHDCFLAGS += -DMCAST_LIST_ACCUMULATION
+ DHDCFLAGS += -DCONFIG_CONTROL_PM
+ DHDCFLAGS += -DCUSTOM_GLOM_SETTING=0
+ DHDCFLAGS += -DPASS_ARP_PACKET
endif
-# For ICS SEC Features
-ifneq ($(findstring GlobalConfig, $(wildcard $(srctree)/include/sec_feature/*)),)
-DHDCFLAGS += -DUSE_SECFEATURE
+ifneq ($(CONFIG_BCM43241),)
+ DHDCFLAGS += -DBCM43241_CHIP -DHW_OOB
+ DHDCFLAGS += -DMCAST_LIST_ACCUMULATION
+ DHDCFLAGS += -DMIMO_ANT_SETTING -DCONFIG_CONTROL_PM
+ DHDCFLAGS += -DAMPDU_HOSTREORDER -DDHD_USE_IDLECOUNT
+ DHDCFLAGS += -DCUSTOM_GLOM_SETTING=1
+ DHDCFLAGS += -DPROP_TXSTATUS
+ DHDCFLAGS += -DVSDB -DHT40_GO
+ DHDCFLAGS += -DWL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST
+ DHDCFLAGS += -DSUPPORT_AMPDU_MPDU_CMD
+ DHDCFLAGS += -DROAM_AP_ENV_DETECTION
+ ifeq ($(CONFIG_BCM43241),m)
+ DHDCFLAGS += -fno-pic
+ endif
+endif
+
+
+#############################
+# Platform dependent feature
+#############################
+
+ifeq ($(CONFIG_SPI_SC8810),y)
+DHDCFLAGS += -DREAD_MACADDR -DBCMSPI -DBCMSPI_ANDROID -DSPI_PIO_32BIT_RW -DSPI_PIO_RW_BIGENDIAN -DDISABLE_11N
+
+#Remove defines for SDMMC
+DHDCFLAGS :=$(filter-out -DOOB_INTR_ONLY,$(DHDCFLAGS))
+DHDCFLAGS :=$(filter-out -DBCMLXSDMMC,$(DHDCFLAGS))
+
+#Remove defines for JB
+DHDCFLAGS :=$(filter-out -DWL_ENABLE_P2P_IF,$(DHDCFLAGS))
+DHDCFLAGS :=$(filter-out -DMULTIPLE_SUPPLICANT,$(DHDCFLAGS))
+DHDCFLAGS :=$(filter-out -DWL_CFG80211_STA_EVENT,$(DHDCFLAGS))
+endif
+
+#For INITIAL 2G scan features
+ifneq ($(CONFIG_TARGET_LOCALE_KOR),y)
+ DHDCFLAGS += -DUSE_INITIAL_2G_SCAN
+endif
+
+# For SLP feature
+ifeq ($(CONFIG_SLP),y)
+ DHDCFLAGS += -DPLATFORM_SLP
+ DHDCFLAGS += -UWL_ENABLE_P2P_IF
+ DHDCFLAGS += -UMULTIPLE_SUPPLICANT
+ DHDCFLAGS += -UWL_CFG80211_STA_EVENT
+endif
+
+# GGSM_WIFI_5GHz_CHANNELS feature is define for only GGSM model
+ifeq ($(GGSM_WIFI_5GHz_CHANNELS),true)
+ DHDCFLAGS += -DCUSTOMER_SET_COUNTRY
endif
##############################################################
@@ -140,65 +188,40 @@ DHDCFLAGS += -DWLAN_REGION_CODE=$(REGION_CODE)
##############################################################
-# For Debug
-EXTRA_CFLAGS += $(DHDCFLAGS) -DWL_CFG80211 -DRSSI_OFFSET=0
-EXTRA_CFLAGS += -DDHD_DEBUG -DSRCBASE=\"$(src)/src\"
-
-EXTRA_CFLAGS += -I$(src)/src/include/
-EXTRA_CFLAGS += -I$(src)/src/dhd/sys/
-EXTRA_CFLAGS += -I$(src)/src/dongle/
-EXTRA_CFLAGS += -I$(src)/src/bcmsdio/sys/
-EXTRA_CFLAGS += -I$(src)/src/wl/sys/
-EXTRA_CFLAGS += -I$(src)/src/shared/
-EXTRA_CFLAGS += -I$(src)/src/wl/bcmwifi/src/
-EXTRA_CFLAGS += -I$(src)/src/wl/bcmwifi/include/
+#########
+# Others
+#########
-ifeq ($(CONFIG_MACH_T0), y)
#EXTRA_LDFLAGS += --strip-debug
-else
-EXTRA_LDFLAGS += --strip-debug
-endif
+
+EXTRA_CFLAGS += $(DHDCFLAGS) -DDHD_DEBUG
+EXTRA_CFLAGS += -DSRCBASE=\"$(src)\"
+EXTRA_CFLAGS += -I$(src)/include/ -I$(src)/
KBUILD_CFLAGS += -I$(LINUXDIR)/include -I$(shell pwd)
-obj-m += dhd.o
+DHDOFILES := bcmsdh.o bcmsdh_linux.o bcmsdh_sdmmc.o bcmsdh_sdmmc_linux.o \
+ dhd_cdc.o dhd_common.o dhd_custom_gpio.o dhd_custom_sec.o \
+ dhd_linux.o dhd_linux_sched.o dhd_cfg80211.o dhd_sdio.o aiutils.o bcmevent.o \
+ bcmutils.o bcmwifi_channels.o hndpmu.o linux_osl.o sbutils.o siutils.o \
+ wl_android.o wl_cfg80211.o wl_cfgp2p.o wldev_common.o wl_linux_mon.o wl_roam.o
-dhd-y := src/bcmsdio/sys/bcmsdh.o src/bcmsdio/sys/bcmsdh_linux.o \
- src/bcmsdio/sys/bcmsdh_sdmmc.o src/bcmsdio/sys/bcmsdh_sdmmc_linux.o \
- src/dhd/sys/dhd_bta.o src/dhd/sys/dhd_cdc.o \
- src/dhd/sys/dhd_common.o src/dhd/sys/dhd_custom_gpio.o \
- src/dhd/sys/dhd_custom_sec.o \
- src/dhd/sys/dhd_linux.o src/dhd/sys/dhd_linux_sched.o \
- src/dhd/sys/dhd_cfg80211.o src/dhd/sys/dhd_sdio.o \
- src/shared/aiutils.o src/shared/bcmevent.o \
- src/shared/bcmutils.o src/wl/bcmwifi/src/bcmwifi_channels.o \
- src/shared/hndpmu.o src/shared/linux_osl.o \
- src/shared/sbutils.o src/shared/siutils.o \
- src/wl/sys/wl_android.o src/wl/sys/wl_cfg80211.o \
- src/wl/sys/wl_cfgp2p.o src/wl/sys/wldev_common.o \
- src/wl/sys/wl_linux_mon.o src/wl/sys/wl_roam.o
+# For SPI projects
+ifeq ($(CONFIG_SPI_SC8810),y)
+DHDOFILES += bcmsdspi_linux.o bcmspibrcm.o
+DHDOFILES :=$(filter-out bcmsdh_sdmmc.o,$(DHDOFILES))
+DHDOFILES :=$(filter-out bcmsdh_sdmmc_linux.o,$(DHDOFILES))
+endif
+
+dhd-y := $(DHDOFILES)
+obj-m += dhd.o
all:
@echo "$(MAKE) --no-print-directory -C $(KDIR) SUBDIRS=$(CURDIR) modules"
- @$(MAKE) --no-print-directory -C $(KDIR) \
- SUBDIRS=$(CURDIR) modules
+ @$(MAKE) --no-print-directory -C $(KDIR) SUBDIRS=$(CURDIR) modules
clean:
- rm -rf *.o *.ko *.mod.c *~ .*.cmd \
- Module.symvers modules.order .tmp_versions modules.builtin \
- src/bcmsdio/sys/*.o \
- src/bcmsdio/sys/*.o.cmd \
- src/bcmsdio/sys/.*.o.cmd \
- src/dhd/sys/*.o \
- src/dhd/sys/*.o.cmd \
- src/dhd/sys/.*.o.cmd \
- src/shared/*.o \
- src/shared/*.o.cmd \
- src/shared/.*.o.cmd \
- src/wl/sys/*.o \
- src/wl/sys/*.o.cmd \
- src/wl/sys/.*.o.cmd \
- src/wl/bcmwifi/src/bcmwifi_channels.o \
- src/wl/bcmwifi/src/.*.o.cmd
+ rm -rf *.o *.ko *.mod.c *~ .*.cmd *.o.cmd .*.o.cmd \
+ Module.symvers modules.order .tmp_versions modules.builtin
install:
@$(MAKE) --no-print-directory -C $(KDIR) \
diff --git a/drivers/net/wireless/bcmdhd/src/shared/aiutils.c b/drivers/net/wireless/bcmdhd/aiutils.c
index 69faeac..3ca1725 100644
--- a/drivers/net/wireless/bcmdhd/src/shared/aiutils.c
+++ b/drivers/net/wireless/bcmdhd/aiutils.c
@@ -2,14 +2,14 @@
* Misc utility routines for accessing chip-specific features
* of the SiliconBackplane-based Broadcom chips.
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -17,12 +17,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: aiutils.c 300516 2011-12-04 17:39:44Z $
+ * $Id: aiutils.c 347614 2012-07-27 10:24:51Z $
*/
#include <bcm_cfg.h>
#include <typedefs.h>
@@ -87,7 +87,7 @@ get_asd(si_t *sih, uint32 **eromptr, uint sp, uint ad, uint st, uint32 *addrl, u
if (((asd & ER_TAG1) != ER_ADD) ||
(((asd & AD_SP_MASK) >> AD_SP_SHIFT) != sp) ||
((asd & AD_ST_MASK) != st)) {
-
+
(*eromptr)--;
return 0;
}
@@ -134,10 +134,10 @@ ai_scan(si_t *sih, void *regs, uint devid)
break;
case PCI_BUS:
-
+
sii->curwrap = (void *)((uintptr)regs + SI_CORE_SIZE);
-
+
OSL_PCI_WRITE_CONFIG(sii->osh, PCI_BAR0_WIN, 4, erombase);
eromptr = regs;
break;
@@ -165,7 +165,7 @@ ai_scan(si_t *sih, void *regs, uint devid)
br = FALSE;
-
+
cia = get_erom_ent(sih, &eromptr, ER_TAG, ER_CI);
if (cia == (ER_END | ER_VALID)) {
SI_VMSG(("Found END of erom after %d cores\n", sii->numcores));
@@ -199,7 +199,7 @@ ai_scan(si_t *sih, void *regs, uint devid)
if (((mfg == MFGID_ARM) && (cid == DEF_AI_COMP)) || (nsp == 0))
continue;
if ((nmw + nsw == 0)) {
-
+
if (cid == OOB_ROUTER_CORE_ID) {
asd = get_asd(sih, &eromptr, 0, 0, AD_ST_SLAVE,
&addrl, &addrh, &sizel, &sizeh);
@@ -228,24 +228,34 @@ ai_scan(si_t *sih, void *regs, uint devid)
(mpd & MPD_MUI_MASK) >> MPD_MUI_SHIFT));
}
-
+
asd = get_asd(sih, &eromptr, 0, 0, AD_ST_SLAVE, &addrl, &addrh, &sizel, &sizeh);
if (asd == 0) {
-
+ do {
+
asd = get_asd(sih, &eromptr, 0, 0, AD_ST_BRIDGE, &addrl, &addrh,
&sizel, &sizeh);
if (asd != 0)
br = TRUE;
- else
- if ((addrh != 0) || (sizeh != 0) || (sizel != SI_CORE_SIZE)) {
- SI_ERROR(("First Slave ASD for core 0x%04x malformed "
+ else {
+ if (br == TRUE) {
+ break;
+ }
+ else if ((addrh != 0) || (sizeh != 0) ||
+ (sizel != SI_CORE_SIZE)) {
+ SI_ERROR(("addrh = 0x%x\t sizeh = 0x%x\t size1 ="
+ "0x%x\n", addrh, sizeh, sizel));
+ SI_ERROR(("First Slave ASD for"
+ "core 0x%04x malformed "
"(0x%08x)\n", cid, asd));
goto error;
}
}
+ } while (1);
+ }
sii->coresba[idx] = addrl;
sii->coresba_size[idx] = sizel;
-
+
j = 1;
do {
asd = get_asd(sih, &eromptr, 0, j, AD_ST_SLAVE, &addrl, &addrh,
@@ -257,7 +267,7 @@ ai_scan(si_t *sih, void *regs, uint devid)
j++;
} while (asd != 0);
-
+
for (i = 1; i < nsp; i++) {
j = 0;
do {
@@ -274,7 +284,7 @@ ai_scan(si_t *sih, void *regs, uint devid)
}
}
-
+
for (i = 0; i < nmw; i++) {
asd = get_asd(sih, &eromptr, i, 0, AD_ST_MWRAP, &addrl, &addrh,
&sizel, &sizeh);
@@ -290,7 +300,7 @@ ai_scan(si_t *sih, void *regs, uint devid)
sii->wrapba[idx] = addrl;
}
-
+
for (i = 0; i < nsw; i++) {
uint fwp = (nsp == 1) ? 0 : 1;
asd = get_asd(sih, &eromptr, fwp + i, 0, AD_ST_SWRAP, &addrl, &addrh,
@@ -308,11 +318,11 @@ ai_scan(si_t *sih, void *regs, uint devid)
}
-
+
if (br)
continue;
-
+
sii->numcores++;
}
@@ -337,12 +347,12 @@ ai_setcoreidx(si_t *sih, uint coreidx)
addr = sii->coresba[coreidx];
wrap = sii->wrapba[coreidx];
-
+
ASSERT((sii->intrsenabled_fn == NULL) || !(*(sii)->intrsenabled_fn)((sii)->intr_arg));
switch (BUSTYPE(sih->bustype)) {
case SI_BUS:
-
+
if (!sii->regs[coreidx]) {
sii->regs[coreidx] = REG_MAP(addr, SI_CORE_SIZE);
ASSERT(GOODREGS(sii->regs[coreidx]));
@@ -405,7 +415,7 @@ ai_coreaddrspaceX(si_t *sih, uint asidx, uint32 *addr, uint32 *size)
nmp = (cib & CIB_NMP_MASK) >> CIB_NMP_SHIFT;
nsp = (cib & CIB_NSP_MASK) >> CIB_NSP_SHIFT;
-
+
while (eromptr < eromlim) {
if ((get_erom_ent(sih, &eromptr, ER_TAG, ER_CI) == cia) &&
(get_erom_ent(sih, &eromptr, 0, 0) == cib)) {
@@ -413,14 +423,14 @@ ai_coreaddrspaceX(si_t *sih, uint asidx, uint32 *addr, uint32 *size)
}
}
-
+
for (i = 0; i < nmp; i++)
get_erom_ent(sih, &eromptr, ER_VALID, ER_VALID);
-
+
asd = get_asd(sih, &eromptr, 0, 0, AD_ST_SLAVE, &addrl, &addrh, &sizel, &sizeh);
if (asd == 0) {
-
+
asd = get_asd(sih, &eromptr, 0, 0, AD_ST_BRIDGE, &addrl, &addrh,
&sizel, &sizeh);
}
@@ -432,7 +442,7 @@ ai_coreaddrspaceX(si_t *sih, uint asidx, uint32 *addr, uint32 *size)
j++;
} while (asd != 0);
-
+
for (i = 1; i < nsp; i++) {
j = 0;
do {
@@ -606,9 +616,9 @@ ai_corereg(si_t *sih, uint coreidx, uint regoff, uint mask, uint val)
return 0;
if (BUSTYPE(sih->bustype) == SI_BUS) {
-
+
fast = TRUE;
-
+
if (!sii->regs[coreidx]) {
sii->regs[coreidx] = REG_MAP(sii->coresba[coreidx],
SI_CORE_SIZE);
@@ -616,15 +626,15 @@ ai_corereg(si_t *sih, uint coreidx, uint regoff, uint mask, uint val)
}
r = (uint32 *)((uchar *)sii->regs[coreidx] + regoff);
} else if (BUSTYPE(sih->bustype) == PCI_BUS) {
-
+
if ((sii->coreid[coreidx] == CC_CORE_ID) && SI_FAST(sii)) {
-
+
fast = TRUE;
r = (uint32 *)((char *)sii->curmap + PCI_16KB0_CCREGS_OFFSET + regoff);
} else if (sii->pub.buscoreidx == coreidx) {
-
+
fast = TRUE;
if (SI_FAST(sii))
r = (uint32 *)((char *)sii->curmap +
@@ -640,25 +650,25 @@ ai_corereg(si_t *sih, uint coreidx, uint regoff, uint mask, uint val)
if (!fast) {
INTR_OFF(sii, intr_val);
-
+
origidx = si_coreidx(&sii->pub);
-
+
r = (uint32*) ((uchar*) ai_setcoreidx(&sii->pub, coreidx) + regoff);
}
ASSERT(r != NULL);
-
+
if (mask || val) {
w = (R_REG(sii->osh, r) & ~mask) | val;
W_REG(sii->osh, r, w);
}
-
+
w = R_REG(sii->osh, r);
if (!fast) {
-
+
if (origidx != coreidx)
ai_setcoreidx(&sii->pub, origidx);
@@ -673,6 +683,7 @@ ai_core_disable(si_t *sih, uint32 bits)
{
si_info_t *sii;
volatile uint32 dummy;
+ uint32 status;
aidmp_t *ai;
sii = SI_INFO(sih);
@@ -680,10 +691,22 @@ ai_core_disable(si_t *sih, uint32 bits)
ASSERT(GOODREGS(sii->curwrap));
ai = sii->curwrap;
-
+
if (R_REG(sii->osh, &ai->resetctrl) & AIRC_RESET)
return;
+
+ SPINWAIT(((status = R_REG(sii->osh, &ai->resetstatus)) != 0), 300);
+
+
+ if (status != 0) {
+
+
+ SPINWAIT(((status = R_REG(sii->osh, &ai->resetstatus)) != 0), 10000);
+
+
+ }
+
W_REG(sii->osh, &ai->ioctrl, bits);
dummy = R_REG(sii->osh, &ai->ioctrl);
BCM_REFERENCE(dummy);
@@ -707,10 +730,10 @@ ai_core_reset(si_t *sih, uint32 bits, uint32 resetbits)
ASSERT(GOODREGS(sii->curwrap));
ai = sii->curwrap;
-
+
ai_core_disable(sih, (bits | resetbits));
-
+
W_REG(sii->osh, &ai->ioctrl, (bits | SICF_FGC | SICF_CLOCK_EN));
dummy = R_REG(sii->osh, &ai->ioctrl);
BCM_REFERENCE(dummy);
diff --git a/drivers/net/wireless/bcmdhd/src/shared/bcmevent.c b/drivers/net/wireless/bcmdhd/bcmevent.c
index cc7ad16..e41c738 100644
--- a/drivers/net/wireless/bcmdhd/src/shared/bcmevent.c
+++ b/drivers/net/wireless/bcmdhd/bcmevent.c
@@ -1,14 +1,14 @@
/*
* bcmevent read-only data shared by kernel or app layers
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,11 +16,11 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
- * $Id: bcmevent.c 300516 2011-12-04 17:39:44Z $
+ * $Id: bcmevent.c 327460 2012-04-13 18:38:41Z $
*/
#include <typedefs.h>
@@ -29,7 +29,7 @@
#include <proto/bcmeth.h>
#include <proto/bcmevent.h>
-#if WLC_E_LAST != 92
+#if WLC_E_LAST != 94
#error "You need to add an entry to bcmevent_names[] for the new event"
#endif
@@ -98,6 +98,18 @@ const bcmevent_name_t bcmevent_names[] = {
{ WLC_E_ACTION_FRAME_RX, "ACTION_FRAME_RX" },
{ WLC_E_ACTION_FRAME_COMPLETE, "ACTION_FRAME_COMPLETE" },
#endif
+#if 0 && (NDISVER >= 0x0620)
+ { WLC_E_PRE_ASSOC_IND, "ASSOC_RECV" },
+ { WLC_E_PRE_REASSOC_IND, "REASSOC_RECV" },
+ { WLC_E_CHANNEL_ADOPTED, "CHANNEL_ADOPTED" },
+ { WLC_E_AP_STARTED, "AP_STARTED" },
+ { WLC_E_DFS_AP_STOP, "DFS_AP_STOP" },
+ { WLC_E_DFS_AP_RESUME, "DFS_AP_RESUME" },
+ { WLC_E_ASSOC_IND_NDIS, "ASSOC_IND_NDIS"},
+ { WLC_E_REASSOC_IND_NDIS, "REASSOC_IND_NDIS"},
+ { WLC_E_ACTION_FRAME_RX_NDIS, "WLC_E_ACTION_FRAME_RX_NDIS" },
+ { WLC_E_AUTH_REQ, "WLC_E_AUTH_REQ" },
+#endif
#ifdef BCMWAPI_WAI
{ WLC_E_WAI_STA_EVENT, "WAI_STA_EVENT" },
{ WLC_E_WAI_MSG, "WAI_MSG" },
@@ -127,7 +139,10 @@ const bcmevent_name_t bcmevent_names[] = {
#endif
{ WLC_E_ASSOC_REQ_IE, "ASSOC_REQ_IE" },
{ WLC_E_ASSOC_RESP_IE, "ASSOC_RESP_IE" },
- { WLC_E_ACTION_FRAME_RX_NDIS, "WLC_E_ACTION_FRAME_RX_NDIS" }
+ { WLC_E_ACTION_FRAME_RX_NDIS, "WLC_E_ACTION_FRAME_RX_NDIS" },
+#ifdef WLTDLS
+ { WLC_E_TDLS_PEER_EVENT, "TDLS_PEER_EVENT" },
+#endif /* WLTDLS */
};
const int bcmevent_names_size = ARRAYSIZE(bcmevent_names);
diff --git a/drivers/net/wireless/bcmdhd/src/bcmsdio/sys/bcmsdh.c b/drivers/net/wireless/bcmdhd/bcmsdh.c
index 768ca3b..2f7c451 100644
--- a/drivers/net/wireless/bcmdhd/src/bcmsdio/sys/bcmsdh.c
+++ b/drivers/net/wireless/bcmdhd/bcmsdh.c
@@ -2,14 +2,14 @@
* BCMSDH interface glue
* implement bcmsdh API for SDIOH driver
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -17,12 +17,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: bcmsdh.c 300445 2011-12-03 05:37:20Z $
+ * $Id: bcmsdh.c 347614 2012-07-27 10:24:51Z $
*/
/**
@@ -38,7 +38,6 @@
#include <hndsoc.h>
#include <siutils.h>
#include <osl.h>
-#include <dhd_sec_feature.h>
#include <bcmsdh.h> /* BRCM API for SDIO clients (such as wl, dhd) */
#include <bcmsdbus.h> /* common SDIO/controller interface */
@@ -46,6 +45,8 @@
#include <sdio.h> /* SDIO Device and Protocol Specs */
+#include <dhd_sec_feature.h>
+
#define SDIOH_API_ACCESS_RETRY_LIMIT 2
const uint bcmsdh_msglevel = BCMSDH_ERROR_VAL;
@@ -363,9 +364,10 @@ bcmsdh_cis_read(void *sdh, uint func, uint8 *cis, uint length)
}
bcopy(cis, tmp_buf, length);
for (tmp_ptr = tmp_buf, ptr = cis; ptr < (cis + length - 4); tmp_ptr++) {
- ptr += sprintf((char*)ptr, "%.2x ", *tmp_ptr & 0xff);
+ ptr += snprintf((char*)ptr, (cis + length - ptr - 4),
+ "%.2x ", *tmp_ptr & 0xff);
if ((((tmp_ptr - tmp_buf) + 1) & 0xf) == 0)
- ptr += sprintf((char *)ptr, "\n");
+ ptr += snprintf((char *)ptr, (cis + length - ptr -4), "\n");
}
MFREE(bcmsdh->osh, tmp_buf, length);
}
@@ -620,6 +622,17 @@ bcmsdh_waitlockfree(void *sdh)
}
+#ifdef BCMSPI /* 4329 gSPI won't have CIS reads. */
+int
+bcmsdh_query_device(void *sdh)
+{
+ bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
+
+ bcmsdh->vendevid = (VENDOR_BROADCOM << 16) | BCM4321_D11N2G_ID;
+
+ return (bcmsdh->vendevid);
+}
+#else
int
bcmsdh_query_device(void *sdh)
{
@@ -627,6 +640,7 @@ bcmsdh_query_device(void *sdh)
bcmsdh->vendevid = (VENDOR_BROADCOM << 16) | 0;
return (bcmsdh->vendevid);
}
+#endif /* else BCMSPI */
uint
bcmsdh_query_iofnum(void *sdh)
@@ -657,7 +671,13 @@ void *bcmsdh_get_sdioh(bcmsdh_info_t *sdh)
uint32
bcmsdh_get_dstatus(void *sdh)
{
+#ifdef BCMSPI
+ bcmsdh_info_t *p = (bcmsdh_info_t *)sdh;
+ sdioh_info_t *sd = (sdioh_info_t *)(p->sdioh);
+ return sdioh_get_dstatus(sd);
+#else
return 0;
+#endif /* BCMSPI */
}
uint32
bcmsdh_cur_sbwad(void *sdh)
@@ -673,9 +693,25 @@ bcmsdh_cur_sbwad(void *sdh)
void
bcmsdh_chipinfo(void *sdh, uint32 chip, uint32 chiprev)
{
+#ifdef BCMSPI
+ bcmsdh_info_t *p = (bcmsdh_info_t *)sdh;
+ sdioh_info_t *sd = (sdioh_info_t *)(p->sdioh);
+ sdioh_chipinfo(sd, chip, chiprev);
+#else
return;
+#endif /* BCMSPI */
}
+#ifdef BCMSPI
+void
+bcmsdh_dwordmode(void *sdh, bool set)
+{
+ bcmsdh_info_t *p = (bcmsdh_info_t *)sdh;
+ sdioh_info_t *sd = (sdioh_info_t *)(p->sdioh);
+ sdioh_dwordmode(sd, set);
+ return;
+}
+#endif /* BCMSPI */
int
bcmsdh_sleep(void *sdh, bool enab)
@@ -725,3 +761,32 @@ bcmsdh_gpioout(void *sdh, uint32 gpio, bool enab)
return sdioh_gpioout(sd, gpio, enab);
}
+
+#ifdef BCMSDIOH_TXGLOM
+void
+bcmsdh_glom_post(void *sdh, uint8 *frame, uint len)
+{
+ bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
+ sdioh_glom_post(bcmsdh->sdioh, frame, len);
+}
+
+void
+bcmsdh_glom_clear(void *sdh)
+{
+ bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
+ sdioh_glom_clear(bcmsdh->sdioh);
+}
+
+uint
+bcmsdh_set_mode(void *sdh, uint mode)
+{
+ bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
+ return (sdioh_set_mode(bcmsdh->sdioh, mode));
+}
+
+bool
+bcmsdh_glom_enabled(void)
+{
+ return (sdioh_glom_enabled());
+}
+#endif /* BCMSDIOH_TXGLOM */
diff --git a/drivers/net/wireless/bcmdhd/src/bcmsdio/sys/bcmsdh_linux.c b/drivers/net/wireless/bcmdhd/bcmsdh_linux.c
index 400397e..cd62e4b 100644
--- a/drivers/net/wireless/bcmdhd/src/bcmsdio/sys/bcmsdh_linux.c
+++ b/drivers/net/wireless/bcmdhd/bcmsdh_linux.c
@@ -1,14 +1,14 @@
/*
* SDIO access interface for drivers - linux specific (pci only)
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,12 +16,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: bcmsdh_linux.c 294990 2011-11-09 00:13:10Z $
+ * $Id: bcmsdh_linux.c 347638 2012-07-27 11:39:03Z $
*/
/**
@@ -41,18 +41,19 @@
#include <bcmdefs.h>
#include <bcmdevs.h>
-#if defined(OOB_INTR_ONLY)
+#if defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID)
#include <linux/irq.h>
extern void dhdsdio_isr(void * args);
#include <bcmutils.h>
#include <dngl_stats.h>
#include <dhd.h>
-#endif /* defined(OOB_INTR_ONLY) */
+#endif /* defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID) */
-#if defined(CONFIG_PM_SLEEP) && defined(CUSTOMER_HW_SLP)
-/*SLP_wakelock_alternative_code*/
+#if defined(CUSTOMER_HW4) && defined(CONFIG_PM_SLEEP) && defined(PLATFORM_SLP)
+/* SLP_wakelock_alternative_code */
struct device *pm_dev;
-#endif /* CONFIG_PM_SLEEP && CUSTOMER_HW_SLP */
+#endif /* CUSTOMER_HW4 && CONFIG_PM_SLEEP && PLATFORM_SLP */
+
/**
* SDIO Host Controller info
*/
@@ -73,9 +74,9 @@ struct bcmsdh_hc {
unsigned long oob_flags; /* OOB Host specifiction as edge and etc */
bool oob_irq_registered;
bool oob_irq_enable_flag;
-#if defined(OOB_INTR_ONLY)
+#if defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID)
spinlock_t irq_lock;
-#endif
+#endif /* defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID) */
};
static bcmsdh_hc_t *sdhcinfo = NULL;
@@ -136,7 +137,7 @@ bcmsdh_chipmatch(uint16 vendor, uint16 device)
}
#if defined(BCMPLATFORM_BUS)
-#if defined(BCMLXSDMMC)
+#if defined(BCMLXSDMMC) || defined(BCMSPI_ANDROID)
/* forward declarations */
int bcmsdh_probe(struct device *dev);
int bcmsdh_remove(struct device *dev);
@@ -148,37 +149,37 @@ EXPORT_SYMBOL(bcmsdh_remove);
/* forward declarations */
static int __devinit bcmsdh_probe(struct device *dev);
static int __devexit bcmsdh_remove(struct device *dev);
-#endif /* BCMLXSDMMC */
+#endif /* defined(BCMLXSDMMC) || defined(BCMSPI_ANDROID) */
-#ifndef BCMLXSDMMC
+#if !defined(BCMLXSDMMC) && !defined(BCMSPI_ANDROID)
static
-#endif /* BCMLXSDMMC */
+#endif /* !defined(BCMLXSDMMC) && !defined(BCMSPI_ANDROID) */
int bcmsdh_probe(struct device *dev)
{
osl_t *osh = NULL;
bcmsdh_hc_t *sdhc = NULL;
ulong regs = 0;
bcmsdh_info_t *sdh = NULL;
-#if !defined(BCMLXSDMMC) && defined(BCMPLATFORM_BUS)
+#if !defined(BCMLXSDMMC) && defined(BCMPLATFORM_BUS) && !defined(BCMSPI_ANDROID)
struct platform_device *pdev;
struct resource *r;
-#endif /* BCMLXSDMMC */
+#endif /* !defined(BCMLXSDMMC) && defined(BCMPLATFORM_BUS) && !defined(BCMSPI_ANDROID) */
int irq = 0;
uint32 vendevid;
unsigned long irq_flags = 0;
-#if defined(CONFIG_PM_SLEEP) && defined(CUSTOMER_HW_SLP)
+#if defined(CUSTOMER_HW4) && defined(CONFIG_PM_SLEEP) && defined(PLATFORM_SLP)
int ret = 0;
-#endif /* CONFIG_PM_SLEEP && CUSTOMER_HW_SLP */
+#endif /* CUSTOMER_HW4 && CONFIG_PM_SLEEP && PLATFORM_SLP */
-#if !defined(BCMLXSDMMC) && defined(BCMPLATFORM_BUS)
+#if !defined(BCMLXSDMMC) && defined(BCMPLATFORM_BUS) && !defined(BCMSPI_ANDROID)
pdev = to_platform_device(dev);
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
irq = platform_get_irq(pdev, 0);
if (!r || irq == NO_IRQ)
return -ENXIO;
-#endif /* BCMLXSDMMC */
+#endif /* !defined(BCMLXSDMMC) && defined(BCMPLATFORM_BUS) && !defined(BCMSPI_ANDROID) */
-#if defined(OOB_INTR_ONLY)
+#if defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID)
#ifdef HW_OOB
irq_flags =
IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL | IORESOURCE_IRQ_SHAREABLE;
@@ -188,15 +189,11 @@ int bcmsdh_probe(struct device *dev)
/* Get customer specific OOB IRQ parametres: IRQ number as IRQ type */
irq = dhd_customer_oob_irq_map(&irq_flags);
-#if defined(BCMHOST)
- /* Do not disable this IRQ during suspend */
- irq_flags |= IRQF_NO_SUSPEND;
-#endif
if (irq < 0) {
SDLX_MSG(("%s: Host irq is not defined\n", __FUNCTION__));
return 1;
}
-#endif /* defined(OOB_INTR_ONLY) */
+#endif /* defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID) */
/* allocate SDIO Host Controller state info */
if (!(osh = osl_attach(dev, PCI_BUS, FALSE))) {
SDLX_MSG(("%s: osl_attach failed\n", __FUNCTION__));
@@ -213,7 +210,7 @@ int bcmsdh_probe(struct device *dev)
sdhc->dev = (void *)dev;
-#ifdef BCMLXSDMMC
+#if defined(BCMLXSDMMC) || defined(BCMSPI_ANDROID)
if (!(sdh = bcmsdh_attach(osh, (void *)0,
(void **)&regs, irq))) {
SDLX_MSG(("%s: bcmsdh_attach failed\n", __FUNCTION__));
@@ -225,26 +222,27 @@ int bcmsdh_probe(struct device *dev)
SDLX_MSG(("%s: bcmsdh_attach failed\n", __FUNCTION__));
goto err;
}
-#endif /* BCMLXSDMMC */
+#endif /* defined(BCMLXSDMMC) || defined(BCMSPI_ANDROID) */
sdhc->sdh = sdh;
sdhc->oob_irq = irq;
sdhc->oob_flags = irq_flags;
sdhc->oob_irq_registered = FALSE; /* to make sure.. */
sdhc->oob_irq_enable_flag = FALSE;
-#if defined(OOB_INTR_ONLY)
+#if defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID)
spin_lock_init(&sdhc->irq_lock);
-#endif
+#endif /* defined(BCMLXSDMMC) || defined(BCMSPI_ANDROID) */
/* chain SDIO Host Controller info together */
sdhc->next = sdhcinfo;
sdhcinfo = sdhc;
-#if defined(CONFIG_PM_SLEEP) && defined(CUSTOMER_HW_SLP)
- /*SLP_wakelock_alternative_code*/
- pm_dev=sdhc->dev;
+#if defined(CUSTOMER_HW4) && defined(CONFIG_PM_SLEEP) && defined(PLATFORM_SLP)
+ /* SLP_wakelock_alternative_code */
+ pm_dev = sdhc->dev;
ret = device_init_wakeup(pm_dev, 1);
printf("%s : device_init_wakeup(pm_dev) enable, ret = %d\n", __func__, ret);
-#endif /* CONFIG_PM_SLEEP && CUSTOMER_HW_SLP */
+#endif /* CUSTOMER_HW4 && CONFIG_PM_SLEEP && PLATFORM_SLP */
+
/* Read the vendor/device ID from the CIS */
vendevid = bcmsdh_query_device(sdh);
/* try to attach to the target device */
@@ -269,20 +267,20 @@ err:
return -ENODEV;
}
-#ifndef BCMLXSDMMC
+#if !defined(BCMLXSDMMC) && !defined(BCMSPI_ANDROID)
static
-#endif /* BCMLXSDMMC */
+#endif /* !defined(BCMLXSDMMC) && !defined(BCMSPI_ANDROID) */
int bcmsdh_remove(struct device *dev)
{
bcmsdh_hc_t *sdhc, *prev;
osl_t *osh;
sdhc = sdhcinfo;
-#if defined(CONFIG_PM_SLEEP) && defined(CUSTOMER_HW_SLP)
- /*SLP_wakelock_alternative_code*/
+#if defined(CUSTOMER_HW4) && defined(CONFIG_PM_SLEEP) && defined(PLATFORM_SLP)
+ /* SLP_wakelock_alternative_code */
device_init_wakeup(pm_dev, 0);
printf("%s : device_init_wakeup(pm_dev) disable\n", __func__);
-#endif /* CONFIG_PM_SLEEP && CUSTOMER_HW_SLP */
+#endif /* CUSTOMER_HW4 && CONFIG_PM_SLEEP && PLATFORM_SLP */
drvinfo.detach(sdhc->ch);
bcmsdh_detach(sdhc->osh, sdhc->sdh);
@@ -307,9 +305,9 @@ int bcmsdh_remove(struct device *dev)
MFREE(osh, sdhc, sizeof(bcmsdh_hc_t));
osl_detach(osh);
-#if !defined(BCMLXSDMMC) || defined(OOB_INTR_ONLY)
+#if !defined(BCMLXSDMMC) || defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID)
dev_set_drvdata(dev, NULL);
-#endif /* !defined(BCMLXSDMMC) || defined(OOB_INTR_ONLY) */
+#endif /* !defined(BCMLXSDMMC) || defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID) */
return 0;
}
@@ -532,7 +530,11 @@ bcmsdh_pci_remove(struct pci_dev *pdev)
#endif /* BCMLXSDMMC */
#endif /* BCMPLATFORM_BUS */
+#ifdef BCMSPI_ANDROID
+extern int spi_function_init(void);
+#else
extern int sdio_function_init(void);
+#endif /* BCMSPI_ANDROID */
extern int sdio_func_reg_notify(void* semaphore);
extern void sdio_func_unreg_notify(void);
@@ -540,15 +542,12 @@ extern void sdio_func_unreg_notify(void);
#if defined(BCMLXSDMMC)
int bcmsdh_reg_sdio_notify(void* semaphore)
{
-
return sdio_func_reg_notify(semaphore);
-
}
void bcmsdh_unreg_sdio_notify(void)
{
sdio_func_unreg_notify();
-
}
#endif /* defined(BCMLXSDMMC) */
@@ -560,8 +559,13 @@ bcmsdh_register(bcmsdh_driver_t *driver)
drvinfo = *driver;
#if defined(BCMPLATFORM_BUS)
+#ifdef BCMSPI_ANDROID
+ SDLX_MSG(("Linux Kernel SPI Driver\n"));
+ error = spi_function_init();
+#else /* BCMSPI_ANDROID */
SDLX_MSG(("Linux Kernel SDIO/MMC Driver\n"));
error = sdio_function_init();
+#endif /* BCMSPI_ANDROID */
return error;
#endif /* defined(BCMPLATFORM_BUS) */
@@ -580,7 +584,11 @@ bcmsdh_register(bcmsdh_driver_t *driver)
return error;
}
+#ifdef BCMSPI_ANDROID
+extern void spi_function_cleanup(void);
+#else
extern void sdio_function_cleanup(void);
+#endif /* BCMSPI_ANDROID */
void
bcmsdh_unregister(void)
@@ -589,6 +597,9 @@ bcmsdh_unregister(void)
if (bcmsdh_pci_driver.node.next)
#endif
+#ifdef BCMSPI_ANDROID
+ spi_function_cleanup();
+#endif /* BCMSPI_ANDROID */
#if defined(BCMLXSDMMC)
sdio_function_cleanup();
#endif /* BCMLXSDMMC */
@@ -598,7 +609,7 @@ bcmsdh_unregister(void)
#endif /* BCMPLATFORM_BUS */
}
-#if defined(OOB_INTR_ONLY)
+#if defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID)
void bcmsdh_oob_intr_set(bool enable)
{
static bool curstate = 1;
@@ -652,7 +663,9 @@ int bcmsdh_register_oob_intr(void * dhdp)
if (error)
return -ENODEV;
- enable_irq_wake(sdhcinfo->oob_irq);
+ error = enable_irq_wake(sdhcinfo->oob_irq);
+ if (error)
+ SDLX_MSG(("%s enable_irq_wake error=%d \n", __FUNCTION__, error));
sdhcinfo->oob_irq_registered = TRUE;
sdhcinfo->oob_irq_enable_flag = TRUE;
}
@@ -669,7 +682,9 @@ void bcmsdh_set_irq(int flag)
enable_irq(sdhcinfo->oob_irq);
enable_irq_wake(sdhcinfo->oob_irq);
} else {
+#if !(defined(BCMSPI_ANDROID) && defined(CUSTOMER_HW4) && defined(CONFIG_NKERNEL))
disable_irq_wake(sdhcinfo->oob_irq);
+#endif /* !defined(BCMSPI_ANDROID) */
disable_irq(sdhcinfo->oob_irq);
}
}
@@ -685,7 +700,7 @@ void bcmsdh_unregister_oob_intr(void)
sdhcinfo->oob_irq_registered = FALSE;
}
}
-#endif /* defined(OOB_INTR_ONLY) */
+#endif /* defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID) */
#if defined(BCMLXSDMMC)
void *bcmsdh_get_drvdata(void)
@@ -694,7 +709,7 @@ void *bcmsdh_get_drvdata(void)
return NULL;
return dev_get_drvdata(sdhcinfo->dev);
}
-#endif /* defined(OOB_INTR_ONLY) */
+#endif
/* Module parameters specific to each host-controller driver */
@@ -724,6 +739,11 @@ extern int sd_uhsimode;
module_param(sd_uhsimode, int, 0);
#endif
+#ifdef BCMSDIOH_TXGLOM
+extern uint sd_txglom;
+module_param(sd_txglom, uint, 0);
+#endif
+
#ifdef BCMSDH_MODULE
EXPORT_SYMBOL(bcmsdh_attach);
EXPORT_SYMBOL(bcmsdh_detach);
diff --git a/drivers/net/wireless/bcmdhd/src/bcmsdio/sys/bcmsdh_sdmmc.c b/drivers/net/wireless/bcmdhd/bcmsdh_sdmmc.c
index d6a110a..c743d09 100644
--- a/drivers/net/wireless/bcmdhd/src/bcmsdio/sys/bcmsdh_sdmmc.c
+++ b/drivers/net/wireless/bcmdhd/bcmsdh_sdmmc.c
@@ -2,13 +2,13 @@
* BCMSDH Function Driver for the native SDIO/MMC driver in the Linux Kernel
*
* Copyright (C) 1999-2012, Broadcom Corporation
- *
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,12 +16,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: bcmsdh_sdmmc.c 309548 2012-01-20 01:13:08Z $
+ * $Id: bcmsdh_sdmmc.c 347640 2012-07-27 11:53:21Z $
*/
#include <typedefs.h>
@@ -168,12 +168,12 @@ sdioh_attach(osl_t *osh, void *bar0, uint irq)
/* Release host controller F1 */
sdio_release_host(gInstance->func[1]);
- }else {
+ } else {
sd_err(("%s:gInstance->func[1] is null\n", __FUNCTION__));
MFREE(sd->osh, sd, sizeof(sdioh_info_t));
return NULL;
}
-
+
if (gInstance->func[2]) {
/* Claim host controller F2 */
sdio_claim_host(gInstance->func[2]);
@@ -187,7 +187,7 @@ sdioh_attach(osl_t *osh, void *bar0, uint irq)
/* Release host controller F2 */
sdio_release_host(gInstance->func[2]);
- }else {
+ } else {
sd_err(("%s:gInstance->func[2] is null\n", __FUNCTION__));
MFREE(sd->osh, sd, sizeof(sdioh_info_t));
return NULL;
@@ -404,17 +404,17 @@ const bcm_iovar_t sdioh_iovars[] = {
{"sd_blockmode", IOV_BLOCKMODE, 0, IOVT_BOOL, 0 },
{"sd_blocksize", IOV_BLOCKSIZE, 0, IOVT_UINT32, 0 }, /* ((fn << 16) | size) */
{"sd_dma", IOV_DMA, 0, IOVT_BOOL, 0 },
- {"sd_ints", IOV_USEINTS, 0, IOVT_BOOL, 0 },
+ {"sd_ints", IOV_USEINTS, 0, IOVT_BOOL, 0 },
{"sd_numints", IOV_NUMINTS, 0, IOVT_UINT32, 0 },
{"sd_numlocalints", IOV_NUMLOCALINTS, 0, IOVT_UINT32, 0 },
{"sd_hostreg", IOV_HOSTREG, 0, IOVT_BUFFER, sizeof(sdreg_t) },
- {"sd_devreg", IOV_DEVREG, 0, IOVT_BUFFER, sizeof(sdreg_t) },
+ {"sd_devreg", IOV_DEVREG, 0, IOVT_BUFFER, sizeof(sdreg_t) },
{"sd_divisor", IOV_DIVISOR, 0, IOVT_UINT32, 0 },
{"sd_power", IOV_POWER, 0, IOVT_UINT32, 0 },
{"sd_clock", IOV_CLOCK, 0, IOVT_UINT32, 0 },
- {"sd_mode", IOV_SDMODE, 0, IOVT_UINT32, 100},
+ {"sd_mode", IOV_SDMODE, 0, IOVT_UINT32, 100},
{"sd_highspeed", IOV_HISPEED, 0, IOVT_UINT32, 0 },
- {"sd_rxchain", IOV_RXCHAIN, 0, IOVT_BOOL, 0 },
+ {"sd_rxchain", IOV_RXCHAIN, 0, IOVT_BOOL, 0 },
{NULL, 0, 0, 0, 0 }
};
@@ -463,6 +463,7 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name,
bcopy(params, &int_val, sizeof(int_val));
bool_val = (int_val != 0) ? TRUE : FALSE;
+ BCM_REFERENCE(bool_val);
actionid = set ? IOV_SVAL(vi->varid) : IOV_GVAL(vi->varid);
switch (actionid) {
@@ -522,7 +523,7 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name,
/* Now set it */
si->client_block_size[func] = blksize;
-#ifdef VSDB_DYNAMIC_F2_BLKSIZE
+#if defined(CUSTOMER_HW4) && defined(DYNAMIC_F2_BLKSIZE_OF_PROPTXSTATUS)
if (gInstance == NULL || gInstance->func[func] == NULL) {
sd_err(("%s: SDIO Device not present\n", __FUNCTION__));
bcmerror = BCME_NORESOURCE;
@@ -531,10 +532,11 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name,
sdio_claim_host(gInstance->func[func]);
bcmerror = sdio_set_block_size(gInstance->func[func], blksize);
if (bcmerror) {
- sd_err(("%s: Failed to set F%d blocksize to %d\n", __FUNCTION__, func, blksize));
+ sd_err(("%s: Failed to set F%d blocksize to %d\n", __FUNCTION__, func,
+ blksize));
}
sdio_release_host(gInstance->func[func]);
-#endif
+#endif /* CUSTOMER_HW4 && DYNAMIC_F2_BLKSIZE_OF_PROPTXSTATUS */
break;
}
@@ -706,15 +708,10 @@ sdioh_enable_hw_oob_intr(sdioh_info_t *sd, bool enable)
uint8 data;
if (enable)
- data = SDIO_SEPINT_MASK | SDIO_SEPINT_OE; /* enable hw oob interrupt */
+ data = SDIO_SEPINT_MASK | SDIO_SEPINT_OE | SDIO_SEPINT_ACT_HI;
else
data = SDIO_SEPINT_ACT_HI; /* disable hw oob interrupt */
-#if 1 && LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)
- /* Needed for Android Linux Kernel 2.6.35 */
- data |= SDIO_SEPINT_ACT_HI; /* Active HIGH */
-#endif /* OEM_ANDROID */
-
status = sdioh_request_byte(sd, SDIOH_WRITE, 0, SDIOD_CCCR_BRCM_SEPINT, &data);
return status;
}
@@ -829,14 +826,15 @@ sdioh_request_byte(sdioh_info_t *sd, uint rw, uint func, uint regaddr, uint8 *by
#if defined(MMC_SDIO_ABORT)
/* to allow abort command through F1 */
else if (regaddr == SDIOD_CCCR_IOABORT) {
- if (gInstance->func[func]){
+ if (gInstance->func[func]) {
sdio_claim_host(gInstance->func[func]);
/*
* this sdio_f0_writeb() can be replaced with another api
* depending upon MMC driver change.
* As of this time, this is temporaray one
*/
- sdio_writeb(gInstance->func[func], *byte, regaddr, &err_ret);
+ sdio_writeb(gInstance->func[func],
+ *byte, regaddr, &err_ret);
sdio_release_host(gInstance->func[func]);
}
}
@@ -845,15 +843,16 @@ sdioh_request_byte(sdioh_info_t *sd, uint rw, uint func, uint regaddr, uint8 *by
sd_err(("bcmsdh_sdmmc: F0 Wr:0x%02x: write disallowed\n", regaddr));
} else {
/* Claim host controller, perform F0 write, and release */
- if (gInstance->func[func]){
+ if (gInstance->func[func]) {
sdio_claim_host(gInstance->func[func]);
- sdio_f0_writeb(gInstance->func[func], *byte, regaddr, &err_ret);
+ sdio_f0_writeb(gInstance->func[func],
+ *byte, regaddr, &err_ret);
sdio_release_host(gInstance->func[func]);
}
}
} else {
/* Claim host controller, perform Fn write, and release */
- if (gInstance->func[func]){
+ if (gInstance->func[func]) {
sdio_claim_host(gInstance->func[func]);
sdio_writeb(gInstance->func[func], *byte, regaddr, &err_ret);
sdio_release_host(gInstance->func[func]);
@@ -861,15 +860,13 @@ sdioh_request_byte(sdioh_info_t *sd, uint rw, uint func, uint regaddr, uint8 *by
}
} else { /* CMD52 Read */
/* Claim host controller, perform Fn read, and release */
- if (gInstance->func[func]){
+ if (gInstance->func[func]) {
sdio_claim_host(gInstance->func[func]);
-
if (func == 0) {
*byte = sdio_f0_readb(gInstance->func[func], regaddr, &err_ret);
} else {
*byte = sdio_readb(gInstance->func[func], regaddr, &err_ret);
}
-
sdio_release_host(gInstance->func[func]);
}
}
@@ -1051,16 +1048,19 @@ sdioh_request_packet(sdioh_info_t *sd, uint fix_inc, uint write, uint func,
xfred_len = 0;
}
- /* Align Patch */
- if (write == 0 || pkt_len < 32) // read or small packet(ex-BDC header) skip 32 byte align
+ /* Align Patch
+ * read or small packet(ex:BDC header) skip 32 byte align
+ * otherwise, padding DHD_SDALIGN for performance
+ */
+ if (write == 0 || pkt_len < 32)
pkt_len = (pkt_len + 3) & 0xFFFFFFFC;
- else if(pkt_len % DHD_SDALIGN) // write
+ else if (pkt_len % DHD_SDALIGN)
pkt_len += DHD_SDALIGN - (pkt_len % DHD_SDALIGN);
-#ifdef VSDB_DYNAMIC_F2_BLKSIZE
+#if defined(CUSTOMER_HW4) && defined(DYNAMIC_F2_BLKSIZE_OF_PROPTXSTATUS)
if (write && pkt_len > 64 && (pkt_len % 64) == 32)
pkt_len += 32;
-#endif
+#endif /* CUSTOMER_HW4 && DYNAMIC_F2_BLKSIZE_OF_PROPTXSTATUS */
#ifdef CONFIG_MMC_MSM7X00A
if ((pkt_len % 64) == 32) {
sd_trace(("%s: Rounding up TX packet +=32\n", __FUNCTION__));
@@ -1311,6 +1311,7 @@ static void IRQHandlerF2(struct sdio_func *func)
sd = gInstance->sd;
ASSERT(sd != NULL);
+ BCM_REFERENCE(sd);
}
#endif /* !defined(OOB_INTR_ONLY) */
@@ -1354,7 +1355,7 @@ sdioh_start(sdioh_info_t *si, int stage)
sdio access will come in way
*/
if (gInstance->func[0]) {
- if (stage == 0) {
+ if (stage == 0) {
/* Since the power to the chip is killed, we will have
re enumerate the device again. Set the block size
and enable the fucntion 1 for in preparation for
@@ -1374,7 +1375,7 @@ sdioh_start(sdioh_info_t *si, int stage)
sd->use_client_ints = TRUE;
sd->client_block_size[0] = 64;
- if(gInstance->func[1]) {
+ if (gInstance->func[1]) {
/* Claim host controller */
sdio_claim_host(gInstance->func[1]);
@@ -1382,6 +1383,7 @@ sdioh_start(sdioh_info_t *si, int stage)
if (sdio_set_block_size(gInstance->func[1], 64)) {
sd_err(("bcmsdh_sdmmc: Failed to set F1 blocksize\n"));
}
+
/* Release host controller F1 */
sdio_release_host(gInstance->func[1]);
}
diff --git a/drivers/net/wireless/bcmdhd/src/bcmsdio/sys/bcmsdh_sdmmc_linux.c b/drivers/net/wireless/bcmdhd/bcmsdh_sdmmc_linux.c
index ca8478b..36f2a6c 100644
--- a/drivers/net/wireless/bcmdhd/src/bcmsdio/sys/bcmsdh_sdmmc_linux.c
+++ b/drivers/net/wireless/bcmdhd/bcmsdh_sdmmc_linux.c
@@ -1,14 +1,14 @@
/*
* BCMSDH Function Driver for the native SDIO/MMC driver in the Linux Kernel
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,12 +16,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: bcmsdh_sdmmc_linux.c 307731 2012-01-12 10:52:03Z $
+ * $Id: bcmsdh_sdmmc_linux.c 353908 2012-08-29 08:09:02Z $
*/
#include <typedefs.h>
@@ -131,30 +131,30 @@ static int bcmsdh_sdmmc_probe(struct sdio_func *func,
gInstance->func[func->num] = func;
if (func->num == 2) {
-#ifdef WL_CFG80211
+ #ifdef WL_CFG80211
wl_cfg80211_set_parent_dev(&func->dev);
-#endif
+ #endif
sd_trace(("F2 found, calling bcmsdh_probe...\n"));
ret = bcmsdh_probe(&func->dev);
}
- }else {
+ } else {
ret = -ENODEV;
}
-
+
return ret;
}
static void bcmsdh_sdmmc_remove(struct sdio_func *func)
{
if (func) {
- sd_err(("bcmsdh_sdmmc: %s Enter\n", __FUNCTION__));
+ sd_trace(("bcmsdh_sdmmc: %s Enter\n", __FUNCTION__));
sd_info(("sdio_bcmsdh: func->class=%x\n", func->class));
sd_info(("sdio_vendor: 0x%04x\n", func->vendor));
sd_info(("sdio_device: 0x%04x\n", func->device));
sd_info(("Function#: 0x%04x\n", func->num));
if (func->num == 2) {
- sd_err(("F2 found, calling bcmsdh_remove...\n"));
+ sd_trace(("F2 found, calling bcmsdh_remove...\n"));
bcmsdh_remove(&func->dev);
} else if (func->num == 1) {
sdio_claim_host(func);
@@ -186,21 +186,38 @@ MODULE_DEVICE_TABLE(sdio, bcmsdh_sdmmc_ids);
static int bcmsdh_sdmmc_suspend(struct device *pdev)
{
struct sdio_func *func = dev_to_sdio_func(pdev);
+ mmc_pm_flag_t sdio_flags;
+ int ret;
if (func->num != 2)
return 0;
- sd_err(("%s Enter\n", __FUNCTION__));
+ sd_trace(("%s Enter\n", __FUNCTION__));
if (dhd_os_check_wakelock(bcmsdh_get_drvdata()))
return -EBUSY;
-#if !defined(CUSTOMER_HW_SAMSUNG)
+
+ sdio_flags = sdio_get_host_pm_caps(func);
+
+ if (!(sdio_flags & MMC_PM_KEEP_POWER)) {
+ sd_err(("%s: can't keep power while host is suspended\n", __FUNCTION__));
+ return -EINVAL;
+ }
+
+ /* keep power while host suspended */
+ ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER);
+ if (ret) {
+ sd_err(("%s: error while trying to keep power\n", __FUNCTION__));
+ return ret;
+ }
+
+#if !defined(CUSTOMER_HW4)
#if defined(OOB_INTR_ONLY)
bcmsdh_oob_intr_set(0);
#endif /* defined(OOB_INTR_ONLY) */
-#endif /* defined(OOB_INTR_ONLY) */
+#endif /* !defined(CUSTOMER_HW4) */
dhd_mmc_suspend = TRUE;
-#if defined (CUSTOMER_HW_SAMSUNG) && defined (CONFIG_ARCH_TEGRA)
+#if defined(CUSTOMER_HW4) && defined(CONFIG_ARCH_TEGRA)
irq_set_irq_wake(390, 1);
#endif
smp_mb();
@@ -210,23 +227,24 @@ static int bcmsdh_sdmmc_suspend(struct device *pdev)
static int bcmsdh_sdmmc_resume(struct device *pdev)
{
+#if !defined(CUSTOMER_HW4)
#if defined(OOB_INTR_ONLY)
struct sdio_func *func = dev_to_sdio_func(pdev);
-#endif
- if (func->num == 2)
- sd_err(("%s Enter\n", __FUNCTION__));
+#endif /* defined(OOB_INTR_ONLY) */
+#endif /* defined(CUSTOMER_HW4) */
+ sd_trace(("%s Enter\n", __FUNCTION__));
+
dhd_mmc_suspend = FALSE;
-#if !defined(CUSTOMER_HW_SAMSUNG)
+#if !defined(CUSTOMER_HW4)
#if defined(OOB_INTR_ONLY)
if ((func->num == 2) && dhd_os_check_if_up(bcmsdh_get_drvdata()))
bcmsdh_oob_intr_set(1);
#endif /* (OOB_INTR_ONLY) */
-#endif /* !CUSTOMER_HW_SAMSUNG */
-#if defined (CUSTOMER_HW_SAMSUNG) && defined (CONFIG_ARCH_TEGRA)
+#endif /* !(CUSTOMER_HW4) */
+#if defined(CUSTOMER_HW4) && defined(CONFIG_ARCH_TEGRA)
if (func->num == 2)
irq_set_irq_wake(390, 0);
#endif
-
smp_mb();
return 0;
}
@@ -244,7 +262,7 @@ static int dummy_probe(struct sdio_func *func,
const struct sdio_device_id *id)
{
if (notify_semaphore)
- up(notify_semaphore);
+ up(notify_semaphore);
return 0;
}
@@ -269,6 +287,7 @@ void sdio_func_unreg_notify(void)
{
sdio_unregister_driver(&dummy_sdmmc_driver);
}
+
#endif /* defined(BCMLXSDMMC) */
static struct sdio_driver bcmsdh_sdmmc_driver = {
@@ -276,14 +295,12 @@ static struct sdio_driver bcmsdh_sdmmc_driver = {
.remove = bcmsdh_sdmmc_remove,
.name = "bcmsdh_sdmmc",
.id_table = bcmsdh_sdmmc_ids,
-#if !defined(BCMHOST)
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)) && defined(CONFIG_PM)
.drv = {
- .pm = &bcmsdh_sdmmc_pm_ops,
+ .pm = &bcmsdh_sdmmc_pm_ops,
},
#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)) && defined(CONFIG_PM) */
-#endif
-};
+ };
struct sdos_info {
sdioh_info_t *sd;
@@ -296,7 +313,7 @@ sdioh_sdmmc_osinit(sdioh_info_t *sd)
{
struct sdos_info *sdos;
- if(!sd)
+ if (!sd)
return BCME_BADARG;
sdos = (struct sdos_info*)MALLOC(sd->osh, sizeof(struct sdos_info));
@@ -326,9 +343,9 @@ sdioh_interrupt_set(sdioh_info_t *sd, bool enable)
ulong flags;
struct sdos_info *sdos;
- if(!sd)
+ if (!sd)
return BCME_BADARG;
-
+
sd_trace(("%s: %s\n", __FUNCTION__, enable ? "Enabling" : "Disabling"));
sdos = (struct sdos_info *)sd->sdos_info;
@@ -362,7 +379,7 @@ static int __init
bcmsdh_module_init(void)
{
int error = 0;
- sdio_function_init();
+ error = sdio_function_init();
return error;
}
@@ -393,6 +410,10 @@ int sdio_function_init(void)
return -ENOMEM;
error = sdio_register_driver(&bcmsdh_sdmmc_driver);
+ if (error && gInstance) {
+ kfree(gInstance);
+ gInstance = 0;
+ }
return error;
}
diff --git a/drivers/net/wireless/bcmdhd/bcmsdspi_linux.c b/drivers/net/wireless/bcmdhd/bcmsdspi_linux.c
new file mode 100644
index 0000000..e834366
--- /dev/null
+++ b/drivers/net/wireless/bcmdhd/bcmsdspi_linux.c
@@ -0,0 +1,420 @@
+/*
+ * Broadcom SPI Host Controller Driver - Linux Per-port
+ *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
+ * Unless you and Broadcom execute a separate written software license
+ * agreement governing use of this software, this software is licensed to you
+ * under the terms of the GNU General Public License version 2 (the "GPL"),
+ * available at http://www.broadcom.com/licenses/GPLv2.php, with the
+ * following added to such license:
+ *
+ * As a special exception, the copyright holders of this software give you
+ * permission to link this software with independent modules, and to copy and
+ * distribute the resulting executable under terms of your choice, provided that
+ * you also meet, for each linked independent module, the terms and conditions of
+ * the license of that module. An independent module is a module which is not
+ * derived from this software. The special exception does not apply to any
+ * modifications of the software.
+ *
+ * Notwithstanding the above, under no circumstances may you combine this
+ * software in any way with any other Broadcom software provided under a license
+ * other than the GPL, without Broadcom's express prior written consent.
+ *
+ * $Id: bcmsdspi_linux.c 355376 2012-09-06 13:23:59Z $
+ */
+
+#include <typedefs.h>
+#include <bcmutils.h>
+
+#include <bcmsdbus.h> /* bcmsdh to/from specific controller APIs */
+#include <sdiovar.h> /* to get msglevel bit values */
+
+#ifndef BCMSPI_ANDROID
+#include <pcicfg.h>
+#include <sdio.h> /* SDIO Device and Protocol Specs */
+#include <linux/sched.h> /* request_irq(), free_irq() */
+#include <bcmsdspi.h>
+#include <bcmspi.h>
+
+extern uint sd_crc;
+module_param(sd_crc, uint, 0);
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0))
+#define KERNEL26
+#endif
+
+struct sdos_info {
+ sdioh_info_t *sd;
+ spinlock_t lock;
+ wait_queue_head_t intr_wait_queue;
+};
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0))
+#define BLOCKABLE() (!in_atomic())
+#else
+#define BLOCKABLE() (!in_interrupt())
+#endif
+
+/* Interrupt handler */
+static irqreturn_t
+sdspi_isr(int irq, void *dev_id
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
+, struct pt_regs *ptregs
+#endif
+)
+{
+ sdioh_info_t *sd;
+ struct sdos_info *sdos;
+ bool ours;
+
+ sd = (sdioh_info_t *)dev_id;
+ sd->local_intrcount++;
+
+ if (!sd->card_init_done) {
+ sd_err(("%s: Hey Bogus intr...not even initted: irq %d\n", __FUNCTION__, irq));
+ return IRQ_RETVAL(FALSE);
+ } else {
+ ours = spi_check_client_intr(sd, NULL);
+
+ /* For local interrupts, wake the waiting process */
+ if (ours && sd->got_hcint) {
+ sdos = (struct sdos_info *)sd->sdos_info;
+ wake_up_interruptible(&sdos->intr_wait_queue);
+ }
+
+ return IRQ_RETVAL(ours);
+ }
+}
+#else /* !BCMSPI_ANDROID */
+#include <bcmspibrcm.h>
+#include <linux/spi/spi.h>
+
+static struct spi_device *gBCMSPI = NULL;
+
+extern int bcmsdh_probe(struct device *dev);
+extern int bcmsdh_remove(struct device *dev);
+
+static int bcmsdh_spi_probe(struct spi_device *spi_dev)
+{
+ int ret = 0;
+
+ gBCMSPI = spi_dev;
+
+#ifdef SPI_PIO_32BIT_RW
+ spi_dev->bits_per_word = 32;
+#else
+ spi_dev->bits_per_word = 8;
+#endif /* SPI_PIO_32BIT_RW */
+ ret = spi_setup(spi_dev);
+
+ if (ret) {
+ sd_err(("bcmsdh_spi_probe: spi_setup fail with %d\n", ret));
+ }
+ sd_err(("bcmsdh_spi_probe: spi_setup with %d, bits_per_word=%d\n",
+ ret, spi_dev->bits_per_word));
+ ret = bcmsdh_probe(&spi_dev->dev);
+
+ return ret;
+}
+
+static int bcmsdh_spi_remove(struct spi_device *spi_dev)
+{
+ int ret = 0;
+
+ ret = bcmsdh_remove(&spi_dev->dev);
+ gBCMSPI = NULL;
+
+ return ret;
+}
+
+static struct spi_driver bcmsdh_spi_driver = {
+ .probe = bcmsdh_spi_probe,
+ .remove = bcmsdh_spi_remove,
+ .driver = {
+ .name = "wlan_spi",
+ .bus = &spi_bus_type,
+ .owner = THIS_MODULE,
+ },
+};
+
+/*
+ * module init
+*/
+int spi_function_init(void)
+{
+ int error = 0;
+ sd_trace(("bcmsdh_gspi: %s Enter\n", __FUNCTION__));
+
+ error = spi_register_driver(&bcmsdh_spi_driver);
+
+ return error;
+}
+
+/*
+ * module cleanup
+*/
+void spi_function_cleanup(void)
+{
+ sd_trace(("%s Enter\n", __FUNCTION__));
+ spi_unregister_driver(&bcmsdh_spi_driver);
+}
+#endif /* !BCMSPI_ANDROID */
+
+/* Register with Linux for interrupts */
+int
+spi_register_irq(sdioh_info_t *sd, uint irq)
+{
+#ifndef BCMSPI_ANDROID
+ sd_trace(("Entering %s: irq == %d\n", __FUNCTION__, irq));
+ if (request_irq(irq, sdspi_isr, IRQF_SHARED, "bcmsdspi", sd) < 0) {
+ sd_err(("%s: request_irq() failed\n", __FUNCTION__));
+ return ERROR;
+ }
+#endif /* !BCMSPI_ANDROID */
+ return SUCCESS;
+}
+
+/* Free Linux irq */
+void
+spi_free_irq(uint irq, sdioh_info_t *sd)
+{
+#ifndef BCMSPI_ANDROID
+ free_irq(irq, sd);
+#endif /* !BCMSPI_ANDROID */
+}
+
+/* Map Host controller registers */
+#ifndef BCMSPI_ANDROID
+uint32 *
+spi_reg_map(osl_t *osh, uintptr addr, int size)
+{
+ return (uint32 *)REG_MAP(addr, size);
+}
+
+void
+spi_reg_unmap(osl_t *osh, uintptr addr, int size)
+{
+ REG_UNMAP((void*)(uintptr)addr);
+}
+#endif /* !BCMSPI_ANDROID */
+
+int
+spi_osinit(sdioh_info_t *sd)
+{
+#ifndef BCMSPI_ANDROID
+ struct sdos_info *sdos;
+
+ sdos = (struct sdos_info*)MALLOC(sd->osh, sizeof(struct sdos_info));
+ sd->sdos_info = (void*)sdos;
+ if (sdos == NULL)
+ return BCME_NOMEM;
+
+ sdos->sd = sd;
+ spin_lock_init(&sdos->lock);
+ init_waitqueue_head(&sdos->intr_wait_queue);
+#endif /* !BCMSPI_ANDROID */
+return BCME_OK;
+}
+
+void
+spi_osfree(sdioh_info_t *sd)
+{
+#ifndef BCMSPI_ANDROID
+ struct sdos_info *sdos;
+ ASSERT(sd && sd->sdos_info);
+
+ sdos = (struct sdos_info *)sd->sdos_info;
+ MFREE(sd->osh, sdos, sizeof(struct sdos_info));
+#endif /* !BCMSPI_ANDROID */
+}
+
+/* Interrupt enable/disable */
+SDIOH_API_RC
+sdioh_interrupt_set(sdioh_info_t *sd, bool enable)
+{
+#ifndef BCMSPI_ANDROID
+ ulong flags;
+ struct sdos_info *sdos;
+
+ sd_trace(("%s: %s\n", __FUNCTION__, enable ? "Enabling" : "Disabling"));
+
+ sdos = (struct sdos_info *)sd->sdos_info;
+ ASSERT(sdos);
+
+ if (!(sd->host_init_done && sd->card_init_done)) {
+ sd_err(("%s: Card & Host are not initted - bailing\n", __FUNCTION__));
+ return SDIOH_API_RC_FAIL;
+ }
+
+ if (enable && !(sd->intr_handler && sd->intr_handler_arg)) {
+ sd_err(("%s: no handler registered, will not enable\n", __FUNCTION__));
+ return SDIOH_API_RC_FAIL;
+ }
+
+ /* Ensure atomicity for enable/disable calls */
+ spin_lock_irqsave(&sdos->lock, flags);
+
+ sd->client_intr_enabled = enable;
+ if (enable && !sd->lockcount)
+ spi_devintr_on(sd);
+ else
+ spi_devintr_off(sd);
+
+ spin_unlock_irqrestore(&sdos->lock, flags);
+#endif /* !BCMSPI_ANDROID */
+
+ return SDIOH_API_RC_SUCCESS;
+}
+
+/* Protect against reentrancy (disable device interrupts while executing) */
+void
+spi_lock(sdioh_info_t *sd)
+{
+#ifndef BCMSPI_ANDROID
+ ulong flags;
+ struct sdos_info *sdos;
+
+ sdos = (struct sdos_info *)sd->sdos_info;
+ ASSERT(sdos);
+
+ sd_trace(("%s: %d\n", __FUNCTION__, sd->lockcount));
+
+ spin_lock_irqsave(&sdos->lock, flags);
+ if (sd->lockcount) {
+ sd_err(("%s: Already locked!\n", __FUNCTION__));
+ ASSERT(sd->lockcount == 0);
+ }
+ spi_devintr_off(sd);
+ sd->lockcount++;
+ spin_unlock_irqrestore(&sdos->lock, flags);
+#endif /* !BCMSPI_ANDROID */
+}
+
+/* Enable client interrupt */
+void
+spi_unlock(sdioh_info_t *sd)
+{
+#ifndef BCMSPI_ANDROID
+ ulong flags;
+ struct sdos_info *sdos;
+
+ sd_trace(("%s: %d, %d\n", __FUNCTION__, sd->lockcount, sd->client_intr_enabled));
+ ASSERT(sd->lockcount > 0);
+
+ sdos = (struct sdos_info *)sd->sdos_info;
+ ASSERT(sdos);
+
+ spin_lock_irqsave(&sdos->lock, flags);
+ if (--sd->lockcount == 0 && sd->client_intr_enabled) {
+ spi_devintr_on(sd);
+ }
+ spin_unlock_irqrestore(&sdos->lock, flags);
+#endif /* !BCMSPI_ANDROID */
+}
+
+#ifndef BCMSPI_ANDROID
+void spi_waitbits(sdioh_info_t *sd, bool yield)
+{
+#ifndef BCMSDYIELD
+ ASSERT(!yield);
+#endif
+ sd_trace(("%s: yield %d canblock %d\n",
+ __FUNCTION__, yield, BLOCKABLE()));
+
+ /* Clear the "interrupt happened" flag and last intrstatus */
+ sd->got_hcint = FALSE;
+
+#ifdef BCMSDYIELD
+ if (yield && BLOCKABLE()) {
+ struct sdos_info *sdos;
+ sdos = (struct sdos_info *)sd->sdos_info;
+ /* Wait for the indication, the interrupt will be masked when the ISR fires. */
+ wait_event_interruptible(sdos->intr_wait_queue, (sd->got_hcint));
+ } else
+#endif /* BCMSDYIELD */
+ {
+ spi_spinbits(sd);
+ }
+
+}
+#else /* !BCMSPI_ANDROID */
+int bcmgspi_dump = 0; /* Set to dump complete trace of all SPI bus transactions */
+
+static void
+hexdump(char *pfx, unsigned char *msg, int msglen)
+{
+ int i, col;
+ char buf[80];
+
+ ASSERT(strlen(pfx) + 49 <= sizeof(buf));
+
+ col = 0;
+
+ for (i = 0; i < msglen; i++, col++) {
+ if (col % 16 == 0)
+ strcpy(buf, pfx);
+ sprintf(buf + strlen(buf), "%02x", msg[i]);
+ if ((col + 1) % 16 == 0)
+ printf("%s\n", buf);
+ else
+ sprintf(buf + strlen(buf), " ");
+ }
+
+ if (col % 16 != 0)
+ printf("%s\n", buf);
+}
+
+/* Send/Receive an SPI Packet */
+void
+spi_sendrecv(sdioh_info_t *sd, uint8 *msg_out, uint8 *msg_in, int msglen)
+{
+ int write = 0;
+ int tx_len = 0;
+ struct spi_message msg;
+ struct spi_transfer t[2];
+
+ spi_message_init(&msg);
+ memset(t, 0, 2*sizeof(struct spi_transfer));
+
+ if (sd->wordlen == 2)
+#if !(defined(SPI_PIO_RW_BIGENDIAN) && defined(SPI_PIO_32BIT_RW))
+ write = msg_out[2] & 0x80;
+#else
+ write = msg_out[1] & 0x80;
+#endif /* !(defined(SPI_PIO_RW_BIGENDIAN) && defined(SPI_PIO_32BIT_RW)) */
+ if (sd->wordlen == 4)
+#if !(defined(SPI_PIO_RW_BIGENDIAN) && defined(SPI_PIO_32BIT_RW))
+ write = msg_out[0] & 0x80;
+#else
+ write = msg_out[3] & 0x80;
+#endif /* !(defined(SPI_PIO_RW_BIGENDIAN) && defined(SPI_PIO_32BIT_RW)) */
+
+ if (bcmgspi_dump) {
+ hexdump(" OUT: ", msg_out, msglen);
+ }
+
+ tx_len = write ? msglen-4 : 4;
+
+ sd_trace(("spi_sendrecv: %s, wordlen %d, cmd : 0x%02x 0x%02x 0x%02x 0x%02x\n",
+ write ? "WR" : "RD", sd->wordlen,
+ msg_out[0], msg_out[1], msg_out[2], msg_out[3]));
+
+ t[0].tx_buf = (char *)&msg_out[0];
+ t[0].rx_buf = 0;
+ t[0].len = tx_len;
+
+ spi_message_add_tail(&t[0], &msg);
+
+ t[1].rx_buf = (char *)&msg_in[tx_len];
+ t[1].tx_buf = 0;
+ t[1].len = msglen-tx_len;
+
+ spi_message_add_tail(&t[1], &msg);
+ spi_sync(gBCMSPI, &msg);
+
+ if (bcmgspi_dump) {
+ hexdump(" IN : ", msg_in, msglen);
+ }
+}
+#endif /* !BCMSPI_ANDROID */
diff --git a/drivers/net/wireless/bcmdhd/bcmspibrcm.c b/drivers/net/wireless/bcmdhd/bcmspibrcm.c
new file mode 100644
index 0000000..d5f5754
--- /dev/null
+++ b/drivers/net/wireless/bcmdhd/bcmspibrcm.c
@@ -0,0 +1,1853 @@
+/*
+ * Broadcom BCMSDH to gSPI Protocol Conversion Layer
+ *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
+ * Unless you and Broadcom execute a separate written software license
+ * agreement governing use of this software, this software is licensed to you
+ * under the terms of the GNU General Public License version 2 (the "GPL"),
+ * available at http://www.broadcom.com/licenses/GPLv2.php, with the
+ * following added to such license:
+ *
+ * As a special exception, the copyright holders of this software give you
+ * permission to link this software with independent modules, and to copy and
+ * distribute the resulting executable under terms of your choice, provided that
+ * you also meet, for each linked independent module, the terms and conditions of
+ * the license of that module. An independent module is a module which is not
+ * derived from this software. The special exception does not apply to any
+ * modifications of the software.
+ *
+ * Notwithstanding the above, under no circumstances may you combine this
+ * software in any way with any other Broadcom software provided under a license
+ * other than the GPL, without Broadcom's express prior written consent.
+ *
+ * $Id: bcmspibrcm.c 355377 2012-09-06 13:25:35Z $
+ */
+
+#define HSMODE
+
+#include <typedefs.h>
+
+#include <bcmdevs.h>
+#include <bcmendian.h>
+#include <bcmutils.h>
+#include <osl.h>
+#include <hndsoc.h>
+#include <siutils.h>
+#include <sbchipc.h>
+#include <sbsdio.h> /* SDIO device core hardware definitions. */
+#include <spid.h>
+
+#include <bcmsdbus.h> /* bcmsdh to/from specific controller APIs */
+#include <sdiovar.h> /* ioctl/iovars */
+#include <sdio.h> /* SDIO Device and Protocol Specs */
+
+#include <pcicfg.h>
+
+
+#include <bcmspibrcm.h>
+#ifdef BCMSPI_ANDROID
+extern void spi_sendrecv(sdioh_info_t *sd, uint8 *msg_out, uint8 *msg_in, int msglen);
+#else
+#include <bcmspi.h>
+#endif /* BCMSPI_ANDROID */
+
+/* these are for the older cores... for newer cores we have control for each of them */
+#define F0_RESPONSE_DELAY 16
+#define F1_RESPONSE_DELAY 16
+#define F2_RESPONSE_DELAY F0_RESPONSE_DELAY
+
+
+#define GSPI_F0_RESP_DELAY 0
+#define GSPI_F1_RESP_DELAY F1_RESPONSE_DELAY
+#define GSPI_F2_RESP_DELAY 0
+#define GSPI_F3_RESP_DELAY 0
+
+#define CMDLEN 4
+
+#define DWORDMODE_ON (sd->chip == BCM4329_CHIP_ID) && (sd->chiprev == 2) && (sd->dwordmode == TRUE)
+
+/* Globals */
+#if defined(DHD_DEBUG)
+uint sd_msglevel = SDH_ERROR_VAL;
+#else
+uint sd_msglevel = 0;
+#endif
+
+uint sd_hiok = FALSE; /* Use hi-speed mode if available? */
+uint sd_sdmode = SDIOH_MODE_SPI; /* Use SD4 mode by default */
+uint sd_f2_blocksize = 64; /* Default blocksize */
+
+
+uint sd_divisor = 2;
+uint sd_power = 1; /* Default to SD Slot powered ON */
+uint sd_clock = 1; /* Default to SD Clock turned ON */
+uint sd_crc = 0; /* Default to SPI CRC Check turned OFF */
+uint sd_pci_slot = 0xFFFFffff; /* Used to force selection of a particular PCI slot */
+
+uint8 spi_outbuf[SPI_MAX_PKT_LEN];
+uint8 spi_inbuf[SPI_MAX_PKT_LEN];
+
+/* 128bytes buffer is enough to clear data-not-available and program response-delay F0 bits
+ * assuming we will not exceed F0 response delay > 100 bytes at 48MHz.
+ */
+#define BUF2_PKT_LEN 128
+uint8 spi_outbuf2[BUF2_PKT_LEN];
+uint8 spi_inbuf2[BUF2_PKT_LEN];
+
+#if !(defined(SPI_PIO_RW_BIGENDIAN) && defined(SPI_PIO_32BIT_RW))
+#define SPISWAP_WD4(x) bcmswap32(x);
+#define SPISWAP_WD2(x) (bcmswap16(x & 0xffff)) | \
+ (bcmswap16((x & 0xffff0000) >> 16) << 16);
+#else
+#define SPISWAP_WD4(x) x;
+#define SPISWAP_WD2(x) bcmswap32by16(x);
+#endif
+
+/* Prototypes */
+static bool bcmspi_test_card(sdioh_info_t *sd);
+static bool bcmspi_host_device_init_adapt(sdioh_info_t *sd);
+static int bcmspi_set_highspeed_mode(sdioh_info_t *sd, bool hsmode);
+static int bcmspi_cmd_issue(sdioh_info_t *sd, bool use_dma, uint32 cmd_arg,
+ uint32 *data, uint32 datalen);
+static int bcmspi_card_regread(sdioh_info_t *sd, int func, uint32 regaddr,
+ int regsize, uint32 *data);
+static int bcmspi_card_regwrite(sdioh_info_t *sd, int func, uint32 regaddr,
+ int regsize, uint32 data);
+static int bcmspi_card_bytewrite(sdioh_info_t *sd, int func, uint32 regaddr,
+ uint8 *data);
+static int bcmspi_driver_init(sdioh_info_t *sd);
+static int bcmspi_card_buf(sdioh_info_t *sd, int rw, int func, bool fifo,
+ uint32 addr, int nbytes, uint32 *data);
+static int bcmspi_card_regread_fixedaddr(sdioh_info_t *sd, int func, uint32 regaddr, int regsize,
+ uint32 *data);
+static void bcmspi_cmd_getdstatus(sdioh_info_t *sd, uint32 *dstatus_buffer);
+static int bcmspi_update_stats(sdioh_info_t *sd, uint32 cmd_arg);
+
+/*
+ * Public entry points & extern's
+ */
+extern sdioh_info_t *
+sdioh_attach(osl_t *osh, void *bar0, uint irq)
+{
+ sdioh_info_t *sd;
+
+ sd_trace(("%s\n", __FUNCTION__));
+ if ((sd = (sdioh_info_t *)MALLOC(osh, sizeof(sdioh_info_t))) == NULL) {
+ sd_err(("%s: out of memory, malloced %d bytes\n", __FUNCTION__, MALLOCED(osh)));
+ return NULL;
+ }
+ bzero((char *)sd, sizeof(sdioh_info_t));
+ sd->osh = osh;
+ if (spi_osinit(sd) != 0) {
+ sd_err(("%s: spi_osinit() failed\n", __FUNCTION__));
+ MFREE(sd->osh, sd, sizeof(sdioh_info_t));
+ return NULL;
+ }
+
+#ifndef BCMSPI_ANDROID
+ sd->bar0 = bar0;
+#endif /* !BCMSPI_ANDROID */
+ sd->irq = irq;
+#ifndef BCMSPI_ANDROID
+ sd->intr_handler = NULL;
+ sd->intr_handler_arg = NULL;
+ sd->intr_handler_valid = FALSE;
+#endif /* !BCMSPI_ANDROID */
+
+ /* Set defaults */
+ sd->use_client_ints = TRUE;
+ sd->sd_use_dma = FALSE; /* DMA Not supported */
+
+ /* Spi device default is 16bit mode, change to 4 when device is changed to 32bit
+ * mode
+ */
+ sd->wordlen = 2;
+
+#ifndef BCMSPI_ANDROID
+ if (!spi_hw_attach(sd)) {
+ sd_err(("%s: spi_hw_attach() failed\n", __FUNCTION__));
+ spi_osfree(sd);
+ MFREE(sd->osh, sd, sizeof(sdioh_info_t));
+ return (NULL);
+ }
+#endif /* !BCMSPI_ANDROID */
+
+ if (bcmspi_driver_init(sd) != SUCCESS) {
+ sd_err(("%s: bcmspi_driver_init() failed()\n", __FUNCTION__));
+#ifndef BCMSPI_ANDROID
+ spi_hw_detach(sd);
+#endif /* !BCMSPI_ANDROID */
+ spi_osfree(sd);
+ MFREE(sd->osh, sd, sizeof(sdioh_info_t));
+ return (NULL);
+ }
+
+ if (spi_register_irq(sd, irq) != SUCCESS) {
+ sd_err(("%s: spi_register_irq() failed for irq = %d\n", __FUNCTION__, irq));
+#ifndef BCMSPI_ANDROID
+ spi_hw_detach(sd);
+#endif /* !BCMSPI_ANDROID */
+ spi_osfree(sd);
+ MFREE(sd->osh, sd, sizeof(sdioh_info_t));
+ return (NULL);
+ }
+
+ sd_trace(("%s: Done\n", __FUNCTION__));
+
+ return sd;
+}
+
+extern SDIOH_API_RC
+sdioh_detach(osl_t *osh, sdioh_info_t *sd)
+{
+ sd_trace(("%s\n", __FUNCTION__));
+ if (sd) {
+ sd_err(("%s: detaching from hardware\n", __FUNCTION__));
+ spi_free_irq(sd->irq, sd);
+#ifndef BCMSPI_ANDROID
+ spi_hw_detach(sd);
+#endif /* !BCMSPI_ANDROID */
+ spi_osfree(sd);
+ MFREE(sd->osh, sd, sizeof(sdioh_info_t));
+ }
+ return SDIOH_API_RC_SUCCESS;
+}
+
+/* Configure callback to client when we recieve client interrupt */
+extern SDIOH_API_RC
+sdioh_interrupt_register(sdioh_info_t *sd, sdioh_cb_fn_t fn, void *argh)
+{
+#ifndef BCMSPI_ANDROID
+ sd_trace(("%s: Entering\n", __FUNCTION__));
+ sd->intr_handler = fn;
+ sd->intr_handler_arg = argh;
+ sd->intr_handler_valid = TRUE;
+#endif /* !BCMSPI_ANDROID */
+ return SDIOH_API_RC_SUCCESS;
+}
+
+extern SDIOH_API_RC
+sdioh_interrupt_deregister(sdioh_info_t *sd)
+{
+#ifndef BCMSPI_ANDROID
+ sd_trace(("%s: Entering\n", __FUNCTION__));
+ sd->intr_handler_valid = FALSE;
+ sd->intr_handler = NULL;
+ sd->intr_handler_arg = NULL;
+#endif /* !BCMSPI_ANDROID */
+ return SDIOH_API_RC_SUCCESS;
+}
+
+extern SDIOH_API_RC
+sdioh_interrupt_query(sdioh_info_t *sd, bool *onoff)
+{
+#ifndef BCMSPI_ANDROID
+ sd_trace(("%s: Entering\n", __FUNCTION__));
+ *onoff = sd->client_intr_enabled;
+#endif /* !BCMSPI_ANDROID */
+ return SDIOH_API_RC_SUCCESS;
+}
+
+#if defined(DHD_DEBUG)
+extern bool
+sdioh_interrupt_pending(sdioh_info_t *sd)
+{
+ return 0;
+}
+#endif
+
+extern SDIOH_API_RC
+sdioh_query_device(sdioh_info_t *sd)
+{
+ /* Return a BRCM ID appropriate to the dongle class */
+ return (sd->num_funcs > 1) ? BCM4329_D11N_ID : BCM4318_D11G_ID;
+}
+
+/* Provide dstatus bits of spi-transaction for dhd layers. */
+extern uint32
+sdioh_get_dstatus(sdioh_info_t *sd)
+{
+ return sd->card_dstatus;
+}
+
+extern void
+sdioh_chipinfo(sdioh_info_t *sd, uint32 chip, uint32 chiprev)
+{
+ sd->chip = chip;
+ sd->chiprev = chiprev;
+}
+
+extern void
+sdioh_dwordmode(sdioh_info_t *sd, bool set)
+{
+ uint8 reg = 0;
+ int status;
+
+ if ((status = sdioh_request_byte(sd, SDIOH_READ, SPI_FUNC_0, SPID_STATUS_ENABLE, &reg)) !=
+ SUCCESS) {
+ sd_err(("%s: Failed to set dwordmode in gSPI\n", __FUNCTION__));
+ return;
+ }
+
+ if (set) {
+ reg |= DWORD_PKT_LEN_EN;
+ sd->dwordmode = TRUE;
+ sd->client_block_size[SPI_FUNC_2] = 4096; /* h2spi's limit is 4KB, we support 8KB */
+ } else {
+ reg &= ~DWORD_PKT_LEN_EN;
+ sd->dwordmode = FALSE;
+ sd->client_block_size[SPI_FUNC_2] = 2048;
+ }
+
+ if ((status = sdioh_request_byte(sd, SDIOH_WRITE, SPI_FUNC_0, SPID_STATUS_ENABLE, &reg)) !=
+ SUCCESS) {
+ sd_err(("%s: Failed to set dwordmode in gSPI\n", __FUNCTION__));
+ return;
+ }
+}
+
+
+uint
+sdioh_query_iofnum(sdioh_info_t *sd)
+{
+ return sd->num_funcs;
+}
+
+/* IOVar table */
+enum {
+ IOV_MSGLEVEL = 1,
+ IOV_BLOCKMODE,
+ IOV_BLOCKSIZE,
+ IOV_DMA,
+ IOV_USEINTS,
+ IOV_NUMINTS,
+ IOV_NUMLOCALINTS,
+ IOV_HOSTREG,
+ IOV_DEVREG,
+ IOV_DIVISOR,
+ IOV_SDMODE,
+ IOV_HISPEED,
+ IOV_HCIREGS,
+ IOV_POWER,
+ IOV_CLOCK,
+ IOV_SPIERRSTATS,
+ IOV_RESP_DELAY_ALL
+};
+
+const bcm_iovar_t sdioh_iovars[] = {
+ {"sd_msglevel", IOV_MSGLEVEL, 0, IOVT_UINT32, 0 },
+ {"sd_blocksize", IOV_BLOCKSIZE, 0, IOVT_UINT32, 0 }, /* ((fn << 16) | size) */
+ {"sd_dma", IOV_DMA, 0, IOVT_BOOL, 0 },
+ {"sd_ints", IOV_USEINTS, 0, IOVT_BOOL, 0 },
+ {"sd_numints", IOV_NUMINTS, 0, IOVT_UINT32, 0 },
+ {"sd_numlocalints", IOV_NUMLOCALINTS, 0, IOVT_UINT32, 0 },
+ {"sd_hostreg", IOV_HOSTREG, 0, IOVT_BUFFER, sizeof(sdreg_t) },
+ {"sd_devreg", IOV_DEVREG, 0, IOVT_BUFFER, sizeof(sdreg_t) },
+ {"sd_divisor", IOV_DIVISOR, 0, IOVT_UINT32, 0 },
+ {"sd_power", IOV_POWER, 0, IOVT_UINT32, 0 },
+ {"sd_clock", IOV_CLOCK, 0, IOVT_UINT32, 0 },
+ {"sd_mode", IOV_SDMODE, 0, IOVT_UINT32, 100},
+ {"sd_highspeed", IOV_HISPEED, 0, IOVT_UINT32, 0},
+ {"spi_errstats", IOV_SPIERRSTATS, 0, IOVT_BUFFER, sizeof(struct spierrstats_t) },
+ {"spi_respdelay", IOV_RESP_DELAY_ALL, 0, IOVT_BOOL, 0 },
+ {NULL, 0, 0, 0, 0 }
+};
+
+int
+sdioh_iovar_op(sdioh_info_t *si, const char *name,
+ void *params, int plen, void *arg, int len, bool set)
+{
+ const bcm_iovar_t *vi = NULL;
+ int bcmerror = 0;
+ int val_size;
+ int32 int_val = 0;
+ bool bool_val;
+ uint32 actionid;
+/*
+ sdioh_regs_t *regs;
+*/
+
+ ASSERT(name);
+ ASSERT(len >= 0);
+
+ /* Get must have return space; Set does not take qualifiers */
+ ASSERT(set || (arg && len));
+ ASSERT(!set || (!params && !plen));
+
+ sd_trace(("%s: Enter (%s %s)\n", __FUNCTION__, (set ? "set" : "get"), name));
+
+ if ((vi = bcm_iovar_lookup(sdioh_iovars, name)) == NULL) {
+ bcmerror = BCME_UNSUPPORTED;
+ goto exit;
+ }
+
+ if ((bcmerror = bcm_iovar_lencheck(vi, arg, len, set)) != 0)
+ goto exit;
+
+ /* Set up params so get and set can share the convenience variables */
+ if (params == NULL) {
+ params = arg;
+ plen = len;
+ }
+
+ if (vi->type == IOVT_VOID)
+ val_size = 0;
+ else if (vi->type == IOVT_BUFFER)
+ val_size = len;
+ else
+ val_size = sizeof(int);
+
+ if (plen >= (int)sizeof(int_val))
+ bcopy(params, &int_val, sizeof(int_val));
+
+ bool_val = (int_val != 0) ? TRUE : FALSE;
+
+ actionid = set ? IOV_SVAL(vi->varid) : IOV_GVAL(vi->varid);
+ switch (actionid) {
+ case IOV_GVAL(IOV_MSGLEVEL):
+ int_val = (int32)sd_msglevel;
+ bcopy(&int_val, arg, val_size);
+ break;
+
+ case IOV_SVAL(IOV_MSGLEVEL):
+ sd_msglevel = int_val;
+ break;
+
+ case IOV_GVAL(IOV_BLOCKSIZE):
+ if ((uint32)int_val > si->num_funcs) {
+ bcmerror = BCME_BADARG;
+ break;
+ }
+ int_val = (int32)si->client_block_size[int_val];
+ bcopy(&int_val, arg, val_size);
+ break;
+
+ case IOV_GVAL(IOV_DMA):
+ int_val = (int32)si->sd_use_dma;
+ bcopy(&int_val, arg, val_size);
+ break;
+
+ case IOV_SVAL(IOV_DMA):
+ si->sd_use_dma = (bool)int_val;
+ break;
+
+ case IOV_GVAL(IOV_USEINTS):
+ int_val = (int32)si->use_client_ints;
+ bcopy(&int_val, arg, val_size);
+ break;
+
+ case IOV_SVAL(IOV_USEINTS):
+ break;
+
+ case IOV_GVAL(IOV_DIVISOR):
+ int_val = (uint32)sd_divisor;
+ bcopy(&int_val, arg, val_size);
+ break;
+
+#ifndef BCMSPI_ANDROID
+ case IOV_SVAL(IOV_DIVISOR):
+ sd_divisor = int_val;
+ if (!spi_start_clock(si, (uint16)sd_divisor)) {
+ sd_err(("%s: set clock failed\n", __FUNCTION__));
+ bcmerror = BCME_ERROR;
+ }
+ break;
+#endif /* !BCMSPI_ANDROID */
+
+ case IOV_GVAL(IOV_POWER):
+ int_val = (uint32)sd_power;
+ bcopy(&int_val, arg, val_size);
+ break;
+
+ case IOV_SVAL(IOV_POWER):
+ sd_power = int_val;
+ break;
+
+ case IOV_GVAL(IOV_CLOCK):
+ int_val = (uint32)sd_clock;
+ bcopy(&int_val, arg, val_size);
+ break;
+
+ case IOV_SVAL(IOV_CLOCK):
+ sd_clock = int_val;
+ break;
+
+ case IOV_GVAL(IOV_SDMODE):
+ int_val = (uint32)sd_sdmode;
+ bcopy(&int_val, arg, val_size);
+ break;
+
+ case IOV_SVAL(IOV_SDMODE):
+ sd_sdmode = int_val;
+ break;
+
+ case IOV_GVAL(IOV_HISPEED):
+ int_val = (uint32)sd_hiok;
+ bcopy(&int_val, arg, val_size);
+ break;
+
+ case IOV_SVAL(IOV_HISPEED):
+ sd_hiok = int_val;
+
+ if (!bcmspi_set_highspeed_mode(si, (bool)sd_hiok)) {
+ sd_err(("%s: Failed changing highspeed mode to %d.\n",
+ __FUNCTION__, sd_hiok));
+ bcmerror = BCME_ERROR;
+ return ERROR;
+ }
+ break;
+
+ case IOV_GVAL(IOV_NUMINTS):
+ int_val = (int32)si->intrcount;
+ bcopy(&int_val, arg, val_size);
+ break;
+
+ case IOV_GVAL(IOV_NUMLOCALINTS):
+ int_val = (int32)si->local_intrcount;
+ bcopy(&int_val, arg, val_size);
+ break;
+ case IOV_GVAL(IOV_DEVREG):
+ {
+ sdreg_t *sd_ptr = (sdreg_t *)params;
+ uint8 data;
+
+ if (sdioh_cfg_read(si, sd_ptr->func, sd_ptr->offset, &data)) {
+ bcmerror = BCME_SDIO_ERROR;
+ break;
+ }
+
+ int_val = (int)data;
+ bcopy(&int_val, arg, sizeof(int_val));
+ break;
+ }
+
+ case IOV_SVAL(IOV_DEVREG):
+ {
+ sdreg_t *sd_ptr = (sdreg_t *)params;
+ uint8 data = (uint8)sd_ptr->value;
+
+ if (sdioh_cfg_write(si, sd_ptr->func, sd_ptr->offset, &data)) {
+ bcmerror = BCME_SDIO_ERROR;
+ break;
+ }
+ break;
+ }
+
+
+ case IOV_GVAL(IOV_SPIERRSTATS):
+ {
+ bcopy(&si->spierrstats, arg, sizeof(struct spierrstats_t));
+ break;
+ }
+
+ case IOV_SVAL(IOV_SPIERRSTATS):
+ {
+ bzero(&si->spierrstats, sizeof(struct spierrstats_t));
+ break;
+ }
+
+ case IOV_GVAL(IOV_RESP_DELAY_ALL):
+ int_val = (int32)si->resp_delay_all;
+ bcopy(&int_val, arg, val_size);
+ break;
+
+ case IOV_SVAL(IOV_RESP_DELAY_ALL):
+ si->resp_delay_all = (bool)int_val;
+ int_val = STATUS_ENABLE|INTR_WITH_STATUS;
+ if (si->resp_delay_all)
+ int_val |= RESP_DELAY_ALL;
+ else {
+ if (bcmspi_card_regwrite(si, SPI_FUNC_0, SPID_RESPONSE_DELAY, 1,
+ F1_RESPONSE_DELAY) != SUCCESS) {
+ sd_err(("%s: Unable to set response delay.\n", __FUNCTION__));
+ bcmerror = BCME_SDIO_ERROR;
+ break;
+ }
+ }
+
+ if (bcmspi_card_regwrite(si, SPI_FUNC_0, SPID_STATUS_ENABLE, 1, int_val)
+ != SUCCESS) {
+ sd_err(("%s: Unable to set response delay.\n", __FUNCTION__));
+ bcmerror = BCME_SDIO_ERROR;
+ break;
+ }
+ break;
+
+ default:
+ bcmerror = BCME_UNSUPPORTED;
+ break;
+ }
+exit:
+
+ return bcmerror;
+}
+
+extern SDIOH_API_RC
+sdioh_cfg_read(sdioh_info_t *sd, uint fnc_num, uint32 addr, uint8 *data)
+{
+ SDIOH_API_RC status;
+ /* No lock needed since sdioh_request_byte does locking */
+ status = sdioh_request_byte(sd, SDIOH_READ, fnc_num, addr, data);
+ return status;
+}
+
+extern SDIOH_API_RC
+sdioh_cfg_write(sdioh_info_t *sd, uint fnc_num, uint32 addr, uint8 *data)
+{
+ /* No lock needed since sdioh_request_byte does locking */
+ SDIOH_API_RC status;
+
+ if ((fnc_num == SPI_FUNC_1) && (addr == SBSDIO_FUNC1_FRAMECTRL)) {
+ uint8 dummy_data;
+ status = sdioh_cfg_read(sd, fnc_num, addr, &dummy_data);
+ if (status) {
+ sd_err(("sdioh_cfg_read() failed.\n"));
+ return status;
+ }
+ }
+
+ status = sdioh_request_byte(sd, SDIOH_WRITE, fnc_num, addr, data);
+ return status;
+}
+
+extern SDIOH_API_RC
+sdioh_cis_read(sdioh_info_t *sd, uint func, uint8 *cisd, uint32 length)
+{
+ uint32 count;
+ int offset;
+ uint32 cis_byte;
+ uint16 *cis = (uint16 *)cisd;
+ uint bar0 = SI_ENUM_BASE;
+ int status;
+ uint8 data;
+
+ sd_trace(("%s: Func %d\n", __FUNCTION__, func));
+
+ spi_lock(sd);
+
+ /* Set sb window address to 0x18000000 */
+ data = (bar0 >> 8) & SBSDIO_SBADDRLOW_MASK;
+ status = bcmspi_card_bytewrite(sd, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRLOW, &data);
+ if (status == SUCCESS) {
+ data = (bar0 >> 16) & SBSDIO_SBADDRMID_MASK;
+ status = bcmspi_card_bytewrite(sd, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRMID, &data);
+ } else {
+ sd_err(("%s: Unable to set sb-addr-windows\n", __FUNCTION__));
+ spi_unlock(sd);
+ return (BCME_ERROR);
+ }
+ if (status == SUCCESS) {
+ data = (bar0 >> 24) & SBSDIO_SBADDRHIGH_MASK;
+ status = bcmspi_card_bytewrite(sd, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRHIGH, &data);
+ } else {
+ sd_err(("%s: Unable to set sb-addr-windows\n", __FUNCTION__));
+ spi_unlock(sd);
+ return (BCME_ERROR);
+ }
+
+ offset = CC_SROM_OTP; /* OTP offset in chipcommon. */
+ for (count = 0; count < length/2; count++) {
+ if (bcmspi_card_regread (sd, SDIO_FUNC_1, offset, 2, &cis_byte) < 0) {
+ sd_err(("%s: regread failed: Can't read CIS\n", __FUNCTION__));
+ spi_unlock(sd);
+ return (BCME_ERROR);
+ }
+
+ *cis = (uint16)cis_byte;
+ cis++;
+ offset += 2;
+ }
+
+ spi_unlock(sd);
+
+ return (BCME_OK);
+}
+
+extern SDIOH_API_RC
+sdioh_request_byte(sdioh_info_t *sd, uint rw, uint func, uint regaddr, uint8 *byte)
+{
+ int status;
+ uint32 cmd_arg;
+ uint32 dstatus;
+ uint32 data = (uint32)(*byte);
+
+ spi_lock(sd);
+
+ cmd_arg = 0;
+ cmd_arg = SFIELD(cmd_arg, SPI_FUNCTION, func);
+ cmd_arg = SFIELD(cmd_arg, SPI_ACCESS, 1); /* Incremental access */
+ cmd_arg = SFIELD(cmd_arg, SPI_REG_ADDR, regaddr);
+ cmd_arg = SFIELD(cmd_arg, SPI_RW_FLAG, rw == SDIOH_READ ? 0 : 1);
+ cmd_arg = SFIELD(cmd_arg, SPI_LEN, 1);
+
+ if (rw == SDIOH_READ) {
+ sd_trace(("%s: RD cmd_arg=0x%x func=%d regaddr=0x%x\n",
+ __FUNCTION__, cmd_arg, func, regaddr));
+ } else {
+ sd_trace(("%s: WR cmd_arg=0x%x func=%d regaddr=0x%x data=0x%x\n",
+ __FUNCTION__, cmd_arg, func, regaddr, data));
+ }
+
+ if ((status = bcmspi_cmd_issue(sd, sd->sd_use_dma, cmd_arg, &data, 1)) != SUCCESS) {
+ spi_unlock(sd);
+ return status;
+ }
+
+ if (rw == SDIOH_READ) {
+ *byte = (uint8)data;
+ sd_trace(("%s: RD result=0x%x\n", __FUNCTION__, *byte));
+ }
+
+ bcmspi_cmd_getdstatus(sd, &dstatus);
+ if (dstatus)
+ sd_trace(("dstatus=0x%x\n", dstatus));
+
+ spi_unlock(sd);
+ return SDIOH_API_RC_SUCCESS;
+}
+
+extern SDIOH_API_RC
+sdioh_request_word(sdioh_info_t *sd, uint cmd_type, uint rw, uint func, uint addr,
+ uint32 *word, uint nbytes)
+{
+ int status;
+
+ spi_lock(sd);
+
+ if (rw == SDIOH_READ)
+ status = bcmspi_card_regread(sd, func, addr, nbytes, word);
+ else
+ status = bcmspi_card_regwrite(sd, func, addr, nbytes, *word);
+
+ spi_unlock(sd);
+ return (status == SUCCESS ? SDIOH_API_RC_SUCCESS : SDIOH_API_RC_FAIL);
+}
+
+extern SDIOH_API_RC
+sdioh_request_buffer(sdioh_info_t *sd, uint pio_dma, uint fix_inc, uint rw, uint func,
+ uint addr, uint reg_width, uint buflen_u, uint8 *buffer, void *pkt)
+{
+ int len;
+ int buflen = (int)buflen_u;
+ bool fifo = (fix_inc == SDIOH_DATA_FIX);
+
+ spi_lock(sd);
+
+ ASSERT(reg_width == 4);
+ ASSERT(buflen_u < (1 << 30));
+ ASSERT(sd->client_block_size[func]);
+
+ sd_data(("%s: %c len %d r_cnt %d t_cnt %d, pkt @0x%p\n",
+ __FUNCTION__, rw == SDIOH_READ ? 'R' : 'W',
+ buflen_u, sd->r_cnt, sd->t_cnt, pkt));
+
+ /* Break buffer down into blocksize chunks. */
+ while (buflen > 0) {
+ len = MIN(sd->client_block_size[func], buflen);
+ if (bcmspi_card_buf(sd, rw, func, fifo, addr, len, (uint32 *)buffer) != SUCCESS) {
+ sd_err(("%s: bcmspi_card_buf %s failed\n",
+ __FUNCTION__, rw == SDIOH_READ ? "Read" : "Write"));
+ spi_unlock(sd);
+ return SDIOH_API_RC_FAIL;
+ }
+ buffer += len;
+ buflen -= len;
+ if (!fifo)
+ addr += len;
+ }
+ spi_unlock(sd);
+ return SDIOH_API_RC_SUCCESS;
+}
+
+/* This function allows write to gspi bus when another rd/wr function is deep down the call stack.
+ * Its main aim is to have simpler spi writes rather than recursive writes.
+ * e.g. When there is a need to program response delay on the fly after detecting the SPI-func
+ * this call will allow to program the response delay.
+ */
+static int
+bcmspi_card_byterewrite(sdioh_info_t *sd, int func, uint32 regaddr, uint8 byte)
+{
+ uint32 cmd_arg;
+ uint32 datalen = 1;
+ uint32 hostlen;
+
+ cmd_arg = 0;
+
+ cmd_arg = SFIELD(cmd_arg, SPI_RW_FLAG, 1);
+ cmd_arg = SFIELD(cmd_arg, SPI_ACCESS, 1); /* Incremental access */
+ cmd_arg = SFIELD(cmd_arg, SPI_FUNCTION, func);
+ cmd_arg = SFIELD(cmd_arg, SPI_REG_ADDR, regaddr);
+ cmd_arg = SFIELD(cmd_arg, SPI_LEN, datalen);
+
+ sd_trace(("%s cmd_arg = 0x%x\n", __FUNCTION__, cmd_arg));
+
+
+ /* Set up and issue the SPI command. MSByte goes out on bus first. Increase datalen
+ * according to the wordlen mode(16/32bit) the device is in.
+ */
+ ASSERT(sd->wordlen == 4 || sd->wordlen == 2);
+ datalen = ROUNDUP(datalen, sd->wordlen);
+
+ /* Start by copying command in the spi-outbuffer */
+ if (sd->wordlen == 4) { /* 32bit spid */
+ *(uint32 *)spi_outbuf2 = SPISWAP_WD4(cmd_arg);
+ if (datalen & 0x3)
+ datalen += (4 - (datalen & 0x3));
+ } else if (sd->wordlen == 2) { /* 16bit spid */
+ *(uint32 *)spi_outbuf2 = SPISWAP_WD2(cmd_arg);
+ if (datalen & 0x1)
+ datalen++;
+ } else {
+ sd_err(("%s: Host is %d bit spid, could not create SPI command.\n",
+ __FUNCTION__, 8 * sd->wordlen));
+ return ERROR;
+ }
+
+ /* for Write, put the data into the output buffer */
+ if (datalen != 0) {
+ if (sd->wordlen == 4) { /* 32bit spid */
+ *(uint32 *)&spi_outbuf2[CMDLEN] = SPISWAP_WD4(byte);
+ } else if (sd->wordlen == 2) { /* 16bit spid */
+ *(uint32 *)&spi_outbuf2[CMDLEN] = SPISWAP_WD2(byte);
+ }
+ }
+
+ /* +4 for cmd, +4 for dstatus */
+ hostlen = datalen + 8;
+ hostlen += (4 - (hostlen & 0x3));
+ spi_sendrecv(sd, spi_outbuf2, spi_inbuf2, hostlen);
+
+ /* Last 4bytes are dstatus. Device is configured to return status bits. */
+ if (sd->wordlen == 4) { /* 32bit spid */
+ sd->card_dstatus = SPISWAP_WD4(*(uint32 *)&spi_inbuf2[datalen + CMDLEN ]);
+ } else if (sd->wordlen == 2) { /* 16bit spid */
+ sd->card_dstatus = SPISWAP_WD2(*(uint32 *)&spi_inbuf2[datalen + CMDLEN ]);
+ } else {
+ sd_err(("%s: Host is %d bit machine, could not read SPI dstatus.\n",
+ __FUNCTION__, 8 * sd->wordlen));
+ return ERROR;
+ }
+
+ if (sd->card_dstatus)
+ sd_trace(("dstatus after byte rewrite = 0x%x\n", sd->card_dstatus));
+
+ return (BCME_OK);
+}
+
+/* Program the response delay corresponding to the spi function */
+static int
+bcmspi_prog_resp_delay(sdioh_info_t *sd, int func, uint8 resp_delay)
+{
+ if (sd->resp_delay_all == FALSE)
+ return (BCME_OK);
+
+ if (sd->prev_fun == func)
+ return (BCME_OK);
+
+ if (F0_RESPONSE_DELAY == F1_RESPONSE_DELAY)
+ return (BCME_OK);
+
+ bcmspi_card_byterewrite(sd, SPI_FUNC_0, SPID_RESPONSE_DELAY, resp_delay);
+
+ /* Remember function for which to avoid reprogramming resp-delay in next iteration */
+ sd->prev_fun = func;
+
+ return (BCME_OK);
+
+}
+
+#define GSPI_RESYNC_PATTERN 0x0
+
+/* A resync pattern is a 32bit MOSI line with all zeros. Its a special command in gSPI.
+ * It resets the spi-bkplane logic so that all F1 related ping-pong buffer logic is
+ * synchronised and all queued resuests are cancelled.
+ */
+static int
+bcmspi_resync_f1(sdioh_info_t *sd)
+{
+ uint32 cmd_arg = GSPI_RESYNC_PATTERN, data = 0, datalen = 0;
+
+
+ /* Set up and issue the SPI command. MSByte goes out on bus first. Increase datalen
+ * according to the wordlen mode(16/32bit) the device is in.
+ */
+ ASSERT(sd->wordlen == 4 || sd->wordlen == 2);
+ datalen = ROUNDUP(datalen, sd->wordlen);
+
+ /* Start by copying command in the spi-outbuffer */
+ *(uint32 *)spi_outbuf2 = cmd_arg;
+
+ /* for Write, put the data into the output buffer */
+ *(uint32 *)&spi_outbuf2[CMDLEN] = data;
+
+ /* +4 for cmd, +4 for dstatus */
+ spi_sendrecv(sd, spi_outbuf2, spi_inbuf2, datalen + 8);
+
+ /* Last 4bytes are dstatus. Device is configured to return status bits. */
+ if (sd->wordlen == 4) { /* 32bit spid */
+ sd->card_dstatus = SPISWAP_WD4(*(uint32 *)&spi_inbuf2[datalen + CMDLEN ]);
+ } else if (sd->wordlen == 2) { /* 16bit spid */
+ sd->card_dstatus = SPISWAP_WD2(*(uint32 *)&spi_inbuf2[datalen + CMDLEN ]);
+ } else {
+ sd_err(("%s: Host is %d bit machine, could not read SPI dstatus.\n",
+ __FUNCTION__, 8 * sd->wordlen));
+ return ERROR;
+ }
+
+ if (sd->card_dstatus)
+ sd_trace(("dstatus after resync pattern write = 0x%x\n", sd->card_dstatus));
+
+ return (BCME_OK);
+}
+
+uint32 dstatus_count = 0;
+
+static int
+bcmspi_update_stats(sdioh_info_t *sd, uint32 cmd_arg)
+{
+ uint32 dstatus = sd->card_dstatus;
+ struct spierrstats_t *spierrstats = &sd->spierrstats;
+ int err = SUCCESS;
+
+ sd_trace(("cmd = 0x%x, dstatus = 0x%x\n", cmd_arg, dstatus));
+
+ /* Store dstatus of last few gSPI transactions */
+ spierrstats->dstatus[dstatus_count % NUM_PREV_TRANSACTIONS] = dstatus;
+ spierrstats->spicmd[dstatus_count % NUM_PREV_TRANSACTIONS] = cmd_arg;
+ dstatus_count++;
+
+ if (sd->card_init_done == FALSE)
+ return err;
+
+ if (dstatus & STATUS_DATA_NOT_AVAILABLE) {
+ spierrstats->dna++;
+ sd_trace(("Read data not available on F1 addr = 0x%x\n",
+ GFIELD(cmd_arg, SPI_REG_ADDR)));
+ /* Clear dna bit */
+ bcmspi_card_byterewrite(sd, SPI_FUNC_0, SPID_INTR_REG, DATA_UNAVAILABLE);
+ }
+
+ if (dstatus & STATUS_UNDERFLOW) {
+ spierrstats->rdunderflow++;
+ sd_err(("FIFO underflow happened due to current F2 read command.\n"));
+ }
+
+ if (dstatus & STATUS_OVERFLOW) {
+ spierrstats->wroverflow++;
+ sd_err(("FIFO overflow happened due to current (F1/F2) write command.\n"));
+ bcmspi_card_byterewrite(sd, SPI_FUNC_0, SPID_INTR_REG, F1_OVERFLOW);
+ bcmspi_resync_f1(sd);
+ sd_err(("Recovering from F1 FIFO overflow.\n"));
+ }
+
+ if (dstatus & STATUS_F2_INTR) {
+ spierrstats->f2interrupt++;
+ sd_trace(("Interrupt from F2. SW should clear corresponding IntStatus bits\n"));
+ }
+
+ if (dstatus & STATUS_F3_INTR) {
+ spierrstats->f3interrupt++;
+ sd_err(("Interrupt from F3. SW should clear corresponding IntStatus bits\n"));
+ }
+
+ if (dstatus & STATUS_HOST_CMD_DATA_ERR) {
+ spierrstats->hostcmddataerr++;
+ sd_err(("Error in CMD or Host data, detected by CRC/Checksum (optional)\n"));
+ }
+
+ if (dstatus & STATUS_F2_PKT_AVAILABLE) {
+ spierrstats->f2pktavailable++;
+ sd_trace(("Packet is available/ready in F2 TX FIFO\n"));
+ sd_trace(("Packet length = %d\n", sd->dwordmode ?
+ ((dstatus & STATUS_F2_PKT_LEN_MASK) >> (STATUS_F2_PKT_LEN_SHIFT - 2)) :
+ ((dstatus & STATUS_F2_PKT_LEN_MASK) >> STATUS_F2_PKT_LEN_SHIFT)));
+ }
+
+ if (dstatus & STATUS_F3_PKT_AVAILABLE) {
+ spierrstats->f3pktavailable++;
+ sd_err(("Packet is available/ready in F3 TX FIFO\n"));
+ sd_err(("Packet length = %d\n",
+ (dstatus & STATUS_F3_PKT_LEN_MASK) >> STATUS_F3_PKT_LEN_SHIFT));
+ }
+
+ return err;
+}
+
+extern int
+sdioh_abort(sdioh_info_t *sd, uint func)
+{
+ return 0;
+}
+
+int
+sdioh_start(sdioh_info_t *sd, int stage)
+{
+ return SUCCESS;
+}
+
+int
+sdioh_stop(sdioh_info_t *sd)
+{
+ return SUCCESS;
+}
+
+int
+sdioh_waitlockfree(sdioh_info_t *sd)
+{
+ return SUCCESS;
+}
+
+
+/*
+ * Private/Static work routines
+ */
+static int
+bcmspi_host_init(sdioh_info_t *sd)
+{
+
+ /* Default power on mode */
+ sd->sd_mode = SDIOH_MODE_SPI;
+ sd->polled_mode = TRUE;
+ sd->host_init_done = TRUE;
+ sd->card_init_done = FALSE;
+ sd->adapter_slot = 1;
+
+ return (SUCCESS);
+}
+
+static int
+get_client_blocksize(sdioh_info_t *sd)
+{
+ uint32 regdata[2];
+ int status;
+
+ /* Find F1/F2/F3 max packet size */
+ if ((status = bcmspi_card_regread(sd, 0, SPID_F1_INFO_REG,
+ 8, regdata)) != SUCCESS) {
+ return status;
+ }
+
+ sd_trace(("pkt_size regdata[0] = 0x%x, regdata[1] = 0x%x\n",
+ regdata[0], regdata[1]));
+
+ sd->client_block_size[1] = (regdata[0] & F1_MAX_PKT_SIZE) >> 2;
+ sd_trace(("Func1 blocksize = %d\n", sd->client_block_size[1]));
+ ASSERT(sd->client_block_size[1] == BLOCK_SIZE_F1);
+
+ sd->client_block_size[2] = ((regdata[0] >> 16) & F2_MAX_PKT_SIZE) >> 2;
+ sd_trace(("Func2 blocksize = %d\n", sd->client_block_size[2]));
+ ASSERT(sd->client_block_size[2] == BLOCK_SIZE_F2);
+
+ sd->client_block_size[3] = (regdata[1] & F3_MAX_PKT_SIZE) >> 2;
+ sd_trace(("Func3 blocksize = %d\n", sd->client_block_size[3]));
+ ASSERT(sd->client_block_size[3] == BLOCK_SIZE_F3);
+
+ return 0;
+}
+
+static int
+bcmspi_client_init(sdioh_info_t *sd)
+{
+ uint32 status_en_reg = 0;
+ sd_trace(("%s: Powering up slot %d\n", __FUNCTION__, sd->adapter_slot));
+
+#ifndef BCMSPI_ANDROID
+#ifdef HSMODE
+ if (!spi_start_clock(sd, (uint16)sd_divisor)) {
+ sd_err(("spi_start_clock failed\n"));
+ return ERROR;
+ }
+#else
+ /* Start at ~400KHz clock rate for initialization */
+ if (!spi_start_clock(sd, 128)) {
+ sd_err(("spi_start_clock failed\n"));
+ return ERROR;
+ }
+#endif /* HSMODE */
+#endif /* !BCMSPI_ANDROID */
+
+ if (!bcmspi_host_device_init_adapt(sd)) {
+ sd_err(("bcmspi_host_device_init_adapt failed\n"));
+ return ERROR;
+ }
+
+ if (!bcmspi_test_card(sd)) {
+ sd_err(("bcmspi_test_card failed\n"));
+ return ERROR;
+ }
+
+ sd->num_funcs = SPI_MAX_IOFUNCS;
+
+ get_client_blocksize(sd);
+
+ /* Apply resync pattern cmd with all zeros to reset spi-bkplane F1 logic */
+ bcmspi_resync_f1(sd);
+
+ sd->dwordmode = FALSE;
+
+ bcmspi_card_regread(sd, 0, SPID_STATUS_ENABLE, 1, &status_en_reg);
+
+ sd_trace(("%s: Enabling interrupt with dstatus \n", __FUNCTION__));
+ status_en_reg |= INTR_WITH_STATUS;
+
+ if (bcmspi_card_regwrite(sd, SPI_FUNC_0, SPID_STATUS_ENABLE, 1,
+ status_en_reg & 0xff) != SUCCESS) {
+ sd_err(("%s: Unable to set response delay for all fun's.\n", __FUNCTION__));
+ return ERROR;
+ }
+
+#ifndef HSMODE
+#ifndef BCMSPI_ANDROID
+ /* After configuring for High-Speed mode, set the desired clock rate. */
+ if (!spi_start_clock(sd, 4)) {
+ sd_err(("spi_start_clock failed\n"));
+ return ERROR;
+ }
+#endif /* !BCMSPI_ANDROID */
+#endif /* HSMODE */
+
+ /* check to see if the response delay needs to be programmed properly */
+ {
+ uint32 f1_respdelay = 0;
+ bcmspi_card_regread(sd, 0, SPID_RESP_DELAY_F1, 1, &f1_respdelay);
+ if ((f1_respdelay == 0) || (f1_respdelay == 0xFF)) {
+ /* older sdiodevice core and has no separte resp delay for each of */
+ sd_err(("older corerev < 4 so use the same resp delay for all funcs\n"));
+ sd->resp_delay_new = FALSE;
+ }
+ else {
+ /* older sdiodevice core and has no separte resp delay for each of */
+ int ret_val;
+ sd->resp_delay_new = TRUE;
+ sd_err(("new corerev >= 4 so set the resp delay for each of the funcs\n"));
+ sd_trace(("resp delay for funcs f0(%d), f1(%d), f2(%d), f3(%d)\n",
+ GSPI_F0_RESP_DELAY, GSPI_F1_RESP_DELAY,
+ GSPI_F2_RESP_DELAY, GSPI_F3_RESP_DELAY));
+ ret_val = bcmspi_card_regwrite(sd, SPI_FUNC_0, SPID_RESP_DELAY_F0, 1,
+ GSPI_F0_RESP_DELAY);
+ if (ret_val != SUCCESS) {
+ sd_err(("%s: Unable to set response delay for F0\n", __FUNCTION__));
+ return ERROR;
+ }
+ ret_val = bcmspi_card_regwrite(sd, SPI_FUNC_0, SPID_RESP_DELAY_F1, 1,
+ GSPI_F1_RESP_DELAY);
+ if (ret_val != SUCCESS) {
+ sd_err(("%s: Unable to set response delay for F1\n", __FUNCTION__));
+ return ERROR;
+ }
+ ret_val = bcmspi_card_regwrite(sd, SPI_FUNC_0, SPID_RESP_DELAY_F2, 1,
+ GSPI_F2_RESP_DELAY);
+ if (ret_val != SUCCESS) {
+ sd_err(("%s: Unable to set response delay for F2\n", __FUNCTION__));
+ return ERROR;
+ }
+ ret_val = bcmspi_card_regwrite(sd, SPI_FUNC_0, SPID_RESP_DELAY_F3, 1,
+ GSPI_F3_RESP_DELAY);
+ if (ret_val != SUCCESS) {
+ sd_err(("%s: Unable to set response delay for F2\n", __FUNCTION__));
+ return ERROR;
+ }
+ }
+ }
+
+
+ sd->card_init_done = TRUE;
+
+ /* get the device rev to program the prop respdelays */
+
+ return SUCCESS;
+}
+
+static int
+bcmspi_set_highspeed_mode(sdioh_info_t *sd, bool hsmode)
+{
+ uint32 regdata;
+ int status;
+
+ if ((status = bcmspi_card_regread(sd, 0, SPID_CONFIG,
+ 4, &regdata)) != SUCCESS)
+ return status;
+
+ sd_trace(("In %s spih-ctrl = 0x%x \n", __FUNCTION__, regdata));
+
+
+ if (hsmode == TRUE) {
+ sd_trace(("Attempting to enable High-Speed mode.\n"));
+
+ if (regdata & HIGH_SPEED_MODE) {
+ sd_trace(("Device is already in High-Speed mode.\n"));
+ return status;
+ } else {
+ regdata |= HIGH_SPEED_MODE;
+ sd_trace(("Writing %08x to device at %08x\n", regdata, SPID_CONFIG));
+ if ((status = bcmspi_card_regwrite(sd, 0, SPID_CONFIG,
+ 4, regdata)) != SUCCESS) {
+ return status;
+ }
+ }
+ } else {
+ sd_trace(("Attempting to disable High-Speed mode.\n"));
+
+ if (regdata & HIGH_SPEED_MODE) {
+ regdata &= ~HIGH_SPEED_MODE;
+ sd_trace(("Writing %08x to device at %08x\n", regdata, SPID_CONFIG));
+ if ((status = bcmspi_card_regwrite(sd, 0, SPID_CONFIG,
+ 4, regdata)) != SUCCESS)
+ return status;
+ }
+ else {
+ sd_trace(("Device is already in Low-Speed mode.\n"));
+ return status;
+ }
+ }
+#ifndef BCMSPI_ANDROID
+ spi_controller_highspeed_mode(sd, hsmode);
+#endif /* !BCMSPI_ANDROID */
+
+ return TRUE;
+}
+
+#define bcmspi_find_curr_mode(sd) { \
+ sd->wordlen = 2; \
+ status = bcmspi_card_regread_fixedaddr(sd, 0, SPID_TEST_READ, 4, &regdata); \
+ regdata &= 0xff; \
+ if ((regdata == 0xad) || (regdata == 0x5b) || \
+ (regdata == 0x5d) || (regdata == 0x5a)) \
+ break; \
+ sd->wordlen = 4; \
+ status = bcmspi_card_regread_fixedaddr(sd, 0, SPID_TEST_READ, 4, &regdata); \
+ regdata &= 0xff; \
+ if ((regdata == 0xad) || (regdata == 0x5b) || \
+ (regdata == 0x5d) || (regdata == 0x5a)) \
+ break; \
+ sd_trace(("Silicon testability issue: regdata = 0x%x." \
+ " Expected 0xad, 0x5a, 0x5b or 0x5d.\n", regdata)); \
+ OSL_DELAY(100000); \
+}
+
+#define INIT_ADAPT_LOOP 100
+
+/* Adapt clock-phase-speed-bitwidth between host and device */
+static bool
+bcmspi_host_device_init_adapt(sdioh_info_t *sd)
+{
+ uint32 wrregdata, regdata = 0;
+ int status;
+ int i;
+
+ /* Due to a silicon testability issue, the first command from the Host
+ * to the device will get corrupted (first bit will be lost). So the
+ * Host should poll the device with a safe read request. ie: The Host
+ * should try to read F0 addr 0x14 using the Fixed address mode
+ * (This will prevent a unintended write command to be detected by device)
+ */
+ for (i = 0; i < INIT_ADAPT_LOOP; i++) {
+ /* If device was not power-cycled it will stay in 32bit mode with
+ * response-delay-all bit set. Alternate the iteration so that
+ * read either with or without response-delay for F0 to succeed.
+ */
+ bcmspi_find_curr_mode(sd);
+ sd->resp_delay_all = (i & 0x1) ? TRUE : FALSE;
+
+ bcmspi_find_curr_mode(sd);
+ sd->dwordmode = TRUE;
+
+ bcmspi_find_curr_mode(sd);
+ sd->dwordmode = FALSE;
+ }
+
+ /* Bail out, device not detected */
+ if (i == INIT_ADAPT_LOOP)
+ return FALSE;
+
+ /* Softreset the spid logic */
+ if ((sd->dwordmode) || (sd->wordlen == 4)) {
+ bcmspi_card_regwrite(sd, 0, SPID_RESET_BP, 1, RESET_ON_WLAN_BP_RESET|RESET_SPI);
+ bcmspi_card_regread(sd, 0, SPID_RESET_BP, 1, &regdata);
+ sd_trace(("reset reg read = 0x%x\n", regdata));
+ sd_trace(("dwordmode = %d, wordlen = %d, resp_delay_all = %d\n", sd->dwordmode,
+ sd->wordlen, sd->resp_delay_all));
+ /* Restore default state after softreset */
+ sd->wordlen = 2;
+ sd->dwordmode = FALSE;
+ }
+
+ if (sd->wordlen == 4) {
+ if ((status = bcmspi_card_regread(sd, 0, SPID_TEST_READ, 4, &regdata)) !=
+ SUCCESS)
+ return FALSE;
+ if (regdata == TEST_RO_DATA_32BIT_LE) {
+ sd_trace(("Spid is already in 32bit LE mode. Value read = 0x%x\n",
+ regdata));
+ sd_trace(("Spid power was left on.\n"));
+ } else {
+ sd_err(("Spid power was left on but signature read failed."
+ " Value read = 0x%x\n", regdata));
+ return FALSE;
+ }
+ } else {
+ sd->wordlen = 2;
+
+#define CTRL_REG_DEFAULT 0x00010430 /* according to the host m/c */
+
+ wrregdata = (CTRL_REG_DEFAULT);
+
+ if ((status = bcmspi_card_regread(sd, 0, SPID_TEST_READ, 4, &regdata)) != SUCCESS)
+ return FALSE;
+ sd_trace(("(we are still in 16bit mode) 32bit READ LE regdata = 0x%x\n", regdata));
+
+#ifndef HSMODE
+ wrregdata |= (CLOCK_PHASE | CLOCK_POLARITY);
+ wrregdata &= ~HIGH_SPEED_MODE;
+ bcmspi_card_regwrite(sd, 0, SPID_CONFIG, 4, wrregdata);
+#endif /* HSMODE */
+
+ for (i = 0; i < INIT_ADAPT_LOOP; i++) {
+ if ((regdata == 0xfdda7d5b) || (regdata == 0xfdda7d5a)) {
+ sd_trace(("0xfeedbead was leftshifted by 1-bit.\n"));
+ if ((status = bcmspi_card_regread(sd, 0, SPID_TEST_READ, 4,
+ &regdata)) != SUCCESS)
+ return FALSE;
+ }
+ OSL_DELAY(1000);
+ }
+
+#ifndef CUSTOMER_HW4
+ /* Change to host controller intr-polarity of active-low */
+ wrregdata &= ~INTR_POLARITY;
+#else
+ /* Change to host controller intr-polarity of active-high */
+ wrregdata |= INTR_POLARITY;
+#endif
+ sd_trace(("(we are still in 16bit mode) 32bit Write LE reg-ctrl-data = 0x%x\n",
+ wrregdata));
+ /* Change to 32bit mode */
+ wrregdata |= WORD_LENGTH_32;
+ bcmspi_card_regwrite(sd, 0, SPID_CONFIG, 4, wrregdata);
+
+ /* Change command/data packaging in 32bit LE mode */
+ sd->wordlen = 4;
+
+ if ((status = bcmspi_card_regread(sd, 0, SPID_TEST_READ, 4, &regdata)) != SUCCESS)
+ return FALSE;
+
+ if (regdata == TEST_RO_DATA_32BIT_LE) {
+ sd_trace(("Read spid passed. Value read = 0x%x\n", regdata));
+ sd_trace(("Spid had power-on cycle OR spi was soft-resetted \n"));
+ } else {
+ sd_err(("Stale spid reg values read as it was kept powered. Value read ="
+ "0x%x\n", regdata));
+ return FALSE;
+ }
+ }
+
+
+ return TRUE;
+}
+
+static bool
+bcmspi_test_card(sdioh_info_t *sd)
+{
+ uint32 regdata;
+ int status;
+
+ if ((status = bcmspi_card_regread(sd, 0, SPID_TEST_READ, 4, &regdata)) != SUCCESS)
+ return FALSE;
+
+ if (regdata == (TEST_RO_DATA_32BIT_LE))
+ sd_trace(("32bit LE regdata = 0x%x\n", regdata));
+ else {
+ sd_trace(("Incorrect 32bit LE regdata = 0x%x\n", regdata));
+ return FALSE;
+ }
+
+
+#define RW_PATTERN1 0xA0A1A2A3
+#define RW_PATTERN2 0x4B5B6B7B
+
+ regdata = RW_PATTERN1;
+ if ((status = bcmspi_card_regwrite(sd, 0, SPID_TEST_RW, 4, regdata)) != SUCCESS)
+ return FALSE;
+ regdata = 0;
+ if ((status = bcmspi_card_regread(sd, 0, SPID_TEST_RW, 4, &regdata)) != SUCCESS)
+ return FALSE;
+ if (regdata != RW_PATTERN1) {
+ sd_err(("Write-Read spid failed. Value wrote = 0x%x, Value read = 0x%x\n",
+ RW_PATTERN1, regdata));
+ return FALSE;
+ } else
+ sd_trace(("R/W spid passed. Value read = 0x%x\n", regdata));
+
+ regdata = RW_PATTERN2;
+ if ((status = bcmspi_card_regwrite(sd, 0, SPID_TEST_RW, 4, regdata)) != SUCCESS)
+ return FALSE;
+ regdata = 0;
+ if ((status = bcmspi_card_regread(sd, 0, SPID_TEST_RW, 4, &regdata)) != SUCCESS)
+ return FALSE;
+ if (regdata != RW_PATTERN2) {
+ sd_err(("Write-Read spid failed. Value wrote = 0x%x, Value read = 0x%x\n",
+ RW_PATTERN2, regdata));
+ return FALSE;
+ } else
+ sd_trace(("R/W spid passed. Value read = 0x%x\n", regdata));
+
+ return TRUE;
+}
+
+static int
+bcmspi_driver_init(sdioh_info_t *sd)
+{
+ sd_trace(("%s\n", __FUNCTION__));
+ if ((bcmspi_host_init(sd)) != SUCCESS) {
+ return ERROR;
+ }
+
+ if (bcmspi_client_init(sd) != SUCCESS) {
+ return ERROR;
+ }
+
+ return SUCCESS;
+}
+
+/* Read device reg */
+static int
+bcmspi_card_regread(sdioh_info_t *sd, int func, uint32 regaddr, int regsize, uint32 *data)
+{
+ int status;
+ uint32 cmd_arg, dstatus;
+
+ ASSERT(regsize);
+
+ if (func == 2)
+ sd_trace(("Reg access on F2 will generate error indication in dstatus bits.\n"));
+
+ cmd_arg = 0;
+ cmd_arg = SFIELD(cmd_arg, SPI_RW_FLAG, 0);
+ cmd_arg = SFIELD(cmd_arg, SPI_ACCESS, 1); /* Incremental access */
+ cmd_arg = SFIELD(cmd_arg, SPI_FUNCTION, func);
+ cmd_arg = SFIELD(cmd_arg, SPI_REG_ADDR, regaddr);
+ cmd_arg = SFIELD(cmd_arg, SPI_LEN, regsize == BLOCK_SIZE_F2 ? 0 : regsize);
+
+ sd_trace(("%s: RD cmd_arg=0x%x func=%d regaddr=0x%x regsize=%d\n",
+ __FUNCTION__, cmd_arg, func, regaddr, regsize));
+
+ if ((status = bcmspi_cmd_issue(sd, sd->sd_use_dma, cmd_arg, data, regsize)) != SUCCESS)
+ return status;
+
+ bcmspi_cmd_getdstatus(sd, &dstatus);
+ if (dstatus)
+ sd_trace(("dstatus =0x%x\n", dstatus));
+
+ return SUCCESS;
+}
+
+static int
+bcmspi_card_regread_fixedaddr(sdioh_info_t *sd, int func, uint32 regaddr, int regsize, uint32 *data)
+{
+
+ int status;
+ uint32 cmd_arg;
+ uint32 dstatus;
+
+ ASSERT(regsize);
+
+ if (func == 2)
+ sd_trace(("Reg access on F2 will generate error indication in dstatus bits.\n"));
+
+ cmd_arg = 0;
+ cmd_arg = SFIELD(cmd_arg, SPI_RW_FLAG, 0);
+ cmd_arg = SFIELD(cmd_arg, SPI_ACCESS, 0); /* Fixed access */
+ cmd_arg = SFIELD(cmd_arg, SPI_FUNCTION, func);
+ cmd_arg = SFIELD(cmd_arg, SPI_REG_ADDR, regaddr);
+ cmd_arg = SFIELD(cmd_arg, SPI_LEN, regsize);
+
+ sd_trace(("%s: RD cmd_arg=0x%x func=%d regaddr=0x%x regsize=%d\n",
+ __FUNCTION__, cmd_arg, func, regaddr, regsize));
+
+ if ((status = bcmspi_cmd_issue(sd, sd->sd_use_dma, cmd_arg, data, regsize)) != SUCCESS)
+ return status;
+
+ sd_trace(("%s: RD result=0x%x\n", __FUNCTION__, *data));
+
+ bcmspi_cmd_getdstatus(sd, &dstatus);
+ sd_trace(("dstatus =0x%x\n", dstatus));
+ return SUCCESS;
+}
+
+/* write a device register */
+static int
+bcmspi_card_regwrite(sdioh_info_t *sd, int func, uint32 regaddr, int regsize, uint32 data)
+{
+ int status;
+ uint32 cmd_arg, dstatus;
+
+ ASSERT(regsize);
+
+ cmd_arg = 0;
+
+ cmd_arg = SFIELD(cmd_arg, SPI_RW_FLAG, 1);
+ cmd_arg = SFIELD(cmd_arg, SPI_ACCESS, 1); /* Incremental access */
+ cmd_arg = SFIELD(cmd_arg, SPI_FUNCTION, func);
+ cmd_arg = SFIELD(cmd_arg, SPI_REG_ADDR, regaddr);
+ cmd_arg = SFIELD(cmd_arg, SPI_LEN, regsize == BLOCK_SIZE_F2 ? 0 : regsize);
+
+ sd_trace(("%s: WR cmd_arg=0x%x func=%d regaddr=0x%x regsize=%d data=0x%x\n",
+ __FUNCTION__, cmd_arg, func, regaddr, regsize, data));
+
+ if ((status = bcmspi_cmd_issue(sd, sd->sd_use_dma, cmd_arg, &data, regsize)) != SUCCESS)
+ return status;
+
+ bcmspi_cmd_getdstatus(sd, &dstatus);
+ if (dstatus)
+ sd_trace(("dstatus=0x%x\n", dstatus));
+
+ return SUCCESS;
+}
+
+/* write a device register - 1 byte */
+static int
+bcmspi_card_bytewrite(sdioh_info_t *sd, int func, uint32 regaddr, uint8 *byte)
+{
+ int status;
+ uint32 cmd_arg;
+ uint32 dstatus;
+ uint32 data = (uint32)(*byte);
+
+ cmd_arg = 0;
+ cmd_arg = SFIELD(cmd_arg, SPI_FUNCTION, func);
+ cmd_arg = SFIELD(cmd_arg, SPI_ACCESS, 1); /* Incremental access */
+ cmd_arg = SFIELD(cmd_arg, SPI_REG_ADDR, regaddr);
+ cmd_arg = SFIELD(cmd_arg, SPI_RW_FLAG, 1);
+ cmd_arg = SFIELD(cmd_arg, SPI_LEN, 1);
+
+ sd_trace(("%s: WR cmd_arg=0x%x func=%d regaddr=0x%x data=0x%x\n",
+ __FUNCTION__, cmd_arg, func, regaddr, data));
+
+ if ((status = bcmspi_cmd_issue(sd, sd->sd_use_dma, cmd_arg, &data, 1)) != SUCCESS)
+ return status;
+
+ bcmspi_cmd_getdstatus(sd, &dstatus);
+ if (dstatus)
+ sd_trace(("dstatus =0x%x\n", dstatus));
+
+ return SUCCESS;
+}
+
+void
+bcmspi_cmd_getdstatus(sdioh_info_t *sd, uint32 *dstatus_buffer)
+{
+ *dstatus_buffer = sd->card_dstatus;
+}
+
+/* 'data' is of type uint32 whereas other buffers are of type uint8 */
+static int
+bcmspi_cmd_issue(sdioh_info_t *sd, bool use_dma, uint32 cmd_arg,
+ uint32 *data, uint32 datalen)
+{
+ uint32 i, j;
+ uint8 resp_delay = 0;
+ int err = SUCCESS;
+ uint32 hostlen;
+ uint32 spilen = 0;
+ uint32 dstatus_idx = 0;
+ uint16 templen, buslen, len, *ptr = NULL;
+
+ sd_trace(("spi cmd = 0x%x\n", cmd_arg));
+
+ if (DWORDMODE_ON) {
+ spilen = GFIELD(cmd_arg, SPI_LEN);
+ if ((GFIELD(cmd_arg, SPI_FUNCTION) == SPI_FUNC_0) ||
+ (GFIELD(cmd_arg, SPI_FUNCTION) == SPI_FUNC_1))
+ dstatus_idx = spilen * 3;
+
+ if ((GFIELD(cmd_arg, SPI_FUNCTION) == SPI_FUNC_2) &&
+ (GFIELD(cmd_arg, SPI_RW_FLAG) == 1)) {
+ spilen = spilen << 2;
+ dstatus_idx = (spilen % 16) ? (16 - (spilen % 16)) : 0;
+ /* convert len to mod16 size */
+ spilen = ROUNDUP(spilen, 16);
+ cmd_arg = SFIELD(cmd_arg, SPI_LEN, (spilen >> 2));
+ }
+ }
+
+ /* Set up and issue the SPI command. MSByte goes out on bus first. Increase datalen
+ * according to the wordlen mode(16/32bit) the device is in.
+ */
+ if (sd->wordlen == 4) { /* 32bit spid */
+ *(uint32 *)spi_outbuf = SPISWAP_WD4(cmd_arg);
+ if (datalen & 0x3)
+ datalen += (4 - (datalen & 0x3));
+ } else if (sd->wordlen == 2) { /* 16bit spid */
+ *(uint32 *)spi_outbuf = SPISWAP_WD2(cmd_arg);
+ if (datalen & 0x1)
+ datalen++;
+ if (datalen < 4)
+ datalen = ROUNDUP(datalen, 4);
+ } else {
+ sd_err(("Host is %d bit spid, could not create SPI command.\n",
+ 8 * sd->wordlen));
+ return ERROR;
+ }
+
+ /* for Write, put the data into the output buffer */
+ if (GFIELD(cmd_arg, SPI_RW_FLAG) == 1) {
+ /* We send len field of hw-header always a mod16 size, both from host and dongle */
+ if (DWORDMODE_ON) {
+ if (GFIELD(cmd_arg, SPI_FUNCTION) == SPI_FUNC_2) {
+ ptr = (uint16 *)&data[0];
+ templen = *ptr;
+ /* ASSERT(*ptr == ~*(ptr + 1)); */
+ templen = ROUNDUP(templen, 16);
+ *ptr = templen;
+ sd_trace(("actual tx len = %d\n", (uint16)(~*(ptr+1))));
+ }
+ }
+
+ if (datalen != 0) {
+ for (i = 0; i < datalen/4; i++) {
+ if (sd->wordlen == 4) { /* 32bit spid */
+ *(uint32 *)&spi_outbuf[i * 4 + CMDLEN] =
+ SPISWAP_WD4(data[i]);
+ } else if (sd->wordlen == 2) { /* 16bit spid */
+ *(uint32 *)&spi_outbuf[i * 4 + CMDLEN] =
+ SPISWAP_WD2(data[i]);
+ }
+ }
+ }
+ }
+
+ /* Append resp-delay number of bytes and clock them out for F0/1/2 reads. */
+ if ((GFIELD(cmd_arg, SPI_RW_FLAG) == 0)) {
+ int func = GFIELD(cmd_arg, SPI_FUNCTION);
+ switch (func) {
+ case 0:
+ if (sd->resp_delay_new)
+ resp_delay = GSPI_F0_RESP_DELAY;
+ else
+ resp_delay = sd->resp_delay_all ? F0_RESPONSE_DELAY : 0;
+ break;
+ case 1:
+ if (sd->resp_delay_new)
+ resp_delay = GSPI_F1_RESP_DELAY;
+ else
+ resp_delay = F1_RESPONSE_DELAY;
+ break;
+ case 2:
+ if (sd->resp_delay_new)
+ resp_delay = GSPI_F2_RESP_DELAY;
+ else
+ resp_delay = sd->resp_delay_all ? F2_RESPONSE_DELAY : 0;
+ break;
+ default:
+ ASSERT(0);
+ break;
+ }
+ /* Program response delay */
+ if (sd->resp_delay_new == FALSE)
+ bcmspi_prog_resp_delay(sd, func, resp_delay);
+ }
+
+ /* +4 for cmd and +4 for dstatus */
+ hostlen = datalen + 8 + resp_delay;
+ hostlen += dstatus_idx;
+#ifdef BCMSPI_ANDROID
+ if (hostlen%4) {
+ sd_err(("Unaligned data len %d, hostlen %d\n",
+ datalen, hostlen));
+#endif /* BCMSPI_ANDROID */
+ hostlen += (4 - (hostlen & 0x3));
+#ifdef BCMSPI_ANDROID
+ }
+#endif /* BCMSPI_ANDROID */
+ spi_sendrecv(sd, spi_outbuf, spi_inbuf, hostlen);
+
+ /* for Read, get the data into the input buffer */
+ if (datalen != 0) {
+ if (GFIELD(cmd_arg, SPI_RW_FLAG) == 0) { /* if read cmd */
+ for (j = 0; j < datalen/4; j++) {
+ if (sd->wordlen == 4) { /* 32bit spid */
+ data[j] = SPISWAP_WD4(*(uint32 *)&spi_inbuf[j * 4 +
+ CMDLEN + resp_delay]);
+ } else if (sd->wordlen == 2) { /* 16bit spid */
+ data[j] = SPISWAP_WD2(*(uint32 *)&spi_inbuf[j * 4 +
+ CMDLEN + resp_delay]);
+ }
+ }
+
+ if ((DWORDMODE_ON) && (GFIELD(cmd_arg, SPI_FUNCTION) == SPI_FUNC_2)) {
+ ptr = (uint16 *)&data[0];
+ templen = *ptr;
+ buslen = len = ~(*(ptr + 1));
+ buslen = ROUNDUP(buslen, 16);
+ /* populate actual len in hw-header */
+ if (templen == buslen)
+ *ptr = len;
+ }
+ }
+ }
+
+ /* Restore back the len field of the hw header */
+ if (DWORDMODE_ON) {
+ if ((GFIELD(cmd_arg, SPI_FUNCTION) == SPI_FUNC_2) &&
+ (GFIELD(cmd_arg, SPI_RW_FLAG) == 1)) {
+ ptr = (uint16 *)&data[0];
+ *ptr = (uint16)(~*(ptr+1));
+ }
+ }
+
+ dstatus_idx += (datalen + CMDLEN + resp_delay);
+ /* Last 4bytes are dstatus. Device is configured to return status bits. */
+ if (sd->wordlen == 4) { /* 32bit spid */
+ sd->card_dstatus = SPISWAP_WD4(*(uint32 *)&spi_inbuf[dstatus_idx]);
+ } else if (sd->wordlen == 2) { /* 16bit spid */
+ sd->card_dstatus = SPISWAP_WD2(*(uint32 *)&spi_inbuf[dstatus_idx]);
+ } else {
+ sd_err(("Host is %d bit machine, could not read SPI dstatus.\n",
+ 8 * sd->wordlen));
+ return ERROR;
+ }
+ if (sd->card_dstatus == 0xffffffff) {
+ sd_err(("looks like not a GSPI device or device is not powered.\n"));
+ }
+
+ err = bcmspi_update_stats(sd, cmd_arg);
+
+ return err;
+
+}
+
+static int
+bcmspi_card_buf(sdioh_info_t *sd, int rw, int func, bool fifo,
+ uint32 addr, int nbytes, uint32 *data)
+{
+ int status;
+ uint32 cmd_arg;
+ bool write = rw == SDIOH_READ ? 0 : 1;
+ uint retries = 0;
+
+ bool enable;
+ uint32 spilen;
+
+ cmd_arg = 0;
+
+ ASSERT(nbytes);
+ ASSERT(nbytes <= sd->client_block_size[func]);
+
+ if (write) sd->t_cnt++; else sd->r_cnt++;
+
+ if (func == 2) {
+ /* Frame len check limited by gSPI. */
+ if ((nbytes > 2000) && write) {
+ sd_trace((">2KB write: F2 wr of %d bytes\n", nbytes));
+ }
+ /* ASSERT(nbytes <= 2048); Fix bigger len gspi issue and uncomment. */
+ /* If F2 fifo on device is not ready to receive data, don't do F2 transfer */
+ if (write) {
+ uint32 dstatus;
+ /* check F2 ready with cached one */
+ bcmspi_cmd_getdstatus(sd, &dstatus);
+ if ((dstatus & STATUS_F2_RX_READY) == 0) {
+ retries = WAIT_F2RXFIFORDY;
+ enable = 0;
+ while (retries-- && !enable) {
+ OSL_DELAY(WAIT_F2RXFIFORDY_DELAY * 1000);
+ bcmspi_card_regread(sd, SPI_FUNC_0, SPID_STATUS_REG, 4,
+ &dstatus);
+ if (dstatus & STATUS_F2_RX_READY)
+ enable = TRUE;
+ }
+ if (!enable) {
+ struct spierrstats_t *spierrstats = &sd->spierrstats;
+ spierrstats->f2rxnotready++;
+ sd_err(("F2 FIFO is not ready to receive data.\n"));
+ return ERROR;
+ }
+ sd_trace(("No of retries on F2 ready %d\n",
+ (WAIT_F2RXFIFORDY - retries)));
+ }
+ }
+ }
+
+ /* F2 transfers happen on 0 addr */
+ addr = (func == 2) ? 0 : addr;
+
+ /* In pio mode buffer is read using fixed address fifo in func 1 */
+ if ((func == 1) && (fifo))
+ cmd_arg = SFIELD(cmd_arg, SPI_ACCESS, 0);
+ else
+ cmd_arg = SFIELD(cmd_arg, SPI_ACCESS, 1);
+
+ cmd_arg = SFIELD(cmd_arg, SPI_FUNCTION, func);
+ cmd_arg = SFIELD(cmd_arg, SPI_REG_ADDR, addr);
+ cmd_arg = SFIELD(cmd_arg, SPI_RW_FLAG, write);
+ spilen = sd->data_xfer_count = MIN(sd->client_block_size[func], nbytes);
+ if ((sd->dwordmode == TRUE) && (GFIELD(cmd_arg, SPI_FUNCTION) == SPI_FUNC_2)) {
+ /* convert len to mod4 size */
+ spilen = spilen + ((spilen & 0x3) ? (4 - (spilen & 0x3)): 0);
+ cmd_arg = SFIELD(cmd_arg, SPI_LEN, (spilen >> 2));
+ } else
+ cmd_arg = SFIELD(cmd_arg, SPI_LEN, spilen);
+
+ if ((func == 2) && (fifo == 1)) {
+ sd_data(("%s: %s func %d, %s, addr 0x%x, len %d bytes, r_cnt %d t_cnt %d\n",
+ __FUNCTION__, write ? "Wr" : "Rd", func, "INCR",
+ addr, nbytes, sd->r_cnt, sd->t_cnt));
+ }
+
+ sd_trace(("%s cmd_arg = 0x%x\n", __FUNCTION__, cmd_arg));
+ sd_data(("%s: %s func %d, %s, addr 0x%x, len %d bytes, r_cnt %d t_cnt %d\n",
+ __FUNCTION__, write ? "Wd" : "Rd", func, "INCR",
+ addr, nbytes, sd->r_cnt, sd->t_cnt));
+
+
+ if ((status = bcmspi_cmd_issue(sd, sd->sd_use_dma, cmd_arg, data, nbytes)) != SUCCESS) {
+ sd_err(("%s: cmd_issue failed for %s\n", __FUNCTION__,
+ (write ? "write" : "read")));
+ return status;
+ }
+
+ /* gSPI expects that hw-header-len is equal to spi-command-len */
+ if ((func == 2) && (rw == SDIOH_WRITE) && (sd->dwordmode == FALSE)) {
+ ASSERT((uint16)sd->data_xfer_count == (uint16)(*data & 0xffff));
+ ASSERT((uint16)sd->data_xfer_count == (uint16)(~((*data & 0xffff0000) >> 16)));
+ }
+
+ if ((nbytes > 2000) && !write) {
+ sd_trace((">2KB read: F2 rd of %d bytes\n", nbytes));
+ }
+
+ return SUCCESS;
+}
+
+/* Reset and re-initialize the device */
+int
+sdioh_sdio_reset(sdioh_info_t *si)
+{
+ si->card_init_done = FALSE;
+ return bcmspi_client_init(si);
+}
+
+SDIOH_API_RC
+sdioh_gpioouten(sdioh_info_t *sd, uint32 gpio)
+{
+ return SDIOH_API_RC_FAIL;
+}
+
+SDIOH_API_RC
+sdioh_gpioout(sdioh_info_t *sd, uint32 gpio, bool enab)
+{
+ return SDIOH_API_RC_FAIL;
+}
+
+bool
+sdioh_gpioin(sdioh_info_t *sd, uint32 gpio)
+{
+ return FALSE;
+}
+
+SDIOH_API_RC
+sdioh_gpio_init(sdioh_info_t *sd)
+{
+ return SDIOH_API_RC_FAIL;
+}
diff --git a/drivers/net/wireless/bcmdhd/src/shared/bcmutils.c b/drivers/net/wireless/bcmdhd/bcmutils.c
index b709efd..272201b 100644
--- a/drivers/net/wireless/bcmdhd/src/shared/bcmutils.c
+++ b/drivers/net/wireless/bcmdhd/bcmutils.c
@@ -1,14 +1,14 @@
/*
* Driver O/S-independent utility routines
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,11 +16,11 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
- * $Id: bcmutils.c 306580 2012-01-06 14:28:35Z $
+ * $Id: bcmutils.c 312855 2012-02-04 02:01:18Z $
*/
#include <bcm_cfg.h>
@@ -56,6 +56,9 @@ void *_bcmutils_dummy_fn = NULL;
#ifdef BCMDRIVER
+
+
+
/* copy a pkt buffer chain into a buffer */
uint
pktcopy(osl_t *osh, void *p, uint offset, int len, uchar *buf)
@@ -117,6 +120,8 @@ pktfrombuf(osl_t *osh, void *p, uint offset, int len, uchar *buf)
return ret;
}
+
+
/* return total length of buffer chain */
uint BCMFASTPATH
pkttotlen(osl_t *osh, void *p)
@@ -331,6 +336,13 @@ pktq_pdeq_tail(struct pktq *pq, int prec)
if ((p = q->head) == NULL)
return NULL;
+#if defined(CONFIG_MACH_M3_JPN_DCM)
+ if (!q || !(q->tail)) {
+ printk(" %s : tail is NULL \n", __func__);
+ return NULL;
+ }
+#endif
+
for (prev = NULL; p != q->tail; p = PKTLINK(p))
prev = p;
@@ -1036,6 +1048,10 @@ bcm_mdelay(uint ms)
}
}
+
+
+
+
#if defined(DHD_DEBUG)
/* pretty hex print a pkt buffer chain */
void
@@ -1049,7 +1065,7 @@ prpkt(const char *msg, osl_t *osh, void *p0)
for (p = p0; p; p = PKTNEXT(osh, p))
prhex(NULL, PKTDATA(osh, p), PKTLEN(osh, p));
}
-#endif
+#endif
/* Takes an Ethernet frame and sets out-of-bound PKTPRIO.
* Also updates the inplace vlan tag if requested.
@@ -1138,6 +1154,8 @@ bcmerrorstr(int bcmerror)
return bcmerrorstrtable[-bcmerror];
}
+
+
/* iovar table lookup */
const bcm_iovar_t*
bcm_iovar_lookup(const bcm_iovar_t *table, const char *name)
@@ -1440,8 +1458,8 @@ hndcrc32(uint8 *pdata, uint nbytes, uint32 crc)
}
#ifdef notdef
-#define CLEN 1499 /* CRC Length */
-#define CBUFSIZ (CLEN+4)
+#define CLEN 1499 /* CRC Length */
+#define CBUFSIZ (CLEN+4)
#define CNBUFS 5 /* # of bufs */
void
@@ -1637,7 +1655,7 @@ bcm_format_hex(char *str, const void *bytes, int len)
}
return (int)(p - str);
}
-#endif /* defined(WLMSG_PRHDRS) || defined(WLMSG_PRPKT) || ... */
+#endif
/* pretty hex print a contiguous buffer */
void
@@ -1684,10 +1702,17 @@ static const char *crypto_algo_names[] = {
"AES_CCM",
"AES_OCB_MSDU",
"AES_OCB_MPDU",
+#ifdef BCMCCX
+ "CKIP",
+ "CKIP_MMH",
+ "WEP_MMH",
+ "NALG"
+#else
"NALG"
"UNDEF",
"UNDEF",
"UNDEF",
+#endif /* BCMCCX */
#ifdef BCMWAPI_WPI
"WAPI",
#endif /* BCMWAPI_WPI */
@@ -1818,7 +1843,7 @@ bcm_mkiovar(char *name, char *data, uint datalen, char *buf, uint buflen)
#define QDBM_TABLE_HIGH_BOUND 64938 /* High bound */
static const uint16 nqdBm_to_mW_map[QDBM_TABLE_LEN] = {
-/* qdBm: +0 +1 +2 +3 +4 +5 +6 +7 */
+/* qdBm: +0 +1 +2 +3 +4 +5 +6 +7 */
/* 153: */ 6683, 7079, 7499, 7943, 8414, 8913, 9441, 10000,
/* 161: */ 10593, 11220, 11885, 12589, 13335, 14125, 14962, 15849,
/* 169: */ 16788, 17783, 18836, 19953, 21135, 22387, 23714, 25119,
@@ -2022,7 +2047,7 @@ bcm_format_ssid(char* buf, const uchar ssid[], uint ssid_len)
return (int)(p - buf);
}
-#endif /* defined(WLTINYDUMP) || defined(WLMSG_INFORM) || ... */
+#endif
#endif /* BCMDRIVER */
diff --git a/drivers/net/wireless/bcmdhd/src/wl/bcmwifi/src/bcmwifi_channels.c b/drivers/net/wireless/bcmdhd/bcmwifi_channels.c
index 629f0c9..0a570f6 100644
--- a/drivers/net/wireless/bcmdhd/src/wl/bcmwifi/src/bcmwifi_channels.c
+++ b/drivers/net/wireless/bcmdhd/bcmwifi_channels.c
@@ -3,14 +3,14 @@
* Contents are wifi-specific, used by any kernel or app-level
* software that might want wifi things as it grows.
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -18,11 +18,11 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
- * $Id: bcmwifi.c 300516 2011-12-04 17:39:44Z $
+ * $Id: bcmwifi_channels.c 309193 2012-01-19 00:03:57Z $
*/
#include <bcm_cfg.h>
@@ -40,18 +40,27 @@
#ifndef ASSERT
#define ASSERT(exp)
#endif
-#endif /* BCMDRIVER */
+#endif
+
#ifdef _bcmwifi_c_
+
#include <bcmwifi.h>
#else
#include <bcmwifi_channels.h>
#endif
#if defined(WIN32) && (defined(BCMDLL) || defined(WLMDLL))
-#include <bcmstdlib.h>
+#include <bcmstdlib.h>
#endif
#ifndef D11AC_IOTYPES
+
+
+
+
+
+
+
char *
wf_chspec_ntoa(chanspec_t chspec, char *buf)
{
@@ -62,7 +71,7 @@ wf_chspec_ntoa(chanspec_t chspec, char *buf)
bw = "";
sb = "";
channel = CHSPEC_CHANNEL(chspec);
-
+
if ((CHSPEC_IS2G(chspec) && channel > CH_MAX_2G_CHANNEL) ||
(CHSPEC_IS5G(chspec) && channel <= CH_MAX_2G_CHANNEL))
band = (CHSPEC_IS2G(chspec)) ? "b" : "a";
@@ -78,7 +87,7 @@ wf_chspec_ntoa(chanspec_t chspec, char *buf)
bw = "n";
}
-
+
snprintf(buf, 6, "%d%s%s%s", channel, band, bw, sb);
return (buf);
}
@@ -93,7 +102,7 @@ wf_chspec_aton(const char *a)
channel = strtoul(a, &endp, 10);
-
+
if (endp == a)
return 0;
@@ -110,7 +119,7 @@ wf_chspec_aton(const char *a)
if (c == '\0')
goto done;
-
+
if (c == 'a' || c == 'b') {
band = (c == 'a') ? WL_CHANSPEC_BAND_5G : WL_CHANSPEC_BAND_2G;
a++;
@@ -119,13 +128,13 @@ wf_chspec_aton(const char *a)
goto done;
}
-
+
if (c == 'n') {
bw = WL_CHANSPEC_BW_10;
} else if (c == 'l') {
bw = WL_CHANSPEC_BW_40;
ctl_sb = WL_CHANSPEC_CTL_SB_LOWER;
-
+
if (channel <= (MAXCHANNEL - CH_20MHZ_APART))
channel += CH_10MHZ_APART;
else
@@ -133,7 +142,7 @@ wf_chspec_aton(const char *a)
} else if (c == 'u') {
bw = WL_CHANSPEC_BW_40;
ctl_sb = WL_CHANSPEC_CTL_SB_UPPER;
-
+
if (channel > CH_20MHZ_APART)
channel -= CH_10MHZ_APART;
else
@@ -150,14 +159,14 @@ done:
bool
wf_chspec_malformed(chanspec_t chanspec)
{
-
+
if (!CHSPEC_IS5G(chanspec) && !CHSPEC_IS2G(chanspec))
return TRUE;
-
+
if (!CHSPEC_IS40(chanspec) && !CHSPEC_IS20(chanspec))
return TRUE;
-
+
if (CHSPEC_IS20(chanspec)) {
if (!CHSPEC_SB_NONE(chanspec))
return TRUE;
@@ -175,19 +184,19 @@ wf_chspec_ctlchan(chanspec_t chspec)
{
uint8 ctl_chan;
-
+
if (CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_NONE) {
return CHSPEC_CHANNEL(chspec);
} else {
-
+
ASSERT(CHSPEC_BW(chspec) == WL_CHANSPEC_BW_40);
-
+
if (CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_UPPER) {
-
+
ctl_chan = UPPER_20_SB(CHSPEC_CHANNEL(chspec));
} else {
ASSERT(CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_LOWER);
-
+
ctl_chan = LOWER_20_SB(CHSPEC_CHANNEL(chspec));
}
}
@@ -203,7 +212,7 @@ wf_chspec_ctlchspec(chanspec_t chspec)
ASSERT(!wf_chspec_malformed(chspec));
-
+
if (CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_NONE) {
return chspec;
} else {
@@ -218,7 +227,12 @@ wf_chspec_ctlchspec(chanspec_t chspec)
return ctl_chspec;
}
-#else
+#else
+
+
+
+
+
static const char *wf_chspec_bw_str[] =
{
@@ -256,6 +270,8 @@ static const uint8 wf_5g_160m_chans[] =
#define WF_NUM_5G_160M_CHANS \
(sizeof(wf_5g_160m_chans)/sizeof(uint8))
+
+
static uint
bw_chspec_to_mhz(chanspec_t chspec)
{
@@ -269,7 +285,7 @@ bw_chspec_to_mhz(chanspec_t chspec)
static uint8
center_chan_to_edge(uint bw)
{
-
+
return (uint8)(((bw - 20) / 2) / 5);
}
@@ -288,15 +304,15 @@ channel_to_sb(uint center_ch, uint ctl_ch, uint bw)
uint sb;
if ((ctl_ch - lowest) % 4) {
-
+
return -1;
}
sb = ((ctl_ch - lowest) / 4);
-
+
if (sb >= (bw / 20)) {
-
+
return -1;
}
@@ -335,15 +351,15 @@ wf_chspec_ntoa(chanspec_t chspec, char *buf)
band = "";
-
+
if ((CHSPEC_IS2G(chspec) && CHSPEC_CHANNEL(chspec) > CH_MAX_2G_CHANNEL) ||
(CHSPEC_IS5G(chspec) && CHSPEC_CHANNEL(chspec) <= CH_MAX_2G_CHANNEL))
band = (CHSPEC_IS2G(chspec)) ? "2g" : "5g";
-
+
ctl_chan = wf_chspec_ctlchan(chspec);
-
+
if (CHSPEC_IS20(chspec)) {
snprintf(buf, CHANSPEC_STR_LEN, "%s%d", band, ctl_chan);
} else if (!CHSPEC_IS8080(chspec)) {
@@ -353,32 +369,32 @@ wf_chspec_ntoa(chanspec_t chspec, char *buf)
bw = wf_chspec_bw_str[(chspec & WL_CHANSPEC_BW_MASK) >> WL_CHANSPEC_BW_SHIFT];
#ifdef CHANSPEC_NEW_40MHZ_FORMAT
-
+
if (CHSPEC_IS40(chspec) && CHSPEC_IS2G(chspec)) {
sb = CHSPEC_SB_UPPER(chspec) ? "u" : "l";
}
snprintf(buf, CHANSPEC_STR_LEN, "%s%d/%s%s", band, ctl_chan, bw, sb);
#else
-
+
if (CHSPEC_IS40(chspec)) {
sb = CHSPEC_SB_UPPER(chspec) ? "u" : "l";
snprintf(buf, CHANSPEC_STR_LEN, "%s%d%s", band, ctl_chan, sb);
} else {
snprintf(buf, CHANSPEC_STR_LEN, "%s%d/%s", band, ctl_chan, bw);
}
-#endif
+#endif
} else {
-
+
uint chan1 = (chspec & WL_CHANSPEC_CHAN1_MASK) >> WL_CHANSPEC_CHAN1_SHIFT;
uint chan2 = (chspec & WL_CHANSPEC_CHAN2_MASK) >> WL_CHANSPEC_CHAN2_SHIFT;
-
+
chan1 = (chan1 < WF_NUM_5G_80M_CHANS) ? wf_5g_80m_chans[chan1] : 0;
chan2 = (chan2 < WF_NUM_5G_80M_CHANS) ? wf_5g_80m_chans[chan2] : 0;
-
+
snprintf(buf, CHANSPEC_STR_LEN, "%d/80+80/%d-%d", ctl_chan, chan1, chan2);
}
@@ -392,13 +408,13 @@ read_uint(const char **p, unsigned int *num)
char *endp = NULL;
val = strtoul(*p, &endp, 10);
-
+
if (endp == *p)
return 0;
-
+
*p = endp;
-
+
*num = (unsigned int)val;
return 1;
@@ -419,16 +435,16 @@ wf_chspec_aton(const char *a)
chspec_sb = 0;
chspec_ch = ch1 = ch2 = 0;
-
+
if (!read_uint(&a, &num))
return 0;
-
+
c = tolower(a[0]);
if (c == 'g') {
- a ++;
-
+ a ++;
+
if (num == 2)
chspec_band = WL_CHANSPEC_BAND_2G;
else if (num == 5)
@@ -436,43 +452,43 @@ wf_chspec_aton(const char *a)
else
return 0;
-
+
if (!read_uint(&a, &ctl_ch))
return 0;
c = tolower(a[0]);
}
else {
-
+
ctl_ch = num;
chspec_band = ((ctl_ch <= CH_MAX_2G_CHANNEL) ?
WL_CHANSPEC_BAND_2G : WL_CHANSPEC_BAND_5G);
}
if (c == '\0') {
-
+
chspec_bw = WL_CHANSPEC_BW_20;
goto done_read;
}
- a ++;
-
+ a ++;
+
if (c == 'u' || c == 'l') {
sb_ul = c;
chspec_bw = WL_CHANSPEC_BW_40;
goto done_read;
}
-
+
if (c != '/')
return 0;
-
+
if (!read_uint(&a, &bw))
return 0;
-
+
if (bw == 20) {
chspec_bw = WL_CHANSPEC_BW_20;
} else if (bw == 40) {
@@ -485,51 +501,63 @@ wf_chspec_aton(const char *a)
return 0;
}
+
+
c = tolower(a[0]);
+
if (chspec_band == WL_CHANSPEC_BAND_2G && bw == 40) {
if (c == 'u' || c == 'l') {
- a ++;
+ a ++;
sb_ul = c;
goto done_read;
}
}
+
if (c == '+') {
+
static const char *plus80 = "80/";
-
+
chspec_bw = WL_CHANSPEC_BW_8080;
- a ++;
-
+ a ++;
+
for (i = 0; i < 3; i++) {
if (*a++ != *plus80++) {
return 0;
}
}
+
if (!read_uint(&a, &ch1))
return 0;
+
if (a[0] != '-')
return 0;
- a ++;
+ a ++;
+
if (!read_uint(&a, &ch2))
return 0;
}
done_read:
-
+
while (a[0] == ' ') {
a ++;
}
+
if (a[0] != '\0')
return 0;
+
+
+
if (sb_ul != '\0') {
if (sb_ul == 'l') {
chspec_ch = UPPER_20_SB(ctl_ch);
@@ -539,14 +567,14 @@ done_read:
chspec_sb = WL_CHANSPEC_CTL_SB_LLU;
}
}
-
+
else if (chspec_bw == WL_CHANSPEC_BW_20) {
chspec_ch = ctl_ch;
chspec_sb = 0;
}
-
+
else if (chspec_bw != WL_CHANSPEC_BW_8080) {
-
+
const uint8 *center_ch = NULL;
int num_ch = 0;
int sb = -1;
@@ -573,12 +601,12 @@ done_read:
}
}
-
+
if (sb < 0) {
return 0;
}
}
-
+
else {
int ch1_id = 0, ch2_id = 0;
int sb;
@@ -586,22 +614,26 @@ done_read:
ch1_id = channel_80mhz_to_id(ch1);
ch2_id = channel_80mhz_to_id(ch2);
-
+
if (ch1 >= ch2 || ch1_id < 0 || ch2_id < 0)
return 0;
+
chspec_ch = (((uint16)ch1_id << WL_CHANSPEC_CHAN1_SHIFT) |
((uint16)ch2_id << WL_CHANSPEC_CHAN2_SHIFT));
+
+
+
sb = channel_to_sb(ch1, ctl_ch, bw);
if (sb < 0) {
-
+
sb = channel_to_sb(ch2, ctl_ch, bw);
if (sb < 0) {
-
+
return 0;
}
-
+
sb += 4;
}
@@ -623,9 +655,9 @@ wf_chspec_malformed(chanspec_t chanspec)
uint chspec_bw = CHSPEC_BW(chanspec);
uint chspec_ch = CHSPEC_CHANNEL(chanspec);
-
+
if (CHSPEC_IS2G(chanspec)) {
-
+
if (chspec_bw != WL_CHANSPEC_BW_20 &&
chspec_bw != WL_CHANSPEC_BW_40) {
return TRUE;
@@ -634,13 +666,13 @@ wf_chspec_malformed(chanspec_t chanspec)
if (chspec_bw == WL_CHANSPEC_BW_8080) {
uint ch1_id, ch2_id;
-
+
ch1_id = CHSPEC_CHAN1(chanspec);
ch2_id = CHSPEC_CHAN2(chanspec);
if (ch1_id >= WF_NUM_5G_80M_CHANS || ch2_id >= WF_NUM_5G_80M_CHANS)
return TRUE;
-
+
if (ch2_id <= ch1_id)
return TRUE;
} else if (chspec_bw == WL_CHANSPEC_BW_20 || chspec_bw == WL_CHANSPEC_BW_40 ||
@@ -650,15 +682,15 @@ wf_chspec_malformed(chanspec_t chanspec)
return TRUE;
}
} else {
-
+
return TRUE;
}
} else {
-
+
return TRUE;
}
-
+
if (chspec_bw == WL_CHANSPEC_BW_20) {
if (CHSPEC_CTL_SB(chanspec) != WL_CHANSPEC_CTL_SB_LLL)
return TRUE;
@@ -684,7 +716,7 @@ wf_chspec_valid(chanspec_t chanspec)
return FALSE;
if (CHSPEC_IS2G(chanspec)) {
-
+
if (chspec_bw == WL_CHANSPEC_BW_20) {
if (chspec_ch >= 1 && chspec_ch <= 14)
return TRUE;
@@ -699,7 +731,7 @@ wf_chspec_valid(chanspec_t chanspec)
ch1 = wf_5g_80m_chans[CHSPEC_CHAN1(chanspec)];
ch2 = wf_5g_80m_chans[CHSPEC_CHAN2(chanspec)];
-
+
if (ch2 > ch1 + CH_80MHZ_APART)
return TRUE;
} else {
@@ -716,34 +748,35 @@ wf_chspec_valid(chanspec_t chanspec)
center_ch = wf_5g_160m_chans;
num_ch = WF_NUM_5G_160M_CHANS;
} else {
-
+
return FALSE;
}
-
+
if (chspec_bw == WL_CHANSPEC_BW_20) {
-
+
for (i = 0; i < num_ch; i ++) {
if (chspec_ch == (uint)LOWER_20_SB(center_ch[i]) ||
chspec_ch == (uint)UPPER_20_SB(center_ch[i]))
- break;
+ break;
}
if (i == num_ch) {
-
+
if (chspec_ch == 34 || chspec_ch == 38 ||
chspec_ch == 42 || chspec_ch == 46)
i = 0;
}
} else {
-
+
for (i = 0; i < num_ch; i ++) {
if (chspec_ch == center_ch[i])
- break;
+ break;
}
}
if (i < num_ch) {
+
return TRUE;
}
}
@@ -762,7 +795,7 @@ wf_chspec_ctlchan(chanspec_t chspec)
ASSERT(!wf_chspec_malformed(chspec));
-
+
if (CHSPEC_IS20(chspec)) {
return CHSPEC_CHANNEL(chspec);
} else {
@@ -779,7 +812,7 @@ wf_chspec_ctlchan(chanspec_t chspec)
sb -= 4;
}
-
+
center_chan = wf_5g_80m_chans[center_chan];
}
else {
@@ -800,7 +833,7 @@ wf_chspec_ctlchspec(chanspec_t chspec)
ASSERT(!wf_chspec_malformed(chspec));
-
+
if (!CHSPEC_IS20(chspec)) {
ctl_chan = wf_chspec_ctlchan(chspec);
ctl_chspec = ctl_chan | WL_CHANSPEC_BW_20;
@@ -809,9 +842,9 @@ wf_chspec_ctlchspec(chanspec_t chspec)
return ctl_chspec;
}
-#endif /* D11AC_IOTYPES */
+#endif
+
-#ifdef D11AC_IOTYPES
extern chanspec_t wf_chspec_primary40_chspec(chanspec_t chspec)
{
chanspec_t chspec40 = chspec;
@@ -825,25 +858,27 @@ extern chanspec_t wf_chspec_primary40_chspec(chanspec_t chspec)
sb = CHSPEC_CTL_SB(chspec);
if (sb == WL_CHANSPEC_CTL_SB_UL) {
-
+
sb = WL_CHANSPEC_CTL_SB_L;
center_chan += CH_20MHZ_APART;
} else if (sb == WL_CHANSPEC_CTL_SB_UU) {
-
+
sb = WL_CHANSPEC_CTL_SB_U;
center_chan += CH_20MHZ_APART;
} else {
+
+
center_chan -= CH_20MHZ_APART;
}
-
+
chspec40 = (WL_CHANSPEC_BAND_5G | WL_CHANSPEC_BW_40 |
sb | center_chan);
}
return chspec40;
}
-#endif /* D11AC_IOTYPES */
+
int
wf_mhz2channel(uint freq, uint start_factor)
@@ -852,7 +887,7 @@ wf_mhz2channel(uint freq, uint start_factor)
uint base;
int offset;
-
+
if (start_factor == 0) {
if (freq >= 2400 && freq <= 2500)
start_factor = WF_CHAN_FACTOR_2_4_G;
@@ -865,18 +900,18 @@ wf_mhz2channel(uint freq, uint start_factor)
base = start_factor / 2;
-
+
if ((freq < base) || (freq > base + 1000))
return -1;
offset = freq - base;
ch = offset / 5;
-
+
if (offset != (ch * 5))
return -1;
-
+
if (start_factor == WF_CHAN_FACTOR_2_4_G && (ch < 1 || ch > 13))
return -1;
diff --git a/drivers/net/wireless/bcmdhd/src/wl/bcmwifi/include/bcmwifi_channels.h b/drivers/net/wireless/bcmdhd/bcmwifi_channels.h
index b3384ef..c797047 100644
--- a/drivers/net/wireless/bcmdhd/src/wl/bcmwifi/include/bcmwifi_channels.h
+++ b/drivers/net/wireless/bcmdhd/bcmwifi_channels.h
@@ -3,14 +3,14 @@
* This header file housing the define and function prototype use by
* both the wl driver, tools & Apps.
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -18,17 +18,19 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: bcmwifi.h 300516 2011-12-04 17:39:44Z $
+ * $Id: bcmwifi_channels.h 309193 2012-01-19 00:03:57Z $
*/
#ifndef _bcmwifi_channels_h_
#define _bcmwifi_channels_h_
+
+
typedef uint16 chanspec_t;
@@ -39,11 +41,15 @@ typedef uint16 chanspec_t;
#define CH_40MHZ_APART 8
#define CH_20MHZ_APART 4
#define CH_10MHZ_APART 2
-#define CH_5MHZ_APART 1
-#define CH_MAX_2G_CHANNEL 14
-#define MAXCHANNEL 224
+#define CH_5MHZ_APART 1
+#define CH_MAX_2G_CHANNEL 14
+#define MAXCHANNEL 224
#define CHSPEC_CTLOVLP(sp1, sp2, sep) ABS(wf_chspec_ctlchan(sp1) - wf_chspec_ctlchan(sp2)) < (sep)
+
+#undef D11AC_IOTYPES
+#define D11AC_IOTYPES
+
#ifndef D11AC_IOTYPES
#define WL_CHANSPEC_CHAN_MASK 0x00ff
@@ -65,7 +71,8 @@ typedef uint16 chanspec_t;
#define WL_CHANSPEC_BAND_SHIFT 12
#define WL_CHANSPEC_BAND_5G 0x1000
#define WL_CHANSPEC_BAND_2G 0x2000
-#define INVCHANSPEC 255
+#define INVCHANSPEC 255
+
#define LOWER_20_SB(channel) (((channel) > CH_10MHZ_APART) ? ((channel) - CH_10MHZ_APART) : 0)
#define UPPER_20_SB(channel) (((channel) < (MAXCHANNEL - CH_10MHZ_APART)) ? \
@@ -95,7 +102,7 @@ typedef uint16 chanspec_t;
#define CHSPEC_IS40(chspec) 0
#endif
-#else
+#else
#define CHSPEC_IS10(chspec) (((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_10)
#define CHSPEC_IS20(chspec) (((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_20)
@@ -103,7 +110,7 @@ typedef uint16 chanspec_t;
#define CHSPEC_IS40(chspec) (((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_40)
#endif
-#endif /* WL11N_20MHZONLY */
+#endif
#define CHSPEC_IS5G(chspec) (((chspec) & WL_CHANSPEC_BAND_MASK) == WL_CHANSPEC_BAND_5G)
#define CHSPEC_IS2G(chspec) (((chspec) & WL_CHANSPEC_BAND_MASK) == WL_CHANSPEC_BAND_2G)
@@ -117,7 +124,7 @@ typedef uint16 chanspec_t;
#define CHANSPEC_STR_LEN 8
-#else
+#else
#define WL_CHANSPEC_CHAN_MASK 0x00ff
#define WL_CHANSPEC_CHAN_SHIFT 0
@@ -142,7 +149,7 @@ typedef uint16 chanspec_t;
#define WL_CHANSPEC_CTL_SB_UU WL_CHANSPEC_CTL_SB_LUU
#define WL_CHANSPEC_CTL_SB_L WL_CHANSPEC_CTL_SB_LLL
#define WL_CHANSPEC_CTL_SB_U WL_CHANSPEC_CTL_SB_LLU
-#define WL_CHANSPEC_CTL_SB_LOWER WL_CHANSPEC_CTL_SB_LLL
+#define WL_CHANSPEC_CTL_SB_LOWER WL_CHANSPEC_CTL_SB_LLL
#define WL_CHANSPEC_CTL_SB_UPPER WL_CHANSPEC_CTL_SB_LLU
#define WL_CHANSPEC_BW_MASK 0x3800
@@ -161,7 +168,8 @@ typedef uint16 chanspec_t;
#define WL_CHANSPEC_BAND_3G 0x4000
#define WL_CHANSPEC_BAND_4G 0x8000
#define WL_CHANSPEC_BAND_5G 0xc000
-#define INVCHANSPEC 255
+#define INVCHANSPEC 255
+
#define LOWER_20_SB(channel) (((channel) > CH_10MHZ_APART) ? \
((channel) - CH_10MHZ_APART) : 0)
@@ -211,7 +219,7 @@ typedef uint16 chanspec_t;
#define CHSPEC_IS8080(chspec) 0
#endif
-#else
+#else
#define CHSPEC_IS10(chspec) (((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_10)
#define CHSPEC_IS20(chspec) (((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_20)
@@ -228,7 +236,7 @@ typedef uint16 chanspec_t;
#define CHSPEC_IS8080(chspec) (((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_8080)
#endif
-#endif /* WL11N_20MHZONLY */
+#endif
#define CHSPEC_IS5G(chspec) (((chspec) & WL_CHANSPEC_BAND_MASK) == WL_CHANSPEC_BAND_5G)
#define CHSPEC_IS2G(chspec) (((chspec) & WL_CHANSPEC_BAND_MASK) == WL_CHANSPEC_BAND_2G)
@@ -243,6 +251,8 @@ typedef uint16 chanspec_t;
#define CHANSPEC_STR_LEN 20
+
+
#define WL_LCHANSPEC_CHAN_MASK 0x00ff
#define WL_LCHANSPEC_CHAN_SHIFT 0
@@ -275,28 +285,35 @@ typedef uint16 chanspec_t;
#define LCHSPEC_CREATE(chan, band, bw, sb) ((uint16)((chan) | (sb) | (bw) | (band)))
-#endif /* D11AC_IOTYPES */
+#endif
+
+
+
+
+#define WF_CHAN_FACTOR_2_4_G 4814
+
+
+#define WF_CHAN_FACTOR_5_G 10000
+
-#define WF_CHAN_FACTOR_2_4_G 4814
-#define WF_CHAN_FACTOR_5_G 10000
-#define WF_CHAN_FACTOR_4_G 8000
+#define WF_CHAN_FACTOR_4_G 8000
-#define WLC_MAXRATE 108
-#define WLC_RATE_1M 2
-#define WLC_RATE_2M 4
-#define WLC_RATE_5M5 11
-#define WLC_RATE_11M 22
-#define WLC_RATE_6M 12
-#define WLC_RATE_9M 18
-#define WLC_RATE_12M 24
-#define WLC_RATE_18M 36
-#define WLC_RATE_24M 48
-#define WLC_RATE_36M 72
-#define WLC_RATE_48M 96
-#define WLC_RATE_54M 108
+#define WLC_MAXRATE 108
+#define WLC_RATE_1M 2
+#define WLC_RATE_2M 4
+#define WLC_RATE_5M5 11
+#define WLC_RATE_11M 22
+#define WLC_RATE_6M 12
+#define WLC_RATE_9M 18
+#define WLC_RATE_12M 24
+#define WLC_RATE_18M 36
+#define WLC_RATE_24M 48
+#define WLC_RATE_36M 72
+#define WLC_RATE_48M 96
+#define WLC_RATE_54M 108
-#define WLC_2G_25MHZ_OFFSET 5
+#define WLC_2G_25MHZ_OFFSET 5
extern char * wf_chspec_ntoa(chanspec_t chspec, char *buf);
@@ -325,4 +342,4 @@ extern int wf_mhz2channel(uint freq, uint start_factor);
extern int wf_channel2mhz(uint channel, uint start_factor);
-#endif /* _bcmwifi_h_ */
+#endif
diff --git a/drivers/net/wireless/bcmdhd/bcmwifi_rates.h b/drivers/net/wireless/bcmdhd/bcmwifi_rates.h
new file mode 100644
index 0000000..9896b23
--- /dev/null
+++ b/drivers/net/wireless/bcmdhd/bcmwifi_rates.h
@@ -0,0 +1,306 @@
+/*
+ * Indices for 802.11 a/b/g/n/ac 1-3 chain symmetric transmit rates
+ *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
+ * Unless you and Broadcom execute a separate written software license
+ * agreement governing use of this software, this software is licensed to you
+ * under the terms of the GNU General Public License version 2 (the "GPL"),
+ * available at http://www.broadcom.com/licenses/GPLv2.php, with the
+ * following added to such license:
+ *
+ * As a special exception, the copyright holders of this software give you
+ * permission to link this software with independent modules, and to copy and
+ * distribute the resulting executable under terms of your choice, provided that
+ * you also meet, for each linked independent module, the terms and conditions of
+ * the license of that module. An independent module is a module which is not
+ * derived from this software. The special exception does not apply to any
+ * modifications of the software.
+ *
+ * Notwithstanding the above, under no circumstances may you combine this
+ * software in any way with any other Broadcom software provided under a license
+ * other than the GPL, without Broadcom's express prior written consent.
+ *
+ * $Id: bcmwifi_rates.h 252708 2011-04-12 06:45:56Z $
+ */
+
+#ifndef _bcmwifi_rates_h_
+#define _bcmwifi_rates_h_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#define WL_RATESET_SZ_DSSS 4
+#define WL_RATESET_SZ_OFDM 8
+#define WL_RATESET_SZ_HT_MCS 8
+#define WL_RATESET_SZ_VHT_MCS 10
+
+#define WL_TX_CHAINS_MAX 3
+
+#define WL_RATE_DISABLED (-128)
+
+
+typedef enum wl_tx_bw {
+ WL_TX_BW_20,
+ WL_TX_BW_40,
+ WL_TX_BW_80,
+ WL_TX_BW_20IN40,
+ WL_TX_BW_20IN80,
+ WL_TX_BW_40IN80,
+ WL_TX_BW_ALL
+} wl_tx_bw_t;
+
+
+
+typedef enum wl_tx_mode {
+ WL_TX_MODE_NONE,
+ WL_TX_MODE_STBC,
+ WL_TX_MODE_CDD,
+ WL_TX_MODE_SDM
+} wl_tx_mode_t;
+
+
+
+typedef enum wl_tx_chains {
+ WL_TX_CHAINS_1 = 1,
+ WL_TX_CHAINS_2,
+ WL_TX_CHAINS_3
+} wl_tx_chains_t;
+
+
+
+typedef enum wl_tx_nss {
+ WL_TX_NSS_1 = 1,
+ WL_TX_NSS_2,
+ WL_TX_NSS_3
+} wl_tx_nss_t;
+
+
+typedef enum clm_rates {
+
+
+
+ WL_RATE_1X1_DSSS_1 = 0,
+ WL_RATE_1X1_DSSS_2 = 1,
+ WL_RATE_1X1_DSSS_5_5 = 2,
+ WL_RATE_1X1_DSSS_11 = 3,
+
+ WL_RATE_1X1_OFDM_6 = 4,
+ WL_RATE_1X1_OFDM_9 = 5,
+ WL_RATE_1X1_OFDM_12 = 6,
+ WL_RATE_1X1_OFDM_18 = 7,
+ WL_RATE_1X1_OFDM_24 = 8,
+ WL_RATE_1X1_OFDM_36 = 9,
+ WL_RATE_1X1_OFDM_48 = 10,
+ WL_RATE_1X1_OFDM_54 = 11,
+
+ WL_RATE_1X1_MCS0 = 12,
+ WL_RATE_1X1_MCS1 = 13,
+ WL_RATE_1X1_MCS2 = 14,
+ WL_RATE_1X1_MCS3 = 15,
+ WL_RATE_1X1_MCS4 = 16,
+ WL_RATE_1X1_MCS5 = 17,
+ WL_RATE_1X1_MCS6 = 18,
+ WL_RATE_1X1_MCS7 = 19,
+
+ WL_RATE_1X1_VHT0SS1 = 12,
+ WL_RATE_1X1_VHT1SS1 = 13,
+ WL_RATE_1X1_VHT2SS1 = 14,
+ WL_RATE_1X1_VHT3SS1 = 15,
+ WL_RATE_1X1_VHT4SS1 = 16,
+ WL_RATE_1X1_VHT5SS1 = 17,
+ WL_RATE_1X1_VHT6SS1 = 18,
+ WL_RATE_1X1_VHT7SS1 = 19,
+ WL_RATE_1X1_VHT8SS1 = 20,
+ WL_RATE_1X1_VHT9SS1 = 21,
+
+
+
+
+
+ WL_RATE_1X2_DSSS_1 = 22,
+ WL_RATE_1X2_DSSS_2 = 23,
+ WL_RATE_1X2_DSSS_5_5 = 24,
+ WL_RATE_1X2_DSSS_11 = 25,
+
+ WL_RATE_1X2_CDD_OFDM_6 = 26,
+ WL_RATE_1X2_CDD_OFDM_9 = 27,
+ WL_RATE_1X2_CDD_OFDM_12 = 28,
+ WL_RATE_1X2_CDD_OFDM_18 = 29,
+ WL_RATE_1X2_CDD_OFDM_24 = 30,
+ WL_RATE_1X2_CDD_OFDM_36 = 31,
+ WL_RATE_1X2_CDD_OFDM_48 = 32,
+ WL_RATE_1X2_CDD_OFDM_54 = 33,
+
+ WL_RATE_1X2_CDD_MCS0 = 34,
+ WL_RATE_1X2_CDD_MCS1 = 35,
+ WL_RATE_1X2_CDD_MCS2 = 36,
+ WL_RATE_1X2_CDD_MCS3 = 37,
+ WL_RATE_1X2_CDD_MCS4 = 38,
+ WL_RATE_1X2_CDD_MCS5 = 39,
+ WL_RATE_1X2_CDD_MCS6 = 40,
+ WL_RATE_1X2_CDD_MCS7 = 41,
+
+ WL_RATE_1X2_VHT0SS1 = 34,
+ WL_RATE_1X2_VHT1SS1 = 35,
+ WL_RATE_1X2_VHT2SS1 = 36,
+ WL_RATE_1X2_VHT3SS1 = 37,
+ WL_RATE_1X2_VHT4SS1 = 38,
+ WL_RATE_1X2_VHT5SS1 = 39,
+ WL_RATE_1X2_VHT6SS1 = 40,
+ WL_RATE_1X2_VHT7SS1 = 41,
+ WL_RATE_1X2_VHT8SS1 = 42,
+ WL_RATE_1X2_VHT9SS1 = 43,
+
+
+ WL_RATE_2X2_STBC_MCS0 = 44,
+ WL_RATE_2X2_STBC_MCS1 = 45,
+ WL_RATE_2X2_STBC_MCS2 = 46,
+ WL_RATE_2X2_STBC_MCS3 = 47,
+ WL_RATE_2X2_STBC_MCS4 = 48,
+ WL_RATE_2X2_STBC_MCS5 = 49,
+ WL_RATE_2X2_STBC_MCS6 = 50,
+ WL_RATE_2X2_STBC_MCS7 = 51,
+
+ WL_RATE_2X2_STBC_VHT0SS1 = 44,
+ WL_RATE_2X2_STBC_VHT1SS1 = 45,
+ WL_RATE_2X2_STBC_VHT2SS1 = 46,
+ WL_RATE_2X2_STBC_VHT3SS1 = 47,
+ WL_RATE_2X2_STBC_VHT4SS1 = 48,
+ WL_RATE_2X2_STBC_VHT5SS1 = 49,
+ WL_RATE_2X2_STBC_VHT6SS1 = 50,
+ WL_RATE_2X2_STBC_VHT7SS1 = 51,
+ WL_RATE_2X2_STBC_VHT8SS1 = 52,
+ WL_RATE_2X2_STBC_VHT9SS1 = 53,
+
+ WL_RATE_2X2_SDM_MCS8 = 54,
+ WL_RATE_2X2_SDM_MCS9 = 55,
+ WL_RATE_2X2_SDM_MCS10 = 56,
+ WL_RATE_2X2_SDM_MCS11 = 57,
+ WL_RATE_2X2_SDM_MCS12 = 58,
+ WL_RATE_2X2_SDM_MCS13 = 59,
+ WL_RATE_2X2_SDM_MCS14 = 60,
+ WL_RATE_2X2_SDM_MCS15 = 61,
+
+ WL_RATE_2X2_VHT0SS2 = 54,
+ WL_RATE_2X2_VHT1SS2 = 55,
+ WL_RATE_2X2_VHT2SS2 = 56,
+ WL_RATE_2X2_VHT3SS2 = 57,
+ WL_RATE_2X2_VHT4SS2 = 58,
+ WL_RATE_2X2_VHT5SS2 = 59,
+ WL_RATE_2X2_VHT6SS2 = 60,
+ WL_RATE_2X2_VHT7SS2 = 61,
+ WL_RATE_2X2_VHT8SS2 = 62,
+ WL_RATE_2X2_VHT9SS2 = 63,
+
+
+
+
+
+ WL_RATE_1X3_DSSS_1 = 64,
+ WL_RATE_1X3_DSSS_2 = 65,
+ WL_RATE_1X3_DSSS_5_5 = 66,
+ WL_RATE_1X3_DSSS_11 = 67,
+
+ WL_RATE_1X3_CDD_OFDM_6 = 68,
+ WL_RATE_1X3_CDD_OFDM_9 = 69,
+ WL_RATE_1X3_CDD_OFDM_12 = 70,
+ WL_RATE_1X3_CDD_OFDM_18 = 71,
+ WL_RATE_1X3_CDD_OFDM_24 = 72,
+ WL_RATE_1X3_CDD_OFDM_36 = 73,
+ WL_RATE_1X3_CDD_OFDM_48 = 74,
+ WL_RATE_1X3_CDD_OFDM_54 = 75,
+
+ WL_RATE_1X3_CDD_MCS0 = 76,
+ WL_RATE_1X3_CDD_MCS1 = 77,
+ WL_RATE_1X3_CDD_MCS2 = 78,
+ WL_RATE_1X3_CDD_MCS3 = 79,
+ WL_RATE_1X3_CDD_MCS4 = 80,
+ WL_RATE_1X3_CDD_MCS5 = 81,
+ WL_RATE_1X3_CDD_MCS6 = 82,
+ WL_RATE_1X3_CDD_MCS7 = 83,
+
+ WL_RATE_1X3_VHT0SS1 = 76,
+ WL_RATE_1X3_VHT1SS1 = 77,
+ WL_RATE_1X3_VHT2SS1 = 78,
+ WL_RATE_1X3_VHT3SS1 = 79,
+ WL_RATE_1X3_VHT4SS1 = 80,
+ WL_RATE_1X3_VHT5SS1 = 81,
+ WL_RATE_1X3_VHT6SS1 = 82,
+ WL_RATE_1X3_VHT7SS1 = 83,
+ WL_RATE_1X3_VHT8SS1 = 84,
+ WL_RATE_1X3_VHT9SS1 = 85,
+
+
+ WL_RATE_2X3_STBC_MCS0 = 86,
+ WL_RATE_2X3_STBC_MCS1 = 87,
+ WL_RATE_2X3_STBC_MCS2 = 88,
+ WL_RATE_2X3_STBC_MCS3 = 89,
+ WL_RATE_2X3_STBC_MCS4 = 90,
+ WL_RATE_2X3_STBC_MCS5 = 91,
+ WL_RATE_2X3_STBC_MCS6 = 92,
+ WL_RATE_2X3_STBC_MCS7 = 93,
+
+ WL_RATE_2X3_STBC_VHT0SS1 = 86,
+ WL_RATE_2X3_STBC_VHT1SS1 = 87,
+ WL_RATE_2X3_STBC_VHT2SS1 = 88,
+ WL_RATE_2X3_STBC_VHT3SS1 = 89,
+ WL_RATE_2X3_STBC_VHT4SS1 = 90,
+ WL_RATE_2X3_STBC_VHT5SS1 = 91,
+ WL_RATE_2X3_STBC_VHT6SS1 = 92,
+ WL_RATE_2X3_STBC_VHT7SS1 = 93,
+ WL_RATE_2X3_STBC_VHT8SS1 = 94,
+ WL_RATE_2X3_STBC_VHT9SS1 = 95,
+
+ WL_RATE_2X3_SDM_MCS8 = 96,
+ WL_RATE_2X3_SDM_MCS9 = 97,
+ WL_RATE_2X3_SDM_MCS10 = 98,
+ WL_RATE_2X3_SDM_MCS11 = 99,
+ WL_RATE_2X3_SDM_MCS12 = 100,
+ WL_RATE_2X3_SDM_MCS13 = 101,
+ WL_RATE_2X3_SDM_MCS14 = 102,
+ WL_RATE_2X3_SDM_MCS15 = 103,
+
+ WL_RATE_2X3_VHT0SS2 = 96,
+ WL_RATE_2X3_VHT1SS2 = 97,
+ WL_RATE_2X3_VHT2SS2 = 98,
+ WL_RATE_2X3_VHT3SS2 = 99,
+ WL_RATE_2X3_VHT4SS2 = 100,
+ WL_RATE_2X3_VHT5SS2 = 101,
+ WL_RATE_2X3_VHT6SS2 = 102,
+ WL_RATE_2X3_VHT7SS2 = 103,
+ WL_RATE_2X3_VHT8SS2 = 104,
+ WL_RATE_2X3_VHT9SS2 = 105,
+
+
+ WL_RATE_3X3_SDM_MCS16 = 106,
+ WL_RATE_3X3_SDM_MCS17 = 107,
+ WL_RATE_3X3_SDM_MCS18 = 108,
+ WL_RATE_3X3_SDM_MCS19 = 109,
+ WL_RATE_3X3_SDM_MCS20 = 110,
+ WL_RATE_3X3_SDM_MCS21 = 111,
+ WL_RATE_3X3_SDM_MCS22 = 112,
+ WL_RATE_3X3_SDM_MCS23 = 113,
+
+ WL_RATE_3X3_VHT0SS3 = 106,
+ WL_RATE_3X3_VHT1SS3 = 107,
+ WL_RATE_3X3_VHT2SS3 = 108,
+ WL_RATE_3X3_VHT3SS3 = 109,
+ WL_RATE_3X3_VHT4SS3 = 110,
+ WL_RATE_3X3_VHT5SS3 = 111,
+ WL_RATE_3X3_VHT6SS3 = 112,
+ WL_RATE_3X3_VHT7SS3 = 113,
+ WL_RATE_3X3_VHT8SS3 = 114,
+ WL_RATE_3X3_VHT9SS3 = 115,
+
+
+ WL_NUMRATES = 116
+} clm_rates_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd.h b/drivers/net/wireless/bcmdhd/dhd.h
index 44fd410..d9deae8 100644
--- a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd.h
+++ b/drivers/net/wireless/bcmdhd/dhd.h
@@ -5,13 +5,13 @@
* DHD OS, bus, and protocol modules.
*
* Copyright (C) 1999-2012, Broadcom Corporation
- *
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -19,12 +19,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: dhd.h 309548 2012-01-20 01:13:08Z $
+ * $Id: dhd.h 357924 2012-09-20 10:44:32Z $
*/
/****************
@@ -34,7 +34,6 @@
#ifndef _dhd_h_
#define _dhd_h_
-#include "dhd_sec_feature.h"
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/slab.h>
@@ -59,8 +58,12 @@ int setScheduler(struct task_struct *p, int policy, struct sched_param *param);
#include <wlioctl.h>
#include <wlfc_proto.h>
-// For dual support of WCN3660 and BCM4334
+#include <dhd_sec_feature.h>
+
+#if defined(CUSTOMER_HW4_RELEASE)
+/* Customer requirement */
#undef CONFIG_WIRELESS_EXT
+#endif
/* Forward decls */
struct dhd_bus;
@@ -77,23 +80,23 @@ enum dhd_bus_state {
/* Firmware requested operation mode */
#define STA_MASK 0x0001
-#define HOSTAPD_MASK 0x0002
+#define HOSTAPD_MASK 0x0002
#define WFD_MASK 0x0004
-#define SOFTAP_FW_MASK 0x0008
-#define CONCURRENT_MASK (STA_MASK | WFD_MASK)
+#define SOFTAP_FW_MASK 0x0008
+#define CONCURRENT_FW_MASK (STA_MASK | WFD_MASK)
+#define P2P_GO_ENABLED 0x0010
+#define P2P_GC_ENABLED 0x0020
+#define CONCURENT_MASK 0x00F0
+#define CONCURRENT_MULTI_CHAN 0x0100
+#define MANUFACTRING_FW "WLTEST"
/* max sequential rxcntl timeouts to set HANG event */
-#ifdef BCM4334_CHIP
-#define MAX_CNTL_TIMEOUT 1
-#else
+#ifndef MAX_CNTL_TIMEOUT
#define MAX_CNTL_TIMEOUT 2
#endif
-#define DHD_SCAN_ACTIVE_TIME 40 /* ms : Embedded default Active setting from DHD Driver */
-#define DHD_SCAN_PASSIVE_TIME 130 /* ms: Embedded default Passive setting from DHD Driver */
-
#ifndef POWERUP_MAX_RETRY
-#define POWERUP_MAX_RETRY (10) /* how many times we retry to power up the chip */
+#define POWERUP_MAX_RETRY 3 /* how many times we retry to power up the chip */
#endif
#ifndef POWERUP_WAIT_MS
#define POWERUP_WAIT_MS (2000) /* ms: time out in waiting wifi to come up */
@@ -120,13 +123,15 @@ enum dhd_prealloc_index {
DHD_PREALLOC_PROT = 0,
DHD_PREALLOC_RXBUF,
DHD_PREALLOC_DATABUF,
-#if defined (CUSTOMER_HW_SAMSUNG) && defined (CONFIG_DHD_USE_STATIC_BUF)
+#if defined(STATIC_WL_PRIV_STRUCT)
DHD_PREALLOC_OSL_BUF,
DHD_PREALLOC_WIPHY_ESCAN0 = 5,
+#if defined(DUAL_ESCAN_RESULT_BUFFER)
DHD_PREALLOC_WIPHY_ESCAN1
+#endif
#else
DHD_PREALLOC_OSL_BUF
-#endif
+#endif /* STATIC_WL_PRIV_STRUCT */
};
typedef enum {
@@ -242,13 +247,16 @@ typedef struct dhd_pub {
char eventmask[WL_EVENTING_MASK_LEN];
int op_mode; /* STA, HostAPD, WFD, SoftAP */
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_HAS_WAKELOCK)
- struct wake_lock wakelock[WAKE_LOCK_MAX];
-#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined (CONFIG_HAS_WAKELOCK) */
+/* Set this to 1 to use a seperate interface (p2p0) for p2p operations.
+ * For ICS MR1 releases it should be disable to be compatable with ICS MR1 Framework
+ * see target dhd-cdc-sdmmc-panda-cfg80211-icsmr1-gpl-debug in Makefile
+ */
+/* #define WL_ENABLE_P2P_IF 1 */
+
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) && 1
- struct mutex wl_start_stop_lock; /* lock/unlock for Android start/stop */
- struct mutex wl_softap_lock; /* lock/unlock for any SoftAP/STA settings */
-#endif
+ struct mutex wl_start_stop_lock; /* lock/unlock for Android start/stop */
+ struct mutex wl_softap_lock; /* lock/unlock for any SoftAP/STA settings */
+#endif
#ifdef WLBTAMP
uint16 maxdatablks;
@@ -257,9 +265,11 @@ typedef struct dhd_pub {
int wlfc_enabled;
void* wlfc_state;
#endif
+#ifdef ROAM_AP_ENV_DETECTION
bool roam_env_detection;
+#endif
bool dongle_isolation;
- bool dongle_trap_occured;
+ bool dongle_trap_occured; /* flag for sending HANG event to upper layer */
int hang_was_sent;
int rxcnt_timeout; /* counter rxcnt timeout to send HANG */
int txcnt_timeout; /* counter txcnt timeout to send HANG */
@@ -267,11 +277,12 @@ typedef struct dhd_pub {
uint8 htsfdlystat_sz; /* Size of delay stats, max 255B */
#endif
struct reorder_info *reorder_bufs[WLHOST_REORDERDATA_MAXFLOWS];
-#if defined(PNO_SUPPORT) && defined(CONFIG_HAS_WAKELOCK)
- struct wake_lock pno_wakelock;
+#if defined(CUSTOMER_HW4) && defined(PNO_SUPPORT) && defined(CONFIG_HAS_WAKELOCK)
+ struct wake_lock pno_wakelock;
#endif
} dhd_pub_t;
+
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP)
#define DHD_PM_RESUME_WAIT_INIT(a) DECLARE_WAIT_QUEUE_HEAD(a);
@@ -280,29 +291,29 @@ typedef struct dhd_pub {
SMP_RD_BARRIER_DEPENDS(); \
while (dhd_mmc_suspend && retry++ != b) { \
SMP_RD_BARRIER_DEPENDS(); \
- wait_event_interruptible_timeout(a, !dhd_mmc_suspend, HZ/100); \
+ wait_event_interruptible_timeout(a, !dhd_mmc_suspend, 1); \
} \
- } while (0)
-#ifdef CUSTOMER_HW_SAMSUNG
- #define DHD_PM_RESUME_WAIT(a) _DHD_PM_RESUME_WAIT(a, 500)
-#else
+ } while (0)
#define DHD_PM_RESUME_WAIT(a) _DHD_PM_RESUME_WAIT(a, 200)
-#endif /* CUSTOMER_HW_SAMSUNG */
- #define DHD_PM_RESUME_WAIT_FOREVER(a) _DHD_PM_RESUME_WAIT(a, ~0)
- #define DHD_PM_RESUME_RETURN_ERROR(a) do { \
- if (dhd_mmc_suspend) { \
- printf("mmc in suspend yet!!!: %s %d\n", \
- __FUNCTION__, __LINE__); \
- return a; \
- } \
- } while (0)
+ #define DHD_PM_RESUME_WAIT_FOREVER(a) _DHD_PM_RESUME_WAIT(a, ~0)
+#ifdef CUSTOMER_HW4
+ #define DHD_PM_RESUME_RETURN_ERROR(a) do { \
+ if (dhd_mmc_suspend) { \
+ printf("%s[%d]: mmc is still in suspend state!!!\n", \
+ __FUNCTION__, __LINE__); \
+ return a; \
+ } \
+ } while (0)
+#else
+ #define DHD_PM_RESUME_RETURN_ERROR(a) do { if (dhd_mmc_suspend) return a; } while (0)
+#endif /* CUSTOMER_HW4 */
#define DHD_PM_RESUME_RETURN do { if (dhd_mmc_suspend) return; } while (0)
#define DHD_SPINWAIT_SLEEP_INIT(a) DECLARE_WAIT_QUEUE_HEAD(a);
#define SPINWAIT_SLEEP(a, exp, us) do { \
uint countdown = (us) + 9999; \
while ((exp) && (countdown >= 10000)) { \
- wait_event_interruptible_timeout(a, FALSE, HZ/100); \
+ wait_event_interruptible_timeout(a, FALSE, 1); \
countdown -= 10000; \
} \
} while (0)
@@ -338,7 +349,8 @@ void dhd_os_spin_unlock(dhd_pub_t *pub, unsigned long flags);
extern int dhd_os_wake_lock(dhd_pub_t *pub);
extern int dhd_os_wake_unlock(dhd_pub_t *pub);
extern int dhd_os_wake_lock_timeout(dhd_pub_t *pub);
-extern int dhd_os_wake_lock_timeout_enable(dhd_pub_t *pub, int val);
+extern int dhd_os_wake_lock_rx_timeout_enable(dhd_pub_t *pub, int val);
+extern int dhd_os_wake_lock_ctrl_timeout_enable(dhd_pub_t *pub, int val);
inline static void MUTEX_LOCK_SOFTAP_SET_INIT(dhd_pub_t * dhdp)
{
@@ -380,17 +392,14 @@ inline static void MUTEX_UNLOCK_SOFTAP_SET(dhd_pub_t * dhdp)
__FUNCTION__, __LINE__); \
dhd_os_wake_lock_timeout(pub); \
} while (0)
-#define DHD_OS_WAKE_LOCK_TIMEOUT_ENABLE(pub, val) \
- do { \
- printf("call wake_lock_timeout_enable[%d]: %s %d\n", \
- val, __FUNCTION__, __LINE__); \
- dhd_os_wake_lock_timeout_enable(pub, val); \
- } while (0)
#else
-#define DHD_OS_WAKE_LOCK(pub) dhd_os_wake_lock(pub)
-#define DHD_OS_WAKE_UNLOCK(pub) dhd_os_wake_unlock(pub)
+#define DHD_OS_WAKE_LOCK(pub) dhd_os_wake_lock(pub)
+#define DHD_OS_WAKE_UNLOCK(pub) dhd_os_wake_unlock(pub)
#define DHD_OS_WAKE_LOCK_TIMEOUT(pub) dhd_os_wake_lock_timeout(pub)
-#define DHD_OS_WAKE_LOCK_TIMEOUT_ENABLE(pub, val) dhd_os_wake_lock_timeout_enable(pub, val)
+#define DHD_OS_WAKE_LOCK_RX_TIMEOUT_ENABLE(pub, val) \
+ dhd_os_wake_lock_rx_timeout_enable(pub, val)
+#define DHD_OS_WAKE_LOCK_CTRL_TIMEOUT_ENABLE(pub, val) \
+ dhd_os_wake_lock_ctrl_timeout_enable(pub, val)
#endif /* DHD_DEBUG_WAKE_LOCK */
#define DHD_PACKET_TIMEOUT_MS 1000
#define DHD_EVENT_TIMEOUT_MS 1500
@@ -425,7 +434,7 @@ typedef enum dhd_attach_states
} dhd_attach_states_t;
/* Value -1 means we are unsuccessful in creating the kthread. */
-#define DHD_PID_KT_INVALID -1
+#define DHD_PID_KT_INVALID -1
/* Value -2 means we are unsuccessful in both creating the kthread and tasklet */
#define DHD_PID_KT_TL_INVALID -2
@@ -495,6 +504,8 @@ extern void dhd_os_sdunlock_sndup_rxq(dhd_pub_t * pub);
extern void dhd_os_sdlock_eventq(dhd_pub_t * pub);
extern void dhd_os_sdunlock_eventq(dhd_pub_t * pub);
extern bool dhd_os_check_hang(dhd_pub_t *dhdp, int ifidx, int ret);
+extern int dhd_os_send_hang_message(dhd_pub_t *dhdp);
+extern void dhd_set_version_info(dhd_pub_t *pub, char *fw);
#ifdef PNO_SUPPORT
extern int dhd_pno_enable(dhd_pub_t *dhd, int pfn_enabled);
@@ -509,12 +520,17 @@ extern int dhd_dev_pno_enable(struct net_device *dev, int pfn_enabled);
extern int dhd_dev_get_pno_status(struct net_device *dev);
#endif /* PNO_SUPPORT */
+#ifdef PKT_FILTER_SUPPORT
#define DHD_UNICAST_FILTER_NUM 0
#define DHD_BROADCAST_FILTER_NUM 1
#define DHD_MULTICAST4_FILTER_NUM 2
#define DHD_MULTICAST6_FILTER_NUM 3
-extern int net_os_set_packet_filter(struct net_device *dev, int val);
+#define DHD_MDNS_FILTER_NUM 4
+extern void dhd_set_packet_filter(dhd_pub_t *dhd);
+extern void dhd_enable_packet_filter(int value, dhd_pub_t *dhd);
+extern int net_os_enable_packet_filter(struct net_device *dev, int val);
extern int net_os_rxfilter_add_remove(struct net_device *dev, int val, int num);
+#endif /* PKT_FILTER_SUPPORT */
extern int dhd_get_dtim_skip(dhd_pub_t *dhd);
extern bool dhd_check_ap_wfd_mode_set(dhd_pub_t *dhd);
@@ -522,9 +538,9 @@ extern bool dhd_check_ap_wfd_mode_set(dhd_pub_t *dhd);
#ifdef DHD_DEBUG
extern int write_to_file(dhd_pub_t *dhd, uint8 *buf, int size);
#endif /* DHD_DEBUG */
-#if defined(OOB_INTR_ONLY)
+#if defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID)
extern int dhd_customer_oob_irq_map(unsigned long *irq_flags_ptr);
-#endif /* defined(OOB_INTR_ONLY) */
+#endif /* defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID) */
extern void dhd_os_sdtxlock(dhd_pub_t * pub);
extern void dhd_os_sdtxunlock(dhd_pub_t * pub);
@@ -541,6 +557,7 @@ extern int dhd_timeout_expired(dhd_timeout_t *tmo);
extern int dhd_ifname2idx(struct dhd_info *dhd, char *name);
extern int dhd_net2idx(struct dhd_info *dhd, struct net_device *net);
extern struct net_device * dhd_idx2net(void *pub, int ifidx);
+extern int net_os_send_hang_message(struct net_device *dev);
extern int wl_host_event(dhd_pub_t *dhd_pub, int *idx, void *pktdata,
wl_event_msg_t *, void **data_ptr);
extern void wl_event_to_host_order(wl_event_msg_t * evt);
@@ -576,6 +593,9 @@ extern int dhd_bus_start(dhd_pub_t *dhdp);
extern int dhd_bus_membytes(dhd_pub_t *dhdp, bool set, uint32 address, uint8 *data, uint size);
extern void dhd_print_buf(void *pbuf, int len, int bytes_per_line);
extern bool dhd_is_associated(dhd_pub_t *dhd, void *bss_buf, int *retval);
+extern uint dhd_bus_chip_id(dhd_pub_t *dhdp);
+extern uint dhd_bus_chiprev_id(dhd_pub_t *dhdp);
+extern uint dhd_bus_chippkg_id(dhd_pub_t *dhdp);
#if defined(KEEP_ALIVE)
extern int dhd_keep_alive_onoff(dhd_pub_t *dhd);
@@ -652,13 +672,30 @@ extern uint dhd_sdiod_drive_strength;
/* Override to force tx queueing all the time */
extern uint dhd_force_tx_queueing;
/* Default KEEP_ALIVE Period is 55 sec to prevent AP from sending Keep Alive probe frame */
+#if defined(CUSTOMER_HW4)
#ifdef KEEP_ALIVE_PACKET_PERIOD_30_SEC
#define KEEP_ALIVE_PERIOD 30000
#else /* KEEP_ALIVE_PACKET_PERIOD_30_SEC */
#define KEEP_ALIVE_PERIOD 55000
#endif /* KEEP_ALIVE_PACKET_PERIOD_30_SEC */
+#else
+#define KEEP_ALIVE_PERIOD 55000
+#endif /* CUSTOMER_HW4 */
#define NULL_PKT_STR "null_pkt"
+/* hooks for custom glom setting option via Makefile */
+#define DEFAULT_GLOM_VALUE -1
+#ifndef CUSTOM_GLOM_SETTING
+#define CUSTOM_GLOM_SETTING DEFAULT_GLOM_VALUE
+#endif
+
+/* hooks for custom dhd_dpc_prio setting option via Makefile */
+#define DEFAULT_DHP_DPC_PRIO 1
+#ifndef CUSTOM_DPC_PRIO_SETTING
+#define CUSTOM_DPC_PRIO_SETTING DEFAULT_DHP_DPC_PRIO
+#endif
+
+
#ifdef SDTEST
/* Echo packet generator (SDIO), pkts/s */
extern uint dhd_pktgen;
@@ -674,6 +711,8 @@ extern uint dhd_pktgen_len;
extern char fw_path[MOD_PARAM_PATHLEN];
extern char nv_path[MOD_PARAM_PATHLEN];
+#define MOD_PARAM_INFOLEN 512
+
#ifdef SOFTAP
extern char fw_path2[MOD_PARAM_PATHLEN];
#endif
@@ -681,28 +720,21 @@ extern char fw_path2[MOD_PARAM_PATHLEN];
/* Flag to indicate if we should download firmware on driver load */
extern uint dhd_download_fw_on_driverload;
-#if defined(WL_CFG80211) && defined(CUSTOMER_HW_SAMSUNG)
-/* CSP#505233: Flags to indicate if we distingish power off policy when
+#if defined(WL_CFG80211) && defined(SUPPORT_DEEP_SLEEP)
+/* Flags to indicate if we distingish power off policy when
* user set the memu "Keep Wi-Fi on during sleep" to "Never"
*/
extern int sleep_never;
int dhd_deepsleep(struct net_device *dev, int flag);
-#endif /* WL_CFG80211 && CUSTOMER_HW_SAMSUNG */
-
-#ifdef BCM4334_CHECK_CHIP_REV
-/* Check chip revision */
-extern uint g_chipver;
-extern char chipver_tag[4];
-extern char fw_down_path[MOD_PARAM_PATHLEN];
-#endif
+#endif /* WL_CFG80211 && SUPPORT_DEEP_SLEEP */
/* For supporting multiple interfaces */
#define DHD_MAX_IFS 16
#define DHD_DEL_IF -0xe
#define DHD_BAD_IF -0xf
-
#define WL_AUTO_ROAM_TRIGGER -75
+
#ifdef PROP_TXSTATUS
/* Please be mindful that total pkttag space is 32 octets only */
typedef struct dhd_pkttag {
@@ -856,9 +888,11 @@ int dhd_arp_get_arp_hostip_table(dhd_pub_t *dhd, void *buf, int buflen);
void dhd_arp_offload_add_ip(dhd_pub_t *dhd, uint32 ipaddr);
#endif /* ARP_OFFLOAD_SUPPORT */
-#ifdef RDWR_KORICS_MACADDR
+#if defined(CUSTOMER_HW4) && defined(RDWR_KORICS_MACADDR)
extern int
dhd_write_rdwr_korics_macaddr(struct dhd_info *dhd, struct ether_addr *mac);
#endif
-
+#if defined(SUPPORT_MULTIPLE_REVISION)
+extern int concate_revision(struct dhd_bus *bus, char *path, int path_len);
+#endif /* SUPPORT_MULTIPLE_REVISION */
#endif /* _dhd_h_ */
diff --git a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_bta.c b/drivers/net/wireless/bcmdhd/dhd_bta.c
index 52b51cc..15c605e 100644
--- a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_bta.c
+++ b/drivers/net/wireless/bcmdhd/dhd_bta.c
@@ -1,14 +1,14 @@
/*
* BT-AMP support routines
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,7 +16,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
diff --git a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_bta.h b/drivers/net/wireless/bcmdhd/dhd_bta.h
index 0b18cdd..0337f15 100644
--- a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_bta.h
+++ b/drivers/net/wireless/bcmdhd/dhd_bta.h
@@ -1,14 +1,14 @@
/*
* BT-AMP support routines
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,7 +16,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
diff --git a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_bus.h b/drivers/net/wireless/bcmdhd/dhd_bus.h
index 6774b65..fcb4bbd 100644
--- a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_bus.h
+++ b/drivers/net/wireless/bcmdhd/dhd_bus.h
@@ -4,14 +4,14 @@
* Provides type definitions and function prototypes used to link the
* DHD OS, bus, and protocol modules.
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -19,12 +19,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: dhd_bus.h 291086 2011-10-21 01:17:24Z $
+ * $Id: dhd_bus.h 347614 2012-07-27 10:24:51Z $
*/
#ifndef _dhd_bus_h_
@@ -97,11 +97,15 @@ extern void *dhd_bus_pub(struct dhd_bus *bus);
extern void *dhd_bus_txq(struct dhd_bus *bus);
extern uint dhd_bus_hdrlen(struct dhd_bus *bus);
+
#define DHD_SET_BUS_STATE_DOWN(_bus) do { \
(_bus)->dhd->busstate = DHD_BUS_DOWN; \
} while (0)
+
/* Register a dummy SDIO client driver in order to be notified of new SDIO device */
extern int dhd_bus_reg_sdio_notify(void* semaphore);
extern void dhd_bus_unreg_sdio_notify(void);
+extern void dhd_txglom_enable(dhd_pub_t *dhdp, bool enable);
+
#endif /* _dhd_bus_h_ */
diff --git a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_cdc.c b/drivers/net/wireless/bcmdhd/dhd_cdc.c
index 0cb4fb4..46de6f4 100644
--- a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_cdc.c
+++ b/drivers/net/wireless/bcmdhd/dhd_cdc.c
@@ -2,13 +2,13 @@
* DHD Protocol Module for CDC and BDC.
*
* Copyright (C) 1999-2012, Broadcom Corporation
- *
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,12 +16,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: dhd_cdc.c 304241 2011-12-21 16:43:50Z $
+ * $Id: dhd_cdc.c 357848 2012-09-20 05:38:41Z $
*
* BDC is like CDC, except it includes a header for data packets to convey
* packet priority over the bus, and flags (e.g. to indicate checksum status
@@ -49,7 +49,7 @@
#define RETRIES 2 /* # of retries to retrieve matching ioctl response */
-#define BUS_HEADER_LEN (16+DHD_SDALIGN) /* Must be at least SDPCM_RESERVE
+#define BUS_HEADER_LEN (24+DHD_SDALIGN) /* Must be at least SDPCM_RESERVE
* defined in dhd_sdio.c (amount of header tha might be added)
* plus any space that might be needed for alignment padding.
*/
@@ -69,11 +69,12 @@ typedef struct dhd_wlfc_commit_info {
} dhd_wlfc_commit_info_t;
#endif /* PROP_TXSTATUS */
-#ifdef VSDB_DYNAMIC_F2_BLKSIZE
+#if defined(CUSTOMER_HW4) && defined(DYNAMIC_F2_BLKSIZE_OF_PROPTXSTATUS)
extern uint sd_f2_blocksize;
extern int
dhdsdio_func_blocksize(dhd_pub_t *dhd, int function_num, int block_size);
-#endif
+#endif /* CUSTOMER_HW4 && DYNAMIC_F2_BLKSIZE_OF_PROPTXSTATUS */
+
typedef struct dhd_prot {
uint16 reqid;
uint8 pending;
@@ -118,18 +119,20 @@ dhdcdc_cmplt(dhd_pub_t *dhd, uint32 id, uint32 len)
DHD_TRACE(("%s: Enter\n", __FUNCTION__));
-#ifdef CUSTOMER_HW_SAMSUNG
+#if defined(CUSTOMER_HW4)
DHD_OS_WAKE_LOCK(dhd);
-#endif /* CUSTOMER_HW_SAMSUNG */
+#endif
+
do {
ret = dhd_bus_rxctl(dhd->bus, (uchar*)&prot->msg, cdc_len);
if (ret < 0)
break;
} while (CDC_IOC_ID(ltoh32(prot->msg.flags)) != id);
-#ifdef CUSTOMER_HW_SAMSUNG
+#if defined(CUSTOMER_HW4)
DHD_OS_WAKE_UNLOCK(dhd);
-#endif /* CUSTOMER_HW_SAMSUNG */
+#endif
+
return ret;
}
@@ -163,6 +166,16 @@ dhdcdc_query_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len, uin
memset(msg, 0, sizeof(cdc_ioctl_t));
+#ifdef BCMSPI
+ /* 11bit gSPI bus allows 2048bytes of max-data. We restrict 'len'
+ * value which is 8Kbytes for various 'get' commands to 2000. 48 bytes are
+ * left for sw headers and misc.
+ */
+ if (len > 2000) {
+ DHD_ERROR(("dhdcdc_query_ioctl: len is truncated to 2000 bytes\n"));
+ len = 2000;
+ }
+#endif /* BCMSPI */
msg->cmd = htol32(cmd);
msg->len = htol32(len);
msg->flags = (++prot->reqid << CDCF_IOC_ID_SHIFT);
@@ -247,6 +260,7 @@ dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len, uint8
__FUNCTION__));
return -EIO;
}
+
#ifdef CONFIG_CONTROL_PM
if ((g_pm_control == TRUE) && (cmd == WLC_SET_PM))
{
@@ -498,7 +512,7 @@ dhd_wlfc_dump(dhd_pub_t *dhdp, struct bcmstrbuf *strbuf)
if (mac_table[i].occupied) {
ea = mac_table[i].ea;
bcm_bprintf(strbuf, "MAC_table[%d].ea = "
- "[%02x:%02x:%02x:%02x:%02x:%02x], if:%d\n", i,
+ "[%02x:%02x:%02x:%02x:%02x:%02x], if:%d \n", i,
ea[0], ea[1], ea[2], ea[3], ea[4], ea[5],
mac_table[i].interface_id);
@@ -875,6 +889,12 @@ _dhd_wlfc_pullheader(athost_wl_status_info_t* ctx, void* pktbuf)
/* pull BDC header */
PKTPULL(ctx->osh, pktbuf, BDC_HEADER_LEN);
+
+ if (PKTLEN(ctx->osh, pktbuf) < (h->dataOffset << 2)) {
+ WLFC_DBGMESG(("%s: rx data too short (%d < %d)\n", __FUNCTION__,
+ PKTLEN(ctx->osh, pktbuf), (h->dataOffset << 2)));
+ return BCME_ERROR;
+ }
/* pull wl-header */
PKTPULL(ctx->osh, pktbuf, (h->dataOffset << 2));
return BCME_OK;
@@ -888,7 +908,6 @@ _dhd_wlfc_find_table_entry(athost_wl_status_info_t* ctx, void* p)
uint8 ifid = DHD_PKTTAG_IF(PKTTAG(p));
uint8* dstn = DHD_PKTTAG_DSTN(PKTTAG(p));
- /* no lookup necessary, only if this packet belongs to STA interface */
if (((ctx->destination_entries.interfaces[ifid].iftype == WLC_E_IF_ROLE_STA) ||
ETHER_ISMULTI(dstn) ||
(ctx->destination_entries.interfaces[ifid].iftype == WLC_E_IF_ROLE_P2P_CLIENT)) &&
@@ -938,7 +957,15 @@ _dhd_wlfc_rollback_packet_toq(athost_wl_status_info_t* ctx,
}
else {
/* remove header first */
- _dhd_wlfc_pullheader(ctx, p);
+ rc = _dhd_wlfc_pullheader(ctx, p);
+ if (rc != BCME_OK) {
+ WLFC_DBGMESG(("Error: %s():%d\n", __FUNCTION__, __LINE__));
+ /* free the hanger slot */
+ dhd_wlfc_hanger_poppkt(ctx->hanger, hslot, &pktout, 1);
+ PKTFREE(ctx->osh, p, TRUE);
+ rc = BCME_ERROR;
+ return rc;
+ }
if (pkt_type == eWLFC_PKTTYPE_DELAYED) {
/* delay-q packets are going to delay-q */
@@ -991,9 +1018,7 @@ _dhd_wlfc_flow_control_check(athost_wl_status_info_t* ctx, struct pktq* pq, uint
pq->len, if_id, __FUNCTION__));
*/
WLFC_DBGMESG(("F"));
-#ifndef BCMDBUS
dhd_txflowcontrol(ctx->dhdp, if_id, OFF);
-#endif
ctx->toggle_host_if = 0;
}
if ((pq->len >= WLFC_FLOWCONTROL_HIWATER) && (ctx->hostif_flow_state[if_id] == OFF)) {
@@ -1004,10 +1029,7 @@ _dhd_wlfc_flow_control_check(athost_wl_status_info_t* ctx, struct pktq* pq, uint
pq->len, if_id, __FUNCTION__));
*/
WLFC_DBGMESG(("N"));
- /* XXX: debug in progress */
-#ifndef BCMDBUS
dhd_txflowcontrol(ctx->dhdp, if_id, ON);
-#endif
ctx->host_ifidx = if_id;
ctx->toggle_host_if = 1;
}
@@ -1154,7 +1176,6 @@ _dhd_wlfc_pretx_pktprocess(athost_wl_status_info_t* ctx,
WL_TXSTATUS_SET_FLAGS(htod, WLFC_PKTFLAG_PKTFROMHOST);
WL_TXSTATUS_SET_FIFO(htod, DHD_PKTTAG_FIFO(PKTTAG(p)));
-
if (!DHD_PKTTAG_CREDITCHECK(PKTTAG(p))) {
/*
Indicate that this packet is being sent in response to an
@@ -1194,16 +1215,17 @@ _dhd_wlfc_pretx_pktprocess(athost_wl_status_info_t* ctx,
int gen;
/* remove old header */
- _dhd_wlfc_pullheader(ctx, p);
-
- hslot = WLFC_PKTID_HSLOT_GET(DHD_PKTTAG_H2DTAG(PKTTAG(p)));
- dhd_wlfc_hanger_get_genbit(ctx->hanger, p, hslot, &gen);
+ rc = _dhd_wlfc_pullheader(ctx, p);
+ if (rc == BCME_OK) {
+ hslot = WLFC_PKTID_HSLOT_GET(DHD_PKTTAG_H2DTAG(PKTTAG(p)));
+ dhd_wlfc_hanger_get_genbit(ctx->hanger, p, hslot, &gen);
- WLFC_PKTFLAG_SET_GENERATION(htod, gen);
- free_ctr = WLFC_PKTID_FREERUNCTR_GET(DHD_PKTTAG_H2DTAG(PKTTAG(p)));
- /* push new header */
- _dhd_wlfc_pushheader(ctx, p, send_tim_update,
- entry->traffic_lastreported_bmp, entry->mac_handle, htod);
+ WLFC_PKTFLAG_SET_GENERATION(htod, gen);
+ free_ctr = WLFC_PKTID_FREERUNCTR_GET(DHD_PKTTAG_H2DTAG(PKTTAG(p)));
+ /* push new header */
+ _dhd_wlfc_pushheader(ctx, p, send_tim_update,
+ entry->traffic_lastreported_bmp, entry->mac_handle, htod);
+ }
}
*slot = hslot;
return rc;
@@ -1262,10 +1284,10 @@ _dhd_wlfc_deque_delayedq(athost_wl_status_info_t* ctx,
if (!_dhd_wlfc_is_destination_closed(ctx, entry, prec)) {
p = pktq_mdeq(&entry->psq,
/* higher precedence will be picked up first,
- i.e. suppressed packets before delayed ones
- */
+ * i.e. suppressed packets before delayed ones
+ */
NBITVAL((prec << 1) + 1), &pout);
- *needs_hdr = 0;
+ *needs_hdr = 0;
if (p == NULL) {
if (entry->suppressed == TRUE) {
@@ -1407,7 +1429,6 @@ _dhd_wlfc_mac_entry_update(athost_wl_status_info_t* ctx, wlfc_mac_descriptor_t*
if (ea != NULL)
memcpy(&entry->ea[0], ea, ETHER_ADDR_LEN);
}
-
else if (action == eWLFC_MAC_ENTRY_ACTION_DEL) {
entry->occupied = 0;
entry->state = WLFC_STATE_CLOSE;
@@ -1561,7 +1582,7 @@ dhd_wlfc_commit_packets(void* state, f_commitpkt_t fcommit, void* commit_ctx)
{
int ac;
int credit;
- int rc;
+ int rc;
dhd_wlfc_commit_info_t commit_info;
athost_wl_status_info_t* ctx = (athost_wl_status_info_t*)state;
int credit_count = 0;
@@ -1659,6 +1680,7 @@ dhd_wlfc_commit_packets(void* state, f_commitpkt_t fcommit, void* commit_ctx)
}
}
}
+
ctx->FIFO_credit[ac] -= credit;
@@ -1776,8 +1798,9 @@ dhd_wlfc_txcomplete(dhd_pub_t *dhd, void *txp, bool success)
#ifdef PROP_TXSTATUS_DEBUG
wlfc->stats.signal_only_pkts_freed++;
#endif
- /* is this a signal-only packet? */
- PKTFREE(wlfc->osh, txp, TRUE);
+ if (success)
+ /* is this a signal-only packet? */
+ PKTFREE(wlfc->osh, txp, TRUE);
return;
}
if (!success) {
@@ -1819,7 +1842,7 @@ dhd_wlfc_txcomplete(dhd_pub_t *dhd, void *txp, bool success)
static int
dhd_wlfc_txstatus_update(dhd_pub_t *dhd, uint8* pkt_info)
{
- uint8 status_flag;
+ uint8 status_flag;
uint32 status;
int ret;
int remove_from_hanger = 1;
@@ -1865,7 +1888,7 @@ dhd_wlfc_txstatus_update(dhd_pub_t *dhd, uint8* pkt_info)
if (!entry->suppressed || entry->generation != WLFC_PKTID_GEN(status)) {
entry->suppressed = TRUE;
entry->suppress_count = pktq_mlen(&entry->psq,
- NBITVAL((WL_TXSTATUS_GET_FIFO(status) << 1) + 1));
+ NBITVAL((WL_TXSTATUS_GET_FIFO(status) << 1) + 1));
entry->suppr_transit_count = entry->transit_count;
}
entry->generation = WLFC_PKTID_GEN(status);
@@ -1934,6 +1957,7 @@ dhd_wlfc_txstatus_update(dhd_pub_t *dhd, uint8* pkt_info)
}
if ((status_flag == WLFC_CTL_PKTFLAG_D11SUPPRESS) ||
(status_flag == WLFC_CTL_PKTFLAG_WLSUPPRESS)) {
+
ret = _dhd_wlfc_enque_suppressed(wlfc, fifo_id, pktbuf);
if (ret != BCME_OK) {
/* delay q is full, drop this packet */
@@ -1943,14 +1967,15 @@ dhd_wlfc_txstatus_update(dhd_pub_t *dhd, uint8* pkt_info)
/* indicate failure and free the packet */
dhd_txcomplete(dhd, pktbuf, FALSE);
entry->transit_count--;
- /* This packet is transmitted Successfully by dongle even after first suppress. */
- if (entry->suppressed){
+ /* This packet is transmitted Successfully by
+ * dongle even after first suppress.
+ */
+ if (entry->suppressed) {
entry->suppr_transit_count--;
}
PKTFREE(wlfc->osh, pktbuf, TRUE);
} else {
/* Mark suppressed to avoid a double free during wlfc cleanup */
-
dhd_wlfc_hanger_mark_suppressed(wlfc->hanger,
WLFC_PKTID_HSLOT_GET(status), WLFC_PKTID_GEN(status));
entry->suppress_count++;
@@ -1961,7 +1986,7 @@ dhd_wlfc_txstatus_update(dhd_pub_t *dhd, uint8* pkt_info)
entry->transit_count--;
/* This packet is transmitted Successfully by dongle even after first suppress. */
- if (entry->suppressed){
+ if (entry->suppressed) {
entry->suppr_transit_count--;
}
/* free the packet */
@@ -2013,6 +2038,19 @@ dhd_wlfc_fifocreditback_indicate(dhd_pub_t *dhd, uint8* credits)
}
static int
+dhd_wlfc_dbg_senum_check(dhd_pub_t *dhd, uint8 *value)
+{
+ uint32 timestamp;
+
+ (void)dhd;
+
+ bcopy(&value[2], &timestamp, sizeof(uint32));
+ DHD_INFO(("RXPKT: SEQ: %d, timestamp %d\n", value[1], timestamp));
+ return BCME_OK;
+}
+
+
+static int
dhd_wlfc_rssi_indicate(dhd_pub_t *dhd, uint8* rssi)
{
(void)dhd;
@@ -2276,6 +2314,9 @@ dhd_wlfc_parse_header_info(dhd_pub_t *dhd, void* pktbuf, int tlv_hdr_len, uchar
(type == WLFC_CTL_TYPE_MACDESC_DEL))
dhd_wlfc_mac_table_update(dhd, value, type);
+ else if (type == WLFC_CTL_TYPE_TRANS_ID)
+ dhd_wlfc_dbg_senum_check(dhd, value);
+
else if ((type == WLFC_CTL_TYPE_INTERFACE_OPEN) ||
(type == WLFC_CTL_TYPE_INTERFACE_CLOSE)) {
dhd_wlfc_interface_update(dhd, value, type);
@@ -2374,9 +2415,9 @@ dhd_wlfc_enable(dhd_pub_t *dhd)
wlfc->allow_credit_borrow = TRUE;
wlfc->borrow_defer_timestamp = 0;
-#ifdef VSDB_DYNAMIC_F2_BLKSIZE
+#if defined(CUSTOMER_HW4) && defined(DYNAMIC_F2_BLKSIZE_OF_PROPTXSTATUS)
dhdsdio_func_blocksize(dhd, 2, VSDB_F2_BLKSIZE);
-#endif
+#endif /* CUSTOMER_HW4 && DYNAMIC_F2_BLKSIZE_OF_PROPTXSTATUS */
return BCME_OK;
}
@@ -2390,10 +2431,15 @@ dhd_wlfc_cleanup(dhd_pub_t *dhd)
dhd->wlfc_state;
wlfc_mac_descriptor_t* table;
wlfc_hanger_t* h;
-
+ int prec;
+ void *pkt = NULL;
+ struct pktq *txq = NULL;
if (dhd->wlfc_state == NULL)
return;
-
+ /* flush bus->txq */
+ txq = dhd_bus_txq(dhd->bus);
+ /* any in the hanger? */
+ h = (wlfc_hanger_t*)wlfc->hanger;
total_entries = sizeof(wlfc->destination_entries)/sizeof(wlfc_mac_descriptor_t);
/* search all entries, include nodes as well as interfaces */
table = (wlfc_mac_descriptor_t*)&wlfc->destination_entries;
@@ -2412,8 +2458,26 @@ dhd_wlfc_cleanup(dhd_pub_t *dhd)
/* release packets held in SENDQ */
if (wlfc->SENDQ.len)
pktq_flush(wlfc->osh, &wlfc->SENDQ, TRUE, NULL, 0);
- /* any in the hanger? */
- h = (wlfc_hanger_t*)wlfc->hanger;
+ for (prec = 0; prec < txq->num_prec; prec++) {
+ pkt = pktq_pdeq(txq, prec);
+ while (pkt) {
+ for (i = 0; i < h->max_items; i++) {
+ if (pkt == h->items[i].pkt) {
+ if (h->items[i].state == WLFC_HANGER_ITEM_STATE_INUSE) {
+ PKTFREE(wlfc->osh, h->items[i].pkt, TRUE);
+ h->items[i].state = WLFC_HANGER_ITEM_STATE_FREE;
+ } else if (h->items[i].state ==
+ WLFC_HANGER_ITEM_STATE_INUSE_SUPPRESSED) {
+ /* These are already freed from the psq */
+ h->items[i].state = WLFC_HANGER_ITEM_STATE_FREE;
+ }
+ break;
+ }
+ }
+ pkt = pktq_pdeq(txq, prec);
+ }
+ }
+ /* flush remained pkt in hanger queue, not in bus->txq */
for (i = 0; i < h->max_items; i++) {
if (h->items[i].state == WLFC_HANGER_ITEM_STATE_INUSE) {
PKTFREE(wlfc->osh, h->items[i].pkt, TRUE);
@@ -2455,9 +2519,9 @@ dhd_wlfc_deinit(dhd_pub_t *dhd)
/* free top structure */
MFREE(dhd->osh, dhd->wlfc_state, sizeof(athost_wl_status_info_t));
dhd->wlfc_state = NULL;
-#ifdef VSDB_DYNAMIC_F2_BLKSIZE
+#if defined(CUSTOMER_HW4) && defined(DYNAMIC_F2_BLKSIZE_OF_PROPTXSTATUS)
dhdsdio_func_blocksize(dhd, 2, sd_f2_blocksize);
-#endif
+#endif /* CUSTOMER_HW4 && DYNAMIC_F2_BLKSIZE_OF_PROPTXSTATUS */
return;
}
#endif /* PROP_TXSTATUS */
@@ -2576,7 +2640,7 @@ dhd_prot_hdrpull(dhd_pub_t *dhd, int *ifidx, void *pktbuf, uchar *reorder_buf_in
}
#endif /* PROP_TXSTATUS */
#if !defined(NDIS630)
- PKTPULL(dhd->osh, pktbuf, (h->dataOffset << 2));
+ PKTPULL(dhd->osh, pktbuf, (h->dataOffset << 2));
#endif
return 0;
}
@@ -2709,7 +2773,7 @@ dhd_get_hostreorder_pkts(void *osh, struct reorder_info *ptr, void **pkt,
if (plast == NULL)
*pkt = p;
else
- PKTSETNEXT(dhd->osh, plast, p);
+ PKTSETNEXT(osh, plast, p);
plast = p;
pkt_cnt++;
@@ -2737,8 +2801,6 @@ dhd_process_pkt_reorder_info(dhd_pub_t *dhd, uchar *reorder_info_buf, uint reord
*pkt_count = 0;
return 0;
}
- cur_pkt = *pkt;
- *pkt = NULL;
flow_id = reorder_info_buf[WLHOST_REORDERDATA_FLOWID_OFFSET];
flags = reorder_info_buf[WLHOST_REORDERDATA_FLAGS_OFFSET];
@@ -2755,6 +2817,9 @@ dhd_process_pkt_reorder_info(dhd_pub_t *dhd, uchar *reorder_info_buf, uint reord
return 0;
}
+ cur_pkt = *pkt;
+ *pkt = NULL;
+
ptr = dhd->reorder_bufs[flow_id];
if (flags & WLHOST_REORDERDATA_DEL_FLOW) {
uint32 buf_size = sizeof(struct reorder_info);
@@ -2766,6 +2831,7 @@ dhd_process_pkt_reorder_info(dhd_pub_t *dhd, uchar *reorder_info_buf, uint reord
DHD_ERROR(("%s: received flags to cleanup, but no flow (%d) yet\n",
__FUNCTION__, flow_id));
*pkt_count = 1;
+ *pkt = cur_pkt;
return 0;
}
diff --git a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_cfg80211.c b/drivers/net/wireless/bcmdhd/dhd_cfg80211.c
index 61369cb..cc49465 100644
--- a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_cfg80211.c
+++ b/drivers/net/wireless/bcmdhd/dhd_cfg80211.c
@@ -2,13 +2,13 @@
* Linux cfg80211 driver - Dongle Host Driver (DHD) related
*
* Copyright (C) 1999-2012, Broadcom Corporation
- *
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,7 +16,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
@@ -46,6 +46,12 @@ extern void dhd_pktfilter_offload_enable(dhd_pub_t * dhd, char *arg, int enable,
static int dhd_dongle_up = FALSE;
+#include <dngl_stats.h>
+#include <dhd.h>
+#include <dhdioctl.h>
+#include <wlioctl.h>
+#include <dhd_cfg80211.h>
+
static s32 wl_dongle_up(struct net_device *ndev, u32 up);
/**
@@ -70,6 +76,38 @@ s32 dhd_cfg80211_down(struct wl_priv *wl)
return 0;
}
+s32 dhd_cfg80211_set_p2p_info(struct wl_priv *wl, int val)
+{
+ dhd_pub_t *dhd = (dhd_pub_t *)(wl->pub);
+ dhd->op_mode |= val;
+ WL_ERR(("Set : op_mode=%d\n", dhd->op_mode));
+#if defined(ARP_OFFLOAD_SUPPORT)
+ if ((dhd->op_mode & CONCURRENT_MULTI_CHAN) !=
+ CONCURRENT_MULTI_CHAN) {
+ /* IF P2P is enabled, disable arpoe */
+ dhd_arp_offload_set(dhd, 0);
+ dhd_arp_offload_enable(dhd, false);
+ }
+#endif /* ARP_OFFLOAD_SUPPORT */
+
+ return 0;
+}
+
+s32 dhd_cfg80211_clean_p2p_info(struct wl_priv *wl)
+{
+ dhd_pub_t *dhd = (dhd_pub_t *)(wl->pub);
+ dhd->op_mode &= ~CONCURENT_MASK;
+ WL_ERR(("Clean : op_mode=%d\n", dhd->op_mode));
+
+#if defined(ARP_OFFLOAD_SUPPORT)
+ /* IF P2P is disabled, enable arpoe back for STA mode. */
+ dhd_arp_offload_set(dhd, dhd_arp_mode);
+ dhd_arp_offload_enable(dhd, true);
+#endif /* ARP_OFFLOAD_SUPPORT */
+
+ return 0;
+}
+
static s32 wl_dongle_up(struct net_device *ndev, u32 up)
{
s32 err = 0;
@@ -384,7 +422,7 @@ static void wl_cfg80211_bt_handler(struct work_struct *work)
__FUNCTION__));
btcx_inf->bt_state = BT_DHCP_OPPR_WIN;
mod_timer(&btcx_inf->timer,
- jiffies + BT_DHCP_OPPR_WIN_TIME*HZ/1000);
+ jiffies + msecs_to_jiffies(BT_DHCP_OPPR_WIN_TIME));
btcx_inf->timer_on = 1;
break;
@@ -404,7 +442,7 @@ static void wl_cfg80211_bt_handler(struct work_struct *work)
wl_cfg80211_bt_setflag(btcx_inf->dev, TRUE);
btcx_inf->bt_state = BT_DHCP_FLAG_FORCE_TIMEOUT;
mod_timer(&btcx_inf->timer,
- jiffies + BT_DHCP_FLAG_FORCE_TIME*HZ/1000);
+ jiffies + msecs_to_jiffies(BT_DHCP_FLAG_FORCE_TIME));
btcx_inf->timer_on = 1;
break;
@@ -480,7 +518,7 @@ void wl_cfg80211_btcoex_deinit(struct wl_priv *wl)
kfree(wl->btcoex_info);
wl->btcoex_info = NULL;
}
-#endif /* COEX_DHCP */
+#endif
int wl_cfg80211_set_btcoex_dhcp(struct net_device *dev, char *command)
{
@@ -504,27 +542,20 @@ int wl_cfg80211_set_btcoex_dhcp(struct net_device *dev, char *command)
#ifdef PKT_FILTER_SUPPORT
dhd_pub_t *dhd = (dhd_pub_t *)(wl->pub);
- int i;
#endif
/* Figure out powermode 1 or o command */
strncpy((char *)&powermode_val, command + strlen("BTCOEXMODE") +1, 1);
- WL_ERR(("%s: DHCP session Enter\n", __FUNCTION__));
if (strnicmp((char *)&powermode_val, "1", strlen("1")) == 0) {
-
- WL_ERR(("%s: DHCP session starts\n", __FUNCTION__));
+ WL_TRACE_HW4(("%s: DHCP session starts\n", __FUNCTION__));
#ifdef PKT_FILTER_SUPPORT
dhd->dhcp_in_progress = 1;
- /* Disable packet filtering */
- if (dhd_pkt_filter_enable && dhd->early_suspended) {
- WL_ERR(("DHCP in progressing , disable packet filter!!!\n"));
- for (i = 0; i < dhd->pktfilter_count; i++) {
- dhd_pktfilter_offload_enable(dhd, dhd->pktfilter[i],
- 0, dhd_master_mode);
- }
+ if (dhd->early_suspended) {
+ WL_TRACE_HW4(("DHCP in progressing , disable packet filter!!!\n"));
+ dhd_enable_packet_filter(0, dhd);
}
#endif
@@ -571,17 +602,15 @@ int wl_cfg80211_set_btcoex_dhcp(struct net_device *dev, char *command)
}
else if (strnicmp((char *)&powermode_val, "2", strlen("2")) == 0) {
+
#ifdef PKT_FILTER_SUPPORT
- dhd->dhcp_in_progress = 0;
- WL_ERR(("%s: DHCP is complete \n", __FUNCTION__));
+ dhd->dhcp_in_progress = 0;
+ WL_TRACE_HW4(("%s: DHCP is complete \n", __FUNCTION__));
/* Enable packet filtering */
- if (dhd_pkt_filter_enable && dhd->early_suspended) {
- WL_ERR(("DHCP is complete , enable packet filter!!!\n"));
- for (i = 0; i < dhd->pktfilter_count; i++) {
- dhd_pktfilter_offload_enable(dhd, dhd->pktfilter[i],
- 1, dhd_master_mode);
- }
+ if (dhd->early_suspended) {
+ WL_TRACE_HW4(("DHCP is complete , enable packet filter!!!\n"));
+ dhd_enable_packet_filter(1, dhd);
}
#endif
diff --git a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_cfg80211.h b/drivers/net/wireless/bcmdhd/dhd_cfg80211.h
index f4374f1..922d6ed 100644
--- a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_cfg80211.h
+++ b/drivers/net/wireless/bcmdhd/dhd_cfg80211.h
@@ -1,14 +1,14 @@
/*
* Linux cfg80211 driver - Dongle Host Driver (DHD) related
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,7 +16,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
@@ -34,6 +34,8 @@
s32 dhd_cfg80211_init(struct wl_priv *wl);
s32 dhd_cfg80211_deinit(struct wl_priv *wl);
s32 dhd_cfg80211_down(struct wl_priv *wl);
+s32 dhd_cfg80211_set_p2p_info(struct wl_priv *wl, int val);
+s32 dhd_cfg80211_clean_p2p_info(struct wl_priv *wl);
s32 dhd_config_dongle(struct wl_priv *wl, bool need_lock);
int wl_cfg80211_btcoex_init(struct wl_priv *wl);
diff --git a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_common.c b/drivers/net/wireless/bcmdhd/dhd_common.c
index 9fda3c1..b985a7c 100644
--- a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_common.c
+++ b/drivers/net/wireless/bcmdhd/dhd_common.c
@@ -2,13 +2,13 @@
* Broadcom Dongle Host Driver (DHD), common DHD core.
*
* Copyright (C) 1999-2012, Broadcom Corporation
- *
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,12 +16,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: dhd_common.c 304622 2011-12-22 19:51:18Z $
+ * $Id: dhd_common.c 357867 2012-09-20 06:57:44Z $
*/
#include <typedefs.h>
#include <osl.h>
@@ -93,7 +93,9 @@ extern int dhd_iscan_in_progress(void *h);
void dhd_iscan_lock(void);
void dhd_iscan_unlock(void);
extern int dhd_change_mtu(dhd_pub_t *dhd, int new_mtu, int ifidx);
-extern bool dhd_concurrent_fw(dhd_pub_t *dhd);
+#if !defined(AP) && defined(WLP2P)
+extern int dhd_get_concurrent_capabilites(dhd_pub_t *dhd);
+#endif
bool ap_cfg_running = FALSE;
bool ap_fw_loaded = FALSE;
@@ -143,7 +145,7 @@ enum {
};
const bcm_iovar_t dhd_iovars[] = {
- {"version", IOV_VERSION, 0, IOVT_BUFFER, sizeof(dhd_version) },
+ {"version", IOV_VERSION, 0, IOVT_BUFFER, sizeof(dhd_version) },
#ifdef DHD_DEBUG
{"msglevel", IOV_MSGLEVEL, 0, IOVT_UINT32, 0 },
#endif /* DHD_DEBUG */
@@ -185,15 +187,6 @@ const bcm_iovar_t dhd_iovars[] = {
void
dhd_common_init(osl_t *osh)
{
-
- /* Init global variables at run-time, not as part of the declaration.
- * This is required to support init/de-init of the driver. Initialization
- * of globals as part of the declaration results in non-deterministic
- * behavior since the value of the globals may be different on the
- * first time that the driver is initialized vs subsequent initializations.
- */
- /* Allocate private bus interface state */
-
#ifdef CONFIG_BCMDHD_FW_PATH
bcm_strncpy_s(fw_path, sizeof(fw_path), CONFIG_BCMDHD_FW_PATH, MOD_PARAM_PATHLEN-1);
#else /* CONFIG_BCMDHD_FW_PATH */
@@ -207,7 +200,6 @@ dhd_common_init(osl_t *osh)
#ifdef SOFTAP
fw_path2[0] = '\0';
#endif
-
}
static int
@@ -285,26 +277,29 @@ dhd_wl_ioctl(dhd_pub_t *dhd_pub, int ifindex, wl_ioctl_t *ioc, void *buf, int le
dhd_os_proto_block(dhd_pub);
ret = dhd_prot_ioctl(dhd_pub, ifindex, ioc, buf, len);
- if (!ret || ret == -ETIMEDOUT) {
+#if defined(CUSTOMER_HW4)
+ if ((ret || ret == -ETIMEDOUT) && (dhd_pub->up))
+#else
+ if ((ret) && (dhd_pub->up))
+#endif /* CUSTOMER_HW4 */
/* Send hang event only if dhd_open() was success */
- if (dhd_pub->up)
dhd_os_check_hang(dhd_pub, ifindex, ret);
- }
dhd_os_proto_unblock(dhd_pub);
-#ifdef CUSTOMER_HW_SAMSUNG
+
+#if defined(CUSTOMER_HW4)
if (ret < 0) {
if (ioc->cmd == WLC_GET_VAR)
DHD_ERROR(("%s: WLC_GET_VAR: %s, ret = %d\n",
- __FUNCTION__, (char *)ioc->buf, ret));
+ __FUNCTION__, (char *)ioc->buf, ret));
else if (ioc->cmd == WLC_SET_VAR)
DHD_ERROR(("%s: WLC_SET_VAR: %s, ret = %d\n",
- __FUNCTION__, (char *)ioc->buf, ret));
+ __FUNCTION__, (char *)ioc->buf, ret));
else
DHD_ERROR(("%s: WLC_IOCTL: cmd: %d, ret = %d\n",
- __FUNCTION__, ioc->cmd, ret));
+ __FUNCTION__, ioc->cmd, ret));
}
-#endif /* CUSTOMER_HW_SAMSUNG */
+#endif
return ret;
}
@@ -337,6 +332,14 @@ dhd_doiovar(dhd_pub_t *dhd_pub, const bcm_iovar_t *vi, uint32 actionid, const ch
break;
case IOV_SVAL(IOV_MSGLEVEL):
+#ifdef WL_CFG80211
+ /* Enable DHD and WL logs in oneshot */
+ if (int_val & DHD_WL_VAL2)
+ wl_cfg80211_enable_trace(TRUE, int_val & (~DHD_WL_VAL2));
+ else if (int_val & DHD_WL_VAL)
+ wl_cfg80211_enable_trace(FALSE, WL_DBG_DBG);
+ if (!(int_val & DHD_WL_VAL2))
+#endif
dhd_msg_level = int_val;
break;
case IOV_GVAL(IOV_BCMERRORSTR):
@@ -576,8 +579,7 @@ dhd_prec_enq(dhd_pub_t *dhdp, struct pktq *q, void *pkt, int prec)
if (pktq_pfull(q, prec))
eprec = prec;
else if (pktq_full(q)) {
- p = pktq_peek_tail(q, &eprec);
-// ASSERT(p);
+ pktq_peek_tail(q, &eprec);
if (eprec > prec || eprec < 0)
return FALSE;
}
@@ -597,8 +599,7 @@ dhd_prec_enq(dhd_pub_t *dhdp, struct pktq *q, void *pkt, int prec)
}
/* Enqueue */
- p = pktq_penq(q, prec, pkt);
-// ASSERT(p);
+ pktq_penq(q, prec, pkt);
return TRUE;
}
@@ -752,11 +753,12 @@ wl_show_host_event(wl_event_msg_t *event, void *event_data)
flags = ntoh16(event->flags);
status = ntoh32(event->status);
reason = ntoh32(event->reason);
+ BCM_REFERENCE(reason);
auth_type = ntoh32(event->auth_type);
datalen = ntoh32(event->datalen);
/* debug dump of event messages */
- sprintf(eabuf, "%02x:%02x:%02x:%02x:%02x:%02x",
+ snprintf(eabuf, sizeof(eabuf), "%02x:%02x:%02x:%02x:%02x:%02x",
(uchar)event->addr.octet[0]&0xff,
(uchar)event->addr.octet[1]&0xff,
(uchar)event->addr.octet[2]&0xff,
@@ -816,7 +818,7 @@ wl_show_host_event(wl_event_msg_t *event, void *event_data)
else if (auth_type == DOT11_SHARED_KEY)
auth_str = "Shared Key";
else {
- sprintf(err_msg, "AUTH unknown: %d", (int)auth_type);
+ snprintf(err_msg, sizeof(err_msg), "AUTH unknown: %d", (int)auth_type);
auth_str = err_msg;
}
if (event_type == WLC_E_AUTH_IND) {
@@ -831,6 +833,7 @@ wl_show_host_event(wl_event_msg_t *event, void *event_data)
DHD_EVENT(("MACEVENT: %s, MAC %s, %s, FAILURE, reason %d\n",
event_name, eabuf, auth_str, (int)reason));
}
+ BCM_REFERENCE(auth_str);
break;
@@ -861,11 +864,14 @@ wl_show_host_event(wl_event_msg_t *event, void *event_data)
case WLC_E_LINK:
DHD_EVENT(("MACEVENT: %s %s\n", event_name, link?"UP":"DOWN"));
+ BCM_REFERENCE(link);
break;
case WLC_E_MIC_ERROR:
DHD_EVENT(("MACEVENT: %s, MAC %s, Group %d, Flush %d\n",
event_name, eabuf, group, flush_txq));
+ BCM_REFERENCE(group);
+ BCM_REFERENCE(flush_txq);
break;
case WLC_E_ICV_ERROR:
@@ -946,7 +952,7 @@ wl_show_host_event(wl_event_msg_t *event, void *event_data)
p = (char *)&buf[MSGTRACE_HDRLEN];
while ((s = strstr(p, "\n")) != NULL) {
*s = '\0';
- printf("FW: %s\n", p);
+ printf("%s\n", p);
p = s+1;
}
printf("%s\n", p);
@@ -1038,7 +1044,6 @@ wl_host_event(dhd_pub_t *dhd_pub, int *ifidx, void *pktdata,
((ifevent->is_AP == 0) ? "STA":"AP "),
ea[0], ea[1], ea[2], ea[3], ea[4], ea[5]));
(void)ea;
-
if (ifevent->action == WLC_E_IF_CHANGE)
dhd_wlfc_interface_event(dhd_pub->info,
eWLFC_MAC_ENTRY_ACTION_UPDATE,
@@ -1061,8 +1066,8 @@ wl_host_event(dhd_pub_t *dhd_pub, int *ifidx, void *pktdata,
DHD_ERROR(("%s: ifidx %d for %s action %d\n",
__FUNCTION__, ifevent->ifidx,
event->ifname, ifevent->action));
- if (ifevent->action == WLC_E_IF_ADD
- || ifevent->action == WLC_E_IF_CHANGE)
+ if (ifevent->action == WLC_E_IF_ADD ||
+ ifevent->action == WLC_E_IF_CHANGE)
wl_cfg80211_notify_ifchange();
return (BCME_OK);
}
@@ -1082,7 +1087,7 @@ wl_host_event(dhd_pub_t *dhd_pub, int *ifidx, void *pktdata,
}
}
else if (ifevent->action == WLC_E_IF_DEL)
- dhd_del_if(dhd_pub->info, ifevent->ifidx);
+ dhd_del_if(dhd_pub->info, ifevent->ifidx);
} else {
#ifndef PROP_TXSTATUS
DHD_ERROR(("%s: Invalid ifidx %d for %s\n",
@@ -1112,7 +1117,7 @@ wl_host_event(dhd_pub_t *dhd_pub, int *ifidx, void *pktdata,
memcpy((void *)(&pvt_data->event.event_type), &temp,
sizeof(pvt_data->event.event_type));
}
-#endif
+#endif
/* These are what external supplicant/authenticator wants */
/* fall through */
case WLC_E_LINK:
@@ -1129,6 +1134,8 @@ wl_host_event(dhd_pub_t *dhd_pub, int *ifidx, void *pktdata,
dhd_event(dhd_pub->info, (char *)pvt_data, evlen, *ifidx);
DHD_TRACE(("%s: MAC event %d, flags %x, status %x\n",
__FUNCTION__, type, flags, status));
+ BCM_REFERENCE(flags);
+ BCM_REFERENCE(status);
/* put it back to WLC_E_NDIS_LINK */
if (type == WLC_E_NDIS_LINK) {
@@ -1190,9 +1197,11 @@ dhd_print_buf(void *pbuf, int len, int bytes_per_line)
printf("\n");
#endif /* DHD_DEBUG */
}
-
+#ifndef strtoul
#define strtoul(nptr, endptr, base) bcm_strtoul((nptr), (endptr), (base))
+#endif
+#ifdef PKT_FILTER_SUPPORT
/* Convert user's input in hex pattern to byte-size mask */
static int
wl_pattern_atoh(char *src, char *dst)
@@ -1223,7 +1232,7 @@ dhd_pktfilter_offload_enable(dhd_pub_t * dhd, char *arg, int enable, int master_
{
char *argv[8];
int i = 0;
- const char *str;
+ const char *str;
int buf_len;
int str_len;
char *arg_save = 0, *arg_org = 0;
@@ -1295,12 +1304,12 @@ fail:
void
dhd_pktfilter_offload_set(dhd_pub_t * dhd, char *arg)
{
- const char *str;
+ const char *str;
wl_pkt_filter_t pkt_filter;
wl_pkt_filter_t *pkt_filterp;
int buf_len;
int str_len;
- int rc;
+ int rc;
uint32 mask_size;
uint32 pattern_size;
char *argv[8], * buf = 0;
@@ -1428,6 +1437,7 @@ fail:
if (buf)
MFREE(dhd->osh, buf, BUF_SIZE);
}
+#endif /* PKT_FILTER_SUPPORT */
/* ========================== */
/* ==== ARP OFFLOAD SUPPORT = */
@@ -1517,7 +1527,7 @@ int
dhd_arp_get_arp_hostip_table(dhd_pub_t *dhd, void *buf, int buflen)
{
int retcode, i;
- int iov_len = 0;
+ int iov_len;
uint32 *ptr32 = buf;
bool clr_bottom = FALSE;
@@ -1525,6 +1535,7 @@ dhd_arp_get_arp_hostip_table(dhd_pub_t *dhd, void *buf, int buflen)
return -1;
iov_len = bcm_mkiovar("arp_hostip", 0, 0, buf, buflen);
+ BCM_REFERENCE(iov_len);
retcode = dhd_wl_ioctl_cmd(dhd, WLC_GET_VAR, buf, buflen, FALSE, 0);
if (retcode) {
@@ -1769,6 +1780,7 @@ bool dhd_is_associated(dhd_pub_t *dhd, void *bss_buf, int *retval)
if (ret == BCME_NOTASSOCIATED) {
DHD_TRACE(("%s: not associated! res:%d\n", __FUNCTION__, ret));
}
+
if (retval)
*retval = ret;
@@ -1846,13 +1858,29 @@ exit:
/* Check if HostAPD or WFD mode setup */
bool dhd_check_ap_wfd_mode_set(dhd_pub_t *dhd)
{
-#ifdef WL_CFG80211
- if ((dhd->op_mode & CONCURRENT_MASK) == CONCURRENT_MASK)
+#if !defined(AP) && defined(WLP2P)
+ if ((dhd->op_mode & CONCURRENT_FW_MASK) == CONCURRENT_FW_MASK)
return FALSE;
+#endif
+#ifdef WL_CFG80211
+#ifndef WL_ENABLE_P2P_IF
+ /* To be back compatble with ICS MR1 release where p2p interface
+ * disable but wlan0 used for p2p
+ */
if (((dhd->op_mode & HOSTAPD_MASK) == HOSTAPD_MASK) ||
- ((dhd->op_mode & WFD_MASK) == WFD_MASK))
+ ((dhd->op_mode & WFD_MASK) == WFD_MASK)) {
+ return TRUE;
+ }
+ else
+#else
+ /* concurent mode with p2p interface for wfd and wlan0 for sta */
+ if (((dhd->op_mode & P2P_GO_ENABLED) == P2P_GO_ENABLED) ||
+ ((dhd->op_mode & P2P_GC_ENABLED) == P2P_GC_ENABLED)) {
+ DHD_ERROR(("%s P2P enabled for mode=%d\n", __FUNCTION__, dhd->op_mode));
return TRUE;
+ }
else
+#endif /* WL_ENABLE_P2P_IF */
#endif /* WL_CFG80211 */
return FALSE;
}
@@ -1942,7 +1970,8 @@ dhd_pno_set(dhd_pub_t *dhd, wlc_ssid_t* ssids_local, int nssid, ushort scan_fr,
DHD_TRACE(("%s nssid=%d nchan=%d\n", __FUNCTION__, nssid, scan_fr));
if ((!dhd) || (!ssids_local)) {
- DHD_ERROR(("%s error exit(%s %s)\n", __FUNCTION__, (!dhd)?"dhd is null":"", (!ssids_local)?"ssids is null":""));
+ DHD_ERROR(("%s error exit(%s %s)\n", __FUNCTION__,
+ (!dhd)?"dhd is null":"", (!ssids_local)?"ssid is null":""));
err = -1;
return err;
}
@@ -2015,7 +2044,7 @@ dhd_pno_set(dhd_pub_t *dhd, wlc_ssid_t* ssids_local, int nssid, ushort scan_fr,
pfn_element.wpa_auth = htod32(WPA_AUTH_PFN_ANY);
pfn_element.wsec = htod32(0);
pfn_element.infra = htod32(1);
- pfn_element.bss_type = htod32(ENABLE << WL_PFN_HIDDEN_BIT);
+ pfn_element.flags = htod32(ENABLE << WL_PFN_HIDDEN_BIT);
memcpy((char *)pfn_element.ssid.SSID, ssids_local[i].SSID, ssids_local[i].SSID_len);
pfn_element.ssid.SSID_len = ssids_local[i].SSID_len;
@@ -2052,18 +2081,18 @@ dhd_pno_get_status(dhd_pub_t *dhd)
return (dhd->pno_enable);
}
-#endif /* PNO_SUPPORT */
+#endif /* OEM_ANDROID && PNO_SUPPORT */
#if defined(KEEP_ALIVE)
int dhd_keep_alive_onoff(dhd_pub_t *dhd)
{
- char buf[256];
- const char *str;
+ char buf[256];
+ const char *str;
wl_mkeep_alive_pkt_t mkeep_alive_pkt;
wl_mkeep_alive_pkt_t *mkeep_alive_pktp;
int buf_len;
int str_len;
- int res = -1;
+ int res = -1;
if (dhd_check_ap_wfd_mode_set(dhd) == TRUE)
return (res);
@@ -2083,6 +2112,7 @@ int dhd_keep_alive_onoff(dhd_pub_t *dhd)
mkeep_alive_pkt.keep_alive_id = 0;
mkeep_alive_pkt.len_bytes = 0;
buf_len += WL_MKEEP_ALIVE_FIXED_LEN;
+ bzero(mkeep_alive_pkt.data, sizeof(mkeep_alive_pkt.data));
/* Keep-alive attributes are set in local variable (mkeep_alive_pkt), and
* then memcpy'ed into buffer (mkeep_alive_pktp) since there is no
* guarantee that the buffer is properly aligned.
@@ -2103,7 +2133,7 @@ int
wl_iw_parse_data_tlv(char** list_str, void *dst, int dst_size, const char token,
int input_size, int *bytes_left)
{
- char* str = *list_str;
+ char* str;
uint16 short_temp;
uint32 int_temp;
@@ -2111,6 +2141,7 @@ wl_iw_parse_data_tlv(char** list_str, void *dst, int dst_size, const char token,
DHD_ERROR(("%s error paramters\n", __FUNCTION__));
return -1;
}
+ str = *list_str;
/* Clean all dest bytes */
memset(dst, 0, dst_size);
@@ -2152,13 +2183,14 @@ int
wl_iw_parse_channel_list_tlv(char** list_str, uint16* channel_list,
int channel_num, int *bytes_left)
{
- char* str = *list_str;
+ char* str;
int idx = 0;
if ((list_str == NULL) || (*list_str == NULL) ||(bytes_left == NULL) || (*bytes_left < 0)) {
DHD_ERROR(("%s error paramters\n", __FUNCTION__));
return -1;
}
+ str = *list_str;
while (*bytes_left > 0) {
@@ -2297,7 +2329,8 @@ wl_iw_parse_ssid_list(char** list_str, wlc_ssid_t* ssid, int idx, int max)
ssid[idx].SSID_len = 0;
if (idx < max) {
- bcm_strcpy_s((char*)ssid[idx].SSID, sizeof(ssid[idx].SSID), str);
+ bzero(ssid[idx].SSID, sizeof(ssid[idx].SSID));
+ strncpy((char*)ssid[idx].SSID, str, sizeof(ssid[idx].SSID) - 1);
ssid[idx].SSID_len = strlen(str);
}
idx++;
diff --git a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_custom_gpio.c b/drivers/net/wireless/bcmdhd/dhd_custom_gpio.c
index 433a12d..9421e98 100644
--- a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_custom_gpio.c
+++ b/drivers/net/wireless/bcmdhd/dhd_custom_gpio.c
@@ -1,13 +1,13 @@
/*
* Customer code to add GPIO control during WLAN start/stop
* Copyright (C) 1999-2012, Broadcom Corporation
-*
+*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
-*
+*
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -15,12 +15,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
-*
+*
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
-* $Id: dhd_custom_gpio.c 291086 2011-10-21 01:17:24Z $
+* $Id: dhd_custom_gpio.c 353167 2012-08-24 22:11:30Z $
*/
#include <typedefs.h>
@@ -41,7 +41,7 @@
extern void bcm_wlan_power_off(int);
extern void bcm_wlan_power_on(int);
#endif /* CUSTOMER_HW */
-#if defined(CUSTOMER_HW2) || defined(CUSTOMER_HW_SAMSUNG)
+#if defined(CUSTOMER_HW2) || defined(CUSTOMER_HW4)
#ifdef CONFIG_WIFI_CONTROL_FUNC
int wifi_set_power(int on, unsigned long msec);
int wifi_get_irq_number(unsigned long *irq_flags_ptr);
@@ -53,9 +53,9 @@ int wifi_get_irq_number(unsigned long *irq_flags_ptr) { return -1; }
int wifi_get_mac_addr(unsigned char *buf) { return -1; }
void *wifi_get_country_code(char *ccode) { return NULL; }
#endif /* CONFIG_WIFI_CONTROL_FUNC */
-#endif /* CUSTOMER_HW2 || CUSTOMER_HW_SAMSUNG */
+#endif /* CUSTOMER_HW2 || CUSTOMER_HW4 */
-#if defined(OOB_INTR_ONLY)
+#if defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID)
#if defined(BCMLXSDMMC)
extern int sdioh_mmc_irq(int irq);
@@ -86,7 +86,7 @@ int dhd_customer_oob_irq_map(unsigned long *irq_flags_ptr)
{
int host_oob_irq = 0;
-#if defined(CUSTOMER_HW2) || defined(CUSTOMER_HW_SAMSUNG)
+#if defined(CUSTOMER_HW2) || defined(CUSTOMER_HW4)
host_oob_irq = wifi_get_irq_number(irq_flags_ptr);
#else
@@ -98,7 +98,7 @@ int dhd_customer_oob_irq_map(unsigned long *irq_flags_ptr)
if (dhd_oob_gpio_num < 0) {
WL_ERROR(("%s: ERROR customer specific Host GPIO is NOT defined \n",
- __FUNCTION__));
+ __FUNCTION__));
return (dhd_oob_gpio_num);
}
@@ -112,11 +112,11 @@ int dhd_customer_oob_irq_map(unsigned long *irq_flags_ptr)
host_oob_irq = gpio_to_irq(dhd_oob_gpio_num);
gpio_direction_input(dhd_oob_gpio_num);
#endif /* CUSTOMER_HW */
-#endif /* CUSTOMER_HW2 || CUSTOMER_HW_SAMSUNG */
+#endif /* CUSTOMER_HW2 || CUSTOMER_HW4 */
return (host_oob_irq);
}
-#endif /* defined(OOB_INTR_ONLY) */
+#endif /* defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID) */
/* Customer function to control hw specific wlan gpios */
void
@@ -129,7 +129,7 @@ dhd_customer_gpio_wlan_ctrl(int onoff)
#ifdef CUSTOMER_HW
bcm_wlan_power_off(2);
#endif /* CUSTOMER_HW */
-#if defined(CUSTOMER_HW2) || defined(CUSTOMER_HW_SAMSUNG)
+#if defined(CUSTOMER_HW2) || defined(CUSTOMER_HW4)
wifi_set_power(0, 0);
#endif
WL_ERROR(("=========== WLAN placed in RESET ========\n"));
@@ -141,7 +141,7 @@ dhd_customer_gpio_wlan_ctrl(int onoff)
#ifdef CUSTOMER_HW
bcm_wlan_power_on(2);
#endif /* CUSTOMER_HW */
-#if defined(CUSTOMER_HW2) || defined(CUSTOMER_HW_SAMSUNG)
+#if defined(CUSTOMER_HW2) || defined(CUSTOMER_HW4)
wifi_set_power(1, 0);
#endif
WL_ERROR(("=========== WLAN going back to live ========\n"));
@@ -195,77 +195,54 @@ dhd_custom_get_mac_address(unsigned char *buf)
}
#endif /* GET_CUSTOM_MAC_ENABLE */
+#ifndef CUSTOMER_HW4
/* Customized Locale table : OPTIONAL feature */
const struct cntry_locales_custom translate_custom_table[] = {
/* Table should be filled out based on custom platform regulatory requirement */
-#ifdef BCM4334_CHIP
- {"", "XZ", 11}, /* Universal if Country code is unknown or empty */
-#endif
- {"AE", "AE", 1},
- {"AR", "AR", 1},
- {"AT", "AT", 1},
- {"AU", "AU", 2},
- {"BE", "BE", 1},
- {"BG", "BG", 1},
- {"BN", "BN", 1},
- {"CA", "CA", 2},
- {"CH", "CH", 1},
- {"CN", "CN", 0},
- {"CY", "CY", 1},
- {"CZ", "CZ", 1},
- {"DE", "DE", 3},
- {"DK", "DK", 1},
- {"EE", "EE", 1},
- {"ES", "ES", 1},
- {"FI", "FI", 1},
- {"FR", "FR", 1},
- {"GB", "GB", 1},
- {"GR", "GR", 1},
- {"HR", "HR", 1},
- {"HU", "HU", 1},
- {"IE", "IE", 1},
- {"IS", "IS", 1},
- {"IT", "IT", 1},
- {"JP", "JP", 5},
- {"KR", "KR", 24},
- {"KW", "KW", 1},
- {"LI", "LI", 1},
- {"LT", "LT", 1},
- {"LU", "LU", 1},
- {"LV", "LV", 1},
- {"MA", "MA", 1},
- {"MT", "MT", 1},
- {"MX", "MX", 1},
- {"NL", "NL", 1},
- {"NO", "NO", 1},
- {"PL", "PL", 1},
- {"PT", "PT", 1},
- {"PY", "PY", 1},
- {"RO", "RO", 1},
- {"SE", "SE", 1},
- {"SI", "SI", 1},
- {"SK", "SK", 1},
- {"TR", "TR", 7},
- {"TW", "TW", 2},
-#ifdef CUSTOMER_HW_SAMSUNG
- {"IR", "XZ", 11}, /* Universal if Country code is IRAN, (ISLAMIC REPUBLIC OF) */
- {"SD", "XZ", 11}, /* Universal if Country code is SUDAN */
- {"SY", "XZ", 11}, /* Universal if Country code is SYRIAN ARAB REPUBLIC */
- {"GL", "XZ", 11}, /* Universal if Country code is GREENLAND */
- {"PS", "XZ", 11}, /* Universal if Country code is PALESTINIAN TERRITORY, OCCUPIED */
- {"TL", "XZ", 11}, /* Universal if Country code is TIMOR-LESTE (EAST TIMOR) */
- {"MH", "XZ", 11}, /* Universal if Country code is MARSHALL ISLANDS */
- {"PK", "XZ", 11}, /* Universal if Country code is PAKISTAN*/
-#endif
-#ifdef BCM4334_CHIP
- {"RU", "RU", 5},
- {"SG", "SG", 4},
- {"US", "US", 46}
-#endif
-#ifdef BCM4330_CHIP
- {"RU", "RU", 1},
- {"US", "US", 5}
-#endif
+#ifdef EXAMPLE_TABLE
+ {"", "XY", 4}, /* Universal if Country code is unknown or empty */
+ {"US", "US", 69}, /* input ISO "US" to : US regrev 69 */
+ {"CA", "US", 69}, /* input ISO "CA" to : US regrev 69 */
+ {"EU", "EU", 5}, /* European union countries to : EU regrev 05 */
+ {"AT", "EU", 5},
+ {"BE", "EU", 5},
+ {"BG", "EU", 5},
+ {"CY", "EU", 5},
+ {"CZ", "EU", 5},
+ {"DK", "EU", 5},
+ {"EE", "EU", 5},
+ {"FI", "EU", 5},
+ {"FR", "EU", 5},
+ {"DE", "EU", 5},
+ {"GR", "EU", 5},
+ {"HU", "EU", 5},
+ {"IE", "EU", 5},
+ {"IT", "EU", 5},
+ {"LV", "EU", 5},
+ {"LI", "EU", 5},
+ {"LT", "EU", 5},
+ {"LU", "EU", 5},
+ {"MT", "EU", 5},
+ {"NL", "EU", 5},
+ {"PL", "EU", 5},
+ {"PT", "EU", 5},
+ {"RO", "EU", 5},
+ {"SK", "EU", 5},
+ {"SI", "EU", 5},
+ {"ES", "EU", 5},
+ {"SE", "EU", 5},
+ {"GB", "EU", 5},
+ {"KR", "XY", 3},
+ {"AU", "XY", 3},
+ {"CN", "XY", 3}, /* input ISO "CN" to : XY regrev 03 */
+ {"TW", "XY", 3},
+ {"AR", "XY", 3},
+ {"MX", "XY", 3},
+ {"IL", "IL", 0},
+ {"CH", "CH", 0},
+ {"TR", "TR", 0},
+ {"NO", "NO", 0},
+#endif /* EXMAPLE_TABLE */
};
@@ -275,7 +252,8 @@ const struct cntry_locales_custom translate_custom_table[] = {
*/
void get_customized_country_code(char *country_iso_code, wl_country_t *cspec)
{
-#ifndef CUSTOMER_HW_SAMSUNG
+#if defined(CUSTOMER_HW2) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
+
struct cntry_locales_custom *cloc_ptr;
if (!cspec)
@@ -312,5 +290,6 @@ void get_customized_country_code(char *country_iso_code, wl_country_t *cspec)
cspec->rev = translate_custom_table[0].custom_locale_rev;
#endif /* EXMAPLE_TABLE */
return;
-#endif /* CUSTOMER_HW_SAMSUNG) */
+#endif /* defined(CUSTOMER_HW2) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)) */
}
+#endif /* CUSTOMER_HW4 */
diff --git a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_custom_sec.c b/drivers/net/wireless/bcmdhd/dhd_custom_sec.c
index 74c5da3..72a3a8e 100644
--- a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_custom_sec.c
+++ b/drivers/net/wireless/bcmdhd/dhd_custom_sec.c
@@ -1,19 +1,29 @@
-/* Function list
- 1. Module Type
- a. For CID - Use 'USE_CID_CHECK' Feature
- dhd_write_cid_file(), dhd_dump_cis(), dhd_check_module_cid()
- b. For MAC - Use 'GET_MAC_FROM_OTP' Feature
- dhd_write_mac_file(), dhd_check_module_mac()
- 2. COB Type
- a. For MAC - Use 'READ_MACADDR' Feature
- dhd_read_macaddr()
- 3. Etc
- a. Power Save Mode - Use 'CONFIG_CONTROL_PM' Feature
- sec_control_pm()
- b. U1 Module only - Use 'WRITE_MACADDR' Feature
- dhd_write_macaddr
-*/
-
+/*
+ * Customer HW 4 dependant file
+ *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
+ * Unless you and Broadcom execute a separate written software license
+ * agreement governing use of this software, this software is licensed to you
+ * under the terms of the GNU General Public License version 2 (the "GPL"),
+ * available at http://www.broadcom.com/licenses/GPLv2.php, with the
+ * following added to such license:
+ *
+ * As a special exception, the copyright holders of this software give you
+ * permission to link this software with independent modules, and to copy and
+ * distribute the resulting executable under terms of your choice, provided that
+ * you also meet, for each linked independent module, the terms and conditions of
+ * the license of that module. An independent module is a module which is not
+ * derived from this software. The special exception does not apply to any
+ * modifications of the software.
+ *
+ * Notwithstanding the above, under no circumstances may you combine this
+ * software in any way with any other Broadcom software provided under a license
+ * other than the GPL, without Broadcom's express prior written consent.
+ *
+ * $Id: dhd_custom_sec.c 334946 2012-05-24 20:38:00Z $
+ */
+#ifdef CUSTOMER_HW4
#include <typedefs.h>
#include <linuxver.h>
#include <osl.h>
@@ -29,7 +39,119 @@
struct dhd_info;
extern int _dhd_set_mac_address(struct dhd_info *dhd,
- int ifidx, struct ether_addr *addr);
+ int ifidx, struct ether_addr *addr);
+
+struct cntry_locales_custom {
+ char iso_abbrev[WLC_CNTRY_BUF_SZ]; /* ISO 3166-1 country abbreviation */
+ char custom_locale[WLC_CNTRY_BUF_SZ]; /* Custom firmware locale */
+ int32 custom_locale_rev; /* Custom local revisin default -1 */
+};
+
+/* Locale table for sec */
+const struct cntry_locales_custom translate_custom_table[] = {
+#ifdef BCM4334_CHIP
+ {"", "XZ", 11}, /* Universal if Country code is unknown or empty */
+#endif
+ {"AE", "AE", 1},
+ {"AR", "AR", 1},
+ {"AT", "AT", 1},
+ {"AU", "AU", 2},
+ {"BE", "BE", 1},
+ {"BG", "BG", 1},
+ {"BN", "BN", 1},
+ {"CA", "CA", 2},
+ {"CH", "CH", 1},
+ {"CN", "CN", 0},
+ {"CY", "CY", 1},
+ {"CZ", "CZ", 1},
+ {"DE", "DE", 3},
+ {"DK", "DK", 1},
+ {"EE", "EE", 1},
+ {"ES", "ES", 1},
+ {"FI", "FI", 1},
+ {"FR", "FR", 1},
+ {"GB", "GB", 1},
+ {"GR", "GR", 1},
+ {"HR", "HR", 1},
+ {"HU", "HU", 1},
+ {"IE", "IE", 1},
+ {"IS", "IS", 1},
+ {"IT", "IT", 1},
+ {"JP", "JP", 5},
+ {"KR", "KR", 24},
+ {"KW", "KW", 1},
+ {"LI", "LI", 1},
+ {"LT", "LT", 1},
+ {"LU", "LU", 1},
+ {"LV", "LV", 1},
+ {"MA", "MA", 1},
+ {"MT", "MT", 1},
+ {"MX", "MX", 1},
+ {"NL", "NL", 1},
+ {"NO", "NO", 1},
+ {"PL", "PL", 1},
+ {"PT", "PT", 1},
+ {"PY", "PY", 1},
+ {"RO", "RO", 1},
+ {"SE", "SE", 1},
+ {"SI", "SI", 1},
+ {"SK", "SK", 1},
+ {"TR", "TR", 7},
+ {"TW", "TW", 2},
+ {"IR", "XZ", 11}, /* Universal if Country code is IRAN, (ISLAMIC REPUBLIC OF) */
+ {"SD", "XZ", 11}, /* Universal if Country code is SUDAN */
+ {"SY", "XZ", 11}, /* Universal if Country code is SYRIAN ARAB REPUBLIC */
+ {"GL", "XZ", 11}, /* Universal if Country code is GREENLAND */
+ {"PS", "XZ", 11}, /* Universal if Country code is PALESTINIAN TERRITORY, OCCUPIED */
+ {"TL", "XZ", 11}, /* Universal if Country code is TIMOR-LESTE (EAST TIMOR) */
+ {"MH", "XZ", 11}, /* Universal if Country code is MARSHALL ISLANDS */
+ {"PK", "XZ", 11}, /* Universal if Country code is PAKISTAN */
+#ifdef BCM4334_CHIP
+ {"RU", "RU", 13},
+ {"SG", "SG", 4},
+ {"US", "US", 46},
+ {"UA", "UA", 8},
+ {"CO", "CO", 4},
+ {"ID", "ID", 1},
+ {"LA", "LA", 1},
+ {"LB", "LB", 2},
+ {"VN", "VN", 4},
+#endif
+#ifdef BCM4330_CHIP
+ {"RU", "RU", 13},
+ {"US", "US", 5},
+ {"UA", "UY", 0},
+ {"AD", "AL", 0},
+#endif
+ {"UA", "UA", 2}
+};
+
+/* Customized Locale convertor
+* input : ISO 3166-1 country abbreviation
+* output: customized cspec
+*/
+void get_customized_country_code(char *country_iso_code, wl_country_t *cspec)
+{
+ int size, i;
+
+ size = ARRAYSIZE(translate_custom_table);
+
+ if (cspec == 0)
+ return;
+
+ if (size == 0)
+ return;
+
+ for (i = 0; i < size; i++) {
+ if (strcmp(country_iso_code, translate_custom_table[i].iso_abbrev) == 0) {
+ memcpy(cspec->ccode,
+ translate_custom_table[i].custom_locale, WLC_CNTRY_BUF_SZ);
+ cspec->rev = translate_custom_table[i].custom_locale_rev;
+ return;
+ }
+ }
+ return;
+}
#ifdef SLP_PATH
#define CIDINFO "/opt/etc/.cid.info"
@@ -44,7 +166,7 @@ extern int _dhd_set_mac_address(struct dhd_info *dhd,
#define REVINFO "/data/.rev"
#define CIDINFO "/data/.cid.info"
#define PSMINFO "/data/.psm.info"
-#endif /*SLP_PATH*/
+#endif /* SLP_PATH */
#ifdef READ_MACADDR
int dhd_read_macaddr(struct dhd_info *dhd, struct ether_addr *mac)
@@ -65,7 +187,7 @@ int dhd_read_macaddr(struct dhd_info *dhd, struct ether_addr *mac)
fp = filp_open(filepath_efs, O_RDONLY, 0);
if (IS_ERR(fp)) {
start_readmac:
- /* File Doesn't Exist. Create and write mac addr.*/
+ /* File Doesn't Exist. Create and write mac addr. */
fp = filp_open(filepath_efs, O_RDWR | O_CREAT, 0666);
if (IS_ERR(fp)) {
DHD_ERROR(("[WIFI] %s: File open error\n", filepath_efs));
@@ -74,30 +196,36 @@ start_readmac:
oldfs = get_fs();
set_fs(get_ds());
- /* Generating the Random Bytes for 3 last octects of the MAC address */
+ /* Generating the Random Bytes for 3 last octects of the MAC address */
get_random_bytes(randommac, 3);
sprintf(macbuffer, "%02X:%02X:%02X:%02X:%02X:%02X\n",
- 0x00, 0x12, 0x34, randommac[0], randommac[1], randommac[2]);
- DHD_ERROR(("[WIFI]The Random Generated MAC ID: %s\n", macbuffer));
+ 0x00, 0x12, 0x34, randommac[0], randommac[1], randommac[2]);
+ DHD_ERROR(("[WIFI]The Random Generated MAC ID: %s\n", macbuffer));
if (fp->f_mode & FMODE_WRITE) {
- ret = fp->f_op->write(fp, (const char *)macbuffer, sizeof(macbuffer), &fp->f_pos);
+ ret = fp->f_op->write(fp, (const char *)macbuffer,
+ sizeof(macbuffer), &fp->f_pos);
if (ret < 0)
- DHD_ERROR(("[WIFI]MAC address [%s] Failed to write into File: %s\n", macbuffer, filepath_efs));
+ DHD_ERROR(("[WIFI]MAC address [%s] Failed to write into File: %s\n",
+ macbuffer, filepath_efs));
else
- DHD_ERROR(("[WIFI]MAC address [%s] written into File: %s\n", macbuffer, filepath_efs));
+ DHD_ERROR(("[WIFI]MAC address [%s] written into File: %s\n",
+ macbuffer, filepath_efs));
}
set_fs(oldfs);
- /* Reading the MAC Address from .mac.info file( the existed file or just created file)*/
+ /* Reading the MAC Address from .mac.info file
+ ( the existed file or just created file)
+ */
ret = kernel_read(fp, 0, buf, 18);
} else {
- /* Reading the MAC Address from .mac.info file( the existed file or just created file)*/
+ /* Reading the MAC Address from
+ .mac.info file( the existed file or just created file)
+ */
ret = kernel_read(fp, 0, buf, 18);
/* to prevent abnormal string display when mac address is displayed on the screen. */
buf[17] = '\0';
- DHD_ERROR(("Read MAC : [%s] [%d] \r\n" , buf, strncmp(buf , "00:00:00:00:00:00" , 17)));
- if (strncmp(buf , "00:00:00:00:00:00" , 17) < 1) {
+ if (strncmp(buf, "00:00:00:00:00:00", 17) < 1) {
DHD_ERROR(("goto start_readmac \r\n"));
filp_close(fp, NULL);
goto start_readmac;
@@ -106,9 +234,9 @@ start_readmac:
if (ret)
sscanf(buf, "%02X:%02X:%02X:%02X:%02X:%02X",
- (unsigned int *)&(mac->octet[0]), (unsigned int *)&(mac->octet[1]),
- (unsigned int *)&(mac->octet[2]), (unsigned int *)&(mac->octet[3]),
- (unsigned int *)&(mac->octet[4]), (unsigned int *)&(mac->octet[5]));
+ (unsigned int *)&(mac->octet[0]), (unsigned int *)&(mac->octet[1]),
+ (unsigned int *)&(mac->octet[2]), (unsigned int *)&(mac->octet[3]),
+ (unsigned int *)&(mac->octet[4]), (unsigned int *)&(mac->octet[5]));
else
DHD_ERROR(("dhd_bus_start: Reading from the '%s' returns 0 bytes\n", filepath_efs));
@@ -116,7 +244,7 @@ start_readmac:
filp_close(fp, NULL);
/* Writing Newly generated MAC ID to the Dongle */
- if (0 == _dhd_set_mac_address(dhd, 0, mac))
+ if (_dhd_set_mac_address(dhd, 0, mac) == 0)
DHD_INFO(("dhd_bus_start: MACID is overwritten\n"));
else
DHD_ERROR(("dhd_bus_start: _dhd_set_mac_address() failed\n"));
@@ -129,7 +257,7 @@ start_readmac:
static int g_imac_flag;
enum {
- MACADDR_NONE = 0 ,
+ MACADDR_NONE = 0,
MACADDR_MOD,
MACADDR_MOD_RANDOM,
MACADDR_MOD_NONE,
@@ -150,8 +278,8 @@ int dhd_write_rdwr_macaddr(struct ether_addr *mac)
return 0;
sprintf(buf, "%02X:%02X:%02X:%02X:%02X:%02X\n",
- mac->octet[0], mac->octet[1], mac->octet[2],
- mac->octet[3], mac->octet[4], mac->octet[5]);
+ mac->octet[0], mac->octet[1], mac->octet[2],
+ mac->octet[3], mac->octet[4], mac->octet[5]);
/* /data/.mac.info will be created */
fp_mac = filp_open(filepath_data, O_RDWR | O_CREAT, 0666);
@@ -203,7 +331,7 @@ int dhd_write_rdwr_macaddr(struct ether_addr *mac)
}
int dhd_check_rdwr_macaddr(struct dhd_info *dhd, dhd_pub_t *dhdp,
- struct ether_addr *mac)
+ struct ether_addr *mac)
{
struct file *fp_mac = NULL;
struct file *fp_nvm = NULL;
@@ -235,10 +363,10 @@ int dhd_check_rdwr_macaddr(struct dhd_info *dhd, dhd_pub_t *dhdp,
/* read MAC Address */
strcpy(cur_mac, "cur_etheraddr");
ret = dhd_wl_ioctl_cmd(dhdp, WLC_GET_VAR, cur_mac,
- sizeof(cur_mac), 0, 0);
+ sizeof(cur_mac), 0, 0);
if (ret < 0) {
DHD_ERROR(("Current READ MAC error \r\n"));
- memset(cur_mac , 0 , ETHER_ADDR_LEN);
+ memset(cur_mac, 0, ETHER_ADDR_LEN);
return -1;
} else {
DHD_ERROR(("MAC (OTP) : "
@@ -284,10 +412,10 @@ int dhd_check_rdwr_macaddr(struct dhd_info *dhd, dhd_pub_t *dhdp,
(unsigned int *)&(mac->octet[4]),
(unsigned int *)&(mac->octet[5]));
/* current MAC address is same as previous one */
- if(memcmp(cur_mac,mac->octet,ETHER_ADDR_LEN) == 0) {
+ if (memcmp(cur_mac, mac->octet, ETHER_ADDR_LEN) == 0) {
g_imac_flag = MACADDR_NONE;
} else { /* change MAC address */
- if (0 == _dhd_set_mac_address(dhd, 0, mac)) {
+ if (_dhd_set_mac_address(dhd, 0, mac) == 0) {
DHD_INFO(("%s: MACID is"
" overwritten\n", __FUNCTION__));
g_imac_flag = MACADDR_MOD;
@@ -333,10 +461,10 @@ int dhd_check_rdwr_macaddr(struct dhd_info *dhd, dhd_pub_t *dhdp,
(unsigned int *)&(mac->octet[4]),
(unsigned int *)&(mac->octet[5]));
/* current MAC address is same as previous one */
- if(memcmp(cur_mac,mac->octet,ETHER_ADDR_LEN) == 0) {
+ if (memcmp(cur_mac, mac->octet, ETHER_ADDR_LEN) == 0) {
g_imac_flag = MACADDR_NONE;
} else { /* change MAC address */
- if (0 == _dhd_set_mac_address(dhd, 0, mac)) {
+ if (_dhd_set_mac_address(dhd, 0, mac) == 0) {
DHD_INFO(("%s: MACID is"
" overwritten\n", __FUNCTION__));
g_imac_flag = MACADDR_MOD;
@@ -374,7 +502,7 @@ int dhd_check_rdwr_macaddr(struct dhd_info *dhd, dhd_pub_t *dhdp,
(unsigned int *)&(mac->octet[4]),
(unsigned int *)&(mac->octet[5]));
/* Writing Newly generated MAC ID to the Dongle */
- if (0 == _dhd_set_mac_address(dhd, 0, mac)) {
+ if (_dhd_set_mac_address(dhd, 0, mac) == 0) {
DHD_INFO(("%s: MACID is overwritten\n",
__FUNCTION__));
g_imac_flag = MACADDR_COB;
@@ -401,7 +529,7 @@ int dhd_check_rdwr_macaddr(struct dhd_info *dhd, dhd_pub_t *dhdp,
(unsigned int *)&(mac->octet[3]),
(unsigned int *)&(mac->octet[4]),
(unsigned int *)&(mac->octet[5]));
- if (0 == _dhd_set_mac_address(dhd, 0, mac)) {
+ if (_dhd_set_mac_address(dhd, 0, mac) == 0) {
DHD_INFO(("%s: MACID is overwritten\n", __FUNCTION__));
g_imac_flag = MACADDR_COB;
} else {
@@ -429,7 +557,7 @@ int dhd_write_rdwr_korics_macaddr(struct dhd_info *dhd, struct ether_addr *mac)
fp = filp_open(filepath_efs, O_RDONLY, 0);
if (IS_ERR(fp)) {
- /* File Doesn't Exist. Create and write mac addr.*/
+ /* File Doesn't Exist. Create and write mac addr. */
fp = filp_open(filepath_efs, O_RDWR | O_CREAT, 0666);
if (IS_ERR(fp)) {
DHD_ERROR(("[WIFI] %s: File open error\n",
@@ -446,15 +574,15 @@ int dhd_write_rdwr_korics_macaddr(struct dhd_info *dhd, struct ether_addr *mac)
get_random_bytes(randommac, 3);
sprintf(macbuffer, "%02X:%02X:%02X:%02X:%02X:%02X\n",
- 0x60, 0xd0, 0xa9, randommac[0],
- randommac[1], randommac[2]);
+ 0x60, 0xd0, 0xa9, randommac[0],
+ randommac[1], randommac[2]);
DHD_ERROR(("[WIFI] The Random Generated MAC ID : %s\n",
- macbuffer));
+ macbuffer));
if (fp->f_mode & FMODE_WRITE) {
ret = fp->f_op->write(fp,
(const char *)macbuffer,
- sizeof(macbuffer), &fp->f_pos);
+ sizeof(macbuffer), &fp->f_pos);
if (ret < 0)
DHD_ERROR(("[WIFI] Mac address [%s]"
" Failed to write into File:"
@@ -475,8 +603,9 @@ int dhd_write_rdwr_korics_macaddr(struct dhd_info *dhd, struct ether_addr *mac)
*/
buf[17] = '\0';
/* Remove security log */
- /*DHD_ERROR(("Read MAC : [%s] [%d] \r\n", buf,
- strncmp(buf, "00:00:00:00:00:00", 17)));*/
+ /* DHD_ERROR(("Read MAC : [%s] [%d] \r\n", buf,
+ * strncmp(buf, "00:00:00:00:00:00", 17)));
+ */
if ((buf[0] == '\0') ||
(strncmp(buf, "00:00:00:00:00:00", 17) == 0)) {
is_zeromac = 1;
@@ -500,7 +629,7 @@ int dhd_write_rdwr_korics_macaddr(struct dhd_info *dhd, struct ether_addr *mac)
if (!is_zeromac) {
/* Writing Newly generated MAC ID to the Dongle */
- if (0 == _dhd_set_mac_address(dhd, 0, mac))
+ if (_dhd_set_mac_address(dhd, 0, mac) == 0)
DHD_INFO(("dhd_bus_start: MACID is overwritten\n"));
else
DHD_ERROR(("dhd_bus_start: _dhd_set_mac_address() "
@@ -520,7 +649,7 @@ static int dhd_write_cid_file(const char *filepath_efs, const char *buf, int buf
mm_segment_t oldfs = {0};
int ret = 0;
- /* File is always created.*/
+ /* File is always created. */
fp = filp_open(filepath_efs, O_RDWR | O_CREAT, 0666);
if (IS_ERR(fp)) {
DHD_ERROR(("[WIFI] %s: File open error\n", filepath_efs));
@@ -584,7 +713,7 @@ int dhd_check_module_cid(dhd_pub_t *dhd)
strcpy(cis_buf, "cisdump");
ret = dhd_wl_ioctl_cmd(dhd, WLC_GET_VAR, cis_buf,
- sizeof(cis_buf), 0, 0);
+ sizeof(cis_buf), 0, 0);
if (ret < 0) {
DHD_TRACE(("%s: CIS reading failed, err=%d\n",
__FUNCTION__, ret));
@@ -592,29 +721,33 @@ int dhd_check_module_cid(dhd_pub_t *dhd)
} else {
#ifdef BCM4334_CHIP
unsigned char semco_id[4] = {0x00, 0x00, 0x33, 0x33};
- unsigned char semco_id_sh[4] = {0x00, 0x00, 0xFB, 0x50}; //for SHARP FEM(new)
+
+ /* for SHARP FEM(new) */
+ unsigned char semco_id_sh[4] = {0x00, 0x00, 0xFB, 0x50};
DHD_ERROR(("%s: CIS reading success, ret=%d\n",
__FUNCTION__, ret));
#ifdef DUMP_CIS
dump_cis(cis_buf, 48);
#endif
if (memcmp(&cis_buf[CIS_CID_OFFSET], semco_id, 4) == 0) {
- DHD_ERROR(("CID MATCH FOUND : Semco, 0x%02X 0x%02X \
- 0x%02X 0x%02X\n", cis_buf[CIS_CID_OFFSET],
- cis_buf[CIS_CID_OFFSET+1], cis_buf[CIS_CID_OFFSET+2],
- cis_buf[CIS_CID_OFFSET+3]));
+ DHD_ERROR(("CID MATCH FOUND : Semco, "
+ "0x%02X 0x%02X 0x%02X 0x%02X\n",
+ cis_buf[CIS_CID_OFFSET],
+ cis_buf[CIS_CID_OFFSET+1], cis_buf[CIS_CID_OFFSET+2],
+ cis_buf[CIS_CID_OFFSET+3]));
dhd_write_cid_file(cidfilepath, "semco", 5);
} else if (memcmp(&cis_buf[CIS_CID_OFFSET], semco_id_sh, 4) == 0) {
- DHD_ERROR(("CIS MATCH FOUND : Semco_sh, 0x%02X 0x%02X \
- 0x%02X 0x%02X\n", cis_buf[CIS_CID_OFFSET],
- cis_buf[CIS_CID_OFFSET+1], cis_buf[CIS_CID_OFFSET+2],
- cis_buf[CIS_CID_OFFSET+3]));
+ DHD_ERROR(("CIS MATCH FOUND : Semco_sh, "
+ "0x%02X 0x%02X 0x%02X 0x%02X\n",
+ cis_buf[CIS_CID_OFFSET],
+ cis_buf[CIS_CID_OFFSET+1], cis_buf[CIS_CID_OFFSET+2],
+ cis_buf[CIS_CID_OFFSET+3]));
dhd_write_cid_file(cidfilepath, "semcosh", 7);
} else {
- DHD_ERROR(("CID MATCH FOUND : Murata, 0x%02X 0x%02X \
- 0x%02X 0x%02X\n", cis_buf[CIS_CID_OFFSET],
- cis_buf[CIS_CID_OFFSET+1], cis_buf[CIS_CID_OFFSET+2],
- cis_buf[CIS_CID_OFFSET+3]));
+ DHD_ERROR(("CID MATCH FOUND : Murata, "
+ "0x%02X 0x%02X 0x%02X 0x%02X\n", cis_buf[CIS_CID_OFFSET],
+ cis_buf[CIS_CID_OFFSET+1], cis_buf[CIS_CID_OFFSET+2],
+ cis_buf[CIS_CID_OFFSET+3]));
dhd_write_cid_file(cidfilepath, "murata", 6);
}
@@ -628,7 +761,7 @@ int dhd_check_module_cid(dhd_pub_t *dhd)
strcpy(cis_buf, "otpdump");
ret = dhd_wl_ioctl_cmd(dhd, WLC_GET_VAR, cis_buf,
- sizeof(cis_buf), 0, 0);
+ sizeof(cis_buf), 0, 0);
if (ret < 0) {
DHD_ERROR(("%s: OTP reading failed, err=%d\n",
__FUNCTION__, ret));
@@ -638,7 +771,7 @@ int dhd_check_module_cid(dhd_pub_t *dhd)
/* otp 33th character is identifier for 4334B3 */
cis_buf[34] = '\0';
flag_b3 = bcm_atoi(&cis_buf[33]);
- if(flag_b3 & 0x1){
+ if (flag_b3 & 0x1) {
DHD_ERROR(("REV MATCH FOUND : 4334B3, %c\n", cis_buf[33]));
dhd_write_cid_file(revfilepath, "4334B3", 6);
}
@@ -682,7 +815,7 @@ static int dhd_write_mac_file(const char *filepath, const char *buf, int buf_len
int ret = 0;
fp = filp_open(filepath, O_RDWR | O_CREAT, 0666);
- /*File is always created.*/
+ /* File is always created. */
if (IS_ERR(fp)) {
DHD_ERROR(("[WIFI] File open error\n"));
return -1;
@@ -706,7 +839,7 @@ static int dhd_write_mac_file(const char *filepath, const char *buf, int buf_len
#define CIS_MAC_OFFSET 33
-int dhd_check_module_mac(dhd_pub_t *dhd)
+int dhd_check_module_mac(dhd_pub_t *dhd, struct ether_addr *mac)
{
int ret = -1;
unsigned char cis_buf[250] = {0};
@@ -728,7 +861,11 @@ int dhd_check_module_mac(dhd_pub_t *dhd)
if (ret < 0) {
DHD_TRACE(("%s: CIS reading failed, err=%d\n", __func__,
ret));
- return ret;
+ sprintf(otp_mac_buf, "%02X:%02X:%02X:%02X:%02X:%02X\n",
+ mac->octet[0], mac->octet[1], mac->octet[2],
+ mac->octet[3], mac->octet[4], mac->octet[5]);
+ DHD_ERROR(("%s: Check module mac by legacy FW : %02X:%02X:%02X\n",
+ __func__, mac->octet[0], mac->octet[4], mac->octet[5]));
} else {
unsigned char mac_id[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
#ifdef DUMP_CIS
@@ -751,8 +888,9 @@ int dhd_check_module_mac(dhd_pub_t *dhd)
if (!IS_ERR(fp_mac)) {
DHD_ERROR(("[WIFI]Check Mac address in .mac.info \n"));
kernel_read(fp_mac, fp_mac->f_pos, mac_buf, sizeof(mac_buf));
+ filp_close(fp_mac, NULL);
- if (strncmp(mac_buf , otp_mac_buf , 17) != 0) {
+ if (strncmp(mac_buf, otp_mac_buf, 17) != 0) {
DHD_ERROR(("[WIFI]file MAC is wrong. Write OTP MAC in .mac.info \n"));
dhd_write_mac_file(macfilepath, otp_mac_buf, sizeof(otp_mac_buf));
}
@@ -765,8 +903,8 @@ int dhd_check_module_mac(dhd_pub_t *dhd)
#ifdef WRITE_MACADDR
int dhd_write_macaddr(struct ether_addr *mac)
{
- char *filepath_data = MACINFO;
- char *filepath_efs = MACINFO_EFS;
+ char *filepath_data = MACINFO;
+ char *filepath_efs = MACINFO_EFS;
struct file *fp_mac = NULL;
char buf[18] = {0};
@@ -777,8 +915,8 @@ int dhd_write_macaddr(struct ether_addr *mac)
startwrite:
sprintf(buf, "%02X:%02X:%02X:%02X:%02X:%02X\n",
- mac->octet[0], mac->octet[1], mac->octet[2],
- mac->octet[3], mac->octet[4], mac->octet[5]);
+ mac->octet[0], mac->octet[1], mac->octet[2],
+ mac->octet[3], mac->octet[4], mac->octet[5]);
/* File will be created /data/.mac.info. */
fp_mac = filp_open(filepath_data, O_RDWR | O_CREAT, 0666);
@@ -894,8 +1032,13 @@ void sec_control_pm(dhd_pub_t *dhd, uint *power_mode)
set_fs(oldfs);
}
} else {
+ if (fp == NULL) {
+ DHD_ERROR(("[%s, %d] /data/.psm.info open failed\n",
+ __FUNCTION__, __LINE__));
+ return;
+ }
kernel_read(fp, fp->f_pos, &power_val, 1);
- DHD_ERROR(("POWER_VAL = %c \r\n" , power_val));
+ DHD_ERROR(("POWER_VAL = %c \r\n", power_val));
if (power_val == '0') {
#ifdef ROAM_ENABLE
@@ -907,14 +1050,14 @@ void sec_control_pm(dhd_pub_t *dhd, uint *power_mode)
sizeof(uint), TRUE, 0);
/* Turn off MPC in AP mode */
bcm_mkiovar("mpc", (char *)power_mode, 4,
- iovbuf, sizeof(iovbuf));
+ iovbuf, sizeof(iovbuf));
dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf,
sizeof(iovbuf), TRUE, 0);
g_pm_control = TRUE;
#ifdef ROAM_ENABLE
/* Roaming off of dongle */
bcm_mkiovar("roam_off", (char *)&roamvar, 4,
- iovbuf, sizeof(iovbuf));
+ iovbuf, sizeof(iovbuf));
dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf,
sizeof(iovbuf), TRUE, 0);
#endif
@@ -927,7 +1070,7 @@ void sec_control_pm(dhd_pub_t *dhd, uint *power_mode)
if (fp)
filp_close(fp, NULL);
}
-#endif
+#endif /* CONFIG_CONTROL_PM */
#ifdef GLOBALCONFIG_WLAN_COUNTRY_CODE
int dhd_customer_set_country(dhd_pub_t *dhd)
{
@@ -956,28 +1099,44 @@ int dhd_customer_set_country(dhd_pub_t *dhd)
country_code_size = country_offset;
if (country_offset != 0) {
strncpy(country_code, buffer, country_offset);
- strncpy(country_rev_buf, buffer+country_offset+1, strlen(buffer) - country_code_size + 1);
+ strncpy(country_rev_buf, buffer+country_offset+1,
+ strlen(buffer) - country_code_size + 1);
country_rev = bcm_atoi(country_rev_buf);
- buf_len = bcm_mkiovar("country", (char *)&cspec, sizeof(cspec), iovbuf, sizeof(iovbuf));
+ buf_len = bcm_mkiovar("country", (char *)&cspec,
+ sizeof(cspec), iovbuf, sizeof(iovbuf));
ret = dhd_wl_ioctl_cmd(dhd, WLC_GET_VAR, iovbuf, buf_len, FALSE, 0);
memcpy((void *)&cspec, iovbuf, sizeof(cspec));
if (!ret) {
- DHD_ERROR(("%s: get country ccode:%s country_abrev:%s rev:%d \n", __FUNCTION__, cspec.ccode, cspec.country_abbrev, cspec.rev));
- if ((strncmp(country_code, cspec.ccode, WLC_CNTRY_BUF_SZ) != 0) || (cspec.rev != country_rev)) {
- strncpy(cspec.country_abbrev, country_code, country_code_size);
- strncpy(cspec.ccode, country_code, country_code_size);
+ DHD_ERROR(("%s: get country ccode:%s"
+ " country_abrev:%s rev:%d \n",
+ __FUNCTION__, cspec.ccode,
+ cspec.country_abbrev, cspec.rev));
+ if ((strncmp(country_code, cspec.ccode,
+ WLC_CNTRY_BUF_SZ) != 0) ||
+ (cspec.rev != country_rev)) {
+ strncpy(cspec.country_abbrev,
+ country_code, country_code_size);
+ strncpy(cspec.ccode, country_code,
+ country_code_size);
cspec.rev = country_rev;
- DHD_ERROR(("%s: set country ccode:%s country_abrev:%s rev:%d \n", __FUNCTION__, cspec.ccode, cspec.country_abbrev, cspec.rev));
- buf_len = bcm_mkiovar("country", (char *)&cspec, sizeof(cspec), iovbuf, sizeof(iovbuf));
- ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, buf_len, TRUE, 0);
+ DHD_ERROR(("%s: set country ccode:%s"
+ "country_abrev:%s rev:%d\n",
+ __FUNCTION__, cspec.ccode,
+ cspec.country_abbrev, cspec.rev));
+ buf_len = bcm_mkiovar("country", (char *)&cspec,
+ sizeof(cspec), iovbuf, sizeof(iovbuf));
+ ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR,
+ iovbuf, buf_len, TRUE, 0);
}
}
} else {
- DHD_ERROR(("%s: set country %s failed code \n", __FUNCTION__, country_code));
+ DHD_ERROR(("%s: set country %s failed code \n",
+ __FUNCTION__, country_code));
ret = -1;
}
} else {
- DHD_ERROR(("%s: Reading from the '%s' returns 0 bytes \n", __FUNCTION__, filepath));
+ DHD_ERROR(("%s: Reading from the '%s' returns 0 bytes \n",
+ __FUNCTION__, filepath));
ret = -1;
}
}
@@ -986,4 +1145,61 @@ int dhd_customer_set_country(dhd_pub_t *dhd)
return ret;
}
-#endif
+#endif /* GLOBALCONFIG_WLAN_COUNTRY_CODE */
+
+#ifdef MIMO_ANT_SETTING
+int dhd_sel_ant_from_file(dhd_pub_t *dhd)
+{
+ struct file *fp = NULL;
+ int ret = -1;
+ uint32 ant_val = 0;
+ char *filepath = "/data/.ant.info";
+ char iovbuf[WLC_IOCTL_SMLEN];
+
+ /* Read antenna settings from the file */
+ fp = filp_open(filepath, O_RDONLY, 0);
+ if (IS_ERR(fp)) {
+ DHD_ERROR(("[WIFI] %s: File [%s] open error\n", __FUNCTION__, filepath));
+ return ret;
+ } else {
+ ret = kernel_read(fp, 0, (char *)&ant_val, 4);
+ if (ret < 0) {
+ DHD_ERROR(("[WIFI] %s: File read error, ret=%d\n", __FUNCTION__, ret));
+ filp_close(fp, NULL);
+ return ret;
+ }
+
+ ant_val = bcm_atoi((char *)&ant_val);
+
+ DHD_ERROR(("[WIFI] %s: ANT val = %d\n", __FUNCTION__, ant_val));
+ filp_close(fp, NULL);
+
+ /* Check value from the file */
+ if (ant_val < 1 || ant_val > 3) {
+ DHD_ERROR(("[WIFI] %s: Invalid value %d read from the file %s\n",
+ __FUNCTION__, ant_val, filepath));
+ return -1;
+ }
+ }
+
+ /* Select Antenna */
+ bcm_mkiovar("txchain", (char *)&ant_val, 4, iovbuf, sizeof(iovbuf));
+ ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
+ if (ret) {
+ DHD_ERROR(("[WIFI] %s: Fail to execute dhd_wl_ioctl_cmd(): txchain, ret=%d\n",
+ __FUNCTION__, ret));
+ return ret;
+ }
+
+ bcm_mkiovar("rxchain", (char *)&ant_val, 4, iovbuf, sizeof(iovbuf));
+ ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
+ if (ret) {
+ DHD_ERROR(("[WIFI] %s: Fail to execute dhd_wl_ioctl_cmd(): rxchain, ret=%d\n",
+ __FUNCTION__, ret));
+ return ret;
+ }
+
+ return 0;
+}
+#endif /* MIMO_ANTENNA_SETTING */
+#endif /* CUSTOMER_HW4 */
diff --git a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_dbg.h b/drivers/net/wireless/bcmdhd/dhd_dbg.h
index ac0713b..314f0ee 100644
--- a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_dbg.h
+++ b/drivers/net/wireless/bcmdhd/dhd_dbg.h
@@ -1,14 +1,14 @@
/*
* Debug/trace/assert driver definitions for Dongle Host Driver.
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,20 +16,27 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: dhd_dbg.h 303834 2011-12-20 06:17:39Z $
+ * $Id: dhd_dbg.h 353490 2012-08-27 21:10:02Z $
*/
#ifndef _dhd_dbg_
#define _dhd_dbg_
+#if !defined(CUSTOMER_HW4)
+#define USE_NET_RATELIMIT net_ratelimit()
+#else
+#define USE_NET_RATELIMIT 1
+#endif
+
#if defined(DHD_DEBUG)
-#define DHD_ERROR(args) do {if (dhd_msg_level & DHD_ERROR_VAL) printf args;} while (0)
+#define DHD_ERROR(args) do {if ((dhd_msg_level & DHD_ERROR_VAL) && USE_NET_RATELIMIT) \
+ printf args;} while (0)
#define DHD_TRACE(args) do {if (dhd_msg_level & DHD_TRACE_VAL) printf args;} while (0)
#define DHD_INFO(args) do {if (dhd_msg_level & DHD_INFO_VAL) printf args;} while (0)
#define DHD_DATA(args) do {if (dhd_msg_level & DHD_DATA_VAL) printf args;} while (0)
@@ -45,6 +52,12 @@
#define DHD_ARPOE(args) do {if (dhd_msg_level & DHD_ARPOE_VAL) printf args;} while (0)
#define DHD_REORDER(args) do {if (dhd_msg_level & DHD_REORDER_VAL) printf args;} while (0)
+#ifdef CUSTOMER_HW4
+#define DHD_TRACE_HW4 DHD_ERROR
+#else
+#define DHD_TRACE_HW4 DHD_TRACE
+#endif
+
#define DHD_ERROR_ON() (dhd_msg_level & DHD_ERROR_VAL)
#define DHD_TRACE_ON() (dhd_msg_level & DHD_TRACE_VAL)
#define DHD_INFO_ON() (dhd_msg_level & DHD_INFO_VAL)
@@ -63,7 +76,7 @@
#else /* defined(BCMDBG) || defined(DHD_DEBUG) */
-#define DHD_ERROR(args) do {if (net_ratelimit()) printf args;} while (0)
+#define DHD_ERROR(args) do {if (USE_NET_RATELIMIT) printf args;} while (0)
#define DHD_TRACE(args)
#define DHD_INFO(args)
#define DHD_DATA(args)
@@ -79,6 +92,12 @@
#define DHD_ARPOE(args)
#define DHD_REORDER(args)
+#ifdef CUSTOMER_HW4
+#define DHD_TRACE_HW4 DHD_ERROR
+#else
+#define DHD_TRACE_HW4 DHD_TRACE
+#endif
+
#define DHD_ERROR_ON() 0
#define DHD_TRACE_ON() 0
#define DHD_INFO_ON() 0
@@ -94,7 +113,7 @@
#define DHD_ISCAN_ON() 0
#define DHD_ARPOE_ON() 0
#define DHD_REORDER_ON() 0
-#endif
+#endif
#define DHD_LOG(args)
diff --git a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_linux.c b/drivers/net/wireless/bcmdhd/dhd_linux.c
index da72c75..ea31b93 100644
--- a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_linux.c
+++ b/drivers/net/wireless/bcmdhd/dhd_linux.c
@@ -3,13 +3,13 @@
* Basically selected code segments from usb-cdc.c and usb-rndis.c
*
* Copyright (C) 1999-2012, Broadcom Corporation
- *
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -17,12 +17,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: dhd_linux.c 309571 2012-01-20 01:45:10Z $
+ * $Id: dhd_linux.c 358099 2012-09-21 04:38:52Z $
*/
#include <typedefs.h>
@@ -49,6 +49,7 @@
#include <epivers.h>
#include <bcmutils.h>
#include <bcmendian.h>
+#include <bcmdevs.h>
#include <proto/ethernet.h>
#include <dngl_stats.h>
@@ -77,7 +78,6 @@
#define HTSF_BUS_DELAY 150 /* assume a fix propagation in us */
#define TSMAX 1000 /* max no. of timing record kept */
#define NUMBIN 34
-
static uint32 tsidx = 0;
static uint32 htsf_seqnum = 0;
uint32 tsfsync;
@@ -95,6 +95,21 @@ typedef struct histo_ {
static histo_t vi_d1, vi_d2, vi_d3, vi_d4;
#endif /* WLMEDIA_HTSF */
+#ifndef DTIM_COUNT
+#define DTIM_COUNT 3
+#endif
+
+#if defined(PKT_FILTER_SUPPORT)
+#if defined(BLOCK_IPV6_PACKET)
+#define HEX_PREF_STR "0x"
+#define UNI_FILTER_STR "010000000000"
+#define ZERO_ADDR_STR "000000000000"
+#define ETHER_TYPE_STR "0000"
+#define IPV6_FILTER_STR "20"
+#define ZERO_TYPE_STR "00"
+#endif /* BLOCK_IPV6_PACKET */
+#endif /* PKT_FILTER_SUPPORT */
+
#if defined(SOFTAP)
extern bool ap_cfg_running;
extern bool ap_fw_loaded;
@@ -134,6 +149,9 @@ DECLARE_WAIT_QUEUE_HEAD(dhd_dpc_wait);
#if defined(OOB_INTR_ONLY)
extern void dhd_enable_oob_intr(struct dhd_bus *bus, bool enable);
#endif /* defined(OOB_INTR_ONLY) */
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && (1)
+static void dhd_hang_process(struct work_struct *work);
+#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0))
MODULE_LICENSE("GPL v2");
#endif /* LinuxVer */
@@ -164,18 +182,27 @@ print_tainted()
extern wl_iw_extra_params_t g_wl_iw_params;
#endif /* defined(CONFIG_WIRELESS_EXT) */
-#if defined(CONFIG_HAS_EARLYSUSPEND)
+#if defined(CUSTOMER_HW4) && defined(CONFIG_PARTIALSUSPEND_SLP)
+#include <linux/partialsuspend_slp.h>
+#define CONFIG_HAS_EARLYSUSPEND
+#define DHD_USE_EARLYSUSPEND
+#define register_early_suspend register_pre_suspend
+#define unregister_early_suspend unregister_pre_suspend
+#define early_suspend pre_suspend
+#define EARLY_SUSPEND_LEVEL_BLANK_SCREEN 50
+#else
+#if defined(CONFIG_HAS_EARLYSUSPEND) && defined(DHD_USE_EARLYSUSPEND)
#include <linux/earlysuspend.h>
-extern int dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len);
+#endif /* defined(CONFIG_HAS_EARLYSUSPEND) && defined(DHD_USE_EARLYSUSPEND) */
+#endif /* CUSTOMER_HW4 && CONFIG_PARTIALSUSPEND_SLP */
+
extern int dhd_get_dtim_skip(dhd_pub_t *dhd);
-#endif /* defined(CONFIG_HAS_EARLYSUSPEND) */
#ifdef PKT_FILTER_SUPPORT
extern void dhd_pktfilter_offload_set(dhd_pub_t * dhd, char *arg);
extern void dhd_pktfilter_offload_enable(dhd_pub_t * dhd, char *arg, int enable, int master_mode);
#endif
-#ifdef CUSTOMER_HW_SAMSUNG
#ifdef READ_MACADDR
extern int dhd_read_macaddr(struct dhd_info *dhd, struct ether_addr *mac);
#endif
@@ -190,9 +217,11 @@ extern int dhd_write_macaddr(struct ether_addr *mac);
extern int dhd_check_module_cid(dhd_pub_t *dhd);
#endif
#ifdef GET_MAC_FROM_OTP
-extern int dhd_check_module_mac(dhd_pub_t *dhd);
+extern int dhd_check_module_mac(dhd_pub_t *dhd, struct ether_addr *mac);
+#endif
+#ifdef MIMO_ANT_SETTING
+extern int dhd_sel_ant_from_file(dhd_pub_t *dhd);
#endif
-#endif /* CUSTOMER_HW_SAMSUNG */
#ifdef GLOBALCONFIG_WLAN_COUNTRY_CODE
int dhd_customer_set_country(dhd_pub_t *dhd);
@@ -204,9 +233,9 @@ typedef struct dhd_if {
/* OS/stack specifics */
struct net_device *net;
struct net_device_stats stats;
- int idx; /* iface idx in dongle */
+ int idx; /* iface idx in dongle */
dhd_if_state_t state; /* interface state */
- uint subunit; /* subunit */
+ uint subunit; /* subunit */
uint8 mac_addr[ETHER_ADDR_LEN]; /* assigned MAC address */
bool attached; /* Delayed attachment when unset */
bool txflowcontrol; /* Per interface flow control indicator */
@@ -244,20 +273,11 @@ static uint32 maxdelay = 0, tspktcnt = 0, maxdelaypktno = 0;
#endif /* WLMEDIA_HTSF */
-#if defined(CONFIG_PM_SLEEP) && defined(CUSTOMER_HW_SLP)
-/*SLP_wakelock_alternative_code*/
+#if defined(CUSTOMER_HW4) && defined(CONFIG_PM_SLEEP) && defined(PLATFORM_SLP)
+/* SLP_wakelock_alternative_code */
extern struct device *pm_dev;
-#endif /* CONFIG_PM_SLEEP && CUSTOMER_HW_SLP */
-#if defined(PKT_FILTER_SUPPORT)
-#if defined(CUSTOMER_HW_SAMSUNG)
-#define HEX_PREF_STR "0x"
-#define UNI_FILTER_STR "010000000000"
-#define ZERO_ADDR_STR "000000000000"
-#define ETHER_TYPE_STR "0000"
-#define IPV6_FILTER_STR "20"
-#define ZERO_TYPE_STR "00"
-#endif /* CUSTOMER_HW_SAMSUNG */
-#endif /* PKT_FILTER_SUPPORT */
+#endif /* CUSTOMER_HW4 && CONFIG_PM_SLEEP && PLATFORM_SLP */
+
/* Local private structure (extension of pub) */
typedef struct dhd_info {
#if defined(CONFIG_WIRELESS_EXT)
@@ -290,16 +310,18 @@ typedef struct dhd_info {
tsk_ctl_t thr_dpc_ctl;
tsk_ctl_t thr_wdt_ctl;
-
-#else
- bool dhd_tasklet_create;
#endif /* DHDTHREAD */
+ bool dhd_tasklet_create;
tsk_ctl_t thr_sysioc_ctl;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
+ struct work_struct work_hang;
+#endif
/* Wakelocks */
#if defined(CONFIG_HAS_WAKELOCK) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
struct wake_lock wl_wifi; /* Wifi wakelock */
struct wake_lock wl_rxwake; /* Wifi rx wakelock */
+ struct wake_lock wl_ctrlwake; /* Wifi ctrl wakelock */
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) && 1
@@ -307,10 +329,12 @@ typedef struct dhd_info {
* calls and wifi_on or wifi_off
*/
struct mutex dhd_net_if_mutex;
+ struct mutex dhd_suspend_mutex;
#endif
spinlock_t wakelock_spinlock;
int wakelock_counter;
- int wakelock_timeout_enable;
+ int wakelock_rx_timeout_enable;
+ int wakelock_ctrl_timeout_enable;
/* Thread to issue ioctl for multicast */
unsigned char set_macaddress;
@@ -319,9 +343,9 @@ typedef struct dhd_info {
atomic_t pend_8021x_cnt;
dhd_attach_states_t dhd_state;
-#ifdef CONFIG_HAS_EARLYSUSPEND
+#if defined(CONFIG_HAS_EARLYSUSPEND) && defined(DHD_USE_EARLYSUSPEND)
struct early_suspend early_suspend;
-#endif /* CONFIG_HAS_EARLYSUSPEND */
+#endif /* CONFIG_HAS_EARLYSUSPEND && defined(DHD_USE_EARLYSUSPEND) */
#ifdef ARP_OFFLOAD_SUPPORT
u32 pend_ipaddr;
@@ -331,20 +355,27 @@ typedef struct dhd_info {
void *rpc_osh;
struct timer_list rpcth_timer;
bool rpcth_timer_active;
+ bool fdaggr;
#endif
} dhd_info_t;
+/* Flag to indicate if we should download firmware on driver load */
+uint dhd_download_fw_on_driverload = TRUE;
+
/* Definitions to provide path to the firmware and nvram
* example nvram_path[MOD_PARAM_PATHLEN]="/projects/wlan/nvram.txt"
*/
char firmware_path[MOD_PARAM_PATHLEN];
char nvram_path[MOD_PARAM_PATHLEN];
+/* information string to keep firmware, chio, cheip version info visiable from log */
+char info_string[MOD_PARAM_INFOLEN];
+module_param_string(info_string, info_string, MOD_PARAM_INFOLEN, 0444);
+
int op_mode = 0;
int disable_proptx = 0;
module_param(op_mode, int, 0644);
extern int wl_control_wl_start(struct net_device *dev);
-extern int net_os_send_hang_message(struct net_device *dev);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
struct semaphore dhd_registration_sem;
struct semaphore dhd_chipup_sem;
@@ -359,11 +390,12 @@ module_param(dhd_sysioc, uint, 0);
/* Error bits */
module_param(dhd_msg_level, int, 0);
-module_param(disable_proptx, int, 0);
+/* Disable Prop tx */
+module_param(disable_proptx, int, 0644);
/* load firmware and/or nvram values from the filesystem */
module_param_string(firmware_path, firmware_path, MOD_PARAM_PATHLEN, 0660);
-module_param_string(nvram_path, nvram_path, MOD_PARAM_PATHLEN, 0);
+module_param_string(nvram_path, nvram_path, MOD_PARAM_PATHLEN, 0660);
/* Watchdog interval */
uint dhd_watchdog_ms = 10;
@@ -379,18 +411,20 @@ uint dhd_slpauto = TRUE;
module_param(dhd_slpauto, uint, 0);
/* ARP offload agent mode : Enable ARP Host Auto-Reply and ARP Peer Auto-Reply */
-uint dhd_arp_mode = 0xb;
+uint dhd_arp_mode = ARP_OL_AGENT | ARP_OL_PEER_AUTO_REPLY | ARP_OL_SNOOP;
module_param(dhd_arp_mode, uint, 0);
/* ARP offload enable */
uint dhd_arp_enable = TRUE;
module_param(dhd_arp_enable, uint, 0);
+#ifdef PKT_FILTER_SUPPORT
/* Global Pkt filter enable control */
uint dhd_pkt_filter_enable = TRUE;
module_param(dhd_pkt_filter_enable, uint, 0);
+#endif
-/* Pkt filter init setup */
+/* Pkt filter init setup */
uint dhd_pkt_filter_init = 0;
module_param(dhd_pkt_filter_init, uint, 0);
@@ -400,15 +434,14 @@ uint dhd_master_mode = FALSE;
#else
uint dhd_master_mode = TRUE;
#endif /* GAL_LITE_NAT_KEEPALIVE_FILTER */
-module_param(dhd_master_mode, uint, 1);
+module_param(dhd_master_mode, uint, 0);
#ifdef DHDTHREAD
-/* Watchdog thread priority, -1 to use kernel timer */
-int dhd_watchdog_prio = 97;
+int dhd_watchdog_prio = 0;
module_param(dhd_watchdog_prio, int, 0);
-/* DPC thread priority, -1 to use tasklet */
-int dhd_dpc_prio = 98;
+/* DPC thread priority */
+int dhd_dpc_prio = CUSTOM_DPC_PRIO_SETTING;
module_param(dhd_dpc_prio, int, 0);
/* DPC thread priority, -1 to use tasklet */
@@ -416,7 +449,11 @@ extern int dhd_dongle_memsize;
module_param(dhd_dongle_memsize, int, 0);
#endif /* DHDTHREAD */
/* Control fw roaming */
+#ifdef BCMCCX
+uint dhd_roam_disable = 0;
+#else
uint dhd_roam_disable = 0;
+#endif /* BCMCCX */
/* Control radio state */
uint dhd_radio_up = 1;
@@ -425,25 +462,6 @@ uint dhd_radio_up = 1;
char iface_name[IFNAMSIZ] = {'\0'};
module_param_string(iface_name, iface_name, IFNAMSIZ, 0);
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0))
-#define DAEMONIZE(a) daemonize(a); \
- allow_signal(SIGKILL); \
- allow_signal(SIGTERM);
-#else /* Linux 2.4 (w/o preemption patch) */
-#define RAISE_RX_SOFTIRQ() \
- cpu_raise_softirq(smp_processor_id(), NET_RX_SOFTIRQ)
-#define DAEMONIZE(a) daemonize(); \
- do { if (a) \
- strncpy(current->comm, a, MIN(sizeof(current->comm), (strlen(a) + 1))); \
- } while (0);
-#endif /* LINUX_VERSION_CODE */
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0))
-#define BLOCKABLE() (!in_atomic())
-#else
-#define BLOCKABLE() (!in_interrupt())
-#endif
-
/* The following are specific to the SDIO dongle */
/* IOCTL response timeout */
@@ -454,11 +472,7 @@ int dhd_idletime = DHD_IDLETIME_TICKS;
module_param(dhd_idletime, int, 0);
/* Use polling */
-#ifdef CONFIG_MACH_MIDAS_02_BD
-uint dhd_poll = TRUE;
-#else
uint dhd_poll = FALSE;
-#endif
module_param(dhd_poll, uint, 0);
/* Use interrupts */
@@ -484,6 +498,8 @@ extern void dhd_dbg_init(dhd_pub_t *dhdp);
extern void dhd_dbg_remove(void);
#endif /* BCMDBGFS */
+
+
#ifdef SDTEST
/* Echo packet generator (pkts/s) */
uint dhd_pktgen = 0;
@@ -511,6 +527,8 @@ static char dhd_version[] = "Dongle Host Driver, version " EPI_VERSION_STR
;
static void dhd_net_if_lock_local(dhd_info_t *dhd);
static void dhd_net_if_unlock_local(dhd_info_t *dhd);
+static void dhd_suspend_lock(dhd_pub_t *dhdp);
+static void dhd_suspend_unlock(dhd_pub_t *dhdp);
#ifdef WLMEDIA_HTSF
void htsf_update(dhd_info_t *dhd, void *data);
@@ -533,6 +551,7 @@ bool g_pm_control;
void sec_control_pm(dhd_pub_t *dhd, uint *);
#endif
+
#if defined(CONFIG_WIRELESS_EXT)
struct iw_statistics *dhd_get_wireless_stats(struct net_device *dev);
#endif /* defined(CONFIG_WIRELESS_EXT) */
@@ -556,7 +575,8 @@ static int dhd_wl_host_event(dhd_info_t *dhd, int *ifidx, void *pktdata,
static int dhd_sleep_pm_callback(struct notifier_block *nfb, unsigned long action, void *ignored)
{
int ret = NOTIFY_DONE;
-#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 39)) || defined(BCMHOST)
+
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 39))
switch (action) {
case PM_HIBERNATION_PREPARE:
case PM_SUSPEND_PREPARE:
@@ -576,190 +596,206 @@ static int dhd_sleep_pm_callback(struct notifier_block *nfb, unsigned long actio
static struct notifier_block dhd_sleep_pm_notifier = {
.notifier_call = dhd_sleep_pm_callback,
- .priority = 0
+ .priority = 10
};
extern int register_pm_notifier(struct notifier_block *nb);
extern int unregister_pm_notifier(struct notifier_block *nb);
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP) */
-static void dhd_set_packet_filter(int value, dhd_pub_t *dhd)
-{
#ifdef PKT_FILTER_SUPPORT
- DHD_TRACE(("%s: %d\n", __FUNCTION__, value));
- /* 1 - Enable packet filter, only allow unicast packet to send up */
- /* 0 - Disable packet filter */
- if (dhd_pkt_filter_enable && !dhd->dhcp_in_progress) {
- int i;
-#ifdef PASS_ALL_MCAST_PKTS
- char iovbuf[20];
- uint32 allmultivar = !value;
-#endif /* PASS_ALL_MCAST_PKTS */
+void dhd_set_packet_filter(dhd_pub_t *dhd)
+{
+ int i;
+ DHD_TRACE(("%s: enter\n", __FUNCTION__));
+ if (dhd_pkt_filter_enable) {
for (i = 0; i < dhd->pktfilter_count; i++) {
dhd_pktfilter_offload_set(dhd, dhd->pktfilter[i]);
+ }
+ }
+}
+
+void dhd_enable_packet_filter(int value, dhd_pub_t *dhd)
+{
+ int i;
+
+ DHD_TRACE(("%s: enter, value = %d\n", __FUNCTION__, value));
+ /* 1 - Enable packet filter, only allow unicast packet to send up */
+ /* 0 - Disable packet filter */
+ if (dhd_pkt_filter_enable) {
+ for (i = 0; i < dhd->pktfilter_count; i++) {
+#ifdef PASS_ARP_PACKET
+ if (value && (i == dhd->pktfilter_count -1) &&
+ !(dhd->op_mode & (P2P_GC_ENABLED | P2P_GO_ENABLED))) {
+ DHD_TRACE_HW4(("Do not turn on ARP white list pkt filter:"
+ "val %d, cnt %d, op_mode 0x%x\n",
+ value, i, dhd->op_mode));
+ continue;
+ }
+#endif
dhd_pktfilter_offload_enable(dhd, dhd->pktfilter[i],
value, dhd_master_mode);
}
-#ifdef PASS_ALL_MCAST_PKTS
- bcm_mkiovar("allmulti", (char *)&allmultivar, 4, iovbuf, sizeof(iovbuf));
- dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
-#endif /* PASS_ALL_MCAST_PKTS */
}
-#endif /* PKT_FILTER_SUPPORT */
}
+#endif /* PKT_FILTER_SUPPORT */
-#if defined(CONFIG_HAS_EARLYSUSPEND)
static int dhd_set_suspend(int value, dhd_pub_t *dhd)
{
- char iovbuf[32];
-#ifndef CUSTOMER_HW_SAMSUNG
+#ifndef SUPPORT_PM2_ONLY
int power_mode = PM_MAX;
+#endif
/* wl_pkt_filter_enable_t enable_parm; */
- int bcn_li_dtim = 3;
+ char iovbuf[32];
+#if !defined(CUSTOMER_HW4)
+ int bcn_li_dtim = DTIM_COUNT;
+#endif
+#ifndef DISABLE_FW_ROAM_SUSPEND
uint roamvar = 1;
#endif
-#ifdef BCM4334_CHIP
+#ifdef ENABLE_BCN_LI_BCN_WAKEUP
int bcn_li_bcn;
-#endif
+#endif /* ENABLE_BCN_LI_BCN_WAKEUP */
#ifdef PASS_ALL_MCAST_PKTS
uint32 allmulti;
#endif /* PASS_ALL_MCAST_PKTS */
- DHD_ERROR(("%s: enter, value = %d in_suspend=%d\n",
+ DHD_TRACE(("%s: enter, value = %d in_suspend=%d\n",
__FUNCTION__, value, dhd->in_suspend));
+ dhd_suspend_lock(dhd);
if (dhd && dhd->up) {
if (value && dhd->in_suspend) {
- if (wl_cfgp2p_p2p_listen_suspend())
- DHD_ERROR(("failed to set WLC_E_P2P_PROBREQ_MSG\n"));
#ifdef PKT_FILTER_SUPPORT
- dhd->early_suspended = 1;
+ dhd->early_suspended = 1;
#endif
+ /* Kernel suspended */
+ DHD_ERROR(("%s: force extra Suspend setting \n", __FUNCTION__));
- /* Kernel suspended */
- DHD_ERROR(("%s: force extra Suspend setting \n", __FUNCTION__));
-
-#ifndef CUSTOMER_HW_SAMSUNG
- dhd_wl_ioctl_cmd(dhd, WLC_SET_PM, (char *)&power_mode,
- sizeof(power_mode), TRUE, 0);
+#ifndef SUPPORT_PM2_ONLY
+ dhd_wl_ioctl_cmd(dhd, WLC_SET_PM, (char *)&power_mode,
+ sizeof(power_mode), TRUE, 0);
#endif
-
- /* Enable packet filter, only allow unicast packet to send up */
- if (dhd_pkt_filter_enable && !dhd->dhcp_in_progress) {
- int i;
- for (i = 0; i < dhd->pktfilter_count; i++)
- dhd_pktfilter_offload_enable(dhd, dhd->pktfilter[i],
- 1, dhd_master_mode);
- }
+#ifdef PKT_FILTER_SUPPORT
+ /* Enable packet filter, only allow unicast packet to send up */
+ if (!dhd->dhcp_in_progress)
+ dhd_enable_packet_filter(1, dhd);
+#endif /* PKT_FILTER_SUPPORT */
#ifdef PASS_ALL_MCAST_PKTS
- allmulti = 0;
- bcm_mkiovar("allmulti", (char *)&allmulti, 4, iovbuf, sizeof(iovbuf));
- dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
+ allmulti = 0;
+ bcm_mkiovar("allmulti", (char *)&allmulti,
+ 4, iovbuf, sizeof(iovbuf));
+ dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
#endif /* PASS_ALL_MCAST_PKTS */
-#ifndef CUSTOMER_HW_SAMSUNG
- /* If DTIM skip is set up as default, force it to wake
- * each third DTIM for better power savings. Note that
- * one side effect is a chance to miss BC/MC packet.
- */
- bcn_li_dtim = dhd_get_dtim_skip(dhd);
- bcm_mkiovar("bcn_li_dtim", (char *)&bcn_li_dtim,
- 4, iovbuf, sizeof(iovbuf));
- dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
-
- /* Disable firmware roaming during suspend */
- bcm_mkiovar("roam_off", (char *)&roamvar, 4,
- iovbuf, sizeof(iovbuf));
- dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
-#endif
-#ifdef BCM4334_CHIP
- bcn_li_bcn = 0;
- bcm_mkiovar("bcn_li_bcn", (char *)&bcn_li_bcn,
- 4, iovbuf, sizeof(iovbuf));
- dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
-#endif
- } else {
+#if !defined(CUSTOMER_HW4)
+ /* If DTIM skip is set up as default, force it to wake
+ * each third DTIM for better power savings. Note that
+ * one side effect is a chance to miss BC/MC packet.
+ */
+ bcn_li_dtim = dhd_get_dtim_skip(dhd);
+ bcm_mkiovar("bcn_li_dtim", (char *)&bcn_li_dtim,
+ 4, iovbuf, sizeof(iovbuf));
+ dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
+#endif /* !defined(CUSTOMER_HW4) */
+#ifndef DISABLE_FW_ROAM_SUSPEND
+ /* Disable firmware roaming during suspend */
+ bcm_mkiovar("roam_off", (char *)&roamvar, 4,
+ iovbuf, sizeof(iovbuf));
+ dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
+#endif
+#ifdef ENABLE_BCN_LI_BCN_WAKEUP
+ bcn_li_bcn = 0;
+ bcm_mkiovar("bcn_li_bcn", (char *)&bcn_li_bcn,
+ 4, iovbuf, sizeof(iovbuf));
+ dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
+#endif /* ENABLE_BCN_LI_BCN_WAKEUP */
+ } else {
#ifdef PKT_FILTER_SUPPORT
- dhd->early_suspended = 0;
+ dhd->early_suspended = 0;
#endif
+ /* Kernel resumed */
+ DHD_TRACE(("%s: Remove extra suspend setting \n", __FUNCTION__));
- /* Kernel resumed */
- DHD_ERROR(("%s: Remove extra suspend setting \n", __FUNCTION__));
-
-#ifndef CUSTOMER_HW_SAMSUNG
- power_mode = PM_FAST;
- dhd_wl_ioctl_cmd(dhd, WLC_SET_PM, (char *)&power_mode,
- sizeof(power_mode), TRUE, 0);
+#ifndef SUPPORT_PM2_ONLY
+ power_mode = PM_FAST;
+ dhd_wl_ioctl_cmd(dhd, WLC_SET_PM, (char *)&power_mode,
+ sizeof(power_mode), TRUE, 0);
#endif
-
- /* disable pkt filter */
- if (dhd_pkt_filter_enable && !dhd->dhcp_in_progress) {
- int i;
- for (i = 0; i < dhd->pktfilter_count; i++)
- dhd_pktfilter_offload_enable(dhd, dhd->pktfilter[i],
- 0, dhd_master_mode);
- }
+#ifdef PKT_FILTER_SUPPORT
+ /* disable pkt filter */
+ dhd_enable_packet_filter(0, dhd);
+#endif /* PKT_FILTER_SUPPORT */
#ifdef PASS_ALL_MCAST_PKTS
- allmulti = 1;
- bcm_mkiovar("allmulti", (char *)&allmulti, 4, iovbuf, sizeof(iovbuf));
- dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
+ allmulti = 1;
+ bcm_mkiovar("allmulti", (char *)&allmulti,
+ 4, iovbuf, sizeof(iovbuf));
+ dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
#endif /* PASS_ALL_MCAST_PKTS */
-#ifndef CUSTOMER_HW_SAMSUNG
- /* restore pre-suspend setting for dtim_skip */
- bcm_mkiovar("bcn_li_dtim", (char *)&dhd->dtim_skip,
- 4, iovbuf, sizeof(iovbuf));
+#if !defined(CUSTOMER_HW4)
+ /* restore pre-suspend setting for dtim_skip */
+ bcm_mkiovar("bcn_li_dtim", (char *)&dhd->dtim_skip,
+ 4, iovbuf, sizeof(iovbuf));
- dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
-
- roamvar = dhd_roam_disable;
- bcm_mkiovar("roam_off", (char *)&roamvar, 4, iovbuf,
- sizeof(iovbuf));
- dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
+ dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
#endif
-#ifdef BCM4334_CHIP
- bcn_li_bcn = 1;
- bcm_mkiovar("bcn_li_bcn", (char *)&bcn_li_bcn,
- 4, iovbuf, sizeof(iovbuf));
- dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
+#ifndef DISABLE_FW_ROAM_SUSPEND
+ roamvar = dhd_roam_disable;
+ bcm_mkiovar("roam_off", (char *)&roamvar, 4, iovbuf,
+ sizeof(iovbuf));
+ dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
#endif
- }
+#ifdef ENABLE_BCN_LI_BCN_WAKEUP
+ bcn_li_bcn = 1;
+ bcm_mkiovar("bcn_li_bcn", (char *)&bcn_li_bcn,
+ 4, iovbuf, sizeof(iovbuf));
+ dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
+#endif /* ENABLE_BCN_LI_BCN_WAKEUP */
+
+ }
}
+ dhd_suspend_unlock(dhd);
return 0;
}
-static void dhd_suspend_resume_helper(struct dhd_info *dhd, int val)
+static int dhd_suspend_resume_helper(struct dhd_info *dhd, int val, int force)
{
dhd_pub_t *dhdp = &dhd->pub;
+ int ret = 0;
DHD_OS_WAKE_LOCK(dhdp);
/* Set flag when early suspend was called */
dhdp->in_suspend = val;
- if ((!dhdp->suspend_disable_flag) && (dhd_check_ap_wfd_mode_set(dhdp) == FALSE))
- dhd_set_suspend(val, dhdp);
+ if ((force || !dhdp->suspend_disable_flag) &&
+ (dhd_check_ap_wfd_mode_set(dhdp) == FALSE))
+ {
+ ret = dhd_set_suspend(val, dhdp);
+ }
+
DHD_OS_WAKE_UNLOCK(dhdp);
+ return ret;
}
+#if defined(CONFIG_HAS_EARLYSUSPEND) && defined(DHD_USE_EARLYSUSPEND)
static void dhd_early_suspend(struct early_suspend *h)
{
struct dhd_info *dhd = container_of(h, struct dhd_info, early_suspend);
-
- DHD_ERROR(("%s: enter\n", __FUNCTION__));
+ DHD_TRACE_HW4(("%s: enter\n", __FUNCTION__));
if (dhd)
- dhd_suspend_resume_helper(dhd, 1);
+ dhd_suspend_resume_helper(dhd, 1, 0);
}
static void dhd_late_resume(struct early_suspend *h)
{
struct dhd_info *dhd = container_of(h, struct dhd_info, early_suspend);
-
- DHD_ERROR(("%s: enter\n", __FUNCTION__));
+ DHD_TRACE_HW4(("%s: enter\n", __FUNCTION__));
if (dhd)
- dhd_suspend_resume_helper(dhd, 0);
+ dhd_suspend_resume_helper(dhd, 0, 0);
}
#endif /* defined(CONFIG_HAS_EARLYSUSPEND) */
@@ -781,7 +817,7 @@ dhd_timeout_start(dhd_timeout_t *tmo, uint usec)
tmo->limit = usec;
tmo->increment = 0;
tmo->elapsed = 0;
- tmo->tick = 1000000 / HZ;
+ tmo->tick = jiffies_to_usecs(1);
}
int
@@ -807,16 +843,12 @@ dhd_timeout_expired(dhd_timeout_t *tmo)
} else {
wait_queue_head_t delay_wait;
DECLARE_WAITQUEUE(wait, current);
- int pending;
init_waitqueue_head(&delay_wait);
add_wait_queue(&delay_wait, &wait);
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(1);
- pending = signal_pending(current);
remove_wait_queue(&delay_wait, &wait);
set_current_state(TASK_RUNNING);
- if (pending)
- return 1; /* Interrupted */
}
return 0;
@@ -933,32 +965,32 @@ _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx)
if (dhd->iflist[i]) {
dev = dhd->iflist[i]->net;
#else
- ASSERT(dhd && dhd->iflist[ifidx]);
- dev = dhd->iflist[ifidx]->net;
+ ASSERT(dhd && dhd->iflist[ifidx]);
+ dev = dhd->iflist[ifidx]->net;
#endif /* MCAST_LIST_ACCUMULATION */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
- netif_addr_lock_bh(dev);
+ netif_addr_lock_bh(dev);
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)
#ifdef MCAST_LIST_ACCUMULATION
cnt_iface[i] = netdev_mc_count(dev);
cnt += cnt_iface[i];
#else
- cnt = netdev_mc_count(dev);
+ cnt = netdev_mc_count(dev);
#endif /* MCAST_LIST_ACCUMULATION */
#else
#ifdef MCAST_LIST_ACCUMULATION
cnt += dev->mc_count;
#else
- cnt = dev->mc_count;
+ cnt = dev->mc_count;
#endif /* MCAST_LIST_ACCUMULATION */
#endif /* LINUX_VERSION_CODE */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
- netif_addr_unlock_bh(dev);
+ netif_addr_unlock_bh(dev);
#endif
- /* Determine initial value of allmulti flag */
+ /* Determine initial value of allmulti flag */
#ifdef MCAST_LIST_ACCUMULATION
allmulti |= (dev->flags & IFF_ALLMULTI) ? TRUE : FALSE;
}
@@ -970,8 +1002,8 @@ _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx)
#ifdef PASS_ALL_MCAST_PKTS
#ifdef PKT_FILTER_SUPPORT
if (!dhd->pub.early_suspended)
- allmulti = TRUE;
-#endif
+#endif /* PKT_FILTER_SUPPORT */
+ allmulti = TRUE;
#endif /* PASS_ALL_MCAST_PKTS */
/* Send down the multicast list first. */
@@ -984,7 +1016,8 @@ _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx)
return;
}
- strcpy(bufp, "mcast_list");
+ strncpy(bufp, "mcast_list", buflen - 1);
+ bufp[buflen - 1] = '\0';
bufp += strlen("mcast_list") + 1;
cnt = htol32(cnt);
@@ -994,49 +1027,48 @@ _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx)
#ifdef MCAST_LIST_ACCUMULATION
for (i = 0; i < DHD_MAX_IFS; i++) {
if (dhd->iflist[i]) {
- DHD_TRACE(("_dhd_set_multicast_list: ifidx %d\n", i)); /* Shinuk */
+ DHD_TRACE(("_dhd_set_multicast_list: ifidx %d\n", i));
dev = dhd->iflist[i]->net;
#endif /* MCAST_LIST_ACCUMULATION */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
- netif_addr_lock_bh(dev);
+ netif_addr_lock_bh(dev);
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)
- netdev_for_each_mc_addr(ha, dev) {
+ netdev_for_each_mc_addr(ha, dev) {
#ifdef MCAST_LIST_ACCUMULATION
if (!cnt_iface[i])
#else
- if (!cnt)
+ if (!cnt)
#endif /* MCAST_LIST_ACCUMULATION */
- break;
- memcpy(bufp, ha->addr, ETHER_ADDR_LEN);
- bufp += ETHER_ADDR_LEN;
+ break;
+ memcpy(bufp, ha->addr, ETHER_ADDR_LEN);
+ bufp += ETHER_ADDR_LEN;
#ifdef MCAST_LIST_ACCUMULATION
- DHD_TRACE(("_dhd_set_multicast_list: cnt %d %02x:%02x:%02x:%02x:%02x:%02x\n",
- cnt_iface[i], ha->addr[0], ha->addr[1],
- ha->addr[2], ha->addr[3], ha->addr[4],
- ha->addr[5])); /* Shinuk */
+ DHD_TRACE(("_dhd_set_multicast_list: cnt "
+ "%d " MACDBG "\n",
+ cnt_iface[i], STR_TO_MACD(ha->addr)));
cnt_iface[i]--;
#else
- cnt--;
+ cnt--;
#endif /* MCAST_LIST_ACCUMULATION */
-
- }
+ }
#else
#ifdef MCAST_LIST_ACCUMULATION
- for (mclist = dev->mc_list; (mclist && (cnt_iface[i] > 0)); cnt_iface[i]--, mclist = mclist->next) {
+ for (mclist = dev->mc_list; (mclist && (cnt_iface[i] > 0));
+ cnt_iface[i]--, mclist = mclist->next) {
#else
- for (mclist = dev->mc_list; (mclist && (cnt > 0)); cnt--, mclist = mclist->next) {
+ for (mclist = dev->mc_list; (mclist && (cnt > 0));
+ cnt--, mclist = mclist->next) {
#endif /* MCAST_LIST_ACCUMULATION */
- memcpy(bufp, (void *)mclist->dmi_addr, ETHER_ADDR_LEN);
- bufp += ETHER_ADDR_LEN;
- }
+ memcpy(bufp, (void *)mclist->dmi_addr, ETHER_ADDR_LEN);
+ bufp += ETHER_ADDR_LEN;
+ }
#endif /* LINUX_VERSION_CODE */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
- netif_addr_unlock_bh(dev);
+ netif_addr_unlock_bh(dev);
#endif
-
#ifdef MCAST_LIST_ACCUMULATION
}
}
@@ -1120,11 +1152,7 @@ _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx)
}
}
-#ifdef CUSTOMER_HW_SAMSUNG
int
-#else
-static int
-#endif
_dhd_set_mac_address(dhd_info_t *dhd, int ifidx, struct ether_addr *addr)
{
char buf[32];
@@ -1237,15 +1265,20 @@ dhd_op_if(dhd_if_t *ifp)
/* dhd_op_if is called again from some other context */
ifp->state = DHD_IF_DELETING;
if (ifp->net != NULL) {
- DHD_ERROR(("\n%s: (WAR TRACE) got 'DHD_IF_DEL' state\n", __FUNCTION__));
+ DHD_TRACE(("\n%s: got 'DHD_IF_DEL' state\n", __FUNCTION__));
netif_stop_queue(ifp->net);
#ifdef WL_CFG80211
if (dhd->dhd_state & DHD_ATTACH_STATE_CFG80211) {
- wl_cfg80211_notify_ifdel(ifp->net);
+ wl_cfg80211_ifdel_ops(ifp->net);
}
#endif
unregister_netdev(ifp->net);
ret = DHD_DEL_IF; /* Make sure the free_netdev() is called */
+#ifdef WL_CFG80211
+ if (dhd->dhd_state & DHD_ATTACH_STATE_CFG80211) {
+ wl_cfg80211_notify_ifdel();
+ }
+#endif
}
break;
case DHD_IF_DELETING:
@@ -1285,10 +1318,11 @@ _dhd_sysioc_thread(void *data)
bool in_ap = FALSE;
unsigned long flags;
#endif
-
+#ifndef USE_KTHREAD_API
DAEMONIZE("dhd_sysioc");
complete(&tsk->completed);
+#endif
while (down_interruptible(&tsk->sema) == 0) {
#ifdef MCAST_LIST_ACCUMULATION
@@ -1347,10 +1381,13 @@ _dhd_sysioc_thread(void *data)
}
if (dhd->set_macaddress == i+1) {
dhd->set_macaddress = 0;
- if (0 == _dhd_set_mac_address(dhd, i, &dhd->macvalue))
- DHD_INFO(("dhd_sysioc_thread: MACID is overwritten\n"));
- else
- DHD_ERROR(("dhd_sysioc_thread: _dhd_set_mac_address() failed\n"));
+ if (_dhd_set_mac_address(dhd, i, &dhd->macvalue) == 0) {
+ DHD_INFO((
+ "dhd_sysioc_thread: MACID is overwritten\n"));
+ } else {
+ DHD_ERROR((
+ "dhd_sysioc_thread: _dhd_set_mac_address() failed\n"));
+ }
}
}
}
@@ -1417,7 +1454,6 @@ dhd_os_wlfc_unblock(dhd_pub_t *pub)
{
dhd_info_t *di = (dhd_info_t *)(pub->info);
- (void)di;
ASSERT(di != NULL);
spin_unlock_bh(&di->wlfc_spinlock);
return 1;
@@ -1524,12 +1560,6 @@ dhd_start_xmit(struct sk_buff *skb, struct net_device *net)
DHD_OS_WAKE_LOCK(&dhd->pub);
/* Reject if down */
-#ifdef CUSTOMER_HW_SAMSUNG
- /*
- * CSP #506108
- * kernel panic issue when first bootup time,
- * rmmod without interface down make unnecessary hang event.
- */
if (dhd->pub.busstate == DHD_BUS_DOWN || dhd->pub.hang_was_sent) {
DHD_ERROR(("%s: xmit rejected pub.up=%d busstate=%d \n",
__FUNCTION__, dhd->pub.up, dhd->pub.busstate));
@@ -1540,29 +1570,23 @@ dhd_start_xmit(struct sk_buff *skb, struct net_device *net)
net_os_send_hang_message(net);
}
DHD_OS_WAKE_UNLOCK(&dhd->pub);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20))
return -ENODEV;
- }
#else
- if (!dhd->pub.up || (dhd->pub.busstate == DHD_BUS_DOWN)) {
- DHD_ERROR(("%s: xmit rejected pub.up=%d busstate=%d \n",
- __FUNCTION__, dhd->pub.up, dhd->pub.busstate));
- netif_stop_queue(net);
- /* Send Event when bus down detected during data session */
- if (dhd->pub.busstate == DHD_BUS_DOWN) {
- DHD_ERROR(("%s: Event HANG sent up\n", __FUNCTION__));
- net_os_send_hang_message(net);
- }
- DHD_OS_WAKE_UNLOCK(&dhd->pub);
- return -ENODEV;
+ return NETDEV_TX_BUSY;
+#endif
}
-#endif /* CUSTOMER_HW_SAMSUNG */
ifidx = dhd_net2idx(dhd, net);
if (ifidx == DHD_BAD_IF) {
DHD_ERROR(("%s: bad ifidx %d\n", __FUNCTION__, ifidx));
netif_stop_queue(net);
DHD_OS_WAKE_UNLOCK(&dhd->pub);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20))
return -ENODEV;
+#else
+ return NETDEV_TX_BUSY;
+#endif
}
/* Make sure there's enough room for any header */
@@ -1617,7 +1641,11 @@ done:
DHD_OS_WAKE_UNLOCK(&dhd->pub);
/* Return ok: we always eat the packet */
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20))
return 0;
+#else
+ return NETDEV_TX_OK;
+#endif
}
void
@@ -1629,11 +1657,11 @@ dhd_txflowcontrol(dhd_pub_t *dhdp, int ifidx, bool state)
DHD_TRACE(("%s: Enter\n", __FUNCTION__));
- dhdp->txoff = state;
ASSERT(dhd);
if (ifidx == ALL_INTERFACES) {
/* Flow control on all active interfaces */
+ dhdp->txoff = state;
for (i = 0; i < DHD_MAX_IFS; i++) {
if (dhd->iflist[i]) {
net = dhd->iflist[i]->net;
@@ -1675,6 +1703,7 @@ static const char *_get_packet_type_str(uint16 type)
{
int i;
int n = sizeof(packet_type_info)/sizeof(packet_type_info[1]) - 1;
+
for (i = 0; i < n; i++) {
if (packet_type_info[i].type == type)
return packet_type_info[i].str;
@@ -1684,6 +1713,11 @@ static const char *_get_packet_type_str(uint16 type)
}
#endif /* DHD_RX_DUMP */
+#ifdef CUSTOMER_HW4
+extern int pkt_free;
+extern int caller;
+extern void *free_ptr;
+#endif
void
dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, void *pktbuf, int numpkt, uint8 chan)
{
@@ -1695,7 +1729,9 @@ dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, void *pktbuf, int numpkt, uint8 chan)
int i;
dhd_if_t *ifp;
wl_event_msg_t event;
- int tout = DHD_PACKET_TIMEOUT_MS;
+ int tout_rx = 0;
+ int tout_ctrl = 0;
+
#ifdef DHD_RX_DUMP
#ifdef DHD_RX_FULL_DUMP
int k;
@@ -1704,7 +1740,6 @@ dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, void *pktbuf, int numpkt, uint8 chan)
uint16 protocol;
#endif /* DHD_RX_DUMP */
-
DHD_TRACE(("%s: Enter\n", __FUNCTION__));
for (i = 0; pktbuf && i < numpkt; i++, pktbuf = pnext) {
@@ -1722,14 +1757,17 @@ dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, void *pktbuf, int numpkt, uint8 chan)
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
/* Dropping packets before registering net device to avoid kernel panic */
- if (!ifp->net || ifp->net->reg_state != NETREG_REGISTERED ||
- !dhd->pub.up) {
+#ifdef BCMDHDUSB
+ if (!ifp->net || ifp->net->reg_state != NETREG_REGISTERED) {
+#else
+ if (!ifp->net || ifp->net->reg_state != NETREG_REGISTERED || !dhd->pub.up) {
+#endif /* BCMDHDUSB */
DHD_ERROR(("%s: net device is NOT registered yet. drop packet\n",
__FUNCTION__));
PKTFREE(dhdp->osh, pktbuf, TRUE);
continue;
}
-#endif
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) */
pnext = PKTNEXT(dhdp->osh, pktbuf);
PKTSETNEXT(wl->sh.osh, pktbuf, NULL);
@@ -1755,10 +1793,16 @@ dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, void *pktbuf, int numpkt, uint8 chan)
piggy-back on
*/
((athost_wl_status_info_t*)dhdp->wlfc_state)->stats.wlfc_header_only_pkt++;
+#ifdef CUSTOMER_HW4
+ if (numpkt == 1 && pkt_free && (free_ptr == pktbuf)) {
+/* DHD_ERROR(("DHD TRACE2(FREE):%d %d %p\n",
+ pkt_free, caller, free_ptr)); */
+ }
+#endif
PKTFREE(dhdp->osh, pktbuf, TRUE);
continue;
}
-#endif
+#endif /* PROP_TXSTATUS */
skb = PKTTONATIVE(dhdp->osh, pktbuf);
@@ -1778,6 +1822,7 @@ dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, void *pktbuf, int numpkt, uint8 chan)
dump_data = skb->data;
protocol = (dump_data[12] << 8) | dump_data[13];
DHD_ERROR(("RX DUMP - %s\n", _get_packet_type_str(protocol)));
+
#ifdef DHD_RX_FULL_DUMP
if (protocol != ETHER_TYPE_BRCM) {
for (k = 0; k < skb->len; k++) {
@@ -1788,6 +1833,7 @@ dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, void *pktbuf, int numpkt, uint8 chan)
DHD_ERROR(("\n"));
}
#endif /* DHD_RX_FULL_DUMP */
+
if (protocol != ETHER_TYPE_BRCM) {
if (dump_data[0] == 0xFF) {
DHD_ERROR(("%s: BROADCAST\n", __FUNCTION__));
@@ -1798,12 +1844,8 @@ dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, void *pktbuf, int numpkt, uint8 chan)
__FUNCTION__, dump_data[0x15]));
}
} else if (dump_data[0] & 1) {
- DHD_ERROR(("%s: MULTICAST: "
- "%02X:%02X:%02X:%02X:%02X:%02X\n",
- __FUNCTION__, dump_data[0],
- dump_data[1], dump_data[2],
- dump_data[3], dump_data[4],
- dump_data[5]));
+ DHD_ERROR(("%s: MULTICAST: " MACDBG "\n",
+ __FUNCTION__, STR_TO_MACD(dump_data)));
}
if (protocol == ETHER_TYPE_802_1X) {
@@ -1848,13 +1890,24 @@ dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, void *pktbuf, int numpkt, uint8 chan)
&event,
&data);
-#ifdef WLBTAMP
wl_event_to_host_order(&event);
+
+ if (!tout_ctrl)
+ tout_ctrl = DHD_PACKET_TIMEOUT_MS;
+
+#ifdef WLBTAMP
if (event.event_type == WLC_E_BTA_HCI_EVENT) {
dhd_bta_doevt(dhdp, data, event.datalen);
}
- tout = DHD_EVENT_TIMEOUT_MS;
#endif /* WLBTAMP */
+
+#if defined(PNO_SUPPORT)
+ if (event.event_type == WLC_E_PFN_NET_FOUND) {
+ tout_ctrl *= 2;
+ }
+#endif /* PNO_SUPPORT */
+ } else {
+ tout_rx = DHD_PACKET_TIMEOUT_MS;
}
ASSERT(ifidx < DHD_MAX_IFS && dhd->iflist[ifidx]);
@@ -1887,7 +1940,9 @@ dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, void *pktbuf, int numpkt, uint8 chan)
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) */
}
}
- DHD_OS_WAKE_LOCK_TIMEOUT_ENABLE(dhdp, tout);
+
+ DHD_OS_WAKE_LOCK_RX_TIMEOUT_ENABLE(dhdp, tout_rx);
+ DHD_OS_WAKE_LOCK_CTRL_TIMEOUT_ENABLE(dhdp, tout_ctrl);
}
void
@@ -1987,11 +2042,12 @@ dhd_watchdog_thread(void *data)
dhd_watchdog_prio:(MAX_RT_PRIO-1);
setScheduler(current, SCHED_FIFO, &param);
}
-
+#ifndef USE_KTHREAD_API
DAEMONIZE("dhd_watchdog");
/* Run until signal received */
complete(&tsk->completed);
+#endif
while (1)
if (down_interruptible (&tsk->sema) == 0) {
@@ -2015,7 +2071,7 @@ dhd_watchdog_thread(void *data)
/* Reschedule the watchdog */
if (dhd->wd_timer_valid)
mod_timer(&dhd->timer,
- jiffies + dhd_watchdog_ms * HZ / 1000);
+ jiffies + msecs_to_jiffies(dhd_watchdog_ms));
dhd_os_spin_unlock(&dhd->pub, flags);
}
dhd_os_sdunlock(&dhd->pub);
@@ -2033,10 +2089,6 @@ static void dhd_watchdog(ulong data)
dhd_info_t *dhd = (dhd_info_t *)data;
unsigned long flags;
- /* To avoid kernel panic */
- if (!dhd->wd_timer_valid)
- return;
-
DHD_OS_WAKE_LOCK(&dhd->pub);
if (dhd->pub.dongle_reset) {
DHD_OS_WAKE_UNLOCK(&dhd->pub);
@@ -2060,7 +2112,7 @@ static void dhd_watchdog(ulong data)
/* Reschedule the watchdog */
if (dhd->wd_timer_valid)
- mod_timer(&dhd->timer, jiffies + dhd_watchdog_ms * HZ / 1000);
+ mod_timer(&dhd->timer, jiffies + msecs_to_jiffies(dhd_watchdog_ms));
dhd_os_spin_unlock(&dhd->pub, flags);
dhd_os_sdunlock(&dhd->pub);
DHD_OS_WAKE_UNLOCK(&dhd->pub);
@@ -2082,12 +2134,13 @@ dhd_dpc_thread(void *data)
param.sched_priority = (dhd_dpc_prio < MAX_RT_PRIO)?dhd_dpc_prio:(MAX_RT_PRIO-1);
setScheduler(current, SCHED_FIFO, &param);
}
-
+#ifndef USE_KTHREAD_API
DAEMONIZE("dhd_dpc");
/* DHD_OS_WAKE_LOCK is called in dhd_sched_dpc[dhd_linux.c] down below */
/* signal: thread has started */
complete(&tsk->completed);
+#endif
/* Run until signal received */
while (1) {
@@ -2156,7 +2209,8 @@ dhd_sched_dpc(dhd_pub_t *dhdp)
}
#endif /* DHDTHREAD */
- tasklet_schedule(&dhd->tasklet);
+ if (dhd->dhd_tasklet_create)
+ tasklet_schedule(&dhd->tasklet);
}
#ifdef TOE
@@ -2175,7 +2229,8 @@ dhd_toe_get(dhd_info_t *dhd, int ifidx, uint32 *toe_ol)
ioc.len = (uint)sizeof(buf);
ioc.set = FALSE;
- strcpy(buf, "toe_ol");
+ strncpy(buf, "toe_ol", sizeof(buf) - 1);
+ buf[sizeof(buf) - 1] = '\0';
if ((ret = dhd_wl_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len)) < 0) {
/* Check for older dongle image that doesn't support toe_ol */
if (ret == -EIO) {
@@ -2209,7 +2264,8 @@ dhd_toe_set(dhd_info_t *dhd, int ifidx, uint32 toe_ol)
/* Set toe_ol as requested */
- strcpy(buf, "toe_ol");
+ strncpy(buf, "toe_ol", sizeof(buf) - 1);
+ buf[sizeof(buf) - 1] = '\0';
memcpy(&buf[sizeof("toe_ol")], &toe_ol, sizeof(uint32));
if ((ret = dhd_wl_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len)) < 0) {
@@ -2240,8 +2296,8 @@ dhd_ethtool_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *info)
{
dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(net);
- sprintf(info->driver, "wl");
- sprintf(info->version, "%lu", dhd->pub.drv_version);
+ snprintf(info->driver, sizeof(info->driver), "wl");
+ snprintf(info->version, sizeof(info->version), "%lu", dhd->pub.drv_version);
}
struct ethtool_ops dhd_ethtool_ops = {
@@ -2283,8 +2339,9 @@ dhd_ethtool(dhd_info_t *dhd, void *uaddr)
/* if dhd requested, identify ourselves */
if (strcmp(drvname, "?dhd") == 0) {
- sprintf(info.driver, "dhd");
- strcpy(info.version, EPI_VERSION_STR);
+ snprintf(info.driver, sizeof(info.driver), "dhd");
+ strncpy(info.version, EPI_VERSION_STR, sizeof(info.version) - 1);
+ info.version[sizeof(info.version) - 1] = '\0';
}
/* otherwise, require dongle to be up */
@@ -2295,11 +2352,11 @@ dhd_ethtool(dhd_info_t *dhd, void *uaddr)
/* finally, report dongle driver type */
else if (dhd->pub.iswl)
- sprintf(info.driver, "wl");
+ snprintf(info.driver, sizeof(info.driver), "wl");
else
- sprintf(info.driver, "xx");
+ snprintf(info.driver, sizeof(info.driver), "xx");
- sprintf(info.version, "%lu", dhd->pub.drv_version);
+ snprintf(info.version, sizeof(info.version), "%lu", dhd->pub.drv_version);
if (copy_to_user(uaddr, &info, sizeof(info)))
return -EFAULT;
DHD_CTL(("%s: given %*s, returning %s\n", __FUNCTION__,
@@ -2369,13 +2426,13 @@ static bool dhd_check_hang(struct net_device *net, dhd_pub_t *dhdp, int error)
return FALSE;
dhd = (dhd_info_t *)dhdp->info;
- if (dhd->thr_sysioc_ctl.thr_pid <0) {
+ if (dhd->thr_sysioc_ctl.thr_pid < 0) {
DHD_ERROR(("%s : skipped due to negative pid - unloading?\n", __FUNCTION__));
return FALSE;
}
- if ((error == -ETIMEDOUT) || (error == -EREMOTEIO)
- || ((dhdp->busstate == DHD_BUS_DOWN)&&(!dhdp->dongle_reset))) {
+ if ((error == -ETIMEDOUT) || (error == -EREMOTEIO) ||
+ ((dhdp->busstate == DHD_BUS_DOWN) && (!dhdp->dongle_reset))) {
DHD_ERROR(("%s: Event HANG send up due to re=%d te=%d e=%d s=%d\n", __FUNCTION__,
dhdp->rxcnt_timeout, dhdp->txcnt_timeout, error, dhdp->busstate));
net_os_send_hang_message(net);
@@ -2401,7 +2458,7 @@ dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd)
/* send to dongle only if we are not waiting for reload already */
if (dhd->pub.hang_was_sent) {
DHD_ERROR(("%s: HANG was sent up earlier\n", __FUNCTION__));
- DHD_OS_WAKE_LOCK_TIMEOUT_ENABLE(&dhd->pub, DHD_EVENT_TIMEOUT_MS);
+ DHD_OS_WAKE_LOCK_CTRL_TIMEOUT_ENABLE(&dhd->pub, DHD_EVENT_TIMEOUT_MS);
DHD_OS_WAKE_UNLOCK(&dhd->pub);
return OSL_ERROR(BCME_DONGLE_DOWN);
}
@@ -2449,7 +2506,7 @@ dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd)
/* Copy the ioc control structure part of ioctl request */
if (copy_from_user(&ioc, ifr->ifr_data, sizeof(wl_ioctl_t))) {
- bcmerror = -BCME_BADADDR;
+ bcmerror = BCME_BADADDR;
goto done;
}
@@ -2457,7 +2514,7 @@ dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd)
if (ioc.buf) {
if (ioc.len == 0) {
DHD_TRACE(("%s: ioc.len=0, returns BCME_BADARG \n", __FUNCTION__));
- bcmerror = -BCME_BADARG;
+ bcmerror = BCME_BADARG;
goto done;
}
buflen = MIN(ioc.len, DHD_IOCTL_MAXLEN);
@@ -2469,11 +2526,11 @@ dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd)
*/
{
if (!(buf = (char*)MALLOC(dhd->pub.osh, buflen))) {
- bcmerror = -BCME_NOMEM;
+ bcmerror = BCME_NOMEM;
goto done;
}
if (copy_from_user(buf, ioc.buf, buflen)) {
- bcmerror = -BCME_BADADDR;
+ bcmerror = BCME_BADADDR;
goto done;
}
}
@@ -2482,12 +2539,12 @@ dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd)
/* To differentiate between wl and dhd read 4 more byes */
if ((copy_from_user(&driver, (char *)ifr->ifr_data + sizeof(wl_ioctl_t),
sizeof(uint)) != 0)) {
- bcmerror = -BCME_BADADDR;
+ bcmerror = BCME_BADADDR;
goto done;
}
if (!capable(CAP_NET_ADMIN)) {
- bcmerror = -BCME_EPERM;
+ bcmerror = BCME_EPERM;
goto done;
}
@@ -2575,13 +2632,15 @@ dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd)
}
#endif /* WLMEDIA_HTSF */
-#ifdef BCM_FD_AGGR
if ((ioc.cmd == WLC_SET_VAR || ioc.cmd == WLC_GET_VAR) &&
ioc.buf != NULL && strncmp("rpc_", ioc.buf, 4) == 0) {
+#ifdef BCM_FD_AGGR
bcmerror = dhd_fdaggr_ioctl(&dhd->pub, ifidx, (wl_ioctl_t *)&ioc, buf, buflen);
+#else
+ bcmerror = BCME_UNSUPPORTED;
+#endif
goto done;
}
-#endif
bcmerror = dhd_wl_ioctl(&dhd->pub, ifidx, (wl_ioctl_t *)&ioc, buf, buflen);
done:
@@ -2620,17 +2679,17 @@ dhd_cleanup_virt_ifaces(dhd_info_t *dhd)
#endif
for (i = 1; i < DHD_MAX_IFS; i++) {
+ dhd_net_if_lock_local(dhd);
if (dhd->iflist[i]) {
- DHD_ERROR(("(WAR TRACE)Deleting IF: %d \n", i));
+ DHD_TRACE(("Deleting IF: %d \n", i));
if ((dhd->iflist[i]->state != DHD_IF_DEL) &&
(dhd->iflist[i]->state != DHD_IF_DELETING)) {
dhd->iflist[i]->state = DHD_IF_DEL;
dhd->iflist[i]->idx = i;
- dhd_net_if_lock_local(dhd);
dhd_op_if(dhd->iflist[i]);
- dhd_net_if_unlock_local(dhd);
}
}
+ dhd_net_if_unlock_local(dhd);
}
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
@@ -2642,8 +2701,8 @@ dhd_cleanup_virt_ifaces(dhd_info_t *dhd)
}
#endif /* WL_CFG80211 */
-#if defined(WL_CFG80211) && defined(CUSTOMER_HW_SAMSUNG)
-/* CSP#505233: Flags to indicate if we distingish power off policy when
+#if defined(WL_CFG80211) && defined(SUPPORT_DEEP_SLEEP)
+/* Flags to indicate if we distingish power off policy when
* user set the memu "Keep Wi-Fi on during sleep" to "Never"
*/
int sleep_never = 0;
@@ -2652,16 +2711,20 @@ int sleep_never = 0;
static int
dhd_stop(struct net_device *net)
{
- int ifidx;
+ int ifidx = 0;
dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(net);
DHD_OS_WAKE_LOCK(&dhd->pub);
- DHD_TRACE(("%s: (WAR TRACE)Enter %p\n", __FUNCTION__, net));
+ DHD_TRACE(("%s: Enter %p\n", __FUNCTION__, net));
if (dhd->pub.up == 0) {
goto exit;
}
ifidx = dhd_net2idx(dhd, net);
BCM_REFERENCE(ifidx);
+ /* Set state and stop OS transmissions */
+ netif_stop_queue(net);
+ dhd->pub.up = 0;
+
#ifdef WL_CFG80211
if (ifidx == 0) {
wl_cfg80211_down(NULL);
@@ -2680,18 +2743,17 @@ dhd_stop(struct net_device *net)
#ifdef PROP_TXSTATUS
dhd_wlfc_cleanup(&dhd->pub);
#endif
- /* Set state and stop OS transmissions */
- dhd->pub.up = 0;
- netif_stop_queue(net);
/* Stop the protocol module */
dhd_prot_stop(&dhd->pub);
+ OLD_MOD_DEC_USE_COUNT;
+exit:
#if defined(WL_CFG80211)
if (ifidx == 0) {
if (!dhd_download_fw_on_driverload)
wl_android_wifi_off(net);
-#ifdef CUSTOMER_HW_SAMSUNG
+#ifdef SUPPORT_DEEP_SLEEP
else {
/* CSP#505233: Flags to indicate if we distingish
* power off policy when user set the memu
@@ -2702,15 +2764,12 @@ dhd_stop(struct net_device *net)
sleep_never = 0;
}
}
-#endif /* CUSTOMER_HW_SAMSUNG */
+#endif /* SUPPORT_DEEP_SLEEP */
}
-#endif /* WL_CFG80211 */
- dhd->pub.dongle_trap_occured = 0;
- dhd->pub.hang_was_sent = 0;
+#endif
dhd->pub.rxcnt_timeout = 0;
dhd->pub.txcnt_timeout = 0;
- OLD_MOD_DEC_USE_COUNT;
-exit:
+
DHD_OS_WAKE_UNLOCK(&dhd->pub);
return 0;
}
@@ -2724,39 +2783,50 @@ dhd_open(struct net_device *net)
#endif
int ifidx;
int32 ret = 0;
-#ifdef WL_CFG80211
- bool fw_changed = FALSE;
-#endif
+
DHD_OS_WAKE_LOCK(&dhd->pub);
+ DHD_ERROR(("%s: Enter, net[%p]\n", __FUNCTION__, net));
/* Update FW path if it was changed */
- if ((strlen(firmware_path) != 0) && (firmware_path[0] != '\0')) {
+ if (strlen(firmware_path) != 0) {
if (firmware_path[strlen(firmware_path)-1] == '\n')
firmware_path[strlen(firmware_path)-1] = '\0';
-#ifdef WL_CFG80211
- if (dhd_download_fw_on_driverload &&
- strcmp(fw_path, firmware_path))
- {
- DHD_ERROR(("firmware path changed:%s --> %s\n",
- fw_path, firmware_path));
- fw_changed = TRUE;
- }
-#endif /* WL_CFG80211 */
- strcpy(fw_path, firmware_path);
-#if defined(BCM4334_CHECK_CHIP_REV)
- strcpy(fw_down_path, fw_path);
- strcat(fw_down_path, chipver_tag);
+ strncpy(fw_path, firmware_path, sizeof(fw_path)-1);
+ fw_path[sizeof(fw_path)-1] = '\0';
+#if defined(SUPPORT_MULTIPLE_REVISION)
+ ret = concate_revision(dhd->pub.bus, fw_path, MOD_PARAM_PATHLEN);
+ if (ret != 0) {
+ DHD_ERROR(("%s: fail to concatnate revison \n", __FUNCTION__));
+ goto exit;
+ }
#endif
firmware_path[0] = '\0';
}
+ /* Update NVRAM path if it was changed */
+ if (!dhd_download_fw_on_driverload && (strlen(nvram_path) != 0)) {
+ if (nvram_path[strlen(nvram_path)-1] == '\n')
+ nvram_path[strlen(nvram_path)-1] = '\0';
+ strcpy(nv_path, nvram_path);
+ nvram_path[0] = '\0';
+ }
+
+
+ dhd->pub.dongle_trap_occured = 0;
+ dhd->pub.hang_was_sent = 0;
#if !defined(WL_CFG80211)
/*
* Force start if ifconfig_up gets called before START command
* We keep WEXT's wl_control_wl_start to provide backward compatibility
* This should be removed in the future
*/
- wl_control_wl_start(net);
-#endif
+ ret = wl_control_wl_start(net);
+ if (ret != 0) {
+ DHD_ERROR(("%s: failed with code %d\n", __FUNCTION__, ret));
+ ret = -1;
+ goto exit;
+ }
+
+#endif
ifidx = dhd_net2idx(dhd, net);
DHD_TRACE(("%s: ifidx %d\n", __FUNCTION__, ifidx));
@@ -2780,43 +2850,52 @@ dhd_open(struct net_device *net)
if (!dhd_download_fw_on_driverload) {
ret = wl_android_wifi_on(net);
if (ret != 0) {
- DHD_ERROR(("wl_android_wifi_on failed (%d)\n", ret));
+ DHD_ERROR(("%s: failed with code %d\n", __FUNCTION__, ret));
+ ret = -1;
goto exit;
- }
+ }
} else {
-#ifdef CUSTOMER_HW_SAMSUNG
- /* CSP#505233: Flags to indicate if we distingish
+#ifdef SUPPORT_DEEP_SLEEP
+ /* Flags to indicate if we distingish
* power off policy when user set the memu
* "Keep Wi-Fi on during sleep" to "Never"
*/
if (sleep_never) {
dhd_deepsleep(net, 0);
sleep_never = 0;
- } else {
-#endif /* CUSTOMER_HW_SAMSUNG */
- if (fw_changed) {
- wl_android_wifi_off(net);
- msleep(300);
- ret = wl_android_wifi_on(net);
- if (ret != 0) {
- DHD_ERROR(("wl_android_wifi_on failed (%d)\n", ret));
- goto exit;
- }
- }
-#ifdef CUSTOMER_HW_SAMSUNG
}
-#endif /* CUSTOMER_HW_SAMSUNG */
+#endif /* SUPPORT_DEEP_SLEEP */
}
-#endif /* WL_CFG80211 */
+#endif
if (dhd->pub.busstate != DHD_BUS_DATA) {
- /* try to bring up bus */
- if ((ret = dhd_bus_start(&dhd->pub)) != 0) {
- DHD_ERROR(("%s: failed with code %d\n", __FUNCTION__, ret));
- ret = -1;
- goto exit;
+#if defined(CUSTOMER_HW4)
+#define WAIT_DHDBUS_READY 5
+ /* Delay ifup until insmod completed in case of module type */
+ if (dhd_download_fw_on_driverload) {
+ uint retry = 0;
+
+ do {
+ OSL_DELAY(100*1000);
+ } while ((dhd->pub.busstate != DHD_BUS_DATA) &&
+ (retry++ < WAIT_DHDBUS_READY));
+
+ if (dhd->pub.busstate != DHD_BUS_DATA) {
+ DHD_ERROR(("%s: call dev open before insmod complete!\n",
+ __FUNCTION__));
+ ret = -1;
+ goto exit;
+ }
}
+ else
+#endif /* CUSTOMER_HW4 */
+ /* try to bring up bus */
+ if ((ret = dhd_bus_start(&dhd->pub)) != 0) {
+ DHD_ERROR(("%s: failed with code %d\n", __FUNCTION__, ret));
+ ret = -1;
+ goto exit;
+ }
}
@@ -2843,12 +2922,16 @@ dhd_open(struct net_device *net)
/* Allow transmit calls */
netif_start_queue(net);
dhd->pub.up = 1;
+
#ifdef BCMDBGFS
dhd_dbg_init(&dhd->pub);
#endif
OLD_MOD_INC_USE_COUNT;
exit:
+ if (ret)
+ dhd_stop(net);
+
DHD_OS_WAKE_UNLOCK(&dhd->pub);
return ret;
}
@@ -2870,7 +2953,7 @@ int dhd_do_driver_init(struct net_device *net)
DHD_TRACE(("Driver already Inititalized. Nothing to do"));
return 0;
}
-
+ DHD_ERROR(("%s: call dhd_open\n", __FUNCTION__));
if (dhd_open(net) < 0) {
DHD_ERROR(("Driver Init Failed \n"));
return -1;
@@ -2892,11 +2975,13 @@ dhd_osl_detach(osl_t *osh)
DHD_ERROR(("%s: MEMORY LEAK %d bytes\n", __FUNCTION__, MALLOCED(osh)));
}
osl_detach(osh);
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
+#if 1 && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
dhd_registration_check = FALSE;
up(&dhd_registration_sem);
+#if defined(BCMLXSDMMC)
up(&dhd_chipup_sem);
#endif
+#endif
}
int
@@ -2939,6 +3024,7 @@ dhd_add_if(dhd_info_t *dhd, int ifidx, void *handle, char *name,
up(&dhd->thr_sysioc_ctl.sema);
} else
ifp->net = (struct net_device *)handle;
+
if (ifidx == 0) {
ifp->event2cfg80211 = TRUE;
}
@@ -2974,7 +3060,11 @@ static struct net_device_ops dhd_ops_pri = {
.ndo_do_ioctl = dhd_ioctl_entry,
.ndo_start_xmit = dhd_start_xmit,
.ndo_set_mac_address = dhd_set_mac_address,
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0))
+ .ndo_set_rx_mode = dhd_set_multicast_list,
+#else
.ndo_set_multicast_list = dhd_set_multicast_list,
+#endif
};
static struct net_device_ops dhd_ops_virt = {
@@ -2982,7 +3072,11 @@ static struct net_device_ops dhd_ops_virt = {
.ndo_do_ioctl = dhd_ioctl_entry,
.ndo_start_xmit = dhd_start_xmit,
.ndo_set_mac_address = dhd_set_mac_address,
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0))
+ .ndo_set_rx_mode = dhd_set_multicast_list,
+#else
.ndo_set_multicast_list = dhd_set_multicast_list,
+#endif
};
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31)) */
@@ -2995,29 +3089,22 @@ dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen)
dhd_attach_states_t dhd_state = DHD_ATTACH_STATE_INIT;
DHD_TRACE(("%s: Enter\n", __FUNCTION__));
-#ifdef BCM4334_CHECK_CHIP_REV
- DHD_ERROR(("CHIP VER = [0x%x]\n", g_chipver));
- if (g_chipver == 1) {
- DHD_ERROR(("----- CHIP bcm4334_B0 -----\n"));
- strcpy(chipver_tag, "_b0");
- } else if (g_chipver == 2) {
- DHD_ERROR(("----- CHIP bcm4334_B1 -----\n"));
- strcpy(chipver_tag, "_b1");
- } else if (g_chipver == 3) {
- DHD_ERROR(("----- CHIP bcm4334_B2 -----\n"));
- strcpy(chipver_tag, "_b2");
- }
- else {
- DHD_ERROR(("----- Invalid chip version -----\n"));
- goto fail;
- }
-#endif /* BCM4334_CHECK_CHIP_REV */
-
/* updates firmware nvram path if it was provided as module parameters */
- if ((strlen(firmware_path) != 0) && (firmware_path[0] != '\0'))
- strcpy(fw_path, firmware_path);
- if ((strlen(nvram_path) != 0) && (nvram_path[0] != '\0'))
- strcpy(nv_path, nvram_path);
+ if (strlen(firmware_path) != 0) {
+ strncpy(fw_path, firmware_path, sizeof(fw_path) - 1);
+ fw_path[sizeof(fw_path) - 1] = '\0';
+ }
+ if (strlen(nvram_path) != 0) {
+ strncpy(nv_path, nvram_path, sizeof(nv_path) -1);
+ nv_path[sizeof(nv_path) -1] = '\0';
+ }
+#if defined(SUPPORT_MULTIPLE_REVISION)
+ if (strlen(fw_path) != 0 &&
+ concate_revision(bus, fw_path, MOD_PARAM_PATHLEN) != 0) {
+ DHD_ERROR(("%s: fail to concatnate revison \n", __FUNCTION__));
+ goto fail;
+ }
+#endif
/* Allocate etherdev, including space for private structure */
if (!(net = alloc_etherdev(sizeof(dhd)))) {
@@ -3036,9 +3123,8 @@ dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen)
#ifdef DHDTHREAD
dhd->thr_dpc_ctl.thr_pid = DHD_PID_KT_TL_INVALID;
dhd->thr_wdt_ctl.thr_pid = DHD_PID_KT_INVALID;
-#else
- dhd->dhd_tasklet_create = FALSE;
#endif /* DHDTHREAD */
+ dhd->dhd_tasklet_create = FALSE;
dhd->thr_sysioc_ctl.thr_pid = DHD_PID_KT_INVALID;
dhd_state |= DHD_ATTACH_STATE_DHD_ALLOC;
@@ -3094,16 +3180,19 @@ dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen)
/* Initialize Wakelock stuff */
spin_lock_init(&dhd->wakelock_spinlock);
dhd->wakelock_counter = 0;
- dhd->wakelock_timeout_enable = 0;
+ dhd->wakelock_rx_timeout_enable = 0;
+ dhd->wakelock_ctrl_timeout_enable = 0;
#ifdef CONFIG_HAS_WAKELOCK
wake_lock_init(&dhd->wl_wifi, WAKE_LOCK_SUSPEND, "wlan_wake");
wake_lock_init(&dhd->wl_rxwake, WAKE_LOCK_SUSPEND, "wlan_rx_wake");
-#ifdef PNO_SUPPORT
+ wake_lock_init(&dhd->wl_ctrlwake, WAKE_LOCK_SUSPEND, "wlan_ctrl_wake");
+#if defined(CUSTOMER_HW4) && defined(PNO_SUPPORT)
wake_lock_init(&dhd->pub.pno_wakelock, WAKE_LOCK_SUSPEND, "pno_wake_lock");
#endif
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) && 1
mutex_init(&dhd->dhd_net_if_mutex);
+ mutex_init(&dhd->dhd_suspend_mutex);
#endif
dhd_state |= DHD_ATTACH_STATE_WAKELOCKS_INIT;
@@ -3153,7 +3242,11 @@ dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen)
if (dhd_dpc_prio >= 0) {
/* Initialize watchdog thread */
+#ifdef USE_KTHREAD_API
+ PROC_START2(dhd_watchdog_thread, dhd, &dhd->thr_wdt_ctl, 0, "dhd_watchdog_thread");
+#else
PROC_START(dhd_watchdog_thread, dhd, &dhd->thr_wdt_ctl, 0);
+#endif
} else {
dhd->thr_wdt_ctl.thr_pid = -1;
}
@@ -3161,7 +3254,11 @@ dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen)
/* Set up the bottom half handler */
if (dhd_dpc_prio >= 0) {
/* Initialize DPC thread */
+#ifdef USE_KTHREAD_API
+ PROC_START2(dhd_dpc_thread, dhd, &dhd->thr_dpc_ctl, 0, "dhd_dpc");
+#else
PROC_START(dhd_dpc_thread, dhd, &dhd->thr_dpc_ctl, 0);
+#endif
} else {
/* use tasklet for dpc */
tasklet_init(&dhd->tasklet, dhd_dpc, (ulong)dhd);
@@ -3174,12 +3271,18 @@ dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen)
#endif /* DHDTHREAD */
if (dhd_sysioc) {
+#ifdef USE_KTHREAD_API
+ PROC_START2(_dhd_sysioc_thread, dhd, &dhd->thr_sysioc_ctl, 0, "dhd_sysioc");
+#else
PROC_START(_dhd_sysioc_thread, dhd, &dhd->thr_sysioc_ctl, 0);
+#endif
} else {
dhd->thr_sysioc_ctl.thr_pid = -1;
}
dhd_state |= DHD_ATTACH_STATE_THREADS_CREATED;
-
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && (1)
+ INIT_WORK(&dhd->work_hang, dhd_hang_process);
+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) */
/*
* Save the dhd_info into the priv
*/
@@ -3189,7 +3292,7 @@ dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen)
register_pm_notifier(&dhd_sleep_pm_notifier);
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP) */
-#ifdef CONFIG_HAS_EARLYSUSPEND
+#if defined(CONFIG_HAS_EARLYSUSPEND) && defined(DHD_USE_EARLYSUSPEND)
dhd->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 20;
dhd->early_suspend.suspend = dhd_early_suspend;
dhd->early_suspend.resume = dhd_late_resume;
@@ -3226,7 +3329,6 @@ dhd_bus_start(dhd_pub_t *dhdp)
int ret = -1;
dhd_info_t *dhd = (dhd_info_t*)dhdp->info;
unsigned long flags;
- char *down_path;
ASSERT(dhd);
@@ -3240,19 +3342,13 @@ dhd_bus_start(dhd_pub_t *dhdp)
/* try to download image and nvram to the dongle */
if ((dhd->pub.busstate == DHD_BUS_DOWN) &&
- (fw_path[0] != '\0') &&
- (nv_path[0] != '\0')) {
- down_path = fw_path;
-#if defined(BCM4334_CHECK_CHIP_REV)
- strcpy(fw_down_path, fw_path);
- strcat(fw_down_path, chipver_tag);
- down_path = fw_down_path;
-#endif
+ (fw_path != NULL) && (fw_path[0] != '\0') &&
+ (nv_path != NULL) && (nv_path[0] != '\0')) {
/* wake lock moved to dhdsdio_download_firmware */
if (!(dhd_bus_download_firmware(dhd->pub.bus, dhd->pub.osh,
- down_path, nv_path))) {
- DHD_ERROR(("%s: dhdsdio_probe_download failed. firmware = %s nvram = %s\n",
- __FUNCTION__, down_path, nv_path));
+ fw_path, nv_path))) {
+ DHD_ERROR(("%s: dhdsdio_probe_download failed. firmware or nvram path is wrong\n",
+ __FUNCTION__));
#ifdef DHDTHREAD
if (dhd->threads_only)
dhd_os_sdunlock(dhdp);
@@ -3282,7 +3378,7 @@ dhd_bus_start(dhd_pub_t *dhdp)
#endif /* DHDTHREAD */
return ret;
}
-#if defined(OOB_INTR_ONLY)
+#if defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID)
/* Host registration for OOB interrupt */
if (bcmsdh_register_oob_intr(dhdp)) {
/* deactivate timer and wait for the handler to finish */
@@ -3300,9 +3396,11 @@ dhd_bus_start(dhd_pub_t *dhdp)
return -ENODEV;
}
+#ifndef BCMSPI_ANDROID
/* Enable oob at firmware */
dhd_enable_oob_intr(dhd->pub.bus, TRUE);
-#endif /* defined(OOB_INTR_ONLY) */
+#endif /* !BCMSPI_ANDROID */
+#endif /* defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID) */
/* If bus is not ready, can't come up */
if (dhd->pub.busstate != DHD_BUS_DATA) {
@@ -3323,13 +3421,16 @@ dhd_bus_start(dhd_pub_t *dhdp)
dhd_os_sdunlock(dhdp);
#endif /* DHDTHREAD */
-#ifdef CUSTOMER_HW_SAMSUNG
+#ifdef BCMSDIOH_TXGLOM
+ if ((dhd->pub.busstate == DHD_BUS_DATA) && bcmsdh_glom_enabled()) {
+ dhd_txglom_enable(dhdp, TRUE);
+ }
+#endif
+
+#ifdef CUSTOMER_HW4
#ifdef USE_CID_CHECK
dhd_check_module_cid(dhdp);
#endif
-#ifdef GET_MAC_FROM_OTP
- dhd_check_module_mac(dhdp);
-#endif
#ifdef READ_MACADDR
dhd_read_macaddr(dhd, &dhd->pub.mac);
#endif
@@ -3339,20 +3440,31 @@ dhd_bus_start(dhd_pub_t *dhdp)
#ifdef RDWR_KORICS_MACADDR
dhd_write_rdwr_korics_macaddr(dhd, &dhd->pub.mac);
#endif
-#endif /* CUSTOMER_HW_SAMSUNG */
+#else
+#ifdef READ_MACADDR
+ dhd_read_macaddr(dhd);
+#endif
+#endif /* CUSTOMER_HW4 */
/* Bus is ready, do any protocol initialization */
if ((ret = dhd_prot_init(&dhd->pub)) < 0)
return ret;
-#ifdef CUSTOMER_HW_SAMSUNG
+#ifdef CUSTOMER_HW4
+#ifdef GET_MAC_FROM_OTP
+ dhd_check_module_mac(dhdp, &dhd->pub.mac);
+#endif
#ifdef RDWR_MACADDR
dhd_write_rdwr_macaddr(&dhd->pub.mac);
#endif
#ifdef WRITE_MACADDR
dhd_write_macaddr(&dhd->pub.mac);
#endif
-#endif /* CUSTOMER_HW_SAMSUNG */
+#else
+#ifdef WRITE_MACADDR
+ dhd_write_macaddr(dhd->pub.mac.octet);
+#endif
+#endif /* CUSTOMER_HW4 */
#ifdef ARP_OFFLOAD_SUPPORT
if (dhd->pend_ipaddr) {
@@ -3372,36 +3484,53 @@ dhd_bus_start(dhd_pub_t *dhdp)
* firmware and accordingly enable concurrent mode (Apply P2P settings). SoftAP firmware
* would still be named as fw_bcmdhd_apsta.
*/
-bool
-dhd_concurrent_fw(dhd_pub_t *dhd)
+int
+dhd_get_concurrent_capabilites(dhd_pub_t *dhd)
{
- int i, ret = 0;
+ int ret = 0;
char buf[WLC_IOCTL_SMLEN];
- char *cap[] = {"p2p", "mchan", "dsta", NULL};
- if ((!op_mode) && (strstr(fw_path, "_p2p") == NULL) &&
- (strstr(fw_path, "_apsta") == NULL)) {
- /* Given path is for the STA firmware. Check whether VSDB + P2P support
- * is present in the firmware. If so, set mode as P2P (concurrent support).
- */
- for (i = 0; cap[i] != NULL; ) {
- memset(buf, 0, sizeof(buf));
- bcm_mkiovar(cap[i++], 0, 0, buf, sizeof(buf));
- if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_GET_VAR, buf, sizeof(buf),
- FALSE, 0)) < 0) {
- DHD_TRACE(("%s: Get VSDB Capability(%s) failed (error=%d)\n",
- __FUNCTION__, cap[i-1], ret));
- return 0;
- } else if (buf[0] != 1) {
- DHD_TRACE(("VSDB(%s) is not supported , ret : %d\n",
- cap[i-1], buf[0]));
- return 0;
+ bool vsdb_supported = false;
+ memset(buf, 0, sizeof(buf));
+ bcm_mkiovar("cap", 0, 0, buf, sizeof(buf));
+ if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_GET_VAR, buf, sizeof(buf),
+ FALSE, 0)) < 0) {
+ DHD_ERROR(("%s: Get Capability failed (error=%d)\n",
+ __FUNCTION__, ret));
+ return 0;
+ }
+ if (strstr(buf, "vsdb")) {
+ vsdb_supported = true;
+ }
+ if (strstr(buf, "p2p") == NULL) {
+ DHD_TRACE(("Chip does not support p2p\n"));
+ return 0;
+ }
+ else {
+ /* Chip supports p2p but ensure that p2p is really implemented in firmware or not */
+ memset(buf, 0, sizeof(buf));
+ bcm_mkiovar("p2p", 0, 0, buf, sizeof(buf));
+ if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_GET_VAR, buf, sizeof(buf),
+ FALSE, 0)) < 0) {
+ DHD_ERROR(("%s: Get P2P failed (error=%d)\n", __FUNCTION__, ret));
+ return 0;
+ }
+ else {
+ if (buf[0] == 1) {
+ /* Chip supports p2p, now lets check for vsdb */
+ if (vsdb_supported)
+ return 2;
+ else
+#ifdef WL_ENABLE_P2P_IF
+ return 1;
+#else
+ return 0;
+#endif
}
}
- return 1;
}
return 0;
}
-#endif /* !defined(AP) && defined(WLP2P) */
+#endif
int
dhd_preinit_ioctls(dhd_pub_t *dhd)
{
@@ -3409,89 +3538,80 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
char eventmask[WL_EVENTING_MASK_LEN];
char iovbuf[WL_EVENTING_MASK_LEN + 12]; /* Room for "event_msgs" + '\0' + bitvec */
+#if !defined(WL_CFG80211)
uint up = 0;
+#endif /* !defined(WL_CFG80211) */
uint power_mode = PM_FAST;
uint32 dongle_align = DHD_SDALIGN;
-#if defined(BCM4334_CHIP)
- uint32 glom = 5; /* 2012.02.21 for perfomance */
- uint32 bcn_li_bcn = 1;
-#elif defined(BCM43241_CHIP)
- uint32 glom = 1;
-#else
- uint32 glom = 0;
-#endif
+ uint32 glom = CUSTOM_GLOM_SETTING;
#if defined(VSDB) || defined(ROAM_ENABLE)
uint bcn_timeout = 8;
#else
uint bcn_timeout = 4;
#endif
+#ifdef ENABLE_BCN_LI_BCN_WAKEUP
+ uint32 bcn_li_bcn = 1;
+#endif /* ENABLE_BCN_LI_BCN_WAKEUP */
uint retry_max = 3;
#if defined(ARP_OFFLOAD_SUPPORT)
int arpoe = 1;
#endif
int scan_assoc_time = DHD_SCAN_ACTIVE_TIME;
- int scan_unassoc_time = 80;
+ int scan_unassoc_time = DHD_SCAN_UNASSOC_ACTIVE_TIME;
int scan_passive_time = DHD_SCAN_PASSIVE_TIME;
char buf[WLC_IOCTL_SMLEN];
char *ptr;
uint32 listen_interval = LISTEN_INTERVAL; /* Default Listen Interval in Beacons */
-#ifdef CUSTOMER_HW_SAMSUNG
#ifdef ROAM_ENABLE
uint roamvar = 0;
- int roam_trigger[2] = {WL_AUTO_ROAM_TRIGGER, WLC_BAND_ALL};
+ int roam_trigger[2] = {-75, WLC_BAND_ALL};
int roam_scan_period[2] = {10, WLC_BAND_ALL};
int roam_delta[2] = {10, WLC_BAND_ALL};
+#ifdef ROAM_AP_ENV_DETECTION
int roam_env_mode = AP_ENV_INDETERMINATE;
+#endif /* ROAM_AP_ENV_DETECTION */
#ifdef FULL_ROAMING_SCAN_PERIOD_60_SEC
int roam_fullscan_period = 60;
#else /* FULL_ROAMING_SCAN_PERIOD_60_SEC */
int roam_fullscan_period = 120;
#endif /* FULL_ROAMING_SCAN_PERIOD_60_SEC */
#else
+#ifdef DISABLE_BUILTIN_ROAM
uint roamvar = 1;
+#endif /* DISABLE_BUILTIN_ROAM */
#endif /* ROAM_ENABLE */
-#ifdef WL_CFG80211
-#ifdef SOFTAP_DISABLE_WMM
- uint32 wme = 0;
-#endif /* SOFTAP_DISABLE_WMM */
- uint32 vlan_mode = 0;
-#endif /* WL_CFG80211 */
-#endif /* CUSTOMER_HW_SAMSUNG */
+
#if defined(SOFTAP)
uint dtim = 1;
#endif
#if (defined(AP) && !defined(WLP2P)) || (!defined(AP) && defined(WL_CFG80211))
uint32 mpc = 0; /* Turn MPC off for AP/APSTA mode */
+ struct ether_addr p2p_ea;
#endif
#if defined(AP) || defined(WLP2P)
uint32 apsta = 1; /* Enable APSTA mode */
- struct ether_addr p2p_ea;
#endif /* defined(AP) || defined(WLP2P) */
#ifdef GET_CUSTOM_MAC_ENABLE
struct ether_addr ea_addr;
#endif /* GET_CUSTOM_MAC_ENABLE */
#ifdef OKC_SUPPORT
uint32 okc = 1;
-#endif /* OKC_SUPPORT */
-
-#ifdef VLAN_MODE_OFF
- int vlanmode = 0;
-#endif /* VLAN_MODE_OFF */
-#ifdef BCM43241_CHIP
- int mimo_bw_cap = 2;
-#endif /* BCM43241_CHIP */
-#ifdef AUTOCOUNTRY
- int autocountry = 1;
-#endif
-#ifdef VSDB
+#endif
+#ifdef DISABLE_11N
+ uint32 nmode = 0;
+#else
+#ifdef AMPDU_HOSTREORDER
+ uint32 hostreorder = 1;
+#endif
+#endif /* DISABLE_11N */
+#if defined(VSDB) && defined(CUSTOMER_HW4)
int interference_mode = 3;
#endif
#ifdef PROP_TXSTATUS
dhd->wlfc_enabled = FALSE;
/* enable WLFC only if the firmware is VSDB */
#endif /* PROP_TXSTATUS */
-
DHD_TRACE(("Enter %s\n", __FUNCTION__));
dhd->op_mode = 0;
#ifdef GET_CUSTOM_MAC_ENABLE
@@ -3504,6 +3624,7 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
DHD_ERROR(("%s: can't set MAC address , error=%d\n", __FUNCTION__, ret));
return BCME_NOTUP;
}
+ memcpy(dhd->mac.octet, ea_addr.octet, ETHER_ADDR_LEN);
} else {
#endif /* GET_CUSTOM_MAC_ENABLE */
/* Get the default device MAC address directly from firmware */
@@ -3521,13 +3642,22 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
}
#endif /* GET_CUSTOM_MAC_ENABLE */
+
+ if ((!op_mode && strstr(fw_path, "_apsta") != NULL) || (op_mode == HOSTAPD_MASK)) {
#ifdef SET_RANDOM_MAC_SOFTAP
- if ((!op_mode && strstr(fw_path, "_apsta") != NULL) || (op_mode == 0x02)) {
uint rand_mac;
-
+#endif
+ op_mode = HOSTAPD_MASK;
+#if defined(ARP_OFFLOAD_SUPPORT)
+ arpoe = 0;
+#endif
+#ifdef PKT_FILTER_SUPPORT
+ dhd_pkt_filter_enable = FALSE;
+#endif
+#ifdef SET_RANDOM_MAC_SOFTAP
srandom32((uint)jiffies);
rand_mac = random32();
- iovbuf[0] = 0x02; /* locally administered bit */
+ iovbuf[0] = 0x02; /* locally administered bit */
iovbuf[1] = 0x1A;
iovbuf[2] = 0x11;
iovbuf[3] = (unsigned char)(rand_mac & 0x0F) | 0xF0;
@@ -3540,90 +3670,66 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
DHD_ERROR(("%s: can't set MAC address , error=%d\n", __FUNCTION__, ret));
} else
memcpy(dhd->mac.octet, iovbuf, ETHER_ADDR_LEN);
- }
#endif /* SET_RANDOM_MAC_SOFTAP */
+#if !defined(AP) && defined(WL_CFG80211)
+ /* Turn off MPC in AP mode */
+ bcm_mkiovar("mpc", (char *)&mpc, 4, iovbuf, sizeof(iovbuf));
+ if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf,
+ sizeof(iovbuf), TRUE, 0)) < 0) {
+ DHD_ERROR(("%s mpc for HostAPD failed %d\n", __FUNCTION__, ret));
+ }
+#endif
- DHD_TRACE(("Firmware = %s\n", fw_path));
-#if !defined(AP) && defined(WLP2P)
- /* Check if firmware with WFD support used */
- if ((!op_mode && strstr(fw_path, "_p2p") != NULL) || (op_mode == 0x04) ||
- (dhd_concurrent_fw(dhd))) {
- bcm_mkiovar("apsta", (char *)&apsta, 4, iovbuf, sizeof(iovbuf));
- if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR,
- iovbuf, sizeof(iovbuf), TRUE, 0)) < 0) {
- DHD_ERROR(("%s APSTA for WFD failed ret= %d\n", __FUNCTION__, ret));
- } else if (!dhd_concurrent_fw(dhd)) {
- dhd->op_mode |= WFD_MASK;
+ }
+ else {
+ int concurrent_capab = 0;
+ if ((!op_mode && strstr(fw_path, "_p2p") != NULL) || (op_mode == WFD_MASK)) {
#if defined(ARP_OFFLOAD_SUPPORT)
arpoe = 0;
-#endif /* (ARP_OFFLOAD_SUPPORT) */
+#endif
+#ifdef PKT_FILTER_SUPPORT
dhd_pkt_filter_enable = FALSE;
+#endif
+ op_mode = WFD_MASK;
}
-
- memcpy(&p2p_ea, &dhd->mac, ETHER_ADDR_LEN);
- ETHER_SET_LOCALADDR(&p2p_ea);
- bcm_mkiovar("p2p_da_override", (char *)&p2p_ea,
- ETHER_ADDR_LEN, iovbuf, sizeof(iovbuf));
- if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR,
- iovbuf, sizeof(iovbuf), TRUE, 0)) < 0) {
- DHD_ERROR(("%s p2p_da_override ret= %d\n", __FUNCTION__, ret));
- } else {
- DHD_INFO(("dhd_preinit_ioctls: p2p_da_override succeeded\n"));
+ else
+ op_mode = STA_MASK;
+#if !defined(AP) && defined(WLP2P)
+ if ((concurrent_capab = dhd_get_concurrent_capabilites(dhd)) > 0) {
+ op_mode = STA_MASK | WFD_MASK;
+ if (concurrent_capab == 2)
+ op_mode = STA_MASK | WFD_MASK | CONCURRENT_MULTI_CHAN;
}
- }
-#endif /* (ARP_OFFLOAD_SUPPORT) */
-#if !defined(AP) && defined(WL_CFG80211)
- /* Check if firmware with HostAPD support used */
- if ((!op_mode && strstr(fw_path, "_apsta") != NULL) || (op_mode == 0x02)) {
-#ifdef CUSTOMER_HW_SAMSUNG
-#ifdef SOFTAP_DISABLE_WMM
- /* WMM disable to avoid SoftAP hangup */
- bcm_mkiovar("wme", (char *)&wme, 4,
- iovbuf, sizeof(iovbuf));
- if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf,
- sizeof(iovbuf), TRUE, 0)) < 0) {
- DHD_ERROR(("%s disable wme for HostAPD"
- " failed %d\n", __FUNCTION__, ret));
- }
-#endif /* SOFTAP_DISABLE_WMM */
+ /* Check if we are enabling p2p */
+ if (op_mode & WFD_MASK) {
+ bcm_mkiovar("apsta", (char *)&apsta, 4, iovbuf, sizeof(iovbuf));
+ if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR,
+ iovbuf, sizeof(iovbuf), TRUE, 0)) < 0) {
+ DHD_ERROR(("%s APSTA for WFD failed ret= %d\n", __FUNCTION__, ret));
+ }
- /* VLAN tagging disable to avoid SoftAP hangup */
- bcm_mkiovar("vlan_mode", (char *)&vlan_mode, 4,
- iovbuf, sizeof(iovbuf));
- if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf,
- sizeof(iovbuf), TRUE, 0)) < 0) {
- DHD_ERROR(("%s disable VLAN tagging for"
- " HostAPD failed %d\n",
- __FUNCTION__, ret));
- }
-#endif /* CUSTOMER_HW_SAMSUNG */
- /* Turn off MPC in AP mode */
- bcm_mkiovar("mpc", (char *)&mpc, 4, iovbuf, sizeof(iovbuf));
- if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf,
- sizeof(iovbuf), TRUE, 0)) < 0) {
- DHD_ERROR(("%s mpc for HostAPD failed %d\n", __FUNCTION__, ret));
+ memcpy(&p2p_ea, &dhd->mac, ETHER_ADDR_LEN);
+ ETHER_SET_LOCALADDR(&p2p_ea);
+ bcm_mkiovar("p2p_da_override", (char *)&p2p_ea,
+ ETHER_ADDR_LEN, iovbuf, sizeof(iovbuf));
+ if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR,
+ iovbuf, sizeof(iovbuf), TRUE, 0)) < 0) {
+ DHD_ERROR(("%s p2p_da_override ret= %d\n", __FUNCTION__, ret));
} else {
- dhd->op_mode |= HOSTAPD_MASK;
-#if defined(ARP_OFFLOAD_SUPPORT)
- arpoe = 0;
-#endif /* (ARP_OFFLOAD_SUPPORT) */
- dhd_pkt_filter_enable = FALSE;
+ DHD_INFO(("dhd_preinit_ioctls: p2p_da_override succeeded\n"));
}
- }
-#endif /* (ARP_OFFLOAD_SUPPORT) */
-
- if ((dhd->op_mode != WFD_MASK) && (dhd->op_mode != HOSTAPD_MASK)) {
- /* STA only operation mode */
- dhd->op_mode |= STA_MASK;
- dhd_pkt_filter_enable = TRUE;
- if (dhd_concurrent_fw(dhd)) {
- dhd->op_mode |= WFD_MASK;
}
+#else
+ (void)concurrent_capab;
+#endif
}
- DHD_ERROR(("Firmware up: op_mode=%d", dhd->op_mode));
-
+ dhd->op_mode = op_mode;
+ DHD_ERROR(("Firmware up: op_mode=%d, "
+ "Broadcom Dongle Host Driver mac="MACDBG"\n",
+ dhd->op_mode,
+ STR_TO_MACD(dhd->mac.octet)));
/* Set Country code */
if (dhd->dhd_cspec.ccode[0] != 0) {
bcm_mkiovar("country", (char *)&dhd->dhd_cspec,
@@ -3637,11 +3743,11 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0)) < 0)
DHD_ERROR(("%s assoc_listen failed %d\n", __FUNCTION__, ret));
-#ifdef CUSTOMER_HW_SAMSUNG
+#if defined(ROAM_ENABLE) || defined(DISABLE_BUILTIN_ROAM)
/* Disable built-in roaming to allowed ext supplicant to take care of roaming */
bcm_mkiovar("roam_off", (char *)&roamvar, 4, iovbuf, sizeof(iovbuf));
dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
-
+#endif /* ROAM_ENABLE || DISABLE_BUILTIN_ROAM */
#ifdef ROAM_ENABLE
dhd_wl_ioctl_cmd(dhd, WLC_SET_ROAM_TRIGGER, roam_trigger, sizeof(roam_trigger), TRUE, 0);
dhd_wl_ioctl_cmd(dhd, WLC_SET_ROAM_SCAN_PERIOD, roam_scan_period,
@@ -3649,27 +3755,23 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
dhd_wl_ioctl_cmd(dhd, WLC_SET_ROAM_DELTA, roam_delta, sizeof(roam_delta), TRUE, 0);
bcm_mkiovar("fullroamperiod", (char *)&roam_fullscan_period, 4, iovbuf, sizeof(iovbuf));
dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
+#ifdef ROAM_AP_ENV_DETECTION
if (roam_trigger[0] == WL_AUTO_ROAM_TRIGGER) {
- bcm_mkiovar("roam_env_detection", (char *)&roam_env_mode, 4, iovbuf, sizeof(iovbuf));
+ bcm_mkiovar("roam_env_detection", (char *)&roam_env_mode,
+ 4, iovbuf, sizeof(iovbuf));
if (dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0) == BCME_OK)
dhd->roam_env_detection = TRUE;
else
dhd->roam_env_detection = FALSE;
}
-#endif
+#endif /* ROAM_AP_ENV_DETECTION */
+#endif /* ROAM_ENABLE */
#ifdef OKC_SUPPORT
bcm_mkiovar("okc_enable", (char *)&okc, 4, iovbuf, sizeof(iovbuf));
dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
#endif
-#ifdef AUTOCOUNTRY
- bcm_mkiovar("autocountry", (char *)&autocountry, 4, iovbuf, sizeof(iovbuf));
- dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
-#endif
-
-#endif /* CUSTOMER_HW_SAMSUNG */
-
#ifdef CONFIG_CONTROL_PM
sec_control_pm(dhd, &power_mode);
#else
@@ -3681,7 +3783,7 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
bcm_mkiovar("bus:txglomalign", (char *)&dongle_align, 4, iovbuf, sizeof(iovbuf));
dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
- /* disable glom option per default */
+ DHD_INFO(("%s set glom=0x%X\n", __FUNCTION__, glom));
bcm_mkiovar("bus:txglom", (char *)&glom, 4, iovbuf, sizeof(iovbuf));
dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
@@ -3699,16 +3801,15 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
#endif /* defined(AP) && !defined(WLP2P) */
-#ifdef BCM43241_CHIP
- bcm_mkiovar("mimo_bw_cap", (char *)&mimo_bw_cap, 4, iovbuf, sizeof(iovbuf));
- dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
-#endif
+#if defined(CUSTOMER_HW4) && defined(MIMO_ANT_SETTING)
+ dhd_sel_ant_from_file(dhd);
+#endif /* defined(CUSTOMER_HW4) && defined(MIMO_ANT_SETTING) */
#if defined(SOFTAP)
if (ap_fw_loaded == TRUE) {
dhd_wl_ioctl_cmd(dhd, WLC_SET_DTIMPRD, (char *)&dtim, sizeof(dtim), TRUE, 0);
}
-#endif
+#endif
#if defined(KEEP_ALIVE)
{
@@ -3717,11 +3818,11 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
#if defined(SOFTAP)
if (ap_fw_loaded == FALSE)
-#endif
- if ((dhd->op_mode & HOSTAPD_MASK) != HOSTAPD_MASK) {
- if ((res = dhd_keep_alive_onoff(dhd)) < 0)
- DHD_ERROR(("%s set keeplive failed %d\n",
- __FUNCTION__, res));
+#endif
+ if ((dhd->op_mode & HOSTAPD_MASK) != HOSTAPD_MASK) {
+ if ((res = dhd_keep_alive_onoff(dhd)) < 0)
+ DHD_ERROR(("%s set keeplive failed %d\n",
+ __FUNCTION__, res));
}
}
#endif /* defined(KEEP_ALIVE) */
@@ -3738,6 +3839,7 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
setbit(eventmask, WLC_E_SET_SSID);
setbit(eventmask, WLC_E_PRUNE);
setbit(eventmask, WLC_E_AUTH);
+ setbit(eventmask, WLC_E_ASSOC);
setbit(eventmask, WLC_E_REASSOC);
setbit(eventmask, WLC_E_REASSOC_IND);
setbit(eventmask, WLC_E_DEAUTH);
@@ -3754,8 +3856,8 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
setbit(eventmask, WLC_E_ASSOC_RESP_IE);
#ifndef WL_CFG80211
setbit(eventmask, WLC_E_PMKID_CACHE);
-#endif
setbit(eventmask, WLC_E_TXFAIL);
+#endif
setbit(eventmask, WLC_E_JOIN_START);
setbit(eventmask, WLC_E_SCAN_COMPLETE);
#ifdef WLMEDIA_HTSF
@@ -3764,11 +3866,12 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
#ifdef PNO_SUPPORT
setbit(eventmask, WLC_E_PFN_NET_FOUND);
#endif /* PNO_SUPPORT */
-#ifdef USE_FW_TRACE
- setbit(eventmask, WLC_E_TRACE);
-#endif
/* enable dongle roaming event */
setbit(eventmask, WLC_E_ROAM);
+#ifdef BCMCCX
+ setbit(eventmask, WLC_E_ADDTS_IND);
+ setbit(eventmask, WLC_E_DELTS_IND);
+#endif /* BCMCCX */
#ifdef WL_CFG80211
setbit(eventmask, WLC_E_ESCAN_RESULT);
if ((dhd->op_mode & WFD_MASK) == WFD_MASK) {
@@ -3777,13 +3880,12 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
setbit(eventmask, WLC_E_ACTION_FRAME_OFF_CHAN_COMPLETE);
setbit(eventmask, WLC_E_P2P_DISC_LISTEN_COMPLETE);
}
+#if defined(CUSTOMER_HW4) && defined(WES_SUPPORT)
+ else {
+ setbit(eventmask, WLC_E_ACTION_FRAME_RX);
+ }
+#endif /* WES_SUPPORT */
#endif /* WL_CFG80211 */
-#ifdef OKC_DEBUG
- setbit(eventmask, WLC_E_ROAM_START);
-#endif /* OKC_DEBUG */
-#ifdef CUSTOMER_HW_SAMSUNG
- clrbit(eventmask, WLC_E_TXFAIL);
-#endif
/* Write updated Event mask */
bcm_mkiovar("event_msgs", eventmask, WL_EVENTING_MASK_LEN, iovbuf, sizeof(iovbuf));
@@ -3805,8 +3907,8 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
if (arpoe && !ap_fw_loaded) {
#else
if (arpoe) {
-#endif
- dhd_arp_offload_enable(dhd, arpoe);
+#endif
+ dhd_arp_offload_enable(dhd, TRUE);
dhd_arp_offload_set(dhd, dhd_arp_mode);
} else {
dhd_arp_offload_enable(dhd, FALSE);
@@ -3815,49 +3917,79 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
#endif /* ARP_OFFLOAD_SUPPORT */
#ifdef PKT_FILTER_SUPPORT
- /* Setup defintions for pktfilter , enable in suspend */
- dhd->pktfilter_count = 1;
+ /* Setup default defintions for pktfilter , enable in suspend */
+ dhd->pktfilter_count = 5;
+ /* Setup filter to allow only unicast */
dhd->pktfilter[0] = "100 0 0 0 0x01 0x00";
+ dhd->pktfilter[1] = NULL;
+ dhd->pktfilter[2] = NULL;
+ dhd->pktfilter[3] = NULL;
+ /* Add filter to pass multicastDNS packet and NOT filter out as Broadcast */
+ dhd->pktfilter[4] = "104 0 0 0 0xFFFFFFFFFFFF 0x01005E0000FB";
+
+#ifdef CUSTOMER_HW4
+#ifdef GAN_LITE_NAT_KEEPALIVE_FILTER
+ dhd->pktfilter_count = 4;
+ /* Setup filter to block broadcast and NAT Keepalive packets */
+ dhd->pktfilter[0] = "100 0 0 0 0xffffff 0xffffff"; /* discard all broadcast packets */
+ dhd->pktfilter[1] = "102 0 0 36 0xffffffff 0x11940009"; /* discard NAT Keepalive packets */
+ dhd->pktfilter[2] = "104 0 0 38 0xffffffff 0x11940009"; /* discard NAT Keepalive packets */
+ dhd->pktfilter[3] = NULL;
+#else
+ /* Setup filter to allow only unicast */
+#if defined(BLOCK_IPV6_PACKET)
+ dhd->pktfilter[0] = "100 0 0 0 "
+ HEX_PREF_STR UNI_FILTER_STR ZERO_ADDR_STR ETHER_TYPE_STR IPV6_FILTER_STR
+ " "
+ HEX_PREF_STR ZERO_ADDR_STR ZERO_ADDR_STR ETHER_TYPE_STR ZERO_TYPE_STR;
+#else
+ dhd->pktfilter[0] = "100 0 0 0 0x01 0x00";
+#endif /* BLOCK_IPV6_PACKET */
+#if defined(PASS_IPV4_SUSPEND)
+ dhd->pktfilter_count = 5;
+ dhd->pktfilter[4] = "104 0 0 0 0xFFFFFF 0x01005E";
+#endif
+#endif /* GAN_LITE_NAT_KEEPALIVE_FILTER */
+#ifdef PASS_ARP_PACKET
+ dhd->pktfilter[dhd->pktfilter_count++] = "105 0 0 12 0xFFFF 0x0806";
+#endif
+#endif /* CUSTOMER_HW4 */
#if defined(SOFTAP)
if (ap_fw_loaded) {
- int i;
- for (i = 0; i < dhd->pktfilter_count; i++) {
- dhd_pktfilter_offload_enable(dhd, dhd->pktfilter[i],
- 0, dhd_master_mode);
- }
+ dhd_enable_packet_filter(0, dhd);
}
#endif /* defined(SOFTAP) */
- if (dhd->pktfilter_count) {
- int i;
-
- for (i = 0; i < dhd->pktfilter_count; i++)
- dhd_pktfilter_offload_set(dhd, dhd->pktfilter[i]);
- }
+ dhd_set_packet_filter(dhd);
#endif /* PKT_FILTER_SUPPORT */
+#ifdef DISABLE_11N
+ bcm_mkiovar("nmode", (char *)&nmode, 4, iovbuf, sizeof(iovbuf));
+ if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0)) < 0)
+ DHD_ERROR(("%s wl nmode 0 failed %d\n", __FUNCTION__, ret));
+#else
+#ifdef AMPDU_HOSTREORDER
+ bcm_mkiovar("ampdu_hostreorder", (char *)&hostreorder, 4, buf, sizeof(buf));
+ dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, buf, sizeof(buf), TRUE, 0);
+#endif /* AMPDU_HOSTREORDER */
+#endif /* DISABLE_11N */
-#ifdef VLAN_MODE_OFF
- bcm_mkiovar("vlan_mode", (char *)&vlanmode, 4, iovbuf, sizeof(iovbuf));
- dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
-#endif /* VLAN_MODE_OFF */
-#ifdef GLOBALCONFIG_WLAN_COUNTRY_CODE
- if (dhd_customer_set_country(dhd) < 0)
- DHD_ERROR(("%s: can't set country \n", __FUNCTION__));
-#endif
-
+#if !defined(WL_CFG80211)
/* Force STA UP */
if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_UP, (char *)&up, sizeof(up), TRUE, 0)) < 0) {
DHD_ERROR(("%s Setting WL UP failed %d\n", __FUNCTION__, ret));
goto done;
}
-#ifdef VSDB
- dhd_wl_ioctl_cmd(dhd, WLC_SET_INTERFERENCE_MODE, (int *)&interference_mode, sizeof(int), TRUE, 0);
#endif
-#ifdef BCM4334_CHIP
+#if defined(VSDB) && defined(CUSTOMER_HW4)
+ dhd_wl_ioctl_cmd(dhd, WLC_SET_INTERFERENCE_MODE,
+ (int *)&interference_mode, sizeof(int), TRUE, 0);
+#endif
+
+#ifdef ENABLE_BCN_LI_BCN_WAKEUP
bcm_mkiovar("bcn_li_bcn", (char *)&bcn_li_bcn, 4, iovbuf, sizeof(iovbuf));
dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
-#endif
+#endif /* ENABLE_BCN_LI_BCN_WAKEUP */
/* query for 'ver' to get version info from firmware */
memset(buf, 0, sizeof(buf));
@@ -3869,6 +4001,18 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
bcmstrtok(&ptr, "\n", 0);
/* Print fw version info */
DHD_ERROR(("Firmware version = %s\n", buf));
+
+ dhd_set_version_info(dhd, buf);
+
+ DHD_BLOG(buf, strlen(buf) + 1);
+ DHD_BLOG(dhd_version, strlen(dhd_version) + 1);
+
+ /* Check and adjust IOCTL response timeout for Manufactring firmware */
+ if (strstr(buf, MANUFACTRING_FW) != NULL) {
+ dhd_os_set_ioctl_resp_timeout(IOCTL_RESP_TIMEOUT * 10);
+ DHD_ERROR(("%s : adjust IOCTL response time for Manufactring Firmware\n",
+ __FUNCTION__));
+ }
}
done:
@@ -4036,7 +4180,7 @@ static int dhd_device_event(struct notifier_block *this,
if (!(ifa->ifa_label[strlen(ifa->ifa_label)-2] == 0x3a)) {
/* 0x3a = ':' */
DHD_ARPOE(("%s: primary interface is down, AOE clr all\n",
- __FUNCTION__));
+ __FUNCTION__));
dhd_aoe_hostip_clr(&dhd->pub);
dhd_aoe_arp_clr(&dhd->pub);
} else
@@ -4057,6 +4201,7 @@ static int dhd_device_event(struct notifier_block *this,
return NOTIFY_DONE;
}
#endif /* ARP_OFFLOAD_SUPPORT */
+
int
dhd_net_attach(dhd_pub_t *dhdp, int ifidx)
{
@@ -4065,7 +4210,7 @@ dhd_net_attach(dhd_pub_t *dhdp, int ifidx)
int err = 0;
uint8 temp_addr[ETHER_ADDR_LEN] = { 0x00, 0x90, 0x4c, 0x11, 0x22, 0x33 };
- DHD_TRACE(("%s: ifidx %d\n", __FUNCTION__, ifidx));
+ DHD_ERROR(("%s: ifidx %d\n", __FUNCTION__, ifidx));
ASSERT(dhd && dhd->iflist[ifidx]);
@@ -4096,7 +4241,8 @@ dhd_net_attach(dhd_pub_t *dhdp, int ifidx)
#else
net->netdev_ops = &dhd_ops_pri;
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31) */
- memcpy(temp_addr, dhd->pub.mac.octet, ETHER_ADDR_LEN);
+ if (!ETHER_ISNULLADDR(dhd->pub.mac.octet))
+ memcpy(temp_addr, dhd->pub.mac.octet, ETHER_ADDR_LEN);
} else {
/*
* We have to use the primary MAC for virtual interfaces
@@ -4137,19 +4283,25 @@ dhd_net_attach(dhd_pub_t *dhdp, int ifidx)
DHD_ERROR(("couldn't register the net device, err %d\n", err));
goto fail;
}
- printf("Broadcom Dongle Host Driver: register interface [%s]",
- net->name);
+ printf("Broadcom Dongle Host Driver: register interface [%s]"
+ " MAC: "MACDBG"\n",
+ net->name,
+#if defined(CUSTOMER_HW4)
+ STR_TO_MACD(dhd->pub.mac.octet));
+#else
+ STR_TO_MACD(net->dev_addr));
+#endif /* CUSTOMER_HW4 */
#if defined(SOFTAP) && defined(CONFIG_WIRELESS_EXT) && !defined(WL_CFG80211)
wl_iw_iscan_set_scan_broadcast_prep(net, 1);
#endif
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
+#if 1 && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
if (ifidx == 0) {
dhd_registration_check = TRUE;
up(&dhd_registration_sem);
}
-#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) */
+#endif
return 0;
fail:
@@ -4184,9 +4336,9 @@ dhd_bus_detach(dhd_pub_t *dhdp)
dhd_bus_stop(dhd->pub.bus, TRUE);
}
-#if defined(OOB_INTR_ONLY)
+#if defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID)
bcmsdh_unregister_oob_intr();
-#endif /* defined(OOB_INTR_ONLY) */
+#endif /* defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID) */
}
}
}
@@ -4207,44 +4359,35 @@ void dhd_detach(dhd_pub_t *dhdp)
DHD_TRACE(("%s: Enter state 0x%x\n", __FUNCTION__, dhd->dhd_state));
-#ifdef CUSTOMER_HW_SAMSUNG
- /*
- * CSP #506108
- * kernel panic issue when first bootup time,
- * rmmod without interface down make unnecessary hang event.
- */
dhd->pub.up = 0;
-#endif
-
if (!(dhd->dhd_state & DHD_ATTACH_STATE_DONE)) {
/* Give sufficient time for threads to start running in case
* dhd_attach() has failed
*/
osl_delay(1000*100);
}
-#ifdef CUSTOMER_HW_SAMSUNG
- /* CSP#482857: Change the location of dhd_bus_detach()
- * to avoid Kernel panic problem
- */
+
if (dhd->dhd_state & DHD_ATTACH_STATE_PROT_ATTACH) {
dhd_bus_detach(dhdp);
if (dhdp->prot)
dhd_prot_detach(dhdp);
}
-#endif /* CUSTOMER_HW_SAMSUNG */
#ifdef ARP_OFFLOAD_SUPPORT
unregister_inetaddr_notifier(&dhd_notifier);
#endif /* ARP_OFFLOAD_SUPPORT */
-#if defined(CONFIG_HAS_EARLYSUSPEND)
+#if defined(CONFIG_HAS_EARLYSUSPEND) && defined(DHD_USE_EARLYSUSPEND)
if (dhd->dhd_state & DHD_ATTACH_STATE_EARLYSUSPEND_DONE) {
if (dhd->early_suspend.suspend)
unregister_early_suspend(&dhd->early_suspend);
}
#endif /* defined(CONFIG_HAS_EARLYSUSPEND) */
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
+ cancel_work_sync(&dhd->work_hang);
+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) */
#if defined(CONFIG_WIRELESS_EXT)
if (dhd->dhd_state & DHD_ATTACH_STATE_WL_ATTACH) {
@@ -4263,20 +4406,21 @@ void dhd_detach(dhd_pub_t *dhdp)
dhd_if_t *ifp;
/* Cleanup virtual interfaces */
- for (i = 1; i < DHD_MAX_IFS; i++)
+ for (i = 1; i < DHD_MAX_IFS; i++) {
+ dhd_net_if_lock_local(dhd);
if (dhd->iflist[i]) {
dhd->iflist[i]->state = DHD_IF_DEL;
dhd->iflist[i]->idx = i;
dhd_op_if(dhd->iflist[i]);
}
+ dhd_net_if_unlock_local(dhd);
+ }
/* delete primary interface 0 */
ifp = dhd->iflist[0];
ASSERT(ifp);
ASSERT(ifp->net);
- if (ifp && ifp->net)
- {
-
+ if (ifp && ifp->net) {
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31))
if (ifp->net->open)
#else
@@ -4313,14 +4457,6 @@ void dhd_detach(dhd_pub_t *dhdp)
#endif /* DHDTHREAD */
tasklet_kill(&dhd->tasklet);
}
-#ifndef CUSTOMER_HW_SAMSUNG
- if (dhd->dhd_state & DHD_ATTACH_STATE_PROT_ATTACH) {
- dhd_bus_detach(dhdp);
-
- if (dhdp->prot)
- dhd_prot_detach(dhdp);
- }
-#endif /* CUSTOMER_HW_SAMSUNG */
#ifdef WL_CFG80211
if (dhd->dhd_state & DHD_ATTACH_STATE_CFG80211) {
@@ -4338,13 +4474,15 @@ void dhd_detach(dhd_pub_t *dhdp)
if (dhd->dhd_state & DHD_ATTACH_STATE_WAKELOCKS_INIT) {
#ifdef CONFIG_HAS_WAKELOCK
dhd->wakelock_counter = 0;
- dhd->wakelock_timeout_enable = 0;
+ dhd->wakelock_rx_timeout_enable = 0;
+ dhd->wakelock_ctrl_timeout_enable = 0;
wake_lock_destroy(&dhd->wl_wifi);
wake_lock_destroy(&dhd->wl_rxwake);
-#ifdef PNO_SUPPORT
+ wake_lock_destroy(&dhd->wl_ctrlwake);
+#if defined(CUSTOMER_HW4) && defined(PNO_SUPPORT)
wake_lock_destroy(&dhdp->pno_wakelock);
#endif
-#endif
+#endif /* CONFIG_HAS_WAKELOCK */
}
}
@@ -4400,10 +4538,10 @@ dhd_module_init(void)
{
int error = 0;
-#if 1 && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
+#if 1 && defined(BCMLXSDMMC) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
int retry = POWERUP_MAX_RETRY;
int chip_up = 0;
-#endif
+#endif
DHD_TRACE(("%s: Enter\n", __FUNCTION__));
@@ -4423,7 +4561,7 @@ dhd_module_init(void)
DHD_ERROR(("Invalid module parameters.\n"));
return -EINVAL;
} while (0);
-#endif
+#endif
#if 1 && defined(BCMLXSDMMC) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
do {
@@ -4461,15 +4599,18 @@ dhd_module_init(void)
if (wl_android_wifictrl_func_add() < 0)
goto fail_1;
#endif /* defined(CONFIG_WIFI_CONTROL_FUNC) */
-#endif /* BCMLXSDMMC */
+
+#endif
#if 1 && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
sema_init(&dhd_registration_sem, 0);
-#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) */
+#endif
+
+
error = dhd_bus_register();
if (!error)
- DHD_TRACE(("%s: \n%s\n", __FUNCTION__, dhd_version));
+ printf("\n%s\n", dhd_version);
else {
DHD_ERROR(("%s: sdio_register_driver failed\n", __FUNCTION__));
goto fail_1;
@@ -4481,15 +4622,11 @@ dhd_module_init(void)
* It's needed to make sync up exit from dhd insmod and
* Kernel MMC sdio device callback registration
*/
- if (down_timeout(&dhd_registration_sem, msecs_to_jiffies(DHD_REGISTRATION_TIMEOUT)) != 0) {
+ if ((down_timeout(&dhd_registration_sem,
+ msecs_to_jiffies(DHD_REGISTRATION_TIMEOUT)) != 0) ||
+ (dhd_registration_check != TRUE)) {
error = -ENODEV;
- DHD_ERROR(("%s: sdio_register_driver timeout\n", __FUNCTION__));
- goto fail_2;
- }
- if (dhd_registration_check != TRUE)
- {
- error = -ENODEV;
- DHD_ERROR(("%s: sdio_register_driver fail\n", __FUNCTION__));
+ DHD_ERROR(("%s: sdio_register_driver timeout or error \n", __FUNCTION__));
goto fail_2;
}
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) */
@@ -4508,7 +4645,7 @@ fail_1:
#if defined(CONFIG_WIFI_CONTROL_FUNC)
wl_android_wifictrl_func_del();
-#endif
+#endif
/* Call customer gpio to turn off power with WL_REG_ON signal */
dhd_customer_gpio_wlan_ctrl(WLAN_POWER_OFF);
@@ -4569,36 +4706,16 @@ int
dhd_os_ioctl_resp_wait(dhd_pub_t *pub, uint *condition, bool *pending)
{
dhd_info_t * dhd = (dhd_info_t *)(pub->info);
- DECLARE_WAITQUEUE(wait, current);
- int timeout = dhd_ioctl_timeout_msec;
+ int timeout;
/* Convert timeout in millsecond to jiffies */
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
- timeout = msecs_to_jiffies(timeout);
+ timeout = msecs_to_jiffies(dhd_ioctl_timeout_msec);
#else
- timeout = timeout * HZ / 1000;
+ timeout = dhd_ioctl_timeout_msec * HZ / 1000;
#endif
- /* Wait until control frame is available */
- add_wait_queue(&dhd->ioctl_resp_wait, &wait);
- set_current_state(TASK_INTERRUPTIBLE);
-
- /* Memory barrier to support multi-processing
- * As the variable "condition", which points to dhd->rxlen (dhd_bus_rxctl[dhd_sdio.c])
- * Can be changed by another processor.
- */
- smp_mb();
- while (!(*condition) && (!signal_pending(current) && timeout)) {
- timeout = schedule_timeout(timeout);
- smp_mb();
- }
-
- if (signal_pending(current))
- *pending = TRUE;
-
- set_current_state(TASK_RUNNING);
- remove_wait_queue(&dhd->ioctl_resp_wait, &wait);
-
+ timeout = wait_event_timeout(dhd->ioctl_resp_wait, (*condition), timeout);
return timeout;
}
@@ -4608,7 +4725,7 @@ dhd_os_ioctl_resp_wake(dhd_pub_t *pub)
dhd_info_t *dhd = (dhd_info_t *)(pub->info);
if (waitqueue_active(&dhd->ioctl_resp_wait)) {
- wake_up_interruptible(&dhd->ioctl_resp_wait);
+ wake_up(&dhd->ioctl_resp_wait);
}
return 0;
@@ -4634,11 +4751,10 @@ dhd_os_wd_timer(void *bus, uint wdtick)
return;
}
- /* Totally stop the timer */
+ /* totally stop the timer */
if (!wdtick && dhd->wd_timer_valid == TRUE) {
dhd->wd_timer_valid = FALSE;
dhd_os_spin_unlock(pub, flags);
- if (dhd)
#ifdef DHDTHREAD
del_timer_sync(&dhd->timer);
#else
@@ -4650,7 +4766,7 @@ dhd_os_wd_timer(void *bus, uint wdtick)
if (wdtick) {
dhd_watchdog_ms = (uint)wdtick;
/* Re arm the timer, at last watchdog period */
- mod_timer(&dhd->timer, jiffies + dhd_watchdog_ms * HZ / 1000);
+ mod_timer(&dhd->timer, jiffies + msecs_to_jiffies(dhd_watchdog_ms));
dhd->wd_timer_valid = TRUE;
}
dhd_os_spin_unlock(pub, flags);
@@ -4949,7 +5065,7 @@ dhd_sendup_event(dhd_pub_t *dhdp, wl_event_msg_t *event, void *data)
else {
/* Could not allocate a sk_buf */
DHD_ERROR(("%s: unable to alloc sk_buf", __FUNCTION__));
-}
+ }
break;
} /* case WLC_E_BTA_HCI_EVENT */
#endif /* WLBTAMP */
@@ -4963,10 +5079,17 @@ void dhd_wait_for_event(dhd_pub_t *dhd, bool *lockvar)
{
#if 1 && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0))
struct dhd_info *dhdinfo = dhd->info;
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
+ int timeout = msecs_to_jiffies(2000);
+#else
+ int timeout = 2 * HZ;
+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) */
+
dhd_os_sdunlock(dhd);
- wait_event_interruptible_timeout(dhdinfo->ctrl_wait, (*lockvar == FALSE), HZ * 5);
+ wait_event_timeout(dhdinfo->ctrl_wait, (*lockvar == FALSE), timeout);
dhd_os_sdlock(dhd);
-#endif
+#endif
return;
}
@@ -4975,7 +5098,7 @@ void dhd_wait_event_wakeup(dhd_pub_t *dhd)
#if 1 && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0))
struct dhd_info *dhdinfo = dhd->info;
if (waitqueue_active(&dhdinfo->ctrl_wait))
- wake_up_interruptible(&dhdinfo->ctrl_wait);
+ wake_up(&dhdinfo->ctrl_wait);
#endif
return;
}
@@ -4987,6 +5110,13 @@ dhd_dev_reset(struct net_device *dev, uint8 flag)
dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
+ if (flag == TRUE) {
+ /* Issue wl down command before resetting the chip */
+ if (dhd_wl_ioctl_cmd(&dhd->pub, WLC_DOWN, NULL, 0, TRUE, 0) < 0) {
+ DHD_TRACE(("%s: wl down failed\n", __FUNCTION__));
+ }
+ }
+
ret = dhd_bus_devreset(&dhd->pub, flag);
if (ret) {
DHD_ERROR(("%s: dhd_bus_devreset: %d\n", __FUNCTION__, ret));
@@ -5008,16 +5138,18 @@ int net_os_set_suspend_disable(struct net_device *dev, int val)
return ret;
}
-int net_os_set_suspend(struct net_device *dev, int val)
+int net_os_set_suspend(struct net_device *dev, int val, int force)
{
int ret = 0;
-#if defined(CONFIG_HAS_EARLYSUSPEND)
dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
if (dhd) {
+#if defined(CONFIG_HAS_EARLYSUSPEND) && defined(DHD_USE_EARLYSUSPEND)
ret = dhd_set_suspend(val, &dhd->pub);
+#else
+ ret = dhd_suspend_resume_helper(dhd, val, force);
+#endif
}
-#endif /* defined(CONFIG_HAS_EARLYSUSPEND) */
return ret;
}
@@ -5031,12 +5163,47 @@ int net_os_set_dtim_skip(struct net_device *dev, int val)
return 0;
}
+#ifdef PKT_FILTER_SUPPORT
int net_os_rxfilter_add_remove(struct net_device *dev, int add_remove, int num)
{
+#ifndef GAN_LITE_NAT_KEEPALIVE_FILTER
+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
+ char *filterp = NULL;
+ int ret = 0;
+
+ if (!dhd || (num == DHD_UNICAST_FILTER_NUM) ||
+ (num == DHD_MDNS_FILTER_NUM))
+ return ret;
+ if (num >= dhd->pub.pktfilter_count)
+ return -EINVAL;
+ if (add_remove) {
+ switch (num) {
+ case DHD_BROADCAST_FILTER_NUM:
+ filterp = "101 0 0 0 0xFFFFFFFFFFFF 0xFFFFFFFFFFFF";
+ break;
+ case DHD_MULTICAST4_FILTER_NUM:
+ filterp = "102 0 0 0 0xFFFFFF 0x01005E";
+ break;
+ case DHD_MULTICAST6_FILTER_NUM:
+#if defined(BLOCK_IPV6_PACKET)
+/* customer want to use NO IPV6 packets only */
+ return ret;
+#endif
+ filterp = "103 0 0 0 0xFFFF 0x3333";
+ break;
+ default:
+ return -EINVAL;
+ }
+ }
+ dhd->pub.pktfilter[num] = filterp;
+ dhd_pktfilter_offload_set(&dhd->pub, dhd->pub.pktfilter[num]);
+ return ret;
+#else
return 0;
+#endif /* GAN_LITE_NAT_KEEPALIVE_FILTER */
}
-int net_os_set_packet_filter(struct net_device *dev, int val)
+int net_os_enable_packet_filter(struct net_device *dev, int val)
{
dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
int ret = 0;
@@ -5049,26 +5216,24 @@ int net_os_set_packet_filter(struct net_device *dev, int val)
if (dhd && dhd->pub.up) {
if (dhd->pub.in_suspend) {
if (!val || (val && !dhd->pub.suspend_disable_flag)) {
- int i;
- for (i = 0; i < dhd->pub.pktfilter_count; i++)
- dhd_pktfilter_offload_enable(&dhd->pub, dhd->pub.pktfilter[i],
- val, dhd_master_mode);
+ dhd_enable_packet_filter(val, &dhd->pub);
}
}
}
return ret;
}
+#endif /* PKT_FILTER_SUPPORT */
-
-void
+int
dhd_dev_init_ioctl(struct net_device *dev)
{
dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
- /* Writing STA's MAC ID to the Dongle for SOFTAP */
- if (_dhd_set_mac_address(dhd, 0, &dhd->pub.mac) == 0)
- DHD_INFO(("dhd_bus_start: MAC ID is overwritten\n"));
-
- dhd_preinit_ioctls(&dhd->pub);
+#if defined(USE_STAMAC_4SOFTAP)
+ /* Writing STA's MAC ID to the Dongle for SOFTAP */
+ if (_dhd_set_mac_address(dhd, 0, &dhd->pub.mac) == 0)
+ DHD_INFO(("dhd_bus_start: MAC ID is overwritten\n"));
+#endif
+ return dhd_preinit_ioctls(&dhd->pub);
}
#ifdef PNO_SUPPORT
@@ -5113,37 +5278,75 @@ dhd_dev_get_pno_status(struct net_device *dev)
#endif /* PNO_SUPPORT */
-int net_os_send_hang_message(struct net_device *dev)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && (1)
+static void dhd_hang_process(struct work_struct *work)
{
- dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
- int ret = 0;
+ dhd_info_t *dhd;
+ struct net_device *dev;
- if (dhd) {
- if (!dhd->pub.hang_was_sent) {
- dhd->pub.hang_was_sent = 1;
-#if defined(CONFIG_WIRELESS_EXT)
- ret = wl_iw_send_priv_event(dev, "HANG");
+ dhd = (dhd_info_t *)container_of(work, dhd_info_t, work_hang);
+ dev = dhd->iflist[0]->net;
+
+ if (dev) {
+ rtnl_lock();
+ dev_close(dev);
+ rtnl_unlock();
+#if defined(WL_WIRELESS_EXT)
+ wl_iw_send_priv_event(dev, "HANG");
#endif
#if defined(WL_CFG80211)
- ret = wl_cfg80211_hang(dev, WLAN_REASON_UNSPECIFIED);
-#if !defined(CUSTOMER_HW_SAMSUNG)
-#error do not use these it cause kernel panic
- dev_close(dev);
- dev_open(dev);
+ wl_cfg80211_hang(dev, WLAN_REASON_UNSPECIFIED);
#endif
-#endif /* WL_CFG80211 */
+ }
+}
+
+int dhd_os_send_hang_message(dhd_pub_t *dhdp)
+{
+ int ret = 0;
+ if (dhdp) {
+ if (!dhdp->hang_was_sent) {
+ dhdp->hang_was_sent = 1;
+ schedule_work(&dhdp->info->work_hang);
}
}
return ret;
}
-void dhd_bus_country_set(struct net_device *dev, wl_country_t *cspec)
+int net_os_send_hang_message(struct net_device *dev)
{
dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
+ int ret = 0;
+
+ if (dhd)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
+ ret = dhd_os_send_hang_message(&dhd->pub);
+#else
+ ret = wl_cfg80211_hang(dev, WLAN_REASON_UNSPECIFIED);
+#endif
+ return ret;
+}
+#endif /* (OEM_ANDROID) */
- if (dhd && dhd->pub.up)
- memcpy(&dhd->pub.dhd_cspec, cspec, sizeof(wl_country_t));
+void dhd_bus_country_set(struct net_device *dev, wl_country_t *cspec)
+{
+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
+ if (dhd && dhd->pub.up) {
+ memcpy(&dhd->pub.dhd_cspec, cspec, sizeof(wl_country_t));
+#ifdef WL_CFG80211
+ wl_update_wiphybands(NULL);
+#endif
+ }
}
+void dhd_bus_band_set(struct net_device *dev, uint band)
+{
+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
+ if (dhd && dhd->pub.up) {
+#ifdef WL_CFG80211
+ wl_update_wiphybands(NULL);
+#endif
+ }
+}
+
void dhd_net_if_lock(struct net_device *dev)
{
@@ -5173,6 +5376,24 @@ static void dhd_net_if_unlock_local(dhd_info_t *dhd)
#endif
}
+static void dhd_suspend_lock(dhd_pub_t *pub)
+{
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) && 1
+ dhd_info_t *dhd = (dhd_info_t *)(pub->info);
+ if (dhd)
+ mutex_lock(&dhd->dhd_suspend_mutex);
+#endif
+}
+
+static void dhd_suspend_unlock(dhd_pub_t *pub)
+{
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) && 1
+ dhd_info_t *dhd = (dhd_info_t *)(pub->info);
+ if (dhd)
+ mutex_unlock(&dhd->dhd_suspend_mutex);
+#endif
+}
+
unsigned long dhd_os_spin_lock(dhd_pub_t *pub)
{
dhd_info_t *dhd = (dhd_info_t *)(pub->info);
@@ -5198,13 +5419,13 @@ dhd_get_pend_8021x_cnt(dhd_info_t *dhd)
return (atomic_read(&dhd->pend_8021x_cnt));
}
-#define MAX_WAIT_FOR_8021X_TX 10
+#define MAX_WAIT_FOR_8021X_TX 25
int
dhd_wait_pend8021x(struct net_device *dev)
{
dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
- int timeout = 10 * HZ / 1000;
+ int timeout = msecs_to_jiffies(10);
int ntimes = MAX_WAIT_FOR_8021X_TX;
int pend = dhd_get_pend_8021x_cnt(dhd);
@@ -5217,6 +5438,8 @@ dhd_wait_pend8021x(struct net_device *dev)
}
pend = dhd_get_pend_8021x_cnt(dhd);
}
+ if (ntimes == 0)
+ DHD_ERROR(("%s: TIMEOUT\n", __FUNCTION__));
return pend;
}
@@ -5265,13 +5488,18 @@ int dhd_os_wake_lock_timeout(dhd_pub_t *pub)
if (dhd) {
spin_lock_irqsave(&dhd->wakelock_spinlock, flags);
- ret = dhd->wakelock_timeout_enable;
+ ret = dhd->wakelock_rx_timeout_enable > dhd->wakelock_ctrl_timeout_enable ?
+ dhd->wakelock_rx_timeout_enable : dhd->wakelock_ctrl_timeout_enable;
#ifdef CONFIG_HAS_WAKELOCK
- if (dhd->wakelock_timeout_enable)
+ if (dhd->wakelock_rx_timeout_enable)
wake_lock_timeout(&dhd->wl_rxwake,
- msecs_to_jiffies(dhd->wakelock_timeout_enable));
+ msecs_to_jiffies(dhd->wakelock_rx_timeout_enable));
+ if (dhd->wakelock_ctrl_timeout_enable)
+ wake_lock_timeout(&dhd->wl_ctrlwake,
+ msecs_to_jiffies(dhd->wakelock_ctrl_timeout_enable));
#endif
- dhd->wakelock_timeout_enable = 0;
+ dhd->wakelock_rx_timeout_enable = 0;
+ dhd->wakelock_ctrl_timeout_enable = 0;
spin_unlock_irqrestore(&dhd->wakelock_spinlock, flags);
}
return ret;
@@ -5286,7 +5514,8 @@ int net_os_wake_lock_timeout(struct net_device *dev)
ret = dhd_os_wake_lock_timeout(&dhd->pub);
return ret;
}
-#if defined(PNO_SUPPORT) && defined(CONFIG_HAS_WAKELOCK)
+
+#if defined(CUSTOMER_HW4) && defined(PNO_SUPPORT) && defined(CONFIG_HAS_WAKELOCK)
int net_os_wake_lock_timeout_for_pno(struct net_device *dev, int sec)
{
dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
@@ -5302,27 +5531,51 @@ int net_os_wake_lock_timeout_for_pno(struct net_device *dev, int sec)
}
#endif
-int dhd_os_wake_lock_timeout_enable(dhd_pub_t *pub, int val)
+int dhd_os_wake_lock_rx_timeout_enable(dhd_pub_t *pub, int val)
+{
+ dhd_info_t *dhd = (dhd_info_t *)(pub->info);
+ unsigned long flags;
+
+ if (dhd) {
+ spin_lock_irqsave(&dhd->wakelock_spinlock, flags);
+ if (val > dhd->wakelock_rx_timeout_enable)
+ dhd->wakelock_rx_timeout_enable = val;
+ spin_unlock_irqrestore(&dhd->wakelock_spinlock, flags);
+ }
+ return 0;
+}
+
+int dhd_os_wake_lock_ctrl_timeout_enable(dhd_pub_t *pub, int val)
{
dhd_info_t *dhd = (dhd_info_t *)(pub->info);
unsigned long flags;
if (dhd) {
spin_lock_irqsave(&dhd->wakelock_spinlock, flags);
- if (val > dhd->wakelock_timeout_enable)
- dhd->wakelock_timeout_enable = val;
+ if (val > dhd->wakelock_ctrl_timeout_enable)
+ dhd->wakelock_ctrl_timeout_enable = val;
spin_unlock_irqrestore(&dhd->wakelock_spinlock, flags);
}
return 0;
}
-int net_os_wake_lock_timeout_enable(struct net_device *dev, int val)
+int net_os_wake_lock_rx_timeout_enable(struct net_device *dev, int val)
+{
+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
+ int ret = 0;
+
+ if (dhd)
+ ret = dhd_os_wake_lock_rx_timeout_enable(&dhd->pub, val);
+ return ret;
+}
+
+int net_os_wake_lock_ctrl_timeout_enable(struct net_device *dev, int val)
{
dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
int ret = 0;
if (dhd)
- ret = dhd_os_wake_lock_timeout_enable(&dhd->pub, val);
+ ret = dhd_os_wake_lock_ctrl_timeout_enable(&dhd->pub, val);
return ret;
}
@@ -5337,10 +5590,10 @@ int dhd_os_wake_lock(dhd_pub_t *pub)
#ifdef CONFIG_HAS_WAKELOCK
if (!dhd->wakelock_counter)
wake_lock(&dhd->wl_wifi);
-#elif defined(CONFIG_PM_SLEEP) && defined(CUSTOMER_HW_SLP)
- /*SLP_wakelock_alternative_code*/
+#elif defined(CUSTOMER_HW4) && defined(CONFIG_PM_SLEEP) && defined(PLATFORM_SLP)
+ /* SLP_wakelock_alternative_code */
pm_stay_awake(pm_dev);
-#endif
+#endif /* CUSTOMER_HW4 && CONFIG_PM_SLEEP && PLATFORM_SLP */
dhd->wakelock_counter++;
ret = dhd->wakelock_counter;
spin_unlock_irqrestore(&dhd->wakelock_spinlock, flags);
@@ -5372,10 +5625,10 @@ int dhd_os_wake_unlock(dhd_pub_t *pub)
#ifdef CONFIG_HAS_WAKELOCK
if (!dhd->wakelock_counter)
wake_unlock(&dhd->wl_wifi);
-#elif defined(CONFIG_PM_SLEEP) && defined(CUSTOMER_HW_SLP)
- /*SLP_wakelock_alternative_code*/
+#elif defined(CUSTOMER_HW4) && defined(CONFIG_PM_SLEEP) && defined(PLATFORM_SLP)
+ /* SLP_wakelock_alternative_code */
pm_relax(pm_dev);
-#endif
+#endif /* CUSTOMER_HW4 && CONFIG_PM_SLEEP && PLATFORM_SLP */
ret = dhd->wakelock_counter;
}
spin_unlock_irqrestore(&dhd->wakelock_spinlock, flags);
@@ -5395,8 +5648,8 @@ int dhd_os_check_wakelock(void *dhdp)
if (dhd && wake_lock_active(&dhd->wl_wifi))
return 1;
-#elif defined(CONFIG_PM_SLEEP) && defined(CUSTOMER_HW_SLP)
- /*SLP_wakelock_alternative_code*/
+#elif defined(CUSTOMER_HW4) && defined(CONFIG_PM_SLEEP) && defined(PLATFORM_SLP)
+ /* SLP_wakelock_alternative_code */
dhd_pub_t *pub = (dhd_pub_t *)dhdp;
dhd_info_t *dhd;
@@ -5404,11 +5657,11 @@ int dhd_os_check_wakelock(void *dhdp)
return 0;
dhd = (dhd_info_t *)(pub->info);
- DHD_ERROR(("%s : wakelock_count = %d\n", __func__, dhd->wakelock_counter ));
+ DHD_ERROR(("%s : wakelock_count = %d\n", __func__, dhd->wakelock_counter));
if (dhd && (dhd->wakelock_counter > 0))
return 1;
-#endif
+#endif /* CUSTOMER_HW4 && CONFIG_PM_SLEEP && PLATFORM_SLP */
return 0;
}
int net_os_wake_unlock(struct net_device *dev)
@@ -5429,6 +5682,23 @@ int dhd_os_check_if_up(void *dhdp)
return 0;
return pub->up;
}
+
+/* function to collect firmware, chip id and chip version info */
+void dhd_set_version_info(dhd_pub_t *dhdp, char *fw)
+{
+ int i;
+
+ i = snprintf(info_string, sizeof(info_string),
+ " Driver: %s\n Firmware: %s ", EPI_VERSION_STR, fw);
+
+ if (!dhdp)
+ return;
+
+ i = snprintf(&info_string[i], sizeof(info_string) - i,
+ "\n Chip: %x Rev %x Pkg %x", dhd_bus_chip_id(dhdp),
+ dhd_bus_chiprev_id(dhdp), dhd_bus_chippkg_id(dhdp));
+}
+
int dhd_ioctl_entry_local(struct net_device *net, wl_ioctl_t *ioc, int cmd)
{
int ifidx;
@@ -5463,7 +5733,7 @@ bool dhd_os_check_hang(dhd_pub_t *dhdp, int ifidx, int ret)
return dhd_check_hang(net, dhdp, ret);
}
-#if defined(WL_CFG80211) && defined(CUSTOMER_HW_SAMSUNG)
+#if defined(WL_CFG80211) && defined(SUPPORT_DEEP_SLEEP)
#define MAX_TRY_CNT 5 /* Number of tries to disable deepsleep */
int dhd_deepsleep(struct net_device *dev, int flag)
{
@@ -5478,59 +5748,62 @@ int dhd_deepsleep(struct net_device *dev, int flag)
dhdp = &dhd->pub;
switch (flag) {
- case 1 : /* Deepsleep on */
- DHD_ERROR(("[WiFi] Deepsleep On\n"));
- /* give some time to _dhd_sysioc_thread() before deepsleep */
- msleep(200);
- if (dhd_pkt_filter_enable) {
- dhd_set_packet_filter(0, dhdp);
- }
- /* Disable MPC */
+ case 1 : /* Deepsleep on */
+ DHD_ERROR(("[WiFi] Deepsleep On\n"));
+ /* give some time to _dhd_sysioc_thread() before deepsleep */
+ msleep(200);
+#ifdef PKT_FILTER_SUPPORT
+ /* disable pkt filter */
+ dhd_enable_packet_filter(0, dhdp);
+#endif /* PKT_FILTER_SUPPORT */
+ /* Disable MPC */
+ powervar = 0;
+ memset(iovbuf, 0, sizeof(iovbuf));
+ bcm_mkiovar("mpc", (char *)&powervar, 4, iovbuf, sizeof(iovbuf));
+ dhd_wl_ioctl_cmd(dhdp, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
+
+ /* Enable Deepsleep */
+ powervar = 1;
+ memset(iovbuf, 0, sizeof(iovbuf));
+ bcm_mkiovar("deepsleep", (char *)&powervar, 4, iovbuf, sizeof(iovbuf));
+ dhd_wl_ioctl_cmd(dhdp, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
+ break;
+
+ case 0: /* Deepsleep Off */
+ DHD_ERROR(("[WiFi] Deepsleep Off\n"));
+
+ /* Disable Deepsleep */
+ for (cnt = 0; cnt < MAX_TRY_CNT; cnt++) {
powervar = 0;
memset(iovbuf, 0, sizeof(iovbuf));
- bcm_mkiovar("mpc", (char *)&powervar, 4, iovbuf, sizeof(iovbuf));
+ bcm_mkiovar("deepsleep", (char *)&powervar, 4, iovbuf, sizeof(iovbuf));
dhd_wl_ioctl_cmd(dhdp, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
- /* Enable Deepsleep*/
- powervar = 1;
memset(iovbuf, 0, sizeof(iovbuf));
bcm_mkiovar("deepsleep", (char *)&powervar, 4, iovbuf, sizeof(iovbuf));
- dhd_wl_ioctl_cmd(dhdp, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
- break;
-
- case 0: /* Deepsleep Off */
- DHD_ERROR(("[WiFi] Deepsleep Off\n"));
-
- /* Disable Deepsleep */
- for (cnt = 0; cnt < MAX_TRY_CNT; cnt++ ) {
- powervar = 0;
- memset(iovbuf, 0, sizeof(iovbuf));
- bcm_mkiovar("deepsleep", (char *)&powervar, 4, iovbuf, sizeof(iovbuf));
- dhd_wl_ioctl_cmd(dhdp, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
-
- memset(iovbuf, 0, sizeof(iovbuf));
- bcm_mkiovar("deepsleep", (char *)&powervar, 4, iovbuf, sizeof(iovbuf));
- if ((ret = dhd_wl_ioctl_cmd(dhdp, WLC_GET_VAR, iovbuf, sizeof(iovbuf), FALSE, 0)) < 0) {
- DHD_ERROR(("the error of dhd deepsleep status ret value : %d\n",ret));
- } else {
- if(!(*(int *)iovbuf )) {
- DHD_ERROR(("deepsleep mode is 0, ok , count : %d\n",cnt));
- break;
- }
+ if ((ret = dhd_wl_ioctl_cmd(dhdp, WLC_GET_VAR, iovbuf, sizeof(iovbuf),
+ FALSE, 0)) < 0) {
+ DHD_ERROR(("the error of dhd deepsleep status ret value :%d\n",
+ ret));
+ } else {
+ if (!(*(int *)iovbuf)) {
+ DHD_ERROR(("deepsleep mode is 0, ok , count : %d\n", cnt));
+ break;
}
}
+ }
- /* Enable MPC */
- powervar = 1;
- memset(iovbuf, 0, sizeof(iovbuf));
- bcm_mkiovar("mpc", (char *)&powervar, 4, iovbuf, sizeof(iovbuf));
- dhd_wl_ioctl_cmd(dhdp, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
- break;
+ /* Enable MPC */
+ powervar = 1;
+ memset(iovbuf, 0, sizeof(iovbuf));
+ bcm_mkiovar("mpc", (char *)&powervar, 4, iovbuf, sizeof(iovbuf));
+ dhd_wl_ioctl_cmd(dhdp, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
+ break;
}
return 0;
}
-#endif /* CUSTOMER_HW_SAMSUNG */
+#endif /* SUPPORT_DEEP_SLEEP */
#ifdef PROP_TXSTATUS
extern int dhd_wlfc_interface_entry_update(void* state, ewlfc_mac_entry_action_t action, uint8 ifid,
@@ -5570,8 +5843,8 @@ extern uint32 dhd_writeregl(void *bp, uint32 addr, uint32 data);
typedef struct dhd_dbgfs {
struct dentry *debugfs_dir;
struct dentry *debugfs_mem;
- dhd_pub_t *dhdp;
- uint32 size;
+ dhd_pub_t *dhdp;
+ uint32 size;
} dhd_dbgfs_t;
dhd_dbgfs_t g_dbgfs;
@@ -5718,9 +5991,9 @@ void dhd_htsf_addtxts(dhd_pub_t *dhdp, void *pktbuf)
p1 = (char*) PKTDATA(dhdp->osh, pktbuf);
if (PKTLEN(dhdp->osh, pktbuf) > HTSF_MINLEN) {
-/* memcpy(&proto, p1+26, 4); */
+/* memcpy(&proto, p1+26, 4); */
memcpy(&dport, p1+40, 2);
-/* proto = ((ntoh32(proto))>> 16) & 0xFF; */
+/* proto = ((ntoh32(proto))>> 16) & 0xFF; */
dport = ntoh16(dport);
}
@@ -5920,7 +6193,8 @@ dhd_ioctl_htsf_get(dhd_info_t *dhd, int ifidx)
ioc.len = (uint)sizeof(buf);
ioc.set = FALSE;
- strcpy(buf, "tsf");
+ strncpy(buf, "tsf", sizeof(buf) - 1);
+ buf[sizeof(buf) - 1] = '\0';
s1 = dhd_get_htsf(dhd, 0);
if ((ret = dhd_wl_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len)) < 0) {
if (ret == -EIO) {
@@ -5989,10 +6263,10 @@ void htsf_update(dhd_info_t *dhd, void *data)
if (tsf_delta) {
hfactor = cyc_delta / tsf_delta;
- tmp = (cyc_delta - (hfactor * tsf_delta))*10;
+ tmp = (cyc_delta - (hfactor * tsf_delta))*10;
dec1 = tmp/tsf_delta;
dec2 = ((tmp - dec1*tsf_delta)*10) / tsf_delta;
- tmp = (tmp - (dec1*tsf_delta))*10;
+ tmp = (tmp - (dec1*tsf_delta))*10;
dec3 = ((tmp - dec2*tsf_delta)*10) / tsf_delta;
if (dec3 > 4) {
diff --git a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_linux_sched.c b/drivers/net/wireless/bcmdhd/dhd_linux_sched.c
index 76336b3..290caf7 100644
--- a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_linux_sched.c
+++ b/drivers/net/wireless/bcmdhd/dhd_linux_sched.c
@@ -1,14 +1,14 @@
/*
* Expose some of the kernel scheduler routines
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,7 +16,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
diff --git a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_proto.h b/drivers/net/wireless/bcmdhd/dhd_proto.h
index 8cc2542..09d5468 100644
--- a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_proto.h
+++ b/drivers/net/wireless/bcmdhd/dhd_proto.h
@@ -4,14 +4,14 @@
* Provides type definitions and function prototypes used to link the
* DHD OS, bus, and protocol modules.
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -19,12 +19,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: dhd_proto.h 303834 2011-12-20 06:17:39Z $
+ * $Id: dhd_proto.h 343390 2012-07-06 22:34:19Z $
*/
#ifndef _dhd_proto_h_
@@ -34,7 +34,7 @@
#include <wlioctl.h>
#ifndef IOCTL_RESP_TIMEOUT
-#define IOCTL_RESP_TIMEOUT 5000 /* In milli second */
+#define IOCTL_RESP_TIMEOUT 2000 /* In milli second default value for Production FW */
#endif /* IOCTL_RESP_TIMEOUT */
/*
@@ -57,7 +57,7 @@ extern void dhd_prot_stop(dhd_pub_t *dhdp);
#ifdef PROP_TXSTATUS
extern int dhd_wlfc_init(dhd_pub_t *dhd);
extern void dhd_wlfc_deinit(dhd_pub_t *dhd);
-#endif
+#endif /* PROP_TXSTATUS */
/* Add any protocol-specific data header.
* Caller must reserve prot_hdrlen prepend space.
diff --git a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_sdio.c b/drivers/net/wireless/bcmdhd/dhd_sdio.c
index 211c865..0617e16 100644
--- a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_sdio.c
+++ b/drivers/net/wireless/bcmdhd/dhd_sdio.c
@@ -2,13 +2,13 @@
* DHD Bus Module for SDIO
*
* Copyright (C) 1999-2012, Broadcom Corporation
- *
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,12 +16,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: dhd_sdio.c 309548 2012-01-20 01:13:08Z $
+ * $Id: dhd_sdio.c 357912 2012-09-20 09:42:47Z $
*/
#include <typedefs.h>
@@ -49,6 +49,9 @@
#include <sbhnddma.h>
#include <sdio.h>
+#ifdef BCMSPI
+#include <spid.h>
+#endif /* BCMSPI */
#include <sbsdio.h>
#include <sbsdpcmdev.h>
#include <bcmsdpcm.h>
@@ -94,8 +97,17 @@
#error DHD_FIRSTREAD is not a power of 2!
#endif
-/* Total length of frame header for dongle protocol */
+#ifdef BCMSDIOH_TXGLOM
+/* Total length of TX frame header for dongle protocol */
+#define SDPCM_HDRLEN (SDPCM_FRAMETAG_LEN + SDPCM_HWEXT_LEN + SDPCM_SWHEADER_LEN)
+/* Total length of RX frame for dongle protocol */
+#else
+/* Total length of TX frame header for dongle protocol */
#define SDPCM_HDRLEN (SDPCM_FRAMETAG_LEN + SDPCM_SWHEADER_LEN)
+#endif
+
+#define SDPCM_HDRLEN_RX (SDPCM_FRAMETAG_LEN + SDPCM_SWHEADER_LEN)
+
#ifdef SDTEST
#define SDPCM_RESERVE (SDPCM_HDRLEN + SDPCM_TEST_HDRLEN + DHD_SDALIGN)
#else
@@ -138,13 +150,12 @@
#define PKTFREE2() if ((bus->bus != SPI_BUS) || bus->usebufpool) \
PKTFREE(bus->dhd->osh, pkt, FALSE);
DHD_SPINWAIT_SLEEP_INIT(sdioh_spinwait_sleep);
-#if defined(OOB_INTR_ONLY)
+#if defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID)
extern void bcmsdh_set_irq(int flag);
-#endif /* defined(OOB_INTR_ONLY) */
+#endif /* defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID) */
#ifdef PROP_TXSTATUS
extern void dhd_wlfc_txcomplete(dhd_pub_t *dhd, void *txp, bool success);
#endif
-
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25))
DEFINE_MUTEX(_dhd_sdio_mutex_lock_);
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) */
@@ -163,13 +174,6 @@ typedef struct dhd_console {
} dhd_console_t;
#endif /* DHD_DEBUG */
-#ifdef BCM4334_CHECK_CHIP_REV
-#define REV_ID_ADDR 0x1E008F90
-uint g_chipver;
-char chipver_tag[4];
-char fw_down_path[MOD_PARAM_PATHLEN];
-#endif
-
#define REMAP_ENAB(bus) ((bus)->remap)
#define REMAP_ISADDR(bus, a) (((a) >= ((bus)->orig_ramsize)) && ((a) < ((bus)->ramsize)))
#define KSO_ENAB(bus) ((bus)->kso)
@@ -179,8 +183,8 @@ char fw_down_path[MOD_PARAM_PATHLEN];
#define MIN_RSRC_SR 0x3
#define CORE_CAPEXT_ADDR (SI_ENUM_BASE + 0x64c)
#define CORE_CAPEXT_SR_SUPPORTED_MASK (1 << 1)
-#define RCTL_MACPHY_DISABLE_MASK (1 << 26)
-#define RCTL_LOGIC_DISABLE_MASK (1 << 27)
+#define RCTL_MACPHY_DISABLE_MASK (1 << 26)
+#define RCTL_LOGIC_DISABLE_MASK (1 << 27)
#define OOB_WAKEUP_ENAB(bus) ((bus)->_oobwakeup)
#define GPIO_DEV_SRSTATE 16 /* Host gpio17 mapped to device gpio0 SR state */
@@ -188,7 +192,7 @@ char fw_down_path[MOD_PARAM_PATHLEN];
#define GPIO_DEV_WAKEUP 17 /* Host gpio17 mapped to device gpio1 wakeup */
#define CC_CHIPCTRL2_GPIO1_WAKEUP (1 << 0)
-
+#define CC_PMUCC3 (0x3)
/* Private data for SDIO bus interaction */
typedef struct dhd_bus {
dhd_pub_t *dhd;
@@ -249,7 +253,7 @@ typedef struct dhd_bus {
bool poll; /* Use polling */
bool ipend; /* Device interrupt is pending */
bool intdis; /* Interrupts disabled by isr */
- uint intrcount; /* Count of device interrupt callbacks */
+ uint intrcount; /* Count of device interrupt callbacks */
uint lastintrs; /* Count as of last watchdog timer */
uint spurious; /* Count of spurious interrupts */
uint pollrate; /* Ticks between device polls */
@@ -327,11 +331,16 @@ typedef struct dhd_bus {
uint f2rxdata; /* Number of frame data reads */
uint f2txdata; /* Number of f2 frame writes */
uint f1regdata; /* Number of f1 register accesses */
+#ifdef BCMSPI
+ bool dwordmode;
+#endif /* BCMSPI */
uint8 *ctrl_frame_buf;
uint32 ctrl_frame_len;
bool ctrl_frame_stat;
+#ifndef BCMSPI
uint32 rxint_mode; /* rx interrupt mode */
+#endif /* BCMSPI */
bool remap; /* Contiguous 1MB RAM: 512K socram + 512K devram
* Available with socram rev 16
* Remap region not DMA-able
@@ -340,7 +349,18 @@ typedef struct dhd_bus {
bool _slpauto;
bool _oobwakeup;
bool _srenab;
- bool readframes;
+ bool readframes;
+ bool reqbussleep;
+ uint32 resetinstr;
+ uint32 dongle_ram_base;
+#ifdef BCMSDIOH_TXGLOM
+ void *glom_pkt_arr[SDPCM_MAXGLOM_SIZE]; /* Array of pkts for glomming */
+ uint16 glom_cnt; /* Number of pkts in the glom array */
+ uint16 glom_total_len; /* Total length of pkts in glom array */
+ bool glom_enable; /* Flag to indicate whether tx glom is enabled/disabled */
+ uint8 glom_mode; /* Glom mode - 0-copy mode, 1 - Multi-descriptor mode */
+ uint32 glomsize; /* Glom size limitation */
+#endif
} dhd_bus_t;
/* clkstate */
@@ -379,8 +399,14 @@ static bool sd1idle;
static bool retrydata;
#define RETRYCHAN(chan) (((chan) == SDPCM_EVENT_CHANNEL) || retrydata)
+#ifdef BCMSPI
+/* At a watermark around 8 the spid hits underflow error. */
+static const uint watermark = 32;
+static const uint mesbusyctrl = 0;
+#else
static const uint watermark = 8;
static const uint mesbusyctrl = 0;
+#endif /* BCMSPI */
static const uint firstread = DHD_FIRSTREAD;
#define HDATLEN (firstread - (SDPCM_HDRLEN))
@@ -391,8 +417,6 @@ static const uint retry_limit = 2;
/* Force even SD lengths (some host controllers mess up on odd bytes) */
static bool forcealign;
-/* Flag to indicate if we should download firmware on driver load */
-uint dhd_download_fw_on_driverload = TRUE;
#define ALIGNMENT 4
@@ -432,6 +456,10 @@ static bool dhd_readahead;
(((uint8)(bus->tx_max - bus->tx_seq) != 0) && \
(((uint8)(bus->tx_max - bus->tx_seq) & 0x80) == 0))
+/* Number of pkts available in dongle for data RX */
+#define DATABUFCNT(bus) \
+ ((uint8)(bus->tx_max - bus->tx_seq) - 1)
+
/* Macros to get register read/write status */
/* NOTE: these assume a local dhdsdio_bus_t *bus! */
#define R_SDREG(regvar, regaddr, retryvar) \
@@ -466,6 +494,7 @@ do { \
#define BUS_WAKE(bus) \
do { \
+ bus->idlecount = 0; \
if ((bus)->sleeping) \
dhdsdio_bussleep((bus), FALSE); \
} while (0);
@@ -491,8 +520,35 @@ do { \
#define SDIO_DEVICE_RXDATAINT_MODE_0 1 /* from sdiod rev 4 */
#define SDIO_DEVICE_RXDATAINT_MODE_1 2 /* from sdiod rev 4 */
+#ifdef BCMSPI
+
+#define FRAME_AVAIL_MASK(bus) I_HMB_FRAME_IND
+
+#define DHD_BUS SPI_BUS
+
+/* check packet-available-interrupt in piggybacked dstatus */
+#define PKT_AVAILABLE(bus, intstatus) (bcmsdh_get_dstatus(bus->sdh) & STATUS_F2_PKT_AVAILABLE)
+
+#define HOSTINTMASK (I_HMB_FC_CHANGE | I_HMB_HOST_INT)
+
+#define GSPI_PR55150_BAILOUT \
+do { \
+ uint32 dstatussw = bcmsdh_get_dstatus((void *)bus->sdh); \
+ uint32 dstatushw = bcmsdh_cfg_read_word(bus->sdh, SDIO_FUNC_0, SPID_STATUS_REG, NULL); \
+ uint32 intstatuserr = 0; \
+ uint retries = 0; \
+ \
+ R_SDREG(intstatuserr, &bus->regs->intstatus, retries); \
+ printf("dstatussw = 0x%x, dstatushw = 0x%x, intstatus = 0x%x\n", \
+ dstatussw, dstatushw, intstatuserr); \
+ \
+ bus->nextlen = 0; \
+ *finished = TRUE; \
+} while (0)
+
+#else /* BCMSDIO */
-#define FRAME_AVAIL_MASK(bus) \
+#define FRAME_AVAIL_MASK(bus) \
((bus->rxint_mode == SDIO_DEVICE_HMB_RXINT) ? I_HMB_FRAME_IND : I_XMTDATA_AVAIL)
#define DHD_BUS SDIO_BUS
@@ -503,6 +559,8 @@ do { \
#define GSPI_PR55150_BAILOUT
+#endif /* BCMSPI */
+
#ifdef SDTEST
static void dhdsdio_testrcv(dhd_bus_t *bus, void *pkt, uint seq);
static void dhdsdio_sdtest_set(dhd_bus_t *bus, uint8 count);
@@ -534,6 +592,10 @@ static int dhd_bcmsdh_recv_buf(dhd_bus_t *bus, uint32 addr, uint fn, uint flags,
static int dhd_bcmsdh_send_buf(dhd_bus_t *bus, uint32 addr, uint fn, uint flags,
uint8 *buf, uint nbytes,
void *pkt, bcmsdh_cmplt_fn_t complete, void *handle);
+#ifdef BCMSDIOH_TXGLOM
+static void dhd_bcmsdh_glom_post(dhd_bus_t *bus, uint8 *frame, uint len);
+static void dhd_bcmsdh_glom_clear(dhd_bus_t *bus);
+#endif
static bool dhdsdio_download_firmware(dhd_bus_t *bus, osl_t *osh, void *sdh);
static int _dhdsdio_download_firmware(dhd_bus_t *bus);
@@ -579,6 +641,28 @@ dhdsdio_set_siaddr_window(dhd_bus_t *bus, uint32 address)
return err;
}
+#ifdef BCMSPI
+static void
+dhdsdio_wkwlan(dhd_bus_t *bus, bool on)
+{
+ int err;
+ uint32 regdata;
+ bcmsdh_info_t *sdh = bus->sdh;
+
+ if (bus->sih->buscoretype == SDIOD_CORE_ID) {
+ /* wake up wlan function :WAKE_UP goes as ht_avail_request and alp_avail_request */
+ regdata = bcmsdh_cfg_read_word(sdh, SDIO_FUNC_0, SPID_CONFIG, NULL);
+ DHD_INFO(("F0 REG0 rd = 0x%x\n", regdata));
+
+ if (on == TRUE)
+ regdata |= WAKE_UP;
+ else
+ regdata &= ~WAKE_UP;
+
+ bcmsdh_cfg_write_word(sdh, SDIO_FUNC_0, SPID_CONFIG, regdata, &err);
+ }
+}
+#endif /* BCMSPI */
#ifdef USE_OOB_GPIO1
static int
@@ -603,7 +687,7 @@ dhdsdio_oobwakeup_init(dhd_bus_t *bus)
}
#endif /* USE_OOB_GPIO1 */
-#ifdef BCM4334_CHIP
+#ifndef BCMSPI
/*
* Query if FW is in SR mode
*/
@@ -611,16 +695,37 @@ static bool
dhdsdio_sr_cap(dhd_bus_t *bus)
{
bool cap = FALSE;
- uint32 min = 0, core_capext, data;
-
- core_capext = bcmsdh_reg_read(bus->sdh, CORE_CAPEXT_ADDR, 4);
- if (!(core_capext & CORE_CAPEXT_SR_SUPPORTED_MASK))
+ uint32 min = 0, core_capext, addr, data;
+ if (bus->sih->chip == BCM4324_CHIP_ID) {
+ addr = SI_ENUM_BASE + OFFSETOF(chipcregs_t, chipcontrol_addr);
+ data = SI_ENUM_BASE + OFFSETOF(chipcregs_t, chipcontrol_data);
+ bcmsdh_reg_write(bus->sdh, addr, 4, 3);
+ core_capext = bcmsdh_reg_read(bus->sdh, data, 4);
+ } else if (bus->sih->chip == BCM4330_CHIP_ID) {
+ core_capext = FALSE;
+ } else if (bus->sih->chip == BCM4335_CHIP_ID) {
+ core_capext = TRUE;
+ } else {
+ core_capext = bcmsdh_reg_read(bus->sdh, CORE_CAPEXT_ADDR, 4);
+ core_capext = (core_capext & CORE_CAPEXT_SR_SUPPORTED_MASK);
+ }
+ if (!(core_capext))
return FALSE;
if (bus->sih->chip == BCM4324_CHIP_ID) {
- min = bcmsdh_reg_read(bus->sdh, MIN_RSRC_ADDR, 4);
+ /* FIX: Should change to query SR control register instead */
+ min = bcmsdh_reg_read(bus->sdh, MIN_RSRC_ADDR, 4);
if (min == MIN_RSRC_SR)
- cap = TRUE;
+ cap = TRUE;
+ } else if (bus->sih->chip == BCM4335_CHIP_ID) {
+ uint32 enabval = 0;
+ addr = SI_ENUM_BASE + OFFSETOF(chipcregs_t, chipcontrol_addr);
+ data = SI_ENUM_BASE + OFFSETOF(chipcregs_t, chipcontrol_data);
+ bcmsdh_reg_write(bus->sdh, addr, 4, CC_PMUCC3);
+ enabval = bcmsdh_reg_read(bus->sdh, data, 4);
+
+ if (enabval)
+ cap = TRUE;
} else {
data = bcmsdh_reg_read(bus->sdh,
SI_ENUM_BASE + OFFSETOF(chipcregs_t, retention_ctl), 4);
@@ -654,7 +759,6 @@ dhdsdio_sr_init(dhd_bus_t *bus)
if ((bus->sih->chip == BCM4334_CHIP_ID) && (bus->sih->chiprev == 2))
dhdsdio_srwar_init(bus);
-
val = bcmsdh_cfg_read(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_WAKEUPCTRL, NULL);
val |= 1 << SBSDIO_FUNC1_WCTRL_HTWAIT_SHIFT;
bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_WAKEUPCTRL,
@@ -674,7 +778,7 @@ dhdsdio_sr_init(dhd_bus_t *bus)
return 0;
}
-#endif /* BCM4334_CHIP */
+#endif /* BCMSPI */
/*
* FIX: Be sure KSO bit is enabled
@@ -704,19 +808,56 @@ dhdsdio_clk_kso_init(dhd_bus_t *bus)
return 0;
}
+#define KSO_DBG(x)
+#define MAX_KSO_ATTEMPTS 64
static int
dhdsdio_clk_kso_enab(dhd_bus_t *bus, bool on)
{
- uint8 val = 0;
+ uint8 wr_val = 0, rd_val, cmp_val, bmask;
int err = 0;
+ int try_cnt = 0;
- /* Don't read here since sdio could be off so just write only */
- val |= (on << SBSDIO_FUNC1_SLEEPCSR_KSO_SHIFT);
- bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_SLEEPCSR, val, &err);
+ KSO_DBG(("%s> op:%s\n", __FUNCTION__, (on ? "KSO_SET" : "KSO_CLR")));
- if (err)
- DHD_TRACE(("%s: KSO toggle %d failed: %d\n", __FUNCTION__, on, err));
- return 0;
+ wr_val |= (on << SBSDIO_FUNC1_SLEEPCSR_KSO_SHIFT);
+
+ bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_SLEEPCSR, wr_val, &err);
+
+ if (on) {
+ cmp_val = SBSDIO_FUNC1_SLEEPCSR_KSO_MASK | SBSDIO_FUNC1_SLEEPCSR_DEVON_MASK;
+ bmask = cmp_val;
+
+ msleep(3);
+
+ } else {
+ /* Put device to sleep, turn off KSO */
+ cmp_val = 0;
+ bmask = SBSDIO_FUNC1_SLEEPCSR_KSO_MASK;
+ }
+
+ do {
+ rd_val = bcmsdh_cfg_read(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_SLEEPCSR, &err);
+ if (((rd_val & bmask) == cmp_val) && !err)
+ break;
+
+ KSO_DBG(("%s> KSO wr/rd retry:%d, ERR:%x \n", __FUNCTION__, try_cnt, err));
+ OSL_DELAY(50);
+
+ bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_SLEEPCSR, wr_val, &err);
+
+ } while (try_cnt++ < MAX_KSO_ATTEMPTS);
+
+
+ if (try_cnt > 1) {
+ KSO_DBG(("%s> op:%s, try_cnt:%d, rd_val:%x, ERR:%x \n",
+ __FUNCTION__, (on ? "KSO_SET" : "KSO_CLR"), try_cnt, rd_val, err));
+ }
+
+ if (try_cnt > MAX_KSO_ATTEMPTS) {
+ DHD_ERROR(("%s> op:%s, ERROR: try_cnt:%d, rd_val:%x, ERR:%x \n",
+ __FUNCTION__, (on ? "KSO_SET" : "KSO_CLR"), try_cnt, rd_val, err));
+ }
+ return err;
}
static int
@@ -758,6 +899,7 @@ dhdsdio_clk_kso_iovar(dhd_bus_t *bus, bool on)
}
bus->kso = on;
+ BCM_REFERENCE(err);
return 0;
}
@@ -838,7 +980,7 @@ dhdsdio_clk_devsleep_iovar(dhd_bus_t *bus, bool on)
/* Exit Sleep */
/* Make sure we have SD bus access */
if (bus->clkstate == CLK_NONE) {
- DHD_ERROR(("%s: Request SD clk\n", __FUNCTION__));
+ DHD_TRACE(("%s: Request SD clk\n", __FUNCTION__));
dhdsdio_clkctl(bus, CLK_SDONLY, FALSE);
}
@@ -883,7 +1025,8 @@ dhdsdio_clk_devsleep_iovar(dhd_bus_t *bus, bool on)
do {
err = dhdsdio_clk_kso_enab(bus, TRUE);
- OSL_DELAY(10000);
+ if (err)
+ OSL_DELAY(10000);
} while ((err != 0) && (++retry < 3));
if (err != 0) {
@@ -898,7 +1041,7 @@ dhdsdio_clk_devsleep_iovar(dhd_bus_t *bus, bool on)
/* Wait for device ready during transition to wake-up */
SPINWAIT((((csr = dhdsdio_sleepcsr_get(bus)) &
SBSDIO_FUNC1_SLEEPCSR_DEVON_MASK) !=
- (SBSDIO_FUNC1_SLEEPCSR_DEVON_MASK)), (10000));
+ (SBSDIO_FUNC1_SLEEPCSR_DEVON_MASK)), (20000));
DHD_TRACE(("%s: ExitSleep sleepcsr: 0x%x\n", __FUNCTION__, csr));
@@ -929,15 +1072,17 @@ dhdsdio_clk_devsleep_iovar(dhd_bus_t *bus, bool on)
static int
dhdsdio_htclk(dhd_bus_t *bus, bool on, bool pendok)
{
+#define HT_AVAIL_ERROR_MAX 10
+ static int ht_avail_error = 0;
int err;
uint8 clkctl, clkreq, devctl;
bcmsdh_info_t *sdh;
DHD_TRACE(("%s: Enter\n", __FUNCTION__));
-#if defined(OOB_INTR_ONLY)
+#if defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID)
pendok = FALSE;
-#endif
+#endif /* defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID) */
clkctl = 0;
sdh = bus->sdh;
@@ -953,10 +1098,26 @@ dhdsdio_htclk(dhd_bus_t *bus, bool on, bool pendok)
if (on) {
/* Request HT Avail */
clkreq = bus->alp_only ? SBSDIO_ALP_AVAIL_REQ : SBSDIO_HT_AVAIL_REQ;
+
+#ifdef BCMSPI
+ dhdsdio_wkwlan(bus, TRUE);
+#endif /* BCMSPI */
+
+
bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, clkreq, &err);
if (err) {
- DHD_ERROR(("%s: HT Avail request error: %d\n", __FUNCTION__, err));
- return BCME_ERROR;
+ ht_avail_error++;
+ if (ht_avail_error < HT_AVAIL_ERROR_MAX) {
+ DHD_ERROR(("%s: HT Avail request error: %d\n", __FUNCTION__, err));
+ }
+
+ else {
+ if (ht_avail_error == HT_AVAIL_ERROR_MAX)
+ dhd_os_send_hang_message(bus->dhd);
+ }
+return BCME_ERROR;
+ } else {
+ ht_avail_error = 0;
}
if (pendok &&
@@ -1045,14 +1206,17 @@ dhdsdio_htclk(dhd_bus_t *bus, bool on, bool pendok)
bus->clkstate = CLK_SDONLY;
if (!SR_ENAB(bus)) {
- bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, clkreq, &err);
- DHD_INFO(("CLKCTL: turned OFF\n"));
- if (err) {
- DHD_ERROR(("%s: Failed access turning clock off: %d\n",
- __FUNCTION__, err));
- return BCME_ERROR;
- }
+ bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, clkreq, &err);
+ DHD_INFO(("CLKCTL: turned OFF\n"));
+ if (err) {
+ DHD_ERROR(("%s: Failed access turning clock off: %d\n",
+ __FUNCTION__, err));
+ return BCME_ERROR;
+ }
}
+#ifdef BCMSPI
+ dhdsdio_wkwlan(bus, FALSE);
+#endif /* BCMSPI */
}
return BCME_OK;
}
@@ -1061,6 +1225,7 @@ dhdsdio_htclk(dhd_bus_t *bus, bool on, bool pendok)
static int
dhdsdio_sdclk(dhd_bus_t *bus, bool on)
{
+#ifndef BCMSPI
int err;
int32 iovalue;
@@ -1139,6 +1304,7 @@ dhdsdio_sdclk(dhd_bus_t *bus, bool on)
}
bus->clkstate = CLK_NONE;
}
+#endif /* BCMSPI */
return BCME_OK;
}
@@ -1175,7 +1341,7 @@ dhdsdio_clkctl(dhd_bus_t *bus, uint target, bool pendok)
ret = dhdsdio_htclk(bus, TRUE, pendok);
if (ret == BCME_OK) {
dhd_os_wd_timer(bus->dhd, dhd_watchdog_ms);
- bus->activity = TRUE;
+ bus->activity = TRUE;
#ifdef DHD_USE_IDLECOUNT
bus->idlecount = 0;
#endif /* DHD_USE_IDLECOUNT */
@@ -1205,6 +1371,7 @@ dhdsdio_clkctl(dhd_bus_t *bus, uint target, bool pendok)
#ifdef DHD_DEBUG
if (dhd_console_ms == 0)
#endif /* DHD_DEBUG */
+ if (bus->poll == 0)
dhd_os_wd_timer(bus->dhd, 0);
break;
}
@@ -1234,7 +1401,11 @@ dhdsdio_bussleep(dhd_bus_t *bus, bool sleep)
/* Going to sleep: set the alarm and turn off the lights... */
if (sleep) {
/* Don't sleep if something is pending */
+#ifdef CUSTOMER_HW4
if (bus->dpc_sched || bus->rxskip || pktq_len(&bus->txq) || bus->readframes)
+#else
+ if (bus->dpc_sched || bus->rxskip || pktq_len(&bus->txq))
+#endif /* CUSTOMER_HW4 */
return BCME_BUSY;
@@ -1314,7 +1485,7 @@ dhdsdio_bussleep(dhd_bus_t *bus, bool sleep)
return err;
}
-#ifdef VSDB_DYNAMIC_F2_BLKSIZE
+#if defined(CUSTOMER_HW4) && defined(DYNAMIC_F2_BLKSIZE_OF_PROPTXSTATUS)
int
dhdsdio_func_blocksize(dhd_pub_t *dhd, int function_num, int block_size)
{
@@ -1322,7 +1493,8 @@ dhdsdio_func_blocksize(dhd_pub_t *dhd, int function_num, int block_size)
int bcmerr = 0;
int result;
- bcmerr = dhd_bus_iovar_op(dhd, "sd_blocksize", &func_blk_size, sizeof(int), &result, sizeof(int), 0);
+ bcmerr = dhd_bus_iovar_op(dhd, "sd_blocksize", &func_blk_size, sizeof(int), &result,
+ sizeof(int), 0);
if (bcmerr != BCME_OK) {
DHD_ERROR(("%s: Get F%d Block size error\n", __FUNCTION__, function_num));
@@ -1331,10 +1503,12 @@ dhdsdio_func_blocksize(dhd_pub_t *dhd, int function_num, int block_size)
if (result != block_size) {
- DHD_ERROR(("%s: F%d Block size set from %d to %d\n", __FUNCTION__, function_num, result, block_size));
+ DHD_ERROR(("%s: F%d Block size set from %d to %d\n", __FUNCTION__,
+ function_num, result, block_size));
- func_blk_size = function_num << 16 | block_size ;
- bcmerr = dhd_bus_iovar_op(dhd, "sd_blocksize", &func_blk_size, sizeof(int32), &result, sizeof(int32), 1);
+ func_blk_size = function_num << 16 | block_size;
+ bcmerr = dhd_bus_iovar_op(dhd, "sd_blocksize", &func_blk_size, sizeof(int32),
+ &result, sizeof(int32), 1);
if (bcmerr != BCME_OK) {
DHD_ERROR(("%s: Set F2 Block size error\n", __FUNCTION__));
@@ -1345,7 +1519,8 @@ dhdsdio_func_blocksize(dhd_pub_t *dhd, int function_num, int block_size)
return BCME_OK;
}
-#endif
+#endif /* CUSTOMER_HW4 && DYNAMIC_F2_BLKSIZE_OF_PROPTXSTATUS */
+
#if defined(OOB_INTR_ONLY)
void
dhd_enable_oob_intr(struct dhd_bus *bus, bool enable)
@@ -1380,7 +1555,7 @@ dhd_enable_oob_intr(struct dhd_bus *bus, bool enable)
/* Writes a HW/SW header into the packet and sends it. */
/* Assumes: (a) header space already there, (b) caller holds lock */
static int
-dhdsdio_txpkt(dhd_bus_t *bus, void *pkt, uint chan, bool free_pkt)
+dhdsdio_txpkt(dhd_bus_t *bus, void *pkt, uint chan, bool free_pkt, bool queue_only)
{
int ret;
osl_t *osh;
@@ -1391,6 +1566,10 @@ dhdsdio_txpkt(dhd_bus_t *bus, void *pkt, uint chan, bool free_pkt)
bcmsdh_info_t *sdh;
void *new;
int i;
+ int pkt_cnt;
+#ifdef BCMSDIOH_TXGLOM
+ uint8 *frame_tmp;
+#endif
#ifdef WLMEDIA_HTSF
char *p;
htsfts_t *htsf_ts;
@@ -1421,7 +1600,7 @@ dhdsdio_txpkt(dhd_bus_t *bus, void *pkt, uint chan, bool free_pkt)
#endif /* WLMEDIA_HTSF */
/* Add alignment padding, allocate new packet if needed */
- if ((pad1 = ((uintptr)frame % DHD_SDALIGN))) {
+ if (!((uintptr)frame & 1) && (pad1 = ((uintptr)frame % DHD_SDALIGN))) {
if (PKTHEADROOM(osh, pkt) < pad1) {
DHD_INFO(("%s: insufficient headroom %d for %d pad1\n",
__FUNCTION__, (int)PKTHEADROOM(osh, pkt), pad1));
@@ -1445,14 +1624,6 @@ dhdsdio_txpkt(dhd_bus_t *bus, void *pkt, uint chan, bool free_pkt)
ASSERT(((uintptr)frame % DHD_SDALIGN) == 0);
pad1 = 0;
} else {
-#ifdef CUSTOMER_HW_SAMSUNG
- /* Adjust pad value to fix firmware crash problems
- * because of odd start address of the frame
- * (CSP#455126)
- */
- if ((int)frame & 1)
- pad1--;
-#endif
PKTPUSH(osh, pkt, pad1);
frame = (uint8*)PKTDATA(osh, pkt);
@@ -1467,6 +1638,77 @@ dhdsdio_txpkt(dhd_bus_t *bus, void *pkt, uint chan, bool free_pkt)
*(uint16*)frame = htol16(len);
*(((uint16*)frame) + 1) = htol16(~len);
+#ifdef BCMSDIOH_TXGLOM
+ if (bus->glom_enable) {
+ uint32 hwheader1 = 0, hwheader2 = 0, act_len = len;
+
+ /* Software tag: channel, sequence number, data offset */
+ swheader = ((chan << SDPCM_CHANNEL_SHIFT) & SDPCM_CHANNEL_MASK) |
+ ((bus->tx_seq + bus->glom_cnt) % SDPCM_SEQUENCE_WRAP) |
+ (((pad1 + SDPCM_HDRLEN) << SDPCM_DOFFSET_SHIFT) & SDPCM_DOFFSET_MASK);
+ htol32_ua_store(swheader, frame + SDPCM_FRAMETAG_LEN + SDPCM_HWEXT_LEN);
+ htol32_ua_store(0, frame + SDPCM_FRAMETAG_LEN + SDPCM_HWEXT_LEN + sizeof(swheader));
+
+ if (queue_only) {
+ if (forcealign && (len & (ALIGNMENT - 1)))
+ len = ROUNDUP(len, ALIGNMENT);
+ /* Hardware extention tag */
+ /* 2byte frame length, 1byte-, 1byte frame flag,
+ * 2byte-hdrlength, 2byte padlenght
+ */
+ hwheader1 = (act_len - SDPCM_FRAMETAG_LEN) | (0 << 24);
+ hwheader2 = (len - act_len) << 16;
+ htol32_ua_store(hwheader1, frame + SDPCM_FRAMETAG_LEN);
+ htol32_ua_store(hwheader2, frame + SDPCM_FRAMETAG_LEN + 4);
+ /* Post the frame pointer to sdio glom array */
+ dhd_bcmsdh_glom_post(bus, frame, len);
+ /* Save the pkt pointer in bus glom array */
+ bus->glom_pkt_arr[bus->glom_cnt] = pkt;
+ bus->glom_total_len += len;
+ bus->glom_cnt++;
+ return BCME_OK;
+ } else {
+ /* Raise len to next SDIO block to eliminate tail command */
+ if (bus->roundup && bus->blocksize &&
+ ((bus->glom_total_len + len) > bus->blocksize)) {
+ uint16 pad2 = bus->blocksize -
+ ((bus->glom_total_len + len) % bus->blocksize);
+ if ((pad2 <= bus->roundup) && (pad2 < bus->blocksize)) {
+ len += pad2;
+ } else {
+ }
+ } else if ((bus->glom_total_len + len) % DHD_SDALIGN) {
+ len += DHD_SDALIGN
+ - ((bus->glom_total_len + len) % DHD_SDALIGN);
+ }
+ if (forcealign && (len & (ALIGNMENT - 1))) {
+ len = ROUNDUP(len, ALIGNMENT);
+ }
+
+ /* Hardware extention tag */
+ /* 2byte frame length, 1byte-, 1byte frame flag,
+ * 2byte-hdrlength, 2byte padlenght
+ */
+ hwheader1 = (act_len - SDPCM_FRAMETAG_LEN) | (1 << 24);
+ hwheader2 = (len - act_len) << 16;
+ htol32_ua_store(hwheader1, frame + SDPCM_FRAMETAG_LEN);
+ htol32_ua_store(hwheader2, frame + SDPCM_FRAMETAG_LEN + 4);
+
+ /* Post the frame pointer to sdio glom array */
+ dhd_bcmsdh_glom_post(bus, frame, len);
+ /* Save the pkt pointer in bus glom array */
+ bus->glom_pkt_arr[bus->glom_cnt] = pkt;
+ bus->glom_cnt++;
+ bus->glom_total_len += len;
+
+ /* Update the total length on the first pkt */
+ frame_tmp = (uint8*)PKTDATA(osh, bus->glom_pkt_arr[0]);
+ *(uint16*)frame_tmp = htol16(bus->glom_total_len);
+ *(((uint16*)frame_tmp) + 1) = htol16(~bus->glom_total_len);
+ }
+ } else
+#endif /* BCMSDIOH_TXGLOM */
+ {
/* Software tag: channel, sequence number, data offset */
swheader = ((chan << SDPCM_CHANNEL_SHIFT) & SDPCM_CHANNEL_MASK) | bus->tx_seq |
(((pad1 + SDPCM_HDRLEN) << SDPCM_DOFFSET_SHIFT) & SDPCM_DOFFSET_MASK);
@@ -1486,6 +1728,7 @@ dhdsdio_txpkt(dhd_bus_t *bus, void *pkt, uint chan, bool free_pkt)
}
#endif
+#ifndef BCMSPI
/* Raise len to next SDIO block to eliminate tail command */
if (bus->roundup && bus->blocksize && (len > bus->blocksize)) {
uint16 pad2 = bus->blocksize - (len % bus->blocksize);
@@ -1497,6 +1740,7 @@ dhdsdio_txpkt(dhd_bus_t *bus, void *pkt, uint chan, bool free_pkt)
} else if (len % DHD_SDALIGN) {
len += DHD_SDALIGN - (len % DHD_SDALIGN);
}
+#endif /* BCMSPI */
/* Some controllers have trouble with odd bytes -- round to even */
if (forcealign && (len & (ALIGNMENT - 1))) {
@@ -1509,6 +1753,7 @@ dhdsdio_txpkt(dhd_bus_t *bus, void *pkt, uint chan, bool free_pkt)
DHD_ERROR(("%s: sending unrounded %d-byte packet\n", __FUNCTION__, len));
#endif
}
+ }
do {
ret = dhd_bcmsdh_send_buf(bus, bcmsdh_cur_sbwad(sdh), SDIO_FUNC_2, F2SYNC,
@@ -1520,11 +1765,15 @@ dhdsdio_txpkt(dhd_bus_t *bus, void *pkt, uint chan, bool free_pkt)
DHD_ERROR(("%s: Device asleep already\n", __FUNCTION__));
} else if (ret < 0) {
/* On failure, abort the command and terminate the frame */
- DHD_INFO(("%s: sdio error %d, abort command and terminate frame.\n",
+ DHD_ERROR(("%s: sdio error %d, abort command and terminate frame.\n",
__FUNCTION__, ret));
bus->tx_sderrs++;
bcmsdh_abort(sdh, SDIO_FUNC_2);
+#ifdef BCMSPI
+ DHD_ERROR(("%s: gSPI transmit error. Check Overflow or F2-fifo-not-ready"
+ " counters.\n", __FUNCTION__));
+#endif /* BCMSPI */
bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_FRAMECTRL,
SFC_WF_TERM, NULL);
bus->f1regdata++;
@@ -1541,13 +1790,43 @@ dhdsdio_txpkt(dhd_bus_t *bus, void *pkt, uint chan, bool free_pkt)
}
}
if (ret == 0) {
+#ifdef BCMSDIOH_TXGLOM
+ if (bus->glom_enable) {
+ bus->tx_seq = (bus->tx_seq + bus->glom_cnt) % SDPCM_SEQUENCE_WRAP;
+ } else
+#endif
+ {
bus->tx_seq = (bus->tx_seq + 1) % SDPCM_SEQUENCE_WRAP;
}
+ }
} while ((ret < 0) && retrydata && retries++ < TXRETRIES);
done:
+
+#ifdef BCMSDIOH_TXGLOM
+ if (bus->glom_enable) {
+ dhd_bcmsdh_glom_clear(bus);
+ pkt_cnt = bus->glom_cnt;
+ } else
+#endif
+ {
+ pkt_cnt = 1;
+ }
/* restore pkt buffer pointer before calling tx complete routine */
+ while (pkt_cnt) {
+#ifdef BCMSDIOH_TXGLOM
+ uint32 doff;
+ if (bus->glom_enable) {
+ pkt = bus->glom_pkt_arr[bus->glom_cnt - pkt_cnt];
+ frame = (uint8*)PKTDATA(osh, pkt);
+ doff = ltoh32_ua(frame + SDPCM_FRAMETAG_LEN + SDPCM_HWEXT_LEN);
+ doff = (doff & SDPCM_DOFFSET_MASK) >> SDPCM_DOFFSET_SHIFT;
+ PKTPULL(osh, pkt, doff);
+ } else
+#endif
+ {
PKTPULL(osh, pkt, SDPCM_HDRLEN + pad1);
+ }
#ifdef PROP_TXSTATUS
if (bus->dhd->wlfc_state) {
dhd_os_sdunlock(bus->dhd);
@@ -1562,6 +1841,16 @@ done:
#ifdef PROP_TXSTATUS
}
#endif
+ pkt_cnt--;
+ }
+
+#ifdef BCMSDIOH_TXGLOM
+ /* Reset the glom array */
+ if (bus->glom_enable) {
+ bus->glom_cnt = 0;
+ bus->glom_total_len = 0;
+ }
+#endif
return ret;
}
@@ -1596,6 +1885,7 @@ dhd_bus_txdata(struct dhd_bus *bus, void *pkt)
datalen += SDPCM_TEST_HDRLEN;
}
#endif /* SDTEST */
+
#ifdef DHD_TX_DUMP
dump_data = PKTDATA(osh, pkt);
dump_data += 4; /* skip 4 bytes header */
@@ -1692,10 +1982,10 @@ dhd_bus_txdata(struct dhd_bus *bus, void *pkt)
/* Make sure back plane ht clk is on, no pending allowed */
dhdsdio_clkctl(bus, CLK_AVAIL, TRUE);
#ifndef SDTEST
- ret = dhdsdio_txpkt(bus, pkt, SDPCM_DATA_CHANNEL, TRUE);
+ ret = dhdsdio_txpkt(bus, pkt, SDPCM_DATA_CHANNEL, TRUE, FALSE);
#else
ret = dhdsdio_txpkt(bus, pkt,
- (bus->ext_loop ? SDPCM_TEST_CHANNEL : SDPCM_DATA_CHANNEL), TRUE);
+ (bus->ext_loop ? SDPCM_TEST_CHANNEL : SDPCM_DATA_CHANNEL), TRUE, FALSE);
#endif
if (ret)
bus->dhd->tx_errors++;
@@ -1729,6 +2019,10 @@ dhdsdio_sendfromq(dhd_bus_t *bus, uint maxframes)
uint cnt = 0;
uint datalen;
uint8 tx_prec_map;
+#ifdef BCMSDIOH_TXGLOM
+ uint i;
+ uint8 glom_cnt;
+#endif
dhd_pub_t *dhd = bus->dhd;
sdpcmd_regs_t *regs = bus->regs;
@@ -1744,6 +2038,48 @@ dhdsdio_sendfromq(dhd_bus_t *bus, uint maxframes)
/* Send frames until the limit or some other event */
for (cnt = 0; (cnt < maxframes) && DATAOK(bus); cnt++) {
+#ifdef BCMSDIOH_TXGLOM
+ if (bus->glom_enable) {
+ glom_cnt = MIN(DATABUFCNT(bus), bus->glomsize);
+ glom_cnt = MIN(glom_cnt, pktq_mlen(&bus->txq, tx_prec_map));
+ glom_cnt = MIN(glom_cnt, maxframes-cnt);
+
+ /* Limiting the size to 2pkts in case of copy */
+ if (bus->glom_mode == SDPCM_TXGLOM_CPY)
+ glom_cnt = MIN(glom_cnt, 5);
+
+ if (glom_cnt == 0)
+ break;
+ datalen = 0;
+ for (i = 0; i < glom_cnt; i++) {
+ dhd_os_sdlock_txq(bus->dhd);
+ if ((pkt = pktq_mdeq(&bus->txq, tx_prec_map, &prec_out)) == NULL) {
+ /* This case should not happen */
+ DHD_ERROR(("No pkts in the queue for glomming\n"));
+ dhd_os_sdunlock_txq(bus->dhd);
+ break;
+ }
+ dhd_os_sdunlock_txq(bus->dhd);
+
+ datalen += (PKTLEN(bus->dhd->osh, pkt) - SDPCM_HDRLEN);
+#ifndef SDTEST
+ ret = dhdsdio_txpkt(bus,
+ pkt,
+ SDPCM_DATA_CHANNEL,
+ TRUE,
+ (i == (glom_cnt-1))? FALSE: TRUE);
+#else
+ ret = dhdsdio_txpkt(bus,
+ pkt,
+ (bus->ext_loop ? SDPCM_TEST_CHANNEL : SDPCM_DATA_CHANNEL),
+ TRUE,
+ (i == (glom_cnt-1))? FALSE: TRUE);
+#endif
+ }
+ cnt += i-1;
+ } else
+#endif /* BCMSDIOH_TXGLOM */
+ {
dhd_os_sdlock_txq(bus->dhd);
if ((pkt = pktq_mdeq(&bus->txq, tx_prec_map, &prec_out)) == NULL) {
dhd_os_sdunlock_txq(bus->dhd);
@@ -1753,11 +2089,16 @@ dhdsdio_sendfromq(dhd_bus_t *bus, uint maxframes)
datalen = PKTLEN(bus->dhd->osh, pkt) - SDPCM_HDRLEN;
#ifndef SDTEST
- ret = dhdsdio_txpkt(bus, pkt, SDPCM_DATA_CHANNEL, TRUE);
+ ret = dhdsdio_txpkt(bus, pkt, SDPCM_DATA_CHANNEL, TRUE, FALSE);
#else
- ret = dhdsdio_txpkt(bus, pkt,
- (bus->ext_loop ? SDPCM_TEST_CHANNEL : SDPCM_DATA_CHANNEL), TRUE);
+ ret = dhdsdio_txpkt(bus,
+ pkt,
+ (bus->ext_loop ? SDPCM_TEST_CHANNEL : SDPCM_DATA_CHANNEL),
+ TRUE,
+ FALSE);
#endif
+ }
+
if (ret)
bus->dhd->tx_errors++;
else
@@ -1817,6 +2158,7 @@ dhd_bus_txctl(struct dhd_bus *bus, uchar *msg, uint msglen)
}
doff += SDPCM_HDRLEN;
+#ifndef BCMSPI
/* Round send length to next SDIO block */
if (bus->roundup && bus->blocksize && (len > bus->blocksize)) {
uint16 pad = bus->blocksize - (len % bus->blocksize);
@@ -1825,6 +2167,7 @@ dhd_bus_txctl(struct dhd_bus *bus, uchar *msg, uint msglen)
} else if (len % DHD_SDALIGN) {
len += DHD_SDALIGN - (len % DHD_SDALIGN);
}
+#endif /* BCMSPI */
/* Satisfy length-alignment requirements */
if (forcealign && (len & (ALIGNMENT - 1)))
@@ -1845,12 +2188,33 @@ dhd_bus_txctl(struct dhd_bus *bus, uchar *msg, uint msglen)
*(uint16*)frame = htol16((uint16)msglen);
*(((uint16*)frame) + 1) = htol16(~msglen);
+#ifdef BCMSDIOH_TXGLOM
+ if (bus->glom_enable) {
+ uint32 hwheader1, hwheader2;
+ /* Software tag: channel, sequence number, data offset */
+ swheader = ((SDPCM_CONTROL_CHANNEL << SDPCM_CHANNEL_SHIFT) & SDPCM_CHANNEL_MASK)
+ | bus->tx_seq
+ | ((doff << SDPCM_DOFFSET_SHIFT) & SDPCM_DOFFSET_MASK);
+ htol32_ua_store(swheader, frame + SDPCM_FRAMETAG_LEN + SDPCM_HWEXT_LEN);
+ htol32_ua_store(0, frame + SDPCM_FRAMETAG_LEN
+ + SDPCM_HWEXT_LEN + sizeof(swheader));
+
+ hwheader1 = (msglen - SDPCM_FRAMETAG_LEN) | (1 << 24);
+ hwheader2 = (len - (msglen)) << 16;
+ htol32_ua_store(hwheader1, frame + SDPCM_FRAMETAG_LEN);
+ htol32_ua_store(hwheader2, frame + SDPCM_FRAMETAG_LEN + 4);
+
+ *(uint16*)frame = htol16(len);
+ *(((uint16*)frame) + 1) = htol16(~(len));
+ } else
+#endif /* BCMSDIOH_TXGLOM */
+ {
/* Software tag: channel, sequence number, data offset */
swheader = ((SDPCM_CONTROL_CHANNEL << SDPCM_CHANNEL_SHIFT) & SDPCM_CHANNEL_MASK)
| bus->tx_seq | ((doff << SDPCM_DOFFSET_SHIFT) & SDPCM_DOFFSET_MASK);
htol32_ua_store(swheader, frame + SDPCM_FRAMETAG_LEN);
htol32_ua_store(0, frame + SDPCM_FRAMETAG_LEN + sizeof(swheader));
-
+ }
if (!TXCTLOK(bus)) {
DHD_INFO(("%s: No bus credit bus->tx_max %d, bus->tx_seq %d\n",
__FUNCTION__, bus->tx_max, bus->tx_seq));
@@ -1858,7 +2222,8 @@ dhd_bus_txctl(struct dhd_bus *bus, uchar *msg, uint msglen)
/* Send from dpc */
bus->ctrl_frame_buf = frame;
bus->ctrl_frame_len = len;
- if(!bus->dpc_sched) {
+
+ if (!bus->dpc_sched) {
bus->dpc_sched = TRUE;
dhd_sched_dpc(bus->dhd);
}
@@ -1900,12 +2265,17 @@ dhd_bus_txctl(struct dhd_bus *bus, uchar *msg, uint msglen)
DHD_ERROR(("%s: Device asleep already\n", __FUNCTION__));
} else if (ret < 0) {
/* On failure, abort the command and terminate the frame */
- DHD_ERROR(("%s: sdio error %d, abort command and terminate frame.\n",
+ DHD_INFO(("%s: sdio error %d, abort command and terminate frame.\n",
__FUNCTION__, ret));
bus->tx_sderrs++;
bcmsdh_abort(sdh, SDIO_FUNC_2);
+#ifdef BCMSPI
+ DHD_ERROR(("%s: Check Overflow or F2-fifo-not-ready counters."
+ " gSPI transmit error on control channel.\n",
+ __FUNCTION__));
+#endif /* BCMSPI */
bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_FRAMECTRL,
SFC_WF_TERM, NULL);
bus->f1regdata++;
@@ -1971,27 +2341,26 @@ dhd_bus_rxctl(struct dhd_bus *bus, uchar *msg, uint msglen)
DHD_CTL(("%s: resumed on rxctl frame, got %d expected %d\n",
__FUNCTION__, rxlen, msglen));
} else if (timeleft == 0) {
- u32 status;
- int retry = 0;
+#ifdef DHD_DEBUG
+ uint32 status, retry = 0;
R_SDREG(status, &bus->regs->intstatus, retry);
- DHD_ERROR(("%s: resumed on timeout, INT status=0x%08X\n", __FUNCTION__, status));
+ DHD_ERROR(("%s: resumed on timeout, INT status=0x%08X\n",
+ __FUNCTION__, status));
+#else
+ DHD_ERROR(("%s: resumed on timeout\n", __FUNCTION__));
+#endif /* DHD_DEBUG */
#ifdef DHD_DEBUG
-#if !defined(CUSTOMER_HW_SAMSUNG)
-#error need debug message if dongle trap occured
- if (!SLPAUTO_ENAB(bus)) {
-#endif
dhd_os_sdlock(bus->dhd);
dhdsdio_checkdied(bus, NULL, 0);
dhd_os_sdunlock(bus->dhd);
-#if !defined(CUSTOMER_HW_SAMSUNG)
- }
-#endif
#endif /* DHD_DEBUG */
} else if (pending == TRUE) {
- DHD_ERROR(("%s: canceled\n", __FUNCTION__));
- return -ERESTARTSYS;
+ /* signal pending */
+ DHD_ERROR(("%s: signal pending\n", __FUNCTION__));
+ return -EINTR;
+
} else {
- DHD_ERROR(("%s: resumed for unknown reason?\n", __FUNCTION__));
+ DHD_CTL(("%s: resumed for unknown reason?\n", __FUNCTION__));
#ifdef DHD_DEBUG
dhd_os_sdlock(bus->dhd);
dhdsdio_checkdied(bus, NULL, 0);
@@ -2060,8 +2429,10 @@ enum {
IOV_DEVCAP,
IOV_VARS,
#ifdef SOFTAP
- IOV_FWPATH
+ IOV_FWPATH,
#endif
+ IOV_TXGLOMSIZE,
+ IOV_TXGLOMMODE
};
const bcm_iovar_t dhdsdio_iovars[] = {
@@ -2107,6 +2478,8 @@ const bcm_iovar_t dhdsdio_iovars[] = {
#ifdef SOFTAP
{"fwpath", IOV_FWPATH, 0, IOVT_BUFFER, 0 },
#endif
+ {"txglomsize", IOV_TXGLOMSIZE, 0, IOVT_UINT32, 0 },
+ {"txglommode", IOV_TXGLOMMODE, 0, IOVT_UINT32, 0 },
{NULL, 0, 0, 0, 0 }
};
@@ -2358,17 +2731,16 @@ dhdsdio_readshared(dhd_bus_t *bus, sdpcm_shared_t *sh)
int rv, i;
uint32 shaddr = 0;
- shaddr = bus->ramsize - 4;
-
+ shaddr = bus->dongle_ram_base + bus->ramsize - 4;
i = 0;
do {
/* Read last word in memory to determine address of sdpcm_shared structure */
if ((rv = dhdsdio_membytes(bus, FALSE, shaddr, (uint8 *)&addr, 4)) < 0)
return rv;
- addr = ltoh32(addr);
+ addr = ltoh32(addr);
- DHD_INFO(("sdpcm_shared address 0x%08X\n", addr));
+ DHD_INFO(("sdpcm_shared address 0x%08X\n", addr));
/*
* Check if addr is valid.
@@ -2770,7 +3142,7 @@ dhd_serialconsole(dhd_bus_t *bus, bool set, bool enable, int *bcmerror)
return (int_val & uart_enab);
}
-#endif /* DHD_DEBUG */
+#endif
static int
dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, uint32 actionid, const char *name,
@@ -3029,6 +3401,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, uint32 actionid, const ch
else
bus->use_rxchain = bool_val;
break;
+#ifndef BCMSPI
case IOV_GVAL(IOV_ALIGNCTL):
int_val = (int32)dhd_alignctl;
bcopy(&int_val, arg, val_size);
@@ -3037,6 +3410,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, uint32 actionid, const ch
case IOV_SVAL(IOV_ALIGNCTL):
dhd_alignctl = bool_val;
break;
+#endif /* BCMSPI */
case IOV_GVAL(IOV_SDALIGN):
int_val = DHD_SDALIGN;
@@ -3176,6 +3550,9 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, uint32 actionid, const ch
case IOV_SVAL(IOV_SERIALCONS):
dhd_serialconsole(bus, TRUE, bool_val, &bcmerror);
break;
+
+
+
#endif /* DHD_DEBUG */
@@ -3281,6 +3658,33 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, uint32 actionid, const ch
dhdsdio_devcap_set(bus, (uint8) int_val);
break;
+#ifdef BCMSDIOH_TXGLOM
+ case IOV_GVAL(IOV_TXGLOMSIZE):
+ int_val = (int32)bus->glomsize;
+ bcopy(&int_val, arg, val_size);
+ break;
+
+ case IOV_SVAL(IOV_TXGLOMSIZE):
+ if (int_val > SDPCM_MAXGLOM_SIZE) {
+ bcmerror = BCME_ERROR;
+ } else {
+ bus->glomsize = (uint)int_val;
+ }
+ break;
+ case IOV_GVAL(IOV_TXGLOMMODE):
+ int_val = (int32)bus->glom_mode;
+ bcopy(&int_val, arg, val_size);
+ break;
+
+ case IOV_SVAL(IOV_TXGLOMMODE):
+ if ((int_val != SDPCM_TXGLOM_CPY) && (int_val != SDPCM_TXGLOM_MDESC)) {
+ bcmerror = BCME_RANGE;
+ } else {
+ if ((bus->glom_mode = bcmsdh_set_mode(bus->sdh, (uint)int_val)) != int_val)
+ bcmerror = BCME_ERROR;
+ }
+ break;
+#endif /* BCMSDIOH_TXGLOM */
default:
bcmerror = BCME_UNSUPPORTED;
break;
@@ -3313,6 +3717,8 @@ dhdsdio_write_vars(dhd_bus_t *bus)
varsize = bus->varsz ? ROUNDUP(bus->varsz, 4) : 0;
varaddr = (bus->ramsize - 4) - varsize;
+ varaddr += bus->dongle_ram_base;
+
if (bus->vars) {
if ((bus->sih->buscoretype == SDIOD_CORE_ID) && (bus->sdpcmrev == 7)) {
if (((varaddr & 0x3C) == 0x3C) && (varsize > 4)) {
@@ -3362,6 +3768,8 @@ dhdsdio_write_vars(dhd_bus_t *bus)
phys_size = REMAP_ENAB(bus) ? bus->ramsize : bus->orig_ramsize;
+ phys_size += bus->dongle_ram_base;
+
/* adjust to the user specified RAM */
DHD_INFO(("Physical memory size: %d, usable memory size: %d\n",
phys_size, bus->ramsize));
@@ -3395,6 +3803,7 @@ dhdsdio_download_state(dhd_bus_t *bus, bool enter)
{
uint retries;
int bcmerror = 0;
+ int foundcr4 = 0;
/* To enter download state, disable ARM and reset SOCRAM.
* To exit download state, simply reset ARM (default is RAM boot).
@@ -3404,11 +3813,16 @@ dhdsdio_download_state(dhd_bus_t *bus, bool enter)
if (!(si_setcore(bus->sih, ARM7S_CORE_ID, 0)) &&
!(si_setcore(bus->sih, ARMCM3_CORE_ID, 0))) {
+ if (si_setcore(bus->sih, ARMCR4_CORE_ID, 0)) {
+ foundcr4 = 1;
+ } else {
DHD_ERROR(("%s: Failed to find ARM core!\n", __FUNCTION__));
bcmerror = BCME_ERROR;
goto fail;
}
+ }
+ if (!foundcr4) {
si_core_disable(bus->sih, 0);
if (bcmsdh_regfail(bus->sdh)) {
bcmerror = BCME_SDIO_ERROR;
@@ -3441,6 +3855,19 @@ dhdsdio_download_state(dhd_bus_t *bus, bool enter)
}
}
} else {
+ /* For CR4,
+ * Halt ARM
+ * Remove ARM reset
+ * Read RAM base address [0x18_0000]
+ * [next] Download firmware
+ * [done at else] Populate the reset vector
+ * [done at else] Remove ARM halt
+ */
+ /* Halt ARM & remove reset */
+ si_core_reset(bus->sih, SICF_CPUHALT, SICF_CPUHALT);
+ }
+ } else {
+ if (!si_setcore(bus->sih, ARMCR4_CORE_ID, 0)) {
if (!(si_setcore(bus->sih, SOCRAM_CORE_ID, 0))) {
DHD_ERROR(("%s: Failed to find SOCRAM core!\n", __FUNCTION__));
bcmerror = BCME_ERROR;
@@ -3457,7 +3884,6 @@ dhdsdio_download_state(dhd_bus_t *bus, bool enter)
DHD_ERROR(("%s: could not write vars to RAM\n", __FUNCTION__));
goto fail;
}
-
/* Enable remap before ARM reset but after vars.
* No backplane access in remap mode
*/
@@ -3472,13 +3898,40 @@ dhdsdio_download_state(dhd_bus_t *bus, bool enter)
}
W_SDREG(0xFFFFFFFF, &bus->regs->intstatus, retries);
-
if (!(si_setcore(bus->sih, ARM7S_CORE_ID, 0)) &&
!(si_setcore(bus->sih, ARMCM3_CORE_ID, 0))) {
DHD_ERROR(("%s: Failed to find ARM core!\n", __FUNCTION__));
bcmerror = BCME_ERROR;
goto fail;
}
+ } else {
+ /* cr4 has no socram, but tcm's */
+ /* write vars */
+ if ((bcmerror = dhdsdio_write_vars(bus))) {
+ DHD_ERROR(("%s: could not write vars to RAM\n", __FUNCTION__));
+ goto fail;
+ }
+
+ if (!si_setcore(bus->sih, PCMCIA_CORE_ID, 0) &&
+ !si_setcore(bus->sih, SDIOD_CORE_ID, 0)) {
+ DHD_ERROR(("%s: Can't change back to SDIO core?\n", __FUNCTION__));
+ bcmerror = BCME_ERROR;
+ goto fail;
+ }
+ W_SDREG(0xFFFFFFFF, &bus->regs->intstatus, retries);
+
+ /* switch back to arm core again */
+ if (!(si_setcore(bus->sih, ARMCR4_CORE_ID, 0))) {
+ DHD_ERROR(("%s: Failed to find ARM CR4 core!\n", __FUNCTION__));
+ bcmerror = BCME_ERROR;
+ goto fail;
+ }
+ /* write address 0 with reset instruction */
+ bcmerror = dhdsdio_membytes(bus, TRUE, 0,
+ (uint8 *)&bus->resetinstr, sizeof(bus->resetinstr));
+
+ /* now remove reset and halt and continue to run CR4 */
+ }
si_core_reset(bus->sih, 0, 0);
if (bcmsdh_regfail(bus->sdh)) {
@@ -3611,7 +4064,7 @@ dhd_bus_stop(struct dhd_bus *bus, bool enforce_mutex)
{
osl_t *osh;
uint32 local_hostintmask;
- uint8 saveclk;
+ uint8 saveclk, dat;
uint retries;
int err;
if (!bus->dhd)
@@ -3627,36 +4080,45 @@ dhd_bus_stop(struct dhd_bus *bus, bool enforce_mutex)
BUS_WAKE(bus);
+ if (KSO_ENAB(bus)) {
+ /* Mask the interrupt */
+ dat = bcmsdh_cfg_read(bus->sdh, SDIO_FUNC_0, SDIOD_CCCR_INTEN, NULL);
+ dat &= ~(INTR_CTL_FUNC1_EN | INTR_CTL_FUNC2_EN);
+ bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_0, SDIOD_CCCR_INTEN, dat, NULL);
+ }
+
/* Change our idea of bus state */
bus->dhd->busstate = DHD_BUS_DOWN;
if (KSO_ENAB(bus)) {
- /* Enable clock for device interrupts */
- dhdsdio_clkctl(bus, CLK_AVAIL, FALSE);
+ /* Enable clock for device interrupts */
+ dhdsdio_clkctl(bus, CLK_AVAIL, FALSE);
- /* Disable and clear interrupts at the chip level also */
- W_SDREG(0, &bus->regs->hostintmask, retries);
- local_hostintmask = bus->hostintmask;
- bus->hostintmask = 0;
+ /* Disable and clear interrupts at the chip level also */
+ W_SDREG(0, &bus->regs->hostintmask, retries);
+ local_hostintmask = bus->hostintmask;
+ bus->hostintmask = 0;
- /* Force clocks on backplane to be sure F2 interrupt propagates */
- saveclk = bcmsdh_cfg_read(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, &err);
- if (!err) {
- bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR,
- (saveclk | SBSDIO_FORCE_HT), &err);
- }
- if (err) {
- DHD_ERROR(("%s: Failed to force clock for F2: err %d\n", __FUNCTION__, err));
- }
+ /* Force clocks on backplane to be sure F2 interrupt propagates */
+ saveclk = bcmsdh_cfg_read(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, &err);
+ if (!err) {
+ bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR,
+ (saveclk | SBSDIO_FORCE_HT), &err);
+ }
+ if (err) {
+ DHD_ERROR(("%s: Failed to force clock for F2: err %d\n", __FUNCTION__, err));
+ }
- /* Turn off the bus (F2), free any pending packets */
- DHD_INTR(("%s: disable SDIO interrupts\n", __FUNCTION__));
- bcmsdh_intr_disable(bus->sdh);
- bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_0, SDIOD_CCCR_IOEN, SDIO_FUNC_ENABLE_1, NULL);
+ /* Turn off the bus (F2), free any pending packets */
+ DHD_INTR(("%s: disable SDIO interrupts\n", __FUNCTION__));
+ bcmsdh_intr_disable(bus->sdh);
+#ifndef BCMSPI
+ bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_0, SDIOD_CCCR_IOEN, SDIO_FUNC_ENABLE_1, NULL);
+#endif /* !BCMSPI */
- /* Clear any pending interrupts now that F2 is disabled */
- W_SDREG(local_hostintmask, &bus->regs->intstatus, retries);
+ /* Clear any pending interrupts now that F2 is disabled */
+ W_SDREG(local_hostintmask, &bus->regs->intstatus, retries);
}
/* Turn off the backplane clock (only) */
@@ -3686,6 +4148,33 @@ dhd_bus_stop(struct dhd_bus *bus, bool enforce_mutex)
dhd_os_sdunlock(bus->dhd);
}
+#ifdef BCMSDIOH_TXGLOM
+void
+dhd_txglom_enable(dhd_pub_t *dhdp, bool enable)
+{
+ dhd_bus_t *bus = dhdp->bus;
+
+ char buf[256];
+ uint32 rxglom;
+ int32 ret;
+
+ if (enable) {
+ rxglom = 1;
+ memset(buf, 0, sizeof(buf));
+ bcm_mkiovar("bus:rxglom",
+ (void *)&rxglom,
+ 4, buf, sizeof(buf));
+ ret = dhd_wl_ioctl_cmd(dhdp,
+ WLC_SET_VAR, buf,
+ sizeof(buf), TRUE, 0);
+ if (!(ret < 0)) {
+ bus->glom_enable = TRUE;
+ }
+ } else {
+ bus->glom_enable = FALSE;
+ }
+}
+#endif /* BCMSDIOH_TXGLOM */
int
dhd_bus_init(dhd_pub_t *dhdp, bool enforce_mutex)
@@ -3695,7 +4184,11 @@ dhd_bus_init(dhd_pub_t *dhdp, bool enforce_mutex)
uint retries = 0;
uint8 ready, enable;
int err, ret = 0;
+#ifdef BCMSPI
+ uint32 dstatus = 0; /* gSPI device-status bits */
+#else /* BCMSPI */
uint8 saveclk;
+#endif /* BCMSPI */
DHD_TRACE(("%s: Enter\n", __FUNCTION__));
@@ -3710,9 +4203,33 @@ dhd_bus_init(dhd_pub_t *dhdp, bool enforce_mutex)
dhdsdio_clkctl(bus, CLK_AVAIL, FALSE);
if (bus->clkstate != CLK_AVAIL) {
DHD_ERROR(("%s: clock state is wrong. state = %d\n", __FUNCTION__, bus->clkstate));
+ ret = -1;
goto exit;
}
+#ifdef BCMSPI
+ /* fake "ready" for spi, wake-wlan would have already enabled F1 and F2 */
+ ready = (SDIO_FUNC_ENABLE_1 | SDIO_FUNC_ENABLE_2);
+ enable = 0;
+
+ /* Give the dongle some time to do its thing and set IOR2 */
+ dhd_timeout_start(&tmo, WAIT_F2RXFIFORDY * WAIT_F2RXFIFORDY_DELAY * 1000);
+ while (!enable && !dhd_timeout_expired(&tmo)) {
+ dstatus = bcmsdh_cfg_read_word(bus->sdh, SDIO_FUNC_0, SPID_STATUS_REG, NULL);
+ if (dstatus & STATUS_F2_RX_READY)
+ enable = TRUE;
+ }
+
+ if (enable) {
+ DHD_ERROR(("Took %u usec before dongle is ready\n", tmo.elapsed));
+ enable = ready;
+ } else {
+ DHD_ERROR(("dstatus when timed out on f2-fifo not ready = 0x%x\n", dstatus));
+ DHD_ERROR(("Waited %u usec, dongle is not ready\n", tmo.elapsed));
+ ret = -1;
+ goto exit;
+ }
+#else /* !BCMSPI */
/* Force clocks on backplane to be sure F2 interrupt propagates */
saveclk = bcmsdh_cfg_read(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, &err);
@@ -3722,6 +4239,7 @@ dhd_bus_init(dhd_pub_t *dhdp, bool enforce_mutex)
}
if (err) {
DHD_ERROR(("%s: Failed to force clock for F2: err %d\n", __FUNCTION__, err));
+ ret = -1;
goto exit;
}
@@ -3739,7 +4257,9 @@ dhd_bus_init(dhd_pub_t *dhdp, bool enforce_mutex)
while (ready != enable && !dhd_timeout_expired(&tmo))
ready = bcmsdh_cfg_read(bus->sdh, SDIO_FUNC_0, SDIOD_CCCR_IORDY, NULL);
- DHD_INFO(("%s: enable 0x%02x, ready 0x%02x (waited %uus)\n",
+#endif /* !BCMSPI */
+
+ DHD_ERROR(("%s: enable 0x%02x, ready 0x%02x (waited %uus)\n",
__FUNCTION__, enable, ready, tmo.elapsed));
@@ -3753,11 +4273,13 @@ dhd_bus_init(dhd_pub_t *dhdp, bool enforce_mutex)
/* Set up the interrupt mask and enable interrupts */
bus->hostintmask = HOSTINTMASK;
/* corerev 4 could use the newer interrupt logic to detect the frames */
+#ifndef BCMSPI
if ((bus->sih->buscoretype == SDIOD_CORE_ID) && (bus->sdpcmrev == 4) &&
(bus->rxint_mode != SDIO_DEVICE_HMB_RXINT)) {
bus->hostintmask &= ~I_HMB_FRAME_IND;
bus->hostintmask |= I_XMTDATA_AVAIL;
}
+#endif /* BCMSPI */
W_SDREG(bus->hostintmask, &bus->regs->hostintmask, retries);
bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_1, SBSDIO_WATERMARK, (uint8)watermark, &err);
@@ -3778,6 +4300,7 @@ dhd_bus_init(dhd_pub_t *dhdp, bool enforce_mutex)
}
+#ifndef BCMSPI
else {
/* Disable F2 again */
@@ -3785,13 +4308,12 @@ dhd_bus_init(dhd_pub_t *dhdp, bool enforce_mutex)
bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_0, SDIOD_CCCR_IOEN, enable, NULL);
}
-#ifdef BCM4334_CHIP
if (dhdsdio_sr_cap(bus))
dhdsdio_sr_init(bus);
else
-#endif /* BCM4334_CHIP */
bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_1,
SBSDIO_FUNC1_CHIPCLKCSR, saveclk, &err);
+#endif /* !BCMSPI */
/* If we didn't come up, turn off backplane clock */
if (dhdp->busstate != DHD_BUS_DATA)
@@ -3968,6 +4490,11 @@ done:
dhd_os_ioctl_resp_wake(bus->dhd);
}
+#ifdef CUSTOMER_HW4
+int pkt_free;
+int caller;
+void *free_ptr;
+#endif
static uint8
dhdsdio_rxglom(dhd_bus_t *bus, uint8 rxseq)
{
@@ -3990,6 +4517,9 @@ dhdsdio_rxglom(dhd_bus_t *bus, uint8 rxseq)
int ifidx = 0;
bool usechain = bus->use_rxchain;
+#ifdef CUSTOMER_HW4
+ pkt_free = 0;
+#endif
/* If packets, issue read(s) and send up packet chain */
/* Return sequence numbers consumed? */
@@ -4013,8 +4543,8 @@ dhdsdio_rxglom(dhd_bus_t *bus, uint8 rxseq)
sublen = ltoh16_ua(dptr);
dlen -= sizeof(uint16);
dptr += sizeof(uint16);
- if ((sublen < SDPCM_HDRLEN) ||
- ((num == 0) && (sublen < (2 * SDPCM_HDRLEN)))) {
+ if ((sublen < SDPCM_HDRLEN_RX) ||
+ ((num == 0) && (sublen < (2 * SDPCM_HDRLEN_RX)))) {
DHD_ERROR(("%s: descriptor len %d bad: %d\n",
__FUNCTION__, num, sublen));
pnext = NULL;
@@ -4183,10 +4713,11 @@ dhdsdio_rxglom(dhd_bus_t *bus, uint8 rxseq)
} else if (SDPCM_GLOMDESC(&dptr[SDPCM_FRAMETAG_LEN])) {
DHD_ERROR(("%s (superframe): got second descriptor?\n", __FUNCTION__));
errcode = -1;
- } else if ((doff < SDPCM_HDRLEN) ||
- (doff > (PKTLEN(osh, pfirst) - SDPCM_HDRLEN))) {
+ } else if ((doff < SDPCM_HDRLEN_RX) ||
+ (doff > (PKTLEN(osh, pfirst) - SDPCM_HDRLEN_RX))) {
DHD_ERROR(("%s (superframe): Bad data offset %d: HW %d pkt %d min %d\n",
- __FUNCTION__, doff, sublen, PKTLEN(osh, pfirst), SDPCM_HDRLEN));
+ __FUNCTION__, doff, sublen, PKTLEN(osh, pfirst),
+ SDPCM_HDRLEN_RX));
errcode = -1;
}
@@ -4230,7 +4761,7 @@ dhdsdio_rxglom(dhd_bus_t *bus, uint8 rxseq)
"len/check 0x%04x/0x%04x\n",
__FUNCTION__, num, sublen, check));
errcode = -1;
- } else if ((sublen > dlen) || (sublen < SDPCM_HDRLEN)) {
+ } else if ((sublen > dlen) || (sublen < SDPCM_HDRLEN_RX)) {
DHD_ERROR(("%s (subframe %d): length mismatch: "
"len 0x%04x, expect 0x%04x\n",
__FUNCTION__, num, sublen, dlen));
@@ -4240,9 +4771,9 @@ dhdsdio_rxglom(dhd_bus_t *bus, uint8 rxseq)
DHD_ERROR(("%s (subframe %d): bad channel %d\n",
__FUNCTION__, num, chan));
errcode = -1;
- } else if ((doff < SDPCM_HDRLEN) || (doff > sublen)) {
+ } else if ((doff < SDPCM_HDRLEN_RX) || (doff > sublen)) {
DHD_ERROR(("%s (subframe %d): Bad data offset %d: HW %d min %d\n",
- __FUNCTION__, num, doff, sublen, SDPCM_HDRLEN));
+ __FUNCTION__, num, doff, sublen, SDPCM_HDRLEN_RX));
errcode = -1;
}
}
@@ -4306,6 +4837,11 @@ dhdsdio_rxglom(dhd_bus_t *bus, uint8 rxseq)
reorder_info_len = sizeof(reorder_info_buf);
if (PKTLEN(osh, pfirst) == 0) {
+#ifdef CUSTOMER_HW4
+ pkt_free = 1;
+ caller = 1;
+ free_ptr = pfirst;
+#endif
PKTFREE(bus->dhd->osh, pfirst, FALSE);
if (plast) {
PKTSETNEXT(osh, plast, pnext);
@@ -4361,6 +4897,7 @@ dhdsdio_rxglom(dhd_bus_t *bus, uint8 rxseq)
else {
/* this packet will go up, link back into chain and count it */
plast = pfirst;
+
if (list_tail[ifidx] == NULL) {
list_head[ifidx] = list_tail[ifidx] = pfirst;
}
@@ -4382,6 +4919,7 @@ dhdsdio_rxglom(dhd_bus_t *bus, uint8 rxseq)
#endif /* DHD_DEBUG */
}
dhd_os_sdunlock_rxq(bus->dhd);
+
for (idx = 0; idx < DHD_MAX_IFS; idx++) {
if (list_head[idx]) {
void *temp;
@@ -4424,6 +4962,9 @@ dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
uint rxleft = 0; /* Remaining number of frames allowed */
int sdret; /* Return code from bcmsdh calls */
uint8 txmax; /* Maximum tx sequence offered */
+#ifdef BCMSPI
+ uint32 dstatus = 0; /* gSPI device status bits of */
+#endif /* BCMSPI */
bool len_consistent; /* Result of comparing readahead len and len from hw-hdr */
uint8 *rxbuf;
int ifidx = 0;
@@ -4436,9 +4977,13 @@ dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
bool sdtest = FALSE; /* To limit message spew from test mode */
#endif
+#ifdef CUSTOMER_HW4
+ pkt_free = 0;
+#endif
DHD_TRACE(("%s: Enter\n", __FUNCTION__));
bus->readframes = TRUE;
+
if (!KSO_ENAB(bus)) {
DHD_ERROR(("%s: KSO off\n", __FUNCTION__));
bus->readframes = FALSE;
@@ -4458,6 +5003,38 @@ dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
/* Not finished unless we encounter no more frames indication */
*finished = FALSE;
+#ifdef BCMSPI
+ /* Get pktlen from gSPI device F0 reg. */
+ if (bus->bus == SPI_BUS) {
+ /* Peek in dstatus bits and find out size to do rx-read. */
+ dstatus = bcmsdh_get_dstatus(bus->sdh);
+ if (dstatus == 0)
+ DHD_ERROR(("%s:ZERO spi dstatus, a case observed in PR61352 hit !!!\n",
+ __FUNCTION__));
+
+ DHD_TRACE(("Device status from regread = 0x%x\n", dstatus));
+ DHD_TRACE(("Device status from bit-reconstruction = 0x%x\n",
+ bcmsdh_get_dstatus((void *)bus->sdh)));
+
+ if ((dstatus & STATUS_F2_PKT_AVAILABLE) && (((dstatus & STATUS_UNDERFLOW)) == 0)) {
+ bus->nextlen = ((dstatus & STATUS_F2_PKT_LEN_MASK) >>
+ STATUS_F2_PKT_LEN_SHIFT);
+ /* '0' size with pkt-available interrupt is eqvt to 2048 bytes */
+ bus->nextlen = (bus->nextlen == 0) ? SPI_MAX_PKT_LEN : bus->nextlen;
+ if (bus->dwordmode)
+ bus->nextlen = bus->nextlen << 2;
+ DHD_TRACE(("Entering %s: length to be read from gSPI = %d\n",
+ __FUNCTION__, bus->nextlen));
+ } else {
+ if (dstatus & STATUS_F2_PKT_AVAILABLE)
+ DHD_ERROR(("Underflow during %s.\n", __FUNCTION__));
+ else
+ DHD_ERROR(("False pkt-available intr.\n"));
+ *finished = TRUE;
+ return (maxframes - rxleft);
+ }
+ }
+#endif /* BCMSPI */
for (rxseq = bus->rx_seq, rxleft = maxframes;
!bus->rxskip && rxleft && bus->dhd->busstate != DHD_BUS_DOWN;
@@ -4534,6 +5111,20 @@ dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
bus->f2rxdata++;
ASSERT(sdret != BCME_PENDING);
+#ifdef BCMSPI
+ if (bcmsdh_get_dstatus((void *)bus->sdh) &
+ STATUS_UNDERFLOW) {
+ bus->nextlen = 0;
+ *finished = TRUE;
+ DHD_ERROR(("%s: read %d control bytes failed "
+ "due to spi underflow\n",
+ __FUNCTION__, rdlen));
+ /* dhd.rx_ctlerrs is higher level */
+ bus->rxc_errors++;
+ dhd_os_sdunlock_rxq(bus->dhd);
+ continue;
+ }
+#endif /* BCMSPI */
/* Control frame failures need retransmission */
if (sdret < 0) {
@@ -4569,6 +5160,19 @@ dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
pkt, NULL, NULL);
bus->f2rxdata++;
ASSERT(sdret != BCME_PENDING);
+#ifdef BCMSPI
+ if (bcmsdh_get_dstatus((void *)bus->sdh) & STATUS_UNDERFLOW) {
+ bus->nextlen = 0;
+ *finished = TRUE;
+ DHD_ERROR(("%s (nextlen): read %d bytes failed due "
+ "to spi underflow\n",
+ __FUNCTION__, rdlen));
+ PKTFREE(bus->dhd->osh, pkt, FALSE);
+ bus->dhd->rx_errors++;
+ dhd_os_sdunlock_rxq(bus->dhd);
+ continue;
+ }
+#endif /* BCMSPI */
if (sdret < 0) {
DHD_ERROR(("%s (nextlen): read %d bytes failed: %d\n",
@@ -4587,7 +5191,7 @@ dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
dhd_os_sdunlock_rxq(bus->dhd);
/* Now check the header */
- bcopy(rxbuf, bus->rxhdr, SDPCM_HDRLEN);
+ bcopy(rxbuf, bus->rxhdr, SDPCM_HDRLEN_RX);
/* Extract hardware header fields */
len = ltoh16_ua(bus->rxhdr);
@@ -4619,7 +5223,7 @@ dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
}
/* Validate frame length */
- if (len < SDPCM_HDRLEN) {
+ if (len < SDPCM_HDRLEN_RX) {
DHD_ERROR(("%s (nextlen): HW hdr length invalid: %d\n",
__FUNCTION__, len));
dhd_os_sdlock_rxq(bus->dhd);
@@ -4630,6 +5234,21 @@ dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
}
/* Check for consistency with readahead info */
+#ifdef BCMSPI
+ if (bus->bus == SPI_BUS) {
+ if (bus->dwordmode) {
+ uint16 spilen;
+ if ((bus->sih->chip == BCM4329_CHIP_ID) &&
+ (bus->sih->chiprev == 2))
+ spilen = ROUNDUP(len, 16);
+ else
+ spilen = ROUNDUP(len, 4);
+
+ len_consistent = (nextlen != spilen);
+ } else
+ len_consistent = (nextlen != len);
+ } else
+#endif /* BCMSPI */
len_consistent = (nextlen != (ROUNDUP(len, 16) >> 4));
if (len_consistent) {
/* Mismatch, force retry w/normal header (may be >4K) */
@@ -4651,6 +5270,29 @@ dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
doff = SDPCM_DOFFSET_VALUE(&bus->rxhdr[SDPCM_FRAMETAG_LEN]);
txmax = SDPCM_WINDOW_VALUE(&bus->rxhdr[SDPCM_FRAMETAG_LEN]);
+#ifdef BCMSPI
+ /* Save the readahead length if there is one */
+ if (bus->bus == SPI_BUS) {
+ /* Use reconstructed dstatus bits and find out readahead size */
+ dstatus = bcmsdh_get_dstatus((void *)bus->sdh);
+ DHD_INFO(("Device status from bit-reconstruction = 0x%x\n",
+ bcmsdh_get_dstatus((void *)bus->sdh)));
+ if (dstatus & STATUS_F2_PKT_AVAILABLE) {
+ bus->nextlen = ((dstatus & STATUS_F2_PKT_LEN_MASK) >>
+ STATUS_F2_PKT_LEN_SHIFT);
+ bus->nextlen = (bus->nextlen == 0) ?
+ SPI_MAX_PKT_LEN : bus->nextlen;
+ if (bus->dwordmode)
+ bus->nextlen = bus->nextlen << 2;
+ DHD_INFO(("readahead len from gSPI = %d \n",
+ bus->nextlen));
+ bus->dhd->rx_readahead_cnt ++;
+ } else {
+ bus->nextlen = 0;
+ *finished = TRUE;
+ }
+ } else {
+#endif /* BCMSPI */
bus->nextlen =
bus->rxhdr[SDPCM_FRAMETAG_LEN + SDPCM_NEXTLEN_OFFSET];
if ((bus->nextlen << 4) > MAX_RX_DATASZ) {
@@ -4661,6 +5303,9 @@ dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
}
bus->dhd->rx_readahead_cnt ++;
+#ifdef BCMSPI
+ }
+#endif /* BCMSPI */
/* Handle Flow Control */
fcbits = SDPCM_FCMASK_VALUE(&bus->rxhdr[SDPCM_FRAMETAG_LEN]);
@@ -4689,9 +5334,19 @@ dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
/* Check window for sanity */
if ((uint8)(txmax - bus->tx_seq) > 0x40) {
+#ifdef BCMSPI
+ if ((bus->bus == SPI_BUS) && !(dstatus & STATUS_F2_RX_READY)) {
+ DHD_ERROR(("%s: got unlikely tx max %d with tx_seq %d\n",
+ __FUNCTION__, txmax, bus->tx_seq));
+ txmax = bus->tx_seq + 2;
+ } else {
+#endif /* BCMSPI */
DHD_ERROR(("%s: got unlikely tx max %d with tx_seq %d\n",
__FUNCTION__, txmax, bus->tx_seq));
txmax = bus->tx_max;
+#ifdef BCMSPI
+ }
+#endif /* BCMSPI */
}
bus->tx_max = txmax;
@@ -4699,7 +5354,7 @@ dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
if (DHD_BYTES_ON() && DHD_DATA_ON()) {
prhex("Rx Data", rxbuf, len);
} else if (DHD_HDRS_ON()) {
- prhex("RxHdr", bus->rxhdr, SDPCM_HDRLEN);
+ prhex("RxHdr", bus->rxhdr, SDPCM_HDRLEN_RX);
}
#endif
@@ -4732,9 +5387,9 @@ dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
}
/* Validate data offset */
- if ((doff < SDPCM_HDRLEN) || (doff > len)) {
+ if ((doff < SDPCM_HDRLEN_RX) || (doff > len)) {
DHD_ERROR(("%s (nextlen): bad data offset %d: HW len %d min %d\n",
- __FUNCTION__, doff, len, SDPCM_HDRLEN));
+ __FUNCTION__, doff, len, SDPCM_HDRLEN_RX));
dhd_os_sdlock_rxq(bus->dhd);
PKTFREE2();
dhd_os_sdunlock_rxq(bus->dhd);
@@ -4766,7 +5421,7 @@ dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
#ifdef DHD_DEBUG
if (DHD_BYTES_ON() || DHD_HDRS_ON()) {
- prhex("RxHdr", bus->rxhdr, SDPCM_HDRLEN);
+ prhex("RxHdr", bus->rxhdr, SDPCM_HDRLEN_RX);
}
#endif
@@ -4790,7 +5445,7 @@ dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
}
/* Validate frame length */
- if (len < SDPCM_HDRLEN) {
+ if (len < SDPCM_HDRLEN_RX) {
DHD_ERROR(("%s: HW hdr length invalid: %d\n", __FUNCTION__, len));
continue;
}
@@ -4802,9 +5457,9 @@ dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
txmax = SDPCM_WINDOW_VALUE(&bus->rxhdr[SDPCM_FRAMETAG_LEN]);
/* Validate data offset */
- if ((doff < SDPCM_HDRLEN) || (doff > len)) {
+ if ((doff < SDPCM_HDRLEN_RX) || (doff > len)) {
DHD_ERROR(("%s: Bad data offset %d: HW len %d, min %d seq %d\n",
- __FUNCTION__, doff, len, SDPCM_HDRLEN, seq));
+ __FUNCTION__, doff, len, SDPCM_HDRLEN_RX, seq));
bus->rx_badhdr++;
ASSERT(0);
dhdsdio_rxfail(bus, FALSE, FALSE);
@@ -4945,8 +5600,8 @@ deliver:
}
#endif
PKTSETLEN(osh, pkt, len);
- ASSERT(doff == SDPCM_HDRLEN);
- PKTPULL(osh, pkt, SDPCM_HDRLEN);
+ ASSERT(doff == SDPCM_HDRLEN_RX);
+ PKTPULL(osh, pkt, SDPCM_HDRLEN_RX);
bus->glomd = pkt;
} else {
DHD_ERROR(("%s: glom superframe w/o descriptor!\n", __FUNCTION__));
@@ -4969,6 +5624,11 @@ deliver:
if (PKTLEN(osh, pkt) == 0) {
dhd_os_sdlock_rxq(bus->dhd);
+#ifdef CUSTOMER_HW4
+ pkt_free = 1;
+ caller = 0;
+ free_ptr = pkt;
+#endif
PKTFREE(bus->dhd->osh, pkt, FALSE);
dhd_os_sdunlock_rxq(bus->dhd);
continue;
@@ -5009,6 +5669,12 @@ deliver:
if (bus->rxskip)
rxseq--;
bus->rx_seq = rxseq;
+
+ if (bus->reqbussleep)
+ {
+ dhdsdio_bussleep(bus, TRUE);
+ bus->reqbussleep = FALSE;
+ }
bus->readframes = FALSE;
return rxcount;
@@ -5051,6 +5717,7 @@ dhdsdio_hostmail(dhd_bus_t *bus)
bus->sdpcm_ver, SDPCM_PROT_VERSION));
else
DHD_INFO(("Dongle ready, protocol version %d\n", bus->sdpcm_ver));
+#ifndef BCMSPI
/* make sure for the SDIO_DEVICE_RXDATAINT_MODE_1 corecontrol is proper */
if ((bus->sih->buscoretype == SDIOD_CORE_ID) && (bus->sdpcmrev >= 4) &&
(bus->rxint_mode == SDIO_DEVICE_RXDATAINT_MODE_1)) {
@@ -5063,11 +5730,10 @@ dhdsdio_hostmail(dhd_bus_t *bus)
val = R_REG(bus->dhd->osh, &bus->regs->corecontrol);
}
+#endif /* BCMSPI */
#ifdef DHD_DEBUG
/* Retrieve console state address now that firmware should have updated it */
- // Kent: tempoprary rollback - firmware should be modified for a correct dconpoll operation
- // if(dhd_console_ms > 0)
{
sdpcm_shared_t shared;
if (dhdsdio_readshared(bus, &shared) == 0)
@@ -5209,10 +5875,12 @@ dhdsdio_dpc(dhd_bus_t *bus)
bus->fcstate = !!(newstatus & I_HMB_FC_STATE);
if (newstatus) {
bus->f1regdata++;
+#ifndef BCMSPI
if ((bus->rxint_mode == SDIO_DEVICE_RXDATAINT_MODE_0) &&
(newstatus == I_XMTDATA_AVAIL)) {
}
else
+#endif /* BCMSPI */
W_SDREG(newstatus, &regs->intstatus, retries);
}
}
@@ -5293,9 +5961,9 @@ clkwait:
DHD_INTR(("%s: enable SDIO interrupts, rxdone %d framecnt %d\n",
__FUNCTION__, rxdone, framecnt));
bus->intdis = FALSE;
-#if defined(OOB_INTR_ONLY)
+#if defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID)
bcmsdh_oob_intr_set(1);
-#endif /* (OOB_INTR_ONLY) */
+#endif /* defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID) */
bcmsdh_intr_enable(sdh);
}
@@ -5317,7 +5985,9 @@ clkwait:
if (TXCTLOK(bus) && bus->ctrl_frame_stat && (bus->clkstate == CLK_AVAIL)) {
int ret, i;
+
uint8* frame_seq = bus->ctrl_frame_buf + SDPCM_FRAMETAG_LEN;
+
if (*frame_seq != bus->tx_seq) {
DHD_INFO(("%s IOCTL frame seq lag detected!"
" frm_seq:%d != bus->tx_seq:%d, corrected\n",
@@ -5369,13 +6039,16 @@ clkwait:
txlimit -= framecnt;
}
/* Resched the DPC if ctrl cmd is pending on bus credit */
- if (bus->ctrl_frame_stat)
+ if (bus->ctrl_frame_stat) {
+ DHD_TRACE_HW4(("%s : tx_max : %d, tx_seq : %d, clkstate : %d \n",
+ __FUNCTION__, bus->tx_max, bus->tx_seq, bus->clkstate));
resched = TRUE;
+ }
/* Resched if events or tx frames are pending, else await next interrupt */
/* On failed register access, all bets are off: no resched or interrupts */
if ((bus->dhd->busstate == DHD_BUS_DOWN) || bcmsdh_regfail(sdh)) {
- if ((bus->sih->buscorerev >= 12) && !(dhdsdio_sleepcsr_get(bus) &
+ if ((bus->sih && bus->sih->buscorerev >= 12) && !(dhdsdio_sleepcsr_get(bus) &
SBSDIO_FUNC1_SLEEPCSR_KSO_MASK)) {
/* Bus failed because of KSO */
DHD_ERROR(("%s: Bus failed due to KSO\n", __FUNCTION__));
@@ -5470,9 +6143,11 @@ dhdsdio_isr(void *arg)
while (dhdsdio_dpc(bus));
DHD_OS_WAKE_UNLOCK(bus->dhd);
#else
+
bus->dpc_sched = TRUE;
dhd_sched_dpc(bus->dhd);
-#endif
+
+#endif
}
@@ -5492,7 +6167,7 @@ dhdsdio_pktgen_init(dhd_bus_t *bus)
/* Default to per-watchdog burst with 10s print time */
bus->pktgen_freq = 1;
- bus->pktgen_print = 10000 / dhd_watchdog_ms;
+ bus->pktgen_print = dhd_watchdog_ms ? (10000/dhd_watchdog_ms):0;
bus->pktgen_count = (dhd_pktgen * dhd_watchdog_ms + 999) / 1000;
/* Default to echo mode */
@@ -5584,7 +6259,7 @@ dhdsdio_pktgen(dhd_bus_t *bus)
#endif
/* Send it */
- if (dhdsdio_txpkt(bus, pkt, SDPCM_TEST_CHANNEL, TRUE)) {
+ if (dhdsdio_txpkt(bus, pkt, SDPCM_TEST_CHANNEL, TRUE, FALSE)) {
bus->pktgen_fail++;
if (bus->pktgen_stop && bus->pktgen_stop == bus->pktgen_fail)
bus->pktgen_count = 0;
@@ -5623,7 +6298,7 @@ dhdsdio_sdtest_set(dhd_bus_t *bus, uint8 count)
*data++ = (bus->pktgen_maxlen >> 8);
/* Send it */
- if (dhdsdio_txpkt(bus, pkt, SDPCM_TEST_CHANNEL, TRUE))
+ if (dhdsdio_txpkt(bus, pkt, SDPCM_TEST_CHANNEL, TRUE, FALSE))
bus->pktgen_fail++;
}
@@ -5668,7 +6343,7 @@ dhdsdio_testrcv(dhd_bus_t *bus, void *pkt, uint seq)
case SDPCM_TEST_ECHOREQ:
/* Rx->Tx turnaround ok (even on NDIS w/current implementation) */
*(uint8 *)(PKTDATA(osh, pkt)) = SDPCM_TEST_ECHORSP;
- if (dhdsdio_txpkt(bus, pkt, SDPCM_TEST_CHANNEL, TRUE) == 0) {
+ if (dhdsdio_txpkt(bus, pkt, SDPCM_TEST_CHANNEL, TRUE, FALSE) == 0) {
bus->pktgen_sent++;
} else {
bus->pktgen_fail++;
@@ -5748,7 +6423,6 @@ dhd_disable_intr(dhd_pub_t *dhdp)
bcmsdh_intr_disable(bus->sdh);
}
-
extern bool
dhd_bus_watchdog(dhd_pub_t *dhdp)
{
@@ -5778,12 +6452,21 @@ dhd_bus_watchdog(dhd_pub_t *dhdp)
/* Check device if no interrupts */
if (!bus->intr || (bus->intrcount == bus->lastintrs)) {
+#ifndef BCMSPI
if (!bus->dpc_sched) {
uint8 devpend;
devpend = bcmsdh_cfg_read(bus->sdh, SDIO_FUNC_0,
SDIOD_CCCR_INTPEND, NULL);
intstatus = devpend & (INTR_STATUS_FUNC1 | INTR_STATUS_FUNC2);
}
+#else
+ if (!bus->dpc_sched) {
+ uint32 devpend;
+ devpend = bcmsdh_cfg_read_word(bus->sdh, SDIO_FUNC_0,
+ SPID_STATUS_REG, NULL);
+ intstatus = devpend & STATUS_F2_PKT_AVAILABLE;
+ }
+#endif /* !BCMSPI */
/* If there is something, make like the ISR and schedule the DPC */
if (intstatus) {
@@ -5831,32 +6514,35 @@ dhd_bus_watchdog(dhd_pub_t *dhdp)
/* On idle timeout clear activity flag and/or turn off clock */
#ifdef DHD_USE_IDLECOUNT
-
- if (bus->activity)
- bus->activity = FALSE;
- else {
+ if (bus->activity)
+ bus->activity = FALSE;
+ else {
bus->idlecount++;
if (bus->idlecount >= bus->idletime) {
- DHD_TIMER(("%s: DHD Idle state!!\n", __FUNCTION__));
+ DHD_TIMER(("%s: DHD Idle state!!\n", __FUNCTION__));
- if (SLPAUTO_ENAB(bus)) {
- if (dhdsdio_bussleep(bus, TRUE) != BCME_BUSY)
- dhd_os_wd_timer(bus->dhd, 0);
+ if (SLPAUTO_ENAB(bus)) {
+ if (dhdsdio_bussleep(bus, TRUE) != BCME_BUSY)
+ dhd_os_wd_timer(bus->dhd, 0);
} else
- dhdsdio_clkctl(bus, CLK_NONE, FALSE);
+ dhdsdio_clkctl(bus, CLK_NONE, FALSE);
bus->idlecount = 0;
- }
- }
+ }
+ }
#else
if ((bus->idletime > 0) && (bus->clkstate == CLK_AVAIL)) {
- if (++bus->idlecount >= bus->idletime) {
+ if (++bus->idlecount > bus->idletime) {
bus->idlecount = 0;
if (bus->activity) {
bus->activity = FALSE;
- if (SLPAUTO_ENAB(bus))
- dhdsdio_bussleep(bus, TRUE);
+ if (SLPAUTO_ENAB(bus)) {
+ if (!bus->readframes)
+ dhdsdio_bussleep(bus, TRUE);
+ else
+ bus->reqbussleep = TRUE;
+ }
else
dhdsdio_clkctl(bus, CLK_NONE, FALSE);
}
@@ -5915,7 +6601,7 @@ dhd_bus_console_in(dhd_pub_t *dhdp, uchar *msg, uint msglen)
* sdpcm_sendup (RX) checks for virtual console input.
*/
if ((pkt = PKTGET(bus->dhd->osh, 4 + SDPCM_RESERVE, TRUE)) != NULL)
- dhdsdio_txpkt(bus, pkt, SDPCM_EVENT_CHANNEL, TRUE);
+ dhdsdio_txpkt(bus, pkt, SDPCM_EVENT_CHANNEL, TRUE, FALSE);
done:
if ((bus->idletime == DHD_IDLE_IMMEDIATE) && !bus->dpc_sched) {
@@ -5986,6 +6672,8 @@ dhdsdio_chipmatch(uint16 chipid)
return TRUE;
if (chipid == BCM4324_CHIP_ID)
return TRUE;
+ if (chipid == BCM4335_CHIP_ID)
+ return TRUE;
return FALSE;
}
@@ -6018,7 +6706,11 @@ dhdsdio_probe(uint16 venid, uint16 devid, uint16 bus_no, uint16 slot,
*/
dhd_txbound = DHD_TXBOUND;
dhd_rxbound = DHD_RXBOUND;
+#ifdef BCMSPI
+ dhd_alignctl = FALSE;
+#else
dhd_alignctl = TRUE;
+#endif /* BCMSPI */
sd1idle = TRUE;
dhd_readahead = TRUE;
retrydata = FALSE;
@@ -6026,7 +6718,11 @@ dhdsdio_probe(uint16 venid, uint16 devid, uint16 bus_no, uint16 slot,
dhd_dongle_memsize = 0;
dhd_txminmax = DHD_TXMINMAX;
+#ifdef BCMSPI
+ forcealign = FALSE;
+#else
forcealign = TRUE;
+#endif /* !BCMSPI */
DHD_TRACE(("%s: Enter\n", __FUNCTION__));
DHD_INFO(("%s: venid 0x%04x devid 0x%04x\n", __FUNCTION__, venid, devid));
@@ -6118,7 +6814,6 @@ dhdsdio_probe(uint16 venid, uint16 devid, uint16 bus_no, uint16 slot,
goto fail;
}
-
/* Allocate buffers */
if (!(dhdsdio_probe_malloc(bus, osh, sdh))) {
DHD_ERROR(("%s: dhdsdio_probe_malloc failed\n", __FUNCTION__));
@@ -6148,7 +6843,7 @@ dhdsdio_probe(uint16 venid, uint16 devid, uint16 bus_no, uint16 slot,
DHD_INFO(("%s: completed!!\n", __FUNCTION__));
#ifdef GET_CUSTOM_MAC_ENABLE
- /* Read MAC address from external customer place */
+ /* Read MAC address from external customer place */
memset(&ea_addr, 0, sizeof(ea_addr));
ret = dhd_custom_get_mac_address(ea_addr.octet);
if (!ret) {
@@ -6157,23 +6852,24 @@ dhdsdio_probe(uint16 venid, uint16 devid, uint16 bus_no, uint16 slot,
#endif /* GET_CUSTOM_MAC_ENABLE */
/* if firmware path present try to download and bring up bus */
- if (dhd_download_fw_on_driverload && (ret = dhd_bus_start(bus->dhd)) != 0) {
- DHD_ERROR(("%s: dhd_bus_start failed\n", __FUNCTION__));
- if (ret == BCME_NOTUP)
- goto fail;
+ if (dhd_download_fw_on_driverload) {
+ if ((ret = dhd_bus_start(bus->dhd)) != 0) {
+ DHD_ERROR(("%s: dhd_bus_start failed\n", __FUNCTION__));
+ if (ret == BCME_NOTUP)
+ goto fail;
}
+ }
/* Ok, have the per-port tell the stack we're open for business */
if (dhd_net_attach(bus->dhd, 0) != 0) {
DHD_ERROR(("%s: Net attach failed!!\n", __FUNCTION__));
goto fail;
}
-#ifdef BCMHOST_XTAL_PU_TIME_MOD
-#ifdef BCM4334_CHIP
+#if defined(CUSTOMER_HW4) && defined(BCMHOST_XTAL_PU_TIME_MOD)
bcmsdh_reg_write(bus->sdh, 0x18000620, 2, 11);
bcmsdh_reg_write(bus->sdh, 0x18000628, 4, 0x00F80001);
#endif
-#endif
+
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25))
mutex_unlock(&_dhd_sdio_mutex_lock_);
DHD_ERROR(("%s : the lock is released.\n", __FUNCTION__));
@@ -6197,13 +6893,10 @@ static bool
dhdsdio_probe_attach(struct dhd_bus *bus, osl_t *osh, void *sdh, void *regsva,
uint16 devid)
{
+#ifndef BCMSPI
int err = 0;
uint8 clkctl = 0;
-
-#ifdef BCM4334_CHECK_CHIP_REV
- uint8 data[4];
- uint32 unique_id;
-#endif
+#endif /* !BCMSPI */
bus->alp_only = TRUE;
bus->sih = NULL;
@@ -6219,8 +6912,12 @@ dhdsdio_probe_attach(struct dhd_bus *bus, osl_t *osh, void *sdh, void *regsva,
#endif /* DHD_DEBUG */
+#ifndef BCMSPI /* wake-wlan in gSPI will bring up the htavail/alpavail clocks. */
/* Force PLL off until si_attach() programs PLL control regs */
+
+
+
bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, DHD_INIT_CLKCTL1, &err);
if (!err)
clkctl = bcmsdh_cfg_read(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, &err);
@@ -6231,12 +6928,15 @@ dhdsdio_probe_attach(struct dhd_bus *bus, osl_t *osh, void *sdh, void *regsva,
goto fail;
}
+#endif /* !BCMSPI */
+
#ifdef DHD_DEBUG
if (DHD_INFO_ON()) {
uint fn, numfn;
uint8 *cis[SDIOD_MAX_IOFUNCS];
int err = 0;
+#ifndef BCMSPI
numfn = bcmsdh_query_iofnum(sdh);
ASSERT(numfn <= SDIOD_MAX_IOFUNCS);
@@ -6249,6 +6949,9 @@ dhdsdio_probe_attach(struct dhd_bus *bus, osl_t *osh, void *sdh, void *regsva,
bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR,
DHD_INIT_CLKCTL2, &err);
OSL_DELAY(65);
+#else
+ numfn = 0; /* internally func is hardcoded to 1 as gSPI has cis on F1 only */
+#endif /* !BCMSPI */
for (fn = 0; fn <= numfn; fn++) {
if (!(cis[fn] = MALLOC(osh, SBSDIO_CIS_SIZE_LIMIT))) {
@@ -6286,20 +6989,6 @@ dhdsdio_probe_attach(struct dhd_bus *bus, osl_t *osh, void *sdh, void *regsva,
bcmsdh_chipinfo(sdh, bus->sih->chip, bus->sih->chiprev);
-#ifdef BCM4334_CHECK_CHIP_REV
- if (bus->sih->chip == BCM4334_CHIP_ID) {
- g_chipver = bus->sih->chiprev;
- if (g_chipver == 0x2) {
- dhdsdio_membytes(bus, FALSE, REV_ID_ADDR, data, 4);
- unique_id = load32_ua(data);
- if (unique_id == 0x30312E36)
- g_chipver = 0x1;
- }
- } else {
- g_chipver = 0;
- }
-#endif
-
if (!dhdsdio_chipmatch((uint16)bus->sih->chip)) {
DHD_ERROR(("%s: unsupported chip: 0x%04x\n",
__FUNCTION__, bus->sih->chip));
@@ -6320,17 +7009,28 @@ dhdsdio_probe_attach(struct dhd_bus *bus, osl_t *osh, void *sdh, void *regsva,
/* Get info on the ARM and SOCRAM cores... */
if (!DHD_NOPMU(bus)) {
if ((si_setcore(bus->sih, ARM7S_CORE_ID, 0)) ||
- (si_setcore(bus->sih, ARMCM3_CORE_ID, 0))) {
+ (si_setcore(bus->sih, ARMCM3_CORE_ID, 0)) ||
+ (si_setcore(bus->sih, ARMCR4_CORE_ID, 0))) {
bus->armrev = si_corerev(bus->sih);
} else {
DHD_ERROR(("%s: failed to find ARM core!\n", __FUNCTION__));
goto fail;
}
+
+ if (!si_setcore(bus->sih, ARMCR4_CORE_ID, 0)) {
if (!(bus->orig_ramsize = si_socram_size(bus->sih))) {
DHD_ERROR(("%s: failed to find SOCRAM memory!\n", __FUNCTION__));
goto fail;
}
-
+ } else {
+ /* cr4 has a different way to find the RAM size from TCM's */
+ if (!(bus->orig_ramsize = si_tcm_size(bus->sih))) {
+ DHD_ERROR(("%s: failed to find CR4-TCM memory!\n", __FUNCTION__));
+ goto fail;
+ }
+ /* also populate base address */
+ bus->dongle_ram_base = CR4_RAM_BASE;
+ }
bus->ramsize = bus->orig_ramsize;
if (dhd_dongle_memsize)
dhd_dongle_setmemsize(bus, dhd_dongle_memsize);
@@ -6351,6 +7051,7 @@ dhdsdio_probe_attach(struct dhd_bus *bus, osl_t *osh, void *sdh, void *regsva,
/* Set core control so an SDIO reset does a backplane reset */
OR_REG(osh, &bus->regs->corecontrol, CC_BPRESEN);
+#ifndef BCMSPI
bus->rxint_mode = SDIO_DEVICE_HMB_RXINT;
if ((bus->sih->buscoretype == SDIOD_CORE_ID) && (bus->sdpcmrev >= 4) &&
@@ -6363,6 +7064,7 @@ dhdsdio_probe_attach(struct dhd_bus *bus, osl_t *osh, void *sdh, void *regsva,
val |= CC_XMTDATAAVAIL_CTRL;
W_REG(osh, &bus->regs->corecontrol, val);
}
+#endif /* BCMSPI */
pktq_init(&bus->txq, (PRIOMASK + 1), QLEN);
@@ -6375,11 +7077,20 @@ dhdsdio_probe_attach(struct dhd_bus *bus, osl_t *osh, void *sdh, void *regsva,
if ((bus->poll = (bool)dhd_poll))
bus->pollrate = 1;
+#ifdef BCMSDIOH_TXGLOM
+ /* Setting default Glom mode */
+ bus->glom_mode = SDPCM_TXGLOM_CPY;
+ /* Setting default Glom size */
+ bus->glomsize = SDPCM_DEFGLOM_SIZE;
+#endif
+
return TRUE;
fail:
- if (bus->sih != NULL)
+ if (bus->sih != NULL) {
si_detach(bus->sih);
+ bus->sih = NULL;
+ }
return FALSE;
}
@@ -6429,16 +7140,20 @@ dhdsdio_probe_init(dhd_bus_t *bus, osl_t *osh, void *sdh)
dhdsdio_pktgen_init(bus);
#endif /* SDTEST */
+#ifndef BCMSPI
/* Disable F2 to clear any intermediate frame state on the dongle */
bcmsdh_cfg_write(sdh, SDIO_FUNC_0, SDIOD_CCCR_IOEN, SDIO_FUNC_ENABLE_1, NULL);
+#endif /* !BCMSPI */
bus->dhd->busstate = DHD_BUS_DOWN;
bus->sleeping = FALSE;
bus->rxflow = FALSE;
bus->prev_rxlim_hit = 0;
+#ifndef BCMSPI
/* Done with backplane-dependent accesses, can drop clock... */
bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, 0, NULL);
+#endif /* !BCMSPI */
/* ...and initialize clock/power states */
bus->clkstate = CLK_SDONLY;
@@ -6500,6 +7215,15 @@ dhd_bus_download_firmware(struct dhd_bus *bus, osl_t *osh,
ret = dhdsdio_download_firmware(bus, osh, bus->sdh);
+#ifdef BCMSPI
+#ifdef GSPI_DWORD_MODE
+ /* Enable the dwordmode in gSPI before first F2 transaction */
+ if ((bus->sih->chip == BCM4329_CHIP_ID) && (bus->sih->chiprev > 1)) {
+ bcmsdh_dwordmode(bus->sdh, TRUE);
+ bus->dwordmode = TRUE;
+ }
+#endif /* GSPI_DWORD_MODE */
+#endif /* BCMSPI */
return ret;
}
@@ -6615,6 +7339,7 @@ dhdsdio_release_dongle(dhd_bus_t *bus, osl_t *osh, bool dongle_isolation, bool r
dhdsdio_clkctl(bus, CLK_NONE, FALSE);
}
si_detach(bus->sih);
+ bus->sih = NULL;
if (bus->vars && bus->varsz)
MFREE(osh, bus->vars, bus->varsz);
bus->vars = NULL;
@@ -6646,13 +7371,12 @@ dhdsdio_disconnect(void *ptr)
dhdsdio_release(bus, bus->dhd->osh);
}
- DHD_TRACE(("%s: Disconnected\n", __FUNCTION__));
-
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25))
mutex_unlock(&_dhd_sdio_mutex_lock_);
DHD_ERROR(("%s : the lock is released.\n", __FUNCTION__));
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) */
+ DHD_TRACE(("%s: Disconnected\n", __FUNCTION__));
}
@@ -6779,7 +7503,7 @@ dhdsdio_download_code_file(struct dhd_bus *bus, char *pfw_path)
{
int bcmerror = -1;
int offset = 0;
- uint len;
+ int len;
void *image = NULL;
uint8 *memblock = NULL, *memptr;
@@ -6799,6 +7523,11 @@ dhdsdio_download_code_file(struct dhd_bus *bus, char *pfw_path)
/* Download image */
while ((len = dhd_os_get_image_block((char*)memptr, MEMBLOCK, image))) {
+ if (len < 0) {
+ DHD_ERROR(("%s: dhd_os_get_image_block failed (%d)\n", __FUNCTION__, len));
+ bcmerror = BCME_ERROR;
+ goto err;
+ }
bcmerror = dhdsdio_membytes(bus, TRUE, offset, memptr, len);
if (bcmerror) {
DHD_ERROR(("%s: error %d on writing %d membytes at 0x%08x\n",
@@ -7016,6 +7745,20 @@ dhd_bcmsdh_send_buf(dhd_bus_t *bus, uint32 addr, uint fn, uint flags, uint8 *buf
return (bcmsdh_send_buf(bus->sdh, addr, fn, flags, buf, nbytes, pkt, complete, handle));
}
+#ifdef BCMSDIOH_TXGLOM
+static void
+dhd_bcmsdh_glom_post(dhd_bus_t *bus, uint8 *frame, uint len)
+{
+ bcmsdh_glom_post(bus->sdh, frame, len);
+}
+
+static void
+dhd_bcmsdh_glom_clear(dhd_bus_t *bus)
+{
+ bcmsdh_glom_clear(bus->sdh);
+}
+#endif
+
uint
dhd_bus_chip(struct dhd_bus *bus)
{
@@ -7061,16 +7804,19 @@ dhd_bus_devreset(dhd_pub_t *dhdp, uint8 flag)
/* Stop the bus, disable F2 */
dhd_bus_stop(bus, FALSE);
-#if defined(OOB_INTR_ONLY)
+#if defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID)
/* Clean up any pending IRQ */
bcmsdh_set_irq(FALSE);
-#endif /* defined(OOB_INTR_ONLY) */
+#endif /* defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID) */
/* Clean tx/rx buffer pointers, detach from the dongle */
dhdsdio_release_dongle(bus, bus->dhd->osh, TRUE, TRUE);
bus->dhd->dongle_reset = TRUE;
bus->dhd->up = FALSE;
+#ifdef BCMSDIOH_TXGLOM
+ dhd_txglom_enable(dhdp, FALSE);
+#endif
dhd_os_sdunlock(dhdp);
DHD_TRACE(("%s: WLAN OFF DONE\n", __FUNCTION__));
@@ -7101,10 +7847,12 @@ dhd_bus_devreset(dhd_pub_t *dhdp, uint8 flag)
/* Re-init bus, enable F2 transfer */
bcmerror = dhd_bus_init((dhd_pub_t *) bus->dhd, FALSE);
if (bcmerror == BCME_OK) {
-#if defined(OOB_INTR_ONLY)
+#if defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID)
bcmsdh_set_irq(TRUE);
+#ifndef BCMSPI_ANDROID
dhd_enable_oob_intr(bus, TRUE);
-#endif /* defined(OOB_INTR_ONLY) */
+#endif /* !BCMSPI_ANDROID */
+#endif /* defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID) */
bus->dhd->dongle_reset = FALSE;
bus->dhd->up = TRUE;
@@ -7112,9 +7860,14 @@ dhd_bus_devreset(dhd_pub_t *dhdp, uint8 flag)
#if !defined(IGNORE_ETH0_DOWN)
/* Restore flow control */
dhd_txflowcontrol(bus->dhd, ALL_INTERFACES, OFF);
-#endif
+#endif
dhd_os_wd_timer(dhdp, dhd_watchdog_ms);
-
+#ifdef BCMSDIOH_TXGLOM
+ if ((dhdp->busstate == DHD_BUS_DATA) &&
+ bcmsdh_glom_enabled()) {
+ dhd_txglom_enable(dhdp, TRUE);
+ }
+#endif /* BCMSDIOH_TXGLOM */
DHD_TRACE(("%s: WLAN ON DONE\n", __FUNCTION__));
} else {
dhd_bus_stop(bus, FALSE);
@@ -7143,6 +7896,30 @@ dhd_bus_devreset(dhd_pub_t *dhdp, uint8 flag)
return bcmerror;
}
+/* Get Chip ID version */
+uint dhd_bus_chip_id(dhd_pub_t *dhdp)
+{
+ dhd_bus_t *bus = dhdp->bus;
+
+ return bus->sih->chip;
+}
+
+/* Get Chip Rev ID version */
+uint dhd_bus_chiprev_id(dhd_pub_t *dhdp)
+{
+ dhd_bus_t *bus = dhdp->bus;
+
+ return bus->sih->chiprev;
+}
+
+/* Get Chip Pkg ID version */
+uint dhd_bus_chippkg_id(dhd_pub_t *dhdp)
+{
+ dhd_bus_t *bus = dhdp->bus;
+
+ return bus->sih->chippkg;
+}
+
int
dhd_bus_membytes(dhd_pub_t *dhdp, bool set, uint32 address, uint8 *data, uint size)
{
@@ -7151,3 +7928,65 @@ dhd_bus_membytes(dhd_pub_t *dhdp, bool set, uint32 address, uint8 *data, uint si
bus = dhdp->bus;
return dhdsdio_membytes(bus, set, address, data, size);
}
+#if defined(SUPPORT_MULTIPLE_REVISION)
+static int
+concate_revision_bcm4334(dhd_bus_t *bus, char *path, int path_len)
+{
+#define REV_ID_ADDR 0x1E008F90
+#define BCM4334_B1_UNIQUE 0x30312E36
+
+ uint chipver;
+ uint32 unique_id;
+ uint8 data[4];
+ char chipver_tag[4] = "_b0";
+
+ DHD_TRACE(("%s: BCM4334 Multiple Revision Check\n", __FUNCTION__));
+ if (bus->sih->chip != BCM4334_CHIP_ID) {
+ DHD_ERROR(("%s:Chip is not BCM4334\n", __FUNCTION__));
+ return -1;
+ }
+ chipver = bus->sih->chiprev;
+ if (chipver == 0x2) {
+ dhdsdio_membytes(bus, FALSE, REV_ID_ADDR, data, 4);
+ unique_id = load32_ua(data);
+ if (unique_id == BCM4334_B1_UNIQUE)
+ chipver = 0x01;
+ }
+ DHD_ERROR(("CHIP VER = [0x%x]\n", chipver));
+ if (chipver == 1) {
+ DHD_ERROR(("----- CHIP bcm4334_B0 -----\n"));
+ chipver_tag[2] = '0';
+ strcpy(chipver_tag, "_b0");
+ } else if (chipver == 2) {
+ DHD_ERROR(("----- CHIP bcm4334_B1 -----\n"));
+ chipver_tag[2] = '1';
+ } else if (chipver == 3) {
+ DHD_ERROR(("----- CHIP bcm4334_B2 -----\n"));
+ chipver_tag[2] = '2';
+ strcpy(chipver_tag, "_b2");
+ }
+ else {
+ DHD_ERROR(("----- Invalid chip version -----\n"));
+ return -1;
+ }
+ strcat(path, chipver_tag);
+#undef REV_ID_ADDR
+#undef BCM4334_B1_UNIQUE
+ return 0;
+}
+
+int
+concate_revision(dhd_bus_t *bus, char *path, int path_len)
+{
+
+ if (!bus || !bus->sih) {
+ DHD_ERROR(("%s:Bus is Invalid\n", __FUNCTION__));
+ return -1;
+ }
+ if (bus->sih->chip == BCM4334_CHIP_ID) {
+ return concate_revision_bcm4334(bus, path, path_len);
+ }
+ DHD_ERROR(("REVISION SPECIFIC feature is not required\n"));
+ return -1;
+}
+#endif /* MULTIPLE_REVISION */
diff --git a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_sec_feature.h b/drivers/net/wireless/bcmdhd/dhd_sec_feature.h
index d6bb7f0..1477516 100644
--- a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_sec_feature.h
+++ b/drivers/net/wireless/bcmdhd/dhd_sec_feature.h
@@ -27,11 +27,6 @@
* $Id: dhd_sec_feature.h 309548 2012-01-20 01:13:08Z $
*/
-#ifdef USE_SECFEATURE
-#include <sec_feature/GlobalConfig.h>
-#include <sec_feature/CustFeature.h>
-#endif
-
/* PROJECTS */
#if defined(CONFIG_MACH_SAMSUNG_ESPRESSO)\
@@ -54,7 +49,7 @@
#define READ_MACADDR
#endif
-#ifdef CONFIG_MACH_GC1
+#if defined CONFIG_MACH_GC1 || defined CONFIG_MACH_U1_NA_SPR
#undef USE_CID_CHECK
#define READ_MACADDR
#endif
@@ -63,11 +58,16 @@
#define READ_MACADDR
#endif
+#ifdef CONFIG_ARCH_MSM8960
+#undef WIFI_TURNOFF_DELAY
+#define WIFI_TURNOFF_DELAY 200
+#endif
+
/* REGION CODE */
#if (WLAN_REGION_CODE >= 100) && (WLAN_REGION_CODE < 200) /*EUR*/
#if (WLAN_REGION_CODE == 101) /*EUR ORG*/
-;/* GAN LITE NAT KEEPALIVE FILTER */
+/* GAN LITE NAT KEEPALIVE FILTER */
#define GAN_LITE_NAT_KEEPALIVE_FILTER
#endif
#endif
@@ -87,12 +87,8 @@
#define OKC_SUPPORT
#endif
-/* for debug */
-#ifdef RSSI_OFFSET
-#undef RSSI_OFFSET
-#define RSSI_OFFSET 8
-#else
-#define RSSI_OFFSET 8
+#ifndef ROAM_AP_ENV_DETECTION
+#define ROAM_AP_ENV_DETECTION
#endif
#undef WRITE_MACADDR
diff --git a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_wlfc.h b/drivers/net/wireless/bcmdhd/dhd_wlfc.h
index 308e318..4087351 100644
--- a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_wlfc.h
+++ b/drivers/net/wireless/bcmdhd/dhd_wlfc.h
@@ -1,12 +1,12 @@
/*
-* Copyright (C) 1999-2011, Broadcom Corporation
-*
+* Copyright (C) 1999-2012, Broadcom Corporation
+*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
-*
+*
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -14,11 +14,11 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
-*
+*
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
-* $Id: dhd_wlfc.h 294267 2011-11-04 23:41:52Z $
+* $Id: dhd_wlfc.h 341930 2012-06-29 04:51:25Z $
*
*/
#ifndef __wlfc_host_driver_definitions_h__
@@ -30,7 +30,6 @@
#define WLFC_HANGER_ITEM_STATE_FREE 1
#define WLFC_HANGER_ITEM_STATE_INUSE 2
#define WLFC_HANGER_ITEM_STATE_INUSE_SUPPRESSED 3
-
#define WLFC_PKTID_HSLOT_MASK 0xffff /* allow 16 bits only */
#define WLFC_PKTID_HSLOT_SHIFT 8
@@ -95,8 +94,11 @@ typedef struct wlfc_hanger {
#define WLFC_STATE_CLOSE 2
#define WLFC_PSQ_PREC_COUNT ((AC_COUNT + 1) * 2) /* 2 for each AC traffic and bc/mc */
+
#define WLFC_PSQ_LEN 2048
-#define WLFC_SENDQ_LEN 256 /* XXX: Match dhd_sdio txq length */
+
+#define WLFC_SENDQ_LEN 256
+
#define WLFC_FLOWCONTROL_HIWATER (2048 - 256)
#define WLFC_FLOWCONTROL_LOWATER 256
@@ -230,7 +232,7 @@ typedef struct athost_wl_status_info {
athost_wl_stat_counters_t stats;
/* the additional ones are for bc/mc and ATIM FIFO */
- int FIFO_credit[AC_COUNT + 2];
+ int FIFO_credit[AC_COUNT + 2];
/* Credit borrow counts for each FIFO from each of the other FIFOs */
int credits_borrowed[AC_COUNT + 2][AC_COUNT + 2];
diff --git a/drivers/net/wireless/bcmdhd/src/dongle/dngl_stats.h b/drivers/net/wireless/bcmdhd/dngl_stats.h
index 3b5606e..5e5a2e2 100644
--- a/drivers/net/wireless/bcmdhd/src/dongle/dngl_stats.h
+++ b/drivers/net/wireless/bcmdhd/dngl_stats.h
@@ -2,14 +2,14 @@
* Common stats definitions for clients of dongle
* ports
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -17,7 +17,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
diff --git a/drivers/net/wireless/bcmdhd/src/dongle/dngl_wlhdr.h b/drivers/net/wireless/bcmdhd/dngl_wlhdr.h
index b89928e..0e37df6 100644
--- a/drivers/net/wireless/bcmdhd/src/dongle/dngl_wlhdr.h
+++ b/drivers/net/wireless/bcmdhd/dngl_wlhdr.h
@@ -1,14 +1,14 @@
/*
* Dongle WL Header definitions
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,7 +16,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
diff --git a/drivers/net/wireless/bcmdhd/src/shared/hndpmu.c b/drivers/net/wireless/bcmdhd/hndpmu.c
index b33f1eb..ad9a9ca 100644
--- a/drivers/net/wireless/bcmdhd/src/shared/hndpmu.c
+++ b/drivers/net/wireless/bcmdhd/hndpmu.c
@@ -2,14 +2,14 @@
* Misc utility routines for accessing PMU corerev specific features
* of the SiliconBackplane-based Broadcom chips.
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -17,12 +17,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: hndpmu.c 306766 2012-01-09 00:57:57Z $
+ * $Id: hndpmu.c 357871 2012-09-20 07:17:35Z $
*/
#include <bcm_cfg.h>
@@ -109,6 +109,13 @@ static const sdiod_drive_str_t sdiod_drive_strength_tab5_1v8[] = {
/* SDIO Drive Strength to sel value table for PMU Rev 13 (3.3v) */
+/* SDIO Drive Strength to sel value table for PMU Rev 17 (1.8v) */
+static const sdiod_drive_str_t sdiod_drive_strength_tab6_1v8[] = {
+ {3, 0x3},
+ {2, 0x2},
+ {1, 0x1},
+ {0, 0x0} };
+
#define SDIOD_DRVSTR_KEY(chip, pmu) (((chip) << 16) | (pmu))
@@ -162,6 +169,11 @@ si_sdiod_drive_strength_init(si_t *sih, osl_t *osh, uint32 drivestrength)
str_mask = 0x00003800;
str_shift = 11;
break;
+ case SDIOD_DRVSTR_KEY(BCM4334_CHIP_ID, 17):
+ str_tab = (sdiod_drive_str_t *)&sdiod_drive_strength_tab6_1v8;
+ str_mask = 0x00001800;
+ str_shift = 11;
+ break;
default:
PMU_MSG(("No SDIO Drive strength init done for chip %s rev %d pmurev %d\n",
bcm_chipname(sih->chip, chn, 8), sih->chiprev, sih->pmurev));
@@ -169,7 +181,7 @@ si_sdiod_drive_strength_init(si_t *sih, osl_t *osh, uint32 drivestrength)
break;
}
- if (str_tab != NULL) {
+ if (str_tab != NULL && cc != NULL) {
uint32 cc_data_temp;
int i;
diff --git a/drivers/net/wireless/bcmdhd/include/Makefile b/drivers/net/wireless/bcmdhd/include/Makefile
new file mode 100644
index 0000000..eca939f
--- /dev/null
+++ b/drivers/net/wireless/bcmdhd/include/Makefile
@@ -0,0 +1,53 @@
+#!/bin/bash
+#
+# This script serves following purpose:
+#
+# 1. It generates native version information by querying
+# automerger maintained database to see where src/include
+# came from
+# 2. For select components, as listed in compvers.sh
+# it generates component version files
+#
+# Copyright 2005, Broadcom, Inc.
+#
+# $Id: Makefile 241686 2011-02-19 00:22:45Z prakashd $
+#
+
+SRCBASE := ..
+
+TARGETS := epivers.h
+
+ifdef VERBOSE
+export VERBOSE
+endif
+
+all release: epivers compvers
+
+# Generate epivers.h for native branch version
+epivers:
+ bash epivers.sh
+
+# Generate epivers.h for native branch version
+compvers:
+ @if [ -s "compvers.sh" ]; then \
+ echo "Generating component versions, if any"; \
+ bash compvers.sh; \
+ else \
+ echo "Skipping component version generation"; \
+ fi
+
+# Generate epivers.h for native branch version
+clean_compvers:
+ @if [ -s "compvers.sh" ]; then \
+ echo "bash compvers.sh clean"; \
+ bash compvers.sh clean; \
+ else \
+ echo "Skipping component version clean"; \
+ fi
+
+clean:
+ rm -f $(TARGETS) *.prev
+
+clean_all: clean clean_compvers
+
+.PHONY: all release clean epivers compvers clean_compvers
diff --git a/drivers/net/wireless/bcmdhd/src/include/aidmp.h b/drivers/net/wireless/bcmdhd/include/aidmp.h
index ed7401a..63513e6 100644
--- a/drivers/net/wireless/bcmdhd/src/include/aidmp.h
+++ b/drivers/net/wireless/bcmdhd/include/aidmp.h
@@ -1,14 +1,14 @@
/*
* Broadcom AMBA Interconnect definitions.
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,7 +16,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
@@ -103,7 +103,7 @@
#define AD_SZ_SZD 0x00000030
#define AD_AG32 0x00000008
#define AD_ADDR_ALIGN 0x00000fff
-#define AD_SZ_BASE 0x00001000
+#define AD_SZ_BASE 0x00001000
#define SD_SZ_MASK 0xfffff000
@@ -114,124 +114,124 @@
#ifndef _LANGUAGE_ASSEMBLY
typedef volatile struct _aidmp {
- uint32 oobselina30;
- uint32 oobselina74;
+ uint32 oobselina30;
+ uint32 oobselina74;
uint32 PAD[6];
- uint32 oobselinb30;
- uint32 oobselinb74;
+ uint32 oobselinb30;
+ uint32 oobselinb74;
uint32 PAD[6];
- uint32 oobselinc30;
- uint32 oobselinc74;
+ uint32 oobselinc30;
+ uint32 oobselinc74;
uint32 PAD[6];
- uint32 oobselind30;
- uint32 oobselind74;
+ uint32 oobselind30;
+ uint32 oobselind74;
uint32 PAD[38];
- uint32 oobselouta30;
- uint32 oobselouta74;
+ uint32 oobselouta30;
+ uint32 oobselouta74;
uint32 PAD[6];
- uint32 oobseloutb30;
- uint32 oobseloutb74;
+ uint32 oobseloutb30;
+ uint32 oobseloutb74;
uint32 PAD[6];
- uint32 oobseloutc30;
- uint32 oobseloutc74;
+ uint32 oobseloutc30;
+ uint32 oobseloutc74;
uint32 PAD[6];
- uint32 oobseloutd30;
- uint32 oobseloutd74;
+ uint32 oobseloutd30;
+ uint32 oobseloutd74;
uint32 PAD[38];
- uint32 oobsynca;
- uint32 oobseloutaen;
+ uint32 oobsynca;
+ uint32 oobseloutaen;
uint32 PAD[6];
- uint32 oobsyncb;
- uint32 oobseloutben;
+ uint32 oobsyncb;
+ uint32 oobseloutben;
uint32 PAD[6];
- uint32 oobsyncc;
- uint32 oobseloutcen;
+ uint32 oobsyncc;
+ uint32 oobseloutcen;
uint32 PAD[6];
- uint32 oobsyncd;
- uint32 oobseloutden;
+ uint32 oobsyncd;
+ uint32 oobseloutden;
uint32 PAD[38];
- uint32 oobaextwidth;
- uint32 oobainwidth;
- uint32 oobaoutwidth;
+ uint32 oobaextwidth;
+ uint32 oobainwidth;
+ uint32 oobaoutwidth;
uint32 PAD[5];
- uint32 oobbextwidth;
- uint32 oobbinwidth;
- uint32 oobboutwidth;
+ uint32 oobbextwidth;
+ uint32 oobbinwidth;
+ uint32 oobboutwidth;
uint32 PAD[5];
- uint32 oobcextwidth;
- uint32 oobcinwidth;
- uint32 oobcoutwidth;
+ uint32 oobcextwidth;
+ uint32 oobcinwidth;
+ uint32 oobcoutwidth;
uint32 PAD[5];
- uint32 oobdextwidth;
- uint32 oobdinwidth;
- uint32 oobdoutwidth;
+ uint32 oobdextwidth;
+ uint32 oobdinwidth;
+ uint32 oobdoutwidth;
uint32 PAD[37];
- uint32 ioctrlset;
- uint32 ioctrlclear;
- uint32 ioctrl;
+ uint32 ioctrlset;
+ uint32 ioctrlclear;
+ uint32 ioctrl;
uint32 PAD[61];
- uint32 iostatus;
+ uint32 iostatus;
uint32 PAD[127];
- uint32 ioctrlwidth;
- uint32 iostatuswidth;
+ uint32 ioctrlwidth;
+ uint32 iostatuswidth;
uint32 PAD[62];
- uint32 resetctrl;
- uint32 resetstatus;
- uint32 resetreadid;
- uint32 resetwriteid;
+ uint32 resetctrl;
+ uint32 resetstatus;
+ uint32 resetreadid;
+ uint32 resetwriteid;
uint32 PAD[60];
- uint32 errlogctrl;
- uint32 errlogdone;
- uint32 errlogstatus;
- uint32 errlogaddrlo;
- uint32 errlogaddrhi;
- uint32 errlogid;
- uint32 errloguser;
- uint32 errlogflags;
+ uint32 errlogctrl;
+ uint32 errlogdone;
+ uint32 errlogstatus;
+ uint32 errlogaddrlo;
+ uint32 errlogaddrhi;
+ uint32 errlogid;
+ uint32 errloguser;
+ uint32 errlogflags;
uint32 PAD[56];
- uint32 intstatus;
+ uint32 intstatus;
uint32 PAD[255];
- uint32 config;
+ uint32 config;
uint32 PAD[63];
- uint32 itcr;
+ uint32 itcr;
uint32 PAD[3];
- uint32 itipooba;
- uint32 itipoobb;
- uint32 itipoobc;
- uint32 itipoobd;
+ uint32 itipooba;
+ uint32 itipoobb;
+ uint32 itipoobc;
+ uint32 itipoobd;
uint32 PAD[4];
- uint32 itipoobaout;
- uint32 itipoobbout;
- uint32 itipoobcout;
- uint32 itipoobdout;
+ uint32 itipoobaout;
+ uint32 itipoobbout;
+ uint32 itipoobcout;
+ uint32 itipoobdout;
uint32 PAD[4];
- uint32 itopooba;
- uint32 itopoobb;
- uint32 itopoobc;
- uint32 itopoobd;
+ uint32 itopooba;
+ uint32 itopoobb;
+ uint32 itopoobc;
+ uint32 itopoobd;
uint32 PAD[4];
- uint32 itopoobain;
- uint32 itopoobbin;
- uint32 itopoobcin;
- uint32 itopoobdin;
+ uint32 itopoobain;
+ uint32 itopoobbin;
+ uint32 itopoobcin;
+ uint32 itopoobdin;
uint32 PAD[4];
- uint32 itopreset;
+ uint32 itopreset;
uint32 PAD[15];
- uint32 peripherialid4;
- uint32 peripherialid5;
- uint32 peripherialid6;
- uint32 peripherialid7;
- uint32 peripherialid0;
- uint32 peripherialid1;
- uint32 peripherialid2;
- uint32 peripherialid3;
- uint32 componentid0;
- uint32 componentid1;
- uint32 componentid2;
- uint32 componentid3;
+ uint32 peripherialid4;
+ uint32 peripherialid5;
+ uint32 peripherialid6;
+ uint32 peripherialid7;
+ uint32 peripherialid0;
+ uint32 peripherialid1;
+ uint32 peripherialid2;
+ uint32 peripherialid3;
+ uint32 componentid0;
+ uint32 componentid1;
+ uint32 componentid2;
+ uint32 componentid3;
} aidmp_t;
-#endif
+#endif
#define OOB_BUSCONFIG 0x020
@@ -372,4 +372,4 @@ typedef volatile struct _aidmp {
#define OOB_SEL_OUTEN_B_5 15
#define OOB_SEL_OUTEN_B_6 23
-#endif
+#endif
diff --git a/drivers/net/wireless/bcmdhd/src/include/bcm_cfg.h b/drivers/net/wireless/bcmdhd/include/bcm_cfg.h
index 13c5786..26da752 100644
--- a/drivers/net/wireless/bcmdhd/src/include/bcm_cfg.h
+++ b/drivers/net/wireless/bcmdhd/include/bcm_cfg.h
@@ -1,14 +1,14 @@
/*
* BCM common config options
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,7 +16,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
@@ -26,4 +26,4 @@
#ifndef _bcm_cfg_h_
#define _bcm_cfg_h_
-#endif
+#endif
diff --git a/drivers/net/wireless/bcmdhd/src/include/bcm_mpool_pub.h b/drivers/net/wireless/bcmdhd/include/bcm_mpool_pub.h
index 7d1e07a..8fe3de7 100644
--- a/drivers/net/wireless/bcmdhd/src/include/bcm_mpool_pub.h
+++ b/drivers/net/wireless/bcmdhd/include/bcm_mpool_pub.h
@@ -35,14 +35,14 @@
* and instrumentation on top of the heap, without modifying the heap
* allocation implementation.
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -50,7 +50,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
diff --git a/drivers/net/wireless/bcmdhd/src/include/bcmcdc.h b/drivers/net/wireless/bcmdhd/include/bcmcdc.h
index f502218..9bae1c2 100644
--- a/drivers/net/wireless/bcmdhd/src/include/bcmcdc.h
+++ b/drivers/net/wireless/bcmdhd/include/bcmcdc.h
@@ -4,14 +4,14 @@
*
* Definitions subject to change without notice.
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -19,46 +19,46 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: bcmcdc.h 291086 2011-10-21 01:17:24Z $
+ * $Id: bcmcdc.h 318308 2012-03-02 02:23:42Z $
*/
#ifndef _bcmcdc_h_
#define _bcmcdc_h_
#include <proto/ethernet.h>
typedef struct cdc_ioctl {
- uint32 cmd;
- uint32 len;
- uint32 flags;
- uint32 status;
+ uint32 cmd;
+ uint32 len;
+ uint32 flags;
+ uint32 status;
} cdc_ioctl_t;
#define CDC_MAX_MSG_SIZE ETHER_MAX_LEN
-#define CDCL_IOC_OUTLEN_MASK 0x0000FFFF
-
+#define CDCL_IOC_OUTLEN_MASK 0x0000FFFF
+
#define CDCL_IOC_OUTLEN_SHIFT 0
-#define CDCL_IOC_INLEN_MASK 0xFFFF0000
+#define CDCL_IOC_INLEN_MASK 0xFFFF0000
#define CDCL_IOC_INLEN_SHIFT 16
-#define CDCF_IOC_ERROR 0x01
-#define CDCF_IOC_SET 0x02
-#define CDCF_IOC_OVL_IDX_MASK 0x3c
-#define CDCF_IOC_OVL_RSV 0x40
-#define CDCF_IOC_OVL 0x80
-#define CDCF_IOC_ACTION_MASK 0xfe
-#define CDCF_IOC_ACTION_SHIFT 1
-#define CDCF_IOC_IF_MASK 0xF000
+#define CDCF_IOC_ERROR 0x01
+#define CDCF_IOC_SET 0x02
+#define CDCF_IOC_OVL_IDX_MASK 0x3c
+#define CDCF_IOC_OVL_RSV 0x40
+#define CDCF_IOC_OVL 0x80
+#define CDCF_IOC_ACTION_MASK 0xfe
+#define CDCF_IOC_ACTION_SHIFT 1
+#define CDCF_IOC_IF_MASK 0xF000
#define CDCF_IOC_IF_SHIFT 12
-#define CDCF_IOC_ID_MASK 0xFFFF0000
-#define CDCF_IOC_ID_SHIFT 16
+#define CDCF_IOC_ID_MASK 0xFFFF0000
+#define CDCF_IOC_ID_SHIFT 16
#define CDC_IOC_IF_IDX(flags) (((flags) & CDCF_IOC_IF_MASK) >> CDCF_IOC_IF_SHIFT)
#define CDC_IOC_ID(flags) (((flags) & CDCF_IOC_ID_MASK) >> CDCF_IOC_ID_SHIFT)
@@ -71,35 +71,36 @@ typedef struct cdc_ioctl {
struct bdc_header {
- uint8 flags;
- uint8 priority;
+ uint8 flags;
+ uint8 priority;
uint8 flags2;
- uint8 dataOffset;
+ uint8 dataOffset;
};
#define BDC_HEADER_LEN 4
-#define BDC_FLAG_80211_PKT 0x01
-#define BDC_FLAG_SUM_GOOD 0x04
-#define BDC_FLAG_SUM_NEEDED 0x08
-#define BDC_FLAG_VER_MASK 0xf0
-#define BDC_FLAG_VER_SHIFT 4
+#define BDC_FLAG_80211_PKT 0x01
+#define BDC_FLAG_SUM_GOOD 0x04
+#define BDC_FLAG_SUM_NEEDED 0x08
+#define BDC_FLAG_EVENT_MSG 0x08
+#define BDC_FLAG_VER_MASK 0xf0
+#define BDC_FLAG_VER_SHIFT 4
#define BDC_PRIORITY_MASK 0x07
-#define BDC_PRIORITY_FC_MASK 0xf0
-#define BDC_PRIORITY_FC_SHIFT 4
+#define BDC_PRIORITY_FC_MASK 0xf0
+#define BDC_PRIORITY_FC_SHIFT 4
-#define BDC_FLAG2_IF_MASK 0x0f
+#define BDC_FLAG2_IF_MASK 0x0f
#define BDC_FLAG2_IF_SHIFT 0
-#define BDC_FLAG2_FC_FLAG 0x10
-
+#define BDC_FLAG2_FC_FLAG 0x10
+
-#define BDC_PROTO_VER_1 1
-#define BDC_PROTO_VER 2
+#define BDC_PROTO_VER_1 1
+#define BDC_PROTO_VER 2
#define BDC_GET_IF_IDX(hdr) \
@@ -122,4 +123,4 @@ struct bdc_header {
((hdr)->flags = (((hdr)->flags & ~BDC_FLAG_PAD_MASK) | \
(((idx) & BDC_FLAG_PAD_IDX) << BDC_FLAG_PAD_SHIFT)))
-#endif
+#endif
diff --git a/drivers/net/wireless/bcmdhd/src/include/bcmdefs.h b/drivers/net/wireless/bcmdhd/include/bcmdefs.h
index cee9a1c..a35ed72 100644
--- a/drivers/net/wireless/bcmdhd/src/include/bcmdefs.h
+++ b/drivers/net/wireless/bcmdhd/include/bcmdefs.h
@@ -1,14 +1,14 @@
/*
* Misc system wide definitions
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,17 +16,20 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: bcmdefs.h 295153 2011-11-09 17:53:12Z $
+ * $Id: bcmdefs.h 316830 2012-02-23 20:29:22Z $
*/
#ifndef _bcmdefs_h_
#define _bcmdefs_h_
+
+
+
#define BCM_REFERENCE(data) ((void)(data))
@@ -37,7 +40,9 @@
typedef char STATIC_ASSERT_FAIL[(expr) ? 1 : -1]; \
}
-#define bcmreclaimed 0
+
+
+#define bcmreclaimed 0
#define _data _data
#define _fn _fn
#define BCMPREATTACHDATA(_data) _data
@@ -50,7 +55,10 @@
#define CONST const
#ifndef BCMFASTPATH
#define BCMFASTPATH
-#endif
+#define BCMFASTPATH_HOST
+#endif
+
+
#define _data _data
#define BCMROMDAT_NAME(_data) _data
@@ -63,29 +71,31 @@
#define BCMROMDAT_SPATCH(data)
-#define SI_BUS 0
-#define PCI_BUS 1
-#define PCMCIA_BUS 2
-#define SDIO_BUS 3
-#define JTAG_BUS 4
-#define USB_BUS 5
-#define SPI_BUS 6
-#define RPC_BUS 7
+#define SI_BUS 0
+#define PCI_BUS 1
+#define PCMCIA_BUS 2
+#define SDIO_BUS 3
+#define JTAG_BUS 4
+#define USB_BUS 5
+#define SPI_BUS 6
+#define RPC_BUS 7
#ifdef BCMBUSTYPE
-#define BUSTYPE(bus) (BCMBUSTYPE)
+#define BUSTYPE(bus) (BCMBUSTYPE)
#else
-#define BUSTYPE(bus) (bus)
+#define BUSTYPE(bus) (bus)
#endif
#ifdef BCMCHIPTYPE
-#define CHIPTYPE(bus) (BCMCHIPTYPE)
+#define CHIPTYPE(bus) (BCMCHIPTYPE)
#else
-#define CHIPTYPE(bus) (bus)
+#define CHIPTYPE(bus) (bus)
#endif
+
+
#if defined(BCMSPROMBUS)
#define SPROMBUS (BCMSPROMBUS)
#elif defined(SI_PCMCIA_SROM)
@@ -108,14 +118,14 @@
#endif
-#define DMADDR_MASK_32 0x0
-#define DMADDR_MASK_30 0xc0000000
-#define DMADDR_MASK_0 0xffffffff
+#define DMADDR_MASK_32 0x0
+#define DMADDR_MASK_30 0xc0000000
+#define DMADDR_MASK_0 0xffffffff
-#define DMADDRWIDTH_30 30
-#define DMADDRWIDTH_32 32
-#define DMADDRWIDTH_63 63
-#define DMADDRWIDTH_64 64
+#define DMADDRWIDTH_30 30
+#define DMADDRWIDTH_32 32
+#define DMADDRWIDTH_63 63
+#define DMADDRWIDTH_64 64
#ifdef BCMDMA64OSL
typedef struct {
@@ -144,7 +154,7 @@ typedef unsigned long dmaaddr_t;
do { \
(_pa) = (_val); \
} while (0)
-#endif /* BCMDMA64OSL */
+#endif
typedef struct {
@@ -156,18 +166,21 @@ typedef struct {
typedef struct {
- void *oshdmah;
- uint origsize;
+ void *oshdmah;
+ uint origsize;
uint nsegs;
hnddma_seg_t segs[MAX_DMA_SEGS];
} hnddma_seg_map_t;
+
+
+
#if defined(BCM_RPC_NOCOPY) || defined(BCM_RCP_TXNOCOPY)
#define BCMEXTRAHDROOM 220
-#else
+#else
#define BCMEXTRAHDROOM 172
-#endif
+#endif
#ifndef SDALIGN
@@ -185,9 +198,10 @@ typedef struct {
# undef BCMDBG_ASSERT
# undef BCMASSERT_LOG
#endif
+
#if defined(BCMASSERT_LOG)
#define BCMASSERT_SUPPORT
-#endif
+#endif
#define BITFIELD_MASK(width) \
@@ -201,23 +215,25 @@ typedef struct {
#ifdef BCMSMALL
#undef BCMSPACE
-#define bcmspace FALSE
+#define bcmspace FALSE
#else
#define BCMSPACE
-#define bcmspace TRUE
+#define bcmspace TRUE
#endif
#define MAXSZ_NVRAM_VARS 4096
+
+
#ifdef DL_NVRAM
#define NVRAM_ARRAY_MAXSIZE DL_NVRAM
#else
#define NVRAM_ARRAY_MAXSIZE MAXSZ_NVRAM_VARS
-#endif
+#endif
#ifdef BCMUSBDEV_ENABLED
extern uint32 gFWID;
#endif
-#endif /* _bcmdefs_h_ */
+#endif
diff --git a/drivers/net/wireless/bcmdhd/include/bcmdevs.h b/drivers/net/wireless/bcmdhd/include/bcmdevs.h
new file mode 100644
index 0000000..c7e06ff
--- /dev/null
+++ b/drivers/net/wireless/bcmdhd/include/bcmdevs.h
@@ -0,0 +1,495 @@
+/*
+ * Broadcom device-specific manifest constants.
+ *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
+ * Unless you and Broadcom execute a separate written software license
+ * agreement governing use of this software, this software is licensed to you
+ * under the terms of the GNU General Public License version 2 (the "GPL"),
+ * available at http://www.broadcom.com/licenses/GPLv2.php, with the
+ * following added to such license:
+ *
+ * As a special exception, the copyright holders of this software give you
+ * permission to link this software with independent modules, and to copy and
+ * distribute the resulting executable under terms of your choice, provided that
+ * you also meet, for each linked independent module, the terms and conditions of
+ * the license of that module. An independent module is a module which is not
+ * derived from this software. The special exception does not apply to any
+ * modifications of the software.
+ *
+ * Notwithstanding the above, under no circumstances may you combine this
+ * software in any way with any other Broadcom software provided under a license
+ * other than the GPL, without Broadcom's express prior written consent.
+ *
+ * $Id: bcmdevs.h 329854 2012-04-27 01:42:28Z $
+ */
+
+#ifndef _BCMDEVS_H
+#define _BCMDEVS_H
+
+
+#define VENDOR_EPIGRAM 0xfeda
+#define VENDOR_BROADCOM 0x14e4
+#define VENDOR_3COM 0x10b7
+#define VENDOR_NETGEAR 0x1385
+#define VENDOR_DIAMOND 0x1092
+#define VENDOR_INTEL 0x8086
+#define VENDOR_DELL 0x1028
+#define VENDOR_HP 0x103c
+#define VENDOR_HP_COMPAQ 0x0e11
+#define VENDOR_APPLE 0x106b
+#define VENDOR_SI_IMAGE 0x1095
+#define VENDOR_BUFFALO 0x1154
+#define VENDOR_TI 0x104c
+#define VENDOR_RICOH 0x1180
+#define VENDOR_JMICRON 0x197b
+
+
+
+#define VENDOR_BROADCOM_PCMCIA 0x02d0
+
+
+#define VENDOR_BROADCOM_SDIO 0x00BF
+
+
+#define BCM_DNGL_VID 0x0a5c
+#define BCM_DNGL_BL_PID_4328 0xbd12
+#define BCM_DNGL_BL_PID_4322 0xbd13
+#define BCM_DNGL_BL_PID_4319 0xbd16
+#define BCM_DNGL_BL_PID_43236 0xbd17
+#define BCM_DNGL_BL_PID_4332 0xbd18
+#define BCM_DNGL_BL_PID_4330 0xbd19
+#define BCM_DNGL_BL_PID_4334 0xbd1a
+#define BCM_DNGL_BL_PID_43239 0xbd1b
+#define BCM_DNGL_BL_PID_4324 0xbd1c
+#define BCM_DNGL_BL_PID_4360 0xbd1d
+
+#define BCM_DNGL_BDC_PID 0x0bdc
+#define BCM_DNGL_JTAG_PID 0x4a44
+
+
+#define BCM_HWUSB_PID_43239 43239
+
+
+#define BCM4210_DEVICE_ID 0x1072
+#define BCM4230_DEVICE_ID 0x1086
+#define BCM4401_ENET_ID 0x170c
+#define BCM3352_DEVICE_ID 0x3352
+#define BCM3360_DEVICE_ID 0x3360
+#define BCM4211_DEVICE_ID 0x4211
+#define BCM4231_DEVICE_ID 0x4231
+#define BCM4303_D11B_ID 0x4303
+#define BCM4311_D11G_ID 0x4311
+#define BCM4311_D11DUAL_ID 0x4312
+#define BCM4311_D11A_ID 0x4313
+#define BCM4328_D11DUAL_ID 0x4314
+#define BCM4328_D11G_ID 0x4315
+#define BCM4328_D11A_ID 0x4316
+#define BCM4318_D11G_ID 0x4318
+#define BCM4318_D11DUAL_ID 0x4319
+#define BCM4318_D11A_ID 0x431a
+#define BCM4325_D11DUAL_ID 0x431b
+#define BCM4325_D11G_ID 0x431c
+#define BCM4325_D11A_ID 0x431d
+#define BCM4306_D11G_ID 0x4320
+#define BCM4306_D11A_ID 0x4321
+#define BCM4306_UART_ID 0x4322
+#define BCM4306_V90_ID 0x4323
+#define BCM4306_D11DUAL_ID 0x4324
+#define BCM4306_D11G_ID2 0x4325
+#define BCM4321_D11N_ID 0x4328
+#define BCM4321_D11N2G_ID 0x4329
+#define BCM4321_D11N5G_ID 0x432a
+#define BCM4322_D11N_ID 0x432b
+#define BCM4322_D11N2G_ID 0x432c
+#define BCM4322_D11N5G_ID 0x432d
+#define BCM4329_D11N_ID 0x432e
+#define BCM4329_D11N2G_ID 0x432f
+#define BCM4329_D11N5G_ID 0x4330
+#define BCM4315_D11DUAL_ID 0x4334
+#define BCM4315_D11G_ID 0x4335
+#define BCM4315_D11A_ID 0x4336
+#define BCM4319_D11N_ID 0x4337
+#define BCM4319_D11N2G_ID 0x4338
+#define BCM4319_D11N5G_ID 0x4339
+#define BCM43231_D11N2G_ID 0x4340
+#define BCM43221_D11N2G_ID 0x4341
+#define BCM43222_D11N_ID 0x4350
+#define BCM43222_D11N2G_ID 0x4351
+#define BCM43222_D11N5G_ID 0x4352
+#define BCM43224_D11N_ID 0x4353
+#define BCM43224_D11N_ID_VEN1 0x0576
+#define BCM43226_D11N_ID 0x4354
+#define BCM43236_D11N_ID 0x4346
+#define BCM43236_D11N2G_ID 0x4347
+#define BCM43236_D11N5G_ID 0x4348
+#define BCM43225_D11N2G_ID 0x4357
+#define BCM43421_D11N_ID 0xA99D
+#define BCM4313_D11N2G_ID 0x4727
+#define BCM4330_D11N_ID 0x4360
+#define BCM4330_D11N2G_ID 0x4361
+#define BCM4330_D11N5G_ID 0x4362
+#define BCM4336_D11N_ID 0x4343
+#define BCM6362_D11N_ID 0x435f
+#define BCM4331_D11N_ID 0x4331
+#define BCM4331_D11N2G_ID 0x4332
+#define BCM4331_D11N5G_ID 0x4333
+#define BCM43237_D11N_ID 0x4355
+#define BCM43237_D11N5G_ID 0x4356
+#define BCM43227_D11N2G_ID 0x4358
+#define BCM43228_D11N_ID 0x4359
+#define BCM43228_D11N5G_ID 0x435a
+#define BCM43362_D11N_ID 0x4363
+#define BCM43239_D11N_ID 0x4370
+#define BCM4324_D11N_ID 0x4374
+#define BCM43217_D11N2G_ID 0x43a9
+#define BCM43131_D11N2G_ID 0x43aa
+#define BCM4314_D11N2G_ID 0x4364
+#define BCM43142_D11N2G_ID 0x4365
+#define BCM4334_D11N_ID 0x4380
+#define BCM4334_D11N2G_ID 0x4381
+#define BCM4334_D11N5G_ID 0x4382
+#define BCM43341_D11N_ID 0x4386
+#define BCM43341_D11N2G_ID 0x4387
+#define BCM43341_D11N5G_ID 0x4388
+#define BCM4360_D11AC_ID 0x43a0
+#define BCM4360_D11AC2G_ID 0x43a1
+#define BCM4360_D11AC5G_ID 0x43a2
+
+
+#define BCM943228HMB_SSID_VEN1 0x0607
+#define BCM94313HMGBL_SSID_VEN1 0x0608
+#define BCM94313HMG_SSID_VEN1 0x0609
+
+
+#define BCM4335_D11AC_ID 0x43ae
+#define BCM4335_D11AC2G_ID 0x43af
+#define BCM4335_D11AC5G_ID 0x43b0
+#define BCM4352_D11AC_ID 0x43b1
+#define BCM4352_D11AC2G_ID 0x43b2
+#define BCM4352_D11AC5G_ID 0x43b3
+
+#define BCMGPRS_UART_ID 0x4333
+#define BCMGPRS2_UART_ID 0x4344
+#define FPGA_JTAGM_ID 0x43f0
+#define BCM_JTAGM_ID 0x43f1
+#define SDIOH_FPGA_ID 0x43f2
+#define BCM_SDIOH_ID 0x43f3
+#define SDIOD_FPGA_ID 0x43f4
+#define SPIH_FPGA_ID 0x43f5
+#define BCM_SPIH_ID 0x43f6
+#define MIMO_FPGA_ID 0x43f8
+#define BCM_JTAGM2_ID 0x43f9
+#define SDHCI_FPGA_ID 0x43fa
+#define BCM4402_ENET_ID 0x4402
+#define BCM4402_V90_ID 0x4403
+#define BCM4410_DEVICE_ID 0x4410
+#define BCM4412_DEVICE_ID 0x4412
+#define BCM4430_DEVICE_ID 0x4430
+#define BCM4432_DEVICE_ID 0x4432
+#define BCM4704_ENET_ID 0x4706
+#define BCM4710_DEVICE_ID 0x4710
+#define BCM47XX_AUDIO_ID 0x4711
+#define BCM47XX_V90_ID 0x4712
+#define BCM47XX_ENET_ID 0x4713
+#define BCM47XX_EXT_ID 0x4714
+#define BCM47XX_GMAC_ID 0x4715
+#define BCM47XX_USBH_ID 0x4716
+#define BCM47XX_USBD_ID 0x4717
+#define BCM47XX_IPSEC_ID 0x4718
+#define BCM47XX_ROBO_ID 0x4719
+#define BCM47XX_USB20H_ID 0x471a
+#define BCM47XX_USB20D_ID 0x471b
+#define BCM47XX_ATA100_ID 0x471d
+#define BCM47XX_SATAXOR_ID 0x471e
+#define BCM47XX_GIGETH_ID 0x471f
+#define BCM4712_MIPS_ID 0x4720
+#define BCM4716_DEVICE_ID 0x4722
+#define BCM47XX_SMBUS_EMU_ID 0x47fe
+#define BCM47XX_XOR_EMU_ID 0x47ff
+#define EPI41210_DEVICE_ID 0xa0fa
+#define EPI41230_DEVICE_ID 0xa10e
+#define JINVANI_SDIOH_ID 0x4743
+#define BCM27XX_SDIOH_ID 0x2702
+#define PCIXX21_FLASHMEDIA_ID 0x803b
+#define PCIXX21_SDIOH_ID 0x803c
+#define R5C822_SDIOH_ID 0x0822
+#define JMICRON_SDIOH_ID 0x2381
+
+
+#define BCM4306_CHIP_ID 0x4306
+#define BCM4311_CHIP_ID 0x4311
+#define BCM43111_CHIP_ID 43111
+#define BCM43112_CHIP_ID 43112
+#define BCM4312_CHIP_ID 0x4312
+#define BCM4313_CHIP_ID 0x4313
+#define BCM43131_CHIP_ID 43131
+#define BCM4315_CHIP_ID 0x4315
+#define BCM4318_CHIP_ID 0x4318
+#define BCM4319_CHIP_ID 0x4319
+#define BCM4320_CHIP_ID 0x4320
+#define BCM4321_CHIP_ID 0x4321
+#define BCM43217_CHIP_ID 43217
+#define BCM4322_CHIP_ID 0x4322
+#define BCM43221_CHIP_ID 43221
+#define BCM43222_CHIP_ID 43222
+#define BCM43224_CHIP_ID 43224
+#define BCM43225_CHIP_ID 43225
+#define BCM43227_CHIP_ID 43227
+#define BCM43228_CHIP_ID 43228
+#define BCM43226_CHIP_ID 43226
+#define BCM43231_CHIP_ID 43231
+#define BCM43234_CHIP_ID 43234
+#define BCM43235_CHIP_ID 43235
+#define BCM43236_CHIP_ID 43236
+#define BCM43237_CHIP_ID 43237
+#define BCM43238_CHIP_ID 43238
+#define BCM43239_CHIP_ID 43239
+#define BCM43420_CHIP_ID 43420
+#define BCM43421_CHIP_ID 43421
+#define BCM43428_CHIP_ID 43428
+#define BCM43431_CHIP_ID 43431
+#define BCM43460_CHIP_ID 43460
+#define BCM4325_CHIP_ID 0x4325
+#define BCM4328_CHIP_ID 0x4328
+#define BCM4329_CHIP_ID 0x4329
+#define BCM4331_CHIP_ID 0x4331
+#define BCM4336_CHIP_ID 0x4336
+#define BCM43362_CHIP_ID 43362
+#define BCM4330_CHIP_ID 0x4330
+#define BCM6362_CHIP_ID 0x6362
+#define BCM4314_CHIP_ID 0x4314
+#define BCM43142_CHIP_ID 43142
+#define BCM4324_CHIP_ID 0x4324
+#define BCM43242_CHIP_ID 43242
+#define BCM4334_CHIP_ID 0x4334
+#define BCM4360_CHIP_ID 0x4360
+#define BCM4352_CHIP_ID 0x4352
+#define BCM43526_CHIP_ID 0xAA06
+#define BCM43341_CHIP_ID 43341
+#define BCM43342_CHIP_ID 43342
+
+#define BCM4335_CHIP_ID 0x4335
+
+#define BCM4342_CHIP_ID 4342
+#define BCM4402_CHIP_ID 0x4402
+#define BCM4704_CHIP_ID 0x4704
+#define BCM4706_CHIP_ID 0x5300
+#define BCM4710_CHIP_ID 0x4710
+#define BCM4712_CHIP_ID 0x4712
+#define BCM4716_CHIP_ID 0x4716
+#define BCM47162_CHIP_ID 47162
+#define BCM4748_CHIP_ID 0x4748
+#define BCM4749_CHIP_ID 0x4749
+#define BCM4785_CHIP_ID 0x4785
+#define BCM5350_CHIP_ID 0x5350
+#define BCM5352_CHIP_ID 0x5352
+#define BCM5354_CHIP_ID 0x5354
+#define BCM5365_CHIP_ID 0x5365
+#define BCM5356_CHIP_ID 0x5356
+#define BCM5357_CHIP_ID 0x5357
+#define BCM53572_CHIP_ID 53572
+
+
+#define BCM4303_PKG_ID 2
+#define BCM4309_PKG_ID 1
+#define BCM4712LARGE_PKG_ID 0
+#define BCM4712SMALL_PKG_ID 1
+#define BCM4712MID_PKG_ID 2
+#define BCM4328USBD11G_PKG_ID 2
+#define BCM4328USBDUAL_PKG_ID 3
+#define BCM4328SDIOD11G_PKG_ID 4
+#define BCM4328SDIODUAL_PKG_ID 5
+#define BCM4329_289PIN_PKG_ID 0
+#define BCM4329_182PIN_PKG_ID 1
+#define BCM5354E_PKG_ID 1
+#define BCM4716_PKG_ID 8
+#define BCM4717_PKG_ID 9
+#define BCM4718_PKG_ID 10
+#define BCM5356_PKG_NONMODE 1
+#define BCM5358U_PKG_ID 8
+#define BCM5358_PKG_ID 9
+#define BCM47186_PKG_ID 10
+#define BCM5357_PKG_ID 11
+#define BCM5356U_PKG_ID 12
+#define BCM53572_PKG_ID 8
+#define BCM5357C0_PKG_ID 8
+#define BCM47188_PKG_ID 9
+#define BCM5358C0_PKG_ID 0xa
+#define BCM5356C0_PKG_ID 0xb
+#define BCM4331TT_PKG_ID 8
+#define BCM4331TN_PKG_ID 9
+#define BCM4331TNA0_PKG_ID 0xb
+#define BCM4706L_PKG_ID 1
+
+#define HDLSIM5350_PKG_ID 1
+#define HDLSIM_PKG_ID 14
+#define HWSIM_PKG_ID 15
+#define BCM43224_FAB_CSM 0x8
+#define BCM43224_FAB_SMIC 0xa
+#define BCM4336_WLBGA_PKG_ID 0x8
+#define BCM4330_WLBGA_PKG_ID 0x0
+#define BCM4314PCIE_ARM_PKG_ID (8 | 0)
+#define BCM4314SDIO_PKG_ID (8 | 1)
+#define BCM4314PCIE_PKG_ID (8 | 2)
+#define BCM4314SDIO_ARM_PKG_ID (8 | 3)
+#define BCM4314SDIO_FPBGA_PKG_ID (8 | 4)
+#define BCM4314DEV_PKG_ID (8 | 6)
+
+#define PCIXX21_FLASHMEDIA0_ID 0x8033
+#define PCIXX21_SDIOH0_ID 0x8034
+
+
+#define BFL_BTC2WIRE 0x00000001
+#define BFL_BTCOEX 0x00000001
+#define BFL_PACTRL 0x00000002
+#define BFL_AIRLINEMODE 0x00000004
+#define BFL_ADCDIV 0x00000008
+#define BFL_RFPLL 0x00000008
+#define BFL_ENETROBO 0x00000010
+#define BFL_NOPLLDOWN 0x00000020
+#define BFL_CCKHIPWR 0x00000040
+#define BFL_ENETADM 0x00000080
+#define BFL_ENETVLAN 0x00000100
+#define BFL_UNUSED 0x00000200
+#define BFL_NOPCI 0x00000400
+#define BFL_FEM 0x00000800
+#define BFL_EXTLNA 0x00001000
+#define BFL_HGPA 0x00002000
+#define BFL_BTC2WIRE_ALTGPIO 0x00004000
+#define BFL_ALTIQ 0x00008000
+#define BFL_NOPA 0x00010000
+#define BFL_RSSIINV 0x00020000
+#define BFL_PAREF 0x00040000
+#define BFL_3TSWITCH 0x00080000
+#define BFL_PHASESHIFT 0x00100000
+#define BFL_BUCKBOOST 0x00200000
+#define BFL_FEM_BT 0x00400000
+#define BFL_NOCBUCK 0x00800000
+#define BFL_CCKFAVOREVM 0x01000000
+#define BFL_PALDO 0x02000000
+#define BFL_LNLDO2_2P5 0x04000000
+#define BFL_FASTPWR 0x08000000
+#define BFL_UCPWRCTL_MININDX 0x08000000
+#define BFL_EXTLNA_5GHz 0x10000000
+#define BFL_TRSW_1by2 0x20000000
+#define BFL_LO_TRSW_R_5GHz 0x40000000
+#define BFL_ELNA_GAINDEF 0x80000000
+#define BFL_EXTLNA_TX 0x20000000
+
+
+#define BFL2_RXBB_INT_REG_DIS 0x00000001
+#define BFL2_APLL_WAR 0x00000002
+#define BFL2_TXPWRCTRL_EN 0x00000004
+#define BFL2_2X4_DIV 0x00000008
+#define BFL2_5G_PWRGAIN 0x00000010
+#define BFL2_PCIEWAR_OVR 0x00000020
+#define BFL2_CAESERS_BRD 0x00000040
+#define BFL2_BTC3WIRE 0x00000080
+#define BFL2_BTCLEGACY 0x00000080
+#define BFL2_SKWRKFEM_BRD 0x00000100
+#define BFL2_SPUR_WAR 0x00000200
+#define BFL2_GPLL_WAR 0x00000400
+#define BFL2_TRISTATE_LED 0x00000800
+#define BFL2_SINGLEANT_CCK 0x00001000
+#define BFL2_2G_SPUR_WAR 0x00002000
+#define BFL2_BPHY_ALL_TXCORES 0x00004000
+#define BFL2_FCC_BANDEDGE_WAR 0x00008000
+#define BFL2_GPLL_WAR2 0x00010000
+#define BFL2_IPALVLSHIFT_3P3 0x00020000
+#define BFL2_INTERNDET_TXIQCAL 0x00040000
+#define BFL2_XTALBUFOUTEN 0x00080000
+
+
+
+#define BFL2_ANAPACTRL_2G 0x00100000
+#define BFL2_ANAPACTRL_5G 0x00200000
+#define BFL2_ELNACTRL_TRSW_2G 0x00400000
+#define BFL2_BT_SHARE_ANT0 0x00800000
+#define BFL2_TEMPSENSE_HIGHER 0x01000000
+#define BFL2_BTC3WIREONLY 0x02000000
+#define BFL2_PWR_NOMINAL 0x04000000
+#define BFL2_EXTLNA_PWRSAVE 0x08000000
+
+#define BFL2_4313_RADIOREG 0x10000000
+
+#define BFL2_SDR_EN 0x20000000
+
+
+#define BOARD_GPIO_BTC3W_IN 0x850
+#define BOARD_GPIO_BTC3W_OUT 0x020
+#define BOARD_GPIO_BTCMOD_IN 0x010
+#define BOARD_GPIO_BTCMOD_OUT 0x020
+#define BOARD_GPIO_BTC_IN 0x080
+#define BOARD_GPIO_BTC_OUT 0x100
+#define BOARD_GPIO_PACTRL 0x200
+#define BOARD_GPIO_12 0x1000
+#define BOARD_GPIO_13 0x2000
+#define BOARD_GPIO_BTC4_IN 0x0800
+#define BOARD_GPIO_BTC4_BT 0x2000
+#define BOARD_GPIO_BTC4_STAT 0x4000
+#define BOARD_GPIO_BTC4_WLAN 0x8000
+#define BOARD_GPIO_1_WLAN_PWR 0x02
+#define BOARD_GPIO_3_WLAN_PWR 0x08
+#define BOARD_GPIO_4_WLAN_PWR 0x10
+
+#define GPIO_BTC4W_OUT_4312 0x010
+#define GPIO_BTC4W_OUT_43224 0x020
+#define GPIO_BTC4W_OUT_43224_SHARED 0x0e0
+#define GPIO_BTC4W_OUT_43225 0x0e0
+#define GPIO_BTC4W_OUT_43421 0x020
+#define GPIO_BTC4W_OUT_4313 0x060
+#define GPIO_BTC4W_OUT_4331_SHARED 0x010
+
+#define PCI_CFG_GPIO_SCS 0x10
+#define PCI_CFG_GPIO_HWRAD 0x20
+#define PCI_CFG_GPIO_XTAL 0x40
+#define PCI_CFG_GPIO_PLL 0x80
+
+
+#define PLL_DELAY 150
+#define FREF_DELAY 200
+#define MIN_SLOW_CLK 32
+#define XTAL_ON_DELAY 1000
+
+
+
+#define BCM943341WLABGS_SSID 0x062d
+
+
+#define GPIO_NUMPINS 32
+
+
+#define RDL_RAM_BASE_4319 0x60000000
+#define RDL_RAM_BASE_4329 0x60000000
+#define RDL_RAM_SIZE_4319 0x48000
+#define RDL_RAM_SIZE_4329 0x48000
+#define RDL_RAM_SIZE_43236 0x70000
+#define RDL_RAM_BASE_43236 0x60000000
+#define RDL_RAM_SIZE_4328 0x60000
+#define RDL_RAM_BASE_4328 0x80000000
+#define RDL_RAM_SIZE_4322 0x60000
+#define RDL_RAM_BASE_4322 0x60000000
+
+
+#define MUXENAB_UART 0x00000001
+#define MUXENAB_GPIO 0x00000002
+#define MUXENAB_ERCX 0x00000004
+#define MUXENAB_JTAG 0x00000008
+#define MUXENAB_HOST_WAKE 0x00000010
+#define MUXENAB_I2S_EN 0x00000020
+#define MUXENAB_I2S_MASTER 0x00000040
+#define MUXENAB_I2S_FULL 0x00000080
+#define MUXENAB_SFLASH 0x00000100
+#define MUXENAB_RFSWCTRL0 0x00000200
+#define MUXENAB_RFSWCTRL1 0x00000400
+#define MUXENAB_RFSWCTRL2 0x00000800
+#define MUXENAB_SECI 0x00001000
+#define MUXENAB_BT_LEGACY 0x00002000
+#define MUXENAB_HOST_WAKE1 0x00004000
+
+
+#define FLASH_KERNEL_NFLASH 0x00000001
+#define FLASH_BOOT_NFLASH 0x00000002
+
+#endif
diff --git a/drivers/net/wireless/bcmdhd/src/include/bcmendian.h b/drivers/net/wireless/bcmdhd/include/bcmendian.h
index 38d6bb0..22eb7db 100644
--- a/drivers/net/wireless/bcmdhd/src/include/bcmendian.h
+++ b/drivers/net/wireless/bcmdhd/include/bcmendian.h
@@ -1,14 +1,14 @@
/*
* Byte order utilities
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,7 +16,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
@@ -67,7 +67,7 @@
#define htol16(i) (i)
#define HTOL32(i) (i)
#define htol32(i) (i)
-#endif
+#endif
#define ltoh16_buf(buf, i)
#define htol16_buf(buf, i)
@@ -175,7 +175,7 @@
_NTOH32_UA(_bytes); \
})
-#else
+#else
static INLINE uint16
@@ -274,5 +274,5 @@ ntoh32_ua(const void *bytes)
return _NTOH32_UA((const uint8 *)bytes);
}
-#endif
-#endif
+#endif
+#endif
diff --git a/drivers/net/wireless/bcmdhd/src/include/bcmnvram.h b/drivers/net/wireless/bcmdhd/include/bcmnvram.h
index 62da907..ce0e035 100644
--- a/drivers/net/wireless/bcmdhd/src/include/bcmnvram.h
+++ b/drivers/net/wireless/bcmdhd/include/bcmnvram.h
@@ -1,14 +1,14 @@
/*
* NVRAM variable manipulation
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,12 +16,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: bcmnvram.h 288000 2011-10-05 19:05:16Z $
+ * $Id: bcmnvram.h 320632 2012-03-12 19:22:42Z $
*/
#ifndef _bcmnvram_h_
@@ -35,9 +35,9 @@
struct nvram_header {
uint32 magic;
uint32 len;
- uint32 crc_ver_init;
- uint32 config_refresh;
- uint32 config_ncdl;
+ uint32 crc_ver_init;
+ uint32 config_refresh;
+ uint32 config_ncdl;
};
struct nvram_tuple {
@@ -109,12 +109,12 @@ extern int nvram_getall(char *nvram_buf, int count);
uint8 nvram_calc_crc(struct nvram_header * nvh);
-#endif
+#endif
#define NVRAM_SOFTWARE_VERSION "1"
-#define NVRAM_MAGIC 0x48534C46
+#define NVRAM_MAGIC 0x48534C46
#define NVRAM_CLEAR_MAGIC 0x0
#define NVRAM_INVALID_MAGIC 0xFFFFFFFF
#define NVRAM_VERSION 1
@@ -124,8 +124,8 @@ uint8 nvram_calc_crc(struct nvram_header * nvh);
#define NVRAM_MAX_VALUE_LEN 255
#define NVRAM_MAX_PARAM_LEN 64
-#define NVRAM_CRC_START_POSITION 9
-#define NVRAM_CRC_VER_MASK 0xffffff00
+#define NVRAM_CRC_START_POSITION 9
+#define NVRAM_CRC_VER_MASK 0xffffff00
#define NVRAM_START_COMPRESSED 0x400
@@ -133,4 +133,47 @@ uint8 nvram_calc_crc(struct nvram_header * nvh);
#define BCM_JUMBO_NVRAM_DELIMIT '\n'
#define BCM_JUMBO_START "Broadcom Jumbo Nvram file"
+
+#if (defined(FAILSAFE_UPGRADE) || defined(CONFIG_FAILSAFE_UPGRADE) || \
+ defined(__CONFIG_FAILSAFE_UPGRADE_SUPPORT__))
+#define IMAGE_SIZE "image_size"
+#define BOOTPARTITION "bootpartition"
+#define IMAGE_BOOT BOOTPARTITION
+#define PARTIALBOOTS "partialboots"
+#define MAXPARTIALBOOTS "maxpartialboots"
+#define IMAGE_1ST_FLASH_TRX "flash0.trx"
+#define IMAGE_1ST_FLASH_OS "flash0.os"
+#define IMAGE_2ND_FLASH_TRX "flash0.trx2"
+#define IMAGE_2ND_FLASH_OS "flash0.os2"
+#define IMAGE_FIRST_OFFSET "image_first_offset"
+#define IMAGE_SECOND_OFFSET "image_second_offset"
+#define LINUX_FIRST "linux"
+#define LINUX_SECOND "linux2"
#endif
+
+#if (defined(DUAL_IMAGE) || defined(CONFIG_DUAL_IMAGE) || \
+ defined(__CONFIG_DUAL_IMAGE_FLASH_SUPPORT__))
+
+#define IMAGE_BOOT "image_boot"
+#define BOOTPARTITION IMAGE_BOOT
+
+#define IMAGE_1ST_FLASH_TRX "flash0.trx"
+#define IMAGE_1ST_FLASH_OS "flash0.os"
+#define IMAGE_2ND_FLASH_TRX "flash0.trx2"
+#define IMAGE_2ND_FLASH_OS "flash0.os2"
+#define IMAGE_SIZE "image_size"
+
+
+#define IMAGE_FIRST_OFFSET "image_first_offset"
+#define IMAGE_SECOND_OFFSET "image_second_offset"
+
+
+#define LINUX_FIRST "linux"
+#define LINUX_SECOND "linux2"
+#define POLICY_TOGGLE "toggle"
+#define LINUX_PART_TO_FLASH "linux_to_flash"
+#define LINUX_FLASH_POLICY "linux_flash_policy"
+
+#endif
+
+#endif
diff --git a/drivers/net/wireless/bcmdhd/src/include/bcmpcispi.h b/drivers/net/wireless/bcmdhd/include/bcmpcispi.h
index 0c4b393..44b263c 100644
--- a/drivers/net/wireless/bcmdhd/src/include/bcmpcispi.h
+++ b/drivers/net/wireless/bcmdhd/include/bcmpcispi.h
@@ -1,14 +1,14 @@
/*
* Broadcom PCI-SPI Host Controller Register Definitions
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,7 +16,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
diff --git a/drivers/net/wireless/bcmdhd/src/include/bcmperf.h b/drivers/net/wireless/bcmdhd/include/bcmperf.h
index 5373817..7438307 100644
--- a/drivers/net/wireless/bcmdhd/src/include/bcmperf.h
+++ b/drivers/net/wireless/bcmdhd/include/bcmperf.h
@@ -1,14 +1,14 @@
/*
* Performance counters software interface.
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,7 +16,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
diff --git a/drivers/net/wireless/bcmdhd/src/include/bcmsdbus.h b/drivers/net/wireless/bcmdhd/include/bcmsdbus.h
index de5cd87..29657d7 100644
--- a/drivers/net/wireless/bcmdhd/src/include/bcmsdbus.h
+++ b/drivers/net/wireless/bcmdhd/include/bcmsdbus.h
@@ -2,14 +2,14 @@
* Definitions for API from sdio common code (bcmsdh) to individual
* host controller drivers.
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -17,12 +17,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: bcmsdbus.h 299859 2011-12-01 03:53:27Z $
+ * $Id: bcmsdbus.h 347614 2012-07-27 10:24:51Z $
*/
#ifndef _sdio_api_h_
@@ -46,6 +46,15 @@
#define SDIOH_DATA_PIO 0 /* PIO mode */
#define SDIOH_DATA_DMA 1 /* DMA mode */
+#ifdef BCMSDIOH_TXGLOM
+/* Max number of glommed pkts */
+#define SDPCM_MAXGLOM_SIZE 10
+#define SDPCM_DEFGLOM_SIZE 3
+
+#define SDPCM_TXGLOM_CPY 0 /* SDIO 2.0 should use copy mode */
+#define SDPCM_TXGLOM_MDESC 1 /* SDIO 3.0 should use multi-desc mode */
+#endif
+
typedef int SDIOH_API_RC;
@@ -86,6 +95,18 @@ extern SDIOH_API_RC sdioh_request_buffer(sdioh_info_t *si, uint pio_dma, uint fi
uint rw, uint fnc_num, uint32 addr, uint regwidth, uint32 buflen, uint8 *buffer,
void *pkt);
+#ifdef BCMSDIOH_TXGLOM
+extern void sdioh_glom_post(sdioh_info_t *sd, uint8 *frame, uint len);
+extern void sdioh_glom_clear(sdioh_info_t *sd);
+extern uint sdioh_set_mode(sdioh_info_t *sd, uint mode);
+extern bool sdioh_glom_enabled(void);
+#else
+#define sdioh_glom_post(a, b, c)
+#define sdioh_glom_clear(a)
+#define sdioh_set_mode(a) (0)
+#define sdioh_glom_enabled() (FALSE)
+#endif
+
/* get cis data */
extern SDIOH_API_RC sdioh_cis_read(sdioh_info_t *si, uint fuc, uint8 *cis, uint32 length);
@@ -116,6 +137,14 @@ extern int sdioh_sdio_reset(sdioh_info_t *si);
void *bcmsdh_get_sdioh(bcmsdh_info_t *sdh);
+#ifdef BCMSPI
+/* Function to pass gSPI specific device-status bits to dhd. */
+extern uint32 sdioh_get_dstatus(sdioh_info_t *si);
+
+/* chipid and chiprev info for lower layers to control sw WAR's for hw bugs. */
+extern void sdioh_chipinfo(sdioh_info_t *si, uint32 chip, uint32 chiprev);
+extern void sdioh_dwordmode(sdioh_info_t *si, bool set);
+#endif /* BCMSPI */
#if defined(BCMSDIOH_STD)
#define SDIOH_SLEEP_ENABLED
diff --git a/drivers/net/wireless/bcmdhd/src/include/bcmsdh.h b/drivers/net/wireless/bcmdhd/include/bcmsdh.h
index 7dbef59..3348e84 100644
--- a/drivers/net/wireless/bcmdhd/src/include/bcmsdh.h
+++ b/drivers/net/wireless/bcmdhd/include/bcmsdh.h
@@ -3,14 +3,14 @@
* export functions to client drivers
* abstract OS and BUS specific details of SDIO
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -18,12 +18,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: bcmsdh.h 299859 2011-12-01 03:53:27Z $
+ * $Id: bcmsdh.h 347614 2012-07-27 10:24:51Z $
*/
/**
@@ -56,7 +56,7 @@ typedef void (*bcmsdh_cb_fn_t)(void *);
* most recent one) to enable single-instance implementations to pass NULL.
*/
-#if defined(NDIS630)
+#if 0 && (NDISVER >= 0x0630) && 1
extern bcmsdh_info_t *bcmsdh_attach(osl_t *osh, void *cfghdl,
void **regsva, uint irq, shared_info_t *sh);
#else
@@ -145,6 +145,10 @@ extern int bcmsdh_recv_buf(void *sdh, uint32 addr, uint fn, uint flags,
uint8 *buf, uint nbytes, void *pkt,
bcmsdh_cmplt_fn_t complete_fn, void *handle);
+extern void bcmsdh_glom_post(void *sdh, uint8 *frame, uint len);
+extern void bcmsdh_glom_clear(void *sdh);
+extern uint bcmsdh_set_mode(void *sdh, uint mode);
+extern bool bcmsdh_glom_enabled(void);
/* Flags bits */
#define SDIO_REQ_4BYTE 0x1 /* Four-byte target (backplane) width (vs. two-byte) */
#define SDIO_REQ_FIXED 0x2 /* Fixed address (FIFO) (vs. incrementing address) */
@@ -211,11 +215,11 @@ extern void bcmsdh_device_remove(void * sdh);
extern int bcmsdh_reg_sdio_notify(void* semaphore);
extern void bcmsdh_unreg_sdio_notify(void);
-#if defined(OOB_INTR_ONLY)
+#if defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID)
extern int bcmsdh_register_oob_intr(void * dhdp);
extern void bcmsdh_unregister_oob_intr(void);
extern void bcmsdh_oob_intr_set(bool enable);
-#endif /* defined(OOB_INTR_ONLY) */
+#endif /* defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID) */
/* Function to pass device-status bits to DHD. */
extern uint32 bcmsdh_get_dstatus(void *sdh);
@@ -226,6 +230,9 @@ extern uint32 bcmsdh_cur_sbwad(void *sdh);
/* Function to pass chipid and rev to lower layers for controlling pr's */
extern void bcmsdh_chipinfo(void *sdh, uint32 chip, uint32 chiprev);
+#ifdef BCMSPI
+extern void bcmsdh_dwordmode(void *sdh, bool set);
+#endif /* BCMSPI */
extern int bcmsdh_sleep(void *sdh, bool enab);
diff --git a/drivers/net/wireless/bcmdhd/src/include/bcmsdh_sdmmc.h b/drivers/net/wireless/bcmdhd/include/bcmsdh_sdmmc.h
index 1e06472..99b412a 100644
--- a/drivers/net/wireless/bcmdhd/src/include/bcmsdh_sdmmc.h
+++ b/drivers/net/wireless/bcmdhd/include/bcmsdh_sdmmc.h
@@ -2,13 +2,13 @@
* BCMSDH Function Driver for the native SDIO/MMC driver in the Linux Kernel
*
* Copyright (C) 1999-2012, Broadcom Corporation
- *
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,18 +16,18 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: bcmsdh_sdmmc.h 294363 2011-11-06 23:02:20Z $
+ * $Id: bcmsdh_sdmmc.h 313732 2012-02-08 19:49:00Z $
*/
#ifndef __BCMSDH_SDMMC_H__
#define __BCMSDH_SDMMC_H__
-#define sd_err(x) do{printf x;}while(0)
+#define sd_err(x) do {printf x;} while (0)
#define sd_trace(x)
#define sd_info(x)
#define sd_debug(x)
@@ -59,10 +59,10 @@ extern void sdioh_sdmmc_osfree(sdioh_info_t *sd);
/* private bus modes */
#define SDIOH_MODE_SD4 2
-#define CLIENT_INTR 0x100 /* Get rid of this! */
+#define CLIENT_INTR 0x100 /* Get rid of this! */
struct sdioh_info {
- osl_t *osh; /* osh handler */
+ osl_t *osh; /* osh handler */
bool client_intr_enabled; /* interrupt connnected flag */
bool intr_handler_valid; /* client driver interrupt handler valid */
sdioh_cb_fn_t intr_handler; /* registered interrupt handler */
@@ -70,18 +70,18 @@ struct sdioh_info {
uint16 intmask; /* Current active interrupts */
void *sdos_info; /* Pointer to per-OS private data */
- uint irq; /* Client irq */
- int intrcount; /* Client interrupts */
+ uint irq; /* Client irq */
+ int intrcount; /* Client interrupts */
bool sd_use_dma; /* DMA on CMD53 */
- bool sd_blockmode; /* sd_blockmode == FALSE => 64 Byte Cmd 53s. */
+ bool sd_blockmode; /* sd_blockmode == FALSE => 64 Byte Cmd 53s. */
/* Must be on for sd_multiblock to be effective */
- bool use_client_ints; /* If this is false, make sure to restore */
- int sd_mode; /* SD1/SD4/SPI */
- int client_block_size[SDIOD_MAX_IOFUNCS]; /* Blocksize */
- uint8 num_funcs; /* Supported funcs on client */
- uint32 com_cis_ptr;
- uint32 func_cis_ptr[SDIOD_MAX_IOFUNCS];
+ bool use_client_ints; /* If this is false, make sure to restore */
+ int sd_mode; /* SD1/SD4/SPI */
+ int client_block_size[SDIOD_MAX_IOFUNCS]; /* Blocksize */
+ uint8 num_funcs; /* Supported funcs on client */
+ uint32 com_cis_ptr;
+ uint32 func_cis_ptr[SDIOD_MAX_IOFUNCS];
#define SDIOH_SDMMC_MAX_SG_ENTRIES 32
struct scatterlist sg_list[SDIOH_SDMMC_MAX_SG_ENTRIES];
diff --git a/drivers/net/wireless/bcmdhd/src/include/bcmsdpcm.h b/drivers/net/wireless/bcmdhd/include/bcmsdpcm.h
index f3b3623..80c0a3d 100644
--- a/drivers/net/wireless/bcmdhd/src/include/bcmsdpcm.h
+++ b/drivers/net/wireless/bcmdhd/include/bcmsdpcm.h
@@ -2,14 +2,14 @@
* Broadcom SDIO/PCMCIA
* Software-specific definitions shared between device and host side
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -17,7 +17,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
@@ -110,7 +110,7 @@
/* Data Offset from SOF (HW Tag, SW Tag, Pad) */
#define SDPCM_DOFFSET_OFFSET 3 /* Data Offset */
-#define SDPCM_DOFFSET_VALUE(p) (((uint8 *)p)[SDPCM_DOFFSET_OFFSET] & 0xff)
+#define SDPCM_DOFFSET_VALUE(p) (((uint8 *)p)[SDPCM_DOFFSET_OFFSET] & 0xff)
#define SDPCM_DOFFSET_MASK 0xff000000
#define SDPCM_DOFFSET_SHIFT 24
diff --git a/drivers/net/wireless/bcmdhd/src/include/bcmsdspi.h b/drivers/net/wireless/bcmdhd/include/bcmsdspi.h
index 45b2d11..3d444f3 100644
--- a/drivers/net/wireless/bcmdhd/src/include/bcmsdspi.h
+++ b/drivers/net/wireless/bcmdhd/include/bcmsdspi.h
@@ -1,14 +1,14 @@
/*
* SD-SPI Protocol Conversion - BCMSDH->SPI Translation Layer
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,7 +16,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
@@ -57,13 +57,13 @@
#define USE_MULTIBLOCK 0x4
struct sdioh_info {
- uint cfg_bar; /* pci cfg address for bar */
- uint32 caps; /* cached value of capabilities reg */
+ uint cfg_bar; /* pci cfg address for bar */
+ uint32 caps; /* cached value of capabilities reg */
uint bar0; /* BAR0 for PCI Device */
- osl_t *osh; /* osh handler */
+ osl_t *osh; /* osh handler */
void *controller; /* Pointer to SPI Controller's private data struct */
- uint lockcount; /* nest count of sdspi_lock() calls */
+ uint lockcount; /* nest count of sdspi_lock() calls */
bool client_intr_enabled; /* interrupt connnected flag */
bool intr_handler_valid; /* client driver interrupt handler valid */
sdioh_cb_fn_t intr_handler; /* registered interrupt handler */
@@ -75,34 +75,34 @@ struct sdioh_info {
uint32 controller_type; /* Host controller type */
uint8 version; /* Host Controller Spec Compliance Version */
- uint irq; /* Client irq */
- uint32 intrcount; /* Client interrupts */
- uint32 local_intrcount; /* Controller interrupts */
- bool host_init_done; /* Controller initted */
- bool card_init_done; /* Client SDIO interface initted */
- bool polled_mode; /* polling for command completion */
+ uint irq; /* Client irq */
+ uint32 intrcount; /* Client interrupts */
+ uint32 local_intrcount; /* Controller interrupts */
+ bool host_init_done; /* Controller initted */
+ bool card_init_done; /* Client SDIO interface initted */
+ bool polled_mode; /* polling for command completion */
bool sd_use_dma; /* DMA on CMD53 */
- bool sd_blockmode; /* sd_blockmode == FALSE => 64 Byte Cmd 53s. */
+ bool sd_blockmode; /* sd_blockmode == FALSE => 64 Byte Cmd 53s. */
/* Must be on for sd_multiblock to be effective */
- bool use_client_ints; /* If this is false, make sure to restore */
+ bool use_client_ints; /* If this is false, make sure to restore */
bool got_hcint; /* Host Controller interrupt. */
/* polling hack in wl_linux.c:wl_timer() */
- int adapter_slot; /* Maybe dealing with multiple slots/controllers */
- int sd_mode; /* SD1/SD4/SPI */
- int client_block_size[SDIOD_MAX_IOFUNCS]; /* Blocksize */
- uint32 data_xfer_count; /* Current register transfer size */
+ int adapter_slot; /* Maybe dealing with multiple slots/controllers */
+ int sd_mode; /* SD1/SD4/SPI */
+ int client_block_size[SDIOD_MAX_IOFUNCS]; /* Blocksize */
+ uint32 data_xfer_count; /* Current register transfer size */
uint32 cmd53_wr_data; /* Used to pass CMD53 write data */
uint32 card_response; /* Used to pass back response status byte */
uint32 card_rsp_data; /* Used to pass back response data word */
- uint16 card_rca; /* Current Address */
- uint8 num_funcs; /* Supported funcs on client */
- uint32 com_cis_ptr;
- uint32 func_cis_ptr[SDIOD_MAX_IOFUNCS];
+ uint16 card_rca; /* Current Address */
+ uint8 num_funcs; /* Supported funcs on client */
+ uint32 com_cis_ptr;
+ uint32 func_cis_ptr[SDIOD_MAX_IOFUNCS];
void *dma_buf;
ulong dma_phys;
- int r_cnt; /* rx count */
- int t_cnt; /* tx_count */
+ int r_cnt; /* rx count */
+ int t_cnt; /* tx_count */
};
/************************************************************
diff --git a/drivers/net/wireless/bcmdhd/src/include/bcmsdstd.h b/drivers/net/wireless/bcmdhd/include/bcmsdstd.h
index b732331..896686c 100644
--- a/drivers/net/wireless/bcmdhd/src/include/bcmsdstd.h
+++ b/drivers/net/wireless/bcmdhd/include/bcmsdstd.h
@@ -1,14 +1,14 @@
/*
* 'Standard' SDIO HOST CONTROLLER driver
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,12 +16,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: bcmsdstd.h 294369 2011-11-06 23:22:23Z $
+ * $Id: bcmsdstd.h 347614 2012-07-27 10:24:51Z $
*/
#ifndef _BCM_SD_STD_H
#define _BCM_SD_STD_H
@@ -62,7 +62,7 @@ extern void sdstd_osfree(sdioh_info_t *sd);
#define SDIOH_MODE_SD1 1
#define SDIOH_MODE_SD4 2
-#define MAX_SLOTS 6 /* For PCI: Only 6 BAR entries => 6 slots */
+#define MAX_SLOTS 6 /* For PCI: Only 6 BAR entries => 6 slots */
#define SDIOH_REG_WINSZ 0x100 /* Number of registers in Standard Host Controller */
#define SDIOH_TYPE_ARASAN_HDK 1
@@ -87,19 +87,31 @@ extern void sdstd_osfree(sdioh_info_t *sd);
#define USE_FIFO 0x8 /* Fifo vs non-fifo */
-#define CLIENT_INTR 0x100 /* Get rid of this! */
+#define CLIENT_INTR 0x100 /* Get rid of this! */
#define HC_INTR_RETUNING 0x1000
+#ifdef BCMSDIOH_TXGLOM
+/* Setting the MAX limit to 10 */
+#define SDIOH_MAXGLOM_SIZE 10
+
+typedef struct glom_buf {
+ uint32 count; /* Total number of pkts queued */
+ void *dma_buf_arr[SDIOH_MAXGLOM_SIZE]; /* Frame address */
+ ulong dma_phys_arr[SDIOH_MAXGLOM_SIZE]; /* DMA_MAPed address of frames */
+ uint16 nbytes[SDIOH_MAXGLOM_SIZE]; /* Size of each frame */
+} glom_buf_t;
+#endif
+
struct sdioh_info {
- uint cfg_bar; /* pci cfg address for bar */
- uint32 caps; /* cached value of capabilities reg */
- uint32 curr_caps; /* max current capabilities reg */
+ uint cfg_bar; /* pci cfg address for bar */
+ uint32 caps; /* cached value of capabilities reg */
+ uint32 curr_caps; /* max current capabilities reg */
- osl_t *osh; /* osh handler */
- volatile char *mem_space; /* pci device memory va */
- uint lockcount; /* nest count of sdstd_lock() calls */
+ osl_t *osh; /* osh handler */
+ volatile char *mem_space; /* pci device memory va */
+ uint lockcount; /* nest count of sdstd_lock() calls */
bool client_intr_enabled; /* interrupt connnected flag */
bool intr_handler_valid; /* client driver interrupt handler valid */
sdioh_cb_fn_t intr_handler; /* registered interrupt handler */
@@ -111,26 +123,26 @@ struct sdioh_info {
uint32 controller_type; /* Host controller type */
uint8 version; /* Host Controller Spec Compliance Version */
- uint irq; /* Client irq */
- int intrcount; /* Client interrupts */
- int local_intrcount; /* Controller interrupts */
- bool host_init_done; /* Controller initted */
- bool card_init_done; /* Client SDIO interface initted */
- bool polled_mode; /* polling for command completion */
-
- bool sd_blockmode; /* sd_blockmode == FALSE => 64 Byte Cmd 53s. */
+ uint irq; /* Client irq */
+ int intrcount; /* Client interrupts */
+ int local_intrcount; /* Controller interrupts */
+ bool host_init_done; /* Controller initted */
+ bool card_init_done; /* Client SDIO interface initted */
+ bool polled_mode; /* polling for command completion */
+
+ bool sd_blockmode; /* sd_blockmode == FALSE => 64 Byte Cmd 53s. */
/* Must be on for sd_multiblock to be effective */
- bool use_client_ints; /* If this is false, make sure to restore */
+ bool use_client_ints; /* If this is false, make sure to restore */
/* polling hack in wl_linux.c:wl_timer() */
- int adapter_slot; /* Maybe dealing with multiple slots/controllers */
- int sd_mode; /* SD1/SD4/SPI */
- int client_block_size[SDIOD_MAX_IOFUNCS]; /* Blocksize */
- uint32 data_xfer_count; /* Current transfer */
- uint16 card_rca; /* Current Address */
+ int adapter_slot; /* Maybe dealing with multiple slots/controllers */
+ int sd_mode; /* SD1/SD4/SPI */
+ int client_block_size[SDIOD_MAX_IOFUNCS]; /* Blocksize */
+ uint32 data_xfer_count; /* Current transfer */
+ uint16 card_rca; /* Current Address */
int8 sd_dma_mode; /* DMA Mode (PIO, SDMA, ... ADMA2) on CMD53 */
- uint8 num_funcs; /* Supported funcs on client */
- uint32 com_cis_ptr;
- uint32 func_cis_ptr[SDIOD_MAX_FUNCS];
+ uint8 num_funcs; /* Supported funcs on client */
+ uint32 com_cis_ptr;
+ uint32 func_cis_ptr[SDIOD_MAX_IOFUNCS];
void *dma_buf; /* DMA Buffer virtual address */
ulong dma_phys; /* DMA Buffer physical address */
void *adma2_dscr_buf; /* ADMA2 Descriptor Buffer virtual address */
@@ -144,12 +156,12 @@ struct sdioh_info {
ulong adma2_dscr_start_phys;
uint alloced_adma2_dscr_size;
- int r_cnt; /* rx count */
- int t_cnt; /* tx_count */
+ int r_cnt; /* rx count */
+ int t_cnt; /* tx_count */
bool got_hcint; /* local interrupt flag */
uint16 last_intrstatus; /* to cache intrstatus */
- int host_UHSISupported; /* whether UHSI is supported for HC. */
- int card_UHSI_voltage_Supported; /* whether UHSI is supported for
+ int host_UHSISupported; /* whether UHSI is supported for HC. */
+ int card_UHSI_voltage_Supported; /* whether UHSI is supported for
* Card in terms of Voltage [1.8 or 3.3].
*/
int global_UHSI_Supp; /* type of UHSI support in both host and card.
@@ -157,10 +169,14 @@ struct sdioh_info {
* HOST_SDR_12_25: SDR12 and SDR25 supported
* HOST_SDR_50_104_DDR: one of SDR50/SDR104 or DDR50 supptd
*/
- int sd3_dat_state; /* data transfer state used for retuning check */
- int sd3_tun_state; /* tuning state used for retuning check */
- bool sd3_tuning_reqd; /* tuning requirement parameter */
+ volatile int sd3_dat_state; /* data transfer state used for retuning check */
+ volatile int sd3_tun_state; /* tuning state used for retuning check */
+ bool sd3_tuning_reqd; /* tuning requirement parameter */
uint32 caps3; /* cached value of 32 MSbits capabilities reg (SDIO 3.0) */
+#ifdef BCMSDIOH_TXGLOM
+ glom_buf_t glom_info; /* pkt information used for glomming */
+ uint txglom_mode; /* Txglom mode: 0 - copy, 1 - multi-descriptor */
+#endif
};
#define DMA_MODE_NONE 0
@@ -173,14 +189,17 @@ struct sdioh_info {
#define USE_DMA(sd) ((bool)((sd->sd_dma_mode > 0) ? TRUE : FALSE))
/* States for Tuning and corr data */
-#define TUNING_IDLE 0
-#define TUNING_START 1
-#define TUNING_START_AFTER_DAT 2
-#define TUNING_ONGOING 3
+#define TUNING_IDLE 0
+#define TUNING_START 1
+#define TUNING_START_AFTER_DAT 2
+#define TUNING_ONGOING 3
-#define DATA_TRANSFER_IDLE 0
+#define DATA_TRANSFER_IDLE 0
#define DATA_TRANSFER_ONGOING 1
+#define CHECK_TUNING_PRE_DATA 1
+#define CHECK_TUNING_POST_DATA 2
+
/************************************************************
* Internal interfaces: per-port references into bcmsdstd.c
*/
@@ -227,10 +246,12 @@ extern int sdstd_waitbits(sdioh_info_t *sd, uint16 norm, uint16 err, bool yield,
extern void sdstd_3_enable_retuning_int(sdioh_info_t *sd);
extern void sdstd_3_disable_retuning_int(sdioh_info_t *sd);
extern bool sdstd_3_is_retuning_int_set(sdioh_info_t *sd);
+extern void sdstd_3_check_and_do_tuning(sdioh_info_t *sd, int tuning_param);
extern bool sdstd_3_check_and_set_retuning(sdioh_info_t *sd);
extern int sdstd_3_get_tune_state(sdioh_info_t *sd);
extern int sdstd_3_get_data_state(sdioh_info_t *sd);
extern void sdstd_3_set_tune_state(sdioh_info_t *sd, int state);
+extern void sdstd_3_set_data_state(sdioh_info_t *sd, int state);
extern uint8 sdstd_3_get_tuning_exp(sdioh_info_t *sd);
extern uint32 sdstd_3_get_uhsi_clkmode(sdioh_info_t *sd);
extern int sdstd_3_clk_tuning(sdioh_info_t *sd, uint32 sd3ClkMode);
diff --git a/drivers/net/wireless/bcmdhd/src/include/bcmspi.h b/drivers/net/wireless/bcmdhd/include/bcmspi.h
index c5261a0..e226cb1 100644
--- a/drivers/net/wireless/bcmdhd/src/include/bcmspi.h
+++ b/drivers/net/wireless/bcmdhd/include/bcmspi.h
@@ -1,14 +1,14 @@
/*
* Broadcom SPI Low-Level Hardware Driver API
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,7 +16,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
diff --git a/drivers/net/wireless/bcmdhd/include/bcmspibrcm.h b/drivers/net/wireless/bcmdhd/include/bcmspibrcm.h
new file mode 100644
index 0000000..13d6557
--- /dev/null
+++ b/drivers/net/wireless/bcmdhd/include/bcmspibrcm.h
@@ -0,0 +1,168 @@
+/*
+ * SD-SPI Protocol Conversion - BCMSDH->gSPI Translation Layer
+ *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
+ * Unless you and Broadcom execute a separate written software license
+ * agreement governing use of this software, this software is licensed to you
+ * under the terms of the GNU General Public License version 2 (the "GPL"),
+ * available at http://www.broadcom.com/licenses/GPLv2.php, with the
+ * following added to such license:
+ *
+ * As a special exception, the copyright holders of this software give you
+ * permission to link this software with independent modules, and to copy and
+ * distribute the resulting executable under terms of your choice, provided that
+ * you also meet, for each linked independent module, the terms and conditions of
+ * the license of that module. An independent module is a module which is not
+ * derived from this software. The special exception does not apply to any
+ * modifications of the software.
+ *
+ * Notwithstanding the above, under no circumstances may you combine this
+ * software in any way with any other Broadcom software provided under a license
+ * other than the GPL, without Broadcom's express prior written consent.
+ *
+ * $Id: bcmspibrcm.h 354197 2012-08-30 09:05:59Z $
+ */
+#ifndef _BCM_SPI_BRCM_H
+#define _BCM_SPI_BRCM_H
+
+#ifndef SPI_MAX_IOFUNCS
+/* Maximum number of I/O funcs */
+#define SPI_MAX_IOFUNCS 4
+#endif
+/* global msglevel for debug messages - bitvals come from sdiovar.h */
+
+#if defined(DHD_DEBUG)
+#define sd_err(x) do { if (sd_msglevel & SDH_ERROR_VAL) printf x; } while (0)
+#define sd_trace(x) do { if (sd_msglevel & SDH_TRACE_VAL) printf x; } while (0)
+#define sd_info(x) do { if (sd_msglevel & SDH_INFO_VAL) printf x; } while (0)
+#define sd_debug(x) do { if (sd_msglevel & SDH_DEBUG_VAL) printf x; } while (0)
+#define sd_data(x) do { if (sd_msglevel & SDH_DATA_VAL) printf x; } while (0)
+#define sd_ctrl(x) do { if (sd_msglevel & SDH_CTRL_VAL) printf x; } while (0)
+#else
+#define sd_err(x)
+#define sd_trace(x)
+#define sd_info(x)
+#define sd_debug(x)
+#define sd_data(x)
+#define sd_ctrl(x)
+#endif
+
+#define sd_log(x)
+
+#define SDIOH_ASSERT(exp) \
+ do { if (!(exp)) \
+ printf("!!!ASSERT fail: file %s lines %d", __FILE__, __LINE__); \
+ } while (0)
+
+#define BLOCK_SIZE_F1 64
+#define BLOCK_SIZE_F2 2048
+#define BLOCK_SIZE_F3 2048
+
+/* internal return code */
+#define SUCCESS 0
+#undef ERROR
+#define ERROR 1
+#define ERROR_UF 2
+#define ERROR_OF 3
+
+/* private bus modes */
+#define SDIOH_MODE_SPI 0
+
+#define USE_BLOCKMODE 0x2 /* Block mode can be single block or multi */
+#define USE_MULTIBLOCK 0x4
+
+struct sdioh_info {
+ uint cfg_bar; /* pci cfg address for bar */
+ uint32 caps; /* cached value of capabilities reg */
+#ifndef BCMSPI_ANDROID
+ void *bar0; /* BAR0 for PCI Device */
+#endif /* !BCMSPI_ANDROID */
+ osl_t *osh; /* osh handler */
+ void *controller; /* Pointer to SPI Controller's private data struct */
+#ifndef BCMSPI_ANDROID
+ uint lockcount; /* nest count of spi_lock() calls */
+ bool client_intr_enabled; /* interrupt connnected flag */
+ bool intr_handler_valid; /* client driver interrupt handler valid */
+ sdioh_cb_fn_t intr_handler; /* registered interrupt handler */
+ void *intr_handler_arg; /* argument to call interrupt handler */
+#endif /* !BCMSPI_ANDROID */
+ bool initialized; /* card initialized */
+ uint32 target_dev; /* Target device ID */
+ uint32 intmask; /* Current active interrupts */
+#ifndef BCMSPI_ANDROID
+ void *sdos_info; /* Pointer to per-OS private data */
+#endif /* !BCMSPI_ANDROID */
+ uint32 controller_type; /* Host controller type */
+ uint8 version; /* Host Controller Spec Compliance Version */
+ uint irq; /* Client irq */
+ uint32 intrcount; /* Client interrupts */
+ uint32 local_intrcount; /* Controller interrupts */
+ bool host_init_done; /* Controller initted */
+ bool card_init_done; /* Client SDIO interface initted */
+ bool polled_mode; /* polling for command completion */
+
+ bool sd_use_dma; /* DMA on CMD53 */
+ bool sd_blockmode; /* sd_blockmode == FALSE => 64 Byte Cmd 53s. */
+ /* Must be on for sd_multiblock to be effective */
+ bool use_client_ints; /* If this is false, make sure to restore */
+ /* polling hack in wl_linux.c:wl_timer() */
+ int adapter_slot; /* Maybe dealing with multiple slots/controllers */
+ int sd_mode; /* SD1/SD4/SPI */
+ int client_block_size[SPI_MAX_IOFUNCS]; /* Blocksize */
+ uint32 data_xfer_count; /* Current transfer */
+ uint16 card_rca; /* Current Address */
+ uint8 num_funcs; /* Supported funcs on client */
+ uint32 card_dstatus; /* 32bit device status */
+ uint32 com_cis_ptr;
+ uint32 func_cis_ptr[SPI_MAX_IOFUNCS];
+ void *dma_buf;
+ ulong dma_phys;
+ int r_cnt; /* rx count */
+ int t_cnt; /* tx_count */
+ uint32 wordlen; /* host processor 16/32bits */
+ uint32 prev_fun;
+ uint32 chip;
+ uint32 chiprev;
+ bool resp_delay_all;
+ bool dwordmode;
+ bool resp_delay_new;
+
+ struct spierrstats_t spierrstats;
+};
+
+/************************************************************
+ * Internal interfaces: per-port references into bcmspibrcm.c
+ */
+
+/* Global message bits */
+extern uint sd_msglevel;
+
+/**************************************************************
+ * Internal interfaces: bcmspibrcm.c references to per-port code
+ */
+
+/* Interrupt (de)registration routines */
+extern int spi_register_irq(sdioh_info_t *sd, uint irq);
+extern void spi_free_irq(uint irq, sdioh_info_t *sd);
+
+/* OS-specific interrupt wrappers (atomic interrupt enable/disable) */
+extern void spi_lock(sdioh_info_t *sd);
+extern void spi_unlock(sdioh_info_t *sd);
+
+/* Allocate/init/free per-OS private data */
+extern int spi_osinit(sdioh_info_t *sd);
+extern void spi_osfree(sdioh_info_t *sd);
+
+#define SPI_RW_FLAG_M BITFIELD_MASK(1) /* Bit [31] - R/W Command Bit */
+#define SPI_RW_FLAG_S 31
+#define SPI_ACCESS_M BITFIELD_MASK(1) /* Bit [30] - Fixed/Incr Access */
+#define SPI_ACCESS_S 30
+#define SPI_FUNCTION_M BITFIELD_MASK(2) /* Bit [29:28] - Function Number */
+#define SPI_FUNCTION_S 28
+#define SPI_REG_ADDR_M BITFIELD_MASK(17) /* Bit [27:11] - Address */
+#define SPI_REG_ADDR_S 11
+#define SPI_LEN_M BITFIELD_MASK(11) /* Bit [10:0] - Packet length */
+#define SPI_LEN_S 0
+
+#endif /* _BCM_SPI_BRCM_H */
diff --git a/drivers/net/wireless/bcmdhd/include/bcmsrom_fmt.h b/drivers/net/wireless/bcmdhd/include/bcmsrom_fmt.h
new file mode 100644
index 0000000..f5246a5
--- /dev/null
+++ b/drivers/net/wireless/bcmdhd/include/bcmsrom_fmt.h
@@ -0,0 +1,607 @@
+/*
+ * SROM format definition.
+ *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
+ * Unless you and Broadcom execute a separate written software license
+ * agreement governing use of this software, this software is licensed to you
+ * under the terms of the GNU General Public License version 2 (the "GPL"),
+ * available at http://www.broadcom.com/licenses/GPLv2.php, with the
+ * following added to such license:
+ *
+ * As a special exception, the copyright holders of this software give you
+ * permission to link this software with independent modules, and to copy and
+ * distribute the resulting executable under terms of your choice, provided that
+ * you also meet, for each linked independent module, the terms and conditions of
+ * the license of that module. An independent module is a module which is not
+ * derived from this software. The special exception does not apply to any
+ * modifications of the software.
+ *
+ * Notwithstanding the above, under no circumstances may you combine this
+ * software in any way with any other Broadcom software provided under a license
+ * other than the GPL, without Broadcom's express prior written consent.
+ *
+ * $Id: bcmsrom_fmt.h 327439 2012-04-13 17:44:48Z $
+ */
+
+#ifndef _bcmsrom_fmt_h_
+#define _bcmsrom_fmt_h_
+
+#define SROM_MAXREV 11 /* max revisiton supported by driver */
+
+/* Maximum srom: 6 Kilobits == 768 bytes */
+#define SROM_MAX 768
+#define SROM_MAXW 384
+#define VARS_MAX 4096
+
+/* PCI fields */
+#define PCI_F0DEVID 48
+
+
+#define SROM_WORDS 64
+
+#define SROM3_SWRGN_OFF 28 /* s/w region offset in words */
+
+#define SROM_SSID 2
+
+#define SROM_WL1LHMAXP 29
+
+#define SROM_WL1LPAB0 30
+#define SROM_WL1LPAB1 31
+#define SROM_WL1LPAB2 32
+
+#define SROM_WL1HPAB0 33
+#define SROM_WL1HPAB1 34
+#define SROM_WL1HPAB2 35
+
+#define SROM_MACHI_IL0 36
+#define SROM_MACMID_IL0 37
+#define SROM_MACLO_IL0 38
+#define SROM_MACHI_ET0 39
+#define SROM_MACMID_ET0 40
+#define SROM_MACLO_ET0 41
+#define SROM_MACHI_ET1 42
+#define SROM_MACMID_ET1 43
+#define SROM_MACLO_ET1 44
+#define SROM3_MACHI 37
+#define SROM3_MACMID 38
+#define SROM3_MACLO 39
+
+#define SROM_BXARSSI2G 40
+#define SROM_BXARSSI5G 41
+
+#define SROM_TRI52G 42
+#define SROM_TRI5GHL 43
+
+#define SROM_RXPO52G 45
+
+#define SROM2_ENETPHY 45
+
+#define SROM_AABREV 46
+/* Fields in AABREV */
+#define SROM_BR_MASK 0x00ff
+#define SROM_CC_MASK 0x0f00
+#define SROM_CC_SHIFT 8
+#define SROM_AA0_MASK 0x3000
+#define SROM_AA0_SHIFT 12
+#define SROM_AA1_MASK 0xc000
+#define SROM_AA1_SHIFT 14
+
+#define SROM_WL0PAB0 47
+#define SROM_WL0PAB1 48
+#define SROM_WL0PAB2 49
+
+#define SROM_LEDBH10 50
+#define SROM_LEDBH32 51
+
+#define SROM_WL10MAXP 52
+
+#define SROM_WL1PAB0 53
+#define SROM_WL1PAB1 54
+#define SROM_WL1PAB2 55
+
+#define SROM_ITT 56
+
+#define SROM_BFL 57
+#define SROM_BFL2 28
+#define SROM3_BFL2 61
+
+#define SROM_AG10 58
+
+#define SROM_CCODE 59
+
+#define SROM_OPO 60
+
+#define SROM3_LEDDC 62
+
+#define SROM_CRCREV 63
+
+/* SROM Rev 4: Reallocate the software part of the srom to accomodate
+ * MIMO features. It assumes up to two PCIE functions and 440 bytes
+ * of useable srom i.e. the useable storage in chips with OTP that
+ * implements hardware redundancy.
+ */
+
+#define SROM4_WORDS 220
+
+#define SROM4_SIGN 32
+#define SROM4_SIGNATURE 0x5372
+
+#define SROM4_BREV 33
+
+#define SROM4_BFL0 34
+#define SROM4_BFL1 35
+#define SROM4_BFL2 36
+#define SROM4_BFL3 37
+#define SROM5_BFL0 37
+#define SROM5_BFL1 38
+#define SROM5_BFL2 39
+#define SROM5_BFL3 40
+
+#define SROM4_MACHI 38
+#define SROM4_MACMID 39
+#define SROM4_MACLO 40
+#define SROM5_MACHI 41
+#define SROM5_MACMID 42
+#define SROM5_MACLO 43
+
+#define SROM4_CCODE 41
+#define SROM4_REGREV 42
+#define SROM5_CCODE 34
+#define SROM5_REGREV 35
+
+#define SROM4_LEDBH10 43
+#define SROM4_LEDBH32 44
+#define SROM5_LEDBH10 59
+#define SROM5_LEDBH32 60
+
+#define SROM4_LEDDC 45
+#define SROM5_LEDDC 45
+
+#define SROM4_AA 46
+#define SROM4_AA2G_MASK 0x00ff
+#define SROM4_AA2G_SHIFT 0
+#define SROM4_AA5G_MASK 0xff00
+#define SROM4_AA5G_SHIFT 8
+
+#define SROM4_AG10 47
+#define SROM4_AG32 48
+
+#define SROM4_TXPID2G 49
+#define SROM4_TXPID5G 51
+#define SROM4_TXPID5GL 53
+#define SROM4_TXPID5GH 55
+
+#define SROM4_TXRXC 61
+#define SROM4_TXCHAIN_MASK 0x000f
+#define SROM4_TXCHAIN_SHIFT 0
+#define SROM4_RXCHAIN_MASK 0x00f0
+#define SROM4_RXCHAIN_SHIFT 4
+#define SROM4_SWITCH_MASK 0xff00
+#define SROM4_SWITCH_SHIFT 8
+
+
+/* Per-path fields */
+#define MAX_PATH_SROM 4
+#define SROM4_PATH0 64
+#define SROM4_PATH1 87
+#define SROM4_PATH2 110
+#define SROM4_PATH3 133
+
+#define SROM4_2G_ITT_MAXP 0
+#define SROM4_2G_PA 1
+#define SROM4_5G_ITT_MAXP 5
+#define SROM4_5GLH_MAXP 6
+#define SROM4_5G_PA 7
+#define SROM4_5GL_PA 11
+#define SROM4_5GH_PA 15
+
+/* Fields in the ITT_MAXP and 5GLH_MAXP words */
+#define B2G_MAXP_MASK 0xff
+#define B2G_ITT_SHIFT 8
+#define B5G_MAXP_MASK 0xff
+#define B5G_ITT_SHIFT 8
+#define B5GH_MAXP_MASK 0xff
+#define B5GL_MAXP_SHIFT 8
+
+/* All the miriad power offsets */
+#define SROM4_2G_CCKPO 156
+#define SROM4_2G_OFDMPO 157
+#define SROM4_5G_OFDMPO 159
+#define SROM4_5GL_OFDMPO 161
+#define SROM4_5GH_OFDMPO 163
+#define SROM4_2G_MCSPO 165
+#define SROM4_5G_MCSPO 173
+#define SROM4_5GL_MCSPO 181
+#define SROM4_5GH_MCSPO 189
+#define SROM4_CDDPO 197
+#define SROM4_STBCPO 198
+#define SROM4_BW40PO 199
+#define SROM4_BWDUPPO 200
+
+#define SROM4_CRCREV 219
+
+
+/* SROM Rev 8: Make space for a 48word hardware header for PCIe rev >= 6.
+ * This is acombined srom for both MIMO and SISO boards, usable in
+ * the .130 4Kilobit OTP with hardware redundancy.
+ */
+
+#define SROM8_SIGN 64
+
+#define SROM8_BREV 65
+
+#define SROM8_BFL0 66
+#define SROM8_BFL1 67
+#define SROM8_BFL2 68
+#define SROM8_BFL3 69
+
+#define SROM8_MACHI 70
+#define SROM8_MACMID 71
+#define SROM8_MACLO 72
+
+#define SROM8_CCODE 73
+#define SROM8_REGREV 74
+
+#define SROM8_LEDBH10 75
+#define SROM8_LEDBH32 76
+
+#define SROM8_LEDDC 77
+
+#define SROM8_AA 78
+
+#define SROM8_AG10 79
+#define SROM8_AG32 80
+
+#define SROM8_TXRXC 81
+
+#define SROM8_BXARSSI2G 82
+#define SROM8_BXARSSI5G 83
+#define SROM8_TRI52G 84
+#define SROM8_TRI5GHL 85
+#define SROM8_RXPO52G 86
+
+#define SROM8_FEM2G 87
+#define SROM8_FEM5G 88
+#define SROM8_FEM_ANTSWLUT_MASK 0xf800
+#define SROM8_FEM_ANTSWLUT_SHIFT 11
+#define SROM8_FEM_TR_ISO_MASK 0x0700
+#define SROM8_FEM_TR_ISO_SHIFT 8
+#define SROM8_FEM_PDET_RANGE_MASK 0x00f8
+#define SROM8_FEM_PDET_RANGE_SHIFT 3
+#define SROM8_FEM_EXTPA_GAIN_MASK 0x0006
+#define SROM8_FEM_EXTPA_GAIN_SHIFT 1
+#define SROM8_FEM_TSSIPOS_MASK 0x0001
+#define SROM8_FEM_TSSIPOS_SHIFT 0
+
+#define SROM8_THERMAL 89
+
+/* Temp sense related entries */
+#define SROM8_MPWR_RAWTS 90
+#define SROM8_TS_SLP_OPT_CORRX 91
+/* FOC: freiquency offset correction, HWIQ: H/W IOCAL enable, IQSWP: IQ CAL swap disable */
+#define SROM8_FOC_HWIQ_IQSWP 92
+
+#define SROM8_EXTLNAGAIN 93
+
+/* Temperature delta for PHY calibration */
+#define SROM8_PHYCAL_TEMPDELTA 94
+
+/* Measured power 1 & 2, 0-13 bits at offset 95, MSB 2 bits are unused for now. */
+#define SROM8_MPWR_1_AND_2 95
+
+
+/* Per-path offsets & fields */
+#define SROM8_PATH0 96
+#define SROM8_PATH1 112
+#define SROM8_PATH2 128
+#define SROM8_PATH3 144
+
+#define SROM8_2G_ITT_MAXP 0
+#define SROM8_2G_PA 1
+#define SROM8_5G_ITT_MAXP 4
+#define SROM8_5GLH_MAXP 5
+#define SROM8_5G_PA 6
+#define SROM8_5GL_PA 9
+#define SROM8_5GH_PA 12
+
+/* All the miriad power offsets */
+#define SROM8_2G_CCKPO 160
+
+#define SROM8_2G_OFDMPO 161
+#define SROM8_5G_OFDMPO 163
+#define SROM8_5GL_OFDMPO 165
+#define SROM8_5GH_OFDMPO 167
+
+#define SROM8_2G_MCSPO 169
+#define SROM8_5G_MCSPO 177
+#define SROM8_5GL_MCSPO 185
+#define SROM8_5GH_MCSPO 193
+
+#define SROM8_CDDPO 201
+#define SROM8_STBCPO 202
+#define SROM8_BW40PO 203
+#define SROM8_BWDUPPO 204
+
+/* SISO PA parameters are in the path0 spaces */
+#define SROM8_SISO 96
+
+/* Legacy names for SISO PA paramters */
+#define SROM8_W0_ITTMAXP (SROM8_SISO + SROM8_2G_ITT_MAXP)
+#define SROM8_W0_PAB0 (SROM8_SISO + SROM8_2G_PA)
+#define SROM8_W0_PAB1 (SROM8_SISO + SROM8_2G_PA + 1)
+#define SROM8_W0_PAB2 (SROM8_SISO + SROM8_2G_PA + 2)
+#define SROM8_W1_ITTMAXP (SROM8_SISO + SROM8_5G_ITT_MAXP)
+#define SROM8_W1_MAXP_LCHC (SROM8_SISO + SROM8_5GLH_MAXP)
+#define SROM8_W1_PAB0 (SROM8_SISO + SROM8_5G_PA)
+#define SROM8_W1_PAB1 (SROM8_SISO + SROM8_5G_PA + 1)
+#define SROM8_W1_PAB2 (SROM8_SISO + SROM8_5G_PA + 2)
+#define SROM8_W1_PAB0_LC (SROM8_SISO + SROM8_5GL_PA)
+#define SROM8_W1_PAB1_LC (SROM8_SISO + SROM8_5GL_PA + 1)
+#define SROM8_W1_PAB2_LC (SROM8_SISO + SROM8_5GL_PA + 2)
+#define SROM8_W1_PAB0_HC (SROM8_SISO + SROM8_5GH_PA)
+#define SROM8_W1_PAB1_HC (SROM8_SISO + SROM8_5GH_PA + 1)
+#define SROM8_W1_PAB2_HC (SROM8_SISO + SROM8_5GH_PA + 2)
+
+#define SROM8_CRCREV 219
+
+/* SROM REV 9 */
+#define SROM9_2GPO_CCKBW20 160
+#define SROM9_2GPO_CCKBW20UL 161
+#define SROM9_2GPO_LOFDMBW20 162
+#define SROM9_2GPO_LOFDMBW20UL 164
+
+#define SROM9_5GLPO_LOFDMBW20 166
+#define SROM9_5GLPO_LOFDMBW20UL 168
+#define SROM9_5GMPO_LOFDMBW20 170
+#define SROM9_5GMPO_LOFDMBW20UL 172
+#define SROM9_5GHPO_LOFDMBW20 174
+#define SROM9_5GHPO_LOFDMBW20UL 176
+
+#define SROM9_2GPO_MCSBW20 178
+#define SROM9_2GPO_MCSBW20UL 180
+#define SROM9_2GPO_MCSBW40 182
+
+#define SROM9_5GLPO_MCSBW20 184
+#define SROM9_5GLPO_MCSBW20UL 186
+#define SROM9_5GLPO_MCSBW40 188
+#define SROM9_5GMPO_MCSBW20 190
+#define SROM9_5GMPO_MCSBW20UL 192
+#define SROM9_5GMPO_MCSBW40 194
+#define SROM9_5GHPO_MCSBW20 196
+#define SROM9_5GHPO_MCSBW20UL 198
+#define SROM9_5GHPO_MCSBW40 200
+
+#define SROM9_PO_MCS32 202
+#define SROM9_PO_LOFDM40DUP 203
+#define SROM8_RXGAINERR_2G 205
+#define SROM8_RXGAINERR_5GL 206
+#define SROM8_RXGAINERR_5GM 207
+#define SROM8_RXGAINERR_5GH 208
+#define SROM8_RXGAINERR_5GU 209
+#define SROM8_SUBBAND_PPR 210
+#define SROM8_PCIEINGRESS_WAR 211
+#define SROM9_SAR 212
+
+#define SROM8_NOISELVL_2G 213
+#define SROM8_NOISELVL_5GL 214
+#define SROM8_NOISELVL_5GM 215
+#define SROM8_NOISELVL_5GH 216
+#define SROM8_NOISELVL_5GU 217
+
+#define SROM9_REV_CRC 219
+
+#define SROM10_CCKPWROFFSET 218
+#define SROM10_SIGN 219
+#define SROM10_SWCTRLMAP_2G 220
+#define SROM10_CRCREV 229
+
+#define SROM10_WORDS 230
+#define SROM10_SIGNATURE SROM4_SIGNATURE
+
+
+/* SROM REV 11 */
+#define SROM11_BREV 65
+
+#define SROM11_BFL0 66
+#define SROM11_BFL1 67
+#define SROM11_BFL2 68
+#define SROM11_BFL3 69
+#define SROM11_BFL4 70
+#define SROM11_BFL5 71
+
+#define SROM11_MACHI 72
+#define SROM11_MACMID 73
+#define SROM11_MACLO 74
+
+#define SROM11_CCODE 75
+#define SROM11_REGREV 76
+
+#define SROM11_LEDBH10 77
+#define SROM11_LEDBH32 78
+
+#define SROM11_LEDDC 79
+
+#define SROM11_AA 80
+
+#define SROM11_AGBG10 81
+#define SROM11_AGBG2A0 82
+#define SROM11_AGA21 83
+
+#define SROM11_TXRXC 84
+
+#define SROM11_FEM_CFG1 85
+#define SROM11_FEM_CFG2 86
+
+/* Masks and offsets for FEM_CFG */
+#define SROM11_FEMCTRL_MASK 0xf800
+#define SROM11_FEMCTRL_SHIFT 11
+#define SROM11_PAPDCAP_MASK 0x0400
+#define SROM11_PAPDCAP_SHIFT 10
+#define SROM11_TWORANGETSSI_MASK 0x0200
+#define SROM11_TWORANGETSSI_SHIFT 9
+#define SROM11_PDGAIN_MASK 0x01f0
+#define SROM11_PDGAIN_SHIFT 4
+#define SROM11_EPAGAIN_MASK 0x000e
+#define SROM11_EPAGAIN_SHIFT 1
+#define SROM11_TSSIPOSSLOPE_MASK 0x0001
+#define SROM11_TSSIPOSSLOPE_SHIFT 0
+#define SROM11_GAINCTRLSPH_MASK 0xf800
+#define SROM11_GAINCTRLSPH_SHIFT 11
+
+#define SROM11_THERMAL 87
+#define SROM11_MPWR_RAWTS 88
+#define SROM11_TS_SLP_OPT_CORRX 89
+#define SROM11_PHYCAL_TEMPDELTA 92
+#define SROM11_MPWR_1_AND_2 93
+
+/* Masks and offsets for Terrmal parameters */
+#define SROM11_TEMPS_PERIOD_MASK 0xf0
+#define SROM11_TEMPS_PERIOD_SHIFT 4
+#define SROM11_TEMPS_HYSTERESIS_MASK 0x0f
+#define SROM11_TEMPS_HYSTERESIS_SHIFT 0
+#define SROM11_TEMPCORRX_MASK 0xfc
+#define SROM11_TEMPCORRX_SHIFT 2
+#define SROM11_TEMPSENSE_OPTION_MASK 0x3
+#define SROM11_TEMPSENSE_OPTION_SHIFT 0
+
+#define SROM11_PDOFF_40M_A0 101
+#define SROM11_PDOFF_40M_A1 102
+#define SROM11_PDOFF_40M_A2 103
+#define SROM11_PDOFF_80M_A0 104
+#define SROM11_PDOFF_80M_A1 105
+#define SROM11_PDOFF_80M_A2 106
+
+#define SROM11_SUBBAND5GVER 107
+
+/* Per-path fields and offset */
+#define MAX_PATH_SROM_11 3
+#define SROM11_PATH0 108
+#define SROM11_PATH1 128
+#define SROM11_PATH2 148
+
+#define SROM11_2G_MAXP 0
+#define SROM11_2G_PA 1
+#define SROM11_RXGAINS1 4
+#define SROM11_RXGAINS 5
+#define SROM11_5GB1B0_MAXP 6
+#define SROM11_5GB3B2_MAXP 7
+#define SROM11_5GB0_PA 8
+#define SROM11_5GB1_PA 11
+#define SROM11_5GB2_PA 14
+#define SROM11_5GB3_PA 17
+
+/* Masks and offsets for rxgains */
+#define SROM11_RXGAINS5GTRELNABYPA_MASK 0x8000
+#define SROM11_RXGAINS5GTRELNABYPA_SHIFT 15
+#define SROM11_RXGAINS5GTRISOA_MASK 0x7800
+#define SROM11_RXGAINS5GTRISOA_SHIFT 11
+#define SROM11_RXGAINS5GELNAGAINA_MASK 0x0700
+#define SROM11_RXGAINS5GELNAGAINA_SHIFT 8
+#define SROM11_RXGAINS2GTRELNABYPA_MASK 0x0080
+#define SROM11_RXGAINS2GTRELNABYPA_SHIFT 7
+#define SROM11_RXGAINS2GTRISOA_MASK 0x0078
+#define SROM11_RXGAINS2GTRISOA_SHIFT 3
+#define SROM11_RXGAINS2GELNAGAINA_MASK 0x0007
+#define SROM11_RXGAINS2GELNAGAINA_SHIFT 0
+#define SROM11_RXGAINS5GHTRELNABYPA_MASK 0x8000
+#define SROM11_RXGAINS5GHTRELNABYPA_SHIFT 15
+#define SROM11_RXGAINS5GHTRISOA_MASK 0x7800
+#define SROM11_RXGAINS5GHTRISOA_SHIFT 11
+#define SROM11_RXGAINS5GHELNAGAINA_MASK 0x0700
+#define SROM11_RXGAINS5GHELNAGAINA_SHIFT 8
+#define SROM11_RXGAINS5GMTRELNABYPA_MASK 0x0080
+#define SROM11_RXGAINS5GMTRELNABYPA_SHIFT 7
+#define SROM11_RXGAINS5GMTRISOA_MASK 0x0078
+#define SROM11_RXGAINS5GMTRISOA_SHIFT 3
+#define SROM11_RXGAINS5GMELNAGAINA_MASK 0x0007
+#define SROM11_RXGAINS5GMELNAGAINA_SHIFT 0
+
+/* Power per rate */
+#define SROM11_CCKBW202GPO 168
+#define SROM11_CCKBW20UL2GPO 169
+#define SROM11_MCSBW202GPO 170
+#define SROM11_MCSBW202GPO_1 171
+#define SROM11_MCSBW402GPO 172
+#define SROM11_MCSBW402GPO_1 173
+#define SROM11_DOT11AGOFDMHRBW202GPO 174
+#define SROM11_OFDMLRBW202GPO 175
+
+#define SROM11_MCSBW205GLPO 176
+#define SROM11_MCSBW205GLPO_1 177
+#define SROM11_MCSBW405GLPO 178
+#define SROM11_MCSBW405GLPO_1 179
+#define SROM11_MCSBW805GLPO 180
+#define SROM11_MCSBW805GLPO_1 181
+#define SROM11_MCSBW1605GLPO 182
+#define SROM11_MCSBW1605GLPO_1 183
+#define SROM11_MCSBW205GMPO 184
+#define SROM11_MCSBW205GMPO_1 185
+#define SROM11_MCSBW405GMPO 186
+#define SROM11_MCSBW405GMPO_1 187
+#define SROM11_MCSBW805GMPO 188
+#define SROM11_MCSBW805GMPO_1 189
+#define SROM11_MCSBW1605GMPO 190
+#define SROM11_MCSBW1605GMPO_1 191
+#define SROM11_MCSBW205GHPO 192
+#define SROM11_MCSBW205GHPO_1 193
+#define SROM11_MCSBW405GHPO 194
+#define SROM11_MCSBW405GHPO_1 195
+#define SROM11_MCSBW805GHPO 196
+#define SROM11_MCSBW805GHPO_1 197
+#define SROM11_MCSBW1605GHPO 198
+#define SROM11_MCSBW1605GHPO_1 199
+
+#define SROM11_MCSLR5GLPO 200
+#define SROM11_MCSLR5GMPO 201
+#define SROM11_MCSLR5GHPO 202
+
+#define SROM11_SB20IN40HRPO 203
+#define SROM11_SB20IN80AND160HR5GLPO 204
+#define SROM11_SB40AND80HR5GLPO 205
+#define SROM11_SB20IN80AND160HR5GMPO 206
+#define SROM11_SB40AND80HR5GMPO 207
+#define SROM11_SB20IN80AND160HR5GHPO 208
+#define SROM11_SB40AND80HR5GHPO 209
+#define SROM11_SB20IN40LRPO 210
+#define SROM11_SB20IN80AND160LR5GLPO 211
+#define SROM11_SB40AND80LR5GLPO 212
+#define SROM11_SB20IN80AND160LR5GMPO 213
+#define SROM11_SB40AND80LR5GMPO 214
+#define SROM11_SB20IN80AND160LR5GHPO 215
+#define SROM11_SB40AND80LR5GHPO 216
+
+#define SROM11_DOT11AGDUPHRPO 217
+#define SROM11_DOT11AGDUPLRPO 218
+
+/* MISC */
+#define SROM11_PCIEINGRESS_WAR 220
+#define SROM11_SAR 221
+
+#define SROM11_NOISELVL_2G 222
+#define SROM11_NOISELVL_5GL 223
+#define SROM11_NOISELVL_5GM 224
+#define SROM11_NOISELVL_5GH 225
+#define SROM11_NOISELVL_5GU 226
+
+#define SROM11_RXGAINERR_2G 227
+#define SROM11_RXGAINERR_5GL 228
+#define SROM11_RXGAINERR_5GM 229
+#define SROM11_RXGAINERR_5GH 230
+#define SROM11_RXGAINERR_5GU 231
+
+#define SROM11_SIGN 64
+#define SROM11_CRCREV 233
+
+#define SROM11_WORDS 234
+#define SROM11_SIGNATURE 0x0634
+
+typedef struct {
+ uint8 tssipos; /* TSSI positive slope, 1: positive, 0: negative */
+ uint8 extpagain; /* Ext PA gain-type: full-gain: 0, pa-lite: 1, no_pa: 2 */
+ uint8 pdetrange; /* support 32 combinations of different Pdet dynamic ranges */
+ uint8 triso; /* TR switch isolation */
+ uint8 antswctrllut; /* antswctrl lookup table configuration: 32 possible choices */
+} srom_fem_t;
+
+#endif /* _bcmsrom_fmt_h_ */
diff --git a/drivers/net/wireless/bcmdhd/include/bcmsrom_tbl.h b/drivers/net/wireless/bcmdhd/include/bcmsrom_tbl.h
new file mode 100644
index 0000000..040ae6a
--- /dev/null
+++ b/drivers/net/wireless/bcmdhd/include/bcmsrom_tbl.h
@@ -0,0 +1,900 @@
+/*
+ * Table that encodes the srom formats for PCI/PCIe NICs.
+ *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
+ * Unless you and Broadcom execute a separate written software license
+ * agreement governing use of this software, this software is licensed to you
+ * under the terms of the GNU General Public License version 2 (the "GPL"),
+ * available at http://www.broadcom.com/licenses/GPLv2.php, with the
+ * following added to such license:
+ *
+ * As a special exception, the copyright holders of this software give you
+ * permission to link this software with independent modules, and to copy and
+ * distribute the resulting executable under terms of your choice, provided that
+ * you also meet, for each linked independent module, the terms and conditions of
+ * the license of that module. An independent module is a module which is not
+ * derived from this software. The special exception does not apply to any
+ * modifications of the software.
+ *
+ * Notwithstanding the above, under no circumstances may you combine this
+ * software in any way with any other Broadcom software provided under a license
+ * other than the GPL, without Broadcom's express prior written consent.
+ *
+ * $Id: bcmsrom_tbl.h 327694 2012-04-16 13:22:24Z $
+ */
+
+#ifndef _bcmsrom_tbl_h_
+#define _bcmsrom_tbl_h_
+
+#include "sbpcmcia.h"
+#include "wlioctl.h"
+
+typedef struct {
+ const char *name;
+ uint32 revmask;
+ uint32 flags;
+ uint16 off;
+ uint16 mask;
+} sromvar_t;
+
+#define SRFL_MORE 1 /* value continues as described by the next entry */
+#define SRFL_NOFFS 2 /* value bits can't be all one's */
+#define SRFL_PRHEX 4 /* value is in hexdecimal format */
+#define SRFL_PRSIGN 8 /* value is in signed decimal format */
+#define SRFL_CCODE 0x10 /* value is in country code format */
+#define SRFL_ETHADDR 0x20 /* value is an Ethernet address */
+#define SRFL_LEDDC 0x40 /* value is an LED duty cycle */
+#define SRFL_NOVAR 0x80 /* do not generate a nvram param, entry is for mfgc */
+#define SRFL_ARRAY 0x100 /* value is in an array. All elements EXCEPT FOR THE LAST
+ * ONE in the array should have this flag set.
+ */
+
+
+/* Assumptions:
+ * - Ethernet address spans across 3 consective words
+ *
+ * Table rules:
+ * - Add multiple entries next to each other if a value spans across multiple words
+ * (even multiple fields in the same word) with each entry except the last having
+ * it's SRFL_MORE bit set.
+ * - Ethernet address entry does not follow above rule and must not have SRFL_MORE
+ * bit set. Its SRFL_ETHADDR bit implies it takes multiple words.
+ * - The last entry's name field must be NULL to indicate the end of the table. Other
+ * entries must have non-NULL name.
+ */
+
+static const sromvar_t pci_sromvars[] = {
+ {"devid", 0xffffff00, SRFL_PRHEX|SRFL_NOVAR, PCI_F0DEVID, 0xffff},
+ {"boardrev", 0x0000000e, SRFL_PRHEX, SROM_AABREV, SROM_BR_MASK},
+ {"boardrev", 0x000000f0, SRFL_PRHEX, SROM4_BREV, 0xffff},
+ {"boardrev", 0xffffff00, SRFL_PRHEX, SROM8_BREV, 0xffff},
+ {"boardflags", 0x00000002, SRFL_PRHEX, SROM_BFL, 0xffff},
+ {"boardflags", 0x00000004, SRFL_PRHEX|SRFL_MORE, SROM_BFL, 0xffff},
+ {"", 0, 0, SROM_BFL2, 0xffff},
+ {"boardflags", 0x00000008, SRFL_PRHEX|SRFL_MORE, SROM_BFL, 0xffff},
+ {"", 0, 0, SROM3_BFL2, 0xffff},
+ {"boardflags", 0x00000010, SRFL_PRHEX|SRFL_MORE, SROM4_BFL0, 0xffff},
+ {"", 0, 0, SROM4_BFL1, 0xffff},
+ {"boardflags", 0x000000e0, SRFL_PRHEX|SRFL_MORE, SROM5_BFL0, 0xffff},
+ {"", 0, 0, SROM5_BFL1, 0xffff},
+ {"boardflags", 0xffffff00, SRFL_PRHEX|SRFL_MORE, SROM8_BFL0, 0xffff},
+ {"", 0, 0, SROM8_BFL1, 0xffff},
+ {"boardflags2", 0x00000010, SRFL_PRHEX|SRFL_MORE, SROM4_BFL2, 0xffff},
+ {"", 0, 0, SROM4_BFL3, 0xffff},
+ {"boardflags2", 0x000000e0, SRFL_PRHEX|SRFL_MORE, SROM5_BFL2, 0xffff},
+ {"", 0, 0, SROM5_BFL3, 0xffff},
+ {"boardflags2", 0xffffff00, SRFL_PRHEX|SRFL_MORE, SROM8_BFL2, 0xffff},
+ {"", 0, 0, SROM8_BFL3, 0xffff},
+ {"boardtype", 0xfffffffc, SRFL_PRHEX, SROM_SSID, 0xffff},
+
+ {"boardnum", 0x00000006, 0, SROM_MACLO_IL0, 0xffff},
+ {"boardnum", 0x00000008, 0, SROM3_MACLO, 0xffff},
+ {"boardnum", 0x00000010, 0, SROM4_MACLO, 0xffff},
+ {"boardnum", 0x000000e0, 0, SROM5_MACLO, 0xffff},
+ {"boardnum", 0x00000700, 0, SROM8_MACLO, 0xffff},
+ {"cc", 0x00000002, 0, SROM_AABREV, SROM_CC_MASK},
+ {"regrev", 0x00000008, 0, SROM_OPO, 0xff00},
+ {"regrev", 0x00000010, 0, SROM4_REGREV, 0x00ff},
+ {"regrev", 0x000000e0, 0, SROM5_REGREV, 0x00ff},
+ {"regrev", 0x00000700, 0, SROM8_REGREV, 0x00ff},
+ {"ledbh0", 0x0000000e, SRFL_NOFFS, SROM_LEDBH10, 0x00ff},
+ {"ledbh1", 0x0000000e, SRFL_NOFFS, SROM_LEDBH10, 0xff00},
+ {"ledbh2", 0x0000000e, SRFL_NOFFS, SROM_LEDBH32, 0x00ff},
+ {"ledbh3", 0x0000000e, SRFL_NOFFS, SROM_LEDBH32, 0xff00},
+ {"ledbh0", 0x00000010, SRFL_NOFFS, SROM4_LEDBH10, 0x00ff},
+ {"ledbh1", 0x00000010, SRFL_NOFFS, SROM4_LEDBH10, 0xff00},
+ {"ledbh2", 0x00000010, SRFL_NOFFS, SROM4_LEDBH32, 0x00ff},
+ {"ledbh3", 0x00000010, SRFL_NOFFS, SROM4_LEDBH32, 0xff00},
+ {"ledbh0", 0x000000e0, SRFL_NOFFS, SROM5_LEDBH10, 0x00ff},
+ {"ledbh1", 0x000000e0, SRFL_NOFFS, SROM5_LEDBH10, 0xff00},
+ {"ledbh2", 0x000000e0, SRFL_NOFFS, SROM5_LEDBH32, 0x00ff},
+ {"ledbh3", 0x000000e0, SRFL_NOFFS, SROM5_LEDBH32, 0xff00},
+ {"ledbh0", 0x00000700, SRFL_NOFFS, SROM8_LEDBH10, 0x00ff},
+ {"ledbh1", 0x00000700, SRFL_NOFFS, SROM8_LEDBH10, 0xff00},
+ {"ledbh2", 0x00000700, SRFL_NOFFS, SROM8_LEDBH32, 0x00ff},
+ {"ledbh3", 0x00000700, SRFL_NOFFS, SROM8_LEDBH32, 0xff00},
+ {"pa0b0", 0x0000000e, SRFL_PRHEX, SROM_WL0PAB0, 0xffff},
+ {"pa0b1", 0x0000000e, SRFL_PRHEX, SROM_WL0PAB1, 0xffff},
+ {"pa0b2", 0x0000000e, SRFL_PRHEX, SROM_WL0PAB2, 0xffff},
+ {"pa0itssit", 0x0000000e, 0, SROM_ITT, 0x00ff},
+ {"pa0maxpwr", 0x0000000e, 0, SROM_WL10MAXP, 0x00ff},
+ {"pa0b0", 0x00000700, SRFL_PRHEX, SROM8_W0_PAB0, 0xffff},
+ {"pa0b1", 0x00000700, SRFL_PRHEX, SROM8_W0_PAB1, 0xffff},
+ {"pa0b2", 0x00000700, SRFL_PRHEX, SROM8_W0_PAB2, 0xffff},
+ {"pa0itssit", 0x00000700, 0, SROM8_W0_ITTMAXP, 0xff00},
+ {"pa0maxpwr", 0x00000700, 0, SROM8_W0_ITTMAXP, 0x00ff},
+ {"opo", 0x0000000c, 0, SROM_OPO, 0x00ff},
+ {"opo", 0x00000700, 0, SROM8_2G_OFDMPO, 0x00ff},
+ {"aa2g", 0x0000000e, 0, SROM_AABREV, SROM_AA0_MASK},
+ {"aa2g", 0x000000f0, 0, SROM4_AA, 0x00ff},
+ {"aa2g", 0x00000700, 0, SROM8_AA, 0x00ff},
+ {"aa5g", 0x0000000e, 0, SROM_AABREV, SROM_AA1_MASK},
+ {"aa5g", 0x000000f0, 0, SROM4_AA, 0xff00},
+ {"aa5g", 0x00000700, 0, SROM8_AA, 0xff00},
+ {"ag0", 0x0000000e, 0, SROM_AG10, 0x00ff},
+ {"ag1", 0x0000000e, 0, SROM_AG10, 0xff00},
+ {"ag0", 0x000000f0, 0, SROM4_AG10, 0x00ff},
+ {"ag1", 0x000000f0, 0, SROM4_AG10, 0xff00},
+ {"ag2", 0x000000f0, 0, SROM4_AG32, 0x00ff},
+ {"ag3", 0x000000f0, 0, SROM4_AG32, 0xff00},
+ {"ag0", 0x00000700, 0, SROM8_AG10, 0x00ff},
+ {"ag1", 0x00000700, 0, SROM8_AG10, 0xff00},
+ {"ag2", 0x00000700, 0, SROM8_AG32, 0x00ff},
+ {"ag3", 0x00000700, 0, SROM8_AG32, 0xff00},
+ {"pa1b0", 0x0000000e, SRFL_PRHEX, SROM_WL1PAB0, 0xffff},
+ {"pa1b1", 0x0000000e, SRFL_PRHEX, SROM_WL1PAB1, 0xffff},
+ {"pa1b2", 0x0000000e, SRFL_PRHEX, SROM_WL1PAB2, 0xffff},
+ {"pa1lob0", 0x0000000c, SRFL_PRHEX, SROM_WL1LPAB0, 0xffff},
+ {"pa1lob1", 0x0000000c, SRFL_PRHEX, SROM_WL1LPAB1, 0xffff},
+ {"pa1lob2", 0x0000000c, SRFL_PRHEX, SROM_WL1LPAB2, 0xffff},
+ {"pa1hib0", 0x0000000c, SRFL_PRHEX, SROM_WL1HPAB0, 0xffff},
+ {"pa1hib1", 0x0000000c, SRFL_PRHEX, SROM_WL1HPAB1, 0xffff},
+ {"pa1hib2", 0x0000000c, SRFL_PRHEX, SROM_WL1HPAB2, 0xffff},
+ {"pa1itssit", 0x0000000e, 0, SROM_ITT, 0xff00},
+ {"pa1maxpwr", 0x0000000e, 0, SROM_WL10MAXP, 0xff00},
+ {"pa1lomaxpwr", 0x0000000c, 0, SROM_WL1LHMAXP, 0xff00},
+ {"pa1himaxpwr", 0x0000000c, 0, SROM_WL1LHMAXP, 0x00ff},
+ {"pa1b0", 0x00000700, SRFL_PRHEX, SROM8_W1_PAB0, 0xffff},
+ {"pa1b1", 0x00000700, SRFL_PRHEX, SROM8_W1_PAB1, 0xffff},
+ {"pa1b2", 0x00000700, SRFL_PRHEX, SROM8_W1_PAB2, 0xffff},
+ {"pa1lob0", 0x00000700, SRFL_PRHEX, SROM8_W1_PAB0_LC, 0xffff},
+ {"pa1lob1", 0x00000700, SRFL_PRHEX, SROM8_W1_PAB1_LC, 0xffff},
+ {"pa1lob2", 0x00000700, SRFL_PRHEX, SROM8_W1_PAB2_LC, 0xffff},
+ {"pa1hib0", 0x00000700, SRFL_PRHEX, SROM8_W1_PAB0_HC, 0xffff},
+ {"pa1hib1", 0x00000700, SRFL_PRHEX, SROM8_W1_PAB1_HC, 0xffff},
+ {"pa1hib2", 0x00000700, SRFL_PRHEX, SROM8_W1_PAB2_HC, 0xffff},
+ {"pa1itssit", 0x00000700, 0, SROM8_W1_ITTMAXP, 0xff00},
+ {"pa1maxpwr", 0x00000700, 0, SROM8_W1_ITTMAXP, 0x00ff},
+ {"pa1lomaxpwr", 0x00000700, 0, SROM8_W1_MAXP_LCHC, 0xff00},
+ {"pa1himaxpwr", 0x00000700, 0, SROM8_W1_MAXP_LCHC, 0x00ff},
+ {"bxa2g", 0x00000008, 0, SROM_BXARSSI2G, 0x1800},
+ {"rssisav2g", 0x00000008, 0, SROM_BXARSSI2G, 0x0700},
+ {"rssismc2g", 0x00000008, 0, SROM_BXARSSI2G, 0x00f0},
+ {"rssismf2g", 0x00000008, 0, SROM_BXARSSI2G, 0x000f},
+ {"bxa2g", 0x00000700, 0, SROM8_BXARSSI2G, 0x1800},
+ {"rssisav2g", 0x00000700, 0, SROM8_BXARSSI2G, 0x0700},
+ {"rssismc2g", 0x00000700, 0, SROM8_BXARSSI2G, 0x00f0},
+ {"rssismf2g", 0x00000700, 0, SROM8_BXARSSI2G, 0x000f},
+ {"bxa5g", 0x00000008, 0, SROM_BXARSSI5G, 0x1800},
+ {"rssisav5g", 0x00000008, 0, SROM_BXARSSI5G, 0x0700},
+ {"rssismc5g", 0x00000008, 0, SROM_BXARSSI5G, 0x00f0},
+ {"rssismf5g", 0x00000008, 0, SROM_BXARSSI5G, 0x000f},
+ {"bxa5g", 0x00000700, 0, SROM8_BXARSSI5G, 0x1800},
+ {"rssisav5g", 0x00000700, 0, SROM8_BXARSSI5G, 0x0700},
+ {"rssismc5g", 0x00000700, 0, SROM8_BXARSSI5G, 0x00f0},
+ {"rssismf5g", 0x00000700, 0, SROM8_BXARSSI5G, 0x000f},
+ {"tri2g", 0x00000008, 0, SROM_TRI52G, 0x00ff},
+ {"tri5g", 0x00000008, 0, SROM_TRI52G, 0xff00},
+ {"tri5gl", 0x00000008, 0, SROM_TRI5GHL, 0x00ff},
+ {"tri5gh", 0x00000008, 0, SROM_TRI5GHL, 0xff00},
+ {"tri2g", 0x00000700, 0, SROM8_TRI52G, 0x00ff},
+ {"tri5g", 0x00000700, 0, SROM8_TRI52G, 0xff00},
+ {"tri5gl", 0x00000700, 0, SROM8_TRI5GHL, 0x00ff},
+ {"tri5gh", 0x00000700, 0, SROM8_TRI5GHL, 0xff00},
+ {"rxpo2g", 0x00000008, SRFL_PRSIGN, SROM_RXPO52G, 0x00ff},
+ {"rxpo5g", 0x00000008, SRFL_PRSIGN, SROM_RXPO52G, 0xff00},
+ {"rxpo2g", 0x00000700, SRFL_PRSIGN, SROM8_RXPO52G, 0x00ff},
+ {"rxpo5g", 0x00000700, SRFL_PRSIGN, SROM8_RXPO52G, 0xff00},
+ {"txchain", 0x000000f0, SRFL_NOFFS, SROM4_TXRXC, SROM4_TXCHAIN_MASK},
+ {"rxchain", 0x000000f0, SRFL_NOFFS, SROM4_TXRXC, SROM4_RXCHAIN_MASK},
+ {"antswitch", 0x000000f0, SRFL_NOFFS, SROM4_TXRXC, SROM4_SWITCH_MASK},
+ {"txchain", 0x00000700, SRFL_NOFFS, SROM8_TXRXC, SROM4_TXCHAIN_MASK},
+ {"rxchain", 0x00000700, SRFL_NOFFS, SROM8_TXRXC, SROM4_RXCHAIN_MASK},
+ {"antswitch", 0x00000700, SRFL_NOFFS, SROM8_TXRXC, SROM4_SWITCH_MASK},
+ {"tssipos2g", 0x00000700, 0, SROM8_FEM2G, SROM8_FEM_TSSIPOS_MASK},
+ {"extpagain2g", 0x00000700, 0, SROM8_FEM2G, SROM8_FEM_EXTPA_GAIN_MASK},
+ {"pdetrange2g", 0x00000700, 0, SROM8_FEM2G, SROM8_FEM_PDET_RANGE_MASK},
+ {"triso2g", 0x00000700, 0, SROM8_FEM2G, SROM8_FEM_TR_ISO_MASK},
+ {"antswctl2g", 0x00000700, 0, SROM8_FEM2G, SROM8_FEM_ANTSWLUT_MASK},
+ {"tssipos5g", 0x00000700, 0, SROM8_FEM5G, SROM8_FEM_TSSIPOS_MASK},
+ {"extpagain5g", 0x00000700, 0, SROM8_FEM5G, SROM8_FEM_EXTPA_GAIN_MASK},
+ {"pdetrange5g", 0x00000700, 0, SROM8_FEM5G, SROM8_FEM_PDET_RANGE_MASK},
+ {"triso5g", 0x00000700, 0, SROM8_FEM5G, SROM8_FEM_TR_ISO_MASK},
+ {"antswctl5g", 0x00000700, 0, SROM8_FEM5G, SROM8_FEM_ANTSWLUT_MASK},
+ {"txpid2ga0", 0x000000f0, 0, SROM4_TXPID2G, 0x00ff},
+ {"txpid2ga1", 0x000000f0, 0, SROM4_TXPID2G, 0xff00},
+ {"txpid2ga2", 0x000000f0, 0, SROM4_TXPID2G + 1, 0x00ff},
+ {"txpid2ga3", 0x000000f0, 0, SROM4_TXPID2G + 1, 0xff00},
+ {"txpid5ga0", 0x000000f0, 0, SROM4_TXPID5G, 0x00ff},
+ {"txpid5ga1", 0x000000f0, 0, SROM4_TXPID5G, 0xff00},
+ {"txpid5ga2", 0x000000f0, 0, SROM4_TXPID5G + 1, 0x00ff},
+ {"txpid5ga3", 0x000000f0, 0, SROM4_TXPID5G + 1, 0xff00},
+ {"txpid5gla0", 0x000000f0, 0, SROM4_TXPID5GL, 0x00ff},
+ {"txpid5gla1", 0x000000f0, 0, SROM4_TXPID5GL, 0xff00},
+ {"txpid5gla2", 0x000000f0, 0, SROM4_TXPID5GL + 1, 0x00ff},
+ {"txpid5gla3", 0x000000f0, 0, SROM4_TXPID5GL + 1, 0xff00},
+ {"txpid5gha0", 0x000000f0, 0, SROM4_TXPID5GH, 0x00ff},
+ {"txpid5gha1", 0x000000f0, 0, SROM4_TXPID5GH, 0xff00},
+ {"txpid5gha2", 0x000000f0, 0, SROM4_TXPID5GH + 1, 0x00ff},
+ {"txpid5gha3", 0x000000f0, 0, SROM4_TXPID5GH + 1, 0xff00},
+
+ {"ccode", 0x0000000f, SRFL_CCODE, SROM_CCODE, 0xffff},
+ {"ccode", 0x00000010, SRFL_CCODE, SROM4_CCODE, 0xffff},
+ {"ccode", 0x000000e0, SRFL_CCODE, SROM5_CCODE, 0xffff},
+ {"ccode", 0x00000700, SRFL_CCODE, SROM8_CCODE, 0xffff},
+ {"macaddr", 0x00000700, SRFL_ETHADDR, SROM8_MACHI, 0xffff},
+ {"macaddr", 0x000000e0, SRFL_ETHADDR, SROM5_MACHI, 0xffff},
+ {"macaddr", 0x00000010, SRFL_ETHADDR, SROM4_MACHI, 0xffff},
+ {"macaddr", 0x00000008, SRFL_ETHADDR, SROM3_MACHI, 0xffff},
+ {"il0macaddr", 0x00000007, SRFL_ETHADDR, SROM_MACHI_IL0, 0xffff},
+ {"et1macaddr", 0x00000007, SRFL_ETHADDR, SROM_MACHI_ET1, 0xffff},
+ {"leddc", 0x00000700, SRFL_NOFFS|SRFL_LEDDC, SROM8_LEDDC, 0xffff},
+ {"leddc", 0x000000e0, SRFL_NOFFS|SRFL_LEDDC, SROM5_LEDDC, 0xffff},
+ {"leddc", 0x00000010, SRFL_NOFFS|SRFL_LEDDC, SROM4_LEDDC, 0xffff},
+ {"leddc", 0x00000008, SRFL_NOFFS|SRFL_LEDDC, SROM3_LEDDC, 0xffff},
+
+ {"tempthresh", 0x00000700, 0, SROM8_THERMAL, 0xff00},
+ {"tempoffset", 0x00000700, 0, SROM8_THERMAL, 0x00ff},
+ {"rawtempsense", 0x00000700, SRFL_PRHEX, SROM8_MPWR_RAWTS, 0x01ff},
+ {"measpower", 0x00000700, SRFL_PRHEX, SROM8_MPWR_RAWTS, 0xfe00},
+ {"tempsense_slope", 0x00000700, SRFL_PRHEX, SROM8_TS_SLP_OPT_CORRX, 0x00ff},
+ {"tempcorrx", 0x00000700, SRFL_PRHEX, SROM8_TS_SLP_OPT_CORRX, 0xfc00},
+ {"tempsense_option", 0x00000700, SRFL_PRHEX, SROM8_TS_SLP_OPT_CORRX, 0x0300},
+ {"freqoffset_corr", 0x00000700, SRFL_PRHEX, SROM8_FOC_HWIQ_IQSWP, 0x000f},
+ {"iqcal_swp_dis", 0x00000700, SRFL_PRHEX, SROM8_FOC_HWIQ_IQSWP, 0x0010},
+ {"hw_iqcal_en", 0x00000700, SRFL_PRHEX, SROM8_FOC_HWIQ_IQSWP, 0x0020},
+ {"elna2g", 0x00000700, 0, SROM8_EXTLNAGAIN, 0x00ff},
+ {"elna5g", 0x00000700, 0, SROM8_EXTLNAGAIN, 0xff00},
+ {"phycal_tempdelta", 0x00000700, 0, SROM8_PHYCAL_TEMPDELTA, 0x00ff},
+ {"temps_period", 0x00000700, 0, SROM8_PHYCAL_TEMPDELTA, 0x0f00},
+ {"temps_hysteresis", 0x00000700, 0, SROM8_PHYCAL_TEMPDELTA, 0xf000},
+ {"measpower1", 0x00000700, SRFL_PRHEX, SROM8_MPWR_1_AND_2, 0x007f},
+ {"measpower2", 0x00000700, SRFL_PRHEX, SROM8_MPWR_1_AND_2, 0x3f80},
+
+ {"cck2gpo", 0x000000f0, 0, SROM4_2G_CCKPO, 0xffff},
+ {"cck2gpo", 0x00000100, 0, SROM8_2G_CCKPO, 0xffff},
+ {"ofdm2gpo", 0x000000f0, SRFL_MORE, SROM4_2G_OFDMPO, 0xffff},
+ {"", 0, 0, SROM4_2G_OFDMPO + 1, 0xffff},
+ {"ofdm5gpo", 0x000000f0, SRFL_MORE, SROM4_5G_OFDMPO, 0xffff},
+ {"", 0, 0, SROM4_5G_OFDMPO + 1, 0xffff},
+ {"ofdm5glpo", 0x000000f0, SRFL_MORE, SROM4_5GL_OFDMPO, 0xffff},
+ {"", 0, 0, SROM4_5GL_OFDMPO + 1, 0xffff},
+ {"ofdm5ghpo", 0x000000f0, SRFL_MORE, SROM4_5GH_OFDMPO, 0xffff},
+ {"", 0, 0, SROM4_5GH_OFDMPO + 1, 0xffff},
+ {"ofdm2gpo", 0x00000100, SRFL_MORE, SROM8_2G_OFDMPO, 0xffff},
+ {"", 0, 0, SROM8_2G_OFDMPO + 1, 0xffff},
+ {"ofdm5gpo", 0x00000100, SRFL_MORE, SROM8_5G_OFDMPO, 0xffff},
+ {"", 0, 0, SROM8_5G_OFDMPO + 1, 0xffff},
+ {"ofdm5glpo", 0x00000100, SRFL_MORE, SROM8_5GL_OFDMPO, 0xffff},
+ {"", 0, 0, SROM8_5GL_OFDMPO + 1, 0xffff},
+ {"ofdm5ghpo", 0x00000100, SRFL_MORE, SROM8_5GH_OFDMPO, 0xffff},
+ {"", 0, 0, SROM8_5GH_OFDMPO + 1, 0xffff},
+ {"mcs2gpo0", 0x000000f0, 0, SROM4_2G_MCSPO, 0xffff},
+ {"mcs2gpo1", 0x000000f0, 0, SROM4_2G_MCSPO + 1, 0xffff},
+ {"mcs2gpo2", 0x000000f0, 0, SROM4_2G_MCSPO + 2, 0xffff},
+ {"mcs2gpo3", 0x000000f0, 0, SROM4_2G_MCSPO + 3, 0xffff},
+ {"mcs2gpo4", 0x000000f0, 0, SROM4_2G_MCSPO + 4, 0xffff},
+ {"mcs2gpo5", 0x000000f0, 0, SROM4_2G_MCSPO + 5, 0xffff},
+ {"mcs2gpo6", 0x000000f0, 0, SROM4_2G_MCSPO + 6, 0xffff},
+ {"mcs2gpo7", 0x000000f0, 0, SROM4_2G_MCSPO + 7, 0xffff},
+ {"mcs5gpo0", 0x000000f0, 0, SROM4_5G_MCSPO, 0xffff},
+ {"mcs5gpo1", 0x000000f0, 0, SROM4_5G_MCSPO + 1, 0xffff},
+ {"mcs5gpo2", 0x000000f0, 0, SROM4_5G_MCSPO + 2, 0xffff},
+ {"mcs5gpo3", 0x000000f0, 0, SROM4_5G_MCSPO + 3, 0xffff},
+ {"mcs5gpo4", 0x000000f0, 0, SROM4_5G_MCSPO + 4, 0xffff},
+ {"mcs5gpo5", 0x000000f0, 0, SROM4_5G_MCSPO + 5, 0xffff},
+ {"mcs5gpo6", 0x000000f0, 0, SROM4_5G_MCSPO + 6, 0xffff},
+ {"mcs5gpo7", 0x000000f0, 0, SROM4_5G_MCSPO + 7, 0xffff},
+ {"mcs5glpo0", 0x000000f0, 0, SROM4_5GL_MCSPO, 0xffff},
+ {"mcs5glpo1", 0x000000f0, 0, SROM4_5GL_MCSPO + 1, 0xffff},
+ {"mcs5glpo2", 0x000000f0, 0, SROM4_5GL_MCSPO + 2, 0xffff},
+ {"mcs5glpo3", 0x000000f0, 0, SROM4_5GL_MCSPO + 3, 0xffff},
+ {"mcs5glpo4", 0x000000f0, 0, SROM4_5GL_MCSPO + 4, 0xffff},
+ {"mcs5glpo5", 0x000000f0, 0, SROM4_5GL_MCSPO + 5, 0xffff},
+ {"mcs5glpo6", 0x000000f0, 0, SROM4_5GL_MCSPO + 6, 0xffff},
+ {"mcs5glpo7", 0x000000f0, 0, SROM4_5GL_MCSPO + 7, 0xffff},
+ {"mcs5ghpo0", 0x000000f0, 0, SROM4_5GH_MCSPO, 0xffff},
+ {"mcs5ghpo1", 0x000000f0, 0, SROM4_5GH_MCSPO + 1, 0xffff},
+ {"mcs5ghpo2", 0x000000f0, 0, SROM4_5GH_MCSPO + 2, 0xffff},
+ {"mcs5ghpo3", 0x000000f0, 0, SROM4_5GH_MCSPO + 3, 0xffff},
+ {"mcs5ghpo4", 0x000000f0, 0, SROM4_5GH_MCSPO + 4, 0xffff},
+ {"mcs5ghpo5", 0x000000f0, 0, SROM4_5GH_MCSPO + 5, 0xffff},
+ {"mcs5ghpo6", 0x000000f0, 0, SROM4_5GH_MCSPO + 6, 0xffff},
+ {"mcs5ghpo7", 0x000000f0, 0, SROM4_5GH_MCSPO + 7, 0xffff},
+ {"mcs2gpo0", 0x00000100, 0, SROM8_2G_MCSPO, 0xffff},
+ {"mcs2gpo1", 0x00000100, 0, SROM8_2G_MCSPO + 1, 0xffff},
+ {"mcs2gpo2", 0x00000100, 0, SROM8_2G_MCSPO + 2, 0xffff},
+ {"mcs2gpo3", 0x00000100, 0, SROM8_2G_MCSPO + 3, 0xffff},
+ {"mcs2gpo4", 0x00000100, 0, SROM8_2G_MCSPO + 4, 0xffff},
+ {"mcs2gpo5", 0x00000100, 0, SROM8_2G_MCSPO + 5, 0xffff},
+ {"mcs2gpo6", 0x00000100, 0, SROM8_2G_MCSPO + 6, 0xffff},
+ {"mcs2gpo7", 0x00000100, 0, SROM8_2G_MCSPO + 7, 0xffff},
+ {"mcs5gpo0", 0x00000100, 0, SROM8_5G_MCSPO, 0xffff},
+ {"mcs5gpo1", 0x00000100, 0, SROM8_5G_MCSPO + 1, 0xffff},
+ {"mcs5gpo2", 0x00000100, 0, SROM8_5G_MCSPO + 2, 0xffff},
+ {"mcs5gpo3", 0x00000100, 0, SROM8_5G_MCSPO + 3, 0xffff},
+ {"mcs5gpo4", 0x00000100, 0, SROM8_5G_MCSPO + 4, 0xffff},
+ {"mcs5gpo5", 0x00000100, 0, SROM8_5G_MCSPO + 5, 0xffff},
+ {"mcs5gpo6", 0x00000100, 0, SROM8_5G_MCSPO + 6, 0xffff},
+ {"mcs5gpo7", 0x00000100, 0, SROM8_5G_MCSPO + 7, 0xffff},
+ {"mcs5glpo0", 0x00000100, 0, SROM8_5GL_MCSPO, 0xffff},
+ {"mcs5glpo1", 0x00000100, 0, SROM8_5GL_MCSPO + 1, 0xffff},
+ {"mcs5glpo2", 0x00000100, 0, SROM8_5GL_MCSPO + 2, 0xffff},
+ {"mcs5glpo3", 0x00000100, 0, SROM8_5GL_MCSPO + 3, 0xffff},
+ {"mcs5glpo4", 0x00000100, 0, SROM8_5GL_MCSPO + 4, 0xffff},
+ {"mcs5glpo5", 0x00000100, 0, SROM8_5GL_MCSPO + 5, 0xffff},
+ {"mcs5glpo6", 0x00000100, 0, SROM8_5GL_MCSPO + 6, 0xffff},
+ {"mcs5glpo7", 0x00000100, 0, SROM8_5GL_MCSPO + 7, 0xffff},
+ {"mcs5ghpo0", 0x00000100, 0, SROM8_5GH_MCSPO, 0xffff},
+ {"mcs5ghpo1", 0x00000100, 0, SROM8_5GH_MCSPO + 1, 0xffff},
+ {"mcs5ghpo2", 0x00000100, 0, SROM8_5GH_MCSPO + 2, 0xffff},
+ {"mcs5ghpo3", 0x00000100, 0, SROM8_5GH_MCSPO + 3, 0xffff},
+ {"mcs5ghpo4", 0x00000100, 0, SROM8_5GH_MCSPO + 4, 0xffff},
+ {"mcs5ghpo5", 0x00000100, 0, SROM8_5GH_MCSPO + 5, 0xffff},
+ {"mcs5ghpo6", 0x00000100, 0, SROM8_5GH_MCSPO + 6, 0xffff},
+ {"mcs5ghpo7", 0x00000100, 0, SROM8_5GH_MCSPO + 7, 0xffff},
+ {"cddpo", 0x000000f0, 0, SROM4_CDDPO, 0xffff},
+ {"stbcpo", 0x000000f0, 0, SROM4_STBCPO, 0xffff},
+ {"bw40po", 0x000000f0, 0, SROM4_BW40PO, 0xffff},
+ {"bwduppo", 0x000000f0, 0, SROM4_BWDUPPO, 0xffff},
+ {"cddpo", 0x00000100, 0, SROM8_CDDPO, 0xffff},
+ {"stbcpo", 0x00000100, 0, SROM8_STBCPO, 0xffff},
+ {"bw40po", 0x00000100, 0, SROM8_BW40PO, 0xffff},
+ {"bwduppo", 0x00000100, 0, SROM8_BWDUPPO, 0xffff},
+
+ /* power per rate from sromrev 9 */
+ {"cckbw202gpo", 0x00000600, 0, SROM9_2GPO_CCKBW20, 0xffff},
+ {"cckbw20ul2gpo", 0x00000600, 0, SROM9_2GPO_CCKBW20UL, 0xffff},
+ {"legofdmbw202gpo", 0x00000600, SRFL_MORE, SROM9_2GPO_LOFDMBW20, 0xffff},
+ {"", 0, 0, SROM9_2GPO_LOFDMBW20 + 1, 0xffff},
+ {"legofdmbw20ul2gpo", 0x00000600, SRFL_MORE, SROM9_2GPO_LOFDMBW20UL, 0xffff},
+ {"", 0, 0, SROM9_2GPO_LOFDMBW20UL + 1, 0xffff},
+ {"legofdmbw205glpo", 0x00000600, SRFL_MORE, SROM9_5GLPO_LOFDMBW20, 0xffff},
+ {"", 0, 0, SROM9_5GLPO_LOFDMBW20 + 1, 0xffff},
+ {"legofdmbw20ul5glpo", 0x00000600, SRFL_MORE, SROM9_5GLPO_LOFDMBW20UL, 0xffff},
+ {"", 0, 0, SROM9_5GLPO_LOFDMBW20UL + 1, 0xffff},
+ {"legofdmbw205gmpo", 0x00000600, SRFL_MORE, SROM9_5GMPO_LOFDMBW20, 0xffff},
+ {"", 0, 0, SROM9_5GMPO_LOFDMBW20 + 1, 0xffff},
+ {"legofdmbw20ul5gmpo", 0x00000600, SRFL_MORE, SROM9_5GMPO_LOFDMBW20UL, 0xffff},
+ {"", 0, 0, SROM9_5GMPO_LOFDMBW20UL + 1, 0xffff},
+ {"legofdmbw205ghpo", 0x00000600, SRFL_MORE, SROM9_5GHPO_LOFDMBW20, 0xffff},
+ {"", 0, 0, SROM9_5GHPO_LOFDMBW20 + 1, 0xffff},
+ {"legofdmbw20ul5ghpo", 0x00000600, SRFL_MORE, SROM9_5GHPO_LOFDMBW20UL, 0xffff},
+ {"", 0, 0, SROM9_5GHPO_LOFDMBW20UL + 1, 0xffff},
+ {"mcsbw202gpo", 0x00000600, SRFL_MORE, SROM9_2GPO_MCSBW20, 0xffff},
+ {"", 0, 0, SROM9_2GPO_MCSBW20 + 1, 0xffff},
+ {"mcsbw20ul2gpo", 0x00000600, SRFL_MORE, SROM9_2GPO_MCSBW20UL, 0xffff},
+ {"", 0, 0, SROM9_2GPO_MCSBW20UL + 1, 0xffff},
+ {"mcsbw402gpo", 0x00000600, SRFL_MORE, SROM9_2GPO_MCSBW40, 0xffff},
+ {"", 0, 0, SROM9_2GPO_MCSBW40 + 1, 0xffff},
+ {"mcsbw205glpo", 0x00000600, SRFL_MORE, SROM9_5GLPO_MCSBW20, 0xffff},
+ {"", 0, 0, SROM9_5GLPO_MCSBW20 + 1, 0xffff},
+ {"mcsbw20ul5glpo", 0x00000600, SRFL_MORE, SROM9_5GLPO_MCSBW20UL, 0xffff},
+ {"", 0, 0, SROM9_5GLPO_MCSBW20UL + 1, 0xffff},
+ {"mcsbw405glpo", 0x00000600, SRFL_MORE, SROM9_5GLPO_MCSBW40, 0xffff},
+ {"", 0, 0, SROM9_5GLPO_MCSBW40 + 1, 0xffff},
+ {"mcsbw205gmpo", 0x00000600, SRFL_MORE, SROM9_5GMPO_MCSBW20, 0xffff},
+ {"", 0, 0, SROM9_5GMPO_MCSBW20 + 1, 0xffff},
+ {"mcsbw20ul5gmpo", 0x00000600, SRFL_MORE, SROM9_5GMPO_MCSBW20UL, 0xffff},
+ {"", 0, 0, SROM9_5GMPO_MCSBW20UL + 1, 0xffff},
+ {"mcsbw405gmpo", 0x00000600, SRFL_MORE, SROM9_5GMPO_MCSBW40, 0xffff},
+ {"", 0, 0, SROM9_5GMPO_MCSBW40 + 1, 0xffff},
+ {"mcsbw205ghpo", 0x00000600, SRFL_MORE, SROM9_5GHPO_MCSBW20, 0xffff},
+ {"", 0, 0, SROM9_5GHPO_MCSBW20 + 1, 0xffff},
+ {"mcsbw20ul5ghpo", 0x00000600, SRFL_MORE, SROM9_5GHPO_MCSBW20UL, 0xffff},
+ {"", 0, 0, SROM9_5GHPO_MCSBW20UL + 1, 0xffff},
+ {"mcsbw405ghpo", 0x00000600, SRFL_MORE, SROM9_5GHPO_MCSBW40, 0xffff},
+ {"", 0, 0, SROM9_5GHPO_MCSBW40 + 1, 0xffff},
+ {"mcs32po", 0x00000600, 0, SROM9_PO_MCS32, 0xffff},
+ {"legofdm40duppo", 0x00000600, 0, SROM9_PO_LOFDM40DUP, 0xffff},
+ {"pcieingress_war", 0x00000700, 0, SROM8_PCIEINGRESS_WAR, 0xf},
+ {"rxgainerr2ga0", 0x00000700, 0, SROM8_RXGAINERR_2G, 0x003f},
+ {"rxgainerr2ga1", 0x00000700, 0, SROM8_RXGAINERR_2G, 0x07c0},
+ {"rxgainerr2ga2", 0x00000700, 0, SROM8_RXGAINERR_2G, 0xf800},
+ {"rxgainerr5gla0", 0x00000700, 0, SROM8_RXGAINERR_5GL, 0x003f},
+ {"rxgainerr5gla1", 0x00000700, 0, SROM8_RXGAINERR_5GL, 0x07c0},
+ {"rxgainerr5gla2", 0x00000700, 0, SROM8_RXGAINERR_5GL, 0xf800},
+ {"rxgainerr5gma0", 0x00000700, 0, SROM8_RXGAINERR_5GM, 0x003f},
+ {"rxgainerr5gma1", 0x00000700, 0, SROM8_RXGAINERR_5GM, 0x07c0},
+ {"rxgainerr5gma2", 0x00000700, 0, SROM8_RXGAINERR_5GM, 0xf800},
+ {"rxgainerr5gha0", 0x00000700, 0, SROM8_RXGAINERR_5GH, 0x003f},
+ {"rxgainerr5gha1", 0x00000700, 0, SROM8_RXGAINERR_5GH, 0x07c0},
+ {"rxgainerr5gha2", 0x00000700, 0, SROM8_RXGAINERR_5GH, 0xf800},
+ {"rxgainerr5gua0", 0x00000700, 0, SROM8_RXGAINERR_5GU, 0x003f},
+ {"rxgainerr5gua1", 0x00000700, 0, SROM8_RXGAINERR_5GU, 0x07c0},
+ {"rxgainerr5gua2", 0x00000700, 0, SROM8_RXGAINERR_5GU, 0xf800},
+ {"sar2g", 0x00000600, 0, SROM9_SAR, 0x00ff},
+ {"sar5g", 0x00000600, 0, SROM9_SAR, 0xff00},
+ {"noiselvl2ga0", 0x00000700, 0, SROM8_NOISELVL_2G, 0x001f},
+ {"noiselvl2ga1", 0x00000700, 0, SROM8_NOISELVL_2G, 0x03e0},
+ {"noiselvl2ga2", 0x00000700, 0, SROM8_NOISELVL_2G, 0x7c00},
+ {"noiselvl5gla0", 0x00000700, 0, SROM8_NOISELVL_5GL, 0x001f},
+ {"noiselvl5gla1", 0x00000700, 0, SROM8_NOISELVL_5GL, 0x03e0},
+ {"noiselvl5gla2", 0x00000700, 0, SROM8_NOISELVL_5GL, 0x7c00},
+ {"noiselvl5gma0", 0x00000700, 0, SROM8_NOISELVL_5GM, 0x001f},
+ {"noiselvl5gma1", 0x00000700, 0, SROM8_NOISELVL_5GM, 0x03e0},
+ {"noiselvl5gma2", 0x00000700, 0, SROM8_NOISELVL_5GM, 0x7c00},
+ {"noiselvl5gha0", 0x00000700, 0, SROM8_NOISELVL_5GH, 0x001f},
+ {"noiselvl5gha1", 0x00000700, 0, SROM8_NOISELVL_5GH, 0x03e0},
+ {"noiselvl5gha2", 0x00000700, 0, SROM8_NOISELVL_5GH, 0x7c00},
+ {"noiselvl5gua0", 0x00000700, 0, SROM8_NOISELVL_5GU, 0x001f},
+ {"noiselvl5gua1", 0x00000700, 0, SROM8_NOISELVL_5GU, 0x03e0},
+ {"noiselvl5gua2", 0x00000700, 0, SROM8_NOISELVL_5GU, 0x7c00},
+ {"subband5gver", 0x00000700, 0, SROM8_SUBBAND_PPR, 0x7},
+
+ {"cckPwrOffset", 0x00000400, 0, SROM10_CCKPWROFFSET, 0xffff},
+ /* swctrlmap_2g array, note that the last element doesn't have SRFL_ARRAY flag set */
+ {"swctrlmap_2g", 0x00000400, SRFL_MORE|SRFL_PRHEX|SRFL_ARRAY, SROM10_SWCTRLMAP_2G, 0xffff},
+ {"", 0x00000400, SRFL_ARRAY, SROM10_SWCTRLMAP_2G + 1, 0xffff},
+ {"", 0x00000400, SRFL_MORE|SRFL_PRHEX|SRFL_ARRAY, SROM10_SWCTRLMAP_2G + 2, 0xffff},
+ {"", 0x00000400, SRFL_ARRAY, SROM10_SWCTRLMAP_2G + 3, 0xffff},
+ {"", 0x00000400, SRFL_MORE|SRFL_PRHEX|SRFL_ARRAY, SROM10_SWCTRLMAP_2G + 4, 0xffff},
+ {"", 0x00000400, SRFL_ARRAY, SROM10_SWCTRLMAP_2G + 5, 0xffff},
+ {"", 0x00000400, SRFL_MORE|SRFL_PRHEX|SRFL_ARRAY, SROM10_SWCTRLMAP_2G + 6, 0xffff},
+ {"", 0x00000400, SRFL_ARRAY, SROM10_SWCTRLMAP_2G + 7, 0xffff},
+ {"", 0x00000400, SRFL_PRHEX, SROM10_SWCTRLMAP_2G + 8, 0xffff},
+
+ /* sromrev 11 */
+ {"boardflags3", 0xfffff800, SRFL_PRHEX|SRFL_MORE, SROM11_BFL3, 0xffff},
+ {"", 0, 0, SROM11_BFL3, 0xffff},
+ {"boardnum", 0xfffff800, 0, SROM11_MACLO, 0xffff},
+ {"macaddr", 0xfffff800, SRFL_ETHADDR, SROM11_MACHI, 0xffff},
+ {"ccode", 0xfffff800, SRFL_CCODE, SROM11_CCODE, 0xffff},
+ {"regrev", 0xfffff800, 0, SROM11_REGREV, 0x00ff},
+ {"ledbh0", 0xfffff800, SRFL_NOFFS, SROM11_LEDBH10, 0x00ff},
+ {"ledbh1", 0xfffff800, SRFL_NOFFS, SROM11_LEDBH10, 0xff00},
+ {"ledbh2", 0xfffff800, SRFL_NOFFS, SROM11_LEDBH32, 0x00ff},
+ {"ledbh3", 0xfffff800, SRFL_NOFFS, SROM11_LEDBH32, 0xff00},
+ {"leddc", 0xfffff800, SRFL_NOFFS|SRFL_LEDDC, SROM11_LEDDC, 0xffff},
+ {"aa2g", 0xfffff800, 0, SROM11_AA, 0x00ff},
+ {"aa5g", 0xfffff800, 0, SROM11_AA, 0xff00},
+ {"agbg0", 0xfffff800, 0, SROM11_AGBG10, 0x00ff},
+ {"agbg1", 0xfffff800, 0, SROM11_AGBG10, 0xff00},
+ {"agbg2", 0xfffff800, 0, SROM11_AGBG2A0, 0x00ff},
+ {"aga0", 0xfffff800, 0, SROM11_AGBG2A0, 0xff00},
+ {"aga1", 0xfffff800, 0, SROM11_AGA21, 0x00ff},
+ {"aga2", 0xfffff800, 0, SROM11_AGA21, 0xff00},
+ {"txchain", 0xfffff800, SRFL_NOFFS, SROM11_TXRXC, SROM4_TXCHAIN_MASK},
+ {"rxchain", 0xfffff800, SRFL_NOFFS, SROM11_TXRXC, SROM4_RXCHAIN_MASK},
+ {"antswitch", 0xfffff800, SRFL_NOFFS, SROM11_TXRXC, SROM4_SWITCH_MASK},
+
+ {"tssiposslope2g", 0xfffff800, 0, SROM11_FEM_CFG1, 0x0001},
+ {"epagain2g", 0xfffff800, 0, SROM11_FEM_CFG1, 0x000e},
+ {"pdgain2g", 0xfffff800, 0, SROM11_FEM_CFG1, 0x01f0},
+ {"tworangetssi2g", 0xfffff800, 0, SROM11_FEM_CFG1, 0x0200},
+ {"papdcap2g", 0xfffff800, 0, SROM11_FEM_CFG1, 0x0400},
+ {"femctrl", 0xfffff800, 0, SROM11_FEM_CFG1, 0xf800},
+
+ {"tssiposslope5g", 0xfffff800, 0, SROM11_FEM_CFG2, 0x0001},
+ {"epagain5g", 0xfffff800, 0, SROM11_FEM_CFG2, 0x000e},
+ {"pdgain5g", 0xfffff800, 0, SROM11_FEM_CFG2, 0x01f0},
+ {"tworangetssi5g", 0xfffff800, 0, SROM11_FEM_CFG2, 0x0200},
+ {"papdcap5g", 0xfffff800, 0, SROM11_FEM_CFG2, 0x0400},
+ {"gainctrlsph", 0xfffff800, 0, SROM11_FEM_CFG2, 0xf800},
+
+ {"tempthresh", 0xfffff800, 0, SROM11_THERMAL, 0xff00},
+ {"tempoffset", 0xfffff800, 0, SROM11_THERMAL, 0x00ff},
+ {"rawtempsense", 0xfffff800, SRFL_PRHEX, SROM11_MPWR_RAWTS, 0x01ff},
+ {"measpower", 0xfffff800, SRFL_PRHEX, SROM11_MPWR_RAWTS, 0xfe00},
+ {"tempsense_slope", 0xfffff800, SRFL_PRHEX, SROM11_TS_SLP_OPT_CORRX, 0x00ff},
+ {"tempcorrx", 0xfffff800, SRFL_PRHEX, SROM11_TS_SLP_OPT_CORRX, 0xfc00},
+ {"tempsense_option", 0xfffff800, SRFL_PRHEX, SROM11_TS_SLP_OPT_CORRX, 0x0300},
+ {"phycal_tempdelta", 0xfffff800, 0, SROM11_PHYCAL_TEMPDELTA, 0x00ff},
+ {"temps_period", 0xfffff800, 0, SROM11_PHYCAL_TEMPDELTA, 0x0f00},
+ {"temps_hysteresis", 0xfffff800, 0, SROM11_PHYCAL_TEMPDELTA, 0xf000},
+ {"measpower1", 0xfffff800, SRFL_PRHEX, SROM11_MPWR_1_AND_2, 0x007f},
+ {"measpower2", 0xfffff800, SRFL_PRHEX, SROM11_MPWR_1_AND_2, 0x3f80},
+ {"pdoffset40ma0", 0xfffff800, 0, SROM11_PDOFF_40M_A0, 0xffff},
+ {"pdoffset40ma1", 0xfffff800, 0, SROM11_PDOFF_40M_A1, 0xffff},
+ {"pdoffset40ma2", 0xfffff800, 0, SROM11_PDOFF_40M_A2, 0xffff},
+ {"pdoffset80ma0", 0xfffff800, 0, SROM11_PDOFF_80M_A0, 0xffff},
+ {"pdoffset80ma1", 0xfffff800, 0, SROM11_PDOFF_80M_A1, 0xffff},
+ {"pdoffset80ma2", 0xfffff800, 0, SROM11_PDOFF_80M_A2, 0xffff},
+
+ {"subband5gver", 0xfffff800, SRFL_PRHEX, SROM11_SUBBAND5GVER, 0xffff},
+
+ /* power per rate */
+ {"cckbw202gpo", 0xfffff800, 0, SROM11_CCKBW202GPO, 0xffff},
+ {"cckbw20ul2gpo", 0xfffff800, 0, SROM11_CCKBW20UL2GPO, 0xffff},
+ {"mcsbw202gpo", 0xfffff800, SRFL_MORE, SROM11_MCSBW202GPO, 0xffff},
+ {"", 0xfffff800, 0, SROM11_MCSBW202GPO_1, 0xffff},
+ {"mcsbw402gpo", 0xfffff800, SRFL_MORE, SROM11_MCSBW402GPO, 0xffff},
+ {"", 0xfffff800, 0, SROM11_MCSBW402GPO_1, 0xffff},
+ {"dot11agofdmhrbw202gpo", 0xfffff800, 0, SROM11_DOT11AGOFDMHRBW202GPO, 0xffff},
+ {"ofdmlrbw202gpo", 0xfffff800, 0, SROM11_OFDMLRBW202GPO, 0xffff},
+ {"mcsbw205glpo", 0xfffff800, SRFL_MORE, SROM11_MCSBW205GLPO, 0xffff},
+ {"", 0xfffff800, 0, SROM11_MCSBW205GLPO_1, 0xffff},
+ {"mcsbw405glpo", 0xfffff800, SRFL_MORE, SROM11_MCSBW405GLPO, 0xffff},
+ {"", 0xfffff800, 0, SROM11_MCSBW405GLPO_1, 0xffff},
+ {"mcsbw805glpo", 0xfffff800, SRFL_MORE, SROM11_MCSBW805GLPO, 0xffff},
+ {"", 0xfffff800, 0, SROM11_MCSBW805GLPO_1, 0xffff},
+ {"mcsbw1605glpo", 0xfffff800, SRFL_MORE, SROM11_MCSBW1605GLPO, 0xffff},
+ {"", 0xfffff800, 0, SROM11_MCSBW1605GLPO_1, 0xffff},
+ {"mcsbw205gmpo", 0xfffff800, SRFL_MORE, SROM11_MCSBW205GMPO, 0xffff},
+ {"", 0xfffff800, 0, SROM11_MCSBW205GMPO_1, 0xffff},
+ {"mcsbw405gmpo", 0xfffff800, SRFL_MORE, SROM11_MCSBW405GMPO, 0xffff},
+ {"", 0xfffff800, 0, SROM11_MCSBW405GMPO_1, 0xffff},
+ {"mcsbw805gmpo", 0xfffff800, SRFL_MORE, SROM11_MCSBW805GMPO, 0xffff},
+ {"", 0xfffff800, 0, SROM11_MCSBW805GMPO_1, 0xffff},
+ {"mcsbw1605gmpo", 0xfffff800, SRFL_MORE, SROM11_MCSBW1605GMPO, 0xffff},
+ {"", 0xfffff800, 0, SROM11_MCSBW1605GMPO_1, 0xffff},
+ {"mcsbw205ghpo", 0xfffff800, SRFL_MORE, SROM11_MCSBW205GHPO, 0xffff},
+ {"", 0xfffff800, 0, SROM11_MCSBW205GHPO_1, 0xffff},
+ {"mcsbw405ghpo", 0xfffff800, SRFL_MORE, SROM11_MCSBW405GHPO, 0xffff},
+ {"", 0xfffff800, 0, SROM11_MCSBW405GHPO_1, 0xffff},
+ {"mcsbw805ghpo", 0xfffff800, SRFL_MORE, SROM11_MCSBW805GHPO, 0xffff},
+ {"", 0xfffff800, 0, SROM11_MCSBW805GHPO_1, 0xffff},
+ {"mcsbw1605ghpo", 0xfffff800, SRFL_MORE, SROM11_MCSBW1605GHPO, 0xffff},
+ {"", 0xfffff800, 0, SROM11_MCSBW1605GHPO_1, 0xffff},
+ {"mcslr5glpo", 0xfffff800, 0, SROM11_MCSLR5GLPO, 0xffff},
+ {"mcslr5gmpo", 0xfffff800, 0, SROM11_MCSLR5GMPO, 0xffff},
+ {"mcslr5ghpo", 0xfffff800, 0, SROM11_MCSLR5GHPO, 0xffff},
+ {"sb20in40hrrpo", 0xfffff800, 0, SROM11_SB20IN40HRPO, 0xffff},
+ {"sb20in80and160hr5glpo", 0xfffff800, 0, SROM11_SB20IN80AND160HR5GLPO, 0xffff},
+ {"sb40and80hr5glpo", 0xfffff800, 0, SROM11_SB40AND80HR5GLPO, 0xffff},
+ {"sb20in80and160hr5gmpo", 0xfffff800, 0, SROM11_SB20IN80AND160HR5GMPO, 0xffff},
+ {"sb40and80hr5gmpo", 0xfffff800, 0, SROM11_SB40AND80HR5GMPO, 0xffff},
+ {"sb20in80and160hr5ghpo", 0xfffff800, 0, SROM11_SB20IN80AND160HR5GHPO, 0xffff},
+ {"sb40and80hr5ghpo", 0xfffff800, 0, SROM11_SB40AND80HR5GHPO, 0xffff},
+ {"sb20in40lrpo", 0xfffff800, 0, SROM11_SB20IN40LRPO, 0xffff},
+ {"sb20in80and160lr5glpo", 0xfffff800, 0, SROM11_SB20IN80AND160LR5GLPO, 0xffff},
+ {"sb40and80lr5glpo", 0xfffff800, 0, SROM11_SB40AND80LR5GLPO, 0xffff},
+ {"sb20in80and160lr5gmpo", 0xfffff800, 0, SROM11_SB20IN80AND160LR5GMPO, 0xffff},
+ {"sb40and80lr5gmpo", 0xfffff800, 0, SROM11_SB40AND80LR5GMPO, 0xffff},
+ {"sb20in80and160lr5ghpo", 0xfffff800, 0, SROM11_SB20IN80AND160LR5GHPO, 0xffff},
+ {"sb40and80lr5ghpo", 0xfffff800, 0, SROM11_SB40AND80LR5GHPO, 0xffff},
+ {"dot11agduphrpo", 0xfffff800, 0, SROM11_DOT11AGDUPHRPO, 0xffff},
+ {"dot11agduplrpo", 0xfffff800, 0, SROM11_DOT11AGDUPLRPO, 0xffff},
+
+ /* Misc */
+ {"pcieingress_war", 0xfffff800, 0, SROM11_PCIEINGRESS_WAR, 0xf},
+ {"sar2g", 0xfffff800, 0, SROM11_SAR, 0x00ff},
+ {"sar5g", 0xfffff800, 0, SROM11_SAR, 0xff00},
+
+ {"noiselvl2ga0", 0xfffff800, 0, SROM11_NOISELVL_2G, 0x001f},
+ {"noiselvl2ga1", 0xfffff800, 0, SROM11_NOISELVL_2G, 0x03e0},
+ {"noiselvl2ga2", 0xfffff800, 0, SROM11_NOISELVL_2G, 0x7c00},
+ {"noiselvl5ga0", 0xfffff800, SRFL_ARRAY, SROM11_NOISELVL_5GL, 0x001f},
+ {"", 0xfffff800, SRFL_ARRAY, SROM11_NOISELVL_5GM, 0x001f},
+ {"", 0xfffff800, SRFL_ARRAY, SROM11_NOISELVL_5GH, 0x001f},
+ {"", 0xfffff800, 0, SROM11_NOISELVL_5GU, 0x001f},
+ {"noiselvl5ga1", 0xfffff800, SRFL_ARRAY, SROM11_NOISELVL_5GL, 0x03e0},
+ {"", 0xfffff800, SRFL_ARRAY, SROM11_NOISELVL_5GM, 0x03e0},
+ {"", 0xfffff800, SRFL_ARRAY, SROM11_NOISELVL_5GH, 0x03e0},
+ {"", 0xfffff800, 0, SROM11_NOISELVL_5GU, 0x03e0},
+ {"noiselvl5ga2", 0xfffff800, SRFL_ARRAY, SROM11_NOISELVL_5GL, 0x7c00},
+ {"", 0xfffff800, SRFL_ARRAY, SROM11_NOISELVL_5GM, 0x7c00},
+ {"", 0xfffff800, SRFL_ARRAY, SROM11_NOISELVL_5GH, 0x7c00},
+ {"", 0xfffff800, 0, SROM11_NOISELVL_5GU, 0x7c00},
+
+ {"rxgainerr2ga0", 0xfffff800, 0, SROM11_RXGAINERR_2G, 0x003f},
+ {"rxgainerr2ga1", 0xfffff800, 0, SROM11_RXGAINERR_2G, 0x07c0},
+ {"rxgainerr2ga2", 0xfffff800, 0, SROM11_RXGAINERR_2G, 0xf800},
+ {"rxgainerr5ga0", 0xfffff800, SRFL_ARRAY, SROM11_RXGAINERR_5GL, 0x003f},
+ {"", 0xfffff800, SRFL_ARRAY, SROM11_RXGAINERR_5GM, 0x003f},
+ {"", 0xfffff800, SRFL_ARRAY, SROM11_RXGAINERR_5GH, 0x003f},
+ {"", 0xfffff800, 0, SROM11_RXGAINERR_5GU, 0x003f},
+ {"rxgainerr5ga1", 0xfffff800, SRFL_ARRAY, SROM11_RXGAINERR_5GL, 0x07c0},
+ {"", 0xfffff800, SRFL_ARRAY, SROM11_RXGAINERR_5GM, 0x07c0},
+ {"", 0xfffff800, SRFL_ARRAY, SROM11_RXGAINERR_5GH, 0x07c0},
+ {"", 0xfffff800, 0, SROM11_RXGAINERR_5GU, 0x07c0},
+ {"rxgainerr5ga2", 0xfffff800, SRFL_ARRAY, SROM11_RXGAINERR_5GL, 0xf800},
+ {"", 0xfffff800, SRFL_ARRAY, SROM11_RXGAINERR_5GM, 0xf800},
+ {"", 0xfffff800, SRFL_ARRAY, SROM11_RXGAINERR_5GH, 0xf800},
+ {"", 0xfffff800, 0, SROM11_RXGAINERR_5GU, 0xf800},
+
+ {NULL, 0, 0, 0, 0}
+};
+
+static const sromvar_t perpath_pci_sromvars[] = {
+ {"maxp2ga", 0x000000f0, 0, SROM4_2G_ITT_MAXP, 0x00ff},
+ {"itt2ga", 0x000000f0, 0, SROM4_2G_ITT_MAXP, 0xff00},
+ {"itt5ga", 0x000000f0, 0, SROM4_5G_ITT_MAXP, 0xff00},
+ {"pa2gw0a", 0x000000f0, SRFL_PRHEX, SROM4_2G_PA, 0xffff},
+ {"pa2gw1a", 0x000000f0, SRFL_PRHEX, SROM4_2G_PA + 1, 0xffff},
+ {"pa2gw2a", 0x000000f0, SRFL_PRHEX, SROM4_2G_PA + 2, 0xffff},
+ {"pa2gw3a", 0x000000f0, SRFL_PRHEX, SROM4_2G_PA + 3, 0xffff},
+ {"maxp5ga", 0x000000f0, 0, SROM4_5G_ITT_MAXP, 0x00ff},
+ {"maxp5gha", 0x000000f0, 0, SROM4_5GLH_MAXP, 0x00ff},
+ {"maxp5gla", 0x000000f0, 0, SROM4_5GLH_MAXP, 0xff00},
+ {"pa5gw0a", 0x000000f0, SRFL_PRHEX, SROM4_5G_PA, 0xffff},
+ {"pa5gw1a", 0x000000f0, SRFL_PRHEX, SROM4_5G_PA + 1, 0xffff},
+ {"pa5gw2a", 0x000000f0, SRFL_PRHEX, SROM4_5G_PA + 2, 0xffff},
+ {"pa5gw3a", 0x000000f0, SRFL_PRHEX, SROM4_5G_PA + 3, 0xffff},
+ {"pa5glw0a", 0x000000f0, SRFL_PRHEX, SROM4_5GL_PA, 0xffff},
+ {"pa5glw1a", 0x000000f0, SRFL_PRHEX, SROM4_5GL_PA + 1, 0xffff},
+ {"pa5glw2a", 0x000000f0, SRFL_PRHEX, SROM4_5GL_PA + 2, 0xffff},
+ {"pa5glw3a", 0x000000f0, SRFL_PRHEX, SROM4_5GL_PA + 3, 0xffff},
+ {"pa5ghw0a", 0x000000f0, SRFL_PRHEX, SROM4_5GH_PA, 0xffff},
+ {"pa5ghw1a", 0x000000f0, SRFL_PRHEX, SROM4_5GH_PA + 1, 0xffff},
+ {"pa5ghw2a", 0x000000f0, SRFL_PRHEX, SROM4_5GH_PA + 2, 0xffff},
+ {"pa5ghw3a", 0x000000f0, SRFL_PRHEX, SROM4_5GH_PA + 3, 0xffff},
+ {"maxp2ga", 0x00000700, 0, SROM8_2G_ITT_MAXP, 0x00ff},
+ {"itt2ga", 0x00000700, 0, SROM8_2G_ITT_MAXP, 0xff00},
+ {"itt5ga", 0x00000700, 0, SROM8_5G_ITT_MAXP, 0xff00},
+ {"pa2gw0a", 0x00000700, SRFL_PRHEX, SROM8_2G_PA, 0xffff},
+ {"pa2gw1a", 0x00000700, SRFL_PRHEX, SROM8_2G_PA + 1, 0xffff},
+ {"pa2gw2a", 0x00000700, SRFL_PRHEX, SROM8_2G_PA + 2, 0xffff},
+ {"maxp5ga", 0x00000700, 0, SROM8_5G_ITT_MAXP, 0x00ff},
+ {"maxp5gha", 0x00000700, 0, SROM8_5GLH_MAXP, 0x00ff},
+ {"maxp5gla", 0x00000700, 0, SROM8_5GLH_MAXP, 0xff00},
+ {"pa5gw0a", 0x00000700, SRFL_PRHEX, SROM8_5G_PA, 0xffff},
+ {"pa5gw1a", 0x00000700, SRFL_PRHEX, SROM8_5G_PA + 1, 0xffff},
+ {"pa5gw2a", 0x00000700, SRFL_PRHEX, SROM8_5G_PA + 2, 0xffff},
+ {"pa5glw0a", 0x00000700, SRFL_PRHEX, SROM8_5GL_PA, 0xffff},
+ {"pa5glw1a", 0x00000700, SRFL_PRHEX, SROM8_5GL_PA + 1, 0xffff},
+ {"pa5glw2a", 0x00000700, SRFL_PRHEX, SROM8_5GL_PA + 2, 0xffff},
+ {"pa5ghw0a", 0x00000700, SRFL_PRHEX, SROM8_5GH_PA, 0xffff},
+ {"pa5ghw1a", 0x00000700, SRFL_PRHEX, SROM8_5GH_PA + 1, 0xffff},
+ {"pa5ghw2a", 0x00000700, SRFL_PRHEX, SROM8_5GH_PA + 2, 0xffff},
+
+ /* sromrev 11 */
+ {"maxp2ga", 0xfffff800, 0, SROM11_2G_MAXP, 0x00ff},
+ {"pa2ga", 0xfffff800, SRFL_PRHEX | SRFL_ARRAY, SROM11_2G_PA, 0xffff},
+ {"", 0xfffff800, SRFL_PRHEX | SRFL_ARRAY, SROM11_2G_PA + 1, 0xffff},
+ {"", 0xfffff800, SRFL_PRHEX, SROM11_2G_PA + 2, 0xffff},
+ {"rxgains5gmelnagaina", 0xfffff800, 0, SROM11_RXGAINS1, 0x0007},
+ {"rxgains5gmtrisoa", 0xfffff800, 0, SROM11_RXGAINS1, 0x0078},
+ {"rxgains5gmtrelnabypa", 0xfffff800, 0, SROM11_RXGAINS1, 0x0080},
+ {"rxgains5ghelnagaina", 0xfffff800, 0, SROM11_RXGAINS1, 0x0700},
+ {"rxgains5ghtrisoa", 0xfffff800, 0, SROM11_RXGAINS1, 0x7800},
+ {"rxgains5ghtrelnabypa", 0xfffff800, 0, SROM11_RXGAINS1, 0x8000},
+ {"rxgains2gelnagaina", 0xfffff800, 0, SROM11_RXGAINS, 0x0007},
+ {"rxgains2gtrisoa", 0xfffff800, 0, SROM11_RXGAINS, 0x0078},
+ {"rxgains2gtrelnabypa", 0xfffff800, 0, SROM11_RXGAINS, 0x0080},
+ {"rxgains5gelnagaina", 0xfffff800, 0, SROM11_RXGAINS, 0x0700},
+ {"rxgains5gtrisoa", 0xfffff800, 0, SROM11_RXGAINS, 0x7800},
+ {"rxgains5gtrelnabypa", 0xfffff800, 0, SROM11_RXGAINS, 0x8000},
+ {"maxp5ga", 0xfffff800, SRFL_ARRAY, SROM11_5GB1B0_MAXP, 0x00ff},
+ {"", 0xfffff800, SRFL_ARRAY, SROM11_5GB1B0_MAXP, 0xff00},
+ {"", 0xfffff800, SRFL_ARRAY, SROM11_5GB3B2_MAXP, 0x00ff},
+ {"", 0xfffff800, 0, SROM11_5GB3B2_MAXP, 0xff00},
+ {"pa5ga", 0xfffff800, SRFL_PRHEX | SRFL_ARRAY, SROM11_5GB0_PA, 0xffff},
+ {"", 0xfffff800, SRFL_PRHEX | SRFL_ARRAY, SROM11_5GB0_PA + 1, 0xffff},
+ {"", 0xfffff800, SRFL_PRHEX | SRFL_ARRAY, SROM11_5GB0_PA + 2, 0xffff},
+ {"", 0xfffff800, SRFL_PRHEX | SRFL_ARRAY, SROM11_5GB1_PA, 0xffff},
+ {"", 0xfffff800, SRFL_PRHEX | SRFL_ARRAY, SROM11_5GB1_PA + 1, 0xffff},
+ {"", 0xfffff800, SRFL_PRHEX | SRFL_ARRAY, SROM11_5GB1_PA + 2, 0xffff},
+ {"", 0xfffff800, SRFL_PRHEX | SRFL_ARRAY, SROM11_5GB2_PA, 0xffff},
+ {"", 0xfffff800, SRFL_PRHEX | SRFL_ARRAY, SROM11_5GB2_PA + 1, 0xffff},
+ {"", 0xfffff800, SRFL_PRHEX | SRFL_ARRAY, SROM11_5GB2_PA + 2, 0xffff},
+ {"", 0xfffff800, SRFL_PRHEX | SRFL_ARRAY, SROM11_5GB3_PA, 0xffff},
+ {"", 0xfffff800, SRFL_PRHEX | SRFL_ARRAY, SROM11_5GB3_PA + 1, 0xffff},
+ {"", 0xfffff800, SRFL_PRHEX, SROM11_5GB3_PA + 2, 0xffff},
+
+ {NULL, 0, 0, 0, 0}
+};
+
+#if !(defined(PHY_TYPE_HT) && defined(PHY_TYPE_N) && defined(PHY_TYPE_LP))
+#define PHY_TYPE_HT 7 /* HT-Phy value */
+#define PHY_TYPE_N 4 /* N-Phy value */
+#define PHY_TYPE_LP 5 /* LP-Phy value */
+#endif /* !(defined(PHY_TYPE_HT) && defined(PHY_TYPE_N) && defined(PHY_TYPE_LP)) */
+#if !defined(PHY_TYPE_AC)
+#define PHY_TYPE_AC 11 /* AC-Phy value */
+#endif /* !defined(PHY_TYPE_AC) */
+#if !defined(PHY_TYPE_NULL)
+#define PHY_TYPE_NULL 0xf /* Invalid Phy value */
+#endif /* !defined(PHY_TYPE_NULL) */
+
+typedef struct {
+ uint16 phy_type;
+ uint16 bandrange;
+ uint16 chain;
+ const char *vars;
+} pavars_t;
+
+static const pavars_t pavars[] = {
+ /* HTPHY */
+ {PHY_TYPE_HT, WL_CHAN_FREQ_RANGE_2G, 0, "pa2gw0a0 pa2gw1a0 pa2gw2a0"},
+ {PHY_TYPE_HT, WL_CHAN_FREQ_RANGE_2G, 1, "pa2gw0a1 pa2gw1a1 pa2gw2a1"},
+ {PHY_TYPE_HT, WL_CHAN_FREQ_RANGE_2G, 2, "pa2gw0a2 pa2gw1a2 pa2gw2a2"},
+ {PHY_TYPE_HT, WL_CHAN_FREQ_RANGE_5G_BAND0, 0, "pa5glw0a0 pa5glw1a0 pa5glw2a0"},
+ {PHY_TYPE_HT, WL_CHAN_FREQ_RANGE_5G_BAND0, 1, "pa5glw0a1 pa5glw1a1 pa5glw2a1"},
+ {PHY_TYPE_HT, WL_CHAN_FREQ_RANGE_5G_BAND0, 2, "pa5glw0a2 pa5glw1a2 pa5glw2a2"},
+ {PHY_TYPE_HT, WL_CHAN_FREQ_RANGE_5G_BAND1, 0, "pa5gw0a0 pa5gw1a0 pa5gw2a0"},
+ {PHY_TYPE_HT, WL_CHAN_FREQ_RANGE_5G_BAND1, 1, "pa5gw0a1 pa5gw1a1 pa5gw2a1"},
+ {PHY_TYPE_HT, WL_CHAN_FREQ_RANGE_5G_BAND1, 2, "pa5gw0a2 pa5gw1a2 pa5gw2a2"},
+ {PHY_TYPE_HT, WL_CHAN_FREQ_RANGE_5G_BAND2, 0, "pa5ghw0a0 pa5ghw1a0 pa5ghw2a0"},
+ {PHY_TYPE_HT, WL_CHAN_FREQ_RANGE_5G_BAND2, 1, "pa5ghw0a1 pa5ghw1a1 pa5ghw2a1"},
+ {PHY_TYPE_HT, WL_CHAN_FREQ_RANGE_5G_BAND2, 2, "pa5ghw0a2 pa5ghw1a2 pa5ghw2a2"},
+ {PHY_TYPE_HT, WL_CHAN_FREQ_RANGE_5G_BAND3, 0, "pa5gw0a3 pa5gw1a3 pa5gw2a3"},
+ {PHY_TYPE_HT, WL_CHAN_FREQ_RANGE_5G_BAND3, 1, "pa5glw0a3 pa5glw1a3 pa5glw2a3"},
+ {PHY_TYPE_HT, WL_CHAN_FREQ_RANGE_5G_BAND3, 2, "pa5ghw0a3 pa5ghw1a3 pa5ghw2a3"},
+ /* NPHY */
+ {PHY_TYPE_N, WL_CHAN_FREQ_RANGE_2G, 0, "pa2gw0a0 pa2gw1a0 pa2gw2a0"},
+ {PHY_TYPE_N, WL_CHAN_FREQ_RANGE_2G, 1, "pa2gw0a1 pa2gw1a1 pa2gw2a1"},
+ {PHY_TYPE_N, WL_CHAN_FREQ_RANGE_5G_BAND0, 0, "pa5glw0a0 pa5glw1a0 pa5glw2a0"},
+ {PHY_TYPE_N, WL_CHAN_FREQ_RANGE_5G_BAND0, 1, "pa5glw0a1 pa5glw1a1 pa5glw2a1"},
+ {PHY_TYPE_N, WL_CHAN_FREQ_RANGE_5G_BAND1, 0, "pa5gw0a0 pa5gw1a0 pa5gw2a0"},
+ {PHY_TYPE_N, WL_CHAN_FREQ_RANGE_5G_BAND1, 1, "pa5gw0a1 pa5gw1a1 pa5gw2a1"},
+ {PHY_TYPE_N, WL_CHAN_FREQ_RANGE_5G_BAND2, 0, "pa5ghw0a0 pa5ghw1a0 pa5ghw2a0"},
+ {PHY_TYPE_N, WL_CHAN_FREQ_RANGE_5G_BAND2, 1, "pa5ghw0a1 pa5ghw1a1 pa5ghw2a1"},
+ /* LPPHY */
+ {PHY_TYPE_LP, WL_CHAN_FREQ_RANGE_2G, 0, "pa0b0 pa0b1 pa0b2"},
+ {PHY_TYPE_LP, WL_CHAN_FREQ_RANGE_5GL, 0, "pa1lob0 pa1lob1 pa1lob2"},
+ {PHY_TYPE_LP, WL_CHAN_FREQ_RANGE_5GM, 0, "pa1b0 pa1b1 pa1b2"},
+ {PHY_TYPE_LP, WL_CHAN_FREQ_RANGE_5GH, 0, "pa1hib0 pa1hib1 pa1hib2"},
+ /* ACPHY */
+ {PHY_TYPE_AC, WL_CHAN_FREQ_RANGE_2G, 0, "pa2ga0"},
+ {PHY_TYPE_AC, WL_CHAN_FREQ_RANGE_2G, 1, "pa2ga1"},
+ {PHY_TYPE_AC, WL_CHAN_FREQ_RANGE_2G, 2, "pa2ga2"},
+ {PHY_TYPE_AC, WL_CHAN_FREQ_RANGE_5G_4BAND, 0, "pa5ga0"},
+ {PHY_TYPE_AC, WL_CHAN_FREQ_RANGE_5G_4BAND, 1, "pa5ga1"},
+ {PHY_TYPE_AC, WL_CHAN_FREQ_RANGE_5G_4BAND, 2, "pa5ga2"},
+ {PHY_TYPE_NULL, 0, 0, ""}
+};
+
+typedef struct {
+ uint16 phy_type;
+ uint16 bandrange;
+ const char *vars;
+} povars_t;
+
+static const povars_t povars[] = {
+ /* NPHY */
+ {PHY_TYPE_N, WL_CHAN_FREQ_RANGE_2G, "mcs2gpo0 mcs2gpo1 mcs2gpo2 mcs2gpo3 "
+ "mcs2gpo4 mcs2gpo5 mcs2gpo6 mcs2gpo7"},
+ {PHY_TYPE_N, WL_CHAN_FREQ_RANGE_5GL, "mcs5glpo0 mcs5glpo1 mcs5glpo2 mcs5glpo3 "
+ "mcs5glpo4 mcs5glpo5 mcs5glpo6 mcs5glpo7"},
+ {PHY_TYPE_N, WL_CHAN_FREQ_RANGE_5GM, "mcs5gpo0 mcs5gpo1 mcs5gpo2 mcs5gpo3 "
+ "mcs5gpo4 mcs5gpo5 mcs5gpo6 mcs5gpo7"},
+ {PHY_TYPE_N, WL_CHAN_FREQ_RANGE_5GH, "mcs5ghpo0 mcs5ghpo1 mcs5ghpo2 mcs5ghpo3 "
+ "mcs5ghpo4 mcs5ghpo5 mcs5ghpo6 mcs5ghpo7"},
+ {PHY_TYPE_NULL, 0, ""}
+};
+
+typedef struct {
+ uint8 tag; /* Broadcom subtag name */
+ uint32 revmask; /* Supported cis_sromrev */
+ uint8 len; /* Length field of the tuple, note that it includes the
+ * subtag name (1 byte): 1 + tuple content length
+ */
+ const char *params;
+} cis_tuple_t;
+
+#define OTP_RAW (0xff - 1) /* Reserved tuple number for wrvar Raw input */
+#define OTP_VERS_1 (0xff - 2) /* CISTPL_VERS_1 */
+#define OTP_MANFID (0xff - 3) /* CISTPL_MANFID */
+#define OTP_RAW1 (0xff - 4) /* Like RAW, but comes first */
+
+static const cis_tuple_t cis_hnbuvars[] = {
+ {OTP_RAW1, 0xffffffff, 0, ""}, /* special case */
+ {OTP_VERS_1, 0xffffffff, 0, "smanf sproductname"}, /* special case (non BRCM tuple) */
+ {OTP_MANFID, 0xffffffff, 4, "2manfid 2prodid"}, /* special case (non BRCM tuple) */
+ /* Unified OTP: tupple to embed USB manfid inside SDIO CIS */
+ {HNBU_UMANFID, 0xffffffff, 8, "8usbmanfid"},
+ {HNBU_SROMREV, 0xffffffff, 2, "1sromrev"},
+ /* NOTE: subdevid is also written to boardtype.
+ * Need to write HNBU_BOARDTYPE to change it if it is different.
+ */
+ {HNBU_CHIPID, 0xffffffff, 11, "2vendid 2devid 2chiprev 2subvendid 2subdevid"},
+ {HNBU_BOARDREV, 0xffffffff, 3, "2boardrev"},
+ {HNBU_PAPARMS, 0xffffffff, 10, "2pa0b0 2pa0b1 2pa0b2 1pa0itssit 1pa0maxpwr 1opo"},
+ {HNBU_AA, 0xffffffff, 3, "1aa2g 1aa5g"},
+ {HNBU_AA, 0xffffffff, 3, "1aa0 1aa1"}, /* backward compatibility */
+ {HNBU_AG, 0xffffffff, 5, "1ag0 1ag1 1ag2 1ag3"},
+ {HNBU_BOARDFLAGS, 0xffffffff, 13, "4boardflags 4boardflags2 4boardflags3"},
+ {HNBU_LEDS, 0xffffffff, 5, "1ledbh0 1ledbh1 1ledbh2 1ledbh3"},
+ {HNBU_CCODE, 0xffffffff, 4, "2ccode 1cctl"},
+ {HNBU_CCKPO, 0xffffffff, 3, "2cckpo"},
+ {HNBU_OFDMPO, 0xffffffff, 5, "4ofdmpo"},
+ {HNBU_PAPARMS5G, 0xffffffff, 23, "2pa1b0 2pa1b1 2pa1b2 2pa1lob0 2pa1lob1 2pa1lob2 "
+ "2pa1hib0 2pa1hib1 2pa1hib2 1pa1itssit "
+ "1pa1maxpwr 1pa1lomaxpwr 1pa1himaxpwr"},
+ {HNBU_RDLID, 0xffffffff, 3, "2rdlid"},
+ {HNBU_RSSISMBXA2G, 0xffffffff, 3, "0rssismf2g 0rssismc2g "
+ "0rssisav2g 0bxa2g"}, /* special case */
+ {HNBU_RSSISMBXA5G, 0xffffffff, 3, "0rssismf5g 0rssismc5g "
+ "0rssisav5g 0bxa5g"}, /* special case */
+ {HNBU_XTALFREQ, 0xffffffff, 5, "4xtalfreq"},
+ {HNBU_TRI2G, 0xffffffff, 2, "1tri2g"},
+ {HNBU_TRI5G, 0xffffffff, 4, "1tri5gl 1tri5g 1tri5gh"},
+ {HNBU_RXPO2G, 0xffffffff, 2, "1rxpo2g"},
+ {HNBU_RXPO5G, 0xffffffff, 2, "1rxpo5g"},
+ {HNBU_BOARDNUM, 0xffffffff, 3, "2boardnum"},
+ {HNBU_MACADDR, 0xffffffff, 7, "6macaddr"}, /* special case */
+ {HNBU_RDLSN, 0xffffffff, 3, "2rdlsn"},
+ {HNBU_BOARDTYPE, 0xffffffff, 3, "2boardtype"},
+ {HNBU_LEDDC, 0xffffffff, 3, "2leddc"},
+ {HNBU_RDLRNDIS, 0xffffffff, 2, "1rdlndis"},
+ {HNBU_CHAINSWITCH, 0xffffffff, 5, "1txchain 1rxchain 2antswitch"},
+ {HNBU_REGREV, 0xffffffff, 2, "1regrev"},
+ {HNBU_FEM, 0x000007fe, 5, "0antswctl2g 0triso2g 0pdetrange2g 0extpagain2g "
+ "0tssipos2g 0antswctl5g 0triso5g 0pdetrange5g 0extpagain5g 0tssipos5g"}, /* special case */
+ {HNBU_PAPARMS_C0, 0x000007fe, 31, "1maxp2ga0 1itt2ga0 2pa2gw0a0 2pa2gw1a0 "
+ "2pa2gw2a0 1maxp5ga0 1itt5ga0 1maxp5gha0 1maxp5gla0 2pa5gw0a0 2pa5gw1a0 2pa5gw2a0 "
+ "2pa5glw0a0 2pa5glw1a0 2pa5glw2a0 2pa5ghw0a0 2pa5ghw1a0 2pa5ghw2a0"},
+ {HNBU_PAPARMS_C1, 0x000007fe, 31, "1maxp2ga1 1itt2ga1 2pa2gw0a1 2pa2gw1a1 "
+ "2pa2gw2a1 1maxp5ga1 1itt5ga1 1maxp5gha1 1maxp5gla1 2pa5gw0a1 2pa5gw1a1 2pa5gw2a1 "
+ "2pa5glw0a1 2pa5glw1a1 2pa5glw2a1 2pa5ghw0a1 2pa5ghw1a1 2pa5ghw2a1"},
+ {HNBU_PO_CCKOFDM, 0xffffffff, 19, "2cck2gpo 4ofdm2gpo 4ofdm5gpo 4ofdm5glpo "
+ "4ofdm5ghpo"},
+ {HNBU_PO_MCS2G, 0xffffffff, 17, "2mcs2gpo0 2mcs2gpo1 2mcs2gpo2 2mcs2gpo3 "
+ "2mcs2gpo4 2mcs2gpo5 2mcs2gpo6 2mcs2gpo7"},
+ {HNBU_PO_MCS5GM, 0xffffffff, 17, "2mcs5gpo0 2mcs5gpo1 2mcs5gpo2 2mcs5gpo3 "
+ "2mcs5gpo4 2mcs5gpo5 2mcs5gpo6 2mcs5gpo7"},
+ {HNBU_PO_MCS5GLH, 0xffffffff, 33, "2mcs5glpo0 2mcs5glpo1 2mcs5glpo2 2mcs5glpo3 "
+ "2mcs5glpo4 2mcs5glpo5 2mcs5glpo6 2mcs5glpo7 "
+ "2mcs5ghpo0 2mcs5ghpo1 2mcs5ghpo2 2mcs5ghpo3 "
+ "2mcs5ghpo4 2mcs5ghpo5 2mcs5ghpo6 2mcs5ghpo7"},
+ {HNBU_CCKFILTTYPE, 0xffffffff, 2, "1cckdigfilttype"},
+ {HNBU_PO_CDD, 0xffffffff, 3, "2cddpo"},
+ {HNBU_PO_STBC, 0xffffffff, 3, "2stbcpo"},
+ {HNBU_PO_40M, 0xffffffff, 3, "2bw40po"},
+ {HNBU_PO_40MDUP, 0xffffffff, 3, "2bwduppo"},
+ {HNBU_RDLRWU, 0xffffffff, 2, "1rdlrwu"},
+ {HNBU_WPS, 0xffffffff, 3, "1wpsgpio 1wpsled"},
+ {HNBU_USBFS, 0xffffffff, 2, "1usbfs"},
+ {HNBU_ELNA2G, 0xffffffff, 2, "1elna2g"},
+ {HNBU_ELNA5G, 0xffffffff, 2, "1elna5g"},
+ {HNBU_CUSTOM1, 0xffffffff, 5, "4customvar1"},
+ {OTP_RAW, 0xffffffff, 0, ""}, /* special case */
+ {HNBU_OFDMPO5G, 0xffffffff, 13, "4ofdm5gpo 4ofdm5glpo 4ofdm5ghpo"},
+ {HNBU_USBEPNUM, 0xffffffff, 3, "2usbepnum"},
+ {HNBU_CCKBW202GPO, 0xffffffff, 5, "2cckbw202gpo 2cckbw20ul2gpo"},
+ {HNBU_LEGOFDMBW202GPO, 0xffffffff, 9, "4legofdmbw202gpo 4legofdmbw20ul2gp"},
+ {HNBU_LEGOFDMBW205GPO, 0xffffffff, 25, "4legofdmbw205glpo 4legofdmbw20ul5glpo "
+ "4legofdmbw205gmpo 4legofdmbw20ul5gmpo 4legofdmbw205ghpo 4legofdmbw20ul5ghpo"},
+ {HNBU_MCS2GPO, 0xffffffff, 13, "4mcsbw202gpo 4mcsbw20ul2gpo 4mcsbw402gpo"},
+ {HNBU_MCS5GLPO, 0xffffffff, 13, "4mcsbw205glpo 4mcsbw20ul5glpo 4mcsbw405glpo"},
+ {HNBU_MCS5GMPO, 0xffffffff, 13, "4mcsbw205gmpo 4mcsbw20ul5gmpo 4mcsbw405gmpo"},
+ {HNBU_MCS5GHPO, 0xffffffff, 13, "4mcsbw205ghpo 4mcsbw20ul5ghpo 4mcsbw405ghpo"},
+ {HNBU_MCS32PO, 0xffffffff, 3, "2mcs32po"},
+ {HNBU_LEG40DUPPO, 0xffffffff, 3, "2legofdm40duppo"},
+ {HNBU_TEMPTHRESH, 0xffffffff, 7, "1tempthresh 0temps_period 0temps_hysteresis "
+ "1tempoffset 1tempsense_slope 0tempcorrx 0tempsense_option "
+ "1phycal_tempdelta"}, /* special case */
+ {HNBU_MUXENAB, 0xffffffff, 2, "1muxenab"},
+ {HNBU_FEM_CFG, 0xfffff800, 5, "0femctrl 0papdcap2g 0tworangetssi2g 0pdgain2g "
+ "0epagain2g 0tssiposslope2g 0gainctrlsph 0papdcap5g 0tworangetssi5g 0pdgain5g 0epagain5g "
+ "0tssiposslope5g"}, /* special case */
+ {HNBU_ACPA_C0, 0xfffff800, 39, "2subband5gver 2maxp2ga0 2*3pa2ga0 "
+ "1*4maxp5ga0 2*12pa5ga0"},
+ {HNBU_ACPA_C1, 0xfffff800, 37, "2maxp2ga1 2*3pa2ga1 1*4maxp5ga1 2*12pa5ga1"},
+ {HNBU_ACPA_C2, 0xfffff800, 37, "2maxp2ga2 2*3pa2ga2 1*4maxp5ga2 2*12pa5ga2"},
+ {HNBU_MEAS_PWR, 0xfffff800, 5, "1measpower 1measpower1 1measpower2 2rawtempsense"},
+ {HNBU_PDOFF, 0xfffff800, 13, "2pdoffset40ma0 2pdoffset40ma1 2pdoffset40ma2 "
+ "2pdoffset80ma0 2pdoffset80ma1 2pdoffset80ma2"},
+ {HNBU_ACPPR_2GPO, 0xfffff800, 5, "2dot11agofdmhrbw202gpo 2ofdmlrbw202gpo"},
+ {HNBU_ACPPR_5GPO, 0xfffff800, 31, "4mcsbw805glpo 4mcsbw1605glpo 4mcsbw805gmpo "
+ "4mcsbw1605gmpo 4mcsbw805ghpo 4mcsbw1605ghpo 2mcslr5rlpo 2mcslr5gmpo 2mcslr5ghpo"},
+ {HNBU_ACPPR_SBPO, 0xfffff800, 33, "2sb20in40hrrpo 2sb20in80and160hr5glpo "
+ "2sb40and80hr5glpo 2sb20in80and160hr5gmpo 2sb40and80hr5gmpo 2sb20in80and160hr5ghpo "
+ "2sb40and80hr5ghpo 2sb20in40lrpo 2sb20in80and160lr5glpo 2sb40and80lr5glpo "
+ "2sb20in80and160lr5gmpo 2sb40and80lr5gmpo 2sb20in80and160lr5ghpo 2sb40and80lr5ghpo "
+ "2dot11agduphrpo 2dot11agduplrpo"},
+ {HNBU_NOISELVL, 0xfffff800, 16, "1noiselvl2ga0 1noiselvl2ga1 1noiselvl2ga2 "
+ "1*4noiselvl5ga0 1*4noiselvl5ga1 1*4noiselvl5ga2"},
+ {HNBU_RXGAIN_ERR, 0xfffff800, 16, "1rxgainerr2ga0 1rxgainerr2ga1 1rxgainerr2ga2 "
+ "1*4rxgainerr5ga0 1*4rxgainerr5ga1 1*4rxgainerr5ga2"},
+ {HNBU_AGBGA, 0xfffff800, 7, "1agbg0 1agbg1 1agbg2 1aga0 1aga1 1aga2"},
+ {HNBU_UUID, 0xffffffff, 17, "16uuid"},
+ {HNBU_WOWLGPIO, 0xffffffff, 2, "1wowl_gpio"},
+ {HNBU_ACRXGAINS_C0, 0xfffff800, 5, "0rxgains5gtrelnabypa0 0rxgains5gtrisoa0 "
+ "0rxgains5gelnagaina0 0rxgains2gtrelnabypa0 0rxgains2gtrisoa0 0rxgains2gelnagaina0 "
+ "0rxgains5ghtrelnabypa0 0rxgains5ghtrisoa0 0rxgains5ghelnagaina0 0rxgains5gmtrelnabypa0 "
+ "0rxgains5gmtrisoa0 0rxgains5gmelnagaina0"}, /* special case */
+ {HNBU_ACRXGAINS_C1, 0xfffff800, 5, "0rxgains5gtrelnabypa1 0rxgains5gtrisoa1 "
+ "0rxgains5gelnagaina1 0rxgains2gtrelnabypa1 0rxgains2gtrisoa1 0rxgains2gelnagaina1 "
+ "0rxgains5ghtrelnabypa1 0rxgains5ghtrisoa1 0rxgains5ghelnagaina1 0rxgains5gmtrelnabypa1 "
+ "0rxgains5gmtrisoa1 0rxgains5gmelnagaina1"}, /* special case */
+ {HNBU_ACRXGAINS_C2, 0xfffff800, 5, "0rxgains5gtrelnabypa2 0rxgains5gtrisoa2 "
+ "0rxgains5gelnagaina2 0rxgains2gtrelnabypa2 0rxgains2gtrisoa2 0rxgains2gelnagaina2 "
+ "0rxgains5ghtrelnabypa2 0rxgains5ghtrisoa2 0rxgains5ghelnagaina2 0rxgains5gmtrelnabypa2 "
+ "0rxgains5gmtrisoa2 0rxgains5gmelnagaina2"}, /* special case */
+ {0xFF, 0xffffffff, 0, ""}
+};
+
+#endif /* _bcmsrom_tbl_h_ */
diff --git a/drivers/net/wireless/bcmdhd/src/include/bcmutils.h b/drivers/net/wireless/bcmdhd/include/bcmutils.h
index f1f7426..b735090 100644
--- a/drivers/net/wireless/bcmdhd/src/include/bcmutils.h
+++ b/drivers/net/wireless/bcmdhd/include/bcmutils.h
@@ -1,14 +1,14 @@
/*
* Misc useful os-independent macros and functions.
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,12 +16,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: bcmutils.h 301796 2011-12-08 20:57:02Z $
+ * $Id: bcmutils.h 354184 2012-08-30 08:08:08Z $
*/
#ifndef _bcmutils_h_
@@ -40,14 +40,14 @@ extern "C" {
#endif
-#define _BCM_U 0x01
-#define _BCM_L 0x02
-#define _BCM_D 0x04
-#define _BCM_C 0x08
-#define _BCM_P 0x10
-#define _BCM_S 0x20
-#define _BCM_X 0x40
-#define _BCM_SP 0x80
+#define _BCM_U 0x01
+#define _BCM_L 0x02
+#define _BCM_D 0x04
+#define _BCM_C 0x08
+#define _BCM_P 0x10
+#define _BCM_S 0x20
+#define _BCM_X 0x40
+#define _BCM_SP 0x80
extern const unsigned char bcm_ctype[];
#define bcm_ismask(x) (bcm_ctype[(int)(unsigned char)(x)])
@@ -69,17 +69,17 @@ extern const unsigned char bcm_ctype[];
struct bcmstrbuf {
- char *buf;
- unsigned int size;
- char *origbuf;
- unsigned int origsize;
+ char *buf;
+ unsigned int size;
+ char *origbuf;
+ unsigned int origsize;
};
#ifdef BCMDRIVER
#include <osl.h>
-#define GPIO_PIN_NOTDEFINED 0x20
+#define GPIO_PIN_NOTDEFINED 0x20
#define SPINWAIT(exp, us) { \
@@ -92,59 +92,59 @@ struct bcmstrbuf {
#ifndef PKTQ_LEN_DEFAULT
-#define PKTQ_LEN_DEFAULT 128
+#define PKTQ_LEN_DEFAULT 128
#endif
#ifndef PKTQ_MAX_PREC
-#define PKTQ_MAX_PREC 16
+#define PKTQ_MAX_PREC 16
#endif
typedef struct pktq_prec {
- void *head;
- void *tail;
- uint16 len;
- uint16 max;
+ void *head;
+ void *tail;
+ uint16 len;
+ uint16 max;
} pktq_prec_t;
#ifdef PKTQ_LOG
typedef struct {
- uint32 requested;
- uint32 stored;
- uint32 saved;
- uint32 selfsaved;
- uint32 full_dropped;
- uint32 dropped;
- uint32 sacrificed;
- uint32 busy;
- uint32 retry;
- uint32 ps_retry;
- uint32 retry_drop;
- uint32 max_avail;
- uint32 max_used;
- uint32 queue_capacity;
+ uint32 requested;
+ uint32 stored;
+ uint32 saved;
+ uint32 selfsaved;
+ uint32 full_dropped;
+ uint32 dropped;
+ uint32 sacrificed;
+ uint32 busy;
+ uint32 retry;
+ uint32 ps_retry;
+ uint32 retry_drop;
+ uint32 max_avail;
+ uint32 max_used;
+ uint32 queue_capacity;
} pktq_counters_t;
-#endif
+#endif
#define PKTQ_COMMON \
- uint16 num_prec; \
- uint16 hi_prec; \
- uint16 max; \
- uint16 len;
+ uint16 num_prec; \
+ uint16 hi_prec; \
+ uint16 max; \
+ uint16 len;
struct pktq {
PKTQ_COMMON
-
+
struct pktq_prec q[PKTQ_MAX_PREC];
#ifdef PKTQ_LOG
- pktq_counters_t _prec_cnt[PKTQ_MAX_PREC];
+ pktq_counters_t _prec_cnt[PKTQ_MAX_PREC];
#endif
};
struct spktq {
PKTQ_COMMON
-
+
struct pktq_prec q[1];
};
@@ -159,15 +159,15 @@ typedef bool (*ifpkt_cb_t)(void*, int);
#define SHARED_POOL (pktpool_shared_ptr)
#else
#define SHARED_POOL (pktpool_shared)
-#endif
-#else
+#endif
+#else
#define POOL_ENAB(bus) 0
#define SHARED_POOL ((struct pktpool *)NULL)
-#endif
+#endif
#ifndef PKTPOOL_LEN_MAX
#define PKTPOOL_LEN_MAX 40
-#endif
+#endif
#define PKTPOOL_CB_MAX 3
struct pktpool;
@@ -195,15 +195,15 @@ typedef struct {
} pktpool_dbg_t;
typedef struct {
- uint8 txdh;
- uint8 txd11;
- uint8 enq;
- uint8 rxdh;
- uint8 rxd11;
- uint8 rxfill;
- uint8 idle;
+ uint8 txdh;
+ uint8 txd11;
+ uint8 enq;
+ uint8 rxdh;
+ uint8 rxd11;
+ uint8 rxfill;
+ uint8 idle;
} pktpool_stats_t;
-#endif
+#endif
typedef struct pktpool {
bool inited;
@@ -235,7 +235,7 @@ typedef struct pktpool {
extern pktpool_t *pktpool_shared_ptr;
#else
extern pktpool_t *pktpool_shared;
-#endif
+#endif
extern int pktpool_init(osl_t *osh, pktpool_t *pktp, int *pktplen, int plen, bool istx);
extern int pktpool_deinit(osl_t *osh, pktpool_t *pktp);
@@ -264,7 +264,7 @@ extern int pktpool_start_trigger(pktpool_t *pktp, void *p);
extern int pktpool_dbg_dump(pktpool_t *pktp);
extern int pktpool_dbg_notify(pktpool_t *pktp);
extern int pktpool_stats_dump(pktpool_t *pktp, pktpool_stats_t *stats);
-#endif
+#endif
@@ -338,10 +338,10 @@ extern uint pktsegcnt_war(osl_t *osh, void *p);
extern uint8 *pktoffset(osl_t *osh, void *p, uint offset);
-#define PKTPRIO_VDSCP 0x100
-#define PKTPRIO_VLAN 0x200
-#define PKTPRIO_UPD 0x400
-#define PKTPRIO_DSCP 0x800
+#define PKTPRIO_VDSCP 0x100
+#define PKTPRIO_VLAN 0x200
+#define PKTPRIO_UPD 0x400
+#define PKTPRIO_DSCP 0x800
extern uint pktsetprio(void *pkt, bool update_vtag);
@@ -393,18 +393,18 @@ extern int bcm_nvram_cache(void *sih);
typedef struct bcm_iovar {
- const char *name;
- uint16 varid;
- uint16 flags;
- uint16 type;
- uint16 minlen;
+ const char *name;
+ uint16 varid;
+ uint16 flags;
+ uint16 type;
+ uint16 minlen;
} bcm_iovar_t;
-#define IOV_GET 0
-#define IOV_SET 1
+#define IOV_GET 0
+#define IOV_SET 1
#define IOV_GVAL(id) ((id) * 2)
@@ -419,19 +419,19 @@ extern int bcm_iovar_lencheck(const bcm_iovar_t *table, void *arg, int len, bool
#if defined(WLTINYDUMP) || defined(WLMSG_INFORM) || defined(WLMSG_ASSOC) || \
defined(WLMSG_PRPKT) || defined(WLMSG_WSEC)
extern int bcm_format_ssid(char* buf, const uchar ssid[], uint ssid_len);
-#endif
-#endif
-
-
-#define IOVT_VOID 0
-#define IOVT_BOOL 1
-#define IOVT_INT8 2
-#define IOVT_UINT8 3
-#define IOVT_INT16 4
-#define IOVT_UINT16 5
-#define IOVT_INT32 6
-#define IOVT_UINT32 7
-#define IOVT_BUFFER 8
+#endif
+#endif
+
+
+#define IOVT_VOID 0
+#define IOVT_BOOL 1
+#define IOVT_INT8 2
+#define IOVT_UINT8 3
+#define IOVT_INT16 4
+#define IOVT_UINT16 5
+#define IOVT_INT32 6
+#define IOVT_UINT32 7
+#define IOVT_BUFFER 8
#define BCM_IOVT_VALID(type) (((unsigned int)(type)) <= IOVT_BUFFER)
@@ -458,55 +458,55 @@ extern int bcm_format_ssid(char* buf, const uchar ssid[], uint ssid_len);
-#define BCME_STRLEN 64
+#define BCME_STRLEN 64
#define VALID_BCMERROR(e) ((e <= 0) && (e >= BCME_LAST))
-#define BCME_OK 0
-#define BCME_ERROR -1
-#define BCME_BADARG -2
-#define BCME_BADOPTION -3
-#define BCME_NOTUP -4
-#define BCME_NOTDOWN -5
-#define BCME_NOTAP -6
-#define BCME_NOTSTA -7
-#define BCME_BADKEYIDX -8
-#define BCME_RADIOOFF -9
-#define BCME_NOTBANDLOCKED -10
-#define BCME_NOCLK -11
-#define BCME_BADRATESET -12
-#define BCME_BADBAND -13
-#define BCME_BUFTOOSHORT -14
-#define BCME_BUFTOOLONG -15
-#define BCME_BUSY -16
-#define BCME_NOTASSOCIATED -17
-#define BCME_BADSSIDLEN -18
-#define BCME_OUTOFRANGECHAN -19
-#define BCME_BADCHAN -20
-#define BCME_BADADDR -21
-#define BCME_NORESOURCE -22
-#define BCME_UNSUPPORTED -23
-#define BCME_BADLEN -24
-#define BCME_NOTREADY -25
-#define BCME_EPERM -26
-#define BCME_NOMEM -27
-#define BCME_ASSOCIATED -28
-#define BCME_RANGE -29
-#define BCME_NOTFOUND -30
-#define BCME_WME_NOT_ENABLED -31
-#define BCME_TSPEC_NOTFOUND -32
-#define BCME_ACM_NOTSUPPORTED -33
-#define BCME_NOT_WME_ASSOCIATION -34
-#define BCME_SDIO_ERROR -35
-#define BCME_DONGLE_DOWN -36
-#define BCME_VERSION -37
-#define BCME_TXFAIL -38
-#define BCME_RXFAIL -39
-#define BCME_NODEVICE -40
-#define BCME_NMODE_DISABLED -41
-#define BCME_NONRESIDENT -42
+#define BCME_OK 0
+#define BCME_ERROR -1
+#define BCME_BADARG -2
+#define BCME_BADOPTION -3
+#define BCME_NOTUP -4
+#define BCME_NOTDOWN -5
+#define BCME_NOTAP -6
+#define BCME_NOTSTA -7
+#define BCME_BADKEYIDX -8
+#define BCME_RADIOOFF -9
+#define BCME_NOTBANDLOCKED -10
+#define BCME_NOCLK -11
+#define BCME_BADRATESET -12
+#define BCME_BADBAND -13
+#define BCME_BUFTOOSHORT -14
+#define BCME_BUFTOOLONG -15
+#define BCME_BUSY -16
+#define BCME_NOTASSOCIATED -17
+#define BCME_BADSSIDLEN -18
+#define BCME_OUTOFRANGECHAN -19
+#define BCME_BADCHAN -20
+#define BCME_BADADDR -21
+#define BCME_NORESOURCE -22
+#define BCME_UNSUPPORTED -23
+#define BCME_BADLEN -24
+#define BCME_NOTREADY -25
+#define BCME_EPERM -26
+#define BCME_NOMEM -27
+#define BCME_ASSOCIATED -28
+#define BCME_RANGE -29
+#define BCME_NOTFOUND -30
+#define BCME_WME_NOT_ENABLED -31
+#define BCME_TSPEC_NOTFOUND -32
+#define BCME_ACM_NOTSUPPORTED -33
+#define BCME_NOT_WME_ASSOCIATION -34
+#define BCME_SDIO_ERROR -35
+#define BCME_DONGLE_DOWN -36
+#define BCME_VERSION -37
+#define BCME_TXFAIL -38
+#define BCME_RXFAIL -39
+#define BCME_NODEVICE -40
+#define BCME_NMODE_DISABLED -41
+#define BCME_NONRESIDENT -42
#define BCME_LAST BCME_NONRESIDENT
@@ -558,15 +558,15 @@ extern int bcm_format_ssid(char* buf, const uchar ssid[], uint ssid_len);
#ifndef ABS
#define ABS(a) (((a) < 0) ? -(a) : (a))
-#endif
+#endif
#ifndef MIN
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
-#endif
+#endif
#ifndef MAX
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
-#endif
+#endif
#define CEIL(x, y) (((x) + ((y) - 1)) / (y))
#define ROUNDUP(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
@@ -585,8 +585,8 @@ extern int bcm_format_ssid(char* buf, const uchar ssid[], uint ssid_len);
#define OFFSETOF(type, member) offsetof(type, member)
#else
#define OFFSETOF(type, member) ((uint)(uintptr)&((type *)0)->member)
-#endif
-#endif
+#endif
+#endif
#ifndef ARRAYSIZE
#define ARRAYSIZE(a) (sizeof(a) / sizeof(a[0]))
@@ -598,14 +598,14 @@ extern void *_bcmutils_dummy_fn;
#ifndef setbit
-#ifndef NBBY
-#define NBBY 8
-#endif
+#ifndef NBBY
+#define NBBY 8
+#endif
#define setbit(a, i) (((uint8 *)a)[(i) / NBBY] |= 1 << ((i) % NBBY))
#define clrbit(a, i) (((uint8 *)a)[(i) / NBBY] &= ~(1 << ((i) % NBBY)))
#define isset(a, i) (((const uint8 *)a)[(i) / NBBY] & (1 << ((i) % NBBY)))
#define isclr(a, i) ((((const uint8 *)a)[(i) / NBBY] & (1 << ((i) % NBBY))) == 0)
-#endif
+#endif
#define NBITS(type) (sizeof(type) * 8)
#define NBITVAL(nbits) (1 << (nbits))
@@ -635,12 +635,35 @@ extern void *_bcmutils_dummy_fn;
#define MODSUB_POW2(x, y, bound) (((x) - (y)) & ((bound) - 1))
-#define CRC8_INIT_VALUE 0xff
-#define CRC8_GOOD_VALUE 0x9f
-#define CRC16_INIT_VALUE 0xffff
-#define CRC16_GOOD_VALUE 0xf0b8
-#define CRC32_INIT_VALUE 0xffffffff
-#define CRC32_GOOD_VALUE 0xdebb20e3
+#define CRC8_INIT_VALUE 0xff
+#define CRC8_GOOD_VALUE 0x9f
+#define CRC16_INIT_VALUE 0xffff
+#define CRC16_GOOD_VALUE 0xf0b8
+#define CRC32_INIT_VALUE 0xffffffff
+#define CRC32_GOOD_VALUE 0xdebb20e3
+
+
+#define MACF "%02x:%02x:%02x:%02x:%02x:%02x"
+#define ETHERP_TO_MACF(ea) ((struct ether_addr *) (ea))->octet[0], \
+ ((struct ether_addr *) (ea))->octet[1], \
+ ((struct ether_addr *) (ea))->octet[2], \
+ ((struct ether_addr *) (ea))->octet[3], \
+ ((struct ether_addr *) (ea))->octet[4], \
+ ((struct ether_addr *) (ea))->octet[5]
+
+#define ETHER_TO_MACF(ea) (ea).octet[0], \
+ (ea).octet[1], \
+ (ea).octet[2], \
+ (ea).octet[3], \
+ (ea).octet[4], \
+ (ea).octet[5]
+#if !defined(SIMPLE_MAC_PRINT)
+#define MACDBG "%02x:%02x:%02x:%02x:%02x:%02x"
+#define STR_TO_MACD(ea) (ea)[0], (ea)[1], (ea)[2], (ea)[3], (ea)[4], (ea)[5]
+#else
+#define MACDBG "%02x:%02x:%02x"
+#define STR_TO_MACD(ea) (ea)[0], (ea)[4], (ea)[5]
+#endif
typedef struct bcm_bit_desc {
@@ -659,7 +682,7 @@ typedef struct bcm_tlv {
#define bcm_valid_tlv(elt, buflen) ((buflen) >= 2 && (int)(buflen) >= (int)(2 + (elt)->len))
-#define ETHER_ADDR_STR_LEN 18
+#define ETHER_ADDR_STR_LEN 18
@@ -671,14 +694,14 @@ xor_128bit_block(const uint8 *src1, const uint8 *src2, uint8 *dst)
1 ||
#endif
(((uintptr)src1 | (uintptr)src2 | (uintptr)dst) & 3) == 0) {
-
-
+
+
((uint32 *)dst)[0] = ((const uint32 *)src1)[0] ^ ((const uint32 *)src2)[0];
((uint32 *)dst)[1] = ((const uint32 *)src1)[1] ^ ((const uint32 *)src2)[1];
((uint32 *)dst)[2] = ((const uint32 *)src1)[2] ^ ((const uint32 *)src2)[2];
((uint32 *)dst)[3] = ((const uint32 *)src1)[3] ^ ((const uint32 *)src2)[3];
} else {
-
+
int k;
for (k = 0; k < 16; k++)
dst[k] = src1[k] ^ src2[k];
@@ -719,16 +742,16 @@ extern bcm_tlv_t *bcm_parse_tlvs(void *buf, int buflen, uint key);
typedef uint32 mbool;
-#define mboolset(mb, bit) ((mb) |= (bit))
-#define mboolclr(mb, bit) ((mb) &= ~(bit))
-#define mboolisset(mb, bit) (((mb) & (bit)) != 0)
+#define mboolset(mb, bit) ((mb) |= (bit))
+#define mboolclr(mb, bit) ((mb) &= ~(bit))
+#define mboolisset(mb, bit) (((mb) & (bit)) != 0)
#define mboolmaskset(mb, mask, val) ((mb) = (((mb) & ~(mask)) | (val)))
struct fielddesc {
const char *nameandfmt;
- uint32 offset;
- uint32 len;
+ uint32 offset;
+ uint32 len;
};
extern void bcm_binit(struct bcmstrbuf *b, char *buf, uint size);
@@ -756,4 +779,4 @@ unsigned int process_nvram_vars(char *varbuf, unsigned int len);
}
#endif
-#endif
+#endif
diff --git a/drivers/net/wireless/bcmdhd/include/dbus.h b/drivers/net/wireless/bcmdhd/include/dbus.h
new file mode 100644
index 0000000..c5ea223
--- /dev/null
+++ b/drivers/net/wireless/bcmdhd/include/dbus.h
@@ -0,0 +1,571 @@
+/*
+ * Dongle BUS interface Abstraction layer
+ * target serial buses like USB, SDIO, SPI, etc.
+ *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
+ * Unless you and Broadcom execute a separate written software license
+ * agreement governing use of this software, this software is licensed to you
+ * under the terms of the GNU General Public License version 2 (the "GPL"),
+ * available at http://www.broadcom.com/licenses/GPLv2.php, with the
+ * following added to such license:
+ *
+ * As a special exception, the copyright holders of this software give you
+ * permission to link this software with independent modules, and to copy and
+ * distribute the resulting executable under terms of your choice, provided that
+ * you also meet, for each linked independent module, the terms and conditions of
+ * the license of that module. An independent module is a module which is not
+ * derived from this software. The special exception does not apply to any
+ * modifications of the software.
+ *
+ * Notwithstanding the above, under no circumstances may you combine this
+ * software in any way with any other Broadcom software provided under a license
+ * other than the GPL, without Broadcom's express prior written consent.
+ *
+ * $Id: dbus.h 323680 2012-03-26 17:52:31Z $
+ */
+
+#ifndef __DBUS_H__
+#define __DBUS_H__
+
+#include "typedefs.h"
+
+#define DBUSTRACE(args)
+#define DBUSERR(args)
+#define DBUSINFO(args)
+#define DBUSTRACE(args)
+#define DBUSDBGLOCK(args)
+
+enum {
+ DBUS_OK = 0,
+ DBUS_ERR = -200,
+ DBUS_ERR_TIMEOUT,
+ DBUS_ERR_DISCONNECT,
+ DBUS_ERR_NODEVICE,
+ DBUS_ERR_UNSUPPORTED,
+ DBUS_ERR_PENDING,
+ DBUS_ERR_NOMEM,
+ DBUS_ERR_TXFAIL,
+ DBUS_ERR_TXTIMEOUT,
+ DBUS_ERR_TXDROP,
+ DBUS_ERR_RXFAIL,
+ DBUS_ERR_RXDROP,
+ DBUS_ERR_TXCTLFAIL,
+ DBUS_ERR_RXCTLFAIL,
+ DBUS_ERR_REG_PARAM,
+ DBUS_STATUS_CANCELLED,
+ DBUS_ERR_NVRAM,
+ DBUS_JUMBO_NOMATCH,
+ DBUS_JUMBO_BAD_FORMAT,
+ DBUS_NVRAM_NONTXT
+};
+
+#define BCM_OTP_SIZE_43236 84 /* number of 16 bit values */
+#define BCM_OTP_SW_RGN_43236 24 /* start offset of SW config region */
+#define BCM_OTP_ADDR_43236 0x18000800 /* address of otp base */
+
+#define ERR_CBMASK_TXFAIL 0x00000001
+#define ERR_CBMASK_RXFAIL 0x00000002
+#define ERR_CBMASK_ALL 0xFFFFFFFF
+
+#define DBUS_CBCTL_WRITE 0
+#define DBUS_CBCTL_READ 1
+#if defined(INTR_EP_ENABLE)
+#define DBUS_CBINTR_POLL 2
+#endif /* defined(INTR_EP_ENABLE) */
+
+#define DBUS_TX_RETRY_LIMIT 3 /* retries for failed txirb */
+#define DBUS_TX_TIMEOUT_INTERVAL 250 /* timeout for txirb complete, in ms */
+
+#define DBUS_BUFFER_SIZE_TX 16000
+#define DBUS_BUFFER_SIZE_RX 5000
+
+#define DBUS_BUFFER_SIZE_TX_NOAGG 2048
+#define DBUS_BUFFER_SIZE_RX_NOAGG 2048
+
+/* DBUS types */
+enum {
+ DBUS_USB,
+ DBUS_SDIO,
+ DBUS_SPI,
+ DBUS_UNKNOWN
+};
+
+enum dbus_state {
+ DBUS_STATE_DL_PENDING,
+ DBUS_STATE_DL_DONE,
+ DBUS_STATE_UP,
+ DBUS_STATE_DOWN,
+ DBUS_STATE_PNP_FWDL,
+ DBUS_STATE_DISCONNECT,
+ DBUS_STATE_SLEEP
+};
+
+enum dbus_pnp_state {
+ DBUS_PNP_DISCONNECT,
+ DBUS_PNP_SLEEP,
+ DBUS_PNP_RESUME
+};
+
+enum dbus_file {
+ DBUS_FIRMWARE,
+ DBUS_NVFILE
+};
+
+typedef enum _DEVICE_SPEED {
+ INVALID_SPEED = -1,
+ LOW_SPEED = 1, /* USB 1.1: 1.5 Mbps */
+ FULL_SPEED, /* USB 1.1: 12 Mbps */
+ HIGH_SPEED, /* USB 2.0: 480 Mbps */
+ SUPER_SPEED, /* USB 3.0: 4.8 Gbps */
+} DEVICE_SPEED;
+
+typedef struct {
+ int bustype;
+ int vid;
+ int pid;
+ int devid;
+ int chiprev; /* chip revsion number */
+ int mtu;
+ int nchan; /* Data Channels */
+ int has_2nd_bulk_in_ep;
+} dbus_attrib_t;
+
+/* FIX: Account for errors related to DBUS;
+ * Let upper layer account for packets/bytes
+ */
+typedef struct {
+ uint32 rx_errors;
+ uint32 tx_errors;
+ uint32 rx_dropped;
+ uint32 tx_dropped;
+} dbus_stats_t;
+
+/*
+ * Configurable BUS parameters
+ */
+typedef struct {
+ bool rxctl_deferrespok;
+} dbus_config_t;
+
+/*
+ * External Download Info
+ */
+typedef struct dbus_extdl {
+ uint8 *fw;
+ int fwlen;
+ uint8 *vars;
+ int varslen;
+} dbus_extdl_t;
+
+struct dbus_callbacks;
+struct exec_parms;
+
+typedef void *(*probe_cb_t)(void *arg, const char *desc, uint32 bustype, uint32 hdrlen);
+typedef void (*disconnect_cb_t)(void *arg);
+typedef void *(*exec_cb_t)(struct exec_parms *args);
+
+/* Client callbacks registered during dbus_attach() */
+typedef struct dbus_callbacks {
+ void (*send_complete)(void *cbarg, void *info, int status);
+ void (*recv_buf)(void *cbarg, uint8 *buf, int len);
+ void (*recv_pkt)(void *cbarg, void *pkt);
+ void (*txflowcontrol)(void *cbarg, bool onoff);
+ void (*errhandler)(void *cbarg, int err);
+ void (*ctl_complete)(void *cbarg, int type, int status);
+ void (*state_change)(void *cbarg, int state);
+ void *(*pktget)(void *cbarg, uint len, bool send);
+ void (*pktfree)(void *cbarg, void *p, bool send);
+} dbus_callbacks_t;
+
+struct dbus_pub;
+struct bcmstrbuf;
+struct dbus_irb;
+struct dbus_irb_rx;
+struct dbus_irb_tx;
+struct dbus_intf_callbacks;
+
+typedef struct {
+ void* (*attach)(struct dbus_pub *pub, void *cbarg, struct dbus_intf_callbacks *cbs);
+ void (*detach)(struct dbus_pub *pub, void *bus);
+
+ int (*up)(void *bus);
+ int (*down)(void *bus);
+ int (*send_irb)(void *bus, struct dbus_irb_tx *txirb);
+ int (*recv_irb)(void *bus, struct dbus_irb_rx *rxirb);
+ int (*cancel_irb)(void *bus, struct dbus_irb_tx *txirb);
+ int (*send_ctl)(void *bus, uint8 *buf, int len);
+ int (*recv_ctl)(void *bus, uint8 *buf, int len);
+ int (*get_stats)(void *bus, dbus_stats_t *stats);
+ int (*get_attrib)(void *bus, dbus_attrib_t *attrib);
+
+ int (*pnp)(void *bus, int evnt);
+ int (*remove)(void *bus);
+ int (*resume)(void *bus);
+ int (*suspend)(void *bus);
+ int (*stop)(void *bus);
+ int (*reset)(void *bus);
+
+ /* Access to bus buffers directly */
+ void *(*pktget)(void *bus, int len);
+ void (*pktfree)(void *bus, void *pkt);
+
+ int (*iovar_op)(void *bus, const char *name, void *params, int plen, void *arg, int len,
+ bool set);
+ void (*dump)(void *bus, struct bcmstrbuf *strbuf);
+ int (*set_config)(void *bus, dbus_config_t *config);
+ int (*get_config)(void *bus, dbus_config_t *config);
+
+ bool (*device_exists)(void *bus);
+ bool (*dlneeded)(void *bus);
+ int (*dlstart)(void *bus, uint8 *fw, int len);
+ int (*dlrun)(void *bus);
+ bool (*recv_needed)(void *bus);
+
+ void *(*exec_rxlock)(void *bus, exec_cb_t func, struct exec_parms *args);
+ void *(*exec_txlock)(void *bus, exec_cb_t func, struct exec_parms *args);
+
+ int (*tx_timer_init)(void *bus);
+ int (*tx_timer_start)(void *bus, uint timeout);
+ int (*tx_timer_stop)(void *bus);
+
+ int (*sched_dpc)(void *bus);
+ int (*lock)(void *bus);
+ int (*unlock)(void *bus);
+ int (*sched_probe_cb)(void *bus);
+
+ int (*shutdown)(void *bus);
+
+ int (*recv_stop)(void *bus);
+ int (*recv_resume)(void *bus);
+
+ int (*recv_irb_from_ep)(void *bus, struct dbus_irb_rx *rxirb, uint ep_idx);
+
+ int (*readreg)(void *bus, uint32 regaddr, int datalen, uint32 *value);
+
+ /* Add from the bottom */
+} dbus_intf_t;
+
+typedef struct dbus_pub {
+ struct osl_info *osh;
+ dbus_stats_t stats;
+ dbus_attrib_t attrib;
+ enum dbus_state busstate;
+ DEVICE_SPEED device_speed;
+ int ntxq, nrxq, rxsize;
+ void *bus;
+ struct shared_info *sh;
+ void *dev_info;
+} dbus_pub_t;
+
+#define BUS_INFO(bus, type) (((type *) bus)->pub->bus)
+
+#define ALIGNED_LOCAL_VARIABLE(var, align) \
+ uint8 buffer[SDALIGN+64]; \
+ uint8 *var = (uint8 *)(((uintptr)&buffer[0]) & ~(align-1)) + align;
+
+/*
+ * Public Bus Function Interface
+ */
+
+/*
+ * FIX: Is there better way to pass OS/Host handles to DBUS but still
+ * maintain common interface for all OS??
+ * Under NDIS, param1 needs to be MiniportHandle
+ * For NDIS60, param2 is WdfDevice
+ * Under Linux, param1 and param2 are NULL;
+ */
+extern int dbus_register(int vid, int pid, probe_cb_t prcb, disconnect_cb_t discb, void *prarg,
+ void *param1, void *param2);
+extern int dbus_deregister(void);
+
+extern dbus_pub_t *dbus_attach(struct osl_info *osh, int rxsize, int nrxq, int ntxq,
+ void *cbarg, dbus_callbacks_t *cbs, dbus_extdl_t *extdl, struct shared_info *sh);
+extern void dbus_detach(dbus_pub_t *pub);
+
+extern int dbus_up(dbus_pub_t *pub);
+extern int dbus_down(dbus_pub_t *pub);
+extern int dbus_stop(dbus_pub_t *pub);
+extern int dbus_shutdown(dbus_pub_t *pub);
+extern void dbus_flowctrl_rx(dbus_pub_t *pub, bool on);
+
+extern int dbus_send_txdata(dbus_pub_t *dbus, void *pktbuf);
+extern int dbus_send_buf(dbus_pub_t *pub, uint8 *buf, int len, void *info);
+extern int dbus_send_pkt(dbus_pub_t *pub, void *pkt, void *info);
+extern int dbus_send_ctl(dbus_pub_t *pub, uint8 *buf, int len);
+extern int dbus_recv_ctl(dbus_pub_t *pub, uint8 *buf, int len);
+extern int dbus_recv_bulk(dbus_pub_t *pub, uint32 ep_idx);
+extern int dbus_poll_intr(dbus_pub_t *pub);
+
+extern int dbus_get_stats(dbus_pub_t *pub, dbus_stats_t *stats);
+extern int dbus_get_attrib(dbus_pub_t *pub, dbus_attrib_t *attrib);
+extern int dbus_get_device_speed(dbus_pub_t *pub);
+extern int dbus_set_config(dbus_pub_t *pub, dbus_config_t *config);
+extern int dbus_get_config(dbus_pub_t *pub, dbus_config_t *config);
+extern void * dbus_get_devinfo(dbus_pub_t *pub);
+
+extern void *dbus_pktget(dbus_pub_t *pub, int len);
+extern void dbus_pktfree(dbus_pub_t *pub, void* pkt);
+
+extern int dbus_set_errmask(dbus_pub_t *pub, uint32 mask);
+extern int dbus_pnp_sleep(dbus_pub_t *pub);
+extern int dbus_pnp_resume(dbus_pub_t *pub, int *fw_reload);
+extern int dbus_pnp_disconnect(dbus_pub_t *pub);
+
+extern int dbus_iovar_op(dbus_pub_t *pub, const char *name,
+ void *params, int plen, void *arg, int len, bool set);
+
+extern void *dhd_dbus_txq(const dbus_pub_t *pub);
+extern uint dhd_dbus_hdrlen(const dbus_pub_t *pub);
+
+/*
+ * Private Common Bus Interface
+ */
+
+/* IO Request Block (IRB) */
+typedef struct dbus_irb {
+ struct dbus_irb *next; /* it's casted from dbus_irb_tx or dbus_irb_rx struct */
+} dbus_irb_t;
+
+typedef struct dbus_irb_rx {
+ struct dbus_irb irb; /* Must be first */
+ uint8 *buf;
+ int buf_len;
+ int actual_len;
+ void *pkt;
+ void *info;
+ void *arg;
+} dbus_irb_rx_t;
+
+typedef struct dbus_irb_tx {
+ struct dbus_irb irb; /* Must be first */
+ uint8 *buf;
+ int len;
+ void *pkt;
+ int retry_count;
+ void *info;
+ void *arg;
+ void *send_buf; /* linear bufffer for LINUX when aggreagtion is enabled */
+} dbus_irb_tx_t;
+
+/* DBUS interface callbacks are different from user callbacks
+ * so, internally, different info can be passed to upper layer
+ */
+typedef struct dbus_intf_callbacks {
+ void (*send_irb_timeout)(void *cbarg, dbus_irb_tx_t *txirb);
+ void (*send_irb_complete)(void *cbarg, dbus_irb_tx_t *txirb, int status);
+ void (*recv_irb_complete)(void *cbarg, dbus_irb_rx_t *rxirb, int status);
+ void (*errhandler)(void *cbarg, int err);
+ void (*ctl_complete)(void *cbarg, int type, int status);
+ void (*state_change)(void *cbarg, int state);
+ bool (*isr)(void *cbarg, bool *wantdpc);
+ bool (*dpc)(void *cbarg, bool bounded);
+ void (*watchdog)(void *cbarg);
+ void *(*pktget)(void *cbarg, uint len, bool send);
+ void (*pktfree)(void *cbarg, void *p, bool send);
+ struct dbus_irb* (*getirb)(void *cbarg, bool send);
+ void (*rxerr_indicate)(void *cbarg, bool on);
+} dbus_intf_callbacks_t;
+
+/*
+ * Porting: To support new bus, port these functions below
+ */
+
+/*
+ * Bus specific Interface
+ * Implemented by dbus_usb.c/dbus_sdio.c
+ */
+extern int dbus_bus_register(int vid, int pid, probe_cb_t prcb, disconnect_cb_t discb, void *prarg,
+ dbus_intf_t **intf, void *param1, void *param2);
+extern int dbus_bus_deregister(void);
+extern void dbus_bus_fw_get(void *bus, uint8 **fw, int *fwlen, int *decomp);
+
+/*
+ * Bus-specific and OS-specific Interface
+ * Implemented by dbus_usb_[linux/ndis].c/dbus_sdio_[linux/ndis].c
+ */
+extern int dbus_bus_osl_register(int vid, int pid, probe_cb_t prcb, disconnect_cb_t discb,
+ void *prarg, dbus_intf_t **intf, void *param1, void *param2);
+extern int dbus_bus_osl_deregister(void);
+
+/*
+ * Bus-specific, OS-specific, HW-specific Interface
+ * Mainly for SDIO Host HW controller
+ */
+extern int dbus_bus_osl_hw_register(int vid, int pid, probe_cb_t prcb, disconnect_cb_t discb,
+ void *prarg, dbus_intf_t **intf);
+extern int dbus_bus_osl_hw_deregister(void);
+
+extern uint usbdev_bulkin_eps(void);
+#if defined(BCM_REQUEST_FW)
+extern void *dbus_get_fw_nvfile(int devid, uint8 **fw, int *fwlen, int type,
+ uint16 boardtype, uint16 boardrev);
+extern void dbus_release_fw_nvfile(void *firmware);
+#endif /* #if defined(BCM_REQUEST_FW) */
+
+
+#if defined(EHCI_FASTPATH_TX) || defined(EHCI_FASTPATH_RX)
+
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0))
+ /* Backward compatibility */
+ typedef unsigned int gfp_t;
+
+ #define dma_pool pci_pool
+ #define dma_pool_create(name, dev, size, align, alloc) \
+ pci_pool_create(name, dev, size, align, alloc, GFP_DMA | GFP_ATOMIC)
+ #define dma_pool_destroy(pool) pci_pool_destroy(pool)
+ #define dma_pool_alloc(pool, flags, handle) pci_pool_alloc(pool, flags, handle)
+ #define dma_pool_free(pool, vaddr, addr) pci_pool_free(pool, vaddr, addr)
+
+ #define dma_map_single(dev, addr, size, dir) pci_map_single(dev, addr, size, dir)
+ #define dma_unmap_single(dev, hnd, size, dir) pci_unmap_single(dev, hnd, size, dir)
+ #define DMA_FROM_DEVICE PCI_DMA_FROMDEVICE
+ #define DMA_TO_DEVICE PCI_DMA_TODEVICE
+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)) */
+
+/* Availability of these functions varies (when present, they have two arguments) */
+#ifndef hc32_to_cpu
+ #define hc32_to_cpu(x) le32_to_cpu(x)
+ #define cpu_to_hc32(x) cpu_to_le32(x)
+ typedef unsigned int __hc32;
+#else
+ #error Two-argument functions needed
+#endif
+
+/* Private USB opcode base */
+#define EHCI_FASTPATH 0x31
+#define EHCI_SET_EP_BYPASS EHCI_FASTPATH
+#define EHCI_SET_BYPASS_CB (EHCI_FASTPATH + 1)
+#define EHCI_SET_BYPASS_DEV (EHCI_FASTPATH + 2)
+#define EHCI_DUMP_STATE (EHCI_FASTPATH + 3)
+#define EHCI_SET_BYPASS_POOL (EHCI_FASTPATH + 4)
+#define EHCI_CLR_EP_BYPASS (EHCI_FASTPATH + 5)
+
+/*
+ * EHCI QTD structure (hardware and extension)
+ * NOTE that is does not need to (and does not) match its kernel counterpart
+ */
+#define EHCI_QTD_NBUFFERS 5
+#define EHCI_QTD_ALIGN 32
+#define EHCI_BULK_PACKET_SIZE 512
+#define EHCI_QTD_XACTERR_MAX 32
+
+struct ehci_qtd {
+ /* Hardware map */
+ volatile uint32_t qtd_next;
+ volatile uint32_t qtd_altnext;
+ volatile uint32_t qtd_status;
+#define EHCI_QTD_GET_BYTES(x) (((x)>>16) & 0x7fff)
+#define EHCI_QTD_IOC 0x00008000
+#define EHCI_QTD_GET_CERR(x) (((x)>>10) & 0x3)
+#define EHCI_QTD_SET_CERR(x) ((x) << 10)
+#define EHCI_QTD_GET_PID(x) (((x)>>8) & 0x3)
+#define EHCI_QTD_SET_PID(x) ((x) << 8)
+#define EHCI_QTD_ACTIVE 0x80
+#define EHCI_QTD_HALTED 0x40
+#define EHCI_QTD_BUFERR 0x20
+#define EHCI_QTD_BABBLE 0x10
+#define EHCI_QTD_XACTERR 0x08
+#define EHCI_QTD_MISSEDMICRO 0x04
+ volatile uint32_t qtd_buffer[EHCI_QTD_NBUFFERS];
+ volatile uint32_t qtd_buffer_hi[EHCI_QTD_NBUFFERS];
+
+ /* Implementation extension */
+ dma_addr_t qtd_self; /* own hardware address */
+ struct ehci_qtd *obj_next; /* software link to the next QTD */
+ void *rpc; /* pointer to the rpc buffer */
+ size_t length; /* length of the data in the buffer */
+ void *buff; /* pointer to the reassembly buffer */
+ int xacterrs; /* retry counter for qtd xact error */
+} __attribute__ ((aligned(EHCI_QTD_ALIGN)));
+
+#define EHCI_NULL __constant_cpu_to_le32(1) /* HW null pointer shall be odd */
+
+#define SHORT_READ_Q(token) (EHCI_QTD_GET_BYTES(token) != 0 && EHCI_QTD_GET_PID(token) == 1)
+
+/* Queue Head */
+/* NOTE This structure is slightly different from the one in the kernel; but needs to stay
+ * compatible
+ */
+struct ehci_qh {
+ /* Hardware map */
+ volatile uint32_t qh_link;
+ volatile uint32_t qh_endp;
+ volatile uint32_t qh_endphub;
+ volatile uint32_t qh_curqtd;
+
+ /* QTD overlay */
+ volatile uint32_t ow_next;
+ volatile uint32_t ow_altnext;
+ volatile uint32_t ow_status;
+ volatile uint32_t ow_buffer [EHCI_QTD_NBUFFERS];
+ volatile uint32_t ow_buffer_hi [EHCI_QTD_NBUFFERS];
+
+ /* Extension (should match the kernel layout) */
+ dma_addr_t unused0;
+ void *unused1;
+ struct list_head unused2;
+ struct ehci_qtd *dummy;
+ struct ehci_qh *unused3;
+
+ struct ehci_hcd *unused4;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0))
+ struct kref unused5;
+ unsigned unused6;
+
+ uint8_t unused7;
+
+ /* periodic schedule info */
+ uint8_t unused8;
+ uint8_t unused9;
+ uint8_t unused10;
+ uint16_t unused11;
+ uint16_t unused12;
+ uint16_t unused13;
+ struct usb_device *unused14;
+#else
+ unsigned unused5;
+
+ u8 unused6;
+
+ /* periodic schedule info */
+ u8 unused7;
+ u8 unused8;
+ u8 unused9;
+ unsigned short unused10;
+ unsigned short unused11;
+#define NO_FRAME ((unsigned short)~0)
+#ifdef EHCI_QUIRK_FIX
+ struct usb_device *unused12;
+#endif /* EHCI_QUIRK_FIX */
+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)) */
+ struct ehci_qtd *first_qtd;
+ /* Link to the first QTD; this is an optimized equivalent of the qtd_list field */
+ /* NOTE that ehci_qh in ehci.h shall reserve this word */
+} __attribute__ ((aligned(EHCI_QTD_ALIGN)));
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0))
+/* The corresponding structure in the kernel is used to get the QH */
+struct hcd_dev { /* usb_device.hcpriv points to this */
+ struct list_head unused0;
+ struct list_head unused1;
+
+ /* array of QH pointers */
+ void *ep[32];
+};
+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)) */
+
+int optimize_qtd_fill_with_rpc(const dbus_pub_t *pub, int epn, struct ehci_qtd *qtd, void *rpc,
+ int token, int len);
+int optimize_qtd_fill_with_data(const dbus_pub_t *pub, int epn, struct ehci_qtd *qtd, void *data,
+ int token, int len);
+int optimize_submit_async(struct ehci_qtd *qtd, int epn);
+void inline optimize_ehci_qtd_init(struct ehci_qtd *qtd, dma_addr_t dma);
+struct ehci_qtd *optimize_ehci_qtd_alloc(gfp_t flags);
+void optimize_ehci_qtd_free(struct ehci_qtd *qtd);
+void optimize_submit_rx_request(const dbus_pub_t *pub, int epn, struct ehci_qtd *qtd_in, void *buf);
+#endif /* EHCI_FASTPATH_TX || EHCI_FASTPATH_RX */
+
+void dbus_flowctrl_tx(void *dbi, bool on);
+#endif /* __DBUS_H__ */
diff --git a/drivers/net/wireless/bcmdhd/src/include/dhdioctl.h b/drivers/net/wireless/bcmdhd/include/dhdioctl.h
index c645563..b36fa0c 100644
--- a/drivers/net/wireless/bcmdhd/src/include/dhdioctl.h
+++ b/drivers/net/wireless/bcmdhd/include/dhdioctl.h
@@ -5,14 +5,14 @@
*
* Definitions subject to change without notice.
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -20,12 +20,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: dhdioctl.h 303826 2011-12-20 06:02:09Z $
+ * $Id: dhdioctl.h 357867 2012-09-20 06:57:44Z $
*/
#ifndef _dhdioctl_h_
@@ -85,13 +85,15 @@ enum {
#define DHD_GLOM_VAL 0x0400
#define DHD_EVENT_VAL 0x0800
#define DHD_BTA_VAL 0x1000
-#if defined(NDIS630)
+#if 0 && (NDISVER >= 0x0630) && 1
#define DHD_SCAN_VAL 0x2000
#else
#define DHD_ISCAN_VAL 0x2000
#endif
#define DHD_ARPOE_VAL 0x4000
#define DHD_REORDER_VAL 0x8000
+#define DHD_WL_VAL 0x10000
+#define DHD_WL_VAL2 0x20000
#ifdef SDTEST
/* For pktgen iovar */
@@ -115,7 +117,7 @@ typedef struct dhd_pktgen {
/* Type of test packets to use */
#define DHD_PKTGEN_ECHO 1 /* Send echo requests */
-#define DHD_PKTGEN_SEND 2 /* Send discard packets */
+#define DHD_PKTGEN_SEND 2 /* Send discard packets */
#define DHD_PKTGEN_RXBURST 3 /* Request dongle send N packets */
#define DHD_PKTGEN_RECV 4 /* Continuous rx from continuous tx dongle */
#endif /* SDTEST */
diff --git a/drivers/net/wireless/bcmdhd/src/include/epivers.h b/drivers/net/wireless/bcmdhd/include/epivers.h
index 4e873bb..2d4b886 100644
--- a/drivers/net/wireless/bcmdhd/src/include/epivers.h
+++ b/drivers/net/wireless/bcmdhd/include/epivers.h
@@ -1,12 +1,12 @@
/*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -14,12 +14,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: epivers.h.in,v 13.33 2010-09-08 22:08:53 $
+ * $Id: epivers.h.in,v 13.33 2010-09-08 22:08:53 csm Exp $
*
*/
@@ -28,21 +28,29 @@
#define EPI_MAJOR_VERSION 1
-#define EPI_MINOR_VERSION 15
+#define EPI_MINOR_VERSION 28
-#define EPI_RC_NUMBER 15
+#define EPI_RC_NUMBER 11
-#define EPI_INCREMENTAL_NUMBER 0
+#define EPI_INCREMENTAL_NUMBER 12
#define EPI_BUILD_NUMBER 0
-#define EPI_VERSION 1, 15, 15, 0
-
-#define EPI_VERSION_NUM 0x010f0f00
+#define EPI_VERSION 1, 28, 11, 12
-#define EPI_VERSION_DEV 1.15.15
+#define EPI_VERSION_NUM 0x011c0b0c
+#define EPI_VERSION_DEV 1.28.11
-#define EPI_VERSION_STR "1.15.15"
+/* Driver Version String, ASCII, 32 chars max */
+#ifdef BCMINTERNAL
+#define EPI_VERSION_STR "1.28.11.12 (r BCMINT)"
+#else
+#ifdef WLTEST
+#define EPI_VERSION_STR "1.28.11.12 (r WLTEST)"
+#else
+#define EPI_VERSION_STR "1.28.11.12 (Add_p2pPatch_1012)"
+#endif
+#endif /* BCMINTERNAL */
#endif /* _epivers_h_ */
diff --git a/drivers/net/wireless/bcmdhd/src/include/hndpmu.h b/drivers/net/wireless/bcmdhd/include/hndpmu.h
index b2911fd..c41def6 100644
--- a/drivers/net/wireless/bcmdhd/src/include/hndpmu.h
+++ b/drivers/net/wireless/bcmdhd/include/hndpmu.h
@@ -1,14 +1,14 @@
/*
* HND SiliconBackplane PMU support.
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,7 +16,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
diff --git a/drivers/net/wireless/bcmdhd/src/include/hndrte_armtrap.h b/drivers/net/wireless/bcmdhd/include/hndrte_armtrap.h
index a3eae2d..90d9799 100644
--- a/drivers/net/wireless/bcmdhd/src/include/hndrte_armtrap.h
+++ b/drivers/net/wireless/bcmdhd/include/hndrte_armtrap.h
@@ -1,14 +1,14 @@
/*
* HNDRTE arm trap handling.
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,7 +16,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
diff --git a/drivers/net/wireless/bcmdhd/src/include/hndrte_cons.h b/drivers/net/wireless/bcmdhd/include/hndrte_cons.h
index 5006556..57abbbd 100644
--- a/drivers/net/wireless/bcmdhd/src/include/hndrte_cons.h
+++ b/drivers/net/wireless/bcmdhd/include/hndrte_cons.h
@@ -1,14 +1,14 @@
/*
* Console support for hndrte.
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,7 +16,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
diff --git a/drivers/net/wireless/bcmdhd/src/include/hndsoc.h b/drivers/net/wireless/bcmdhd/include/hndsoc.h
index 1f11aef..66640c3 100644
--- a/drivers/net/wireless/bcmdhd/src/include/hndsoc.h
+++ b/drivers/net/wireless/bcmdhd/include/hndsoc.h
@@ -1,14 +1,14 @@
/*
* Broadcom HND chip & on-chip-interconnect-related definitions.
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,12 +16,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: hndsoc.h 283666 2011-09-15 00:27:45Z $
+ * $Id: hndsoc.h 309193 2012-01-19 00:03:57Z $
*/
#ifndef _HNDSOC_H
@@ -42,10 +42,10 @@
#define SI_SDRAM_SWAPPED 0x10000000 /* Byteswapped Physical SDRAM */
#define SI_SDRAM_R2 0x80000000 /* Region 2 for sdram (512 MB) */
-#define SI_ENUM_BASE 0x18000000 /* Enumeration space base */
+#define SI_ENUM_BASE 0x18000000 /* Enumeration space base */
-#define SI_WRAP_BASE 0x18100000 /* Wrapper space base */
-#define SI_CORE_SIZE 0x1000 /* each core gets 4Kbytes for registers */
+#define SI_WRAP_BASE 0x18100000 /* Wrapper space base */
+#define SI_CORE_SIZE 0x1000 /* each core gets 4Kbytes for registers */
#define SI_MAXCORES 16 /* Max cores (this is arbitrary, for software
* convenience and could be changed if we
* make any larger chips
@@ -136,13 +136,13 @@
#define ACPHY_CORE_ID 0x83b /* Dot11 ACPHY */
#define PCIE2_CORE_ID 0x83c /* pci express Gen2 core */
-#define USB30D_CORE_ID 0x83d /* usb 3.0 device core */
+#define USB30D_CORE_ID 0x83d /* usb 3.0 device core */
#define ARMCR4_CORE_ID 0x83e /* ARM CR4 CPU */
-#define APB_BRIDGE_CORE_ID 0x135 /* APB bridge core ID */
-#define AXI_CORE_ID 0x301 /* AXI/GPV core ID */
-#define EROM_CORE_ID 0x366 /* EROM core ID */
+#define APB_BRIDGE_CORE_ID 0x135 /* APB bridge core ID */
+#define AXI_CORE_ID 0x301 /* AXI/GPV core ID */
+#define EROM_CORE_ID 0x366 /* EROM core ID */
#define OOB_ROUTER_CORE_ID 0x367 /* OOB router core ID */
-#define DEF_AI_COMP 0xfff /* Default component, in ai chips it maps all
+#define DEF_AI_COMP 0xfff /* Default component, in ai chips it maps all
* unused address ranges
*/
diff --git a/drivers/net/wireless/bcmdhd/src/include/linux_osl.h b/drivers/net/wireless/bcmdhd/include/linux_osl.h
index fbe3d86..5fd1dbd 100644
--- a/drivers/net/wireless/bcmdhd/src/include/linux_osl.h
+++ b/drivers/net/wireless/bcmdhd/include/linux_osl.h
@@ -2,13 +2,13 @@
* Linux OS Independent Layer
*
* Copyright (C) 1999-2012, Broadcom Corporation
- *
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,12 +16,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: linux_osl.h 309193 2012-01-19 00:03:57Z $
+ * $Id: linux_osl.h 352246 2012-08-22 05:42:04Z $
*/
#ifndef _linux_osl_h_
@@ -57,10 +57,12 @@ extern void osl_assert(const char *exp, const char *file, int line);
#if GCC_VERSION > 30100
#define ASSERT(exp) do {} while (0)
#else
+
#define ASSERT(exp)
- #endif
- #endif /* __GNUC__ */
-#endif /* BCMASSERT_LOG */
+ #endif
+ #endif
+#endif
+
#define OSL_DELAY(usec) osl_delay(usec)
extern void osl_delay(uint usec);
@@ -90,10 +92,10 @@ extern struct pci_dev *osl_pci_device(osl_t *osh);
typedef struct {
bool pkttag;
- uint pktalloced;
- bool mmbus;
- pktfree_cb_fn_t tx_fn;
- void *tx_ctx;
+ uint pktalloced;
+ bool mmbus;
+ pktfree_cb_fn_t tx_fn;
+ void *tx_ctx;
void *unused[3];
} osl_pubinfo_t;
@@ -103,6 +105,8 @@ typedef struct {
((osl_pubinfo_t*)osh)->tx_ctx = _tx_ctx; \
} while (0)
+
+
#define BUS_SWAP32(v) (v)
#define MALLOC(osh, size) osl_malloc((osh), (size))
@@ -128,8 +132,9 @@ extern uint osl_dma_consistent_align(void);
extern void *osl_dma_alloc_consistent(osl_t *osh, uint size, uint16 align, uint *tot, ulong *pap);
extern void osl_dma_free_consistent(osl_t *osh, void *va, uint size, ulong pa);
-#define DMA_TX 1
-#define DMA_RX 2
+
+#define DMA_TX 1
+#define DMA_RX 2
#define DMA_UNMAP(osh, pa, size, direction, p, dmah) \
@@ -154,21 +159,24 @@ extern void osl_dma_unmap(osl_t *osh, uint pa, uint size, int direction);
extern int osl_error(int bcmerror);
-#define PKTBUFSZ 2048
+#define PKTBUFSZ 2048
+
-#include <linuxver.h>
-#include <linux/kernel.h>
-#include <linux/string.h>
+#include <linuxver.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
-#define OSL_SYSUPTIME() ((uint32)jiffies * (1000 / HZ))
+#define OSL_SYSUPTIME() ((uint32)jiffies_to_msecs(jiffies))
#define printf(fmt, args...) printk(fmt , ## args)
-#include <linux/kernel.h>
-#include <linux/string.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
#define bcopy(src, dst, len) memcpy((dst), (src), (len))
#define bcmp(b1, b2, len) memcmp((b1), (b2), (len))
#define bzero(b, len) memset((b), '\0', (len))
+
+
#define R_REG(osh, r) (\
SELECT_BUS_READ(osh, \
({ \
@@ -218,7 +226,7 @@ extern int osl_error(int bcmerror);
#define OSL_GETCYCLES(x) rdtscl((x))
#else
#define OSL_GETCYCLES(x) ((x) = 0)
-#endif
+#endif
#define BUSPROBE(val, addr) ({ (val) = R_REG(NULL, (addr)); 0; })
@@ -228,7 +236,7 @@ extern int osl_error(int bcmerror);
#define REG_MAP(pa, size) ioremap_nocache((unsigned long)(pa), (unsigned long)(size))
#else
#define REG_MAP(pa, size) (void *)(0)
-#endif
+#endif
#define REG_UNMAP(va) iounmap((va))
@@ -237,7 +245,7 @@ extern int osl_error(int bcmerror);
#define BZERO_SM(r, len) memset((r), '\0', (len))
-#include <linuxver.h>
+#include <linuxver.h>
#define PKTGET(osh, len, send) osl_pktget((osh), (len))
@@ -248,7 +256,7 @@ extern int osl_error(int bcmerror);
#ifdef CONFIG_DHD_USE_STATIC_BUF
#define PKTGET_STATIC(osh, len, send) osl_pktget_static((osh), (len))
#define PKTFREE_STATIC(osh, skb, send) osl_pktfree_static((osh), (skb), (send))
-#endif
+#endif
#define PKTDATA(osh, skb) (((struct sk_buff*)(skb))->data)
#define PKTLEN(osh, skb) (((struct sk_buff*)(skb))->len)
#define PKTHEADROOM(osh, skb) (PKTDATA(osh, skb)-(((struct sk_buff*)(skb))->head))
@@ -274,12 +282,12 @@ typedef struct ctfpool {
uint obj_size;
uint refills;
uint fast_allocs;
- uint fast_frees;
- uint slow_allocs;
+ uint fast_frees;
+ uint slow_allocs;
} ctfpool_t;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22)
-#define FASTBUF (1 << 4)
-#define CTFBUF (1 << 5)
+#define FASTBUF (1 << 16)
+#define CTFBUF (1 << 17)
#define PKTSETFAST(osh, skb) ((((struct sk_buff*)(skb))->mac_len) |= FASTBUF)
#define PKTCLRFAST(osh, skb) ((((struct sk_buff*)(skb))->mac_len) &= (~FASTBUF))
#define PKTSETCTF(osh, skb) ((((struct sk_buff*)(skb))->mac_len) |= CTFBUF)
@@ -297,7 +305,7 @@ typedef struct ctfpool {
#define PKTISFAST(osh, skb) ((((struct sk_buff*)(skb))->__unused) & FASTBUF)
#define PKTISCTF(osh, skb) ((((struct sk_buff*)(skb))->__unused) & CTFBUF)
#define PKTFAST(osh, skb) (((struct sk_buff*)(skb))->__unused)
-#endif /* LINUX_VERSION_CODE */
+#endif
#define CTFPOOLPTR(osh, skb) (((struct sk_buff*)(skb))->sk)
#define CTFPOOLHEAD(osh, skb) (((ctfpool_t *)((struct sk_buff*)(skb))->sk)->head)
@@ -307,26 +315,26 @@ extern void osl_ctfpool_replenish(osl_t *osh, uint thresh);
extern int32 osl_ctfpool_init(osl_t *osh, uint numobj, uint size);
extern void osl_ctfpool_cleanup(osl_t *osh);
extern void osl_ctfpool_stats(osl_t *osh, void *b);
-#endif /* CTFPOOL */
+#endif
#ifdef HNDCTF
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22)
-#define SKIPCT (1 << 6)
+#define SKIPCT (1 << 18)
#define PKTSETSKIPCT(osh, skb) (((struct sk_buff*)(skb))->mac_len |= SKIPCT)
#define PKTCLRSKIPCT(osh, skb) (((struct sk_buff*)(skb))->mac_len &= (~SKIPCT))
#define PKTSKIPCT(osh, skb) (((struct sk_buff*)(skb))->mac_len & SKIPCT)
-#else
+#else
#define SKIPCT (1 << 2)
#define PKTSETSKIPCT(osh, skb) (((struct sk_buff*)(skb))->__unused |= SKIPCT)
#define PKTCLRSKIPCT(osh, skb) (((struct sk_buff*)(skb))->__unused &= (~SKIPCT))
#define PKTSKIPCT(osh, skb) (((struct sk_buff*)(skb))->__unused & SKIPCT)
-#endif
-#else
+#endif
+#else
#define PKTSETSKIPCT(osh, skb)
#define PKTCLRSKIPCT(osh, skb)
#define PKTSKIPCT(osh, skb)
-#endif /* HNDCTF */
+#endif
extern void osl_pktfree(osl_t *osh, void *skb, bool send);
extern void *osl_pktget_static(osl_t *osh, uint len);
@@ -352,10 +360,49 @@ extern struct sk_buff *osl_pkt_tonative(osl_t *osh, void *pkt);
#define DMA_MAP(osh, va, size, direction, p, dmah) \
osl_dma_map((osh), (va), (size), (direction))
+#ifdef PKTC
+
+struct chain_node {
+ struct sk_buff *link;
+ unsigned int flags:3, pkts:9, bytes:20;
+};
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 14)
+#define CHAIN_NODE(skb) ((struct chain_node*)&(((struct sk_buff*)skb)->tstamp))
#else
+#define CHAIN_NODE(skb) ((struct chain_node*)&(((struct sk_buff*)skb)->stamp))
+#endif
+
+#define PKTCCNT(skb) (CHAIN_NODE(skb)->pkts)
+#define PKTCLEN(skb) (CHAIN_NODE(skb)->bytes)
+#define PKTCFLAGS(skb) (CHAIN_NODE(skb)->flags)
+#define PKTCSETCNT(skb, c) (CHAIN_NODE(skb)->pkts = (c) & ((1 << 9) - 1))
+#define PKTCSETLEN(skb, l) (CHAIN_NODE(skb)->bytes = (l) & ((1 << 20) - 1))
+#define PKTCSETFLAG(skb, fb) (CHAIN_NODE(skb)->flags |= (fb))
+#define PKTCCLRFLAG(skb, fb) (CHAIN_NODE(skb)->flags &= ~(fb))
+#define PKTCLINK(skb) (CHAIN_NODE(skb)->link)
+#define PKTSETCLINK(skb, x) (CHAIN_NODE(skb)->link = (struct sk_buff*)(x))
+#define PKTISCHAINED(skb) (PKTCLINK(skb) != NULL)
+#define FOREACH_CHAINED_PKT(skb, nskb) \
+ for (; (skb) != NULL; (skb) = (nskb)) \
+ if ((nskb) = PKTCLINK(skb), PKTSETCLINK((skb), NULL), 1)
+#define PKTCFREE(osh, skb, send) \
+do { \
+ void *nskb; \
+ ASSERT((skb) != NULL); \
+ FOREACH_CHAINED_PKT((skb), nskb) { \
+ PKTFREE((osh), (skb), (send)); \
+ } \
+} while (0)
+#endif
+
+#else
+
+
#define ASSERT(exp) do {} while (0)
+
#define MALLOC(o, l) malloc(l)
#define MFREE(o, p, l) free(p)
#include <stdlib.h>
@@ -370,6 +417,6 @@ extern struct sk_buff *osl_pkt_tonative(osl_t *osh, void *pkt);
extern void bcopy(const void *src, void *dst, size_t len);
extern int bcmp(const void *b1, const void *b2, size_t len);
extern void bzero(void *b, size_t len);
-#endif /* BCMDRIVER */
+#endif
-#endif /* _linux_osl_h_ */
+#endif
diff --git a/drivers/net/wireless/bcmdhd/src/include/linuxver.h b/drivers/net/wireless/bcmdhd/include/linuxver.h
index 40830d9..3c2a168 100644
--- a/drivers/net/wireless/bcmdhd/src/include/linuxver.h
+++ b/drivers/net/wireless/bcmdhd/include/linuxver.h
@@ -2,14 +2,14 @@
* Linux-specific abstractions to gain some independence from linux kernel versions.
* Pave over some 2.2 versus 2.4 versus 2.6 kernel differences.
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -17,12 +17,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: linuxver.h 291086 2011-10-21 01:17:24Z $
+ * $Id: linuxver.h 353905 2012-08-29 07:33:08Z $
*/
#ifndef _linuxver_h_
@@ -37,7 +37,7 @@
#else
#include <linux/autoconf.h>
#endif
-#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) */
+#endif
#include <linux/module.h>
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 0))
@@ -47,7 +47,7 @@
#else
#define __NO_VERSION__
#endif
-#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 0)) */
+#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
#define module_param(_name_, _type_, _perm_) MODULE_PARM(_name_, "i")
@@ -73,10 +73,10 @@
#include <linux/semaphore.h>
#else
#include <asm/semaphore.h>
-#endif
+#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28))
#undef IP_TOS
-#endif
+#endif
#include <asm/io.h>
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 41))
@@ -95,7 +95,20 @@
#ifndef flush_scheduled_work
#define flush_scheduled_work() flush_scheduled_tasks()
#endif
-#endif
+#endif
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0))
+#define DAEMONIZE(a) daemonize(a); \
+ allow_signal(SIGKILL); \
+ allow_signal(SIGTERM);
+#else
+#define RAISE_RX_SOFTIRQ() \
+ cpu_raise_softirq(smp_processor_id(), NET_RX_SOFTIRQ)
+#define DAEMONIZE(a) daemonize(); \
+ do { if (a) \
+ strncpy(current->comm, a, MIN(sizeof(current->comm), (strlen(a)))); \
+ } while (0);
+#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)
#define MY_INIT_WORK(_work, _func) INIT_WORK(_work, _func)
@@ -103,9 +116,10 @@
#define MY_INIT_WORK(_work, _func) INIT_WORK(_work, _func, _work)
#if !(LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 18) && defined(RHEL_MAJOR) && \
(RHEL_MAJOR == 5))
+
typedef void (*work_func_t)(void *work);
#endif
-#endif
+#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0))
@@ -117,22 +131,22 @@ typedef void irqreturn_t;
#endif
#else
typedef irqreturn_t(*FN_ISR) (int irq, void *dev_id, struct pt_regs *ptregs);
-#endif
+#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
#define IRQF_SHARED SA_SHIRQ
-#endif
+#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 17)
#ifdef CONFIG_NET_RADIO
#define CONFIG_WIRELESS_EXT
#endif
-#endif
+#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 67)
#define MOD_INC_USE_COUNT
#define MOD_DEC_USE_COUNT
-#endif
+#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 32)
#include <linux/sched.h>
@@ -147,8 +161,12 @@ typedef irqreturn_t(*FN_ISR) (int irq, void *dev_id, struct pt_regs *ptregs);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 14)
#include <net/ieee80211.h>
#endif
-#endif
+#endif
+
+#ifdef CUSTOMER_HW4
+#include <linux/kthread.h>
+#endif
#ifndef __exit
#define __exit
@@ -174,21 +192,21 @@ typedef irqreturn_t(*FN_ISR) (int irq, void *dev_id, struct pt_regs *ptregs);
struct pci_device_id {
- unsigned int vendor, device;
- unsigned int subvendor, subdevice;
- unsigned int class, class_mask;
- unsigned long driver_data;
+ unsigned int vendor, device;
+ unsigned int subvendor, subdevice;
+ unsigned int class, class_mask;
+ unsigned long driver_data;
};
struct pci_driver {
struct list_head node;
char *name;
- const struct pci_device_id *id_table;
+ const struct pci_device_id *id_table;
int (*probe)(struct pci_dev *dev,
- const struct pci_device_id *id);
- void (*remove)(struct pci_dev *dev);
- void (*suspend)(struct pci_dev *dev);
- void (*resume)(struct pci_dev *dev);
+ const struct pci_device_id *id);
+ void (*remove)(struct pci_dev *dev);
+ void (*suspend)(struct pci_dev *dev);
+ void (*resume)(struct pci_dev *dev);
};
#define MODULE_DEVICE_TABLE(type, name)
@@ -199,7 +217,7 @@ struct pci_driver {
extern int pci_register_driver(struct pci_driver *drv);
extern void pci_unregister_driver(struct pci_driver *drv);
-#endif
+#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 18))
#define pci_module_init pci_register_driver
@@ -213,7 +231,7 @@ extern void pci_unregister_driver(struct pci_driver *drv);
#define module_init(x) __initcall(x);
#define module_exit(x) __exitcall(x);
#endif
-#endif
+#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31)
#define WL_USE_NETDEV_OPS
@@ -293,7 +311,7 @@ static inline void pci_free_consistent(struct pci_dev *hwdev, size_t size,
#define pci_map_single(cookie, address, size, dir) virt_to_bus(address)
#define pci_unmap_single(cookie, address, size, dir)
-#endif
+#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 43))
@@ -320,7 +338,7 @@ static inline void netif_start_queue(struct net_device *dev)
#define netif_queue_stopped(dev) (dev)->tbusy
#define netif_running(dev) (dev)->start
-#endif
+#endif
#define netif_device_attach(dev) netif_start_queue(dev)
#define netif_device_detach(dev) netif_stop_queue(dev)
@@ -351,7 +369,7 @@ static inline void tasklet_init(struct tasklet_struct *tasklet,
#define netif_down(dev)
-#endif
+#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 3))
@@ -370,7 +388,7 @@ static inline void tasklet_init(struct tasklet_struct *tasklet,
PREPARE_TQUEUE((_tq), (_routine), (_data)); \
} while (0)
-#endif
+#endif
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 9)
@@ -402,7 +420,7 @@ pci_restore_state(struct pci_dev *dev, u32 *buffer)
for (i = 0; i < 16; i++)
pci_write_config_dword(dev, i * 4, buffer[i]);
}
-
+
else {
for (i = 0; i < 6; i ++)
pci_write_config_dword(dev,
@@ -412,7 +430,7 @@ pci_restore_state(struct pci_dev *dev, u32 *buffer)
}
return 0;
}
-#endif
+#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 19))
@@ -429,7 +447,7 @@ pci_restore_state(struct pci_dev *dev, u32 *buffer)
#define OLD_MOD_INC_USE_COUNT do {} while (0)
#define OLD_MOD_DEC_USE_COUNT do {} while (0)
#endif
-#else
+#else
#ifndef SET_MODULE_OWNER
#define SET_MODULE_OWNER(dev) do {} while (0)
#endif
@@ -441,7 +459,7 @@ pci_restore_state(struct pci_dev *dev, u32 *buffer)
#endif
#define OLD_MOD_INC_USE_COUNT MOD_INC_USE_COUNT
#define OLD_MOD_DEC_USE_COUNT MOD_DEC_USE_COUNT
-#endif
+#endif
#ifndef SET_NETDEV_DEV
#define SET_NETDEV_DEV(net, pdev) do {} while (0)
@@ -468,10 +486,10 @@ pci_restore_state(struct pci_dev *dev, u32 *buffer)
#endif
typedef struct {
- void *parent;
+ void *parent;
struct task_struct *p_task;
- long thr_pid;
- int prio;
+ long thr_pid;
+ int prio;
struct semaphore sema;
int terminated;
struct completion completed;
@@ -506,6 +524,19 @@ typedef struct {
DBG_THR(("%s thr:%lx started\n", __FUNCTION__, (tsk_ctl)->thr_pid)); \
}
+#ifdef USE_KTHREAD_API
+#define PROC_START2(thread_func, owner, tsk_ctl, flags, name) \
+{ \
+ sema_init(&((tsk_ctl)->sema), 0); \
+ init_completion(&((tsk_ctl)->completed)); \
+ (tsk_ctl)->parent = owner; \
+ (tsk_ctl)->terminated = FALSE; \
+ (tsk_ctl)->p_task = kthread_run(thread_func, tsk_ctl, (char*)name); \
+ (tsk_ctl)->thr_pid = (tsk_ctl)->p_task->pid; \
+ DBG_THR(("%s thr:%lx created\n", __FUNCTION__, (tsk_ctl)->thr_pid)); \
+}
+#endif
+
#define PROC_STOP(tsk_ctl) \
{ \
(tsk_ctl)->terminated = TRUE; \
@@ -542,7 +573,7 @@ if (tsk) send_sig(sig, tsk, 1); \
kill_proc(pid, sig, 1); \
}
#endif
-#endif
+#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0))
#include <linux/time.h>
@@ -581,7 +612,8 @@ do { \
__ret; \
})
-#endif
+#endif
+
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24))
#define DEV_PRIV(dev) (dev->priv)
@@ -593,10 +625,10 @@ do { \
#define WL_ISR(i, d, p) wl_isr((i), (d))
#else
#define WL_ISR(i, d, p) wl_isr((i), (d), (p))
-#endif
+#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0))
#define netdev_priv(dev) dev->priv
-#endif
+#endif
-#endif
+#endif
diff --git a/drivers/net/wireless/bcmdhd/src/include/miniopt.h b/drivers/net/wireless/bcmdhd/include/miniopt.h
index 055ba92..c1eca68 100644
--- a/drivers/net/wireless/bcmdhd/src/include/miniopt.h
+++ b/drivers/net/wireless/bcmdhd/include/miniopt.h
@@ -1,14 +1,14 @@
/*
* Command line options parser.
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,7 +16,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
diff --git a/drivers/net/wireless/bcmdhd/src/include/msgtrace.h b/drivers/net/wireless/bcmdhd/include/msgtrace.h
index 348f62d..7c5fd81 100644
--- a/drivers/net/wireless/bcmdhd/src/include/msgtrace.h
+++ b/drivers/net/wireless/bcmdhd/include/msgtrace.h
@@ -1,14 +1,14 @@
/*
* Trace messages sent over HBUS
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,7 +16,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
@@ -49,7 +49,7 @@ typedef BWL_PRE_PACKED_STRUCT struct msgtrace_hdr {
uint32 discarded_printf; /* Number of discarded printf because of trace overflow */
} BWL_POST_PACKED_STRUCT msgtrace_hdr_t;
-#define MSGTRACE_HDRLEN sizeof(msgtrace_hdr_t)
+#define MSGTRACE_HDRLEN sizeof(msgtrace_hdr_t)
/* The hbus driver generates traces when sending a trace message. This causes endless traces.
* This flag must be set to TRUE in any hbus traces. The flag is reset in the function msgtrace_put.
diff --git a/drivers/net/wireless/bcmdhd/src/include/osl.h b/drivers/net/wireless/bcmdhd/include/osl.h
index 85bd25b..ca171d8 100644
--- a/drivers/net/wireless/bcmdhd/src/include/osl.h
+++ b/drivers/net/wireless/bcmdhd/include/osl.h
@@ -1,14 +1,14 @@
/*
* OS Abstraction Layer
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,12 +16,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: osl.h 301926 2011-12-09 02:00:46Z $
+ * $Id: osl.h 320905 2012-03-13 15:33:25Z $
*/
#ifndef _osl_h_
@@ -31,7 +31,7 @@
typedef struct osl_info osl_t;
typedef struct osl_dmainfo osldma_t;
-#define OSL_PKTTAG_SZ 32
+#define OSL_PKTTAG_SZ 32
typedef void (*pktfree_cb_fn_t)(void *ctx, void *pkt, unsigned int status);
@@ -55,17 +55,34 @@ typedef void (*osl_wreg_fn_t)(void *ctx, volatile void *reg, unsigned int val,
#ifndef AND_REG
#define AND_REG(osh, r, v) W_REG(osh, (r), R_REG(osh, r) & (v))
-#endif
+#endif
#ifndef OR_REG
#define OR_REG(osh, r, v) W_REG(osh, (r), R_REG(osh, r) | (v))
-#endif
+#endif
#if !defined(OSL_SYSUPTIME)
#define OSL_SYSUPTIME() (0)
#define OSL_SYSUPTIME_SUPPORT FALSE
#else
#define OSL_SYSUPTIME_SUPPORT TRUE
+#endif
+
+#if !defined(PKTC)
+#define PKTCCNT(skb) (0)
+#define PKTCLEN(skb) (0)
+#define PKTCFLAGS(skb) (0)
+#define PKTCSETCNT(skb, c)
+#define PKTCSETLEN(skb, l)
+#define PKTCSETFLAG(skb, fb)
+#define PKTCCLRFLAG(skb, fb)
+#define PKTCLINK(skb) PKTLINK(skb)
+#define PKTSETCLINK(skb, x) PKTSETLINK((skb), (x))
+#define PKTISCHAINED(skb) FALSE
+#define FOREACH_CHAINED_PKT(skb, nskb) \
+ for ((nskb) = NULL; (skb) != NULL; (skb) = (nskb))
+#define PKTCFREE PKTFREE
#endif
-#endif
+
+#endif
diff --git a/drivers/net/wireless/bcmdhd/src/include/packed_section_end.h b/drivers/net/wireless/bcmdhd/include/packed_section_end.h
index 9b7ff57..24ff467 100644
--- a/drivers/net/wireless/bcmdhd/src/include/packed_section_end.h
+++ b/drivers/net/wireless/bcmdhd/include/packed_section_end.h
@@ -15,14 +15,14 @@
* #include <packed_section_end.h>
*
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -30,7 +30,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
diff --git a/drivers/net/wireless/bcmdhd/src/include/packed_section_start.h b/drivers/net/wireless/bcmdhd/include/packed_section_start.h
index 7aea56f..7fce0dd 100644
--- a/drivers/net/wireless/bcmdhd/src/include/packed_section_start.h
+++ b/drivers/net/wireless/bcmdhd/include/packed_section_start.h
@@ -15,14 +15,14 @@
* #include <packed_section_end.h>
*
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -30,7 +30,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
diff --git a/drivers/net/wireless/bcmdhd/src/include/pcicfg.h b/drivers/net/wireless/bcmdhd/include/pcicfg.h
index 8a5d996..5f7df6a 100644
--- a/drivers/net/wireless/bcmdhd/src/include/pcicfg.h
+++ b/drivers/net/wireless/bcmdhd/include/pcicfg.h
@@ -1,14 +1,14 @@
/*
* pcicfg.h: PCI configuration constants and structures.
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,12 +16,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: pcicfg.h 296577 2011-11-16 03:09:51Z $
+ * $Id: pcicfg.h 309193 2012-01-19 00:03:57Z $
*/
#ifndef _h_pcicfg_
@@ -55,36 +55,36 @@
#define PCI_CFG_PIN 0x3d
#define PCI_CFG_MINGNT 0x3e
#define PCI_CFG_MAXLAT 0x3f
-#define PCI_BAR0_WIN 0x80
-#define PCI_BAR1_WIN 0x84
-#define PCI_SPROM_CONTROL 0x88
-#define PCI_BAR1_CONTROL 0x8c
-#define PCI_INT_STATUS 0x90
-#define PCI_INT_MASK 0x94
-#define PCI_TO_SB_MB 0x98
-#define PCI_BACKPLANE_ADDR 0xa0
-#define PCI_BACKPLANE_DATA 0xa4
-#define PCI_CLK_CTL_ST 0xa8
-#define PCI_BAR0_WIN2 0xac
-#define PCI_GPIO_IN 0xb0
-#define PCI_GPIO_OUT 0xb4
-#define PCI_GPIO_OUTEN 0xb8
+#define PCI_BAR0_WIN 0x80
+#define PCI_BAR1_WIN 0x84
+#define PCI_SPROM_CONTROL 0x88
+#define PCI_BAR1_CONTROL 0x8c
+#define PCI_INT_STATUS 0x90
+#define PCI_INT_MASK 0x94
+#define PCI_TO_SB_MB 0x98
+#define PCI_BACKPLANE_ADDR 0xa0
+#define PCI_BACKPLANE_DATA 0xa4
+#define PCI_CLK_CTL_ST 0xa8
+#define PCI_BAR0_WIN2 0xac
+#define PCI_GPIO_IN 0xb0
+#define PCI_GPIO_OUT 0xb4
+#define PCI_GPIO_OUTEN 0xb8
-#define PCI_BAR0_SHADOW_OFFSET (2 * 1024)
-#define PCI_BAR0_SPROM_OFFSET (4 * 1024)
-#define PCI_BAR0_PCIREGS_OFFSET (6 * 1024)
-#define PCI_BAR0_PCISBR_OFFSET (4 * 1024)
+#define PCI_BAR0_SHADOW_OFFSET (2 * 1024)
+#define PCI_BAR0_SPROM_OFFSET (4 * 1024)
+#define PCI_BAR0_PCIREGS_OFFSET (6 * 1024)
+#define PCI_BAR0_PCISBR_OFFSET (4 * 1024)
-#define PCIE2_BAR0_WIN2 0x70
-#define PCIE2_BAR0_CORE2_WIN 0x74
-#define PCIE2_BAR0_CORE2_WIN2 0x78
+#define PCIE2_BAR0_WIN2 0x70
+#define PCIE2_BAR0_CORE2_WIN 0x74
+#define PCIE2_BAR0_CORE2_WIN2 0x78
-#define PCI_BAR0_WINSZ (16 * 1024)
+#define PCI_BAR0_WINSZ (16 * 1024)
-#define PCI_16KB0_PCIREGS_OFFSET (8 * 1024)
-#define PCI_16KB0_CCREGS_OFFSET (12 * 1024)
-#define PCI_16KBB0_WINSZ (16 * 1024)
+#define PCI_16KB0_PCIREGS_OFFSET (8 * 1024)
+#define PCI_16KB0_CCREGS_OFFSET (12 * 1024)
+#define PCI_16KBB0_WINSZ (16 * 1024)
#define PCI_CONFIG_SPACE_SIZE 256
-#endif
+#endif
diff --git a/drivers/net/wireless/bcmdhd/include/proto/802.11.h b/drivers/net/wireless/bcmdhd/include/proto/802.11.h
new file mode 100644
index 0000000..1632e7d
--- /dev/null
+++ b/drivers/net/wireless/bcmdhd/include/proto/802.11.h
@@ -0,0 +1,2254 @@
+/*
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
+ * Unless you and Broadcom execute a separate written software license
+ * agreement governing use of this software, this software is licensed to you
+ * under the terms of the GNU General Public License version 2 (the "GPL"),
+ * available at http://www.broadcom.com/licenses/GPLv2.php, with the
+ * following added to such license:
+ *
+ * As a special exception, the copyright holders of this software give you
+ * permission to link this software with independent modules, and to copy and
+ * distribute the resulting executable under terms of your choice, provided that
+ * you also meet, for each linked independent module, the terms and conditions of
+ * the license of that module. An independent module is a module which is not
+ * derived from this software. The special exception does not apply to any
+ * modifications of the software.
+ *
+ * Notwithstanding the above, under no circumstances may you combine this
+ * software in any way with any other Broadcom software provided under a license
+ * other than the GPL, without Broadcom's express prior written consent.
+ *
+ * Fundamental types and constants relating to 802.11
+ *
+ * $Id: 802.11.h 346820 2012-07-24 13:53:12Z $
+ */
+
+#ifndef _802_11_H_
+#define _802_11_H_
+
+#ifndef _TYPEDEFS_H_
+#include <typedefs.h>
+#endif
+
+#ifndef _NET_ETHERNET_H_
+#include <proto/ethernet.h>
+#endif
+
+#include <proto/wpa.h>
+
+
+#include <packed_section_start.h>
+
+
+#define DOT11_TU_TO_US 1024
+
+
+#define DOT11_A3_HDR_LEN 24
+#define DOT11_A4_HDR_LEN 30
+#define DOT11_MAC_HDR_LEN DOT11_A3_HDR_LEN
+#define DOT11_FCS_LEN 4
+#define DOT11_ICV_LEN 4
+#define DOT11_ICV_AES_LEN 8
+#define DOT11_QOS_LEN 2
+#define DOT11_HTC_LEN 4
+
+#define DOT11_KEY_INDEX_SHIFT 6
+#define DOT11_IV_LEN 4
+#define DOT11_IV_TKIP_LEN 8
+#define DOT11_IV_AES_OCB_LEN 4
+#define DOT11_IV_AES_CCM_LEN 8
+#define DOT11_IV_MAX_LEN 8
+
+
+#define DOT11_MAX_MPDU_BODY_LEN 2304
+
+#define DOT11_MAX_MPDU_LEN (DOT11_A4_HDR_LEN + \
+ DOT11_QOS_LEN + \
+ DOT11_IV_AES_CCM_LEN + \
+ DOT11_MAX_MPDU_BODY_LEN + \
+ DOT11_ICV_LEN + \
+ DOT11_FCS_LEN)
+
+#define DOT11_MAX_SSID_LEN 32
+
+
+#define DOT11_DEFAULT_RTS_LEN 2347
+#define DOT11_MAX_RTS_LEN 2347
+
+
+#define DOT11_MIN_FRAG_LEN 256
+#define DOT11_MAX_FRAG_LEN 2346
+#define DOT11_DEFAULT_FRAG_LEN 2346
+
+
+#define DOT11_MIN_BEACON_PERIOD 1
+#define DOT11_MAX_BEACON_PERIOD 0xFFFF
+
+
+#define DOT11_MIN_DTIM_PERIOD 1
+#define DOT11_MAX_DTIM_PERIOD 0xFF
+
+
+#define DOT11_LLC_SNAP_HDR_LEN 8
+#define DOT11_OUI_LEN 3
+BWL_PRE_PACKED_STRUCT struct dot11_llc_snap_header {
+ uint8 dsap;
+ uint8 ssap;
+ uint8 ctl;
+ uint8 oui[DOT11_OUI_LEN];
+ uint16 type;
+} BWL_POST_PACKED_STRUCT;
+
+
+#define RFC1042_HDR_LEN (ETHER_HDR_LEN + DOT11_LLC_SNAP_HDR_LEN)
+
+
+
+BWL_PRE_PACKED_STRUCT struct dot11_header {
+ uint16 fc;
+ uint16 durid;
+ struct ether_addr a1;
+ struct ether_addr a2;
+ struct ether_addr a3;
+ uint16 seq;
+ struct ether_addr a4;
+} BWL_POST_PACKED_STRUCT;
+
+
+
+BWL_PRE_PACKED_STRUCT struct dot11_rts_frame {
+ uint16 fc;
+ uint16 durid;
+ struct ether_addr ra;
+ struct ether_addr ta;
+} BWL_POST_PACKED_STRUCT;
+#define DOT11_RTS_LEN 16
+
+BWL_PRE_PACKED_STRUCT struct dot11_cts_frame {
+ uint16 fc;
+ uint16 durid;
+ struct ether_addr ra;
+} BWL_POST_PACKED_STRUCT;
+#define DOT11_CTS_LEN 10
+
+BWL_PRE_PACKED_STRUCT struct dot11_ack_frame {
+ uint16 fc;
+ uint16 durid;
+ struct ether_addr ra;
+} BWL_POST_PACKED_STRUCT;
+#define DOT11_ACK_LEN 10
+
+BWL_PRE_PACKED_STRUCT struct dot11_ps_poll_frame {
+ uint16 fc;
+ uint16 durid;
+ struct ether_addr bssid;
+ struct ether_addr ta;
+} BWL_POST_PACKED_STRUCT;
+#define DOT11_PS_POLL_LEN 16
+
+BWL_PRE_PACKED_STRUCT struct dot11_cf_end_frame {
+ uint16 fc;
+ uint16 durid;
+ struct ether_addr ra;
+ struct ether_addr bssid;
+} BWL_POST_PACKED_STRUCT;
+#define DOT11_CS_END_LEN 16
+
+
+BWL_PRE_PACKED_STRUCT struct dot11_action_wifi_vendor_specific {
+ uint8 category;
+ uint8 OUI[3];
+ uint8 type;
+ uint8 subtype;
+ uint8 data[1040];
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_action_wifi_vendor_specific dot11_action_wifi_vendor_specific_t;
+
+
+BWL_PRE_PACKED_STRUCT struct dot11_action_vs_frmhdr {
+ uint8 category;
+ uint8 OUI[3];
+ uint8 type;
+ uint8 subtype;
+ uint8 data[1];
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_action_vs_frmhdr dot11_action_vs_frmhdr_t;
+#define DOT11_ACTION_VS_HDR_LEN 6
+
+#define BCM_ACTION_OUI_BYTE0 0x00
+#define BCM_ACTION_OUI_BYTE1 0x90
+#define BCM_ACTION_OUI_BYTE2 0x4c
+
+
+#define DOT11_BA_CTL_POLICY_NORMAL 0x0000
+#define DOT11_BA_CTL_POLICY_NOACK 0x0001
+#define DOT11_BA_CTL_POLICY_MASK 0x0001
+
+#define DOT11_BA_CTL_MTID 0x0002
+#define DOT11_BA_CTL_COMPRESSED 0x0004
+
+#define DOT11_BA_CTL_NUMMSDU_MASK 0x0FC0
+#define DOT11_BA_CTL_NUMMSDU_SHIFT 6
+
+#define DOT11_BA_CTL_TID_MASK 0xF000
+#define DOT11_BA_CTL_TID_SHIFT 12
+
+
+BWL_PRE_PACKED_STRUCT struct dot11_ctl_header {
+ uint16 fc;
+ uint16 durid;
+ struct ether_addr ra;
+ struct ether_addr ta;
+} BWL_POST_PACKED_STRUCT;
+#define DOT11_CTL_HDR_LEN 16
+
+
+BWL_PRE_PACKED_STRUCT struct dot11_bar {
+ uint16 bar_control;
+ uint16 seqnum;
+} BWL_POST_PACKED_STRUCT;
+#define DOT11_BAR_LEN 4
+
+#define DOT11_BA_BITMAP_LEN 128
+#define DOT11_BA_CMP_BITMAP_LEN 8
+
+BWL_PRE_PACKED_STRUCT struct dot11_ba {
+ uint16 ba_control;
+ uint16 seqnum;
+ uint8 bitmap[DOT11_BA_BITMAP_LEN];
+} BWL_POST_PACKED_STRUCT;
+#define DOT11_BA_LEN 4
+
+
+BWL_PRE_PACKED_STRUCT struct dot11_management_header {
+ uint16 fc;
+ uint16 durid;
+ struct ether_addr da;
+ struct ether_addr sa;
+ struct ether_addr bssid;
+ uint16 seq;
+} BWL_POST_PACKED_STRUCT;
+#define DOT11_MGMT_HDR_LEN 24
+
+
+
+BWL_PRE_PACKED_STRUCT struct dot11_bcn_prb {
+ uint32 timestamp[2];
+ uint16 beacon_interval;
+ uint16 capability;
+} BWL_POST_PACKED_STRUCT;
+#define DOT11_BCN_PRB_LEN 12
+#define DOT11_BCN_PRB_FIXED_LEN 12
+
+BWL_PRE_PACKED_STRUCT struct dot11_auth {
+ uint16 alg;
+ uint16 seq;
+ uint16 status;
+} BWL_POST_PACKED_STRUCT;
+#define DOT11_AUTH_FIXED_LEN 6
+
+BWL_PRE_PACKED_STRUCT struct dot11_assoc_req {
+ uint16 capability;
+ uint16 listen;
+} BWL_POST_PACKED_STRUCT;
+#define DOT11_ASSOC_REQ_FIXED_LEN 4
+
+BWL_PRE_PACKED_STRUCT struct dot11_reassoc_req {
+ uint16 capability;
+ uint16 listen;
+ struct ether_addr ap;
+} BWL_POST_PACKED_STRUCT;
+#define DOT11_REASSOC_REQ_FIXED_LEN 10
+
+BWL_PRE_PACKED_STRUCT struct dot11_assoc_resp {
+ uint16 capability;
+ uint16 status;
+ uint16 aid;
+} BWL_POST_PACKED_STRUCT;
+#define DOT11_ASSOC_RESP_FIXED_LEN 6
+
+BWL_PRE_PACKED_STRUCT struct dot11_action_measure {
+ uint8 category;
+ uint8 action;
+ uint8 token;
+ uint8 data[1];
+} BWL_POST_PACKED_STRUCT;
+#define DOT11_ACTION_MEASURE_LEN 3
+
+BWL_PRE_PACKED_STRUCT struct dot11_action_ht_ch_width {
+ uint8 category;
+ uint8 action;
+ uint8 ch_width;
+} BWL_POST_PACKED_STRUCT;
+
+BWL_PRE_PACKED_STRUCT struct dot11_action_ht_mimops {
+ uint8 category;
+ uint8 action;
+ uint8 control;
+} BWL_POST_PACKED_STRUCT;
+
+BWL_PRE_PACKED_STRUCT struct dot11_action_sa_query {
+ uint8 category;
+ uint8 action;
+ uint16 id;
+} BWL_POST_PACKED_STRUCT;
+
+#define SM_PWRSAVE_ENABLE 1
+#define SM_PWRSAVE_MODE 2
+
+
+BWL_PRE_PACKED_STRUCT struct dot11_power_cnst {
+ uint8 id;
+ uint8 len;
+ uint8 power;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_power_cnst dot11_power_cnst_t;
+
+BWL_PRE_PACKED_STRUCT struct dot11_power_cap {
+ uint8 min;
+ uint8 max;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_power_cap dot11_power_cap_t;
+
+BWL_PRE_PACKED_STRUCT struct dot11_tpc_rep {
+ uint8 id;
+ uint8 len;
+ uint8 tx_pwr;
+ uint8 margin;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_tpc_rep dot11_tpc_rep_t;
+#define DOT11_MNG_IE_TPC_REPORT_LEN 2
+
+BWL_PRE_PACKED_STRUCT struct dot11_supp_channels {
+ uint8 id;
+ uint8 len;
+ uint8 first_channel;
+ uint8 num_channels;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_supp_channels dot11_supp_channels_t;
+
+
+BWL_PRE_PACKED_STRUCT struct dot11_extch {
+ uint8 id;
+ uint8 len;
+ uint8 extch;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_extch dot11_extch_ie_t;
+
+BWL_PRE_PACKED_STRUCT struct dot11_brcm_extch {
+ uint8 id;
+ uint8 len;
+ uint8 oui[3];
+ uint8 type;
+ uint8 extch;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_brcm_extch dot11_brcm_extch_ie_t;
+
+#define BRCM_EXTCH_IE_LEN 5
+#define BRCM_EXTCH_IE_TYPE 53
+#define DOT11_EXTCH_IE_LEN 1
+#define DOT11_EXT_CH_MASK 0x03
+#define DOT11_EXT_CH_UPPER 0x01
+#define DOT11_EXT_CH_LOWER 0x03
+#define DOT11_EXT_CH_NONE 0x00
+
+BWL_PRE_PACKED_STRUCT struct dot11_action_frmhdr {
+ uint8 category;
+ uint8 action;
+ uint8 data[1];
+} BWL_POST_PACKED_STRUCT;
+#define DOT11_ACTION_FRMHDR_LEN 2
+
+
+BWL_PRE_PACKED_STRUCT struct dot11_channel_switch {
+ uint8 id;
+ uint8 len;
+ uint8 mode;
+ uint8 channel;
+ uint8 count;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_channel_switch dot11_chan_switch_ie_t;
+
+#define DOT11_SWITCH_IE_LEN 3
+
+#define DOT11_CSA_MODE_ADVISORY 0
+#define DOT11_CSA_MODE_NO_TX 1
+
+BWL_PRE_PACKED_STRUCT struct dot11_action_switch_channel {
+ uint8 category;
+ uint8 action;
+ dot11_chan_switch_ie_t chan_switch_ie;
+ dot11_brcm_extch_ie_t extch_ie;
+} BWL_POST_PACKED_STRUCT;
+
+BWL_PRE_PACKED_STRUCT struct dot11_csa_body {
+ uint8 mode;
+ uint8 reg;
+ uint8 channel;
+ uint8 count;
+} BWL_POST_PACKED_STRUCT;
+
+
+BWL_PRE_PACKED_STRUCT struct dot11_ext_csa {
+ uint8 id;
+ uint8 len;
+ struct dot11_csa_body b;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_ext_csa dot11_ext_csa_ie_t;
+#define DOT11_EXT_CSA_IE_LEN 4
+
+BWL_PRE_PACKED_STRUCT struct dot11_action_ext_csa {
+ uint8 category;
+ uint8 action;
+ dot11_ext_csa_ie_t chan_switch_ie;
+} BWL_POST_PACKED_STRUCT;
+
+BWL_PRE_PACKED_STRUCT struct dot11y_action_ext_csa {
+ uint8 category;
+ uint8 action;
+ struct dot11_csa_body b;
+} BWL_POST_PACKED_STRUCT;
+
+BWL_PRE_PACKED_STRUCT struct dot11_obss_coex {
+ uint8 id;
+ uint8 len;
+ uint8 info;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_obss_coex dot11_obss_coex_t;
+#define DOT11_OBSS_COEXINFO_LEN 1
+
+#define DOT11_OBSS_COEX_INFO_REQ 0x01
+#define DOT11_OBSS_COEX_40MHZ_INTOLERANT 0x02
+#define DOT11_OBSS_COEX_20MHZ_WIDTH_REQ 0x04
+
+BWL_PRE_PACKED_STRUCT struct dot11_obss_chanlist {
+ uint8 id;
+ uint8 len;
+ uint8 regclass;
+ uint8 chanlist[1];
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_obss_chanlist dot11_obss_chanlist_t;
+#define DOT11_OBSS_CHANLIST_FIXED_LEN 1
+
+BWL_PRE_PACKED_STRUCT struct dot11_extcap_ie {
+ uint8 id;
+ uint8 len;
+ uint8 cap[1];
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_extcap_ie dot11_extcap_ie_t;
+
+#define DOT11_EXTCAP_LEN_MAX 7
+#define DOT11_EXTCAP_LEN_COEX 1
+#define DOT11_EXTCAP_LEN_BT 3
+#define DOT11_EXTCAP_LEN_IW 4
+#define DOT11_EXTCAP_LEN_SI 6
+
+#define DOT11_EXTCAP_LEN_TDLS 5
+BWL_PRE_PACKED_STRUCT struct dot11_extcap {
+ uint8 extcap[DOT11_EXTCAP_LEN_TDLS];
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_extcap dot11_extcap_t;
+
+
+#define TDLS_CAP_TDLS 37
+#define TDLS_CAP_PU_BUFFER_STA 28
+#define TDLS_CAP_PEER_PSM 20
+#define TDLS_CAP_CH_SW 30
+#define TDLS_CAP_PROH 38
+#define TDLS_CAP_CH_SW_PROH 39
+
+#define TDLS_CAP_MAX_BIT 39
+
+
+
+#define DOT11_MEASURE_TYPE_BASIC 0
+#define DOT11_MEASURE_TYPE_CCA 1
+#define DOT11_MEASURE_TYPE_RPI 2
+#define DOT11_MEASURE_TYPE_CHLOAD 3
+#define DOT11_MEASURE_TYPE_NOISE 4
+#define DOT11_MEASURE_TYPE_BEACON 5
+#define DOT11_MEASURE_TYPE_FRAME 6
+#define DOT11_MEASURE_TYPE_STATS 7
+#define DOT11_MEASURE_TYPE_LCI 8
+#define DOT11_MEASURE_TYPE_TXSTREAM 9
+#define DOT11_MEASURE_TYPE_PAUSE 255
+
+
+#define DOT11_MEASURE_MODE_PARALLEL (1<<0)
+#define DOT11_MEASURE_MODE_ENABLE (1<<1)
+#define DOT11_MEASURE_MODE_REQUEST (1<<2)
+#define DOT11_MEASURE_MODE_REPORT (1<<3)
+#define DOT11_MEASURE_MODE_DUR (1<<4)
+
+#define DOT11_MEASURE_MODE_LATE (1<<0)
+#define DOT11_MEASURE_MODE_INCAPABLE (1<<1)
+#define DOT11_MEASURE_MODE_REFUSED (1<<2)
+
+#define DOT11_MEASURE_BASIC_MAP_BSS ((uint8)(1<<0))
+#define DOT11_MEASURE_BASIC_MAP_OFDM ((uint8)(1<<1))
+#define DOT11_MEASURE_BASIC_MAP_UKNOWN ((uint8)(1<<2))
+#define DOT11_MEASURE_BASIC_MAP_RADAR ((uint8)(1<<3))
+#define DOT11_MEASURE_BASIC_MAP_UNMEAS ((uint8)(1<<4))
+
+BWL_PRE_PACKED_STRUCT struct dot11_meas_req {
+ uint8 id;
+ uint8 len;
+ uint8 token;
+ uint8 mode;
+ uint8 type;
+ uint8 channel;
+ uint8 start_time[8];
+ uint16 duration;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_meas_req dot11_meas_req_t;
+#define DOT11_MNG_IE_MREQ_LEN 14
+
+#define DOT11_MNG_IE_MREQ_FIXED_LEN 3
+
+BWL_PRE_PACKED_STRUCT struct dot11_meas_rep {
+ uint8 id;
+ uint8 len;
+ uint8 token;
+ uint8 mode;
+ uint8 type;
+ BWL_PRE_PACKED_STRUCT union
+ {
+ BWL_PRE_PACKED_STRUCT struct {
+ uint8 channel;
+ uint8 start_time[8];
+ uint16 duration;
+ uint8 map;
+ } BWL_POST_PACKED_STRUCT basic;
+ uint8 data[1];
+ } BWL_POST_PACKED_STRUCT rep;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_meas_rep dot11_meas_rep_t;
+
+
+#define DOT11_MNG_IE_MREP_FIXED_LEN 3
+
+BWL_PRE_PACKED_STRUCT struct dot11_meas_rep_basic {
+ uint8 channel;
+ uint8 start_time[8];
+ uint16 duration;
+ uint8 map;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_meas_rep_basic dot11_meas_rep_basic_t;
+#define DOT11_MEASURE_BASIC_REP_LEN 12
+
+BWL_PRE_PACKED_STRUCT struct dot11_quiet {
+ uint8 id;
+ uint8 len;
+ uint8 count;
+ uint8 period;
+ uint16 duration;
+ uint16 offset;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_quiet dot11_quiet_t;
+
+BWL_PRE_PACKED_STRUCT struct chan_map_tuple {
+ uint8 channel;
+ uint8 map;
+} BWL_POST_PACKED_STRUCT;
+typedef struct chan_map_tuple chan_map_tuple_t;
+
+BWL_PRE_PACKED_STRUCT struct dot11_ibss_dfs {
+ uint8 id;
+ uint8 len;
+ uint8 eaddr[ETHER_ADDR_LEN];
+ uint8 interval;
+ chan_map_tuple_t map[1];
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_ibss_dfs dot11_ibss_dfs_t;
+
+
+#define WME_OUI "\x00\x50\xf2"
+#define WME_OUI_LEN 3
+#define WME_OUI_TYPE 2
+#define WME_TYPE 2
+#define WME_SUBTYPE_IE 0
+#define WME_SUBTYPE_PARAM_IE 1
+#define WME_SUBTYPE_TSPEC 2
+#define WME_VER 1
+
+
+#define AC_BE 0
+#define AC_BK 1
+#define AC_VI 2
+#define AC_VO 3
+#define AC_COUNT 4
+
+typedef uint8 ac_bitmap_t;
+
+#define AC_BITMAP_NONE 0x0
+#define AC_BITMAP_ALL 0xf
+#define AC_BITMAP_TST(ab, ac) (((ab) & (1 << (ac))) != 0)
+#define AC_BITMAP_SET(ab, ac) (((ab) |= (1 << (ac))))
+#define AC_BITMAP_RESET(ab, ac) (((ab) &= ~(1 << (ac))))
+
+
+BWL_PRE_PACKED_STRUCT struct wme_ie {
+ uint8 oui[3];
+ uint8 type;
+ uint8 subtype;
+ uint8 version;
+ uint8 qosinfo;
+} BWL_POST_PACKED_STRUCT;
+typedef struct wme_ie wme_ie_t;
+#define WME_IE_LEN 7
+
+BWL_PRE_PACKED_STRUCT struct edcf_acparam {
+ uint8 ACI;
+ uint8 ECW;
+ uint16 TXOP;
+} BWL_POST_PACKED_STRUCT;
+typedef struct edcf_acparam edcf_acparam_t;
+
+
+BWL_PRE_PACKED_STRUCT struct wme_param_ie {
+ uint8 oui[3];
+ uint8 type;
+ uint8 subtype;
+ uint8 version;
+ uint8 qosinfo;
+ uint8 rsvd;
+ edcf_acparam_t acparam[AC_COUNT];
+} BWL_POST_PACKED_STRUCT;
+typedef struct wme_param_ie wme_param_ie_t;
+#define WME_PARAM_IE_LEN 24
+
+
+#define WME_QI_AP_APSD_MASK 0x80
+#define WME_QI_AP_APSD_SHIFT 7
+#define WME_QI_AP_COUNT_MASK 0x0f
+#define WME_QI_AP_COUNT_SHIFT 0
+
+
+#define WME_QI_STA_MAXSPLEN_MASK 0x60
+#define WME_QI_STA_MAXSPLEN_SHIFT 5
+#define WME_QI_STA_APSD_ALL_MASK 0xf
+#define WME_QI_STA_APSD_ALL_SHIFT 0
+#define WME_QI_STA_APSD_BE_MASK 0x8
+#define WME_QI_STA_APSD_BE_SHIFT 3
+#define WME_QI_STA_APSD_BK_MASK 0x4
+#define WME_QI_STA_APSD_BK_SHIFT 2
+#define WME_QI_STA_APSD_VI_MASK 0x2
+#define WME_QI_STA_APSD_VI_SHIFT 1
+#define WME_QI_STA_APSD_VO_MASK 0x1
+#define WME_QI_STA_APSD_VO_SHIFT 0
+
+
+#define EDCF_AIFSN_MIN 1
+#define EDCF_AIFSN_MAX 15
+#define EDCF_AIFSN_MASK 0x0f
+#define EDCF_ACM_MASK 0x10
+#define EDCF_ACI_MASK 0x60
+#define EDCF_ACI_SHIFT 5
+#define EDCF_AIFSN_SHIFT 12
+
+
+#define EDCF_ECW_MIN 0
+#define EDCF_ECW_MAX 15
+#define EDCF_ECW2CW(exp) ((1 << (exp)) - 1)
+#define EDCF_ECWMIN_MASK 0x0f
+#define EDCF_ECWMAX_MASK 0xf0
+#define EDCF_ECWMAX_SHIFT 4
+
+
+#define EDCF_TXOP_MIN 0
+#define EDCF_TXOP_MAX 65535
+#define EDCF_TXOP2USEC(txop) ((txop) << 5)
+
+
+#define NON_EDCF_AC_BE_ACI_STA 0x02
+
+
+#define EDCF_AC_BE_ACI_STA 0x03
+#define EDCF_AC_BE_ECW_STA 0xA4
+#define EDCF_AC_BE_TXOP_STA 0x0000
+#define EDCF_AC_BK_ACI_STA 0x27
+#define EDCF_AC_BK_ECW_STA 0xA4
+#define EDCF_AC_BK_TXOP_STA 0x0000
+#define EDCF_AC_VI_ACI_STA 0x42
+#define EDCF_AC_VI_ECW_STA 0x43
+#define EDCF_AC_VI_TXOP_STA 0x005e
+#define EDCF_AC_VO_ACI_STA 0x62
+#define EDCF_AC_VO_ECW_STA 0x32
+#define EDCF_AC_VO_TXOP_STA 0x002f
+
+
+#define EDCF_AC_BE_ACI_AP 0x03
+#define EDCF_AC_BE_ECW_AP 0x64
+#define EDCF_AC_BE_TXOP_AP 0x0000
+#define EDCF_AC_BK_ACI_AP 0x27
+#define EDCF_AC_BK_ECW_AP 0xA4
+#define EDCF_AC_BK_TXOP_AP 0x0000
+#define EDCF_AC_VI_ACI_AP 0x41
+#define EDCF_AC_VI_ECW_AP 0x43
+#define EDCF_AC_VI_TXOP_AP 0x005e
+#define EDCF_AC_VO_ACI_AP 0x61
+#define EDCF_AC_VO_ECW_AP 0x32
+#define EDCF_AC_VO_TXOP_AP 0x002f
+
+
+BWL_PRE_PACKED_STRUCT struct edca_param_ie {
+ uint8 qosinfo;
+ uint8 rsvd;
+ edcf_acparam_t acparam[AC_COUNT];
+} BWL_POST_PACKED_STRUCT;
+typedef struct edca_param_ie edca_param_ie_t;
+#define EDCA_PARAM_IE_LEN 18
+
+
+BWL_PRE_PACKED_STRUCT struct qos_cap_ie {
+ uint8 qosinfo;
+} BWL_POST_PACKED_STRUCT;
+typedef struct qos_cap_ie qos_cap_ie_t;
+
+BWL_PRE_PACKED_STRUCT struct dot11_qbss_load_ie {
+ uint8 id;
+ uint8 length;
+ uint16 station_count;
+ uint8 channel_utilization;
+ uint16 aac;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_qbss_load_ie dot11_qbss_load_ie_t;
+#define BSS_LOAD_IE_SIZE 7
+
+
+#define FIXED_MSDU_SIZE 0x8000
+#define MSDU_SIZE_MASK 0x7fff
+
+
+
+#define INTEGER_SHIFT 13
+#define FRACTION_MASK 0x1FFF
+
+
+BWL_PRE_PACKED_STRUCT struct dot11_management_notification {
+ uint8 category;
+ uint8 action;
+ uint8 token;
+ uint8 status;
+ uint8 data[1];
+} BWL_POST_PACKED_STRUCT;
+#define DOT11_MGMT_NOTIFICATION_LEN 4
+
+
+BWL_PRE_PACKED_STRUCT struct ti_ie {
+ uint8 ti_type;
+ uint32 ti_val;
+} BWL_POST_PACKED_STRUCT;
+typedef struct ti_ie ti_ie_t;
+#define TI_TYPE_REASSOC_DEADLINE 1
+#define TI_TYPE_KEY_LIFETIME 2
+
+
+#define WME_ADDTS_REQUEST 0
+#define WME_ADDTS_RESPONSE 1
+#define WME_DELTS_REQUEST 2
+
+
+#define WME_ADMISSION_ACCEPTED 0
+#define WME_INVALID_PARAMETERS 1
+#define WME_ADMISSION_REFUSED 3
+
+
+#define BCN_PRB_SSID(body) ((char*)(body) + DOT11_BCN_PRB_LEN)
+
+
+#define DOT11_OPEN_SYSTEM 0
+#define DOT11_SHARED_KEY 1
+#define DOT11_FAST_BSS 2
+#define DOT11_CHALLENGE_LEN 128
+
+
+#define FC_PVER_MASK 0x3
+#define FC_PVER_SHIFT 0
+#define FC_TYPE_MASK 0xC
+#define FC_TYPE_SHIFT 2
+#define FC_SUBTYPE_MASK 0xF0
+#define FC_SUBTYPE_SHIFT 4
+#define FC_TODS 0x100
+#define FC_TODS_SHIFT 8
+#define FC_FROMDS 0x200
+#define FC_FROMDS_SHIFT 9
+#define FC_MOREFRAG 0x400
+#define FC_MOREFRAG_SHIFT 10
+#define FC_RETRY 0x800
+#define FC_RETRY_SHIFT 11
+#define FC_PM 0x1000
+#define FC_PM_SHIFT 12
+#define FC_MOREDATA 0x2000
+#define FC_MOREDATA_SHIFT 13
+#define FC_WEP 0x4000
+#define FC_WEP_SHIFT 14
+#define FC_ORDER 0x8000
+#define FC_ORDER_SHIFT 15
+
+
+#define SEQNUM_SHIFT 4
+#define SEQNUM_MAX 0x1000
+#define FRAGNUM_MASK 0xF
+
+
+
+
+#define FC_TYPE_MNG 0
+#define FC_TYPE_CTL 1
+#define FC_TYPE_DATA 2
+
+
+#define FC_SUBTYPE_ASSOC_REQ 0
+#define FC_SUBTYPE_ASSOC_RESP 1
+#define FC_SUBTYPE_REASSOC_REQ 2
+#define FC_SUBTYPE_REASSOC_RESP 3
+#define FC_SUBTYPE_PROBE_REQ 4
+#define FC_SUBTYPE_PROBE_RESP 5
+#define FC_SUBTYPE_BEACON 8
+#define FC_SUBTYPE_ATIM 9
+#define FC_SUBTYPE_DISASSOC 10
+#define FC_SUBTYPE_AUTH 11
+#define FC_SUBTYPE_DEAUTH 12
+#define FC_SUBTYPE_ACTION 13
+#define FC_SUBTYPE_ACTION_NOACK 14
+
+
+#define FC_SUBTYPE_CTL_WRAPPER 7
+#define FC_SUBTYPE_BLOCKACK_REQ 8
+#define FC_SUBTYPE_BLOCKACK 9
+#define FC_SUBTYPE_PS_POLL 10
+#define FC_SUBTYPE_RTS 11
+#define FC_SUBTYPE_CTS 12
+#define FC_SUBTYPE_ACK 13
+#define FC_SUBTYPE_CF_END 14
+#define FC_SUBTYPE_CF_END_ACK 15
+
+
+#define FC_SUBTYPE_DATA 0
+#define FC_SUBTYPE_DATA_CF_ACK 1
+#define FC_SUBTYPE_DATA_CF_POLL 2
+#define FC_SUBTYPE_DATA_CF_ACK_POLL 3
+#define FC_SUBTYPE_NULL 4
+#define FC_SUBTYPE_CF_ACK 5
+#define FC_SUBTYPE_CF_POLL 6
+#define FC_SUBTYPE_CF_ACK_POLL 7
+#define FC_SUBTYPE_QOS_DATA 8
+#define FC_SUBTYPE_QOS_DATA_CF_ACK 9
+#define FC_SUBTYPE_QOS_DATA_CF_POLL 10
+#define FC_SUBTYPE_QOS_DATA_CF_ACK_POLL 11
+#define FC_SUBTYPE_QOS_NULL 12
+#define FC_SUBTYPE_QOS_CF_POLL 14
+#define FC_SUBTYPE_QOS_CF_ACK_POLL 15
+
+
+#define FC_SUBTYPE_ANY_QOS(s) (((s) & 8) != 0)
+#define FC_SUBTYPE_ANY_NULL(s) (((s) & 4) != 0)
+#define FC_SUBTYPE_ANY_CF_POLL(s) (((s) & 2) != 0)
+#define FC_SUBTYPE_ANY_CF_ACK(s) (((s) & 1) != 0)
+
+
+#define FC_KIND_MASK (FC_TYPE_MASK | FC_SUBTYPE_MASK)
+
+#define FC_KIND(t, s) (((t) << FC_TYPE_SHIFT) | ((s) << FC_SUBTYPE_SHIFT))
+
+#define FC_SUBTYPE(fc) (((fc) & FC_SUBTYPE_MASK) >> FC_SUBTYPE_SHIFT)
+#define FC_TYPE(fc) (((fc) & FC_TYPE_MASK) >> FC_TYPE_SHIFT)
+
+#define FC_ASSOC_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ASSOC_REQ)
+#define FC_ASSOC_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ASSOC_RESP)
+#define FC_REASSOC_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_REASSOC_REQ)
+#define FC_REASSOC_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_REASSOC_RESP)
+#define FC_PROBE_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_REQ)
+#define FC_PROBE_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_RESP)
+#define FC_BEACON FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_BEACON)
+#define FC_DISASSOC FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_DISASSOC)
+#define FC_AUTH FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_AUTH)
+#define FC_DEAUTH FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_DEAUTH)
+#define FC_ACTION FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ACTION)
+#define FC_ACTION_NOACK FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ACTION_NOACK)
+
+#define FC_CTL_WRAPPER FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CTL_WRAPPER)
+#define FC_BLOCKACK_REQ FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_BLOCKACK_REQ)
+#define FC_BLOCKACK FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_BLOCKACK)
+#define FC_PS_POLL FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_PS_POLL)
+#define FC_RTS FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_RTS)
+#define FC_CTS FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CTS)
+#define FC_ACK FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_ACK)
+#define FC_CF_END FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CF_END)
+#define FC_CF_END_ACK FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CF_END_ACK)
+
+#define FC_DATA FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_DATA)
+#define FC_NULL_DATA FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_NULL)
+#define FC_DATA_CF_ACK FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_DATA_CF_ACK)
+#define FC_QOS_DATA FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_QOS_DATA)
+#define FC_QOS_NULL FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_QOS_NULL)
+
+
+
+
+#define QOS_PRIO_SHIFT 0
+#define QOS_PRIO_MASK 0x0007
+#define QOS_PRIO(qos) (((qos) & QOS_PRIO_MASK) >> QOS_PRIO_SHIFT)
+
+
+#define QOS_TID_SHIFT 0
+#define QOS_TID_MASK 0x000f
+#define QOS_TID(qos) (((qos) & QOS_TID_MASK) >> QOS_TID_SHIFT)
+
+
+#define QOS_EOSP_SHIFT 4
+#define QOS_EOSP_MASK 0x0010
+#define QOS_EOSP(qos) (((qos) & QOS_EOSP_MASK) >> QOS_EOSP_SHIFT)
+
+
+#define QOS_ACK_NORMAL_ACK 0
+#define QOS_ACK_NO_ACK 1
+#define QOS_ACK_NO_EXP_ACK 2
+#define QOS_ACK_BLOCK_ACK 3
+#define QOS_ACK_SHIFT 5
+#define QOS_ACK_MASK 0x0060
+#define QOS_ACK(qos) (((qos) & QOS_ACK_MASK) >> QOS_ACK_SHIFT)
+
+
+#define QOS_AMSDU_SHIFT 7
+#define QOS_AMSDU_MASK 0x0080
+
+
+
+
+
+
+#define DOT11_MNG_AUTH_ALGO_LEN 2
+#define DOT11_MNG_AUTH_SEQ_LEN 2
+#define DOT11_MNG_BEACON_INT_LEN 2
+#define DOT11_MNG_CAP_LEN 2
+#define DOT11_MNG_AP_ADDR_LEN 6
+#define DOT11_MNG_LISTEN_INT_LEN 2
+#define DOT11_MNG_REASON_LEN 2
+#define DOT11_MNG_AID_LEN 2
+#define DOT11_MNG_STATUS_LEN 2
+#define DOT11_MNG_TIMESTAMP_LEN 8
+
+
+#define DOT11_AID_MASK 0x3fff
+
+
+#define DOT11_RC_RESERVED 0
+#define DOT11_RC_UNSPECIFIED 1
+#define DOT11_RC_AUTH_INVAL 2
+#define DOT11_RC_DEAUTH_LEAVING 3
+#define DOT11_RC_INACTIVITY 4
+#define DOT11_RC_BUSY 5
+#define DOT11_RC_INVAL_CLASS_2 6
+#define DOT11_RC_INVAL_CLASS_3 7
+#define DOT11_RC_DISASSOC_LEAVING 8
+#define DOT11_RC_NOT_AUTH 9
+#define DOT11_RC_BAD_PC 10
+#define DOT11_RC_BAD_CHANNELS 11
+
+
+
+#define DOT11_RC_UNSPECIFIED_QOS 32
+#define DOT11_RC_INSUFFCIENT_BW 33
+#define DOT11_RC_EXCESSIVE_FRAMES 34
+#define DOT11_RC_TX_OUTSIDE_TXOP 35
+#define DOT11_RC_LEAVING_QBSS 36
+#define DOT11_RC_BAD_MECHANISM 37
+#define DOT11_RC_SETUP_NEEDED 38
+#define DOT11_RC_TIMEOUT 39
+
+#define DOT11_RC_MAX 23
+
+#define DOT11_RC_TDLS_PEER_UNREACH 25
+#define DOT11_RC_TDLS_DOWN_UNSPECIFIED 26
+
+
+#define DOT11_SC_SUCCESS 0
+#define DOT11_SC_FAILURE 1
+#define DOT11_SC_TDLS_WAKEUP_SCH_ALT 2
+
+#define DOT11_SC_TDLS_WAKEUP_SCH_REJ 3
+#define DOT11_SC_TDLS_SEC_DISABLED 5
+#define DOT11_SC_LIFETIME_REJ 6
+#define DOT11_SC_NOT_SAME_BSS 7
+#define DOT11_SC_CAP_MISMATCH 10
+#define DOT11_SC_REASSOC_FAIL 11
+#define DOT11_SC_ASSOC_FAIL 12
+#define DOT11_SC_AUTH_MISMATCH 13
+#define DOT11_SC_AUTH_SEQ 14
+#define DOT11_SC_AUTH_CHALLENGE_FAIL 15
+#define DOT11_SC_AUTH_TIMEOUT 16
+#define DOT11_SC_ASSOC_BUSY_FAIL 17
+#define DOT11_SC_ASSOC_RATE_MISMATCH 18
+#define DOT11_SC_ASSOC_SHORT_REQUIRED 19
+#define DOT11_SC_ASSOC_PBCC_REQUIRED 20
+#define DOT11_SC_ASSOC_AGILITY_REQUIRED 21
+#define DOT11_SC_ASSOC_SPECTRUM_REQUIRED 22
+#define DOT11_SC_ASSOC_BAD_POWER_CAP 23
+#define DOT11_SC_ASSOC_BAD_SUP_CHANNELS 24
+#define DOT11_SC_ASSOC_SHORTSLOT_REQUIRED 25
+#define DOT11_SC_ASSOC_ERPBCC_REQUIRED 26
+#define DOT11_SC_ASSOC_DSSOFDM_REQUIRED 27
+#define DOT11_SC_ASSOC_R0KH_UNREACHABLE 28
+#define DOT11_SC_ASSOC_TRY_LATER 30
+#define DOT11_SC_ASSOC_MFP_VIOLATION 31
+
+#define DOT11_SC_DECLINED 37
+#define DOT11_SC_INVALID_PARAMS 38
+#define DOT11_SC_INVALID_PAIRWISE_CIPHER 42
+#define DOT11_SC_INVALID_AKMP 43
+#define DOT11_SC_INVALID_RSNIE_CAP 45
+#define DOT11_SC_DLS_NOT_ALLOWED 48
+#define DOT11_SC_INVALID_PMKID 53
+#define DOT11_SC_INVALID_MDID 54
+#define DOT11_SC_INVALID_FTIE 55
+
+#define DOT11_SC_UNEXP_MSG 70
+#define DOT11_SC_INVALID_SNONCE 71
+#define DOT11_SC_INVALID_RSNIE 72
+
+
+#define DOT11_MNG_DS_PARAM_LEN 1
+#define DOT11_MNG_IBSS_PARAM_LEN 2
+
+
+#define DOT11_MNG_TIM_FIXED_LEN 3
+#define DOT11_MNG_TIM_DTIM_COUNT 0
+#define DOT11_MNG_TIM_DTIM_PERIOD 1
+#define DOT11_MNG_TIM_BITMAP_CTL 2
+#define DOT11_MNG_TIM_PVB 3
+
+
+#define TLV_TAG_OFF 0
+#define TLV_LEN_OFF 1
+#define TLV_HDR_LEN 2
+#define TLV_BODY_OFF 2
+
+
+#define DOT11_MNG_SSID_ID 0
+#define DOT11_MNG_RATES_ID 1
+#define DOT11_MNG_FH_PARMS_ID 2
+#define DOT11_MNG_DS_PARMS_ID 3
+#define DOT11_MNG_CF_PARMS_ID 4
+#define DOT11_MNG_TIM_ID 5
+#define DOT11_MNG_IBSS_PARMS_ID 6
+#define DOT11_MNG_COUNTRY_ID 7
+#define DOT11_MNG_HOPPING_PARMS_ID 8
+#define DOT11_MNG_HOPPING_TABLE_ID 9
+#define DOT11_MNG_REQUEST_ID 10
+#define DOT11_MNG_QBSS_LOAD_ID 11
+#define DOT11_MNG_EDCA_PARAM_ID 12
+#define DOT11_MNG_CHALLENGE_ID 16
+#define DOT11_MNG_PWR_CONSTRAINT_ID 32
+#define DOT11_MNG_PWR_CAP_ID 33
+#define DOT11_MNG_TPC_REQUEST_ID 34
+#define DOT11_MNG_TPC_REPORT_ID 35
+#define DOT11_MNG_SUPP_CHANNELS_ID 36
+#define DOT11_MNG_CHANNEL_SWITCH_ID 37
+#define DOT11_MNG_MEASURE_REQUEST_ID 38
+#define DOT11_MNG_MEASURE_REPORT_ID 39
+#define DOT11_MNG_QUIET_ID 40
+#define DOT11_MNG_IBSS_DFS_ID 41
+#define DOT11_MNG_ERP_ID 42
+#define DOT11_MNG_TS_DELAY_ID 43
+#define DOT11_MNG_HT_CAP 45
+#define DOT11_MNG_QOS_CAP_ID 46
+#define DOT11_MNG_NONERP_ID 47
+#define DOT11_MNG_RSN_ID 48
+#define DOT11_MNG_EXT_RATES_ID 50
+#define DOT11_MNG_AP_CHREP_ID 51
+#define DOT11_MNG_NBR_REP_ID 52
+#define DOT11_MNG_MDIE_ID 54
+#define DOT11_MNG_FTIE_ID 55
+#define DOT11_MNG_FT_TI_ID 56
+#define DOT11_MNG_REGCLASS_ID 59
+#define DOT11_MNG_EXT_CSA_ID 60
+#define DOT11_MNG_HT_ADD 61
+#define DOT11_MNG_EXT_CHANNEL_OFFSET 62
+#define DOT11_MNG_WAPI_ID 68
+#define DOT11_MNG_TIME_ADVERTISE_ID 69
+#define DOT11_MNG_RRM_CAP_ID 70
+#define DOT11_MNG_HT_BSS_COEXINFO_ID 72
+#define DOT11_MNG_HT_BSS_CHANNEL_REPORT_ID 73
+#define DOT11_MNG_HT_OBSS_ID 74
+#define DOT11_MNG_CHANNEL_USAGE 97
+#define DOT11_MNG_TIME_ZONE_ID 98
+#define DOT11_MNG_LINK_IDENTIFIER_ID 101
+#define DOT11_MNG_WAKEUP_SCHEDULE_ID 102
+#define DOT11_MNG_CHANNEL_SWITCH_TIMING_ID 104
+#define DOT11_MNG_PTI_CONTROL_ID 105
+#define DOT11_MNG_PU_BUFFER_STATUS_ID 106
+#define DOT11_MNG_INTERWORKING_ID 107
+#define DOT11_MNG_ADVERTISEMENT_ID 108
+#define DOT11_MNG_EXP_BW_REQ_ID 109
+#define DOT11_MNG_QOS_MAP_ID 110
+#define DOT11_MNG_ROAM_CONSORT_ID 111
+#define DOT11_MNG_EMERGCY_ALERT_ID 112
+#define DOT11_MNG_EXT_CAP_ID 127
+#define DOT11_MNG_VHT_CAP_ID 191
+#define DOT11_MNG_VHT_OPERATION_ID 192
+
+#define DOT11_MNG_WPA_ID 221
+#define DOT11_MNG_PROPR_ID 221
+
+#define DOT11_MNG_VS_ID 221
+
+
+#define DOT11_RATE_BASIC 0x80
+#define DOT11_RATE_MASK 0x7F
+
+
+#define DOT11_MNG_ERP_LEN 1
+#define DOT11_MNG_NONERP_PRESENT 0x01
+#define DOT11_MNG_USE_PROTECTION 0x02
+#define DOT11_MNG_BARKER_PREAMBLE 0x04
+
+#define DOT11_MGN_TS_DELAY_LEN 4
+#define TS_DELAY_FIELD_SIZE 4
+
+
+#define DOT11_CAP_ESS 0x0001
+#define DOT11_CAP_IBSS 0x0002
+#define DOT11_CAP_POLLABLE 0x0004
+#define DOT11_CAP_POLL_RQ 0x0008
+#define DOT11_CAP_PRIVACY 0x0010
+#define DOT11_CAP_SHORT 0x0020
+#define DOT11_CAP_PBCC 0x0040
+#define DOT11_CAP_AGILITY 0x0080
+#define DOT11_CAP_SPECTRUM 0x0100
+#define DOT11_CAP_SHORTSLOT 0x0400
+#define DOT11_CAP_RRM 0x1000
+#define DOT11_CAP_CCK_OFDM 0x2000
+
+
+
+#define DOT11_EXT_CAP_OBSS_COEX_MGMT 0
+
+#define DOT11_EXT_CAP_SPSMP 6
+
+#define DOT11_EXT_CAP_BSS_TRANSITION_MGMT 19
+
+#define DOT11_EXT_CAP_IW 31
+
+#define DOT11_EXT_CAP_SI 41
+#define DOT11_EXT_CAP_SI_MASK 0x0E
+
+
+#define DOT11_ACTION_HDR_LEN 2
+#define DOT11_ACTION_CAT_OFF 0
+#define DOT11_ACTION_ACT_OFF 1
+
+
+#define DOT11_ACTION_CAT_ERR_MASK 0x80
+#define DOT11_ACTION_CAT_MASK 0x7F
+#define DOT11_ACTION_CAT_SPECT_MNG 0
+#define DOT11_ACTION_CAT_QOS 1
+#define DOT11_ACTION_CAT_DLS 2
+#define DOT11_ACTION_CAT_BLOCKACK 3
+#define DOT11_ACTION_CAT_PUBLIC 4
+#define DOT11_ACTION_CAT_RRM 5
+#define DOT11_ACTION_CAT_FBT 6
+#define DOT11_ACTION_CAT_HT 7
+#define DOT11_ACTION_CAT_SA_QUERY 8
+#define DOT11_ACTION_CAT_PDPA 9
+#define DOT11_ACTION_CAT_BSSMGMT 10
+#define DOT11_ACTION_NOTIFICATION 17
+#define DOT11_ACTION_CAT_VSP 126
+#define DOT11_ACTION_CAT_VS 127
+
+
+#define DOT11_SM_ACTION_M_REQ 0
+#define DOT11_SM_ACTION_M_REP 1
+#define DOT11_SM_ACTION_TPC_REQ 2
+#define DOT11_SM_ACTION_TPC_REP 3
+#define DOT11_SM_ACTION_CHANNEL_SWITCH 4
+#define DOT11_SM_ACTION_EXT_CSA 5
+
+
+#define DOT11_ACTION_ID_HT_CH_WIDTH 0
+#define DOT11_ACTION_ID_HT_MIMO_PS 1
+
+
+#define DOT11_PUB_ACTION_BSS_COEX_MNG 0
+#define DOT11_PUB_ACTION_CHANNEL_SWITCH 4
+
+
+#define DOT11_BA_ACTION_ADDBA_REQ 0
+#define DOT11_BA_ACTION_ADDBA_RESP 1
+#define DOT11_BA_ACTION_DELBA 2
+
+
+#define DOT11_ADDBA_PARAM_AMSDU_SUP 0x0001
+#define DOT11_ADDBA_PARAM_POLICY_MASK 0x0002
+#define DOT11_ADDBA_PARAM_POLICY_SHIFT 1
+#define DOT11_ADDBA_PARAM_TID_MASK 0x003c
+#define DOT11_ADDBA_PARAM_TID_SHIFT 2
+#define DOT11_ADDBA_PARAM_BSIZE_MASK 0xffc0
+#define DOT11_ADDBA_PARAM_BSIZE_SHIFT 6
+
+#define DOT11_ADDBA_POLICY_DELAYED 0
+#define DOT11_ADDBA_POLICY_IMMEDIATE 1
+
+
+#define DOT11_FT_ACTION_FT_RESERVED 0
+#define DOT11_FT_ACTION_FT_REQ 1
+#define DOT11_FT_ACTION_FT_RES 2
+#define DOT11_FT_ACTION_FT_CON 3
+#define DOT11_FT_ACTION_FT_ACK 4
+
+
+#define DOT11_DLS_ACTION_REQ 0
+#define DOT11_DLS_ACTION_RESP 1
+#define DOT11_DLS_ACTION_TD 2
+
+
+#define DOT11_WNM_ACTION_EVENT_REQ 0
+#define DOT11_WNM_ACTION_EVENT_REP 1
+#define DOT11_WNM_ACTION_DIAG_REQ 2
+#define DOT11_WNM_ACTION_DIAG_REP 3
+#define DOT11_WNM_ACTION_LOC_CFG_REQ 4
+#define DOT11_WNM_ACTION_LOC_RFG_RESP 5
+#define DOT11_WNM_ACTION_BSS_TRANS_QURY 6
+#define DOT11_WNM_ACTION_BSS_TRANS_REQ 7
+#define DOT11_WNM_ACTION_BSS_TRANS_RESP 8
+#define DOT11_WNM_ACTION_FMS_REQ 9
+#define DOT11_WNM_ACTION_FMS_RESP 10
+#define DOT11_WNM_ACTION_COL_INTRFRNCE_REQ 11
+#define DOT11_WNM_ACTION_COL_INTRFRNCE_REP 12
+#define DOT11_WNM_ACTION_TFS_REQ 13
+#define DOT11_WNM_ACTION_TFS_RESP 14
+#define DOT11_WNM_ACTION_TFS_NOTIFY 15
+#define DOT11_WNM_ACTION_WNM_SLEEP_REQ 16
+#define DOT11_WNM_ACTION_WNM_SLEEP_RESP 17
+#define DOT11_WNM_ACTION_TIM_BCAST_REQ 18
+#define DOT11_WNM_ACTION_TIM_BCAST_RESP 19
+#define DOT11_WNM_ACTION_QOS_TRFC_CAP_UPD 20
+#define DOT11_WNM_ACTION_CHAN_USAGE_REQ 21
+#define DOT11_WNM_ACTION_CHAN_USAGE_RESP 22
+#define DOT11_WNM_ACTION_DMS_REQ 23
+#define DOT11_WNM_ACTION_DMS_RESP 24
+#define DOT11_WNM_ACTION_TMNG_MEASUR_REQ 25
+#define DOT11_WNM_ACTION_NOTFCTN_REQ 26
+#define DOT11_WNM_ACTION_NOTFCTN_RES 27
+
+#define DOT11_MNG_COUNTRY_ID_LEN 3
+
+
+BWL_PRE_PACKED_STRUCT struct dot11_dls_req {
+ uint8 category;
+ uint8 action;
+ struct ether_addr da;
+ struct ether_addr sa;
+ uint16 cap;
+ uint16 timeout;
+ uint8 data[1];
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_dls_req dot11_dls_req_t;
+#define DOT11_DLS_REQ_LEN 18
+
+
+BWL_PRE_PACKED_STRUCT struct dot11_dls_resp {
+ uint8 category;
+ uint8 action;
+ uint16 status;
+ struct ether_addr da;
+ struct ether_addr sa;
+ uint8 data[1];
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_dls_resp dot11_dls_resp_t;
+#define DOT11_DLS_RESP_LEN 16
+
+
+
+BWL_PRE_PACKED_STRUCT struct dot11_bss_trans_query {
+ uint8 category;
+ uint8 action;
+ uint8 token;
+ uint8 reason;
+ uint8 data[1];
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_bss_trans_query dot11_bss_trans_query_t;
+#define DOT11_BSS_TRANS_QUERY_LEN 4
+
+
+BWL_PRE_PACKED_STRUCT struct dot11_bss_trans_req {
+ uint8 category;
+ uint8 action;
+ uint8 token;
+ uint8 reqmode;
+ uint16 disassoc_tmr;
+ uint8 validity_intrvl;
+ uint8 data[1];
+
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_bss_trans_req dot11_bss_trans_req_t;
+#define DOT11_BSS_TRANS_REQ_LEN 7
+
+#define DOT11_BSS_TERM_DUR_LEN 12
+
+
+
+#define DOT11_BSS_TRNS_REQMODE_PREF_LIST_INCL 0x01
+#define DOT11_BSS_TRNS_REQMODE_ABRIDGED 0x02
+#define DOT11_BSS_TRNS_REQMODE_DISASSOC_IMMINENT 0x04
+#define DOT11_BSS_TRNS_REQMODE_BSS_TERM_INCL 0x08
+#define DOT11_BSS_TRNS_REQMODE_ESS_DISASSOC_IMNT 0x10
+
+
+
+BWL_PRE_PACKED_STRUCT struct dot11_bss_trans_res {
+ uint8 category;
+ uint8 action;
+ uint8 token;
+ uint8 status;
+ uint8 term_delay;
+ uint8 data[1];
+
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_bss_trans_res dot11_bss_trans_res_t;
+#define DOT11_BSS_TRANS_RES_LEN 5
+
+
+#define DOT11_BSS_TRNS_RES_STATUS_ACCEPT 0
+#define DOT11_BSS_TRNS_RES_STATUS_REJECT 1
+#define DOT11_BSS_TRNS_RES_STATUS_REJ_INSUFF_BCN 2
+#define DOT11_BSS_TRNS_RES_STATUS_REJ_INSUFF_CAP 3
+#define DOT11_BSS_TRNS_RES_STATUS_REJ_TERM_UNDESIRED 4
+#define DOT11_BSS_TRNS_RES_STATUS_REJ_TERM_DELAY_REQ 5
+#define DOT11_BSS_TRNS_RES_STATUS_REJ_BSS_LIST_PROVIDED 6
+#define DOT11_BSS_TRNS_RES_STATUS_REJ_NO_SUITABLE_BSS 7
+#define DOT11_BSS_TRNS_RES_STATUS_REJ_LEAVING_ESS 8
+
+
+
+#define DOT11_NBR_RPRT_BSSID_INFO_REACHABILTY 0x0003
+#define DOT11_NBR_RPRT_BSSID_INFO_SEC 0x0004
+#define DOT11_NBR_RPRT_BSSID_INFO_KEY_SCOPE 0x0008
+#define DOT11_NBR_RPRT_BSSID_INFO_CAP 0x03f0
+
+#define DOT11_NBR_RPRT_BSSID_INFO_CAP_SPEC_MGMT 0x0010
+#define DOT11_NBR_RPRT_BSSID_INFO_CAP_QOS 0x0020
+#define DOT11_NBR_RPRT_BSSID_INFO_CAP_APSD 0x0040
+#define DOT11_NBR_RPRT_BSSID_INFO_CAP_RDIO_MSMT 0x0080
+#define DOT11_NBR_RPRT_BSSID_INFO_CAP_DEL_BA 0x0100
+#define DOT11_NBR_RPRT_BSSID_INFO_CAP_IMM_BA 0x0200
+
+
+#define DOT11_NBR_RPRT_SUBELEM_BSS_CANDDT_PREF_ID 3
+
+
+BWL_PRE_PACKED_STRUCT struct dot11_addba_req {
+ uint8 category;
+ uint8 action;
+ uint8 token;
+ uint16 addba_param_set;
+ uint16 timeout;
+ uint16 start_seqnum;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_addba_req dot11_addba_req_t;
+#define DOT11_ADDBA_REQ_LEN 9
+
+BWL_PRE_PACKED_STRUCT struct dot11_addba_resp {
+ uint8 category;
+ uint8 action;
+ uint8 token;
+ uint16 status;
+ uint16 addba_param_set;
+ uint16 timeout;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_addba_resp dot11_addba_resp_t;
+#define DOT11_ADDBA_RESP_LEN 9
+
+
+#define DOT11_DELBA_PARAM_INIT_MASK 0x0800
+#define DOT11_DELBA_PARAM_INIT_SHIFT 11
+#define DOT11_DELBA_PARAM_TID_MASK 0xf000
+#define DOT11_DELBA_PARAM_TID_SHIFT 12
+
+BWL_PRE_PACKED_STRUCT struct dot11_delba {
+ uint8 category;
+ uint8 action;
+ uint16 delba_param_set;
+ uint16 reason;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_delba dot11_delba_t;
+#define DOT11_DELBA_LEN 6
+
+
+#define SA_QUERY_REQUEST 0
+#define SA_QUERY_RESPONSE 1
+
+
+
+
+BWL_PRE_PACKED_STRUCT struct dot11_ft_req {
+ uint8 category;
+ uint8 action;
+ uint8 sta_addr[ETHER_ADDR_LEN];
+ uint8 tgt_ap_addr[ETHER_ADDR_LEN];
+ uint8 data[1];
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_ft_req dot11_ft_req_t;
+#define DOT11_FT_REQ_FIXED_LEN 14
+
+
+BWL_PRE_PACKED_STRUCT struct dot11_ft_res {
+ uint8 category;
+ uint8 action;
+ uint8 sta_addr[ETHER_ADDR_LEN];
+ uint8 tgt_ap_addr[ETHER_ADDR_LEN];
+ uint16 status;
+ uint8 data[1];
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_ft_res dot11_ft_res_t;
+#define DOT11_FT_RES_FIXED_LEN 16
+
+
+
+
+
+
+#define DOT11_RRM_CAP_LEN 5
+BWL_PRE_PACKED_STRUCT struct dot11_rrm_cap_ie {
+ uint8 cap[DOT11_RRM_CAP_LEN];
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_rrm_cap_ie dot11_rrm_cap_ie_t;
+
+
+#define DOT11_RRM_CAP_LINK 0
+#define DOT11_RRM_CAP_NEIGHBOR_REPORT 1
+#define DOT11_RRM_CAP_PARALLEL 2
+#define DOT11_RRM_CAP_REPEATED 3
+#define DOT11_RRM_CAP_BCN_PASSIVE 4
+#define DOT11_RRM_CAP_BCN_ACTIVE 5
+#define DOT11_RRM_CAP_BCN_TABLE 6
+#define DOT11_RRM_CAP_BCN_REP_COND 7
+#define DOT11_RRM_CAP_AP_CHANREP 16
+
+
+
+#define DOT11_OP_CLASS_NONE 255
+
+
+
+#define DOT11_RM_ACTION_RM_REQ 0
+#define DOT11_RM_ACTION_RM_REP 1
+#define DOT11_RM_ACTION_LM_REQ 2
+#define DOT11_RM_ACTION_LM_REP 3
+#define DOT11_RM_ACTION_NR_REQ 4
+#define DOT11_RM_ACTION_NR_REP 5
+
+
+BWL_PRE_PACKED_STRUCT struct dot11_rm_action {
+ uint8 category;
+ uint8 action;
+ uint8 token;
+ uint8 data[1];
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_rm_action dot11_rm_action_t;
+#define DOT11_RM_ACTION_LEN 3
+
+BWL_PRE_PACKED_STRUCT struct dot11_rmreq {
+ uint8 category;
+ uint8 action;
+ uint8 token;
+ uint16 reps;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_rmreq dot11_rmreq_t;
+#define DOT11_RMREQ_LEN 5
+
+BWL_PRE_PACKED_STRUCT struct dot11_rm_ie {
+ uint8 id;
+ uint8 len;
+ uint8 token;
+ uint8 mode;
+ uint8 type;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_rm_ie dot11_rm_ie_t;
+#define DOT11_RM_IE_LEN 5
+
+
+#define DOT11_RMREQ_MODE_PARALLEL 1
+#define DOT11_RMREQ_MODE_ENABLE 2
+#define DOT11_RMREQ_MODE_REQUEST 4
+#define DOT11_RMREQ_MODE_REPORT 8
+#define DOT11_RMREQ_MODE_DURMAND 0x10
+
+
+#define DOT11_RMREP_MODE_LATE 1
+#define DOT11_RMREP_MODE_INCAPABLE 2
+#define DOT11_RMREP_MODE_REFUSED 4
+
+BWL_PRE_PACKED_STRUCT struct dot11_rmreq_bcn {
+ uint8 id;
+ uint8 len;
+ uint8 token;
+ uint8 mode;
+ uint8 type;
+ uint8 reg;
+ uint8 channel;
+ uint16 interval;
+ uint16 duration;
+ uint8 bcn_mode;
+ struct ether_addr bssid;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_rmreq_bcn dot11_rmreq_bcn_t;
+#define DOT11_RMREQ_BCN_LEN 18
+
+BWL_PRE_PACKED_STRUCT struct dot11_rmrep_bcn {
+ uint8 reg;
+ uint8 channel;
+ uint32 starttime[2];
+ uint16 duration;
+ uint8 frame_info;
+ uint8 rcpi;
+ uint8 rsni;
+ struct ether_addr bssid;
+ uint8 antenna_id;
+ uint32 parent_tsf;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_rmrep_bcn dot11_rmrep_bcn_t;
+#define DOT11_RMREP_BCN_LEN 26
+
+
+#define DOT11_RMREQ_BCN_PASSIVE 0
+#define DOT11_RMREQ_BCN_ACTIVE 1
+#define DOT11_RMREQ_BCN_TABLE 2
+
+
+#define DOT11_RMREQ_BCN_SSID_ID 0
+#define DOT11_RMREQ_BCN_REPINFO_ID 1
+#define DOT11_RMREQ_BCN_REPDET_ID 2
+#define DOT11_RMREQ_BCN_REQUEST_ID 10
+#define DOT11_RMREQ_BCN_APCHREP_ID 51
+
+
+#define DOT11_RMREQ_BCN_REPDET_FIXED 0
+#define DOT11_RMREQ_BCN_REPDET_REQUEST 1
+#define DOT11_RMREQ_BCN_REPDET_ALL 2
+
+
+#define DOT11_RMREP_BCN_FRM_BODY 1
+
+
+BWL_PRE_PACKED_STRUCT struct dot11_rmrep_nbr {
+ struct ether_addr bssid;
+ uint32 bssid_info;
+ uint8 reg;
+ uint8 channel;
+ uint8 phytype;
+ uchar sub_elements[1];
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_rmrep_nbr dot11_rmrep_nbr_t;
+#define DOT11_RMREP_NBR_LEN 13
+
+
+#define DOT11_BSSTYPE_INFRASTRUCTURE 0
+#define DOT11_BSSTYPE_INDEPENDENT 1
+#define DOT11_BSSTYPE_ANY 2
+#define DOT11_SCANTYPE_ACTIVE 0
+#define DOT11_SCANTYPE_PASSIVE 1
+
+
+BWL_PRE_PACKED_STRUCT struct dot11_lmreq {
+ uint8 category;
+ uint8 action;
+ uint8 token;
+ uint8 txpwr;
+ uint8 maxtxpwr;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_lmreq dot11_lmreq_t;
+#define DOT11_LMREQ_LEN 5
+
+BWL_PRE_PACKED_STRUCT struct dot11_lmrep {
+ uint8 category;
+ uint8 action;
+ uint8 token;
+ dot11_tpc_rep_t tpc;
+ uint8 rxant;
+ uint8 txant;
+ uint8 rcpi;
+ uint8 rsni;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_lmrep dot11_lmrep_t;
+#define DOT11_LMREP_LEN 11
+
+
+#define PREN_PREAMBLE 24
+#define PREN_MM_EXT 12
+#define PREN_PREAMBLE_EXT 4
+
+
+#define RIFS_11N_TIME 2
+
+
+
+#define HT_SIG1_MCS_MASK 0x00007F
+#define HT_SIG1_CBW 0x000080
+#define HT_SIG1_HT_LENGTH 0xFFFF00
+
+
+#define HT_SIG2_SMOOTHING 0x000001
+#define HT_SIG2_NOT_SOUNDING 0x000002
+#define HT_SIG2_RESERVED 0x000004
+#define HT_SIG2_AGGREGATION 0x000008
+#define HT_SIG2_STBC_MASK 0x000030
+#define HT_SIG2_STBC_SHIFT 4
+#define HT_SIG2_FEC_CODING 0x000040
+#define HT_SIG2_SHORT_GI 0x000080
+#define HT_SIG2_ESS_MASK 0x000300
+#define HT_SIG2_ESS_SHIFT 8
+#define HT_SIG2_CRC 0x03FC00
+#define HT_SIG2_TAIL 0x1C0000
+
+
+#define APHY_SLOT_TIME 9
+#define APHY_SIFS_TIME 16
+#define APHY_DIFS_TIME (APHY_SIFS_TIME + (2 * APHY_SLOT_TIME))
+#define APHY_PREAMBLE_TIME 16
+#define APHY_SIGNAL_TIME 4
+#define APHY_SYMBOL_TIME 4
+#define APHY_SERVICE_NBITS 16
+#define APHY_TAIL_NBITS 6
+#define APHY_CWMIN 15
+
+
+#define BPHY_SLOT_TIME 20
+#define BPHY_SIFS_TIME 10
+#define BPHY_DIFS_TIME 50
+#define BPHY_PLCP_TIME 192
+#define BPHY_PLCP_SHORT_TIME 96
+#define BPHY_CWMIN 31
+
+
+#define DOT11_OFDM_SIGNAL_EXTENSION 6
+
+#define PHY_CWMAX 1023
+
+#define DOT11_MAXNUMFRAGS 16
+
+
+
+typedef int vht_group_id_t;
+
+
+
+#define VHT_SIGA1_CONST_MASK 0x800004
+
+#define VHT_SIGA1_20MHZ_VAL 0x000000
+#define VHT_SIGA1_40MHZ_VAL 0x000001
+#define VHT_SIGA1_80MHZ_VAL 0x000002
+#define VHT_SIGA1_160MHZ_VAL 0x000003
+
+#define VHT_SIGA1_STBC 0x000008
+
+#define VHT_SIGA1_GID_MAX_GID 0x3f
+#define VHT_SIGA1_GID_SHIFT 4
+#define VHT_SIGA1_GID_TO_AP 0x00
+#define VHT_SIGA1_GID_NOT_TO_AP 0x3f
+
+#define VHT_SIGA1_NSTS_SHIFT 10
+#define VHT_SIGA1_NSTS_SHIFT_MASK_USER0 0x001C00
+
+#define VHT_SIGA1_PARTIAL_AID_SHIFT 13
+
+
+#define VHT_SIGA2_GI_NONE 0x000000
+#define VHT_SIGA2_GI_SHORT 0x000001
+#define VHT_SIGA2_GI_W_MOD10 0x000002
+#define VHT_SIGA2_CODING_LDPC 0x000004
+#define VHT_SIGA2_BEAMFORM_ENABLE 0x000100
+#define VHT_SIGA2_MCS_SHIFT 4
+
+#define VHT_SIGA2_B9_RESERVED 0x000200
+#define VHT_SIGA2_TAIL_MASK 0xfc0000
+#define VHT_SIGA2_TAIL_VALUE 0x000000
+
+#define VHT_SIGA2_SVC_BITS 16
+#define VHT_SIGA2_TAIL_BITS 6
+
+
+
+typedef struct d11cnt {
+ uint32 txfrag;
+ uint32 txmulti;
+ uint32 txfail;
+ uint32 txretry;
+ uint32 txretrie;
+ uint32 rxdup;
+ uint32 txrts;
+ uint32 txnocts;
+ uint32 txnoack;
+ uint32 rxfrag;
+ uint32 rxmulti;
+ uint32 rxcrc;
+ uint32 txfrmsnt;
+ uint32 rxundec;
+} d11cnt_t;
+
+
+#define BRCM_PROP_OUI "\x00\x90\x4C"
+
+
+
+#define BRCM_OUI "\x00\x10\x18"
+
+
+BWL_PRE_PACKED_STRUCT struct brcm_ie {
+ uint8 id;
+ uint8 len;
+ uint8 oui[3];
+ uint8 ver;
+ uint8 assoc;
+ uint8 flags;
+ uint8 flags1;
+ uint16 amsdu_mtu_pref;
+} BWL_POST_PACKED_STRUCT;
+typedef struct brcm_ie brcm_ie_t;
+#define BRCM_IE_LEN 11
+#define BRCM_IE_VER 2
+#define BRCM_IE_LEGACY_AES_VER 1
+
+
+#define BRF_LZWDS 0x4
+#define BRF_BLOCKACK 0x8
+
+
+#define BRF1_AMSDU 0x1
+#define BRF1_WMEPS 0x4
+#define BRF1_PSOFIX 0x8
+#define BRF1_RX_LARGE_AGG 0x10
+#define BRF1_RFAWARE_DCS 0x20
+#define BRF1_SOFTAP 0x40
+
+
+BWL_PRE_PACKED_STRUCT struct vndr_ie {
+ uchar id;
+ uchar len;
+ uchar oui [3];
+ uchar data [1];
+} BWL_POST_PACKED_STRUCT;
+typedef struct vndr_ie vndr_ie_t;
+
+#define VNDR_IE_HDR_LEN 2
+#define VNDR_IE_MIN_LEN 3
+#define VNDR_IE_FIXED_LEN (VNDR_IE_HDR_LEN + VNDR_IE_MIN_LEN)
+#define VNDR_IE_MAX_LEN 256
+
+
+#define MCSSET_LEN 16
+#define MAX_MCS_NUM (128)
+
+BWL_PRE_PACKED_STRUCT struct ht_cap_ie {
+ uint16 cap;
+ uint8 params;
+ uint8 supp_mcs[MCSSET_LEN];
+ uint16 ext_htcap;
+ uint32 txbf_cap;
+ uint8 as_cap;
+} BWL_POST_PACKED_STRUCT;
+typedef struct ht_cap_ie ht_cap_ie_t;
+
+
+
+BWL_PRE_PACKED_STRUCT struct ht_prop_cap_ie {
+ uint8 id;
+ uint8 len;
+ uint8 oui[3];
+ uint8 type;
+ ht_cap_ie_t cap_ie;
+} BWL_POST_PACKED_STRUCT;
+typedef struct ht_prop_cap_ie ht_prop_cap_ie_t;
+
+#define HT_PROP_IE_OVERHEAD 4
+#define HT_CAP_IE_LEN 26
+#define HT_CAP_IE_TYPE 51
+
+#define HT_CAP_LDPC_CODING 0x0001
+#define HT_CAP_40MHZ 0x0002
+#define HT_CAP_MIMO_PS_MASK 0x000C
+#define HT_CAP_MIMO_PS_SHIFT 0x0002
+#define HT_CAP_MIMO_PS_OFF 0x0003
+#define HT_CAP_MIMO_PS_RTS 0x0001
+#define HT_CAP_MIMO_PS_ON 0x0000
+#define HT_CAP_GF 0x0010
+#define HT_CAP_SHORT_GI_20 0x0020
+#define HT_CAP_SHORT_GI_40 0x0040
+#define HT_CAP_TX_STBC 0x0080
+#define HT_CAP_RX_STBC_MASK 0x0300
+#define HT_CAP_RX_STBC_SHIFT 8
+#define HT_CAP_DELAYED_BA 0x0400
+#define HT_CAP_MAX_AMSDU 0x0800
+
+#define HT_CAP_DSSS_CCK 0x1000
+#define HT_CAP_PSMP 0x2000
+#define HT_CAP_40MHZ_INTOLERANT 0x4000
+#define HT_CAP_LSIG_TXOP 0x8000
+
+#define HT_CAP_RX_STBC_NO 0x0
+#define HT_CAP_RX_STBC_ONE_STREAM 0x1
+#define HT_CAP_RX_STBC_TWO_STREAM 0x2
+#define HT_CAP_RX_STBC_THREE_STREAM 0x3
+
+#define VHT_MAX_MPDU 11454
+#define VHT_MPDU_MSDU_DELTA 56
+
+#define VHT_MAX_AMSDU (VHT_MAX_MPDU - VHT_MPDU_MSDU_DELTA)
+
+#define HT_MAX_AMSDU 7935
+#define HT_MIN_AMSDU 3835
+
+#define HT_PARAMS_RX_FACTOR_MASK 0x03
+#define HT_PARAMS_DENSITY_MASK 0x1C
+#define HT_PARAMS_DENSITY_SHIFT 2
+
+
+#define AMPDU_MAX_MPDU_DENSITY 7
+#define AMPDU_DENSITY_NONE 0
+#define AMPDU_DENSITY_1over4_US 1
+#define AMPDU_DENSITY_1over2_US 2
+#define AMPDU_DENSITY_1_US 3
+#define AMPDU_DENSITY_2_US 4
+#define AMPDU_DENSITY_4_US 5
+#define AMPDU_DENSITY_8_US 6
+#define AMPDU_DENSITY_16_US 7
+#define AMPDU_RX_FACTOR_8K 0
+#define AMPDU_RX_FACTOR_16K 1
+#define AMPDU_RX_FACTOR_32K 2
+#define AMPDU_RX_FACTOR_64K 3
+#define AMPDU_RX_FACTOR_BASE 8*1024
+
+#define AMPDU_DELIMITER_LEN 4
+#define AMPDU_DELIMITER_LEN_MAX 63
+
+#define HT_CAP_EXT_PCO 0x0001
+#define HT_CAP_EXT_PCO_TTIME_MASK 0x0006
+#define HT_CAP_EXT_PCO_TTIME_SHIFT 1
+#define HT_CAP_EXT_MCS_FEEDBACK_MASK 0x0300
+#define HT_CAP_EXT_MCS_FEEDBACK_SHIFT 8
+#define HT_CAP_EXT_HTC 0x0400
+#define HT_CAP_EXT_RD_RESP 0x0800
+
+BWL_PRE_PACKED_STRUCT struct ht_add_ie {
+ uint8 ctl_ch;
+ uint8 byte1;
+ uint16 opmode;
+ uint16 misc_bits;
+ uint8 basic_mcs[MCSSET_LEN];
+} BWL_POST_PACKED_STRUCT;
+typedef struct ht_add_ie ht_add_ie_t;
+
+
+
+BWL_PRE_PACKED_STRUCT struct ht_prop_add_ie {
+ uint8 id;
+ uint8 len;
+ uint8 oui[3];
+ uint8 type;
+ ht_add_ie_t add_ie;
+} BWL_POST_PACKED_STRUCT;
+typedef struct ht_prop_add_ie ht_prop_add_ie_t;
+
+#define HT_ADD_IE_LEN 22
+#define HT_ADD_IE_TYPE 52
+
+
+#define HT_BW_ANY 0x04
+#define HT_RIFS_PERMITTED 0x08
+
+
+#define HT_OPMODE_MASK 0x0003
+#define HT_OPMODE_SHIFT 0
+#define HT_OPMODE_PURE 0x0000
+#define HT_OPMODE_OPTIONAL 0x0001
+#define HT_OPMODE_HT20IN40 0x0002
+#define HT_OPMODE_MIXED 0x0003
+#define HT_OPMODE_NONGF 0x0004
+#define DOT11N_TXBURST 0x0008
+#define DOT11N_OBSS_NONHT 0x0010
+
+
+#define HT_BASIC_STBC_MCS 0x007f
+#define HT_DUAL_STBC_PROT 0x0080
+#define HT_SECOND_BCN 0x0100
+#define HT_LSIG_TXOP 0x0200
+#define HT_PCO_ACTIVE 0x0400
+#define HT_PCO_PHASE 0x0800
+#define HT_DUALCTS_PROTECTION 0x0080
+
+
+#define DOT11N_2G_TXBURST_LIMIT 6160
+#define DOT11N_5G_TXBURST_LIMIT 3080
+
+
+#define GET_HT_OPMODE(add_ie) ((ltoh16_ua(&add_ie->opmode) & HT_OPMODE_MASK) \
+ >> HT_OPMODE_SHIFT)
+#define HT_MIXEDMODE_PRESENT(add_ie) ((ltoh16_ua(&add_ie->opmode) & HT_OPMODE_MASK) \
+ == HT_OPMODE_MIXED)
+#define HT_HT20_PRESENT(add_ie) ((ltoh16_ua(&add_ie->opmode) & HT_OPMODE_MASK) \
+ == HT_OPMODE_HT20IN40)
+#define HT_OPTIONAL_PRESENT(add_ie) ((ltoh16_ua(&add_ie->opmode) & HT_OPMODE_MASK) \
+ == HT_OPMODE_OPTIONAL)
+#define HT_USE_PROTECTION(add_ie) (HT_HT20_PRESENT((add_ie)) || \
+ HT_MIXEDMODE_PRESENT((add_ie)))
+#define HT_NONGF_PRESENT(add_ie) ((ltoh16_ua(&add_ie->opmode) & HT_OPMODE_NONGF) \
+ == HT_OPMODE_NONGF)
+#define DOT11N_TXBURST_PRESENT(add_ie) ((ltoh16_ua(&add_ie->opmode) & DOT11N_TXBURST) \
+ == DOT11N_TXBURST)
+#define DOT11N_OBSS_NONHT_PRESENT(add_ie) ((ltoh16_ua(&add_ie->opmode) & DOT11N_OBSS_NONHT) \
+ == DOT11N_OBSS_NONHT)
+
+BWL_PRE_PACKED_STRUCT struct obss_params {
+ uint16 passive_dwell;
+ uint16 active_dwell;
+ uint16 bss_widthscan_interval;
+ uint16 passive_total;
+ uint16 active_total;
+ uint16 chanwidth_transition_dly;
+ uint16 activity_threshold;
+} BWL_POST_PACKED_STRUCT;
+typedef struct obss_params obss_params_t;
+
+BWL_PRE_PACKED_STRUCT struct dot11_obss_ie {
+ uint8 id;
+ uint8 len;
+ obss_params_t obss_params;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_obss_ie dot11_obss_ie_t;
+#define DOT11_OBSS_SCAN_IE_LEN sizeof(obss_params_t)
+
+
+#define HT_CTRL_LA_TRQ 0x00000002
+#define HT_CTRL_LA_MAI 0x0000003C
+#define HT_CTRL_LA_MAI_SHIFT 2
+#define HT_CTRL_LA_MAI_MRQ 0x00000004
+#define HT_CTRL_LA_MAI_MSI 0x00000038
+#define HT_CTRL_LA_MFSI 0x000001C0
+#define HT_CTRL_LA_MFSI_SHIFT 6
+#define HT_CTRL_LA_MFB_ASELC 0x0000FE00
+#define HT_CTRL_LA_MFB_ASELC_SH 9
+#define HT_CTRL_LA_ASELC_CMD 0x00000C00
+#define HT_CTRL_LA_ASELC_DATA 0x0000F000
+#define HT_CTRL_CAL_POS 0x00030000
+#define HT_CTRL_CAL_SEQ 0x000C0000
+#define HT_CTRL_CSI_STEERING 0x00C00000
+#define HT_CTRL_CSI_STEER_SHIFT 22
+#define HT_CTRL_CSI_STEER_NFB 0
+#define HT_CTRL_CSI_STEER_CSI 1
+#define HT_CTRL_CSI_STEER_NCOM 2
+#define HT_CTRL_CSI_STEER_COM 3
+#define HT_CTRL_NDP_ANNOUNCE 0x01000000
+#define HT_CTRL_AC_CONSTRAINT 0x40000000
+#define HT_CTRL_RDG_MOREPPDU 0x80000000
+
+#define HT_OPMODE_OPTIONAL 0x0001
+#define HT_OPMODE_HT20IN40 0x0002
+#define HT_OPMODE_MIXED 0x0003
+#define HT_OPMODE_NONGF 0x0004
+#define DOT11N_TXBURST 0x0008
+#define DOT11N_OBSS_NONHT 0x0010
+
+
+
+BWL_PRE_PACKED_STRUCT struct vht_cap_ie {
+ uint32 vht_cap_info;
+
+ uint16 rx_mcs_map;
+ uint16 rx_max_rate;
+ uint16 tx_mcs_map;
+ uint16 tx_max_rate;
+} BWL_POST_PACKED_STRUCT;
+typedef struct vht_cap_ie vht_cap_ie_t;
+
+#define VHT_CAP_IE_LEN 12
+
+#define VHT_CAP_INFO_MAX_MPDU_LEN_MASK 0x00000003
+#define VHT_CAP_INFO_SUPP_CHAN_WIDTH_MASK 0x0000000c
+#define VHT_CAP_INFO_LDPC 0x00000010
+#define VHT_CAP_INFO_SGI_80MHZ 0x00000020
+
+#define VHT_CAP_INFO_SGI_160MHZ 0x00000040
+#define VHT_CAP_INFO_TX_STBC 0x00000080
+
+#define VHT_CAP_INFO_RX_STBC_MASK 0x00000700
+#define VHT_CAP_INFO_RX_STBC_SHIFT 8
+#define VHT_CAP_INFO_SU_BEAMFMR 0x00000800
+#define VHT_CAP_INFO_SU_BEAMFMEE 0x00001000
+#define VHT_CAP_INFO_NUM_BMFMR_ANT_MASK 0x0000e000
+#define VHT_CAP_INFO_NUM_BMFMR_ANT_SHIFT 13
+
+#define VHT_CAP_INFO_NUM_SOUNDING_DIM_MASK 0x00070000
+#define VHT_CAP_INFO_NUM_SOUNDING_DIM_SHIFT 16
+#define VHT_CAP_INFO_MU_BEAMFMR 0x00080000
+#define VHT_CAP_INFO_MU_BEAMFMEE 0x00100000
+#define VHT_CAP_INFO_TXOPPS 0x00200000
+#define VHT_CAP_INFO_HTCVHT 0x00400000
+#define VHT_CAP_INFO_AMPDU_MAXLEN_EXP_MASK 0x03800000
+#define VHT_CAP_INFO_AMPDU_MAXLEN_EXP_SHIFT 23
+
+#define VHT_CAP_INFO_LINK_ADAPT_CAP_MASK 0x0c000000
+#define VHT_CAP_INFO_LINK_ADAPT_CAP_SHIFT 26
+
+
+#define VHT_CAP_SUPP_MCS_RX_HIGHEST_RATE_MASK 0x1fff
+#define VHT_CAP_SUPP_MCS_RX_HIGHEST_RATE_SHIFT 0
+
+#define VHT_CAP_SUPP_MCS_TX_HIGHEST_RATE_MASK 0x1fff
+#define VHT_CAP_SUPP_MCS_TX_HIGHEST_RATE_SHIFT 0
+
+#define VHT_CAP_MCS_MAP_0_7 0
+#define VHT_CAP_MCS_MAP_0_8 1
+#define VHT_CAP_MCS_MAP_0_9 2
+#define VHT_CAP_MCS_MAP_NONE 3
+
+#define VHT_CAP_MCS_MAP_NSS_MAX 8
+
+
+typedef enum vht_cap_chan_width {
+ VHT_CAP_CHAN_WIDTH_20_40 = 0x00,
+ VHT_CAP_CHAN_WIDTH_80 = 0x04,
+ VHT_CAP_CHAN_WIDTH_160 = 0x08
+} vht_cap_chan_width_t;
+
+
+typedef enum vht_cap_max_mpdu_len {
+ VHT_CAP_MPDU_MAX_4K = 0x00,
+ VHT_CAP_MPDU_MAX_8K = 0x01,
+ VHT_CAP_MPDU_MAX_11K = 0x02
+} vht_cap_max_mpdu_len_t;
+
+
+BWL_PRE_PACKED_STRUCT struct vht_op_ie {
+ uint8 chan_width;
+ uint8 chan1;
+ uint8 chan2;
+ uint16 supp_mcs;
+} BWL_POST_PACKED_STRUCT;
+typedef struct vht_op_ie vht_op_ie_t;
+
+#define VHT_OP_IE_LEN 5
+
+typedef enum vht_op_chan_width {
+ VHT_OP_CHAN_WIDTH_20_40 = 0,
+ VHT_OP_CHAN_WIDTH_80 = 1,
+ VHT_OP_CHAN_WIDTH_160 = 2,
+ VHT_OP_CHAN_WIDTH_80_80 = 3
+} vht_op_chan_width_t;
+
+
+#define VHT_MCS_MAP_GET_SS_IDX(nss) (((nss)-1)*2)
+#define VHT_MCS_MAP_GET_MCS_PER_SS(nss, mcsMap) \
+ (((mcsMap) >> VHT_MCS_MAP_GET_SS_IDX(nss)) & 0x3)
+#define VHT_MCS_MAP_SET_MCS_PER_SS(nss, numMcs, mcsMap) \
+ ((mcsMap) |= (((numMcs) & 0x3) << VHT_MCS_MAP_GET_SS_IDX(nss)))
+
+
+#define WPA_OUI "\x00\x50\xF2"
+#define WPA_OUI_LEN 3
+#define WPA_OUI_TYPE 1
+#define WPA_VERSION 1
+#define WPA2_OUI "\x00\x0F\xAC"
+#define WPA2_OUI_LEN 3
+#define WPA2_VERSION 1
+#define WPA2_VERSION_LEN 2
+
+
+#define WPS_OUI "\x00\x50\xF2"
+#define WPS_OUI_LEN 3
+#define WPS_OUI_TYPE 4
+
+
+
+#ifdef P2P_IE_OVRD
+#define WFA_OUI MAC_OUI
+#else
+#define WFA_OUI "\x50\x6F\x9A"
+#endif
+#define WFA_OUI_LEN 3
+#ifdef P2P_IE_OVRD
+#define WFA_OUI_TYPE_P2P MAC_OUI_TYPE_P2P
+#else
+#define WFA_OUI_TYPE_P2P 9
+#endif
+
+#define WFA_OUI_TYPE_TPC 8
+#ifdef WLTDLS
+#define WFA_OUI_TYPE_WFD 10
+#endif
+
+
+#define RSN_AKM_NONE 0
+#define RSN_AKM_UNSPECIFIED 1
+#define RSN_AKM_PSK 2
+#define RSN_AKM_FBT_1X 3
+#define RSN_AKM_FBT_PSK 4
+#define RSN_AKM_MFP_1X 5
+#define RSN_AKM_MFP_PSK 6
+#define RSN_AKM_TPK 7
+
+
+#define DOT11_MAX_DEFAULT_KEYS 4
+#define DOT11_MAX_KEY_SIZE 32
+#define DOT11_MAX_IV_SIZE 16
+#define DOT11_EXT_IV_FLAG (1<<5)
+#define DOT11_WPA_KEY_RSC_LEN 8
+
+#define WEP1_KEY_SIZE 5
+#define WEP1_KEY_HEX_SIZE 10
+#define WEP128_KEY_SIZE 13
+#define WEP128_KEY_HEX_SIZE 26
+#define TKIP_MIC_SIZE 8
+#define TKIP_EOM_SIZE 7
+#define TKIP_EOM_FLAG 0x5a
+#define TKIP_KEY_SIZE 32
+#define TKIP_MIC_AUTH_TX 16
+#define TKIP_MIC_AUTH_RX 24
+#define TKIP_MIC_SUP_RX TKIP_MIC_AUTH_TX
+#define TKIP_MIC_SUP_TX TKIP_MIC_AUTH_RX
+#define AES_KEY_SIZE 16
+#define AES_MIC_SIZE 8
+#define BIP_KEY_SIZE 16
+
+
+#define WCN_OUI "\x00\x50\xf2"
+#define WCN_TYPE 4
+
+#ifdef BCMWAPI_WPI
+#define SMS4_KEY_LEN 16
+#define SMS4_WPI_CBC_MAC_LEN 16
+#endif
+
+
+
+
+BWL_PRE_PACKED_STRUCT struct dot11_mdid_ie {
+ uint8 id;
+ uint8 len;
+ uint16 mdid;
+ uint8 cap;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_mdid_ie dot11_mdid_ie_t;
+
+#define FBT_MDID_CAP_OVERDS 0x01
+#define FBT_MDID_CAP_RRP 0x02
+
+
+BWL_PRE_PACKED_STRUCT struct dot11_ft_ie {
+ uint8 id;
+ uint8 len;
+ uint16 mic_control;
+ uint8 mic[16];
+ uint8 anonce[32];
+ uint8 snonce[32];
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_ft_ie dot11_ft_ie_t;
+
+#define TIE_TYPE_RESERVED 0
+#define TIE_TYPE_REASSOC_DEADLINE 1
+#define TIE_TYPE_KEY_LIEFTIME 2
+#define TIE_TYPE_ASSOC_COMEBACK 3
+BWL_PRE_PACKED_STRUCT struct dot11_timeout_ie {
+ uint8 id;
+ uint8 len;
+ uint8 type;
+ uint32 value;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_timeout_ie dot11_timeout_ie_t;
+
+
+
+BWL_PRE_PACKED_STRUCT struct dot11_gtk_ie {
+ uint8 id;
+ uint8 len;
+ uint16 key_info;
+ uint8 key_len;
+ uint8 rsc[8];
+ uint8 data[1];
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_gtk_ie dot11_gtk_ie_t;
+
+#define BSSID_INVALID "\x00\x00\x00\x00\x00\x00"
+#define BSSID_BROADCAST "\xFF\xFF\xFF\xFF\xFF\xFF"
+
+#ifdef BCMWAPI_WAI
+#define WAPI_IE_MIN_LEN 20
+#define WAPI_VERSION 1
+#define WAPI_VERSION_LEN 2
+#define WAPI_OUI "\x00\x14\x72"
+#define WAPI_OUI_LEN DOT11_OUI_LEN
+#endif
+
+
+#define WMM_OUI "\x00\x50\xF2"
+#define WMM_OUI_LEN 3
+#define WMM_OUI_TYPE 2
+#define WMM_VERSION 1
+#define WMM_VERSION_LEN 1
+
+
+#define WMM_OUI_SUBTYPE_PARAMETER 1
+#define WMM_PARAMETER_IE_LEN 24
+
+
+BWL_PRE_PACKED_STRUCT struct link_id_ie {
+ uint8 id;
+ uint8 len;
+ struct ether_addr bssid;
+ struct ether_addr tdls_init_mac;
+ struct ether_addr tdls_resp_mac;
+} BWL_POST_PACKED_STRUCT;
+typedef struct link_id_ie link_id_ie_t;
+#define TDLS_LINK_ID_IE_LEN 18
+
+
+BWL_PRE_PACKED_STRUCT struct wakeup_sch_ie {
+ uint8 id;
+ uint8 len;
+ uint32 offset;
+ uint32 interval;
+ uint32 awake_win_slots;
+ uint32 max_wake_win;
+ uint16 idle_cnt;
+} BWL_POST_PACKED_STRUCT;
+typedef struct wakeup_sch_ie wakeup_sch_ie_t;
+#define TDLS_WAKEUP_SCH_IE_LEN 18
+
+
+BWL_PRE_PACKED_STRUCT struct channel_switch_timing_ie {
+ uint8 id;
+ uint8 len;
+ uint16 switch_time;
+ uint16 switch_timeout;
+} BWL_POST_PACKED_STRUCT;
+typedef struct channel_switch_timing_ie channel_switch_timing_ie_t;
+#define TDLS_CHANNEL_SWITCH_TIMING_IE_LEN 4
+
+
+BWL_PRE_PACKED_STRUCT struct pti_control_ie {
+ uint8 id;
+ uint8 len;
+ uint8 tid;
+ uint16 seq_control;
+} BWL_POST_PACKED_STRUCT;
+typedef struct pti_control_ie pti_control_ie_t;
+#define TDLS_PTI_CONTROL_IE_LEN 3
+
+
+BWL_PRE_PACKED_STRUCT struct pu_buffer_status_ie {
+ uint8 id;
+ uint8 len;
+ uint8 status;
+} BWL_POST_PACKED_STRUCT;
+typedef struct pu_buffer_status_ie pu_buffer_status_ie_t;
+#define TDLS_PU_BUFFER_STATUS_IE_LEN 1
+#define TDLS_PU_BUFFER_STATUS_AC_BK 1
+#define TDLS_PU_BUFFER_STATUS_AC_BE 2
+#define TDLS_PU_BUFFER_STATUS_AC_VI 4
+#define TDLS_PU_BUFFER_STATUS_AC_VO 8
+
+
+#include <packed_section_end.h>
+
+#endif
diff --git a/drivers/net/wireless/bcmdhd/src/include/proto/802.11_bta.h b/drivers/net/wireless/bcmdhd/include/proto/802.11_bta.h
index ba790b8..3ee5a74 100755..100644
--- a/drivers/net/wireless/bcmdhd/src/include/proto/802.11_bta.h
+++ b/drivers/net/wireless/bcmdhd/include/proto/802.11_bta.h
@@ -1,14 +1,14 @@
/*
* BT-AMP (BlueTooth Alternate Mac and Phy) 802.11 PAL (Protocol Adaptation Layer)
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,7 +16,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
diff --git a/drivers/net/wireless/bcmdhd/src/include/proto/802.11e.h b/drivers/net/wireless/bcmdhd/include/proto/802.11e.h
index a053d61..c837f57 100755..100644
--- a/drivers/net/wireless/bcmdhd/src/include/proto/802.11e.h
+++ b/drivers/net/wireless/bcmdhd/include/proto/802.11e.h
@@ -1,14 +1,14 @@
/*
* 802.11e protocol header file
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,7 +16,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
@@ -117,6 +117,12 @@ typedef BWL_PRE_PACKED_STRUCT struct tspec {
#define DOT11E_STATUS_ADDTS_INVALID_PARAM 1 /* TSPEC invalid parameter status */
#define DOT11E_STATUS_ADDTS_REFUSED_NSBW 3 /* ADDTS refused (non-sufficient BW) */
#define DOT11E_STATUS_ADDTS_REFUSED_AWHILE 47 /* ADDTS refused but could retry later */
+#ifdef BCMCCX
+#define CCX_STATUS_ASSOC_DENIED_UNKNOWN 0xc8 /* unspecified QoS related failure */
+#define CCX_STATUS_ASSOC_DENIED_AP_POLICY 0xc9 /* TSPEC refused due to AP policy */
+#define CCX_STATUS_ASSOC_DENIED_NO_BW 0xca /* Assoc denied due to AP insufficient BW */
+#define CCX_STATUS_ASSOC_DENIED_BAD_PARAM 0xcb /* one or more TSPEC with invalid parameter */
+#endif /* BCMCCX */
/* 802.11e DELTS status code */
#define DOT11E_STATUS_QSTA_LEAVE_QBSS 36 /* STA leave QBSS */
diff --git a/drivers/net/wireless/bcmdhd/src/include/proto/802.1d.h b/drivers/net/wireless/bcmdhd/include/proto/802.1d.h
index 94b5627..116a226 100755..100644
--- a/drivers/net/wireless/bcmdhd/src/include/proto/802.1d.h
+++ b/drivers/net/wireless/bcmdhd/include/proto/802.1d.h
@@ -1,12 +1,12 @@
/*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -14,7 +14,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
@@ -28,21 +28,21 @@
#define _802_1_D_
-#define PRIO_8021D_NONE 2
-#define PRIO_8021D_BK 1
-#define PRIO_8021D_BE 0
-#define PRIO_8021D_EE 3
-#define PRIO_8021D_CL 4
-#define PRIO_8021D_VI 5
-#define PRIO_8021D_VO 6
-#define PRIO_8021D_NC 7
-#define MAXPRIO 7
+#define PRIO_8021D_NONE 2
+#define PRIO_8021D_BK 1
+#define PRIO_8021D_BE 0
+#define PRIO_8021D_EE 3
+#define PRIO_8021D_CL 4
+#define PRIO_8021D_VI 5
+#define PRIO_8021D_VO 6
+#define PRIO_8021D_NC 7
+#define MAXPRIO 7
#define NUMPRIO (MAXPRIO + 1)
-#define ALLPRIO -1
+#define ALLPRIO -1
#define PRIO2PREC(prio) \
(((prio) == PRIO_8021D_NONE || (prio) == PRIO_8021D_BE) ? ((prio^2)) : (prio))
-#endif
+#endif
diff --git a/drivers/net/wireless/bcmdhd/src/include/proto/bcmeth.h b/drivers/net/wireless/bcmdhd/include/proto/bcmeth.h
index 5207d30..e54b2e3 100644
--- a/drivers/net/wireless/bcmdhd/src/include/proto/bcmeth.h
+++ b/drivers/net/wireless/bcmdhd/include/proto/bcmeth.h
@@ -1,14 +1,14 @@
/*
* Broadcom Ethernettype protocol definitions
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,7 +16,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
@@ -67,11 +67,11 @@
typedef BWL_PRE_PACKED_STRUCT struct bcmeth_hdr
{
- uint16 subtype;
+ uint16 subtype;
uint16 length;
- uint8 version;
- uint8 oui[3];
-
+ uint8 version;
+ uint8 oui[3];
+
uint16 usr_subtype;
} BWL_POST_PACKED_STRUCT bcmeth_hdr_t;
@@ -79,4 +79,4 @@ typedef BWL_PRE_PACKED_STRUCT struct bcmeth_hdr
#include <packed_section_end.h>
-#endif
+#endif
diff --git a/drivers/net/wireless/bcmdhd/include/proto/bcmevent.h b/drivers/net/wireless/bcmdhd/include/proto/bcmevent.h
new file mode 100644
index 0000000..312074d
--- /dev/null
+++ b/drivers/net/wireless/bcmdhd/include/proto/bcmevent.h
@@ -0,0 +1,342 @@
+/*
+ * Broadcom Event protocol definitions
+ *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
+ * Unless you and Broadcom execute a separate written software license
+ * agreement governing use of this software, this software is licensed to you
+ * under the terms of the GNU General Public License version 2 (the "GPL"),
+ * available at http://www.broadcom.com/licenses/GPLv2.php, with the
+ * following added to such license:
+ *
+ * As a special exception, the copyright holders of this software give you
+ * permission to link this software with independent modules, and to copy and
+ * distribute the resulting executable under terms of your choice, provided that
+ * you also meet, for each linked independent module, the terms and conditions of
+ * the license of that module. An independent module is a module which is not
+ * derived from this software. The special exception does not apply to any
+ * modifications of the software.
+ *
+ * Notwithstanding the above, under no circumstances may you combine this
+ * software in any way with any other Broadcom software provided under a license
+ * other than the GPL, without Broadcom's express prior written consent.
+ *
+ * Dependencies: proto/bcmeth.h
+ *
+ * $Id: bcmevent.h 326276 2012-04-06 23:16:42Z $
+ *
+ */
+
+
+
+#ifndef _BCMEVENT_H_
+#define _BCMEVENT_H_
+
+#ifndef _TYPEDEFS_H_
+#include <typedefs.h>
+#endif
+
+
+#include <packed_section_start.h>
+
+#define BCM_EVENT_MSG_VERSION 2
+#define BCM_MSG_IFNAME_MAX 16
+
+
+#define WLC_EVENT_MSG_LINK 0x01
+#define WLC_EVENT_MSG_FLUSHTXQ 0x02
+#define WLC_EVENT_MSG_GROUP 0x04
+#define WLC_EVENT_MSG_UNKBSS 0x08
+#define WLC_EVENT_MSG_UNKIF 0x10
+
+
+
+
+typedef BWL_PRE_PACKED_STRUCT struct
+{
+ uint16 version;
+ uint16 flags;
+ uint32 event_type;
+ uint32 status;
+ uint32 reason;
+ uint32 auth_type;
+ uint32 datalen;
+ struct ether_addr addr;
+ char ifname[BCM_MSG_IFNAME_MAX];
+} BWL_POST_PACKED_STRUCT wl_event_msg_v1_t;
+
+
+typedef BWL_PRE_PACKED_STRUCT struct
+{
+ uint16 version;
+ uint16 flags;
+ uint32 event_type;
+ uint32 status;
+ uint32 reason;
+ uint32 auth_type;
+ uint32 datalen;
+ struct ether_addr addr;
+ char ifname[BCM_MSG_IFNAME_MAX];
+ uint8 ifidx;
+ uint8 bsscfgidx;
+} BWL_POST_PACKED_STRUCT wl_event_msg_t;
+
+
+typedef BWL_PRE_PACKED_STRUCT struct bcm_event {
+ struct ether_header eth;
+ bcmeth_hdr_t bcm_hdr;
+ wl_event_msg_t event;
+
+} BWL_POST_PACKED_STRUCT bcm_event_t;
+
+#define BCM_MSG_LEN (sizeof(bcm_event_t) - sizeof(bcmeth_hdr_t) - sizeof(struct ether_header))
+
+
+#define WLC_E_SET_SSID 0
+#define WLC_E_JOIN 1
+#define WLC_E_START 2
+#define WLC_E_AUTH 3
+#define WLC_E_AUTH_IND 4
+#define WLC_E_DEAUTH 5
+#define WLC_E_DEAUTH_IND 6
+#define WLC_E_ASSOC 7
+#define WLC_E_ASSOC_IND 8
+#define WLC_E_REASSOC 9
+#define WLC_E_REASSOC_IND 10
+#define WLC_E_DISASSOC 11
+#define WLC_E_DISASSOC_IND 12
+#define WLC_E_QUIET_START 13
+#define WLC_E_QUIET_END 14
+#define WLC_E_BEACON_RX 15
+#define WLC_E_LINK 16
+#define WLC_E_MIC_ERROR 17
+#define WLC_E_NDIS_LINK 18
+#define WLC_E_ROAM 19
+#define WLC_E_TXFAIL 20
+#define WLC_E_PMKID_CACHE 21
+#define WLC_E_RETROGRADE_TSF 22
+#define WLC_E_PRUNE 23
+#define WLC_E_AUTOAUTH 24
+#define WLC_E_EAPOL_MSG 25
+#define WLC_E_SCAN_COMPLETE 26
+#define WLC_E_ADDTS_IND 27
+#define WLC_E_DELTS_IND 28
+#define WLC_E_BCNSENT_IND 29
+#define WLC_E_BCNRX_MSG 30
+#define WLC_E_BCNLOST_MSG 31
+#define WLC_E_ROAM_PREP 32
+#define WLC_E_PFN_NET_FOUND 33
+#define WLC_E_PFN_NET_LOST 34
+#define WLC_E_RESET_COMPLETE 35
+#define WLC_E_JOIN_START 36
+#define WLC_E_ROAM_START 37
+#define WLC_E_ASSOC_START 38
+#define WLC_E_IBSS_ASSOC 39
+#define WLC_E_RADIO 40
+#define WLC_E_PSM_WATCHDOG 41
+#define WLC_E_PROBREQ_MSG 44
+#define WLC_E_SCAN_CONFIRM_IND 45
+#define WLC_E_PSK_SUP 46
+#define WLC_E_COUNTRY_CODE_CHANGED 47
+#define WLC_E_EXCEEDED_MEDIUM_TIME 48
+#define WLC_E_ICV_ERROR 49
+#define WLC_E_UNICAST_DECODE_ERROR 50
+#define WLC_E_MULTICAST_DECODE_ERROR 51
+#define WLC_E_TRACE 52
+#ifdef WLBTAMP
+#define WLC_E_BTA_HCI_EVENT 53
+#endif
+#define WLC_E_IF 54
+#define WLC_E_P2P_DISC_LISTEN_COMPLETE 55
+#define WLC_E_RSSI 56
+#define WLC_E_PFN_SCAN_COMPLETE 57
+#define WLC_E_EXTLOG_MSG 58
+#define WLC_E_ACTION_FRAME 59
+#define WLC_E_ACTION_FRAME_COMPLETE 60
+#define WLC_E_PRE_ASSOC_IND 61
+#define WLC_E_PRE_REASSOC_IND 62
+#define WLC_E_CHANNEL_ADOPTED 63
+#define WLC_E_AP_STARTED 64
+#define WLC_E_DFS_AP_STOP 65
+#define WLC_E_DFS_AP_RESUME 66
+#define WLC_E_WAI_STA_EVENT 67
+#define WLC_E_WAI_MSG 68
+#define WLC_E_ESCAN_RESULT 69
+#define WLC_E_ACTION_FRAME_OFF_CHAN_COMPLETE 70
+#define WLC_E_PROBRESP_MSG 71
+#define WLC_E_P2P_PROBREQ_MSG 72
+#define WLC_E_DCS_REQUEST 73
+
+#define WLC_E_FIFO_CREDIT_MAP 74
+
+#define WLC_E_ACTION_FRAME_RX 75
+#define WLC_E_WAKE_EVENT 76
+#define WLC_E_RM_COMPLETE 77
+#define WLC_E_HTSFSYNC 78
+#define WLC_E_OVERLAY_REQ 79
+#define WLC_E_CSA_COMPLETE_IND 80
+#define WLC_E_EXCESS_PM_WAKE_EVENT 81
+#define WLC_E_PFN_SCAN_NONE 82
+#define WLC_E_PFN_SCAN_ALLGONE 83
+#define WLC_E_GTK_PLUMBED 84
+#define WLC_E_ASSOC_IND_NDIS 85
+#define WLC_E_REASSOC_IND_NDIS 86
+#define WLC_E_ASSOC_REQ_IE 87
+#define WLC_E_ASSOC_RESP_IE 88
+#define WLC_E_ASSOC_RECREATED 89
+#define WLC_E_ACTION_FRAME_RX_NDIS 90
+#define WLC_E_AUTH_REQ 91
+#define WLC_E_TDLS_PEER_EVENT 92
+#define WLC_E_SPEEDY_RECREATE_FAIL 93
+#define WLC_E_LAST 94
+
+
+
+typedef struct {
+ uint event;
+ const char *name;
+} bcmevent_name_t;
+
+extern const bcmevent_name_t bcmevent_names[];
+extern const int bcmevent_names_size;
+
+
+#define WLC_E_STATUS_SUCCESS 0
+#define WLC_E_STATUS_FAIL 1
+#define WLC_E_STATUS_TIMEOUT 2
+#define WLC_E_STATUS_NO_NETWORKS 3
+#define WLC_E_STATUS_ABORT 4
+#define WLC_E_STATUS_NO_ACK 5
+#define WLC_E_STATUS_UNSOLICITED 6
+#define WLC_E_STATUS_ATTEMPT 7
+#define WLC_E_STATUS_PARTIAL 8
+#define WLC_E_STATUS_NEWSCAN 9
+#define WLC_E_STATUS_NEWASSOC 10
+#define WLC_E_STATUS_11HQUIET 11
+#define WLC_E_STATUS_SUPPRESS 12
+#define WLC_E_STATUS_NOCHANS 13
+#ifdef BCMCCX
+#define WLC_E_STATUS_CCXFASTRM 14
+#endif
+#define WLC_E_STATUS_CS_ABORT 15
+#define WLC_E_STATUS_ERROR 16
+
+
+#define WLC_E_REASON_INITIAL_ASSOC 0
+#define WLC_E_REASON_LOW_RSSI 1
+#define WLC_E_REASON_DEAUTH 2
+#define WLC_E_REASON_DISASSOC 3
+#define WLC_E_REASON_BCNS_LOST 4
+#define WLC_E_REASON_MINTXRATE 9
+#define WLC_E_REASON_TXFAIL 10
+
+
+#define WLC_E_REASON_FAST_ROAM_FAILED 5
+#define WLC_E_REASON_DIRECTED_ROAM 6
+#define WLC_E_REASON_TSPEC_REJECTED 7
+#define WLC_E_REASON_BETTER_AP 8
+
+
+#define WLC_E_REASON_REQUESTED_ROAM 11
+
+
+#define WLC_E_PRUNE_ENCR_MISMATCH 1
+#define WLC_E_PRUNE_BCAST_BSSID 2
+#define WLC_E_PRUNE_MAC_DENY 3
+#define WLC_E_PRUNE_MAC_NA 4
+#define WLC_E_PRUNE_REG_PASSV 5
+#define WLC_E_PRUNE_SPCT_MGMT 6
+#define WLC_E_PRUNE_RADAR 7
+#define WLC_E_RSN_MISMATCH 8
+#define WLC_E_PRUNE_NO_COMMON_RATES 9
+#define WLC_E_PRUNE_BASIC_RATES 10
+#ifdef BCMCCX
+#define WLC_E_PRUNE_CCXFAST_PREVAP 11
+#endif
+#define WLC_E_PRUNE_CIPHER_NA 12
+#define WLC_E_PRUNE_KNOWN_STA 13
+#ifdef BCMCCX
+#define WLC_E_PRUNE_CCXFAST_DROAM 14
+#endif
+#define WLC_E_PRUNE_WDS_PEER 15
+#define WLC_E_PRUNE_QBSS_LOAD 16
+#define WLC_E_PRUNE_HOME_AP 17
+#ifdef BCMCCX
+#define WLC_E_PRUNE_AP_BLOCKED 18
+#define WLC_E_PRUNE_NO_DIAG_SUPPORT 19
+#endif
+
+
+#define WLC_E_SUP_OTHER 0
+#define WLC_E_SUP_DECRYPT_KEY_DATA 1
+#define WLC_E_SUP_BAD_UCAST_WEP128 2
+#define WLC_E_SUP_BAD_UCAST_WEP40 3
+#define WLC_E_SUP_UNSUP_KEY_LEN 4
+#define WLC_E_SUP_PW_KEY_CIPHER 5
+#define WLC_E_SUP_MSG3_TOO_MANY_IE 6
+#define WLC_E_SUP_MSG3_IE_MISMATCH 7
+#define WLC_E_SUP_NO_INSTALL_FLAG 8
+#define WLC_E_SUP_MSG3_NO_GTK 9
+#define WLC_E_SUP_GRP_KEY_CIPHER 10
+#define WLC_E_SUP_GRP_MSG1_NO_GTK 11
+#define WLC_E_SUP_GTK_DECRYPT_FAIL 12
+#define WLC_E_SUP_SEND_FAIL 13
+#define WLC_E_SUP_DEAUTH 14
+#define WLC_E_SUP_WPA_PSK_TMO 15
+
+
+
+typedef BWL_PRE_PACKED_STRUCT struct wl_event_rx_frame_data {
+ uint16 version;
+ uint16 channel;
+ int32 rssi;
+ uint32 mactime;
+ uint32 rate;
+} BWL_POST_PACKED_STRUCT wl_event_rx_frame_data_t;
+
+#define BCM_RX_FRAME_DATA_VERSION 1
+
+
+typedef struct wl_event_data_if {
+ uint8 ifidx;
+ uint8 opcode;
+ uint8 reserved;
+ uint8 bssidx;
+ uint8 role;
+} wl_event_data_if_t;
+
+
+#define WLC_E_IF_ADD 1
+#define WLC_E_IF_DEL 2
+#define WLC_E_IF_CHANGE 3
+
+
+#define WLC_E_IF_ROLE_STA 0
+#define WLC_E_IF_ROLE_AP 1
+#define WLC_E_IF_ROLE_WDS 2
+#define WLC_E_IF_ROLE_P2P_GO 3
+#define WLC_E_IF_ROLE_P2P_CLIENT 4
+#ifdef WLBTAMP
+#define WLC_E_IF_ROLE_BTA_CREATOR 5
+#define WLC_E_IF_ROLE_BTA_ACCEPTOR 6
+#endif
+
+
+#define WLC_E_LINK_BCN_LOSS 1
+#define WLC_E_LINK_DISASSOC 2
+#define WLC_E_LINK_ASSOC_REC 3
+#define WLC_E_LINK_BSSCFG_DIS 4
+
+
+#define WLC_E_OVL_DOWNLOAD 0
+#define WLC_E_OVL_UPDATE_IND 1
+
+
+#define WLC_E_TDLS_PEER_DISCOVERED 0
+#define WLC_E_TDLS_PEER_CONNECTED 1
+#define WLC_E_TDLS_PEER_DISCONNECTED 2
+
+
+#include <packed_section_end.h>
+
+#endif
diff --git a/drivers/net/wireless/bcmdhd/src/include/proto/bcmip.h b/drivers/net/wireless/bcmdhd/include/proto/bcmip.h
index bdc902b..d5c3b76 100644
--- a/drivers/net/wireless/bcmdhd/src/include/proto/bcmip.h
+++ b/drivers/net/wireless/bcmdhd/include/proto/bcmip.h
@@ -1,12 +1,12 @@
/*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -14,7 +14,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
@@ -36,40 +36,40 @@
-#define IP_VER_OFFSET 0x0
-#define IP_VER_MASK 0xf0
-#define IP_VER_SHIFT 4
-#define IP_VER_4 4
-#define IP_VER_6 6
+#define IP_VER_OFFSET 0x0
+#define IP_VER_MASK 0xf0
+#define IP_VER_SHIFT 4
+#define IP_VER_4 4
+#define IP_VER_6 6
#define IP_VER(ip_body) \
((((uint8 *)(ip_body))[IP_VER_OFFSET] & IP_VER_MASK) >> IP_VER_SHIFT)
-#define IP_PROT_ICMP 0x1
-#define IP_PROT_IGMP 0x2
-#define IP_PROT_TCP 0x6
-#define IP_PROT_UDP 0x11
-#define IP_PROT_ICMP6 0x3a
+#define IP_PROT_ICMP 0x1
+#define IP_PROT_IGMP 0x2
+#define IP_PROT_TCP 0x6
+#define IP_PROT_UDP 0x11
+#define IP_PROT_ICMP6 0x3a
-#define IPV4_VER_HL_OFFSET 0
-#define IPV4_TOS_OFFSET 1
-#define IPV4_PKTLEN_OFFSET 2
-#define IPV4_PKTFLAG_OFFSET 6
-#define IPV4_PROT_OFFSET 9
-#define IPV4_CHKSUM_OFFSET 10
-#define IPV4_SRC_IP_OFFSET 12
-#define IPV4_DEST_IP_OFFSET 16
-#define IPV4_OPTIONS_OFFSET 20
+#define IPV4_VER_HL_OFFSET 0
+#define IPV4_TOS_OFFSET 1
+#define IPV4_PKTLEN_OFFSET 2
+#define IPV4_PKTFLAG_OFFSET 6
+#define IPV4_PROT_OFFSET 9
+#define IPV4_CHKSUM_OFFSET 10
+#define IPV4_SRC_IP_OFFSET 12
+#define IPV4_DEST_IP_OFFSET 16
+#define IPV4_OPTIONS_OFFSET 20
-#define IPV4_VER_MASK 0xf0
-#define IPV4_VER_SHIFT 4
+#define IPV4_VER_MASK 0xf0
+#define IPV4_VER_SHIFT 4
-#define IPV4_HLEN_MASK 0x0f
+#define IPV4_HLEN_MASK 0x0f
#define IPV4_HLEN(ipv4_body) (4 * (((uint8 *)(ipv4_body))[IPV4_VER_HL_OFFSET] & IPV4_HLEN_MASK))
-#define IPV4_ADDR_LEN 4
+#define IPV4_ADDR_LEN 4
#define IPV4_ADDR_NULL(a) ((((uint8 *)(a))[0] | ((uint8 *)(a))[1] | \
((uint8 *)(a))[2] | ((uint8 *)(a))[3]) == 0)
@@ -77,26 +77,26 @@
#define IPV4_ADDR_BCAST(a) ((((uint8 *)(a))[0] & ((uint8 *)(a))[1] & \
((uint8 *)(a))[2] & ((uint8 *)(a))[3]) == 0xff)
-#define IPV4_TOS_DSCP_MASK 0xfc
-#define IPV4_TOS_DSCP_SHIFT 2
+#define IPV4_TOS_DSCP_MASK 0xfc
+#define IPV4_TOS_DSCP_SHIFT 2
#define IPV4_TOS(ipv4_body) (((uint8 *)(ipv4_body))[IPV4_TOS_OFFSET])
-#define IPV4_TOS_PREC_MASK 0xe0
-#define IPV4_TOS_PREC_SHIFT 5
+#define IPV4_TOS_PREC_MASK 0xe0
+#define IPV4_TOS_PREC_SHIFT 5
-#define IPV4_TOS_LOWDELAY 0x10
-#define IPV4_TOS_THROUGHPUT 0x8
-#define IPV4_TOS_RELIABILITY 0x4
+#define IPV4_TOS_LOWDELAY 0x10
+#define IPV4_TOS_THROUGHPUT 0x8
+#define IPV4_TOS_RELIABILITY 0x4
#define IPV4_PROT(ipv4_body) (((uint8 *)(ipv4_body))[IPV4_PROT_OFFSET])
-#define IPV4_FRAG_RESV 0x8000
-#define IPV4_FRAG_DONT 0x4000
-#define IPV4_FRAG_MORE 0x2000
-#define IPV4_FRAG_OFFSET_MASK 0x1fff
+#define IPV4_FRAG_RESV 0x8000
+#define IPV4_FRAG_DONT 0x4000
+#define IPV4_FRAG_MORE 0x2000
+#define IPV4_FRAG_OFFSET_MASK 0x1fff
-#define IPV4_ADDR_STR_LEN 16
+#define IPV4_ADDR_STR_LEN 16
BWL_PRE_PACKED_STRUCT struct ipv4_addr {
@@ -104,24 +104,24 @@ BWL_PRE_PACKED_STRUCT struct ipv4_addr {
} BWL_POST_PACKED_STRUCT;
BWL_PRE_PACKED_STRUCT struct ipv4_hdr {
- uint8 version_ihl;
- uint8 tos;
- uint16 tot_len;
+ uint8 version_ihl;
+ uint8 tos;
+ uint16 tot_len;
uint16 id;
- uint16 frag;
- uint8 ttl;
- uint8 prot;
- uint16 hdr_chksum;
- uint8 src_ip[IPV4_ADDR_LEN];
- uint8 dst_ip[IPV4_ADDR_LEN];
+ uint16 frag;
+ uint8 ttl;
+ uint8 prot;
+ uint16 hdr_chksum;
+ uint8 src_ip[IPV4_ADDR_LEN];
+ uint8 dst_ip[IPV4_ADDR_LEN];
} BWL_POST_PACKED_STRUCT;
-#define IPV6_PAYLOAD_LEN_OFFSET 4
-#define IPV6_NEXT_HDR_OFFSET 6
-#define IPV6_HOP_LIMIT_OFFSET 7
-#define IPV6_SRC_IP_OFFSET 8
-#define IPV6_DEST_IP_OFFSET 24
+#define IPV6_PAYLOAD_LEN_OFFSET 4
+#define IPV6_NEXT_HDR_OFFSET 6
+#define IPV6_HOP_LIMIT_OFFSET 7
+#define IPV6_SRC_IP_OFFSET 8
+#define IPV6_DEST_IP_OFFSET 24
#define IPV6_TRAFFIC_CLASS(ipv6_body) \
@@ -142,7 +142,7 @@ BWL_PRE_PACKED_STRUCT struct ipv4_hdr {
#define IPV6_PROT(ipv6_body) IPV6_NEXT_HDR(ipv6_body)
-#define IPV6_ADDR_LEN 16
+#define IPV6_ADDR_LEN 16
#define IP_TOS46(ip_body) \
@@ -164,7 +164,7 @@ BWL_PRE_PACKED_STRUCT struct ipv4_hdr {
((prot) == IPV6_EXTHDR_NONE) || \
((prot) == IPV6_EXTHDR_DEST))
-#define IPV6_MIN_HLEN 40
+#define IPV6_MIN_HLEN 40
#define IPV6_EXTHDR_LEN(eh) ((((struct ipv6_exthdr *)(eh))->hdrlen + 1) << 3)
@@ -207,4 +207,4 @@ ipv6_exthdr_len(uint8 *h, uint8 *proto)
#include <packed_section_end.h>
-#endif
+#endif
diff --git a/drivers/net/wireless/bcmdhd/include/proto/bcmipv6.h b/drivers/net/wireless/bcmdhd/include/proto/bcmipv6.h
new file mode 100644
index 0000000..9533391
--- /dev/null
+++ b/drivers/net/wireless/bcmdhd/include/proto/bcmipv6.h
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
+ * Unless you and Broadcom execute a separate written software license
+ * agreement governing use of this software, this software is licensed to you
+ * under the terms of the GNU General Public License version 2 (the "GPL"),
+ * available at http://www.broadcom.com/licenses/GPLv2.php, with the
+ * following added to such license:
+ *
+ * As a special exception, the copyright holders of this software give you
+ * permission to link this software with independent modules, and to copy and
+ * distribute the resulting executable under terms of your choice, provided that
+ * you also meet, for each linked independent module, the terms and conditions of
+ * the license of that module. An independent module is a module which is not
+ * derived from this software. The special exception does not apply to any
+ * modifications of the software.
+ *
+ * Notwithstanding the above, under no circumstances may you combine this
+ * software in any way with any other Broadcom software provided under a license
+ * other than the GPL, without Broadcom's express prior written consent.
+ *
+ * Fundamental constants relating to Neighbor Discovery Protocol
+ *
+ * $Id: bcmipv6.h 309193 2012-01-19 00:03:57Z $
+ */
+
+#ifndef _bcmipv6_h_
+#define _bcmipv6_h_
+
+#ifndef _TYPEDEFS_H_
+#include <typedefs.h>
+#endif
+
+/* This marks the start of a packed structure section. */
+#include <packed_section_start.h>
+
+#define ICMPV6_HEADER_TYPE 0x3A
+#define ICMPV6_PKT_TYPE_NS 135
+#define ICMPV6_PKT_TYPE_NA 136
+
+#define ICMPV6_ND_OPT_TYPE_TARGET_MAC 2
+#define ICMPV6_ND_OPT_TYPE_SRC_MAC 1
+
+#define IPV6_VERSION 6
+#define IPV6_HOP_LIMIT 255
+
+#define IPV6_ADDR_NULL(a) ((a[0] | a[1] | a[2] | a[3] | a[4] | \
+ a[5] | a[6] | a[7] | a[8] | a[9] | \
+ a[10] | a[11] | a[12] | a[13] | \
+ a[14] | a[15]) == 0)
+
+/* IPV6 address */
+BWL_PRE_PACKED_STRUCT struct ipv6_addr {
+ uint8 addr[16];
+} BWL_POST_PACKED_STRUCT;
+
+
+/* ICMPV6 Header */
+BWL_PRE_PACKED_STRUCT struct icmp6_hdr {
+ uint8 icmp6_type;
+ uint8 icmp6_code;
+ uint16 icmp6_cksum;
+ BWL_PRE_PACKED_STRUCT union {
+ uint32 reserved;
+ BWL_PRE_PACKED_STRUCT struct nd_advt {
+ uint32 reserved1:5,
+ override:1,
+ solicited:1,
+ router:1,
+ reserved2:24;
+ } BWL_POST_PACKED_STRUCT nd_advt;
+ } BWL_POST_PACKED_STRUCT opt;
+} BWL_POST_PACKED_STRUCT;
+
+/* Ipv6 Header Format */
+BWL_PRE_PACKED_STRUCT struct ipv6_hdr {
+ uint8 priority:4,
+ version:4;
+ uint8 flow_lbl[3];
+ uint16 payload_len;
+ uint8 nexthdr;
+ uint8 hop_limit;
+ struct ipv6_addr saddr;
+ struct ipv6_addr daddr;
+} BWL_POST_PACKED_STRUCT;
+
+/* Neighbor Advertisement/Solicitation Packet Structure */
+BWL_PRE_PACKED_STRUCT struct nd_msg {
+ struct icmp6_hdr icmph;
+ struct ipv6_addr target;
+} BWL_POST_PACKED_STRUCT;
+
+
+/* Neighibor Solicitation/Advertisement Optional Structure */
+BWL_PRE_PACKED_STRUCT struct nd_msg_opt {
+ uint8 type;
+ uint8 len;
+ uint8 mac_addr[ETHER_ADDR_LEN];
+} BWL_POST_PACKED_STRUCT;
+
+/* This marks the end of a packed structure section. */
+#include <packed_section_end.h>
+
+#endif /* !defined(_bcmipv6_h_) */
diff --git a/drivers/net/wireless/bcmdhd/src/include/proto/bt_amp_hci.h b/drivers/net/wireless/bcmdhd/include/proto/bt_amp_hci.h
index 49f3949..8617985 100644
--- a/drivers/net/wireless/bcmdhd/src/include/proto/bt_amp_hci.h
+++ b/drivers/net/wireless/bcmdhd/include/proto/bt_amp_hci.h
@@ -1,14 +1,14 @@
/*
* BT-AMP (BlueTooth Alternate Mac and Phy) HCI (Host/Controller Interface)
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,7 +16,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
diff --git a/drivers/net/wireless/bcmdhd/src/include/proto/eapol.h b/drivers/net/wireless/bcmdhd/include/proto/eapol.h
index f19dc55..8936d16 100644
--- a/drivers/net/wireless/bcmdhd/src/include/proto/eapol.h
+++ b/drivers/net/wireless/bcmdhd/include/proto/eapol.h
@@ -75,7 +75,7 @@ typedef BWL_PRE_PACKED_STRUCT struct {
unsigned char key[1]; /* Key (optional) */
} BWL_POST_PACKED_STRUCT eapol_key_header_t;
-#define EAPOL_KEY_HEADER_LEN 44
+#define EAPOL_KEY_HEADER_LEN 44
/* RC4 EAPOL-Key flags */
#define EAPOL_KEY_FLAGS_MASK 0x80
@@ -110,7 +110,7 @@ typedef BWL_PRE_PACKED_STRUCT struct {
unsigned char data[EAPOL_WPA_KEY_DATA_LEN]; /* Key data */
} BWL_POST_PACKED_STRUCT eapol_wpa_key_header_t;
-#define EAPOL_WPA_KEY_LEN 95
+#define EAPOL_WPA_KEY_LEN 95
/* WPA/802.11i/WPA2 KEY KEY_INFO bits */
#define WPA_KEY_DESC_V1 0x01
@@ -146,7 +146,7 @@ typedef BWL_PRE_PACKED_STRUCT struct {
uint8 data[1];
} BWL_POST_PACKED_STRUCT eapol_wpa2_encap_data_t;
-#define EAPOL_WPA2_ENCAP_DATA_HDR_LEN 6
+#define EAPOL_WPA2_ENCAP_DATA_HDR_LEN 6
#define WPA2_KEY_DATA_SUBTYPE_GTK 1
#define WPA2_KEY_DATA_SUBTYPE_STAKEY 2
@@ -161,7 +161,7 @@ typedef BWL_PRE_PACKED_STRUCT struct {
uint8 gtk[EAPOL_WPA_MAX_KEY_SIZE];
} BWL_POST_PACKED_STRUCT eapol_wpa2_key_gtk_encap_t;
-#define EAPOL_WPA2_KEY_GTK_ENCAP_HDR_LEN 2
+#define EAPOL_WPA2_KEY_GTK_ENCAP_HDR_LEN 2
#define WPA2_GTK_INDEX_MASK 0x03
#define WPA2_GTK_INDEX_SHIFT 0x00
@@ -175,7 +175,7 @@ typedef BWL_PRE_PACKED_STRUCT struct {
uint8 key[EAPOL_WPA_MAX_KEY_SIZE];
} BWL_POST_PACKED_STRUCT eapol_wpa2_key_igtk_encap_t;
-#define EAPOL_WPA2_KEY_IGTK_ENCAP_HDR_LEN 8
+#define EAPOL_WPA2_KEY_IGTK_ENCAP_HDR_LEN 8
/* STAKey encapsulation */
typedef BWL_PRE_PACKED_STRUCT struct {
diff --git a/drivers/net/wireless/bcmdhd/src/include/proto/ethernet.h b/drivers/net/wireless/bcmdhd/include/proto/ethernet.h
index f9fc116..e455185 100644
--- a/drivers/net/wireless/bcmdhd/src/include/proto/ethernet.h
+++ b/drivers/net/wireless/bcmdhd/include/proto/ethernet.h
@@ -1,14 +1,14 @@
/*
* From FreeBSD 2.2.7: Fundamental constants relating to ethernet.
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,15 +16,15 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: ethernet.h 300516 2011-12-04 17:39:44Z $
+ * $Id: ethernet.h 309193 2012-01-19 00:03:57Z $
*/
-#ifndef _NET_ETHERNET_H_
+#ifndef _NET_ETHERNET_H_
#define _NET_ETHERNET_H_
#ifndef _TYPEDEFS_H_
@@ -60,26 +60,26 @@
#define ETHER_MAX_DATA 1500
-#define ETHER_TYPE_MIN 0x0600
-#define ETHER_TYPE_IP 0x0800
-#define ETHER_TYPE_ARP 0x0806
-#define ETHER_TYPE_8021Q 0x8100
-#define ETHER_TYPE_IPV6 0x86dd
-#define ETHER_TYPE_BRCM 0x886c
-#define ETHER_TYPE_802_1X 0x888e
-#define ETHER_TYPE_802_1X_PREAUTH 0x88c7
-#define ETHER_TYPE_WAI 0x88b4
-#define ETHER_TYPE_89_0D 0x890d
+#define ETHER_TYPE_MIN 0x0600
+#define ETHER_TYPE_IP 0x0800
+#define ETHER_TYPE_ARP 0x0806
+#define ETHER_TYPE_8021Q 0x8100
+#define ETHER_TYPE_IPV6 0x86dd
+#define ETHER_TYPE_BRCM 0x886c
+#define ETHER_TYPE_802_1X 0x888e
+#define ETHER_TYPE_802_1X_PREAUTH 0x88c7
+#define ETHER_TYPE_WAI 0x88b4
+#define ETHER_TYPE_89_0D 0x890d
-#define ETHER_TYPE_IPV6 0x86dd
+#define ETHER_TYPE_IPV6 0x86dd
-#define ETHER_BRCM_SUBTYPE_LEN 4
+#define ETHER_BRCM_SUBTYPE_LEN 4
-#define ETHER_DEST_OFFSET (0 * ETHER_ADDR_LEN)
-#define ETHER_SRC_OFFSET (1 * ETHER_ADDR_LEN)
-#define ETHER_TYPE_OFFSET (2 * ETHER_ADDR_LEN)
+#define ETHER_DEST_OFFSET (0 * ETHER_ADDR_LEN)
+#define ETHER_SRC_OFFSET (1 * ETHER_ADDR_LEN)
+#define ETHER_TYPE_OFFSET (2 * ETHER_ADDR_LEN)
#define ETHER_IS_VALID_LEN(foo) \
@@ -94,7 +94,7 @@
((uint8 *)ea)[5] = ((mgrp_ip) >> 0) & 0xff; \
}
-#ifndef __INCif_etherh
+#ifndef __INCif_etherh
BWL_PRE_PACKED_STRUCT struct ether_header {
uint8 ether_dhost[ETHER_ADDR_LEN];
@@ -106,11 +106,11 @@ BWL_PRE_PACKED_STRUCT struct ether_header {
BWL_PRE_PACKED_STRUCT struct ether_addr {
uint8 octet[ETHER_ADDR_LEN];
} BWL_POST_PACKED_STRUCT;
-#endif
+#endif
#define ETHER_SET_LOCALADDR(ea) (((uint8 *)(ea))[0] = (((uint8 *)(ea))[0] | 2))
-#define ETHER_IS_LOCALADDR(ea) (((uint8 *)(ea))[0] & 2)
+#define ETHER_IS_LOCALADDR(ea) (((uint8 *)(ea))[0] & 2)
#define ETHER_CLR_LOCALADDR(ea) (((uint8 *)(ea))[0] = (((uint8 *)(ea))[0] & 0xfd))
#define ETHER_TOGGLE_LOCALADDR(ea) (((uint8 *)(ea))[0] = (((uint8 *)(ea))[0] ^ 2))
@@ -159,4 +159,4 @@ do { \
#include <packed_section_end.h>
-#endif
+#endif
diff --git a/drivers/net/wireless/bcmdhd/include/proto/p2p.h b/drivers/net/wireless/bcmdhd/include/proto/p2p.h
new file mode 100644
index 0000000..206effc
--- /dev/null
+++ b/drivers/net/wireless/bcmdhd/include/proto/p2p.h
@@ -0,0 +1,565 @@
+/*
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
+ * Unless you and Broadcom execute a separate written software license
+ * agreement governing use of this software, this software is licensed to you
+ * under the terms of the GNU General Public License version 2 (the "GPL"),
+ * available at http://www.broadcom.com/licenses/GPLv2.php, with the
+ * following added to such license:
+ *
+ * As a special exception, the copyright holders of this software give you
+ * permission to link this software with independent modules, and to copy and
+ * distribute the resulting executable under terms of your choice, provided that
+ * you also meet, for each linked independent module, the terms and conditions of
+ * the license of that module. An independent module is a module which is not
+ * derived from this software. The special exception does not apply to any
+ * modifications of the software.
+ *
+ * Notwithstanding the above, under no circumstances may you combine this
+ * software in any way with any other Broadcom software provided under a license
+ * other than the GPL, without Broadcom's express prior written consent.
+ *
+ * Fundamental types and constants relating to WFA P2P (aka WiFi Direct)
+ *
+ * $Id: p2p.h 357863 2012-09-20 06:40:47Z $
+ */
+
+#ifndef _P2P_H_
+#define _P2P_H_
+
+#ifndef _TYPEDEFS_H_
+#include <typedefs.h>
+#endif
+#include <wlioctl.h>
+#include <proto/802.11.h>
+
+
+#include <packed_section_start.h>
+
+
+
+#define P2P_OUI WFA_OUI
+#define P2P_VER WFA_OUI_TYPE_P2P
+
+#define P2P_IE_ID 0xdd
+
+
+BWL_PRE_PACKED_STRUCT struct wifi_p2p_ie {
+ uint8 id;
+ uint8 len;
+ uint8 OUI[3];
+ uint8 oui_type;
+ uint8 subelts[1];
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2p_ie wifi_p2p_ie_t;
+
+#define P2P_IE_FIXED_LEN 6
+
+#define P2P_ATTR_ID_OFF 0
+#define P2P_ATTR_LEN_OFF 1
+#define P2P_ATTR_DATA_OFF 3
+
+#define P2P_ATTR_ID_LEN 1
+#define P2P_ATTR_LEN_LEN 2
+#define P2P_ATTR_HDR_LEN 3
+
+
+#define P2P_SEID_STATUS 0
+#define P2P_SEID_MINOR_RC 1
+#define P2P_SEID_P2P_INFO 2
+#define P2P_SEID_DEV_ID 3
+#define P2P_SEID_INTENT 4
+#define P2P_SEID_CFG_TIMEOUT 5
+#define P2P_SEID_CHANNEL 6
+#define P2P_SEID_GRP_BSSID 7
+#define P2P_SEID_XT_TIMING 8
+#define P2P_SEID_INTINTADDR 9
+#define P2P_SEID_P2P_MGBTY 10
+#define P2P_SEID_CHAN_LIST 11
+#define P2P_SEID_ABSENCE 12
+#define P2P_SEID_DEV_INFO 13
+#define P2P_SEID_GROUP_INFO 14
+#define P2P_SEID_GROUP_ID 15
+#define P2P_SEID_P2P_IF 16
+#define P2P_SEID_OP_CHANNEL 17
+#define P2P_SEID_INVITE_FLAGS 18
+#define P2P_SEID_VNDR 221
+
+#define P2P_SE_VS_ID_SERVICES 0x1b
+
+
+
+BWL_PRE_PACKED_STRUCT struct wifi_p2p_info_se_s {
+ uint8 eltId;
+ uint8 len[2];
+ uint8 dev;
+ uint8 group;
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2p_info_se_s wifi_p2p_info_se_t;
+
+
+#define P2P_CAPSE_DEV_SERVICE_DIS 0x1
+#define P2P_CAPSE_DEV_CLIENT_DIS 0x2
+#define P2P_CAPSE_DEV_CONCURRENT 0x4
+#define P2P_CAPSE_DEV_INFRA_MAN 0x8
+#define P2P_CAPSE_DEV_LIMIT 0x10
+#define P2P_CAPSE_INVITE_PROC 0x20
+
+
+#define P2P_CAPSE_GRP_OWNER 0x1
+#define P2P_CAPSE_PERSIST_GRP 0x2
+#define P2P_CAPSE_GRP_LIMIT 0x4
+#define P2P_CAPSE_GRP_INTRA_BSS 0x8
+#define P2P_CAPSE_GRP_X_CONNECT 0x10
+#define P2P_CAPSE_GRP_PERSISTENT 0x20
+#define P2P_CAPSE_GRP_FORMATION 0x40
+
+
+
+BWL_PRE_PACKED_STRUCT struct wifi_p2p_intent_se_s {
+ uint8 eltId;
+ uint8 len[2];
+ uint8 intent;
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2p_intent_se_s wifi_p2p_intent_se_t;
+
+
+BWL_PRE_PACKED_STRUCT struct wifi_p2p_cfg_tmo_se_s {
+ uint8 eltId;
+ uint8 len[2];
+ uint8 go_tmo;
+ uint8 client_tmo;
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2p_cfg_tmo_se_s wifi_p2p_cfg_tmo_se_t;
+
+
+BWL_PRE_PACKED_STRUCT struct wifi_p2p_listen_channel_se_s {
+ uint8 eltId;
+ uint8 len[2];
+ uint8 country[3];
+ uint8 op_class;
+ uint8 channel;
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2p_listen_channel_se_s wifi_p2p_listen_channel_se_t;
+
+
+BWL_PRE_PACKED_STRUCT struct wifi_p2p_grp_bssid_se_s {
+ uint8 eltId;
+ uint8 len[2];
+ uint8 mac[6];
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2p_grp_bssid_se_s wifi_p2p_grp_bssid_se_t;
+
+
+BWL_PRE_PACKED_STRUCT struct wifi_p2p_grp_id_se_s {
+ uint8 eltId;
+ uint8 len[2];
+ uint8 mac[6];
+ uint8 ssid[1];
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2p_grp_id_se_s wifi_p2p_grp_id_se_t;
+
+
+BWL_PRE_PACKED_STRUCT struct wifi_p2p_intf_se_s {
+ uint8 eltId;
+ uint8 len[2];
+ uint8 mac[6];
+ uint8 ifaddrs;
+ uint8 ifaddr[1][6];
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2p_intf_se_s wifi_p2p_intf_se_t;
+
+
+BWL_PRE_PACKED_STRUCT struct wifi_p2p_status_se_s {
+ uint8 eltId;
+ uint8 len[2];
+ uint8 status;
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2p_status_se_s wifi_p2p_status_se_t;
+
+
+#define P2P_STATSE_SUCCESS 0
+
+#define P2P_STATSE_FAIL_INFO_CURR_UNAVAIL 1
+
+#define P2P_STATSE_PASSED_UP P2P_STATSE_FAIL_INFO_CURR_UNAVAIL
+
+#define P2P_STATSE_FAIL_INCOMPAT_PARAMS 2
+
+#define P2P_STATSE_FAIL_LIMIT_REACHED 3
+
+#define P2P_STATSE_FAIL_INVALID_PARAMS 4
+
+#define P2P_STATSE_FAIL_UNABLE_TO_ACCOM 5
+
+#define P2P_STATSE_FAIL_PROTO_ERROR 6
+
+#define P2P_STATSE_FAIL_NO_COMMON_CHAN 7
+
+#define P2P_STATSE_FAIL_UNKNOWN_GROUP 8
+
+#define P2P_STATSE_FAIL_INTENT 9
+
+#define P2P_STATSE_FAIL_INCOMPAT_PROVIS 10
+
+#define P2P_STATSE_FAIL_USER_REJECT 11
+
+
+
+BWL_PRE_PACKED_STRUCT struct wifi_p2p_ext_se_s {
+ uint8 eltId;
+ uint8 len[2];
+ uint8 avail[2];
+ uint8 interval[2];
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2p_ext_se_s wifi_p2p_ext_se_t;
+
+#define P2P_EXT_MIN 10
+
+
+BWL_PRE_PACKED_STRUCT struct wifi_p2p_intintad_se_s {
+ uint8 eltId;
+ uint8 len[2];
+ uint8 mac[6];
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2p_intintad_se_s wifi_p2p_intintad_se_t;
+
+
+BWL_PRE_PACKED_STRUCT struct wifi_p2p_channel_se_s {
+ uint8 eltId;
+ uint8 len[2];
+ uint8 band;
+ uint8 channel;
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2p_channel_se_s wifi_p2p_channel_se_t;
+
+
+
+BWL_PRE_PACKED_STRUCT struct wifi_p2p_chanlist_entry_s {
+ uint8 band;
+ uint8 num_channels;
+ uint8 channels[WL_NUMCHANNELS];
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2p_chanlist_entry_s wifi_p2p_chanlist_entry_t;
+#define WIFI_P2P_CHANLIST_SE_MAX_ENTRIES 2
+
+
+BWL_PRE_PACKED_STRUCT struct wifi_p2p_chanlist_se_s {
+ uint8 eltId;
+ uint8 len[2];
+ uint8 country[3];
+ uint8 num_entries;
+ wifi_p2p_chanlist_entry_t entries[WIFI_P2P_CHANLIST_SE_MAX_ENTRIES];
+
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2p_chanlist_se_s wifi_p2p_chanlist_se_t;
+
+
+BWL_PRE_PACKED_STRUCT struct wifi_p2p_pri_devtype_s {
+ uint16 cat_id;
+ uint8 OUI[3];
+ uint8 oui_type;
+ uint16 sub_cat_id;
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2p_pri_devtype_s wifi_p2p_pri_devtype_t;
+
+
+BWL_PRE_PACKED_STRUCT struct wifi_p2p_devinfo_se_s {
+ uint8 eltId;
+ uint8 len[2];
+ uint8 mac[6];
+ uint16 wps_cfg_meths;
+ uint8 pri_devtype[8];
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2p_devinfo_se_s wifi_p2p_devinfo_se_t;
+
+#define P2P_DEV_TYPE_LEN 8
+
+
+BWL_PRE_PACKED_STRUCT struct wifi_p2p_cid_fixed_s {
+ uint8 len;
+ uint8 devaddr[ETHER_ADDR_LEN];
+ uint8 ifaddr[ETHER_ADDR_LEN];
+ uint8 devcap;
+ uint8 cfg_meths[2];
+ uint8 pridt[P2P_DEV_TYPE_LEN];
+ uint8 secdts;
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2p_cid_fixed_s wifi_p2p_cid_fixed_t;
+
+
+BWL_PRE_PACKED_STRUCT struct wifi_p2p_devid_se_s {
+ uint8 eltId;
+ uint8 len[2];
+ struct ether_addr addr;
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2p_devid_se_s wifi_p2p_devid_se_t;
+
+
+BWL_PRE_PACKED_STRUCT struct wifi_p2p_mgbt_se_s {
+ uint8 eltId;
+ uint8 len[2];
+ uint8 mg_bitmap;
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2p_mgbt_se_s wifi_p2p_mgbt_se_t;
+
+#define P2P_MGBTSE_P2PDEVMGMT_FLAG 0x1
+
+
+BWL_PRE_PACKED_STRUCT struct wifi_p2p_grpinfo_se_s {
+ uint8 eltId;
+ uint8 len[2];
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2p_grpinfo_se_s wifi_p2p_grpinfo_se_t;
+
+
+BWL_PRE_PACKED_STRUCT struct wifi_p2p_op_channel_se_s {
+ uint8 eltId;
+ uint8 len[2];
+ uint8 country[3];
+ uint8 op_class;
+ uint8 channel;
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2p_op_channel_se_s wifi_p2p_op_channel_se_t;
+
+
+BWL_PRE_PACKED_STRUCT struct wifi_p2p_invite_flags_se_s {
+ uint8 eltId;
+ uint8 len[2];
+ uint8 flags;
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2p_invite_flags_se_s wifi_p2p_invite_flags_se_t;
+
+
+BWL_PRE_PACKED_STRUCT struct wifi_p2p_action_frame {
+ uint8 category;
+ uint8 OUI[3];
+ uint8 type;
+ uint8 subtype;
+ uint8 dialog_token;
+ uint8 elts[1];
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2p_action_frame wifi_p2p_action_frame_t;
+#define P2P_AF_CATEGORY 0x7f
+
+#define P2P_AF_FIXED_LEN 7
+
+
+#define P2P_AF_NOTICE_OF_ABSENCE 0
+#define P2P_AF_PRESENCE_REQ 1
+#define P2P_AF_PRESENCE_RSP 2
+#define P2P_AF_GO_DISC_REQ 3
+
+
+
+BWL_PRE_PACKED_STRUCT struct wifi_p2p_pub_act_frame {
+ uint8 category;
+ uint8 action;
+ uint8 oui[3];
+ uint8 oui_type;
+ uint8 subtype;
+ uint8 dialog_token;
+ uint8 elts[1];
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2p_pub_act_frame wifi_p2p_pub_act_frame_t;
+#define P2P_PUB_AF_FIXED_LEN 8
+#define P2P_PUB_AF_CATEGORY 0x04
+#define P2P_PUB_AF_ACTION 0x09
+
+
+#define P2P_PAF_GON_REQ 0
+#define P2P_PAF_GON_RSP 1
+#define P2P_PAF_GON_CONF 2
+#define P2P_PAF_INVITE_REQ 3
+#define P2P_PAF_INVITE_RSP 4
+#define P2P_PAF_DEVDIS_REQ 5
+#define P2P_PAF_DEVDIS_RSP 6
+#define P2P_PAF_PROVDIS_REQ 7
+#define P2P_PAF_PROVDIS_RSP 8
+#define P2P_PAF_SUBTYPE_INVALID 255
+
+
+#define P2P_TYPE_MNREQ P2P_PAF_GON_REQ
+#define P2P_TYPE_MNRSP P2P_PAF_GON_RSP
+#define P2P_TYPE_MNCONF P2P_PAF_GON_CONF
+
+
+BWL_PRE_PACKED_STRUCT struct wifi_p2p_noa_desc {
+ uint8 cnt_type;
+ uint32 duration;
+ uint32 interval;
+ uint32 start;
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2p_noa_desc wifi_p2p_noa_desc_t;
+
+BWL_PRE_PACKED_STRUCT struct wifi_p2p_noa_se {
+ uint8 eltId;
+ uint8 len[2];
+ uint8 index;
+ uint8 ops_ctw_parms;
+ wifi_p2p_noa_desc_t desc[1];
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2p_noa_se wifi_p2p_noa_se_t;
+
+#define P2P_NOA_SE_FIXED_LEN 5
+
+
+#define P2P_NOA_DESC_CNT_RESERVED 0
+#define P2P_NOA_DESC_CNT_REPEAT 255
+#define P2P_NOA_DESC_TYPE_PREFERRED 1
+#define P2P_NOA_DESC_TYPE_ACCEPTABLE 2
+
+
+#define P2P_NOA_CTW_MASK 0x7f
+#define P2P_NOA_OPS_MASK 0x80
+#define P2P_NOA_OPS_SHIFT 7
+
+#define P2P_CTW_MIN 10
+
+
+#define P2PSD_ACTION_CATEGORY 0x04
+
+#define P2PSD_ACTION_ID_GAS_IREQ 0x0a
+
+#define P2PSD_ACTION_ID_GAS_IRESP 0x0b
+
+#define P2PSD_ACTION_ID_GAS_CREQ 0x0c
+
+#define P2PSD_ACTION_ID_GAS_CRESP 0x0d
+
+#define P2PSD_AD_EID 0x6c
+
+#define P2PSD_ADP_TUPLE_QLMT_PAMEBI 0x00
+
+#define P2PSD_ADP_PROTO_ID 0x00
+
+#define P2PSD_GAS_OUI P2P_OUI
+
+#define P2PSD_GAS_OUI_SUBTYPE P2P_VER
+
+#define P2PSD_GAS_NQP_INFOID 0xDDDD
+
+#define P2PSD_GAS_COMEBACKDEALY 0x00
+
+
+
+typedef enum p2psd_svc_protype {
+ SVC_RPOTYPE_ALL = 0,
+ SVC_RPOTYPE_BONJOUR = 1,
+ SVC_RPOTYPE_UPNP = 2,
+ SVC_RPOTYPE_WSD = 3,
+ SVC_RPOTYPE_VENDOR = 255
+} p2psd_svc_protype_t;
+
+
+typedef enum {
+ P2PSD_RESP_STATUS_SUCCESS = 0,
+ P2PSD_RESP_STATUS_PROTYPE_NA = 1,
+ P2PSD_RESP_STATUS_DATA_NA = 2,
+ P2PSD_RESP_STATUS_BAD_REQUEST = 3
+} p2psd_resp_status_t;
+
+
+BWL_PRE_PACKED_STRUCT struct wifi_p2psd_adp_tpl {
+ uint8 llm_pamebi;
+ uint8 adp_id;
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2psd_adp_tpl wifi_p2psd_adp_tpl_t;
+
+
+BWL_PRE_PACKED_STRUCT struct wifi_p2psd_adp_ie {
+ uint8 id;
+ uint8 len;
+ wifi_p2psd_adp_tpl_t adp_tpl;
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2psd_adp_ie wifi_p2psd_adp_ie_t;
+
+
+BWL_PRE_PACKED_STRUCT struct wifi_p2psd_nqp_query_vsc {
+ uint8 oui_subtype;
+ uint16 svc_updi;
+ uint8 svc_tlvs[1];
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2psd_nqp_query_vsc wifi_p2psd_nqp_query_vsc_t;
+
+
+BWL_PRE_PACKED_STRUCT struct wifi_p2psd_qreq_tlv {
+ uint16 len;
+ uint8 svc_prot;
+ uint8 svc_tscid;
+ uint8 query_data[1];
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2psd_qreq_tlv wifi_p2psd_qreq_tlv_t;
+
+
+BWL_PRE_PACKED_STRUCT struct wifi_p2psd_qreq_frame {
+ uint16 info_id;
+ uint16 len;
+ uint8 oui[3];
+ uint8 qreq_vsc[1];
+
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2psd_qreq_frame wifi_p2psd_qreq_frame_t;
+
+
+BWL_PRE_PACKED_STRUCT struct wifi_p2psd_gas_ireq_frame {
+ wifi_p2psd_adp_ie_t adp_ie;
+ uint16 qreq_len;
+ uint8 qreq_frm[1];
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2psd_gas_ireq_frame wifi_p2psd_gas_ireq_frame_t;
+
+
+BWL_PRE_PACKED_STRUCT struct wifi_p2psd_qresp_tlv {
+ uint16 len;
+ uint8 svc_prot;
+ uint8 svc_tscid;
+ uint8 status;
+ uint8 query_data[1];
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2psd_qresp_tlv wifi_p2psd_qresp_tlv_t;
+
+
+BWL_PRE_PACKED_STRUCT struct wifi_p2psd_qresp_frame {
+ uint16 info_id;
+ uint16 len;
+ uint8 oui[3];
+ uint8 qresp_vsc[1];
+
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2psd_qresp_frame wifi_p2psd_qresp_frame_t;
+
+
+BWL_PRE_PACKED_STRUCT struct wifi_p2psd_gas_iresp_frame {
+ uint16 status;
+ uint16 cb_delay;
+ wifi_p2psd_adp_ie_t adp_ie;
+ uint16 qresp_len;
+ uint8 qresp_frm[1];
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2psd_gas_iresp_frame wifi_p2psd_gas_iresp_frame_t;
+
+
+BWL_PRE_PACKED_STRUCT struct wifi_p2psd_gas_cresp_frame {
+ uint16 status;
+ uint8 fragment_id;
+ uint16 cb_delay;
+ wifi_p2psd_adp_ie_t adp_ie;
+ uint16 qresp_len;
+ uint8 qresp_frm[1];
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2psd_gas_cresp_frame wifi_p2psd_gas_cresp_frame_t;
+
+
+BWL_PRE_PACKED_STRUCT struct wifi_p2psd_gas_pub_act_frame {
+ uint8 category;
+ uint8 action;
+ uint8 dialog_token;
+ uint8 query_data[1];
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2psd_gas_pub_act_frame wifi_p2psd_gas_pub_act_frame_t;
+
+
+#include <packed_section_end.h>
+
+#endif
diff --git a/drivers/net/wireless/bcmdhd/src/include/proto/sdspi.h b/drivers/net/wireless/bcmdhd/include/proto/sdspi.h
index 94a2d3c..a4900ed 100644
--- a/drivers/net/wireless/bcmdhd/src/include/proto/sdspi.h
+++ b/drivers/net/wireless/bcmdhd/include/proto/sdspi.h
@@ -1,14 +1,14 @@
/*
* SD-SPI Protocol Standard
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,7 +16,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
@@ -26,44 +26,44 @@
#ifndef _SD_SPI_H
#define _SD_SPI_H
-#define SPI_START_M BITFIELD_MASK(1) /* Bit [31] - Start Bit */
+#define SPI_START_M BITFIELD_MASK(1) /* Bit [31] - Start Bit */
#define SPI_START_S 31
-#define SPI_DIR_M BITFIELD_MASK(1) /* Bit [30] - Direction */
+#define SPI_DIR_M BITFIELD_MASK(1) /* Bit [30] - Direction */
#define SPI_DIR_S 30
#define SPI_CMD_INDEX_M BITFIELD_MASK(6) /* Bits [29:24] - Command number */
#define SPI_CMD_INDEX_S 24
-#define SPI_RW_M BITFIELD_MASK(1) /* Bit [23] - Read=0, Write=1 */
+#define SPI_RW_M BITFIELD_MASK(1) /* Bit [23] - Read=0, Write=1 */
#define SPI_RW_S 23
#define SPI_FUNC_M BITFIELD_MASK(3) /* Bits [22:20] - Function Number */
#define SPI_FUNC_S 20
-#define SPI_RAW_M BITFIELD_MASK(1) /* Bit [19] - Read After Wr */
+#define SPI_RAW_M BITFIELD_MASK(1) /* Bit [19] - Read After Wr */
#define SPI_RAW_S 19
-#define SPI_STUFF_M BITFIELD_MASK(1) /* Bit [18] - Stuff bit */
+#define SPI_STUFF_M BITFIELD_MASK(1) /* Bit [18] - Stuff bit */
#define SPI_STUFF_S 18
-#define SPI_BLKMODE_M BITFIELD_MASK(1) /* Bit [19] - Blockmode 1=blk */
+#define SPI_BLKMODE_M BITFIELD_MASK(1) /* Bit [19] - Blockmode 1=blk */
#define SPI_BLKMODE_S 19
-#define SPI_OPCODE_M BITFIELD_MASK(1) /* Bit [18] - OP Code */
+#define SPI_OPCODE_M BITFIELD_MASK(1) /* Bit [18] - OP Code */
#define SPI_OPCODE_S 18
-#define SPI_ADDR_M BITFIELD_MASK(17) /* Bits [17:1] - Address */
+#define SPI_ADDR_M BITFIELD_MASK(17) /* Bits [17:1] - Address */
#define SPI_ADDR_S 1
-#define SPI_STUFF0_M BITFIELD_MASK(1) /* Bit [0] - Stuff bit */
+#define SPI_STUFF0_M BITFIELD_MASK(1) /* Bit [0] - Stuff bit */
#define SPI_STUFF0_S 0
-#define SPI_RSP_START_M BITFIELD_MASK(1) /* Bit [7] - Start Bit (always 0) */
+#define SPI_RSP_START_M BITFIELD_MASK(1) /* Bit [7] - Start Bit (always 0) */
#define SPI_RSP_START_S 7
-#define SPI_RSP_PARAM_ERR_M BITFIELD_MASK(1) /* Bit [6] - Parameter Error */
+#define SPI_RSP_PARAM_ERR_M BITFIELD_MASK(1) /* Bit [6] - Parameter Error */
#define SPI_RSP_PARAM_ERR_S 6
-#define SPI_RSP_RFU5_M BITFIELD_MASK(1) /* Bit [5] - RFU (Always 0) */
+#define SPI_RSP_RFU5_M BITFIELD_MASK(1) /* Bit [5] - RFU (Always 0) */
#define SPI_RSP_RFU5_S 5
-#define SPI_RSP_FUNC_ERR_M BITFIELD_MASK(1) /* Bit [4] - Function number error */
+#define SPI_RSP_FUNC_ERR_M BITFIELD_MASK(1) /* Bit [4] - Function number error */
#define SPI_RSP_FUNC_ERR_S 4
-#define SPI_RSP_CRC_ERR_M BITFIELD_MASK(1) /* Bit [3] - COM CRC Error */
+#define SPI_RSP_CRC_ERR_M BITFIELD_MASK(1) /* Bit [3] - COM CRC Error */
#define SPI_RSP_CRC_ERR_S 3
-#define SPI_RSP_ILL_CMD_M BITFIELD_MASK(1) /* Bit [2] - Illegal Command error */
+#define SPI_RSP_ILL_CMD_M BITFIELD_MASK(1) /* Bit [2] - Illegal Command error */
#define SPI_RSP_ILL_CMD_S 2
-#define SPI_RSP_RFU1_M BITFIELD_MASK(1) /* Bit [1] - RFU (Always 0) */
+#define SPI_RSP_RFU1_M BITFIELD_MASK(1) /* Bit [1] - RFU (Always 0) */
#define SPI_RSP_RFU1_S 1
-#define SPI_RSP_IDLE_M BITFIELD_MASK(1) /* Bit [0] - In idle state */
+#define SPI_RSP_IDLE_M BITFIELD_MASK(1) /* Bit [0] - In idle state */
#define SPI_RSP_IDLE_S 0
/* SD-SPI Protocol Definitions */
diff --git a/drivers/net/wireless/bcmdhd/src/include/proto/vlan.h b/drivers/net/wireless/bcmdhd/include/proto/vlan.h
index 168be85..9c94985 100644
--- a/drivers/net/wireless/bcmdhd/src/include/proto/vlan.h
+++ b/drivers/net/wireless/bcmdhd/include/proto/vlan.h
@@ -1,14 +1,14 @@
/*
* 802.1Q VLAN protocol definitions
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,7 +16,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
@@ -34,22 +34,22 @@
#include <packed_section_start.h>
-#define VLAN_VID_MASK 0xfff
-#define VLAN_CFI_SHIFT 12
-#define VLAN_PRI_SHIFT 13
+#define VLAN_VID_MASK 0xfff
+#define VLAN_CFI_SHIFT 12
+#define VLAN_PRI_SHIFT 13
-#define VLAN_PRI_MASK 7
+#define VLAN_PRI_MASK 7
#define VLAN_TAG_LEN 4
-#define VLAN_TAG_OFFSET (2 * ETHER_ADDR_LEN)
+#define VLAN_TAG_OFFSET (2 * ETHER_ADDR_LEN)
-#define VLAN_TPID 0x8100
+#define VLAN_TPID 0x8100
struct ethervlan_header {
uint8 ether_dhost[ETHER_ADDR_LEN];
uint8 ether_shost[ETHER_ADDR_LEN];
- uint16 vlan_type;
- uint16 vlan_tag;
+ uint16 vlan_type;
+ uint16 vlan_tag;
uint16 ether_type;
};
@@ -66,4 +66,4 @@ do { \
*(struct ethervlan_header *)(d) = t; \
} while (0)
-#endif
+#endif
diff --git a/drivers/net/wireless/bcmdhd/src/include/proto/wpa.h b/drivers/net/wireless/bcmdhd/include/proto/wpa.h
index b8a10e0..47bc354 100644
--- a/drivers/net/wireless/bcmdhd/src/include/proto/wpa.h
+++ b/drivers/net/wireless/bcmdhd/include/proto/wpa.h
@@ -1,14 +1,14 @@
/*
* Fundamental types and constants relating to WPA
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,7 +16,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
@@ -37,43 +37,43 @@
#include <dhd_sec_feature.h>
-#define DOT11_RC_INVALID_WPA_IE 13
-#define DOT11_RC_MIC_FAILURE 14
-#define DOT11_RC_4WH_TIMEOUT 15
-#define DOT11_RC_GTK_UPDATE_TIMEOUT 16
-#define DOT11_RC_WPA_IE_MISMATCH 17
-#define DOT11_RC_INVALID_MC_CIPHER 18
-#define DOT11_RC_INVALID_UC_CIPHER 19
-#define DOT11_RC_INVALID_AKMP 20
-#define DOT11_RC_BAD_WPA_VERSION 21
-#define DOT11_RC_INVALID_WPA_CAP 22
-#define DOT11_RC_8021X_AUTH_FAIL 23
+#define DOT11_RC_INVALID_WPA_IE 13
+#define DOT11_RC_MIC_FAILURE 14
+#define DOT11_RC_4WH_TIMEOUT 15
+#define DOT11_RC_GTK_UPDATE_TIMEOUT 16
+#define DOT11_RC_WPA_IE_MISMATCH 17
+#define DOT11_RC_INVALID_MC_CIPHER 18
+#define DOT11_RC_INVALID_UC_CIPHER 19
+#define DOT11_RC_INVALID_AKMP 20
+#define DOT11_RC_BAD_WPA_VERSION 21
+#define DOT11_RC_INVALID_WPA_CAP 22
+#define DOT11_RC_8021X_AUTH_FAIL 23
#define WPA2_PMKID_LEN 16
typedef BWL_PRE_PACKED_STRUCT struct
{
- uint8 tag;
- uint8 length;
- uint8 oui[3];
- uint8 oui_type;
+ uint8 tag;
+ uint8 length;
+ uint8 oui[3];
+ uint8 oui_type;
BWL_PRE_PACKED_STRUCT struct {
uint8 low;
uint8 high;
- } BWL_POST_PACKED_STRUCT version;
+ } BWL_POST_PACKED_STRUCT version;
} BWL_POST_PACKED_STRUCT wpa_ie_fixed_t;
#define WPA_IE_OUITYPE_LEN 4
#define WPA_IE_FIXED_LEN 8
#define WPA_IE_TAG_FIXED_LEN 6
typedef BWL_PRE_PACKED_STRUCT struct {
- uint8 tag;
- uint8 length;
+ uint8 tag;
+ uint8 length;
BWL_PRE_PACKED_STRUCT struct {
uint8 low;
uint8 high;
- } BWL_POST_PACKED_STRUCT version;
+ } BWL_POST_PACKED_STRUCT version;
} BWL_POST_PACKED_STRUCT wpa_rsn_ie_fixed_t;
#define WPA_RSN_IE_FIXED_LEN 4
#define WPA_RSN_IE_TAG_FIXED_LEN 2
@@ -107,22 +107,30 @@ typedef BWL_PRE_PACKED_STRUCT struct
} BWL_POST_PACKED_STRUCT wpa_pmkid_list_t;
-#define WPA_CIPHER_NONE 0
-#define WPA_CIPHER_WEP_40 1
-#define WPA_CIPHER_TKIP 2
-#define WPA_CIPHER_AES_OCB 3
-#define WPA_CIPHER_AES_CCM 4
-#define WPA_CIPHER_WEP_104 5
-#define WPA_CIPHER_BIP 6
-#define WPA_CIPHER_TPK 7
-
+#define WPA_CIPHER_NONE 0
+#define WPA_CIPHER_WEP_40 1
+#define WPA_CIPHER_TKIP 2
+#define WPA_CIPHER_AES_OCB 3
+#define WPA_CIPHER_AES_CCM 4
+#define WPA_CIPHER_WEP_104 5
+#define WPA_CIPHER_BIP 6
+#define WPA_CIPHER_TPK 7
+#ifdef BCMCCX
+#define WPA_CIPHER_CKIP 8
+#define WPA_CIPHER_CKIP_MMH 9
+#define WPA_CIPHER_WEP_MMH 10
+
+#define IS_CCX_CIPHER(cipher) ((cipher) == WPA_CIPHER_CKIP || \
+ (cipher) == WPA_CIPHER_CKIP_MMH || \
+ (cipher) == WPA_CIPHER_WEP_MMH)
+#endif
#ifdef BCMWAPI_WAI
#define WAPI_CIPHER_NONE WPA_CIPHER_NONE
#define WAPI_CIPHER_SMS4 11
#define WAPI_CSE_WPI_SMS4 1
-#endif /* BCMWAPI_WAI */
+#endif
#define IS_WPA_CIPHER(cipher) ((cipher) == WPA_CIPHER_NONE || \
(cipher) == WPA_CIPHER_WEP_40 || \
@@ -136,20 +144,20 @@ typedef BWL_PRE_PACKED_STRUCT struct
#define IS_WAPI_CIPHER(cipher) ((cipher) == WAPI_CIPHER_NONE || \
(cipher) == WAPI_CSE_WPI_SMS4)
-/* convert WAPI_CSE_WPI_XXX to WAPI_CIPHER_XXX */
+
#define WAPI_CSE_WPI_2_CIPHER(cse) ((cse) == WAPI_CSE_WPI_SMS4 ? \
WAPI_CIPHER_SMS4 : WAPI_CIPHER_NONE)
#define WAPI_CIPHER_2_CSE_WPI(cipher) ((cipher) == WAPI_CIPHER_SMS4 ? \
WAPI_CSE_WPI_SMS4 : WAPI_CIPHER_NONE)
-#endif /* BCMWAPI_WAI */
+#endif
+
-/* WPA TKIP countermeasures parameters */
-#define WPA_TKIP_CM_DETECT 60 /* multiple MIC failure window (seconds) */
-#define WPA_TKIP_CM_BLOCK 60 /* countermeasures active window (seconds) */
+#define WPA_TKIP_CM_DETECT 60
+#define WPA_TKIP_CM_BLOCK 60
-#define RSN_CAP_LEN 2
+#define RSN_CAP_LEN 2
#define RSN_CAP_PREAUTH 0x0001
@@ -174,11 +182,11 @@ typedef BWL_PRE_PACKED_STRUCT struct
#define WPA_CAP_REPLAY_CNTR_MASK RSN_CAP_PTK_REPLAY_CNTR_MASK
-#define WPA_CAP_PEER_KEY_ENABLE (0x1 << 1)
+#define WPA_CAP_PEER_KEY_ENABLE (0x1 << 1)
-#define WPA_CAP_LEN RSN_CAP_LEN
-#define WPA_PMKID_CNT_LEN 2
+#define WPA_CAP_LEN RSN_CAP_LEN
+#define WPA_PMKID_CNT_LEN 2
#define WPA_CAP_WPA2_PREAUTH RSN_CAP_PREAUTH
@@ -187,18 +195,18 @@ typedef BWL_PRE_PACKED_STRUCT struct
#ifdef BCMWAPI_WAI
#define WAPI_CAP_PREAUTH RSN_CAP_PREAUTH
-/* Other WAI definition */
+
#define WAPI_WAI_REQUEST 0x00F1
#define WAPI_UNICAST_REKEY 0x00F2
#define WAPI_STA_AGING 0x00F3
#define WAPI_MUTIL_REKEY 0x00F4
#define WAPI_STA_STATS 0x00F5
-#define WAPI_USK_REKEY_COUNT 0x4000000 /* 0xA00000 */
-#define WAPI_MSK_REKEY_COUNT 0x4000000 /* 0xA00000 */
-#endif /* BCMWAPI_WAI */
+#define WAPI_USK_REKEY_COUNT 0x4000000
+#define WAPI_MSK_REKEY_COUNT 0x4000000
+#endif
+
-/* This marks the end of a packed structure section. */
#include <packed_section_end.h>
-#endif
+#endif
diff --git a/drivers/net/wireless/bcmdhd/src/include/proto/wps.h b/drivers/net/wireless/bcmdhd/include/proto/wps.h
index 9d98a37..cccbfff 100644
--- a/drivers/net/wireless/bcmdhd/src/include/proto/wps.h
+++ b/drivers/net/wireless/bcmdhd/include/proto/wps.h
@@ -1,14 +1,14 @@
/*
* WPS IE definitions
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,7 +16,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
diff --git a/drivers/net/wireless/bcmdhd/src/include/sbchipc.h b/drivers/net/wireless/bcmdhd/include/sbchipc.h
index 03039a6..5feb743 100644
--- a/drivers/net/wireless/bcmdhd/src/include/sbchipc.h
+++ b/drivers/net/wireless/bcmdhd/include/sbchipc.h
@@ -5,16 +5,16 @@
* JTAG, 0/1/2 UARTs, clock frequency control, a watchdog interrupt timer,
* GPIO interface, extbus, and support for serial and parallel flashes.
*
- * $Id: sbchipc.h 307724 2012-01-12 10:41:05Z $
- *
- * Copyright (C) 1999-2011, Broadcom Corporation
+ * $Id: sbchipc.h 347614 2012-07-27 10:24:51Z $
*
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -22,7 +22,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
@@ -38,7 +38,7 @@
#define _PADLINE(line) pad ## line
#define _XSTR(line) _PADLINE(line)
#define PAD _XSTR(__LINE__)
-#endif
+#endif
typedef struct eci_prerev35 {
uint32 eci_output;
@@ -86,113 +86,113 @@ typedef struct eci_rev35 {
typedef struct flash_config {
uint32 PAD[19];
-
+
uint32 flashstrconfig;
} flash_config_t;
typedef volatile struct {
- uint32 chipid;
+ uint32 chipid;
uint32 capabilities;
- uint32 corecontrol;
+ uint32 corecontrol;
uint32 bist;
-
- uint32 otpstatus;
+
+ uint32 otpstatus;
uint32 otpcontrol;
uint32 otpprog;
- uint32 otplayout;
-
+ uint32 otplayout;
- uint32 intstatus;
+
+ uint32 intstatus;
uint32 intmask;
+
+ uint32 chipcontrol;
+ uint32 chipstatus;
- uint32 chipcontrol;
- uint32 chipstatus;
-
-
- uint32 jtagcmd;
+
+ uint32 jtagcmd;
uint32 jtagir;
uint32 jtagdr;
uint32 jtagctrl;
-
- uint32 flashcontrol;
+
+ uint32 flashcontrol;
uint32 flashaddress;
uint32 flashdata;
- uint32 otplayoutextension;
+ uint32 otplayoutextension;
-
- uint32 broadcastaddress;
+
+ uint32 broadcastaddress;
uint32 broadcastdata;
-
- uint32 gpiopullup;
- uint32 gpiopulldown;
- uint32 gpioin;
- uint32 gpioout;
- uint32 gpioouten;
- uint32 gpiocontrol;
- uint32 gpiointpolarity;
- uint32 gpiointmask;
-
-
+
+ uint32 gpiopullup;
+ uint32 gpiopulldown;
+ uint32 gpioin;
+ uint32 gpioout;
+ uint32 gpioouten;
+ uint32 gpiocontrol;
+ uint32 gpiointpolarity;
+ uint32 gpiointmask;
+
+
uint32 gpioevent;
uint32 gpioeventintmask;
+
+ uint32 watchdog;
- uint32 watchdog;
-
-
+
uint32 gpioeventintpolarity;
-
- uint32 gpiotimerval;
+
+ uint32 gpiotimerval;
uint32 gpiotimeroutmask;
-
- uint32 clockcontrol_n;
- uint32 clockcontrol_sb;
- uint32 clockcontrol_pci;
- uint32 clockcontrol_m2;
- uint32 clockcontrol_m3;
- uint32 clkdiv;
- uint32 gpiodebugsel;
- uint32 capabilities_ext;
-
-
- uint32 pll_on_delay;
+
+ uint32 clockcontrol_n;
+ uint32 clockcontrol_sb;
+ uint32 clockcontrol_pci;
+ uint32 clockcontrol_m2;
+ uint32 clockcontrol_m3;
+ uint32 clkdiv;
+ uint32 gpiodebugsel;
+ uint32 capabilities_ext;
+
+
+ uint32 pll_on_delay;
uint32 fref_sel_delay;
- uint32 slow_clk_ctl;
+ uint32 slow_clk_ctl;
uint32 PAD;
-
- uint32 system_clk_ctl;
+
+ uint32 system_clk_ctl;
uint32 clkstatestretch;
uint32 PAD[2];
-
- uint32 bp_addrlow;
+
+ uint32 bp_addrlow;
uint32 bp_addrhigh;
uint32 bp_data;
uint32 PAD;
uint32 bp_indaccess;
-
+
uint32 gsioctrl;
uint32 gsioaddress;
uint32 gsiodata;
-
+
uint32 clkdiv2;
- uint32 PAD;
+
+ uint32 otpcontrol1;
+ uint32 fabid;
- uint32 fabid;
+
+ uint32 eromptr;
-
- uint32 eromptr;
-
-
- uint32 pcmcia_config;
+
+ uint32 pcmcia_config;
uint32 pcmcia_memwait;
uint32 pcmcia_attrwait;
uint32 pcmcia_iowait;
@@ -204,28 +204,28 @@ typedef volatile struct {
uint32 prog_waitcount;
uint32 flash_config;
uint32 flash_waitcount;
- uint32 SECI_config;
+ uint32 SECI_config;
uint32 SECI_status;
uint32 SECI_statusmask;
uint32 SECI_rxnibchanged;
uint32 PAD[20];
-
- uint32 sromcontrol;
+
+ uint32 sromcontrol;
uint32 sromaddress;
uint32 sromdata;
- uint32 PAD[1];
-
- uint32 nflashctrl;
+ uint32 PAD[1];
+
+ uint32 nflashctrl;
uint32 nflashconf;
uint32 nflashcoladdr;
uint32 nflashrowaddr;
uint32 nflashdata;
- uint32 nflashwaitcnt0;
+ uint32 nflashwaitcnt0;
uint32 PAD[2];
- uint32 seci_uart_data;
+ uint32 seci_uart_data;
uint32 seci_uart_bauddiv;
uint32 seci_uart_fcr;
uint32 seci_uart_lcr;
@@ -233,13 +233,13 @@ typedef volatile struct {
uint32 seci_uart_lsr;
uint32 seci_uart_msr;
uint32 seci_uart_baudadj;
-
- uint32 clk_ctl_st;
+
+ uint32 clk_ctl_st;
uint32 hw_war;
uint32 PAD[70];
-
- uint8 uart0data;
+
+ uint8 uart0data;
uint8 uart0imr;
uint8 uart0fcr;
uint8 uart0lcr;
@@ -247,9 +247,9 @@ typedef volatile struct {
uint8 uart0lsr;
uint8 uart0msr;
uint8 uart0scratch;
- uint8 PAD[248];
+ uint8 PAD[248];
- uint8 uart1data;
+ uint8 uart1data;
uint8 uart1imr;
uint8 uart1fcr;
uint8 uart1lcr;
@@ -259,9 +259,9 @@ typedef volatile struct {
uint8 uart1scratch;
uint32 PAD[126];
-
-
- uint32 pmucontrol;
+
+
+ uint32 pmucontrol;
uint32 pmucapabilities;
uint32 pmustatus;
uint32 res_state;
@@ -275,28 +275,29 @@ typedef volatile struct {
uint32 res_timer;
uint32 clkstretch;
uint32 pmuwatchdog;
- uint32 gpiosel;
- uint32 gpioenable;
+ uint32 gpiosel;
+ uint32 gpioenable;
uint32 res_req_timer_sel;
uint32 res_req_timer;
uint32 res_req_mask;
uint32 PAD;
- uint32 chipcontrol_addr;
- uint32 chipcontrol_data;
+ uint32 chipcontrol_addr;
+ uint32 chipcontrol_data;
uint32 regcontrol_addr;
uint32 regcontrol_data;
uint32 pllcontrol_addr;
uint32 pllcontrol_data;
- uint32 pmustrapopt;
- uint32 pmu_xtalfreq;
- uint32 retention_ctl;
- uint32 PAD[3];
- uint32 retention_grpidx;
- uint32 retention_grpctl;
+ uint32 pmustrapopt;
+ uint32 pmu_xtalfreq;
+ uint32 retention_ctl;
+ uint32 PAD[3];
+ uint32 retention_grpidx;
+ uint32 retention_grpctl;
uint32 PAD[94];
- uint16 sromotp[512];
-
- uint32 nand_revision;
+ uint16 sromotp[512];
+#ifdef NFLASH_SUPPORT
+
+ uint32 nand_revision;
uint32 nand_cmd_start;
uint32 nand_cmd_addr_x;
uint32 nand_cmd_addr;
@@ -357,9 +358,19 @@ typedef volatile struct {
uint32 nand_cache_data;
uint32 nand_ctrl_config;
uint32 nand_ctrl_status;
+#endif
+ uint32 gci_corecaps0;
+ uint32 gci_corecaps1;
+ uint32 gci_corecaps2;
+ uint32 gci_corectrl;
+ uint32 gci_corestat;
+ uint32 PAD[11];
+ uint32 gci_indirect_addr;
+ uint32 PAD[111];
+ uint32 gci_chipctrl;
} chipcregs_t;
-#endif
+#endif
#define CC_CHIPID 0
@@ -400,9 +411,13 @@ typedef volatile struct {
#define CC_CHIPCTL_DATA 0x654
#define PMU_REG_CONTROL_ADDR 0x658
#define PMU_REG_CONTROL_DATA 0x65C
-#define PMU_PLL_CONTROL_ADDR 0x660
-#define PMU_PLL_CONTROL_DATA 0x664
-#define CC_SROM_OTP 0x800
+#define PMU_PLL_CONTROL_ADDR 0x660
+#define PMU_PLL_CONTROL_DATA 0x664
+#define CC_SROM_OTP 0x800
+#define CC_GCI_INDIRECT_ADDR_REG 0xC40
+#define CC_GCI_CHIP_CTRL_REG 0xE00
+#define CC_GCI_CC_OFFSET_2 2
+#define CC_GCI_CC_OFFSET_5 5
#ifdef NFLASH_SUPPORT
@@ -417,58 +432,58 @@ typedef volatile struct {
#define CC_NAND_DEVID 0xC60
#define CC_NAND_DEVID_EXT 0xC64
#define CC_NAND_INTFC_STATUS 0xC6C
-#endif
+#endif
-#define CID_ID_MASK 0x0000ffff
-#define CID_REV_MASK 0x000f0000
-#define CID_REV_SHIFT 16
-#define CID_PKG_MASK 0x00f00000
-#define CID_PKG_SHIFT 20
-#define CID_CC_MASK 0x0f000000
+#define CID_ID_MASK 0x0000ffff
+#define CID_REV_MASK 0x000f0000
+#define CID_REV_SHIFT 16
+#define CID_PKG_MASK 0x00f00000
+#define CID_PKG_SHIFT 20
+#define CID_CC_MASK 0x0f000000
#define CID_CC_SHIFT 24
-#define CID_TYPE_MASK 0xf0000000
+#define CID_TYPE_MASK 0xf0000000
#define CID_TYPE_SHIFT 28
-#define CC_CAP_UARTS_MASK 0x00000003
-#define CC_CAP_MIPSEB 0x00000004
-#define CC_CAP_UCLKSEL 0x00000018
-#define CC_CAP_UINTCLK 0x00000008
-#define CC_CAP_UARTGPIO 0x00000020
-#define CC_CAP_EXTBUS_MASK 0x000000c0
-#define CC_CAP_EXTBUS_NONE 0x00000000
-#define CC_CAP_EXTBUS_FULL 0x00000040
-#define CC_CAP_EXTBUS_PROG 0x00000080
-#define CC_CAP_FLASH_MASK 0x00000700
-#define CC_CAP_PLL_MASK 0x00038000
-#define CC_CAP_PWR_CTL 0x00040000
-#define CC_CAP_OTPSIZE 0x00380000
-#define CC_CAP_OTPSIZE_SHIFT 19
-#define CC_CAP_OTPSIZE_BASE 5
-#define CC_CAP_JTAGP 0x00400000
-#define CC_CAP_ROM 0x00800000
-#define CC_CAP_BKPLN64 0x08000000
-#define CC_CAP_PMU 0x10000000
-#define CC_CAP_ECI 0x20000000
-#define CC_CAP_SROM 0x40000000
-#define CC_CAP_NFLASH 0x80000000
-
-#define CC_CAP2_SECI 0x00000001
-#define CC_CAP2_GSIO 0x00000002
-
-
-#define CC_CAP_EXT_SECI_PRESENT 0x00000001
+#define CC_CAP_UARTS_MASK 0x00000003
+#define CC_CAP_MIPSEB 0x00000004
+#define CC_CAP_UCLKSEL 0x00000018
+#define CC_CAP_UINTCLK 0x00000008
+#define CC_CAP_UARTGPIO 0x00000020
+#define CC_CAP_EXTBUS_MASK 0x000000c0
+#define CC_CAP_EXTBUS_NONE 0x00000000
+#define CC_CAP_EXTBUS_FULL 0x00000040
+#define CC_CAP_EXTBUS_PROG 0x00000080
+#define CC_CAP_FLASH_MASK 0x00000700
+#define CC_CAP_PLL_MASK 0x00038000
+#define CC_CAP_PWR_CTL 0x00040000
+#define CC_CAP_OTPSIZE 0x00380000
+#define CC_CAP_OTPSIZE_SHIFT 19
+#define CC_CAP_OTPSIZE_BASE 5
+#define CC_CAP_JTAGP 0x00400000
+#define CC_CAP_ROM 0x00800000
+#define CC_CAP_BKPLN64 0x08000000
+#define CC_CAP_PMU 0x10000000
+#define CC_CAP_ECI 0x20000000
+#define CC_CAP_SROM 0x40000000
+#define CC_CAP_NFLASH 0x80000000
+
+#define CC_CAP2_SECI 0x00000001
+#define CC_CAP2_GSIO 0x00000002
+
+
+#define CC_CAP_EXT_SECI_PRESENT 0x00000001
#define PLL_NONE 0x00000000
-#define PLL_TYPE1 0x00010000
-#define PLL_TYPE2 0x00020000
-#define PLL_TYPE3 0x00030000
-#define PLL_TYPE4 0x00008000
-#define PLL_TYPE5 0x00018000
-#define PLL_TYPE6 0x00028000
-#define PLL_TYPE7 0x00038000
+#define PLL_TYPE1 0x00010000
+#define PLL_TYPE2 0x00020000
+#define PLL_TYPE3 0x00030000
+#define PLL_TYPE4 0x00008000
+#define PLL_TYPE5 0x00018000
+#define PLL_TYPE6 0x00028000
+#define PLL_TYPE7 0x00038000
#define ILP_CLOCK 32000
@@ -480,30 +495,30 @@ typedef volatile struct {
#define HT_CLOCK 80000000
-#define CC_UARTCLKO 0x00000001
-#define CC_SE 0x00000002
-#define CC_ASYNCGPIO 0x00000004
-#define CC_UARTCLKEN 0x00000008
+#define CC_UARTCLKO 0x00000001
+#define CC_SE 0x00000002
+#define CC_ASYNCGPIO 0x00000004
+#define CC_UARTCLKEN 0x00000008
#define CHIPCTRL_4321A0_DEFAULT 0x3a4
#define CHIPCTRL_4321A1_DEFAULT 0x0a4
-#define CHIPCTRL_4321_PLL_DOWN 0x800000
+#define CHIPCTRL_4321_PLL_DOWN 0x800000
#define OTPS_OL_MASK 0x000000ff
-#define OTPS_OL_MFG 0x00000001
-#define OTPS_OL_OR1 0x00000002
-#define OTPS_OL_OR2 0x00000004
-#define OTPS_OL_GU 0x00000008
+#define OTPS_OL_MFG 0x00000001
+#define OTPS_OL_OR1 0x00000002
+#define OTPS_OL_OR2 0x00000004
+#define OTPS_OL_GU 0x00000008
#define OTPS_GUP_MASK 0x00000f00
#define OTPS_GUP_SHIFT 8
-#define OTPS_GUP_HW 0x00000100
-#define OTPS_GUP_SW 0x00000200
-#define OTPS_GUP_CI 0x00000400
-#define OTPS_GUP_FUSE 0x00000800
+#define OTPS_GUP_HW 0x00000100
+#define OTPS_GUP_SW 0x00000200
+#define OTPS_GUP_CI 0x00000400
+#define OTPS_GUP_FUSE 0x00000800
#define OTPS_READY 0x00001000
-#define OTPS_RV(x) (1 << (16 + (x)))
+#define OTPS_RV(x) (1 << (16 + (x)))
#define OTPS_RV_MASK 0x0fff0000
#define OTPS_PROGOK 0x40000000
@@ -519,6 +534,30 @@ typedef volatile struct {
#define OTPC_PROGEN 0x80000000
+#define OTPC_40NM_PROGSEL_SHIFT 0
+#define OTPC_40NM_PCOUNT_SHIFT 1
+#define OTPC_40NM_PCOUNT_WR 0xA
+#define OTPC_40NM_PCOUNT_V1X 0xB
+#define OTPC_40NM_REGCSEL_SHIFT 5
+#define OTPC_40NM_REGCSEL_DEF 0x4
+#define OTPC_40NM_PROGIN_SHIFT 8
+#define OTPC_40NM_R2X_SHIFT 10
+#define OTPC_40NM_ODM_SHIFT 11
+#define OTPC_40NM_DF_SHIFT 15
+#define OTPC_40NM_VSEL_SHIFT 16
+#define OTPC_40NM_VSEL_WR 0xA
+#define OTPC_40NM_VSEL_V1X 0xA
+#define OTPC_40NM_VSEL_R1X 0x5
+#define OTPC_40NM_COFAIL_SHIFT 30
+
+#define OTPC1_CPCSEL_SHIFT 0
+#define OTPC1_CPCSEL_DEF 6
+#define OTPC1_TM_SHIFT 8
+#define OTPC1_TM_WR 0x84
+#define OTPC1_TM_V1X 0x84
+#define OTPC1_TM_R1X 0x4
+
+
#define OTPP_COL_MASK 0x000000ff
#define OTPP_COL_SHIFT 0
#define OTPP_ROW_MASK 0x0000ff00
@@ -529,7 +568,7 @@ typedef volatile struct {
#define OTPP_VALUE_MASK 0x20000000
#define OTPP_VALUE_SHIFT 29
#define OTPP_START_BUSY 0x80000000
-#define OTPP_READ 0x40000000
+#define OTPP_READ 0x40000000
#define OTPL_HWRGN_OFF_MASK 0x00000FFF
@@ -578,18 +617,18 @@ typedef volatile struct {
-#define JTAGM_CREV_OLD 10
-#define JTAGM_CREV_IRP 22
-#define JTAGM_CREV_RTI 28
+#define JTAGM_CREV_OLD 10
+#define JTAGM_CREV_IRP 22
+#define JTAGM_CREV_RTI 28
#define JCMD_START 0x80000000
#define JCMD_BUSY 0x80000000
#define JCMD_STATE_MASK 0x60000000
-#define JCMD_STATE_TLR 0x00000000
-#define JCMD_STATE_PIR 0x20000000
-#define JCMD_STATE_PDR 0x40000000
-#define JCMD_STATE_RTI 0x60000000
+#define JCMD_STATE_TLR 0x00000000
+#define JCMD_STATE_PIR 0x20000000
+#define JCMD_STATE_PDR 0x40000000
+#define JCMD_STATE_RTI 0x60000000
#define JCMD0_ACC_MASK 0x0000f000
#define JCMD0_ACC_IRDR 0x00000000
#define JCMD0_ACC_DR 0x00001000
@@ -598,7 +637,7 @@ typedef volatile struct {
#define JCMD0_ACC_IRPDR 0x00004000
#define JCMD0_ACC_PDR 0x00005000
#define JCMD0_IRW_MASK 0x00000f00
-#define JCMD_ACC_MASK 0x000f0000
+#define JCMD_ACC_MASK 0x000f0000
#define JCMD_ACC_IRDR 0x00000000
#define JCMD_ACC_DR 0x00010000
#define JCMD_ACC_IR 0x00020000
@@ -606,16 +645,16 @@ typedef volatile struct {
#define JCMD_ACC_IRPDR 0x00040000
#define JCMD_ACC_PDR 0x00050000
#define JCMD_ACC_PIR 0x00060000
-#define JCMD_ACC_IRDR_I 0x00070000
-#define JCMD_ACC_DR_I 0x00080000
+#define JCMD_ACC_IRDR_I 0x00070000
+#define JCMD_ACC_DR_I 0x00080000
#define JCMD_IRW_MASK 0x00001f00
#define JCMD_IRW_SHIFT 8
#define JCMD_DRW_MASK 0x0000003f
-#define JCTRL_FORCE_CLK 4
-#define JCTRL_EXT_EN 2
-#define JCTRL_EN 1
+#define JCTRL_FORCE_CLK 4
+#define JCTRL_EXT_EN 2
+#define JCTRL_EN 1
#define CLKD_SFLASH 0x0f000000
@@ -629,36 +668,36 @@ typedef volatile struct {
#define CLKD2_SROM 0x00000003
-#define CI_GPIO 0x00000001
-#define CI_EI 0x00000002
-#define CI_TEMP 0x00000004
-#define CI_SIRQ 0x00000008
-#define CI_ECI 0x00000010
-#define CI_PMU 0x00000020
-#define CI_UART 0x00000040
-#define CI_WDRESET 0x80000000
-
-
-#define SCC_SS_MASK 0x00000007
-#define SCC_SS_LPO 0x00000000
-#define SCC_SS_XTAL 0x00000001
-#define SCC_SS_PCI 0x00000002
-#define SCC_LF 0x00000200
-#define SCC_LP 0x00000400
-#define SCC_FS 0x00000800
-#define SCC_IP 0x00001000
-#define SCC_XC 0x00002000
-#define SCC_XP 0x00004000
-#define SCC_CD_MASK 0xffff0000
+#define CI_GPIO 0x00000001
+#define CI_EI 0x00000002
+#define CI_TEMP 0x00000004
+#define CI_SIRQ 0x00000008
+#define CI_ECI 0x00000010
+#define CI_PMU 0x00000020
+#define CI_UART 0x00000040
+#define CI_WDRESET 0x80000000
+
+
+#define SCC_SS_MASK 0x00000007
+#define SCC_SS_LPO 0x00000000
+#define SCC_SS_XTAL 0x00000001
+#define SCC_SS_PCI 0x00000002
+#define SCC_LF 0x00000200
+#define SCC_LP 0x00000400
+#define SCC_FS 0x00000800
+#define SCC_IP 0x00001000
+#define SCC_XC 0x00002000
+#define SCC_XP 0x00004000
+#define SCC_CD_MASK 0xffff0000
#define SCC_CD_SHIFT 16
-#define SYCC_IE 0x00000001
-#define SYCC_AE 0x00000002
-#define SYCC_FP 0x00000004
-#define SYCC_AR 0x00000008
-#define SYCC_HR 0x00000010
-#define SYCC_CD_MASK 0xffff0000
+#define SYCC_IE 0x00000001
+#define SYCC_AE 0x00000002
+#define SYCC_FP 0x00000004
+#define SYCC_AR 0x00000008
+#define SYCC_HR 0x00000010
+#define SYCC_CD_MASK 0xffff0000
#define SYCC_CD_SHIFT 16
@@ -673,70 +712,70 @@ typedef volatile struct {
#define BPIA_ERROR 0x00000400
-#define CF_EN 0x00000001
-#define CF_EM_MASK 0x0000000e
+#define CF_EN 0x00000001
+#define CF_EM_MASK 0x0000000e
#define CF_EM_SHIFT 1
-#define CF_EM_FLASH 0
-#define CF_EM_SYNC 2
-#define CF_EM_PCMCIA 4
-#define CF_DS 0x00000010
-#define CF_BS 0x00000020
-#define CF_CD_MASK 0x000000c0
+#define CF_EM_FLASH 0
+#define CF_EM_SYNC 2
+#define CF_EM_PCMCIA 4
+#define CF_DS 0x00000010
+#define CF_BS 0x00000020
+#define CF_CD_MASK 0x000000c0
#define CF_CD_SHIFT 6
-#define CF_CD_DIV2 0x00000000
-#define CF_CD_DIV3 0x00000040
-#define CF_CD_DIV4 0x00000080
-#define CF_CE 0x00000100
-#define CF_SB 0x00000200
+#define CF_CD_DIV2 0x00000000
+#define CF_CD_DIV3 0x00000040
+#define CF_CD_DIV4 0x00000080
+#define CF_CE 0x00000100
+#define CF_SB 0x00000200
-#define PM_W0_MASK 0x0000003f
-#define PM_W1_MASK 0x00001f00
+#define PM_W0_MASK 0x0000003f
+#define PM_W1_MASK 0x00001f00
#define PM_W1_SHIFT 8
-#define PM_W2_MASK 0x001f0000
+#define PM_W2_MASK 0x001f0000
#define PM_W2_SHIFT 16
-#define PM_W3_MASK 0x1f000000
+#define PM_W3_MASK 0x1f000000
#define PM_W3_SHIFT 24
-#define PA_W0_MASK 0x0000003f
-#define PA_W1_MASK 0x00001f00
+#define PA_W0_MASK 0x0000003f
+#define PA_W1_MASK 0x00001f00
#define PA_W1_SHIFT 8
-#define PA_W2_MASK 0x001f0000
+#define PA_W2_MASK 0x001f0000
#define PA_W2_SHIFT 16
-#define PA_W3_MASK 0x1f000000
+#define PA_W3_MASK 0x1f000000
#define PA_W3_SHIFT 24
-#define PI_W0_MASK 0x0000003f
-#define PI_W1_MASK 0x00001f00
+#define PI_W0_MASK 0x0000003f
+#define PI_W1_MASK 0x00001f00
#define PI_W1_SHIFT 8
-#define PI_W2_MASK 0x001f0000
+#define PI_W2_MASK 0x001f0000
#define PI_W2_SHIFT 16
-#define PI_W3_MASK 0x1f000000
+#define PI_W3_MASK 0x1f000000
#define PI_W3_SHIFT 24
-#define PW_W0_MASK 0x0000001f
-#define PW_W1_MASK 0x00001f00
+#define PW_W0_MASK 0x0000001f
+#define PW_W1_MASK 0x00001f00
#define PW_W1_SHIFT 8
-#define PW_W2_MASK 0x001f0000
+#define PW_W2_MASK 0x001f0000
#define PW_W2_SHIFT 16
-#define PW_W3_MASK 0x1f000000
+#define PW_W3_MASK 0x1f000000
#define PW_W3_SHIFT 24
-#define PW_W0 0x0000000c
-#define PW_W1 0x00000a00
-#define PW_W2 0x00020000
-#define PW_W3 0x01000000
+#define PW_W0 0x0000000c
+#define PW_W1 0x00000a00
+#define PW_W2 0x00020000
+#define PW_W3 0x01000000
-#define FW_W0_MASK 0x0000003f
-#define FW_W1_MASK 0x00001f00
+#define FW_W0_MASK 0x0000003f
+#define FW_W1_MASK 0x00001f00
#define FW_W1_SHIFT 8
-#define FW_W2_MASK 0x001f0000
+#define FW_W2_MASK 0x001f0000
#define FW_W2_SHIFT 16
-#define FW_W3_MASK 0x1f000000
+#define FW_W3_MASK 0x1f000000
#define FW_W3_SHIFT 24
@@ -759,8 +798,8 @@ typedef volatile struct {
#define PCTL_ILP_DIV_MASK 0xffff0000
#define PCTL_ILP_DIV_SHIFT 16
-#define PCTL_PLL_PLLCTL_UPD 0x00000400
-#define PCTL_NOILP_ON_WAIT 0x00000200
+#define PCTL_PLL_PLLCTL_UPD 0x00000400
+#define PCTL_NOILP_ON_WAIT 0x00000200
#define PCTL_HT_REQ_EN 0x00000100
#define PCTL_ALP_REQ_EN 0x00000080
#define PCTL_XTALFREQ_MASK 0x0000007c
@@ -776,30 +815,30 @@ typedef volatile struct {
#define GPIO_ONTIME_SHIFT 16
-#define CN_N1_MASK 0x3f
-#define CN_N2_MASK 0x3f00
+#define CN_N1_MASK 0x3f
+#define CN_N2_MASK 0x3f00
#define CN_N2_SHIFT 8
-#define CN_PLLC_MASK 0xf0000
+#define CN_PLLC_MASK 0xf0000
#define CN_PLLC_SHIFT 16
-#define CC_M1_MASK 0x3f
-#define CC_M2_MASK 0x3f00
+#define CC_M1_MASK 0x3f
+#define CC_M2_MASK 0x3f00
#define CC_M2_SHIFT 8
-#define CC_M3_MASK 0x3f0000
+#define CC_M3_MASK 0x3f0000
#define CC_M3_SHIFT 16
-#define CC_MC_MASK 0x1f000000
+#define CC_MC_MASK 0x1f000000
#define CC_MC_SHIFT 24
-#define CC_F6_2 0x02
-#define CC_F6_3 0x03
-#define CC_F6_4 0x05
+#define CC_F6_2 0x02
+#define CC_F6_3 0x03
+#define CC_F6_4 0x05
#define CC_F6_5 0x09
#define CC_F6_6 0x11
#define CC_F6_7 0x21
-#define CC_F5_BIAS 5
+#define CC_F5_BIAS 5
#define CC_MC_BYPASS 0x08
#define CC_MC_M1 0x04
@@ -808,98 +847,98 @@ typedef volatile struct {
#define CC_MC_M1M3 0x11
-#define CC_T2_BIAS 2
-#define CC_T2M2_BIAS 3
+#define CC_T2_BIAS 2
+#define CC_T2M2_BIAS 3
#define CC_T2MC_M1BYP 1
#define CC_T2MC_M2BYP 2
#define CC_T2MC_M3BYP 4
-#define CC_T6_MMASK 1
-#define CC_T6_M0 120000000
-#define CC_T6_M1 100000000
+#define CC_T6_MMASK 1
+#define CC_T6_M0 120000000
+#define CC_T6_M1 100000000
#define SB2MIPS_T6(sb) (2 * (sb))
-#define CC_CLOCK_BASE1 24000000
-#define CC_CLOCK_BASE2 12500000
+#define CC_CLOCK_BASE1 24000000
+#define CC_CLOCK_BASE2 12500000
#define CLKC_5350_N 0x0311
#define CLKC_5350_M 0x04020009
-#define FLASH_NONE 0x000
-#define SFLASH_ST 0x100
-#define SFLASH_AT 0x200
+#define FLASH_NONE 0x000
+#define SFLASH_ST 0x100
+#define SFLASH_AT 0x200
#define NFLASH 0x300
-#define PFLASH 0x700
+#define PFLASH 0x700
-#define CC_CFG_EN 0x0001
-#define CC_CFG_EM_MASK 0x000e
-#define CC_CFG_EM_ASYNC 0x0000
-#define CC_CFG_EM_SYNC 0x0002
-#define CC_CFG_EM_PCMCIA 0x0004
-#define CC_CFG_EM_IDE 0x0006
-#define CC_CFG_DS 0x0010
-#define CC_CFG_CD_MASK 0x00e0
-#define CC_CFG_CE 0x0100
-#define CC_CFG_SB 0x0200
-#define CC_CFG_IS 0x0400
+#define CC_CFG_EN 0x0001
+#define CC_CFG_EM_MASK 0x000e
+#define CC_CFG_EM_ASYNC 0x0000
+#define CC_CFG_EM_SYNC 0x0002
+#define CC_CFG_EM_PCMCIA 0x0004
+#define CC_CFG_EM_IDE 0x0006
+#define CC_CFG_DS 0x0010
+#define CC_CFG_CD_MASK 0x00e0
+#define CC_CFG_CE 0x0100
+#define CC_CFG_SB 0x0200
+#define CC_CFG_IS 0x0400
-#define CC_EB_BASE 0x1a000000
-#define CC_EB_PCMCIA_MEM 0x1a000000
-#define CC_EB_PCMCIA_IO 0x1a200000
-#define CC_EB_PCMCIA_CFG 0x1a400000
-#define CC_EB_IDE 0x1a800000
-#define CC_EB_PCMCIA1_MEM 0x1a800000
-#define CC_EB_PCMCIA1_IO 0x1aa00000
-#define CC_EB_PCMCIA1_CFG 0x1ac00000
-#define CC_EB_PROGIF 0x1b000000
+#define CC_EB_BASE 0x1a000000
+#define CC_EB_PCMCIA_MEM 0x1a000000
+#define CC_EB_PCMCIA_IO 0x1a200000
+#define CC_EB_PCMCIA_CFG 0x1a400000
+#define CC_EB_IDE 0x1a800000
+#define CC_EB_PCMCIA1_MEM 0x1a800000
+#define CC_EB_PCMCIA1_IO 0x1aa00000
+#define CC_EB_PCMCIA1_CFG 0x1ac00000
+#define CC_EB_PROGIF 0x1b000000
#define SFLASH_OPCODE 0x000000ff
#define SFLASH_ACTION 0x00000700
-#define SFLASH_CS_ACTIVE 0x00001000
+#define SFLASH_CS_ACTIVE 0x00001000
#define SFLASH_START 0x80000000
#define SFLASH_BUSY SFLASH_START
-#define SFLASH_ACT_OPONLY 0x0000
-#define SFLASH_ACT_OP1D 0x0100
-#define SFLASH_ACT_OP3A 0x0200
-#define SFLASH_ACT_OP3A1D 0x0300
-#define SFLASH_ACT_OP3A4D 0x0400
-#define SFLASH_ACT_OP3A4X4D 0x0500
-#define SFLASH_ACT_OP3A1X4D 0x0700
+#define SFLASH_ACT_OPONLY 0x0000
+#define SFLASH_ACT_OP1D 0x0100
+#define SFLASH_ACT_OP3A 0x0200
+#define SFLASH_ACT_OP3A1D 0x0300
+#define SFLASH_ACT_OP3A4D 0x0400
+#define SFLASH_ACT_OP3A4X4D 0x0500
+#define SFLASH_ACT_OP3A1X4D 0x0700
-#define SFLASH_ST_WREN 0x0006
-#define SFLASH_ST_WRDIS 0x0004
-#define SFLASH_ST_RDSR 0x0105
-#define SFLASH_ST_WRSR 0x0101
-#define SFLASH_ST_READ 0x0303
-#define SFLASH_ST_PP 0x0302
-#define SFLASH_ST_SE 0x02d8
-#define SFLASH_ST_BE 0x00c7
-#define SFLASH_ST_DP 0x00b9
-#define SFLASH_ST_RES 0x03ab
-#define SFLASH_ST_CSA 0x1000
-#define SFLASH_ST_SSE 0x0220
+#define SFLASH_ST_WREN 0x0006
+#define SFLASH_ST_WRDIS 0x0004
+#define SFLASH_ST_RDSR 0x0105
+#define SFLASH_ST_WRSR 0x0101
+#define SFLASH_ST_READ 0x0303
+#define SFLASH_ST_PP 0x0302
+#define SFLASH_ST_SE 0x02d8
+#define SFLASH_ST_BE 0x00c7
+#define SFLASH_ST_DP 0x00b9
+#define SFLASH_ST_RES 0x03ab
+#define SFLASH_ST_CSA 0x1000
+#define SFLASH_ST_SSE 0x0220
-#define SFLASH_MXIC_RDID 0x0390
-#define SFLASH_MXIC_MFID 0xc2
+#define SFLASH_MXIC_RDID 0x0390
+#define SFLASH_MXIC_MFID 0xc2
-#define SFLASH_ST_WIP 0x01
-#define SFLASH_ST_WEL 0x02
-#define SFLASH_ST_BP_MASK 0x1c
+#define SFLASH_ST_WIP 0x01
+#define SFLASH_ST_WEL 0x02
+#define SFLASH_ST_BP_MASK 0x1c
#define SFLASH_ST_BP_SHIFT 2
-#define SFLASH_ST_SRWD 0x80
+#define SFLASH_ST_SRWD 0x80
#define SFLASH_AT_READ 0x07e8
@@ -936,47 +975,47 @@ typedef volatile struct {
-#define UART_RX 0
-#define UART_TX 0
-#define UART_DLL 0
-#define UART_IER 1
-#define UART_DLM 1
-#define UART_IIR 2
-#define UART_FCR 2
-#define UART_LCR 3
-#define UART_MCR 4
-#define UART_LSR 5
-#define UART_MSR 6
-#define UART_SCR 7
-#define UART_LCR_DLAB 0x80
-#define UART_LCR_WLEN8 0x03
-#define UART_MCR_OUT2 0x08
-#define UART_MCR_LOOP 0x10
-#define UART_LSR_RX_FIFO 0x80
-#define UART_LSR_TDHR 0x40
-#define UART_LSR_THRE 0x20
-#define UART_LSR_BREAK 0x10
-#define UART_LSR_FRAMING 0x08
-#define UART_LSR_PARITY 0x04
-#define UART_LSR_OVERRUN 0x02
-#define UART_LSR_RXRDY 0x01
-#define UART_FCR_FIFO_ENABLE 1
-
-
-#define UART_IIR_FIFO_MASK 0xc0
-#define UART_IIR_INT_MASK 0xf
-#define UART_IIR_MDM_CHG 0x0
-#define UART_IIR_NOINT 0x1
-#define UART_IIR_THRE 0x2
-#define UART_IIR_RCVD_DATA 0x4
-#define UART_IIR_RCVR_STATUS 0x6
-#define UART_IIR_CHAR_TIME 0xc
-
-
-#define UART_IER_EDSSI 8
-#define UART_IER_ELSI 4
-#define UART_IER_ETBEI 2
-#define UART_IER_ERBFI 1
+#define UART_RX 0
+#define UART_TX 0
+#define UART_DLL 0
+#define UART_IER 1
+#define UART_DLM 1
+#define UART_IIR 2
+#define UART_FCR 2
+#define UART_LCR 3
+#define UART_MCR 4
+#define UART_LSR 5
+#define UART_MSR 6
+#define UART_SCR 7
+#define UART_LCR_DLAB 0x80
+#define UART_LCR_WLEN8 0x03
+#define UART_MCR_OUT2 0x08
+#define UART_MCR_LOOP 0x10
+#define UART_LSR_RX_FIFO 0x80
+#define UART_LSR_TDHR 0x40
+#define UART_LSR_THRE 0x20
+#define UART_LSR_BREAK 0x10
+#define UART_LSR_FRAMING 0x08
+#define UART_LSR_PARITY 0x04
+#define UART_LSR_OVERRUN 0x02
+#define UART_LSR_RXRDY 0x01
+#define UART_FCR_FIFO_ENABLE 1
+
+
+#define UART_IIR_FIFO_MASK 0xc0
+#define UART_IIR_INT_MASK 0xf
+#define UART_IIR_MDM_CHG 0x0
+#define UART_IIR_NOINT 0x1
+#define UART_IIR_THRE 0x2
+#define UART_IIR_RCVD_DATA 0x4
+#define UART_IIR_RCVR_STATUS 0x6
+#define UART_IIR_CHAR_TIME 0xc
+
+
+#define UART_IER_EDSSI 8
+#define UART_IER_ELSI 4
+#define UART_IER_ETBEI 2
+#define UART_IER_ERBFI 1
#define PST_EXTLPOAVAIL 0x0100
@@ -1002,7 +1041,7 @@ typedef volatile struct {
#define PCAP_VC_SHIFT 21
#define PCAP_CC_MASK 0x1e000000
#define PCAP_CC_SHIFT 25
-#define PCAP5_PC_MASK 0x003e0000
+#define PCAP5_PC_MASK 0x003e0000
#define PCAP5_PC_SHIFT 17
#define PCAP5_VC_MASK 0x07c00000
#define PCAP5_VC_SHIFT 22
@@ -1038,16 +1077,16 @@ typedef volatile struct {
#define PMU_CHIPCTL1 1
#define PMU_CC1_RXC_DLL_BYPASS 0x00010000
-#define PMU_CC1_IF_TYPE_MASK 0x00000030
-#define PMU_CC1_IF_TYPE_RMII 0x00000000
-#define PMU_CC1_IF_TYPE_MII 0x00000010
-#define PMU_CC1_IF_TYPE_RGMII 0x00000020
+#define PMU_CC1_IF_TYPE_MASK 0x00000030
+#define PMU_CC1_IF_TYPE_RMII 0x00000000
+#define PMU_CC1_IF_TYPE_MII 0x00000010
+#define PMU_CC1_IF_TYPE_RGMII 0x00000020
-#define PMU_CC1_SW_TYPE_MASK 0x000000c0
-#define PMU_CC1_SW_TYPE_EPHY 0x00000000
-#define PMU_CC1_SW_TYPE_EPHYMII 0x00000040
+#define PMU_CC1_SW_TYPE_MASK 0x000000c0
+#define PMU_CC1_SW_TYPE_EPHY 0x00000000
+#define PMU_CC1_SW_TYPE_EPHYMII 0x00000040
#define PMU_CC1_SW_TYPE_EPHYRMII 0x00000080
-#define PMU_CC1_SW_TYPE_RGMII 0x000000c0
+#define PMU_CC1_SW_TYPE_RGMII 0x000000c0
#define PMU_CHIPCTL2 2
@@ -1074,7 +1113,7 @@ typedef volatile struct {
#define PMU0_PLL0_PC0_DIV_ARM_110MHZ 0
#define PMU0_PLL0_PC0_DIV_ARM_97_7MHZ 1
#define PMU0_PLL0_PC0_DIV_ARM_88MHZ 2
-#define PMU0_PLL0_PC0_DIV_ARM_80MHZ 3
+#define PMU0_PLL0_PC0_DIV_ARM_80MHZ 3
#define PMU0_PLL0_PC0_DIV_ARM_73_3MHZ 4
#define PMU0_PLL0_PC0_DIV_ARM_67_7MHZ 5
#define PMU0_PLL0_PC0_DIV_ARM_62_9MHZ 6
@@ -1133,7 +1172,7 @@ typedef volatile struct {
#define PMU1_PLL0_PC2_NDIV_MODE_MASK 0x000e0000
#define PMU1_PLL0_PC2_NDIV_MODE_SHIFT 17
#define PMU1_PLL0_PC2_NDIV_MODE_MASH 1
-#define PMU1_PLL0_PC2_NDIV_MODE_MFB 2
+#define PMU1_PLL0_PC2_NDIV_MODE_MFB 2
#define PMU1_PLL0_PC2_NDIV_INT_MASK 0x1ff00000
#define PMU1_PLL0_PC2_NDIV_INT_SHIFT 20
@@ -1158,27 +1197,27 @@ typedef volatile struct {
#define PMU2_PLL_PLLCTL0 0
-#define PMU2_PLL_PC0_P1DIV_MASK 0x00f00000
+#define PMU2_PLL_PC0_P1DIV_MASK 0x00f00000
#define PMU2_PLL_PC0_P1DIV_SHIFT 20
-#define PMU2_PLL_PC0_P2DIV_MASK 0x0f000000
+#define PMU2_PLL_PC0_P2DIV_MASK 0x0f000000
#define PMU2_PLL_PC0_P2DIV_SHIFT 24
#define PMU2_PLL_PLLCTL1 1
-#define PMU2_PLL_PC1_M1DIV_MASK 0x000000ff
+#define PMU2_PLL_PC1_M1DIV_MASK 0x000000ff
#define PMU2_PLL_PC1_M1DIV_SHIFT 0
-#define PMU2_PLL_PC1_M2DIV_MASK 0x0000ff00
+#define PMU2_PLL_PC1_M2DIV_MASK 0x0000ff00
#define PMU2_PLL_PC1_M2DIV_SHIFT 8
-#define PMU2_PLL_PC1_M3DIV_MASK 0x00ff0000
+#define PMU2_PLL_PC1_M3DIV_MASK 0x00ff0000
#define PMU2_PLL_PC1_M3DIV_SHIFT 16
-#define PMU2_PLL_PC1_M4DIV_MASK 0xff000000
+#define PMU2_PLL_PC1_M4DIV_MASK 0xff000000
#define PMU2_PLL_PC1_M4DIV_SHIFT 24
#define PMU2_PLL_PLLCTL2 2
-#define PMU2_PLL_PC2_M5DIV_MASK 0x000000ff
+#define PMU2_PLL_PC2_M5DIV_MASK 0x000000ff
#define PMU2_PLL_PC2_M5DIV_SHIFT 0
-#define PMU2_PLL_PC2_M6DIV_MASK 0x0000ff00
+#define PMU2_PLL_PC2_M6DIV_MASK 0x0000ff00
#define PMU2_PLL_PC2_M6DIV_SHIFT 8
#define PMU2_PLL_PC2_NDIV_MODE_MASK 0x000e0000
#define PMU2_PLL_PC2_NDIV_MODE_SHIFT 17
@@ -1244,7 +1283,7 @@ typedef volatile struct {
#define PMU4706_MAINPLL_PLL0 0
-#define PMU6_4706_PROCPLL_OFF 4
+#define PMU6_4706_PROCPLL_OFF 4
#define PMU6_4706_PROC_P2DIV_MASK 0x000f0000
#define PMU6_4706_PROC_P2DIV_SHIFT 16
#define PMU6_4706_PROC_P1DIV_MASK 0x0000f000
@@ -1256,7 +1295,7 @@ typedef volatile struct {
#define PMU7_PLL_PLLCTL7 7
#define PMU7_PLL_CTL7_M4DIV_MASK 0xff000000
-#define PMU7_PLL_CTL7_M4DIV_SHIFT 24
+#define PMU7_PLL_CTL7_M4DIV_SHIFT 24
#define PMU7_PLL_CTL7_M4DIV_BY_6 6
#define PMU7_PLL_CTL7_M4DIV_BY_12 0xc
#define PMU7_PLL_CTL7_M4DIV_BY_24 0x18
@@ -1377,9 +1416,9 @@ typedef volatile struct {
#define PMU15_FREQTGT_480_DEFAULT 0x19AB1
#define PMU15_FREQTGT_492_DEFAULT 0x1A4F5
-#define PMU15_ARM_96MHZ 96000000
-#define PMU15_ARM_98MHZ 98400000
-#define PMU15_ARM_97MHZ 97000000
+#define PMU15_ARM_96MHZ 96000000
+#define PMU15_ARM_98MHZ 98400000
+#define PMU15_ARM_97MHZ 97000000
#define PMU17_PLLCTL2_NDIVTYPE_MASK 0x00000070
@@ -1406,164 +1445,168 @@ typedef volatile struct {
#define RES4716_PROC_HT_AVAIL 0x00000080
-#define CCTRL_471X_I2S_PINS_ENABLE 0x0080
-
-
-
-#define CCTRL_5357_I2S_PINS_ENABLE 0x00040000
-#define CCTRL_5357_I2CSPI_PINS_ENABLE 0x00080000
-
-
-#define RES5354_EXT_SWITCHER_PWM 0
-#define RES5354_BB_SWITCHER_PWM 1
-#define RES5354_BB_SWITCHER_BURST 2
-#define RES5354_BB_EXT_SWITCHER_BURST 3
-#define RES5354_ILP_REQUEST 4
-#define RES5354_RADIO_SWITCHER_PWM 5
-#define RES5354_RADIO_SWITCHER_BURST 6
-#define RES5354_ROM_SWITCH 7
-#define RES5354_PA_REF_LDO 8
-#define RES5354_RADIO_LDO 9
-#define RES5354_AFE_LDO 10
-#define RES5354_PLL_LDO 11
-#define RES5354_BG_FILTBYP 12
-#define RES5354_TX_FILTBYP 13
-#define RES5354_RX_FILTBYP 14
-#define RES5354_XTAL_PU 15
-#define RES5354_XTAL_EN 16
-#define RES5354_BB_PLL_FILTBYP 17
-#define RES5354_RF_PLL_FILTBYP 18
-#define RES5354_BB_PLL_PU 19
-
-
-#define CCTRL5357_EXTPA (1<<14)
-#define CCTRL5357_ANT_MUX_2o3 (1<<15)
-#define CCTRL5357_NFLASH (1<<16)
-
-
-#define RES4328_EXT_SWITCHER_PWM 0
-#define RES4328_BB_SWITCHER_PWM 1
-#define RES4328_BB_SWITCHER_BURST 2
-#define RES4328_BB_EXT_SWITCHER_BURST 3
-#define RES4328_ILP_REQUEST 4
-#define RES4328_RADIO_SWITCHER_PWM 5
-#define RES4328_RADIO_SWITCHER_BURST 6
-#define RES4328_ROM_SWITCH 7
-#define RES4328_PA_REF_LDO 8
-#define RES4328_RADIO_LDO 9
-#define RES4328_AFE_LDO 10
-#define RES4328_PLL_LDO 11
-#define RES4328_BG_FILTBYP 12
-#define RES4328_TX_FILTBYP 13
-#define RES4328_RX_FILTBYP 14
-#define RES4328_XTAL_PU 15
-#define RES4328_XTAL_EN 16
-#define RES4328_BB_PLL_FILTBYP 17
-#define RES4328_RF_PLL_FILTBYP 18
-#define RES4328_BB_PLL_PU 19
-
-
-#define RES4325_BUCK_BOOST_BURST 0
-#define RES4325_CBUCK_BURST 1
-#define RES4325_CBUCK_PWM 2
-#define RES4325_CLDO_CBUCK_BURST 3
-#define RES4325_CLDO_CBUCK_PWM 4
-#define RES4325_BUCK_BOOST_PWM 5
-#define RES4325_ILP_REQUEST 6
-#define RES4325_ABUCK_BURST 7
-#define RES4325_ABUCK_PWM 8
-#define RES4325_LNLDO1_PU 9
-#define RES4325_OTP_PU 10
-#define RES4325_LNLDO3_PU 11
-#define RES4325_LNLDO4_PU 12
-#define RES4325_XTAL_PU 13
-#define RES4325_ALP_AVAIL 14
-#define RES4325_RX_PWRSW_PU 15
-#define RES4325_TX_PWRSW_PU 16
-#define RES4325_RFPLL_PWRSW_PU 17
-#define RES4325_LOGEN_PWRSW_PU 18
-#define RES4325_AFE_PWRSW_PU 19
-#define RES4325_BBPLL_PWRSW_PU 20
-#define RES4325_HT_AVAIL 21
-
-
-#define RES4325B0_CBUCK_LPOM 1
-#define RES4325B0_CBUCK_BURST 2
-#define RES4325B0_CBUCK_PWM 3
-#define RES4325B0_CLDO_PU 4
-
-
-#define RES4325C1_LNLDO2_PU 12
+#define CCTRL_471X_I2S_PINS_ENABLE 0x0080
+
+
+
+#define CCTRL_5357_I2S_PINS_ENABLE 0x00040000
+#define CCTRL_5357_I2CSPI_PINS_ENABLE 0x00080000
+
+
+#define RES5354_EXT_SWITCHER_PWM 0
+#define RES5354_BB_SWITCHER_PWM 1
+#define RES5354_BB_SWITCHER_BURST 2
+#define RES5354_BB_EXT_SWITCHER_BURST 3
+#define RES5354_ILP_REQUEST 4
+#define RES5354_RADIO_SWITCHER_PWM 5
+#define RES5354_RADIO_SWITCHER_BURST 6
+#define RES5354_ROM_SWITCH 7
+#define RES5354_PA_REF_LDO 8
+#define RES5354_RADIO_LDO 9
+#define RES5354_AFE_LDO 10
+#define RES5354_PLL_LDO 11
+#define RES5354_BG_FILTBYP 12
+#define RES5354_TX_FILTBYP 13
+#define RES5354_RX_FILTBYP 14
+#define RES5354_XTAL_PU 15
+#define RES5354_XTAL_EN 16
+#define RES5354_BB_PLL_FILTBYP 17
+#define RES5354_RF_PLL_FILTBYP 18
+#define RES5354_BB_PLL_PU 19
+
+
+#define CCTRL5357_EXTPA (1<<14)
+#define CCTRL5357_ANT_MUX_2o3 (1<<15)
+#define CCTRL5357_NFLASH (1<<16)
+
+
+#define CCTRL43217_EXTPA_C0 (1<<13)
+#define CCTRL43217_EXTPA_C1 (1<<8)
+
+
+#define RES4328_EXT_SWITCHER_PWM 0
+#define RES4328_BB_SWITCHER_PWM 1
+#define RES4328_BB_SWITCHER_BURST 2
+#define RES4328_BB_EXT_SWITCHER_BURST 3
+#define RES4328_ILP_REQUEST 4
+#define RES4328_RADIO_SWITCHER_PWM 5
+#define RES4328_RADIO_SWITCHER_BURST 6
+#define RES4328_ROM_SWITCH 7
+#define RES4328_PA_REF_LDO 8
+#define RES4328_RADIO_LDO 9
+#define RES4328_AFE_LDO 10
+#define RES4328_PLL_LDO 11
+#define RES4328_BG_FILTBYP 12
+#define RES4328_TX_FILTBYP 13
+#define RES4328_RX_FILTBYP 14
+#define RES4328_XTAL_PU 15
+#define RES4328_XTAL_EN 16
+#define RES4328_BB_PLL_FILTBYP 17
+#define RES4328_RF_PLL_FILTBYP 18
+#define RES4328_BB_PLL_PU 19
+
+
+#define RES4325_BUCK_BOOST_BURST 0
+#define RES4325_CBUCK_BURST 1
+#define RES4325_CBUCK_PWM 2
+#define RES4325_CLDO_CBUCK_BURST 3
+#define RES4325_CLDO_CBUCK_PWM 4
+#define RES4325_BUCK_BOOST_PWM 5
+#define RES4325_ILP_REQUEST 6
+#define RES4325_ABUCK_BURST 7
+#define RES4325_ABUCK_PWM 8
+#define RES4325_LNLDO1_PU 9
+#define RES4325_OTP_PU 10
+#define RES4325_LNLDO3_PU 11
+#define RES4325_LNLDO4_PU 12
+#define RES4325_XTAL_PU 13
+#define RES4325_ALP_AVAIL 14
+#define RES4325_RX_PWRSW_PU 15
+#define RES4325_TX_PWRSW_PU 16
+#define RES4325_RFPLL_PWRSW_PU 17
+#define RES4325_LOGEN_PWRSW_PU 18
+#define RES4325_AFE_PWRSW_PU 19
+#define RES4325_BBPLL_PWRSW_PU 20
+#define RES4325_HT_AVAIL 21
+
+
+#define RES4325B0_CBUCK_LPOM 1
+#define RES4325B0_CBUCK_BURST 2
+#define RES4325B0_CBUCK_PWM 3
+#define RES4325B0_CLDO_PU 4
+
+
+#define RES4325C1_LNLDO2_PU 12
#define CST4325_SPROM_OTP_SEL_MASK 0x00000003
-#define CST4325_DEFCIS_SEL 0
-#define CST4325_SPROM_SEL 1
-#define CST4325_OTP_SEL 2
-#define CST4325_OTP_PWRDN 3
+#define CST4325_DEFCIS_SEL 0
+#define CST4325_SPROM_SEL 1
+#define CST4325_OTP_SEL 2
+#define CST4325_OTP_PWRDN 3
#define CST4325_SDIO_USB_MODE_MASK 0x00000004
#define CST4325_SDIO_USB_MODE_SHIFT 2
#define CST4325_RCAL_VALID_MASK 0x00000008
#define CST4325_RCAL_VALID_SHIFT 3
#define CST4325_RCAL_VALUE_MASK 0x000001f0
#define CST4325_RCAL_VALUE_SHIFT 4
-#define CST4325_PMUTOP_2B_MASK 0x00000200
-#define CST4325_PMUTOP_2B_SHIFT 9
-
-#define RES4329_RESERVED0 0
-#define RES4329_CBUCK_LPOM 1
-#define RES4329_CBUCK_BURST 2
-#define RES4329_CBUCK_PWM 3
-#define RES4329_CLDO_PU 4
-#define RES4329_PALDO_PU 5
-#define RES4329_ILP_REQUEST 6
-#define RES4329_RESERVED7 7
-#define RES4329_RESERVED8 8
-#define RES4329_LNLDO1_PU 9
-#define RES4329_OTP_PU 10
-#define RES4329_RESERVED11 11
-#define RES4329_LNLDO2_PU 12
-#define RES4329_XTAL_PU 13
-#define RES4329_ALP_AVAIL 14
-#define RES4329_RX_PWRSW_PU 15
-#define RES4329_TX_PWRSW_PU 16
-#define RES4329_RFPLL_PWRSW_PU 17
-#define RES4329_LOGEN_PWRSW_PU 18
-#define RES4329_AFE_PWRSW_PU 19
-#define RES4329_BBPLL_PWRSW_PU 20
-#define RES4329_HT_AVAIL 21
+#define CST4325_PMUTOP_2B_MASK 0x00000200
+#define CST4325_PMUTOP_2B_SHIFT 9
+
+#define RES4329_RESERVED0 0
+#define RES4329_CBUCK_LPOM 1
+#define RES4329_CBUCK_BURST 2
+#define RES4329_CBUCK_PWM 3
+#define RES4329_CLDO_PU 4
+#define RES4329_PALDO_PU 5
+#define RES4329_ILP_REQUEST 6
+#define RES4329_RESERVED7 7
+#define RES4329_RESERVED8 8
+#define RES4329_LNLDO1_PU 9
+#define RES4329_OTP_PU 10
+#define RES4329_RESERVED11 11
+#define RES4329_LNLDO2_PU 12
+#define RES4329_XTAL_PU 13
+#define RES4329_ALP_AVAIL 14
+#define RES4329_RX_PWRSW_PU 15
+#define RES4329_TX_PWRSW_PU 16
+#define RES4329_RFPLL_PWRSW_PU 17
+#define RES4329_LOGEN_PWRSW_PU 18
+#define RES4329_AFE_PWRSW_PU 19
+#define RES4329_BBPLL_PWRSW_PU 20
+#define RES4329_HT_AVAIL 21
#define CST4329_SPROM_OTP_SEL_MASK 0x00000003
-#define CST4329_DEFCIS_SEL 0
-#define CST4329_SPROM_SEL 1
-#define CST4329_OTP_SEL 2
-#define CST4329_OTP_PWRDN 3
+#define CST4329_DEFCIS_SEL 0
+#define CST4329_SPROM_SEL 1
+#define CST4329_OTP_SEL 2
+#define CST4329_OTP_PWRDN 3
#define CST4329_SPI_SDIO_MODE_MASK 0x00000004
#define CST4329_SPI_SDIO_MODE_SHIFT 2
#define CST4312_SPROM_OTP_SEL_MASK 0x00000003
-#define CST4312_DEFCIS_SEL 0
-#define CST4312_SPROM_SEL 1
-#define CST4312_OTP_SEL 2
-#define CST4312_OTP_BAD 3
-
-
-#define RES4312_SWITCHER_BURST 0
-#define RES4312_SWITCHER_PWM 1
-#define RES4312_PA_REF_LDO 2
-#define RES4312_CORE_LDO_BURST 3
-#define RES4312_CORE_LDO_PWM 4
-#define RES4312_RADIO_LDO 5
-#define RES4312_ILP_REQUEST 6
-#define RES4312_BG_FILTBYP 7
-#define RES4312_TX_FILTBYP 8
-#define RES4312_RX_FILTBYP 9
-#define RES4312_XTAL_PU 10
-#define RES4312_ALP_AVAIL 11
-#define RES4312_BB_PLL_FILTBYP 12
-#define RES4312_RF_PLL_FILTBYP 13
-#define RES4312_HT_AVAIL 14
+#define CST4312_DEFCIS_SEL 0
+#define CST4312_SPROM_SEL 1
+#define CST4312_OTP_SEL 2
+#define CST4312_OTP_BAD 3
+
+
+#define RES4312_SWITCHER_BURST 0
+#define RES4312_SWITCHER_PWM 1
+#define RES4312_PA_REF_LDO 2
+#define RES4312_CORE_LDO_BURST 3
+#define RES4312_CORE_LDO_PWM 4
+#define RES4312_RADIO_LDO 5
+#define RES4312_ILP_REQUEST 6
+#define RES4312_BG_FILTBYP 7
+#define RES4312_TX_FILTBYP 8
+#define RES4312_RX_FILTBYP 9
+#define RES4312_XTAL_PU 10
+#define RES4312_ALP_AVAIL 11
+#define RES4312_BB_PLL_FILTBYP 12
+#define RES4312_RF_PLL_FILTBYP 13
+#define RES4312_HT_AVAIL 14
#define RES4322_RF_LDO 0
@@ -1580,36 +1623,36 @@ typedef volatile struct {
#define CST4322_XTAL_FREQ_20_40MHZ 0x00000020
#define CST4322_SPROM_OTP_SEL_MASK 0x000000c0
#define CST4322_SPROM_OTP_SEL_SHIFT 6
-#define CST4322_NO_SPROM_OTP 0
-#define CST4322_SPROM_PRESENT 1
-#define CST4322_OTP_PRESENT 2
+#define CST4322_NO_SPROM_OTP 0
+#define CST4322_SPROM_PRESENT 1
+#define CST4322_OTP_PRESENT 2
#define CST4322_PCI_OR_USB 0x00000100
#define CST4322_BOOT_MASK 0x00000600
#define CST4322_BOOT_SHIFT 9
-#define CST4322_BOOT_FROM_SRAM 0
-#define CST4322_BOOT_FROM_ROM 1
-#define CST4322_BOOT_FROM_FLASH 2
+#define CST4322_BOOT_FROM_SRAM 0
+#define CST4322_BOOT_FROM_ROM 1
+#define CST4322_BOOT_FROM_FLASH 2
#define CST4322_BOOT_FROM_INVALID 3
#define CST4322_ILP_DIV_EN 0x00000800
#define CST4322_FLASH_TYPE_MASK 0x00001000
#define CST4322_FLASH_TYPE_SHIFT 12
-#define CST4322_FLASH_TYPE_SHIFT_ST 0
-#define CST4322_FLASH_TYPE_SHIFT_ATMEL 1
+#define CST4322_FLASH_TYPE_SHIFT_ST 0
+#define CST4322_FLASH_TYPE_SHIFT_ATMEL 1
#define CST4322_ARM_TAP_SEL 0x00002000
#define CST4322_RES_INIT_MODE_MASK 0x0000c000
#define CST4322_RES_INIT_MODE_SHIFT 14
-#define CST4322_RES_INIT_MODE_ILPAVAIL 0
-#define CST4322_RES_INIT_MODE_ILPREQ 1
-#define CST4322_RES_INIT_MODE_ALPAVAIL 2
-#define CST4322_RES_INIT_MODE_HTAVAIL 3
+#define CST4322_RES_INIT_MODE_ILPAVAIL 0
+#define CST4322_RES_INIT_MODE_ILPREQ 1
+#define CST4322_RES_INIT_MODE_ALPAVAIL 2
+#define CST4322_RES_INIT_MODE_HTAVAIL 3
#define CST4322_PCIPLLCLK_GATING 0x00010000
#define CST4322_CLK_SWITCH_PCI_TO_ALP 0x00020000
#define CST4322_PCI_CARDBUS_MODE 0x00040000
-#define CCTRL43224_GPIO_TOGGLE 0x8000
-#define CCTRL_43224A0_12MA_LED_DRIVE 0x00F000F0
-#define CCTRL_43224B0_12MA_LED_DRIVE 0xF0
+#define CCTRL43224_GPIO_TOGGLE 0x8000
+#define CCTRL_43224A0_12MA_LED_DRIVE 0x00F000F0
+#define CCTRL_43224B0_12MA_LED_DRIVE 0xF0
#define RES43236_REGULATOR 0
@@ -1620,23 +1663,23 @@ typedef volatile struct {
#define RES43236_HT_SI_AVAIL 5
-#define CCTRL43236_BT_COEXIST (1<<0)
-#define CCTRL43236_SECI (1<<1)
-#define CCTRL43236_EXT_LNA (1<<2)
-#define CCTRL43236_ANT_MUX_2o3 (1<<3)
-#define CCTRL43236_GSIO (1<<4)
+#define CCTRL43236_BT_COEXIST (1<<0)
+#define CCTRL43236_SECI (1<<1)
+#define CCTRL43236_EXT_LNA (1<<2)
+#define CCTRL43236_ANT_MUX_2o3 (1<<3)
+#define CCTRL43236_GSIO (1<<4)
#define CST43236_SFLASH_MASK 0x00000040
#define CST43236_OTP_SEL_MASK 0x00000080
#define CST43236_OTP_SEL_SHIFT 7
-#define CST43236_HSIC_MASK 0x00000100
-#define CST43236_BP_CLK 0x00000200
+#define CST43236_HSIC_MASK 0x00000100
+#define CST43236_BP_CLK 0x00000200
#define CST43236_BOOT_MASK 0x00001800
#define CST43236_BOOT_SHIFT 11
-#define CST43236_BOOT_FROM_SRAM 0
-#define CST43236_BOOT_FROM_ROM 1
-#define CST43236_BOOT_FROM_FLASH 2
+#define CST43236_BOOT_FROM_SRAM 0
+#define CST43236_BOOT_FROM_ROM 1
+#define CST43236_BOOT_FROM_FLASH 2
#define CST43236_BOOT_FROM_INVALID 3
@@ -1648,23 +1691,23 @@ typedef volatile struct {
#define RES43237_HT_SI_AVAIL 5
-#define CCTRL43237_BT_COEXIST (1<<0)
-#define CCTRL43237_SECI (1<<1)
-#define CCTRL43237_EXT_LNA (1<<2)
-#define CCTRL43237_ANT_MUX_2o3 (1<<3)
-#define CCTRL43237_GSIO (1<<4)
+#define CCTRL43237_BT_COEXIST (1<<0)
+#define CCTRL43237_SECI (1<<1)
+#define CCTRL43237_EXT_LNA (1<<2)
+#define CCTRL43237_ANT_MUX_2o3 (1<<3)
+#define CCTRL43237_GSIO (1<<4)
#define CST43237_SFLASH_MASK 0x00000040
#define CST43237_OTP_SEL_MASK 0x00000080
#define CST43237_OTP_SEL_SHIFT 7
-#define CST43237_HSIC_MASK 0x00000100
-#define CST43237_BP_CLK 0x00000200
+#define CST43237_HSIC_MASK 0x00000100
+#define CST43237_BP_CLK 0x00000200
#define CST43237_BOOT_MASK 0x00001800
#define CST43237_BOOT_SHIFT 11
-#define CST43237_BOOT_FROM_SRAM 0
-#define CST43237_BOOT_FROM_ROM 1
-#define CST43237_BOOT_FROM_FLASH 2
+#define CST43237_BOOT_FROM_SRAM 0
+#define CST43237_BOOT_FROM_ROM 1
+#define CST43237_BOOT_FROM_FLASH 2
#define CST43237_BOOT_FROM_INVALID 3
@@ -1677,10 +1720,10 @@ typedef volatile struct {
#define CST43239_SFLASH_MASK 0x00000004
#define CST43239_RES_INIT_MODE_SHIFT 7
#define CST43239_RES_INIT_MODE_MASK 0x000001f0
-#define CST43239_CHIPMODE_SDIOD(cs) ((cs) & (1 << 15))
-#define CST43239_CHIPMODE_USB20D(cs) (~(cs) & (1 << 15))
-#define CST43239_CHIPMODE_SDIO(cs) (((cs) & (1 << 0)) == 0)
-#define CST43239_CHIPMODE_GSPI(cs) (((cs) & (1 << 0)) == (1 << 0))
+#define CST43239_CHIPMODE_SDIOD(cs) ((cs) & (1 << 15))
+#define CST43239_CHIPMODE_USB20D(cs) (~(cs) & (1 << 15))
+#define CST43239_CHIPMODE_SDIO(cs) (((cs) & (1 << 0)) == 0)
+#define CST43239_CHIPMODE_GSPI(cs) (((cs) & (1 << 0)) == (1 << 0))
#define RES4324_OTP_PU 10
@@ -1693,8 +1736,8 @@ typedef volatile struct {
#define CST4324_RES_INIT_MODE_SHIFT 10
#define CST4324_RES_INIT_MODE_MASK 0x00000c00
#define CST4324_CHIPMODE_MASK 0x7
-#define CST4324_CHIPMODE_SDIOD(cs) ((~(cs)) & (1 << 2))
-#define CST4324_CHIPMODE_USB20D(cs) (((cs) & CST4324_CHIPMODE_MASK) == 0x6)
+#define CST4324_CHIPMODE_SDIOD(cs) ((~(cs)) & (1 << 2))
+#define CST4324_CHIPMODE_USB20D(cs) (((cs) & CST4324_CHIPMODE_MASK) == 0x6)
#define RES4331_REGULATOR 0
@@ -1705,26 +1748,26 @@ typedef volatile struct {
#define RES4331_HT_SI_AVAIL 5
-#define CCTRL4331_BT_COEXIST (1<<0)
-#define CCTRL4331_SECI (1<<1)
-#define CCTRL4331_EXT_LNA_G (1<<2)
-#define CCTRL4331_SPROM_GPIO13_15 (1<<3)
-#define CCTRL4331_EXTPA_EN (1<<4)
-#define CCTRL4331_GPIOCLK_ON_SPROMCS (1<<5)
-#define CCTRL4331_PCIE_MDIO_ON_SPROMCS (1<<6)
-#define CCTRL4331_EXTPA_ON_GPIO2_5 (1<<7)
-#define CCTRL4331_OVR_PIPEAUXCLKEN (1<<8)
-#define CCTRL4331_OVR_PIPEAUXPWRDOWN (1<<9)
-#define CCTRL4331_PCIE_AUXCLKEN (1<<10)
-#define CCTRL4331_PCIE_PIPE_PLLDOWN (1<<11)
-#define CCTRL4331_EXTPA_EN2 (1<<12)
-#define CCTRL4331_EXT_LNA_A (1<<13)
-#define CCTRL4331_BT_SHD0_ON_GPIO4 (1<<16)
-#define CCTRL4331_BT_SHD1_ON_GPIO5 (1<<17)
-#define CCTRL4331_EXTPA_ANA_EN (1<<24)
-
-
-#define CST4331_XTAL_FREQ 0x00000001
+#define CCTRL4331_BT_COEXIST (1<<0)
+#define CCTRL4331_SECI (1<<1)
+#define CCTRL4331_EXT_LNA_G (1<<2)
+#define CCTRL4331_SPROM_GPIO13_15 (1<<3)
+#define CCTRL4331_EXTPA_EN (1<<4)
+#define CCTRL4331_GPIOCLK_ON_SPROMCS (1<<5)
+#define CCTRL4331_PCIE_MDIO_ON_SPROMCS (1<<6)
+#define CCTRL4331_EXTPA_ON_GPIO2_5 (1<<7)
+#define CCTRL4331_OVR_PIPEAUXCLKEN (1<<8)
+#define CCTRL4331_OVR_PIPEAUXPWRDOWN (1<<9)
+#define CCTRL4331_PCIE_AUXCLKEN (1<<10)
+#define CCTRL4331_PCIE_PIPE_PLLDOWN (1<<11)
+#define CCTRL4331_EXTPA_EN2 (1<<12)
+#define CCTRL4331_EXT_LNA_A (1<<13)
+#define CCTRL4331_BT_SHD0_ON_GPIO4 (1<<16)
+#define CCTRL4331_BT_SHD1_ON_GPIO5 (1<<17)
+#define CCTRL4331_EXTPA_ANA_EN (1<<24)
+
+
+#define CST4331_XTAL_FREQ 0x00000001
#define CST4331_SPROM_OTP_SEL_MASK 0x00000006
#define CST4331_SPROM_OTP_SEL_SHIFT 1
#define CST4331_SPROM_PRESENT 0x00000002
@@ -1733,77 +1776,77 @@ typedef volatile struct {
#define CST4331_LDO_PAR 0x00000010
-#define RES4315_CBUCK_LPOM 1
-#define RES4315_CBUCK_BURST 2
-#define RES4315_CBUCK_PWM 3
-#define RES4315_CLDO_PU 4
-#define RES4315_PALDO_PU 5
-#define RES4315_ILP_REQUEST 6
-#define RES4315_LNLDO1_PU 9
-#define RES4315_OTP_PU 10
-#define RES4315_LNLDO2_PU 12
-#define RES4315_XTAL_PU 13
-#define RES4315_ALP_AVAIL 14
-#define RES4315_RX_PWRSW_PU 15
-#define RES4315_TX_PWRSW_PU 16
-#define RES4315_RFPLL_PWRSW_PU 17
-#define RES4315_LOGEN_PWRSW_PU 18
-#define RES4315_AFE_PWRSW_PU 19
-#define RES4315_BBPLL_PWRSW_PU 20
-#define RES4315_HT_AVAIL 21
-
-
-#define CST4315_SPROM_OTP_SEL_MASK 0x00000003
-#define CST4315_DEFCIS_SEL 0x00000000
-#define CST4315_SPROM_SEL 0x00000001
-#define CST4315_OTP_SEL 0x00000002
-#define CST4315_OTP_PWRDN 0x00000003
-#define CST4315_SDIO_MODE 0x00000004
+#define RES4315_CBUCK_LPOM 1
+#define RES4315_CBUCK_BURST 2
+#define RES4315_CBUCK_PWM 3
+#define RES4315_CLDO_PU 4
+#define RES4315_PALDO_PU 5
+#define RES4315_ILP_REQUEST 6
+#define RES4315_LNLDO1_PU 9
+#define RES4315_OTP_PU 10
+#define RES4315_LNLDO2_PU 12
+#define RES4315_XTAL_PU 13
+#define RES4315_ALP_AVAIL 14
+#define RES4315_RX_PWRSW_PU 15
+#define RES4315_TX_PWRSW_PU 16
+#define RES4315_RFPLL_PWRSW_PU 17
+#define RES4315_LOGEN_PWRSW_PU 18
+#define RES4315_AFE_PWRSW_PU 19
+#define RES4315_BBPLL_PWRSW_PU 20
+#define RES4315_HT_AVAIL 21
+
+
+#define CST4315_SPROM_OTP_SEL_MASK 0x00000003
+#define CST4315_DEFCIS_SEL 0x00000000
+#define CST4315_SPROM_SEL 0x00000001
+#define CST4315_OTP_SEL 0x00000002
+#define CST4315_OTP_PWRDN 0x00000003
+#define CST4315_SDIO_MODE 0x00000004
#define CST4315_RCAL_VALID 0x00000008
#define CST4315_RCAL_VALUE_MASK 0x000001f0
#define CST4315_RCAL_VALUE_SHIFT 4
-#define CST4315_PALDO_EXTPNP 0x00000200
+#define CST4315_PALDO_EXTPNP 0x00000200
#define CST4315_CBUCK_MODE_MASK 0x00000c00
#define CST4315_CBUCK_MODE_BURST 0x00000400
#define CST4315_CBUCK_MODE_LPBURST 0x00000c00
-#define RES4319_CBUCK_LPOM 1
-#define RES4319_CBUCK_BURST 2
-#define RES4319_CBUCK_PWM 3
-#define RES4319_CLDO_PU 4
-#define RES4319_PALDO_PU 5
-#define RES4319_ILP_REQUEST 6
-#define RES4319_LNLDO1_PU 9
-#define RES4319_OTP_PU 10
-#define RES4319_LNLDO2_PU 12
-#define RES4319_XTAL_PU 13
-#define RES4319_ALP_AVAIL 14
-#define RES4319_RX_PWRSW_PU 15
-#define RES4319_TX_PWRSW_PU 16
-#define RES4319_RFPLL_PWRSW_PU 17
-#define RES4319_LOGEN_PWRSW_PU 18
-#define RES4319_AFE_PWRSW_PU 19
-#define RES4319_BBPLL_PWRSW_PU 20
-#define RES4319_HT_AVAIL 21
+#define RES4319_CBUCK_LPOM 1
+#define RES4319_CBUCK_BURST 2
+#define RES4319_CBUCK_PWM 3
+#define RES4319_CLDO_PU 4
+#define RES4319_PALDO_PU 5
+#define RES4319_ILP_REQUEST 6
+#define RES4319_LNLDO1_PU 9
+#define RES4319_OTP_PU 10
+#define RES4319_LNLDO2_PU 12
+#define RES4319_XTAL_PU 13
+#define RES4319_ALP_AVAIL 14
+#define RES4319_RX_PWRSW_PU 15
+#define RES4319_TX_PWRSW_PU 16
+#define RES4319_RFPLL_PWRSW_PU 17
+#define RES4319_LOGEN_PWRSW_PU 18
+#define RES4319_AFE_PWRSW_PU 19
+#define RES4319_BBPLL_PWRSW_PU 20
+#define RES4319_HT_AVAIL 21
#define CST4319_SPI_CPULESSUSB 0x00000001
#define CST4319_SPI_CLK_POL 0x00000002
#define CST4319_SPI_CLK_PH 0x00000008
-#define CST4319_SPROM_OTP_SEL_MASK 0x000000c0
+#define CST4319_SPROM_OTP_SEL_MASK 0x000000c0
#define CST4319_SPROM_OTP_SEL_SHIFT 6
-#define CST4319_DEFCIS_SEL 0x00000000
-#define CST4319_SPROM_SEL 0x00000040
-#define CST4319_OTP_SEL 0x00000080
-#define CST4319_OTP_PWRDN 0x000000c0
-#define CST4319_SDIO_USB_MODE 0x00000100
+#define CST4319_DEFCIS_SEL 0x00000000
+#define CST4319_SPROM_SEL 0x00000040
+#define CST4319_OTP_SEL 0x00000080
+#define CST4319_OTP_PWRDN 0x000000c0
+#define CST4319_SDIO_USB_MODE 0x00000100
#define CST4319_REMAP_SEL_MASK 0x00000600
#define CST4319_ILPDIV_EN 0x00000800
#define CST4319_XTAL_PD_POL 0x00001000
#define CST4319_LPO_SEL 0x00002000
#define CST4319_RES_INIT_MODE 0x0000c000
-#define CST4319_PALDO_EXTPNP 0x00010000
+#define CST4319_PALDO_EXTPNP 0x00010000
#define CST4319_CBUCK_MODE_MASK 0x00060000
#define CST4319_CBUCK_MODE_BURST 0x00020000
#define CST4319_CBUCK_MODE_LPBURST 0x00060000
@@ -1897,16 +1940,16 @@ typedef volatile struct {
#define RES4330_5g_LOGEN_PWRSW_PU 27
-#define CST4330_CHIPMODE_SDIOD(cs) (((cs) & 0x7) < 6)
-#define CST4330_CHIPMODE_USB20D(cs) (((cs) & 0x7) >= 6)
-#define CST4330_CHIPMODE_SDIO(cs) (((cs) & 0x4) == 0)
-#define CST4330_CHIPMODE_GSPI(cs) (((cs) & 0x6) == 4)
-#define CST4330_CHIPMODE_USB(cs) (((cs) & 0x7) == 6)
-#define CST4330_CHIPMODE_USBDA(cs) (((cs) & 0x7) == 7)
+#define CST4330_CHIPMODE_SDIOD(cs) (((cs) & 0x7) < 6)
+#define CST4330_CHIPMODE_USB20D(cs) (((cs) & 0x7) >= 6)
+#define CST4330_CHIPMODE_SDIO(cs) (((cs) & 0x4) == 0)
+#define CST4330_CHIPMODE_GSPI(cs) (((cs) & 0x6) == 4)
+#define CST4330_CHIPMODE_USB(cs) (((cs) & 0x7) == 6)
+#define CST4330_CHIPMODE_USBDA(cs) (((cs) & 0x7) == 7)
#define CST4330_OTP_PRESENT 0x00000010
#define CST4330_LPO_AUTODET_EN 0x00000020
#define CST4330_ARMREMAP_0 0x00000040
-#define CST4330_SPROM_PRESENT 0x00000080
+#define CST4330_SPROM_PRESENT 0x00000080
#define CST4330_ILPDIV_EN 0x00000100
#define CST4330_LPO_SEL 0x00000200
#define CST4330_RES_INIT_MODE_SHIFT 10
@@ -1922,10 +1965,14 @@ typedef volatile struct {
#define PCTL_4330_SERIAL_ENAB (1 << 24)
-#define CCTRL_4330_GPIO_SEL 0x00000001
-#define CCTRL_4330_ERCX_SEL 0x00000002
-#define CCTRL_4330_SDIO_HOST_WAKE 0x00000004
-#define CCTRL_4330_JTAG_DISABLE 0x00000008
+#define CCTRL_4330_GPIO_SEL 0x00000001
+#define CCTRL_4330_ERCX_SEL 0x00000002
+#define CCTRL_4330_SDIO_HOST_WAKE 0x00000004
+#define CCTRL_4330_JTAG_DISABLE 0x00000008
+
+#define PMU_VREG0_ADDR 0
+#define PMU_VREG0_DISABLE_PULLD_BT_SHIFT 2
+#define PMU_VREG0_DISABLE_PULLD_WL_SHIFT 3
#define RES4334_LPLDO_PU 0
@@ -1985,8 +2032,10 @@ typedef volatile struct {
#define CCTRL4334_HSIC_LDO_PU (1 << 23)
-#define CCTRL1_4324_GPIO_SEL (1 << 0)
-#define CCTRL1_4324_SDIO_HOST_WAKE (1 << 2)
+#define CCTRL1_4324_GPIO_SEL (1 << 0)
+#define CCTRL1_4324_SDIO_HOST_WAKE (1 << 2)
+
+
#define RES4313_BB_PU_RSRC 0
#define RES4313_ILP_REQ_RSRC 1
@@ -2012,7 +2061,7 @@ typedef volatile struct {
#define CST4313_SPROM_OTP_SEL_SHIFT 0
-#define CCTRL_4313_12MA_LED_DRIVE 0x00000007
+#define CCTRL_4313_12MA_LED_DRIVE 0x00000007
#define RES4314_LPLDO_PU 0
@@ -2066,26 +2115,26 @@ typedef volatile struct {
#define CST43228_SDIO_RESET 0x20
-#define CST4706_PKG_OPTION (1<<0)
-#define CST4706_SFLASH_PRESENT (1<<1)
-#define CST4706_SFLASH_TYPE (1<<2)
-#define CST4706_MIPS_BENDIAN (1<<3)
-#define CST4706_PCIE1_DISABLE (1<<5)
+#define CST4706_PKG_OPTION (1<<0)
+#define CST4706_SFLASH_PRESENT (1<<1)
+#define CST4706_SFLASH_TYPE (1<<2)
+#define CST4706_MIPS_BENDIAN (1<<3)
+#define CST4706_PCIE1_DISABLE (1<<5)
#define FLSTRCF4706_MASK 0x000000ff
-#define FLSTRCF4706_SF1 0x00000001
-#define FLSTRCF4706_PF1 0x00000002
-#define FLSTRCF4706_SF1_TYPE 0x00000004
-#define FLSTRCF4706_NF1 0x00000008
-#define FLSTRCF4706_1ST_MADDR_SEG_MASK 0x000000f0
-#define FLSTRCF4706_1ST_MADDR_SEG_4MB 0x00000010
-#define FLSTRCF4706_1ST_MADDR_SEG_8MB 0x00000020
-#define FLSTRCF4706_1ST_MADDR_SEG_16MB 0x00000030
-#define FLSTRCF4706_1ST_MADDR_SEG_32MB 0x00000040
-#define FLSTRCF4706_1ST_MADDR_SEG_64MB 0x00000050
-#define FLSTRCF4706_1ST_MADDR_SEG_128MB 0x00000060
-#define FLSTRCF4706_1ST_MADDR_SEG_256MB 0x00000070
+#define FLSTRCF4706_SF1 0x00000001
+#define FLSTRCF4706_PF1 0x00000002
+#define FLSTRCF4706_SF1_TYPE 0x00000004
+#define FLSTRCF4706_NF1 0x00000008
+#define FLSTRCF4706_1ST_MADDR_SEG_MASK 0x000000f0
+#define FLSTRCF4706_1ST_MADDR_SEG_4MB 0x00000010
+#define FLSTRCF4706_1ST_MADDR_SEG_8MB 0x00000020
+#define FLSTRCF4706_1ST_MADDR_SEG_16MB 0x00000030
+#define FLSTRCF4706_1ST_MADDR_SEG_32MB 0x00000040
+#define FLSTRCF4706_1ST_MADDR_SEG_64MB 0x00000050
+#define FLSTRCF4706_1ST_MADDR_SEG_128MB 0x00000060
+#define FLSTRCF4706_1ST_MADDR_SEG_256MB 0x00000070
#define CCTRL4360_SECI_MODE (1 << 2)
@@ -2098,14 +2147,12 @@ typedef volatile struct {
#define RES4360_REGULATOR 0
#define RES4360_ILP_AVAIL 1
#define RES4360_ILP_REQ 2
-#define RES4360_XTAL_PU 3
-#define RES4360_ALP_AVAIL 4
-#define RES4360_BBPLLPWRSW_PU 5
-#define RES4360_HT_AVAIL 6
-#define RES4360_OTP_PU 7
-#define RES4360_USBLDO_PU 8
-#define RES4360_USBPLL_PWRSW_PU 9
-#define RES4360_LQ_AVAIL 10
+#define RES4360_XTAL_LDO_PU 3
+#define RES4360_XTAL_PU 4
+#define RES4360_ALP_AVAIL 5
+#define RES4360_BBPLLPWRSW_PU 6
+#define RES4360_HT_AVAIL 7
+#define RES4360_OTP_PU 8
#define CST4360_XTAL_40MZ 0x00000001
#define CST4360_SFLASH 0x00000002
@@ -2126,6 +2173,134 @@ typedef volatile struct {
#define CCTRL_4360_UART_SEL 0x2
+#define RES4335_LPLDO_PO 0
+#define RES4335_PMU_BG_PU 1
+#define RES4335_PMU_SLEEP 2
+#define RES4335_RSVD_3 3
+#define RES4335_CBUCK_LPOM_PU 4
+#define RES4335_CBUCK_PFM_PU 5
+#define RES4335_RSVD_6 6
+#define RES4335_RSVD_7 7
+#define RES4335_LNLDO_PU 8
+#define RES4335_XTALLDO_PU 9
+#define RES4335_LDO3P3_PU 10
+#define RES4335_OTP_PU 11
+#define RES4335_XTAL_PU 12
+#define RES4335_SR_CLK_START 13
+#define RES4335_LQ_AVAIL 14
+#define RES4335_LQ_START 15
+#define RES4335_RSVD_16 16
+#define RES4335_WL_CORE_RDY 17
+#define RES4335_ILP_REQ 18
+#define RES4335_ALP_AVAIL 19
+#define RES4335_MINI_PMU 20
+#define RES4335_RADIO_PU 21
+#define RES4335_SR_CLK_STABLE 22
+#define RES4335_SR_SAVE_RESTORE 23
+#define RES4335_SR_PHY_PWRSW 24
+#define RES4335_SR_VDDM_PWRSW 25
+#define RES4335_SR_SUBCORE_PWRSW 26
+#define RES4335_SR_SLEEP 27
+#define RES4335_HT_START 28
+#define RES4335_HT_AVAIL 29
+#define RES4335_MACPHY_CLKAVAIL 30
+
+
+#define CST4335_SPROM_MASK 0x00000020
+#define CST4335_SFLASH_MASK 0x00000040
+#define CST4335_RES_INIT_MODE_SHIFT 7
+#define CST4335_RES_INIT_MODE_MASK 0x00000180
+#define CST4335_CHIPMODE_MASK 0xF
+#define CST4335_CHIPMODE_SDIOD(cs) (((cs) & (1 << 0)) != 0)
+#define CST4335_CHIPMODE_GSPI(cs) (((cs) & (1 << 1)) != 0)
+#define CST4335_CHIPMODE_USB20D(cs) (((cs) & (1 << 2)) != 0)
+#define CST4335_CHIPMODE_PCIE(cs) (((cs) & (1 << 3)) != 0)
+
+
+#define CCTRL1_4335_GPIO_SEL (1 << 0)
+#define CCTRL1_4335_SDIO_HOST_WAKE (1 << 2)
+
+
+#define CR4_RAM_BASE (0x180000)
+
+
+
+
+#define CC_GCI_CHIPCTRL_00 (0)
+#define CC_GCI_CHIPCTRL_01 (1)
+#define CC_GCI_CHIPCTRL_02 (2)
+#define CC_GCI_CHIPCTRL_03 (3)
+#define CC_GCI_CHIPCTRL_04 (4)
+#define CC_GCI_CHIPCTRL_05 (5)
+#define CC_GCI_CHIPCTRL_06 (6)
+#define CC_GCI_CHIPCTRL_07 (7)
+#define CC_GCI_CHIPCTRL_08 (8)
+
+#define CC_GCI_NUMCHIPCTRLREGS(cap1) ((cap1 & 0xF00) >> 8)
+
+
+#define CC4335_PIN_GPIO_00 (0)
+#define CC4335_PIN_GPIO_01 (1)
+#define CC4335_PIN_GPIO_02 (2)
+#define CC4335_PIN_GPIO_03 (3)
+#define CC4335_PIN_GPIO_04 (4)
+#define CC4335_PIN_GPIO_05 (5)
+#define CC4335_PIN_GPIO_06 (6)
+#define CC4335_PIN_GPIO_07 (7)
+#define CC4335_PIN_GPIO_08 (8)
+#define CC4335_PIN_GPIO_09 (9)
+#define CC4335_PIN_GPIO_10 (10)
+#define CC4335_PIN_GPIO_11 (11)
+#define CC4335_PIN_GPIO_12 (12)
+#define CC4335_PIN_GPIO_13 (13)
+#define CC4335_PIN_GPIO_14 (14)
+#define CC4335_PIN_GPIO_15 (15)
+#define CC4335_PIN_SDIO_CLK (16)
+#define CC4335_PIN_SDIO_CMD (17)
+#define CC4335_PIN_SDIO_DATA0 (18)
+#define CC4335_PIN_SDIO_DATA1 (19)
+#define CC4335_PIN_SDIO_DATA2 (20)
+#define CC4335_PIN_SDIO_DATA3 (21)
+#define CC4335_PIN_RF_SW_CTRL_0 (22)
+#define CC4335_PIN_RF_SW_CTRL_1 (23)
+#define CC4335_PIN_RF_SW_CTRL_2 (24)
+#define CC4335_PIN_RF_SW_CTRL_3 (25)
+#define CC4335_PIN_RF_SW_CTRL_4 (26)
+#define CC4335_PIN_RF_SW_CTRL_5 (27)
+#define CC4335_PIN_RF_SW_CTRL_6 (28)
+#define CC4335_PIN_RF_SW_CTRL_7 (29)
+#define CC4335_PIN_RF_SW_CTRL_8 (30)
+#define CC4335_PIN_RF_SW_CTRL_9 (31)
+
+
+#define CC4335_FNSEL_HWDEF (0)
+#define CC4335_FNSEL_SAMEASPIN (1)
+#define CC4335_FNSEL_GPIO0 (2)
+#define CC4335_FNSEL_GPIO1 (3)
+#define CC4335_FNSEL_GCI0 (4)
+#define CC4335_FNSEL_GCI1 (5)
+#define CC4335_FNSEL_UART (6)
+#define CC4335_FNSEL_SFLASH (7)
+#define CC4335_FNSEL_SPROM (8)
+#define CC4335_FNSEL_MISC0 (9)
+#define CC4335_FNSEL_MISC1 (10)
+#define CC4335_FNSEL_MISC2 (11)
+#define CC4335_FNSEL_IND (12)
+#define CC4335_FNSEL_PDN (13)
+#define CC4335_FNSEL_PUP (14)
+#define CC4335_FNSEL_TRI (15)
+
+
+#define GCIMASK(pos) (((uint32)0xF) << pos)
+
+
+#define GCIPOSVAL(val, pos) ((((uint32)val) << pos) & GCIMASK(pos))
+
+
+#define MUXENAB4335_UART_MASK (0x0000000f)
+
+
+
#define CHIP_HOSTIF_USB(sih) (si_chip_hostif(sih) & CST4360_MODE_USB)
@@ -2147,7 +2322,7 @@ typedef volatile struct {
#define SECI_ENAB_SECI_ECI (1 << 2)
#define SECI_ENAB_SECIOUT_DIS (1 << 3)
#define SECI_MODE_MASK 0x7
-#define SECI_MODE_SHIFT 4
+#define SECI_MODE_SHIFT 4
#define SECI_UPD_SECI (1 << 7)
#define SECI_SIGNOFF_0 0xDB
@@ -2163,11 +2338,11 @@ typedef volatile struct {
#define SECI_UART_SECI_IN2_STATE (1 << 3)
-#define SECI_UART_LCR_STOP_BITS (1 << 0)
+#define SECI_UART_LCR_STOP_BITS (1 << 0)
#define SECI_UART_LCR_PARITY_EN (1 << 1)
-#define SECI_UART_LCR_PARITY (1 << 2)
+#define SECI_UART_LCR_PARITY (1 << 2)
#define SECI_UART_LCR_RX_EN (1 << 3)
-#define SECI_UART_LCR_LBRK_CTRL (1 << 4)
+#define SECI_UART_LCR_LBRK_CTRL (1 << 4)
#define SECI_UART_LCR_TXO_EN (1 << 5)
#define SECI_UART_LCR_RTSO_EN (1 << 6)
#define SECI_UART_LCR_SLIPMODE_EN (1 << 7)
@@ -2202,4 +2377,4 @@ typedef volatile struct {
#define WLAN_NUM_ANT1 TXANT_0
#define WLAN_NUM_ANT2 TXANT_1
-#endif
+#endif
diff --git a/drivers/net/wireless/bcmdhd/src/include/sbconfig.h b/drivers/net/wireless/bcmdhd/include/sbconfig.h
index 96038c3..44d6832 100644
--- a/drivers/net/wireless/bcmdhd/src/include/sbconfig.h
+++ b/drivers/net/wireless/bcmdhd/include/sbconfig.h
@@ -1,14 +1,14 @@
/*
* Broadcom SiliconBackplane hardware register definitions.
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,7 +16,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
@@ -35,18 +35,18 @@
#endif
-#define SB_BUS_SIZE 0x10000
+#define SB_BUS_SIZE 0x10000
#define SB_BUS_BASE(b) (SI_ENUM_BASE + (b) * SB_BUS_SIZE)
-#define SB_BUS_MAXCORES (SB_BUS_SIZE / SI_CORE_SIZE)
+#define SB_BUS_MAXCORES (SB_BUS_SIZE / SI_CORE_SIZE)
-#define SBCONFIGOFF 0xf00
-#define SBCONFIGSIZE 256
+#define SBCONFIGOFF 0xf00
+#define SBCONFIGSIZE 256
#define SBIPSFLAG 0x08
#define SBTPSFLAG 0x18
-#define SBTMERRLOGA 0x48
-#define SBTMERRLOG 0x50
+#define SBTMERRLOGA 0x48
+#define SBTMERRLOG 0x50
#define SBADMATCH3 0x60
#define SBADMATCH2 0x68
#define SBADMATCH1 0x70
@@ -78,198 +78,198 @@
typedef volatile struct _sbconfig {
uint32 PAD[2];
- uint32 sbipsflag;
+ uint32 sbipsflag;
uint32 PAD[3];
- uint32 sbtpsflag;
+ uint32 sbtpsflag;
uint32 PAD[11];
- uint32 sbtmerrloga;
+ uint32 sbtmerrloga;
uint32 PAD;
- uint32 sbtmerrlog;
+ uint32 sbtmerrlog;
uint32 PAD[3];
- uint32 sbadmatch3;
+ uint32 sbadmatch3;
uint32 PAD;
- uint32 sbadmatch2;
+ uint32 sbadmatch2;
uint32 PAD;
- uint32 sbadmatch1;
+ uint32 sbadmatch1;
uint32 PAD[7];
- uint32 sbimstate;
- uint32 sbintvec;
- uint32 sbtmstatelow;
- uint32 sbtmstatehigh;
- uint32 sbbwa0;
+ uint32 sbimstate;
+ uint32 sbintvec;
+ uint32 sbtmstatelow;
+ uint32 sbtmstatehigh;
+ uint32 sbbwa0;
uint32 PAD;
- uint32 sbimconfiglow;
- uint32 sbimconfighigh;
- uint32 sbadmatch0;
+ uint32 sbimconfiglow;
+ uint32 sbimconfighigh;
+ uint32 sbadmatch0;
uint32 PAD;
- uint32 sbtmconfiglow;
- uint32 sbtmconfighigh;
- uint32 sbbconfig;
+ uint32 sbtmconfiglow;
+ uint32 sbtmconfighigh;
+ uint32 sbbconfig;
uint32 PAD;
- uint32 sbbstate;
+ uint32 sbbstate;
uint32 PAD[3];
- uint32 sbactcnfg;
+ uint32 sbactcnfg;
uint32 PAD[3];
- uint32 sbflagst;
+ uint32 sbflagst;
uint32 PAD[3];
- uint32 sbidlow;
- uint32 sbidhigh;
+ uint32 sbidlow;
+ uint32 sbidhigh;
} sbconfig_t;
-#endif
+#endif
-#define SBIPS_INT1_MASK 0x3f
+#define SBIPS_INT1_MASK 0x3f
#define SBIPS_INT1_SHIFT 0
-#define SBIPS_INT2_MASK 0x3f00
+#define SBIPS_INT2_MASK 0x3f00
#define SBIPS_INT2_SHIFT 8
-#define SBIPS_INT3_MASK 0x3f0000
+#define SBIPS_INT3_MASK 0x3f0000
#define SBIPS_INT3_SHIFT 16
-#define SBIPS_INT4_MASK 0x3f000000
+#define SBIPS_INT4_MASK 0x3f000000
#define SBIPS_INT4_SHIFT 24
-#define SBTPS_NUM0_MASK 0x3f
-#define SBTPS_F0EN0 0x40
+#define SBTPS_NUM0_MASK 0x3f
+#define SBTPS_F0EN0 0x40
-#define SBTMEL_CM 0x00000007
-#define SBTMEL_CI 0x0000ff00
-#define SBTMEL_EC 0x0f000000
-#define SBTMEL_ME 0x80000000
+#define SBTMEL_CM 0x00000007
+#define SBTMEL_CI 0x0000ff00
+#define SBTMEL_EC 0x0f000000
+#define SBTMEL_ME 0x80000000
-#define SBIM_PC 0xf
-#define SBIM_AP_MASK 0x30
-#define SBIM_AP_BOTH 0x00
-#define SBIM_AP_TS 0x10
-#define SBIM_AP_TK 0x20
-#define SBIM_AP_RSV 0x30
-#define SBIM_IBE 0x20000
-#define SBIM_TO 0x40000
-#define SBIM_BY 0x01800000
-#define SBIM_RJ 0x02000000
+#define SBIM_PC 0xf
+#define SBIM_AP_MASK 0x30
+#define SBIM_AP_BOTH 0x00
+#define SBIM_AP_TS 0x10
+#define SBIM_AP_TK 0x20
+#define SBIM_AP_RSV 0x30
+#define SBIM_IBE 0x20000
+#define SBIM_TO 0x40000
+#define SBIM_BY 0x01800000
+#define SBIM_RJ 0x02000000
-#define SBTML_RESET 0x0001
-#define SBTML_REJ_MASK 0x0006
-#define SBTML_REJ 0x0002
-#define SBTML_TMPREJ 0x0004
+#define SBTML_RESET 0x0001
+#define SBTML_REJ_MASK 0x0006
+#define SBTML_REJ 0x0002
+#define SBTML_TMPREJ 0x0004
-#define SBTML_SICF_SHIFT 16
+#define SBTML_SICF_SHIFT 16
-#define SBTMH_SERR 0x0001
-#define SBTMH_INT 0x0002
-#define SBTMH_BUSY 0x0004
-#define SBTMH_TO 0x0020
+#define SBTMH_SERR 0x0001
+#define SBTMH_INT 0x0002
+#define SBTMH_BUSY 0x0004
+#define SBTMH_TO 0x0020
-#define SBTMH_SISF_SHIFT 16
+#define SBTMH_SISF_SHIFT 16
-#define SBBWA_TAB0_MASK 0xffff
-#define SBBWA_TAB1_MASK 0xffff
+#define SBBWA_TAB0_MASK 0xffff
+#define SBBWA_TAB1_MASK 0xffff
#define SBBWA_TAB1_SHIFT 16
-#define SBIMCL_STO_MASK 0x7
-#define SBIMCL_RTO_MASK 0x70
+#define SBIMCL_STO_MASK 0x7
+#define SBIMCL_RTO_MASK 0x70
#define SBIMCL_RTO_SHIFT 4
-#define SBIMCL_CID_MASK 0xff0000
+#define SBIMCL_CID_MASK 0xff0000
#define SBIMCL_CID_SHIFT 16
-#define SBIMCH_IEM_MASK 0xc
-#define SBIMCH_TEM_MASK 0x30
+#define SBIMCH_IEM_MASK 0xc
+#define SBIMCH_TEM_MASK 0x30
#define SBIMCH_TEM_SHIFT 4
-#define SBIMCH_BEM_MASK 0xc0
+#define SBIMCH_BEM_MASK 0xc0
#define SBIMCH_BEM_SHIFT 6
-#define SBAM_TYPE_MASK 0x3
-#define SBAM_AD64 0x4
-#define SBAM_ADINT0_MASK 0xf8
+#define SBAM_TYPE_MASK 0x3
+#define SBAM_AD64 0x4
+#define SBAM_ADINT0_MASK 0xf8
#define SBAM_ADINT0_SHIFT 3
-#define SBAM_ADINT1_MASK 0x1f8
+#define SBAM_ADINT1_MASK 0x1f8
#define SBAM_ADINT1_SHIFT 3
-#define SBAM_ADINT2_MASK 0x1f8
+#define SBAM_ADINT2_MASK 0x1f8
#define SBAM_ADINT2_SHIFT 3
-#define SBAM_ADEN 0x400
-#define SBAM_ADNEG 0x800
-#define SBAM_BASE0_MASK 0xffffff00
+#define SBAM_ADEN 0x400
+#define SBAM_ADNEG 0x800
+#define SBAM_BASE0_MASK 0xffffff00
#define SBAM_BASE0_SHIFT 8
-#define SBAM_BASE1_MASK 0xfffff000
+#define SBAM_BASE1_MASK 0xfffff000
#define SBAM_BASE1_SHIFT 12
-#define SBAM_BASE2_MASK 0xffff0000
+#define SBAM_BASE2_MASK 0xffff0000
#define SBAM_BASE2_SHIFT 16
-#define SBTMCL_CD_MASK 0xff
-#define SBTMCL_CO_MASK 0xf800
+#define SBTMCL_CD_MASK 0xff
+#define SBTMCL_CO_MASK 0xf800
#define SBTMCL_CO_SHIFT 11
-#define SBTMCL_IF_MASK 0xfc0000
+#define SBTMCL_IF_MASK 0xfc0000
#define SBTMCL_IF_SHIFT 18
-#define SBTMCL_IM_MASK 0x3000000
+#define SBTMCL_IM_MASK 0x3000000
#define SBTMCL_IM_SHIFT 24
-#define SBTMCH_BM_MASK 0x3
-#define SBTMCH_RM_MASK 0x3
+#define SBTMCH_BM_MASK 0x3
+#define SBTMCH_RM_MASK 0x3
#define SBTMCH_RM_SHIFT 2
-#define SBTMCH_SM_MASK 0x30
+#define SBTMCH_SM_MASK 0x30
#define SBTMCH_SM_SHIFT 4
-#define SBTMCH_EM_MASK 0x300
+#define SBTMCH_EM_MASK 0x300
#define SBTMCH_EM_SHIFT 8
-#define SBTMCH_IM_MASK 0xc00
+#define SBTMCH_IM_MASK 0xc00
#define SBTMCH_IM_SHIFT 10
-#define SBBC_LAT_MASK 0x3
-#define SBBC_MAX0_MASK 0xf0000
+#define SBBC_LAT_MASK 0x3
+#define SBBC_MAX0_MASK 0xf0000
#define SBBC_MAX0_SHIFT 16
-#define SBBC_MAX1_MASK 0xf00000
+#define SBBC_MAX1_MASK 0xf00000
#define SBBC_MAX1_SHIFT 20
-#define SBBS_SRD 0x1
-#define SBBS_HRD 0x2
+#define SBBS_SRD 0x1
+#define SBBS_HRD 0x2
-#define SBIDL_CS_MASK 0x3
-#define SBIDL_AR_MASK 0x38
+#define SBIDL_CS_MASK 0x3
+#define SBIDL_AR_MASK 0x38
#define SBIDL_AR_SHIFT 3
-#define SBIDL_SYNCH 0x40
-#define SBIDL_INIT 0x80
-#define SBIDL_MINLAT_MASK 0xf00
+#define SBIDL_SYNCH 0x40
+#define SBIDL_INIT 0x80
+#define SBIDL_MINLAT_MASK 0xf00
#define SBIDL_MINLAT_SHIFT 8
-#define SBIDL_MAXLAT 0xf000
+#define SBIDL_MAXLAT 0xf000
#define SBIDL_MAXLAT_SHIFT 12
-#define SBIDL_FIRST 0x10000
-#define SBIDL_CW_MASK 0xc0000
+#define SBIDL_FIRST 0x10000
+#define SBIDL_CW_MASK 0xc0000
#define SBIDL_CW_SHIFT 18
-#define SBIDL_TP_MASK 0xf00000
+#define SBIDL_TP_MASK 0xf00000
#define SBIDL_TP_SHIFT 20
-#define SBIDL_IP_MASK 0xf000000
+#define SBIDL_IP_MASK 0xf000000
#define SBIDL_IP_SHIFT 24
-#define SBIDL_RV_MASK 0xf0000000
+#define SBIDL_RV_MASK 0xf0000000
#define SBIDL_RV_SHIFT 28
-#define SBIDL_RV_2_2 0x00000000
-#define SBIDL_RV_2_3 0x10000000
+#define SBIDL_RV_2_2 0x00000000
+#define SBIDL_RV_2_3 0x10000000
-#define SBIDH_RC_MASK 0x000f
-#define SBIDH_RCE_MASK 0x7000
+#define SBIDH_RC_MASK 0x000f
+#define SBIDH_RCE_MASK 0x7000
#define SBIDH_RCE_SHIFT 8
#define SBCOREREV(sbidh) \
((((sbidh) & SBIDH_RCE_MASK) >> SBIDH_RCE_SHIFT) | ((sbidh) & SBIDH_RC_MASK))
-#define SBIDH_CC_MASK 0x8ff0
+#define SBIDH_CC_MASK 0x8ff0
#define SBIDH_CC_SHIFT 4
-#define SBIDH_VC_MASK 0xffff0000
+#define SBIDH_VC_MASK 0xffff0000
#define SBIDH_VC_SHIFT 16
-#define SB_COMMIT 0xfd8
+#define SB_COMMIT 0xfd8
-#define SB_VEND_BCM 0x4243
+#define SB_VEND_BCM 0x4243
-#endif
+#endif
diff --git a/drivers/net/wireless/bcmdhd/include/sbhnddma.h b/drivers/net/wireless/bcmdhd/include/sbhnddma.h
new file mode 100644
index 0000000..da1f1a1
--- /dev/null
+++ b/drivers/net/wireless/bcmdhd/include/sbhnddma.h
@@ -0,0 +1,370 @@
+/*
+ * Generic Broadcom Home Networking Division (HND) DMA engine HW interface
+ * This supports the following chips: BCM42xx, 44xx, 47xx .
+ *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
+ * Unless you and Broadcom execute a separate written software license
+ * agreement governing use of this software, this software is licensed to you
+ * under the terms of the GNU General Public License version 2 (the "GPL"),
+ * available at http://www.broadcom.com/licenses/GPLv2.php, with the
+ * following added to such license:
+ *
+ * As a special exception, the copyright holders of this software give you
+ * permission to link this software with independent modules, and to copy and
+ * distribute the resulting executable under terms of your choice, provided that
+ * you also meet, for each linked independent module, the terms and conditions of
+ * the license of that module. An independent module is a module which is not
+ * derived from this software. The special exception does not apply to any
+ * modifications of the software.
+ *
+ * Notwithstanding the above, under no circumstances may you combine this
+ * software in any way with any other Broadcom software provided under a license
+ * other than the GPL, without Broadcom's express prior written consent.
+ *
+ * $Id: sbhnddma.h 309193 2012-01-19 00:03:57Z $
+ */
+
+#ifndef _sbhnddma_h_
+#define _sbhnddma_h_
+
+
+
+
+
+
+
+typedef volatile struct {
+ uint32 control;
+ uint32 addr;
+ uint32 ptr;
+ uint32 status;
+} dma32regs_t;
+
+typedef volatile struct {
+ dma32regs_t xmt;
+ dma32regs_t rcv;
+} dma32regp_t;
+
+typedef volatile struct {
+ uint32 fifoaddr;
+ uint32 fifodatalow;
+ uint32 fifodatahigh;
+ uint32 pad;
+} dma32diag_t;
+
+
+typedef volatile struct {
+ uint32 ctrl;
+ uint32 addr;
+} dma32dd_t;
+
+
+#define D32RINGALIGN_BITS 12
+#define D32MAXRINGSZ (1 << D32RINGALIGN_BITS)
+#define D32RINGALIGN (1 << D32RINGALIGN_BITS)
+
+#define D32MAXDD (D32MAXRINGSZ / sizeof (dma32dd_t))
+
+
+#define XC_XE ((uint32)1 << 0)
+#define XC_SE ((uint32)1 << 1)
+#define XC_LE ((uint32)1 << 2)
+#define XC_FL ((uint32)1 << 4)
+#define XC_MR_MASK 0x000000C0
+#define XC_MR_SHIFT 6
+#define XC_PD ((uint32)1 << 11)
+#define XC_AE ((uint32)3 << 16)
+#define XC_AE_SHIFT 16
+#define XC_BL_MASK 0x001C0000
+#define XC_BL_SHIFT 18
+#define XC_PC_MASK 0x00E00000
+#define XC_PC_SHIFT 21
+#define XC_PT_MASK 0x03000000
+#define XC_PT_SHIFT 24
+
+
+#define DMA_MR_1 0
+#define DMA_MR_2 1
+
+
+
+#define DMA_BL_16 0
+#define DMA_BL_32 1
+#define DMA_BL_64 2
+#define DMA_BL_128 3
+#define DMA_BL_256 4
+#define DMA_BL_512 5
+#define DMA_BL_1024 6
+
+
+#define DMA_PC_0 0
+#define DMA_PC_4 1
+#define DMA_PC_8 2
+#define DMA_PC_16 3
+
+
+
+#define DMA_PT_1 0
+#define DMA_PT_2 1
+#define DMA_PT_4 2
+#define DMA_PT_8 3
+
+
+#define XP_LD_MASK 0xfff
+
+
+#define XS_CD_MASK 0x0fff
+#define XS_XS_MASK 0xf000
+#define XS_XS_SHIFT 12
+#define XS_XS_DISABLED 0x0000
+#define XS_XS_ACTIVE 0x1000
+#define XS_XS_IDLE 0x2000
+#define XS_XS_STOPPED 0x3000
+#define XS_XS_SUSP 0x4000
+#define XS_XE_MASK 0xf0000
+#define XS_XE_SHIFT 16
+#define XS_XE_NOERR 0x00000
+#define XS_XE_DPE 0x10000
+#define XS_XE_DFU 0x20000
+#define XS_XE_BEBR 0x30000
+#define XS_XE_BEDA 0x40000
+#define XS_AD_MASK 0xfff00000
+#define XS_AD_SHIFT 20
+
+
+#define RC_RE ((uint32)1 << 0)
+#define RC_RO_MASK 0xfe
+#define RC_RO_SHIFT 1
+#define RC_FM ((uint32)1 << 8)
+#define RC_SH ((uint32)1 << 9)
+#define RC_OC ((uint32)1 << 10)
+#define RC_PD ((uint32)1 << 11)
+#define RC_AE ((uint32)3 << 16)
+#define RC_AE_SHIFT 16
+#define RC_BL_MASK 0x001C0000
+#define RC_BL_SHIFT 18
+#define RC_PC_MASK 0x00E00000
+#define RC_PC_SHIFT 21
+#define RC_PT_MASK 0x03000000
+#define RC_PT_SHIFT 24
+
+
+#define RP_LD_MASK 0xfff
+
+
+#define RS_CD_MASK 0x0fff
+#define RS_RS_MASK 0xf000
+#define RS_RS_SHIFT 12
+#define RS_RS_DISABLED 0x0000
+#define RS_RS_ACTIVE 0x1000
+#define RS_RS_IDLE 0x2000
+#define RS_RS_STOPPED 0x3000
+#define RS_RE_MASK 0xf0000
+#define RS_RE_SHIFT 16
+#define RS_RE_NOERR 0x00000
+#define RS_RE_DPE 0x10000
+#define RS_RE_DFO 0x20000
+#define RS_RE_BEBW 0x30000
+#define RS_RE_BEDA 0x40000
+#define RS_AD_MASK 0xfff00000
+#define RS_AD_SHIFT 20
+
+
+#define FA_OFF_MASK 0xffff
+#define FA_SEL_MASK 0xf0000
+#define FA_SEL_SHIFT 16
+#define FA_SEL_XDD 0x00000
+#define FA_SEL_XDP 0x10000
+#define FA_SEL_RDD 0x40000
+#define FA_SEL_RDP 0x50000
+#define FA_SEL_XFD 0x80000
+#define FA_SEL_XFP 0x90000
+#define FA_SEL_RFD 0xc0000
+#define FA_SEL_RFP 0xd0000
+#define FA_SEL_RSD 0xe0000
+#define FA_SEL_RSP 0xf0000
+
+
+#define CTRL_BC_MASK 0x00001fff
+#define CTRL_AE ((uint32)3 << 16)
+#define CTRL_AE_SHIFT 16
+#define CTRL_PARITY ((uint32)3 << 18)
+#define CTRL_EOT ((uint32)1 << 28)
+#define CTRL_IOC ((uint32)1 << 29)
+#define CTRL_EOF ((uint32)1 << 30)
+#define CTRL_SOF ((uint32)1 << 31)
+
+
+#define CTRL_CORE_MASK 0x0ff00000
+
+
+
+
+typedef volatile struct {
+ uint32 control;
+ uint32 ptr;
+ uint32 addrlow;
+ uint32 addrhigh;
+ uint32 status0;
+ uint32 status1;
+} dma64regs_t;
+
+typedef volatile struct {
+ dma64regs_t tx;
+ dma64regs_t rx;
+} dma64regp_t;
+
+typedef volatile struct {
+ uint32 fifoaddr;
+ uint32 fifodatalow;
+ uint32 fifodatahigh;
+ uint32 pad;
+} dma64diag_t;
+
+
+typedef volatile struct {
+ uint32 ctrl1;
+ uint32 ctrl2;
+ uint32 addrlow;
+ uint32 addrhigh;
+} dma64dd_t;
+
+
+#define D64RINGALIGN_BITS 13
+#define D64MAXRINGSZ (1 << D64RINGALIGN_BITS)
+#define D64RINGALIGN (1 << D64RINGALIGN_BITS)
+
+#define D64MAXDD (D64MAXRINGSZ / sizeof (dma64dd_t))
+
+
+#define D64_XC_XE 0x00000001
+#define D64_XC_SE 0x00000002
+#define D64_XC_LE 0x00000004
+#define D64_XC_FL 0x00000010
+#define D64_XC_MR_MASK 0x000000C0
+#define D64_XC_MR_SHIFT 6
+#define D64_XC_PD 0x00000800
+#define D64_XC_AE 0x00030000
+#define D64_XC_AE_SHIFT 16
+#define D64_XC_BL_MASK 0x001C0000
+#define D64_XC_BL_SHIFT 18
+#define D64_XC_PC_MASK 0x00E00000
+#define D64_XC_PC_SHIFT 21
+#define D64_XC_PT_MASK 0x03000000
+#define D64_XC_PT_SHIFT 24
+
+
+#define D64_XP_LD_MASK 0x00001fff
+
+
+#define D64_XS0_CD_MASK 0x00001fff
+#define D64_XS0_XS_MASK 0xf0000000
+#define D64_XS0_XS_SHIFT 28
+#define D64_XS0_XS_DISABLED 0x00000000
+#define D64_XS0_XS_ACTIVE 0x10000000
+#define D64_XS0_XS_IDLE 0x20000000
+#define D64_XS0_XS_STOPPED 0x30000000
+#define D64_XS0_XS_SUSP 0x40000000
+
+#define D64_XS1_AD_MASK 0x00001fff
+#define D64_XS1_XE_MASK 0xf0000000
+#define D64_XS1_XE_SHIFT 28
+#define D64_XS1_XE_NOERR 0x00000000
+#define D64_XS1_XE_DPE 0x10000000
+#define D64_XS1_XE_DFU 0x20000000
+#define D64_XS1_XE_DTE 0x30000000
+#define D64_XS1_XE_DESRE 0x40000000
+#define D64_XS1_XE_COREE 0x50000000
+
+
+#define D64_RC_RE 0x00000001
+#define D64_RC_RO_MASK 0x000000fe
+#define D64_RC_RO_SHIFT 1
+#define D64_RC_FM 0x00000100
+#define D64_RC_SH 0x00000200
+#define D64_RC_OC 0x00000400
+#define D64_RC_PD 0x00000800
+#define D64_RC_AE 0x00030000
+#define D64_RC_AE_SHIFT 16
+#define D64_RC_BL_MASK 0x001C0000
+#define D64_RC_BL_SHIFT 18
+#define D64_RC_PC_MASK 0x00E00000
+#define D64_RC_PC_SHIFT 21
+#define D64_RC_PT_MASK 0x03000000
+#define D64_RC_PT_SHIFT 24
+
+
+#define DMA_CTRL_PEN (1 << 0)
+#define DMA_CTRL_ROC (1 << 1)
+#define DMA_CTRL_RXMULTI (1 << 2)
+#define DMA_CTRL_UNFRAMED (1 << 3)
+#define DMA_CTRL_USB_BOUNDRY4KB_WAR (1 << 4)
+#define DMA_CTRL_DMA_AVOIDANCE_WAR (1 << 5)
+
+
+#define D64_RP_LD_MASK 0x00001fff
+
+
+#define D64_RS0_CD_MASK 0x00001fff
+#define D64_RS0_RS_MASK 0xf0000000
+#define D64_RS0_RS_SHIFT 28
+#define D64_RS0_RS_DISABLED 0x00000000
+#define D64_RS0_RS_ACTIVE 0x10000000
+#define D64_RS0_RS_IDLE 0x20000000
+#define D64_RS0_RS_STOPPED 0x30000000
+#define D64_RS0_RS_SUSP 0x40000000
+
+#define D64_RS1_AD_MASK 0x0001ffff
+#define D64_RS1_RE_MASK 0xf0000000
+#define D64_RS1_RE_SHIFT 28
+#define D64_RS1_RE_NOERR 0x00000000
+#define D64_RS1_RE_DPO 0x10000000
+#define D64_RS1_RE_DFU 0x20000000
+#define D64_RS1_RE_DTE 0x30000000
+#define D64_RS1_RE_DESRE 0x40000000
+#define D64_RS1_RE_COREE 0x50000000
+
+
+#define D64_FA_OFF_MASK 0xffff
+#define D64_FA_SEL_MASK 0xf0000
+#define D64_FA_SEL_SHIFT 16
+#define D64_FA_SEL_XDD 0x00000
+#define D64_FA_SEL_XDP 0x10000
+#define D64_FA_SEL_RDD 0x40000
+#define D64_FA_SEL_RDP 0x50000
+#define D64_FA_SEL_XFD 0x80000
+#define D64_FA_SEL_XFP 0x90000
+#define D64_FA_SEL_RFD 0xc0000
+#define D64_FA_SEL_RFP 0xd0000
+#define D64_FA_SEL_RSD 0xe0000
+#define D64_FA_SEL_RSP 0xf0000
+
+
+#define D64_CTRL_COREFLAGS 0x0ff00000
+#define D64_CTRL1_EOT ((uint32)1 << 28)
+#define D64_CTRL1_IOC ((uint32)1 << 29)
+#define D64_CTRL1_EOF ((uint32)1 << 30)
+#define D64_CTRL1_SOF ((uint32)1 << 31)
+
+
+#define D64_CTRL2_BC_MASK 0x00007fff
+#define D64_CTRL2_AE 0x00030000
+#define D64_CTRL2_AE_SHIFT 16
+#define D64_CTRL2_PARITY 0x00040000
+
+
+#define D64_CTRL_CORE_MASK 0x0ff00000
+
+#define D64_RX_FRM_STS_LEN 0x0000ffff
+#define D64_RX_FRM_STS_OVFL 0x00800000
+#define D64_RX_FRM_STS_DSCRCNT 0x0f000000
+#define D64_RX_FRM_STS_DATATYPE 0xf0000000
+
+
+typedef volatile struct {
+ uint16 len;
+ uint16 flags;
+} dma_rxh_t;
+
+#endif
diff --git a/drivers/net/wireless/bcmdhd/src/include/sbpcmcia.h b/drivers/net/wireless/bcmdhd/include/sbpcmcia.h
index 35d7b65..6ad98b5 100644
--- a/drivers/net/wireless/bcmdhd/src/include/sbpcmcia.h
+++ b/drivers/net/wireless/bcmdhd/include/sbpcmcia.h
@@ -1,14 +1,14 @@
/*
* BCM43XX Sonics SiliconBackplane PCMCIA core hardware definitions.
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,12 +16,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: sbpcmcia.h 307736 2012-01-12 10:57:05Z $
+ * $Id: sbpcmcia.h 326494 2012-04-09 13:29:57Z $
*/
#ifndef _SBPCMCIA_H
@@ -81,8 +81,8 @@
#define SROM_DATAH (0x073a / 2)
#define SROM_ADDRL (0x073c / 2)
#define SROM_ADDRH (0x073e / 2)
-#define SROM_INFO2 (0x0772 / 2)
-#define SROM_INFO (0x07be / 2)
+#define SROM_INFO2 (0x0772 / 2)
+#define SROM_INFO (0x07be / 2)
#define SROM_IDLE 0
@@ -99,10 +99,10 @@
-#define SBTML_INT_ACK 0x40000
-#define SBTML_INT_EN 0x20000
+#define SBTML_INT_ACK 0x40000
+#define SBTML_INT_EN 0x20000
-#define SBTMH_INT_STATUS 0x40000
+#define SBTMH_INT_STATUS 0x40000
-#endif
+#endif
diff --git a/drivers/net/wireless/bcmdhd/src/include/sbsdio.h b/drivers/net/wireless/bcmdhd/include/sbsdio.h
index 334c44e..00e44d2 100644
--- a/drivers/net/wireless/bcmdhd/src/include/sbsdio.h
+++ b/drivers/net/wireless/bcmdhd/include/sbsdio.h
@@ -4,14 +4,14 @@
*
* SDIO core support 1bit, 4 bit SDIO mode as well as SPI mode.
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -19,12 +19,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: sbsdio.h 303863 2011-12-20 07:14:09Z $
+ * $Id: sbsdio.h 308945 2012-01-18 02:15:27Z $
*/
#ifndef _SBSDIO_H
@@ -36,7 +36,7 @@
#define SBSDIO_SPROM_CS 0x10000 /* sprom command and status */
#define SBSDIO_SPROM_INFO 0x10001 /* sprom info register */
#define SBSDIO_SPROM_DATA_LOW 0x10002 /* sprom indirect access data byte 0 */
-#define SBSDIO_SPROM_DATA_HIGH 0x10003 /* sprom indirect access data byte 1 */
+#define SBSDIO_SPROM_DATA_HIGH 0x10003 /* sprom indirect access data byte 1 */
#define SBSDIO_SPROM_ADDR_LOW 0x10004 /* sprom indirect access addr byte 0 */
#define SBSDIO_SPROM_ADDR_HIGH 0x10005 /* sprom indirect access addr byte 0 */
#define SBSDIO_CHIP_CTRL_DATA 0x10006 /* xtal_pu (gpio) output */
@@ -50,15 +50,15 @@
#define SBSDIO_FUNC1_SBADDRHIGH 0x1000C /* SB Address Window High (b31:b24) */
#define SBSDIO_FUNC1_FRAMECTRL 0x1000D /* Frame Control (frame term/abort) */
#define SBSDIO_FUNC1_CHIPCLKCSR 0x1000E /* ChipClockCSR (ALP/HT ctl/status) */
-#define SBSDIO_FUNC1_SDIOPULLUP 0x1000F /* SdioPullUp (on cmd, d0-d2) */
+#define SBSDIO_FUNC1_SDIOPULLUP 0x1000F /* SdioPullUp (on cmd, d0-d2) */
#define SBSDIO_FUNC1_WFRAMEBCLO 0x10019 /* Write Frame Byte Count Low */
#define SBSDIO_FUNC1_WFRAMEBCHI 0x1001A /* Write Frame Byte Count High */
#define SBSDIO_FUNC1_RFRAMEBCLO 0x1001B /* Read Frame Byte Count Low */
#define SBSDIO_FUNC1_RFRAMEBCHI 0x1001C /* Read Frame Byte Count High */
#define SBSDIO_FUNC1_MESBUSYCTRL 0x1001D /* MesBusyCtl at 0x1001D (rev 11) */
-#define SBSDIO_FUNC1_MISC_REG_START 0x10000 /* f1 misc register start */
-#define SBSDIO_FUNC1_MISC_REG_LIMIT 0x1001C /* f1 misc register end */
+#define SBSDIO_FUNC1_MISC_REG_START 0x10000 /* f1 misc register start */
+#define SBSDIO_FUNC1_MISC_REG_LIMIT 0x1001C /* f1 misc register end */
/* Sdio Core Rev 12 */
#define SBSDIO_FUNC1_WAKEUPCTRL 0x1001E
@@ -164,7 +164,11 @@
/* direct(mapped) cis space */
#define SBSDIO_CIS_BASE_COMMON 0x1000 /* MAPPED common CIS address */
+#ifdef BCMSPI
+#define SBSDIO_CIS_SIZE_LIMIT 0x100 /* maximum bytes in one spi CIS */
+#else
#define SBSDIO_CIS_SIZE_LIMIT 0x200 /* maximum bytes in one CIS */
+#endif /* !BCMSPI */
#define SBSDIO_OTP_CIS_SIZE_LIMIT 0x078 /* maximum bytes OTP CIS */
#define SBSDIO_CIS_OFT_ADDR_MASK 0x1FFFF /* cis offset addr is < 17 bits */
diff --git a/drivers/net/wireless/bcmdhd/src/include/sbsdpcmdev.h b/drivers/net/wireless/bcmdhd/include/sbsdpcmdev.h
index 3bc071a..10c7401 100644
--- a/drivers/net/wireless/bcmdhd/src/include/sbsdpcmdev.h
+++ b/drivers/net/wireless/bcmdhd/include/sbsdpcmdev.h
@@ -2,14 +2,14 @@
* Broadcom SiliconBackplane SDIO/PCMCIA hardware-specific
* device core support
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -17,12 +17,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: sbsdpcmdev.h 241182 2011-02-17 21:50:03Z $
+ * $Id: sbsdpcmdev.h 347614 2012-07-27 10:24:51Z $
*/
#ifndef _sbsdpcmdev_h_
@@ -290,4 +290,6 @@ typedef volatile struct {
/* HW frame tag */
#define SDPCM_FRAMETAG_LEN 4 /* HW frametag: 2 bytes len, 2 bytes check val */
+#define SDPCM_HWEXT_LEN 8
+
#endif /* _sbsdpcmdev_h_ */
diff --git a/drivers/net/wireless/bcmdhd/src/include/sbsocram.h b/drivers/net/wireless/bcmdhd/include/sbsocram.h
index 5a03d4b..852d115 100644
--- a/drivers/net/wireless/bcmdhd/src/include/sbsocram.h
+++ b/drivers/net/wireless/bcmdhd/include/sbsocram.h
@@ -1,14 +1,14 @@
/*
* BCM47XX Sonics SiliconBackplane embedded ram core
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,7 +16,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
@@ -34,7 +34,7 @@
#define _PADLINE(line) pad ## line
#define _XSTR(line) _PADLINE(line)
#define PAD _XSTR(__LINE__)
-#endif
+#endif
typedef volatile struct sbsocramregs {
@@ -45,9 +45,9 @@ typedef volatile struct sbsocramregs {
uint32 bankidx;
uint32 standbyctrl;
- uint32 errlogstatus;
- uint32 errlogaddr;
-
+ uint32 errlogstatus;
+ uint32 errlogaddr;
+
uint32 cambankidx;
uint32 cambankstandbyctrl;
uint32 cambankpatchctrl;
@@ -56,7 +56,7 @@ typedef volatile struct sbsocramregs {
uint32 cambankdatareg;
uint32 cambankmaskreg;
uint32 PAD[1];
- uint32 bankinfo;
+ uint32 bankinfo;
uint32 PAD[15];
uint32 extmemconfig;
uint32 extmemparitycsr;
@@ -65,15 +65,15 @@ typedef volatile struct sbsocramregs {
uint32 extmemwrctrlandsize;
uint32 PAD[84];
uint32 workaround;
- uint32 pwrctl;
+ uint32 pwrctl;
uint32 PAD[133];
- uint32 sr_control;
- uint32 sr_status;
- uint32 sr_address;
- uint32 sr_data;
+ uint32 sr_control;
+ uint32 sr_status;
+ uint32 sr_address;
+ uint32 sr_data;
} sbsocramregs_t;
-#endif
+#endif
#define SR_COREINFO 0x00
@@ -84,7 +84,7 @@ typedef volatile struct sbsocramregs {
#define SR_PWRCTL 0x1e8
-#define SRCI_PT_MASK 0x00070000
+#define SRCI_PT_MASK 0x00070000
#define SRCI_PT_SHIFT 16
#define SRCI_PT_OCP_OCP 0
@@ -120,11 +120,11 @@ typedef volatile struct sbsocramregs {
#define SRSC_SBYOVR_SHIFT 31
#define SRSC_SBYOVRVAL_MASK 0x60000000
#define SRSC_SBYOVRVAL_SHIFT 29
-#define SRSC_SBYEN_MASK 0x01000000
+#define SRSC_SBYEN_MASK 0x01000000
#define SRSC_SBYEN_SHIFT 24
-#define SRPC_PMU_STBYDIS_MASK 0x00000010
+#define SRPC_PMU_STBYDIS_MASK 0x00000010
#define SRPC_PMU_STBYDIS_SHIFT 4
#define SRPC_STBYOVRVAL_MASK 0x00000008
#define SRPC_STBYOVRVAL_SHIFT 3
@@ -187,7 +187,7 @@ typedef volatile struct sbsocramregs {
#define SOCRAM_BANKINFO_SZBASE 8192
-#define SOCRAM_BANKSIZE_SHIFT 13
+#define SOCRAM_BANKSIZE_SHIFT 13
-#endif
+#endif
diff --git a/drivers/net/wireless/bcmdhd/src/include/sdio.h b/drivers/net/wireless/bcmdhd/include/sdio.h
index aafd1ea..b8eee1f 100644
--- a/drivers/net/wireless/bcmdhd/src/include/sdio.h
+++ b/drivers/net/wireless/bcmdhd/include/sdio.h
@@ -2,14 +2,14 @@
* SDIO spec header file
* Protocol and standard (common) device definitions
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -17,12 +17,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: sdio.h 288543 2011-10-07 12:15:31Z $
+ * $Id: sdio.h 308973 2012-01-18 04:19:34Z $
*/
#ifndef _SDIO_H
@@ -89,7 +89,7 @@ typedef volatile struct {
#define SDIOD_CCCR_BRCM_CARDCAP_CMD14_EXT 0x04
#define SDIOD_CCCR_BRCM_CARDCAP_CMD_NODEC 0x08
#define SDIOD_CCCR_BRCM_CARDCTL 0xf1
-#define SDIOD_CCCR_BRCM_SEPINT 0xf2
+#define SDIOD_CCCR_BRCM_SEPINT 0xf2
/* cccr_sdio_rev */
#define SDIO_REV_SDIOID_MASK 0xf0 /* SDIO spec revision number */
@@ -406,7 +406,7 @@ typedef volatile struct {
/* ------------------------------------------------
* SDIO Command structures. I/O only commands are:
*
- * CMD0, CMD3, CMD5, CMD7, CMD15, CMD52, CMD53
+ * CMD0, CMD3, CMD5, CMD7, CMD15, CMD52, CMD53
* ------------------------------------------------
*/
diff --git a/drivers/net/wireless/bcmdhd/src/include/sdioh.h b/drivers/net/wireless/bcmdhd/include/sdioh.h
index a4bb275..5517a71 100644
--- a/drivers/net/wireless/bcmdhd/src/include/sdioh.h
+++ b/drivers/net/wireless/bcmdhd/include/sdioh.h
@@ -2,14 +2,14 @@
* SDIO Host Controller Spec header file
* Register map and definitions for the Standard Host Controller
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -17,12 +17,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: sdioh.h 299859 2011-12-01 03:53:27Z $
+ * $Id: sdioh.h 347633 2012-07-27 11:02:02Z $
*/
#ifndef _SDIOH_H
@@ -30,35 +30,35 @@
#define SD_SysAddr 0x000
#define SD_BlockSize 0x004
-#define SD_BlockCount 0x006
+#define SD_BlockCount 0x006
#define SD_Arg0 0x008
-#define SD_Arg1 0x00A
+#define SD_Arg1 0x00A
#define SD_TransferMode 0x00C
-#define SD_Command 0x00E
+#define SD_Command 0x00E
#define SD_Response0 0x010
-#define SD_Response1 0x012
+#define SD_Response1 0x012
#define SD_Response2 0x014
-#define SD_Response3 0x016
+#define SD_Response3 0x016
#define SD_Response4 0x018
-#define SD_Response5 0x01A
+#define SD_Response5 0x01A
#define SD_Response6 0x01C
-#define SD_Response7 0x01E
+#define SD_Response7 0x01E
#define SD_BufferDataPort0 0x020
-#define SD_BufferDataPort1 0x022
+#define SD_BufferDataPort1 0x022
#define SD_PresentState 0x024
#define SD_HostCntrl 0x028
#define SD_PwrCntrl 0x029
-#define SD_BlockGapCntrl 0x02A
-#define SD_WakeupCntrl 0x02B
+#define SD_BlockGapCntrl 0x02A
+#define SD_WakeupCntrl 0x02B
#define SD_ClockCntrl 0x02C
-#define SD_TimeoutCntrl 0x02E
+#define SD_TimeoutCntrl 0x02E
#define SD_SoftwareReset 0x02F
#define SD_IntrStatus 0x030
-#define SD_ErrorIntrStatus 0x032
+#define SD_ErrorIntrStatus 0x032
#define SD_IntrStatusEnable 0x034
-#define SD_ErrorIntrStatusEnable 0x036
+#define SD_ErrorIntrStatusEnable 0x036
#define SD_IntrSignalEnable 0x038
-#define SD_ErrorIntrSignalEnable 0x03A
+#define SD_ErrorIntrSignalEnable 0x03A
#define SD_CMD12ErrorStatus 0x03C
#define SD_Capabilities 0x040
#define SD_Capabilities3 0x044
@@ -67,7 +67,7 @@
#define SD_ADMA_ErrStatus 0x054
#define SD_ADMA_SysAddr 0x58
#define SD_SlotInterruptStatus 0x0FC
-#define SD_HostControllerVersion 0x0FE
+#define SD_HostControllerVersion 0x0FE
#define SD_GPIO_Reg 0x100
#define SD_GPIO_OE 0x104
#define SD_GPIO_Enable 0x108
@@ -89,6 +89,10 @@
#define SD3_PresetVal_SDR50 0x06a
#define SD3_PresetVal_SDR104 0x06c
#define SD3_PresetVal_DDR50 0x06e
+/* SDIO3.0 Revx specific Registers */
+#define SD3_Tuning_Info_Register 0x0EC
+#define SD3_WL_BT_reset_register 0x0F0
+
/* preset value indices */
#define SD3_PRESETVAL_INITIAL_IX 0
@@ -101,16 +105,16 @@
#define SD3_PRESETVAL_DDR50_IX 7
/* SD_Capabilities reg (0x040) */
-#define CAP_TO_CLKFREQ_M BITFIELD_MASK(6)
-#define CAP_TO_CLKFREQ_S 0
-#define CAP_TO_CLKUNIT_M BITFIELD_MASK(1)
-#define CAP_TO_CLKUNIT_S 7
+#define CAP_TO_CLKFREQ_M BITFIELD_MASK(6)
+#define CAP_TO_CLKFREQ_S 0
+#define CAP_TO_CLKUNIT_M BITFIELD_MASK(1)
+#define CAP_TO_CLKUNIT_S 7
/* Note: for sdio-2.0 case, this mask has to be 6 bits, but msb 2
bits are reserved. going ahead with 8 bits, as it is req for 3.0
*/
-#define CAP_BASECLK_M BITFIELD_MASK(8)
-#define CAP_BASECLK_S 8
-#define CAP_MAXBLOCK_M BITFIELD_MASK(2)
+#define CAP_BASECLK_M BITFIELD_MASK(8)
+#define CAP_BASECLK_S 8
+#define CAP_MAXBLOCK_M BITFIELD_MASK(2)
#define CAP_MAXBLOCK_S 16
#define CAP_ADMA2_M BITFIELD_MASK(1)
#define CAP_ADMA2_S 19
@@ -205,12 +209,12 @@
/* SD_Arg0: Offset 0x008, size = 4 bytes */
/* SD_TransferMode Offset 0x00C, size = 2 bytes */
-#define XFER_DMA_ENABLE_M BITFIELD_MASK(1)
+#define XFER_DMA_ENABLE_M BITFIELD_MASK(1)
#define XFER_DMA_ENABLE_S 0
-#define XFER_BLK_COUNT_EN_M BITFIELD_MASK(1)
+#define XFER_BLK_COUNT_EN_M BITFIELD_MASK(1)
#define XFER_BLK_COUNT_EN_S 1
-#define XFER_CMD_12_EN_M BITFIELD_MASK(1)
-#define XFER_CMD_12_EN_S 2
+#define XFER_CMD_12_EN_M BITFIELD_MASK(1)
+#define XFER_CMD_12_EN_S 2
#define XFER_DATA_DIRECTION_M BITFIELD_MASK(1)
#define XFER_DATA_DIRECTION_S 4
#define XFER_MULTI_BLOCK_M BITFIELD_MASK(1)
@@ -218,9 +222,9 @@
/* SD_Command: Offset 0x00E, size = 2 bytes */
/* resp_type field */
-#define RESP_TYPE_NONE 0
-#define RESP_TYPE_136 1
-#define RESP_TYPE_48 2
+#define RESP_TYPE_NONE 0
+#define RESP_TYPE_136 1
+#define RESP_TYPE_48 2
#define RESP_TYPE_48_BUSY 3
/* type field */
#define CMD_TYPE_NORMAL 0
@@ -228,22 +232,22 @@
#define CMD_TYPE_RESUME 2
#define CMD_TYPE_ABORT 3
-#define CMD_RESP_TYPE_M BITFIELD_MASK(2) /* Bits [0-1] - Response type */
+#define CMD_RESP_TYPE_M BITFIELD_MASK(2) /* Bits [0-1] - Response type */
#define CMD_RESP_TYPE_S 0
-#define CMD_CRC_EN_M BITFIELD_MASK(1) /* Bit 3 - CRC enable */
+#define CMD_CRC_EN_M BITFIELD_MASK(1) /* Bit 3 - CRC enable */
#define CMD_CRC_EN_S 3
-#define CMD_INDEX_EN_M BITFIELD_MASK(1) /* Bit 4 - Enable index checking */
+#define CMD_INDEX_EN_M BITFIELD_MASK(1) /* Bit 4 - Enable index checking */
#define CMD_INDEX_EN_S 4
-#define CMD_DATA_EN_M BITFIELD_MASK(1) /* Bit 5 - Using DAT line */
+#define CMD_DATA_EN_M BITFIELD_MASK(1) /* Bit 5 - Using DAT line */
#define CMD_DATA_EN_S 5
-#define CMD_TYPE_M BITFIELD_MASK(2) /* Bit [6-7] - Normal, abort, resume, etc
+#define CMD_TYPE_M BITFIELD_MASK(2) /* Bit [6-7] - Normal, abort, resume, etc
*/
#define CMD_TYPE_S 6
-#define CMD_INDEX_M BITFIELD_MASK(6) /* Bits [8-13] - Command number */
+#define CMD_INDEX_M BITFIELD_MASK(6) /* Bits [8-13] - Command number */
#define CMD_INDEX_S 8
/* SD_BufferDataPort0 : Offset 0x020, size = 2 or 4 bytes */
-/* SD_BufferDataPort1 : Offset 0x022, size = 2 bytes */
+/* SD_BufferDataPort1 : Offset 0x022, size = 2 bytes */
/* SD_PresentState : Offset 0x024, size = 4 bytes */
#define PRES_CMD_INHIBIT_M BITFIELD_MASK(1) /* Bit 0 May use CMD */
#define PRES_CMD_INHIBIT_S 0
@@ -310,8 +314,8 @@
#define HOST_CONTR_VER_3 (2)
/* misc defines */
-#define SD1_MODE 0x1 /* SD Host Cntrlr Spec */
-#define SD4_MODE 0x2 /* SD Host Cntrlr Spec */
+#define SD1_MODE 0x1 /* SD Host Cntrlr Spec */
+#define SD4_MODE 0x2 /* SD Host Cntrlr Spec */
/* SD_PwrCntrl: Offset 0x029, size = 1 bytes */
#define PWR_BUS_EN_M BITFIELD_MASK(1) /* Bit 0 Power the bus */
@@ -398,9 +402,9 @@
/* SD_WakeupCntr_BlockGapCntrl : Offset 0x02A , size = bytes */
/* SD_ClockCntrl : Offset 0x02C , size = bytes */
-/* SD_SoftwareReset_TimeoutCntrl : Offset 0x02E , size = bytes */
+/* SD_SoftwareReset_TimeoutCntrl : Offset 0x02E , size = bytes */
/* SD_IntrStatus : Offset 0x030 , size = bytes */
-/* SD_ErrorIntrStatus : Offset 0x032 , size = bytes */
+/* SD_ErrorIntrStatus : Offset 0x032 , size = bytes */
/* SD_IntrStatusEnable : Offset 0x034 , size = bytes */
/* SD_ErrorIntrStatusEnable : Offset 0x036 , size = bytes */
/* SD_IntrSignalEnable : Offset 0x038 , size = bytes */
diff --git a/drivers/net/wireless/bcmdhd/src/include/sdiovar.h b/drivers/net/wireless/bcmdhd/include/sdiovar.h
index a00b41e..16a1c19 100644
--- a/drivers/net/wireless/bcmdhd/src/include/sdiovar.h
+++ b/drivers/net/wireless/bcmdhd/include/sdiovar.h
@@ -2,14 +2,14 @@
* Structure used by apps whose drivers access SDIO drivers.
* Pulled out separately so dhdu and wlu can both use it.
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -17,7 +17,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
@@ -52,6 +52,29 @@ typedef struct sdreg {
#define NUM_PREV_TRANSACTIONS 16
+#ifdef BCMSPI
+/* Error statistics for gSPI */
+struct spierrstats_t {
+ uint32 dna; /* The requested data is not available. */
+ uint32 rdunderflow; /* FIFO underflow happened due to current (F2, F3) rd command */
+ uint32 wroverflow; /* FIFO underflow happened due to current (F1, F2, F3) wr command */
+
+ uint32 f2interrupt; /* OR of all F2 related intr status bits. */
+ uint32 f3interrupt; /* OR of all F3 related intr status bits. */
+
+ uint32 f2rxnotready; /* F2 FIFO is not ready to receive data (FIFO empty) */
+ uint32 f3rxnotready; /* F3 FIFO is not ready to receive data (FIFO empty) */
+
+ uint32 hostcmddataerr; /* Error in command or host data, detected by CRC/checksum
+ * (optional)
+ */
+ uint32 f2pktavailable; /* Packet is available in F2 TX FIFO */
+ uint32 f3pktavailable; /* Packet is available in F2 TX FIFO */
+
+ uint32 dstatus[NUM_PREV_TRANSACTIONS]; /* dstatus bits of last 16 gSPI transactions */
+ uint32 spicmd[NUM_PREV_TRANSACTIONS];
+};
+#endif /* BCMSPI */
#include <packed_section_end.h>
diff --git a/drivers/net/wireless/bcmdhd/src/include/siutils.h b/drivers/net/wireless/bcmdhd/include/siutils.h
index 85915c3..a797b3d 100644
--- a/drivers/net/wireless/bcmdhd/src/include/siutils.h
+++ b/drivers/net/wireless/bcmdhd/include/siutils.h
@@ -2,14 +2,14 @@
* Misc utility routines for accessing the SOC Interconnects
* of Broadcom HNBU chips.
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -17,12 +17,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: siutils.h 300516 2011-12-04 17:39:44Z $
+ * $Id: siutils.h 347614 2012-07-27 10:24:51Z $
*/
#ifndef _siutils_h_
@@ -30,28 +30,28 @@
struct si_pub {
- uint socitype;
-
- uint bustype;
- uint buscoretype;
- uint buscorerev;
- uint buscoreidx;
- int ccrev;
- uint32 cccaps;
- uint32 cccaps_ext;
- int pmurev;
- uint32 pmucaps;
- uint boardtype;
- uint boardrev;
- uint boardvendor;
- uint boardflags;
- uint boardflags2;
- uint chip;
- uint chiprev;
- uint chippkg;
- uint32 chipst;
- bool issim;
- uint socirev;
+ uint socitype;
+
+ uint bustype;
+ uint buscoretype;
+ uint buscorerev;
+ uint buscoreidx;
+ int ccrev;
+ uint32 cccaps;
+ uint32 cccaps_ext;
+ int pmurev;
+ uint32 pmucaps;
+ uint boardtype;
+ uint boardrev;
+ uint boardvendor;
+ uint boardflags;
+ uint boardflags2;
+ uint chip;
+ uint chiprev;
+ uint chippkg;
+ uint32 chipst;
+ bool issim;
+ uint socirev;
bool pci_pr32414;
};
@@ -61,34 +61,34 @@ typedef const struct si_pub si_t;
-#define SI_OSH NULL
+#define SI_OSH NULL
#define BADIDX (SI_MAXCORES + 1)
-#define XTAL 0x1
-#define PLL 0x2
+#define XTAL 0x1
+#define PLL 0x2
-#define CLK_FAST 0
-#define CLK_DYNAMIC 2
+#define CLK_FAST 0
+#define CLK_DYNAMIC 2
-#define GPIO_DRV_PRIORITY 0
-#define GPIO_APP_PRIORITY 1
-#define GPIO_HI_PRIORITY 2
+#define GPIO_DRV_PRIORITY 0
+#define GPIO_APP_PRIORITY 1
+#define GPIO_HI_PRIORITY 2
#define GPIO_PULLUP 0
#define GPIO_PULLDN 1
-#define GPIO_REGEVT 0
-#define GPIO_REGEVT_INTMSK 1
-#define GPIO_REGEVT_INTPOL 2
+#define GPIO_REGEVT 0
+#define GPIO_REGEVT_INTMSK 1
+#define GPIO_REGEVT_INTPOL 2
-#define SI_DEVPATH_BUFSZ 16
+#define SI_DEVPATH_BUFSZ 16
#define SI_DOATTACH 1
@@ -125,6 +125,21 @@ typedef void (*gpio_handler_t)(uint32 stat, void *arg);
+#define SI_CR4_CAP (0x04)
+#define SI_CR4_BANKIDX (0x40)
+#define SI_CR4_BANKINFO (0x44)
+
+#define ARMCR4_TCBBNB_MASK 0xf0
+#define ARMCR4_TCBBNB_SHIFT 4
+#define ARMCR4_TCBANB_MASK 0xf
+#define ARMCR4_TCBANB_SHIFT 0
+
+#define SICF_CPUHALT (0x0020)
+#define ARMCR4_BSZ_MASK 0x3f
+#define ARMCR4_BSZ_MULT 8192
+
+
+
extern si_t *si_attach(uint pcidev, osl_t *osh, void *regs, uint bustype,
void *sdh, char **vars, uint *varsz);
extern si_t *si_kattach(osl_t *osh);
@@ -189,6 +204,7 @@ extern uint32 si_socdevram_remap_size(si_t *sih);
extern void si_watchdog(si_t *sih, uint ticks);
extern void si_watchdog_ms(si_t *sih, uint32 ms);
+extern uint32 si_watchdog_msticks(void);
extern void *si_gpiosetcore(si_t *sih);
extern uint32 si_gpiocontrol(si_t *sih, uint32 mask, uint32 val, uint8 priority);
extern uint32 si_gpioouten(si_t *sih, uint32 mask, uint32 val, uint8 priority);
@@ -249,10 +265,10 @@ extern int si_cis_source(si_t *sih);
#define CIS_OTP 2
-#define DEFAULT_FAB 0x0
-#define CSM_FAB7 0x1
-#define TSMC_FAB12 0x2
-#define SMIC_FAB4 0x3
+#define DEFAULT_FAB 0x0
+#define CSM_FAB7 0x1
+#define TSMC_FAB12 0x2
+#define SMIC_FAB4 0x3
extern int si_otp_fabid(si_t *sih, uint16 *fabid, bool rw);
extern uint16 si_fabid(si_t *sih);
@@ -309,4 +325,8 @@ extern int si_pcie_configspace_get(si_t *sih, uint8 *buf, uint size);
char *si_getnvramflvar(si_t *sih, const char *name);
-#endif
+extern uint32 si_tcm_size(si_t *sih);
+
+extern int si_set_sromctl(si_t *sih, uint32 value);
+extern uint32 si_get_sromctl(si_t *sih);
+#endif
diff --git a/drivers/net/wireless/bcmdhd/include/spid.h b/drivers/net/wireless/bcmdhd/include/spid.h
new file mode 100644
index 0000000..f1ecc22
--- /dev/null
+++ b/drivers/net/wireless/bcmdhd/include/spid.h
@@ -0,0 +1,165 @@
+/*
+ * SPI device spec header file
+ *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
+ * Unless you and Broadcom execute a separate written software license
+ * agreement governing use of this software, this software is licensed to you
+ * under the terms of the GNU General Public License version 2 (the "GPL"),
+ * available at http://www.broadcom.com/licenses/GPLv2.php, with the
+ * following added to such license:
+ *
+ * As a special exception, the copyright holders of this software give you
+ * permission to link this software with independent modules, and to copy and
+ * distribute the resulting executable under terms of your choice, provided that
+ * you also meet, for each linked independent module, the terms and conditions of
+ * the license of that module. An independent module is a module which is not
+ * derived from this software. The special exception does not apply to any
+ * modifications of the software.
+ *
+ * Notwithstanding the above, under no circumstances may you combine this
+ * software in any way with any other Broadcom software provided under a license
+ * other than the GPL, without Broadcom's express prior written consent.
+ *
+ * $Id: spid.h 354197 2012-08-30 09:05:59Z $
+ */
+
+#ifndef _SPI_H
+#define _SPI_H
+
+/*
+ * Brcm SPI Device Register Map.
+ *
+ */
+
+typedef volatile struct {
+ uint8 config; /* 0x00, len, endian, clock, speed, polarity, wakeup */
+ uint8 response_delay; /* 0x01, read response delay in bytes (corerev < 3) */
+ uint8 status_enable; /* 0x02, status-enable, intr with status, response_delay
+ * function selection, command/data error check
+ */
+ uint8 reset_bp; /* 0x03, reset on wlan/bt backplane reset (corerev >= 1) */
+ uint16 intr_reg; /* 0x04, Intr status register */
+ uint16 intr_en_reg; /* 0x06, Intr mask register */
+ uint32 status_reg; /* 0x08, RO, Status bits of last spi transfer */
+ uint16 f1_info_reg; /* 0x0c, RO, enabled, ready for data transfer, blocksize */
+ uint16 f2_info_reg; /* 0x0e, RO, enabled, ready for data transfer, blocksize */
+ uint16 f3_info_reg; /* 0x10, RO, enabled, ready for data transfer, blocksize */
+ uint32 test_read; /* 0x14, RO 0xfeedbead signature */
+ uint32 test_rw; /* 0x18, RW */
+ uint8 resp_delay_f0; /* 0x1c, read resp delay bytes for F0 (corerev >= 3) */
+ uint8 resp_delay_f1; /* 0x1d, read resp delay bytes for F1 (corerev >= 3) */
+ uint8 resp_delay_f2; /* 0x1e, read resp delay bytes for F2 (corerev >= 3) */
+ uint8 resp_delay_f3; /* 0x1f, read resp delay bytes for F3 (corerev >= 3) */
+} spi_regs_t;
+
+/* SPI device register offsets */
+#define SPID_CONFIG 0x00
+#define SPID_RESPONSE_DELAY 0x01
+#define SPID_STATUS_ENABLE 0x02
+#define SPID_RESET_BP 0x03 /* (corerev >= 1) */
+#define SPID_INTR_REG 0x04 /* 16 bits - Interrupt status */
+#define SPID_INTR_EN_REG 0x06 /* 16 bits - Interrupt mask */
+#define SPID_STATUS_REG 0x08 /* 32 bits */
+#define SPID_F1_INFO_REG 0x0C /* 16 bits */
+#define SPID_F2_INFO_REG 0x0E /* 16 bits */
+#define SPID_F3_INFO_REG 0x10 /* 16 bits */
+#define SPID_TEST_READ 0x14 /* 32 bits */
+#define SPID_TEST_RW 0x18 /* 32 bits */
+#define SPID_RESP_DELAY_F0 0x1c /* 8 bits (corerev >= 3) */
+#define SPID_RESP_DELAY_F1 0x1d /* 8 bits (corerev >= 3) */
+#define SPID_RESP_DELAY_F2 0x1e /* 8 bits (corerev >= 3) */
+#define SPID_RESP_DELAY_F3 0x1f /* 8 bits (corerev >= 3) */
+
+/* Bit masks for SPID_CONFIG device register */
+#define WORD_LENGTH_32 0x1 /* 0/1 16/32 bit word length */
+#define ENDIAN_BIG 0x2 /* 0/1 Little/Big Endian */
+#define CLOCK_PHASE 0x4 /* 0/1 clock phase delay */
+#define CLOCK_POLARITY 0x8 /* 0/1 Idle state clock polarity is low/high */
+#define HIGH_SPEED_MODE 0x10 /* 1/0 High Speed mode / Normal mode */
+#define INTR_POLARITY 0x20 /* 1/0 Interrupt active polarity is high/low */
+#define WAKE_UP 0x80 /* 0/1 Wake-up command from Host to WLAN */
+
+/* Bit mask for SPID_RESPONSE_DELAY device register */
+#define RESPONSE_DELAY_MASK 0xFF /* Configurable rd response delay in multiples of 8 bits */
+
+/* Bit mask for SPID_STATUS_ENABLE device register */
+#define STATUS_ENABLE 0x1 /* 1/0 Status sent/not sent to host after read/write */
+#define INTR_WITH_STATUS 0x2 /* 0/1 Do-not / do-interrupt if status is sent */
+#define RESP_DELAY_ALL 0x4 /* Applicability of resp delay to F1 or all func's read */
+#define DWORD_PKT_LEN_EN 0x8 /* Packet len denoted in dwords instead of bytes */
+#define CMD_ERR_CHK_EN 0x20 /* Command error check enable */
+#define DATA_ERR_CHK_EN 0x40 /* Data error check enable */
+
+/* Bit mask for SPID_RESET_BP device register */
+#define RESET_ON_WLAN_BP_RESET 0x4 /* enable reset for WLAN backplane */
+#define RESET_ON_BT_BP_RESET 0x8 /* enable reset for BT backplane */
+#define RESET_SPI 0x80 /* reset the above enabled logic */
+
+/* Bit mask for SPID_INTR_REG device register */
+#define DATA_UNAVAILABLE 0x0001 /* Requested data not available; Clear by writing a "1" */
+#define F2_F3_FIFO_RD_UNDERFLOW 0x0002
+#define F2_F3_FIFO_WR_OVERFLOW 0x0004
+#define COMMAND_ERROR 0x0008 /* Cleared by writing 1 */
+#define DATA_ERROR 0x0010 /* Cleared by writing 1 */
+#define F2_PACKET_AVAILABLE 0x0020
+#define F3_PACKET_AVAILABLE 0x0040
+#define F1_OVERFLOW 0x0080 /* Due to last write. Bkplane has pending write requests */
+#define MISC_INTR0 0x0100
+#define MISC_INTR1 0x0200
+#define MISC_INTR2 0x0400
+#define MISC_INTR3 0x0800
+#define MISC_INTR4 0x1000
+#define F1_INTR 0x2000
+#define F2_INTR 0x4000
+#define F3_INTR 0x8000
+
+/* Bit mask for 32bit SPID_STATUS_REG device register */
+#define STATUS_DATA_NOT_AVAILABLE 0x00000001
+#define STATUS_UNDERFLOW 0x00000002
+#define STATUS_OVERFLOW 0x00000004
+#define STATUS_F2_INTR 0x00000008
+#define STATUS_F3_INTR 0x00000010
+#define STATUS_F2_RX_READY 0x00000020
+#define STATUS_F3_RX_READY 0x00000040
+#define STATUS_HOST_CMD_DATA_ERR 0x00000080
+#define STATUS_F2_PKT_AVAILABLE 0x00000100
+#define STATUS_F2_PKT_LEN_MASK 0x000FFE00
+#define STATUS_F2_PKT_LEN_SHIFT 9
+#define STATUS_F3_PKT_AVAILABLE 0x00100000
+#define STATUS_F3_PKT_LEN_MASK 0xFFE00000
+#define STATUS_F3_PKT_LEN_SHIFT 21
+
+/* Bit mask for 16 bits SPID_F1_INFO_REG device register */
+#define F1_ENABLED 0x0001
+#define F1_RDY_FOR_DATA_TRANSFER 0x0002
+#define F1_MAX_PKT_SIZE 0x01FC
+
+/* Bit mask for 16 bits SPID_F2_INFO_REG device register */
+#define F2_ENABLED 0x0001
+#define F2_RDY_FOR_DATA_TRANSFER 0x0002
+#define F2_MAX_PKT_SIZE 0x3FFC
+
+/* Bit mask for 16 bits SPID_F3_INFO_REG device register */
+#define F3_ENABLED 0x0001
+#define F3_RDY_FOR_DATA_TRANSFER 0x0002
+#define F3_MAX_PKT_SIZE 0x3FFC
+
+/* Bit mask for 32 bits SPID_TEST_READ device register read in 16bit LE mode */
+#define TEST_RO_DATA_32BIT_LE 0xFEEDBEAD
+
+/* Maximum number of I/O funcs */
+#define SPI_MAX_IOFUNCS 4
+
+#define SPI_MAX_PKT_LEN (2048*4)
+
+/* Misc defines */
+#define SPI_FUNC_0 0
+#define SPI_FUNC_1 1
+#define SPI_FUNC_2 2
+#define SPI_FUNC_3 3
+
+#define WAIT_F2RXFIFORDY 100
+#define WAIT_F2RXFIFORDY_DELAY 20
+
+#endif /* _SPI_H */
diff --git a/drivers/net/wireless/bcmdhd/src/include/trxhdr.h b/drivers/net/wireless/bcmdhd/include/trxhdr.h
index 7afb4dc..bf92a56 100644
--- a/drivers/net/wireless/bcmdhd/src/include/trxhdr.h
+++ b/drivers/net/wireless/bcmdhd/include/trxhdr.h
@@ -1,14 +1,14 @@
/*
* TRX image file header format.
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,7 +16,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
diff --git a/drivers/net/wireless/bcmdhd/src/include/typedefs.h b/drivers/net/wireless/bcmdhd/include/typedefs.h
index 546651b..4eee5ba 100644
--- a/drivers/net/wireless/bcmdhd/src/include/typedefs.h
+++ b/drivers/net/wireless/bcmdhd/include/typedefs.h
@@ -1,12 +1,12 @@
/*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -14,7 +14,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
@@ -44,10 +44,10 @@
#define TRUE true
#endif
-#else
+#else
-#endif
+#endif
#if defined(__x86_64__)
#define TYPEDEF_UINTPTR
@@ -76,21 +76,21 @@ typedef long unsigned int size_t;
#ifndef TARGETENV_android
#define TYPEDEF_USHORT
#define TYPEDEF_ULONG
-#endif
+#endif
#ifdef __KERNEL__
#include <linux/version.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19))
#define TYPEDEF_BOOL
-#endif
+#endif
#if (LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 18))
#include <linux/compiler.h>
#ifdef noinline_for_stack
#define TYPEDEF_BOOL
#endif
-#endif
-#endif
-#endif
+#endif
+#endif
+#endif
@@ -110,7 +110,7 @@ typedef long unsigned int size_t;
#define TYPEDEF_UINT64
#endif
-#endif
+#endif
#if !defined(__DJGPP__)
@@ -119,24 +119,24 @@ typedef long unsigned int size_t;
#if !defined(LINUX_HYBRID) || defined(LINUX_PORT)
-#include <linux/types.h>
-#endif
+#include <linux/types.h>
+#endif
#else
#include <sys/types.h>
-#endif
+#endif
-#endif
+#endif
#define USE_TYPEDEF_DEFAULTS
-#endif
+#endif
@@ -220,11 +220,11 @@ typedef double float64;
#if defined(FLOAT32)
typedef float32 float_t;
-#else
+#else
typedef float64 float_t;
#endif
-#endif
+#endif
@@ -233,7 +233,7 @@ typedef float64 float_t;
#endif
#ifndef TRUE
-#define TRUE 1
+#define TRUE 1
#endif
#ifndef NULL
@@ -245,10 +245,10 @@ typedef float64 float_t;
#endif
#ifndef ON
-#define ON 1
+#define ON 1
#endif
-#define AUTO (-1)
+#define AUTO (-1)
@@ -264,7 +264,7 @@ typedef float64 float_t;
#define BWL_COMPILER_ARMCC
#else
#error "Unknown compiler!"
-#endif
+#endif
#ifndef INLINE
@@ -276,8 +276,8 @@ typedef float64 float_t;
#define INLINE __inline
#else
#define INLINE
- #endif
-#endif
+ #endif
+#endif
#undef TYPEDEF_BOOL
#undef TYPEDEF_UCHAR
@@ -297,7 +297,7 @@ typedef float64 float_t;
#undef TYPEDEF_FLOAT64
#undef TYPEDEF_FLOAT_T
-#endif
+#endif
#define UNUSED_PARAMETER(x) (void)(x)
@@ -307,4 +307,4 @@ typedef float64 float_t;
#include <bcmdefs.h>
-#endif
+#endif
diff --git a/drivers/net/wireless/bcmdhd/src/include/wlfc_proto.h b/drivers/net/wireless/bcmdhd/include/wlfc_proto.h
index 22e08f6..1c8cc01 100644
--- a/drivers/net/wireless/bcmdhd/src/include/wlfc_proto.h
+++ b/drivers/net/wireless/bcmdhd/include/wlfc_proto.h
@@ -1,12 +1,12 @@
/*
-* Copyright (C) 1999-2011, Broadcom Corporation
-*
+* Copyright (C) 1999-2012, Broadcom Corporation
+*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
-*
+*
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -14,11 +14,11 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
-*
+*
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
-* $Id: wlfc_proto.h 303826 2011-12-20 06:02:09Z $
+* $Id: wlfc_proto.h 347585 2012-07-27 09:02:53Z $
*
*/
#ifndef __wlfc_proto_definitions_h__
@@ -62,6 +62,12 @@
| 13 | 3 | (count, handle, prec_bmp)| One time request for packet to a specific
| | | | MAC destination.
---------------------------------------------------------------------------
+ | 15 | 1 | interface ID | NIC period start
+ ---------------------------------------------------------------------------
+ | 16 | 1 | interface ID | NIC period end
+ ---------------------------------------------------------------------------
+ | 17 | 3 | (ifid, txs) | Action frame tx status
+ ---------------------------------------------------------------------------
| 255 | N/A | N/A | FILLER - This is a special type
| | | | that has no length or value.
| | | | Typically used for padding.
@@ -70,13 +76,13 @@
#define WLFC_CTL_TYPE_MAC_OPEN 1
#define WLFC_CTL_TYPE_MAC_CLOSE 2
-#define WLFC_CTL_TYPE_MAC_REQUEST_CREDIT 3
+#define WLFC_CTL_TYPE_MAC_REQUEST_CREDIT 3
#define WLFC_CTL_TYPE_TXSTATUS 4
#define WLFC_CTL_TYPE_PKTTAG 5
#define WLFC_CTL_TYPE_MACDESC_ADD 6
#define WLFC_CTL_TYPE_MACDESC_DEL 7
-#define WLFC_CTL_TYPE_RSSI 8
+#define WLFC_CTL_TYPE_RSSI 8
#define WLFC_CTL_TYPE_INTERFACE_OPEN 9
#define WLFC_CTL_TYPE_INTERFACE_CLOSE 10
@@ -87,25 +93,33 @@
#define WLFC_CTL_TYPE_MAC_REQUEST_PACKET 13
#define WLFC_CTL_TYPE_HOST_REORDER_RXPKTS 14
-#define WLFC_CTL_TYPE_FILLER 255
+#define WLFC_CTL_TYPE_NIC_PRD_START 15
+#define WLFC_CTL_TYPE_NIC_PRD_END 16
+#define WLFC_CTL_TYPE_AF_TXS 17
+#define WLFC_CTL_TYPE_TRANS_ID 18
+
+#define WLFC_CTL_TYPE_FILLER 255
-#define WLFC_CTL_VALUE_LEN_MACDESC 8 /* handle, interface, MAC */
+#define WLFC_CTL_VALUE_LEN_MACDESC 8 /* handle, interface, MAC */
-#define WLFC_CTL_VALUE_LEN_MAC 1 /* MAC-handle */
-#define WLFC_CTL_VALUE_LEN_RSSI 1
+#define WLFC_CTL_VALUE_LEN_MAC 1 /* MAC-handle */
+#define WLFC_CTL_VALUE_LEN_RSSI 1
-#define WLFC_CTL_VALUE_LEN_INTERFACE 1
+#define WLFC_CTL_VALUE_LEN_INTERFACE 1
#define WLFC_CTL_VALUE_LEN_PENDING_TRAFFIC_BMP 2
-#define WLFC_CTL_VALUE_LEN_TXSTATUS 4
-#define WLFC_CTL_VALUE_LEN_PKTTAG 4
+#define WLFC_CTL_VALUE_LEN_TXSTATUS 4
+#define WLFC_CTL_VALUE_LEN_PKTTAG 4
/* enough space to host all 4 ACs, bc/mc and atim fifo credit */
#define WLFC_CTL_VALUE_LEN_FIFO_CREDITBACK 6
-#define WLFC_CTL_VALUE_LEN_REQUEST_CREDIT 3 /* credit, MAC-handle, prec_bitmap */
-#define WLFC_CTL_VALUE_LEN_REQUEST_PACKET 3 /* credit, MAC-handle, prec_bitmap */
+#define WLFC_CTL_VALUE_LEN_REQUEST_CREDIT 3 /* credit, MAC-handle, prec_bitmap */
+#define WLFC_CTL_VALUE_LEN_REQUEST_PACKET 3 /* credit, MAC-handle, prec_bitmap */
+#define WLFC_CTL_VALUE_LEN_NIC_PRD_START 1
+#define WLFC_CTL_VALUE_LEN_NIC_PRD_END 1
+#define WLFC_CTL_VALUE_LEN_AF_TXS 3
#define WLFC_PKTID_GEN_MASK 0x80000000
@@ -187,7 +201,7 @@
{printf("WLFC: %s():%d:caller:%p\n", \
__FUNCTION__, __LINE__, __builtin_return_address(0));}} while (0)
#define WLFC_PRINTMAC(banner, ea) do {printf("%s MAC: [%02x:%02x:%02x:%02x:%02x:%02x]\n", \
- banner, ea[0], ea[1], ea[2], ea[3], ea[4], ea[5]); } while (0)
+ banner, ea[0], ea[1], ea[2], ea[3], ea[4], ea[5]); } while (0)
#define WLFC_WHEREIS(s) printf("WLFC: at %s():%d, %s\n", __FUNCTION__, __LINE__, (s))
#else
#define WLFC_DBGMESG(x)
@@ -212,5 +226,7 @@
#define WLHOST_REORDERDATA_CURIDX_VALID 0x04
#define WLHOST_REORDERDATA_EXPIDX_VALID 0x08
#define WLHOST_REORDERDATA_NEW_HOLE 0x10
+/* transaction id data len byte 0: rsvd, byte 1: seqnumber, byte 2-5 will be used for timestampe */
+#define WLFC_CTL_TRANS_ID_LEN 6
#endif /* __wlfc_proto_definitions_h__ */
diff --git a/drivers/net/wireless/bcmdhd/src/include/wlioctl.h b/drivers/net/wireless/bcmdhd/include/wlioctl.h
index d6bdb8f..5205c07 100644
--- a/drivers/net/wireless/bcmdhd/src/include/wlioctl.h
+++ b/drivers/net/wireless/bcmdhd/include/wlioctl.h
@@ -5,13 +5,13 @@
* Definitions subject to change without notice.
*
* Copyright (C) 1999-2012, Broadcom Corporation
- *
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -19,12 +19,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: wlioctl.h 310294 2012-01-24 06:17:47Z $
+ * $Id: wlioctl.h 357629 2012-09-19 12:51:08Z $
*/
#ifndef _wlioctl_h_
@@ -36,9 +36,22 @@
#include <proto/bcmevent.h>
#include <proto/802.11.h>
#include <bcmwifi_channels.h>
+#include <bcmwifi_rates.h>
+#ifndef LINUX_POSTMOGRIFY_REMOVAL
#include <bcm_mpool_pub.h>
#include <bcmcdc.h>
+#endif /* LINUX_POSTMOGRIFY_REMOVAL */
+
+#include <dhd_sec_feature.h>
+
+/* LINUX_POSTMOGRIFY_REMOVAL: undefined during compile phase, so its
+ * a no-op for most cases. For hybrid and other open source releases,
+ * its defined during a second pass and mogrified out for distribution.
+ */
+
+
+#ifndef LINUX_POSTMOGRIFY_REMOVAL
#ifndef INTF_NAME_SIZ
#define INTF_NAME_SIZ 16
@@ -46,7 +59,7 @@
/* Used to send ioctls over the transport pipe */
typedef struct remote_ioctl {
- cdc_ioctl_t msg;
+ cdc_ioctl_t msg;
uint data_len;
char intf_name[INTF_NAME_SIZ];
} rem_ioctl_t;
@@ -55,9 +68,9 @@ typedef struct remote_ioctl {
#define ACTION_FRAME_SIZE 1800
typedef struct wl_action_frame {
- struct ether_addr da;
- uint16 len;
- uint32 packetId;
+ struct ether_addr da;
+ uint16 len;
+ uint32 packetId;
uint8 data[ACTION_FRAME_SIZE];
} wl_action_frame_t;
@@ -70,9 +83,9 @@ typedef struct ssid_info
} ssid_info_t;
typedef struct wl_af_params {
- uint32 channel;
- int32 dwell_time;
- struct ether_addr BSSID;
+ uint32 channel;
+ int32 dwell_time;
+ struct ether_addr BSSID;
wl_action_frame_t action_frame;
} wl_af_params_t;
@@ -82,11 +95,12 @@ typedef struct wl_af_params {
#define MFP_TEST_FLAG_ANY_KEY 1
typedef struct wl_sa_query {
uint32 flag;
- uint8 action;
- uint16 id;
- struct ether_addr da;
+ uint8 action;
+ uint16 id;
+ struct ether_addr da;
} wl_sa_query_t;
+#endif /* LINUX_POSTMOGRIFY_REMOVAL */
/* require default structure packing */
#define BWL_DEFAULT_PACKING
@@ -120,7 +134,6 @@ typedef struct wl_bss_info_107 {
uint32 ie_length; /* byte length of Information Elements */
/* variable length Information Elements */
} wl_bss_info_107_t;
-#endif /* LINUX_POSTMOGRIFY_REMOVAL */
/*
* Per-BSS information structure.
@@ -166,6 +179,8 @@ typedef struct wl_bss_info_108 {
/* variable length Information Elements */
} wl_bss_info_108_t;
+#endif /* LINUX_POSTMOGRIFY_REMOVAL */
+
#define WL_BSS_INFO_VERSION 109 /* current version of wl_bss_info struct */
/* BSS info structure
@@ -193,7 +208,7 @@ typedef struct wl_bss_info {
int8 phy_noise; /* noise (in dBm) */
uint8 n_cap; /* BSS is 802.11N Capable */
- uint32 nbss_cap; /* 802.11N BSS Capabilities (based on HT_CAP_*) */
+ uint32 nbss_cap; /* 802.11N+AC BSS Capabilities */
uint8 ctl_ch; /* 802.11N BSS control channel number */
uint8 padding1[3]; /* explicit struct alignment padding */
uint16 vht_rxmcsmap; /* VHT rx mcs map */
@@ -210,6 +225,16 @@ typedef struct wl_bss_info {
/* variable length Information Elements */
} wl_bss_info_t;
+/* bss_info_cap_t flags */
+#define WL_BSS_FLAGS_FROM_BEACON 0x01 /* bss_info derived from beacon */
+#define WL_BSS_FLAGS_FROM_CACHE 0x02 /* bss_info collected from cache */
+#define WL_BSS_FLAGS_RSSI_ONCHANNEL 0x04 /* rssi info was received on channel (vs offchannel) */
+
+/* bssinfo flag for nbss_cap */
+#define VHT_BI_SGI_80MHZ 0x00000100
+
+#ifndef LINUX_POSTMOGRIFY_REMOVAL
+
typedef struct wl_bsscfg {
uint32 wsec;
uint32 WPA_auth;
@@ -234,7 +259,7 @@ typedef struct wl_bss_config {
#define DLOAD_FLAG_VER_MASK 0xf000 /* Downloader version mask */
#define DLOAD_FLAG_VER_SHIFT 12 /* Downloader version shift */
-#define DL_CRC_NOT_INUSE 0x0001
+#define DL_CRC_NOT_INUSE 0x0001
/* generic download types & flags */
enum {
@@ -277,11 +302,15 @@ struct wl_clm_dload_info {
};
typedef struct wl_clm_dload_info wl_clm_dload_info_t;
+#endif /* LINUX_POSTMOGRIFY_REMOVAL */
+
typedef struct wlc_ssid {
uint32 SSID_len;
uchar SSID[32];
} wlc_ssid_t;
+#ifndef LINUX_POSTMOGRIFY_REMOVAL
+
#define MAX_PREFERRED_AP_NUM 5
typedef struct wlc_fastssidinfo {
uint32 SSID_channel[MAX_PREFERRED_AP_NUM];
@@ -289,11 +318,10 @@ typedef struct wlc_fastssidinfo {
} wlc_fastssidinfo_t;
typedef BWL_PRE_PACKED_STRUCT struct wnm_url {
- uint8 len;
- uint8 data[1];
+ uint8 len;
+ uint8 data[1];
} BWL_POST_PACKED_STRUCT wnm_url_t;
-#ifndef LINUX_POSTMOGRIFY_REMOVAL
typedef struct chan_scandata {
uint8 txpower;
uint8 pad;
@@ -310,24 +338,19 @@ typedef enum wl_scan_type {
#define WLC_EXTDSCAN_MAX_SSID 5
-#define WL_BSS_FLAGS_FROM_BEACON 0x01 /* bss_info derived from beacon */
-#define WL_BSS_FLAGS_FROM_CACHE 0x02 /* bss_info collected from cache */
-#define WL_BSS_FLAGS_RSSI_ONCHANNEL 0x04 /* rssi info was received on channel (vs offchannel) */
-
typedef struct wl_extdscan_params {
- int8 nprobes; /* 0, passive, otherwise active */
- int8 split_scan; /* split scan */
+ int8 nprobes; /* 0, passive, otherwise active */
+ int8 split_scan; /* split scan */
int8 band; /* band */
int8 pad;
- wlc_ssid_t ssid[WLC_EXTDSCAN_MAX_SSID]; /* ssid list */
+ wlc_ssid_t ssid[WLC_EXTDSCAN_MAX_SSID]; /* ssid list */
uint32 tx_rate; /* in 500ksec units */
wl_scan_type_t scan_type; /* enum */
- int32 channel_num;
+ int32 channel_num;
chan_scandata_t channel_list[1]; /* list of chandata structs */
} wl_extdscan_params_t;
-#define WL_EXTDSCAN_PARAMS_FIXED_SIZE (sizeof(wl_extdscan_params_t) - sizeof(chan_scandata_t))
-#endif /* LINUX_POSTMOGRIFY_REMOVAL */
+#define WL_EXTDSCAN_PARAMS_FIXED_SIZE (sizeof(wl_extdscan_params_t) - sizeof(chan_scandata_t))
#define WL_BSSTYPE_INFRA 1
#define WL_BSSTYPE_INDEP 0
@@ -338,7 +361,7 @@ typedef struct wl_extdscan_params {
#define WL_SCANFLAGS_RESERVED 0x02 /* Reserved */
#define WL_SCANFLAGS_PROHIBITED 0x04 /* allow scanning prohibited channels */
-#define WL_SCAN_PARAMS_SSID_MAX 10
+#define WL_SCAN_PARAMS_SSID_MAX 10
typedef struct wl_scan_params {
wlc_ssid_t ssid; /* default: {0, ""} */
@@ -397,6 +420,7 @@ typedef struct wl_iscan_params {
/* 3 fields + size of wl_scan_params, not including variable length array */
#define WL_ISCAN_PARAMS_FIXED_SIZE (OFFSETOF(wl_iscan_params_t, params) + sizeof(wlc_ssid_t))
+#endif /* LINUX_POSTMOGRIFY_REMOVAL */
typedef struct wl_scan_results {
uint32 buflen;
@@ -405,6 +429,7 @@ typedef struct wl_scan_results {
wl_bss_info_t bss_info[1];
} wl_scan_results_t;
+#ifndef LINUX_POSTMOGRIFY_REMOVAL
/* size of wl_scan_results not including variable length array */
#define WL_SCAN_RESULTS_FIXED_SIZE (sizeof(wl_scan_results_t) - sizeof(wl_bss_info_t))
@@ -468,16 +493,17 @@ typedef struct wl_probe_params {
struct ether_addr bssid;
struct ether_addr mac;
} wl_probe_params_t;
+#endif /* LINUX_POSTMOGRIFY_REMOVAL */
-#define WL_NUMRATES 16 /* max # of rates in a rateset */
+#define WL_MAXRATES_IN_SET 16 /* max # of rates in a rateset */
typedef struct wl_rateset {
uint32 count; /* # rates in this set */
- uint8 rates[WL_NUMRATES]; /* rates in 500kbps units w/hi bit set if basic */
+ uint8 rates[WL_MAXRATES_IN_SET]; /* rates in 500kbps units w/hi bit set if basic */
} wl_rateset_t;
typedef struct wl_rateset_args {
uint32 count; /* # rates in this set */
- uint8 rates[WL_NUMRATES]; /* rates in 500kbps units w/hi bit set if basic */
+ uint8 rates[WL_MAXRATES_IN_SET]; /* rates in 500kbps units w/hi bit set if basic */
uint8 mcs[MCSSET_LEN]; /* supported mcs index bit map */
} wl_rateset_args_t;
@@ -497,7 +523,7 @@ typedef struct wl_assoc_params {
*/
chanspec_t chanspec_list[1]; /* list of chanspecs */
} wl_assoc_params_t;
-#define WL_ASSOC_PARAMS_FIXED_SIZE OFFSETOF(wl_assoc_params_t, chanspec_list)
+#define WL_ASSOC_PARAMS_FIXED_SIZE OFFSETOF(wl_assoc_params_t, chanspec_list)
/* used for reassociation/roam to a specific BSSID and channel */
typedef wl_assoc_params_t wl_reassoc_params_t;
@@ -514,7 +540,9 @@ typedef struct wl_join_params {
* of the wl_assoc_params_t struct when it does present.
*/
} wl_join_params_t;
-#define WL_JOIN_PARAMS_FIXED_SIZE (OFFSETOF(wl_join_params_t, params) + \
+
+#ifndef LINUX_POSTMOGRIFY_REMOVAL
+#define WL_JOIN_PARAMS_FIXED_SIZE (OFFSETOF(wl_join_params_t, params) + \
WL_ASSOC_PARAMS_FIXED_SIZE)
/* scan params for extended join */
typedef struct wl_join_scan_params {
@@ -540,9 +568,13 @@ typedef struct wl_extjoin_params {
* present.
*/
} wl_extjoin_params_t;
-#define WL_EXTJOIN_PARAMS_FIXED_SIZE (OFFSETOF(wl_extjoin_params_t, assoc) + \
+#define WL_EXTJOIN_PARAMS_FIXED_SIZE (OFFSETOF(wl_extjoin_params_t, assoc) + \
WL_JOIN_ASSOC_PARAMS_FIXED_SIZE)
+/* All builds use the new 11ac ratespec/chanspec */
+#undef D11AC_IOTYPES
+#define D11AC_IOTYPES
+
#ifndef D11AC_IOTYPES
/* defines used by the nrate iovar */
@@ -645,9 +677,9 @@ typedef struct {
#define CCA_FLAG_5G_ONLY 0x02 /* Return a channel from 2.4 Ghz band */
#define CCA_FLAG_IGNORE_DURATION 0x04 /* Ignore dwell time for each channel */
#define CCA_FLAGS_PREFER_1_6_11 0x10
-#define CCA_FLAG_IGNORE_INTERFER 0x20 /* do not exlude channel based on interfer level */
+#define CCA_FLAG_IGNORE_INTERFER 0x20 /* do not exlude channel based on interfer level */
-#define CCA_ERRNO_BAND 1 /* After filtering for band pref, no choices left */
+#define CCA_ERRNO_BAND 1 /* After filtering for band pref, no choices left */
#define CCA_ERRNO_DURATION 2 /* After filtering for duration, no choices left */
#define CCA_ERRNO_PREF_CHAN 3 /* After filtering for chan pref, no choices left */
#define CCA_ERRNO_INTERFER 4 /* After filtering for interference, no choices left */
@@ -699,8 +731,12 @@ typedef struct {
#define ITFR_HOME_CHANNEL 2 /* home channel has interference */
#define ITFR_NOISY_ENVIRONMENT 4 /* noisy environemnt so feature stopped */
+#endif /* LINUX_POSTMOGRIFY_REMOVAL */
+
#define WLC_CNTRY_BUF_SZ 4 /* Country string is 3 bytes + NUL */
+#ifndef LINUX_POSTMOGRIFY_REMOVAL
+
typedef struct wl_country {
char country_abbrev[WLC_CNTRY_BUF_SZ]; /* nul-terminated country code used in
* the Country IE
@@ -788,6 +824,29 @@ typedef struct wl_rm_rep {
} wl_rm_rep_t;
#define WL_RM_REP_FIXED_LEN 8
+#ifdef BCMCCX
+
+#define LEAP_USER_MAX 32
+#define LEAP_DOMAIN_MAX 32
+#define LEAP_PASSWORD_MAX 32
+
+typedef struct wl_leap_info {
+ wlc_ssid_t ssid;
+ uint8 user_len;
+ uchar user[LEAP_USER_MAX];
+ uint8 password_len;
+ uchar password[LEAP_PASSWORD_MAX];
+ uint8 domain_len;
+ uchar domain[LEAP_DOMAIN_MAX];
+} wl_leap_info_t;
+
+typedef struct wl_leap_list {
+ uint32 buflen;
+ uint32 version;
+ uint32 count;
+ wl_leap_info_t leap_info[1];
+} wl_leap_list_t;
+#endif /* BCMCCX */
typedef enum sup_auth_status {
/* Basic supplicant authentication states */
@@ -812,6 +871,7 @@ typedef enum sup_auth_status {
WLC_SUP_KEYXCHANGE_WAIT_G1, /* Waiting to receive handshake msg G1 */
WLC_SUP_KEYXCHANGE_PREP_G2 /* Preparing to send handshake msg G2 */
} sup_auth_status_t;
+#endif /* LINUX_POSTMOGRIFY_REMOVAL */
/* Enumerate crypto algorithms */
#define CRYPTO_ALGO_OFF 0
@@ -821,9 +881,16 @@ typedef enum sup_auth_status {
#define CRYPTO_ALGO_AES_CCM 4
#define CRYPTO_ALGO_AES_OCB_MSDU 5
#define CRYPTO_ALGO_AES_OCB_MPDU 6
+#if !defined(BCMCCX)
#define CRYPTO_ALGO_NALG 7
+#else
+#define CRYPTO_ALGO_CKIP 7
+#define CRYPTO_ALGO_CKIP_MMH 8
+#define CRYPTO_ALGO_WEP_MMH 9
+#define CRYPTO_ALGO_NALG 10
+#endif
#ifdef BCMWAPI_WPI
-#define CRYPTO_ALGO_SMS4 11
+#define CRYPTO_ALGO_SMS4 11
#endif /* BCMWAPI_WPI */
#define CRYPTO_ALGO_PMK 12 /* for 802.1x supp to set PMK before 4-way */
@@ -836,8 +903,13 @@ typedef enum sup_auth_status {
#define WL_SOFT_KEY (1 << 0) /* Indicates this key is using soft encrypt */
#define WL_PRIMARY_KEY (1 << 1) /* Indicates this key is the primary (ie tx) key */
+#if defined(BCMCCX)
+#define WL_CKIP_KP (1 << 4) /* CMIC */
+#define WL_CKIP_MMH (1 << 5) /* CKIP */
+#else
#define WL_KF_RES_4 (1 << 4) /* Reserved for backward compat */
#define WL_KF_RES_5 (1 << 5) /* Reserved for backward compat */
+#endif
#define WL_IBSS_PEER_GROUP_KEY (1 << 6) /* Indicates a group key for a IBSS PEER */
typedef struct wl_wsec_key {
@@ -878,9 +950,13 @@ typedef struct {
#define TKIP_ENABLED 0x0002
#define AES_ENABLED 0x0004
#define WSEC_SWFLAG 0x0008
+#ifdef BCMCCX
+#define CKIP_KP_ENABLED 0x0010
+#define CKIP_MIC_ENABLED 0x0020
+#endif /* BCMCCX */
#define SES_OW_ENABLED 0x0040 /* to go into transition mode without setting wep */
#ifdef BCMWAPI_WPI
-#define SMS4_ENABLED 0x0100
+#define SMS4_ENABLED 0x0100
#endif /* BCMWAPI_WPI */
/* wsec macros for operating on the above definitions */
@@ -888,11 +964,27 @@ typedef struct {
#define WSEC_TKIP_ENABLED(wsec) ((wsec) & TKIP_ENABLED)
#define WSEC_AES_ENABLED(wsec) ((wsec) & AES_ENABLED)
+#ifdef BCMCCX
+#define WSEC_CKIP_KP_ENABLED(wsec) ((wsec) & CKIP_KP_ENABLED)
+#define WSEC_CKIP_MIC_ENABLED(wsec) ((wsec) & CKIP_MIC_ENABLED)
+#define WSEC_CKIP_ENABLED(wsec) ((wsec) & (CKIP_KP_ENABLED|CKIP_MIC_ENABLED))
+
+#ifdef BCMWAPI_WPI
+#define WSEC_ENABLED(wsec) \
+ ((wsec) & (WEP_ENABLED | TKIP_ENABLED | AES_ENABLED | CKIP_KP_ENABLED | \
+ CKIP_MIC_ENABLED | SMS4_ENABLED))
+#else /* BCMWAPI_WPI */
+#define WSEC_ENABLED(wsec) \
+ ((wsec) & \
+ (WEP_ENABLED | TKIP_ENABLED | AES_ENABLED | CKIP_KP_ENABLED | CKIP_MIC_ENABLED))
+#endif /* BCMWAPI_WPI */
+#else /* defined BCMCCX */
#ifdef BCMWAPI_WPI
#define WSEC_ENABLED(wsec) ((wsec) & (WEP_ENABLED | TKIP_ENABLED | AES_ENABLED | SMS4_ENABLED))
#else /* BCMWAPI_WPI */
#define WSEC_ENABLED(wsec) ((wsec) & (WEP_ENABLED | TKIP_ENABLED | AES_ENABLED))
#endif /* BCMWAPI_WPI */
+#endif /* BCMCCX */
#define WSEC_SES_OW_ENABLED(wsec) ((wsec) & SES_OW_ENABLED)
#ifdef BCMWAPI_WAI
#define WSEC_SMS4_ENABLED(wsec) ((wsec) & SMS4_ENABLED)
@@ -904,22 +996,15 @@ typedef struct {
#define MFP_SHA256 0x0800 /* a special configuration for STA for WIFI test tool */
#endif /* MFP */
-#ifdef MFP
-#define MFP_CAPABLE 0x0200
-#define MFP_REQUIRED 0x0400
-#define MFP_SHA256 0x0800 /* a special configuration for STA for WIFI test tool */
-#endif /* MFP */
/* WPA authentication mode bitvec */
#define WPA_AUTH_DISABLED 0x0000 /* Legacy (i.e., non-WPA) */
#define WPA_AUTH_NONE 0x0001 /* none (IBSS) */
#define WPA_AUTH_UNSPECIFIED 0x0002 /* over 802.1x */
#define WPA_AUTH_PSK 0x0004 /* Pre-shared key */
-
-#if defined(BCMCCX) || defined(BCMEXTCCX)
-#define WPA_AUTH_CCKM 0x0008 /* CCKM */
-#define WPA2_AUTH_CCKM 0x0010 /* CCKM2 */
-#endif /* BCMCCX || BCMEXTCCX */
-
+#if defined(BCMCCX)
+#define WPA_AUTH_CCKM 0x0008 /* CCKM */
+#define WPA2_AUTH_CCKM 0x0010 /* CCKM2 */
+#endif
/* #define WPA_AUTH_8021X 0x0020 */ /* 802.1x, reserved */
#define WPA2_AUTH_UNSPECIFIED 0x0040 /* over 802.1x */
#define WPA2_AUTH_PSK 0x0080 /* Pre-shared key */
@@ -932,8 +1017,8 @@ typedef struct {
#define WAPI_AUTH_PSK 0x0800 /* Pre-shared key */
#endif /* BCMWAPI_WAI || BCMWAPI_WPI */
#define WPA2_AUTH_MFP 0x1000 /* MFP (11w) in contrast to CCX */
-#define WPA2_AUTH_TPK 0x2000 /* TDLS Peer Key */
-#define WPA2_AUTH_FT 0x4000 /* Fast Transition. */
+#define WPA2_AUTH_TPK 0x2000 /* TDLS Peer Key */
+#define WPA2_AUTH_FT 0x4000 /* Fast Transition. */
#define WPA_AUTH_PFN_ANY 0xffffffff /* for PFN, match only ssid */
/* pmkid */
@@ -959,6 +1044,7 @@ typedef struct _pmkid_cand_list {
pmkid_cand_t pmkid_cand[1];
} pmkid_cand_list_t;
+#ifndef LINUX_POSTMOGRIFY_REMOVAL
typedef struct wl_assoc_info {
uint32 req_len;
uint32 resp_len;
@@ -971,7 +1057,6 @@ typedef struct wl_assoc_info {
/* flags */
#define WLC_ASSOC_REQ_IS_REASSOC 0x01 /* assoc req was actually a reassoc */
-#ifndef LINUX_POSTMOGRIFY_REMOVAL
typedef struct wl_led_info {
uint32 index; /* led index */
uint32 behavior;
@@ -1053,7 +1138,6 @@ typedef struct {
} link_val_t;
#define BCM_MAC_STATUS_INDICATION (0x40010200L)
-#endif /* LINUX_POSTMOGRIFY_REMOVAL */
typedef struct {
uint16 ver; /* version of this struct */
@@ -1102,6 +1186,8 @@ typedef struct {
#define WLC_TXFILTER_OVERRIDE_DISABLED 0
#define WLC_TXFILTER_OVERRIDE_ENABLED 1
+#endif /* LINUX_POSTMOGRIFY_REMOVAL */
+
/* Used to get specific STA parameters */
typedef struct {
uint32 val;
@@ -1127,6 +1213,7 @@ struct maclist {
struct ether_addr ea[1]; /* variable length array of MAC addresses */
};
+#ifndef LINUX_POSTMOGRIFY_REMOVAL
/* get pkt count struct passed through ioctl */
typedef struct get_pktcnt {
uint rx_good_pkt;
@@ -1152,9 +1239,6 @@ typedef struct {
int isvalid; /* Flag indicating whether above data is valid */
} wl_lq_t; /* Link Quality */
-/* NINTENDO2 */
-#define MCS_INDEX_SIZE 33
-
typedef enum wl_wakeup_reason_type {
LCD_ON = 1,
LCD_OFF,
@@ -1181,7 +1265,8 @@ typedef struct {
/* Get MAC rate histogram response */
typedef struct {
uint32 rate[WLC_MAXRATE + 1]; /* Rates */
- uint32 mcs_index[MCS_INDEX_SIZE]; /* MCS index */
+ uint32 mcs[WL_RATESET_SZ_HT_MCS * WL_TX_CHAINS_MAX]; /* MCS counts */
+ uint32 vht[WL_RATESET_SZ_VHT_MCS][WL_TX_CHAINS_MAX]; /* VHT counts */
uint32 tsf_timer[2][2]; /* Start and End time for 8bytes value */
} wl_mac_ratehisto_res_t; /* MAC Specific Rate Histogram Response */
@@ -1197,6 +1282,8 @@ typedef struct {
#define WL_IOCTL_ACTION_MASK 0x7e
#define WL_IOCTL_ACTION_OVL_SHIFT 1
+#endif /* LINUX_POSTMOGRIFY_REMOVAL */
+
/* Linux network driver ioctl encoding */
typedef struct wl_ioctl {
uint cmd; /* common ioctl definition */
@@ -1207,6 +1294,8 @@ typedef struct wl_ioctl {
uint needed; /* bytes needed (optional) */
} wl_ioctl_t;
+#ifndef LINUX_POSTMOGRIFY_REMOVAL
+
/* reference to wl_ioctl_t struct used by usermode driver */
#define ioctl_subtype set /* subtype param */
#define ioctl_pid used /* pid param */
@@ -1271,6 +1360,7 @@ typedef struct wlc_iov_trx_s {
#else
#define WLC_IOCTL_VERSION 1
#endif /* D11AC_IOTYPES */
+#endif /* LINUX_POSTMOGRIFY_REMOVAL */
#define WLC_IOCTL_MAXLEN 8192 /* max length ioctl buffer required */
#define WLC_IOCTL_SMLEN 256 /* "small" length ioctl buffer required */
@@ -1310,7 +1400,7 @@ typedef struct wlc_iov_trx_s {
#define WLC_GET_SSID 25
#define WLC_SET_SSID 26
#define WLC_RESTART 27
-#define WLC_TERMINATED 28
+#define WLC_TERMINATED 28
/* #define WLC_DUMP_SCB 28 */ /* no longer supported */
#define WLC_GET_CHANNEL 29
#define WLC_SET_CHANNEL 30
@@ -1426,6 +1516,8 @@ typedef struct wlc_iov_trx_s {
#define WLC_GET_LAZYWDS 138
#define WLC_SET_LAZYWDS 139
#define WLC_GET_BANDLIST 140
+
+#ifndef LINUX_POSTMOGRIFY_REMOVAL
#define WLC_GET_BAND 141
#define WLC_SET_BAND 142
#define WLC_SCB_DEAUTHENTICATE 143
@@ -1465,7 +1557,9 @@ typedef struct wlc_iov_trx_s {
/* #define WLC_DUMP_PHYREGS 177 */ /* no longer supported */
#define WLC_GET_PROTECTION_CONTROL 178
#define WLC_SET_PROTECTION_CONTROL 179
+#endif /* LINUX_POSTMOGRIFY_REMOVAL */
#define WLC_GET_PHYLIST 180
+#ifndef LINUX_POSTMOGRIFY_REMOVAL
#define WLC_ENCRYPT_STRENGTH 181 /* ndis only */
#define WLC_DECRYPT_STATUS 182 /* ndis only */
#define WLC_GET_KEY_SEQ 183
@@ -1486,7 +1580,9 @@ typedef struct wlc_iov_trx_s {
/* #define WLC_GET_GMODE_PROTECTION_CTS 198 */ /* no longer supported */
/* #define WLC_SET_GMODE_PROTECTION_CTS 199 */ /* no longer supported */
#define WLC_SET_WSEC_TEST 200
+#endif /* LINUX_POSTMOGRIFY_REMOVAL */
#define WLC_SCB_DEAUTHENTICATE_FOR_REASON 201
+#ifndef LINUX_POSTMOGRIFY_REMOVAL
#define WLC_TKIP_COUNTERMEASURES 202
#define WLC_GET_PIOMODE 203
#define WLC_SET_PIOMODE 204
@@ -1502,6 +1598,7 @@ typedef struct wlc_iov_trx_s {
#define WLC_START_CHANNEL_QA 214
#define WLC_GET_CHANNEL_SEL 215
#define WLC_START_CHANNEL_SEL 216
+#endif /* LINUX_POSTMOGRIFY_REMOVAL */
#define WLC_GET_VALID_CHANNELS 217
#define WLC_GET_FAKEFRAG 218
#define WLC_SET_FAKEFRAG 219
@@ -1522,6 +1619,9 @@ typedef struct wlc_iov_trx_s {
/* #define WLC_GET_GLACIAL_TIMER 234 */ /* no longer supported */
#define WLC_GET_KEY_PRIMARY 235
#define WLC_SET_KEY_PRIMARY 236
+
+#ifndef LINUX_POSTMOGRIFY_REMOVAL
+
/* #define WLC_DUMP_RADIOREGS 237 */ /* no longer supported */
#define WLC_GET_ACI_ARGS 238
#define WLC_SET_ACI_ARGS 239
@@ -1547,8 +1647,10 @@ typedef struct wlc_iov_trx_s {
#define WLC_LEGACY_LINK_BEHAVIOR 259
#define WLC_GET_CHANNELS_IN_COUNTRY 260
#define WLC_GET_COUNTRY_LIST 261
+#endif /* LINUX_POSTMOGRIFY_REMOVAL */
#define WLC_GET_VAR 262 /* get value of named variable */
#define WLC_SET_VAR 263 /* set named variable to value */
+#ifndef LINUX_POSTMOGRIFY_REMOVAL
#define WLC_NVRAM_GET 264 /* deprecated */
#define WLC_NVRAM_SET 265
#define WLC_NVRAM_DUMP 266
@@ -1680,6 +1782,10 @@ typedef struct {
/* BCM4334(Phoenex branch) value changed to 3 */
#define WL_AUTH_OPEN_SHARED 3 /* try open, then shared if open failed w/rc 13 */
#endif
+#ifdef USE_WEP_AUTH_SHARED_OPEN
+#define WL_AUTH_SHARED_OPEN 4 /* try shared, then open if shared failed w/rc 13 */
+#endif /* USE_WEP_AUTH_SHARED_OPEN */
+#endif /* LINUX_POSTMOGRIFY_REMOVAL */
/* Bit masks for radio disabled status - returned by WL_GET_RADIO */
#define WL_RADIO_SW_DISABLE (1<<0)
@@ -1695,6 +1801,7 @@ typedef struct {
#define WL_TXPWR_OVERRIDE (1U<<31)
#define WL_TXPWR_NEG (1U<<30)
+#ifndef LINUX_POSTMOGRIFY_REMOVAL
#define WL_PHY_PAVARS_LEN 32 /* Phy type, Band range, chain, a1[0], b0[0], b1[0] ... */
#define WL_PHY_PAVAR_VER 1 /* pavars version */
@@ -1754,7 +1861,8 @@ typedef struct wl_po {
#define WL_CHAN_FREQ_RANGE_5G_BAND2 3
#define WL_CHAN_FREQ_RANGE_5G_BAND3 4
-#define WL_CHAN_FREQ_RANGE_5G_4BAND 5
+#define WL_CHAN_FREQ_RANGE_5G_4BAND 5
+#endif /* LINUX_POSTMOGRIFY_REMOVAL */
/* phy types (returned by WLC_GET_PHYTPE) */
#define WLC_PHY_TYPE_A 0
@@ -1766,8 +1874,16 @@ typedef struct wl_po {
#define WLC_PHY_TYPE_HT 7
#define WLC_PHY_TYPE_LCN 8
#define WLC_PHY_TYPE_LCN40 10
+#define WLC_PHY_TYPE_AC 11
#define WLC_PHY_TYPE_NULL 0xf
+/* Values for PM */
+#define PM_OFF 0
+#define PM_MAX 1
+#define PM_FAST 2
+#define PM_FORCE_OFF 3 /* use this bit to force PM off even bt is active */
+
+#ifndef LINUX_POSTMOGRIFY_REMOVAL
/* MAC list modes */
#define WLC_MACMODE_DISABLED 0 /* MAC list disabled */
#define WLC_MACMODE_DENY 1 /* Deny specified (i.e. allow unspecified) */
@@ -1835,11 +1951,25 @@ typedef struct wl_po {
#define WLC_N_PREAMBLE_GF 1
#define WLC_N_PREAMBLE_GF_BRCM 2
-/* values for band specific 40MHz capabilities */
+/* values for band specific 40MHz capabilities (deprecated) */
#define WLC_N_BW_20ALL 0
#define WLC_N_BW_40ALL 1
#define WLC_N_BW_20IN2G_40IN5G 2
+#define WLC_BW_20MHZ_BIT (1<<0)
+#define WLC_BW_40MHZ_BIT (1<<1)
+#define WLC_BW_80MHZ_BIT (1<<2)
+
+/* Bandwidth capabilities */
+#define WLC_BW_CAP_20MHZ (WLC_BW_20MHZ_BIT)
+#define WLC_BW_CAP_40MHZ (WLC_BW_40MHZ_BIT|WLC_BW_20MHZ_BIT)
+#define WLC_BW_CAP_80MHZ (WLC_BW_80MHZ_BIT|WLC_BW_40MHZ_BIT|WLC_BW_20MHZ_BIT)
+#define WLC_BW_CAP_UNRESTRICTED 0xFF
+
+#define WL_BW_CAP_20MHZ(bw_cap) (((bw_cap) & WLC_BW_20MHZ_BIT) ? TRUE : FALSE)
+#define WL_BW_CAP_40MHZ(bw_cap) (((bw_cap) & WLC_BW_40MHZ_BIT) ? TRUE : FALSE)
+#define WL_BW_CAP_80MHZ(bw_cap) (((bw_cap) & WLC_BW_80MHZ_BIT) ? TRUE : FALSE)
+
/* values to force tx/rx chain */
#define WLC_N_TXRX_CHAIN0 0
#define WLC_N_TXRX_CHAIN1 1
@@ -1847,15 +1977,14 @@ typedef struct wl_po {
/* bitflags for SGI support (sgi_rx iovar) */
#define WLC_N_SGI_20 0x01
#define WLC_N_SGI_40 0x02
+#define WLC_VHT_SGI_80 0x04
/* when sgi_tx==WLC_SGI_ALL, bypass rate selection, enable sgi for all mcs */
#define WLC_SGI_ALL 0x02
-/* Values for PM */
-#define PM_OFF 0
-#define PM_MAX 1
-#define PM_FAST 2
-#define PM_FORCE_OFF 3 /* use this bit to force PM off even bt is active */
+#define DHD_SCAN_ACTIVE_TIME 40 /* ms : Embedded default Active setting from DHD */
+#define DHD_SCAN_UNASSOC_ACTIVE_TIME 80 /* ms : def. Unassoc Active setting from DHD */
+#define DHD_SCAN_PASSIVE_TIME 130 /* ms: Embedded default Passive setting from DHD */
#define LISTEN_INTERVAL 10
/* interference mitigation options */
@@ -1950,13 +2079,12 @@ typedef struct wl_sampledata {
uint32 flag; /* bit def */
} wl_sampledata_t;
-#ifndef LINUX_POSTMOGRIFY_REMOVAL
/* wl_radar_args_t */
typedef struct {
- int npulses; /* required number of pulses at n * t_int */
- int ncontig; /* required number of pulses at t_int */
- int min_pw; /* minimum pulse width (20 MHz clocks) */
- int max_pw; /* maximum pulse width (20 MHz clocks) */
+ int npulses; /* required number of pulses at n * t_int */
+ int ncontig; /* required number of pulses at t_int */
+ int min_pw; /* minimum pulse width (20 MHz clocks) */
+ int max_pw; /* maximum pulse width (20 MHz clocks) */
uint16 thresh0; /* Radar detection, thresh 0 */
uint16 thresh1; /* Radar detection, thresh 1 */
uint16 blank; /* Radar detection, blank control */
@@ -1993,13 +2121,21 @@ typedef struct {
uint16 thresh1_20_lo; /* Radar detection, thresh 1 (range 5250-5350MHz) for BW 20MHz */
uint16 thresh0_40_lo; /* Radar detection, thresh 0 (range 5250-5350MHz) for BW 40MHz */
uint16 thresh1_40_lo; /* Radar detection, thresh 1 (range 5250-5350MHz) for BW 40MHz */
+ uint16 thresh0_80_lo; /* Radar detection, thresh 0 (range 5250-5350MHz) for BW 80MHz */
+ uint16 thresh1_80_lo; /* Radar detection, thresh 1 (range 5250-5350MHz) for BW 80MHz */
+ uint16 thresh0_160_lo; /* Radar detection, thresh 0 (range 5250-5350MHz) for BW 160MHz */
+ uint16 thresh1_160_lo; /* Radar detection, thresh 1 (range 5250-5350MHz) for BW 160MHz */
uint16 thresh0_20_hi; /* Radar detection, thresh 0 (range 5470-5725MHz) for BW 20MHz */
uint16 thresh1_20_hi; /* Radar detection, thresh 1 (range 5470-5725MHz) for BW 20MHz */
uint16 thresh0_40_hi; /* Radar detection, thresh 0 (range 5470-5725MHz) for BW 40MHz */
uint16 thresh1_40_hi; /* Radar detection, thresh 1 (range 5470-5725MHz) for BW 40MHz */
+ uint16 thresh0_80_hi; /* Radar detection, thresh 0 (range 5470-5725MHz) for BW 80MHz */
+ uint16 thresh1_80_hi; /* Radar detection, thresh 1 (range 5470-5725MHz) for BW 80MHz */
+ uint16 thresh0_160_hi; /* Radar detection, thresh 0 (range 5470-5725MHz) for BW 160MHz */
+ uint16 thresh1_160_hi; /* Radar detection, thresh 1 (range 5470-5725MHz) for BW 160MHz */
} wl_radar_thr_t;
-#define WL_RADAR_THR_VERSION 1
+#define WL_RADAR_THR_VERSION 2
#define WL_THRESHOLD_LO_BAND 70 /* range from 5250MHz - 5350MHz */
/* radar iovar SET defines */
@@ -2099,12 +2235,12 @@ typedef struct {
} tx_power_legacy2_t;
/* TX Power index defines */
-#define WL_NUM_RATES_CCK 4 /* 1, 2, 5.5, 11 Mbps */
-#define WL_NUM_RATES_OFDM 8 /* 6, 9, 12, 18, 24, 36, 48, 54 Mbps SISO/CDD */
-#define WL_NUM_RATES_MCS_1STREAM 8 /* MCS 0-7 1-stream rates - SISO/CDD/STBC/MCS */
+#define WL_NUM_RATES_CCK 4 /* 1, 2, 5.5, 11 Mbps */
+#define WL_NUM_RATES_OFDM 8 /* 6, 9, 12, 18, 24, 36, 48, 54 Mbps SISO/CDD */
+#define WL_NUM_RATES_MCS_1STREAM 8 /* MCS 0-7 1-stream rates - SISO/CDD/STBC/MCS */
#define WL_NUM_RATES_EXTRA_VHT 2 /* Additional VHT 11AC rates */
#define WL_NUM_RATES_VHT 10
-#define WL_NUM_RATES_MCS32 1
+#define WL_NUM_RATES_MCS32 1
#define WLC_NUM_RATES_CCK WL_NUM_RATES_CCK
#define WLC_NUM_RATES_OFDM WL_NUM_RATES_OFDM
@@ -2347,9 +2483,9 @@ typedef struct txppr {
#define WL_TX_POWER_40_S3X3_VHT OFFSETOF(txppr_t, b40_3x3sdm_vht)
/* 20 in 40MHz */
-#define WL_TX_POWER_20UL_CCK_FIRST OFFSETOF(txppr_t, b20in40_1x1dsss)
-#define WL_TX_POWER_20UL_OFDM_FIRST OFFSETOF(txppr_t, b20in40_1x1ofdm)
-#define WL_TX_POWER_20UL_S1x1_FIRST OFFSETOF(txppr_t, b20in40_1x1mcs0)
+#define WL_TX_POWER_20UL_CCK_FIRST OFFSETOF(txppr_t, b20in40_1x1dsss)
+#define WL_TX_POWER_20UL_OFDM_FIRST OFFSETOF(txppr_t, b20in40_1x1ofdm)
+#define WL_TX_POWER_20UL_S1x1_FIRST OFFSETOF(txppr_t, b20in40_1x1mcs0)
#define WL_TX_POWER_CCK_20U_CDD_S1x2_FIRST OFFSETOF(txppr_t, b20in40_1x2dsss)
#define WL_TX_POWER_20UL_OFDM_CDD_FIRST OFFSETOF(txppr_t, b20in40_1x2cdd_ofdm)
@@ -2358,7 +2494,7 @@ typedef struct txppr {
#define WL_TX_POWER_20UL_S2x2_FIRST OFFSETOF(txppr_t, b20in40_2x2sdm_mcs8)
#define WL_TX_POWER_CCK_20U_CDD_S1x3_FIRST OFFSETOF(txppr_t, b20in40_1x3dsss)
-#define WL_TX_POWER_20UL_OFDM_CDD_S1x3_FIRST OFFSETOF(txppr_t, b20in40_1x3cdd_ofdm)
+#define WL_TX_POWER_20UL_OFDM_CDD_S1x3_FIRST OFFSETOF(txppr_t, b20in40_1x3cdd_ofdm)
#define WL_TX_POWER_20UL_S1x3_FIRST OFFSETOF(txppr_t, b20in40_1x3cdd_mcs0)
#define WL_TX_POWER_20UL_STBC_S2x3_FIRST OFFSETOF(txppr_t, b20in40_2x3stbc_mcs0)
#define WL_TX_POWER_20UL_S2x3_FIRST OFFSETOF(txppr_t, b20in40_2x3sdm_mcs8)
@@ -2459,7 +2595,7 @@ typedef struct txppr {
#define WL_TX_POWER_MCS_32 OFFSETOF(txppr_t, mcs32) /* C_CHECK remove later */
-#define WL_TX_POWER_RATES sizeof(struct txppr)
+#define WL_TX_POWER_RATES sizeof(struct txppr)
/* sslpnphy specifics */
#define WL_TX_POWER_MCS20_SISO_FIRST_SSN WL_TX_POWER_MCS20_SISO_FIRST
@@ -2483,14 +2619,27 @@ typedef struct {
#define WL_TXPPR_VERSION 0
#define WL_TXPPR_LENGTH (sizeof(wl_txppr_t))
-#define WL_CLM_NUM_RATES 116 /* must be the same as CLM_NUMRATES */
#define TX_POWER_T_VERSION 43
/* Defines used with channel_bandwidth for curpower */
-#define WL_BW_20MHZ 0
-#define WL_BW_40MHZ 1
-#define WL_BW_80MHZ 2
+#define WL_BW_20MHZ 0
+#define WL_BW_40MHZ 1
+#define WL_BW_80MHZ 2
+/* tx_power_t.flags bits */
+#ifdef PPR_API
+#define WL_TX_POWER2_F_ENABLED 1
+#define WL_TX_POWER2_F_HW 2
+#define WL_TX_POWER2_F_MIMO 4
+#define WL_TX_POWER2_F_SISO 8
+#define WL_TX_POWER2_F_HT 0x10
+#else
+#define WL_TX_POWER_F_ENABLED 1
+#define WL_TX_POWER_F_HW 2
+#define WL_TX_POWER_F_MIMO 4
+#define WL_TX_POWER_F_SISO 8
+#define WL_TX_POWER_F_HT 0x10
+#endif
typedef struct {
uint32 flags;
chanspec_t chanspec; /* txpwr report for this channel */
@@ -2500,22 +2649,27 @@ typedef struct {
int8 antgain[2]; /* Ant gain for each band - from SROM */
uint8 rf_cores; /* count of RF Cores being reported */
uint8 est_Pout[4]; /* Latest tx power out estimate per RF chain */
- uint8 est_Pout_act[4]; /* Latest tx power out estimate per RF chain
- * without adjustment
- */
+ uint8 est_Pout_act[4]; /* Latest tx power out estimate per RF chain
+ * without adjustment
+ */
uint8 est_Pout_cck; /* Latest CCK tx power out estimate */
- uint8 tx_power_max[4]; /* Maximum target power among all rates */
- uint tx_power_max_rate_ind[4]; /* Index of the rate with the max target power */
+ uint8 tx_power_max[4]; /* Maximum target power among all rates */
+ uint tx_power_max_rate_ind[4]; /* Index of the rate with the max target power */
uint8 user_limit[WL_TX_POWER_RATES]; /* User limit */
int8 board_limit[WL_TX_POWER_RATES]; /* Max power board can support (SROM) */
int8 target[WL_TX_POWER_RATES]; /* Latest target power */
- int8 clm_limits[WL_CLM_NUM_RATES]; /* regulatory limits - 20, 40 or 80MHz */
- int8 clm_limits_subchan1[WL_CLM_NUM_RATES]; /* regulatory limits - 20in40 or 40in80 */
- int8 clm_limits_subchan2[WL_CLM_NUM_RATES]; /* regulatory limits - 20in80MHz */
- int8 sar; /* SAR limit for display by wl executable */
- int8 channel_bandwidth; /* 20, 40 or 80 MHz bandwidth? */
+ int8 clm_limits[WL_NUMRATES]; /* regulatory limits - 20, 40 or 80MHz */
+ int8 clm_limits_subchan1[WL_NUMRATES]; /* regulatory limits - 20in40 or 40in80 */
+ int8 clm_limits_subchan2[WL_NUMRATES]; /* regulatory limits - 20in80MHz */
+ int8 sar; /* SAR limit for display by wl executable */
+ int8 channel_bandwidth; /* 20, 40 or 80 MHz bandwidth? */
uint8 version; /* Version of the data format wlu <--> driver */
+ uint8 display_core; /* Displayed curpower core */
+#ifdef PPR_API
+} tx_power_new_t;
+#else
} tx_power_t;
+#endif
typedef struct tx_inst_power {
uint8 txpwr_est_Pout[2]; /* Latest estimate for 2.4 and 5 Ghz */
@@ -2602,7 +2756,6 @@ typedef struct wl_txchain_pwr_offsets {
#define WL_BTC_FLAG_ECI (1 << 6)
#define WL_BTC_FLAG_LIGHT (1 << 7)
#define WL_BTC_FLAG_PARALLEL (1 << 8)
-#endif /* !defined(LINUX_POSTMOGRIFY_REMOVAL) */
/* Message levels */
#define WL_ERROR_VAL 0x00000001
@@ -2641,7 +2794,7 @@ typedef struct wl_txchain_pwr_offsets {
/* wl_msg_level is full. For new bits take the next one and AND with
* wl_msg_level2 in wl_dbg.h
*/
-#define WL_DPT_VAL 0x00000001
+#define WL_DPT_VAL 0x00000001
#define WL_SCAN_VAL 0x00000002
#define WL_WOWL_VAL 0x00000004
#define WL_COEX_VAL 0x00000008
@@ -2657,6 +2810,9 @@ typedef struct wl_txchain_pwr_offsets {
#define WL_MCNX_VAL 0x00002000
#define WL_PROT_VAL 0x00004000
#define WL_PSTA_VAL 0x00008000
+#define WL_TBTT_VAL 0x00010000
+#define WL_NIC_VAL 0x00020000
+#define WL_PWRSEL_VAL 0x00040000
/* use top-bit for WL_TIME_STAMP_VAL because this is a modifier
* rather than a message-type of its own
*/
@@ -2686,9 +2842,9 @@ typedef struct wl_txchain_pwr_offsets {
#define WL_LED_BLINKFAST 17 /* blink fast */
#define WL_LED_BLINKCUSTOM 18 /* blink custom */
#define WL_LED_BLINKPERIODIC 19 /* blink periodic (custom 1000ms / off 400ms) */
-#define WL_LED_ASSOC_WITH_SEC 20 /* when connected with security */
+#define WL_LED_ASSOC_WITH_SEC 20 /* when connected with security */
/* keep on for 300 sec */
-#define WL_LED_START_OFF 21 /* off upon boot, could be turned on later */
+#define WL_LED_START_OFF 21 /* off upon boot, could be turned on later */
#define WL_LED_NUMBEHAVIOR 22
/* led behavior numeric value format */
@@ -2697,7 +2853,9 @@ typedef struct wl_txchain_pwr_offsets {
/* maximum channels returned by the get valid channels iovar */
#define WL_NUMCHANNELS 64
-#define WL_NUMCHANSPECS 100
+
+/* max number of chanspecs (used by the iovar to calc. buf space) */
+#define WL_NUMCHANSPECS 110
/* WDS link local endpoint WPA role */
#define WL_WDS_WPA_ROLE_AUTH 0 /* authenticator */
@@ -2764,6 +2922,7 @@ typedef struct wl_txchain_pwr_offsets {
struct tsinfo_arg {
uint8 octets[3];
};
+#endif /* LINUX_POSTMOGRIFY_REMOVAL */
#define NFIFO 6 /* # tx/rx fifopairs */
@@ -2958,7 +3117,7 @@ typedef struct {
uint32 rx36mbps; /* packets rx at 36Mbps */
uint32 rx48mbps; /* packets rx at 48Mbps */
uint32 rx54mbps; /* packets rx at 54Mbps */
- uint32 rx108mbps; /* packets rx at 108mbps */
+ uint32 rx108mbps; /* packets rx at 108mbps */
uint32 rx162mbps; /* packets rx at 162mbps */
uint32 rx216mbps; /* packets rx at 216 mbps */
uint32 rx270mbps; /* packets rx at 270 mbps */
@@ -3010,6 +3169,7 @@ typedef struct {
uint32 cso_passthrough; /* hw cso required but passthrough */
} wl_cnt_t;
+#ifndef LINUX_POSTMOGRIFY_REMOVAL
typedef struct {
uint16 version; /* see definition of WL_CNT_T_VERSION */
uint16 length; /* length of entire structure */
@@ -3239,8 +3399,6 @@ typedef struct {
uint32 rxmpdu_stbc; /* count for stbc received */
} wl_cnt_ver_six_t;
-
-#ifndef LINUX_POSTMOGRIFY_REMOVAL
#define WL_DELTA_STATS_T_VERSION 1 /* current version of wl_delta_stats_t struct */
typedef struct {
@@ -3270,7 +3428,7 @@ typedef struct {
uint32 rx36mbps; /* packets rx at 36Mbps */
uint32 rx48mbps; /* packets rx at 48Mbps */
uint32 rx54mbps; /* packets rx at 54Mbps */
- uint32 rx108mbps; /* packets rx at 108mbps */
+ uint32 rx108mbps; /* packets rx at 108mbps */
uint32 rx162mbps; /* packets rx at 162mbps */
uint32 rx216mbps; /* packets rx at 216 mbps */
uint32 rx270mbps; /* packets rx at 270 mbps */
@@ -3304,6 +3462,7 @@ typedef struct {
} wl_wme_cnt_t;
+#ifndef LINUX_POSTMOGRIFY_REMOVAL
struct wl_msglevel2 {
uint32 low;
uint32 high;
@@ -3322,7 +3481,6 @@ typedef struct wl_mkeep_alive_pkt {
#define WL_MKEEP_ALIVE_FIXED_LEN OFFSETOF(wl_mkeep_alive_pkt_t, data)
#define WL_MKEEP_ALIVE_PRECISION 500
-#ifndef LINUX_POSTMOGRIFY_REMOVAL
#ifdef WLBA
#define WLC_BA_CNT_VERSION 1 /* current version of wlc_ba_cnt_t */
@@ -3392,8 +3550,8 @@ struct ampdu_retry_tid {
#define DPT_PATHSEL_APPATH 2 /* always use AP path */
/* different ops for deny list */
-#define DPT_DENY_LIST_ADD 1 /* add to dpt deny list */
-#define DPT_DENY_LIST_REMOVE 2 /* remove from dpt deny list */
+#define DPT_DENY_LIST_ADD 1 /* add to dpt deny list */
+#define DPT_DENY_LIST_REMOVE 2 /* remove from dpt deny list */
/* different ops for manual end point */
#define DPT_MANUAL_EP_CREATE 1 /* create manual dpt endpoint */
@@ -3464,6 +3622,18 @@ typedef struct tdls_iovar {
chanspec_t chanspec;
uint32 pad; /* future */
} tdls_iovar_t;
+
+/* modes */
+#define TDLS_WFD_IE_TX 0
+#define TDLS_WFD_IE_RX 1
+#define TDLS_WFD_IE_SIZE 255
+/* structure for tdls wfd ie */
+typedef struct tdls_wfd_ie_iovar {
+ struct ether_addr ea; /* Station address */
+ uint8 mode;
+ uint8 length;
+ uint8 data[TDLS_WFD_IE_SIZE];
+} tdls_wfd_ie_iovar_t;
#endif /* WLTDLS */
/* structure for addts/delts arguments */
@@ -3513,6 +3683,7 @@ typedef struct wme_max_bandwidth {
#define WL_WOWL_KEEPALIVE_MAX_PACKET_SIZE 80
#define WLC_WOWL_MAX_KEEPALIVE 2
+
/* define for flag */
#define TSPEC_PENDING 0 /* TSPEC pending */
#define TSPEC_ACCEPTED 1 /* TSPEC accepted */
@@ -3520,6 +3691,13 @@ typedef struct wme_max_bandwidth {
#define TSPEC_UNKNOWN 3 /* TSPEC unknown */
#define TSPEC_STATUS_MASK 7 /* TSPEC status mask */
+#ifdef BCMCCX
+/* "wlan_reason" iovar interface */
+#define WL_WLAN_ASSOC_REASON_NORMAL_NETWORK 0 /* normal WLAN network setup */
+#define WL_WLAN_ASSOC_REASON_ROAM_FROM_CELLULAR_NETWORK 1 /* roam from Cellular network */
+#define WL_WLAN_ASSOC_REASON_ROAM_FROM_LAN 2 /* roam from LAN */
+#define WL_WLAN_ASSOC_REASON_MAX 2 /* largest value allowed */
+#endif /* BCMCCX */
/* Software feature flag defines used by wlfeatureflag */
#ifdef WLAFTERBURNER
@@ -3545,7 +3723,6 @@ typedef struct wl_chan_switch {
chanspec_t chspec; /* chanspec */
uint8 reg; /* regulatory class */
} wl_chan_switch_t;
-#endif /* LINUX_POSTMOGRIFY_REMOVAL */
/* Roaming trigger definitions for WLC_SET_ROAM_TRIGGER.
*
@@ -3562,6 +3739,8 @@ typedef struct wl_chan_switch {
#define WLC_ROAM_TRIGGER_AUTO 3 /* auto-detect environment */
#define WLC_ROAM_TRIGGER_MAX_VALUE 3 /* max. valid value */
+#define WLC_ROAM_NEVER_ROAM_TRIGGER (-100) /* Avoid Roaming by setting a large value */
+
/* Preferred Network Offload (PNO, formerly PFN) defines */
#define WPA_AUTH_PFN_ANY 0xffffffff /* for PFN, match only ssid */
@@ -3590,6 +3769,8 @@ enum {
#define ENABLE_BD_SCAN_BIT 5
#define ENABLE_ADAPTSCAN_BIT 6
#define IMMEDIATE_EVENT_BIT 8
+#define SUPPRESS_SSID_BIT 9
+#define ENABLE_NET_OFFLOAD_BIT 10
#define SORT_CRITERIA_MASK 0x0001
#define AUTO_NET_SWITCH_MASK 0x0002
@@ -3600,6 +3781,8 @@ enum {
#define ENABLE_BD_SCAN_MASK 0x0020
#define ENABLE_ADAPTSCAN_MASK 0x00c0
#define IMMEDIATE_EVENT_MASK 0x0100
+#define SUPPRESS_SSID_MASK 0x0200
+#define ENABLE_NET_OFFLOAD_MASK 0x0400
#define PFN_VERSION 2
#define PFN_SCANRESULT_VERSION 1
@@ -3658,7 +3841,7 @@ typedef struct wl_pfn_param {
} wl_pfn_param_t;
typedef struct wl_pfn_bssid {
- struct ether_addr macaddr;
+ struct ether_addr macaddr;
/* Bit4: suppress_lost, Bit3: suppress_found */
uint16 flags;
} wl_pfn_bssid_t;
@@ -3670,13 +3853,13 @@ typedef struct wl_pfn_cfg {
int32 channel_num;
uint16 channel_list[WL_NUMCHANNELS];
} wl_pfn_cfg_t;
-#define WL_PFN_REPORT_ALLNET 0
-#define WL_PFN_REPORT_SSIDNET 1
-#define WL_PFN_REPORT_BSSIDNET 2
+#define WL_PFN_REPORT_ALLNET 0
+#define WL_PFN_REPORT_SSIDNET 1
+#define WL_PFN_REPORT_BSSIDNET 2
typedef struct wl_pfn {
wlc_ssid_t ssid; /* ssid name and its length */
- int32 bss_type; /* IBSS or infrastructure */
+ int32 flags; /* bit2: hidden */
int32 infra; /* BSS Vs IBSS */
int32 auth; /* Open Vs Closed */
int32 wpa_auth; /* WPA type */
@@ -3688,10 +3871,13 @@ typedef struct wl_pfn {
#define PNO_SCAN_MIN_FW_SEC 10 /* min time scan time in SEC */
#define WL_PFN_HIDDEN_MASK 0x4
+#endif /* LINUX_POSTMOGRIFY_REMOVAL */
+
/* TCP Checksum Offload defines */
#define TOE_TX_CSUM_OL 0x00000001
#define TOE_RX_CSUM_OL 0x00000002
+#ifndef LINUX_POSTMOGRIFY_REMOVAL
/* TCP Checksum Offload error injection for testing */
#define TOE_ERRTEST_TX_CSUM 0x00000001
#define TOE_ERRTEST_RX_CSUM 0x00000002
@@ -3872,8 +4058,8 @@ typedef struct wl_seq_cmd_ioctl {
#define WL_PKTENG_PER_TX_START 0x01
#define WL_PKTENG_PER_TX_STOP 0x02
#define WL_PKTENG_PER_RX_START 0x04
-#define WL_PKTENG_PER_RX_WITH_ACK_START 0x05
-#define WL_PKTENG_PER_TX_WITH_ACK_START 0x06
+#define WL_PKTENG_PER_RX_WITH_ACK_START 0x05
+#define WL_PKTENG_PER_TX_WITH_ACK_START 0x06
#define WL_PKTENG_PER_RX_STOP 0x08
#define WL_PKTENG_PER_MASK 0xff
@@ -3900,27 +4086,29 @@ typedef struct wl_pkteng_stats {
uint16 rxpktcnt[NUM_80211_RATES+1];
} wl_pkteng_stats_t;
-#define WL_WOWL_MAGIC (1 << 0) /* Wakeup on Magic packet */
-#define WL_WOWL_NET (1 << 1) /* Wakeup on Netpattern */
-#define WL_WOWL_DIS (1 << 2) /* Wakeup on loss-of-link due to Disassoc/Deauth */
-#define WL_WOWL_RETR (1 << 3) /* Wakeup on retrograde TSF */
-#define WL_WOWL_BCN (1 << 4) /* Wakeup on loss of beacon */
-#define WL_WOWL_TST (1 << 5) /* Wakeup after test */
-#define WL_WOWL_M1 (1 << 6) /* Wakeup after PTK refresh */
-#define WL_WOWL_EAPID (1 << 7) /* Wakeup after receipt of EAP-Identity Req */
-#define WL_WOWL_PME_GPIO (1 << 8) /* Wakeind via PME(0) or GPIO(1) */
+
+#define WL_WOWL_MAGIC (1 << 0) /* Wakeup on Magic packet */
+#define WL_WOWL_NET (1 << 1) /* Wakeup on Netpattern */
+#define WL_WOWL_DIS (1 << 2) /* Wakeup on loss-of-link due to Disassoc/Deauth */
+#define WL_WOWL_RETR (1 << 3) /* Wakeup on retrograde TSF */
+#define WL_WOWL_BCN (1 << 4) /* Wakeup on loss of beacon */
+#define WL_WOWL_TST (1 << 5) /* Wakeup after test */
+#define WL_WOWL_M1 (1 << 6) /* Wakeup after PTK refresh */
+#define WL_WOWL_EAPID (1 << 7) /* Wakeup after receipt of EAP-Identity Req */
+#define WL_WOWL_PME_GPIO (1 << 8) /* Wakeind via PME(0) or GPIO(1) */
#define WL_WOWL_NEEDTKIP1 (1 << 9) /* need tkip phase 1 key to be updated by the driver */
#define WL_WOWL_GTK_FAILURE (1 << 10) /* enable wakeup if GTK fails */
#define WL_WOWL_EXTMAGPAT (1 << 11) /* support extended magic packets */
#define WL_WOWL_ARPOFFLOAD (1 << 12) /* support ARP/NS/keepalive offloading */
#define WL_WOWL_WPA2 (1 << 13) /* read protocol version for EAPOL frames */
-#define WL_WOWL_KEYROT (1 << 14) /* If the bit is set, use key rotaton */
-#define WL_WOWL_BCAST (1 << 15) /* If the bit is set, frm received was bcast frame */
+#define WL_WOWL_KEYROT (1 << 14) /* If the bit is set, use key rotaton */
+#define WL_WOWL_BCAST (1 << 15) /* If the bit is set, frm received was bcast frame */
-#define MAGIC_PKT_MINLEN 102 /* Magic pkt min length is 6 * 0xFF + 16 * ETHER_ADDR_LEN */
+#define MAGIC_PKT_MINLEN 102 /* Magic pkt min length is 6 * 0xFF + 16 * ETHER_ADDR_LEN */
#define WOWL_PATTEN_TYPE_ARP (1 << 0) /* ARP offload Pattern */
#define WOWL_PATTEN_TYPE_NA (1 << 1) /* NA offload Pattern */
+
typedef struct {
uint32 masksize; /* Size of the mask in #of bytes */
uint32 offset; /* Offset to start looking for the packet in # of bytes */
@@ -3943,6 +4131,7 @@ typedef struct {
uint16 ucode_wakeind; /* What wakeup-event indication was set by ucode */
} wl_wowl_wakeind_t;
+
/* per AC rate control related data structure */
typedef struct wl_txrate_class {
uint8 init_rate;
@@ -3950,6 +4139,8 @@ typedef struct wl_txrate_class {
uint8 max_rate;
} wl_txrate_class_t;
+
+
/* Overlap BSS Scan parameters default, minimum, maximum */
#define WLC_OBSS_SCAN_PASSIVE_DWELL_DEFAULT 20 /* unit TU */
#define WLC_OBSS_SCAN_PASSIVE_DWELL_MIN 5 /* unit TU */
@@ -4203,11 +4394,16 @@ typedef struct {
#define OVERLAY_DOWNLOAD_CHUNKSIZE 1024
#endif /* DONGLEOVERLAYS */
+#endif /* LINUX_POSTMOGRIFY_REMOVAL */
+
/* no default structure packing */
#include <packed_section_end.h>
/* require strict packing */
#include <packed_section_start.h>
+
+#ifndef LINUX_POSTMOGRIFY_REMOVAL
+
/* Structures and constants used for "vndr_ie" IOVar interface */
#define VNDR_IE_CMD_LEN 4 /* length of the set command string:
* "add", "del" (+ NUL)
@@ -4297,9 +4493,12 @@ typedef BWL_PRE_PACKED_STRUCT struct {
} BWL_POST_PACKED_STRUCT txfailinfo_t;
#endif /* WLMEDIA_TXFAILEVENT */
+#endif /* LINUX_POSTMOGRIFY_REMOVAL */
+
/* no strict structure packing */
#include <packed_section_end.h>
+#ifndef LINUX_POSTMOGRIFY_REMOVAL
/* Global ASSERT Logging */
#define ASSERTLOG_CUR_VER 0x0100
#define MAX_ASSRTSTR_LEN 64
@@ -4324,14 +4523,14 @@ typedef struct assertlog_results {
#define IV_LEN 16
struct wapi_sta_msg_t
{
- uint16 msg_type;
- uint16 datalen;
- uint8 vap_mac[6];
- uint8 reserve_data1[2];
- uint8 sta_mac[6];
- uint8 reserve_data2[2];
- uint8 gsn[IV_LEN];
- uint8 wie[256];
+ uint16 msg_type;
+ uint16 datalen;
+ uint8 vap_mac[6];
+ uint8 reserve_data1[2];
+ uint8 sta_mac[6];
+ uint8 reserve_data2[2];
+ uint8 gsn[IV_LEN];
+ uint8 wie[256];
};
#endif /* BCMWAPI_WAI */
@@ -4340,14 +4539,14 @@ struct wapi_sta_msg_t
/* chanim mode */
#define CHANIM_DISABLE 0 /* disabled */
#define CHANIM_DETECT 1 /* detection only */
-#define CHANIM_EXT 2 /* external state machine */
+#define CHANIM_EXT 2 /* external state machine */
#define CHANIM_ACT 3 /* full internal state machine, detect + act */
#define CHANIM_MODE_MAX 4
/* define for apcs reason code */
#define APCS_INIT 0
-#define APCS_IOCTL 1
-#define APCS_CHANIM 2
+#define APCS_IOCTL 1
+#define APCS_CHANIM 2
#define APCS_CSTIMER 3
#define APCS_BTA 4
@@ -4386,7 +4585,7 @@ typedef struct {
typedef struct chanim_stats {
uint32 glitchcnt; /* normalized as per second count */
uint32 badplcp; /* normalized as per second count */
- uint8 ccastats[CCASTATS_MAX]; /* normalized as 0-255 */
+ uint8 ccastats[CCASTATS_MAX]; /* normalized as 0-255 */
int8 bgnoise; /* background noise level (in dBm) */
chanspec_t chanspec;
uint32 timestamp;
@@ -4422,11 +4621,13 @@ typedef struct {
#define AP_TPC_AP_BSS_PWR 3 /* Both AP and BSS power control */
#define AP_TPC_MAX_LINK_MARGIN 127
+/* ap tpc modes */
#define AP_TPC_OFF 0
#define AP_TPC_BSS_PWR 1 /* BSS power control */
#define AP_TPC_AP_PWR 2 /* AP power control */
#define AP_TPC_AP_BSS_PWR 3 /* Both AP and BSS power control */
#define AP_TPC_MAX_LINK_MARGIN 127
+
/* structure/defines for selective mgmt frame (smf) stats support */
#define SMFS_VERSION 1
@@ -4456,7 +4657,7 @@ enum {
/* reuse two number in the sc/rc space */
#define SMFS_CODE_MALFORMED 0xFFFE
-#define SMFS_CODE_IGNORED 0xFFFD
+#define SMFS_CODE_IGNORED 0xFFFD
typedef enum smfs_type {
SMFS_TYPE_AUTH,
@@ -4672,6 +4873,13 @@ typedef struct wl_nic_ifq {
uint bsscfgidx;
char ifname[BCM_MSG_IFNAME_MAX];
} wl_nic_ifq_t;
+
+/* data mode */
+/* nic_dm iovar */
+typedef struct wl_nic_dm {
+ uint8 enab;
+ chanspec_t chspec;
+} wl_nic_dm_t;
#endif /* WLNIC */
/* RFAWARE def */
@@ -4823,6 +5031,7 @@ typedef struct wl_mempool_stats {
} wl_mempool_stats_t;
+/* D0 Coalescing */
#define IPV4_ARP_FILTER 0x0001
#define IPV4_NETBT_FILTER 0x0002
#define IPV4_LLMNR_FILTER 0x0004
@@ -4832,6 +5041,7 @@ typedef struct wl_mempool_stats {
#define IPV6_LLMNR_FILTER 0x0400
#define IPV6_SSDP_FILTER 0x0800
#define IPV6_WSD_FILTER 0x1000
+
/* Network Offload Engine */
#define NWOE_OL_ENABLE 0x00000001
@@ -4841,4 +5051,103 @@ typedef struct {
uint32 ipaddr_gateway;
} nwoe_ifconfig_t;
+/*
+ * Traffic management structures/defines.
+ */
+
+/* Traffic management bandwidth parameters */
+#define TRF_MGMT_MAX_PRIORITIES 3
+
+#define TRF_MGMT_FLAG_ADD_DSCP 0x0001 /* Add DSCP to IP TOS field */
+#define TRF_MGMT_FLAG_DISABLE_SHAPING 0x0002 /* Only support traffic clasification */
+#define TRF_MGMT_FLAG_DISABLE_PRIORITY_TAGGING 0x0004 /* Don't override packet's priority */
+
+/* Traffic management priority classes */
+typedef enum trf_mgmt_priority_class {
+ trf_mgmt_priority_low = 0, /* Maps to 802.1p BO */
+ trf_mgmt_priority_medium = 1, /* Maps to 802.1p BE */
+ trf_mgmt_priority_high = 2, /* Maps to 802.1p VI */
+ trf_mgmt_priority_invalid = (trf_mgmt_priority_high + 1)
+} trf_mgmt_priority_class_t;
+
+/* Traffic management configuration parameters */
+typedef struct trf_mgmt_config {
+ uint32 trf_mgmt_enabled; /* 0 - disabled, 1 - enabled */
+ uint32 flags; /* See TRF_MGMT_FLAG_xxx defines */
+ uint32 host_ip_addr; /* My IP address to determine subnet */
+ uint32 host_subnet_mask; /* My subnet mask */
+ uint32 downlink_bandwidth; /* In units of kbps */
+ uint32 uplink_bandwidth; /* In units of kbps */
+ uint32 min_tx_bandwidth[TRF_MGMT_MAX_PRIORITIES]; /* Minimum guaranteed tx bandwidth */
+ uint32 min_rx_bandwidth[TRF_MGMT_MAX_PRIORITIES]; /* Minimum guaranteed rx bandwidth */
+} trf_mgmt_config_t;
+
+/* Traffic management filter */
+typedef struct trf_mgmt_filter {
+ struct ether_addr dst_ether_addr; /* His L2 address */
+ uint32 dst_ip_addr; /* His IP address */
+ uint16 dst_port; /* His L4 port */
+ uint16 src_port; /* My L4 port */
+ uint16 prot; /* L4 protocol (only TCP or UDP) */
+ uint16 flags; /* TBD. For now, this must be zero. */
+ trf_mgmt_priority_class_t priority; /* Priority for filtered packets */
+} trf_mgmt_filter_t;
+
+/* Traffic management filter list (variable length) */
+typedef struct trf_mgmt_filter_list {
+ uint32 num_filters;
+ trf_mgmt_filter_t filter[1];
+} trf_mgmt_filter_list_t;
+
+/* Traffic management global info used for all queues */
+typedef struct trf_mgmt_global_info {
+ uint32 maximum_bytes_per_second;
+ uint32 maximum_bytes_per_sampling_period;
+ uint32 total_bytes_consumed_per_second;
+ uint32 total_bytes_consumed_per_sampling_period;
+ uint32 total_unused_bytes_per_sampling_period;
+} trf_mgmt_global_info_t;
+
+/* Traffic management shaping info per priority queue */
+typedef struct trf_mgmt_shaping_info {
+ uint32 gauranteed_bandwidth_percentage;
+ uint32 guaranteed_bytes_per_second;
+ uint32 guaranteed_bytes_per_sampling_period;
+ uint32 num_bytes_produced_per_second;
+ uint32 num_bytes_consumed_per_second;
+ uint32 num_queued_packets; /* Number of packets in queue */
+ uint32 num_queued_bytes; /* Number of bytes in queue */
+} trf_mgmt_shaping_info_t;
+
+/* Traffic management shaping info array */
+typedef struct trf_mgmt_shaping_info_array {
+ trf_mgmt_global_info_t tx_global_shaping_info;
+ trf_mgmt_shaping_info_t tx_queue_shaping_info[TRF_MGMT_MAX_PRIORITIES];
+ trf_mgmt_global_info_t rx_global_shaping_info;
+ trf_mgmt_shaping_info_t rx_queue_shaping_info[TRF_MGMT_MAX_PRIORITIES];
+} trf_mgmt_shaping_info_array_t;
+
+
+/* Traffic management statistical counters */
+typedef struct trf_mgmt_stats {
+ uint32 num_processed_packets; /* Number of packets processed */
+ uint32 num_processed_bytes; /* Number of bytes processed */
+ uint32 num_discarded_packets; /* Number of packets discarded from queue */
+} trf_mgmt_stats_t;
+
+/* Traffic management statisics array */
+typedef struct trf_mgmt_stats_array {
+ trf_mgmt_stats_t tx_queue_stats[TRF_MGMT_MAX_PRIORITIES];
+ trf_mgmt_stats_t rx_queue_stats[TRF_MGMT_MAX_PRIORITIES];
+} trf_mgmt_stats_array_t;
+
+typedef struct powersel_params {
+ /* LPC Params exposed via IOVAR */
+ int32 tp_ratio_thresh; /* Throughput ratio threshold */
+ uint8 rate_stab_thresh; /* Thresh for rate stability based on nupd */
+ uint8 pwr_stab_thresh; /* Number of successes before power step down */
+ uint8 pwr_sel_exp_time; /* Time lapse for expiry of database */
+} powersel_params_t;
+
+#endif /* LINUX_POSTMOGRIFY_REMOVAL */
#endif /* _wlioctl_h_ */
diff --git a/drivers/net/wireless/bcmdhd/src/shared/linux_osl.c b/drivers/net/wireless/bcmdhd/linux_osl.c
index 9c9d9a1..ddb8372 100644
--- a/drivers/net/wireless/bcmdhd/src/shared/linux_osl.c
+++ b/drivers/net/wireless/bcmdhd/linux_osl.c
@@ -2,13 +2,13 @@
* Linux OS Independent Layer
*
* Copyright (C) 1999-2012, Broadcom Corporation
- *
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,12 +16,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: linux_osl.c 309193 2012-01-19 00:03:57Z $
+ * $Id: linux_osl.c 350283 2012-08-12 07:47:25Z $
*/
#define LINUX_PORT
@@ -42,18 +42,16 @@
#include <linux/fs.h>
-#define PCI_CFG_RETRY 10
+#define PCI_CFG_RETRY 10
-#define OS_HANDLE_MAGIC 0x1234abcd
-#define BCM_MEM_FILENAME_LEN 24
+#define OS_HANDLE_MAGIC 0x1234abcd
+#define BCM_MEM_FILENAME_LEN 24
#ifdef CONFIG_DHD_USE_STATIC_BUF
-#ifdef CUSTOMER_HW_SAMSUNG
#define DHD_SKB_HDRSIZE 336
#define DHD_SKB_1PAGE_BUFSIZE ((PAGE_SIZE*1)-DHD_SKB_HDRSIZE)
#define DHD_SKB_2PAGE_BUFSIZE ((PAGE_SIZE*2)-DHD_SKB_HDRSIZE)
#define DHD_SKB_4PAGE_BUFSIZE ((PAGE_SIZE*4)-DHD_SKB_HDRSIZE)
-#endif /* CUSTOMER_HW_SAMSUNG */
#define STATIC_BUF_MAX_NUM 16
#define STATIC_BUF_SIZE (PAGE_SIZE*2)
@@ -68,30 +66,33 @@ typedef struct bcm_static_buf {
static bcm_static_buf_t *bcm_static_buf = 0;
#define STATIC_PKT_MAX_NUM 8
+#if defined(ENHANCED_STATIC_BUF)
+#define STATIC_PKT_4PAGE_NUM 1
+#define DHD_SKB_MAX_BUFSIZE DHD_SKB_4PAGE_BUFSIZE
+#else
+#define STATIC_PKT_4PAGE_NUM 0
+#define DHD_SKB_MAX_BUFSIZE DHD_SKB_2PAGE_BUFSIZE
+#endif
typedef struct bcm_static_pkt {
struct sk_buff *skb_4k[STATIC_PKT_MAX_NUM];
struct sk_buff *skb_8k[STATIC_PKT_MAX_NUM];
-#ifdef CUSTOMER_HW_SAMSUNG
+#ifdef ENHANCED_STATIC_BUF
struct sk_buff *skb_16k;
#endif
struct semaphore osl_pkt_sem;
-#ifdef CUSTOMER_HW_SAMSUNG
- unsigned char pkt_use[STATIC_PKT_MAX_NUM * 2 + 1];
-#else
- unsigned char pkt_use[STATIC_PKT_MAX_NUM * 2];
-#endif
+ unsigned char pkt_use[STATIC_PKT_MAX_NUM * 2 + STATIC_PKT_4PAGE_NUM];
} bcm_static_pkt_t;
static bcm_static_pkt_t *bcm_static_skb = 0;
-#endif /* CONFIG_DHD_USE_STATIC_BUF */
+#endif
typedef struct bcm_mem_link {
struct bcm_mem_link *prev;
struct bcm_mem_link *next;
uint size;
int line;
- void *osh;
+ void *osh;
char file[BCM_MEM_FILENAME_LEN];
} bcm_mem_link_t;
@@ -99,7 +100,7 @@ struct osl_info {
osl_pubinfo_t pub;
#ifdef CTFPOOL
ctfpool_t *ctfpool;
-#endif
+#endif
uint magic;
void *pdev;
atomic_t malloced;
@@ -110,52 +111,57 @@ struct osl_info {
spinlock_t pktalloc_lock;
};
+
+
+
uint32 g_assert_type = FALSE;
static int16 linuxbcmerrormap[] =
-{ 0,
- -EINVAL,
- -EINVAL,
- -EINVAL,
- -EINVAL,
- -EINVAL,
- -EINVAL,
- -EINVAL,
- -EINVAL,
- -EINVAL,
- -EINVAL,
- -EINVAL,
- -EINVAL,
- -EINVAL,
- -E2BIG,
- -E2BIG,
- -EBUSY,
- -EINVAL,
- -EINVAL,
- -EINVAL,
- -EINVAL,
- -EFAULT,
- -ENOMEM,
- -EOPNOTSUPP,
- -EMSGSIZE,
- -EINVAL,
- -EPERM,
- -ENOMEM,
- -EINVAL,
- -ERANGE,
- -EINVAL,
- -EINVAL,
- -EINVAL,
- -EINVAL,
- -EINVAL,
- -EIO,
- -ENODEV,
- -EINVAL,
- -EIO,
- -EIO,
- -ENODEV,
- -EINVAL,
- -ENODATA,
+{ 0,
+ -EINVAL,
+ -EINVAL,
+ -EINVAL,
+ -EINVAL,
+ -EINVAL,
+ -EINVAL,
+ -EINVAL,
+ -EINVAL,
+ -EINVAL,
+ -EINVAL,
+ -EINVAL,
+ -EINVAL,
+ -EINVAL,
+ -E2BIG,
+ -E2BIG,
+ -EBUSY,
+ -EINVAL,
+ -EINVAL,
+ -EINVAL,
+ -EINVAL,
+ -EFAULT,
+ -ENOMEM,
+ -EOPNOTSUPP,
+ -EMSGSIZE,
+ -EINVAL,
+ -EPERM,
+ -ENOMEM,
+ -EINVAL,
+ -ERANGE,
+ -EINVAL,
+ -EINVAL,
+ -EINVAL,
+ -EINVAL,
+ -EINVAL,
+ -EIO,
+ -ENODEV,
+ -EINVAL,
+ -EIO,
+ -EIO,
+ -ENODEV,
+ -EINVAL,
+ -ENODATA,
+
+
#if BCME_LAST != -42
#error "You need to add a OS error translation in the linuxbcmerrormap \
@@ -172,6 +178,7 @@ osl_error(int bcmerror)
else if (bcmerror < BCME_LAST)
bcmerror = BCME_ERROR;
+
return linuxbcmerrormap[-bcmerror];
}
@@ -181,12 +188,20 @@ osl_t *
osl_attach(void *pdev, uint bustype, bool pkttag)
{
osl_t *osh;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25))
+ gfp_t flags;
+ flags = (in_atomic()) ? GFP_ATOMIC : GFP_KERNEL;
+ osh = kmalloc(sizeof(osl_t), flags);
+#else
osh = kmalloc(sizeof(osl_t), GFP_ATOMIC);
+#endif
+
ASSERT(osh);
bzero(osh, sizeof(osl_t));
+
ASSERT(ABS(BCME_LAST) == (ARRAYSIZE(linuxbcmerrormap) - 1));
osh->magic = OS_HANDLE_MAGIC;
@@ -237,21 +252,14 @@ osl_attach(void *pdev, uint bustype, bool pkttag)
bcm_static_skb = (bcm_static_pkt_t *)((char *)bcm_static_buf + 2048);
skb_buff_ptr = dhd_os_prealloc(osh, 4, 0);
-#ifdef CUSTOMER_HW_SAMSUNG
- bcopy(skb_buff_ptr, bcm_static_skb,
- sizeof(struct sk_buff *)*(STATIC_PKT_MAX_NUM * 2 + 1));
- for (i = 0; i < (STATIC_PKT_MAX_NUM * 2 + 1); i++)
+ bcopy(skb_buff_ptr, bcm_static_skb, sizeof(struct sk_buff *)*
+ (STATIC_PKT_MAX_NUM * 2 + STATIC_PKT_4PAGE_NUM));
+ for (i = 0; i < (STATIC_PKT_MAX_NUM * 2 + STATIC_PKT_4PAGE_NUM); i++)
bcm_static_skb->pkt_use[i] = 0;
-#else
- bcopy(skb_buff_ptr, bcm_static_skb,
- sizeof(struct sk_buff *)*16);
- for (i = 0; i < STATIC_PKT_MAX_NUM * 2; i++)
- bcm_static_skb->pkt_use[i] = 0;
-#endif /* CUSTOMER_HW_SAMSUNG */
sema_init(&bcm_static_skb->osl_pkt_sem, 1);
}
-#endif /* CONFIG_DHD_USE_STATIC_BUF */
+#endif
spin_lock_init(&(osh->pktalloc_lock));
@@ -280,7 +288,7 @@ osl_detach(osl_t *osh)
static struct sk_buff *osl_alloc_skb(unsigned int len)
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)
- gfp_t flags = GFP_ATOMIC;
+ gfp_t flags = (in_atomic()) ? GFP_ATOMIC : GFP_KERNEL;
return __dev_alloc_skb(len, flags);
#else
@@ -296,7 +304,7 @@ static struct sk_buff *osl_alloc_skb(unsigned int len)
#else
#define CTFPOOL_LOCK(ctfpool, flags) spin_lock_bh(&(ctfpool)->lock)
#define CTFPOOL_UNLOCK(ctfpool, flags) spin_unlock_bh(&(ctfpool)->lock)
-#endif
+#endif
void *
osl_ctfpool_add(osl_t *osh)
@@ -304,7 +312,7 @@ osl_ctfpool_add(osl_t *osh)
struct sk_buff *skb;
#ifdef CTFPOOL_SPINLOCK
unsigned long flags;
-#endif
+#endif
if ((osh == NULL) || (osh->ctfpool == NULL))
return NULL;
@@ -312,11 +320,13 @@ osl_ctfpool_add(osl_t *osh)
CTFPOOL_LOCK(osh->ctfpool, flags);
ASSERT(osh->ctfpool->curr_obj <= osh->ctfpool->max_obj);
+
if (osh->ctfpool->curr_obj == osh->ctfpool->max_obj) {
CTFPOOL_UNLOCK(osh->ctfpool, flags);
return NULL;
}
+
skb = osl_alloc_skb(osh->ctfpool->obj_size);
if (skb == NULL) {
printf("%s: skb alloc of len %d failed\n", __FUNCTION__,
@@ -325,13 +335,16 @@ osl_ctfpool_add(osl_t *osh)
return NULL;
}
+
skb->next = (struct sk_buff *)osh->ctfpool->head;
osh->ctfpool->head = skb;
osh->ctfpool->fast_frees++;
osh->ctfpool->curr_obj++;
+
CTFPOOLPTR(osh, skb) = (void *)osh->ctfpool;
+
PKTFAST(osh, skb) = FASTBUF;
CTFPOOL_UNLOCK(osh->ctfpool, flags);
@@ -339,12 +352,14 @@ osl_ctfpool_add(osl_t *osh)
return skb;
}
+
void
osl_ctfpool_replenish(osl_t *osh, uint thresh)
{
if ((osh == NULL) || (osh->ctfpool == NULL))
return;
+
while ((osh->ctfpool->refills > 0) && (thresh--)) {
osl_ctfpool_add(osh);
osh->ctfpool->refills--;
@@ -355,7 +370,14 @@ osl_ctfpool_replenish(osl_t *osh, uint thresh)
int32
osl_ctfpool_init(osl_t *osh, uint numobj, uint size)
{
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25))
+ gfp_t flags;
+
+ flags = (in_atomic()) ? GFP_ATOMIC : GFP_KERNEL;
+ osh->ctfpool = kmalloc(sizeof(ctfpool_t), flags);
+#else
osh->ctfpool = kmalloc(sizeof(ctfpool_t), GFP_ATOMIC);
+#endif
ASSERT(osh->ctfpool);
bzero(osh->ctfpool, sizeof(ctfpool_t));
@@ -380,7 +402,7 @@ osl_ctfpool_cleanup(osl_t *osh)
struct sk_buff *skb, *nskb;
#ifdef CTFPOOL_SPINLOCK
unsigned long flags;
-#endif
+#endif
if ((osh == NULL) || (osh->ctfpool == NULL))
return;
@@ -419,7 +441,7 @@ osl_ctfpool_stats(osl_t *osh, void *b)
if (bcm_static_skb) {
bcm_static_skb = 0;
}
-#endif
+#endif
bb = b;
@@ -439,8 +461,9 @@ osl_pktfastget(osl_t *osh, uint len)
struct sk_buff *skb;
#ifdef CTFPOOL_SPINLOCK
unsigned long flags;
-#endif
+#endif
+
if (osh->ctfpool == NULL)
return NULL;
@@ -454,6 +477,7 @@ osl_pktfastget(osl_t *osh, uint len)
ASSERT(len <= osh->ctfpool->obj_size);
+
skb = (struct sk_buff *)osh->ctfpool->head;
osh->ctfpool->head = (void *)skb->next;
@@ -462,6 +486,7 @@ osl_pktfastget(osl_t *osh, uint len)
ASSERT(CTFPOOLHEAD(osh, skb) == (struct sock *)osh->ctfpool->head);
CTFPOOL_UNLOCK(osh->ctfpool, flags);
+
skb->next = skb->prev = NULL;
skb->data = skb->head + 16;
skb->tail = skb->head + 16;
@@ -475,7 +500,7 @@ osl_pktfastget(osl_t *osh, uint len)
return skb;
}
-#endif /* CTFPOOL */
+#endif
struct sk_buff * BCMFASTPATH
osl_pkt_tonative(osl_t *osh, void *pkt)
@@ -489,13 +514,13 @@ osl_pkt_tonative(osl_t *osh, void *pkt)
bzero((void*)((struct sk_buff *)pkt)->cb, OSL_PKTTAG_SZ);
#ifndef WL_UMK
+
for (nskb = (struct sk_buff *)pkt; nskb; nskb = nskb->next) {
spin_lock_irqsave(&osh->pktalloc_lock, flags);
osh->pub.pktalloced--;
spin_unlock_irqrestore(&osh->pktalloc_lock, flags);
}
-#endif
-
+#endif
return (struct sk_buff *)pkt;
}
@@ -512,13 +537,13 @@ osl_pkt_frmnative(osl_t *osh, void *pkt)
bzero((void*)((struct sk_buff *)pkt)->cb, OSL_PKTTAG_SZ);
#ifndef WL_UMK
+
for (nskb = (struct sk_buff *)pkt; nskb; nskb = nskb->next) {
spin_lock_irqsave(&osh->pktalloc_lock, flags);
osh->pub.pktalloced++;
spin_unlock_irqrestore(&osh->pktalloc_lock, flags);
}
-#endif
-
+#endif
return (void *)pkt;
}
@@ -530,14 +555,16 @@ osl_pktget(osl_t *osh, uint len)
unsigned long flags;
#ifdef CTFPOOL
+
skb = osl_pktfastget(osh, len);
if ((skb != NULL) || ((skb = osl_alloc_skb(len)) != NULL)) {
-#else
+#else
if ((skb = osl_alloc_skb(len))) {
-#endif
+#endif
skb_put(skb, len);
skb->priority = 0;
+
spin_lock_irqsave(&osh->pktalloc_lock, flags);
osh->pub.pktalloced++;
spin_unlock_irqrestore(&osh->pktalloc_lock, flags);
@@ -553,7 +580,7 @@ osl_pktfastfree(osl_t *osh, struct sk_buff *skb)
ctfpool_t *ctfpool;
#ifdef CTFPOOL_SPINLOCK
unsigned long flags;
-#endif
+#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 14)
skb->tstamp.tv.sec = 0;
@@ -561,6 +588,7 @@ osl_pktfastfree(osl_t *osh, struct sk_buff *skb)
skb->stamp.tv_sec = 0;
#endif
+
skb->dev = NULL;
skb->dst = NULL;
memset(skb->cb, 0, sizeof(skb->cb));
@@ -570,6 +598,7 @@ osl_pktfastfree(osl_t *osh, struct sk_buff *skb)
ctfpool = (ctfpool_t *)CTFPOOLPTR(osh, skb);
ASSERT(ctfpool != NULL);
+
CTFPOOL_LOCK(ctfpool, flags);
skb->next = (struct sk_buff *)ctfpool->head;
ctfpool->head = (void *)skb;
@@ -580,7 +609,8 @@ osl_pktfastfree(osl_t *osh, struct sk_buff *skb)
ASSERT(ctfpool->curr_obj <= ctfpool->max_obj);
CTFPOOL_UNLOCK(ctfpool, flags);
}
-#endif /* CTFPOOL */
+#endif
+
void BCMFASTPATH
osl_pktfree(osl_t *osh, void *p, bool send)
@@ -595,21 +625,26 @@ osl_pktfree(osl_t *osh, void *p, bool send)
PKTDBG_TRACE(osh, (void *) skb, PKTLIST_PKTFREE);
+
while (skb) {
nskb = skb->next;
skb->next = NULL;
+
+
#ifdef CTFPOOL
if ((PKTISFAST(osh, skb)) && (atomic_read(&skb->users) == 1))
osl_pktfastfree(osh, skb);
else {
-#else
+#else
{
-#endif
+#endif
if (skb->destructor)
+
dev_kfree_skb_any(skb);
else
+
dev_kfree_skb(skb);
}
spin_lock_irqsave(&osh->pktalloc_lock, flags);
@@ -620,7 +655,6 @@ osl_pktfree(osl_t *osh, void *p, bool send)
}
#ifdef CONFIG_DHD_USE_STATIC_BUF
-#ifdef CUSTOMER_HW_SAMSUNG
void*
osl_pktget_static(osl_t *osh, uint len)
{
@@ -628,7 +662,7 @@ osl_pktget_static(osl_t *osh, uint len)
struct sk_buff *skb;
- if (len > DHD_SKB_4PAGE_BUFSIZE) {
+ if (len > DHD_SKB_MAX_BUFSIZE) {
printk("osl_pktget_static: Do we really need this big skb??"
" len=%d\n", len);
return osl_pktget(osh, len);
@@ -644,12 +678,12 @@ osl_pktget_static(osl_t *osh, uint len)
if (i != STATIC_PKT_MAX_NUM) {
bcm_static_skb->pkt_use[i] = 1;
- up(&bcm_static_skb->osl_pkt_sem);
skb = bcm_static_skb->skb_4k[i];
skb->tail = skb->data + len;
skb->len = len;
+ up(&bcm_static_skb->osl_pkt_sem);
return skb;
}
}
@@ -664,91 +698,45 @@ osl_pktget_static(osl_t *osh, uint len)
if (i != STATIC_PKT_MAX_NUM) {
bcm_static_skb->pkt_use[i + STATIC_PKT_MAX_NUM] = 1;
- up(&bcm_static_skb->osl_pkt_sem);
skb = bcm_static_skb->skb_8k[i];
skb->tail = skb->data + len;
skb->len = len;
+ up(&bcm_static_skb->osl_pkt_sem);
return skb;
}
}
+#if defined(ENHANCED_STATIC_BUF)
if (bcm_static_skb->pkt_use[STATIC_PKT_MAX_NUM * 2] == 0) {
bcm_static_skb->pkt_use[STATIC_PKT_MAX_NUM * 2] = 1;
- up(&bcm_static_skb->osl_pkt_sem);
skb = bcm_static_skb->skb_16k;
skb->tail = skb->data + len;
skb->len = len;
- return skb;
- }
-
- up(&bcm_static_skb->osl_pkt_sem);
- printk("osl_pktget_static: all static pkt in use!\n");
- return osl_pktget(osh, len);
-}
-
-#else /* !CUSTOMER_HW_SAMSUNG */
-
-void*
-osl_pktget_static(osl_t *osh, uint len)
-{
- int i = 0;
- struct sk_buff *skb;
-
- if (len > (PAGE_SIZE*2)) {
- printk("%s: attempt to allocate huge packet (0x%x)\n", __FUNCTION__, len);
- return osl_pktget(osh, len);
- }
-
- down(&bcm_static_skb->osl_pkt_sem);
-
- if (len <= PAGE_SIZE) {
- for (i = 0; i < STATIC_PKT_MAX_NUM; i++) {
- if (bcm_static_skb->pkt_use[i] == 0)
- break;
- }
-
- if (i != STATIC_PKT_MAX_NUM) {
- bcm_static_skb->pkt_use[i] = 1;
- up(&bcm_static_skb->osl_pkt_sem);
- skb = bcm_static_skb->skb_4k[i];
- skb->tail = skb->data + len;
- skb->len = len;
- return skb;
- }
- }
-
-
- for (i = 0; i < STATIC_PKT_MAX_NUM; i++) {
- if (bcm_static_skb->pkt_use[i+STATIC_PKT_MAX_NUM] == 0)
- break;
- }
-
- if (i != STATIC_PKT_MAX_NUM) {
- bcm_static_skb->pkt_use[i+STATIC_PKT_MAX_NUM] = 1;
up(&bcm_static_skb->osl_pkt_sem);
- skb = bcm_static_skb->skb_8k[i];
- skb->tail = skb->data + len;
- skb->len = len;
return skb;
}
+#endif
up(&bcm_static_skb->osl_pkt_sem);
- printk("%s: all static pkt in use!\n", __FUNCTION__);
+ printk("osl_pktget_static: all static pkt in use!\n");
return osl_pktget(osh, len);
}
-#endif /* CUSTOMER_HW_SAMSUNG */
void
osl_pktfree_static(osl_t *osh, void *p, bool send)
{
int i;
+ if (!bcm_static_skb) {
+ osl_pktfree(osh, p, send);
+ return;
+ }
+ down(&bcm_static_skb->osl_pkt_sem);
for (i = 0; i < STATIC_PKT_MAX_NUM; i++) {
if (p == bcm_static_skb->skb_4k[i]) {
- down(&bcm_static_skb->osl_pkt_sem);
bcm_static_skb->pkt_use[i] = 0;
up(&bcm_static_skb->osl_pkt_sem);
return;
@@ -757,24 +745,24 @@ osl_pktfree_static(osl_t *osh, void *p, bool send)
for (i = 0; i < STATIC_PKT_MAX_NUM; i++) {
if (p == bcm_static_skb->skb_8k[i]) {
- down(&bcm_static_skb->osl_pkt_sem);
bcm_static_skb->pkt_use[i + STATIC_PKT_MAX_NUM] = 0;
up(&bcm_static_skb->osl_pkt_sem);
return;
}
}
-#ifdef CUSTOMER_HW_SAMSUNG
+#ifdef ENHANCED_STATIC_BUF
if (p == bcm_static_skb->skb_16k) {
- down(&bcm_static_skb->osl_pkt_sem);
- bcm_static_skb->pkt_use[STATIC_PKT_MAX_NUM * 2] = 0;
+ bcm_static_skb->pkt_use[STATIC_PKT_MAX_NUM*2] = 0;
up(&bcm_static_skb->osl_pkt_sem);
return;
}
#endif
+ up(&bcm_static_skb->osl_pkt_sem);
- return osl_pktfree(osh, p, send);
+ osl_pktfree(osh, p, send);
+ return;
}
-#endif /* CONFIG_DHD_USE_STATIC_BUF */
+#endif
uint32
osl_pci_read_config(osl_t *osh, uint offset, uint size)
@@ -783,6 +771,8 @@ osl_pci_read_config(osl_t *osh, uint offset, uint size)
uint retry = PCI_CFG_RETRY;
ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC)));
+
+
ASSERT(size == 4);
do {
@@ -791,6 +781,7 @@ osl_pci_read_config(osl_t *osh, uint offset, uint size)
break;
} while (retry--);
+
return (val);
}
@@ -801,6 +792,7 @@ osl_pci_write_config(osl_t *osh, uint offset, uint size, uint val)
ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC)));
+
ASSERT(size == 4);
do {
@@ -861,7 +853,11 @@ void *
osl_malloc(osl_t *osh, uint size)
{
void *addr;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25))
+ gfp_t flags;
+#endif
+
if (osh)
ASSERT(osh->magic == OS_HANDLE_MAGIC);
@@ -897,9 +893,14 @@ osl_malloc(osl_t *osh, uint size)
}
}
original:
-#endif /* CONFIG_DHD_USE_STATIC_BUF */
+#endif
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25))
+ flags = (in_atomic()) ? GFP_ATOMIC : GFP_KERNEL;
+ if ((addr = kmalloc(size, flags)) == NULL) {
+#else
if ((addr = kmalloc(size, GFP_ATOMIC)) == NULL) {
+#endif
if (osh)
osh->failed++;
return (NULL);
@@ -934,8 +935,7 @@ osl_mfree(osl_t *osh, void *addr, uint size)
return;
}
}
-#endif /* CONFIG_DHD_USE_STATIC_BUF */
-
+#endif
if (osh) {
ASSERT(osh->magic == OS_HANDLE_MAGIC);
atomic_sub(size, &osh->malloced);
@@ -1013,7 +1013,7 @@ osl_assert(const char *exp, const char *file, int line)
const char *basename;
basename = strrchr(file, '/');
-
+
if (basename)
basename++;
@@ -1025,11 +1025,11 @@ osl_assert(const char *exp, const char *file, int line)
exp, basename, line);
bcm_assert_log(tempbuf);
-#endif
+#endif
}
-#endif /* BCMASSERT_LOG */
+#endif
void
osl_delay(uint usec)
@@ -1043,45 +1043,65 @@ osl_delay(uint usec)
}
}
+
+
void *
osl_pktdup(osl_t *osh, void *skb)
{
void * p;
unsigned long irqflags;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25))
+ gfp_t flags;
+#endif
+
PKTCTFMAP(osh, skb);
- if ((p = skb_clone((struct sk_buff *)skb, GFP_ATOMIC)) == NULL)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25))
+ flags = (in_atomic()) ? GFP_ATOMIC : GFP_KERNEL;
+ if ((p = skb_clone((struct sk_buff *)skb, flags)) == NULL)
+#else
+ if ((p = skb_clone((struct sk_buff*)skb, GFP_ATOMIC)) == NULL)
+#endif
return NULL;
#ifdef CTFPOOL
if (PKTISFAST(osh, skb)) {
ctfpool_t *ctfpool;
+
ctfpool = (ctfpool_t *)CTFPOOLPTR(osh, skb);
ASSERT(ctfpool != NULL);
PKTCLRFAST(osh, p);
PKTCLRFAST(osh, skb);
ctfpool->refills++;
}
-#endif
+#endif
+
if (osh->pub.pkttag)
bzero((void*)((struct sk_buff *)p)->cb, OSL_PKTTAG_SZ);
+
spin_lock_irqsave(&osh->pktalloc_lock, irqflags);
osh->pub.pktalloced++;
spin_unlock_irqrestore(&osh->pktalloc_lock, irqflags);
return (p);
}
+
+
+
+
+
+
void *
osl_os_open_image(char *filename)
{
struct file *fp;
fp = filp_open(filename, O_RDONLY, 0);
-
+
if (IS_ERR(fp))
fp = NULL;
diff --git a/drivers/net/wireless/bcmdhd/src/shared/sbutils.c b/drivers/net/wireless/bcmdhd/sbutils.c
index 85c65f2..68cfcb2 100644
--- a/drivers/net/wireless/bcmdhd/src/shared/sbutils.c
+++ b/drivers/net/wireless/bcmdhd/sbutils.c
@@ -2,14 +2,14 @@
* Misc utility routines for accessing chip-specific features
* of the SiliconBackplane-based Broadcom chips.
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -17,12 +17,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: sbutils.c 300516 2011-12-04 17:39:44Z $
+ * $Id: sbutils.c 310902 2012-01-26 19:45:33Z $
*/
#include <bcm_cfg.h>
diff --git a/drivers/net/wireless/bcmdhd/src/shared/siutils.c b/drivers/net/wireless/bcmdhd/siutils.c
index 0c8a9fe..db108b8 100644
--- a/drivers/net/wireless/bcmdhd/src/shared/siutils.c
+++ b/drivers/net/wireless/bcmdhd/siutils.c
@@ -2,14 +2,14 @@
* Misc utility routines for accessing chip-specific features
* of the SiliconBackplane-based Broadcom chips.
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -17,12 +17,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: siutils.c 307724 2012-01-12 10:41:05Z $
+ * $Id: siutils.c 347632 2012-07-27 11:00:35Z $
*/
#include <bcm_cfg.h>
@@ -44,6 +44,9 @@
#include <sbsdpcmdev.h>
#include <bcmsdpcm.h>
#include <hndpmu.h>
+#ifdef BCMSPI
+#include <spid.h>
+#endif /* BCMSPI */
#include "siutils_priv.h"
@@ -55,6 +58,7 @@ static bool si_buscore_setup(si_info_t *sii, chipcregs_t *cc, uint bustype, uint
uint *origidx, void *regs);
+
/* global variable to indicate reservation/release of gpio's */
static uint32 si_gpioreservation = 0;
@@ -105,7 +109,7 @@ si_kattach(osl_t *osh)
static bool ksii_attached = FALSE;
if (!ksii_attached) {
- void *regs;
+ void *regs = NULL;
regs = REG_MAP(SI_ENUM_BASE, SI_CORE_SIZE);
if (si_doattach(&ksii, BCM4710_DEVICE_ID, osh, regs,
@@ -175,6 +179,24 @@ si_buscore_prep(si_info_t *sii, uint bustype, uint devid, void *sdh)
bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_SDIOPULLUP, 0, NULL);
}
+#ifdef BCMSPI
+ /* Avoid backplane accesses before wake-wlan (i.e. htavail) for spi.
+ * F1 read accesses may return correct data but with data-not-available dstatus bit set.
+ */
+ if (BUSTYPE(bustype) == SPI_BUS) {
+
+ int err;
+ uint32 regdata;
+ /* wake up wlan function :WAKE_UP goes as HT_AVAIL request in hardware */
+ regdata = bcmsdh_cfg_read_word(sdh, SDIO_FUNC_0, SPID_CONFIG, NULL);
+ SI_MSG(("F0 REG0 rd = 0x%x\n", regdata));
+ regdata |= WAKE_UP;
+
+ bcmsdh_cfg_write_word(sdh, SDIO_FUNC_0, SPID_CONFIG, regdata, &err);
+
+ OSL_DELAY(100000);
+ }
+#endif /* BCMSPI */
return TRUE;
}
@@ -275,7 +297,7 @@ si_buscore_setup(si_info_t *sii, chipcregs_t *cc, uint bustype, uint32 savewin,
if (pcie_gen2)
sii->pub.buscoretype = PCIE2_CORE_ID;
else
- sii->pub.buscoretype = PCIE_CORE_ID;
+ sii->pub.buscoretype = PCIE_CORE_ID;
sii->pub.buscorerev = pcierev;
sii->pub.buscoreidx = pcieidx;
}
@@ -1130,6 +1152,11 @@ si_watchdog_ms(si_t *sih, uint32 ms)
si_watchdog(sih, wd_msticks * ms);
}
+uint32 si_watchdog_msticks(void)
+{
+ return wd_msticks;
+}
+
bool
si_taclear(si_t *sih, bool details)
{
@@ -1921,6 +1948,70 @@ done:
return memsize;
}
+
+/* Return the TCM-RAM size of the ARMCR4 core. */
+uint32
+si_tcm_size(si_t *sih)
+{
+ si_info_t *sii;
+ uint origidx;
+ uint intr_val = 0;
+ uint8 *regs;
+ bool wasup;
+ uint32 corecap;
+ uint memsize = 0;
+ uint32 nab = 0;
+ uint32 nbb = 0;
+ uint32 totb = 0;
+ uint32 bxinfo = 0;
+ uint32 idx = 0;
+ uint32 *arm_cap_reg;
+ uint32 *arm_bidx;
+ uint32 *arm_binfo;
+
+ sii = SI_INFO(sih);
+
+ /* Block ints and save current core */
+ INTR_OFF(sii, intr_val);
+ origidx = si_coreidx(sih);
+
+ /* Switch to CR4 core */
+ if (!(regs = si_setcore(sih, ARMCR4_CORE_ID, 0)))
+ goto done;
+
+ /* Get info for determining size. If in reset, come out of reset,
+ * but remain in halt
+ */
+ if (!(wasup = si_iscoreup(sih)))
+ si_core_reset(sih, SICF_CPUHALT, SICF_CPUHALT);
+
+ arm_cap_reg = (uint32 *)(regs + SI_CR4_CAP);
+ corecap = R_REG(sii->osh, arm_cap_reg);
+
+ nab = (corecap & ARMCR4_TCBANB_MASK) >> ARMCR4_TCBANB_SHIFT;
+ nbb = (corecap & ARMCR4_TCBBNB_MASK) >> ARMCR4_TCBBNB_SHIFT;
+ totb = nab + nbb;
+
+ arm_bidx = (uint32 *)(regs + SI_CR4_BANKIDX);
+ arm_binfo = (uint32 *)(regs + SI_CR4_BANKINFO);
+ for (idx = 0; idx < totb; idx++) {
+ W_REG(sii->osh, arm_bidx, idx);
+
+ bxinfo = R_REG(sii->osh, arm_binfo);
+ memsize += ((bxinfo & ARMCR4_BSZ_MASK) + 1) * ARMCR4_BSZ_MULT;
+ }
+
+ /* Return to previous state and core */
+ if (!wasup)
+ si_core_disable(sih, 0);
+ si_setcoreidx(sih, origidx);
+
+done:
+ INTR_RESTORE(sii, intr_val);
+
+ return memsize;
+}
+
uint32
si_socram_srmem_size(si_t *sih)
{
@@ -1938,7 +2029,6 @@ si_socram_srmem_size(si_t *sih)
return (32 * 1024);
}
-
sii = SI_INFO(sih);
/* Block ints and save current core */
@@ -2339,6 +2429,9 @@ si_is_sprom_available(si_t *sih)
case BCM4324_CHIP_ID:
return ((sih->chipst & CST4324_SPROM_MASK) &&
!(sih->chipst & CST4324_SFLASH_MASK));
+ case BCM4335_CHIP_ID:
+ return ((sih->chipst & CST4335_SPROM_MASK) &&
+ !(sih->chipst & CST4335_SFLASH_MASK));
case BCM43131_CHIP_ID:
case BCM43217_CHIP_ID:
case BCM43227_CHIP_ID:
@@ -2349,3 +2442,46 @@ si_is_sprom_available(si_t *sih)
return TRUE;
}
}
+
+
+uint32 si_get_sromctl(si_t *sih)
+{
+ chipcregs_t *cc;
+ uint origidx;
+ uint32 sromctl;
+ osl_t *osh;
+
+ osh = si_osh(sih);
+ origidx = si_coreidx(sih);
+ cc = si_setcoreidx(sih, SI_CC_IDX);
+ ASSERT((uintptr)cc);
+
+ sromctl = R_REG(osh, &cc->sromcontrol);
+
+ /* return to the original core */
+ si_setcoreidx(sih, origidx);
+ return sromctl;
+}
+
+int si_set_sromctl(si_t *sih, uint32 value)
+{
+ chipcregs_t *cc;
+ uint origidx;
+ osl_t *osh;
+
+ osh = si_osh(sih);
+ origidx = si_coreidx(sih);
+ cc = si_setcoreidx(sih, SI_CC_IDX);
+ ASSERT((uintptr)cc);
+
+ /* get chipcommon rev */
+ if (si_corerev(sih) < 32)
+ return BCME_UNSUPPORTED;
+
+ W_REG(osh, &cc->sromcontrol, value);
+
+ /* return to the original core */
+ si_setcoreidx(sih, origidx);
+ return BCME_OK;
+
+}
diff --git a/drivers/net/wireless/bcmdhd/src/shared/siutils_priv.h b/drivers/net/wireless/bcmdhd/siutils_priv.h
index 94b8eee..9a3270f 100644
--- a/drivers/net/wireless/bcmdhd/src/shared/siutils_priv.h
+++ b/drivers/net/wireless/bcmdhd/siutils_priv.h
@@ -1,14 +1,14 @@
/*
* Include file private to the SOC Interconnect support files.
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,12 +16,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: siutils_priv.h 300516 2011-12-04 17:39:44Z $
+ * $Id: siutils_priv.h 309193 2012-01-19 00:03:57Z $
*/
#ifndef _siutils_priv_h_
@@ -66,7 +66,7 @@ typedef struct si_info {
void *pch; /* PCI/E core handle */
- gpioh_item_t *gpioh_head; /* GPIO event handlers list */
+ gpioh_item_t *gpioh_head; /* GPIO event handlers list */
bool memseg; /* flag to toggle MEM_SEG register */
diff --git a/drivers/net/wireless/bcmdhd/src/include/bcmdevs.h b/drivers/net/wireless/bcmdhd/src/include/bcmdevs.h
deleted file mode 100644
index 8fe4fc1..0000000
--- a/drivers/net/wireless/bcmdhd/src/include/bcmdevs.h
+++ /dev/null
@@ -1,481 +0,0 @@
-/*
- * Broadcom device-specific manifest constants.
- *
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
- * Unless you and Broadcom execute a separate written software license
- * agreement governing use of this software, this software is licensed to you
- * under the terms of the GNU General Public License version 2 (the "GPL"),
- * available at http://www.broadcom.com/licenses/GPLv2.php, with the
- * following added to such license:
- *
- * As a special exception, the copyright holders of this software give you
- * permission to link this software with independent modules, and to copy and
- * distribute the resulting executable under terms of your choice, provided that
- * you also meet, for each linked independent module, the terms and conditions of
- * the license of that module. An independent module is a module which is not
- * derived from this software. The special exception does not apply to any
- * modifications of the software.
- *
- * Notwithstanding the above, under no circumstances may you combine this
- * software in any way with any other Broadcom software provided under a license
- * other than the GPL, without Broadcom's express prior written consent.
- *
- * $Id: bcmdevs.h 306883 2012-01-09 21:47:42Z $
- */
-
-#ifndef _BCMDEVS_H
-#define _BCMDEVS_H
-
-
-#define VENDOR_EPIGRAM 0xfeda
-#define VENDOR_BROADCOM 0x14e4
-#define VENDOR_3COM 0x10b7
-#define VENDOR_NETGEAR 0x1385
-#define VENDOR_DIAMOND 0x1092
-#define VENDOR_INTEL 0x8086
-#define VENDOR_DELL 0x1028
-#define VENDOR_HP 0x103c
-#define VENDOR_HP_COMPAQ 0x0e11
-#define VENDOR_APPLE 0x106b
-#define VENDOR_SI_IMAGE 0x1095
-#define VENDOR_BUFFALO 0x1154
-#define VENDOR_TI 0x104c
-#define VENDOR_RICOH 0x1180
-#define VENDOR_JMICRON 0x197b
-
-
-
-#define VENDOR_BROADCOM_PCMCIA 0x02d0
-
-
-#define VENDOR_BROADCOM_SDIO 0x00BF
-
-
-#define BCM_DNGL_VID 0x0a5c
-#define BCM_DNGL_BL_PID_4328 0xbd12
-#define BCM_DNGL_BL_PID_4322 0xbd13
-#define BCM_DNGL_BL_PID_4319 0xbd16
-#define BCM_DNGL_BL_PID_43236 0xbd17
-#define BCM_DNGL_BL_PID_4332 0xbd18
-#define BCM_DNGL_BL_PID_4330 0xbd19
-#define BCM_DNGL_BL_PID_4334 0xbd1a
-#define BCM_DNGL_BL_PID_43239 0xbd1b
-#define BCM_DNGL_BL_PID_4324 0xbd1c
-#define BCM_DNGL_BL_PID_4360 0xbd1d
-
-#define BCM_DNGL_BDC_PID 0x0bdc
-#define BCM_DNGL_JTAG_PID 0x4a44
-
-
-#define BCM_HWUSB_PID_43239 43239
-
-
-#define BCM4210_DEVICE_ID 0x1072
-#define BCM4230_DEVICE_ID 0x1086
-#define BCM4401_ENET_ID 0x170c
-#define BCM3352_DEVICE_ID 0x3352
-#define BCM3360_DEVICE_ID 0x3360
-#define BCM4211_DEVICE_ID 0x4211
-#define BCM4231_DEVICE_ID 0x4231
-#define BCM4303_D11B_ID 0x4303
-#define BCM4311_D11G_ID 0x4311
-#define BCM4311_D11DUAL_ID 0x4312
-#define BCM4311_D11A_ID 0x4313
-#define BCM4328_D11DUAL_ID 0x4314
-#define BCM4328_D11G_ID 0x4315
-#define BCM4328_D11A_ID 0x4316
-#define BCM4318_D11G_ID 0x4318
-#define BCM4318_D11DUAL_ID 0x4319
-#define BCM4318_D11A_ID 0x431a
-#define BCM4325_D11DUAL_ID 0x431b
-#define BCM4325_D11G_ID 0x431c
-#define BCM4325_D11A_ID 0x431d
-#define BCM4306_D11G_ID 0x4320
-#define BCM4306_D11A_ID 0x4321
-#define BCM4306_UART_ID 0x4322
-#define BCM4306_V90_ID 0x4323
-#define BCM4306_D11DUAL_ID 0x4324
-#define BCM4306_D11G_ID2 0x4325
-#define BCM4321_D11N_ID 0x4328
-#define BCM4321_D11N2G_ID 0x4329
-#define BCM4321_D11N5G_ID 0x432a
-#define BCM4322_D11N_ID 0x432b
-#define BCM4322_D11N2G_ID 0x432c
-#define BCM4322_D11N5G_ID 0x432d
-#define BCM4329_D11N_ID 0x432e
-#define BCM4329_D11N2G_ID 0x432f
-#define BCM4329_D11N5G_ID 0x4330
-#define BCM4315_D11DUAL_ID 0x4334
-#define BCM4315_D11G_ID 0x4335
-#define BCM4315_D11A_ID 0x4336
-#define BCM4319_D11N_ID 0x4337
-#define BCM4319_D11N2G_ID 0x4338
-#define BCM4319_D11N5G_ID 0x4339
-#define BCM43231_D11N2G_ID 0x4340
-#define BCM43221_D11N2G_ID 0x4341
-#define BCM43222_D11N_ID 0x4350
-#define BCM43222_D11N2G_ID 0x4351
-#define BCM43222_D11N5G_ID 0x4352
-#define BCM43224_D11N_ID 0x4353
-#define BCM43224_D11N_ID_VEN1 0x0576
-#define BCM43226_D11N_ID 0x4354
-#define BCM43236_D11N_ID 0x4346
-#define BCM43236_D11N2G_ID 0x4347
-#define BCM43236_D11N5G_ID 0x4348
-#define BCM43225_D11N2G_ID 0x4357
-#define BCM43421_D11N_ID 0xA99D
-#define BCM4313_D11N2G_ID 0x4727
-#define BCM4330_D11N_ID 0x4360
-#define BCM4330_D11N2G_ID 0x4361
-#define BCM4330_D11N5G_ID 0x4362
-#define BCM4336_D11N_ID 0x4343
-#define BCM6362_D11N_ID 0x435f
-#define BCM4331_D11N_ID 0x4331
-#define BCM4331_D11N2G_ID 0x4332
-#define BCM4331_D11N5G_ID 0x4333
-#define BCM43237_D11N_ID 0x4355
-#define BCM43237_D11N5G_ID 0x4356
-#define BCM43227_D11N2G_ID 0x4358
-#define BCM43228_D11N_ID 0x4359
-#define BCM43228_D11N5G_ID 0x435a
-#define BCM43362_D11N_ID 0x4363
-#define BCM43239_D11N_ID 0x4370
-#define BCM4324_D11N_ID 0x4374
-#define BCM43217_D11N2G_ID 0x43a9
-#define BCM43131_D11N2G_ID 0x43aa
-#define BCM4314_D11N2G_ID 0x4364
-#define BCM43142_D11N2G_ID 0x4365
-#define BCM4334_D11N_ID 0x4380
-#define BCM4334_D11N2G_ID 0x4381
-#define BCM4334_D11N5G_ID 0x4382
-#define BCM4360_D11AC_ID 0x43a0
-#define BCM4360_D11AC2G_ID 0x43a1
-#define BCM4360_D11AC5G_ID 0x43a2
-
-
-#define BCM943228HMB_SSID_VEN1 0x0607
-#define BCM94313HMGBL_SSID_VEN1 0x0608
-#define BCM94313HMG_SSID_VEN1 0x0609
-
-
-#define BCM4335_D11AC_ID 0x43a9
-#define BCM4335_D11AC2G_ID 0x43aa
-#define BCM4335_D11AC5G_ID 0x43ab
-
-#define BCMGPRS_UART_ID 0x4333
-#define BCMGPRS2_UART_ID 0x4344
-#define FPGA_JTAGM_ID 0x43f0
-#define BCM_JTAGM_ID 0x43f1
-#define SDIOH_FPGA_ID 0x43f2
-#define BCM_SDIOH_ID 0x43f3
-#define SDIOD_FPGA_ID 0x43f4
-#define SPIH_FPGA_ID 0x43f5
-#define BCM_SPIH_ID 0x43f6
-#define MIMO_FPGA_ID 0x43f8
-#define BCM_JTAGM2_ID 0x43f9
-#define SDHCI_FPGA_ID 0x43fa
-#define BCM4402_ENET_ID 0x4402
-#define BCM4402_V90_ID 0x4403
-#define BCM4410_DEVICE_ID 0x4410
-#define BCM4412_DEVICE_ID 0x4412
-#define BCM4430_DEVICE_ID 0x4430
-#define BCM4432_DEVICE_ID 0x4432
-#define BCM4704_ENET_ID 0x4706
-#define BCM4710_DEVICE_ID 0x4710
-#define BCM47XX_AUDIO_ID 0x4711
-#define BCM47XX_V90_ID 0x4712
-#define BCM47XX_ENET_ID 0x4713
-#define BCM47XX_EXT_ID 0x4714
-#define BCM47XX_GMAC_ID 0x4715
-#define BCM47XX_USBH_ID 0x4716
-#define BCM47XX_USBD_ID 0x4717
-#define BCM47XX_IPSEC_ID 0x4718
-#define BCM47XX_ROBO_ID 0x4719
-#define BCM47XX_USB20H_ID 0x471a
-#define BCM47XX_USB20D_ID 0x471b
-#define BCM47XX_ATA100_ID 0x471d
-#define BCM47XX_SATAXOR_ID 0x471e
-#define BCM47XX_GIGETH_ID 0x471f
-#define BCM4712_MIPS_ID 0x4720
-#define BCM4716_DEVICE_ID 0x4722
-#define BCM47XX_SMBUS_EMU_ID 0x47fe
-#define BCM47XX_XOR_EMU_ID 0x47ff
-#define EPI41210_DEVICE_ID 0xa0fa
-#define EPI41230_DEVICE_ID 0xa10e
-#define JINVANI_SDIOH_ID 0x4743
-#define BCM27XX_SDIOH_ID 0x2702
-#define PCIXX21_FLASHMEDIA_ID 0x803b
-#define PCIXX21_SDIOH_ID 0x803c
-#define R5C822_SDIOH_ID 0x0822
-#define JMICRON_SDIOH_ID 0x2381
-
-
-#define BCM4306_CHIP_ID 0x4306
-#define BCM4311_CHIP_ID 0x4311
-#define BCM43111_CHIP_ID 43111
-#define BCM43112_CHIP_ID 43112
-#define BCM4312_CHIP_ID 0x4312
-#define BCM4313_CHIP_ID 0x4313
-#define BCM43131_CHIP_ID 43131
-#define BCM4315_CHIP_ID 0x4315
-#define BCM4318_CHIP_ID 0x4318
-#define BCM4319_CHIP_ID 0x4319
-#define BCM4320_CHIP_ID 0x4320
-#define BCM4321_CHIP_ID 0x4321
-#define BCM43217_CHIP_ID 43217
-#define BCM4322_CHIP_ID 0x4322
-#define BCM43221_CHIP_ID 43221
-#define BCM43222_CHIP_ID 43222
-#define BCM43224_CHIP_ID 43224
-#define BCM43225_CHIP_ID 43225
-#define BCM43227_CHIP_ID 43227
-#define BCM43228_CHIP_ID 43228
-#define BCM43226_CHIP_ID 43226
-#define BCM43231_CHIP_ID 43231
-#define BCM43234_CHIP_ID 43234
-#define BCM43235_CHIP_ID 43235
-#define BCM43236_CHIP_ID 43236
-#define BCM43237_CHIP_ID 43237
-#define BCM43238_CHIP_ID 43238
-#define BCM43239_CHIP_ID 43239
-#define BCM43420_CHIP_ID 43420
-#define BCM43421_CHIP_ID 43421
-#define BCM43428_CHIP_ID 43428
-#define BCM43431_CHIP_ID 43431
-#define BCM43460_CHIP_ID 43460
-#define BCM4325_CHIP_ID 0x4325
-#define BCM4328_CHIP_ID 0x4328
-#define BCM4329_CHIP_ID 0x4329
-#define BCM4331_CHIP_ID 0x4331
-#define BCM4336_CHIP_ID 0x4336
-#define BCM43362_CHIP_ID 43362
-#define BCM4330_CHIP_ID 0x4330
-#define BCM6362_CHIP_ID 0x6362
-#define BCM4314_CHIP_ID 0x4314
-#define BCM43142_CHIP_ID 43142
-#define BCM4324_CHIP_ID 0x4324
-#define BCM43242_CHIP_ID 43242
-#define BCM4334_CHIP_ID 0x4334
-#define BCM4360_CHIP_ID 0x4360
-
-#define BCM4335_CHIP_ID 0x4335
-
-#define BCM4342_CHIP_ID 4342
-#define BCM4402_CHIP_ID 0x4402
-#define BCM4704_CHIP_ID 0x4704
-#define BCM4706_CHIP_ID 0x5300
-#define BCM4710_CHIP_ID 0x4710
-#define BCM4712_CHIP_ID 0x4712
-#define BCM4716_CHIP_ID 0x4716
-#define BCM47162_CHIP_ID 47162
-#define BCM4748_CHIP_ID 0x4748
-#define BCM4749_CHIP_ID 0x4749
-#define BCM4785_CHIP_ID 0x4785
-#define BCM5350_CHIP_ID 0x5350
-#define BCM5352_CHIP_ID 0x5352
-#define BCM5354_CHIP_ID 0x5354
-#define BCM5365_CHIP_ID 0x5365
-#define BCM5356_CHIP_ID 0x5356
-#define BCM5357_CHIP_ID 0x5357
-#define BCM53572_CHIP_ID 53572
-
-
-#define BCM4303_PKG_ID 2
-#define BCM4309_PKG_ID 1
-#define BCM4712LARGE_PKG_ID 0
-#define BCM4712SMALL_PKG_ID 1
-#define BCM4712MID_PKG_ID 2
-#define BCM4328USBD11G_PKG_ID 2
-#define BCM4328USBDUAL_PKG_ID 3
-#define BCM4328SDIOD11G_PKG_ID 4
-#define BCM4328SDIODUAL_PKG_ID 5
-#define BCM4329_289PIN_PKG_ID 0
-#define BCM4329_182PIN_PKG_ID 1
-#define BCM5354E_PKG_ID 1
-#define BCM4716_PKG_ID 8
-#define BCM4717_PKG_ID 9
-#define BCM4718_PKG_ID 10
-#define BCM5356_PKG_NONMODE 1
-#define BCM5358U_PKG_ID 8
-#define BCM5358_PKG_ID 9
-#define BCM47186_PKG_ID 10
-#define BCM5357_PKG_ID 11
-#define BCM5356U_PKG_ID 12
-#define BCM53572_PKG_ID 8
-#define BCM5357C0_PKG_ID 8
-#define BCM47188_PKG_ID 9
-#define BCM5358C0_PKG_ID 0xa
-#define BCM5356C0_PKG_ID 0xb
-#define BCM4331TT_PKG_ID 8
-#define BCM4331TN_PKG_ID 9
-#define BCM4331TNA0_PKG_ID 0xb
-#define BCM4706L_PKG_ID 1
-
-#define HDLSIM5350_PKG_ID 1
-#define HDLSIM_PKG_ID 14
-#define HWSIM_PKG_ID 15
-#define BCM43224_FAB_CSM 0x8
-#define BCM43224_FAB_SMIC 0xa
-#define BCM4336_WLBGA_PKG_ID 0x8
-#define BCM4330_WLBGA_PKG_ID 0x0
-#define BCM4314PCIE_ARM_PKG_ID (8 | 0)
-#define BCM4314SDIO_PKG_ID (8 | 1)
-#define BCM4314PCIE_PKG_ID (8 | 2)
-#define BCM4314SDIO_ARM_PKG_ID (8 | 3)
-#define BCM4314SDIO_FPBGA_PKG_ID (8 | 4)
-#define BCM4314DEV_PKG_ID (8 | 6)
-
-#define PCIXX21_FLASHMEDIA0_ID 0x8033
-#define PCIXX21_SDIOH0_ID 0x8034
-
-
-#define BFL_BTC2WIRE 0x00000001
-#define BFL_BTCOEX 0x00000001
-#define BFL_PACTRL 0x00000002
-#define BFL_AIRLINEMODE 0x00000004
-#define BFL_ADCDIV 0x00000008
-#define BFL_ENETROBO 0x00000010
-#define BFL_NOPLLDOWN 0x00000020
-#define BFL_CCKHIPWR 0x00000040
-#define BFL_ENETADM 0x00000080
-#define BFL_ENETVLAN 0x00000100
-#define BFL_UNUSED 0x00000200
-#define BFL_NOPCI 0x00000400
-#define BFL_FEM 0x00000800
-#define BFL_EXTLNA 0x00001000
-#define BFL_HGPA 0x00002000
-#define BFL_BTC2WIRE_ALTGPIO 0x00004000
-#define BFL_ALTIQ 0x00008000
-#define BFL_NOPA 0x00010000
-#define BFL_RSSIINV 0x00020000
-#define BFL_PAREF 0x00040000
-#define BFL_3TSWITCH 0x00080000
-#define BFL_PHASESHIFT 0x00100000
-#define BFL_BUCKBOOST 0x00200000
-#define BFL_FEM_BT 0x00400000
-#define BFL_NOCBUCK 0x00800000
-#define BFL_CCKFAVOREVM 0x01000000
-#define BFL_PALDO 0x02000000
-#define BFL_LNLDO2_2P5 0x04000000
-#define BFL_FASTPWR 0x08000000
-#define BFL_UCPWRCTL_MININDX 0x08000000
-#define BFL_EXTLNA_5GHz 0x10000000
-#define BFL_TRSW_1by2 0x20000000
-#define BFL_LO_TRSW_R_5GHz 0x40000000
-#define BFL_ELNA_GAINDEF 0x80000000
-#define BFL_EXTLNA_TX 0x20000000
-
-
-#define BFL2_RXBB_INT_REG_DIS 0x00000001
-#define BFL2_APLL_WAR 0x00000002
-#define BFL2_TXPWRCTRL_EN 0x00000004
-#define BFL2_2X4_DIV 0x00000008
-#define BFL2_5G_PWRGAIN 0x00000010
-#define BFL2_PCIEWAR_OVR 0x00000020
-#define BFL2_CAESERS_BRD 0x00000040
-#define BFL2_BTC3WIRE 0x00000080
-#define BFL2_BTCLEGACY 0x00000080
-#define BFL2_SKWRKFEM_BRD 0x00000100
-#define BFL2_SPUR_WAR 0x00000200
-#define BFL2_GPLL_WAR 0x00000400
-#define BFL2_TRISTATE_LED 0x00000800
-#define BFL2_SINGLEANT_CCK 0x00001000
-#define BFL2_2G_SPUR_WAR 0x00002000
-#define BFL2_BPHY_ALL_TXCORES 0x00004000
-#define BFL2_FCC_BANDEDGE_WAR 0x00008000
-#define BFL2_GPLL_WAR2 0x00010000
-#define BFL2_IPALVLSHIFT_3P3 0x00020000
-#define BFL2_INTERNDET_TXIQCAL 0x00040000
-#define BFL2_XTALBUFOUTEN 0x00080000
-
-
-
-#define BFL2_ANAPACTRL_2G 0x00100000
-#define BFL2_ANAPACTRL_5G 0x00200000
-#define BFL2_ELNACTRL_TRSW_2G 0x00400000
-#define BFL2_BT_SHARE_ANT0 0x00800000
-#define BFL2_TEMPSENSE_HIGHER 0x01000000
-#define BFL2_BTC3WIREONLY 0x02000000
-#define BFL2_PWR_NOMINAL 0x04000000
-#define BFL2_EXTLNA_PWRSAVE 0x08000000
-
-#define BFL2_4313_RADIOREG 0x10000000
-
-#define BFL2_SDR_EN 0x20000000
-
-
-#define BOARD_GPIO_BTC3W_IN 0x850
-#define BOARD_GPIO_BTC3W_OUT 0x020
-#define BOARD_GPIO_BTCMOD_IN 0x010
-#define BOARD_GPIO_BTCMOD_OUT 0x020
-#define BOARD_GPIO_BTC_IN 0x080
-#define BOARD_GPIO_BTC_OUT 0x100
-#define BOARD_GPIO_PACTRL 0x200
-#define BOARD_GPIO_12 0x1000
-#define BOARD_GPIO_13 0x2000
-#define BOARD_GPIO_BTC4_IN 0x0800
-#define BOARD_GPIO_BTC4_BT 0x2000
-#define BOARD_GPIO_BTC4_STAT 0x4000
-#define BOARD_GPIO_BTC4_WLAN 0x8000
-#define BOARD_GPIO_1_WLAN_PWR 0x02
-#define BOARD_GPIO_3_WLAN_PWR 0x08
-#define BOARD_GPIO_4_WLAN_PWR 0x10
-
-#define GPIO_BTC4W_OUT_4312 0x010
-#define GPIO_BTC4W_OUT_43224 0x020
-#define GPIO_BTC4W_OUT_43224_SHARED 0x0e0
-#define GPIO_BTC4W_OUT_43225 0x0e0
-#define GPIO_BTC4W_OUT_43421 0x020
-#define GPIO_BTC4W_OUT_4313 0x060
-#define GPIO_BTC4W_OUT_4331_SHARED 0x010
-
-#define PCI_CFG_GPIO_SCS 0x10
-#define PCI_CFG_GPIO_HWRAD 0x20
-#define PCI_CFG_GPIO_XTAL 0x40
-#define PCI_CFG_GPIO_PLL 0x80
-
-
-#define PLL_DELAY 150
-#define FREF_DELAY 200
-#define MIN_SLOW_CLK 32
-#define XTAL_ON_DELAY 1000
-
-
-
-#define GPIO_NUMPINS 32
-
-
-#define RDL_RAM_BASE_4319 0x60000000
-#define RDL_RAM_BASE_4329 0x60000000
-#define RDL_RAM_SIZE_4319 0x48000
-#define RDL_RAM_SIZE_4329 0x48000
-#define RDL_RAM_SIZE_43236 0x70000
-#define RDL_RAM_BASE_43236 0x60000000
-#define RDL_RAM_SIZE_4328 0x60000
-#define RDL_RAM_BASE_4328 0x80000000
-#define RDL_RAM_SIZE_4322 0x60000
-#define RDL_RAM_BASE_4322 0x60000000
-
-
-#define MUXENAB_UART 0x00000001
-#define MUXENAB_GPIO 0x00000002
-#define MUXENAB_ERCX 0x00000004
-#define MUXENAB_JTAG 0x00000008
-#define MUXENAB_HOST_WAKE 0x00000010
-#define MUXENAB_I2S_EN 0x00000020
-#define MUXENAB_I2S_MASTER 0x00000040
-#define MUXENAB_I2S_FULL 0x00000080
-#define MUXENAB_SFLASH 0x00000100
-#define MUXENAB_RFSWCTRL0 0x00000200
-#define MUXENAB_RFSWCTRL1 0x00000400
-#define MUXENAB_RFSWCTRL2 0x00000800
-#define MUXENAB_SECI 0x00001000
-#define MUXENAB_BT_LEGACY 0x00002000
-#define MUXENAB_HOST_WAKE1 0x00004000
-
-
-#define FLASH_KERNEL_NFLASH 0x00000001
-#define FLASH_BOOT_NFLASH 0x00000002
-
-#endif
diff --git a/drivers/net/wireless/bcmdhd/src/include/proto/802.11.h b/drivers/net/wireless/bcmdhd/src/include/proto/802.11.h
deleted file mode 100755
index 23d55d8..0000000
--- a/drivers/net/wireless/bcmdhd/src/include/proto/802.11.h
+++ /dev/null
@@ -1,2240 +0,0 @@
-/*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
- * Unless you and Broadcom execute a separate written software license
- * agreement governing use of this software, this software is licensed to you
- * under the terms of the GNU General Public License version 2 (the "GPL"),
- * available at http://www.broadcom.com/licenses/GPLv2.php, with the
- * following added to such license:
- *
- * As a special exception, the copyright holders of this software give you
- * permission to link this software with independent modules, and to copy and
- * distribute the resulting executable under terms of your choice, provided that
- * you also meet, for each linked independent module, the terms and conditions of
- * the license of that module. An independent module is a module which is not
- * derived from this software. The special exception does not apply to any
- * modifications of the software.
- *
- * Notwithstanding the above, under no circumstances may you combine this
- * software in any way with any other Broadcom software provided under a license
- * other than the GPL, without Broadcom's express prior written consent.
- *
- * Fundamental types and constants relating to 802.11
- *
- * $Id: 802.11.h 297130 2011-11-18 01:41:36Z $
- */
-
-#ifndef _802_11_H_
-#define _802_11_H_
-
-#ifndef _TYPEDEFS_H_
-#include <typedefs.h>
-#endif
-
-#ifndef _NET_ETHERNET_H_
-#include <proto/ethernet.h>
-#endif
-
-#include <proto/wpa.h>
-
-
-#include <packed_section_start.h>
-
-
-#define DOT11_TU_TO_US 1024
-
-
-#define DOT11_A3_HDR_LEN 24
-#define DOT11_A4_HDR_LEN 30
-#define DOT11_MAC_HDR_LEN DOT11_A3_HDR_LEN
-#define DOT11_FCS_LEN 4
-#define DOT11_ICV_LEN 4
-#define DOT11_ICV_AES_LEN 8
-#define DOT11_QOS_LEN 2
-#define DOT11_HTC_LEN 4
-
-#define DOT11_KEY_INDEX_SHIFT 6
-#define DOT11_IV_LEN 4
-#define DOT11_IV_TKIP_LEN 8
-#define DOT11_IV_AES_OCB_LEN 4
-#define DOT11_IV_AES_CCM_LEN 8
-#define DOT11_IV_MAX_LEN 8
-
-
-#define DOT11_MAX_MPDU_BODY_LEN 2304
-
-#define DOT11_MAX_MPDU_LEN (DOT11_A4_HDR_LEN + \
- DOT11_QOS_LEN + \
- DOT11_IV_AES_CCM_LEN + \
- DOT11_MAX_MPDU_BODY_LEN + \
- DOT11_ICV_LEN + \
- DOT11_FCS_LEN)
-
-#define DOT11_MAX_SSID_LEN 32
-
-
-#define DOT11_DEFAULT_RTS_LEN 2347
-#define DOT11_MAX_RTS_LEN 2347
-
-
-#define DOT11_MIN_FRAG_LEN 256
-#define DOT11_MAX_FRAG_LEN 2346
-#define DOT11_DEFAULT_FRAG_LEN 2346
-
-
-#define DOT11_MIN_BEACON_PERIOD 1
-#define DOT11_MAX_BEACON_PERIOD 0xFFFF
-
-
-#define DOT11_MIN_DTIM_PERIOD 1
-#define DOT11_MAX_DTIM_PERIOD 0xFF
-
-
-#define DOT11_LLC_SNAP_HDR_LEN 8
-#define DOT11_OUI_LEN 3
-BWL_PRE_PACKED_STRUCT struct dot11_llc_snap_header {
- uint8 dsap;
- uint8 ssap;
- uint8 ctl;
- uint8 oui[DOT11_OUI_LEN];
- uint16 type;
-} BWL_POST_PACKED_STRUCT;
-
-
-#define RFC1042_HDR_LEN (ETHER_HDR_LEN + DOT11_LLC_SNAP_HDR_LEN)
-
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_header {
- uint16 fc;
- uint16 durid;
- struct ether_addr a1;
- struct ether_addr a2;
- struct ether_addr a3;
- uint16 seq;
- struct ether_addr a4;
-} BWL_POST_PACKED_STRUCT;
-
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_rts_frame {
- uint16 fc;
- uint16 durid;
- struct ether_addr ra;
- struct ether_addr ta;
-} BWL_POST_PACKED_STRUCT;
-#define DOT11_RTS_LEN 16
-
-BWL_PRE_PACKED_STRUCT struct dot11_cts_frame {
- uint16 fc;
- uint16 durid;
- struct ether_addr ra;
-} BWL_POST_PACKED_STRUCT;
-#define DOT11_CTS_LEN 10
-
-BWL_PRE_PACKED_STRUCT struct dot11_ack_frame {
- uint16 fc;
- uint16 durid;
- struct ether_addr ra;
-} BWL_POST_PACKED_STRUCT;
-#define DOT11_ACK_LEN 10
-
-BWL_PRE_PACKED_STRUCT struct dot11_ps_poll_frame {
- uint16 fc;
- uint16 durid;
- struct ether_addr bssid;
- struct ether_addr ta;
-} BWL_POST_PACKED_STRUCT;
-#define DOT11_PS_POLL_LEN 16
-
-BWL_PRE_PACKED_STRUCT struct dot11_cf_end_frame {
- uint16 fc;
- uint16 durid;
- struct ether_addr ra;
- struct ether_addr bssid;
-} BWL_POST_PACKED_STRUCT;
-#define DOT11_CS_END_LEN 16
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_action_wifi_vendor_specific {
- uint8 category;
- uint8 OUI[3];
- uint8 type;
- uint8 subtype;
- uint8 data[1040];
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_action_wifi_vendor_specific dot11_action_wifi_vendor_specific_t;
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_action_vs_frmhdr {
- uint8 category;
- uint8 OUI[3];
- uint8 type;
- uint8 subtype;
- uint8 data[1];
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_action_vs_frmhdr dot11_action_vs_frmhdr_t;
-#define DOT11_ACTION_VS_HDR_LEN 6
-
-#define BCM_ACTION_OUI_BYTE0 0x00
-#define BCM_ACTION_OUI_BYTE1 0x90
-#define BCM_ACTION_OUI_BYTE2 0x4c
-
-
-#define DOT11_BA_CTL_POLICY_NORMAL 0x0000
-#define DOT11_BA_CTL_POLICY_NOACK 0x0001
-#define DOT11_BA_CTL_POLICY_MASK 0x0001
-
-#define DOT11_BA_CTL_MTID 0x0002
-#define DOT11_BA_CTL_COMPRESSED 0x0004
-
-#define DOT11_BA_CTL_NUMMSDU_MASK 0x0FC0
-#define DOT11_BA_CTL_NUMMSDU_SHIFT 6
-
-#define DOT11_BA_CTL_TID_MASK 0xF000
-#define DOT11_BA_CTL_TID_SHIFT 12
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_ctl_header {
- uint16 fc;
- uint16 durid;
- struct ether_addr ra;
- struct ether_addr ta;
-} BWL_POST_PACKED_STRUCT;
-#define DOT11_CTL_HDR_LEN 16
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_bar {
- uint16 bar_control;
- uint16 seqnum;
-} BWL_POST_PACKED_STRUCT;
-#define DOT11_BAR_LEN 4
-
-#define DOT11_BA_BITMAP_LEN 128
-#define DOT11_BA_CMP_BITMAP_LEN 8
-
-BWL_PRE_PACKED_STRUCT struct dot11_ba {
- uint16 ba_control;
- uint16 seqnum;
- uint8 bitmap[DOT11_BA_BITMAP_LEN];
-} BWL_POST_PACKED_STRUCT;
-#define DOT11_BA_LEN 4
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_management_header {
- uint16 fc;
- uint16 durid;
- struct ether_addr da;
- struct ether_addr sa;
- struct ether_addr bssid;
- uint16 seq;
-} BWL_POST_PACKED_STRUCT;
-#define DOT11_MGMT_HDR_LEN 24
-
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_bcn_prb {
- uint32 timestamp[2];
- uint16 beacon_interval;
- uint16 capability;
-} BWL_POST_PACKED_STRUCT;
-#define DOT11_BCN_PRB_LEN 12
-#define DOT11_BCN_PRB_FIXED_LEN 12
-
-BWL_PRE_PACKED_STRUCT struct dot11_auth {
- uint16 alg;
- uint16 seq;
- uint16 status;
-} BWL_POST_PACKED_STRUCT;
-#define DOT11_AUTH_FIXED_LEN 6
-
-BWL_PRE_PACKED_STRUCT struct dot11_assoc_req {
- uint16 capability;
- uint16 listen;
-} BWL_POST_PACKED_STRUCT;
-#define DOT11_ASSOC_REQ_FIXED_LEN 4
-
-BWL_PRE_PACKED_STRUCT struct dot11_reassoc_req {
- uint16 capability;
- uint16 listen;
- struct ether_addr ap;
-} BWL_POST_PACKED_STRUCT;
-#define DOT11_REASSOC_REQ_FIXED_LEN 10
-
-BWL_PRE_PACKED_STRUCT struct dot11_assoc_resp {
- uint16 capability;
- uint16 status;
- uint16 aid;
-} BWL_POST_PACKED_STRUCT;
-#define DOT11_ASSOC_RESP_FIXED_LEN 6
-
-BWL_PRE_PACKED_STRUCT struct dot11_action_measure {
- uint8 category;
- uint8 action;
- uint8 token;
- uint8 data[1];
-} BWL_POST_PACKED_STRUCT;
-#define DOT11_ACTION_MEASURE_LEN 3
-
-BWL_PRE_PACKED_STRUCT struct dot11_action_ht_ch_width {
- uint8 category;
- uint8 action;
- uint8 ch_width;
-} BWL_POST_PACKED_STRUCT;
-
-BWL_PRE_PACKED_STRUCT struct dot11_action_ht_mimops {
- uint8 category;
- uint8 action;
- uint8 control;
-} BWL_POST_PACKED_STRUCT;
-
-BWL_PRE_PACKED_STRUCT struct dot11_action_sa_query {
- uint8 category;
- uint8 action;
- uint16 id;
-} BWL_POST_PACKED_STRUCT;
-
-#define SM_PWRSAVE_ENABLE 1
-#define SM_PWRSAVE_MODE 2
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_power_cnst {
- uint8 id;
- uint8 len;
- uint8 power;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_power_cnst dot11_power_cnst_t;
-
-BWL_PRE_PACKED_STRUCT struct dot11_power_cap {
- uint8 min;
- uint8 max;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_power_cap dot11_power_cap_t;
-
-BWL_PRE_PACKED_STRUCT struct dot11_tpc_rep {
- uint8 id;
- uint8 len;
- uint8 tx_pwr;
- uint8 margin;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_tpc_rep dot11_tpc_rep_t;
-#define DOT11_MNG_IE_TPC_REPORT_LEN 2
-
-BWL_PRE_PACKED_STRUCT struct dot11_supp_channels {
- uint8 id;
- uint8 len;
- uint8 first_channel;
- uint8 num_channels;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_supp_channels dot11_supp_channels_t;
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_extch {
- uint8 id;
- uint8 len;
- uint8 extch;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_extch dot11_extch_ie_t;
-
-BWL_PRE_PACKED_STRUCT struct dot11_brcm_extch {
- uint8 id;
- uint8 len;
- uint8 oui[3];
- uint8 type;
- uint8 extch;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_brcm_extch dot11_brcm_extch_ie_t;
-
-#define BRCM_EXTCH_IE_LEN 5
-#define BRCM_EXTCH_IE_TYPE 53
-#define DOT11_EXTCH_IE_LEN 1
-#define DOT11_EXT_CH_MASK 0x03
-#define DOT11_EXT_CH_UPPER 0x01
-#define DOT11_EXT_CH_LOWER 0x03
-#define DOT11_EXT_CH_NONE 0x00
-
-BWL_PRE_PACKED_STRUCT struct dot11_action_frmhdr {
- uint8 category;
- uint8 action;
- uint8 data[1];
-} BWL_POST_PACKED_STRUCT;
-#define DOT11_ACTION_FRMHDR_LEN 2
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_channel_switch {
- uint8 id;
- uint8 len;
- uint8 mode;
- uint8 channel;
- uint8 count;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_channel_switch dot11_chan_switch_ie_t;
-
-#define DOT11_SWITCH_IE_LEN 3
-
-#define DOT11_CSA_MODE_ADVISORY 0
-#define DOT11_CSA_MODE_NO_TX 1
-
-BWL_PRE_PACKED_STRUCT struct dot11_action_switch_channel {
- uint8 category;
- uint8 action;
- dot11_chan_switch_ie_t chan_switch_ie;
- dot11_brcm_extch_ie_t extch_ie;
-} BWL_POST_PACKED_STRUCT;
-
-BWL_PRE_PACKED_STRUCT struct dot11_csa_body {
- uint8 mode;
- uint8 reg;
- uint8 channel;
- uint8 count;
-} BWL_POST_PACKED_STRUCT;
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_ext_csa {
- uint8 id;
- uint8 len;
- struct dot11_csa_body b;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_ext_csa dot11_ext_csa_ie_t;
-#define DOT11_EXT_CSA_IE_LEN 4
-
-BWL_PRE_PACKED_STRUCT struct dot11_action_ext_csa {
- uint8 category;
- uint8 action;
- dot11_ext_csa_ie_t chan_switch_ie;
-} BWL_POST_PACKED_STRUCT;
-
-BWL_PRE_PACKED_STRUCT struct dot11y_action_ext_csa {
- uint8 category;
- uint8 action;
- struct dot11_csa_body b;
-} BWL_POST_PACKED_STRUCT;
-
-BWL_PRE_PACKED_STRUCT struct dot11_obss_coex {
- uint8 id;
- uint8 len;
- uint8 info;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_obss_coex dot11_obss_coex_t;
-#define DOT11_OBSS_COEXINFO_LEN 1
-
-#define DOT11_OBSS_COEX_INFO_REQ 0x01
-#define DOT11_OBSS_COEX_40MHZ_INTOLERANT 0x02
-#define DOT11_OBSS_COEX_20MHZ_WIDTH_REQ 0x04
-
-BWL_PRE_PACKED_STRUCT struct dot11_obss_chanlist {
- uint8 id;
- uint8 len;
- uint8 regclass;
- uint8 chanlist[1];
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_obss_chanlist dot11_obss_chanlist_t;
-#define DOT11_OBSS_CHANLIST_FIXED_LEN 1
-
-BWL_PRE_PACKED_STRUCT struct dot11_extcap_ie {
- uint8 id;
- uint8 len;
- uint8 cap[1];
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_extcap_ie dot11_extcap_ie_t;
-
-#define DOT11_EXTCAP_LEN_MAX 7
-#define DOT11_EXTCAP_LEN_COEX 1
-#define DOT11_EXTCAP_LEN_BT 3
-#define DOT11_EXTCAP_LEN_IW 4
-#define DOT11_EXTCAP_LEN_SI 6
-
-#define DOT11_EXTCAP_LEN_TDLS 5
-BWL_PRE_PACKED_STRUCT struct dot11_extcap {
- uint8 extcap[DOT11_EXTCAP_LEN_TDLS];
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_extcap dot11_extcap_t;
-
-
-#define TDLS_CAP_TDLS 37
-#define TDLS_CAP_PU_BUFFER_STA 28
-#define TDLS_CAP_PEER_PSM 20
-#define TDLS_CAP_CH_SW 30
-#define TDLS_CAP_PROH 38
-#define TDLS_CAP_CH_SW_PROH 39
-
-#define TDLS_CAP_MAX_BIT 39
-
-
-
-#define DOT11_MEASURE_TYPE_BASIC 0
-#define DOT11_MEASURE_TYPE_CCA 1
-#define DOT11_MEASURE_TYPE_RPI 2
-#define DOT11_MEASURE_TYPE_CHLOAD 3
-#define DOT11_MEASURE_TYPE_NOISE 4
-#define DOT11_MEASURE_TYPE_BEACON 5
-#define DOT11_MEASURE_TYPE_FRAME 6
-#define DOT11_MEASURE_TYPE_STATS 7
-#define DOT11_MEASURE_TYPE_LCI 8
-#define DOT11_MEASURE_TYPE_TXSTREAM 9
-#define DOT11_MEASURE_TYPE_PAUSE 255
-
-
-#define DOT11_MEASURE_MODE_PARALLEL (1<<0)
-#define DOT11_MEASURE_MODE_ENABLE (1<<1)
-#define DOT11_MEASURE_MODE_REQUEST (1<<2)
-#define DOT11_MEASURE_MODE_REPORT (1<<3)
-#define DOT11_MEASURE_MODE_DUR (1<<4)
-
-#define DOT11_MEASURE_MODE_LATE (1<<0)
-#define DOT11_MEASURE_MODE_INCAPABLE (1<<1)
-#define DOT11_MEASURE_MODE_REFUSED (1<<2)
-
-#define DOT11_MEASURE_BASIC_MAP_BSS ((uint8)(1<<0))
-#define DOT11_MEASURE_BASIC_MAP_OFDM ((uint8)(1<<1))
-#define DOT11_MEASURE_BASIC_MAP_UKNOWN ((uint8)(1<<2))
-#define DOT11_MEASURE_BASIC_MAP_RADAR ((uint8)(1<<3))
-#define DOT11_MEASURE_BASIC_MAP_UNMEAS ((uint8)(1<<4))
-
-BWL_PRE_PACKED_STRUCT struct dot11_meas_req {
- uint8 id;
- uint8 len;
- uint8 token;
- uint8 mode;
- uint8 type;
- uint8 channel;
- uint8 start_time[8];
- uint16 duration;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_meas_req dot11_meas_req_t;
-#define DOT11_MNG_IE_MREQ_LEN 14
-
-#define DOT11_MNG_IE_MREQ_FIXED_LEN 3
-
-BWL_PRE_PACKED_STRUCT struct dot11_meas_rep {
- uint8 id;
- uint8 len;
- uint8 token;
- uint8 mode;
- uint8 type;
- BWL_PRE_PACKED_STRUCT union
- {
- BWL_PRE_PACKED_STRUCT struct {
- uint8 channel;
- uint8 start_time[8];
- uint16 duration;
- uint8 map;
- } BWL_POST_PACKED_STRUCT basic;
- uint8 data[1];
- } BWL_POST_PACKED_STRUCT rep;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_meas_rep dot11_meas_rep_t;
-
-
-#define DOT11_MNG_IE_MREP_FIXED_LEN 3
-
-BWL_PRE_PACKED_STRUCT struct dot11_meas_rep_basic {
- uint8 channel;
- uint8 start_time[8];
- uint16 duration;
- uint8 map;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_meas_rep_basic dot11_meas_rep_basic_t;
-#define DOT11_MEASURE_BASIC_REP_LEN 12
-
-BWL_PRE_PACKED_STRUCT struct dot11_quiet {
- uint8 id;
- uint8 len;
- uint8 count;
- uint8 period;
- uint16 duration;
- uint16 offset;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_quiet dot11_quiet_t;
-
-BWL_PRE_PACKED_STRUCT struct chan_map_tuple {
- uint8 channel;
- uint8 map;
-} BWL_POST_PACKED_STRUCT;
-typedef struct chan_map_tuple chan_map_tuple_t;
-
-BWL_PRE_PACKED_STRUCT struct dot11_ibss_dfs {
- uint8 id;
- uint8 len;
- uint8 eaddr[ETHER_ADDR_LEN];
- uint8 interval;
- chan_map_tuple_t map[1];
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_ibss_dfs dot11_ibss_dfs_t;
-
-
-#define WME_OUI "\x00\x50\xf2"
-#define WME_OUI_LEN 3
-#define WME_OUI_TYPE 2
-#define WME_TYPE 2
-#define WME_SUBTYPE_IE 0
-#define WME_SUBTYPE_PARAM_IE 1
-#define WME_SUBTYPE_TSPEC 2
-#define WME_VER 1
-
-
-#define AC_BE 0
-#define AC_BK 1
-#define AC_VI 2
-#define AC_VO 3
-#define AC_COUNT 4
-
-typedef uint8 ac_bitmap_t;
-
-#define AC_BITMAP_NONE 0x0
-#define AC_BITMAP_ALL 0xf
-#define AC_BITMAP_TST(ab, ac) (((ab) & (1 << (ac))) != 0)
-#define AC_BITMAP_SET(ab, ac) (((ab) |= (1 << (ac))))
-#define AC_BITMAP_RESET(ab, ac) (((ab) &= ~(1 << (ac))))
-
-
-BWL_PRE_PACKED_STRUCT struct wme_ie {
- uint8 oui[3];
- uint8 type;
- uint8 subtype;
- uint8 version;
- uint8 qosinfo;
-} BWL_POST_PACKED_STRUCT;
-typedef struct wme_ie wme_ie_t;
-#define WME_IE_LEN 7
-
-BWL_PRE_PACKED_STRUCT struct edcf_acparam {
- uint8 ACI;
- uint8 ECW;
- uint16 TXOP;
-} BWL_POST_PACKED_STRUCT;
-typedef struct edcf_acparam edcf_acparam_t;
-
-
-BWL_PRE_PACKED_STRUCT struct wme_param_ie {
- uint8 oui[3];
- uint8 type;
- uint8 subtype;
- uint8 version;
- uint8 qosinfo;
- uint8 rsvd;
- edcf_acparam_t acparam[AC_COUNT];
-} BWL_POST_PACKED_STRUCT;
-typedef struct wme_param_ie wme_param_ie_t;
-#define WME_PARAM_IE_LEN 24
-
-
-#define WME_QI_AP_APSD_MASK 0x80
-#define WME_QI_AP_APSD_SHIFT 7
-#define WME_QI_AP_COUNT_MASK 0x0f
-#define WME_QI_AP_COUNT_SHIFT 0
-
-
-#define WME_QI_STA_MAXSPLEN_MASK 0x60
-#define WME_QI_STA_MAXSPLEN_SHIFT 5
-#define WME_QI_STA_APSD_ALL_MASK 0xf
-#define WME_QI_STA_APSD_ALL_SHIFT 0
-#define WME_QI_STA_APSD_BE_MASK 0x8
-#define WME_QI_STA_APSD_BE_SHIFT 3
-#define WME_QI_STA_APSD_BK_MASK 0x4
-#define WME_QI_STA_APSD_BK_SHIFT 2
-#define WME_QI_STA_APSD_VI_MASK 0x2
-#define WME_QI_STA_APSD_VI_SHIFT 1
-#define WME_QI_STA_APSD_VO_MASK 0x1
-#define WME_QI_STA_APSD_VO_SHIFT 0
-
-
-#define EDCF_AIFSN_MIN 1
-#define EDCF_AIFSN_MAX 15
-#define EDCF_AIFSN_MASK 0x0f
-#define EDCF_ACM_MASK 0x10
-#define EDCF_ACI_MASK 0x60
-#define EDCF_ACI_SHIFT 5
-#define EDCF_AIFSN_SHIFT 12
-
-
-#define EDCF_ECW_MIN 0
-#define EDCF_ECW_MAX 15
-#define EDCF_ECW2CW(exp) ((1 << (exp)) - 1)
-#define EDCF_ECWMIN_MASK 0x0f
-#define EDCF_ECWMAX_MASK 0xf0
-#define EDCF_ECWMAX_SHIFT 4
-
-
-#define EDCF_TXOP_MIN 0
-#define EDCF_TXOP_MAX 65535
-#define EDCF_TXOP2USEC(txop) ((txop) << 5)
-
-
-#define NON_EDCF_AC_BE_ACI_STA 0x02
-
-
-#define EDCF_AC_BE_ACI_STA 0x03
-#define EDCF_AC_BE_ECW_STA 0xA4
-#define EDCF_AC_BE_TXOP_STA 0x0000
-#define EDCF_AC_BK_ACI_STA 0x27
-#define EDCF_AC_BK_ECW_STA 0xA4
-#define EDCF_AC_BK_TXOP_STA 0x0000
-#define EDCF_AC_VI_ACI_STA 0x42
-#define EDCF_AC_VI_ECW_STA 0x43
-#define EDCF_AC_VI_TXOP_STA 0x005e
-#define EDCF_AC_VO_ACI_STA 0x62
-#define EDCF_AC_VO_ECW_STA 0x32
-#define EDCF_AC_VO_TXOP_STA 0x002f
-
-
-#define EDCF_AC_BE_ACI_AP 0x03
-#define EDCF_AC_BE_ECW_AP 0x64
-#define EDCF_AC_BE_TXOP_AP 0x0000
-#define EDCF_AC_BK_ACI_AP 0x27
-#define EDCF_AC_BK_ECW_AP 0xA4
-#define EDCF_AC_BK_TXOP_AP 0x0000
-#define EDCF_AC_VI_ACI_AP 0x41
-#define EDCF_AC_VI_ECW_AP 0x43
-#define EDCF_AC_VI_TXOP_AP 0x005e
-#define EDCF_AC_VO_ACI_AP 0x61
-#define EDCF_AC_VO_ECW_AP 0x32
-#define EDCF_AC_VO_TXOP_AP 0x002f
-
-
-BWL_PRE_PACKED_STRUCT struct edca_param_ie {
- uint8 qosinfo;
- uint8 rsvd;
- edcf_acparam_t acparam[AC_COUNT];
-} BWL_POST_PACKED_STRUCT;
-typedef struct edca_param_ie edca_param_ie_t;
-#define EDCA_PARAM_IE_LEN 18
-
-
-BWL_PRE_PACKED_STRUCT struct qos_cap_ie {
- uint8 qosinfo;
-} BWL_POST_PACKED_STRUCT;
-typedef struct qos_cap_ie qos_cap_ie_t;
-
-BWL_PRE_PACKED_STRUCT struct dot11_qbss_load_ie {
- uint8 id;
- uint8 length;
- uint16 station_count;
- uint8 channel_utilization;
- uint16 aac;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_qbss_load_ie dot11_qbss_load_ie_t;
-#define BSS_LOAD_IE_SIZE 7
-
-
-#define FIXED_MSDU_SIZE 0x8000
-#define MSDU_SIZE_MASK 0x7fff
-
-
-
-#define INTEGER_SHIFT 13
-#define FRACTION_MASK 0x1FFF
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_management_notification {
- uint8 category;
- uint8 action;
- uint8 token;
- uint8 status;
- uint8 data[1];
-} BWL_POST_PACKED_STRUCT;
-#define DOT11_MGMT_NOTIFICATION_LEN 4
-
-
-BWL_PRE_PACKED_STRUCT struct ti_ie {
- uint8 ti_type;
- uint32 ti_val;
-} BWL_POST_PACKED_STRUCT;
-typedef struct ti_ie ti_ie_t;
-#define TI_TYPE_REASSOC_DEADLINE 1
-#define TI_TYPE_KEY_LIFETIME 2
-
-
-#define WME_ADDTS_REQUEST 0
-#define WME_ADDTS_RESPONSE 1
-#define WME_DELTS_REQUEST 2
-
-
-#define WME_ADMISSION_ACCEPTED 0
-#define WME_INVALID_PARAMETERS 1
-#define WME_ADMISSION_REFUSED 3
-
-
-#define BCN_PRB_SSID(body) ((char*)(body) + DOT11_BCN_PRB_LEN)
-
-
-#define DOT11_OPEN_SYSTEM 0
-#define DOT11_SHARED_KEY 1
-#define DOT11_FAST_BSS 2
-#define DOT11_CHALLENGE_LEN 128
-
-
-#define FC_PVER_MASK 0x3
-#define FC_PVER_SHIFT 0
-#define FC_TYPE_MASK 0xC
-#define FC_TYPE_SHIFT 2
-#define FC_SUBTYPE_MASK 0xF0
-#define FC_SUBTYPE_SHIFT 4
-#define FC_TODS 0x100
-#define FC_TODS_SHIFT 8
-#define FC_FROMDS 0x200
-#define FC_FROMDS_SHIFT 9
-#define FC_MOREFRAG 0x400
-#define FC_MOREFRAG_SHIFT 10
-#define FC_RETRY 0x800
-#define FC_RETRY_SHIFT 11
-#define FC_PM 0x1000
-#define FC_PM_SHIFT 12
-#define FC_MOREDATA 0x2000
-#define FC_MOREDATA_SHIFT 13
-#define FC_WEP 0x4000
-#define FC_WEP_SHIFT 14
-#define FC_ORDER 0x8000
-#define FC_ORDER_SHIFT 15
-
-
-#define SEQNUM_SHIFT 4
-#define SEQNUM_MAX 0x1000
-#define FRAGNUM_MASK 0xF
-
-
-
-
-#define FC_TYPE_MNG 0
-#define FC_TYPE_CTL 1
-#define FC_TYPE_DATA 2
-
-
-#define FC_SUBTYPE_ASSOC_REQ 0
-#define FC_SUBTYPE_ASSOC_RESP 1
-#define FC_SUBTYPE_REASSOC_REQ 2
-#define FC_SUBTYPE_REASSOC_RESP 3
-#define FC_SUBTYPE_PROBE_REQ 4
-#define FC_SUBTYPE_PROBE_RESP 5
-#define FC_SUBTYPE_BEACON 8
-#define FC_SUBTYPE_ATIM 9
-#define FC_SUBTYPE_DISASSOC 10
-#define FC_SUBTYPE_AUTH 11
-#define FC_SUBTYPE_DEAUTH 12
-#define FC_SUBTYPE_ACTION 13
-#define FC_SUBTYPE_ACTION_NOACK 14
-
-
-#define FC_SUBTYPE_CTL_WRAPPER 7
-#define FC_SUBTYPE_BLOCKACK_REQ 8
-#define FC_SUBTYPE_BLOCKACK 9
-#define FC_SUBTYPE_PS_POLL 10
-#define FC_SUBTYPE_RTS 11
-#define FC_SUBTYPE_CTS 12
-#define FC_SUBTYPE_ACK 13
-#define FC_SUBTYPE_CF_END 14
-#define FC_SUBTYPE_CF_END_ACK 15
-
-
-#define FC_SUBTYPE_DATA 0
-#define FC_SUBTYPE_DATA_CF_ACK 1
-#define FC_SUBTYPE_DATA_CF_POLL 2
-#define FC_SUBTYPE_DATA_CF_ACK_POLL 3
-#define FC_SUBTYPE_NULL 4
-#define FC_SUBTYPE_CF_ACK 5
-#define FC_SUBTYPE_CF_POLL 6
-#define FC_SUBTYPE_CF_ACK_POLL 7
-#define FC_SUBTYPE_QOS_DATA 8
-#define FC_SUBTYPE_QOS_DATA_CF_ACK 9
-#define FC_SUBTYPE_QOS_DATA_CF_POLL 10
-#define FC_SUBTYPE_QOS_DATA_CF_ACK_POLL 11
-#define FC_SUBTYPE_QOS_NULL 12
-#define FC_SUBTYPE_QOS_CF_POLL 14
-#define FC_SUBTYPE_QOS_CF_ACK_POLL 15
-
-
-#define FC_SUBTYPE_ANY_QOS(s) (((s) & 8) != 0)
-#define FC_SUBTYPE_ANY_NULL(s) (((s) & 4) != 0)
-#define FC_SUBTYPE_ANY_CF_POLL(s) (((s) & 2) != 0)
-#define FC_SUBTYPE_ANY_CF_ACK(s) (((s) & 1) != 0)
-
-
-#define FC_KIND_MASK (FC_TYPE_MASK | FC_SUBTYPE_MASK)
-
-#define FC_KIND(t, s) (((t) << FC_TYPE_SHIFT) | ((s) << FC_SUBTYPE_SHIFT))
-
-#define FC_SUBTYPE(fc) (((fc) & FC_SUBTYPE_MASK) >> FC_SUBTYPE_SHIFT)
-#define FC_TYPE(fc) (((fc) & FC_TYPE_MASK) >> FC_TYPE_SHIFT)
-
-#define FC_ASSOC_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ASSOC_REQ)
-#define FC_ASSOC_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ASSOC_RESP)
-#define FC_REASSOC_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_REASSOC_REQ)
-#define FC_REASSOC_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_REASSOC_RESP)
-#define FC_PROBE_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_REQ)
-#define FC_PROBE_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_RESP)
-#define FC_BEACON FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_BEACON)
-#define FC_DISASSOC FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_DISASSOC)
-#define FC_AUTH FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_AUTH)
-#define FC_DEAUTH FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_DEAUTH)
-#define FC_ACTION FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ACTION)
-#define FC_ACTION_NOACK FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ACTION_NOACK)
-
-#define FC_CTL_WRAPPER FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CTL_WRAPPER)
-#define FC_BLOCKACK_REQ FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_BLOCKACK_REQ)
-#define FC_BLOCKACK FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_BLOCKACK)
-#define FC_PS_POLL FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_PS_POLL)
-#define FC_RTS FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_RTS)
-#define FC_CTS FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CTS)
-#define FC_ACK FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_ACK)
-#define FC_CF_END FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CF_END)
-#define FC_CF_END_ACK FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CF_END_ACK)
-
-#define FC_DATA FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_DATA)
-#define FC_NULL_DATA FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_NULL)
-#define FC_DATA_CF_ACK FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_DATA_CF_ACK)
-#define FC_QOS_DATA FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_QOS_DATA)
-#define FC_QOS_NULL FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_QOS_NULL)
-
-
-
-
-#define QOS_PRIO_SHIFT 0
-#define QOS_PRIO_MASK 0x0007
-#define QOS_PRIO(qos) (((qos) & QOS_PRIO_MASK) >> QOS_PRIO_SHIFT)
-
-
-#define QOS_TID_SHIFT 0
-#define QOS_TID_MASK 0x000f
-#define QOS_TID(qos) (((qos) & QOS_TID_MASK) >> QOS_TID_SHIFT)
-
-
-#define QOS_EOSP_SHIFT 4
-#define QOS_EOSP_MASK 0x0010
-#define QOS_EOSP(qos) (((qos) & QOS_EOSP_MASK) >> QOS_EOSP_SHIFT)
-
-
-#define QOS_ACK_NORMAL_ACK 0
-#define QOS_ACK_NO_ACK 1
-#define QOS_ACK_NO_EXP_ACK 2
-#define QOS_ACK_BLOCK_ACK 3
-#define QOS_ACK_SHIFT 5
-#define QOS_ACK_MASK 0x0060
-#define QOS_ACK(qos) (((qos) & QOS_ACK_MASK) >> QOS_ACK_SHIFT)
-
-
-#define QOS_AMSDU_SHIFT 7
-#define QOS_AMSDU_MASK 0x0080
-
-
-
-
-
-
-#define DOT11_MNG_AUTH_ALGO_LEN 2
-#define DOT11_MNG_AUTH_SEQ_LEN 2
-#define DOT11_MNG_BEACON_INT_LEN 2
-#define DOT11_MNG_CAP_LEN 2
-#define DOT11_MNG_AP_ADDR_LEN 6
-#define DOT11_MNG_LISTEN_INT_LEN 2
-#define DOT11_MNG_REASON_LEN 2
-#define DOT11_MNG_AID_LEN 2
-#define DOT11_MNG_STATUS_LEN 2
-#define DOT11_MNG_TIMESTAMP_LEN 8
-
-
-#define DOT11_AID_MASK 0x3fff
-
-
-#define DOT11_RC_RESERVED 0
-#define DOT11_RC_UNSPECIFIED 1
-#define DOT11_RC_AUTH_INVAL 2
-#define DOT11_RC_DEAUTH_LEAVING 3
-#define DOT11_RC_INACTIVITY 4
-#define DOT11_RC_BUSY 5
-#define DOT11_RC_INVAL_CLASS_2 6
-#define DOT11_RC_INVAL_CLASS_3 7
-#define DOT11_RC_DISASSOC_LEAVING 8
-#define DOT11_RC_NOT_AUTH 9
-#define DOT11_RC_BAD_PC 10
-#define DOT11_RC_BAD_CHANNELS 11
-
-
-
-#define DOT11_RC_UNSPECIFIED_QOS 32
-#define DOT11_RC_INSUFFCIENT_BW 33
-#define DOT11_RC_EXCESSIVE_FRAMES 34
-#define DOT11_RC_TX_OUTSIDE_TXOP 35
-#define DOT11_RC_LEAVING_QBSS 36
-#define DOT11_RC_BAD_MECHANISM 37
-#define DOT11_RC_SETUP_NEEDED 38
-#define DOT11_RC_TIMEOUT 39
-
-#define DOT11_RC_MAX 23
-
-#define DOT11_RC_TDLS_PEER_UNREACH 25
-#define DOT11_RC_TDLS_DOWN_UNSPECIFIED 26
-
-
-#define DOT11_SC_SUCCESS 0
-#define DOT11_SC_FAILURE 1
-#define DOT11_SC_TDLS_WAKEUP_SCH_ALT 2
-
-#define DOT11_SC_TDLS_WAKEUP_SCH_REJ 3
-#define DOT11_SC_TDLS_SEC_DISABLED 5
-#define DOT11_SC_LIFETIME_REJ 6
-#define DOT11_SC_NOT_SAME_BSS 7
-#define DOT11_SC_CAP_MISMATCH 10
-#define DOT11_SC_REASSOC_FAIL 11
-#define DOT11_SC_ASSOC_FAIL 12
-#define DOT11_SC_AUTH_MISMATCH 13
-#define DOT11_SC_AUTH_SEQ 14
-#define DOT11_SC_AUTH_CHALLENGE_FAIL 15
-#define DOT11_SC_AUTH_TIMEOUT 16
-#define DOT11_SC_ASSOC_BUSY_FAIL 17
-#define DOT11_SC_ASSOC_RATE_MISMATCH 18
-#define DOT11_SC_ASSOC_SHORT_REQUIRED 19
-#define DOT11_SC_ASSOC_PBCC_REQUIRED 20
-#define DOT11_SC_ASSOC_AGILITY_REQUIRED 21
-#define DOT11_SC_ASSOC_SPECTRUM_REQUIRED 22
-#define DOT11_SC_ASSOC_BAD_POWER_CAP 23
-#define DOT11_SC_ASSOC_BAD_SUP_CHANNELS 24
-#define DOT11_SC_ASSOC_SHORTSLOT_REQUIRED 25
-#define DOT11_SC_ASSOC_ERPBCC_REQUIRED 26
-#define DOT11_SC_ASSOC_DSSOFDM_REQUIRED 27
-#define DOT11_SC_ASSOC_R0KH_UNREACHABLE 28
-#define DOT11_SC_ASSOC_TRY_LATER 30
-#define DOT11_SC_ASSOC_MFP_VIOLATION 31
-
-#define DOT11_SC_DECLINED 37
-#define DOT11_SC_INVALID_PARAMS 38
-#define DOT11_SC_INVALID_PAIRWISE_CIPHER 42
-#define DOT11_SC_INVALID_AKMP 43
-#define DOT11_SC_INVALID_RSNIE_CAP 45
-#define DOT11_SC_DLS_NOT_ALLOWED 48
-#define DOT11_SC_INVALID_PMKID 53
-#define DOT11_SC_INVALID_MDID 54
-#define DOT11_SC_INVALID_FTIE 55
-
-#define DOT11_SC_UNEXP_MSG 70
-#define DOT11_SC_INVALID_SNONCE 71
-#define DOT11_SC_INVALID_RSNIE 72
-
-
-#define DOT11_MNG_DS_PARAM_LEN 1
-#define DOT11_MNG_IBSS_PARAM_LEN 2
-
-
-#define DOT11_MNG_TIM_FIXED_LEN 3
-#define DOT11_MNG_TIM_DTIM_COUNT 0
-#define DOT11_MNG_TIM_DTIM_PERIOD 1
-#define DOT11_MNG_TIM_BITMAP_CTL 2
-#define DOT11_MNG_TIM_PVB 3
-
-
-#define TLV_TAG_OFF 0
-#define TLV_LEN_OFF 1
-#define TLV_HDR_LEN 2
-#define TLV_BODY_OFF 2
-
-
-#define DOT11_MNG_SSID_ID 0
-#define DOT11_MNG_RATES_ID 1
-#define DOT11_MNG_FH_PARMS_ID 2
-#define DOT11_MNG_DS_PARMS_ID 3
-#define DOT11_MNG_CF_PARMS_ID 4
-#define DOT11_MNG_TIM_ID 5
-#define DOT11_MNG_IBSS_PARMS_ID 6
-#define DOT11_MNG_COUNTRY_ID 7
-#define DOT11_MNG_HOPPING_PARMS_ID 8
-#define DOT11_MNG_HOPPING_TABLE_ID 9
-#define DOT11_MNG_REQUEST_ID 10
-#define DOT11_MNG_QBSS_LOAD_ID 11
-#define DOT11_MNG_EDCA_PARAM_ID 12
-#define DOT11_MNG_CHALLENGE_ID 16
-#define DOT11_MNG_PWR_CONSTRAINT_ID 32
-#define DOT11_MNG_PWR_CAP_ID 33
-#define DOT11_MNG_TPC_REQUEST_ID 34
-#define DOT11_MNG_TPC_REPORT_ID 35
-#define DOT11_MNG_SUPP_CHANNELS_ID 36
-#define DOT11_MNG_CHANNEL_SWITCH_ID 37
-#define DOT11_MNG_MEASURE_REQUEST_ID 38
-#define DOT11_MNG_MEASURE_REPORT_ID 39
-#define DOT11_MNG_QUIET_ID 40
-#define DOT11_MNG_IBSS_DFS_ID 41
-#define DOT11_MNG_ERP_ID 42
-#define DOT11_MNG_TS_DELAY_ID 43
-#define DOT11_MNG_HT_CAP 45
-#define DOT11_MNG_QOS_CAP_ID 46
-#define DOT11_MNG_NONERP_ID 47
-#define DOT11_MNG_RSN_ID 48
-#define DOT11_MNG_EXT_RATES_ID 50
-#define DOT11_MNG_AP_CHREP_ID 51
-#define DOT11_MNG_NBR_REP_ID 52
-#define DOT11_MNG_MDIE_ID 54
-#define DOT11_MNG_FTIE_ID 55
-#define DOT11_MNG_FT_TI_ID 56
-#define DOT11_MNG_REGCLASS_ID 59
-#define DOT11_MNG_EXT_CSA_ID 60
-#define DOT11_MNG_HT_ADD 61
-#define DOT11_MNG_EXT_CHANNEL_OFFSET 62
-#define DOT11_MNG_WAPI_ID 68
-#define DOT11_MNG_TIME_ADVERTISE_ID 69
-#define DOT11_MNG_RRM_CAP_ID 70
-#define DOT11_MNG_HT_BSS_COEXINFO_ID 72
-#define DOT11_MNG_HT_BSS_CHANNEL_REPORT_ID 73
-#define DOT11_MNG_HT_OBSS_ID 74
-#define DOT11_MNG_CHANNEL_USAGE 97
-#define DOT11_MNG_TIME_ZONE_ID 98
-#define DOT11_MNG_LINK_IDENTIFIER_ID 101
-#define DOT11_MNG_WAKEUP_SCHEDULE_ID 102
-#define DOT11_MNG_CHANNEL_SWITCH_TIMING_ID 104
-#define DOT11_MNG_PTI_CONTROL_ID 105
-#define DOT11_MNG_PU_BUFFER_STATUS_ID 106
-#define DOT11_MNG_INTERWORKING_ID 107
-#define DOT11_MNG_ADVERTISEMENT_ID 108
-#define DOT11_MNG_EXP_BW_REQ_ID 109
-#define DOT11_MNG_QOS_MAP_ID 110
-#define DOT11_MNG_ROAM_CONSORT_ID 111
-#define DOT11_MNG_EMERGCY_ALERT_ID 112
-#define DOT11_MNG_EXT_CAP_ID 127
-#define DOT11_MNG_VHT_CAP_ID 191
-#define DOT11_MNG_VHT_OPERATION_ID 192
-
-#define DOT11_MNG_WPA_ID 221
-#define DOT11_MNG_PROPR_ID 221
-
-#define DOT11_MNG_VS_ID 221
-
-
-#define DOT11_RATE_BASIC 0x80
-#define DOT11_RATE_MASK 0x7F
-
-
-#define DOT11_MNG_ERP_LEN 1
-#define DOT11_MNG_NONERP_PRESENT 0x01
-#define DOT11_MNG_USE_PROTECTION 0x02
-#define DOT11_MNG_BARKER_PREAMBLE 0x04
-
-#define DOT11_MGN_TS_DELAY_LEN 4
-#define TS_DELAY_FIELD_SIZE 4
-
-
-#define DOT11_CAP_ESS 0x0001
-#define DOT11_CAP_IBSS 0x0002
-#define DOT11_CAP_POLLABLE 0x0004
-#define DOT11_CAP_POLL_RQ 0x0008
-#define DOT11_CAP_PRIVACY 0x0010
-#define DOT11_CAP_SHORT 0x0020
-#define DOT11_CAP_PBCC 0x0040
-#define DOT11_CAP_AGILITY 0x0080
-#define DOT11_CAP_SPECTRUM 0x0100
-#define DOT11_CAP_SHORTSLOT 0x0400
-#define DOT11_CAP_RRM 0x1000
-#define DOT11_CAP_CCK_OFDM 0x2000
-
-
-
-#define DOT11_EXT_CAP_OBSS_COEX_MGMT 0
-
-#define DOT11_EXT_CAP_SPSMP 6
-
-#define DOT11_EXT_CAP_BSS_TRANSITION_MGMT 19
-
-#define DOT11_EXT_CAP_IW 31
-
-#define DOT11_EXT_CAP_SI 41
-#define DOT11_EXT_CAP_SI_MASK 0x0E
-
-
-#define DOT11_ACTION_HDR_LEN 2
-#define DOT11_ACTION_CAT_OFF 0
-#define DOT11_ACTION_ACT_OFF 1
-
-
-#define DOT11_ACTION_CAT_ERR_MASK 0x80
-#define DOT11_ACTION_CAT_MASK 0x7F
-#define DOT11_ACTION_CAT_SPECT_MNG 0
-#define DOT11_ACTION_CAT_QOS 1
-#define DOT11_ACTION_CAT_DLS 2
-#define DOT11_ACTION_CAT_BLOCKACK 3
-#define DOT11_ACTION_CAT_PUBLIC 4
-#define DOT11_ACTION_CAT_RRM 5
-#define DOT11_ACTION_CAT_FBT 6
-#define DOT11_ACTION_CAT_HT 7
-#define DOT11_ACTION_CAT_SA_QUERY 8
-#define DOT11_ACTION_CAT_PDPA 9
-#define DOT11_ACTION_CAT_BSSMGMT 10
-#define DOT11_ACTION_NOTIFICATION 17
-#define DOT11_ACTION_CAT_VSP 126
-#define DOT11_ACTION_CAT_VS 127
-
-
-#define DOT11_SM_ACTION_M_REQ 0
-#define DOT11_SM_ACTION_M_REP 1
-#define DOT11_SM_ACTION_TPC_REQ 2
-#define DOT11_SM_ACTION_TPC_REP 3
-#define DOT11_SM_ACTION_CHANNEL_SWITCH 4
-#define DOT11_SM_ACTION_EXT_CSA 5
-
-
-#define DOT11_ACTION_ID_HT_CH_WIDTH 0
-#define DOT11_ACTION_ID_HT_MIMO_PS 1
-
-
-#define DOT11_PUB_ACTION_BSS_COEX_MNG 0
-#define DOT11_PUB_ACTION_CHANNEL_SWITCH 4
-
-
-#define DOT11_BA_ACTION_ADDBA_REQ 0
-#define DOT11_BA_ACTION_ADDBA_RESP 1
-#define DOT11_BA_ACTION_DELBA 2
-
-
-#define DOT11_ADDBA_PARAM_AMSDU_SUP 0x0001
-#define DOT11_ADDBA_PARAM_POLICY_MASK 0x0002
-#define DOT11_ADDBA_PARAM_POLICY_SHIFT 1
-#define DOT11_ADDBA_PARAM_TID_MASK 0x003c
-#define DOT11_ADDBA_PARAM_TID_SHIFT 2
-#define DOT11_ADDBA_PARAM_BSIZE_MASK 0xffc0
-#define DOT11_ADDBA_PARAM_BSIZE_SHIFT 6
-
-#define DOT11_ADDBA_POLICY_DELAYED 0
-#define DOT11_ADDBA_POLICY_IMMEDIATE 1
-
-
-#define DOT11_FT_ACTION_FT_RESERVED 0
-#define DOT11_FT_ACTION_FT_REQ 1
-#define DOT11_FT_ACTION_FT_RES 2
-#define DOT11_FT_ACTION_FT_CON 3
-#define DOT11_FT_ACTION_FT_ACK 4
-
-
-#define DOT11_DLS_ACTION_REQ 0
-#define DOT11_DLS_ACTION_RESP 1
-#define DOT11_DLS_ACTION_TD 2
-
-
-#define DOT11_WNM_ACTION_EVENT_REQ 0
-#define DOT11_WNM_ACTION_EVENT_REP 1
-#define DOT11_WNM_ACTION_DIAG_REQ 2
-#define DOT11_WNM_ACTION_DIAG_REP 3
-#define DOT11_WNM_ACTION_LOC_CFG_REQ 4
-#define DOT11_WNM_ACTION_LOC_RFG_RESP 5
-#define DOT11_WNM_ACTION_BSS_TRANS_QURY 6
-#define DOT11_WNM_ACTION_BSS_TRANS_REQ 7
-#define DOT11_WNM_ACTION_BSS_TRANS_RESP 8
-#define DOT11_WNM_ACTION_FMS_REQ 9
-#define DOT11_WNM_ACTION_FMS_RESP 10
-#define DOT11_WNM_ACTION_COL_INTRFRNCE_REQ 11
-#define DOT11_WNM_ACTION_COL_INTRFRNCE_REP 12
-#define DOT11_WNM_ACTION_TFS_REQ 13
-#define DOT11_WNM_ACTION_TFS_RESP 14
-#define DOT11_WNM_ACTION_TFS_NOTIFY 15
-#define DOT11_WNM_ACTION_WNM_SLEEP_REQ 16
-#define DOT11_WNM_ACTION_WNM_SLEEP_RESP 17
-#define DOT11_WNM_ACTION_TIM_BCAST_REQ 18
-#define DOT11_WNM_ACTION_TIM_BCAST_RESP 19
-#define DOT11_WNM_ACTION_QOS_TRFC_CAP_UPD 20
-#define DOT11_WNM_ACTION_CHAN_USAGE_REQ 21
-#define DOT11_WNM_ACTION_CHAN_USAGE_RESP 22
-#define DOT11_WNM_ACTION_DMS_REQ 23
-#define DOT11_WNM_ACTION_DMS_RESP 24
-#define DOT11_WNM_ACTION_TMNG_MEASUR_REQ 25
-#define DOT11_WNM_ACTION_NOTFCTN_REQ 26
-#define DOT11_WNM_ACTION_NOTFCTN_RES 27
-
-#define DOT11_MNG_COUNTRY_ID_LEN 3
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_dls_req {
- uint8 category;
- uint8 action;
- struct ether_addr da;
- struct ether_addr sa;
- uint16 cap;
- uint16 timeout;
- uint8 data[1];
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_dls_req dot11_dls_req_t;
-#define DOT11_DLS_REQ_LEN 18
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_dls_resp {
- uint8 category;
- uint8 action;
- uint16 status;
- struct ether_addr da;
- struct ether_addr sa;
- uint8 data[1];
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_dls_resp dot11_dls_resp_t;
-#define DOT11_DLS_RESP_LEN 16
-
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_bss_trans_query {
- uint8 category;
- uint8 action;
- uint8 token;
- uint8 reason;
- uint8 data[1];
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_bss_trans_query dot11_bss_trans_query_t;
-#define DOT11_BSS_TRANS_QUERY_LEN 4
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_bss_trans_req {
- uint8 category;
- uint8 action;
- uint8 token;
- uint8 reqmode;
- uint16 disassoc_tmr;
- uint8 validity_intrvl;
- uint8 data[1];
-
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_bss_trans_req dot11_bss_trans_req_t;
-#define DOT11_BSS_TRANS_REQ_LEN 7
-
-#define DOT11_BSS_TERM_DUR_LEN 12
-
-
-
-#define DOT11_BSS_TRNS_REQMODE_PREF_LIST_INCL 0x01
-#define DOT11_BSS_TRNS_REQMODE_ABRIDGED 0x02
-#define DOT11_BSS_TRNS_REQMODE_DISASSOC_IMMINENT 0x04
-#define DOT11_BSS_TRNS_REQMODE_BSS_TERM_INCL 0x08
-#define DOT11_BSS_TRNS_REQMODE_ESS_DISASSOC_IMNT 0x10
-
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_bss_trans_res {
- uint8 category;
- uint8 action;
- uint8 token;
- uint8 status;
- uint8 term_delay;
- uint8 data[1];
-
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_bss_trans_res dot11_bss_trans_res_t;
-#define DOT11_BSS_TRANS_RES_LEN 5
-
-
-#define DOT11_BSS_TRNS_RES_STATUS_ACCEPT 0
-#define DOT11_BSS_TRNS_RES_STATUS_REJECT 1
-#define DOT11_BSS_TRNS_RES_STATUS_REJ_INSUFF_BCN 2
-#define DOT11_BSS_TRNS_RES_STATUS_REJ_INSUFF_CAP 3
-#define DOT11_BSS_TRNS_RES_STATUS_REJ_TERM_UNDESIRED 4
-#define DOT11_BSS_TRNS_RES_STATUS_REJ_TERM_DELAY_REQ 5
-#define DOT11_BSS_TRNS_RES_STATUS_REJ_BSS_LIST_PROVIDED 6
-#define DOT11_BSS_TRNS_RES_STATUS_REJ_NO_SUITABLE_BSS 7
-#define DOT11_BSS_TRNS_RES_STATUS_REJ_LEAVING_ESS 8
-
-
-
-#define DOT11_NBR_RPRT_BSSID_INFO_REACHABILTY 0x0003
-#define DOT11_NBR_RPRT_BSSID_INFO_SEC 0x0004
-#define DOT11_NBR_RPRT_BSSID_INFO_KEY_SCOPE 0x0008
-#define DOT11_NBR_RPRT_BSSID_INFO_CAP 0x03f0
-
-#define DOT11_NBR_RPRT_BSSID_INFO_CAP_SPEC_MGMT 0x0010
-#define DOT11_NBR_RPRT_BSSID_INFO_CAP_QOS 0x0020
-#define DOT11_NBR_RPRT_BSSID_INFO_CAP_APSD 0x0040
-#define DOT11_NBR_RPRT_BSSID_INFO_CAP_RDIO_MSMT 0x0080
-#define DOT11_NBR_RPRT_BSSID_INFO_CAP_DEL_BA 0x0100
-#define DOT11_NBR_RPRT_BSSID_INFO_CAP_IMM_BA 0x0200
-
-
-#define DOT11_NBR_RPRT_SUBELEM_BSS_CANDDT_PREF_ID 3
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_addba_req {
- uint8 category;
- uint8 action;
- uint8 token;
- uint16 addba_param_set;
- uint16 timeout;
- uint16 start_seqnum;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_addba_req dot11_addba_req_t;
-#define DOT11_ADDBA_REQ_LEN 9
-
-BWL_PRE_PACKED_STRUCT struct dot11_addba_resp {
- uint8 category;
- uint8 action;
- uint8 token;
- uint16 status;
- uint16 addba_param_set;
- uint16 timeout;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_addba_resp dot11_addba_resp_t;
-#define DOT11_ADDBA_RESP_LEN 9
-
-
-#define DOT11_DELBA_PARAM_INIT_MASK 0x0800
-#define DOT11_DELBA_PARAM_INIT_SHIFT 11
-#define DOT11_DELBA_PARAM_TID_MASK 0xf000
-#define DOT11_DELBA_PARAM_TID_SHIFT 12
-
-BWL_PRE_PACKED_STRUCT struct dot11_delba {
- uint8 category;
- uint8 action;
- uint16 delba_param_set;
- uint16 reason;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_delba dot11_delba_t;
-#define DOT11_DELBA_LEN 6
-
-
-#define SA_QUERY_REQUEST 0
-#define SA_QUERY_RESPONSE 1
-
-
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_ft_req {
- uint8 category;
- uint8 action;
- uint8 sta_addr[ETHER_ADDR_LEN];
- uint8 tgt_ap_addr[ETHER_ADDR_LEN];
- uint8 data[1];
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_ft_req dot11_ft_req_t;
-#define DOT11_FT_REQ_FIXED_LEN 14
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_ft_res {
- uint8 category;
- uint8 action;
- uint8 sta_addr[ETHER_ADDR_LEN];
- uint8 tgt_ap_addr[ETHER_ADDR_LEN];
- uint16 status;
- uint8 data[1];
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_ft_res dot11_ft_res_t;
-#define DOT11_FT_RES_FIXED_LEN 16
-
-
-
-
-
-
-#define DOT11_RRM_CAP_LEN 5
-BWL_PRE_PACKED_STRUCT struct dot11_rrm_cap_ie {
- uint8 cap[DOT11_RRM_CAP_LEN];
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_rrm_cap_ie dot11_rrm_cap_ie_t;
-
-
-#define DOT11_RRM_CAP_LINK 0
-#define DOT11_RRM_CAP_NEIGHBOR_REPORT 1
-#define DOT11_RRM_CAP_PARALLEL 2
-#define DOT11_RRM_CAP_REPEATED 3
-#define DOT11_RRM_CAP_BCN_PASSIVE 4
-#define DOT11_RRM_CAP_BCN_ACTIVE 5
-#define DOT11_RRM_CAP_BCN_TABLE 6
-#define DOT11_RRM_CAP_BCN_REP_COND 7
-#define DOT11_RRM_CAP_AP_CHANREP 16
-
-
-
-#define DOT11_OP_CLASS_NONE 255
-
-
-
-#define DOT11_RM_ACTION_RM_REQ 0
-#define DOT11_RM_ACTION_RM_REP 1
-#define DOT11_RM_ACTION_LM_REQ 2
-#define DOT11_RM_ACTION_LM_REP 3
-#define DOT11_RM_ACTION_NR_REQ 4
-#define DOT11_RM_ACTION_NR_REP 5
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_rm_action {
- uint8 category;
- uint8 action;
- uint8 token;
- uint8 data[1];
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_rm_action dot11_rm_action_t;
-#define DOT11_RM_ACTION_LEN 3
-
-BWL_PRE_PACKED_STRUCT struct dot11_rmreq {
- uint8 category;
- uint8 action;
- uint8 token;
- uint16 reps;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_rmreq dot11_rmreq_t;
-#define DOT11_RMREQ_LEN 5
-
-BWL_PRE_PACKED_STRUCT struct dot11_rm_ie {
- uint8 id;
- uint8 len;
- uint8 token;
- uint8 mode;
- uint8 type;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_rm_ie dot11_rm_ie_t;
-#define DOT11_RM_IE_LEN 5
-
-
-#define DOT11_RMREQ_MODE_PARALLEL 1
-#define DOT11_RMREQ_MODE_ENABLE 2
-#define DOT11_RMREQ_MODE_REQUEST 4
-#define DOT11_RMREQ_MODE_REPORT 8
-#define DOT11_RMREQ_MODE_DURMAND 0x10
-
-
-#define DOT11_RMREP_MODE_LATE 1
-#define DOT11_RMREP_MODE_INCAPABLE 2
-#define DOT11_RMREP_MODE_REFUSED 4
-
-BWL_PRE_PACKED_STRUCT struct dot11_rmreq_bcn {
- uint8 id;
- uint8 len;
- uint8 token;
- uint8 mode;
- uint8 type;
- uint8 reg;
- uint8 channel;
- uint16 interval;
- uint16 duration;
- uint8 bcn_mode;
- struct ether_addr bssid;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_rmreq_bcn dot11_rmreq_bcn_t;
-#define DOT11_RMREQ_BCN_LEN 18
-
-BWL_PRE_PACKED_STRUCT struct dot11_rmrep_bcn {
- uint8 reg;
- uint8 channel;
- uint32 starttime[2];
- uint16 duration;
- uint8 frame_info;
- uint8 rcpi;
- uint8 rsni;
- struct ether_addr bssid;
- uint8 antenna_id;
- uint32 parent_tsf;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_rmrep_bcn dot11_rmrep_bcn_t;
-#define DOT11_RMREP_BCN_LEN 26
-
-
-#define DOT11_RMREQ_BCN_PASSIVE 0
-#define DOT11_RMREQ_BCN_ACTIVE 1
-#define DOT11_RMREQ_BCN_TABLE 2
-
-
-#define DOT11_RMREQ_BCN_SSID_ID 0
-#define DOT11_RMREQ_BCN_REPINFO_ID 1
-#define DOT11_RMREQ_BCN_REPDET_ID 2
-#define DOT11_RMREQ_BCN_REQUEST_ID 10
-#define DOT11_RMREQ_BCN_APCHREP_ID 51
-
-
-#define DOT11_RMREQ_BCN_REPDET_FIXED 0
-#define DOT11_RMREQ_BCN_REPDET_REQUEST 1
-#define DOT11_RMREQ_BCN_REPDET_ALL 2
-
-
-#define DOT11_RMREP_BCN_FRM_BODY 1
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_rmrep_nbr {
- struct ether_addr bssid;
- uint32 bssid_info;
- uint8 reg;
- uint8 channel;
- uint8 phytype;
- uchar sub_elements[1];
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_rmrep_nbr dot11_rmrep_nbr_t;
-#define DOT11_RMREP_NBR_LEN 13
-
-
-#define DOT11_BSSTYPE_INFRASTRUCTURE 0
-#define DOT11_BSSTYPE_INDEPENDENT 1
-#define DOT11_BSSTYPE_ANY 2
-#define DOT11_SCANTYPE_ACTIVE 0
-#define DOT11_SCANTYPE_PASSIVE 1
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_lmreq {
- uint8 category;
- uint8 action;
- uint8 token;
- uint8 txpwr;
- uint8 maxtxpwr;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_lmreq dot11_lmreq_t;
-#define DOT11_LMREQ_LEN 5
-
-BWL_PRE_PACKED_STRUCT struct dot11_lmrep {
- uint8 category;
- uint8 action;
- uint8 token;
- dot11_tpc_rep_t tpc;
- uint8 rxant;
- uint8 txant;
- uint8 rcpi;
- uint8 rsni;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_lmrep dot11_lmrep_t;
-#define DOT11_LMREP_LEN 11
-
-
-#define PREN_PREAMBLE 24
-#define PREN_MM_EXT 12
-#define PREN_PREAMBLE_EXT 4
-
-
-#define RIFS_11N_TIME 2
-
-
-
-#define HT_SIG1_MCS_MASK 0x00007F
-#define HT_SIG1_CBW 0x000080
-#define HT_SIG1_HT_LENGTH 0xFFFF00
-
-
-#define HT_SIG2_SMOOTHING 0x000001
-#define HT_SIG2_NOT_SOUNDING 0x000002
-#define HT_SIG2_RESERVED 0x000004
-#define HT_SIG2_AGGREGATION 0x000008
-#define HT_SIG2_STBC_MASK 0x000030
-#define HT_SIG2_STBC_SHIFT 4
-#define HT_SIG2_FEC_CODING 0x000040
-#define HT_SIG2_SHORT_GI 0x000080
-#define HT_SIG2_ESS_MASK 0x000300
-#define HT_SIG2_ESS_SHIFT 8
-#define HT_SIG2_CRC 0x03FC00
-#define HT_SIG2_TAIL 0x1C0000
-
-
-#define APHY_SLOT_TIME 9
-#define APHY_SIFS_TIME 16
-#define APHY_DIFS_TIME (APHY_SIFS_TIME + (2 * APHY_SLOT_TIME))
-#define APHY_PREAMBLE_TIME 16
-#define APHY_SIGNAL_TIME 4
-#define APHY_SYMBOL_TIME 4
-#define APHY_SERVICE_NBITS 16
-#define APHY_TAIL_NBITS 6
-#define APHY_CWMIN 15
-
-
-#define BPHY_SLOT_TIME 20
-#define BPHY_SIFS_TIME 10
-#define BPHY_DIFS_TIME 50
-#define BPHY_PLCP_TIME 192
-#define BPHY_PLCP_SHORT_TIME 96
-#define BPHY_CWMIN 31
-
-
-#define DOT11_OFDM_SIGNAL_EXTENSION 6
-
-#define PHY_CWMAX 1023
-
-#define DOT11_MAXNUMFRAGS 16
-
-
-
-typedef int vht_group_id_t;
-
-
-
-#define VHT_SIGA1_CONST_MASK 0x800004
-
-#define VHT_SIGA1_20MHZ_VAL 0x000000
-#define VHT_SIGA1_40MHZ_VAL 0x000001
-#define VHT_SIGA1_80MHZ_VAL 0x000002
-#define VHT_SIGA1_160MHZ_VAL 0x000003
-
-#define VHT_SIGA1_STBC 0x000008
-
-#define VHT_SIGA1_GID_MAX_GID 0x3f
-#define VHT_SIGA1_GID_SHIFT 4
-#define VHT_SIGA1_GID_TO_AP 0x00
-#define VHT_SIGA1_GID_NOT_TO_AP 0x3f
-
-#define VHT_SIGA1_NSTS_SHIFT 10
-#define VHT_SIGA1_NSTS_SHIFT_MASK_USER0 0x001C00
-
-#define VHT_SIGA1_PARTIAL_AID_SHIFT 13
-
-
-#define VHT_SIGA2_GI_NONE 0x000000
-#define VHT_SIGA2_GI_SHORT 0x000001
-#define VHT_SIGA2_GI_W_MOD10 0x000002
-#define VHT_SIGA2_CODING_LDPC 0x000004
-#define VHT_SIGA2_BEAMFORM_ENABLE 0x000100
-#define VHT_SIGA2_MCS_SHIFT 4
-
-#define VHT_SIGA2_B9_RESERVED 0x000200
-#define VHT_SIGA2_TAIL_MASK 0xfc0000
-#define VHT_SIGA2_TAIL_VALUE 0x000000
-
-#define VHT_SIGA2_SVC_BITS 16
-#define VHT_SIGA2_TAIL_BITS 6
-
-
-
-typedef struct d11cnt {
- uint32 txfrag;
- uint32 txmulti;
- uint32 txfail;
- uint32 txretry;
- uint32 txretrie;
- uint32 rxdup;
- uint32 txrts;
- uint32 txnocts;
- uint32 txnoack;
- uint32 rxfrag;
- uint32 rxmulti;
- uint32 rxcrc;
- uint32 txfrmsnt;
- uint32 rxundec;
-} d11cnt_t;
-
-
-#define BRCM_PROP_OUI "\x00\x90\x4C"
-
-
-
-#define BRCM_OUI "\x00\x10\x18"
-
-
-BWL_PRE_PACKED_STRUCT struct brcm_ie {
- uint8 id;
- uint8 len;
- uint8 oui[3];
- uint8 ver;
- uint8 assoc;
- uint8 flags;
- uint8 flags1;
- uint16 amsdu_mtu_pref;
-} BWL_POST_PACKED_STRUCT;
-typedef struct brcm_ie brcm_ie_t;
-#define BRCM_IE_LEN 11
-#define BRCM_IE_VER 2
-#define BRCM_IE_LEGACY_AES_VER 1
-
-
-#define BRF_LZWDS 0x4
-#define BRF_BLOCKACK 0x8
-
-
-#define BRF1_AMSDU 0x1
-#define BRF1_WMEPS 0x4
-#define BRF1_PSOFIX 0x8
-#define BRF1_RX_LARGE_AGG 0x10
-#define BRF1_RFAWARE_DCS 0x20
-#define BRF1_SOFTAP 0x40
-
-
-BWL_PRE_PACKED_STRUCT struct vndr_ie {
- uchar id;
- uchar len;
- uchar oui [3];
- uchar data [1];
-} BWL_POST_PACKED_STRUCT;
-typedef struct vndr_ie vndr_ie_t;
-
-#define VNDR_IE_HDR_LEN 2
-#define VNDR_IE_MIN_LEN 3
-#define VNDR_IE_MAX_LEN 256
-
-
-#define MCSSET_LEN 16
-#define MAX_MCS_NUM (128)
-
-BWL_PRE_PACKED_STRUCT struct ht_cap_ie {
- uint16 cap;
- uint8 params;
- uint8 supp_mcs[MCSSET_LEN];
- uint16 ext_htcap;
- uint32 txbf_cap;
- uint8 as_cap;
-} BWL_POST_PACKED_STRUCT;
-typedef struct ht_cap_ie ht_cap_ie_t;
-
-
-
-BWL_PRE_PACKED_STRUCT struct ht_prop_cap_ie {
- uint8 id;
- uint8 len;
- uint8 oui[3];
- uint8 type;
- ht_cap_ie_t cap_ie;
-} BWL_POST_PACKED_STRUCT;
-typedef struct ht_prop_cap_ie ht_prop_cap_ie_t;
-
-#define HT_PROP_IE_OVERHEAD 4
-#define HT_CAP_IE_LEN 26
-#define HT_CAP_IE_TYPE 51
-
-#define HT_CAP_LDPC_CODING 0x0001
-#define HT_CAP_40MHZ 0x0002
-#define HT_CAP_MIMO_PS_MASK 0x000C
-#define HT_CAP_MIMO_PS_SHIFT 0x0002
-#define HT_CAP_MIMO_PS_OFF 0x0003
-#define HT_CAP_MIMO_PS_RTS 0x0001
-#define HT_CAP_MIMO_PS_ON 0x0000
-#define HT_CAP_GF 0x0010
-#define HT_CAP_SHORT_GI_20 0x0020
-#define HT_CAP_SHORT_GI_40 0x0040
-#define HT_CAP_TX_STBC 0x0080
-#define HT_CAP_RX_STBC_MASK 0x0300
-#define HT_CAP_RX_STBC_SHIFT 8
-#define HT_CAP_DELAYED_BA 0x0400
-#define HT_CAP_MAX_AMSDU 0x0800
-
-#define HT_CAP_DSSS_CCK 0x1000
-#define HT_CAP_PSMP 0x2000
-#define HT_CAP_40MHZ_INTOLERANT 0x4000
-#define HT_CAP_LSIG_TXOP 0x8000
-
-#define HT_CAP_RX_STBC_NO 0x0
-#define HT_CAP_RX_STBC_ONE_STREAM 0x1
-#define HT_CAP_RX_STBC_TWO_STREAM 0x2
-#define HT_CAP_RX_STBC_THREE_STREAM 0x3
-
-#define VHT_MAX_MPDU 11454
-#define VHT_MPDU_MSDU_DELTA 56
-
-#define VHT_MAX_AMSDU (VHT_MAX_MPDU - VHT_MPDU_MSDU_DELTA)
-
-#define HT_MAX_AMSDU 7935
-#define HT_MIN_AMSDU 3835
-
-#define HT_PARAMS_RX_FACTOR_MASK 0x03
-#define HT_PARAMS_DENSITY_MASK 0x1C
-#define HT_PARAMS_DENSITY_SHIFT 2
-
-
-#define AMPDU_MAX_MPDU_DENSITY 7
-#define AMPDU_RX_FACTOR_8K 0
-#define AMPDU_RX_FACTOR_16K 1
-#define AMPDU_RX_FACTOR_32K 2
-#define AMPDU_RX_FACTOR_64K 3
-#define AMPDU_RX_FACTOR_BASE 8*1024
-
-#define AMPDU_DELIMITER_LEN 4
-#define AMPDU_DELIMITER_LEN_MAX 63
-
-#define HT_CAP_EXT_PCO 0x0001
-#define HT_CAP_EXT_PCO_TTIME_MASK 0x0006
-#define HT_CAP_EXT_PCO_TTIME_SHIFT 1
-#define HT_CAP_EXT_MCS_FEEDBACK_MASK 0x0300
-#define HT_CAP_EXT_MCS_FEEDBACK_SHIFT 8
-#define HT_CAP_EXT_HTC 0x0400
-#define HT_CAP_EXT_RD_RESP 0x0800
-
-BWL_PRE_PACKED_STRUCT struct ht_add_ie {
- uint8 ctl_ch;
- uint8 byte1;
- uint16 opmode;
- uint16 misc_bits;
- uint8 basic_mcs[MCSSET_LEN];
-} BWL_POST_PACKED_STRUCT;
-typedef struct ht_add_ie ht_add_ie_t;
-
-
-
-BWL_PRE_PACKED_STRUCT struct ht_prop_add_ie {
- uint8 id;
- uint8 len;
- uint8 oui[3];
- uint8 type;
- ht_add_ie_t add_ie;
-} BWL_POST_PACKED_STRUCT;
-typedef struct ht_prop_add_ie ht_prop_add_ie_t;
-
-#define HT_ADD_IE_LEN 22
-#define HT_ADD_IE_TYPE 52
-
-
-#define HT_BW_ANY 0x04
-#define HT_RIFS_PERMITTED 0x08
-
-
-#define HT_OPMODE_MASK 0x0003
-#define HT_OPMODE_SHIFT 0
-#define HT_OPMODE_PURE 0x0000
-#define HT_OPMODE_OPTIONAL 0x0001
-#define HT_OPMODE_HT20IN40 0x0002
-#define HT_OPMODE_MIXED 0x0003
-#define HT_OPMODE_NONGF 0x0004
-#define DOT11N_TXBURST 0x0008
-#define DOT11N_OBSS_NONHT 0x0010
-
-
-#define HT_BASIC_STBC_MCS 0x007f
-#define HT_DUAL_STBC_PROT 0x0080
-#define HT_SECOND_BCN 0x0100
-#define HT_LSIG_TXOP 0x0200
-#define HT_PCO_ACTIVE 0x0400
-#define HT_PCO_PHASE 0x0800
-#define HT_DUALCTS_PROTECTION 0x0080
-
-
-#define DOT11N_2G_TXBURST_LIMIT 6160
-#define DOT11N_5G_TXBURST_LIMIT 3080
-
-
-#define GET_HT_OPMODE(add_ie) ((ltoh16_ua(&add_ie->opmode) & HT_OPMODE_MASK) \
- >> HT_OPMODE_SHIFT)
-#define HT_MIXEDMODE_PRESENT(add_ie) ((ltoh16_ua(&add_ie->opmode) & HT_OPMODE_MASK) \
- == HT_OPMODE_MIXED)
-#define HT_HT20_PRESENT(add_ie) ((ltoh16_ua(&add_ie->opmode) & HT_OPMODE_MASK) \
- == HT_OPMODE_HT20IN40)
-#define HT_OPTIONAL_PRESENT(add_ie) ((ltoh16_ua(&add_ie->opmode) & HT_OPMODE_MASK) \
- == HT_OPMODE_OPTIONAL)
-#define HT_USE_PROTECTION(add_ie) (HT_HT20_PRESENT((add_ie)) || \
- HT_MIXEDMODE_PRESENT((add_ie)))
-#define HT_NONGF_PRESENT(add_ie) ((ltoh16_ua(&add_ie->opmode) & HT_OPMODE_NONGF) \
- == HT_OPMODE_NONGF)
-#define DOT11N_TXBURST_PRESENT(add_ie) ((ltoh16_ua(&add_ie->opmode) & DOT11N_TXBURST) \
- == DOT11N_TXBURST)
-#define DOT11N_OBSS_NONHT_PRESENT(add_ie) ((ltoh16_ua(&add_ie->opmode) & DOT11N_OBSS_NONHT) \
- == DOT11N_OBSS_NONHT)
-
-BWL_PRE_PACKED_STRUCT struct obss_params {
- uint16 passive_dwell;
- uint16 active_dwell;
- uint16 bss_widthscan_interval;
- uint16 passive_total;
- uint16 active_total;
- uint16 chanwidth_transition_dly;
- uint16 activity_threshold;
-} BWL_POST_PACKED_STRUCT;
-typedef struct obss_params obss_params_t;
-
-BWL_PRE_PACKED_STRUCT struct dot11_obss_ie {
- uint8 id;
- uint8 len;
- obss_params_t obss_params;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_obss_ie dot11_obss_ie_t;
-#define DOT11_OBSS_SCAN_IE_LEN sizeof(obss_params_t)
-
-
-#define HT_CTRL_LA_TRQ 0x00000002
-#define HT_CTRL_LA_MAI 0x0000003C
-#define HT_CTRL_LA_MAI_SHIFT 2
-#define HT_CTRL_LA_MAI_MRQ 0x00000004
-#define HT_CTRL_LA_MAI_MSI 0x00000038
-#define HT_CTRL_LA_MFSI 0x000001C0
-#define HT_CTRL_LA_MFSI_SHIFT 6
-#define HT_CTRL_LA_MFB_ASELC 0x0000FE00
-#define HT_CTRL_LA_MFB_ASELC_SH 9
-#define HT_CTRL_LA_ASELC_CMD 0x00000C00
-#define HT_CTRL_LA_ASELC_DATA 0x0000F000
-#define HT_CTRL_CAL_POS 0x00030000
-#define HT_CTRL_CAL_SEQ 0x000C0000
-#define HT_CTRL_CSI_STEERING 0x00C00000
-#define HT_CTRL_CSI_STEER_SHIFT 22
-#define HT_CTRL_CSI_STEER_NFB 0
-#define HT_CTRL_CSI_STEER_CSI 1
-#define HT_CTRL_CSI_STEER_NCOM 2
-#define HT_CTRL_CSI_STEER_COM 3
-#define HT_CTRL_NDP_ANNOUNCE 0x01000000
-#define HT_CTRL_AC_CONSTRAINT 0x40000000
-#define HT_CTRL_RDG_MOREPPDU 0x80000000
-
-#define HT_OPMODE_OPTIONAL 0x0001
-#define HT_OPMODE_HT20IN40 0x0002
-#define HT_OPMODE_MIXED 0x0003
-#define HT_OPMODE_NONGF 0x0004
-#define DOT11N_TXBURST 0x0008
-#define DOT11N_OBSS_NONHT 0x0010
-
-
-
-BWL_PRE_PACKED_STRUCT struct vht_cap_ie {
- uint32 vht_cap_info;
-
- uint16 rx_mcs_map;
- uint16 rx_max_rate;
- uint16 tx_mcs_map;
- uint16 tx_max_rate;
-} BWL_POST_PACKED_STRUCT;
-typedef struct vht_cap_ie vht_cap_ie_t;
-
-#define VHT_CAP_IE_LEN 12
-
-#define VHT_CAP_INFO_MAX_MPDU_LEN_MASK 0x00000003
-#define VHT_CAP_INFO_SUPP_CHAN_WIDTH_MASK 0x0000000c
-#define VHT_CAP_INFO_LDPC 0x00000010
-#define VHT_CAP_INFO_SGI_80MHZ 0x00000020
-#define VHT_CAP_INFO_SGI_160MHZ 0x00000040
-#define VHT_CAP_INFO_TX_STBC 0x00000080
-
-#define VHT_CAP_INFO_RX_STBC_MASK 0x00000700
-#define VHT_CAP_INFO_RX_STBC_SHIFT 8
-#define VHT_CAP_INFO_SU_BEAMFMR 0x00000800
-#define VHT_CAP_INFO_SU_BEAMFMEE 0x00001000
-#define VHT_CAP_INFO_NUM_BMFMR_ANT_MASK 0x0000e000
-#define VHT_CAP_INFO_NUM_BMFMR_ANT_SHIFT 13
-
-#define VHT_CAP_INFO_NUM_SOUNDING_DIM_MASK 0x00070000
-#define VHT_CAP_INFO_NUM_SOUNDING_DIM_SHIFT 16
-#define VHT_CAP_INFO_MU_BEAMFMR 0x00080000
-#define VHT_CAP_INFO_MU_BEAMFMEE 0x00100000
-#define VHT_CAP_INFO_TXOPPS 0x00200000
-#define VHT_CAP_INFO_HTCVHT 0x00400000
-#define VHT_CAP_INFO_AMPDU_MAXLEN_EXP_MASK 0x03800000
-#define VHT_CAP_INFO_AMPDU_MAXLEN_EXP_SHIFT 23
-
-#define VHT_CAP_INFO_LINK_ADAPT_CAP_MASK 0x0c000000
-#define VHT_CAP_INFO_LINK_ADAPT_CAP_SHIFT 26
-
-
-#define VHT_CAP_SUPP_MCS_RX_HIGHEST_RATE_MASK 0x1fff
-#define VHT_CAP_SUPP_MCS_RX_HIGHEST_RATE_SHIFT 0
-
-#define VHT_CAP_SUPP_MCS_TX_HIGHEST_RATE_MASK 0x1fff
-#define VHT_CAP_SUPP_MCS_TX_HIGHEST_RATE_SHIFT 0
-
-#define VHT_CAP_MCS_MAP_0_7 0
-#define VHT_CAP_MCS_MAP_0_8 1
-#define VHT_CAP_MCS_MAP_0_9 2
-#define VHT_CAP_MCS_MAP_NONE 3
-
-#define VHT_CAP_MCS_MAP_NSS_MAX 8
-
-
-typedef enum vht_cap_chan_width {
- VHT_CAP_CHAN_WIDTH_20_40 = 0x00,
- VHT_CAP_CHAN_WIDTH_80 = 0x04,
- VHT_CAP_CHAN_WIDTH_160 = 0x08
-} vht_cap_chan_width_t;
-
-
-typedef enum vht_cap_max_mpdu_len {
- VHT_CAP_MPDU_MAX_4K = 0x00,
- VHT_CAP_MPDU_MAX_8K = 0x01,
- VHT_CAP_MPDU_MAX_11K = 0x02
-} vht_cap_max_mpdu_len_t;
-
-
-BWL_PRE_PACKED_STRUCT struct vht_op_ie {
- uint8 chan_width;
- uint8 chan1;
- uint8 chan2;
- uint16 supp_mcs;
-} BWL_POST_PACKED_STRUCT;
-typedef struct vht_op_ie vht_op_ie_t;
-
-#define VHT_OP_IE_LEN 5
-
-typedef enum vht_op_chan_width {
- VHT_OP_CHAN_WIDTH_20_40 = 0,
- VHT_OP_CHAN_WIDTH_80 = 1,
- VHT_OP_CHAN_WIDTH_160 = 2,
- VHT_OP_CHAN_WIDTH_80_80 = 3
-} vht_op_chan_width_t;
-
-
-#define VHT_MCS_MAP_GET_SS_IDX(numSpatialStreams) ((numSpatialStreams-1)*2)
-#define VHT_MCS_MAP_GET_MCS_PER_SS(numSpatialStreams, mcsMap) \
- ((mcsMap >> VHT_MCS_MAP_GET_SS_IDX(numSpatialStreams)) & 0x3)
-#define VHT_MCS_MAP_SET_MCS_PER_SS(numSpatialStreams, numMcs, mcsMap) \
- (mcsMap |= ((numMcs & 0x3) << VHT_MCS_MAP_GET_SS_IDX(numSpatialStreams)))
-
-
-#define WPA_OUI "\x00\x50\xF2"
-#define WPA_OUI_LEN 3
-#define WPA_OUI_TYPE 1
-#define WPA_VERSION 1
-#define WPA2_OUI "\x00\x0F\xAC"
-#define WPA2_OUI_LEN 3
-#define WPA2_VERSION 1
-#define WPA2_VERSION_LEN 2
-
-
-#define WPS_OUI "\x00\x50\xF2"
-#define WPS_OUI_LEN 3
-#define WPS_OUI_TYPE 4
-
-
-
-#ifdef P2P_IE_OVRD
-#define WFA_OUI MAC_OUI
-#else
-#define WFA_OUI "\x50\x6F\x9A"
-#endif
-#define WFA_OUI_LEN 3
-#ifdef P2P_IE_OVRD
-#define WFA_OUI_TYPE_P2P MAC_OUI_TYPE_P2P
-#else
-#define WFA_OUI_TYPE_P2P 9
-#endif
-
-#define WFA_OUI_TYPE_TPC 8
-
-
-#define RSN_AKM_NONE 0
-#define RSN_AKM_UNSPECIFIED 1
-#define RSN_AKM_PSK 2
-#define RSN_AKM_FBT_1X 3
-#define RSN_AKM_FBT_PSK 4
-#define RSN_AKM_MFP_1X 5
-#define RSN_AKM_MFP_PSK 6
-#define RSN_AKM_TPK 7
-
-
-#define DOT11_MAX_DEFAULT_KEYS 4
-#define DOT11_MAX_KEY_SIZE 32
-#define DOT11_MAX_IV_SIZE 16
-#define DOT11_EXT_IV_FLAG (1<<5)
-#define DOT11_WPA_KEY_RSC_LEN 8
-
-#define WEP1_KEY_SIZE 5
-#define WEP1_KEY_HEX_SIZE 10
-#define WEP128_KEY_SIZE 13
-#define WEP128_KEY_HEX_SIZE 26
-#define TKIP_MIC_SIZE 8
-#define TKIP_EOM_SIZE 7
-#define TKIP_EOM_FLAG 0x5a
-#define TKIP_KEY_SIZE 32
-#define TKIP_MIC_AUTH_TX 16
-#define TKIP_MIC_AUTH_RX 24
-#define TKIP_MIC_SUP_RX TKIP_MIC_AUTH_TX
-#define TKIP_MIC_SUP_TX TKIP_MIC_AUTH_RX
-#define AES_KEY_SIZE 16
-#define AES_MIC_SIZE 8
-#define BIP_KEY_SIZE 16
-
-
-#define WCN_OUI "\x00\x50\xf2"
-#define WCN_TYPE 4
-
-#ifdef BCMWAPI_WPI
-#define SMS4_KEY_LEN 16
-#define SMS4_WPI_CBC_MAC_LEN 16
-#endif
-
-
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_mdid_ie {
- uint8 id;
- uint8 len;
- uint16 mdid;
- uint8 cap;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_mdid_ie dot11_mdid_ie_t;
-
-#define FBT_MDID_CAP_OVERDS 0x01
-#define FBT_MDID_CAP_RRP 0x02
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_ft_ie {
- uint8 id;
- uint8 len;
- uint16 mic_control;
- uint8 mic[16];
- uint8 anonce[32];
- uint8 snonce[32];
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_ft_ie dot11_ft_ie_t;
-
-#define TIE_TYPE_RESERVED 0
-#define TIE_TYPE_REASSOC_DEADLINE 1
-#define TIE_TYPE_KEY_LIEFTIME 2
-#define TIE_TYPE_ASSOC_COMEBACK 3
-BWL_PRE_PACKED_STRUCT struct dot11_timeout_ie {
- uint8 id;
- uint8 len;
- uint8 type;
- uint32 value;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_timeout_ie dot11_timeout_ie_t;
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_gtk_ie {
- uint8 id;
- uint8 len;
- uint16 key_info;
- uint8 key_len;
- uint8 rsc[8];
- uint8 data[1];
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_gtk_ie dot11_gtk_ie_t;
-
-#define BSSID_INVALID "\x00\x00\x00\x00\x00\x00"
-#define BSSID_BROADCAST "\xFF\xFF\xFF\xFF\xFF\xFF"
-
-#ifdef BCMWAPI_WAI
-#define WAPI_IE_MIN_LEN 20
-#define WAPI_VERSION 1
-#define WAPI_VERSION_LEN 2
-#define WAPI_OUI "\x00\x14\x72"
-#define WAPI_OUI_LEN DOT11_OUI_LEN
-#endif
-
-
-#define WMM_OUI "\x00\x50\xF2"
-#define WMM_OUI_LEN 3
-#define WMM_OUI_TYPE 2
-#define WMM_VERSION 1
-#define WMM_VERSION_LEN 1
-
-
-#define WMM_OUI_SUBTYPE_PARAMETER 1
-#define WMM_PARAMETER_IE_LEN 24
-
-
-BWL_PRE_PACKED_STRUCT struct link_id_ie {
- uint8 id;
- uint8 len;
- struct ether_addr bssid;
- struct ether_addr tdls_init_mac;
- struct ether_addr tdls_resp_mac;
-} BWL_POST_PACKED_STRUCT;
-typedef struct link_id_ie link_id_ie_t;
-#define TDLS_LINK_ID_IE_LEN 18
-
-
-BWL_PRE_PACKED_STRUCT struct wakeup_sch_ie {
- uint8 id;
- uint8 len;
- uint32 offset;
- uint32 interval;
- uint32 awake_win_slots;
- uint32 max_wake_win;
- uint16 idle_cnt;
-} BWL_POST_PACKED_STRUCT;
-typedef struct wakeup_sch_ie wakeup_sch_ie_t;
-#define TDLS_WAKEUP_SCH_IE_LEN 18
-
-
-BWL_PRE_PACKED_STRUCT struct channel_switch_timing_ie {
- uint8 id;
- uint8 len;
- uint16 switch_time;
- uint16 switch_timeout;
-} BWL_POST_PACKED_STRUCT;
-typedef struct channel_switch_timing_ie channel_switch_timing_ie_t;
-#define TDLS_CHANNEL_SWITCH_TIMING_IE_LEN 4
-
-
-BWL_PRE_PACKED_STRUCT struct pti_control_ie {
- uint8 id;
- uint8 len;
- uint8 tid;
- uint16 seq_control;
-} BWL_POST_PACKED_STRUCT;
-typedef struct pti_control_ie pti_control_ie_t;
-#define TDLS_PTI_CONTROL_IE_LEN 3
-
-
-BWL_PRE_PACKED_STRUCT struct pu_buffer_status_ie {
- uint8 id;
- uint8 len;
- uint8 status;
-} BWL_POST_PACKED_STRUCT;
-typedef struct pu_buffer_status_ie pu_buffer_status_ie_t;
-#define TDLS_PU_BUFFER_STATUS_IE_LEN 1
-#define TDLS_PU_BUFFER_STATUS_AC_BK 1
-#define TDLS_PU_BUFFER_STATUS_AC_BE 2
-#define TDLS_PU_BUFFER_STATUS_AC_VI 4
-#define TDLS_PU_BUFFER_STATUS_AC_VO 8
-
-
-#include <packed_section_end.h>
-
-#endif
diff --git a/drivers/net/wireless/bcmdhd/src/include/proto/bcmevent.h b/drivers/net/wireless/bcmdhd/src/include/proto/bcmevent.h
deleted file mode 100644
index a9680a4..0000000
--- a/drivers/net/wireless/bcmdhd/src/include/proto/bcmevent.h
+++ /dev/null
@@ -1,311 +0,0 @@
-/*
- * Broadcom Event protocol definitions
- *
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
- * Unless you and Broadcom execute a separate written software license
- * agreement governing use of this software, this software is licensed to you
- * under the terms of the GNU General Public License version 2 (the "GPL"),
- * available at http://www.broadcom.com/licenses/GPLv2.php, with the
- * following added to such license:
- *
- * As a special exception, the copyright holders of this software give you
- * permission to link this software with independent modules, and to copy and
- * distribute the resulting executable under terms of your choice, provided that
- * you also meet, for each linked independent module, the terms and conditions of
- * the license of that module. An independent module is a module which is not
- * derived from this software. The special exception does not apply to any
- * modifications of the software.
- *
- * Notwithstanding the above, under no circumstances may you combine this
- * software in any way with any other Broadcom software provided under a license
- * other than the GPL, without Broadcom's express prior written consent.
- *
- * Dependencies: proto/bcmeth.h
- *
- * $Id: bcmevent.h 294352 2011-11-06 19:23:00Z $
- *
- */
-
-#ifndef _BCMEVENT_H_
-#define _BCMEVENT_H_
-
-#ifndef _TYPEDEFS_H_
-#include <typedefs.h>
-#endif
-
-#include <packed_section_start.h>
-
-#define BCM_EVENT_MSG_VERSION 2
-#define BCM_MSG_IFNAME_MAX 16
-
-
-#define WLC_EVENT_MSG_LINK 0x01
-#define WLC_EVENT_MSG_FLUSHTXQ 0x02
-#define WLC_EVENT_MSG_GROUP 0x04
-#define WLC_EVENT_MSG_UNKBSS 0x08
-#define WLC_EVENT_MSG_UNKIF 0x10
-
-typedef BWL_PRE_PACKED_STRUCT struct
-{
- uint16 version;
- uint16 flags;
- uint32 event_type;
- uint32 status;
- uint32 reason;
- uint32 auth_type;
- uint32 datalen;
- struct ether_addr addr;
- char ifname[BCM_MSG_IFNAME_MAX];
-} BWL_POST_PACKED_STRUCT wl_event_msg_v1_t;
-
-
-typedef BWL_PRE_PACKED_STRUCT struct
-{
- uint16 version;
- uint16 flags;
- uint32 event_type;
- uint32 status;
- uint32 reason;
- uint32 auth_type;
- uint32 datalen;
- struct ether_addr addr;
- char ifname[BCM_MSG_IFNAME_MAX];
- uint8 ifidx;
- uint8 bsscfgidx;
-} BWL_POST_PACKED_STRUCT wl_event_msg_t;
-
-
-typedef BWL_PRE_PACKED_STRUCT struct bcm_event {
- struct ether_header eth;
- bcmeth_hdr_t bcm_hdr;
- wl_event_msg_t event;
-} BWL_POST_PACKED_STRUCT bcm_event_t;
-
-#define BCM_MSG_LEN (sizeof(bcm_event_t) - sizeof(bcmeth_hdr_t) - sizeof(struct ether_header))
-
-
-#define WLC_E_SET_SSID 0
-#define WLC_E_JOIN 1
-#define WLC_E_START 2
-#define WLC_E_AUTH 3
-#define WLC_E_AUTH_IND 4
-#define WLC_E_DEAUTH 5
-#define WLC_E_DEAUTH_IND 6
-#define WLC_E_ASSOC 7
-#define WLC_E_ASSOC_IND 8
-#define WLC_E_REASSOC 9
-#define WLC_E_REASSOC_IND 10
-#define WLC_E_DISASSOC 11
-#define WLC_E_DISASSOC_IND 12
-#define WLC_E_QUIET_START 13
-#define WLC_E_QUIET_END 14
-#define WLC_E_BEACON_RX 15
-#define WLC_E_LINK 16
-#define WLC_E_MIC_ERROR 17
-#define WLC_E_NDIS_LINK 18
-#define WLC_E_ROAM 19
-#define WLC_E_TXFAIL 20
-#define WLC_E_PMKID_CACHE 21
-#define WLC_E_RETROGRADE_TSF 22
-#define WLC_E_PRUNE 23
-#define WLC_E_AUTOAUTH 24
-#define WLC_E_EAPOL_MSG 25
-#define WLC_E_SCAN_COMPLETE 26
-#define WLC_E_ADDTS_IND 27
-#define WLC_E_DELTS_IND 28
-#define WLC_E_BCNSENT_IND 29
-#define WLC_E_BCNRX_MSG 30
-#define WLC_E_BCNLOST_MSG 31
-#define WLC_E_ROAM_PREP 32
-#define WLC_E_PFN_NET_FOUND 33
-#define WLC_E_PFN_NET_LOST 34
-#define WLC_E_RESET_COMPLETE 35
-#define WLC_E_JOIN_START 36
-#define WLC_E_ROAM_START 37
-#define WLC_E_ASSOC_START 38
-#define WLC_E_IBSS_ASSOC 39
-#define WLC_E_RADIO 40
-#define WLC_E_PSM_WATCHDOG 41
-#define WLC_E_PROBREQ_MSG 44
-#define WLC_E_SCAN_CONFIRM_IND 45
-#define WLC_E_PSK_SUP 46
-#define WLC_E_COUNTRY_CODE_CHANGED 47
-#define WLC_E_EXCEEDED_MEDIUM_TIME 48
-#define WLC_E_ICV_ERROR 49
-#define WLC_E_UNICAST_DECODE_ERROR 50
-#define WLC_E_MULTICAST_DECODE_ERROR 51
-#define WLC_E_TRACE 52
-#ifdef WLBTAMP
-#define WLC_E_BTA_HCI_EVENT 53
-#endif
-#define WLC_E_IF 54
-#define WLC_E_P2P_DISC_LISTEN_COMPLETE 55
-#define WLC_E_RSSI 56
-#define WLC_E_PFN_SCAN_COMPLETE 57
-#define WLC_E_EXTLOG_MSG 58
-#define WLC_E_ACTION_FRAME 59
-#define WLC_E_ACTION_FRAME_COMPLETE 60
-#define WLC_E_PRE_ASSOC_IND 61
-#define WLC_E_PRE_REASSOC_IND 62
-#define WLC_E_CHANNEL_ADOPTED 63
-#define WLC_E_AP_STARTED 64
-#define WLC_E_DFS_AP_STOP 65
-#define WLC_E_DFS_AP_RESUME 66
-#define WLC_E_WAI_STA_EVENT 67
-#define WLC_E_WAI_MSG 68
-#define WLC_E_ESCAN_RESULT 69
-#define WLC_E_ACTION_FRAME_OFF_CHAN_COMPLETE 70
-#define WLC_E_PROBRESP_MSG 71
-#define WLC_E_P2P_PROBREQ_MSG 72
-#define WLC_E_DCS_REQUEST 73
-
-#define WLC_E_FIFO_CREDIT_MAP 74
-
-#define WLC_E_ACTION_FRAME_RX 75
-#define WLC_E_WAKE_EVENT 76
-#define WLC_E_RM_COMPLETE 77
-#define WLC_E_HTSFSYNC 78
-#define WLC_E_OVERLAY_REQ 79
-#define WLC_E_CSA_COMPLETE_IND 80
-#define WLC_E_EXCESS_PM_WAKE_EVENT 81
-#define WLC_E_PFN_SCAN_NONE 82
-#define WLC_E_PFN_SCAN_ALLGONE 83
-#define WLC_E_GTK_PLUMBED 84
-#define WLC_E_ASSOC_IND_NDIS 85
-#define WLC_E_REASSOC_IND_NDIS 86
-#define WLC_E_ASSOC_REQ_IE 87
-#define WLC_E_ASSOC_RESP_IE 88
-#define WLC_E_ASSOC_RECREATED 89
-#define WLC_E_ACTION_FRAME_RX_NDIS 90
-#define WLC_E_AUTH_REQ 91
-#define WLC_E_LAST 92
-
-
-typedef struct {
- uint event;
- const char *name;
-} bcmevent_name_t;
-
-extern const bcmevent_name_t bcmevent_names[];
-extern const int bcmevent_names_size;
-
-
-#define WLC_E_STATUS_SUCCESS 0
-#define WLC_E_STATUS_FAIL 1
-#define WLC_E_STATUS_TIMEOUT 2
-#define WLC_E_STATUS_NO_NETWORKS 3
-#define WLC_E_STATUS_ABORT 4
-#define WLC_E_STATUS_NO_ACK 5
-#define WLC_E_STATUS_UNSOLICITED 6
-#define WLC_E_STATUS_ATTEMPT 7
-#define WLC_E_STATUS_PARTIAL 8
-#define WLC_E_STATUS_NEWSCAN 9
-#define WLC_E_STATUS_NEWASSOC 10
-#define WLC_E_STATUS_11HQUIET 11
-#define WLC_E_STATUS_SUPPRESS 12
-#define WLC_E_STATUS_NOCHANS 13
-#define WLC_E_STATUS_CS_ABORT 15
-#define WLC_E_STATUS_ERROR 16
-
-
-#define WLC_E_REASON_INITIAL_ASSOC 0
-#define WLC_E_REASON_LOW_RSSI 1
-#define WLC_E_REASON_DEAUTH 2
-#define WLC_E_REASON_DISASSOC 3
-#define WLC_E_REASON_BCNS_LOST 4
-#define WLC_E_REASON_MINTXRATE 9
-#define WLC_E_REASON_TXFAIL 10
-
-
-#define WLC_E_REASON_FAST_ROAM_FAILED 5
-#define WLC_E_REASON_DIRECTED_ROAM 6
-#define WLC_E_REASON_TSPEC_REJECTED 7
-#define WLC_E_REASON_BETTER_AP 8
-
-#define WLC_E_REASON_REQUESTED_ROAM 11
-
-
-#define WLC_E_PRUNE_ENCR_MISMATCH 1
-#define WLC_E_PRUNE_BCAST_BSSID 2
-#define WLC_E_PRUNE_MAC_DENY 3
-#define WLC_E_PRUNE_MAC_NA 4
-#define WLC_E_PRUNE_REG_PASSV 5
-#define WLC_E_PRUNE_SPCT_MGMT 6
-#define WLC_E_PRUNE_RADAR 7
-#define WLC_E_RSN_MISMATCH 8
-#define WLC_E_PRUNE_NO_COMMON_RATES 9
-#define WLC_E_PRUNE_BASIC_RATES 10
-#define WLC_E_PRUNE_CIPHER_NA 12
-#define WLC_E_PRUNE_KNOWN_STA 13
-#define WLC_E_PRUNE_WDS_PEER 15
-#define WLC_E_PRUNE_QBSS_LOAD 16
-#define WLC_E_PRUNE_HOME_AP 17
-
-
-#define WLC_E_SUP_OTHER 0
-#define WLC_E_SUP_DECRYPT_KEY_DATA 1
-#define WLC_E_SUP_BAD_UCAST_WEP128 2
-#define WLC_E_SUP_BAD_UCAST_WEP40 3
-#define WLC_E_SUP_UNSUP_KEY_LEN 4
-#define WLC_E_SUP_PW_KEY_CIPHER 5
-#define WLC_E_SUP_MSG3_TOO_MANY_IE 6
-#define WLC_E_SUP_MSG3_IE_MISMATCH 7
-#define WLC_E_SUP_NO_INSTALL_FLAG 8
-#define WLC_E_SUP_MSG3_NO_GTK 9
-#define WLC_E_SUP_GRP_KEY_CIPHER 10
-#define WLC_E_SUP_GRP_MSG1_NO_GTK 11
-#define WLC_E_SUP_GTK_DECRYPT_FAIL 12
-#define WLC_E_SUP_SEND_FAIL 13
-#define WLC_E_SUP_DEAUTH 14
-#define WLC_E_SUP_WPA_PSK_TMO 15
-
-typedef BWL_PRE_PACKED_STRUCT struct wl_event_rx_frame_data {
- uint16 version;
- uint16 channel;
- int32 rssi;
- uint32 mactime;
- uint32 rate;
-} BWL_POST_PACKED_STRUCT wl_event_rx_frame_data_t;
-
-#define BCM_RX_FRAME_DATA_VERSION 1
-
-
-typedef struct wl_event_data_if {
- uint8 ifidx;
- uint8 opcode;
- uint8 reserved;
- uint8 bssidx;
- uint8 role;
-} wl_event_data_if_t;
-
-
-#define WLC_E_IF_ADD 1
-#define WLC_E_IF_DEL 2
-#define WLC_E_IF_CHANGE 3
-
-
-#define WLC_E_IF_ROLE_STA 0
-#define WLC_E_IF_ROLE_AP 1
-#define WLC_E_IF_ROLE_WDS 2
-#define WLC_E_IF_ROLE_P2P_GO 3
-#define WLC_E_IF_ROLE_P2P_CLIENT 4
-#ifdef WLBTAMP
-#define WLC_E_IF_ROLE_BTA_CREATOR 5
-#define WLC_E_IF_ROLE_BTA_ACCEPTOR 6
-#endif
-
-
-#define WLC_E_LINK_BCN_LOSS 1
-#define WLC_E_LINK_DISASSOC 2
-#define WLC_E_LINK_ASSOC_REC 3
-#define WLC_E_LINK_BSSCFG_DIS 4
-
-
-#define WLC_E_OVL_DOWNLOAD 0
-#define WLC_E_OVL_UPDATE_IND 1
-
-
-#include <packed_section_end.h>
-
-#endif /* _BCMEVENT_H_ */
diff --git a/drivers/net/wireless/bcmdhd/src/include/proto/p2p.h b/drivers/net/wireless/bcmdhd/src/include/proto/p2p.h
deleted file mode 100644
index 0c974c7..0000000
--- a/drivers/net/wireless/bcmdhd/src/include/proto/p2p.h
+++ /dev/null
@@ -1,564 +0,0 @@
-/*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
- * Unless you and Broadcom execute a separate written software license
- * agreement governing use of this software, this software is licensed to you
- * under the terms of the GNU General Public License version 2 (the "GPL"),
- * available at http://www.broadcom.com/licenses/GPLv2.php, with the
- * following added to such license:
- *
- * As a special exception, the copyright holders of this software give you
- * permission to link this software with independent modules, and to copy and
- * distribute the resulting executable under terms of your choice, provided that
- * you also meet, for each linked independent module, the terms and conditions of
- * the license of that module. An independent module is a module which is not
- * derived from this software. The special exception does not apply to any
- * modifications of the software.
- *
- * Notwithstanding the above, under no circumstances may you combine this
- * software in any way with any other Broadcom software provided under a license
- * other than the GPL, without Broadcom's express prior written consent.
- *
- * Fundamental types and constants relating to WFA P2P (aka WiFi Direct)
- *
- * $Id: p2p.h,v 9.17.2.4 2010-12-15 21:41:21 $
- */
-
-#ifndef _P2P_H_
-#define _P2P_H_
-
-#ifndef _TYPEDEFS_H_
-#include <typedefs.h>
-#endif
-#include <wlioctl.h>
-#include <proto/802.11.h>
-
-/* This marks the start of a packed structure section. */
-#include <packed_section_start.h>
-
-
-/* WiFi P2P OUI values */
-#define P2P_OUI WFA_OUI /* WiFi P2P OUI */
-#define P2P_VER WFA_OUI_TYPE_P2P /* P2P version: 9=WiFi P2P v1.0 */
-
-#define P2P_IE_ID 0xdd /* P2P IE element ID */
-
-/* WiFi P2P IE */
-BWL_PRE_PACKED_STRUCT struct wifi_p2p_ie {
- uint8 id; /* IE ID: 0xDD */
- uint8 len; /* IE length */
- uint8 OUI[3]; /* WiFi P2P specific OUI: P2P_OUI */
- uint8 oui_type; /* Identifies P2P version: P2P_VER */
- uint8 subelts[1]; /* variable length subelements */
-} BWL_POST_PACKED_STRUCT;
-typedef struct wifi_p2p_ie wifi_p2p_ie_t;
-
-#define P2P_IE_FIXED_LEN 6
-
-#define P2P_ATTR_ID_OFF 0
-#define P2P_ATTR_LEN_OFF 1
-#define P2P_ATTR_DATA_OFF 3
-
-#define P2P_ATTR_ID_LEN 1
-#define P2P_ATTR_LEN_LEN 2
-#define P2P_ATTR_HDR_LEN 3 /* ID + 2-byte length field spec 1.02 */
-
-/* P2P IE Subelement IDs from WiFi P2P Technical Spec 1.00 */
-#define P2P_SEID_STATUS 0 /* Status */
-#define P2P_SEID_MINOR_RC 1 /* Minor Reason Code */
-#define P2P_SEID_P2P_INFO 2 /* P2P Capability (capabilities info) */
-#define P2P_SEID_DEV_ID 3 /* P2P Device ID */
-#define P2P_SEID_INTENT 4 /* Group Owner Intent */
-#define P2P_SEID_CFG_TIMEOUT 5 /* Configuration Timeout */
-#define P2P_SEID_CHANNEL 6 /* Channel */
-#define P2P_SEID_GRP_BSSID 7 /* P2P Group BSSID */
-#define P2P_SEID_XT_TIMING 8 /* Extended Listen Timing */
-#define P2P_SEID_INTINTADDR 9 /* Intended P2P Interface Address */
-#define P2P_SEID_P2P_MGBTY 10 /* P2P Manageability */
-#define P2P_SEID_CHAN_LIST 11 /* Channel List */
-#define P2P_SEID_ABSENCE 12 /* Notice of Absence */
-#define P2P_SEID_DEV_INFO 13 /* Device Info */
-#define P2P_SEID_GROUP_INFO 14 /* Group Info */
-#define P2P_SEID_GROUP_ID 15 /* Group ID */
-#define P2P_SEID_P2P_IF 16 /* P2P Interface */
-#define P2P_SEID_OP_CHANNEL 17
-#define P2P_SEID_INVITE_FLAGS 18
-#define P2P_SEID_VNDR 221 /* Vendor-specific subelement */
-
-#define P2P_SE_VS_ID_SERVICES 0x1b /* BRCM subel: L2 Services */
-
-
-/* WiFi P2P IE subelement: P2P Capability (capabilities info) */
-BWL_PRE_PACKED_STRUCT struct wifi_p2p_info_se_s {
- uint8 eltId; /* SE ID: P2P_SEID_P2P_INFO */
- uint8 len[2]; /* SE length not including eltId, len fields */
- uint8 dev; /* Device Capability Bitmap */
- uint8 group; /* Group Capability Bitmap */
-} BWL_POST_PACKED_STRUCT;
-typedef struct wifi_p2p_info_se_s wifi_p2p_info_se_t;
-
-/* P2P Capability subelement's Device Capability Bitmap bit values */
-#define P2P_CAPSE_DEV_SERVICE_DIS 0x1 /* Service Discovery */
-#define P2P_CAPSE_DEV_CLIENT_DIS 0x2 /* Client Discoverability */
-#define P2P_CAPSE_DEV_CONCURRENT 0x4 /* Concurrent Operation */
-#define P2P_CAPSE_DEV_INFRA_MAN 0x8 /* P2P Infrastructure Managed */
-#define P2P_CAPSE_DEV_LIMIT 0x10 /* P2P Device Limit */
-#define P2P_CAPSE_INVITE_PROC 0x20 /* P2P Invitation Procedure */
-
-/* P2P Capability subelement's Group Capability Bitmap bit values */
-#define P2P_CAPSE_GRP_OWNER 0x1 /* P2P Group Owner */
-#define P2P_CAPSE_PERSIST_GRP 0x2 /* Persistent P2P Group */
-#define P2P_CAPSE_GRP_LIMIT 0x4 /* P2P Group Limit */
-#define P2P_CAPSE_GRP_INTRA_BSS 0x8 /* Intra-BSS Distribution */
-#define P2P_CAPSE_GRP_X_CONNECT 0x10 /* Cross Connection */
-#define P2P_CAPSE_GRP_PERSISTENT 0x20 /* Persistent Reconnect */
-#define P2P_CAPSE_GRP_FORMATION 0x40 /* Group Formation */
-
-
-/* WiFi P2P IE subelement: Group Owner Intent */
-BWL_PRE_PACKED_STRUCT struct wifi_p2p_intent_se_s {
- uint8 eltId; /* SE ID: P2P_SEID_INTENT */
- uint8 len[2]; /* SE length not including eltId, len fields */
- uint8 intent; /* Intent Value 0...15 (0=legacy 15=master only) */
-} BWL_POST_PACKED_STRUCT;
-typedef struct wifi_p2p_intent_se_s wifi_p2p_intent_se_t;
-
-/* WiFi P2P IE subelement: Configuration Timeout */
-BWL_PRE_PACKED_STRUCT struct wifi_p2p_cfg_tmo_se_s {
- uint8 eltId; /* SE ID: P2P_SEID_CFG_TIMEOUT */
- uint8 len[2]; /* SE length not including eltId, len fields */
- uint8 go_tmo; /* GO config timeout in units of 10 ms */
- uint8 client_tmo; /* Client config timeout in units of 10 ms */
-} BWL_POST_PACKED_STRUCT;
-typedef struct wifi_p2p_cfg_tmo_se_s wifi_p2p_cfg_tmo_se_t;
-
-
-BWL_PRE_PACKED_STRUCT struct wifi_p2p_listen_channel_se_s {
- uint8 eltId;
- uint8 len[2];
- uint8 country[3];
- uint8 op_class;
- uint8 channel;
-} BWL_POST_PACKED_STRUCT;
-typedef struct wifi_p2p_listen_channel_se_s wifi_p2p_listen_channel_se_t;
-BWL_PRE_PACKED_STRUCT struct wifi_p2p_grp_bssid_se_s {
- uint8 eltId;
- uint8 len[2];
- uint8 mac[6];
-} BWL_POST_PACKED_STRUCT;
-typedef struct wifi_p2p_grp_bssid_se_s wifi_p2p_grp_bssid_se_t;
-BWL_PRE_PACKED_STRUCT struct wifi_p2p_grp_id_se_s {
- uint8 eltId;
- uint8 len[2];
- uint8 mac[6];
- uint8 ssid[1];
-} BWL_POST_PACKED_STRUCT;
-typedef struct wifi_p2p_grp_id_se_s wifi_p2p_grp_id_se_t;
-BWL_PRE_PACKED_STRUCT struct wifi_p2p_intf_se_s {
- uint8 eltId;
- uint8 len[2];
- uint8 mac[6];
- uint8 ifaddrs;
- uint8 ifaddr[1][6];
-} BWL_POST_PACKED_STRUCT;
-typedef struct wifi_p2p_intf_se_s wifi_p2p_intf_se_t;
-BWL_PRE_PACKED_STRUCT struct wifi_p2p_status_se_s {
- uint8 eltId; /* SE ID: P2P_SEID_STATUS */
- uint8 len[2]; /* SE length not including eltId, len fields */
- uint8 status; /* Status Code: P2P_STATSE_* */
-} BWL_POST_PACKED_STRUCT;
-typedef struct wifi_p2p_status_se_s wifi_p2p_status_se_t;
-
-/* Status subelement Status Code definitions */
-#define P2P_STATSE_SUCCESS 0
- /* Success */
-#define P2P_STATSE_FAIL_INFO_CURR_UNAVAIL 1
- /* Failed, information currently unavailable */
-#define P2P_STATSE_PASSED_UP P2P_STATSE_FAIL_INFO_CURR_UNAVAIL
- /* Old name for above in P2P spec 1.08 and older */
-#define P2P_STATSE_FAIL_INCOMPAT_PARAMS 2
- /* Failed, incompatible parameters */
-#define P2P_STATSE_FAIL_LIMIT_REACHED 3
- /* Failed, limit reached */
-#define P2P_STATSE_FAIL_INVALID_PARAMS 4
- /* Failed, invalid parameters */
-#define P2P_STATSE_FAIL_UNABLE_TO_ACCOM 5
- /* Failed, unable to accomodate request */
-#define P2P_STATSE_FAIL_PROTO_ERROR 6
- /* Failed, previous protocol error or disruptive behaviour */
-#define P2P_STATSE_FAIL_NO_COMMON_CHAN 7
- /* Failed, no common channels */
-#define P2P_STATSE_FAIL_UNKNOWN_GROUP 8
- /* Failed, unknown P2P Group */
-#define P2P_STATSE_FAIL_INTENT 9
- /* Failed, both peers indicated Intent 15 in GO Negotiation */
-#define P2P_STATSE_FAIL_INCOMPAT_PROVIS 10
- /* Failed, incompatible provisioning method */
-#define P2P_STATSE_FAIL_USER_REJECT 11
- /* Failed, rejected by user */
-
-/* WiFi P2P IE attribute: Extended Listen Timing */
-BWL_PRE_PACKED_STRUCT struct wifi_p2p_ext_se_s {
- uint8 eltId; /* ID: P2P_SEID_EXT_TIMING */
- uint8 len[2]; /* length not including eltId, len fields */
- uint8 avail[2]; /* availibility period */
- uint8 interval[2]; /* availibility interval */
-} BWL_POST_PACKED_STRUCT;
-typedef struct wifi_p2p_ext_se_s wifi_p2p_ext_se_t;
-
-#define P2P_EXT_MIN 10 /* minimum 10ms */
-
-/* WiFi P2P IE subelement: Intended P2P Interface Address */
-BWL_PRE_PACKED_STRUCT struct wifi_p2p_intintad_se_s {
- uint8 eltId; /* SE ID: P2P_SEID_INTINTADDR */
- uint8 len[2]; /* SE length not including eltId, len fields */
- uint8 mac[6]; /* intended P2P interface MAC address */
-} BWL_POST_PACKED_STRUCT;
-typedef struct wifi_p2p_intintad_se_s wifi_p2p_intintad_se_t;
-
-/* WiFi P2P IE subelement: Channel */
-BWL_PRE_PACKED_STRUCT struct wifi_p2p_channel_se_s {
- uint8 eltId; /* SE ID: P2P_SEID_STATUS */
- uint8 len[2]; /* SE length not including eltId, len fields */
- uint8 band; /* Regulatory Class (band) */
- uint8 channel; /* Channel */
-} BWL_POST_PACKED_STRUCT;
-typedef struct wifi_p2p_channel_se_s wifi_p2p_channel_se_t;
-
-
-/* Channel Entry structure within the Channel List SE */
-BWL_PRE_PACKED_STRUCT struct wifi_p2p_chanlist_entry_s {
- uint8 band; /* Regulatory Class (band) */
- uint8 num_channels; /* # of channels in the channel list */
- uint8 channels[WL_NUMCHANNELS]; /* Channel List */
-} BWL_POST_PACKED_STRUCT;
-typedef struct wifi_p2p_chanlist_entry_s wifi_p2p_chanlist_entry_t;
-#define WIFI_P2P_CHANLIST_SE_MAX_ENTRIES 2
-
-/* WiFi P2P IE subelement: Channel List */
-BWL_PRE_PACKED_STRUCT struct wifi_p2p_chanlist_se_s {
- uint8 eltId; /* SE ID: P2P_SEID_STATUS */
- uint8 len[2]; /* SE length not including eltId, len fields */
- uint8 country[3]; /* Country String */
- uint8 num_entries; /* # of channel entries */
- wifi_p2p_chanlist_entry_t entries[WIFI_P2P_CHANLIST_SE_MAX_ENTRIES];
- /* Channel Entry List */
-} BWL_POST_PACKED_STRUCT;
-typedef struct wifi_p2p_chanlist_se_s wifi_p2p_chanlist_se_t;
-
-/* WiFi P2P IE's Device Info subelement */
-BWL_PRE_PACKED_STRUCT struct wifi_p2p_pri_devtype_s {
- uint16 cat_id;
- uint8 OUI[3];
- uint8 oui_type;
- uint16 sub_cat_id;
-} BWL_POST_PACKED_STRUCT;
-typedef struct wifi_p2p_pri_devtype_s wifi_p2p_pri_devtype_t;
-BWL_PRE_PACKED_STRUCT struct wifi_p2p_devinfo_se_s {
- uint8 eltId; /* SE ID: P2P_SEID_DEVINFO */
- uint8 len[2]; /* SE length not including eltId, len fields */
- uint8 mac[6]; /* P2P Device MAC address */
- uint16 wps_cfg_meths; /* Config Methods: reg_prototlv.h WPS_CONFMET_* */
- uint8 pri_devtype[8]; /* Primary Device Type */
-} BWL_POST_PACKED_STRUCT;
-typedef struct wifi_p2p_devinfo_se_s wifi_p2p_devinfo_se_t;
-
-#define P2P_DEV_TYPE_LEN 8
-
-/* WiFi P2P IE's Group Info subelement Client Info Descriptor */
-BWL_PRE_PACKED_STRUCT struct wifi_p2p_cid_fixed_s {
- uint8 len;
- uint8 devaddr[ETHER_ADDR_LEN]; /* P2P Device Address */
- uint8 ifaddr[ETHER_ADDR_LEN]; /* P2P Interface Address */
- uint8 devcap; /* Device Capability */
- uint8 cfg_meths[2]; /* Config Methods: reg_prototlv.h WPS_CONFMET_* */
- uint8 pridt[P2P_DEV_TYPE_LEN]; /* Primary Device Type */
- uint8 secdts; /* Number of Secondary Device Types */
-} BWL_POST_PACKED_STRUCT;
-typedef struct wifi_p2p_cid_fixed_s wifi_p2p_cid_fixed_t;
-
-/* WiFi P2P IE's Device ID subelement */
-BWL_PRE_PACKED_STRUCT struct wifi_p2p_devid_se_s {
- uint8 eltId;
- uint8 len[2];
- struct ether_addr addr; /* P2P Device MAC address */
-} BWL_POST_PACKED_STRUCT;
-typedef struct wifi_p2p_devid_se_s wifi_p2p_devid_se_t;
-
-/* WiFi P2P IE subelement: P2P Manageability */
-BWL_PRE_PACKED_STRUCT struct wifi_p2p_mgbt_se_s {
- uint8 eltId; /* SE ID: P2P_SEID_P2P_MGBTY */
- uint8 len[2]; /* SE length not including eltId, len fields */
- uint8 mg_bitmap; /* manageability bitmap */
-} BWL_POST_PACKED_STRUCT;
-typedef struct wifi_p2p_mgbt_se_s wifi_p2p_mgbt_se_t;
-/* mg_bitmap field bit values */
-#define P2P_MGBTSE_P2PDEVMGMT_FLAG 0x1 /* AP supports Managed P2P Device */
-
-/* WiFi P2P IE subelement: Group Info */
-BWL_PRE_PACKED_STRUCT struct wifi_p2p_grpinfo_se_s {
- uint8 eltId; /* SE ID: P2P_SEID_GROUP_INFO */
- uint8 len[2]; /* SE length not including eltId, len fields */
-} BWL_POST_PACKED_STRUCT;
-typedef struct wifi_p2p_grpinfo_se_s wifi_p2p_grpinfo_se_t;
-
-
-BWL_PRE_PACKED_STRUCT struct wifi_p2p_op_channel_se_s {
- uint8 eltId;
- uint8 len[2];
- uint8 country[3];
- uint8 op_class;
- uint8 channel;
-} BWL_POST_PACKED_STRUCT;
-typedef struct wifi_p2p_op_channel_se_s wifi_p2p_op_channel_se_t;
-BWL_PRE_PACKED_STRUCT struct wifi_p2p_invite_flags_se_s {
- uint8 eltId;
- uint8 len[2];
- uint8 flags;
-} BWL_POST_PACKED_STRUCT;
-typedef struct wifi_p2p_invite_flags_se_s wifi_p2p_invite_flags_se_t;
-BWL_PRE_PACKED_STRUCT struct wifi_p2p_action_frame {
- uint8 category; /* P2P_AF_CATEGORY */
- uint8 OUI[3]; /* OUI - P2P_OUI */
- uint8 type; /* OUI Type - P2P_VER */
- uint8 subtype; /* OUI Subtype - P2P_AF_* */
- uint8 dialog_token; /* nonzero, identifies req/resp tranaction */
- uint8 elts[1]; /* Variable length information elements. Max size =
- * ACTION_FRAME_SIZE - sizeof(this structure) - 1
- */
-} BWL_POST_PACKED_STRUCT;
-typedef struct wifi_p2p_action_frame wifi_p2p_action_frame_t;
-#define P2P_AF_CATEGORY 0x7f
-
-#define P2P_AF_FIXED_LEN 7
-
-/* WiFi P2P Action Frame OUI Subtypes */
-#define P2P_AF_NOTICE_OF_ABSENCE 0 /* Notice of Absence */
-#define P2P_AF_PRESENCE_REQ 1 /* P2P Presence Request */
-#define P2P_AF_PRESENCE_RSP 2 /* P2P Presence Response */
-#define P2P_AF_GO_DISC_REQ 3 /* GO Discoverability Request */
-
-
-/* WiFi P2P Public Action Frame */
-BWL_PRE_PACKED_STRUCT struct wifi_p2p_pub_act_frame {
- uint8 category; /* P2P_PUB_AF_CATEGORY */
- uint8 action; /* P2P_PUB_AF_ACTION */
- uint8 oui[3]; /* P2P_OUI */
- uint8 oui_type; /* OUI type - P2P_VER */
- uint8 subtype; /* OUI subtype - P2P_TYPE_* */
- uint8 dialog_token; /* nonzero, identifies req/rsp transaction */
- uint8 elts[1]; /* Variable length information elements. Max size =
- * ACTION_FRAME_SIZE - sizeof(this structure) - 1
- */
-} BWL_POST_PACKED_STRUCT;
-typedef struct wifi_p2p_pub_act_frame wifi_p2p_pub_act_frame_t;
-#define P2P_PUB_AF_FIXED_LEN 8
-#define P2P_PUB_AF_CATEGORY 0x04
-#define P2P_PUB_AF_ACTION 0x09
-
-/* WiFi P2P Public Action Frame OUI Subtypes */
-#define P2P_PAF_GON_REQ 0 /* Group Owner Negotiation Req */
-#define P2P_PAF_GON_RSP 1 /* Group Owner Negotiation Rsp */
-#define P2P_PAF_GON_CONF 2 /* Group Owner Negotiation Confirm */
-#define P2P_PAF_INVITE_REQ 3 /* P2P Invitation Request */
-#define P2P_PAF_INVITE_RSP 4 /* P2P Invitation Response */
-#define P2P_PAF_DEVDIS_REQ 5 /* Device Discoverability Request */
-#define P2P_PAF_DEVDIS_RSP 6 /* Device Discoverability Response */
-#define P2P_PAF_PROVDIS_REQ 7 /* Provision Discovery Request */
-#define P2P_PAF_PROVDIS_RSP 8 /* Provision Discovery Request */
-
-/* TODO: Stop using these obsolete aliases for P2P_PAF_GON_* */
-#define P2P_TYPE_MNREQ P2P_PAF_GON_REQ
-#define P2P_TYPE_MNRSP P2P_PAF_GON_RSP
-#define P2P_TYPE_MNCONF P2P_PAF_GON_CONF
-
-/* WiFi P2P IE subelement: Notice of Absence */
-BWL_PRE_PACKED_STRUCT struct wifi_p2p_noa_desc {
- uint8 cnt_type; /* Count/Type */
- uint32 duration; /* Duration */
- uint32 interval; /* Interval */
- uint32 start; /* Start Time */
-} BWL_POST_PACKED_STRUCT;
-typedef struct wifi_p2p_noa_desc wifi_p2p_noa_desc_t;
-
-BWL_PRE_PACKED_STRUCT struct wifi_p2p_noa_se {
- uint8 eltId; /* Subelement ID */
- uint8 len[2]; /* Length */
- uint8 index; /* Index */
- uint8 ops_ctw_parms; /* CTWindow and OppPS Parameters */
- wifi_p2p_noa_desc_t desc[1]; /* Notice of Absence Descriptor(s) */
-} BWL_POST_PACKED_STRUCT;
-typedef struct wifi_p2p_noa_se wifi_p2p_noa_se_t;
-
-#define P2P_NOA_SE_FIXED_LEN 5
-
-/* cnt_type field values */
-#define P2P_NOA_DESC_CNT_RESERVED 0 /* reserved and should not be used */
-#define P2P_NOA_DESC_CNT_REPEAT 255 /* continuous schedule */
-#define P2P_NOA_DESC_TYPE_PREFERRED 1 /* preferred values */
-#define P2P_NOA_DESC_TYPE_ACCEPTABLE 2 /* acceptable limits */
-
-/* ctw_ops_parms field values */
-#define P2P_NOA_CTW_MASK 0x7f
-#define P2P_NOA_OPS_MASK 0x80
-#define P2P_NOA_OPS_SHIFT 7
-
-#define P2P_CTW_MIN 10 /* minimum 10TU */
-
-/*
- * P2P Service Discovery related
- */
-#define P2PSD_ACTION_CATEGORY 0x04
- /* Public action frame */
-#define P2PSD_ACTION_ID_GAS_IREQ 0x0a
- /* Action value for GAS Initial Request AF */
-#define P2PSD_ACTION_ID_GAS_IRESP 0x0b
- /* Action value for GAS Initial Response AF */
-#define P2PSD_ACTION_ID_GAS_CREQ 0x0c
- /* Action value for GAS Comback Request AF */
-#define P2PSD_ACTION_ID_GAS_CRESP 0x0d
- /* Action value for GAS Comback Response AF */
-#define P2PSD_AD_EID 0x6c
- /* Advertisement Protocol IE ID */
-#define P2PSD_ADP_TUPLE_QLMT_PAMEBI 0x00
- /* Query Response Length Limit 7 bits plus PAME-BI 1 bit */
-#define P2PSD_ADP_PROTO_ID 0x00
- /* Advertisement Protocol ID. Always 0 for P2P SD */
-#define P2PSD_GAS_OUI P2P_OUI
- /* WFA OUI */
-#define P2PSD_GAS_OUI_SUBTYPE P2P_VER
- /* OUI Subtype for GAS IE */
-#define P2PSD_GAS_NQP_INFOID 0xDDDD
- /* NQP Query Info ID: 56797 */
-#define P2PSD_GAS_COMEBACKDEALY 0x00
- /* Not used in the Native GAS protocol */
-
-/* Service Protocol Type */
-typedef enum p2psd_svc_protype {
- SVC_RPOTYPE_ALL = 0,
- SVC_RPOTYPE_BONJOUR = 1,
- SVC_RPOTYPE_UPNP = 2,
- SVC_RPOTYPE_WSD = 3,
- SVC_RPOTYPE_VENDOR = 255
-} p2psd_svc_protype_t;
-
-/* Service Discovery response status code */
-typedef enum {
- P2PSD_RESP_STATUS_SUCCESS = 0,
- P2PSD_RESP_STATUS_PROTYPE_NA = 1,
- P2PSD_RESP_STATUS_DATA_NA = 2,
- P2PSD_RESP_STATUS_BAD_REQUEST = 3
-} p2psd_resp_status_t;
-
-/* Advertisement Protocol IE tuple field */
-BWL_PRE_PACKED_STRUCT struct wifi_p2psd_adp_tpl {
- uint8 llm_pamebi; /* Query Response Length Limit bit 0-6, set to 0 plus
- * Pre-Associated Message Exchange BSSID Independent bit 7, set to 0
- */
- uint8 adp_id; /* Advertisement Protocol ID: 0 for NQP Native Query Protocol */
-} BWL_POST_PACKED_STRUCT;
-typedef struct wifi_p2psd_adp_tpl wifi_p2psd_adp_tpl_t;
-
-/* Advertisement Protocol IE */
-BWL_PRE_PACKED_STRUCT struct wifi_p2psd_adp_ie {
- uint8 id; /* IE ID: 0x6c - 108 */
- uint8 len; /* IE length */
- wifi_p2psd_adp_tpl_t adp_tpl; /* Advertisement Protocol Tuple field. Only one
- * tuple is defined for P2P Service Discovery
- */
-} BWL_POST_PACKED_STRUCT;
-typedef struct wifi_p2psd_adp_ie wifi_p2psd_adp_ie_t;
-
-/* NQP Vendor-specific Content */
-BWL_PRE_PACKED_STRUCT struct wifi_p2psd_nqp_query_vsc {
- uint8 oui_subtype; /* OUI Subtype: 0x09 */
- uint16 svc_updi; /* Service Update Indicator */
- uint8 svc_tlvs[1]; /* wifi_p2psd_qreq_tlv_t type for service request,
- * wifi_p2psd_qresp_tlv_t type for service response
- */
-} BWL_POST_PACKED_STRUCT;
-typedef struct wifi_p2psd_nqp_query_vsc wifi_p2psd_nqp_query_vsc_t;
-
-/* Service Request TLV */
-BWL_PRE_PACKED_STRUCT struct wifi_p2psd_qreq_tlv {
- uint16 len; /* Length: 5 plus size of Query Data */
- uint8 svc_prot; /* Service Protocol Type */
- uint8 svc_tscid; /* Service Transaction ID */
- uint8 query_data[1]; /* Query Data, passed in from above Layer 2 */
-} BWL_POST_PACKED_STRUCT;
-typedef struct wifi_p2psd_qreq_tlv wifi_p2psd_qreq_tlv_t;
-
-/* Query Request Frame, defined in generic format, instead of NQP specific */
-BWL_PRE_PACKED_STRUCT struct wifi_p2psd_qreq_frame {
- uint16 info_id; /* Info ID: 0xDDDD */
- uint16 len; /* Length of service request TLV, 5 plus the size of request data */
- uint8 oui[3]; /* WFA OUI: 0x0050F2 */
- uint8 qreq_vsc[1]; /* Vendor-specific Content: wifi_p2psd_nqp_query_vsc_t type for NQP */
-
-} BWL_POST_PACKED_STRUCT;
-typedef struct wifi_p2psd_qreq_frame wifi_p2psd_qreq_frame_t;
-
-/* GAS Initial Request AF body, "elts" in wifi_p2p_pub_act_frame */
-BWL_PRE_PACKED_STRUCT struct wifi_p2psd_gas_ireq_frame {
- wifi_p2psd_adp_ie_t adp_ie; /* Advertisement Protocol IE */
- uint16 qreq_len; /* Query Request Length */
- uint8 qreq_frm[1]; /* Query Request Frame wifi_p2psd_qreq_frame_t */
-} BWL_POST_PACKED_STRUCT;
-typedef struct wifi_p2psd_gas_ireq_frame wifi_p2psd_gas_ireq_frame_t;
-
-/* Service Response TLV */
-BWL_PRE_PACKED_STRUCT struct wifi_p2psd_qresp_tlv {
- uint16 len; /* Length: 5 plus size of Query Data */
- uint8 svc_prot; /* Service Protocol Type */
- uint8 svc_tscid; /* Service Transaction ID */
- uint8 status; /* Value defined in Table 57 of P2P spec. */
- uint8 query_data[1]; /* Response Data, passed in from above Layer 2 */
-} BWL_POST_PACKED_STRUCT;
-typedef struct wifi_p2psd_qresp_tlv wifi_p2psd_qresp_tlv_t;
-
-/* Query Response Frame, defined in generic format, instead of NQP specific */
-BWL_PRE_PACKED_STRUCT struct wifi_p2psd_qresp_frame {
- uint16 info_id; /* Info ID: 0xDDDD */
- uint16 len; /* Lenth of service response TLV, 6 plus the size of resp data */
- uint8 oui[3]; /* WFA OUI: 0x0050F2 */
- uint8 qresp_vsc[1]; /* Vendor-specific Content: wifi_p2psd_qresp_tlv_t type for NQP */
-
-} BWL_POST_PACKED_STRUCT;
-typedef struct wifi_p2psd_qresp_frame wifi_p2psd_qresp_frame_t;
-
-/* GAS Initial Response AF body, "elts" in wifi_p2p_pub_act_frame */
-BWL_PRE_PACKED_STRUCT struct wifi_p2psd_gas_iresp_frame {
- uint16 status; /* Value defined in Table 7-23 of IEEE P802.11u */
- uint16 cb_delay; /* GAS Comeback Delay */
- wifi_p2psd_adp_ie_t adp_ie; /* Advertisement Protocol IE */
- uint16 qresp_len; /* Query Response Length */
- uint8 qresp_frm[1]; /* Query Response Frame wifi_p2psd_qresp_frame_t */
-} BWL_POST_PACKED_STRUCT;
-typedef struct wifi_p2psd_gas_iresp_frame wifi_p2psd_gas_iresp_frame_t;
-
-/* GAS Comeback Response AF body, "elts" in wifi_p2p_pub_act_frame */
-BWL_PRE_PACKED_STRUCT struct wifi_p2psd_gas_cresp_frame {
- uint16 status; /* Value defined in Table 7-23 of IEEE P802.11u */
- uint8 fragment_id; /* Fragmentation ID */
- uint16 cb_delay; /* GAS Comeback Delay */
- wifi_p2psd_adp_ie_t adp_ie; /* Advertisement Protocol IE */
- uint16 qresp_len; /* Query Response Length */
- uint8 qresp_frm[1]; /* Query Response Frame wifi_p2psd_qresp_frame_t */
-} BWL_POST_PACKED_STRUCT;
-typedef struct wifi_p2psd_gas_cresp_frame wifi_p2psd_gas_cresp_frame_t;
-
-/* Wi-Fi GAS Public Action Frame */
-BWL_PRE_PACKED_STRUCT struct wifi_p2psd_gas_pub_act_frame {
- uint8 category; /* 0x04 Public Action Frame */
- uint8 action; /* 0x6c Advertisement Protocol */
- uint8 dialog_token; /* nonzero, identifies req/rsp transaction */
- uint8 query_data[1]; /* Query Data. wifi_p2psd_gas_ireq_frame_t
- * or wifi_p2psd_gas_iresp_frame_t format
- */
-} BWL_POST_PACKED_STRUCT;
-typedef struct wifi_p2psd_gas_pub_act_frame wifi_p2psd_gas_pub_act_frame_t;
-
-/* This marks the end of a packed structure section. */
-#include <packed_section_end.h>
-
-#endif /* _P2P_H_ */
diff --git a/drivers/net/wireless/bcmdhd/src/include/sbhnddma.h b/drivers/net/wireless/bcmdhd/src/include/sbhnddma.h
deleted file mode 100644
index 81e94df..0000000
--- a/drivers/net/wireless/bcmdhd/src/include/sbhnddma.h
+++ /dev/null
@@ -1,370 +0,0 @@
-/*
- * Generic Broadcom Home Networking Division (HND) DMA engine HW interface
- * This supports the following chips: BCM42xx, 44xx, 47xx .
- *
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
- * Unless you and Broadcom execute a separate written software license
- * agreement governing use of this software, this software is licensed to you
- * under the terms of the GNU General Public License version 2 (the "GPL"),
- * available at http://www.broadcom.com/licenses/GPLv2.php, with the
- * following added to such license:
- *
- * As a special exception, the copyright holders of this software give you
- * permission to link this software with independent modules, and to copy and
- * distribute the resulting executable under terms of your choice, provided that
- * you also meet, for each linked independent module, the terms and conditions of
- * the license of that module. An independent module is a module which is not
- * derived from this software. The special exception does not apply to any
- * modifications of the software.
- *
- * Notwithstanding the above, under no circumstances may you combine this
- * software in any way with any other Broadcom software provided under a license
- * other than the GPL, without Broadcom's express prior written consent.
- *
- * $Id: sbhnddma.h 305346 2011-12-28 04:27:46Z $
- */
-
-#ifndef _sbhnddma_h_
-#define _sbhnddma_h_
-
-
-
-
-
-
-
-typedef volatile struct {
- uint32 control;
- uint32 addr;
- uint32 ptr;
- uint32 status;
-} dma32regs_t;
-
-typedef volatile struct {
- dma32regs_t xmt;
- dma32regs_t rcv;
-} dma32regp_t;
-
-typedef volatile struct {
- uint32 fifoaddr;
- uint32 fifodatalow;
- uint32 fifodatahigh;
- uint32 pad;
-} dma32diag_t;
-
-
-typedef volatile struct {
- uint32 ctrl;
- uint32 addr;
-} dma32dd_t;
-
-
-#define D32RINGALIGN_BITS 12
-#define D32MAXRINGSZ (1 << D32RINGALIGN_BITS)
-#define D32RINGALIGN (1 << D32RINGALIGN_BITS)
-
-#define D32MAXDD (D32MAXRINGSZ / sizeof (dma32dd_t))
-
-
-#define XC_XE ((uint32)1 << 0)
-#define XC_SE ((uint32)1 << 1)
-#define XC_LE ((uint32)1 << 2)
-#define XC_FL ((uint32)1 << 4)
-#define XC_MR_MASK 0x000000C0
-#define XC_MR_SHIFT 6
-#define XC_PD ((uint32)1 << 11)
-#define XC_AE ((uint32)3 << 16)
-#define XC_AE_SHIFT 16
-#define XC_BL_MASK 0x001C0000
-#define XC_BL_SHIFT 18
-#define XC_PC_MASK 0x00E00000
-#define XC_PC_SHIFT 21
-#define XC_PT_MASK 0x03000000
-#define XC_PT_SHIFT 24
-
-
-#define DMA_MR_1 0
-#define DMA_MR_2 1
-
-
-
-#define DMA_BL_16 0
-#define DMA_BL_32 1
-#define DMA_BL_64 2
-#define DMA_BL_128 3
-#define DMA_BL_256 4
-#define DMA_BL_512 5
-#define DMA_BL_1024 6
-
-
-#define DMA_PC_0 0
-#define DMA_PC_4 1
-#define DMA_PC_8 2
-#define DMA_PC_16 3
-
-
-
-#define DMA_PT_1 0
-#define DMA_PT_2 1
-#define DMA_PT_4 2
-#define DMA_PT_8 3
-
-
-#define XP_LD_MASK 0xfff
-
-
-#define XS_CD_MASK 0x0fff
-#define XS_XS_MASK 0xf000
-#define XS_XS_SHIFT 12
-#define XS_XS_DISABLED 0x0000
-#define XS_XS_ACTIVE 0x1000
-#define XS_XS_IDLE 0x2000
-#define XS_XS_STOPPED 0x3000
-#define XS_XS_SUSP 0x4000
-#define XS_XE_MASK 0xf0000
-#define XS_XE_SHIFT 16
-#define XS_XE_NOERR 0x00000
-#define XS_XE_DPE 0x10000
-#define XS_XE_DFU 0x20000
-#define XS_XE_BEBR 0x30000
-#define XS_XE_BEDA 0x40000
-#define XS_AD_MASK 0xfff00000
-#define XS_AD_SHIFT 20
-
-
-#define RC_RE ((uint32)1 << 0)
-#define RC_RO_MASK 0xfe
-#define RC_RO_SHIFT 1
-#define RC_FM ((uint32)1 << 8)
-#define RC_SH ((uint32)1 << 9)
-#define RC_OC ((uint32)1 << 10)
-#define RC_PD ((uint32)1 << 11)
-#define RC_AE ((uint32)3 << 16)
-#define RC_AE_SHIFT 16
-#define RC_BL_MASK 0x001C0000
-#define RC_BL_SHIFT 18
-#define RC_PC_MASK 0x00E00000
-#define RC_PC_SHIFT 21
-#define RC_PT_MASK 0x03000000
-#define RC_PT_SHIFT 24
-
-
-#define RP_LD_MASK 0xfff
-
-
-#define RS_CD_MASK 0x0fff
-#define RS_RS_MASK 0xf000
-#define RS_RS_SHIFT 12
-#define RS_RS_DISABLED 0x0000
-#define RS_RS_ACTIVE 0x1000
-#define RS_RS_IDLE 0x2000
-#define RS_RS_STOPPED 0x3000
-#define RS_RE_MASK 0xf0000
-#define RS_RE_SHIFT 16
-#define RS_RE_NOERR 0x00000
-#define RS_RE_DPE 0x10000
-#define RS_RE_DFO 0x20000
-#define RS_RE_BEBW 0x30000
-#define RS_RE_BEDA 0x40000
-#define RS_AD_MASK 0xfff00000
-#define RS_AD_SHIFT 20
-
-
-#define FA_OFF_MASK 0xffff
-#define FA_SEL_MASK 0xf0000
-#define FA_SEL_SHIFT 16
-#define FA_SEL_XDD 0x00000
-#define FA_SEL_XDP 0x10000
-#define FA_SEL_RDD 0x40000
-#define FA_SEL_RDP 0x50000
-#define FA_SEL_XFD 0x80000
-#define FA_SEL_XFP 0x90000
-#define FA_SEL_RFD 0xc0000
-#define FA_SEL_RFP 0xd0000
-#define FA_SEL_RSD 0xe0000
-#define FA_SEL_RSP 0xf0000
-
-
-#define CTRL_BC_MASK 0x00001fff
-#define CTRL_AE ((uint32)3 << 16)
-#define CTRL_AE_SHIFT 16
-#define CTRL_PARITY ((uint32)3 << 18)
-#define CTRL_EOT ((uint32)1 << 28)
-#define CTRL_IOC ((uint32)1 << 29)
-#define CTRL_EOF ((uint32)1 << 30)
-#define CTRL_SOF ((uint32)1 << 31)
-
-
-#define CTRL_CORE_MASK 0x0ff00000
-
-
-
-
-typedef volatile struct {
- uint32 control;
- uint32 ptr;
- uint32 addrlow;
- uint32 addrhigh;
- uint32 status0;
- uint32 status1;
-} dma64regs_t;
-
-typedef volatile struct {
- dma64regs_t tx;
- dma64regs_t rx;
-} dma64regp_t;
-
-typedef volatile struct {
- uint32 fifoaddr;
- uint32 fifodatalow;
- uint32 fifodatahigh;
- uint32 pad;
-} dma64diag_t;
-
-
-typedef volatile struct {
- uint32 ctrl1;
- uint32 ctrl2;
- uint32 addrlow;
- uint32 addrhigh;
-} dma64dd_t;
-
-
-#define D64RINGALIGN_BITS 13
-#define D64MAXRINGSZ (1 << D64RINGALIGN_BITS)
-#define D64RINGALIGN (1 << D64RINGALIGN_BITS)
-
-#define D64MAXDD (D64MAXRINGSZ / sizeof (dma64dd_t))
-
-
-#define D64_XC_XE 0x00000001
-#define D64_XC_SE 0x00000002
-#define D64_XC_LE 0x00000004
-#define D64_XC_FL 0x00000010
-#define D64_XC_MR_MASK 0x000000C0
-#define D64_XC_MR_SHIFT 6
-#define D64_XC_PD 0x00000800
-#define D64_XC_AE 0x00030000
-#define D64_XC_AE_SHIFT 16
-#define D64_XC_BL_MASK 0x001C0000
-#define D64_XC_BL_SHIFT 18
-#define D64_XC_PC_MASK 0x00E00000
-#define D64_XC_PC_SHIFT 21
-#define D64_XC_PT_MASK 0x03000000
-#define D64_XC_PT_SHIFT 24
-
-
-#define D64_XP_LD_MASK 0x00001fff
-
-
-#define D64_XS0_CD_MASK 0x00001fff
-#define D64_XS0_XS_MASK 0xf0000000
-#define D64_XS0_XS_SHIFT 28
-#define D64_XS0_XS_DISABLED 0x00000000
-#define D64_XS0_XS_ACTIVE 0x10000000
-#define D64_XS0_XS_IDLE 0x20000000
-#define D64_XS0_XS_STOPPED 0x30000000
-#define D64_XS0_XS_SUSP 0x40000000
-
-#define D64_XS1_AD_MASK 0x00001fff
-#define D64_XS1_XE_MASK 0xf0000000
-#define D64_XS1_XE_SHIFT 28
-#define D64_XS1_XE_NOERR 0x00000000
-#define D64_XS1_XE_DPE 0x10000000
-#define D64_XS1_XE_DFU 0x20000000
-#define D64_XS1_XE_DTE 0x30000000
-#define D64_XS1_XE_DESRE 0x40000000
-#define D64_XS1_XE_COREE 0x50000000
-
-
-#define D64_RC_RE 0x00000001
-#define D64_RC_RO_MASK 0x000000fe
-#define D64_RC_RO_SHIFT 1
-#define D64_RC_FM 0x00000100
-#define D64_RC_SH 0x00000200
-#define D64_RC_OC 0x00000400
-#define D64_RC_PD 0x00000800
-#define D64_RC_AE 0x00030000
-#define D64_RC_AE_SHIFT 16
-#define D64_RC_BL_MASK 0x001C0000
-#define D64_RC_BL_SHIFT 18
-#define D64_RC_PC_MASK 0x00E00000
-#define D64_RC_PC_SHIFT 21
-#define D64_RC_PT_MASK 0x03000000
-#define D64_RC_PT_SHIFT 24
-
-
-#define DMA_CTRL_PEN (1 << 0)
-#define DMA_CTRL_ROC (1 << 1)
-#define DMA_CTRL_RXMULTI (1 << 2)
-#define DMA_CTRL_UNFRAMED (1 << 3)
-#define DMA_CTRL_USB_BOUNDRY4KB_WAR (1 << 4)
-#define DMA_CTRL_DMA_AVOIDANCE_WAR (1 << 5)
-
-
-#define D64_RP_LD_MASK 0x00001fff
-
-
-#define D64_RS0_CD_MASK 0x00001fff
-#define D64_RS0_RS_MASK 0xf0000000
-#define D64_RS0_RS_SHIFT 28
-#define D64_RS0_RS_DISABLED 0x00000000
-#define D64_RS0_RS_ACTIVE 0x10000000
-#define D64_RS0_RS_IDLE 0x20000000
-#define D64_RS0_RS_STOPPED 0x30000000
-#define D64_RS0_RS_SUSP 0x40000000
-
-#define D64_RS1_AD_MASK 0x0001ffff
-#define D64_RS1_RE_MASK 0xf0000000
-#define D64_RS1_RE_SHIFT 28
-#define D64_RS1_RE_NOERR 0x00000000
-#define D64_RS1_RE_DPO 0x10000000
-#define D64_RS1_RE_DFU 0x20000000
-#define D64_RS1_RE_DTE 0x30000000
-#define D64_RS1_RE_DESRE 0x40000000
-#define D64_RS1_RE_COREE 0x50000000
-
-
-#define D64_FA_OFF_MASK 0xffff
-#define D64_FA_SEL_MASK 0xf0000
-#define D64_FA_SEL_SHIFT 16
-#define D64_FA_SEL_XDD 0x00000
-#define D64_FA_SEL_XDP 0x10000
-#define D64_FA_SEL_RDD 0x40000
-#define D64_FA_SEL_RDP 0x50000
-#define D64_FA_SEL_XFD 0x80000
-#define D64_FA_SEL_XFP 0x90000
-#define D64_FA_SEL_RFD 0xc0000
-#define D64_FA_SEL_RFP 0xd0000
-#define D64_FA_SEL_RSD 0xe0000
-#define D64_FA_SEL_RSP 0xf0000
-
-
-#define D64_CTRL_COREFLAGS 0x0ff00000
-#define D64_CTRL1_EOT ((uint32)1 << 28)
-#define D64_CTRL1_IOC ((uint32)1 << 29)
-#define D64_CTRL1_EOF ((uint32)1 << 30)
-#define D64_CTRL1_SOF ((uint32)1 << 31)
-
-
-#define D64_CTRL2_BC_MASK 0x00007fff
-#define D64_CTRL2_AE 0x00030000
-#define D64_CTRL2_AE_SHIFT 16
-#define D64_CTRL2_PARITY 0x00040000
-
-
-#define D64_CTRL_CORE_MASK 0x0ff00000
-
-#define D64_RX_FRM_STS_LEN 0x0000ffff
-#define D64_RX_FRM_STS_OVFL 0x00800000
-#define D64_RX_FRM_STS_DSCRCNT 0x0f000000
-#define D64_RX_FRM_STS_DATATYPE 0xf0000000
-
-
-typedef volatile struct {
- uint16 len;
- uint16 flags;
-} dma_rxh_t;
-
-#endif
diff --git a/drivers/net/wireless/bcmdhd/src/wl/sys/wl_roam.c b/drivers/net/wireless/bcmdhd/src/wl/sys/wl_roam.c
deleted file mode 100644
index 5b77c5c..0000000
--- a/drivers/net/wireless/bcmdhd/src/wl/sys/wl_roam.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Linux Wireless Extensions support
- *
- * Copyright (C) 1999-2012, Broadcom Corporation
- *
- * Unless you and Broadcom execute a separate written software license
- * agreement governing use of this software, this software is licensed to you
- * under the terms of the GNU General Public License version 2 (the "GPL"),
- * available at http://www.broadcom.com/licenses/GPLv2.php, with the
- * following added to such license:
- *
- * As a special exception, the copyright holders of this software give you
- * permission to link this software with independent modules, and to copy and
- * distribute the resulting executable under terms of your choice, provided that
- * you also meet, for each linked independent module, the terms and conditions of
- * the license of that module. An independent module is a module which is not
- * derived from this software. The special exception does not apply to any
- * modifications of the software.
- *
- * Notwithstanding the above, under no circumstances may you combine this
- * software in any way with any other Broadcom software provided under a license
- * other than the GPL, without Broadcom's express prior written consent.
- *
- * $Id: wl_roam.c 302026 2011-12-09 11:51:50Z $
- */
-#include <typedefs.h>
-#include <osl.h>
-#include <bcmwifi_channels.h>
-#include <wlioctl.h>
-
-#define WL_DBG(x)
-
-#define MAX_ROAM_CACHE 100
-
-typedef struct {
- chanspec_t chanspec;
- int ssid_len;
- char ssid[36];
-} roam_channel_cache;
-
-static int n_roam_cache = 0;
-static int roam_band = WLC_BAND_AUTO;
-static roam_channel_cache roam_cache[MAX_ROAM_CACHE];
-
-void set_roam_band(int band)
-{
- roam_band = band;
-}
-
-void reset_roam_cache(void)
-{
- n_roam_cache = 0;
-}
-
-void add_roam_cache(wl_bss_info_t *bi)
-{
- int i;
- uint8 channel;
-
- if (n_roam_cache == MAX_ROAM_CACHE)
- return;
-
- for (i = 0; i < n_roam_cache; i++) {
- if ((roam_cache[i].ssid_len == bi->SSID_len) &&
- (roam_cache[i].chanspec == bi->chanspec) &&
- (memcmp(roam_cache[i].ssid, bi->SSID, bi->SSID_len) == 0)) {
- /* identical one found, just return */
- return;
- }
- }
-
- roam_cache[n_roam_cache].ssid_len = bi->SSID_len;
- channel = (bi->ctl_ch == 0) ? CHSPEC_CHANNEL(bi->chanspec) : bi->ctl_ch;
- roam_cache[n_roam_cache].chanspec = WL_CHANSPEC_BW_20 | WL_CHANSPEC_CTL_SB_NONE | (channel <= 14 ? WL_CHANSPEC_BAND_2G : WL_CHANSPEC_BAND_5G) | channel;
- memcpy(roam_cache[n_roam_cache].ssid, bi->SSID, bi->SSID_len);
-
- n_roam_cache++;
-}
-
-int get_roam_channel_list(int target_chan, chanspec_t *channels, const wlc_ssid_t *ssid)
-{
- int i, n = 1;
- uint band;
-
- WL_DBG((" %s: %02d\n", __FUNCTION__, target_chan));
-
- if (target_chan <= 14)
- band = WL_CHANSPEC_BAND_2G;
- else
- band = WL_CHANSPEC_BAND_5G;
- *channels++ = (target_chan & WL_CHANSPEC_CHAN_MASK) | band | WL_CHANSPEC_BW_20 | WL_CHANSPEC_CTL_SB_NONE;
-
- for(i=0; i<n_roam_cache; i++) {
- chanspec_t ch = roam_cache[i].chanspec;
- if ((roam_cache[i].ssid_len == ssid->SSID_len) &&
- ((ch & WL_CHANSPEC_CHAN_MASK) != target_chan) &&
- ((roam_band == WLC_BAND_AUTO) || ((roam_band == WLC_BAND_2G) && CHSPEC_IS2G(ch)) || ((roam_band == WLC_BAND_5G) && CHSPEC_IS5G(ch))) &&
- (memcmp(roam_cache[i].ssid, ssid->SSID, ssid->SSID_len) == 0)) {
- /* match found, add it */
- *channels = ch & WL_CHANSPEC_CHAN_MASK;
- if (*channels <= 14)
- *channels |= WL_CHANSPEC_BAND_2G | WL_CHANSPEC_BW_20 | WL_CHANSPEC_CTL_SB_NONE;
- else
- *channels |= WL_CHANSPEC_BAND_5G | WL_CHANSPEC_BW_20 | WL_CHANSPEC_CTL_SB_NONE;
- WL_DBG((" %s: %02d 0x%04X\n", __FUNCTION__, ch & WL_CHANSPEC_CHAN_MASK, *channels));
- channels++; n++;
- }
- }
-
- return n;
-}
-
-
-void print_roam_cache(void)
-{
- int i;
-
- WL_DBG((" %d cache\n", n_roam_cache));
-
- for (i = 0; i < n_roam_cache; i++) {
- roam_cache[i].ssid[roam_cache[i].ssid_len] = 0;
- WL_DBG(("0x%02X %02d %s\n", roam_cache[i].chanspec, roam_cache[i].ssid_len, roam_cache[i].ssid));
- }
-}
diff --git a/drivers/net/wireless/bcmdhd/src/wl/sys/uamp_api.h b/drivers/net/wireless/bcmdhd/uamp_api.h
index ff4da83..673dce0 100644
--- a/drivers/net/wireless/bcmdhd/src/wl/sys/uamp_api.h
+++ b/drivers/net/wireless/bcmdhd/uamp_api.h
@@ -3,14 +3,14 @@
*
* Description: Universal AMP API
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -18,7 +18,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
diff --git a/drivers/net/wireless/bcmdhd/src/wl/sys/wl_android.c b/drivers/net/wireless/bcmdhd/wl_android.c
index 7f1b86c..0470a9c 100644
--- a/drivers/net/wireless/bcmdhd/src/wl/sys/wl_android.c
+++ b/drivers/net/wireless/bcmdhd/wl_android.c
@@ -2,13 +2,13 @@
* Linux cfg80211 driver - Android related functions
*
* Copyright (C) 1999-2012, Broadcom Corporation
- *
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,12 +16,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: wl_android.c 309571 2012-01-20 01:45:10Z $
+ * $Id: wl_android.c 354184 2012-08-30 08:08:08Z $
*/
#include <linux/module.h>
@@ -67,23 +67,33 @@
#define CMD_BTCOEXSCAN_STOP "BTCOEXSCAN-STOP"
#define CMD_BTCOEXMODE "BTCOEXMODE"
#define CMD_SETSUSPENDOPT "SETSUSPENDOPT"
+#define CMD_SETSUSPENDMODE "SETSUSPENDMODE"
#define CMD_P2P_DEV_ADDR "P2P_DEV_ADDR"
#define CMD_SETFWPATH "SETFWPATH"
#define CMD_SETBAND "SETBAND"
#define CMD_GETBAND "GETBAND"
#define CMD_COUNTRY "COUNTRY"
#define CMD_P2P_SET_NOA "P2P_SET_NOA"
+#if !defined WL_ENABLE_P2P_IF
#define CMD_P2P_GET_NOA "P2P_GET_NOA"
+#endif
#define CMD_P2P_SET_PS "P2P_SET_PS"
-#define CMD_SET_AP_WPS_P2P_IE "SET_AP_WPS_P2P_IE"
-
+#define CMD_SET_AP_WPS_P2P_IE "SET_AP_WPS_P2P_IE"
+#if defined(SUPPORT_HIDDEN_AP)
/* Hostapd private command */
-#define CMD_SET_HAPD_AUTO_CHANNEL "HAPD_AUTO_CHANNEL"
#define CMD_SET_HAPD_MAX_NUM_STA "HAPD_MAX_NUM_STA"
#define CMD_SET_HAPD_SSID "HAPD_SSID"
#define CMD_SET_HAPD_HIDE_SSID "HAPD_HIDE_SSID"
+#endif
+#if defined(SUPPORT_AUTO_CHANNEL)
+#define CMD_SET_HAPD_AUTO_CHANNEL "HAPD_AUTO_CHANNEL"
+#endif
+#if defined(SUPPORT_SOFTAP_SINGL_DISASSOC)
#define CMD_HAPD_STA_DISASSOC "HAPD_STA_DISASSOC"
+#endif
+
+/* CCX Private Commands */
#ifdef BCMCCX
#define CMD_GETCCKM_RN "get cckm_rn"
#define CMD_SETCCKM_KRK "set cckm_krk"
@@ -98,7 +108,7 @@
#define PNO_TLV_PREFIX 'S'
#define PNO_TLV_VERSION '1'
-#define PNO_TLV_SUBVERSION '2'
+#define PNO_TLV_SUBVERSION '2'
#define PNO_TLV_RESERVED '0'
#define PNO_TLV_TYPE_SSID_IE 'S'
#define PNO_TLV_TYPE_TIME 'T'
@@ -113,30 +123,78 @@ typedef struct cmd_tlv {
} cmd_tlv_t;
#endif /* PNO_SUPPORT */
-#ifdef ROAM_API
-#define CMD_ROAMTRIGGER_SET "SETROAMTRIGGER"
-#define CMD_ROAMTRIGGER_GET "GETROAMTRIGGER"
-#define CMD_ROAMDELTA_SET "SETROAMDELTA"
-#define CMD_ROAMDELTA_GET "GETROAMDELTA"
-#define CMD_ROAMSCANPERIOD_SET "SETROAMSCANPERIOD"
-#define CMD_ROAMSCANPERIOD_GET "GETROAMSCANPERIOD"
-#define CMD_COUNTRYREV_SET "SETCOUNTRYREV"
-#define CMD_COUNTRYREV_GET "GETCOUNTRYREV"
-#endif /* ROAM_API */
-
#ifdef OKC_SUPPORT
#define CMD_OKC_SET_PMK "SET_PMK"
#define CMD_OKC_ENABLE "OKC_ENABLE"
#endif
-#ifdef SUPPORT_AMPDU_MPDU_CMD
-#define CMD_AMPDU_MPDU "AMPDU_MPDU"
-#endif
+#ifdef ROAM_API
+#define CMD_ROAMTRIGGER_SET "SETROAMTRIGGER"
+#define CMD_ROAMTRIGGER_GET "GETROAMTRIGGER"
+#define CMD_ROAMDELTA_SET "SETROAMDELTA"
+#define CMD_ROAMDELTA_GET "GETROAMDELTA"
+#define CMD_ROAMSCANPERIOD_SET "SETROAMSCANPERIOD"
+#define CMD_ROAMSCANPERIOD_GET "GETROAMSCANPERIOD"
+#define CMD_FULLROAMSCANPERIOD_SET "SETFULLROAMSCANPERIOD"
+#define CMD_FULLROAMSCANPERIOD_GET "GETFULLROAMSCANPERIOD"
+#define CMD_COUNTRYREV_SET "SETCOUNTRYREV"
+#define CMD_COUNTRYREV_GET "GETCOUNTRYREV"
+#endif /* ROAM_API */
+
+#define CMD_SETROAMMODE "SETROAMMODE"
+
+#if defined(CUSTOMER_HW4) && defined(WES_SUPPORT)
+#define CMD_GETROAMSCANCONTROL "GETROAMSCANCONTROL"
+#define CMD_SETROAMSCANCONTROL "SETROAMSCANCONTROL"
+#define CMD_GETROAMSCANCHANNELS "GETROAMSCANCHANNELS"
+#define CMD_SETROAMSCANCHANNELS "SETROAMSCANCHANNELS"
+
+#define CMD_GETSCANCHANNELTIME "GETSCANCHANNELTIME"
+#define CMD_SETSCANCHANNELTIME "SETSCANCHANNELTIME"
+#define CMD_GETSCANHOMETIME "GETSCANHOMETIME"
+#define CMD_SETSCANHOMETIME "SETSCANHOMETIME"
+#define CMD_GETSCANHOMEAWAYTIME "GETSCANHOMEAWAYTIME"
+#define CMD_SETSCANHOMEAWAYTIME "SETSCANHOMEAWAYTIME"
+#define CMD_GETSCANNPROBES "GETSCANNPROBES"
+#define CMD_SETSCANNPROBES "SETSCANNPROBES"
+
+#define CMD_SENDACTIONFRAME "SENDACTIONFRAME"
+#define CMD_REASSOC "REASSOC"
+
+#define CMD_GETWESMODE "GETWESMODE"
+#define CMD_SETWESMODE "SETWESMODE"
+
+#define CMD_GETOKCMODE "GETOKCMODE"
+#define CMD_SETOKCMODE "SETOKCMODE"
-#ifdef VSDB
+#define ANDROID_WIFI_MAX_ROAM_SCAN_CHANNELS 100
+
+typedef struct android_wifi_reassoc_params {
+ unsigned char bssid[18];
+ int channel;
+} android_wifi_reassoc_params_t;
+
+#define ANDROID_WIFI_REASSOC_PARAMS_SIZE sizeof(struct android_wifi_reassoc_params)
+
+#define ANDROID_WIFI_ACTION_FRAME_SIZE 1040
+
+typedef struct android_wifi_af_params {
+ unsigned char bssid[18];
+ int channel;
+ int dwell_time;
+ int len;
+ unsigned char data[ANDROID_WIFI_ACTION_FRAME_SIZE];
+} android_wifi_af_params_t;
+
+#define ANDROID_WIFI_AF_PARAMS_SIZE sizeof(struct android_wifi_af_params)
+#endif /* WES_SUPPORT */
+#ifdef SUPPORT_AMPDU_MPDU_CMD
+#define CMD_AMPDU_MPDU "AMPDU_MPDU"
+#endif /* SUPPORT_AMPDU_MPDU_CMD */
+#ifdef CUSTOMER_HW4
#define CMD_CHANGE_RL "CHANGE_RL"
#define CMD_RESTORE_RL "RESTORE_RL"
-#endif
+#endif /* CUSTOMER_HW4 */
typedef struct android_wifi_priv_cmd {
char *buf;
int used_len;
@@ -147,11 +205,16 @@ typedef struct android_wifi_priv_cmd {
* Extern function declarations (TODO: move them to dhd_linux.h)
*/
void dhd_customer_gpio_wlan_ctrl(int onoff);
-uint dhd_dev_reset(struct net_device *dev, uint8 flag);
-void dhd_dev_init_ioctl(struct net_device *dev);
+int dhd_dev_reset(struct net_device *dev, uint8 flag);
+int dhd_dev_init_ioctl(struct net_device *dev);
#ifdef WL_CFG80211
int wl_cfg80211_get_p2p_dev_addr(struct net_device *net, struct ether_addr *p2pdev_addr);
int wl_cfg80211_set_btcoex_dhcp(struct net_device *dev, char *command);
+#if defined(CUSTOMER_HW4) && defined(WES_SUPPORT)
+int wl_cfg80211_set_wes_mode(int mode);
+int wl_cfg80211_get_wes_mode(void);
+int wl_cfg80211_get_ioctl_version(void);
+#endif
#else
int wl_cfg80211_get_p2p_dev_addr(struct net_device *net, struct ether_addr *p2pdev_addr)
{ return 0; }
@@ -161,15 +224,27 @@ int wl_cfg80211_get_p2p_noa(struct net_device *net, char* buf, int len)
{ return 0; }
int wl_cfg80211_set_p2p_ps(struct net_device *net, char* buf, int len)
{ return 0; }
-#endif
+#endif /* WL_CFG80211 */
extern int dhd_os_check_if_up(void *dhdp);
extern void *bcmsdh_get_drvdata(void);
+#if defined(CUSTOMER_HW4) && defined(WES_SUPPORT)
+/* wl_roam.c */
+extern int get_roamscan_mode(struct net_device *dev, int *mode);
+extern int set_roamscan_mode(struct net_device *dev, int mode);
+extern int get_roamscan_channel_list(struct net_device *dev, unsigned char channels[]);
+extern int set_roamscan_channel_list(struct net_device *dev, unsigned char n,
+ unsigned char channels[], int ioctl_ver);
+#endif
+
extern bool ap_fw_loaded;
-#if defined(CUSTOMER_HW2) || defined(CUSTOMER_HW_SAMSUNG)
+#if defined(CUSTOMER_HW2) || defined(CUSTOMER_HW4)
extern char iface_name[IFNAMSIZ];
#endif
+#ifndef WIFI_TURNOFF_DELAY
+#define WIFI_TURNOFF_DELAY 0
+#endif
/**
* Local (static) functions and variables
*/
@@ -231,9 +306,9 @@ static int wl_android_set_suspendopt(struct net_device *dev, char *command, int
int ret_now;
int ret = 0;
-#ifdef CUSTOMER_HW_SAMSUNG
+#ifdef CUSTOMER_HW4
if (!dhd_download_fw_on_driverload) {
-#endif /* CUSTOMER_HW_SAMSUNG */
+#endif /* CUSTOMER_HW4 */
suspend_flag = *(command + strlen(CMD_SETSUSPENDOPT) + 1) - '0';
if (suspend_flag != 0)
@@ -241,15 +316,35 @@ static int wl_android_set_suspendopt(struct net_device *dev, char *command, int
ret_now = net_os_set_suspend_disable(dev, suspend_flag);
if (ret_now != suspend_flag) {
- if (!(ret = net_os_set_suspend(dev, ret_now)))
+ if (!(ret = net_os_set_suspend(dev, ret_now, 1)))
DHD_INFO(("%s: Suspend Flag %d -> %d\n",
__FUNCTION__, ret_now, suspend_flag));
else
DHD_ERROR(("%s: failed %d\n", __FUNCTION__, ret));
}
-#ifdef CUSTOMER_HW_SAMSUNG
+#ifdef CUSTOMER_HW4
}
-#endif /* CUSTOMER_HW_SAMSUNG */
+#endif /* CUSTOMER_HW4 */
+ return ret;
+}
+
+static int wl_android_set_suspendmode(struct net_device *dev, char *command, int total_len)
+{
+ int ret = 0;
+
+#if !defined(CONFIG_HAS_EARLYSUSPEND) || !defined(DHD_USE_EARLYSUSPEND)
+ int suspend_flag;
+
+ suspend_flag = *(command + strlen(CMD_SETSUSPENDMODE) + 1) - '0';
+
+ if (suspend_flag != 0)
+ suspend_flag = 1;
+
+ if (!(ret = net_os_set_suspend(dev, suspend_flag, 0)))
+ DHD_INFO(("%s: Suspend Mode %d\n", __FUNCTION__, suspend_flag));
+ else
+ DHD_ERROR(("%s: failed %d\n", __FUNCTION__, ret));
+#endif
return ret;
}
@@ -272,7 +367,7 @@ int wl_android_set_roam_trigger(
{
int roam_trigger[2];
- sscanf(command, "%*s %d", &roam_trigger[0]);
+ sscanf(command, "%*s %10d", &roam_trigger[0]);
roam_trigger[1] = WLC_BAND_ALL;
return wldev_ioctl(dev, WLC_SET_ROAM_TRIGGER, roam_trigger,
@@ -305,7 +400,7 @@ int wl_android_set_roam_delta(
{
int roam_delta[2];
- sscanf(command, "%*s %d", &roam_delta[0]);
+ sscanf(command, "%*s %10d", &roam_delta[0]);
roam_delta[1] = WLC_BAND_ALL;
return wldev_ioctl(dev, WLC_SET_ROAM_DELTA, roam_delta,
@@ -338,7 +433,7 @@ int wl_android_set_roam_scan_period(
{
int roam_scan_period = 0;
- sscanf(command, "%*s %d", &roam_scan_period);
+ sscanf(command, "%*s %10d", &roam_scan_period);
return wldev_ioctl(dev, WLC_SET_ROAM_SCAN_PERIOD, &roam_scan_period,
sizeof(roam_scan_period), 1);
}
@@ -359,6 +454,48 @@ static int wl_android_get_roam_scan_period(
return bytes_written;
}
+int wl_android_set_full_roam_scan_period(
+ struct net_device *dev, char* command, int total_len)
+{
+ int error = 0;
+ int full_roam_scan_period = 0;
+ char smbuf[WLC_IOCTL_SMLEN];
+
+ sscanf(command+sizeof("SETFULLROAMSCANPERIOD"), "%d", &full_roam_scan_period);
+ WL_TRACE(("%s: fullroamperiod = %d\n", __func__, full_roam_scan_period));
+
+ error = wldev_iovar_setbuf(dev, "fullroamperiod", &full_roam_scan_period,
+ sizeof(full_roam_scan_period), smbuf, sizeof(smbuf), NULL);
+ if (error) {
+ DHD_ERROR(("Failed to set full roam scan period, error = %d\n", error));
+ }
+
+ return error;
+}
+
+static int wl_android_get_full_roam_scan_period(
+ struct net_device *dev, char *command, int total_len)
+{
+ int error;
+ int bytes_written;
+ int full_roam_scan_period = 0;
+
+ error = wldev_iovar_getint(dev, "fullroamperiod", &full_roam_scan_period);
+
+ if (error) {
+ DHD_ERROR(("%s: get full roam scan period failed code %d\n",
+ __func__, error));
+ return -1;
+ } else {
+ DHD_INFO(("%s: get full roam scan period %d\n", __func__, full_roam_scan_period));
+ }
+
+ bytes_written = snprintf(command, total_len, "%s %d",
+ CMD_FULLROAMSCANPERIOD_GET, full_roam_scan_period);
+
+ return bytes_written;
+}
+
int wl_android_set_country_rev(
struct net_device *dev, char* command, int total_len)
{
@@ -369,8 +506,8 @@ int wl_android_set_country_rev(
int rev = 0;
memset(country_code, 0, sizeof(country_code));
- sscanf(command+sizeof("SETCOUNTRYREV"), "%s %d", country_code, &rev);
- WL_TRACE(("%s: country_code = %s, rev = %d\n", __func__,
+ sscanf(command+sizeof("SETCOUNTRYREV"), "%10s %10d", country_code, &rev);
+ WL_TRACE(("%s: country_code = %s, rev = %d\n", __FUNCTION__,
country_code, rev));
memcpy(cspec.country_abbrev, country_code, sizeof(country_code));
@@ -382,39 +519,487 @@ int wl_android_set_country_rev(
if (error) {
DHD_ERROR(("%s: set country '%s/%d' failed code %d\n",
- __func__, cspec.ccode, cspec.rev, error));
+ __FUNCTION__, cspec.ccode, cspec.rev, error));
} else {
dhd_bus_country_set(dev, &cspec);
DHD_INFO(("%s: set country '%s/%d'\n",
- __func__, cspec.ccode, cspec.rev));
+ __FUNCTION__, cspec.ccode, cspec.rev));
}
return error;
}
static int wl_android_get_country_rev(
- struct net_device *dev, char *command, int total_len)
+ struct net_device *dev, char *command, int total_len)
{
int error;
int bytes_written;
char smbuf[WLC_IOCTL_SMLEN];
wl_country_t cspec;
- error = wldev_iovar_getbuf(dev, "country", &cspec, sizeof(cspec), smbuf,
+ error = wldev_iovar_getbuf(dev, "country", NULL, 0, smbuf,
sizeof(smbuf), NULL);
if (error) {
DHD_ERROR(("%s: get country failed code %d\n",
- __func__, error));
+ __FUNCTION__, error));
return -1;
} else {
- DHD_INFO(("%s: get country '%s %d'\n", __func__, smbuf, smbuf[WLC_CNTRY_BUF_SZ]));
+ memcpy(&cspec, smbuf, sizeof(cspec));
+ DHD_INFO(("%s: get country '%c%c %d'\n",
+ __FUNCTION__, cspec.ccode[0], cspec.ccode[1], cspec.rev));
}
- bytes_written = snprintf(command, total_len, "%s %s %d", CMD_COUNTRYREV_GET, smbuf, smbuf[WLC_CNTRY_BUF_SZ]);
+
+ bytes_written = snprintf(command, total_len, "%s %c%c %d",
+ CMD_COUNTRYREV_GET, cspec.ccode[0], cspec.ccode[1], cspec.rev);
+
return bytes_written;
}
#endif /* ROAM_API */
+#if defined(CUSTOMER_HW4) && defined(WES_SUPPORT)
+int wl_android_get_roam_scan_control(struct net_device *dev, char *command, int total_len)
+{
+ int error = 0;
+ int bytes_written = 0;
+ int mode = 0;
+
+ error = get_roamscan_mode(dev, &mode);
+ if (error) {
+ DHD_ERROR(("%s: Failed to get Scan Control, error = %d\n", __FUNCTION__, error));
+ return -1;
+ }
+
+ bytes_written = snprintf(command, total_len, "%s %d", CMD_GETROAMSCANCONTROL, mode);
+
+ return bytes_written;
+}
+
+int wl_android_set_roam_scan_control(struct net_device *dev, char *command, int total_len)
+{
+ int error = 0;
+ int mode = 0;
+
+ if (sscanf(command, "%*s %d", &mode) != 1) {
+ DHD_ERROR(("%s: Failed to get Parameter\n", __FUNCTION__));
+ return -1;
+ }
+
+ error = set_roamscan_mode(dev, mode);
+ if (error) {
+ DHD_ERROR(("%s: Failed to set Scan Control %d, error = %d\n",
+ __FUNCTION__, mode, error));
+ return -1;
+ }
+
+ return 0;
+}
+
+int wl_android_get_roam_scan_channels(struct net_device *dev, char *command, int total_len)
+{
+ int bytes_written = 0;
+ unsigned char channels[ANDROID_WIFI_MAX_ROAM_SCAN_CHANNELS] = {0};
+ int channel_cnt = 0;
+ char channel_info[10 + (ANDROID_WIFI_MAX_ROAM_SCAN_CHANNELS * 3)] = {0};
+ int channel_info_len = 0;
+ int i = 0;
+
+ channel_cnt = get_roamscan_channel_list(dev, channels);
+
+ channel_info_len += sprintf(&channel_info[channel_info_len], "%d ", channel_cnt);
+ for (i = 0; i < channel_cnt; i++) {
+ channel_info_len += sprintf(&channel_info[channel_info_len], "%d ", channels[i]);
+
+ if (channel_info_len > (sizeof(channel_info) - 10))
+ break;
+ }
+ channel_info_len += sprintf(&channel_info[channel_info_len], "%s", "\0");
+
+ bytes_written = snprintf(command, total_len, "%s %s",
+ CMD_GETROAMSCANCHANNELS, channel_info);
+ return bytes_written;
+}
+
+int wl_android_set_roam_scan_channels(struct net_device *dev, char *command, int total_len)
+{
+ int error = 0;
+ unsigned char *p = (unsigned char *)(command + strlen(CMD_SETROAMSCANCHANNELS) + 1);
+ int ioctl_version = wl_cfg80211_get_ioctl_version();
+ error = set_roamscan_channel_list(dev, p[0], &p[1], ioctl_version);
+ if (error) {
+ DHD_ERROR(("%s: Failed to set Scan Channels %d, error = %d\n",
+ __FUNCTION__, p[0], error));
+ return -1;
+ }
+
+ return 0;
+}
+
+int wl_android_get_scan_channel_time(struct net_device *dev, char *command, int total_len)
+{
+ int error = 0;
+ int bytes_written = 0;
+ int time = 0;
+
+ error = wldev_ioctl(dev, WLC_GET_SCAN_CHANNEL_TIME, &time, sizeof(time), 0);
+ if (error) {
+ DHD_ERROR(("%s: Failed to get Scan Channel Time, error = %d\n",
+ __FUNCTION__, error));
+ return -1;
+ }
+
+ bytes_written = snprintf(command, total_len, "%s %d", CMD_GETSCANCHANNELTIME, time);
+
+ return bytes_written;
+}
+
+int wl_android_set_scan_channel_time(struct net_device *dev, char *command, int total_len)
+{
+ int error = 0;
+ int time = 0;
+
+ if (sscanf(command, "%*s %d", &time) != 1) {
+ DHD_ERROR(("%s: Failed to get Parameter\n", __FUNCTION__));
+ return -1;
+ }
+
+ error = wldev_ioctl(dev, WLC_SET_SCAN_CHANNEL_TIME, &time, sizeof(time), 1);
+ if (error) {
+ DHD_ERROR(("%s: Failed to set Scan Channel Time %d, error = %d\n",
+ __FUNCTION__, time, error));
+ return -1;
+ }
+
+ return 0;
+}
+
+int wl_android_get_scan_home_time(struct net_device *dev, char *command, int total_len)
+{
+ int error = 0;
+ int bytes_written = 0;
+ int time = 0;
+
+ error = wldev_ioctl(dev, WLC_GET_SCAN_HOME_TIME, &time, sizeof(time), 0);
+ if (error) {
+ DHD_ERROR(("Failed to get Scan Home Time, error = %d\n", error));
+ return -1;
+ }
+
+ bytes_written = snprintf(command, total_len, "%s %d", CMD_GETSCANHOMETIME, time);
+
+ return bytes_written;
+}
+
+int wl_android_set_scan_home_time(struct net_device *dev, char *command, int total_len)
+{
+ int error = 0;
+ int time = 0;
+
+ if (sscanf(command, "%*s %d", &time) != 1) {
+ DHD_ERROR(("%s: Failed to get Parameter\n", __FUNCTION__));
+ return -1;
+ }
+
+ error = wldev_ioctl(dev, WLC_SET_SCAN_HOME_TIME, &time, sizeof(time), 1);
+ if (error) {
+ DHD_ERROR(("%s: Failed to set Scan Home Time %d, error = %d\n",
+ __FUNCTION__, time, error));
+ return -1;
+ }
+
+ return 0;
+}
+
+int wl_android_get_scan_home_away_time(struct net_device *dev, char *command, int total_len)
+{
+ int error = 0;
+ int bytes_written = 0;
+ int time = 0;
+
+ error = wldev_iovar_getint(dev, "scan_home_away_time", &time);
+ if (error) {
+ DHD_ERROR(("%s: Failed to get Scan Home Away Time, error = %d\n",
+ __FUNCTION__, error));
+ return -1;
+ }
+
+ bytes_written = snprintf(command, total_len, "%s %d", CMD_GETSCANHOMEAWAYTIME, time);
+
+ return bytes_written;
+}
+
+int wl_android_set_scan_home_away_time(struct net_device *dev, char *command, int total_len)
+{
+ int error = 0;
+ int time = 0;
+
+ if (sscanf(command, "%*s %d", &time) != 1) {
+ DHD_ERROR(("%s: Failed to get Parameter\n", __FUNCTION__));
+ return -1;
+ }
+
+ error = wldev_iovar_setint(dev, "scan_home_away_time", time);
+ if (error) {
+ DHD_ERROR(("%s: Failed to set Scan Home Away Time %d, error = %d\n",
+ __FUNCTION__, time, error));
+ return -1;
+ }
+
+ return 0;
+}
+
+int wl_android_get_scan_nprobes(struct net_device *dev, char *command, int total_len)
+{
+ int error = 0;
+ int bytes_written = 0;
+ int num = 0;
+
+ error = wldev_ioctl(dev, WLC_GET_SCAN_NPROBES, &num, sizeof(num), 0);
+ if (error) {
+ DHD_ERROR(("%s: Failed to get Scan NProbes, error = %d\n", __FUNCTION__, error));
+ return -1;
+ }
+
+ bytes_written = snprintf(command, total_len, "%s %d", CMD_GETSCANNPROBES, num);
+
+ return bytes_written;
+}
+
+int wl_android_set_scan_nprobes(struct net_device *dev, char *command, int total_len)
+{
+ int error = 0;
+ int num = 0;
+
+ if (sscanf(command, "%*s %d", &num) != 1) {
+ DHD_ERROR(("%s: Failed to get Parameter\n", __FUNCTION__));
+ return -1;
+ }
+
+ error = wldev_ioctl(dev, WLC_SET_SCAN_NPROBES, &num, sizeof(num), 1);
+ if (error) {
+ DHD_ERROR(("%s: Failed to set Scan NProbes %d, error = %d\n",
+ __FUNCTION__, num, error));
+ return -1;
+ }
+
+ return 0;
+}
+
+int wl_android_send_action_frame(struct net_device *dev, char *command, int total_len)
+{
+ int error = -1;
+ android_wifi_af_params_t *params = NULL;
+ wl_action_frame_t *action_frame = NULL;
+ wl_af_params_t *af_params = NULL;
+ char *smbuf = NULL;
+ struct ether_addr tmp_bssid;
+ int tmp_channel = 0;
+
+ params = (android_wifi_af_params_t *)(command + strlen(CMD_SENDACTIONFRAME) + 1);
+ if (params == NULL) {
+ DHD_ERROR(("%s: Invalid params \n", __FUNCTION__));
+ goto send_action_frame_out;
+ }
+
+ smbuf = kmalloc(WLC_IOCTL_MAXLEN, GFP_KERNEL);
+ if (smbuf == NULL) {
+ DHD_ERROR(("%s: failed to allocated memory %d bytes\n",
+ __FUNCTION__, WLC_IOCTL_MAXLEN));
+ goto send_action_frame_out;
+ }
+
+ af_params = (wl_af_params_t *) kzalloc(WL_WIFI_AF_PARAMS_SIZE, GFP_KERNEL);
+ if (af_params == NULL)
+ {
+ DHD_ERROR(("%s: unable to allocate frame\n", __FUNCTION__));
+ goto send_action_frame_out;
+ }
+
+ memset(&tmp_bssid, 0, ETHER_ADDR_LEN);
+ if (bcm_ether_atoe((const char *)params->bssid, (struct ether_addr *)&tmp_bssid) == 0) {
+ memset(&tmp_bssid, 0, ETHER_ADDR_LEN);
+
+ error = wldev_ioctl(dev, WLC_GET_BSSID, &tmp_bssid, ETHER_ADDR_LEN, false);
+ if (error) {
+ memset(&tmp_bssid, 0, ETHER_ADDR_LEN);
+ DHD_ERROR(("%s: failed to get bssid, error=%d\n", __FUNCTION__, error));
+ goto send_action_frame_out;
+ }
+ }
+
+ if (params->channel < 0) {
+ struct channel_info ci;
+ error = wldev_ioctl(dev, WLC_GET_CHANNEL, &ci, sizeof(ci), false);
+ if (error) {
+ DHD_ERROR(("%s: failed to get channel, error=%d\n", __FUNCTION__, error));
+ goto send_action_frame_out;
+ }
+
+ tmp_channel = ci.hw_channel;
+ }
+ else {
+ tmp_channel = params->channel;
+ }
+
+ af_params->channel = tmp_channel;
+ af_params->dwell_time = params->dwell_time;
+ memcpy(&af_params->BSSID, &tmp_bssid, ETHER_ADDR_LEN);
+ action_frame = &af_params->action_frame;
+
+ action_frame->packetId = 0;
+ memcpy(&action_frame->da, &tmp_bssid, ETHER_ADDR_LEN);
+ action_frame->len = params->len;
+ memcpy(action_frame->data, params->data, action_frame->len);
+
+ error = wldev_iovar_setbuf(dev, "actframe", af_params,
+ sizeof(wl_af_params_t), smbuf, WLC_IOCTL_MAXLEN, NULL);
+ if (error) {
+ DHD_ERROR(("%s: failed to set action frame, error=%d\n", __FUNCTION__, error));
+ }
+
+send_action_frame_out:
+ if (af_params)
+ kfree(af_params);
+
+ if (smbuf)
+ kfree(smbuf);
+
+ if (error)
+ return -1;
+ else
+ return 0;
+}
+
+int wl_android_reassoc(struct net_device *dev, char *command, int total_len)
+{
+ int error = 0;
+ android_wifi_reassoc_params_t *params = NULL;
+ uint band;
+ chanspec_t channel;
+ u32 params_size;
+ wl_reassoc_params_t reassoc_params;
+
+ params = (android_wifi_reassoc_params_t *)(command + strlen(CMD_REASSOC) + 1);
+ if (params == NULL) {
+ DHD_ERROR(("%s: Invalid params \n", __FUNCTION__));
+ return -1;
+ }
+
+ memset(&reassoc_params, 0, WL_REASSOC_PARAMS_FIXED_SIZE);
+
+ if (bcm_ether_atoe((const char *)params->bssid,
+ (struct ether_addr *)&reassoc_params.bssid) == 0) {
+ DHD_ERROR(("%s: Invalid bssid \n", __FUNCTION__));
+ return -1;
+ }
+
+ if (params->channel < 0) {
+ DHD_ERROR(("%s: Invalid Channel \n", __FUNCTION__));
+ return -1;
+ }
+
+ reassoc_params.chanspec_num = 1;
+
+ channel = params->channel;
+#ifdef D11AC_IOTYPES
+ if (wl_cfg80211_get_ioctl_version() == 1) {
+ band = ((channel <= CH_MAX_2G_CHANNEL) ?
+ WL_LCHANSPEC_BAND_2G : WL_LCHANSPEC_BAND_5G);
+ reassoc_params.chanspec_list[0] = channel |
+ band | WL_LCHANSPEC_BW_20 | WL_LCHANSPEC_CTL_SB_NONE;
+ }
+ else {
+ band = ((channel <= CH_MAX_2G_CHANNEL) ? WL_CHANSPEC_BAND_2G : WL_CHANSPEC_BAND_5G);
+ reassoc_params.chanspec_list[0] = channel | band | WL_LCHANSPEC_BW_20;
+ }
+#else
+ band = ((channel <= CH_MAX_2G_CHANNEL) ? WL_CHANSPEC_BAND_2G : WL_CHANSPEC_BAND_5G);
+ reassoc_params.chanspec_list[0] = channel |
+ band | WL_CHANSPEC_BW_20 | WL_CHANSPEC_CTL_SB_NONE;
+#endif /* D11AC_IOTYPES */
+ params_size = WL_REASSOC_PARAMS_FIXED_SIZE + sizeof(chanspec_t);
+
+ error = wldev_ioctl(dev, WLC_REASSOC, &reassoc_params, params_size, true);
+ if (error) {
+ DHD_ERROR(("%s: failed to reassoc, error=%d\n", __FUNCTION__, error));
+ }
+
+ if (error)
+ return -1;
+ else
+ return 0;
+}
+
+int wl_android_get_wes_mode(struct net_device *dev, char *command, int total_len)
+{
+ int bytes_written = 0;
+ int mode = 0;
+
+ mode = wl_cfg80211_get_wes_mode();
+
+ bytes_written = snprintf(command, total_len, "%s %d", CMD_GETWESMODE, mode);
+
+ return bytes_written;
+}
+
+int wl_android_set_wes_mode(struct net_device *dev, char *command, int total_len)
+{
+ int error = 0;
+ int mode = 0;
+
+ if (sscanf(command, "%*s %d", &mode) != 1) {
+ DHD_ERROR(("%s: Failed to get Parameter\n", __FUNCTION__));
+ return -1;
+ }
+
+ error = wl_cfg80211_set_wes_mode(mode);
+ if (error) {
+ DHD_ERROR(("%s: Failed to set WES Mode %d, error = %d\n",
+ __FUNCTION__, mode, error));
+ return -1;
+ }
+
+ return 0;
+}
+
+int wl_android_get_okc_mode(struct net_device *dev, char *command, int total_len)
+{
+ int error = 0;
+ int bytes_written = 0;
+ int mode = 0;
+
+ error = wldev_iovar_getint(dev, "okc_enable", &mode);
+ if (error) {
+ DHD_ERROR(("%s: Failed to get OKC Mode, error = %d\n", __FUNCTION__, error));
+ return -1;
+ }
+
+ bytes_written = snprintf(command, total_len, "%s %d", CMD_GETOKCMODE, mode);
+
+ return bytes_written;
+}
+
+int wl_android_set_okc_mode(struct net_device *dev, char *command, int total_len)
+{
+ int error = 0;
+ int mode = 0;
+
+ if (sscanf(command, "%*s %d", &mode) != 1) {
+ DHD_ERROR(("%s: Failed to get Parameter\n", __FUNCTION__));
+ return -1;
+ }
+
+ error = wldev_iovar_setint(dev, "okc_enable", mode);
+ if (error) {
+ DHD_ERROR(("%s: Failed to set OKC Mode %d, error = %d\n",
+ __FUNCTION__, mode, error));
+ return -1;
+ }
+
+ return error;
+}
+#endif /* WES_SUPPORT */
+
#ifdef PNO_SUPPORT
static int wl_android_set_pno_setup(struct net_device *dev, char *command, int total_len)
{
@@ -535,85 +1120,87 @@ static int wl_android_get_p2p_dev_addr(struct net_device *ndev, char *command, i
bytes_written = sizeof(struct ether_addr);
return bytes_written;
}
+
#ifdef BCMCCX
static int wl_android_get_cckm_rn(struct net_device *dev, char *command)
{
- int error, rn;
+ int error, rn;
- WL_TRACE(("%s:wl_android_get_cckm_rn\n", dev->name));
+ WL_TRACE(("%s:wl_android_get_cckm_rn\n", dev->name));
- error = wldev_iovar_getint(dev, "cckm_rn", &rn);
- if (unlikely(error)) {
- WL_ERR(("wl_android_get_cckm_rn error (%d)\n", error));
- return -1;
- }
- //WL_ERR(("wl_android_get_cckm_rn = %d\n", rn));
- memcpy(command, &rn, sizeof(int));
+ error = wldev_iovar_getint(dev, "cckm_rn", &rn);
+ if (unlikely(error)) {
+ WL_ERR(("wl_android_get_cckm_rn error (%d)\n", error));
+ return -1;
+ }
+ memcpy(command, &rn, sizeof(int));
- return sizeof(int);
+ return sizeof(int);
}
static int wl_android_set_cckm_krk(struct net_device *dev, char *command)
{
- int error;
- unsigned char key[16];
-
- static char iovar_buf[WLC_IOCTL_MEDLEN];
+ int error;
+ unsigned char key[16];
+ static char iovar_buf[WLC_IOCTL_MEDLEN];
- WL_TRACE(("%s: wl_iw_set_cckm_krk\n", dev->name));
+ WL_TRACE(("%s: wl_iw_set_cckm_krk\n", dev->name));
- memset(iovar_buf, 0, sizeof(iovar_buf));
- memcpy(key, command+strlen("set cckm_krk")+1, 16);
+ memset(iovar_buf, 0, sizeof(iovar_buf));
+ memcpy(key, command+strlen("set cckm_krk")+1, 16);
- error = wldev_iovar_setbuf(dev,"cckm_krk", key, sizeof(key), iovar_buf, WLC_IOCTL_MEDLEN, NULL);
- if (unlikely(error))
- {
- WL_ERR((" cckm_krk set error (%d)\n", error));
- return -1;
- }
- return 0;
+ error = wldev_iovar_setbuf(dev, "cckm_krk", key, sizeof(key),
+ iovar_buf, WLC_IOCTL_MEDLEN, NULL);
+ if (unlikely(error))
+ {
+ WL_ERR((" cckm_krk set error (%d)\n", error));
+ return -1;
+ }
+ return 0;
}
+
static int wl_android_get_assoc_res_ies(struct net_device *dev, char *command)
{
- int error;
- u8 buf[WL_ASSOC_INFO_MAX];
- wl_assoc_info_t assoc_info;
- u32 resp_ies_len = 0;
- int bytes_written = 0;
+ int error;
+ u8 buf[WL_ASSOC_INFO_MAX];
+ wl_assoc_info_t assoc_info;
+ u32 resp_ies_len = 0;
+ int bytes_written = 0;
- WL_TRACE(("%s: wl_iw_get_assoc_res_ies\n", dev->name));
+ WL_TRACE(("%s: wl_iw_get_assoc_res_ies\n", dev->name));
- error = wldev_iovar_getbuf(dev, "assoc_info", NULL, 0, buf, WL_ASSOC_INFO_MAX, NULL);
- if (unlikely(error)) {
- WL_ERR(("could not get assoc info (%d)\n", error));
- return -1;
- }
+ error = wldev_iovar_getbuf(dev, "assoc_info", NULL, 0, buf, WL_ASSOC_INFO_MAX, NULL);
+ if (unlikely(error)) {
+ WL_ERR(("could not get assoc info (%d)\n", error));
+ return -1;
+ }
- memcpy(&assoc_info, buf, sizeof(wl_assoc_info_t));
- assoc_info.req_len = htod32(assoc_info.req_len);
- assoc_info.resp_len = htod32(assoc_info.resp_len);
- assoc_info.flags = htod32(assoc_info.flags);
+ memcpy(&assoc_info, buf, sizeof(wl_assoc_info_t));
+ assoc_info.req_len = htod32(assoc_info.req_len);
+ assoc_info.resp_len = htod32(assoc_info.resp_len);
+ assoc_info.flags = htod32(assoc_info.flags);
- if (assoc_info.resp_len) {
- resp_ies_len = assoc_info.resp_len - sizeof(struct dot11_assoc_resp);
- }
+ if (assoc_info.resp_len) {
+ resp_ies_len = assoc_info.resp_len - sizeof(struct dot11_assoc_resp);
+ }
- /* first 4 bytes are ie len */
- memcpy(command, &resp_ies_len, sizeof(u32));
- bytes_written= sizeof(u32);
+ /* first 4 bytes are ie len */
+ memcpy(command, &resp_ies_len, sizeof(u32));
+ bytes_written = sizeof(u32);
- /* get the association resp IE's if there are any */
- if (resp_ies_len) {
- error = wldev_iovar_getbuf(dev, "assoc_resp_ies", NULL, 0, buf, WL_ASSOC_INFO_MAX, NULL);
- if (unlikely(error)) {
- WL_ERR(("could not get assoc resp_ies (%d)\n", error));
- return -1;
- }
+ /* get the association resp IE's if there are any */
+ if (resp_ies_len) {
+ error = wldev_iovar_getbuf(dev, "assoc_resp_ies", NULL, 0,
+ buf, WL_ASSOC_INFO_MAX, NULL);
+ if (unlikely(error)) {
+ WL_ERR(("could not get assoc resp_ies (%d)\n", error));
+ return -1;
+ }
- memcpy(command+sizeof(u32), buf, resp_ies_len);
- bytes_written += resp_ies_len;
- }
- return bytes_written;
+ memcpy(command+sizeof(u32), buf, resp_ies_len);
+ bytes_written += resp_ies_len;
+ }
+ return bytes_written;
}
#endif /* BCMCCX */
@@ -627,7 +1214,7 @@ int wl_android_wifi_on(struct net_device *dev)
int ret = 0;
int retry = POWERUP_MAX_RETRY;
- DHD_ERROR(("%s in\n", __FUNCTION__));
+ printk("%s in\n", __FUNCTION__);
if (!dev) {
DHD_ERROR(("%s: dev is null\n", __FUNCTION__));
return -EINVAL;
@@ -636,10 +1223,7 @@ int wl_android_wifi_on(struct net_device *dev)
dhd_net_if_lock(dev);
if (!g_wifi_on) {
do {
- dhd_customer_gpio_wlan_ctrl(WLAN_RESET_ON);
- if (dhd_download_fw_on_driverload)
- msleep(300);
-
+ dhd_customer_gpio_wlan_ctrl(WLAN_RESET_ON);
ret = sdioh_start(NULL, 0);
if (ret == 0)
break;
@@ -653,7 +1237,10 @@ int wl_android_wifi_on(struct net_device *dev)
}
ret = dhd_dev_reset(dev, FALSE);
sdioh_start(NULL, 1);
- dhd_dev_init_ioctl(dev);
+ if (!ret) {
+ if (dhd_dev_init_ioctl(dev) < 0)
+ ret = -EFAULT;
+ }
g_wifi_on = TRUE;
}
@@ -667,7 +1254,7 @@ int wl_android_wifi_off(struct net_device *dev)
{
int ret = 0;
- DHD_ERROR(("%s in\n", __FUNCTION__));
+ printk("%s in\n", __FUNCTION__);
if (!dev) {
DHD_TRACE(("%s: dev is null\n", __FUNCTION__));
return -EINVAL;
@@ -675,9 +1262,7 @@ int wl_android_wifi_off(struct net_device *dev)
dhd_net_if_lock(dev);
if (g_wifi_on) {
- dhd_dev_reset(dev, 1);
- if (dhd_download_fw_on_driverload)
- msleep(100);
+ ret = dhd_dev_reset(dev, TRUE);
sdioh_stop(NULL);
dhd_customer_gpio_wlan_ctrl(WLAN_RESET_OFF);
g_wifi_on = FALSE;
@@ -703,10 +1288,54 @@ static int wl_android_set_fwpath(struct net_device *net, char *command, int tota
return 0;
}
+#if defined(SUPPORT_HIDDEN_AP)
+static int
+wl_android_set_max_num_sta(struct net_device *dev, const char* string_num)
+{
+ int max_assoc;
+
+ max_assoc = bcm_atoi(string_num);
+ DHD_INFO(("%s : HAPD_MAX_NUM_STA = %d\n", __FUNCTION__, max_assoc));
+ wldev_iovar_setint(dev, "maxassoc", max_assoc);
+ return 1;
+}
static int
+wl_android_set_ssid(struct net_device *dev, const char* hapd_ssid)
+{
+ wlc_ssid_t ssid;
+ s32 ret;
+
+ ssid.SSID_len = strlen(hapd_ssid);
+ bcm_strncpy_s(ssid.SSID, sizeof(ssid.SSID), hapd_ssid, ssid.SSID_len);
+ DHD_INFO(("%s: HAPD_SSID = %s\n", __FUNCTION__, ssid.SSID));
+ ret = wldev_ioctl(dev, WLC_SET_SSID, &ssid, sizeof(wlc_ssid_t), true);
+ if (ret < 0) {
+ DHD_ERROR(("%s : WLC_SET_SSID Error:%d\n", __FUNCTION__, ret));
+ }
+ return 1;
+
+}
+
+static int
+wl_android_set_hide_ssid(struct net_device *dev, const char* string_num)
+{
+ int hide_ssid;
+ int enable = 0;
+
+ hide_ssid = bcm_atoi(string_num);
+ DHD_INFO(("%s: HAPD_HIDE_SSID = %d\n", __FUNCTION__, hide_ssid));
+ if (hide_ssid)
+ enable = 1;
+ wldev_iovar_setint(dev, "closednet", enable);
+ return 1;
+}
+#endif /* SUPPORT_HIDDEN_AP */
+
+#if defined(SUPPORT_AUTO_CHANNEL)
+static int
wl_android_set_auto_channel(struct net_device *dev, const char* string_num,
- char* command, int total_len)
+ char* command, int total_len)
{
int channel;
int chosen = 0;
@@ -715,7 +1344,7 @@ wl_android_set_auto_channel(struct net_device *dev, const char* string_num,
/* Restrict channel to 1 - 7: 2GHz, 20MHz BW, No SB */
u32 req_buf[8] = {7, 0x2B01, 0x2B02, 0x2B03, 0x2B04, 0x2B05, 0x2B06,
- 0x2B07};
+ 0x2B07};
/* Auto channel select */
wl_uint32_list_t request;
@@ -725,16 +1354,16 @@ wl_android_set_auto_channel(struct net_device *dev, const char* string_num,
if (channel == 20)
ret = wldev_ioctl(dev, WLC_START_CHANNEL_SEL, (void *)&req_buf,
- sizeof(req_buf), true);
+ sizeof(req_buf), true);
else { /* channel == 0 */
request.count = htod32(0);
ret = wldev_ioctl(dev, WLC_START_CHANNEL_SEL, (void *)&request,
- sizeof(request), true);
+ sizeof(request), true);
}
if (ret < 0) {
DHD_ERROR(("%s: can't start auto channel scan, err = %d\n",
- __FUNCTION__, ret));
+ __FUNCTION__, ret));
channel = 0;
goto done;
}
@@ -743,12 +1372,12 @@ wl_android_set_auto_channel(struct net_device *dev, const char* string_num,
bcm_mdelay(500);
retry = 10;
- while(retry--) {
+ while (retry--) {
ret = wldev_ioctl(dev, WLC_GET_CHANNEL_SEL, &chosen, sizeof(chosen),
- false);
+ false);
if (ret < 0 || dtoh32(chosen) == 0) {
DHD_INFO(("%s: %d tried, ret = %d, chosen = %d\n",
- __FUNCTION__, (10 - retry), ret, chosen));
+ __FUNCTION__, (10 - retry), ret, chosen));
bcm_mdelay(200);
}
else {
@@ -764,61 +1393,18 @@ wl_android_set_auto_channel(struct net_device *dev, const char* string_num,
}
done:
-// snprintf(command, total_len, "%d", channel);
snprintf(command, 4, "%d", channel);
DHD_INFO(("%s: command result is %s\n", __FUNCTION__, command));
-// return 1;
return 4;
}
+#endif /* SUPPORT_AUTO_CHANNEL */
-static int
-wl_android_set_max_num_sta(struct net_device *dev, const char* string_num)
-{
- int max_assoc;
-
- max_assoc = bcm_atoi(string_num);
- DHD_INFO(("%s : HAPD_MAX_NUM_STA = %d\n", __FUNCTION__, max_assoc));
- wldev_iovar_setint(dev, "maxassoc", max_assoc);
- return 1;
-}
-
-static int
-wl_android_set_ssid (struct net_device *dev, const char* hapd_ssid)
-{
- wlc_ssid_t ssid;
- s32 ret;
-
- ssid.SSID_len = strlen(hapd_ssid);
- bcm_strncpy_s(ssid.SSID, sizeof(ssid.SSID), hapd_ssid, ssid.SSID_len);
- DHD_INFO(("%s: HAPD_SSID = %s\n", __FUNCTION__, ssid.SSID));
- ret = wldev_ioctl(dev, WLC_SET_SSID, &ssid, sizeof(wlc_ssid_t), true);
- if (ret < 0) {
- DHD_ERROR(("%s : WLC_SET_SSID Error:%d\n", __FUNCTION__, ret));
- }
- return 1;
-
-}
-
-static int
-wl_android_set_hide_ssid(struct net_device *dev, const char* string_num)
-{
- int hide_ssid;
- int enable = 0;
-
- hide_ssid = bcm_atoi(string_num);
- DHD_INFO(("%s: HAPD_HIDE_SSID = %d\n", __FUNCTION__, hide_ssid));
- if (hide_ssid)
- enable = 1;
- wldev_iovar_setint(dev, "closednet", enable);
- return 1;
-}
-
+#if defined(SUPPORT_SOFTAP_SINGL_DISASSOC)
static int
wl_android_sta_diassoc(struct net_device *dev, const char* straddr)
{
scb_val_t scbval;
- s32 ret;
DHD_INFO(("%s: deauth STA %s\n", __FUNCTION__, straddr));
@@ -826,17 +1412,15 @@ wl_android_sta_diassoc(struct net_device *dev, const char* straddr)
scbval.val = htod32(1);
bcm_ether_atoe(straddr, &scbval.ea);
- DHD_INFO(("%s: deauth STA: %02X:%02X:%02X:%02X:%02X:%02X\n", __FUNCTION__,
- scbval.ea.octet[0], scbval.ea.octet[1], scbval.ea.octet[2],
- scbval.ea.octet[3], scbval.ea.octet[4], scbval.ea.octet[5]));
+ DHD_INFO(("%s: deauth STA: "MACDBG "\n", __FUNCTION__,
+ STR_TO_MACD(scbval.ea.octet)));
- if ((ret = wldev_ioctl(dev, WLC_SCB_DEAUTHENTICATE_FOR_REASON, &scbval,
- sizeof(scb_val_t), true)) < 0) {
- DHD_ERROR(("%s : WLC_SCB_DEAUTHENTICATE_FOR_REASON error:%d\n", __FUNCTION__ , ret));
- }
+ wldev_ioctl(dev, WLC_SCB_DEAUTHENTICATE_FOR_REASON, &scbval,
+ sizeof(scb_val_t), true);
return 1;
}
+#endif /* SUPPORT_SOFTAP_SINGL_DISASSOC */
#ifdef OKC_SUPPORT
@@ -883,7 +1467,7 @@ wl_android_okc_enable(struct net_device *dev, char *command, int total_len)
}
#endif /* OKC_ SUPPORT */
-#ifdef VSDB
+#ifdef CUSTOMER_HW4
static int
wl_android_ch_res_rl(struct net_device *dev, bool change)
{
@@ -894,20 +1478,18 @@ wl_android_ch_res_rl(struct net_device *dev, bool change)
if (change) {
srl = 4;
lrl = 2;
- }
- error = wldev_ioctl(dev, WLC_SET_SRL, &srl,
- sizeof(s32), true);
+ }
+ error = wldev_ioctl(dev, WLC_SET_SRL, &srl, sizeof(s32), true);
if (error) {
DHD_ERROR(("Failed to set SRL, error = %d\n", error));
}
- error = wldev_ioctl(dev, WLC_SET_LRL, &lrl,
- sizeof(s32), true);
+ error = wldev_ioctl(dev, WLC_SET_LRL, &lrl, sizeof(s32), true);
if (error) {
DHD_ERROR(("Failed to set LRL, error = %d\n", error));
}
return error;
}
-#endif
+#endif /* CUSTOMER_HW4 */
#ifdef SUPPORT_AMPDU_MPDU_CMD
/* CMD_AMPDU_MPDU */
@@ -917,13 +1499,13 @@ wl_android_set_ampdu_mpdu(struct net_device *dev, const char* string_num)
int err = 0;
int ampdu_mpdu;
- //ampdu_mpdu = my_atoi(string_num);
ampdu_mpdu = bcm_atoi(string_num);
if (ampdu_mpdu > 32) {
DHD_ERROR(("%s : ampdu_mpdu MAX value is 32.\n", __FUNCTION__));
return -1;
}
+
DHD_ERROR(("%s : ampdu_mpdu = %d\n", __FUNCTION__, ampdu_mpdu));
err = wldev_iovar_setint(dev, "ampdu_mpdu", ampdu_mpdu);
if (err < 0) {
@@ -933,10 +1515,34 @@ wl_android_set_ampdu_mpdu(struct net_device *dev, const char* string_num)
return 0;
}
-#endif
+#endif /* SUPPORT_AMPDU_MPDU_CMD */
+
+int wl_android_set_roam_mode(struct net_device *dev,
+char *command, int total_len)
+{
+ int error = 0;
+ int mode = 0;
+ if (sscanf(command, "%*s %d", &mode) != 1) {
+ DHD_ERROR(("wl_android_set_roam_mode:"\
+ "Failed to get Parameter\n"));
+ return -1;
+ }
+
+ error = wldev_iovar_setint(dev, "roam_off", mode);
+ if (error) {
+ DHD_ERROR(("wl_android_set_roam_mode:"\
+ "Failed to set roaming Mode %d, error = %d\n", mode, error));
+ return -1;
+ } else {
+ DHD_ERROR(("wl_android_set_roam_mode:"\
+ "succeeded to set roaming Mode %d, error = %d\n", mode, error));
+ }
+ return error;
+}
int wl_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
{
+#define PRIVATE_COMMAND_MAX_LEN 8192
int ret = 0;
char *command = NULL;
int bytes_written = 0;
@@ -952,6 +1558,11 @@ int wl_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
ret = -EFAULT;
goto exit;
}
+ if (priv_cmd.total_len > PRIVATE_COMMAND_MAX_LEN)
+ {
+ DHD_ERROR(("%s: too long priavte command\n", __FUNCTION__));
+ ret = -EINVAL;
+ }
command = kmalloc(priv_cmd.total_len, GFP_KERNEL);
if (!command)
{
@@ -963,16 +1574,15 @@ int wl_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
ret = -EFAULT;
goto exit;
}
-
DHD_INFO(("%s: Android private cmd \"%s\" on %s\n", __FUNCTION__, command, ifr->ifr_name));
if (strnicmp(command, CMD_START, strlen(CMD_START)) == 0) {
- DHD_ERROR(("%s, Received regular START command\n", __FUNCTION__));
-#ifdef CUSTOMER_HW_SAMSUNG
+ DHD_INFO(("%s, Received regular START command\n", __FUNCTION__));
+#ifdef SUPPORT_DEEP_SLEEP
sleep_never = 1;
#else
bytes_written = wl_android_wifi_on(net);
-#endif /* CUSTOMER_HW_SAMSUNG */
+#endif /* SUPPORT_DEEP_SLEEP */
}
else if (strnicmp(command, CMD_SETFWPATH, strlen(CMD_SETFWPATH)) == 0) {
bytes_written = wl_android_set_fwpath(net, command, priv_cmd.total_len);
@@ -986,12 +1596,11 @@ int wl_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
}
if (strnicmp(command, CMD_STOP, strlen(CMD_STOP)) == 0) {
- DHD_ERROR(("%s, Received regular STOP command\n", __FUNCTION__));
-#ifdef CUSTOMER_HW_SAMSUNG
+#ifdef SUPPORT_DEEP_SLEEP
sleep_never = 1;
#else
bytes_written = wl_android_wifi_off(net);
-#endif /* CUSTOMER_HW_SAMSUNG */
+#endif /* SUPPORT_DEEP_SLEEP */
}
else if (strnicmp(command, CMD_SCAN_ACTIVE, strlen(CMD_SCAN_ACTIVE)) == 0) {
/* TBD: SCAN-ACTIVE */
@@ -1005,11 +1614,12 @@ int wl_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
else if (strnicmp(command, CMD_LINKSPEED, strlen(CMD_LINKSPEED)) == 0) {
bytes_written = wl_android_get_link_speed(net, command, priv_cmd.total_len);
}
+#ifdef PKT_FILTER_SUPPORT
else if (strnicmp(command, CMD_RXFILTER_START, strlen(CMD_RXFILTER_START)) == 0) {
- bytes_written = net_os_set_packet_filter(net, 1);
+ bytes_written = net_os_enable_packet_filter(net, 1);
}
else if (strnicmp(command, CMD_RXFILTER_STOP, strlen(CMD_RXFILTER_STOP)) == 0) {
- bytes_written = net_os_set_packet_filter(net, 0);
+ bytes_written = net_os_enable_packet_filter(net, 0);
}
else if (strnicmp(command, CMD_RXFILTER_ADD, strlen(CMD_RXFILTER_ADD)) == 0) {
int filter_num = *(command + strlen(CMD_RXFILTER_ADD) + 1) - '0';
@@ -1019,6 +1629,7 @@ int wl_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
int filter_num = *(command + strlen(CMD_RXFILTER_REMOVE) + 1) - '0';
bytes_written = net_os_rxfilter_add_remove(net, FALSE, filter_num);
}
+#endif /* PKT_FILTER_SUPPORT */
else if (strnicmp(command, CMD_BTCOEXSCAN_START, strlen(CMD_BTCOEXSCAN_START)) == 0) {
/* TBD: BTCOEXSCAN-START */
}
@@ -1026,73 +1637,143 @@ int wl_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
/* TBD: BTCOEXSCAN-STOP */
}
else if (strnicmp(command, CMD_BTCOEXMODE, strlen(CMD_BTCOEXMODE)) == 0) {
-#if !defined(CUSTOMER_HW_SAMSUNG)
+#ifdef WL_CFG80211
+ bytes_written = wl_cfg80211_set_btcoex_dhcp(net, command);
+#else
+#ifdef PKT_FILTER_SUPPORT
uint mode = *(command + strlen(CMD_BTCOEXMODE) + 1) - '0';
if (mode == 1)
- net_os_set_packet_filter(net, 0); /* DHCP starts */
+ net_os_enable_packet_filter(net, 0); /* DHCP starts */
else
- net_os_set_packet_filter(net, 1); /* DHCP ends */
-#endif
-#ifdef WL_CFG80211
- bytes_written = wl_cfg80211_set_btcoex_dhcp(net, command);
-#endif
+ net_os_enable_packet_filter(net, 1); /* DHCP ends */
+#endif /* PKT_FILTER_SUPPORT */
+#endif /* WL_CFG80211 */
}
else if (strnicmp(command, CMD_SETSUSPENDOPT, strlen(CMD_SETSUSPENDOPT)) == 0) {
bytes_written = wl_android_set_suspendopt(net, command, priv_cmd.total_len);
}
+ else if (strnicmp(command, CMD_SETSUSPENDMODE, strlen(CMD_SETSUSPENDMODE)) == 0) {
+ bytes_written = wl_android_set_suspendmode(net, command, priv_cmd.total_len);
+ }
else if (strnicmp(command, CMD_SETBAND, strlen(CMD_SETBAND)) == 0) {
uint band = *(command + strlen(CMD_SETBAND) + 1) - '0';
bytes_written = wldev_set_band(net, band);
- wl_update_wiphybands(NULL);
}
else if (strnicmp(command, CMD_GETBAND, strlen(CMD_GETBAND)) == 0) {
bytes_written = wl_android_get_band(net, command, priv_cmd.total_len);
}
-#ifndef GLOBALCONFIG_WLAN_COUNTRY_CODE
-
+#ifdef WL_CFG80211
+#ifndef CUSTOMER_SET_COUNTRY
+ /* CUSTOMER_SET_COUNTRY feature is define for only GGSM model */
else if (strnicmp(command, CMD_COUNTRY, strlen(CMD_COUNTRY)) == 0) {
char *country_code = command + strlen(CMD_COUNTRY) + 1;
bytes_written = wldev_set_country(net, country_code);
- wl_update_wiphybands(NULL);
}
#endif
+#endif /* WL_CFG80211 */
#ifdef ROAM_API
else if (strnicmp(command, CMD_ROAMTRIGGER_SET,
- strlen(CMD_ROAMTRIGGER_SET)) == 0) {
+ strlen(CMD_ROAMTRIGGER_SET)) == 0) {
bytes_written = wl_android_set_roam_trigger(net, command,
- priv_cmd.total_len);
+ priv_cmd.total_len);
} else if (strnicmp(command, CMD_ROAMTRIGGER_GET,
- strlen(CMD_ROAMTRIGGER_GET)) == 0) {
+ strlen(CMD_ROAMTRIGGER_GET)) == 0) {
bytes_written = wl_android_get_roam_trigger(net, command,
- priv_cmd.total_len);
+ priv_cmd.total_len);
} else if (strnicmp(command, CMD_ROAMDELTA_SET,
- strlen(CMD_ROAMDELTA_SET)) == 0) {
+ strlen(CMD_ROAMDELTA_SET)) == 0) {
bytes_written = wl_android_set_roam_delta(net, command,
- priv_cmd.total_len);
+ priv_cmd.total_len);
} else if (strnicmp(command, CMD_ROAMDELTA_GET,
- strlen(CMD_ROAMDELTA_GET)) == 0) {
+ strlen(CMD_ROAMDELTA_GET)) == 0) {
bytes_written = wl_android_get_roam_delta(net, command,
- priv_cmd.total_len);
+ priv_cmd.total_len);
} else if (strnicmp(command, CMD_ROAMSCANPERIOD_SET,
- strlen(CMD_ROAMSCANPERIOD_SET)) == 0) {
+ strlen(CMD_ROAMSCANPERIOD_SET)) == 0) {
bytes_written = wl_android_set_roam_scan_period(net, command,
- priv_cmd.total_len);
+ priv_cmd.total_len);
} else if (strnicmp(command, CMD_ROAMSCANPERIOD_GET,
- strlen(CMD_ROAMSCANPERIOD_GET)) == 0) {
+ strlen(CMD_ROAMSCANPERIOD_GET)) == 0) {
bytes_written = wl_android_get_roam_scan_period(net, command,
- priv_cmd.total_len);
+ priv_cmd.total_len);
+ } else if (strnicmp(command, CMD_FULLROAMSCANPERIOD_SET,
+ strlen(CMD_FULLROAMSCANPERIOD_SET)) == 0) {
+ bytes_written = wl_android_set_full_roam_scan_period(net, command,
+ priv_cmd.total_len);
+ } else if (strnicmp(command, CMD_FULLROAMSCANPERIOD_GET,
+ strlen(CMD_FULLROAMSCANPERIOD_GET)) == 0) {
+ bytes_written = wl_android_get_full_roam_scan_period(net, command,
+ priv_cmd.total_len);
} else if (strnicmp(command, CMD_COUNTRYREV_SET,
- strlen(CMD_COUNTRYREV_SET)) == 0) {
+ strlen(CMD_COUNTRYREV_SET)) == 0) {
bytes_written = wl_android_set_country_rev(net, command,
- priv_cmd.total_len);
+ priv_cmd.total_len);
wl_update_wiphybands(NULL);
} else if (strnicmp(command, CMD_COUNTRYREV_GET,
- strlen(CMD_COUNTRYREV_GET)) == 0) {
+ strlen(CMD_COUNTRYREV_GET)) == 0) {
bytes_written = wl_android_get_country_rev(net, command,
- priv_cmd.total_len);
+ priv_cmd.total_len);
}
#endif /* ROAM_API */
+#if defined(CUSTOMER_HW4) && defined(WES_SUPPORT)
+ else if (strnicmp(command, CMD_GETROAMSCANCONTROL, strlen(CMD_GETROAMSCANCONTROL)) == 0) {
+ bytes_written = wl_android_get_roam_scan_control(net, command, priv_cmd.total_len);
+ }
+ else if (strnicmp(command, CMD_SETROAMSCANCONTROL, strlen(CMD_SETROAMSCANCONTROL)) == 0) {
+ bytes_written = wl_android_set_roam_scan_control(net, command, priv_cmd.total_len);
+ }
+ else if (strnicmp(command, CMD_GETROAMSCANCHANNELS, strlen(CMD_GETROAMSCANCHANNELS)) == 0) {
+ bytes_written = wl_android_get_roam_scan_channels(net, command, priv_cmd.total_len);
+ }
+ else if (strnicmp(command, CMD_SETROAMSCANCHANNELS, strlen(CMD_SETROAMSCANCHANNELS)) == 0) {
+ bytes_written = wl_android_set_roam_scan_channels(net, command, priv_cmd.total_len);
+ }
+ else if (strnicmp(command, CMD_SENDACTIONFRAME, strlen(CMD_SENDACTIONFRAME)) == 0) {
+ bytes_written = wl_android_send_action_frame(net, command, priv_cmd.total_len);
+ }
+ else if (strnicmp(command, CMD_REASSOC, strlen(CMD_REASSOC)) == 0) {
+ bytes_written = wl_android_reassoc(net, command, priv_cmd.total_len);
+ }
+ else if (strnicmp(command, CMD_GETSCANCHANNELTIME, strlen(CMD_GETSCANCHANNELTIME)) == 0) {
+ bytes_written = wl_android_get_scan_channel_time(net, command, priv_cmd.total_len);
+ }
+ else if (strnicmp(command, CMD_SETSCANCHANNELTIME, strlen(CMD_SETSCANCHANNELTIME)) == 0) {
+ bytes_written = wl_android_set_scan_channel_time(net, command, priv_cmd.total_len);
+ }
+ else if (strnicmp(command, CMD_GETSCANHOMETIME, strlen(CMD_GETSCANHOMETIME)) == 0) {
+ bytes_written = wl_android_get_scan_home_time(net, command, priv_cmd.total_len);
+ }
+ else if (strnicmp(command, CMD_SETSCANHOMETIME, strlen(CMD_SETSCANHOMETIME)) == 0) {
+ bytes_written = wl_android_set_scan_home_time(net, command, priv_cmd.total_len);
+ }
+ else if (strnicmp(command, CMD_GETSCANHOMEAWAYTIME, strlen(CMD_GETSCANHOMEAWAYTIME)) == 0) {
+ bytes_written = wl_android_get_scan_home_away_time(net, command,
+ priv_cmd.total_len);
+ }
+ else if (strnicmp(command, CMD_SETSCANHOMEAWAYTIME, strlen(CMD_SETSCANHOMEAWAYTIME)) == 0) {
+ bytes_written = wl_android_set_scan_home_away_time(net, command,
+ priv_cmd.total_len);
+ }
+ else if (strnicmp(command, CMD_GETSCANNPROBES, strlen(CMD_GETSCANNPROBES)) == 0) {
+ bytes_written = wl_android_get_scan_nprobes(net, command, priv_cmd.total_len);
+ }
+ else if (strnicmp(command, CMD_SETSCANNPROBES, strlen(CMD_SETSCANNPROBES)) == 0) {
+ bytes_written = wl_android_set_scan_nprobes(net, command, priv_cmd.total_len);
+ }
+ else if (strnicmp(command, CMD_GETWESMODE, strlen(CMD_GETWESMODE)) == 0) {
+ bytes_written = wl_android_get_wes_mode(net, command, priv_cmd.total_len);
+ }
+ else if (strnicmp(command, CMD_SETWESMODE, strlen(CMD_SETWESMODE)) == 0) {
+ bytes_written = wl_android_set_wes_mode(net, command, priv_cmd.total_len);
+ }
+ else if (strnicmp(command, CMD_GETOKCMODE, strlen(CMD_GETOKCMODE)) == 0) {
+ bytes_written = wl_android_get_okc_mode(net, command, priv_cmd.total_len);
+ }
+ else if (strnicmp(command, CMD_SETOKCMODE, strlen(CMD_SETOKCMODE)) == 0) {
+ bytes_written = wl_android_set_okc_mode(net, command, priv_cmd.total_len);
+ }
+#endif /* WES_SUPPORT */
#ifdef PNO_SUPPORT
else if (strnicmp(command, CMD_PNOSSIDCLR_SET, strlen(CMD_PNOSSIDCLR_SET)) == 0) {
bytes_written = dhd_dev_pno_reset(net);
@@ -1113,9 +1794,11 @@ int wl_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
bytes_written = wl_cfg80211_set_p2p_noa(net, command + skip,
priv_cmd.total_len - skip);
}
+#if !defined WL_ENABLE_P2P_IF
else if (strnicmp(command, CMD_P2P_GET_NOA, strlen(CMD_P2P_GET_NOA)) == 0) {
bytes_written = wl_cfg80211_get_p2p_noa(net, command, priv_cmd.total_len);
}
+#endif /* WL_ENABLE_P2P_IF */
else if (strnicmp(command, CMD_P2P_SET_PS, strlen(CMD_P2P_SET_PS)) == 0) {
int skip = strlen(CMD_P2P_SET_PS) + 1;
bytes_written = wl_cfg80211_set_p2p_ps(net, command + skip,
@@ -1129,34 +1812,38 @@ int wl_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
priv_cmd.total_len - skip, *(command + skip - 2) - '0');
}
#endif /* WL_CFG80211 */
+#if defined(SUPPORT_AUTO_CHANNEL)
else if (strnicmp(command, CMD_SET_HAPD_AUTO_CHANNEL,
- strlen(CMD_SET_HAPD_AUTO_CHANNEL)) == 0) {
+ strlen(CMD_SET_HAPD_AUTO_CHANNEL)) == 0) {
int skip = strlen(CMD_SET_HAPD_AUTO_CHANNEL) + 3;
-// wl_android_set_auto_channel(net, (const char*)command+skip, command,
-// priv_cmd.total_len);
bytes_written = wl_android_set_auto_channel(net, (const char*)command+skip, command,
- priv_cmd.total_len);
+ priv_cmd.total_len);
}
+#endif
+#if defined(SUPPORT_HIDDEN_AP)
else if (strnicmp(command, CMD_SET_HAPD_MAX_NUM_STA,
- strlen(CMD_SET_HAPD_MAX_NUM_STA)) == 0) {
+ strlen(CMD_SET_HAPD_MAX_NUM_STA)) == 0) {
int skip = strlen(CMD_SET_HAPD_MAX_NUM_STA) + 3;
wl_android_set_max_num_sta(net, (const char*)command+skip);
}
else if (strnicmp(command, CMD_SET_HAPD_SSID,
- strlen(CMD_SET_HAPD_SSID)) == 0) {
+ strlen(CMD_SET_HAPD_SSID)) == 0) {
int skip = strlen(CMD_SET_HAPD_SSID) + 3;
wl_android_set_ssid(net, (const char*)command+skip);
}
else if (strnicmp(command, CMD_SET_HAPD_HIDE_SSID,
- strlen(CMD_SET_HAPD_HIDE_SSID)) == 0) {
+ strlen(CMD_SET_HAPD_HIDE_SSID)) == 0) {
int skip = strlen(CMD_SET_HAPD_HIDE_SSID) + 3;
wl_android_set_hide_ssid(net, (const char*)command+skip);
}
+#endif /* SUPPORT_HIDDEN_AP */
+#if defined(SUPPORT_SOFTAP_SINGL_DISASSOC)
else if (strnicmp(command, CMD_HAPD_STA_DISASSOC,
- strlen(CMD_HAPD_STA_DISASSOC)) == 0) {
+ strlen(CMD_HAPD_STA_DISASSOC)) == 0) {
int skip = strlen(CMD_HAPD_STA_DISASSOC) + 1;
wl_android_sta_diassoc(net, (const char*)command+skip);
}
+#endif /* SUPPORT_SOFTAP_SINGL_DISASSOC */
#ifdef OKC_SUPPORT
else if (strnicmp(command, CMD_OKC_SET_PMK, strlen(CMD_OKC_SET_PMK)) == 0)
bytes_written = wl_android_set_pmk(net, command, priv_cmd.total_len);
@@ -1176,21 +1863,23 @@ int wl_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
#endif /* BCMCCX */
#ifdef SUPPORT_AMPDU_MPDU_CMD
/* CMD_AMPDU_MPDU */
- else if (strnicmp(command, CMD_AMPDU_MPDU,strlen(CMD_AMPDU_MPDU)) == 0) {
+ else if (strnicmp(command, CMD_AMPDU_MPDU, strlen(CMD_AMPDU_MPDU)) == 0) {
int skip = strlen(CMD_AMPDU_MPDU) + 1;
bytes_written = wl_android_set_ampdu_mpdu(net, (const char*)command+skip);
}
-#endif
-#ifdef VSDB
+#endif /* SUPPORT_AMPDU_MPDU_CMD */
+#ifdef CUSTOMER_HW4
else if (strnicmp(command, CMD_CHANGE_RL, strlen(CMD_CHANGE_RL)) == 0)
bytes_written = wl_android_ch_res_rl(net, true);
else if (strnicmp(command, CMD_RESTORE_RL, strlen(CMD_RESTORE_RL)) == 0)
bytes_written = wl_android_ch_res_rl(net, false);
-#endif
+#endif /* CUSTOMER_HW4 */
+ else if (strnicmp(command, CMD_SETROAMMODE,
+ strlen(CMD_SETROAMMODE)) == 0)
+ bytes_written = wl_android_set_roam_mode(net,
+ command, priv_cmd.total_len);
else {
- if ((strnicmp(command, CMD_START, strlen(CMD_START)) != 0) &&
- (strnicmp(command, CMD_SETFWPATH, strlen(CMD_SETFWPATH)) != 0))
- DHD_ERROR(("Unknown PRIVATE command %s - ignored\n", command));
+ DHD_ERROR(("Unknown PRIVATE command %s - ignored\n", command));
snprintf(command, 3, "OK");
bytes_written = strlen("OK");
}
@@ -1227,16 +1916,16 @@ int wl_android_init(void)
{
int ret = 0;
- dhd_msg_level = DHD_ERROR_VAL;
+ dhd_msg_level |= DHD_ERROR_VAL;
#ifdef ENABLE_INSMOD_NO_FW_LOAD
dhd_download_fw_on_driverload = FALSE;
#endif /* ENABLE_INSMOD_NO_FW_LOAD */
-#if defined(CUSTOMER_HW2) || defined(CUSTOMER_HW_SAMSUNG)
+#if defined(CUSTOMER_HW2) || defined(CUSTOMER_HW4)
if (!iface_name[0]) {
memset(iface_name, 0, IFNAMSIZ);
bcm_strncpy_s(iface_name, IFNAMSIZ, "wlan", IFNAMSIZ);
}
-#endif /* CUSTOMER_HW2 || CUSTOMER_HW_SAMSUNG */
+#endif /* CUSTOMER_HW2 || CUSTOMER_HW4 */
return ret;
}
@@ -1306,7 +1995,7 @@ void* wl_android_prealloc(int section, unsigned long size)
if (alloc_ptr) {
DHD_INFO(("success alloc section %d\n", section));
if (size != 0L)
- bzero(alloc_ptr, size);
+ bzero(alloc_ptr, size);
return alloc_ptr;
}
}
@@ -1379,14 +2068,12 @@ static int wifi_probe(struct platform_device *pdev)
struct wifi_platform_data *wifi_ctrl =
(struct wifi_platform_data *)(pdev->dev.platform_data);
- DHD_ERROR(("## %s\n", __FUNCTION__));
wifi_irqres = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "bcmdhd_wlan_irq");
if (wifi_irqres == NULL)
wifi_irqres = platform_get_resource_byname(pdev,
IORESOURCE_IRQ, "bcm4329_wlan_irq");
wifi_control_data = wifi_ctrl;
-
- wifi_set_power(1, 200); /* Power On */
+ wifi_set_power(1, 0); /* Power On */
wifi_set_carddetect(1); /* CardDetect (0->1) */
up(&wifi_control_sem);
@@ -1401,21 +2088,16 @@ static int wifi_remove(struct platform_device *pdev)
DHD_ERROR(("## %s\n", __FUNCTION__));
wifi_control_data = wifi_ctrl;
- wifi_set_power(0, 100); /* Power Off */
+ wifi_set_power(0, WIFI_TURNOFF_DELAY); /* Power Off */
wifi_set_carddetect(0); /* CardDetect (1->0) */
up(&wifi_control_sem);
return 0;
}
-int dhd_os_check_wakelock(void *dhdp);
static int wifi_suspend(struct platform_device *pdev, pm_message_t state)
{
DHD_TRACE(("##> %s\n", __FUNCTION__));
-#if defined(BCMHOST)
- if (dhd_os_check_wakelock(bcmsdh_get_drvdata()))
- return -EBUSY;
-#endif
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 39)) && defined(OOB_INTR_ONLY) && 1
bcmsdh_oob_intr_set(0);
#endif /* (OOB_INTR_ONLY) */
@@ -1454,10 +2136,15 @@ static struct platform_driver wifi_device_legacy = {
static int wifi_add_dev(void)
{
+ int ret = 0;
DHD_TRACE(("## Calling platform_driver_register\n"));
- platform_driver_register(&wifi_device);
- platform_driver_register(&wifi_device_legacy);
- return 0;
+
+ ret = platform_driver_register(&wifi_device);
+ if (ret)
+ return ret;
+
+ ret = platform_driver_register(&wifi_device_legacy);
+ return ret;
}
static void wifi_del_dev(void)
diff --git a/drivers/net/wireless/bcmdhd/src/wl/sys/wl_android.h b/drivers/net/wireless/bcmdhd/wl_android.h
index 5b36049..583a167 100644
--- a/drivers/net/wireless/bcmdhd/src/wl/sys/wl_android.h
+++ b/drivers/net/wireless/bcmdhd/wl_android.h
@@ -1,14 +1,14 @@
/*
* Linux cfg80211 driver - Android related functions
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,7 +16,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
diff --git a/drivers/net/wireless/bcmdhd/src/wl/sys/wl_cfg80211.c b/drivers/net/wireless/bcmdhd/wl_cfg80211.c
index 659efd0..a0e8616 100644
--- a/drivers/net/wireless/bcmdhd/src/wl/sys/wl_cfg80211.c
+++ b/drivers/net/wireless/bcmdhd/wl_cfg80211.c
@@ -2,13 +2,13 @@
* Linux cfg80211 driver
*
* Copyright (C) 1999-2012, Broadcom Corporation
- *
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,12 +16,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: wl_cfg80211.c 310409 2012-01-24 18:47:09Z $
+ * $Id: wl_cfg80211.c 358102 2012-09-21 04:45:06Z $
*/
#include <typedefs.h>
@@ -54,22 +54,20 @@
#include <linux/wait.h>
#include <net/cfg80211.h>
#include <net/rtnetlink.h>
-
#include <wlioctl.h>
#include <wldev_common.h>
#include <wl_cfg80211.h>
#include <wl_cfgp2p.h>
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0))
-#define DAEMONIZE(a) daemonize(a); \
- allow_signal(SIGKILL); \
-allow_signal(SIGTERM);
-#else /* Linux 2.4 (w/o preemption patch) */
-#define DAEMONIZE(a) daemonize(); \
- do { if (a) \
- strncpy(current->comm, a, MIN(sizeof(current->comm), (strlen(a) + 1))); \
- } while (0);
-#endif /* LINUX_VERSION_CODE */
+#ifdef PROP_TXSTATUS
+#include <dhd_wlfc.h>
+#endif
+
+#ifdef WL11U
+#ifndef WL_ENABLE_P2P_IF
+#error "You should enable WL_ENABLE_P2P_IF and Only supported in JB"
+#endif
+#endif /* WL11U */
#ifdef BCMWAPI_WPI
/* these items should evetually go into wireless.h of the linux system headfile dir */
@@ -104,25 +102,22 @@ allow_signal(SIGTERM);
#define IW_WSEC_ENABLED(wsec) ((wsec) & (WEP_ENABLED | TKIP_ENABLED | AES_ENABLED))
#endif /* BCMWAPI_WPI */
-
static struct device *cfg80211_parent_dev = NULL;
-static int vsdb_supported = 0;
struct wl_priv *wlcfg_drv_priv = NULL;
-
+#ifdef CUSTOMER_HW4
+u32 wl_dbg_level = WL_DBG_ERR | WL_DBG_P2P_ACTION;
+#else
u32 wl_dbg_level = WL_DBG_ERR;
+#endif
-#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
-#define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
#define MAX_WAIT_TIME 1500
-#define WL_SCAN_ACTIVE_TIME 40 /* ms : Embedded default Active setting from DHD Driver */
-#define WL_SCAN_PASSIVE_TIME 130 /* ms: Embedded default Passive setting from DHD Driver */
#ifdef VSDB
-/* ms : default wait time to keep STA's connecting or connection during continuous af tx */
-#define DEFAULT_SLEEP_TIME_VSDB 200
-#define WL_CHANNEL_SYNC_RETRY_VSDB 3
+/* sleep time to keep STA's connecting or connection for continuous af tx or finding a peer */
+#define DEFAULT_SLEEP_TIME_VSDB 200
+#define OFF_CHAN_TIME_THRESHOLD_MS 200
-/* if sta is connected or connecting, sleep for a while before retry for VSDB */
+/* if sta is connected or connecting, sleep for a while before retry af tx or finding a peer */
#define WL_AF_TX_KEEP_PRI_CONNECTION_VSDB(wl) \
do { \
if (wl_get_drv_status(wl, CONNECTED, wl_to_prmry_ndev(wl)) || \
@@ -130,27 +125,25 @@ u32 wl_dbg_level = WL_DBG_ERR;
msleep(DEFAULT_SLEEP_TIME_VSDB); \
} \
} while (0)
-#define WL_AF_TX_REDUCE_RETRY_VSDB(wl, max_retry)
#else /* VSDB */
/* if not VSDB, do nothing */
#define WL_AF_TX_KEEP_PRI_CONNECTION_VSDB(wl)
-#define WL_AF_TX_REDUCE_RETRY_VSDB(wl, max_retry)
#endif /* VSDB */
-#ifdef D11AC_IOTYPES
+#ifdef WL_CFG80211_SYNC_GON
+#define WL_DRV_STATUS_SENDING_AF_FRM_EXT(wl) \
+ (wl_get_drv_status_all(wl, SENDING_ACT_FRM) || \
+ wl_get_drv_status_all(wl, WAITING_NEXT_ACT_FRM_LISTEN))
+#else
+#define WL_DRV_STATUS_SENDING_AF_FRM_EXT(wl) wl_get_drv_status_all(wl, SENDING_ACT_FRM)
+#endif /* WL_CFG80211_SYNC_GON */
+
#define WL_CHANSPEC_CTL_SB_NONE WL_CHANSPEC_CTL_SB_LLL
-#endif /* D11AC_IOTYPES */
+
#define DNGL_FUNC(func, parameters) func parameters;
#define COEX_DHCP
-#define WLAN_EID_SSID 0
-
-/* Set this to 1 to use a seperate interface (p2p0)
- * for p2p operations.
- */
-#define ENABLE_P2P_INTERFACE 1
-
/* This is to override regulatory domains defined in cfg80211 module (reg.c)
* By default world regulatory domain defined in reg.c puts the flags NL80211_RRF_PASSIVE_SCAN
* and NL80211_RRF_NO_IBSS for 5GHz channels (for 36..48 and 149..165).
@@ -158,20 +151,16 @@ u32 wl_dbg_level = WL_DBG_ERR;
* All the chnages in world regulatory domain are to be done here.
*/
static const struct ieee80211_regdomain brcm_regdom = {
- .n_reg_rules = 5,
+ .n_reg_rules = 4,
.alpha2 = "99",
.reg_rules = {
/* IEEE 802.11b/g, channels 1..11 */
- REG_RULE(2412-10, 2462+10, 40, 6, 20, 0),
- /* IEEE 802.11b/g, channels 12..13. No HT40
- * channel fits here.
- */
- REG_RULE(2467-10, 2472+10, 20, 6, 20, 0),
+ REG_RULE(2412-10, 2472+10, 40, 6, 20, 0),
+ /* If any */
/* IEEE 802.11 channel 14 - Only JP enables
* this and for 802.11b only
*/
REG_RULE(2484-10, 2484+10, 20, 6, 20, 0),
-
/* IEEE 802.11a, channel 36..64 */
REG_RULE(5150-10, 5350+10, 40, 6, 20, 0),
/* IEEE 802.11a, channel 100..165 */
@@ -214,6 +203,7 @@ static const struct ieee80211_regdomain brcm_regdom = {
#define PM_BLOCK 1
#define PM_ENABLE 0
+
#ifdef BCMCCX
#ifndef WLAN_AKM_SUITE_CCKM
#define WLAN_AKM_SUITE_CCKM 0x000FAC04
@@ -221,6 +211,9 @@ static const struct ieee80211_regdomain brcm_regdom = {
#define DOT11_LEAP_AUTH 0x80 /* LEAP auth frame paylod constants */
#endif /* BCMCCX */
+#ifndef RSSI_OFFSET
+#define RSSI_OFFSET 0
+#endif
/*
* cfg80211_ops api/callback list
*/
@@ -277,7 +270,8 @@ static s32 wl_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev,
struct cfg80211_pmksa *pmksa);
static s32 wl_cfg80211_flush_pmksa(struct wiphy *wiphy,
struct net_device *dev);
-static void wl_notify_escan_complete(struct wl_priv *wl, struct net_device *ndev, bool aborted);
+static s32 wl_notify_escan_complete(struct wl_priv *wl,
+ struct net_device *ndev, bool aborted, bool fw_abort);
/*
* event & event Q handlers for cfg80211 interfaces
*/
@@ -352,7 +346,7 @@ static s32 wl_set_set_sharedkey(struct net_device *dev,
struct cfg80211_connect_params *sme);
#ifdef BCMWAPI_WPI
static s32 wl_set_set_wapi_ie(struct net_device *dev,
- struct cfg80211_connect_params *sme);
+ struct cfg80211_connect_params *sme);
#endif
static s32 wl_get_assoc_ies(struct wl_priv *wl, struct net_device *ndev);
static void wl_ch_to_chanspec(int ch,
@@ -367,13 +361,20 @@ static s32 wl_mrg_ie(struct wl_priv *wl, u8 *ie_stream, u16 ie_size);
static s32 wl_cp_ie(struct wl_priv *wl, u8 *dst, u16 dst_size);
static u32 wl_get_ielen(struct wl_priv *wl);
+#ifdef WL11U
+bcm_tlv_t *
+wl_cfg80211_find_interworking_ie(u8 *parse, u32 len);
+static s32
+wl_cfg80211_add_iw_ie(struct wl_priv *wl, struct net_device *ndev, s32 bssidx, s32 pktflag,
+ uint8 ie_id, uint8 *data, uint8 data_len);
+#endif /* WL11U */
static s32 wl_setup_wiphy(struct wireless_dev *wdev, struct device *dev);
static void wl_free_wdev(struct wl_priv *wl);
static s32 wl_inform_bss(struct wl_priv *wl);
-static s32 wl_inform_single_bss(struct wl_priv *wl, struct wl_bss_info *bi, u8 is_roam_done);
-static s32 wl_update_bss_info(struct wl_priv *wl, struct net_device *ndev, u8 is_roam_done);
+static s32 wl_inform_single_bss(struct wl_priv *wl, struct wl_bss_info *bi, u8 roam_done_flag);
+static s32 wl_update_bss_info(struct wl_priv *wl, struct net_device *ndev, u8 roam_done_flag);
static chanspec_t wl_cfg80211_get_shared_freq(struct wiphy *wiphy);
static s32 wl_add_keyext(struct wiphy *wiphy, struct net_device *dev,
@@ -412,7 +413,6 @@ static void wl_link_down(struct wl_priv *wl);
static s32 wl_config_ifmode(struct wl_priv *wl, struct net_device *ndev, s32 iftype);
static void wl_init_conf(struct wl_conf *conf);
-
/*
* iscan handler
*/
@@ -457,25 +457,29 @@ int dhd_del_monitor(struct net_device *ndev);
int dhd_monitor_init(void *dhd_pub);
int dhd_monitor_uninit(void);
int dhd_start_xmit(struct sk_buff *skb, struct net_device *net);
+
#ifdef ROAM_CHANNEL_CACHE
void reset_roam_cache(void);
void add_roam_cache(wl_bss_info_t *bi);
-int get_roam_channel_list(int target_chan, chanspec_t *channels, const wlc_ssid_t *ssid);
+int get_roam_channel_list(int target_chan,
+ chanspec_t *channels, const wlc_ssid_t *ssid, int ioctl_ver);
void print_roam_cache(void);
void set_roam_band(int band);
#endif
-#define CHECK_SYS_UP(wlpriv) \
+
+
+#define CHECK_SYS_UP(wlpriv) \
do { \
- struct net_device *ndev = wl_to_prmry_ndev(wlpriv); \
+ struct net_device *ndev = wl_to_prmry_ndev(wlpriv); \
if (unlikely(!wl_get_drv_status(wlpriv, READY, ndev))) { \
- WL_INFO(("device is not ready\n")); \
+ WL_INFO(("device is not ready\n")); \
return -EIO; \
} \
} while (0)
-#define IS_WPA_AKM(akm) ((akm) == RSN_AKM_NONE || \
- (akm) == RSN_AKM_UNSPECIFIED || \
+#define IS_WPA_AKM(akm) ((akm) == RSN_AKM_NONE || \
+ (akm) == RSN_AKM_UNSPECIFIED || \
(akm) == RSN_AKM_PSK)
@@ -484,7 +488,7 @@ extern int dhd_wait_pend8021x(struct net_device *dev);
extern int disable_proptx;
extern int dhd_wlfc_init(dhd_pub_t *dhd);
extern void dhd_wlfc_deinit(dhd_pub_t *dhd);
-#endif
+#endif /* PROP_TXSTATUS */
#if (WL_DBG_LEVEL > 0)
#define WL_DBG_ESTR_MAX 50
@@ -600,22 +604,7 @@ static struct ieee80211_supported_band __wl_band_2ghz = {
.channels = __wl_2ghz_channels,
.n_channels = ARRAY_SIZE(__wl_2ghz_channels),
.bitrates = wl_g_rates,
- .n_bitrates = wl_g_rates_size,
-#if (ENABLE_P2P_INTERFACE)
- /* wpa_supplicant sets wmm_enabled based on whether ht_cap
- * is present or not. The wmm_enabled is inturn used to
- * set the replay counters in the RSN IE. Without this
- * the 4way handshake will fail complaining that IE in beacon
- * doesn't match with the IE present in the 3/4 EAPOL msg.
- */
- .ht_cap = {
- IEEE80211_HT_CAP_SGI_20 |
- IEEE80211_HT_CAP_DSSSCCK40 | IEEE80211_HT_CAP_MAX_AMSDU,
- .ht_supported = TRUE,
- .ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K,
- .ampdu_density = IEEE80211_HT_MPDU_DENSITY_16
- }
-#endif
+ .n_bitrates = wl_g_rates_size
};
static struct ieee80211_supported_band __wl_band_5ghz_a = {
@@ -623,22 +612,7 @@ static struct ieee80211_supported_band __wl_band_5ghz_a = {
.channels = __wl_5ghz_a_channels,
.n_channels = ARRAY_SIZE(__wl_5ghz_a_channels),
.bitrates = wl_a_rates,
- .n_bitrates = wl_a_rates_size,
-#if (ENABLE_P2P_INTERFACE)
- /* wpa_supplicant sets wmm_enabled based on whether ht_cap
- * is present or not. The wmm_enabled is inturn used to
- * set the replay counters in the RSN IE. Without this
- * the 4way handshake will fail complaining that IE in beacon
- * doesn't match with the IE present in the 3/4 EAPOL msg.
- */
- .ht_cap = {
- IEEE80211_HT_CAP_SGI_20 |
- IEEE80211_HT_CAP_DSSSCCK40 | IEEE80211_HT_CAP_MAX_AMSDU,
- .ht_supported = TRUE,
- .ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K,
- .ampdu_density = IEEE80211_HT_MPDU_DENSITY_16
- }
-#endif
+ .n_bitrates = wl_a_rates_size
};
static const u32 __wl_cipher_suites[] = {
@@ -659,8 +633,6 @@ static const u32 __wl_cipher_suites[] = {
/* IOCtl version read from targeted driver */
static int ioctl_version;
-#ifdef D11AC_IOTYPES
-
/* Return a new chanspec given a legacy chanspec
* Returns INVCHANSPEC on error
*/
@@ -766,6 +738,29 @@ wl_chspec_host_to_driver(chanspec_t chanspec)
return chanspec;
}
+/* given a channel value, do the endian and chanspec version conversion to
+ * a chanspec_t value
+ * Returns INVCHANSPEC on error
+ */
+chanspec_t
+wl_ch_host_to_driver(u16 channel)
+{
+
+ chanspec_t chanspec;
+
+ chanspec = channel & WL_CHANSPEC_CHAN_MASK;
+
+ if (channel <= CH_MAX_2G_CHANNEL)
+ chanspec |= WL_CHANSPEC_BAND_2G;
+ else
+ chanspec |= WL_CHANSPEC_BAND_5G;
+
+ chanspec |= WL_CHANSPEC_BW_20;
+ chanspec |= WL_CHANSPEC_CTL_SB_NONE;
+
+ return wl_chspec_host_to_driver(chanspec);
+}
+
/* given a chanspec value from the driver, do the endian and chanspec version conversion to
* a chanspec_t value
* Returns INVCHANSPEC on error
@@ -781,22 +776,6 @@ wl_chspec_driver_to_host(chanspec_t chanspec)
return chanspec;
}
-#else /* not D11AC_IOTYPES */
-#ifndef ROAM_CHANNEL_CACHE
-static chanspec_t
-wl_chspec_host_to_driver(chanspec_t chanspec)
-{
- return htodchanspec(chanspec);
-}
-#endif
-static chanspec_t
-wl_chspec_driver_to_host(chanspec_t chanspec)
-{
- return dtohchanspec(chanspec);
-}
-
-#endif /* D11AC_IOTYPES */
-
/* There isn't a lot of sense in it, but you can transmit anything you like */
static const struct ieee80211_txrx_stypes
wl_cfg80211_default_mgmt_stypes[NUM_NL80211_IFTYPES] = {
@@ -869,22 +848,31 @@ static void swap_key_to_BE(struct wl_wsec_key *key)
key->iv_initialized = dtoh32(key->iv_initialized);
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0)
/* For debug: Dump the contents of the encoded wps ie buffe */
static void
-wl_validate_wps_ie(char *wps_ie, bool *pbc)
+wl_validate_wps_ie(char *wps_ie, s32 wps_ie_len, bool *pbc)
{
#define WPS_IE_FIXED_LEN 6
- u16 len = (u16) wps_ie[TLV_LEN_OFF];
- u8 *subel = wps_ie+ WPS_IE_FIXED_LEN;
+ u16 len;
+ u8 *subel = NULL;
u16 subelt_id;
u16 subelt_len;
u16 val;
u8 *valptr = (uint8*) &val;
+ if (wps_ie == NULL || wps_ie_len < WPS_IE_FIXED_LEN) {
+ WL_ERR(("invalid argument : NULL\n"));
+ return;
+ }
+ len = (u16)wps_ie[TLV_LEN_OFF];
+ if (len > wps_ie_len) {
+ WL_ERR(("invalid length len %d, wps ie len %d\n", len, wps_ie_len));
+ return;
+ }
WL_DBG(("wps_ie len=%d\n", len));
-
len -= 4; /* for the WPS IE's OUI, oui_type fields */
-
+ subel = wps_ie + WPS_IE_FIXED_LEN;
while (len >= 4) { /* must have attr id, attr len fields */
valptr[0] = *subel++;
valptr[1] = *subel++;
@@ -944,13 +932,10 @@ wl_validate_wps_ie(char *wps_ie, bool *pbc)
subel += subelt_len;
}
}
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0) */
static chanspec_t wl_cfg80211_get_shared_freq(struct wiphy *wiphy)
{
- if (vsdb_supported) {
- return wf_chspec_aton(WL_P2P_TEMP_CHAN);
- }
- else {
chanspec_t chspec;
int err = 0;
struct wl_priv *wl = wiphy_priv(wiphy);
@@ -964,7 +949,7 @@ static chanspec_t wl_cfg80211_get_shared_freq(struct wiphy *wiphy)
* via set_channel (cfg80211 API).
*/
WL_DBG(("Not associated. Return a temp channel. \n"));
- return wf_chspec_aton(WL_P2P_TEMP_CHAN);
+ return wl_ch_host_to_driver(WL_P2P_TEMP_CHAN);
}
@@ -972,25 +957,28 @@ static chanspec_t wl_cfg80211_get_shared_freq(struct wiphy *wiphy)
if ((err = wldev_ioctl(dev, WLC_GET_BSS_INFO, wl->extra_buf,
WL_EXTRA_BUF_MAX, false))) {
WL_ERR(("Failed to get associated bss info, use temp channel \n"));
- chspec = wf_chspec_aton(WL_P2P_TEMP_CHAN);
+ chspec = wl_ch_host_to_driver(WL_P2P_TEMP_CHAN);
}
else {
bss = (struct wl_bss_info *) (wl->extra_buf + 4);
chspec = bss->chanspec;
- WL_DBG(("Valid BSS Found. chanspec:%d \n", bss->chanspec));
+ WL_DBG(("Valid BSS Found. chanspec:%d \n", bss->chanspec));
}
-
return chspec;
- }
}
static struct net_device* wl_cfg80211_add_monitor_if(char *name)
{
+#if defined(WLP2P) && defined(WL_ENABLE_P2P_IF)
+ WL_INFO(("wl_cfg80211_add_monitor_if: No more support monitor interface\n"));
+ return ERR_PTR(-EOPNOTSUPP);
+#else
struct net_device* ndev = NULL;
dhd_add_monitor(name, &ndev);
WL_INFO(("wl_cfg80211_add_monitor_if net device returned: 0x%p\n", ndev));
return ndev;
+#endif /* defined(WLP2P) && defined(WL_ENABLE_P2P_IF) */
}
static struct net_device *
@@ -1003,6 +991,9 @@ wl_cfg80211_add_virtual_iface(struct wiphy *wiphy, char *name,
s32 wlif_type = -1;
s32 mode = 0;
s32 val = 0;
+#if defined(WL_ENABLE_P2P_IF)
+ s32 dhd_mode = 0;
+#endif /* (WL_ENABLE_P2P_IF) */
chanspec_t chspec;
struct wl_priv *wl = wiphy_priv(wiphy);
struct net_device *_ndev;
@@ -1013,13 +1004,16 @@ wl_cfg80211_add_virtual_iface(struct wiphy *wiphy, char *name,
s32 up = 1;
dhd_pub_t *dhd;
#endif /* PROP_TXSTATUS */
+
if (!wl)
return ERR_PTR(-EINVAL);
+
#ifdef PROP_TXSTATUS
dhd = (dhd_pub_t *)(wl->pub);
#endif /* PROP_TXSTATUS */
- /* Use primary I/F for to send commands down */
+
+ /* Use primary I/F for sending cmds down to firmware */
_ndev = wl_to_prmry_ndev(wl);
WL_DBG(("if name: %s, type: %d\n", name, type));
@@ -1053,8 +1047,6 @@ wl_cfg80211_add_virtual_iface(struct wiphy *wiphy, char *name,
WL_ERR(("name is NULL\n"));
return NULL;
}
- if (wl->iface_cnt == IFACE_MAX_CNT)
- return ERR_PTR(-ENOMEM);
if (wl->p2p_supported && (wlif_type != -1)) {
if (wl_get_p2p_status(wl, IF_DELETING)) {
/* wait till IF_DEL is complete
@@ -1082,14 +1074,21 @@ wl_cfg80211_add_virtual_iface(struct wiphy *wiphy, char *name,
WL_ERR(("timeount < 0, return -EAGAIN\n"));
return ERR_PTR(-EAGAIN);
}
+ /* It should be now be safe to put this check here since we are sure
+ * by now netdev_notifier (unregister) would have been called
+ */
+ if (wl->iface_cnt == IFACE_MAX_CNT)
+ return ERR_PTR(-ENOMEM);
}
+
#ifdef PROP_TXSTATUS
if (!dhd)
return ERR_PTR(-ENODEV);
-#endif
+#endif /* PROP_TXSTATUS */
if (!wl->p2p || !wl->p2p->vir_ifname)
return ERR_PTR(-ENODEV);
- if (!wl->p2p->on && strstr(name, WL_P2P_INTERFACE_PREFIX)) {
+
+ if (wl->p2p && !wl->p2p->on && strstr(name, WL_P2P_INTERFACE_PREFIX)) {
p2p_on(wl) = true;
wl_cfgp2p_set_firm_p2p(wl);
wl_cfgp2p_init_discovery(wl);
@@ -1100,8 +1099,8 @@ wl_cfg80211_add_virtual_iface(struct wiphy *wiphy, char *name,
memset(wl->p2p->vir_ifname, 0, IFNAMSIZ);
strncpy(wl->p2p->vir_ifname, name, IFNAMSIZ - 1);
- WL_SCAN2((" Scan Abort %p(id %d)\n", _ndev, wl->escan_info.cur_sync_id));
- wl_cfg80211_scan_abort(wl, _ndev);
+
+ wl_notify_escan_complete(wl, _ndev, true, true);
#ifdef PROP_TXSTATUS
if (!wl->wlfc_on && !disable_proptx) {
dhd->wlfc_enabled = true;
@@ -1111,7 +1110,7 @@ wl_cfg80211_add_virtual_iface(struct wiphy *wiphy, char *name,
WL_ERR(("WLC_UP return err:%d\n", err));
wl->wlfc_on = true;
}
-#endif
+#endif /* PROP_TXSTATUS */
/* In concurrency case, STA may be already associated in a particular channel.
* so retrieve the current channel of primary interface and then start the virtual
@@ -1145,7 +1144,7 @@ wl_cfg80211_add_virtual_iface(struct wiphy *wiphy, char *name,
}
vwdev->wiphy = wl->wdev->wiphy;
WL_INFO((" virtual interface(%s) is created memalloc done \n",
- wl->p2p->vir_ifname));
+ wl->p2p->vir_ifname));
vwdev->iftype = type;
_ndev = wl_to_p2p_bss_ndev(wl, P2PAPI_BSSCFG_CONNECTION);
_ndev->ieee80211_ptr = vwdev;
@@ -1160,14 +1159,25 @@ wl_cfg80211_add_virtual_iface(struct wiphy *wiphy, char *name,
rollback_lock = true;
}
if (net_attach && !net_attach(wl->pub, _ndev->ifindex)) {
+#ifdef CUSTOMER_HW4
wl_alloc_netinfo(wl, _ndev, vwdev, mode, PM_BLOCK);
- WL_DBG((" virtual interface(%s) is "
- "created net attach done\n", wl->p2p->vir_ifname));
+#else
+ wl_alloc_netinfo(wl, _ndev, vwdev, mode, PM_ENABLE);
+#endif /* CUSTOMER_HW4 */
val = 1;
/* Disable firmware roaming for P2P interface */
wldev_iovar_setint(_ndev, "roam_off", val);
+ WL_ERR((" virtual interface(%s) is "
+ "created net attach done\n", wl->p2p->vir_ifname));
if (mode == WL_MODE_AP)
wl_set_drv_status(wl, CONNECTED, _ndev);
+#if defined(WL_ENABLE_P2P_IF)
+ if (type == NL80211_IFTYPE_P2P_CLIENT)
+ dhd_mode = P2P_GC_ENABLED;
+ else if (type == NL80211_IFTYPE_P2P_GO)
+ dhd_mode = P2P_GO_ENABLED;
+ DNGL_FUNC(dhd_cfg80211_set_p2p_info, (wl, dhd_mode));
+#endif /* (WL_ENABLE_P2P_IF) */
} else {
/* put back the rtnl_lock again */
if (rollback_lock)
@@ -1185,12 +1195,12 @@ wl_cfg80211_add_virtual_iface(struct wiphy *wiphy, char *name,
memset(wl->p2p->vir_ifname, '\0', IFNAMSIZ);
wl->p2p->vif_created = false;
#ifdef PROP_TXSTATUS
- if (dhd->wlfc_enabled && wl->wlfc_on) {
- dhd->wlfc_enabled = false;
- dhd_wlfc_deinit(dhd);
- wl->wlfc_on = false;
- }
-#endif
+ if (dhd->wlfc_enabled && wl->wlfc_on) {
+ dhd->wlfc_enabled = false;
+ dhd_wlfc_deinit(dhd);
+ wl->wlfc_on = false;
+ }
+#endif /* PROP_TXSTATUS */
}
}
fail:
@@ -1207,19 +1217,24 @@ wl_cfg80211_del_virtual_iface(struct wiphy *wiphy, struct net_device *dev)
s32 timeout = -1;
s32 ret = 0;
WL_DBG(("Enter\n"));
- WL_SCAN2(("Enter\n"));
+
if (wl->p2p_net == dev) {
- /* Since there is no ifidx corresponding to p2p0,
- * all commands should be routed through primary I/F
+ /* Since there is no ifidx corresponding to p2p0, cmds to
+ * firmware should be routed through primary I/F
*/
dev = wl_to_prmry_ndev(wl);
}
if (wl->p2p_supported) {
memcpy(p2p_mac.octet, wl->p2p->int_addr.octet, ETHER_ADDR_LEN);
+
+ /* Clear GO_NEG_PHASE bit to take care of GO-NEG-FAIL cases
+ */
+ WL_DBG(("P2P: GO_NEG_PHASE status cleared "));
+ wl_clr_p2p_status(wl, GO_NEG_PHASE);
if (wl->p2p->vif_created) {
if (wl_get_drv_status(wl, SCANNING, dev)) {
- wl_cfg80211_scan_abort(wl, dev);
+ wl_notify_escan_complete(wl, dev, true, true);
}
wldev_iovar_setint(dev, "mpc", 1);
@@ -1227,18 +1242,26 @@ wl_cfg80211_del_virtual_iface(struct wiphy *wiphy, struct net_device *dev)
if (wl_get_drv_status(wl, DISCONNECTING, dev) &&
(wl_get_mode_by_netdev(wl, dev) != WL_MODE_AP)) {
WL_ERR(("Wait for Link Down event for GC !\n"));
- wait_for_completion_timeout(&wl->iface_disable, msecs_to_jiffies(500));
+ wait_for_completion_timeout
+ (&wl->iface_disable, msecs_to_jiffies(500));
}
wl_set_p2p_status(wl, IF_DELETING);
+#if defined(WL_ENABLE_P2P_IF)
+ DNGL_FUNC(dhd_cfg80211_clean_p2p_info, (wl));
+#endif /* (WL_ENABLE_P2P_IF)) */
/* for GO */
if (wl_get_mode_by_netdev(wl, dev) == WL_MODE_AP) {
+ wl_add_remove_eventmsg(dev, WLC_E_PROBREQ_MSG, false);
/* disable interface before bsscfg free */
ret = wl_cfgp2p_ifdisable(wl, &p2p_mac);
- /* if fw doesn't support "ifdis", do not wait for link down of ap mode */
+ /* if fw doesn't support "ifdis",
+ do not wait for link down of ap mode
+ */
if (ret == 0) {
WL_ERR(("Wait for Link Down event for GO !!!\n"));
- wait_for_completion_timeout(&wl->iface_disable, msecs_to_jiffies(500));
+ wait_for_completion_timeout(&wl->iface_disable,
+ msecs_to_jiffies(500));
} else {
msleep(300);
}
@@ -1258,12 +1281,11 @@ wl_cfg80211_del_virtual_iface(struct wiphy *wiphy, struct net_device *dev)
"HANG Notification sent to %s\n", ret, ndev->name));
wl_cfg80211_hang(ndev, WLAN_REASON_UNSPECIFIED);
}
-
- /* Wait for any pending scan req to get aborted from the sysioc context */
+ /* Wait for IF_DEL operation to be finished in firmware */
timeout = wait_event_interruptible_timeout(wl->netif_change_event,
- (wl_get_p2p_status(wl, IF_DELETING) == false),
+ (wl->p2p->vif_created == false),
msecs_to_jiffies(MAX_WAIT_TIME));
- if (timeout > 0 && !wl_get_p2p_status(wl, IF_DELETING)) {
+ if (timeout > 0 && (wl->p2p->vif_created == false)) {
WL_DBG(("IFDEL operation done\n"));
} else {
WL_ERR(("IFDEL didn't complete properly\n"));
@@ -1271,7 +1293,6 @@ wl_cfg80211_del_virtual_iface(struct wiphy *wiphy, struct net_device *dev)
ret = dhd_del_monitor(dev);
}
}
- WL_SCAN2(("Exit\n"));
return ret;
}
@@ -1287,7 +1308,7 @@ wl_cfg80211_change_virtual_iface(struct wiphy *wiphy, struct net_device *ndev,
chanspec_t chspec;
struct wl_priv *wl = wiphy_priv(wiphy);
- WL_DBG(("Enter \n"));
+ WL_DBG(("Enter type %d\n", type));
switch (type) {
case NL80211_IFTYPE_MONITOR:
case NL80211_IFTYPE_WDS:
@@ -1320,17 +1341,17 @@ wl_cfg80211_change_virtual_iface(struct wiphy *wiphy, struct net_device *ndev,
WL_DBG(("p2p_vif_created (%d) p2p_on (%d)\n", wl->p2p->vif_created,
p2p_on(wl)));
wldev_iovar_setint(ndev, "mpc", 0);
+ wl_notify_escan_complete(wl, ndev, true, true);
+
/* In concurrency case, STA may be already associated in a particular
* channel. so retrieve the current channel of primary interface and
* then start the virtual interface on that.
*/
- WL_SCAN2(("Scan Abort %p(id %d)\n", ndev, wl->escan_info.cur_sync_id));
- wl_cfg80211_scan_abort(wl, ndev);
chspec = wl_cfg80211_get_shared_freq(wiphy);
wlif_type = WL_P2P_IF_GO;
- WL_ERR(("%s : ap (%d), infra (%d), iftype: (%d), chspec: (0x%04x)\n",
- ndev->name, ap, infra, type, chspec));
+ WL_ERR(("%s : ap (%d), infra (%d), iftype: (%d)\n",
+ ndev->name, ap, infra, type));
wl_set_p2p_status(wl, IF_CHANGING);
wl_clr_p2p_status(wl, IF_CHANGED);
wl_cfgp2p_ifchange(wl, &wl->p2p->int_addr, htod32(wlif_type), chspec);
@@ -1354,6 +1375,8 @@ wl_cfg80211_change_virtual_iface(struct wiphy *wiphy, struct net_device *ndev,
WL_ERR(("Cannot change the interface for GO or SOFTAP\n"));
return -EINVAL;
}
+ } else {
+ WL_DBG(("Change_virtual_iface for transition from GO/AP to client/STA"));
}
ndev->ieee80211_ptr->iftype = type;
@@ -1366,6 +1389,7 @@ wl_cfg80211_notify_ifadd(struct net_device *ndev, s32 idx, s32 bssidx,
{
struct wl_priv *wl = wlcfg_drv_priv;
s32 ret = BCME_OK;
+ WL_DBG(("Enter"));
if (!ndev) {
WL_ERR(("net is NULL\n"));
return 0;
@@ -1389,7 +1413,18 @@ wl_cfg80211_notify_ifadd(struct net_device *ndev, s32 idx, s32 bssidx,
}
s32
-wl_cfg80211_notify_ifdel(struct net_device *ndev)
+wl_cfg80211_notify_ifdel(void)
+{
+ struct wl_priv *wl = wlcfg_drv_priv;
+
+ WL_DBG(("Enter \n"));
+ wl_clr_p2p_status(wl, IF_DELETING);
+ wake_up_interruptible(&wl->netif_change_event);
+ return 0;
+}
+
+s32
+wl_cfg80211_ifdel_ops(struct net_device *ndev)
{
struct wl_priv *wl = wlcfg_drv_priv;
bool rollback_lock = false;
@@ -1397,7 +1432,6 @@ wl_cfg80211_notify_ifdel(struct net_device *ndev)
#ifdef PROP_TXSTATUS
dhd_pub_t *dhd = (dhd_pub_t *)(wl->pub);
#endif /* PROP_TXSTATUS */
-
if (!ndev || (strlen(ndev->name) == 0)) {
WL_ERR(("net is NULL\n"));
return 0;
@@ -1414,16 +1448,13 @@ wl_cfg80211_notify_ifdel(struct net_device *ndev)
rollback_lock = true;
}
WL_DBG(("ESCAN COMPLETED\n"));
- WL_SCAN2(("Send Notify Complete %p(id %d)\n",
- ndev, wl->escan_info.cur_sync_id));
- wl_notify_escan_complete(wl, ndev, true);
+ wl_notify_escan_complete(wl, ndev, true, false);
if (rollback_lock)
rtnl_unlock();
}
WL_ERR(("IF_DEL event called from dongle, net %x, vif name: %s\n",
(unsigned int)ndev, wl->p2p->vir_ifname));
- wl->first_remain = true;
memset(wl->p2p->vir_ifname, '\0', IFNAMSIZ);
index = wl_cfgp2p_find_idx(wl, ndev);
wl_to_p2p_bss_ndev(wl, index) = NULL;
@@ -1431,15 +1462,16 @@ wl_cfg80211_notify_ifdel(struct net_device *ndev)
wl->p2p->vif_created = false;
wl_cfgp2p_clear_management_ie(wl,
index);
- wl_clr_p2p_status(wl, IF_DELETING);
WL_DBG(("index : %d\n", index));
#ifdef PROP_TXSTATUS
if (dhd->wlfc_enabled && wl->wlfc_on) {
+ dhd_os_wlfc_block(dhd);
dhd->wlfc_enabled = false;
dhd_wlfc_deinit(dhd);
wl->wlfc_on = false;
+ dhd_os_wlfc_unblock(dhd);
}
-#endif
+#endif /* PROP_TXSTATUS */
wl_clr_drv_status(wl, CONNECTED, ndev);
}
/* Wake up any waiting thread */
@@ -1480,16 +1512,13 @@ wl_cfg80211_notify_ifchange(void)
return 0;
}
-
-/* Find my listen channel value in my GON Req frame,
- * Save my listen channel for channel sync
- */
-static s32 wl_find_my_listen_channel(struct wl_priv *wl,
+/* Find listen channel */
+static s32 wl_find_listen_channel(struct wl_priv *wl,
u8 *ie, u32 ie_len)
{
wifi_p2p_ie_t *p2p_ie;
u8 *end, *pos;
- s32 my_listen_channel;
+ s32 listen_channel;
p2p_ie = wl_cfgp2p_find_p2pie(ie, ie_len);
@@ -1517,18 +1546,20 @@ static s32 wl_find_my_listen_channel(struct wl_priv *wl,
return 0;
}
- /* if Listen Channel att id is 6, save my listen channel */
+ /* if Listen Channel att id is 6 and the vailue is valid,
+ * return the listen channel
+ */
if (pos[0] == 6) {
/* listen channel subel length format
* 1(id) + 2(len) + 3(country) + 1(op. class) + 1(chan num)
*/
- my_listen_channel = pos[1 + 2 + 3 + 1];
+ listen_channel = pos[1 + 2 + 3 + 1];
- if (my_listen_channel == SOCIAL_CHAN_1 ||
- my_listen_channel == SOCIAL_CHAN_2 ||
- my_listen_channel == SOCIAL_CHAN_3) {
- CFGP2P_DBG((" Found my Listen Channel %d \n", my_listen_channel));
- return my_listen_channel;
+ if (listen_channel == SOCIAL_CHAN_1 ||
+ listen_channel == SOCIAL_CHAN_2 ||
+ listen_channel == SOCIAL_CHAN_3) {
+ CFGP2P_DBG((" Found my Listen Channel %d \n", listen_channel));
+ return listen_channel;
}
}
pos += 3 + attr_len;
@@ -1536,23 +1567,22 @@ static s32 wl_find_my_listen_channel(struct wl_priv *wl,
return 0;
}
-static void wl_scan_prep(struct wl_scan_params *params,
- struct cfg80211_scan_request *request, int32 active_time)
+static void wl_scan_prep(struct wl_scan_params *params, struct cfg80211_scan_request *request)
{
u32 n_ssids;
u32 n_channels;
u16 channel;
chanspec_t chanspec;
- s32 i = 0;
- s32 offset;
+ s32 i = 0, offset;
char *ptr;
wlc_ssid_t ssid;
struct wl_priv *wl = wlcfg_drv_priv;
+
memcpy(&params->bssid, &ether_bcast, ETHER_ADDR_LEN);
params->bss_type = DOT11_BSSTYPE_ANY;
params->scan_type = 0;
params->nprobes = -1;
- params->active_time = active_time;
+ params->active_time = -1;
params->passive_time = -1;
params->home_time = -1;
params->channel_num = 0;
@@ -1569,6 +1599,7 @@ static void wl_scan_prep(struct wl_scan_params *params,
params->active_time = htod32(params->active_time);
params->passive_time = htod32(params->passive_time);
params->home_time = htod32(params->home_time);
+
/* if request is null just exit so it will be all channel broadcast scan */
if (!request)
return;
@@ -1584,7 +1615,8 @@ static void wl_scan_prep(struct wl_scan_params *params,
channel = ieee80211_frequency_to_channel(request->channels[i]->center_freq);
/* SKIP DFS channels for Secondary interface */
if ((wl->escan_info.ndev != wl_to_prmry_ndev(wl)) &&
- (request->channels[i]->flags & (IEEE80211_CHAN_RADAR | IEEE80211_CHAN_PASSIVE_SCAN)))
+ (request->channels[i]->flags &
+ (IEEE80211_CHAN_RADAR | IEEE80211_CHAN_PASSIVE_SCAN)))
continue;
if (request->channels[i]->band == IEEE80211_BAND_2GHZ)
@@ -1600,7 +1632,7 @@ static void wl_scan_prep(struct wl_scan_params *params,
params->channel_list[i] |= chanspec;
WL_SCAN(("Chan : %d, Channel spec: %x \n",
channel, params->channel_list[i]));
- params->channel_list[i] = htod16(params->channel_list[i]);
+ params->channel_list[i] = wl_chspec_host_to_driver(params->channel_list[i]);
}
} else {
WL_SCAN(("Scanning all channels\n"));
@@ -1647,29 +1679,27 @@ wl_run_iscan(struct wl_iscan_ctrl *iscan, struct cfg80211_scan_request *request,
struct wl_iscan_params *params = NULL;
s32 err = 0;
- if (!request) {
+ if (request == NULL) {
err = -EINVAL;
goto done;
- }else {
- n_channels = request->n_channels;
- n_ssids = request->n_ssids;
- /* Allocate space for populating ssids in wl_iscan_params struct */
- if (n_channels % 2)
- /* If n_channels is odd, add a padd of u16 */
- params_size += sizeof(u16) * (n_channels + 1);
- else
- params_size += sizeof(u16) * n_channels;
-
- /* Allocate space for populating ssids in wl_iscan_params struct */
- params_size += sizeof(struct wlc_ssid) * n_ssids;
}
+ n_channels = request->n_channels;
+ n_ssids = request->n_ssids;
+ /* Allocate space for populating ssids in wl_iscan_params struct */
+ if (n_channels % 2)
+ /* If n_channels is odd, add a padd of u16 */
+ params_size += sizeof(u16) * (n_channels + 1);
+ else
+ params_size += sizeof(u16) * n_channels;
+
+ /* Allocate space for populating ssids in wl_iscan_params struct */
+ params_size += sizeof(struct wlc_ssid) * n_ssids;
params = (struct wl_iscan_params *)kzalloc(params_size, GFP_KERNEL);
if (!params) {
err = -ENOMEM;
goto done;
}
-
- wl_scan_prep(&params->params, request, -1);
+ wl_scan_prep(&params->params, request);
params->version = htod32(ISCAN_REQ_VERSION);
params->action = htod16(action);
@@ -1689,6 +1719,7 @@ wl_run_iscan(struct wl_iscan_ctrl *iscan, struct cfg80211_scan_request *request,
WL_ERR(("error (%d)\n", err));
}
}
+
done:
if (params)
kfree(params);
@@ -1713,7 +1744,7 @@ static s32 wl_do_iscan(struct wl_priv *wl, struct cfg80211_scan_request *request
}
wl->iscan_kickstart = true;
wl_run_iscan(iscan, request, WL_SCAN_ACTION_START);
- mod_timer(&iscan->timer, jiffies + iscan->timer_ms * HZ / 1000);
+ mod_timer(&iscan->timer, jiffies + msecs_to_jiffies(iscan->timer_ms));
iscan->timer_on = 1;
return err;
@@ -1737,10 +1768,10 @@ wl_get_valid_channels(struct net_device *ndev, u8 *valid_chan_list, s32 size)
return err;
}
-#ifdef USE_INITIAL_2G_SCAN_ORG
+#ifdef USE_INITIAL_2G_SCAN
#define FIRST_SCAN_ACTIVE_DWELL_TIME_MS 40
static bool g_first_broadcast_scan = TRUE;
-#endif /* USE_INITIAL_2G_SCAN_ORG */
+#endif /* USE_INITIAL_2G_SCAN */
static s32
wl_run_escan(struct wl_priv *wl, struct net_device *ndev,
@@ -1751,7 +1782,6 @@ wl_run_escan(struct wl_priv *wl, struct net_device *ndev,
u32 n_ssids;
s32 params_size = (WL_SCAN_PARAMS_FIXED_SIZE + OFFSETOF(wl_escan_params_t, params));
wl_escan_params_t *params = NULL;
-
u8 chan_buf[sizeof(u32)*(WL_NUMCHANNELS + 1)];
u32 num_chans = 0;
s32 channel;
@@ -1761,76 +1791,82 @@ wl_run_escan(struct wl_priv *wl, struct net_device *ndev,
u16 *default_chan_list = NULL;
wl_uint32_list_t *list;
struct net_device *dev = NULL;
+#ifdef USE_INITIAL_2G_SCAN
+ bool is_first_init_2g_scan = false;
+#endif /* USE_INITIAL_2G_SCAN */
WL_DBG(("Enter \n"));
if (!request || !wl) {
err = -EINVAL;
goto exit;
}
- if (!wl->p2p_supported)
- WL_SCAN2(("P2P is not supported\n"));
- else
- WL_SCAN2(("P2P is supported, ndev is %s, "
- "p2p_scan ? %s, p2p_is_on ? %s\n",
- (ndev == wl_to_prmry_ndev(wl)) ? "Primary" : "P2P",
- p2p_scan(wl) ? "YES" : "NO",
- p2p_is_on(wl) ? "YES" : "NO"));
-
if (!wl->p2p_supported || !p2p_scan(wl)) {
- s32 active_time = -1;
-
/* LEGACY SCAN TRIGGER */
WL_SCAN((" LEGACY E-SCAN START\n"));
-#ifdef USE_INITIAL_2G_SCAN_ORG
- if (ndev == wl_to_prmry_ndev(wl) && g_first_broadcast_scan == true) {
- j = 0;
- if (!wl_get_valid_channels(ndev, chan_buf, sizeof(chan_buf))) {
- list = (wl_uint32_list_t *) chan_buf;
- n_valid_chan = dtoh32(list->count);
- for (i = 0; i < n_valid_chan; i++) {
+#ifdef USE_INITIAL_2G_SCAN
+ if (ndev == wl_to_prmry_ndev(wl) && g_first_broadcast_scan == true) {
+ j = 0;
+ if (!wl_get_valid_channels(ndev, chan_buf, sizeof(chan_buf))) {
+ list = (wl_uint32_list_t *) chan_buf;
+ n_valid_chan = dtoh32(list->count);
+ for (i = 0; i < n_valid_chan && request->n_channels > j;
+ i++) {
+#if defined(BCM4334_CHIP)
+ request->channels[i]->flags |=
+ IEEE80211_CHAN_NO_HT40;
+#endif
- WL_SCAN(("list->element[%d]=%d\n",
- i, list->element[i]));
- if (list->element[i] > CH_MAX_2G_CHANNEL)
- break;
- j++;
- }
- request->n_channels = j;
+ WL_SCAN(("list->element[%d]=%d\n",
+ i, list->element[i]));
+ if (list->element[i] > CH_MAX_2G_CHANNEL)
+ break;
+ j++;
+ }
+ request->n_channels = j;
- active_time = FIRST_SCAN_ACTIVE_DWELL_TIME_MS;
- WL_SCAN(("request->n_channels=%d\n", request->n_channels));
- g_first_broadcast_scan = false;
+ WL_SCAN(("request->n_channels=%d\n", request->n_channels));
+ g_first_broadcast_scan = false;
+ is_first_init_2g_scan = true;
+ }
}
- }
-#endif /* USE_INITIAL_2G_SCAN_ORG */
- n_channels = request->n_channels;
- n_ssids = request->n_ssids;
- /* Allocate space for populating ssids in wl_iscan_params struct */
- if (n_channels % 2)
- /* If n_channels is odd, add a padd of u16 */
- params_size += sizeof(u16) * (n_channels + 1);
- else
- params_size += sizeof(u16) * n_channels;
+#endif /* USE_INITIAL_2G_SCAN */
- /* Allocate space for populating ssids in wl_iscan_params struct */
- params_size += sizeof(struct wlc_ssid) * n_ssids;
+ n_channels = request->n_channels;
+ n_ssids = request->n_ssids;
+ /* Allocate space for populating ssids in wl_iscan_params struct */
+ if (n_channels % 2)
+ /* If n_channels is odd, add a padd of u16 */
+ params_size += sizeof(u16) * (n_channels + 1);
+ else
+ params_size += sizeof(u16) * n_channels;
+ /* Allocate space for populating ssids in wl_iscan_params struct */
+ params_size += sizeof(struct wlc_ssid) * n_ssids;
params = (wl_escan_params_t *) kzalloc(params_size, GFP_KERNEL);
if (params == NULL) {
err = -ENOMEM;
goto exit;
}
+ wl_scan_prep(&params->params, request);
+
+#ifdef USE_INITIAL_2G_SCAN
+ /* Override active_time to reduce scan time if it's first bradcast scan. */
+ if (is_first_init_2g_scan)
+ params->params.active_time = FIRST_SCAN_ACTIVE_DWELL_TIME_MS;
+#endif /* USE_INITIAL_2G_SCAN */
- wl_scan_prep(&params->params, request, active_time);
params->version = htod32(ESCAN_REQ_VERSION);
params->action = htod16(action);
+#if defined(DUAL_ESCAN_RESULT_BUFFER)
params->sync_id = wl->escan_info.cur_sync_id;
+#else
+ params->sync_id = htod16(0x1234);
+#endif
if (params_size + sizeof("escan") >= WLC_IOCTL_MEDLEN) {
WL_ERR(("ioctl buffer length not sufficient\n"));
kfree(params);
- params = NULL;
err = -ENOMEM;
goto exit;
}
@@ -1839,16 +1875,12 @@ wl_run_escan(struct wl_priv *wl, struct net_device *ndev,
if (unlikely(err))
WL_ERR((" Escan set error (%d)\n", err));
kfree(params);
- params = NULL;
}
else if (p2p_is_on(wl) && p2p_scan(wl)) {
/* P2P SCAN TRIGGER */
s32 _freq = 0;
n_nodfs = 0;
-
- WL_DBG((" P2P E-SCAN START\n"));
-
- if (request->n_channels) {
+ if (request && request->n_channels) {
num_chans = request->n_channels;
WL_SCAN((" chann number : %d\n", num_chans));
default_chan_list = kzalloc(num_chans * sizeof(*default_chan_list),
@@ -1867,7 +1899,8 @@ wl_run_escan(struct wl_priv *wl, struct net_device *ndev,
channel = ieee80211_frequency_to_channel(_freq);
/* remove DFS channels */
if (!(request->channels[i]->flags &
- (IEEE80211_CHAN_RADAR | IEEE80211_CHAN_PASSIVE_SCAN))) {
+ (IEEE80211_CHAN_RADAR
+ | IEEE80211_CHAN_PASSIVE_SCAN))) {
for (j = 0; j < n_valid_chan; j++) {
/* allows only supported channel on
* current reguatory
@@ -1921,11 +1954,16 @@ wl_do_escan(struct wl_priv *wl, struct wiphy *wiphy, struct net_device *ndev,
s32 passive_scan;
wl_scan_results_t *results;
WL_SCAN(("Enter \n"));
- WL_SCAN2(("scan result set to sync id :%d\n", wl->escan_info.cur_sync_id%2));
+ mutex_lock(&wl->usr_sync);
+#if defined(DUAL_ESCAN_RESULT_BUFFER)
results = (wl_scan_results_t *) wl->escan_info.escan_buf[wl->escan_info.cur_sync_id%2];
+#else
+ results = (wl_scan_results_t *) wl->escan_info.escan_buf;
+#endif
results->version = 0;
results->count = 0;
results->buflen = WL_SCAN_RESULTS_FIXED_SIZE;
+
wl->escan_info.ndev = ndev;
wl->escan_info.wiphy = wiphy;
wl->escan_info.escan_state = WL_ESCAN_STATE_SCANING;
@@ -1934,10 +1972,12 @@ wl_do_escan(struct wl_priv *wl, struct wiphy *wiphy, struct net_device *ndev,
&passive_scan, sizeof(passive_scan), false);
if (unlikely(err)) {
WL_ERR(("error (%d)\n", err));
- return err;
+ goto exit;
}
err = wl_run_escan(wl, ndev, request, WL_SCAN_ACTION_START);
+exit:
+ mutex_unlock(&wl->usr_sync);
return err;
}
@@ -1950,18 +1990,18 @@ __wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
struct cfg80211_ssid *ssids;
struct wl_scan_req *sr = wl_to_sr(wl);
struct ether_addr primary_mac;
- wpa_ie_fixed_t *wps_ie;
- wifi_p2p_ie_t *p2p_ie;
s32 passive_scan;
bool iscan_req;
bool escan_req = false;
bool p2p_ssid;
+#ifdef WL11U
+ bcm_tlv_t *interworking_ie;
+ u32 ie_len;
+#endif
s32 err = 0;
s32 bssidx = -1;
s32 i;
- u32 wpsie_len = 0;
- u32 p2pie_len = 0;
- u8 wpsie[IE_MAX_LEN];
+
unsigned long flags;
static s32 busy_count = 0;
@@ -1972,26 +2012,21 @@ __wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
ndev = wl_to_prmry_ndev(wl);
}
- if (wl_get_drv_status_all(wl, SENDING_ACT_FRM)
-#ifdef WL_CFG80211_SYNC_GON_TIME
- || wl_get_drv_status_all(wl, WAITING_MORE_TIME_NEXT_ACT_FRM)
-#endif /* WL_CFG80211_SYNC_GON_TIME */
- ) {
+ if (WL_DRV_STATUS_SENDING_AF_FRM_EXT(wl)) {
WL_ERR(("Sending Action Frames. Try it again.\n"));
return -EAGAIN;
}
WL_DBG(("Enter wiphy (%p)\n", wiphy));
if (wl_get_drv_status_all(wl, SCANNING)) {
- if(wl->scan_request == NULL) {
+ if (wl->scan_request == NULL) {
wl_clr_drv_status_all(wl, SCANNING);
- WL_DBG(( "<<<<<<<<<<<Force Clear Scanning Status>>>>>>>>>>>\n"));
+ WL_DBG(("<<<<<<<<<<<Force Clear Scanning Status>>>>>>>>>>>\n"));
} else {
WL_ERR(("Scanning already\n"));
return -EAGAIN;
}
}
-
if (wl_get_drv_status(wl, SCAN_ABORTING, ndev)) {
WL_ERR(("Scanning being aborted\n"));
return -EAGAIN;
@@ -2000,18 +2035,15 @@ __wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
WL_ERR(("request null or n_ssids > WL_SCAN_PARAMS_SSID_MAX\n"));
return -EOPNOTSUPP;
}
-
- WL_DBG(("scan start\n"));
-
#ifdef WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST
if (wl_get_drv_status_all(wl, REMAINING_ON_CHANNEL)) {
- WL_SCAN2(("request scan abort: %p(%d)\n", ndev, wl->escan_info.cur_sync_id));
- wl_cfg80211_scan_abort(wl, ndev);
+ WL_DBG(("Remain_on_channel bit is set, somehow it didn't get cleared\n"));
+ wl_notify_escan_complete(wl, ndev, true, true);
}
#endif /* WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST */
/* Arm scan timeout timer */
- mod_timer(&wl->scan_timeout, jiffies + WL_SCAN_TIMER_INTERVAL_MS * HZ / 1000);
+ mod_timer(&wl->scan_timeout, jiffies + msecs_to_jiffies(WL_SCAN_TIMER_INTERVAL_MS));
iscan_req = false;
if (request) { /* scan bss */
ssids = request->ssids;
@@ -2021,7 +2053,8 @@ __wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
escan_req = true;
p2p_ssid = false;
for (i = 0; i < request->n_ssids; i++) {
- if (ssids[i].ssid_len && IS_P2P_SSID(ssids[i].ssid, ssids[i].ssid_len)) {
+ if (ssids[i].ssid_len &&
+ IS_P2P_SSID(ssids[i].ssid, ssids[i].ssid_len)) {
p2p_ssid = true;
break;
}
@@ -2037,6 +2070,8 @@ __wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
wl_cfgp2p_generate_bss_mac(&primary_mac,
&wl->p2p->dev_addr, &wl->p2p->int_addr);
}
+ wl_clr_p2p_status(wl, GO_NEG_PHASE);
+ WL_DBG(("P2P: GO_NEG_PHASE status cleared \n"));
p2p_scan(wl) = true;
}
} else {
@@ -2061,27 +2096,36 @@ __wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
}
}
if (!wl->p2p_supported || !p2p_scan(wl)) {
- /* find the WPSIE */
- memset(wpsie, 0, sizeof(wpsie));
- if ((wps_ie = wl_cfgp2p_find_wpsie(
- (u8 *)request->ie,
- request->ie_len)) != NULL) {
- wpsie_len =
- wps_ie->length + WPA_RSN_IE_TAG_FIXED_LEN;
- memcpy(wpsie, wps_ie, wpsie_len);
- } else {
- wpsie_len = 0;
- }
- if ((p2p_ie = wl_cfgp2p_find_p2pie(
- (u8 *)request->ie,
- request->ie_len)) != NULL && (ndev != wl_to_prmry_ndev(wl))) {
- p2pie_len = p2p_ie->len + sizeof(p2p_ie->len) + sizeof(p2p_ie->id);
- memcpy(wpsie + wpsie_len, p2p_ie, p2pie_len);
- wpsie_len += p2pie_len;
- bssidx = wl_cfgp2p_find_idx(wl, ndev);
+ bssidx = wl_cfgp2p_find_idx(wl, ndev);
+
+#ifdef WL11U
+ if ((interworking_ie = wl_cfg80211_find_interworking_ie(
+ (u8 *)request->ie, request->ie_len)) != NULL) {
+ ie_len = interworking_ie->len;
+
+ err = wl_cfg80211_add_iw_ie(wl, ndev, bssidx,
+ VNDR_IE_CUSTOM_FLAG, interworking_ie->id,
+ interworking_ie->data, interworking_ie->len);
+
+ if (unlikely(err)) {
+ goto scan_out;
+ }
+ } else if (wl->iw_ie_len != 0) {
+ /* we have to clear IW IE and disable gratuitous APR */
+ wl_cfg80211_add_iw_ie(wl, ndev, bssidx,
+ VNDR_IE_CUSTOM_FLAG,
+ DOT11_MNG_INTERWORKING_ID,
+ 0, 0);
+
+ wldev_iovar_setint_bsscfg(ndev, "grat_arp", 0,
+ bssidx);
+ /* we don't care about error */
}
+#endif /* WL11U */
err = wl_cfgp2p_set_management_ie(wl, ndev, bssidx,
- VNDR_IE_PRBREQ_FLAG, wpsie, wpsie_len);
+ VNDR_IE_PRBREQ_FLAG, (u8 *)request->ie,
+ request->ie_len);
+
if (unlikely(err)) {
goto scan_out;
}
@@ -2107,9 +2151,10 @@ __wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
/* find my listen channel */
wl->afx_hdl->my_listen_chan =
- wl_find_my_listen_channel(wl, (u8 *)request->ie, request->ie_len);
+ wl_find_listen_channel(wl, (u8 *)request->ie,
+ request->ie_len);
err = wl_cfgp2p_enable_discovery(wl, ndev,
- request->ie, request->ie_len);
+ request->ie, request->ie_len);
if (unlikely(err)) {
goto scan_out;
@@ -2165,7 +2210,7 @@ scan_success:
scan_out:
if (err == BCME_BUSY || err == BCME_NOTREADY) {
- WL_ERR(("---> Error occurred err = (%d), busy?%d", err, -EBUSY));
+ WL_ERR(("Scan err = (%d), busy?%d", err, -EBUSY));
err = -EBUSY;
}
@@ -2189,8 +2234,8 @@ scan_out:
bzero(&bssid, sizeof(bssid));
if ((ret = wldev_ioctl(ndev, WLC_GET_BSSID,
&bssid, ETHER_ADDR_LEN, false)) == 0)
- WL_ERR(("FW is connected with " MACSTR "/n",
- MAC2STR(bssid.octet)));
+ WL_ERR(("FW is connected with " MACDBG "/n",
+ STR_TO_MACD(bssid.octet)));
else
WL_ERR(("GET BSSID failed with %d\n", ret));
@@ -2199,12 +2244,12 @@ scan_out:
} else {
busy_count = 0;
}
-
wl_clr_drv_status(wl, SCANNING, ndev);
+ if (timer_pending(&wl->scan_timeout))
+ del_timer_sync(&wl->scan_timeout);
spin_lock_irqsave(&wl->cfgdrv_lock, flags);
wl->scan_request = NULL;
spin_unlock_irqrestore(&wl->cfgdrv_lock, flags);
- WL_SCAN2(("remove scan request:%p %d \n", ndev, wl->escan_info.cur_sync_id));
return err;
}
@@ -2216,7 +2261,6 @@ wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
struct wl_priv *wl = wiphy_priv(wiphy);
WL_DBG(("Enter \n"));
- WL_SCAN2(("start %p\n", ndev));
CHECK_SYS_UP(wl);
err = __wl_cfg80211_scan(wiphy, ndev, request, NULL);
@@ -2273,6 +2317,7 @@ static s32 wl_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
s32 err = 0;
CHECK_SYS_UP(wl);
+ WL_DBG(("Enter\n"));
if (changed & WIPHY_PARAM_RTS_THRESHOLD &&
(wl->conf->rts_threshold != wiphy->rts_threshold)) {
wl->conf->rts_threshold = wiphy->rts_threshold;
@@ -2345,7 +2390,7 @@ wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
}
/* wait 4 secons till scan done.... */
- schedule_timeout_interruptible(4 * HZ);
+ schedule_timeout_interruptible(msecs_to_jiffies(4000));
if (rollback_lock)
rtnl_lock();
bss = cfg80211_get_ibss(wiphy, NULL,
@@ -2406,15 +2451,15 @@ wl_set_wpa_version(struct net_device *dev, struct cfg80211_connect_params *sme)
if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_1)
val = WPA_AUTH_PSK |
#ifdef BCMCCX
- WPA_AUTH_CCKM |
+ WPA_AUTH_CCKM |
#endif
- WPA_AUTH_UNSPECIFIED;
+ WPA_AUTH_UNSPECIFIED;
else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2)
val = WPA2_AUTH_PSK|
#ifdef BCMCCX
- WPA2_AUTH_CCKM |
+ WPA2_AUTH_CCKM |
#endif
- WPA2_AUTH_UNSPECIFIED;
+ WPA2_AUTH_UNSPECIFIED;
else
val = WPA_AUTH_DISABLED;
@@ -2481,7 +2526,11 @@ wl_set_auth_type(struct net_device *dev, struct cfg80211_connect_params *sme)
WL_DBG(("shared key\n"));
break;
case NL80211_AUTHTYPE_AUTOMATIC:
+#ifdef USE_WEP_AUTH_SHARED_OPEN
+ val = WL_AUTH_SHARED_OPEN;
+#else
val = WL_AUTH_OPEN_SHARED;
+#endif /* USE_WEP_AUTH_SHARED_OPEN */
WL_DBG(("automatic\n"));
break;
#ifdef BCMCCX
@@ -2577,9 +2626,10 @@ wl_set_set_cipher(struct net_device *dev, struct cfg80211_connect_params *sme)
WL_DBG(("pval (%d) gval (%d)\n", pval, gval));
if (is_wps_conn(sme)) {
- if(sme->privacy)
+ if (sme->privacy)
err = wldev_iovar_setint_bsscfg(dev, "wsec", 4, bssidx);
else
+ /* WPS-2.0 allows no security */
err = wldev_iovar_setint_bsscfg(dev, "wsec", 0, bssidx);
} else {
#ifdef BCMWAPI_WPI
@@ -2646,9 +2696,9 @@ wl_set_key_mgmt(struct net_device *dev, struct cfg80211_connect_params *sme)
}
} else if (val & (WPA2_AUTH_PSK |
#ifdef BCMCCX
- WPA2_AUTH_CCKM |
+ WPA2_AUTH_CCKM |
#endif
- WPA2_AUTH_UNSPECIFIED)) {
+ WPA2_AUTH_UNSPECIFIED)) {
switch (sme->crypto.akm_suites[0]) {
case WLAN_AKM_SUITE_8021X:
val = WPA2_AUTH_UNSPECIFIED;
@@ -2763,9 +2813,9 @@ wl_set_set_sharedkey(struct net_device *dev,
WL_ERR(("WLC_SET_KEY error (%d)\n", err));
return err;
}
- if (sec->auth_type == NL80211_AUTHTYPE_OPEN_SYSTEM) {
+ if (sec->auth_type == NL80211_AUTHTYPE_SHARED_KEY) {
WL_DBG(("set auth_type to shared key\n"));
- val = 1; /* shared key */
+ val = WL_AUTH_SHARED_KEY; /* shared key */
err = wldev_iovar_setint_bsscfg(dev, "auth", val, bssidx);
if (unlikely(err)) {
WL_ERR(("set auth failed (%d)\n", err));
@@ -2777,14 +2827,15 @@ wl_set_set_sharedkey(struct net_device *dev,
return err;
}
-#ifdef ROAM_CHANNEL_CACHE
-#define MAX_ROAM_CACHE_NUM 100
-#endif
#ifdef ESCAN_RESULT_PATCH
static u8 connect_req_bssid[6];
static u8 broad_bssid[6];
#endif
+#ifdef ROAM_CHANNEL_CACHE
+#define MAX_ROAM_CACHE_NUM 100
+#endif
+
static s32
wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
struct cfg80211_connect_params *sme)
@@ -2794,16 +2845,15 @@ wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
wl_extjoin_params_t *ext_join_params;
struct wl_join_params join_params;
size_t join_params_size;
+#ifdef ROAM_AP_ENV_DETECTION
dhd_pub_t *dhd = (dhd_pub_t *)(wl->pub);
+#endif /* ROAM_AP_ENV_DETECTION */
s32 err = 0;
wpa_ie_fixed_t *wpa_ie;
- wpa_ie_fixed_t *wps_ie;
bcm_tlv_t *wpa2_ie;
u8* wpaie = 0;
u32 wpaie_len = 0;
- u32 wpsie_len = 0;
u32 chan_cnt = 0;
- u8 wpsie[IE_MAX_LEN];
struct ether_addr bssid;
#ifdef ROAM_CHANNEL_CACHE
chanspec_t chanspec_list[MAX_ROAM_CACHE_NUM];
@@ -2822,46 +2872,40 @@ wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
/*
* Cancel ongoing scan to sync up with sme state machine of cfg80211.
*/
-#if (defined (BCM4334_CHIP) || !defined(ESCAN_RESULT_PATCH))
+#if (defined(BCM4334_CHIP) || !defined(ESCAN_RESULT_PATCH))
if (wl->scan_request) {
- WL_SCAN2(("Abort Scan %p(%d)\n", dev, wl->escan_info.cur_sync_id));
- wl_cfg80211_scan_abort(wl, dev);
+ wl_notify_escan_complete(wl, dev, true, true);
}
#endif
-
#ifdef WL_CFG80211_GON_COLLISION
/* init block gon req count */
wl->block_gon_req_tx_count = 0;
wl->block_gon_req_rx_count = 0;
#endif /* WL_CFG80211_GON_COLLISION */
-
- if (sme->bssid) {
- WL_SCAN2(("Connect Request: \"%s\" \n",
- sme->ssid));
#ifdef ESCAN_RESULT_PATCH
+ if (sme->bssid) {
memcpy(connect_req_bssid, sme->bssid, ETHER_ADDR_LEN);
- }else {
+ }
+ else {
bzero(connect_req_bssid, ETHER_ADDR_LEN);
}
bzero(broad_bssid, ETHER_ADDR_LEN);
-#else
- }
#endif
bzero(&bssid, sizeof(bssid));
if (!wl_get_drv_status(wl, CONNECTED, dev)&&
(ret = wldev_ioctl(dev, WLC_GET_BSSID, &bssid, ETHER_ADDR_LEN, false)) == 0) {
- if(!ETHER_ISNULLADDR(&bssid)) {
+ if (!ETHER_ISNULLADDR(&bssid)) {
scb_val_t scbval;
wl_set_drv_status(wl, DISCONNECTING, dev);
scbval.val = DOT11_RC_DISASSOC_LEAVING;
memcpy(&scbval.ea, &bssid, ETHER_ADDR_LEN);
scbval.val = htod32(scbval.val);
- WL_DBG(("drv status CONNECTED is not set, but connected in FW!" MACSTR "/n"
- , MAC2STR(bssid.octet)));
+ WL_DBG(("drv status CONNECTED is not set, but connected in FW!" MACDBG "/n",
+ STR_TO_MACD(bssid.octet)));
err = wldev_ioctl(dev, WLC_DISASSOC, &scbval,
- sizeof(scb_val_t), true);
+ sizeof(scb_val_t), true);
if (unlikely(err)) {
wl_clr_drv_status(wl, DISCONNECTING, dev);
WL_ERR(("error (%d)\n", err));
@@ -2880,79 +2924,49 @@ wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
if (!wl_get_drv_status(wl, DISCONNECTING, dev))
wl_update_prof(wl, dev, NULL, (void *)&bssid, WL_PROF_BSSID);
- if (!memcmp(sme->ssid, WL_P2P_WILDCARD_SSID, WL_P2P_WILDCARD_SSID_LEN) &&
- (dev != wl_to_prmry_ndev(wl))) {
+ if (p2p_is_on(wl) && (dev != wl_to_prmry_ndev(wl))) {
/* we only allow to connect using virtual interface in case of P2P */
- if (p2p_is_on(wl) && is_wps_conn(sme)) {
- WL_DBG(("ASSOC1 p2p index : %d sme->ie_len %d\n",
- wl_cfgp2p_find_idx(wl, dev), sme->ie_len));
- /* Have to apply WPS IE + P2P IE in assoc req frame */
- wl_cfgp2p_set_management_ie(wl, dev,
- wl_cfgp2p_find_idx(wl, dev), VNDR_IE_PRBREQ_FLAG,
- wl_to_p2p_bss_saved_ie(wl, P2PAPI_BSSCFG_DEVICE).p2p_probe_req_ie,
- wl_to_p2p_bss_saved_ie(wl,
- P2PAPI_BSSCFG_DEVICE).p2p_probe_req_ie_len);
- wl_cfgp2p_set_management_ie(wl, dev, wl_cfgp2p_find_idx(wl, dev),
- VNDR_IE_ASSOCREQ_FLAG, sme->ie, sme->ie_len);
- } else if (p2p_is_on(wl) && (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2)) {
- /* This is the connect req after WPS is done [credentials exchanged]
- * currently identified with WPA_VERSION_2 .
- * Update the previously set IEs with
- * the newly received IEs from Supplicant. This will remove the WPS IE from
- * the Assoc Req.
- */
- WL_DBG(("ASSOC2 p2p index : %d sme->ie_len %d\n",
- wl_cfgp2p_find_idx(wl, dev), sme->ie_len));
wl_cfgp2p_set_management_ie(wl, dev, wl_cfgp2p_find_idx(wl, dev),
VNDR_IE_ASSOCREQ_FLAG, sme->ie, sme->ie_len);
- }
-
} else if (dev == wl_to_prmry_ndev(wl)) {
- /* find the RSN_IE */
- if ((wpa2_ie = bcm_parse_tlvs((u8 *)sme->ie, sme->ie_len,
- DOT11_MNG_RSN_ID)) != NULL) {
- WL_DBG((" WPA2 IE is found\n"));
- }
- /* find the WPA_IE */
- if ((wpa_ie = wl_cfgp2p_find_wpaie((u8 *)sme->ie,
- sme->ie_len)) != NULL) {
- WL_DBG((" WPA IE is found\n"));
- }
- if (wpa_ie != NULL || wpa2_ie != NULL) {
- wpaie = (wpa_ie != NULL) ? (u8 *)wpa_ie : (u8 *)wpa2_ie;
- wpaie_len = (wpa_ie != NULL) ? wpa_ie->length : wpa2_ie->len;
- wpaie_len += WPA_RSN_IE_TAG_FIXED_LEN;
- wldev_iovar_setbuf(dev, "wpaie", wpaie, wpaie_len,
- wl->ioctl_buf, WLC_IOCTL_MAXLEN, &wl->ioctl_buf_sync);
- } else {
- wldev_iovar_setbuf(dev, "wpaie", NULL, 0,
- wl->ioctl_buf, WLC_IOCTL_MAXLEN, &wl->ioctl_buf_sync);
- }
+ /* find the RSN_IE */
+ if ((wpa2_ie = bcm_parse_tlvs((u8 *)sme->ie, sme->ie_len,
+ DOT11_MNG_RSN_ID)) != NULL) {
+ WL_DBG((" WPA2 IE is found\n"));
+ }
+ /* find the WPA_IE */
+ if ((wpa_ie = wl_cfgp2p_find_wpaie((u8 *)sme->ie,
+ sme->ie_len)) != NULL) {
+ WL_DBG((" WPA IE is found\n"));
+ }
+ if (wpa_ie != NULL || wpa2_ie != NULL) {
+ wpaie = (wpa_ie != NULL) ? (u8 *)wpa_ie : (u8 *)wpa2_ie;
+ wpaie_len = (wpa_ie != NULL) ? wpa_ie->length : wpa2_ie->len;
+ wpaie_len += WPA_RSN_IE_TAG_FIXED_LEN;
+ wldev_iovar_setbuf(dev, "wpaie", wpaie, wpaie_len,
+ wl->ioctl_buf, WLC_IOCTL_MAXLEN, &wl->ioctl_buf_sync);
+ } else {
+ wldev_iovar_setbuf(dev, "wpaie", NULL, 0,
+ wl->ioctl_buf, WLC_IOCTL_MAXLEN, &wl->ioctl_buf_sync);
+ }
- /* find the WPSIE */
- memset(wpsie, 0, sizeof(wpsie));
- if ((wps_ie = wl_cfgp2p_find_wpsie((u8 *)sme->ie,
- sme->ie_len)) != NULL) {
- wpsie_len = wps_ie->length +WPA_RSN_IE_TAG_FIXED_LEN;
- memcpy(wpsie, wps_ie, wpsie_len);
- } else {
- wpsie_len = 0;
- }
- err = wl_cfgp2p_set_management_ie(wl, dev, -1,
- VNDR_IE_ASSOCREQ_FLAG, wpsie, wpsie_len);
- if (unlikely(err)) {
- return err;
- }
+ err = wl_cfgp2p_set_management_ie(wl, dev, wl_cfgp2p_find_idx(wl, dev),
+ VNDR_IE_ASSOCREQ_FLAG, (u8 *)sme->ie, sme->ie_len);
+ if (unlikely(err)) {
+ return err;
+ }
}
+#ifdef ROAM_AP_ENV_DETECTION
if (dhd->roam_env_detection && (wldev_iovar_setint(dev, "roam_env_detection",
- AP_ENV_DETECT_NOT_USED) == BCME_OK)) {
+ AP_ENV_DETECT_NOT_USED) == BCME_OK)) {
s32 roam_trigger[2] = {WL_AUTO_ROAM_TRIGGER, WLC_BAND_ALL};
err = wldev_ioctl(dev, WLC_SET_ROAM_TRIGGER, roam_trigger,
- sizeof(roam_trigger), true);
+ sizeof(roam_trigger), true);
if (unlikely(err)) {
WL_ERR((" failed to restore roam_trigger for auto env detection\n"));
}
}
+#endif /* ROAM_AP_ENV_DETECTION */
if (chan) {
#ifdef ROAM_CHANNEL_CACHE
wlc_ssid_t ssid;
@@ -2966,11 +2980,11 @@ wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
wl->channel = ieee80211_frequency_to_channel(chan->center_freq);
memcpy(ssid.SSID, sme->ssid, sme->ssid_len);
ssid.SSID_len = sme->ssid_len;
- chan_cnt = get_roam_channel_list(wl->channel, chanspec_list, &ssid);
+ chan_cnt = get_roam_channel_list(wl->channel, chanspec_list, &ssid, ioctl_version);
#else
wl->channel = ieee80211_frequency_to_channel(chan->center_freq);
chan_cnt = 1;
-#endif
+#endif /* ROAM_CHANNEL_CACHE */
WL_DBG(("channel (%d), center_req (%d), %d channels\n", wl->channel,
chan->center_freq, chan_cnt));
} else
@@ -3043,11 +3057,12 @@ wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
/* increate dwell time to receive probe response or detect Beacon
* from target AP at a noisy air only during connect command
*/
- ext_join_params->scan.active_time = WL_SCAN_ACTIVE_TIME*8;
- ext_join_params->scan.passive_time = WL_SCAN_PASSIVE_TIME*3;
+ ext_join_params->scan.active_time = DHD_SCAN_ACTIVE_TIME*8;
+ ext_join_params->scan.passive_time = DHD_SCAN_PASSIVE_TIME*3;
/* Set up join scan parameters */
ext_join_params->scan.scan_type = -1;
- ext_join_params->scan.nprobes = (ext_join_params->scan.active_time/(WL_SCAN_ACTIVE_TIME *2));
+ ext_join_params->scan.nprobes
+ = (ext_join_params->scan.active_time/WL_SCAN_JOIN_PROBE_INTERVAL_MS);
ext_join_params->scan.home_time = -1;
if (sme->bssid)
@@ -3136,18 +3151,14 @@ wl_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev,
CHECK_SYS_UP(wl);
act = *(bool *) wl_read_prof(wl, dev, WL_PROF_ACT);
curbssid = wl_read_prof(wl, dev, WL_PROF_BSSID);
- WL_DBG(("request(%d) %02x:%02x:%02x:%02x:%02x:%02x\n",
- act, curbssid[0], curbssid[1], curbssid[2],
- curbssid[3],curbssid[4],curbssid[5]));
if (act) {
/*
* Cancel ongoing scan to sync up with sme state machine of cfg80211.
*/
-#if (defined (BCM4334_CHIP) || !defined (ESCAN_RESULT_PATCH))
+#if (defined(BCM4334_CHIP) || !defined(ESCAN_RESULT_PATCH))
/* Let scan aborted by F/W */
if (wl->scan_request) {
- WL_SCAN2(("Abort scan : %p(%d)\n", dev, wl->escan_info.cur_sync_id));
- wl_cfg80211_scan_abort(wl, dev);
+ wl_notify_escan_complete(wl, dev, true, true);
}
#endif /* ESCAN_RESULT_PATCH */
wl_set_drv_status(wl, DISCONNECTING, dev);
@@ -3288,7 +3299,7 @@ wl_add_keyext(struct wiphy *wiphy, struct net_device *dev,
if (key.len == 0) {
/* key delete */
swap_key_from_BE(&key);
- wldev_iovar_setbuf_bsscfg(dev, "wsec_key", &key, sizeof(key),
+ err = wldev_iovar_setbuf_bsscfg(dev, "wsec_key", &key, sizeof(key),
wl->ioctl_buf, WLC_IOCTL_MAXLEN, bssidx, &wl->ioctl_buf_sync);
if (unlikely(err)) {
WL_ERR(("key delete error (%d)\n", err));
@@ -3353,9 +3364,8 @@ wl_add_keyext(struct wiphy *wiphy, struct net_device *dev,
return -EINVAL;
}
swap_key_from_BE(&key);
-#if defined(CONFIG_WIRELESS_EXT)
+ /* need to guarantee EAPOL 4/4 send out before set key */
dhd_wait_pend8021x(dev);
-#endif
err = wldev_iovar_setbuf_bsscfg(dev, "wsec_key", &key, sizeof(key),
wl->ioctl_buf, WLC_IOCTL_MAXLEN, bssidx, &wl->ioctl_buf_sync);
if (unlikely(err)) {
@@ -3480,12 +3490,10 @@ wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev,
s32 bssidx = wl_cfgp2p_find_idx(wl, dev);
WL_DBG(("Enter\n"));
-
- #ifndef IEEE80211W
- if ((key_idx >= DOT11_MAX_DEFAULT_KEYS) && (key_idx < DOT11_MAX_DEFAULT_KEYS+2))
- return -EINVAL;
- #endif
-
+#ifndef IEEE80211W
+ if ((key_idx >= DOT11_MAX_DEFAULT_KEYS) && (key_idx < DOT11_MAX_DEFAULT_KEYS+2))
+ return -EINVAL;
+#endif
CHECK_SYS_UP(wl);
memset(&key, 0, sizeof(key));
@@ -3596,7 +3604,6 @@ wl_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev,
#endif
dhd_pub_t *dhd = (dhd_pub_t *)(wl->pub);
CHECK_SYS_UP(wl);
- WL_DBG((" Enter\n"));
if (wl_get_mode_by_netdev(wl, dev) == WL_MODE_AP) {
err = wldev_iovar_getbuf(dev, "sta_info", (struct ether_addr *)mac,
ETHER_ADDR_LEN, wl->ioctl_buf, WLC_IOCTL_SMLEN, &wl->ioctl_buf_sync);
@@ -3622,22 +3629,19 @@ wl_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev,
sta->idle * 1000));
#endif
} else if (wl_get_mode_by_netdev(wl, dev) == WL_MODE_BSS) {
+ get_pktcnt_t pktcnt;
u8 *curmacp = wl_read_prof(wl, dev, WL_PROF_BSSID);
if (!wl_get_drv_status(wl, CONNECTED, dev) ||
- (dhd_is_associated(dhd, NULL, &err) == FALSE)) {
+ (dhd_is_associated(dhd, NULL, &err) == FALSE)) {
WL_ERR(("NOT assoc\n"));
- if(err == -ERESTARTSYS)
+ if (err == -ERESTARTSYS)
return err;
-#ifdef ESCAN_RESULT_PATCH
- return -ENODEV;
-#else
err = -ENODEV;
- goto get_station_err;
-#endif /* ESCAN_RESULT_PATCH */
+ return err;
}
if (memcmp(mac, curmacp, ETHER_ADDR_LEN)) {
- WL_ERR(("Wrong Mac address: "MACSTR" != "MACSTR"\n",
- MAC2STR(mac), MAC2STR(curmacp)));
+ WL_ERR(("Wrong Mac address: "MACDBG" != "MACDBG"\n",
+ STR_TO_MACD(mac), STR_TO_MACD(curmacp)));
}
/* Report the current tx rate */
@@ -3663,7 +3667,18 @@ wl_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev,
sinfo->filled |= STATION_INFO_SIGNAL;
sinfo->signal = rssi;
WL_DBG(("RSSI %d dBm\n", rssi));
-
+ err = wldev_ioctl(dev, WLC_GET_PKTCNTS, &pktcnt,
+ sizeof(pktcnt), false);
+ if (!err) {
+ sinfo->filled |= (STATION_INFO_RX_PACKETS |
+ STATION_INFO_RX_DROP_MISC |
+ STATION_INFO_TX_PACKETS |
+ STATION_INFO_TX_FAILED);
+ sinfo->rx_packets = pktcnt.rx_good_pkt;
+ sinfo->rx_dropped_misc = pktcnt.rx_bad_pkt;
+ sinfo->tx_packets = pktcnt.tx_good_pkt;
+ sinfo->tx_failed = pktcnt.tx_bad_pkt;
+ }
get_station_err:
if (err && (err != -ERESTARTSYS)) {
/* Disconnect due to zero BSSID or error to get RSSI */
@@ -3777,15 +3792,12 @@ static s32 wl_cfg80211_suspend(struct wiphy *wiphy)
if (wl->scan_request) {
cfg80211_scan_done(wl->scan_request, true);
wl->scan_request = NULL;
- spin_unlock_irqrestore(&wl->cfgdrv_lock, flags);
- WL_SCAN2(("remove scan_request %p, %d\n", ndev, wl->escan_info.cur_sync_id));
- } else {
- spin_unlock_irqrestore(&wl->cfgdrv_lock, flags);
}
for_each_ndev(wl, iter, next) {
wl_clr_drv_status(wl, SCANNING, iter->ndev);
wl_clr_drv_status(wl, SCAN_ABORTING, iter->ndev);
}
+ spin_unlock_irqrestore(&wl->cfgdrv_lock, flags);
for_each_ndev(wl, iter, next) {
if (wl_get_drv_status(wl, CONNECTING, iter->ndev)) {
wl_bss_connect_done(wl, iter->ndev, NULL, NULL, false);
@@ -3808,8 +3820,8 @@ wl_update_pmklist(struct net_device *dev, struct wl_pmk_list *pmk_list,
return -EINVAL;
}
/* pmk list is supported only for STA interface i.e. primary interface
- * Refer code wlc_bsscfg.c->wlc_bsscfg_sta_init
- */
+ * Refer code wlc_bsscfg.c->wlc_bsscfg_sta_init
+ */
if (primary_dev != dev) {
WL_INFO(("Not supporting Flushing pmklist on virtual"
" interfaces than primary interface\n"));
@@ -3879,7 +3891,7 @@ wl_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev,
CHECK_SYS_UP(wl);
memcpy(&pmkid.pmkid[0].BSSID, pmksa->bssid, ETHER_ADDR_LEN);
- memcpy(&pmkid.pmkid[0].PMKID, pmksa->pmkid, WPA2_PMKID_LEN);
+ memcpy(pmkid.pmkid[0].PMKID, pmksa->pmkid, WPA2_PMKID_LEN);
WL_DBG(("del_pmksa,IW_PMKSA_REMOVE - PMKID: %pM =\n",
&pmkid.pmkid[0].BSSID));
@@ -3955,57 +3967,18 @@ wl_cfg80211_scan_alloc_params(int channel, int nprobes, int *out_params_size)
params->active_time = htod32(-1);
params->passive_time = htod32(-1);
params->home_time = htod32(10);
- params->channel_list[0] = htodchanspec(channel);
+ if (channel == -1)
+ params->channel_list[0] = htodchanspec(channel);
+ else
+ params->channel_list[0] = wl_ch_host_to_driver(channel);
/* Our scan params have 1 channel and 0 ssids */
params->channel_num = htod32((0 << WL_SCAN_PARAMS_NSSID_SHIFT) |
- (num_chans & WL_SCAN_PARAMS_COUNT_MASK));
+ (num_chans & WL_SCAN_PARAMS_COUNT_MASK));
*out_params_size = params_size; /* rtn size to the caller */
return params;
}
-s32
-wl_cfg80211_scan_abort(struct wl_priv *wl, struct net_device *ndev)
-{
- wl_scan_params_t *params = NULL;
- s32 params_size = 0;
- s32 err = BCME_OK;
- unsigned long flags;
-
- WL_DBG(("Enter\n"));
-
- /* Our scan params only need space for 1 channel and 0 ssids */
- params = wl_cfg80211_scan_alloc_params(-1, 0, &params_size);
- if (params == NULL) {
- WL_ERR(("scan params allocation failed \n"));
- err = -ENOMEM;
- } else {
- /* Do a scan abort to stop the driver's scan engine */
- err = wldev_ioctl(ndev, WLC_SCAN, params, params_size, true);
- if (err < 0) {
- WL_ERR(("scan abort failed \n"));
- }
- }
- del_timer_sync(&wl->scan_timeout);
-#if defined(BCM4334_CHIP)
- if (wl->scan_request) {
- u8 temp_id = wl->escan_info.cur_sync_id;
- wl->bss_list = (wl_scan_results_t *) wl->escan_info.escan_buf[(temp_id+1)%2];
- wl_inform_bss(wl);
- }
-#endif
- spin_lock_irqsave(&wl->cfgdrv_lock, flags);
- if (wl->scan_request) {
- cfg80211_scan_done(wl->scan_request, true);
- wl->scan_request = NULL;
- }
-
- spin_unlock_irqrestore(&wl->cfgdrv_lock, flags);
- wl_clr_drv_status(wl, SCANNING, ndev);
- if (params)
- kfree(params);
- return err;
-}
static s32
wl_cfg80211_remain_on_channel(struct wiphy *wiphy, struct net_device *dev,
@@ -4017,28 +3990,29 @@ wl_cfg80211_remain_on_channel(struct wiphy *wiphy, struct net_device *dev,
u32 id;
struct ether_addr primary_mac;
struct net_device *ndev = NULL;
+
s32 err = BCME_OK;
struct wl_priv *wl = wiphy_priv(wiphy);
- WL_SCAN2(("duration :%d\n", duration));
WL_DBG(("Enter, ifindex: %d, channel: %d, duration ms (%d) SCANNING ?? %s \n",
dev->ifindex, ieee80211_frequency_to_channel(channel->center_freq),
duration, (wl_get_drv_status(wl, SCANNING, ndev)) ? "YES":"NO"));
- if (wl->first_remain) {
- wl->first_remain = false;
- duration = 100;
- }
-
if (wl->p2p_net == dev) {
ndev = wl_to_prmry_ndev(wl);
} else {
ndev = dev;
}
+
+ if (!wl->p2p) {
+ WL_DBG(("wl->p2p is not initialized\n"));
+ err = BCME_ERROR;
+ goto exit;
+ }
+
#ifndef WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST
if (wl_get_drv_status(wl, SCANNING, ndev)) {
- WL_SCAN2(("Abort Scan : %p(%d)\n", ndev, wl->escan_info.cur_sync_id));
- wl_cfg80211_scan_abort(wl, ndev);
+ wl_notify_escan_complete(wl, ndev, true, true);
}
#endif /* not WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST */
@@ -4049,21 +4023,17 @@ wl_cfg80211_remain_on_channel(struct wiphy *wiphy, struct net_device *dev,
if (id == 0)
id = ++wl->last_roc_id;
*cookie = id;
- cfg80211_ready_on_channel(dev, *cookie, channel,
- channel_type, duration, GFP_KERNEL);
#ifdef WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST
if (wl_get_drv_status(wl, SCANNING, ndev)) {
struct timer_list *_timer;
- WL_DBG((": fake listen state !! \n"));
+ WL_DBG(("scan is running. go to fake listen state\n"));
wl_set_drv_status(wl, FAKE_REMAINING_ON_CHANNEL, ndev);
if (timer_pending(&wl->p2p->listen_timer)) {
- WL_ERR((": cancel current listen timer \n"));
- spin_lock_bh(&wl->p2p->timer_lock);
+ WL_DBG(("cancel current listen timer \n"));
del_timer_sync(&wl->p2p->listen_timer);
- spin_unlock_bh(&wl->p2p->timer_lock);
}
_timer = &wl->p2p->listen_timer;
@@ -4071,12 +4041,13 @@ wl_cfg80211_remain_on_channel(struct wiphy *wiphy, struct net_device *dev,
INIT_TIMER(_timer, wl_cfgp2p_listen_expired, duration, 0);
- return BCME_OK;
+ err = BCME_OK;
+ goto exit;
}
#endif /* WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST */
-#ifdef WL_CFG80211_SYNC_GON_TIME
- if (wl_get_drv_status_all(wl, WAITING_MORE_TIME_NEXT_ACT_FRM)) {
+#ifdef WL_CFG80211_SYNC_GON
+ if (wl_get_drv_status_all(wl, WAITING_NEXT_ACT_FRM_LISTEN)) {
/* do not enter listen mode again if we are in listen mode already for next af.
* remain on channel completion will be returned by waiting next af completion.
*/
@@ -4087,25 +4058,21 @@ wl_cfg80211_remain_on_channel(struct wiphy *wiphy, struct net_device *dev,
#endif /* WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST */
goto exit;
}
-#endif /* WL_CFG80211_SYNC_GON_TIME */
-
+#endif /* WL_CFG80211_SYNC_GON */
if (wl->p2p && !wl->p2p->on) {
- get_primary_mac(wl, &primary_mac);
- wl_cfgp2p_generate_bss_mac(&primary_mac, &wl->p2p->dev_addr, &wl->p2p->int_addr);
-
/* In case of p2p_listen command, supplicant send remain_on_channel
* without turning on P2P
*/
-
+ get_primary_mac(wl, &primary_mac);
+ wl_cfgp2p_generate_bss_mac(&primary_mac, &wl->p2p->dev_addr, &wl->p2p->int_addr);
p2p_on(wl) = true;
- err = wl_cfgp2p_enable_discovery(wl, ndev, NULL, 0);
+ }
+ if (p2p_is_on(wl)) {
+ err = wl_cfgp2p_enable_discovery(wl, ndev, NULL, 0);
if (unlikely(err)) {
goto exit;
}
- }
-
- if (p2p_is_on(wl)) {
#ifndef WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST
wl_set_drv_status(wl, REMAINING_ON_CHANNEL, ndev);
#endif /* not WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST */
@@ -4116,15 +4083,25 @@ wl_cfg80211_remain_on_channel(struct wiphy *wiphy, struct net_device *dev,
wl_set_drv_status(wl, REMAINING_ON_CHANNEL, ndev);
} else {
/* if failed, firmware may be internal scanning state.
- so other scan request shall not abort it */
+ * so other scan request shall not abort it
+ */
wl_set_drv_status(wl, FAKE_REMAINING_ON_CHANNEL, ndev);
- /* set err = ok to prevent cookie mismatch */
- err = BCME_OK;
}
#endif /* WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST */
+ /* WAR: set err = ok to prevent cookie mismatch in wpa_supplicant
+ * and expire timer will send a completion to the upper layer
+ */
+ err = BCME_OK;
}
exit:
+ if (err == BCME_OK) {
+ WL_INFO(("Success\n"));
+ cfg80211_ready_on_channel(dev, *cookie, channel,
+ channel_type, duration, GFP_KERNEL);
+ } else {
+ WL_ERR(("Fail to Set (err=%d cookie:%llu)\n", err, *cookie));
+ }
return err;
}
@@ -4136,49 +4113,10 @@ wl_cfg80211_cancel_remain_on_channel(struct wiphy *wiphy, struct net_device *dev
WL_DBG((" enter ) netdev_ifidx: %d \n", dev->ifindex));
return err;
}
-static s32
-wl_cfg80211_send_pending_tx_act_frm(struct wl_priv *wl)
-{
- wl_af_params_t *tx_act_frm;
- struct net_device *dev = wl->afx_hdl->dev;
-
- if (dev == NULL)
- return -1;
-
- if (!p2p_is_on(wl))
- return -1;
-
- if (dev == wl->p2p_net) {
- dev = wl_to_prmry_ndev(wl);
- }
- tx_act_frm = wl->afx_hdl->pending_tx_act_frm;
- WL_DBG(("Sending the action frame\n"));
- wl->afx_hdl->pending_tx_act_frm = NULL;
- if (tx_act_frm != NULL) {
- /* Suspend P2P discovery's search-listen to prevent it from
- * starting a scan or changing the channel.
- */
-#ifndef CUSTOMER_HW_SAMSUNG
-#error remove sending act frame to improve P2P connection ratio
- wl_clr_drv_status(wl, SENDING_ACT_FRM, wl->afx_hdl->dev);
-#endif
- wl_clr_drv_status(wl, SCANNING, wl->afx_hdl->dev);
-/* Do not abort scan for VSDB. Scan will be aborted in firmware if necessary */
-#ifndef WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST
- wl_cfg80211_scan_abort(wl, dev);
-#endif /* not WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST */
- wl_cfgp2p_discover_enable_search(wl, false);
- tx_act_frm->channel = wl->afx_hdl->peer_chan;
- wl->afx_hdl->ack_recv = (wl_cfgp2p_tx_action_frame(wl, dev,
- tx_act_frm, wl->afx_hdl->bssidx)) ? false : true;
- }
- return 0;
-}
static void
wl_cfg80211_afx_handler(struct work_struct *work)
{
-
struct afx_hdl *afx_instance;
struct wl_priv *wl = wlcfg_drv_priv;
s32 ret = BCME_OK;
@@ -4186,41 +4124,34 @@ wl_cfg80211_afx_handler(struct work_struct *work)
afx_instance = container_of(work, struct afx_hdl, work);
if (afx_instance != NULL && wl->afx_hdl->is_active) {
if (wl->afx_hdl->is_listen && wl->afx_hdl->my_listen_chan) {
- ret = wl_cfgp2p_discover_listen(wl, wl->afx_hdl->my_listen_chan, 200);
+ ret = wl_cfgp2p_discover_listen(wl, wl->afx_hdl->my_listen_chan,
+ (100 * (1 + (random32() % 3)))); /* 100ms ~ 300ms */
} else {
ret = wl_cfgp2p_act_frm_search(wl, wl->afx_hdl->dev,
wl->afx_hdl->bssidx, wl->afx_hdl->peer_listen_chan);
}
if (unlikely(ret != BCME_OK)) {
WL_ERR(("ERROR occurred! returned value is (%d)\n", ret));
- if (wl_get_drv_status_all(wl, SCANNING_PEER_CHANNEL))
+ if (wl_get_drv_status_all(wl, FINDING_COMMON_CHANNEL))
complete(&wl->act_frm_scan);
}
}
}
-static bool
-wl_cfg80211_send_at_common_channel(struct wl_priv *wl,
- struct net_device *dev,
- wl_af_params_t *af_params)
+static s32
+wl_cfg80211_af_searching_channel(struct wl_priv *wl, struct net_device *dev)
{
u32 max_retry = WL_CHANNEL_SYNC_RETRY;
- WL_DBG((" enter ) \n"));
- /* initialize afx_hdl */
- wl->afx_hdl->pending_tx_act_frm = af_params;
- wl->afx_hdl->bssidx = wl_cfgp2p_find_idx(wl, dev);
- wl->afx_hdl->dev = dev;
- wl->afx_hdl->retry = 0;
- wl->afx_hdl->peer_chan = WL_INVALID;
- wl->afx_hdl->ack_recv = false;
+ if (dev == NULL)
+ return -1;
- WL_AF_TX_REDUCE_RETRY_VSDB(wl, max_retry);
+ WL_DBG((" enter ) \n"));
- wl_set_drv_status(wl, SCANNING_PEER_CHANNEL, dev);
+ wl_set_drv_status(wl, FINDING_COMMON_CHANNEL, dev);
wl->afx_hdl->is_active = TRUE;
- /* Loop to wait until we have sent the pending tx action frame or the
+ /* Loop to wait until we find a peer's channel or the
* pending action frame tx is cancelled.
*/
while ((wl->afx_hdl->retry < max_retry) &&
@@ -4229,25 +4160,25 @@ wl_cfg80211_send_at_common_channel(struct wl_priv *wl,
wl_set_drv_status(wl, SCANNING, dev);
WL_DBG(("Scheduling the action frame for sending.. retry %d\n",
wl->afx_hdl->retry));
- /* Do find_peer_for_action */
+ /* search peer on peer's listen channel */
schedule_work(&wl->afx_hdl->work);
wait_for_completion_timeout(&wl->act_frm_scan,
- msecs_to_jiffies(MAX_WAIT_TIME));
+ msecs_to_jiffies(MAX_WAIT_TIME));
if ((wl->afx_hdl->peer_chan != WL_INVALID) ||
- !(wl_get_drv_status(wl, SCANNING_PEER_CHANNEL, dev)))
+ !(wl_get_drv_status(wl, FINDING_COMMON_CHANNEL, dev)))
break;
if (wl->afx_hdl->my_listen_chan) {
WL_DBG(("Scheduling Listen peer in my listen channel = %d\n",
wl->afx_hdl->my_listen_chan));
+ /* listen on my listen channel */
wl->afx_hdl->is_listen = TRUE;
- /* Do find_peer_for_action */
schedule_work(&wl->afx_hdl->work);
wait_for_completion_timeout(&wl->act_frm_scan,
- msecs_to_jiffies(MAX_WAIT_TIME));
+ msecs_to_jiffies(MAX_WAIT_TIME));
}
- if (!wl_get_drv_status(wl, SCANNING_PEER_CHANNEL, dev))
+ if (!wl_get_drv_status(wl, FINDING_COMMON_CHANNEL, dev))
break;
wl->afx_hdl->retry++;
@@ -4257,26 +4188,403 @@ wl_cfg80211_send_at_common_channel(struct wl_priv *wl,
wl->afx_hdl->is_active = FALSE;
wl_clr_drv_status(wl, SCANNING, dev);
- wl_clr_drv_status(wl, SCANNING_PEER_CHANNEL, dev);
+ wl_clr_drv_status(wl, FINDING_COMMON_CHANNEL, dev);
- if (wl->afx_hdl->peer_chan != WL_INVALID)
- wl_cfg80211_send_pending_tx_act_frm(wl);
- else {
- WL_ERR(("Couldn't find the peer after %d retries\n",
- wl->afx_hdl->retry));
+ return (wl->afx_hdl->peer_chan);
+}
+
+struct p2p_config_af_params {
+ s32 max_tx_retry; /* max tx retry count if tx no ack */
+ /* To make sure to send successfully action frame, we have to turn off mpc
+ * 0: off, 1: on, (-1): do nothing
+ */
+ s32 mpc_onoff;
+#ifdef WL_CFG80211_GON_COLLISION
+ /* drop tx go nego request if go nego collision occurs */
+ bool drop_tx_req;
+#endif
+#ifdef WL_CFG80211_SYNC_GON
+ bool extra_listen;
+#endif
+ bool search_channel; /* 1: search peer's channel to send af */
+};
+
+static s32
+wl_cfg80211_config_p2p_pub_af_tx(struct wiphy *wiphy,
+ wl_action_frame_t *action_frame, wl_af_params_t *af_params,
+ struct p2p_config_af_params *config_af_params)
+{
+ s32 err = BCME_OK;
+ struct wl_priv *wl = wiphy_priv(wiphy);
+ wifi_p2p_pub_act_frame_t *act_frm =
+ (wifi_p2p_pub_act_frame_t *) (action_frame->data);
+
+ /* initialize default value */
+#ifdef WL_CFG80211_GON_COLLISION
+ config_af_params->drop_tx_req = false;
+#endif
+#ifdef WL_CFG80211_SYNC_GON
+ config_af_params->extra_listen = true;
+#endif
+ config_af_params->search_channel = false;
+ config_af_params->max_tx_retry = WL_AF_TX_MAX_RETRY;
+ config_af_params->mpc_onoff = -1;
+
+ switch (act_frm->subtype) {
+ case P2P_PAF_GON_REQ: {
+ WL_DBG(("P2P: GO_NEG_PHASE status set \n"));
+ wl_set_p2p_status(wl, GO_NEG_PHASE);
+
+ config_af_params->mpc_onoff = 0;
+ config_af_params->search_channel = true;
+ wl->next_af_subtype = act_frm->subtype + 1;
+
+ /* increase dwell time to wait for RESP frame */
+ af_params->dwell_time = WL_MED_DWELL_TIME;
+
+#ifdef WL_CFG80211_GON_COLLISION
+ config_af_params->drop_tx_req = true;
+#endif /* WL_CFG80211_GON_COLLISION */
+ break;
}
- wl->afx_hdl->is_listen = FALSE;
- wl->afx_hdl->pending_tx_act_frm = NULL;
- wl->afx_hdl->dev = NULL;
- wl->afx_hdl->bssidx = WL_INVALID;
-#ifndef CUSTOMER_HW_SAMSUNG
-#error remove sending act frame to improve P2P connection ratio
- wl_clr_drv_status(wl, SENDING_ACT_FRM, dev);
+ case P2P_PAF_GON_RSP: {
+ wl->next_af_subtype = act_frm->subtype + 1;
+ /* increase dwell time to wait for CONF frame */
+ af_params->dwell_time = WL_MED_DWELL_TIME;
+ break;
+ }
+ case P2P_PAF_GON_CONF: {
+ /* If we reached till GO Neg confirmation reset the filter */
+ WL_DBG(("P2P: GO_NEG_PHASE status cleared \n"));
+ wl_clr_p2p_status(wl, GO_NEG_PHASE);
+
+ /* turn on mpc again if go nego is done */
+ config_af_params->mpc_onoff = 1;
+
+ /* minimize dwell time */
+ af_params->dwell_time = WL_MIN_DWELL_TIME;
+
+#ifdef WL_CFG80211_GON_COLLISION
+ /* if go nego formation done, clear it */
+ wl->block_gon_req_tx_count = 0;
+ wl->block_gon_req_rx_count = 0;
+#endif /* WL_CFG80211_GON_COLLISION */
+#ifdef WL_CFG80211_SYNC_GON
+ config_af_params->extra_listen = false;
+#endif /* WL_CFG80211_SYNC_GON */
+ break;
+ }
+ case P2P_PAF_INVITE_REQ: {
+ config_af_params->search_channel = true;
+ wl->next_af_subtype = act_frm->subtype + 1;
+
+ /* increase dwell time */
+ af_params->dwell_time = WL_MED_DWELL_TIME;
+ break;
+ }
+ case P2P_PAF_INVITE_RSP:
+ /* minimize dwell time */
+ af_params->dwell_time = WL_MIN_DWELL_TIME;
+#ifdef WL_CFG80211_SYNC_GON
+ config_af_params->extra_listen = false;
+#endif /* WL_CFG80211_SYNC_GON */
+ break;
+ case P2P_PAF_DEVDIS_REQ: {
+ config_af_params->search_channel = true;
+
+ wl->next_af_subtype = act_frm->subtype + 1;
+ /* maximize dwell time to wait for RESP frame */
+ af_params->dwell_time = WL_LONG_DWELL_TIME;
+ break;
+ }
+ case P2P_PAF_DEVDIS_RSP:
+ /* minimize dwell time */
+ af_params->dwell_time = WL_MIN_DWELL_TIME;
+#ifdef WL_CFG80211_SYNC_GON
+ config_af_params->extra_listen = false;
+#endif /* WL_CFG80211_SYNC_GON */
+ break;
+ case P2P_PAF_PROVDIS_REQ: {
+ if (IS_PROV_DISC_WITHOUT_GROUP_ID(&act_frm->elts[0],
+ action_frame->len)) {
+ config_af_params->search_channel = true;
+ }
+
+ config_af_params->mpc_onoff = 0;
+ wl->next_af_subtype = act_frm->subtype + 1;
+ /* increase dwell time to wait for RESP frame */
+ af_params->dwell_time = WL_MED_DWELL_TIME;
+ break;
+ }
+ case P2P_PAF_PROVDIS_RSP: {
+ wl->next_af_subtype = P2P_PAF_GON_REQ;
+ /* increase dwell time to MED level */
+ af_params->dwell_time = WL_MED_DWELL_TIME;
+#ifdef WL_CFG80211_SYNC_GON
+ config_af_params->extra_listen = false;
+#endif /* WL_CFG80211_SYNC_GON */
+ break;
+ }
+ default:
+ WL_DBG(("Unknown p2p pub act frame subtype: %d\n",
+ act_frm->subtype));
+ err = BCME_BADARG;
+ }
+ return err;
+}
+
+
+static bool
+wl_cfg80211_send_action_frame(struct wiphy *wiphy, struct net_device *dev,
+ struct net_device *ndev, wl_af_params_t *af_params,
+ wl_action_frame_t *action_frame, u16 action_frame_len, s32 bssidx)
+{
+ struct wl_priv *wl = wiphy_priv(wiphy);
+ bool ack = false;
+ u8 category, action;
+ s32 tx_retry;
+ struct p2p_config_af_params config_af_params;
+ dhd_pub_t *dhd;
+#ifdef VSDB
+ ulong off_chan_started_jiffies = 0;
#endif
- if (wl->afx_hdl->ack_recv)
- return true; /* ACK */
- else
- return false; /* NO ACK */
+
+#ifdef WL11U
+ if (!af_params || !action_frame || (!p2p_is_on(wl) && !wl->wl11u))
+#else
+ if (!af_params || !action_frame || !p2p_is_on(wl))
+ return false;
+#endif
+
+ wl_cfgp2p_print_actframe(true, action_frame->data, action_frame->len);
+
+ category = action_frame->data[DOT11_ACTION_CAT_OFF];
+ action = action_frame->data[DOT11_ACTION_ACT_OFF];
+
+ /* initialize variables */
+ tx_retry = 0;
+ wl->next_af_subtype = P2P_PAF_SUBTYPE_INVALID;
+ config_af_params.max_tx_retry = WL_AF_TX_MAX_RETRY;
+ config_af_params.mpc_onoff = -1;
+ config_af_params.search_channel = false;
+#ifdef WL_CFG80211_GON_COLLISION
+ config_af_params.drop_tx_req = false;
+#endif
+#ifdef WL_CFG80211_SYNC_GON
+ config_af_params.extra_listen = false;
+#endif
+
+ /* config parameters */
+ /* Public Action Frame Process - DOT11_ACTION_CAT_PUBLIC */
+ if (category == DOT11_ACTION_CAT_PUBLIC) {
+ if ((action == P2P_PUB_AF_ACTION) &&
+ (action_frame_len >= sizeof(wifi_p2p_pub_act_frame_t))) {
+ /* p2p public action frame process */
+ if (BCME_OK != wl_cfg80211_config_p2p_pub_af_tx(wiphy,
+ action_frame, af_params, &config_af_params)) {
+ WL_DBG(("Unknown subtype.\n"));
+ }
+
+#ifdef WL_CFG80211_GON_COLLISION
+ if (config_af_params.drop_tx_req) {
+ if (wl->block_gon_req_tx_count) {
+ /* drop gon req tx action frame */
+ WL_DBG(("Drop gon req tx action frame: count %d\n",
+ wl->block_gon_req_tx_count));
+ goto exit;
+ }
+ }
+#endif /* WL_CFG80211_GON_COLLISION */
+ } else if (action_frame_len >= sizeof(wifi_p2psd_gas_pub_act_frame_t)) {
+ /* service discovery process */
+ if (action == P2PSD_ACTION_ID_GAS_IREQ ||
+ action == P2PSD_ACTION_ID_GAS_IREQ) {
+ /* configure service discovery query frame */
+
+ config_af_params.search_channel = true;
+
+ /* save next af suptype to cancel remained dwell time */
+ wl->next_af_subtype = action + 1;
+
+ af_params->dwell_time = WL_MED_DWELL_TIME;
+ } else if (action == P2PSD_ACTION_ID_GAS_IRESP ||
+ action == P2PSD_ACTION_ID_GAS_IRESP) {
+ /* configure service discovery response frame */
+ af_params->dwell_time = WL_MIN_DWELL_TIME;
+ } else {
+ WL_DBG(("Unknown action type: %d\n", action));
+ }
+ } else {
+ WL_DBG(("Unknown Frame: category 0x%x, action 0x%x, length %d\n",
+ category, action, action_frame_len));
+ }
+ } else if (category == P2P_AF_CATEGORY) {
+ /* do not configure anything. it will be sent with a default configuration */
+ } else {
+ dhd = (dhd_pub_t *)(wl->pub);
+ if ((dhd->op_mode & HOSTAPD_MASK) == HOSTAPD_MASK) {
+ WL_ERR(("Unknown Frame: category 0x%x, action 0x%x\n",
+ category, action));
+ wl_clr_drv_status(wl, SENDING_ACT_FRM, dev);
+ return false;
+ } else {
+ WL_DBG(("Unknown Frame: category 0x%x, action 0x%x\n",
+ category, action));
+ }
+ }
+
+ /* To make sure to send successfully action frame, we have to turn off mpc */
+ if (config_af_params.mpc_onoff == 0) {
+ wldev_iovar_setint(dev, "mpc", 0);
+ }
+
+ /* validate channel and p2p ies */
+ if (config_af_params.search_channel && IS_P2P_SOCIAL(af_params->channel) &&
+ wl_to_p2p_bss_saved_ie(wl, P2PAPI_BSSCFG_DEVICE).p2p_probe_req_ie_len) {
+ config_af_params.search_channel = true;
+ } else {
+ config_af_params.search_channel = false;
+ }
+
+#ifdef WL11U
+ if (ndev == wl_to_prmry_ndev(wl))
+ config_af_params.search_channel = false;
+#endif /* WL11U */
+
+#ifdef VSDB
+ /* if connecting on primary iface, sleep for a while before sending af tx for VSDB */
+ if (wl_get_drv_status(wl, CONNECTING, wl_to_prmry_ndev(wl))) {
+ msleep(50);
+ }
+#endif
+
+ /* if scan is ongoing, abort current scan. */
+ if (wl_get_drv_status_all(wl, SCANNING)) {
+ wl_notify_escan_complete(wl, ndev, true, true);
+ }
+
+ /* set status and destination address before sending af */
+ if (wl->next_af_subtype != P2P_PAF_SUBTYPE_INVALID) {
+ /* set this status to cancel the remained dwell time in rx process */
+ wl_set_drv_status(wl, WAITING_NEXT_ACT_FRM, dev);
+ }
+ wl_set_drv_status(wl, SENDING_ACT_FRM, dev);
+ memcpy(wl->afx_hdl->tx_dst_addr.octet,
+ af_params->action_frame.da.octet,
+ sizeof(wl->afx_hdl->tx_dst_addr.octet));
+
+ /* save af_params for rx process */
+ wl->afx_hdl->pending_tx_act_frm = af_params;
+
+ /* search peer's channel */
+ if (config_af_params.search_channel) {
+ /* initialize afx_hdl */
+ wl->afx_hdl->bssidx = wl_cfgp2p_find_idx(wl, dev);
+ wl->afx_hdl->dev = dev;
+ wl->afx_hdl->retry = 0;
+ wl->afx_hdl->peer_chan = WL_INVALID;
+
+ if (wl_cfg80211_af_searching_channel(wl, dev) == WL_INVALID) {
+ WL_ERR(("couldn't find peer's channel.\n"));
+ goto exit;
+ }
+
+ /* Suspend P2P discovery's search-listen to prevent it from
+ * starting a scan or changing the channel.
+ */
+ wl_clr_drv_status(wl, SCANNING, wl->afx_hdl->dev);
+/* Do not abort scan for VSDB. Scan will be aborted in firmware if necessary */
+#ifndef WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST
+ wl_notify_escan_complete(wl, dev, true, true);
+#endif /* not WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST */
+ wl_cfgp2p_discover_enable_search(wl, false);
+
+ /* update channel */
+ af_params->channel = wl->afx_hdl->peer_chan;
+ }
+
+#ifdef VSDB
+ off_chan_started_jiffies = jiffies;
+#endif /* VSDB */
+
+ /* Now send a tx action frame */
+ ack = wl_cfgp2p_tx_action_frame(wl, dev, af_params, bssidx) ? false : true;
+
+ /* if failed, retry it. tx_retry_max value is configure by .... */
+ while ((ack == false) && (tx_retry++ < config_af_params.max_tx_retry)) {
+#ifdef VSDB
+ if (af_params->channel) {
+ if (jiffies_to_msecs(jiffies - off_chan_started_jiffies) >
+ OFF_CHAN_TIME_THRESHOLD_MS) {
+ WL_AF_TX_KEEP_PRI_CONNECTION_VSDB(wl);
+ off_chan_started_jiffies = jiffies;
+ }
+ }
+#endif /* VSDB */
+ ack = wl_cfgp2p_tx_action_frame(wl, dev, af_params, bssidx) ?
+ false : true;
+ }
+ if (ack == false) {
+ WL_ERR(("Failed to send Action Frame(retry %d)\n", tx_retry));
+ }
+exit:
+ /* Clear SENDING_ACT_FRM after all sending af is done */
+ wl_clr_drv_status(wl, SENDING_ACT_FRM, dev);
+
+#ifdef WL_CFG80211_SYNC_GON
+ /* WAR: sometimes dongle does not keep the dwell time of 'actframe'.
+ * if we coundn't get the next action response frame and dongle does not keep
+ * the dwell time, go to listen state again to get next action response frame.
+ */
+ if (ack && config_af_params.extra_listen &&
+#ifdef WL_CFG80211_GON_COLLISION
+ !wl->block_gon_req_tx_count &&
+#endif /* WL_CFG80211_GON_COLLISION */
+ wl_get_drv_status_all(wl, WAITING_NEXT_ACT_FRM) &&
+ wl->af_sent_channel == wl->afx_hdl->my_listen_chan) {
+ s32 extar_listen_time;
+
+ extar_listen_time = af_params->dwell_time -
+ jiffies_to_msecs(jiffies - wl->af_tx_sent_jiffies);
+
+ if (extar_listen_time > 50) {
+ wl_set_drv_status(wl, WAITING_NEXT_ACT_FRM_LISTEN, dev);
+ WL_DBG(("Wait more time! actual af time:%d,"
+ "calculated extar listen:%d\n",
+ af_params->dwell_time, extar_listen_time));
+ if (wl_cfgp2p_discover_listen(wl, wl->af_sent_channel,
+ extar_listen_time + 100) == BCME_OK) {
+ wait_for_completion_timeout(&wl->wait_next_af,
+ msecs_to_jiffies(extar_listen_time + 100 + 300));
+ }
+ wl_clr_drv_status(wl, WAITING_NEXT_ACT_FRM_LISTEN, dev);
+ }
+ }
+#endif /* WL_CFG80211_SYNC_GON */
+ wl_clr_drv_status(wl, WAITING_NEXT_ACT_FRM, dev);
+
+ if (wl->afx_hdl->pending_tx_act_frm)
+ wl->afx_hdl->pending_tx_act_frm = NULL;
+
+ WL_INFO(("-- sending Action Frame is %s, listen chan: %d\n",
+ (ack) ? "Succeeded!!":"Failed!!", wl->afx_hdl->my_listen_chan));
+
+#ifdef WL_CFG80211_GON_COLLISION
+ if (wl->block_gon_req_tx_count) {
+ wl->block_gon_req_tx_count--;
+ /* if ack is ture, supplicant will wait more time(100ms).
+ * so we will return it as a success to get more time .
+ */
+ ack = true;
+ }
+#endif /* WL_CFG80211_GON_COLLISION */
+
+ /* if all done, turn mpc on again */
+ if (config_af_params.mpc_onoff == 1) {
+ wldev_iovar_setint(dev, "mpc", 1);
+ }
+
+ return ack;
}
static s32
@@ -4284,40 +4592,26 @@ wl_cfg80211_mgmt_tx(struct wiphy *wiphy, struct net_device *ndev,
struct ieee80211_channel *channel, bool offchan,
enum nl80211_channel_type channel_type,
bool channel_type_valid, unsigned int wait,
- const u8* buf, size_t len, u64 *cookie)
+ const u8* buf, size_t len,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)
+ bool no_cck,
+#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)
+ bool dont_wait_for_ack,
+#endif
+ u64 *cookie)
{
wl_action_frame_t *action_frame;
wl_af_params_t *af_params;
- wifi_p2p_ie_t *p2p_ie;
- wpa_ie_fixed_t *wps_ie;
- wifi_wfd_ie_t *wfd_ie;
- wifi_p2p_ie_t *customer_ie;
+ scb_val_t scb_val;
const struct ieee80211_mgmt *mgmt;
struct wl_priv *wl = wiphy_priv(wiphy);
struct net_device *dev = NULL;
s32 err = BCME_OK;
s32 bssidx = 0;
- u32 p2pie_len = 0;
- u32 wpsie_len = 0;
- u32 wfdie_len = 0;
- u32 customer_ie_len = 0;
- u32 remain_len;
u32 id;
- u32 retry = 0;
- u8 *ptr;
bool ack = false;
- wifi_p2p_pub_act_frame_t *act_frm = NULL;
- wifi_p2p_action_frame_t *p2p_act_frm = NULL;
- wifi_p2psd_gas_pub_act_frame_t *sd_act_frm = NULL;
- scb_val_t scb_val;
s8 eabuf[ETHER_ADDR_STR_LEN];
-#ifdef WL_CFG80211_GON_COLLISION
- static uint8 saved_af_subtype = 0xff;
-#endif /* WL_CFG80211_GON_COLLISION */
-#ifdef WL_CFG80211_SYNC_GON_TIME
- bool is_waiting_more_time = false;
-#endif /* WL_CFG80211_SYNC_GON_TIME */
- bool is_PROVDIS_REQ_GO = false;
WL_DBG(("Enter \n"));
@@ -4354,63 +4648,22 @@ wl_cfg80211_mgmt_tx(struct wiphy *wiphy, struct net_device *ndev,
if (ieee80211_is_probe_resp(mgmt->frame_control)) {
s32 ie_offset = DOT11_MGMT_HDR_LEN + DOT11_BCN_PRB_FIXED_LEN;
s32 ie_len = len - ie_offset;
- if ((p2p_ie = wl_cfgp2p_find_p2pie((u8 *)(buf + ie_offset), ie_len))
- != NULL) {
- /* Total length of P2P Information Element */
- p2pie_len = p2p_ie->len + sizeof(p2p_ie->len) + sizeof(p2p_ie->id);
- }
- if ((wfd_ie = wl_cfgp2p_find_wfdie((u8 *)(buf + ie_offset), ie_len))
- != NULL) {
- /* Total length of WFD Information Element */
- wfdie_len = wfd_ie->len + sizeof(wfd_ie->len) + sizeof(wfd_ie->id);
- }
- if ((wps_ie = wl_cfgp2p_find_wpsie((u8 *)(buf + ie_offset), ie_len))
- != NULL) {
- wpsie_len = wps_ie->length + sizeof(wps_ie->length) +
- sizeof(wps_ie->tag);
- }
-
- /* Customer IE */
- ptr = (u8 *)(buf + ie_offset);
- remain_len = ie_len;
- customer_ie_len = 0;
- while (remain_len > 0)
- {
- customer_ie = wl_cfgp2p_find_customer_ie(ptr, &remain_len);
- if (customer_ie)
- {
- u32 add_len;
- add_len = customer_ie->len + sizeof(customer_ie->len)
- + sizeof(customer_ie->id);
- customer_ie_len += add_len;
- ptr = (u8*)customer_ie + add_len;
- remain_len -= add_len;
- WL_INFO(("Customer IE exist(len:%d)\n", add_len));
- }
- else
- break;
- }
- /* Order of Vendor IE is 1) WPS IE +
- * 2) P2P IE created by supplicant
- * So, it is ok to find start address of WPS IE
- * to save IEs
- */
-
- wl_cfgp2p_set_management_ie(wl, dev, bssidx,
- VNDR_IE_PRBRSP_FLAG,
- (u8 *)wps_ie, wpsie_len + p2pie_len + wfdie_len + customer_ie_len);
-
+ if (dev == wl_to_prmry_ndev(wl))
+ bssidx = wl_to_p2p_bss_bssidx(wl, P2PAPI_BSSCFG_DEVICE);
+ wl_cfgp2p_set_management_ie(wl, dev, bssidx,
+ VNDR_IE_PRBRSP_FLAG, (u8 *)(buf + ie_offset), ie_len);
cfg80211_mgmt_tx_status(ndev, *cookie, buf, len, true, GFP_KERNEL);
goto exit;
} else if (ieee80211_is_disassoc(mgmt->frame_control) ||
ieee80211_is_deauth(mgmt->frame_control)) {
memcpy(scb_val.ea.octet, mgmt->da, ETH_ALEN);
scb_val.val = mgmt->u.disassoc.reason_code;
- if (wldev_ioctl(dev, WLC_SCB_DEAUTHENTICATE_FOR_REASON, &scb_val,
- sizeof(scb_val_t), true) < 0)
- WL_ERR(("Connect Status check is required\n"));
- WL_DBG(("Disconnect STA : %s\n",
- bcm_ether_ntoa((const struct ether_addr *)mgmt->da, eabuf)));
+ wldev_ioctl(dev, WLC_SCB_DEAUTHENTICATE_FOR_REASON, &scb_val,
+ sizeof(scb_val_t), true);
+ WL_DBG(("Disconnect STA : %s scb_val.val %d\n",
+ bcm_ether_ntoa((const struct ether_addr *)mgmt->da, eabuf),
+ scb_val.val));
+ wl_delay(400);
cfg80211_mgmt_tx_status(ndev, *cookie, buf, len, true, GFP_KERNEL);
goto exit;
@@ -4426,9 +4679,7 @@ wl_cfg80211_mgmt_tx(struct wiphy *wiphy, struct net_device *ndev,
* And previous off-channel action frame must be ended before new af tx.
*/
#ifndef WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST
- WL_SCAN2(("Abort scan: %p(%d)\n", dev, wl->escan_info.cur_sync_id));
-
- wl_cfg80211_scan_abort(wl, dev);
+ wl_notify_escan_complete(wl, dev, true, true);
#endif /* not WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST */
}
@@ -4466,230 +4717,19 @@ wl_cfg80211_mgmt_tx(struct wiphy *wiphy, struct net_device *ndev,
wl->afx_hdl->peer_listen_chan = af_params->channel;
WL_DBG(("channel from upper layer %d\n", wl->afx_hdl->peer_listen_chan));
-
-
- /* Add the dwell time
+ /* Add the default dwell time
* Dwell time to stay off-channel to wait for a response action frame
* after transmitting an GO Negotiation action frame
*/
af_params->dwell_time = WL_DWELL_TIME;
memcpy(action_frame->data, &buf[DOT11_MGMT_HDR_LEN], action_frame->len);
- if (wl_cfgp2p_is_pub_action(action_frame->data, action_frame->len)) {
- act_frm = (wifi_p2p_pub_act_frame_t *) (action_frame->data);
- WL_DBG(("P2P PUB action_frame->len: %d chan %d category %d subtype %d\n",
- action_frame->len, af_params->channel,
- act_frm->category, act_frm->subtype));
- } else if (wl_cfgp2p_is_p2p_action(action_frame->data, action_frame->len)) {
- p2p_act_frm = (wifi_p2p_action_frame_t *) (action_frame->data);
- WL_DBG(("P2P action_frame->len: %d chan %d category %d subtype %d\n",
- action_frame->len, af_params->channel,
- p2p_act_frm->category, p2p_act_frm->subtype));
- } else if (wl_cfgp2p_is_gas_action(action_frame->data, action_frame->len)) {
- sd_act_frm = (wifi_p2psd_gas_pub_act_frame_t *) (action_frame->data);
- WL_DBG(("Service Discovery action_frame->len: %d chan %d category %d action %d\n",
- action_frame->len, af_params->channel,
- sd_act_frm->category, sd_act_frm->action));
-
- }
- wl_cfgp2p_print_actframe(true, action_frame->data, action_frame->len);
- /*
- * To make sure to send successfully action frame, we have to turn off mpc
- */
-
- if (act_frm) {
-#ifdef WL_CFG80211_GON_COLLISION
- if (wl->block_gon_req_tx_count && act_frm->subtype == P2P_PAF_GON_REQ) {
- /* drop gon req tx action frame */
- wl->block_gon_req_tx_count--;
- WL_ERR(("Drop gon req tx action frame: count %d\n", wl->block_gon_req_tx_count));
- cfg80211_mgmt_tx_status(ndev, *cookie, buf, len, true, GFP_KERNEL);
- kfree(af_params);
- goto exit;
- } else if (act_frm->subtype == P2P_PAF_GON_CONF) {
- /* if go formation done, clear it */
- wl->block_gon_req_tx_count = 0;
- wl->block_gon_req_rx_count = 0;
- }
-#endif /* WL_CFG80211_GON_COLLISION */
-
- if ((act_frm->subtype == P2P_PAF_GON_REQ) ||
- (act_frm->subtype == P2P_PAF_GON_RSP) ||
- (act_frm->subtype == P2P_PAF_GON_CONF) ||
- (act_frm->subtype == P2P_PAF_PROVDIS_REQ)) {
- wldev_iovar_setint(dev, "mpc", 0);
- }
-
- if (act_frm->subtype == P2P_PAF_GON_REQ) {
- wl->afx_hdl->my_listen_chan =
- wl_find_my_listen_channel(wl, act_frm->elts, action_frame->len);
- }
-
- if (act_frm->subtype == P2P_PAF_DEVDIS_REQ) {
- af_params->dwell_time = WL_LONG_DWELL_TIME;
- } else if (act_frm->subtype == P2P_PAF_PROVDIS_REQ ||
- act_frm->subtype == P2P_PAF_INVITE_REQ ||
- act_frm->subtype == P2P_PAF_GON_REQ ||
- act_frm->subtype == P2P_PAF_GON_RSP ||
- act_frm->subtype == P2P_PAF_PROVDIS_RSP) {
- af_params->dwell_time = WL_MED_DWELL_TIME;
- }
-
-#ifdef WL_CFG80211_SYNC_GON_TIME
- if (act_frm->subtype == P2P_PAF_PROVDIS_REQ ||
- act_frm->subtype == P2P_PAF_INVITE_REQ ||
- act_frm->subtype == P2P_PAF_GON_REQ ||
- act_frm->subtype == P2P_PAF_GON_RSP) {
- /* sometimes we can't get next gon frame with remain-on-channel,
- * waiting for next gon frame more!
- */
- is_waiting_more_time = true;
- if (act_frm->subtype == P2P_PAF_PROVDIS_RSP)
- wl->next_gon_af_subtype = P2P_PAF_GON_REQ;
- else
- wl->next_gon_af_subtype = act_frm->subtype + 1;
-
- wl_set_drv_status(wl, WAITING_NEXT_ACT_FRM, dev);
- wl->afx_hdl->peer_chan = WL_INVALID;
- } else
- wl->next_gon_af_subtype = -1;
-#endif /* WL_CFG80211_SYNC_GON_TIME */
- }
-
-#ifdef VSDB
- /* if connecting, sleep for a while before retry for VSDB */
- if (wl_get_drv_status(wl, CONNECTING, wl_to_prmry_ndev(wl))) {
- msleep(50);
- }
-#endif
-
- /* if scanning, abort current scan. */
- if (wl_get_drv_status_all(wl, SCANNING)) {
- wl_cfg80211_scan_abort(wl, dev);
- }
-
- /* Set SENDING_ACT_FRM and destinatio address for sending af */
- wl_set_drv_status(wl, SENDING_ACT_FRM, dev);
- memcpy(wl->afx_hdl->tx_dst_addr.octet,
- af_params->action_frame.da.octet,
- sizeof(wl->afx_hdl->tx_dst_addr.octet));
- if (act_frm && act_frm->elts) {
- if ((act_frm->subtype == P2P_PAF_PROVDIS_REQ) &&
- (p2p_ie = wl_cfgp2p_find_p2pie((u8 *)act_frm->elts,
- action_frame->len)) != NULL) {
- if ((ptr = wl_cfgp2p_retreive_p2pattrib(p2p_ie, P2P_SEID_GROUP_ID))) {
- is_PROVDIS_REQ_GO = true;
- }
- }
- }
-
- if (!is_PROVDIS_REQ_GO && IS_P2P_SOCIAL(af_params->channel) &&
- (IS_P2P_PUB_ACT_REQ(act_frm, action_frame->len) ||
- IS_GAS_REQ(sd_act_frm, action_frame->len)) &&
- wl_to_p2p_bss_saved_ie(wl, P2PAPI_BSSCFG_DEVICE).p2p_probe_req_ie_len) {
- /* channel offload require P2P IE for Probe request
- * otherwise, we will use wl_cfgp2p_tx_action_frame directly.
- * channel offload for action request frame
- */
-
- /* channel offload for action request frame */
- ack = wl_cfg80211_send_at_common_channel(wl, dev, af_params);
- } else {
- if (!wl_to_p2p_bss_saved_ie(wl, P2PAPI_BSSCFG_DEVICE).p2p_probe_req_ie_len)
- WL_ERR(("<<<< TX action frame without probe req ie >>>>\n"));
- if (!IS_P2P_SOCIAL(af_params->channel))
- WL_ERR(("<<<< TX action frame with (CH %d) >>>>\n",
- af_params->channel));
- ack = (wl_cfgp2p_tx_action_frame(wl, dev, af_params, bssidx)) ? false : true;
- if (!ack) {
- u32 max_retry = WL_CHANNEL_SYNC_RETRY;
- WL_AF_TX_REDUCE_RETRY_VSDB(wl, max_retry);
-
- if (wl_to_p2p_bss_saved_ie(wl, P2PAPI_BSSCFG_DEVICE).p2p_probe_req_ie_len) {
- /* if the NO ACK occurs, the peer device will be on
- * listen channel of the peer
- * So, we have to find the peer and send action frame on
- * that channel.
- */
- /* if public action response, the peer only wait for 100ms.
- * do not sync channel
- */
- if (act_frm && IS_P2P_SOCIAL(af_params->channel) &&
- !IS_P2P_PUB_ACT_RSP_SUBTYPE(act_frm->subtype)) {
- ack = wl_cfg80211_send_at_common_channel(wl, dev, af_params);
- } else {
- for (retry = 0; retry < max_retry; retry++) {
- WL_AF_TX_KEEP_PRI_CONNECTION_VSDB(wl);
- ack = (wl_cfgp2p_tx_action_frame(wl, dev,
- af_params, bssidx)) ? false : true;
- if (ack)
- break;
- }
- }
- } else {
- for (retry = 0; retry < max_retry; retry++) {
- WL_AF_TX_KEEP_PRI_CONNECTION_VSDB(wl);
- ack = (wl_cfgp2p_tx_action_frame(wl, dev,
- af_params, bssidx)) ? false : true;
- if (ack)
- break;
- }
-
- }
-
- }
-
- }
-
- /* Clear SENDING_ACT_FRM after all sending af is done */
- wl_clr_drv_status(wl, SENDING_ACT_FRM, dev);
-
-#ifdef WL_CFG80211_SYNC_GON_TIME
- if (ack && is_waiting_more_time && !wl->block_gon_req_tx_count &&
- wl_get_drv_status_all(wl, WAITING_NEXT_ACT_FRM) &&
- wl->af_sent_channel == wl->afx_hdl->my_listen_chan) {
- s32 extar_listen_time;
-
- extar_listen_time =
- af_params->dwell_time - jiffies_to_msecs(jiffies - wl->saved_jiffies);
-
- if (extar_listen_time > 50) {
- wl_set_drv_status(wl, WAITING_MORE_TIME_NEXT_ACT_FRM, dev);
- WL_DBG(("Wait more time! actual af time:%d, calculated extar listen:%d\n",
- af_params->dwell_time, extar_listen_time));
- if (wl_cfgp2p_discover_listen(wl, wl->af_sent_channel,
- extar_listen_time + 100) == BCME_OK) {
- wait_for_completion_timeout(&wl->wait_next_af,
- msecs_to_jiffies(extar_listen_time + 100 + 300));
- }
- wl_clr_drv_status(wl, WAITING_MORE_TIME_NEXT_ACT_FRM, dev);
- }
- }
- wl_clr_drv_status(wl, WAITING_NEXT_ACT_FRM, dev);
-
- WL_INFO(("-- sending Action Frame is %s, af sent chan: %d, my listen chan: %d\n",
- (ack) ? "Succeeded!!":"Failed!!", wl->af_sent_channel, wl->afx_hdl->my_listen_chan));
-#endif /* WL_CFG80211_SYNC_GON_TIME */
-
-#ifdef WL_CFG80211_GON_COLLISION
- /* Save Action Frame subtype */
- if (act_frm)
- saved_af_subtype = act_frm->subtype;
- else
- saved_af_subtype = 0xff;
-
- /* if ack is ture, supplicant will wait more time(100ms).
- * so we will return it as a success if block gon req tx is on.
- */
- if (wl->block_gon_req_tx_count)
- ack = true;
-#endif /* WL_CFG80211_GON_COLLISION */
+ ack = wl_cfg80211_send_action_frame(wiphy, dev, ndev, af_params,
+ action_frame, action_frame->len, bssidx);
cfg80211_mgmt_tx_status(ndev, *cookie, buf, len, ack, GFP_KERNEL);
- if (ack && act_frm && act_frm->subtype == P2P_PAF_GON_CONF) {
- wldev_iovar_setint(dev, "mpc", 1);
- }
+
kfree(af_params);
exit:
return err;
@@ -4770,9 +4810,9 @@ wl_cfg80211_set_channel(struct wiphy *wiphy, struct net_device *dev,
chspec = CH20MHZ_CHSPEC(channel);
}
-#endif
+#endif /* NOT_YET */
#ifdef HT40_GO
- switch(_chan) {
+ switch (_chan) {
/* adjust channel to center of 40MHz band */
case 40:
case 48:
@@ -4795,7 +4835,7 @@ wl_cfg80211_set_channel(struct wiphy *wiphy, struct net_device *dev,
break;
}
-
+ chspec = wl_chspec_host_to_driver(chspec);
if ((err = wldev_iovar_setint(dev, "chanspec", chspec)) == BCME_BADCHAN) {
err = wldev_ioctl(dev, WLC_SET_CHANNEL, &_chan, sizeof(_chan), true);
if (err < 0) {
@@ -4809,11 +4849,38 @@ wl_cfg80211_set_channel(struct wiphy *wiphy, struct net_device *dev,
WL_ERR(("WLC_SET_CHANNEL error %d"
"chip may not be supporting this channel\n", err));
}
-#endif
+#endif /* HT40_GO */
return err;
}
static s32
+wl_validate_opensecurity(struct net_device *dev, s32 bssidx)
+{
+ s32 err = BCME_OK;
+
+ /* set auth */
+ err = wldev_iovar_setint_bsscfg(dev, "auth", 0, bssidx);
+ if (err < 0) {
+ WL_ERR(("auth error %d\n", err));
+ return BCME_ERROR;
+ }
+ /* set wsec */
+ err = wldev_iovar_setint_bsscfg(dev, "wsec", 0, bssidx);
+ if (err < 0) {
+ WL_ERR(("wsec error %d\n", err));
+ return BCME_ERROR;
+ }
+ /* set upper-layer auth */
+ err = wldev_iovar_setint_bsscfg(dev, "wpa_auth", WPA_AUTH_NONE, bssidx);
+ if (err < 0) {
+ WL_ERR(("wpa_auth error %d\n", err));
+ return BCME_ERROR;
+ }
+
+ return 0;
+}
+
+static s32
wl_validate_wpa2ie(struct net_device *dev, bcm_tlv_t *wpa2ie, s32 bssidx)
{
s32 len = 0;
@@ -4826,6 +4893,11 @@ wl_validate_wpa2ie(struct net_device *dev, bcm_tlv_t *wpa2ie, s32 bssidx)
wpa_suite_mcast_t *mcast;
wpa_suite_ucast_t *ucast;
wpa_suite_auth_key_mgmt_t *mgmt;
+
+ u16 suite_count;
+ u8 rsn_cap[2];
+ u32 wme_bss_disable;
+
if (wpa2ie == NULL)
goto exit;
@@ -4856,10 +4928,12 @@ wl_validate_wpa2ie(struct net_device *dev, bcm_tlv_t *wpa2ie, s32 bssidx)
WL_ERR(("No Security Info\n"));
break;
}
- len -= WPA_SUITE_LEN;
+ if ((len -= WPA_SUITE_LEN) <= 0)
+ return BCME_BADLEN;
+
/* check the unicast cipher */
ucast = (wpa_suite_ucast_t *)&mcast[1];
- ltoh16_ua(&ucast->count);
+ suite_count = ltoh16_ua(&ucast->count);
switch (ucast->list[0].type) {
case WPA_CIPHER_NONE:
pval = 0;
@@ -4882,11 +4956,14 @@ wl_validate_wpa2ie(struct net_device *dev, bcm_tlv_t *wpa2ie, s32 bssidx)
default:
WL_ERR(("No Security Info\n"));
}
+ if ((len -= (WPA_IE_SUITE_COUNT_LEN + (WPA_SUITE_LEN * suite_count))) <= 0)
+ return BCME_BADLEN;
+
/* FOR WPS , set SEC_OW_ENABLED */
wsec = (pval | gval | SES_OW_ENABLED);
/* check the AKM */
- mgmt = (wpa_suite_auth_key_mgmt_t *)&ucast->list[1];
- ltoh16_ua(&mgmt->count);
+ mgmt = (wpa_suite_auth_key_mgmt_t *)&ucast->list[suite_count];
+ suite_count = ltoh16_ua(&mgmt->count);
switch (mgmt->list[0].type) {
case RSN_AKM_NONE:
wpa_auth = WPA_AUTH_NONE;
@@ -4900,6 +4977,27 @@ wl_validate_wpa2ie(struct net_device *dev, bcm_tlv_t *wpa2ie, s32 bssidx)
default:
WL_ERR(("No Key Mgmt Info\n"));
}
+
+ if ((len -= (WPA_IE_SUITE_COUNT_LEN + (WPA_SUITE_LEN * suite_count))) >= RSN_CAP_LEN) {
+ rsn_cap[0] = *(u8 *)&mgmt->list[suite_count];
+ rsn_cap[1] = *((u8 *)&mgmt->list[suite_count] + 1);
+
+ if (rsn_cap[0] & (RSN_CAP_16_REPLAY_CNTRS << RSN_CAP_PTK_REPLAY_CNTR_SHIFT)) {
+ wme_bss_disable = 0;
+ } else {
+ wme_bss_disable = 1;
+ }
+
+ /* set wme_bss_disable to sync RSN Capabilities */
+ err = wldev_iovar_setint_bsscfg(dev, "wme_bss_disable", wme_bss_disable, bssidx);
+ if (err < 0) {
+ WL_ERR(("wme_bss_disable error %d\n", err));
+ return BCME_ERROR;
+ }
+ } else {
+ WL_DBG(("There is no RSN Capabilities. remained len %d\n", len));
+ }
+
/* set auth */
err = wldev_iovar_setint_bsscfg(dev, "auth", auth, bssidx);
if (err < 0) {
@@ -5069,128 +5167,187 @@ exit:
}
static s32
-wl_cfg80211_add_set_beacon(struct wiphy *wiphy, struct net_device *dev,
- struct beacon_parameters *info)
+wl_cfg80211_bcn_validate_sec(
+ struct net_device *dev,
+ struct parsed_ies *ies,
+ u32 dev_role,
+ s32 bssidx)
{
- s32 err = BCME_OK;
- bcm_tlv_t *ssid_ie;
- wlc_ssid_t ssid;
- struct wl_priv *wl = wiphy_priv(wiphy);
- struct wl_join_params join_params;
- wpa_ie_fixed_t *wps_ie;
- wpa_ie_fixed_t *wpa_ie;
- bcm_tlv_t *wpa2_ie;
- wifi_p2p_ie_t *p2p_ie;
- wifi_wfd_ie_t *wfd_ie;
- bool is_bssup = false;
- bool update_bss = false;
- bool pbc = false;
- u16 wpsie_len = 0;
- u16 p2pie_len = 0;
- u32 wfdie_len = 0;
- u8 beacon_ie[IE_MAX_LEN];
- s32 ie_offset = 0;
- s32 bssidx = 0;
- s32 infra = 1;
- s32 join_params_size = 0;
- s32 ap = 0;
- WL_DBG(("interval (%d) dtim_period (%d) head_len (%d) tail_len (%d)\n",
- info->interval, info->dtim_period, info->head_len, info->tail_len));
-
- if (wl->p2p_net == dev) {
- dev = wl_to_prmry_ndev(wl);
- }
+ struct wl_priv *wl = wlcfg_drv_priv;
- bssidx = wl_cfgp2p_find_idx(wl, dev);
- if (p2p_is_on(wl) &&
- (bssidx == wl_to_p2p_bss_bssidx(wl,
- P2PAPI_BSSCFG_CONNECTION))) {
- memset(beacon_ie, 0, sizeof(beacon_ie));
- /* We don't need to set beacon for P2P_GO,
- * but need to parse ssid from beacon_parameters
- * because there is no way to set ssid
- */
- ie_offset = DOT11_MGMT_HDR_LEN + DOT11_BCN_PRB_FIXED_LEN;
- /* find the SSID */
- if ((ssid_ie = bcm_parse_tlvs((u8 *)&info->head[ie_offset],
- info->head_len - ie_offset,
- DOT11_MNG_SSID_ID)) != NULL) {
- memcpy(wl->p2p->ssid.SSID, ssid_ie->data, ssid_ie->len);
- wl->p2p->ssid.SSID_len = ssid_ie->len;
- WL_DBG(("SSID (%s) in Head \n", ssid_ie->data));
+ if (dev_role == NL80211_IFTYPE_P2P_GO && (ies->wpa2_ie)) {
+ /* For P2P GO, the sec type is WPA2-PSK */
+ WL_DBG(("P2P GO: validating wpa2_ie"));
+ if (wl_validate_wpa2ie(dev, ies->wpa2_ie, bssidx) < 0)
+ return BCME_ERROR;
+
+ } else if (dev_role == NL80211_IFTYPE_AP) {
+
+ WL_DBG(("SoftAP: validating security"));
+ /* If wpa2_ie or wpa_ie is present validate it */
+ if ((ies->wpa2_ie || ies->wpa_ie) &&
+ ((wl_validate_wpa2ie(dev, ies->wpa2_ie, bssidx) < 0 ||
+ wl_validate_wpaie(dev, ies->wpa_ie, bssidx) < 0))) {
+ wl->ap_info->security_mode = false;
+ return BCME_ERROR;
+ }
+
+ wl->ap_info->security_mode = true;
+ if (wl->ap_info->rsn_ie) {
+ kfree(wl->ap_info->rsn_ie);
+ wl->ap_info->rsn_ie = NULL;
+ }
+ if (wl->ap_info->wpa_ie) {
+ kfree(wl->ap_info->wpa_ie);
+ wl->ap_info->wpa_ie = NULL;
+ }
+ if (wl->ap_info->wps_ie) {
+ kfree(wl->ap_info->wps_ie);
+ wl->ap_info->wps_ie = NULL;
+ }
+ if (ies->wpa_ie != NULL) {
+ /* WPAIE */
+ wl->ap_info->rsn_ie = NULL;
+ wl->ap_info->wpa_ie = kmemdup(ies->wpa_ie,
+ ies->wpa_ie->length + WPA_RSN_IE_TAG_FIXED_LEN,
+ GFP_KERNEL);
+ } else if (ies->wpa2_ie != NULL) {
+ /* RSNIE */
+ wl->ap_info->wpa_ie = NULL;
+ wl->ap_info->rsn_ie = kmemdup(ies->wpa2_ie,
+ ies->wpa2_ie->len + WPA_RSN_IE_TAG_FIXED_LEN,
+ GFP_KERNEL);
+ }
- } else {
- WL_ERR(("No SSID in beacon \n"));
+ if (!ies->wpa2_ie && !ies->wpa_ie) {
+ wl_validate_opensecurity(dev, bssidx);
+ wl->ap_info->security_mode = false;
}
- /* find the WPSIE */
- if ((wps_ie = wl_cfgp2p_find_wpsie((u8 *)info->tail, info->tail_len)) != NULL) {
- wpsie_len = wps_ie->length + WPA_RSN_IE_TAG_FIXED_LEN;
- /*
- * Should be compared with saved ie before saving it
- */
- wl_validate_wps_ie((char *) wps_ie, &pbc);
- memcpy(beacon_ie, wps_ie, wpsie_len);
- } else {
- WL_ERR(("No WPSIE in beacon \n"));
+ if (ies->wps_ie) {
+ wl->ap_info->wps_ie = kmemdup(ies->wps_ie, ies->wps_ie_len, GFP_KERNEL);
}
+ }
+ return 0;
- /* find the P2PIE */
- if ((p2p_ie = wl_cfgp2p_find_p2pie((u8 *)info->tail, info->tail_len)) != NULL) {
- /* Total length of P2P Information Element */
- p2pie_len = p2p_ie->len + sizeof(p2p_ie->len) + sizeof(p2p_ie->id);
- memcpy(&beacon_ie[wpsie_len], p2p_ie, p2pie_len);
+}
- } else {
- WL_ERR(("No P2PIE in beacon \n"));
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)
+static s32 wl_cfg80211_bcn_set_params(
+ struct cfg80211_ap_settings *info,
+ struct net_device *dev,
+ u32 dev_role, s32 bssidx)
+{
+ struct wl_priv *wl = wlcfg_drv_priv;
+ s32 err = BCME_OK;
+
+ WL_DBG(("interval (%d) \ndtim_period (%d) \n",
+ info->beacon_interval, info->dtim_period));
+
+ if (info->beacon_interval) {
+ if ((err = wldev_ioctl(dev, WLC_SET_BCNPRD,
+ &info->beacon_interval, sizeof(s32), true)) < 0) {
+ WL_ERR(("Beacon Interval Set Error, %d\n", err));
+ return err;
}
+ }
- /* find the WFD IEs */
- if ((wfd_ie = wl_cfgp2p_find_wfdie((u8 *)info->tail, info->tail_len)) != NULL) {
- /* Total length of P2P Information Element */
- wfdie_len = wfd_ie->len + sizeof(wfd_ie->len) + sizeof(wfd_ie->id);
- if ((wpsie_len + p2pie_len + wfdie_len) < IE_MAX_LEN) {
- memcpy(&beacon_ie[wpsie_len + p2pie_len], wfd_ie, wfdie_len);
- } else {
- WL_ERR(("Found WFD IE but there is no space, (%d)(%d)(%d)\n",
- wpsie_len, p2pie_len, wfdie_len));
- wfdie_len = 0;
- }
- } else {
- WL_INFO(("No WFDIE in beacon \n"));
+ if (info->dtim_period) {
+ if ((err = wldev_ioctl(dev, WLC_SET_DTIMPRD,
+ &info->dtim_period, sizeof(s32), true)) < 0) {
+ WL_ERR(("DTIM Interval Set Error, %d\n", err));
+ return err;
}
- /* add WLC_E_PROBREQ_MSG event to respose probe_request from STA */
- wl_add_remove_eventmsg(dev, WLC_E_PROBREQ_MSG, pbc);
- wl_cfgp2p_set_management_ie(wl, dev, bssidx, VNDR_IE_BEACON_FLAG,
- beacon_ie, wpsie_len + p2pie_len + wfdie_len);
+ }
- /* find the RSN_IE */
- if ((wpa2_ie = bcm_parse_tlvs((u8 *)info->tail, info->tail_len,
- DOT11_MNG_RSN_ID)) != NULL) {
- WL_DBG((" WPA2 IE is found\n"));
+ if ((info->ssid) && (info->ssid_len > 0) &&
+ (info->ssid_len <= 32)) {
+ WL_DBG(("SSID (%s) len:%d \n", info->ssid, info->ssid_len));
+ if (dev_role == NL80211_IFTYPE_AP) {
+ /* Store the hostapd SSID */
+ memset(wl->hostapd_ssid.SSID, 0x00, 32);
+ memcpy(wl->hostapd_ssid.SSID, info->ssid, info->ssid_len);
+ wl->hostapd_ssid.SSID_len = info->ssid_len;
+ } else {
+ /* P2P GO */
+ memset(wl->p2p->ssid.SSID, 0x00, 32);
+ memcpy(wl->p2p->ssid.SSID, info->ssid, info->ssid_len);
+ wl->p2p->ssid.SSID_len = info->ssid_len;
}
+ }
+
+ if (info->hidden_ssid) {
+ if ((err = wldev_iovar_setint(dev, "closednet", 1)) < 0)
+ WL_ERR(("failed to set hidden : %d\n", err));
+ WL_DBG(("hidden_ssid_enum_val: %d \n", info->hidden_ssid));
+ }
+
+ return err;
+}
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) */
+
+static s32
+wl_cfg80211_parse_ies(u8 *ptr, u32 len, struct parsed_ies *ies)
+{
+ s32 err = BCME_OK;
+
+ memset(ies, 0, sizeof(struct parsed_ies));
+
+ /* find the WPSIE */
+ if ((ies->wps_ie = wl_cfgp2p_find_wpsie(ptr, len)) != NULL) {
+ WL_DBG(("WPSIE in beacon \n"));
+ ies->wps_ie_len = ies->wps_ie->length + WPA_RSN_IE_TAG_FIXED_LEN;
+ } else {
+ WL_ERR(("No WPSIE in beacon \n"));
+ }
+
+ /* find the RSN_IE */
+ if ((ies->wpa2_ie = bcm_parse_tlvs(ptr, len,
+ DOT11_MNG_RSN_ID)) != NULL) {
+ WL_DBG((" WPA2 IE found\n"));
+ ies->wpa2_ie_len = ies->wpa2_ie->len;
+ }
+
+ /* find the WPA_IE */
+ if ((ies->wpa_ie = wl_cfgp2p_find_wpaie(ptr, len)) != NULL) {
+ WL_DBG((" WPA found\n"));
+ ies->wpa_ie_len = ies->wpa_ie->length;
+ }
+
+ return err;
+
+}
+
+static s32
+wl_cfg80211_bcn_bringup_ap(
+ struct net_device *dev,
+ struct parsed_ies *ies,
+ u32 dev_role, s32 bssidx)
+{
+ struct wl_priv *wl = wlcfg_drv_priv;
+ struct wl_join_params join_params;
+ bool is_bssup = false;
+ s32 infra = 1;
+ s32 join_params_size = 0;
+ s32 ap = 1;
+ s32 err = BCME_OK;
+
+ WL_DBG(("Enter dev_role: %d\n", dev_role));
+
+ /* Common code for SoftAP and P2P GO */
+ wldev_iovar_setint(dev, "mpc", 0);
+
+ if (dev_role == NL80211_IFTYPE_P2P_GO) {
is_bssup = wl_cfgp2p_bss_isup(dev, bssidx);
+ if (!is_bssup && (ies->wpa2_ie != NULL)) {
- if (!is_bssup && (wpa2_ie != NULL)) {
- if (!info->dtim_period) {
- info->dtim_period = 1;
- }
- if ((err = wldev_ioctl(dev, WLC_SET_DTIMPRD,
- &info->dtim_period, sizeof(s32), true)) < 0) {
- WL_ERR(("DTIM Interval Set Error, %d\n", err));
- return err;
- }
- wldev_iovar_setint(dev, "mpc", 0);
- if ((err = wl_validate_wpa2ie(dev, wpa2_ie, bssidx)) < 0) {
- WL_ERR(("WPA2 IE parsing error"));
- goto exit;
- }
err = wldev_ioctl(dev, WLC_SET_INFRA, &infra, sizeof(s32), true);
if (err < 0) {
WL_ERR(("SET INFRA error %d\n", err));
goto exit;
}
+
err = wldev_iovar_setbuf_bsscfg(dev, "ssid", &wl->p2p->ssid,
sizeof(wl->p2p->ssid), wl->ioctl_buf, WLC_IOCTL_MAXLEN,
bssidx, &wl->ioctl_buf_sync);
@@ -5198,237 +5355,522 @@ wl_cfg80211_add_set_beacon(struct wiphy *wiphy, struct net_device *dev,
WL_ERR(("GO SSID setting error %d\n", err));
goto exit;
}
+
if ((err = wl_cfgp2p_bss(wl, dev, bssidx, 1)) < 0) {
WL_ERR(("GO Bring up error %d\n", err));
goto exit;
}
+ } else
+ WL_DBG(("Bss is already up\n"));
+ } else if ((dev_role == NL80211_IFTYPE_AP) &&
+ (wl_get_drv_status(wl, AP_CREATING, dev))) {
+ /* Device role SoftAP */
+ err = wldev_ioctl(dev, WLC_DOWN, &ap, sizeof(s32), true);
+ if (err < 0) {
+ WL_ERR(("WLC_DOWN error %d\n", err));
+ goto exit;
}
- } else if (wl_get_drv_status(wl, AP_CREATING, dev)) {
- ie_offset = DOT11_MGMT_HDR_LEN + DOT11_BCN_PRB_FIXED_LEN;
- ap = 1;
- /* find the SSID */
- if ((ssid_ie = bcm_parse_tlvs((u8 *)&info->head[ie_offset],
- info->head_len - ie_offset,
- DOT11_MNG_SSID_ID)) != NULL) {
- memset(&ssid, 0, sizeof(wlc_ssid_t));
- memcpy(ssid.SSID, ssid_ie->data, ssid_ie->len);
- WL_DBG(("SSID is (%s) in Head \n", ssid.SSID));
- ssid.SSID_len = ssid_ie->len;
- wldev_iovar_setint(dev, "mpc", 0);
- err = wldev_ioctl(dev, WLC_DOWN, &ap, sizeof(s32), true);
- if (err < 0) {
- WL_ERR(("WLC_DOWN error %d\n", err));
- goto exit;
- }
- err = wldev_ioctl(dev, WLC_SET_INFRA, &infra, sizeof(s32), true);
- if (err < 0) {
- WL_ERR(("SET INFRA error %d\n", err));
- goto exit;
- }
- if ((err = wldev_ioctl(dev, WLC_SET_AP, &ap, sizeof(s32), true)) < 0) {
- WL_ERR(("setting AP mode failed %d \n", err));
- return err;
- }
- /* find the RSN_IE */
- if ((wpa2_ie = bcm_parse_tlvs((u8 *)info->tail, info->tail_len,
- DOT11_MNG_RSN_ID)) != NULL) {
- WL_DBG((" WPA2 IE is found\n"));
- }
- /* find the WPA_IE */
- if ((wpa_ie = wl_cfgp2p_find_wpaie((u8 *)info->tail,
- info->tail_len)) != NULL) {
- WL_DBG((" WPA IE is found\n"));
- }
- if ((wpa_ie != NULL || wpa2_ie != NULL)) {
- if (wl_validate_wpa2ie(dev, wpa2_ie, bssidx) < 0 ||
- wl_validate_wpaie(dev, wpa_ie, bssidx) < 0) {
- wl->ap_info->security_mode = false;
- return BCME_ERROR;
+ err = wldev_ioctl(dev, WLC_SET_INFRA, &infra, sizeof(s32), true);
+ if (err < 0) {
+ WL_ERR(("SET INFRA error %d\n", err));
+ goto exit;
+ }
+ if ((err = wldev_ioctl(dev, WLC_SET_AP, &ap, sizeof(s32), true)) < 0) {
+ WL_ERR(("setting AP mode failed %d \n", err));
+ goto exit;
+ }
+
+ err = wldev_ioctl(dev, WLC_UP, &ap, sizeof(s32), true);
+ if (unlikely(err)) {
+ WL_ERR(("WLC_UP error (%d)\n", err));
+ goto exit;
+ }
+
+ memset(&join_params, 0, sizeof(join_params));
+ /* join parameters starts with ssid */
+ join_params_size = sizeof(join_params.ssid);
+ memcpy(join_params.ssid.SSID, wl->hostapd_ssid.SSID,
+ wl->hostapd_ssid.SSID_len);
+ join_params.ssid.SSID_len = htod32(wl->hostapd_ssid.SSID_len);
+
+ /* create softap */
+ if ((err = wldev_ioctl(dev, WLC_SET_SSID, &join_params,
+ join_params_size, true)) == 0) {
+ WL_DBG(("SoftAP set SSID (%s) success\n", join_params.ssid.SSID));
+ wl_clr_drv_status(wl, AP_CREATING, dev);
+ wl_set_drv_status(wl, AP_CREATED, dev);
+ }
+ }
+
+
+exit:
+ return err;
+}
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)
+s32
+wl_cfg80211_parse_set_ies(
+ struct net_device *dev,
+ struct cfg80211_beacon_data *info,
+ struct parsed_ies *ies,
+ u32 dev_role,
+ s32 bssidx)
+{
+ struct wl_priv *wl = wlcfg_drv_priv;
+ struct parsed_ies prb_ies;
+ s32 err = BCME_OK;
+
+ memset(ies, 0, sizeof(struct parsed_ies));
+ memset(&prb_ies, 0, sizeof(struct parsed_ies));
+
+ /* Parse Beacon IEs */
+ if (wl_cfg80211_parse_ies((u8 *)info->tail,
+ info->tail_len, ies) < 0) {
+ WL_ERR(("Beacon get IEs failed \n"));
+ err = -EINVAL;
+ goto fail;
+ }
+
+ /* Set Beacon IEs to FW */
+ if ((err = wl_cfgp2p_set_management_ie(wl, dev, bssidx,
+ VNDR_IE_BEACON_FLAG, (u8 *)info->tail,
+ info->tail_len)) < 0) {
+ WL_ERR(("Set Beacon IE Failed \n"));
+ } else {
+ WL_DBG(("Applied Vndr IEs for Beacon \n"));
+ }
+
+ /* Parse Probe Response IEs */
+ if (wl_cfg80211_parse_ies((u8 *)info->proberesp_ies,
+ info->proberesp_ies_len, &prb_ies) < 0) {
+ WL_ERR(("PRB RESP get IEs failed \n"));
+ err = -EINVAL;
+ goto fail;
+ }
+
+ /* Set Probe Response IEs to FW */
+ if ((err = wl_cfgp2p_set_management_ie(wl, dev, bssidx,
+ VNDR_IE_PRBRSP_FLAG, (u8 *)info->proberesp_ies,
+ info->proberesp_ies_len)) < 0) {
+ WL_ERR(("Set Probe Resp IE Failed \n"));
+ } else {
+ WL_DBG(("Applied Vndr IEs for Probe Resp \n"));
+ }
+
+fail:
+
+ return err;
+}
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) */
+
+static s32 wl_cfg80211_hostapd_sec(
+ struct net_device *dev,
+ struct parsed_ies *ies,
+ s32 bssidx)
+{
+ bool update_bss = 0;
+ struct wl_priv *wl = wlcfg_drv_priv;
+
+
+ if (ies->wps_ie) {
+ if (wl->ap_info->wps_ie &&
+ memcmp(wl->ap_info->wps_ie, ies->wps_ie, ies->wps_ie_len)) {
+ WL_DBG((" WPS IE is changed\n"));
+ kfree(wl->ap_info->wps_ie);
+ wl->ap_info->wps_ie = kmemdup(ies->wps_ie, ies->wps_ie_len, GFP_KERNEL);
+ } else if (wl->ap_info->wps_ie == NULL) {
+ WL_DBG((" WPS IE is added\n"));
+ wl->ap_info->wps_ie = kmemdup(ies->wps_ie, ies->wps_ie_len, GFP_KERNEL);
+ }
+ if ((ies->wpa_ie != NULL || ies->wpa2_ie != NULL)) {
+ if (!wl->ap_info->security_mode) {
+ /* change from open mode to security mode */
+ update_bss = true;
+ if (ies->wpa_ie != NULL) {
+ wl->ap_info->wpa_ie = kmemdup(ies->wpa_ie,
+ ies->wpa_ie->length + WPA_RSN_IE_TAG_FIXED_LEN,
+ GFP_KERNEL);
+ } else {
+ wl->ap_info->rsn_ie = kmemdup(ies->wpa2_ie,
+ ies->wpa2_ie->len + WPA_RSN_IE_TAG_FIXED_LEN,
+ GFP_KERNEL);
}
- wl->ap_info->security_mode = true;
- if (wl->ap_info->rsn_ie) {
+ } else if (wl->ap_info->wpa_ie) {
+ /* change from WPA2 mode to WPA mode */
+ if (ies->wpa_ie != NULL) {
+ update_bss = true;
kfree(wl->ap_info->rsn_ie);
wl->ap_info->rsn_ie = NULL;
- }
- if (wl->ap_info->wpa_ie) {
- kfree(wl->ap_info->wpa_ie);
- wl->ap_info->wpa_ie = NULL;
- }
- if (wl->ap_info->wps_ie) {
- kfree(wl->ap_info->wps_ie);
- wl->ap_info->wps_ie = NULL;
- }
- if (wpa_ie != NULL) {
- /* WPAIE */
- wl->ap_info->rsn_ie = NULL;
- wl->ap_info->wpa_ie = kmemdup(wpa_ie,
- wpa_ie->length + WPA_RSN_IE_TAG_FIXED_LEN,
- GFP_KERNEL);
- } else {
- /* RSNIE */
+ wl->ap_info->wpa_ie = kmemdup(ies->wpa_ie,
+ ies->wpa_ie->length + WPA_RSN_IE_TAG_FIXED_LEN,
+ GFP_KERNEL);
+ } else if (memcmp(wl->ap_info->rsn_ie,
+ ies->wpa2_ie, ies->wpa2_ie->len
+ + WPA_RSN_IE_TAG_FIXED_LEN)) {
+ update_bss = true;
+ kfree(wl->ap_info->rsn_ie);
+ wl->ap_info->rsn_ie = kmemdup(ies->wpa2_ie,
+ ies->wpa2_ie->len + WPA_RSN_IE_TAG_FIXED_LEN,
+ GFP_KERNEL);
wl->ap_info->wpa_ie = NULL;
- wl->ap_info->rsn_ie = kmemdup(wpa2_ie,
- wpa2_ie->len + WPA_RSN_IE_TAG_FIXED_LEN,
- GFP_KERNEL);
}
- } else
- wl->ap_info->security_mode = false;
- /* find the WPSIE */
- if ((wps_ie = wl_cfgp2p_find_wpsie((u8 *)info->tail,
- info->tail_len)) != NULL) {
- wpsie_len = wps_ie->length +WPA_RSN_IE_TAG_FIXED_LEN;
- /*
- * Should be compared with saved ie before saving it
- */
- wl_validate_wps_ie((char *) wps_ie, &pbc);
- memcpy(beacon_ie, wps_ie, wpsie_len);
- wl_cfgp2p_set_management_ie(wl, dev, bssidx, VNDR_IE_BEACON_FLAG,
- beacon_ie, wpsie_len);
- wl->ap_info->wps_ie = kmemdup(wps_ie, wpsie_len, GFP_KERNEL);
- /* add WLC_E_PROBREQ_MSG event to respose probe_request from STA */
- wl_add_remove_eventmsg(dev, WLC_E_PROBREQ_MSG, pbc);
- } else {
- WL_DBG(("No WPSIE in beacon \n"));
}
- if (info->interval) {
- if ((err = wldev_ioctl(dev, WLC_SET_BCNPRD,
- &info->interval, sizeof(s32), true)) < 0) {
- WL_ERR(("Beacon Interval Set Error, %d\n", err));
- return err;
+ if (update_bss) {
+ wl->ap_info->security_mode = true;
+ wl_cfgp2p_bss(wl, dev, bssidx, 0);
+ if (wl_validate_wpa2ie(dev, ies->wpa2_ie, bssidx) < 0 ||
+ wl_validate_wpaie(dev, ies->wpa_ie, bssidx) < 0) {
+ return BCME_ERROR;
}
+ wl_cfgp2p_bss(wl, dev, bssidx, 1);
}
- if (!info->dtim_period) {
- info->dtim_period = 1;
- }
- if ((err = wldev_ioctl(dev, WLC_SET_DTIMPRD,
- &info->dtim_period, sizeof(s32), true)) < 0) {
- WL_ERR(("DTIM Interval Set Error, %d\n", err));
- return err;
- }
+ }
+ } else {
+ WL_ERR(("No WPSIE in beacon \n"));
+ }
+ return 0;
+}
- err = wldev_ioctl(dev, WLC_UP, &ap, sizeof(s32), true);
- if (unlikely(err)) {
- WL_ERR(("WLC_UP error (%d)\n", err));
- return err;
- }
- memset(&join_params, 0, sizeof(join_params));
- /* join parameters starts with ssid */
- join_params_size = sizeof(join_params.ssid);
- memcpy(join_params.ssid.SSID, ssid.SSID, ssid.SSID_len);
- join_params.ssid.SSID_len = htod32(ssid.SSID_len);
- /* create softap */
- if ((err = wldev_ioctl(dev, WLC_SET_SSID, &join_params,
- join_params_size, true)) == 0) {
- wl_clr_drv_status(wl, AP_CREATING, dev);
- wl_set_drv_status(wl, AP_CREATED, dev);
- }
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)
+static s32
+wl_cfg80211_start_ap(
+ struct wiphy *wiphy,
+ struct net_device *dev,
+ struct cfg80211_ap_settings *info)
+{
+ struct wl_priv *wl = wiphy_priv(wiphy);
+ s32 err = BCME_OK;
+ struct parsed_ies ies;
+ s32 bssidx = 0;
+ u32 dev_role = 0;
+
+ WL_DBG(("Enter \n"));
+ if (dev == wl_to_prmry_ndev(wl)) {
+ WL_DBG(("Start AP req on primary iface: Softap\n"));
+ dev_role = NL80211_IFTYPE_AP;
+ } else if (dev == wl->p2p_net) {
+ /* Group Add request on p2p0 */
+ WL_DBG(("Start AP req on P2P iface: GO\n"));
+ dev = wl_to_prmry_ndev(wl);
+ dev_role = NL80211_IFTYPE_P2P_GO;
+ }
+
+ bssidx = wl_cfgp2p_find_idx(wl, dev);
+ if (p2p_is_on(wl) &&
+ (bssidx == wl_to_p2p_bss_bssidx(wl,
+ P2PAPI_BSSCFG_CONNECTION))) {
+ dev_role = NL80211_IFTYPE_P2P_GO;
+ WL_DBG(("Start AP req on P2P connection iface\n"));
+ }
+
+ if ((err = wl_cfg80211_bcn_set_params(info, dev,
+ dev_role, bssidx)) < 0) {
+ WL_ERR(("Beacon params set failed \n"));
+ goto fail;
+ }
+
+ /* Set IEs to FW */
+ if ((err = wl_cfg80211_parse_set_ies(dev, &info->beacon,
+ &ies, dev_role, bssidx) < 0)) {
+ WL_ERR(("Set IEs failed \n"));
+ goto fail;
+ }
+
+ if ((wl_cfg80211_bcn_validate_sec(dev, &ies,
+ dev_role, bssidx)) < 0)
+ {
+ WL_ERR(("Beacon set security failed \n"));
+ goto fail;
+ }
+
+ if ((err = wl_cfg80211_bcn_bringup_ap(dev, &ies,
+ dev_role, bssidx)) < 0) {
+ WL_ERR(("Beacon bring up AP/GO failed \n"));
+ goto fail;
+ }
+
+ WL_DBG(("** AP/GO Created **\n"));
+
+fail:
+ if (err) {
+ WL_ERR(("ADD/SET beacon failed\n"));
+ wldev_iovar_setint(dev, "mpc", 1);
+ }
+
+ return err;
+}
+
+static s32
+wl_cfg80211_stop_ap(
+ struct wiphy *wiphy,
+ struct net_device *dev)
+{
+ int err = 0;
+ u32 dev_role = 0;
+ int infra = 0;
+ int ap = 0;
+ s32 bssidx = 0;
+ struct wl_priv *wl = wiphy_priv(wiphy);
+
+ WL_DBG(("Enter \n"));
+ if (dev == wl_to_prmry_ndev(wl)) {
+ dev_role = NL80211_IFTYPE_AP;
+ } else if (dev == wl->p2p_net) {
+ /* Group Add request on p2p0 */
+ dev = wl_to_prmry_ndev(wl);
+ dev_role = NL80211_IFTYPE_P2P_GO;
+ }
+ bssidx = wl_cfgp2p_find_idx(wl, dev);
+ if (p2p_is_on(wl) &&
+ (bssidx == wl_to_p2p_bss_bssidx(wl,
+ P2PAPI_BSSCFG_CONNECTION))) {
+ dev_role = NL80211_IFTYPE_P2P_GO;
+ }
+
+ if (dev_role == NL80211_IFTYPE_AP) {
+ /* SoftAp on primary Interface.
+ * Shut down AP and turn on MPC
+ */
+ err = wldev_ioctl(dev, WLC_SET_INFRA, &infra, sizeof(s32), true);
+ if (err < 0) {
+ WL_ERR(("SET INFRA error %d\n", err));
+ err = -ENOTSUPP;
+ goto exit;
}
- } else if (wl_get_drv_status(wl, AP_CREATED, dev)) {
- ap = 1;
- /* find the WPSIE */
- if ((wps_ie = wl_cfgp2p_find_wpsie((u8 *)info->tail, info->tail_len)) != NULL) {
- wpsie_len = wps_ie->length + WPA_RSN_IE_TAG_FIXED_LEN;
- /*
- * Should be compared with saved ie before saving it
- */
- wl_validate_wps_ie((char *) wps_ie, &pbc);
- memcpy(beacon_ie, wps_ie, wpsie_len);
- wl_cfgp2p_set_management_ie(wl, dev, bssidx, VNDR_IE_BEACON_FLAG,
- beacon_ie, wpsie_len);
- if (wl->ap_info->wps_ie &&
- memcmp(wl->ap_info->wps_ie, wps_ie, wpsie_len)) {
- WL_DBG((" WPS IE is changed\n"));
- kfree(wl->ap_info->wps_ie);
- wl->ap_info->wps_ie = kmemdup(wps_ie, wpsie_len, GFP_KERNEL);
- /* add WLC_E_PROBREQ_MSG event to respose probe_request from STA */
- wl_add_remove_eventmsg(dev, WLC_E_PROBREQ_MSG, pbc);
- } else if (wl->ap_info->wps_ie == NULL) {
- WL_DBG((" WPS IE is added\n"));
- wl->ap_info->wps_ie = kmemdup(wps_ie, wpsie_len, GFP_KERNEL);
- /* add WLC_E_PROBREQ_MSG event to respose probe_request from STA */
- wl_add_remove_eventmsg(dev, WLC_E_PROBREQ_MSG, pbc);
- }
- /* find the RSN_IE */
- if ((wpa2_ie = bcm_parse_tlvs((u8 *)info->tail, info->tail_len,
- DOT11_MNG_RSN_ID)) != NULL) {
- WL_DBG((" WPA2 IE is found\n"));
- }
- /* find the WPA_IE */
- if ((wpa_ie = wl_cfgp2p_find_wpaie((u8 *)info->tail,
- info->tail_len)) != NULL) {
- WL_DBG((" WPA IE is found\n"));
- }
- if ((wpa_ie != NULL || wpa2_ie != NULL)) {
- if (!wl->ap_info->security_mode) {
- /* change from open mode to security mode */
- update_bss = true;
- if (wpa_ie != NULL) {
- wl->ap_info->wpa_ie = kmemdup(wpa_ie,
- wpa_ie->length + WPA_RSN_IE_TAG_FIXED_LEN,
- GFP_KERNEL);
- } else {
- wl->ap_info->rsn_ie = kmemdup(wpa2_ie,
- wpa2_ie->len + WPA_RSN_IE_TAG_FIXED_LEN,
- GFP_KERNEL);
- }
- } else if (wl->ap_info->wpa_ie) {
- /* change from WPA mode to WPA2 mode */
- if (wpa2_ie != NULL) {
- update_bss = true;
- kfree(wl->ap_info->wpa_ie);
- wl->ap_info->rsn_ie = kmemdup(wpa2_ie,
- wpa2_ie->len + WPA_RSN_IE_TAG_FIXED_LEN,
- GFP_KERNEL);
- wl->ap_info->wpa_ie = NULL;
- }
- else if (memcmp(wl->ap_info->wpa_ie,
- wpa_ie, wpa_ie->length +
- WPA_RSN_IE_TAG_FIXED_LEN)) {
- kfree(wl->ap_info->wpa_ie);
- update_bss = true;
- wl->ap_info->wpa_ie = kmemdup(wpa_ie,
- wpa_ie->length + WPA_RSN_IE_TAG_FIXED_LEN,
- GFP_KERNEL);
- wl->ap_info->rsn_ie = NULL;
- }
- } else {
- /* change from WPA2 mode to WPA mode */
- if (wpa_ie != NULL) {
- update_bss = true;
- kfree(wl->ap_info->rsn_ie);
- wl->ap_info->rsn_ie = NULL;
- wl->ap_info->wpa_ie = kmemdup(wpa_ie,
- wpa_ie->length + WPA_RSN_IE_TAG_FIXED_LEN,
- GFP_KERNEL);
- } else if (memcmp(wl->ap_info->rsn_ie,
- wpa2_ie, wpa2_ie->len + WPA_RSN_IE_TAG_FIXED_LEN)) {
- update_bss = true;
- kfree(wl->ap_info->rsn_ie);
- wl->ap_info->rsn_ie = kmemdup(wpa2_ie,
- wpa2_ie->len + WPA_RSN_IE_TAG_FIXED_LEN,
- GFP_KERNEL);
- wl->ap_info->wpa_ie = NULL;
- }
- }
- if (update_bss) {
- wl->ap_info->security_mode = true;
- wl_cfgp2p_bss(wl, dev, bssidx, 0);
- if (wl_validate_wpa2ie(dev, wpa2_ie, bssidx) < 0 ||
- wl_validate_wpaie(dev, wpa_ie, bssidx) < 0) {
- return BCME_ERROR;
- }
- wl_cfgp2p_bss(wl, dev, bssidx, 1);
- }
- }
- } else {
- WL_ERR(("No WPSIE in beacon \n"));
+ if ((err = wldev_ioctl(dev, WLC_SET_AP, &ap, sizeof(s32), true)) < 0) {
+ WL_ERR(("setting AP mode failed %d \n", err));
+ err = -ENOTSUPP;
+ goto exit;
+ }
+
+ err = wldev_ioctl(dev, WLC_UP, &ap, sizeof(s32), true);
+ if (unlikely(err)) {
+ WL_ERR(("WLC_UP error (%d)\n", err));
+ err = -EINVAL;
+ goto exit;
}
+
+ wl_clr_drv_status(wl, AP_CREATED, dev);
+ /* Turn on the MPC */
+ wldev_iovar_setint(dev, "mpc", 1);
+ } else {
+ WL_DBG(("Stopping P2P GO \n"));
}
+
exit:
- if (err)
+ return err;
+}
+static s32
+wl_cfg80211_del_station(
+ struct wiphy *wiphy,
+ struct net_device *ndev,
+ u8* mac_addr)
+{
+ struct net_device *dev;
+ struct wl_priv *wl = wiphy_priv(wiphy);
+ scb_val_t scb_val;
+ s8 eabuf[ETHER_ADDR_STR_LEN];
+
+ WL_DBG(("Entry\n"));
+ if (mac_addr == NULL) {
+ WL_DBG(("mac_addr is NULL ignore it\n"));
+ return 0;
+ }
+
+ if (ndev == wl->p2p_net) {
+ dev = wl_to_prmry_ndev(wl);
+ } else {
+ dev = ndev;
+ }
+
+ if (p2p_is_on(wl)) {
+ /* Suspend P2P discovery search-listen to prevent it from changing the
+ * channel.
+ */
+ if ((wl_cfgp2p_discover_enable_search(wl, false)) < 0) {
+ WL_ERR(("Can not disable discovery mode\n"));
+ return -EFAULT;
+ }
+ }
+
+ memcpy(scb_val.ea.octet, mac_addr, ETHER_ADDR_LEN);
+ scb_val.val = DOT11_RC_DEAUTH_LEAVING;
+ wldev_ioctl(dev, WLC_SCB_DEAUTHENTICATE_FOR_REASON, &scb_val,
+ sizeof(scb_val_t), true);
+ WL_DBG(("Disconnect STA : %s scb_val.val %d\n",
+ bcm_ether_ntoa((const struct ether_addr *)mac_addr, eabuf),
+ scb_val.val));
+ wl_delay(400);
+ return 0;
+}
+
+static s32
+wl_cfg80211_change_beacon(
+ struct wiphy *wiphy,
+ struct net_device *dev,
+ struct cfg80211_beacon_data *info)
+{
+ s32 err = BCME_OK;
+ struct wl_priv *wl = wiphy_priv(wiphy);
+ struct parsed_ies ies;
+ u32 dev_role = 0;
+ s32 bssidx = 0;
+
+ WL_DBG(("Enter \n"));
+
+ if (dev == wl_to_prmry_ndev(wl)) {
+ dev_role = NL80211_IFTYPE_AP;
+ } else if (dev == wl->p2p_net) {
+ /* Group Add request on p2p0 */
+ dev = wl_to_prmry_ndev(wl);
+ dev_role = NL80211_IFTYPE_P2P_GO;
+ }
+
+ bssidx = wl_cfgp2p_find_idx(wl, dev);
+ if (p2p_is_on(wl) &&
+ (bssidx == wl_to_p2p_bss_bssidx(wl,
+ P2PAPI_BSSCFG_CONNECTION))) {
+ dev_role = NL80211_IFTYPE_P2P_GO;
+ }
+
+ /* Set IEs to FW */
+ if ((err = wl_cfg80211_parse_set_ies(dev, info,
+ &ies, dev_role, bssidx) < 0)) {
+ WL_ERR(("Set IEs failed \n"));
+ goto fail;
+ }
+
+ if (dev_role == NL80211_IFTYPE_AP) {
+ if (wl_cfg80211_hostapd_sec(dev, &ies, bssidx) < 0) {
+ WL_ERR(("Hostapd update sec failed \n"));
+ err = -EINVAL;
+ goto fail;
+ }
+ }
+
+fail:
+ return err;
+}
+#else /* LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0) */
+static s32
+wl_cfg80211_add_set_beacon(struct wiphy *wiphy, struct net_device *dev,
+ struct beacon_parameters *info)
+{
+ s32 err = BCME_OK;
+ struct wl_priv *wl = wiphy_priv(wiphy);
+ s32 ie_offset = 0;
+ s32 bssidx = 0;
+ u32 dev_role = NL80211_IFTYPE_AP;
+ struct parsed_ies ies;
+ bcm_tlv_t *ssid_ie;
+ bool pbc = 0;
+ WL_DBG(("interval (%d) dtim_period (%d) head_len (%d) tail_len (%d)\n",
+ info->interval, info->dtim_period, info->head_len, info->tail_len));
+
+ if (dev == wl_to_prmry_ndev(wl)) {
+ dev_role = NL80211_IFTYPE_AP;
+ } else if (dev == wl->p2p_net) {
+ /* Group Add request on p2p0 */
+ dev = wl_to_prmry_ndev(wl);
+ dev_role = NL80211_IFTYPE_P2P_GO;
+ }
+
+ bssidx = wl_cfgp2p_find_idx(wl, dev);
+ if (p2p_is_on(wl) &&
+ (bssidx == wl_to_p2p_bss_bssidx(wl,
+ P2PAPI_BSSCFG_CONNECTION))) {
+ dev_role = NL80211_IFTYPE_P2P_GO;
+ }
+
+ ie_offset = DOT11_MGMT_HDR_LEN + DOT11_BCN_PRB_FIXED_LEN;
+ /* find the SSID */
+ if ((ssid_ie = bcm_parse_tlvs((u8 *)&info->head[ie_offset],
+ info->head_len - ie_offset,
+ DOT11_MNG_SSID_ID)) != NULL) {
+ if (dev_role == NL80211_IFTYPE_AP) {
+ /* Store the hostapd SSID */
+ memset(&wl->hostapd_ssid.SSID[0], 0x00, 32);
+ memcpy(&wl->hostapd_ssid.SSID[0], ssid_ie->data, ssid_ie->len);
+ wl->hostapd_ssid.SSID_len = ssid_ie->len;
+ } else {
+ /* P2P GO */
+ memset(&wl->p2p->ssid.SSID[0], 0x00, 32);
+ memcpy(wl->p2p->ssid.SSID, ssid_ie->data, ssid_ie->len);
+ wl->p2p->ssid.SSID_len = ssid_ie->len;
+ }
+ }
+
+ if (wl_cfg80211_parse_ies((u8 *)info->tail,
+ info->tail_len, &ies) < 0) {
+ WL_ERR(("Beacon get IEs failed \n"));
+ err = -EINVAL;
+ goto fail;
+ }
+
+ if (wl_cfgp2p_set_management_ie(wl, dev, bssidx,
+ VNDR_IE_BEACON_FLAG, (u8 *)info->tail,
+ info->tail_len) < 0) {
+ WL_ERR(("Beacon set IEs failed \n"));
+ goto fail;
+ } else {
+ WL_DBG(("Applied Vndr IEs for Beacon \n"));
+ }
+ if (!wl_cfgp2p_bss_isup(dev, bssidx) &&
+ (wl_cfg80211_bcn_validate_sec(dev, &ies, dev_role, bssidx) < 0))
+ {
+ WL_ERR(("Beacon set security failed \n"));
+ goto fail;
+ }
+
+ /* Set BI and DTIM period */
+ if (info->interval) {
+ if ((err = wldev_ioctl(dev, WLC_SET_BCNPRD,
+ &info->interval, sizeof(s32), true)) < 0) {
+ WL_ERR(("Beacon Interval Set Error, %d\n", err));
+ return err;
+ }
+ }
+ if (info->dtim_period) {
+ if ((err = wldev_ioctl(dev, WLC_SET_DTIMPRD,
+ &info->dtim_period, sizeof(s32), true)) < 0) {
+ WL_ERR(("DTIM Interval Set Error, %d\n", err));
+ return err;
+ }
+ }
+
+ if (wl_cfg80211_bcn_bringup_ap(dev, &ies, dev_role, bssidx) < 0) {
+ WL_ERR(("Beacon bring up AP/GO failed \n"));
+ goto fail;
+ }
+
+ if (wl_get_drv_status(wl, AP_CREATED, dev)) {
+ /* Soft AP already running. Update changed params */
+ if (wl_cfg80211_hostapd_sec(dev, &ies, bssidx) < 0) {
+ WL_ERR(("Hostapd update sec failed \n"));
+ err = -EINVAL;
+ goto fail;
+ }
+ }
+
+ /* Enable Probe Req filter */
+ if (((dev_role == NL80211_IFTYPE_P2P_GO) ||
+ (dev_role == NL80211_IFTYPE_AP)) && (ies.wps_ie != NULL)) {
+ wl_validate_wps_ie((char *) ies.wps_ie, ies.wps_ie_len, &pbc);
+ if (pbc)
+ wl_add_remove_eventmsg(dev, WLC_E_PROBREQ_MSG, true);
+ }
+
+ WL_DBG(("** ADD/SET beacon done **\n"));
+
+fail:
+ if (err) {
+ WL_ERR(("ADD/SET beacon failed\n"));
wldev_iovar_setint(dev, "mpc", 1);
+ }
return err;
+
}
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0) */
static struct cfg80211_ops wl_cfg80211_ops = {
.add_virtual_intf = wl_cfg80211_add_virtual_iface,
@@ -5460,8 +5902,15 @@ static struct cfg80211_ops wl_cfg80211_ops = {
.mgmt_frame_register = wl_cfg80211_mgmt_frame_register,
.change_bss = wl_cfg80211_change_bss,
.set_channel = wl_cfg80211_set_channel,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0)
.set_beacon = wl_cfg80211_add_set_beacon,
.add_beacon = wl_cfg80211_add_set_beacon,
+#else
+ .change_beacon = wl_cfg80211_change_beacon,
+ .start_ap = wl_cfg80211_start_ap,
+ .stop_ap = wl_cfg80211_stop_ap,
+ .del_station = wl_cfg80211_del_station,
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0) */
};
s32 wl_mode_to_nl80211_iftype(s32 mode)
@@ -5499,10 +5948,13 @@ static s32 wl_setup_wiphy(struct wireless_dev *wdev, struct device *sdiofunc_dev
wdev->wiphy->max_num_pmkids = WL_NUM_PMKIDS_MAX;
wdev->wiphy->interface_modes =
BIT(NL80211_IFTYPE_STATION)
- | BIT(NL80211_IFTYPE_AP) | BIT(NL80211_IFTYPE_MONITOR);
+#if !(defined(WLP2P) && defined(WL_ENABLE_P2P_IF))
+ | BIT(NL80211_IFTYPE_MONITOR)
+#endif
+ | BIT(NL80211_IFTYPE_AP);
wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = &__wl_band_2ghz;
- wdev->wiphy->bands[IEEE80211_BAND_5GHZ] = &__wl_band_5ghz_a;
+
wdev->wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
wdev->wiphy->cipher_suites = __wl_cipher_suites;
wdev->wiphy->n_cipher_suites = ARRAY_SIZE(__wl_cipher_suites);
@@ -5519,9 +5971,29 @@ static s32 wl_setup_wiphy(struct wireless_dev *wdev, struct device *sdiofunc_dev
WIPHY_FLAG_SUPPORTS_SEPARATE_DEFAULT_KEYS |
#endif
WIPHY_FLAG_4ADDR_STATION;
+ /* If driver advertises FW_ROAM, the supplicant wouldn't
+ * send the BSSID & Freq in the connect command allowing the
+ * the driver to choose the AP to connect to. But unless we
+ * support ROAM_CACHE in firware this will delay the ASSOC as
+ * as the FW need to do a full scan before attempting to connect
+ * So that feature will just increase assoc. The better approach
+ * to let Supplicant to provide channel info and FW letter may roam
+ * if needed so DON'T advertise that featur eto Supplicant.
+ */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)
- wdev->wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM;
+/* wdev->wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM; */
#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)
+ wdev->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL |
+ WIPHY_FLAG_OFFCHAN_TX;
+#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)
+ /* From 3.4 kernel ownards AP_SME flag can be advertised
+ * to remove the patch from supplicant
+ */
+ wdev->wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME;
+#endif
+
WL_DBG(("Registering custom regulatory)\n"));
wdev->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY;
wiphy_apply_custom_regulatory(wdev->wiphy, &brcm_regdom);
@@ -5549,8 +6021,8 @@ static void wl_free_wdev(struct wl_priv *wl)
wl_delete_all_netinfo(wl);
wiphy_free(wiphy);
/* PLEASE do NOT call any function after wiphy_free, the driver's private structure "wl",
- * which is the private part of wiphy, has been freed in wiphy_free !!!!!!!!!!!
- */
+ * which is the private part of wiphy, has been freed in wiphy_free !!!!!!!!!!!
+ */
}
static s32 wl_inform_bss(struct wl_priv *wl)
@@ -5580,13 +6052,13 @@ static s32 wl_inform_bss(struct wl_priv *wl)
return err;
}
-static s32 wl_inform_single_bss(struct wl_priv *wl, struct wl_bss_info *bi, u8 is_roam_done)
+static s32 wl_inform_single_bss(struct wl_priv *wl, struct wl_bss_info *bi, u8 roam_done_flag)
{
- struct wiphy *wiphy = wiphy_from_scan(wl);
+ struct wiphy *wiphy = wl_to_wiphy(wl);
struct ieee80211_mgmt *mgmt;
struct ieee80211_channel *channel;
struct ieee80211_supported_band *band;
- struct wl_cfg80211_bss_info *notif_bss_info = NULL;
+ struct wl_cfg80211_bss_info *notif_bss_info;
struct wl_scan_req *sr = wl_to_sr(wl);
struct beacon_proberesp *beacon_proberesp;
struct cfg80211_bss *cbss = NULL;
@@ -5594,8 +6066,8 @@ static s32 wl_inform_single_bss(struct wl_priv *wl, struct wl_bss_info *bi, u8 i
s32 signal;
u32 freq;
s32 err = 0;
- u8 * ie_offset = NULL;
gfp_t aflags;
+ u8 *ie_offset=NULL;
if (unlikely(dtoh32(bi->length) > WL_BSS_INFO_MAX)) {
WL_DBG(("Beacon is larger than buffer. Discarding\n"));
@@ -5610,18 +6082,17 @@ static s32 wl_inform_single_bss(struct wl_priv *wl, struct wl_bss_info *bi, u8 i
}
mgmt = (struct ieee80211_mgmt *)notif_bss_info->frame_buf;
notif_bss_info->channel =
- bi->ctl_ch ? bi->ctl_ch : CHSPEC_CHANNEL(bi->chanspec);
+ bi->ctl_ch ? bi->ctl_ch : CHSPEC_CHANNEL(wl_chspec_driver_to_host(bi->chanspec));
if (notif_bss_info->channel <= CH_MAX_2G_CHANNEL)
band = wiphy->bands[IEEE80211_BAND_2GHZ];
else
band = wiphy->bands[IEEE80211_BAND_5GHZ];
-
- if(band==NULL) {
+ if (!band) {
+ WL_ERR(("No valid band"));
kfree(notif_bss_info);
- return err;
+ return -EINVAL;
}
-
notif_bss_info->rssi = dtoh16(bi->RSSI) + RSSI_OFFSET;
memcpy(mgmt->bssid, &bi->BSSID, ETHER_ADDR_LEN);
mgmt_type = wl->active_scan ?
@@ -5637,34 +6108,34 @@ static s32 wl_inform_single_bss(struct wl_priv *wl, struct wl_bss_info *bi, u8 i
beacon_proberesp->capab_info = cpu_to_le16(bi->capability);
wl_rst_ie(wl);
+#define WLAN_EID_SSID 0
ie_offset = ((u8 *) bi) + bi->ie_offset;
- if (is_roam_done && ((int)(*(ie_offset)) == WLAN_EID_SSID &&
- ((int)(*(ie_offset+1)) == 0 || (int)(*(ie_offset+2)) == 0))) {
- u8 *ie_new_offset = NULL;
- uint8 ie_new_length;
-
- WL_ERR(("WAR trace: Changing the SSID Info, from beacon %d\n", bi->flags & WL_BSS_FLAGS_FROM_BEACON));
-
- ie_new_offset = (u8 *)kzalloc(WL_BSS_INFO_MAX, GFP_KERNEL);
- if (ie_new_offset) {
- *(ie_new_offset) = WLAN_EID_SSID;
- *(ie_new_offset+1) = bi->SSID_len;
- memcpy(ie_new_offset+2, bi->SSID, bi->SSID_len);
- ie_new_length = bi->ie_length - *(ie_offset+1) + bi->SSID_len;
-
- /* Copy the remaining IE apart from SSID IE from bi */
- memcpy( ie_new_offset+2 + bi->SSID_len,
- ie_offset+2 + *(ie_offset+1),
- bi->ie_length - 2 - *(ie_offset+1));
- wl_mrg_ie(wl, ie_new_offset , ie_new_length);
- kfree(ie_new_offset);
- } else {
- wl_mrg_ie(wl, ((u8 *) bi) + bi->ie_offset, bi->ie_length);
- }
- } else {
- wl_mrg_ie(wl, ((u8 *) bi) + bi->ie_offset, bi->ie_length);
- }
+ if ( roam_done_flag && ((int)(*(ie_offset)) == WLAN_EID_SSID && ((int)(*(ie_offset+1)) == 0 || (int)(*(ie_offset+2)) == 0))) {
+ u8 *ie_new_offset = NULL;
+ uint8 ie_new_length;
+
+ WL_ERR(("Changing the SSID Info\n"));
+
+ ie_new_offset = (u8 *)kzalloc(WL_BSS_INFO_MAX, GFP_KERNEL);
+ if (ie_new_offset) {
+ *(ie_new_offset) = WLAN_EID_SSID;
+ *(ie_new_offset+1) = bi->SSID_len;
+ memcpy(ie_new_offset+2, bi->SSID, bi->SSID_len);
+ ie_new_length = bi->ie_length - *(ie_offset+1) + bi->SSID_len;
+
+ /* Copy the remaining IE apart from SSID IE from bi */
+ memcpy( ie_new_offset+2 + bi->SSID_len,
+ ie_offset+2 + *(ie_offset+1),
+ bi->ie_length - 2 - *(ie_offset+1));
+ wl_mrg_ie(wl, ie_new_offset , ie_new_length);
+ kfree(ie_new_offset);
+ } else {
+ wl_mrg_ie(wl, ((u8 *) bi) + bi->ie_offset, bi->ie_length);
+ }
+ } else {
+ wl_mrg_ie(wl, ((u8 *) bi) + bi->ie_offset, bi->ie_length);
+ }
wl_cp_ie(wl, beacon_proberesp->variable, WL_BSS_INFO_MAX -
offsetof(struct wl_cfg80211_bss_info, frame_buf));
@@ -5676,23 +6147,41 @@ static s32 wl_inform_single_bss(struct wl_priv *wl, struct wl_bss_info *bi, u8 i
#else
freq = ieee80211_channel_to_frequency(notif_bss_info->channel, band->band);
#endif
+ if (freq == 0) {
+ WL_ERR(("Invalid channel, fail to chcnage channel to freq\n"));
+ kfree(notif_bss_info);
+ return -EINVAL;
+ }
channel = ieee80211_get_channel(wiphy, freq);
if (unlikely(!channel)) {
WL_ERR(("ieee80211_get_channel error\n"));
kfree(notif_bss_info);
- return EINVAL;
+ return -EINVAL;
}
-
WL_DBG(("SSID : \"%s\", rssi %d, channel %d, capability : 0x04%x, bssid %pM"
- "mgmt_type %d frame_len %d\n", bi->SSID,
+ "mgmt_type 0x%x, mgmt->frame_control=0x%x, frame_len %d\n", bi->SSID,
notif_bss_info->rssi, notif_bss_info->channel,
- mgmt->u.beacon.capab_info, &bi->BSSID, mgmt_type,
+ mgmt->u.beacon.capab_info, &bi->BSSID, mgmt_type,mgmt->frame_control,
notif_bss_info->frame_len));
signal = notif_bss_info->rssi * 100;
+ if (!mgmt->u.probe_resp.timestamp) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
+ struct timespec ts;
+ get_monotonic_boottime(&ts);
+ mgmt->u.probe_resp.timestamp = ((u64)ts.tv_sec*1000000)
+ + ts.tv_nsec / 1000;
+#else
+ struct timeval tv;
+ do_gettimeofday(&tv);
+ mgmt->u.probe_resp.timestamp = ((u64)tv.tv_sec*1000000)
+ + tv.tv_usec;
+#endif
+ }
+
cbss = cfg80211_inform_bss_frame(wiphy, channel, mgmt,
- le16_to_cpu(notif_bss_info->frame_len), signal, GFP_KERNEL);
+ le16_to_cpu(notif_bss_info->frame_len), signal, aflags);
if (unlikely(!cbss)) {
WL_ERR(("cfg80211_inform_bss_frame error\n"));
kfree(notif_bss_info);
@@ -5701,7 +6190,6 @@ static s32 wl_inform_single_bss(struct wl_priv *wl, struct wl_bss_info *bi, u8 i
cfg80211_put_bss(cbss);
kfree(notif_bss_info);
-
return err;
}
@@ -5711,7 +6199,7 @@ static bool wl_is_linkup(struct wl_priv *wl, const wl_event_msg_t *e, struct net
u32 status = ntoh32(e->status);
u16 flags = ntoh16(e->flags);
- WL_DBG(("event %d, status %d\n", event, status));
+ WL_DBG(("event %d, status %d flags %x\n", event, status, flags));
if (event == WLC_E_SET_SSID) {
if (status == WLC_E_STATUS_SUCCESS) {
if (!wl_is_ibssmode(wl, ndev))
@@ -5735,10 +6223,17 @@ static bool wl_is_linkdown(struct wl_priv *wl, const wl_event_msg_t *e)
event == WLC_E_DISASSOC_IND ||
event == WLC_E_DISASSOC ||
event == WLC_E_DEAUTH) {
+#if (WL_DBG_LEVEL > 0)
+ WL_ERR(("Link down Reason : WLC_E_%s\n", wl_dbg_estr[event]));
+#endif /* (WL_DBG_LEVEL > 0) */
return true;
} else if (event == WLC_E_LINK) {
- if (!(flags & WLC_EVENT_MSG_LINK))
+ if (!(flags & WLC_EVENT_MSG_LINK)) {
+#if (WL_DBG_LEVEL > 0)
+ WL_ERR(("Link down Reason : WLC_E_%s\n", wl_dbg_estr[event]));
+#endif /* (WL_DBG_LEVEL > 0) */
return true;
+ }
}
return false;
@@ -5759,11 +6254,9 @@ static bool wl_is_nonetwork(struct wl_priv *wl, const wl_event_msg_t *e)
/* The mainline kernel >= 3.2.0 has support for indicating new/del station
* to AP/P2P GO via events. If this change is backported to kernel for which
- * this driver is being built, set CFG80211_STA_EVENT_AVAILABLE to 1. You
- * should use this new/del sta event mechanism for BRCM supplicant from BRANCH
- * HOSTAP_BRANCH_0_15 (ver >= 15_1).
+ * this driver is being built, then define WL_CFG80211_STA_EVENT. You
+ * should use this new/del sta event mechanism for BRCM supplicant >= 22.
*/
-#define CFG80211_STA_EVENT_AVAILABLE 0
static s32
wl_notify_connect_status_ap(struct wl_priv *wl, struct net_device *ndev,
const wl_event_msg_t *e, void *data)
@@ -5773,14 +6266,15 @@ wl_notify_connect_status_ap(struct wl_priv *wl, struct net_device *ndev,
u32 reason = ntoh32(e->reason);
u32 len = ntoh32(e->datalen);
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0)) && !CFG80211_STA_EVENT_AVAILABLE
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0)) && !defined(WL_CFG80211_STA_EVENT)
bool isfree = false;
u8 *mgmt_frame;
u8 bsscfgidx = e->bsscfgidx;
s32 freq;
s32 channel;
- u8 *body=NULL;
+ u8 *body = NULL;
u16 fc = 0;
+
struct ieee80211_supported_band *band;
struct ether_addr da;
struct ether_addr bssid;
@@ -5788,7 +6282,7 @@ wl_notify_connect_status_ap(struct wl_priv *wl, struct net_device *ndev,
channel_info_t ci;
#else
struct station_info sinfo;
-#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0)) && !CFG80211_STA_EVENT_AVAILABLE */
+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0)) && !WL_CFG80211_STA_EVENT */
/* if link down, bsscfg is disabled. */
if (event == WLC_E_LINK && reason == WLC_E_LINK_BSSCFG_DIS &&
@@ -5798,29 +6292,30 @@ wl_notify_connect_status_ap(struct wl_priv *wl, struct net_device *ndev,
return 0;
}
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0)) && !CFG80211_STA_EVENT_AVAILABLE
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0)) && !defined(WL_CFG80211_STA_EVENT)
+ body = kzalloc(len, GFP_KERNEL);
WL_DBG(("Enter \n"));
if (!len && (event == WLC_E_DEAUTH)) {
len = 2; /* reason code field */
data = &reason;
}
if (len) {
- body=kzalloc(len, GFP_KERNEL);
+ body = kzalloc(len, GFP_KERNEL);
- if(body==NULL) {
- WL_ERR(("wl_notify_connect_status: Failed to allocate body\n"));
- return WL_INVALID;
- }
+ if (body == NULL) {
+ WL_ERR(("wl_notify_connect_status: Failed to allocate body\n"));
+ return WL_INVALID;
+ }
}
memset(&bssid, 0, ETHER_ADDR_LEN);
- WL_DBG(("Enter \n"));
+ WL_DBG(("Enter event %d ndev %p\n", event, ndev));
if (wl_get_mode_by_netdev(wl, ndev) == WL_INVALID) {
kfree(body);
return WL_INVALID;
}
if (len)
- memcpy(body, data, len);
-
+ memcpy(body, data, len);
+
wldev_iovar_getbuf_bsscfg(ndev, "cur_etheraddr",
NULL, 0, wl->ioctl_buf, WLC_IOCTL_SMLEN, bsscfgidx, &wl->ioctl_buf_sync);
memcpy(da.octet, wl->ioctl_buf, ETHER_ADDR_LEN);
@@ -5846,7 +6341,7 @@ wl_notify_connect_status_ap(struct wl_priv *wl, struct net_device *ndev,
goto exit;
}
if ((err = wldev_ioctl(ndev, WLC_GET_CHANNEL, &ci, sizeof(ci), false))) {
- kfree (body);
+ kfree(body);
return err;
}
@@ -5855,11 +6350,11 @@ wl_notify_connect_status_ap(struct wl_priv *wl, struct net_device *ndev,
band = wiphy->bands[IEEE80211_BAND_2GHZ];
else
band = wiphy->bands[IEEE80211_BAND_5GHZ];
-
- if(band == NULL) {
- WL_ERR(("band is null(channel=%d)\n", channel));
- kfree(body);
- return WL_INVALID;
+ if (!band) {
+ WL_ERR(("No valid band"));
+ if (body)
+ kfree(body);
+ return -EINVAL;
}
#if LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 38) && !defined(WL_COMPAT_WIRELESS)
freq = ieee80211_channel_to_frequency(channel);
@@ -5869,17 +6364,29 @@ wl_notify_connect_status_ap(struct wl_priv *wl, struct net_device *ndev,
#endif
err = wl_frame_get_mgmt(fc, &da, &e->addr, &bssid,
- &mgmt_frame, &len, body);
+ &mgmt_frame, &len, body);
if (err < 0)
- goto exit;
+ goto exit;
isfree = true;
if (event == WLC_E_ASSOC_IND && reason == DOT11_SC_SUCCESS) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)
+ cfg80211_rx_mgmt(ndev, freq, 0, mgmt_frame, len, GFP_ATOMIC);
+#else
cfg80211_rx_mgmt(ndev, freq, mgmt_frame, len, GFP_ATOMIC);
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) */
} else if (event == WLC_E_DISASSOC_IND) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)
+ cfg80211_rx_mgmt(ndev, freq, 0, mgmt_frame, len, GFP_ATOMIC);
+#else
cfg80211_rx_mgmt(ndev, freq, mgmt_frame, len, GFP_ATOMIC);
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) */
} else if ((event == WLC_E_DEAUTH_IND) || (event == WLC_E_DEAUTH)) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)
+ cfg80211_rx_mgmt(ndev, freq, 0, mgmt_frame, len, GFP_ATOMIC);
+#else
cfg80211_rx_mgmt(ndev, freq, mgmt_frame, len, GFP_ATOMIC);
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) */
}
exit:
@@ -5888,7 +6395,7 @@ exit:
if (body)
kfree(body);
return err;
-#else /* LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0) && !CFG80211_STA_EVENT_AVAILABLE */
+#else /* LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0) && !WL_CFG80211_STA_EVENT */
sinfo.filled = 0;
if (((event == WLC_E_ASSOC_IND) || (event == WLC_E_REASSOC_IND)) &&
reason == DOT11_SC_SUCCESS) {
@@ -5905,11 +6412,32 @@ exit:
} else if ((event == WLC_E_DEAUTH_IND) || (event == WLC_E_DEAUTH)) {
cfg80211_del_sta(ndev, e->addr.octet, GFP_ATOMIC);
}
-#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0) && !CFG80211_STA_EVENT_AVAILABLE */
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0) && !WL_CFG80211_STA_EVENT */
return err;
}
static s32
+wl_get_auth_assoc_status(struct wl_priv *wl, struct net_device *ndev,
+ const wl_event_msg_t *e)
+{
+ u32 reason = ntoh32(e->reason);
+ u32 event = ntoh32(e->event_type);
+ struct wl_security *sec = wl_read_prof(wl, ndev, WL_PROF_SEC);
+ WL_DBG(("event type : %d, reason : %d\n", event, reason));
+ if (sec) {
+ switch (event) {
+ case WLC_E_ASSOC:
+ case WLC_E_AUTH:
+ sec->auth_assoc_res_status = reason;
+ default:
+ break;
+ }
+ } else
+ WL_ERR(("sec is NULL\n"));
+ return 0;
+}
+
+static s32
wl_notify_connect_status(struct wl_priv *wl, struct net_device *ndev,
const wl_event_msg_t *e, void *data)
{
@@ -5920,12 +6448,11 @@ wl_notify_connect_status(struct wl_priv *wl, struct net_device *ndev,
if (wl_get_mode_by_netdev(wl, ndev) == WL_MODE_AP) {
wl_notify_connect_status_ap(wl, ndev, e, data);
} else {
- WL_DBG(("wl_notify_connect_status : event %d status : %d \n",
- ntoh32(e->event_type), ntoh32(e->status)));
- /* chanyun TBD from DHD 15 no p2p firmware exist should change to interface */
- if (strstr(fw_path, "_p2p") == NULL && event == WLC_E_DEAUTH) {
- WL_DBG(("unexpected event WLC_E_DEAUTH\n"));
- return WL_INVALID;
+ WL_DBG(("wl_notify_connect_status : event %d status : %d ndev %p\n",
+ ntoh32(e->event_type), ntoh32(e->status), ndev));
+ if (event == WLC_E_ASSOC || event == WLC_E_AUTH) {
+ wl_get_auth_assoc_status(wl, ndev, e);
+ return err;
}
if (wl_is_linkup(wl, e, ndev)) {
wl_link_up(wl);
@@ -5937,7 +6464,8 @@ wl_notify_connect_status(struct wl_priv *wl, struct net_device *ndev,
WL_DBG(("joined in IBSS network\n"));
} else {
if (!wl_get_drv_status(wl, DISCONNECTING, ndev)) {
- printk("wl_bss_connect_done succeeded\n");
+ printk("wl_bss_connect_done succeeded with " MACDBG "\n",
+ STR_TO_MACD((u8*)(&e->addr)));
wl_bss_connect_done(wl, ndev, e, data, true);
WL_DBG(("joined in BSS network \"%s\"\n",
((struct wlc_ssid *)
@@ -5949,58 +6477,53 @@ wl_notify_connect_status(struct wl_priv *wl, struct net_device *ndev,
} else if (wl_is_linkdown(wl, e)) {
if (wl->scan_request) {
- del_timer_sync(&wl->scan_timeout);
if (wl->escan_on) {
- WL_SCAN2(("link down notify escan complete: %p(%d)\n",
- ndev, wl->escan_info.cur_sync_id));
-#ifndef CUSTOMER_HW_SAMSUNG
-#error inform bss will be done at notify function
- {
- u8 temp_id = wl->escan_info.cur_sync_id;
- wl->bss_list =
- (wl_scan_results_t *)
- wl->escan_info.escan_buf[(temp_id+1)%2];
- wl_inform_bss(wl);
- }
-#endif
- wl_notify_escan_complete(wl, ndev, true);
- } else
+ wl_notify_escan_complete(wl, ndev, true, true);
+ } else {
+ del_timer_sync(&wl->scan_timeout);
wl_iscan_aborted(wl);
+ }
}
if (wl_get_drv_status(wl, CONNECTED, ndev)) {
scb_val_t scbval;
u8 *curbssid = wl_read_prof(wl, ndev, WL_PROF_BSSID);
- printk("link down, call cfg80211_disconnected. (reason=%d)\n",
- ntoh32(e->reason));
- WL_DBG(("con=%02x:%02x:%02x:%02x:%02x:%02x\n",
- curbssid[0], curbssid[1], curbssid[2],
- curbssid[3],curbssid[4], curbssid[5]));
- WL_DBG(("dis=%02x:%02x:%02x:%02x:%02x:%02x\n",
- ((u8 *)&e->addr)[0], ((u8 *)&e->addr)[1],
- ((u8 *)&e->addr)[2], ((u8 *)&e->addr)[3],
- ((u8 *)&e->addr)[4], ((u8 *)&e->addr)[5]));
-#ifdef ESCAN_RESULT_PATCH
- if (memcmp(curbssid, &e->addr, ETHER_ADDR_LEN) == 0) {
-#endif /* ESCAN_RESULT_PATCH */
- wl_clr_drv_status(wl, CONNECTED, ndev);
+ s32 reason = 0;
+ if (event == WLC_E_DEAUTH_IND || event == WLC_E_DISASSOC_IND)
+ reason = ntoh32(e->reason);
+ /* WLAN_REASON_UNSPECIFIED is used for hang up event in Android */
+ reason = (reason == WLAN_REASON_UNSPECIFIED)? 0 : reason;
+
+ printk("link down if %s may call cfg80211_disconnected. "
+ "event : %d, reason=%d from " MACDBG "\n",
+ ndev->name, event, ntoh32(e->reason),
+ STR_TO_MACD((u8*)(&e->addr)));
+ if (memcmp(curbssid, &e->addr, ETHER_ADDR_LEN) != 0) {
+ WL_ERR(("BSSID of event is not the connected BSSID"
+ "(ignore it) cur: " MACDBG " event: " MACDBG"\n",
+ STR_TO_MACD(curbssid), STR_TO_MACD((u8*)(&e->addr))));
+ return 0;
+ }
+ wl_clr_drv_status(wl, CONNECTED, ndev);
+ if (! wl_get_drv_status(wl, DISCONNECTING, ndev)) {
/* To make sure disconnect, explictly send dissassoc
* for BSSID 00:00:00:00:00:00 issue
*/
scbval.val = WLAN_REASON_DEAUTH_LEAVING;
+
memcpy(&scbval.ea, curbssid, ETHER_ADDR_LEN);
scbval.val = htod32(scbval.val);
- err =wldev_ioctl(ndev, WLC_DISASSOC, &scbval,
- sizeof(scb_val_t), true);
- if (err < 0)
- WL_ERR(("Check Assoc Status : %d\n", err));
- cfg80211_disconnected(ndev, 0, NULL, 0, GFP_KERNEL);
+ err = wldev_ioctl(ndev, WLC_DISASSOC, &scbval,
+ sizeof(scb_val_t), true);
+ if (err < 0) {
+ WL_ERR(("WLC_DISASSOC error %d\n", err));
+ err = 0;
+ }
+ cfg80211_disconnected(ndev, reason, NULL, 0, GFP_KERNEL);
wl_link_down(wl);
wl_init_prof(wl, ndev);
-#ifdef ESCAN_RESULT_PATCH
- } else
- WL_ERR(("BSSID of event is not the connected BSSID\n"));
-#endif /* ESCAN_RESULT_PATCH */
- } else if (wl_get_drv_status(wl, CONNECTING, ndev)) {
+ }
+ }
+ else if (wl_get_drv_status(wl, CONNECTING, ndev)) {
printk("link down, during connecting\n");
#ifdef ESCAN_RESULT_PATCH
if ((memcmp(connect_req_bssid, broad_bssid, ETHER_ADDR_LEN) == 0) ||
@@ -6017,20 +6540,17 @@ wl_notify_connect_status(struct wl_priv *wl, struct net_device *ndev,
complete(&wl->iface_disable);
} else if (wl_is_nonetwork(wl, e)) {
- printk("connect failed event=%d e->status 0x%x\n",
- event, (int)ntoh32(e->status));
+ printk("connect failed event=%d e->status %d e->reason %d \n",
+ event, (int)ntoh32(e->status), (int)ntoh32(e->reason));
/* Clean up any pending scan request */
-
if (wl->scan_request) {
- del_timer_sync(&wl->scan_timeout);
if (wl->escan_on) {
- WL_SCAN2((" send noti due to connect fail : %p(%d)\n",
- ndev, wl->escan_info.cur_sync_id));
- wl_notify_escan_complete(wl, ndev, true);
- } else
+ wl_notify_escan_complete(wl, ndev, true, true);
+ } else {
+ del_timer_sync(&wl->scan_timeout);
wl_iscan_aborted(wl);
+ }
}
-
if (wl_get_drv_status(wl, CONNECTING, ndev))
wl_bss_connect_done(wl, ndev, e, data, false);
} else {
@@ -6078,8 +6598,6 @@ static s32 wl_get_assoc_ies(struct wl_priv *wl, struct net_device *ndev)
assoc_info.req_len = htod32(assoc_info.req_len);
assoc_info.resp_len = htod32(assoc_info.resp_len);
assoc_info.flags = htod32(assoc_info.flags);
- WL_DBG(("assoc info: %d %d %d\n", assoc_info.req_len,
- assoc_info.resp_len, assoc_info.flags));
if (conn_info->req_ie_len) {
conn_info->req_ie_len = 0;
bzero(conn_info->req_ie, sizeof(conn_info->req_ie));
@@ -6144,7 +6662,7 @@ static void wl_ch_to_chanspec(int ch, struct wl_join_params *join_params,
int n_channels;
n_channels = get_roam_channel_list(ch, join_params->params.chanspec_list,
- &join_params->ssid);
+ &join_params->ssid, ioctl_version);
join_params->params.chanspec_num = htod32(n_channels);
*join_params_size += WL_ASSOC_PARAMS_FIXED_SIZE +
join_params->params.chanspec_num * sizeof(chanspec_t);
@@ -6170,15 +6688,15 @@ static void wl_ch_to_chanspec(int ch, struct wl_join_params *join_params,
join_params->params.chanspec_num =
htod32(join_params->params.chanspec_num);
+
#endif /* ROAM_CHANNEL_CACHE */
WL_DBG(("join_params->params.chanspec_list[0]= %X, %d channels\n",
join_params->params.chanspec_list[0],
join_params->params.chanspec_num));
-
}
}
-static s32 wl_update_bss_info(struct wl_priv *wl, struct net_device *ndev, u8 is_roam_done)
+static s32 wl_update_bss_info(struct wl_priv *wl, struct net_device *ndev, u8 roam_done_flag)
{
struct cfg80211_bss *bss;
struct wl_bss_info *bi;
@@ -6218,7 +6736,7 @@ static s32 wl_update_bss_info(struct wl_priv *wl, struct net_device *ndev, u8 is
err = -EIO;
goto update_bss_info_out;
}
- err = wl_inform_single_bss(wl, bi, is_roam_done);
+ err = wl_inform_single_bss(wl, bi, roam_done_flag);
if (unlikely(err))
goto update_bss_info_out;
@@ -6271,8 +6789,14 @@ wl_bss_roaming_done(struct wl_priv *wl, struct net_device *ndev,
curbssid = wl_read_prof(wl, ndev, WL_PROF_BSSID);
wl_update_bss_info(wl, ndev, 1);
wl_update_pmklist(ndev, wl->pmk_list, err);
+ printk("wl_bss_roaming_done succeeded to " MACDBG "\n",
+ STR_TO_MACD((u8*)(&e->addr)));
+
cfg80211_roamed(ndev,
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)
+ NULL, /* struct cfg80211_bss *bss */
+#elif LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)
NULL,
#endif
curbssid,
@@ -6290,15 +6814,21 @@ wl_bss_connect_done(struct wl_priv *wl, struct net_device *ndev,
const wl_event_msg_t *e, void *data, bool completed)
{
struct wl_connect_info *conn_info = wl_to_conn(wl);
+ struct wl_security *sec = wl_read_prof(wl, ndev, WL_PROF_SEC);
+#ifdef ROAM_AP_ENV_DETECTION
dhd_pub_t *dhd = (dhd_pub_t *)(wl->pub);
+#endif /* ROAM_AP_ENV_DETECTION */
s32 err = 0;
u8 *curbssid = wl_read_prof(wl, ndev, WL_PROF_BSSID);
-
- WL_DBG((" Enter\n"));
+ if (!sec) {
+ WL_ERR(("sec is NULL\n"));
+ }
+ WL_DBG((" enter\n"));
#ifdef ESCAN_RESULT_PATCH
if (wl_get_drv_status(wl, CONNECTED, ndev)) {
if (memcmp(curbssid, connect_req_bssid, ETHER_ADDR_LEN) == 0) {
- WL_ERR((" Connected event of connected device, ignore it\n"));
+ WL_ERR((" Connected event of connected device e=%d s=%d, ignore it\n",
+ ntoh32(e->event_type), ntoh32(e->status)));
return err;
}
}
@@ -6308,34 +6838,30 @@ wl_bss_connect_done(struct wl_priv *wl, struct net_device *ndev,
memcpy(curbssid, connect_req_bssid, ETHER_ADDR_LEN);
}
- WL_SCAN2(("Connect done \n"));
#if defined(BCM4334_CHIP)
if (wl->scan_request) {
- WL_SCAN2(("Abort scan : %p(%d)\n", ndev, wl->escan_info.cur_sync_id));
- wl_cfg80211_scan_abort(wl, ndev);
+ wl_notify_escan_complete(wl, ndev, true, true);
}
#endif
#else
if (wl->scan_request) {
- WL_SCAN2(("Abort scan : %p(%d)\n", ndev, wl->escan_info.cur_sync_id));
- wl_cfg80211_scan_abort(wl, ndev);
+ wl_notify_escan_complete(wl, ndev, true, true);
}
#endif /* ESCAN_RESULT_PATCH */
if (wl_get_drv_status(wl, CONNECTING, ndev)) {
wl_clr_drv_status(wl, CONNECTING, ndev);
if (completed) {
- err = wl_get_assoc_ies(wl, ndev);
- if (err) {
- WL_DBG(("no assoc ies\n"));
- err = 0;
- }
+ wl_get_assoc_ies(wl, ndev);
wl_update_prof(wl, ndev, NULL, (void *)(e->addr.octet), WL_PROF_BSSID);
curbssid = wl_read_prof(wl, ndev, WL_PROF_BSSID);
wl_update_bss_info(wl, ndev, 0);
wl_update_pmklist(ndev, wl->pmk_list, err);
wl_set_drv_status(wl, CONNECTED, ndev);
+#ifdef ROAM_AP_ENV_DETECTION
if (dhd->roam_env_detection)
- wldev_iovar_setint(ndev, "roam_env_detection", AP_ENV_INDETERMINATE);
+ wldev_iovar_setint(ndev, "roam_env_detection",
+ AP_ENV_INDETERMINATE);
+#endif /* ROAM_AP_ENV_DETECTION */
}
cfg80211_connect_result(ndev,
curbssid,
@@ -6343,18 +6869,16 @@ wl_bss_connect_done(struct wl_priv *wl, struct net_device *ndev,
conn_info->req_ie_len,
conn_info->resp_ie,
conn_info->resp_ie_len,
- completed ? WLAN_STATUS_SUCCESS : WLAN_STATUS_AUTH_TIMEOUT,
+ completed ? WLAN_STATUS_SUCCESS :
+ (sec->auth_assoc_res_status) ?
+ sec->auth_assoc_res_status :
+ WLAN_STATUS_UNSPECIFIED_FAILURE,
GFP_KERNEL);
if (completed)
- WL_SCAN2(("Report connect result - connection succeeded(%d)\n",
- conn_info->resp_ie_len));
+ WL_INFO(("Report connect result - connection succeeded\n"));
else
WL_ERR(("Report connect result - connection failed\n"));
}
-#ifdef ESCAN_RESULT_PATCH
- else
- WL_DBG(("wl_bss_connect_done : do nothing\n"));
-#endif /* ESCAN_RESULT_PATCH */
return err;
}
@@ -6432,12 +6956,9 @@ scan_done_out:
if (wl->scan_request) {
cfg80211_scan_done(wl->scan_request, false);
wl->scan_request = NULL;
- spin_unlock_irqrestore(&wl->cfgdrv_lock, flags);
- WL_DBG(("cfg80211_scan_done\n"));
- WL_SCAN2(("Remove Scan Request %p, %d\n", ndev, wl->escan_info.cur_sync_id));
- } else {
- spin_unlock_irqrestore(&wl->cfgdrv_lock, flags);
}
+ spin_unlock_irqrestore(&wl->cfgdrv_lock, flags);
+ WL_DBG(("cfg80211_scan_done\n"));
mutex_unlock(&wl->usr_sync);
return err;
}
@@ -6485,25 +7006,124 @@ wl_frame_get_mgmt(u16 fc, const struct ether_addr *da,
}
#ifdef WL_CFG80211_GON_COLLISION
-static bool
-wl_is_gon_req_collision(struct wl_priv *wl, wl_action_frame_t *tx_act_frm,
- wifi_p2p_pub_act_frame_t *rx_act_frm)
+static void
+wl_gon_req_collision(struct wl_priv *wl, wl_action_frame_t *tx_act_frm,
+ wifi_p2p_pub_act_frame_t *rx_act_frm, struct net_device *ndev,
+ struct ether_addr sa, struct ether_addr da)
{
- if (tx_act_frm && wl_cfgp2p_is_pub_action(tx_act_frm->data, tx_act_frm->len)) {
+ if (wl->afx_hdl->pending_tx_act_frm == NULL)
+ return;
+
+ if (tx_act_frm &&
+ wl_cfgp2p_is_pub_action(tx_act_frm->data, tx_act_frm->len)) {
wifi_p2p_pub_act_frame_t *pact_frm;
pact_frm = (wifi_p2p_pub_act_frame_t *)tx_act_frm->data;
- if (pact_frm->subtype == P2P_PAF_GON_REQ &&
- rx_act_frm->subtype == P2P_PAF_GON_REQ) {
- WL_ERR((" GO NEGO Request COLLISION !!! \n"));
- return true;
+ if (!(pact_frm->subtype == P2P_PAF_GON_REQ &&
+ rx_act_frm->subtype == P2P_PAF_GON_REQ)) {
+ return;
}
}
- return false;
+
+ WL_ERR((" GO NEGO Request COLLISION !!! \n"));
+
+ /* if sa(peer) addr is less than da(my) addr,
+ * my device will process peer's gon request and block to send my gon req.
+ *
+ * if not (sa addr > da addr),
+ * my device will process gon request and drop gon req of peer.
+ */
+ if (memcmp(sa.octet, da.octet, ETHER_ADDR_LEN) < 0) {
+ /* block to send tx gon request */
+ wl->block_gon_req_tx_count = BLOCK_GON_REQ_MAX_NUM;
+ WL_ERR((" block to send gon req tx !!!\n"));
+
+ /* if we are finding a common channel for sending af,
+ * do not scan more to block to send current gon req
+ */
+ if (wl_get_drv_status_all(wl, FINDING_COMMON_CHANNEL)) {
+ wl_clr_drv_status(wl, FINDING_COMMON_CHANNEL, ndev);
+ complete(&wl->act_frm_scan);
+ }
+ } else {
+ /* drop gon request of peer to process gon request by my device. */
+ WL_ERR((" drop to receive gon req rx !!! \n"));
+ wl->block_gon_req_rx_count = BLOCK_GON_REQ_MAX_NUM;
+ }
+
+ return;
}
#endif /* WL_CFG80211_GON_COLLISION */
+void
+wl_stop_wait_next_action_frame(struct wl_priv *wl, struct net_device *ndev)
+{
+ if (wl_get_drv_status_all(wl, SENDING_ACT_FRM) &&
+ (wl_get_p2p_status(wl, ACTION_TX_COMPLETED) ||
+ wl_get_p2p_status(wl, ACTION_TX_NOACK))) {
+ WL_DBG(("*** Wake UP ** abort actframe iovar\n"));
+ /* if channel is not zero, "actfame" uses off channel scan.
+ * So abort scan for off channel completion.
+ */
+ if (wl->af_sent_channel)
+ /* wl_cfg80211_scan_abort(wl, ndev); */
+ wl_notify_escan_complete(wl,
+ (ndev == wl->p2p_net) ? wl_to_prmry_ndev(wl) : ndev, true, true);
+ }
+#ifdef WL_CFG80211_SYNC_GON
+ else if (wl_get_drv_status_all(wl, WAITING_NEXT_ACT_FRM_LISTEN)) {
+ WL_DBG(("*** Wake UP ** abort listen for next af frame\n"));
+ /* So abort scan to cancel listen */
+ wl_notify_escan_complete(wl,
+ (ndev == wl->p2p_net) ? wl_to_prmry_ndev(wl) : ndev, true, true);
+ }
+#endif /* WL_CFG80211_SYNC_GON */
+}
+
+#if defined(CUSTOMER_HW4) && defined(WES_SUPPORT)
+static int wes_mode = 0;
+int wl_cfg80211_set_wes_mode(int mode)
+{
+ wes_mode = mode;
+ return 0;
+}
+
+int wl_cfg80211_get_wes_mode(void)
+{
+ return wes_mode;
+}
+
+bool wl_cfg80211_is_wes(void *frame, u32 frame_len)
+{
+ unsigned char *data;
+
+ if (frame == NULL) {
+ WL_ERR(("%s: Invalid frame \n", __FUNCTION__));
+ return false;
+ }
+
+ if (frame_len < 4) {
+ WL_ERR(("%s: Invalid frame length [%d] \n", __FUNCTION__, frame_len));
+ return false;
+ }
+
+ data = frame;
+
+ if (memcmp(data, "\x7f\x00\x00\xf0", 4) == 0) {
+ WL_DBG(("%s: Receive WES VS Action Frame \n", __FUNCTION__));
+ return true;
+ }
+
+ return false;
+}
+
+int wl_cfg80211_get_ioctl_version(void)
+{
+ return ioctl_version;
+}
+#endif /* WES_SUPPORT */
+
static s32
wl_notify_rx_mgmt_frame(struct wl_priv *wl, struct net_device *ndev,
const wl_event_msg_t *e, void *data)
@@ -6539,10 +7159,9 @@ wl_notify_rx_mgmt_frame(struct wl_priv *wl, struct net_device *ndev,
band = wiphy->bands[IEEE80211_BAND_2GHZ];
else
band = wiphy->bands[IEEE80211_BAND_5GHZ];
-
- if(band == NULL) {
- WL_ERR(("band is null(channel=%d)\n", channel));
- return WL_INVALID;
+ if (!band) {
+ WL_ERR(("No valid band"));
+ return -EINVAL;
}
#if LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 38) && !defined(WL_COMPAT_WIRELESS)
freq = ieee80211_channel_to_frequency(channel);
@@ -6554,11 +7173,7 @@ wl_notify_rx_mgmt_frame(struct wl_priv *wl, struct net_device *ndev,
wldev_iovar_getbuf_bsscfg(dev, "cur_etheraddr",
NULL, 0, wl->ioctl_buf, WLC_IOCTL_SMLEN, bsscfgidx, &wl->ioctl_buf_sync);
- err = wldev_ioctl(dev, WLC_GET_BSSID, &bssid, ETHER_ADDR_LEN, false);
- if( err < 0) {
- bzero (&bssid, ETHER_ADDR_LEN);
- WL_ERR (("NO Connected BSSID set to zero\n"));
- }
+ wldev_ioctl(dev, WLC_GET_BSSID, &bssid, ETHER_ADDR_LEN, false);
memcpy(da.octet, wl->ioctl_buf, ETHER_ADDR_LEN);
err = wl_frame_get_mgmt(FC_ACTION, &da, &e->addr, &bssid,
&mgmt_frame, &mgmt_frame_len,
@@ -6582,43 +7197,42 @@ wl_notify_rx_mgmt_frame(struct wl_priv *wl, struct net_device *ndev,
mgmt_frame_len - DOT11_MGMT_HDR_LEN)) {
sd_act_frm = (wifi_p2psd_gas_pub_act_frame_t *)
(&mgmt_frame[DOT11_MGMT_HDR_LEN]);
+ if (sd_act_frm && wl_get_drv_status_all(wl, WAITING_NEXT_ACT_FRM)) {
+ if (wl->next_af_subtype == sd_act_frm->action) {
+ WL_DBG(("We got a right next frame of SD!(%d)\n",
+ sd_act_frm->action));
+ wl_clr_drv_status(wl, WAITING_NEXT_ACT_FRM,
+ (ndev == wl->p2p_net) ?
+ wl_to_prmry_ndev(wl) : ndev);
+
+ /* Stop waiting for next AF. */
+ wl_stop_wait_next_action_frame(wl, ndev);
+ }
+ }
(void) sd_act_frm;
+ } else {
+ /*
+ * if we got normal action frame and ndev is p2p0,
+ * we have to change ndev from p2p0 to wlan0
+ */
+#if defined(CUSTOMER_HW4) && defined(WES_SUPPORT)
+ if (wl_cfg80211_is_wes(&mgmt_frame[DOT11_MGMT_HDR_LEN],
+ mgmt_frame_len - DOT11_MGMT_HDR_LEN) && wes_mode == 0) {
+ /* Ignore WES VS Action frame */
+ goto exit;
+ }
+#endif /* WES_SUPPORT */
+ if (wl->p2p_net == ndev)
+ ndev = wl_to_prmry_ndev(wl);
}
if (act_frm) {
#ifdef WL_CFG80211_GON_COLLISION
if (act_frm->subtype == P2P_PAF_GON_REQ) {
- if (wl->afx_hdl->pending_tx_act_frm) {
- wl_action_frame_t *tx_act_frm =
- &wl->afx_hdl->pending_tx_act_frm->action_frame;
- if (wl_is_gon_req_collision(wl, tx_act_frm, act_frm)) {
- /* if sa(peer) addr is less than da(my) addr,
- * my device will process peer's gon request and block to send my gon req.
- *
- * if not (sa addr > da addr),
- * my device will process gon request and drop current gon req of peer.
- */
- if (memcmp(e->addr.octet, da.octet, ETHER_ADDR_LEN) < 0) {
- /* block to send tx gon request */
- wl->block_gon_req_tx_count = BLOCK_GON_REQ_MAX_NUM;
- WL_ERR((" block to send gon req tx !!!\n"));
-
- /* if we are scanning peer channel for sending af,
- * do not scan more to block to send current gon req
- */
- if (wl_get_drv_status_all(wl, SCANNING_PEER_CHANNEL)) {
- wl_clr_drv_status(wl, SCANNING_PEER_CHANNEL, ndev);
- complete(&wl->act_frm_scan);
- }
- } else {
- /* drop current gon request of peer to process gon request by my device */
- /* should reduce another af tx to keep 100ms for next gon process */
- WL_ERR((" drop to receive gon req rx !!! \n"));
- wl->block_gon_req_rx_count = BLOCK_GON_REQ_MAX_NUM;
- }
+ wl_gon_req_collision(wl,
+ &wl->afx_hdl->pending_tx_act_frm->action_frame,
+ act_frm, ndev, e->addr, da);
- }
- }
if (wl->block_gon_req_rx_count) {
WL_ERR(("drop frame GON Req Rx : count (%d)\n",
wl->block_gon_req_rx_count));
@@ -6632,32 +7246,18 @@ wl_notify_rx_mgmt_frame(struct wl_priv *wl, struct net_device *ndev,
}
#endif /* WL_CFG80211_GON_COLLISION */
-#ifdef WL_CFG80211_SYNC_GON_TIME
if (wl_get_drv_status_all(wl, WAITING_NEXT_ACT_FRM)) {
- if (wl->next_gon_af_subtype == act_frm->subtype) {
- WL_DBG(("We got a right next frame!(%d) time (%d)\n",
- act_frm->subtype,
- jiffies_to_msecs(jiffies - wl->saved_jiffies)));
- wl_clr_drv_status(wl, WAITING_NEXT_ACT_FRM, ndev);
-
- if (wl_get_drv_status_all(wl, SENDING_ACT_FRM) &&
- (wl_get_p2p_status(wl, ACTION_TX_COMPLETED) ||
- wl_get_p2p_status(wl, ACTION_TX_NOACK))) {
- WL_DBG(("*** Wake UP ** abort actframe ** \n"));
- //wake_up_interruptible(&wl->send_af_done_event);
- /* if channel is not zero, "actfame" uses off channel scan.
- * So abort scan for off channel completion. */
- if (wl->af_sent_channel)
- wl_cfg80211_scan_abort(wl, dev);
- } else if (wl_get_drv_status_all(wl, WAITING_MORE_TIME_NEXT_ACT_FRM)) {
- WL_DBG(("*** Wake UP ** wait_next_af ** \n"));
- complete(&wl->wait_next_af);
- }
- //wake_up_interruptible(&wl->send_af_done_event);
- //msleep(5);
+ if (wl->next_af_subtype == act_frm->subtype) {
+ WL_DBG(("We got a right next frame!(%d)\n",
+ act_frm->subtype));
+ wl_clr_drv_status(wl, WAITING_NEXT_ACT_FRM,
+ (ndev == wl->p2p_net) ?
+ wl_to_prmry_ndev(wl) : ndev);
+
+ /* Stop waiting for next AF. */
+ wl_stop_wait_next_action_frame(wl, ndev);
}
}
-#endif /* WL_CFG80211_SYNC_GON_TIME */
}
wl_cfgp2p_print_actframe(false, &mgmt_frame[DOT11_MGMT_HDR_LEN],
@@ -6666,13 +7266,14 @@ wl_notify_rx_mgmt_frame(struct wl_priv *wl, struct net_device *ndev,
* After complete GO Negotiation, roll back to mpc mode
*/
if (act_frm && ((act_frm->subtype == P2P_PAF_GON_CONF) ||
- (act_frm->subtype == P2P_PAF_PROVDIS_RSP))) {
+ (act_frm->subtype == P2P_PAF_PROVDIS_RSP))) {
wldev_iovar_setint(dev, "mpc", 1);
}
+ if (act_frm && (act_frm->subtype == P2P_PAF_GON_CONF)) {
+ WL_DBG(("P2P: GO_NEG_PHASE status cleared \n"));
+ wl_clr_p2p_status(wl, GO_NEG_PHASE);
+ }
} else {
- if (wl_get_mode_by_netdev(wl, ndev) == WL_INVALID)
- return WL_INVALID;
-
mgmt_frame = (u8 *)((wl_event_rx_frame_data_t *)rxframe + 1);
/* wpa supplicant use probe request event for restarting another GON Req.
@@ -6684,37 +7285,44 @@ wl_notify_rx_mgmt_frame(struct wl_priv *wl, struct net_device *ndev,
WL_DBG((" Event %s\n", (event == WLC_E_P2P_PROBREQ_MSG) ?
"WLC_E_P2P_PROBREQ_MSG":"WLC_E_PROBREQ_MSG"));
- if ((wl_get_drv_status_all(wl, SENDING_ACT_FRM)
-#ifdef WL_CFG80211_SYNC_GON_TIME
- || wl_get_drv_status_all(wl, WAITING_MORE_TIME_NEXT_ACT_FRM)
-#endif /* WL_CFG80211_SYNC_GON_TIME */
- ) &&
- !memcmp(wl->afx_hdl->tx_dst_addr.octet, e->addr.octet, ETHER_ADDR_LEN)) {
#ifdef WL_CFG80211_USE_PRB_REQ_FOR_AF_TX
+ if (WL_DRV_STATUS_SENDING_AF_FRM_EXT(wl) &&
+ !memcmp(wl->afx_hdl->tx_dst_addr.octet, e->addr.octet,
+ ETHER_ADDR_LEN)) {
if (wl->afx_hdl->pending_tx_act_frm &&
- wl_get_drv_status_all(wl, SCANNING_PEER_CHANNEL)) {
+ wl_get_drv_status_all(wl, FINDING_COMMON_CHANNEL)) {
s32 channel = CHSPEC_CHANNEL(hton16(rxframe->channel));
- WL_DBG(("PROBE REQUEST : Peer found, channel : %d\n", channel));
+ WL_DBG(("PROBE REQUEST : Peer found, channel : %d\n",
+ channel));
wl->afx_hdl->peer_chan = channel;
complete(&wl->act_frm_scan);
}
+ }
#endif /* WL_CFG80211_USE_PRB_REQ_FOR_AF_TX */
- /* do not send probe request event to upper layer */
- WL_DBG((" Do Not Send..... PROBE REQUEST Event !!!!!\n"));
+
+ /* Filter any P2P probe reqs arriving during the
+ * GO-NEG Phase
+ */
+ if (wl->p2p &&
+ wl_get_p2p_status(wl, GO_NEG_PHASE)) {
+ WL_DBG(("Filtering P2P probe_req while "
+ "being in GO-Neg state\n"));
return 0;
}
}
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)
+ cfg80211_rx_mgmt(ndev, freq, 0, mgmt_frame, mgmt_frame_len, GFP_ATOMIC);
+#else
cfg80211_rx_mgmt(ndev, freq, mgmt_frame, mgmt_frame_len, GFP_ATOMIC);
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) */
WL_DBG(("%s: mgmt_frame_len (%d) , e->datalen (%d), channel (%d), freq (%d)\n", __func__,
mgmt_frame_len, ntoh32(e->datalen), channel, freq));
-
exit:
if (isfree)
kfree(mgmt_frame);
-
return 0;
}
@@ -6743,6 +7351,8 @@ static void wl_init_event_handler(struct wl_priv *wl)
memset(wl->evt_handler, 0, sizeof(wl->evt_handler));
wl->evt_handler[WLC_E_SCAN_COMPLETE] = wl_notify_scan_status;
+ wl->evt_handler[WLC_E_AUTH] = wl_notify_connect_status;
+ wl->evt_handler[WLC_E_ASSOC] = wl_notify_connect_status;
wl->evt_handler[WLC_E_LINK] = wl_notify_connect_status;
wl->evt_handler[WLC_E_DEAUTH_IND] = wl_notify_connect_status;
wl->evt_handler[WLC_E_DEAUTH] = wl_notify_connect_status;
@@ -6810,6 +7420,8 @@ static s32 wl_init_priv_mem(struct wl_priv *wl)
WL_ERR(("sta info alloc failed\n"));
goto init_priv_mem_out;
}
+
+#if defined(STATIC_WL_PRIV_STRUCT)
wl->conn_info = (void *)kzalloc(sizeof(*wl->conn_info), GFP_KERNEL);
if (unlikely(!wl->conn_info)) {
WL_ERR(("wl->conn_info alloc failed\n"));
@@ -6820,32 +7432,23 @@ static s32 wl_init_priv_mem(struct wl_priv *wl)
WL_ERR(("wl->ie alloc failed\n"));
goto init_priv_mem_out;
}
-#ifdef CONFIG_DHD_USE_STATIC_BUF
+#if defined(DUAL_ESCAN_RESULT_BUFFER)
wl->escan_info.escan_buf[0] = dhd_os_prealloc(NULL, DHD_PREALLOC_WIPHY_ESCAN0, 0);
bzero(wl->escan_info.escan_buf[0], ESCAN_BUF_SIZE);
wl->escan_info.escan_buf[1] = dhd_os_prealloc(NULL, DHD_PREALLOC_WIPHY_ESCAN1, 0);
bzero(wl->escan_info.escan_buf[1], ESCAN_BUF_SIZE);
#else
- wl->escan_info.escan_buf[0] = (void *)kzalloc(ESCAN_BUF_SIZE, GFP_KERNEL);
- if (unlikely(!wl->escan_info.escan_buf[0])) {
- WL_ERR(("wl->escan_info.escan_buf[0] alloc failed\n"));
- goto init_priv_mem_out;
- }
- wl->escan_info.escan_buf[1] = (void *)kzalloc(ESCAN_BUF_SIZE, GFP_KERNEL);
- if (unlikely(!wl->escan_info.escan_buf[1])) {
- WL_ERR(("wl->escan_info.escan_buf[1] alloc failed\n"));
- goto init_priv_mem_out;
- }
-#endif
+ wl->escan_info.escan_buf = dhd_os_prealloc(NULL, DHD_PREALLOC_WIPHY_ESCAN0, 0);
+ bzero(wl->escan_info.escan_buf, ESCAN_BUF_SIZE);
+#endif /* DUAL_ESCAN_RESULT_BUFFER */
+#endif /* STATIC_WL_PRIV_STRUCT */
wl->afx_hdl = (void *)kzalloc(sizeof(*wl->afx_hdl), GFP_KERNEL);
if (unlikely(!wl->afx_hdl)) {
WL_ERR(("afx hdl alloc failed\n"));
goto init_priv_mem_out;
} else {
init_completion(&wl->act_frm_scan);
-#ifdef WL_CFG80211_SYNC_GON_TIME
init_completion(&wl->wait_next_af);
-#endif /* WL_CFG80211_SYNC_GON_TIME */
INIT_WORK(&wl->afx_hdl->work, wl_cfg80211_afx_handler);
}
@@ -6877,16 +7480,18 @@ static void wl_deinit_priv_mem(struct wl_priv *wl)
wl->pmk_list = NULL;
kfree(wl->sta_info);
wl->sta_info = NULL;
+#if defined(STATIC_WL_PRIV_STRUCT)
kfree(wl->conn_info);
wl->conn_info = NULL;
kfree(wl->ie);
wl->ie = NULL;
-#ifndef CONFIG_DHD_USE_STATIC_BUF
- kfree(wl->escan_info.escan_buf[0]);
- kfree(wl->escan_info.escan_buf[1]);
-#endif
+#if defined(DUAL_ESCAN_RESULT_BUFFER)
wl->escan_info.escan_buf[0] = NULL;
wl->escan_info.escan_buf[1] = NULL;
+#else
+ wl->escan_info.escan_buf = NULL;
+#endif
+#endif /* STATIC_WL_PRIV_STRUCT */
if (wl->afx_hdl) {
cancel_work_sync(&wl->afx_hdl->work);
kfree(wl->afx_hdl);
@@ -6905,15 +7510,16 @@ static void wl_deinit_priv_mem(struct wl_priv *wl)
static s32 wl_create_event_handler(struct wl_priv *wl)
{
int ret = 0;
- WL_ERR(("Enter \n"));
- WL_ERR(("wl = 0x%08x, wl->event_tsk = 0x%08x\n",
- (unsigned int )wl, (unsigned int)&wl->event_tsk));
- if (wl->event_tsk.thr_pid > 0)
- WL_ERR(("wl->event_tsk already created ?\n"));
-
+ WL_DBG(("Enter \n"));
+
/* Do not use DHD in cfg driver */
wl->event_tsk.thr_pid = -1;
+
+#ifdef USE_KTHREAD_API
+ PROC_START2(wl_event_handler, wl, &wl->event_tsk, 0, "wl_event_handler");
+#else
PROC_START(wl_event_handler, wl, &wl->event_tsk, 0);
+#endif
if (wl->event_tsk.thr_pid < 0)
ret = -ENOMEM;
return ret;
@@ -6952,12 +7558,12 @@ static void wl_notify_iscan_complete(struct wl_iscan_ctrl *iscan, bool aborted)
return;
}
spin_lock_irqsave(&wl->cfgdrv_lock, flags);
+ wl_clr_drv_status(wl, SCANNING, ndev);
if (likely(wl->scan_request)) {
cfg80211_scan_done(wl->scan_request, aborted);
wl->scan_request = NULL;
}
spin_unlock_irqrestore(&wl->cfgdrv_lock, flags);
- wl_clr_drv_status(wl, SCANNING, ndev);
wl->iscan_kickstart = false;
}
@@ -7029,7 +7635,7 @@ static s32 wl_iscan_pending(struct wl_priv *wl)
s32 err = 0;
/* Reschedule the timer */
- mod_timer(&iscan->timer, jiffies + iscan->timer_ms * HZ / 1000);
+ mod_timer(&iscan->timer, jiffies + msecs_to_jiffies(iscan->timer_ms));
iscan->timer_on = 1;
return err;
@@ -7045,7 +7651,7 @@ static s32 wl_iscan_inprogress(struct wl_priv *wl)
wl_run_iscan(iscan, NULL, WL_SCAN_ACTION_CONTINUE);
mutex_unlock(&wl->usr_sync);
/* Reschedule the timer */
- mod_timer(&iscan->timer, jiffies + iscan->timer_ms * HZ / 1000);
+ mod_timer(&iscan->timer, jiffies + msecs_to_jiffies(iscan->timer_ms));
iscan->timer_on = 1;
return err;
@@ -7101,26 +7707,12 @@ static s32 wl_iscan_thread(void *data)
static void wl_scan_timeout(unsigned long data)
{
struct wl_priv *wl = (struct wl_priv *)data;
- wl_event_msg_t msg;
- wl_escan_result_t *escan_results;
+
if (wl->scan_request) {
WL_ERR(("timer expired\n"));
- if (wl->escan_on) {
- msg.event_type = hton32(WLC_E_ESCAN_RESULT);
- msg.status = hton32(WLC_E_STATUS_SUCCESS);
- escan_results = kzalloc(sizeof(wl_escan_result_t), GFP_ATOMIC);
- if (escan_results != NULL) {
- msg.datalen = hton32(sizeof(wl_escan_result_t));
- escan_results->sync_id = htod16(wl->escan_info.cur_sync_id);
- escan_results->bss_count =htod16(0);
- escan_results->buflen = htod32(WL_ESCAN_RESULTS_FIXED_SIZE);
- escan_results->version =htod32(WL_BSS_INFO_VERSION);
- wl_cfg80211_event(wl->escan_info.ndev, &msg, escan_results);
- kfree(escan_results);
- } else {
- wl_notify_escan_complete(wl, wl->escan_info.ndev, true);
- }
- } else
+ if (wl->escan_on)
+ wl_notify_escan_complete(wl, wl->escan_info.ndev, true, true);
+ else
wl_notify_iscan_complete(wl_to_iscan(wl), true);
}
}
@@ -7179,10 +7771,10 @@ wl_cfg80211_netdev_notifier_call(struct notifier_block * nb,
return NOTIFY_DONE;
switch (state) {
case NETDEV_DOWN:
- while(work_pending(&wdev->cleanup_work) && refcnt < 100) {
- if(refcnt%5==0)
- WL_ERR(("%s : [NETDEV_DOWN] work_pending (%d th)\n",
- __FUNCTION__, refcnt));
+ while (work_pending(&wdev->cleanup_work) && refcnt < 100) {
+ if (refcnt%5 == 0)
+ WL_ERR(("%s : [NETDEV_DOWN] work_pending (%d th)\n",
+ __FUNCTION__, refcnt));
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(100);
set_current_state(TASK_RUNNING);
@@ -7202,10 +7794,8 @@ wl_cfg80211_netdev_notifier_call(struct notifier_block * nb,
* make the scan done forcibly.
*/
if (wl_get_drv_status(wl, SCANNING, dev)) {
- WL_SCAN2(("Abort Scan and send result\n"));
- wl_cfg80211_scan_abort(wl, dev);
if (wl->escan_on) {
- wl_notify_escan_complete(wl, dev, true);
+ wl_notify_escan_complete(wl, dev, true, true);
}
}
break;
@@ -7215,23 +7805,56 @@ wl_cfg80211_netdev_notifier_call(struct notifier_block * nb,
static struct notifier_block wl_cfg80211_netdev_notifier = {
.notifier_call = wl_cfg80211_netdev_notifier_call,
};
-static void wl_notify_escan_complete(struct wl_priv *wl,
+
+static s32 wl_notify_escan_complete(struct wl_priv *wl,
struct net_device *ndev,
- bool aborted)
+ bool aborted, bool fw_abort)
{
+ wl_scan_params_t *params = NULL;
+ s32 params_size = 0;
+ s32 err = BCME_OK;
unsigned long flags;
+ struct net_device *dev;
WL_DBG(("Enter \n"));
if (wl->escan_info.ndev != ndev)
{
- WL_SCAN2(("ndev is different %p %p\n", wl->escan_info.ndev, ndev));
- return;
+ WL_ERR(("ndev is different %p %p\n", wl->escan_info.ndev, ndev));
+ return err;
}
- wl_clr_drv_status(wl, SCANNING, ndev);
- if (p2p_is_on(wl))
- wl_clr_p2p_status(wl, SCANNING);
- if(likely(wl->scan_request)) {
+
+ if (wl->scan_request) {
+ if (wl->scan_request->dev == wl->p2p_net)
+ dev = wl_to_prmry_ndev(wl);
+ else
+ dev = wl->scan_request->dev;
+ }
+ else {
+ WL_DBG(("wl->scan_request is NULL may be internal scan."
+ "doing scan_abort for ndev %p primary %p p2p_net %p",
+ ndev, wl_to_prmry_ndev(wl), wl->p2p_net));
+ dev = ndev;
+ }
+ if (fw_abort) {
+ /* Our scan params only need space for 1 channel and 0 ssids */
+ params = wl_cfg80211_scan_alloc_params(-1, 0, &params_size);
+ if (params == NULL) {
+ WL_ERR(("scan params allocation failed \n"));
+ err = -ENOMEM;
+ } else if (!in_atomic()) {
+ /* Do a scan abort to stop the driver's scan engine */
+ err = wldev_ioctl(dev, WLC_SCAN, params, params_size, true);
+ if (err < 0) {
+ WL_ERR(("scan abort failed \n"));
+ }
+ }
+ }
+ if (timer_pending(&wl->scan_timeout))
+ del_timer_sync(&wl->scan_timeout);
+#if defined(ESCAN_RESULT_PATCH)
+ if (likely(wl->scan_request)) {
+#if defined(DUAL_ESCAN_RESULT_BUFFER)
u8 temp_id = wl->escan_info.cur_sync_id;
if (aborted)
wl->bss_list =
@@ -7239,20 +7862,25 @@ static void wl_notify_escan_complete(struct wl_priv *wl,
else
wl->bss_list =
(wl_scan_results_t *)wl->escan_info.escan_buf[(temp_id)%2];
+#else
+ wl->bss_list = (wl_scan_results_t *)wl->escan_info.escan_buf;
+#endif
wl_inform_bss(wl);
}
-
+#endif /* ESCAN_RESULT_PATCH */
spin_lock_irqsave(&wl->cfgdrv_lock, flags);
if (likely(wl->scan_request)) {
cfg80211_scan_done(wl->scan_request, aborted);
wl->scan_request = NULL;
- spin_unlock_irqrestore(&wl->cfgdrv_lock, flags);
}
- else {
- spin_unlock_irqrestore(&wl->cfgdrv_lock, flags);
- WL_SCAN2(("no scan request is existed\n"));
- }
- WL_DBG(("Exit \n"));
+ if (p2p_is_on(wl))
+ wl_clr_p2p_status(wl, SCANNING);
+ wl_clr_drv_status(wl, SCANNING, dev);
+ spin_unlock_irqrestore(&wl->cfgdrv_lock, flags);
+ if (params)
+ kfree(params);
+
+ return err;
}
static s32 wl_escan_handler(struct wl_priv *wl,
@@ -7269,10 +7897,11 @@ static s32 wl_escan_handler(struct wl_priv *wl,
u32 bi_length;
u32 i;
u8 *p2p_dev_addr = NULL;
- u8 *ptr;
WL_DBG((" enter event type : %d, status : %d \n",
ntoh32(e->event_type), ntoh32(e->status)));
+
+ mutex_lock(&wl->usr_sync);
/* P2P SCAN is coming from primary interface */
if (wl_get_p2p_status(wl, SCANNING)) {
if (wl_get_drv_status_all(wl, SENDING_ACT_FRM))
@@ -7283,16 +7912,23 @@ static s32 wl_escan_handler(struct wl_priv *wl,
}
if (!ndev || !wl->escan_on ||
!wl_get_drv_status(wl, SCANNING, ndev)) {
+#if defined(DUAL_ESCAN_RESULT_BUFFER)
WL_ERR(("escan is not ready ndev %p wl->escan_on %d"
" drv_status 0x%x e_type %d e_states %d\n",
ndev, wl->escan_on, wl_get_drv_status(wl, SCANNING, ndev),
ntoh32(e->event_type), ntoh32(e->status)));
- return err;
+#else
+ WL_ERR(("escan is not ready ndev %p wl->escan_on %d drv_status 0x%x\n",
+ ndev, wl->escan_on, wl_get_drv_status(wl, SCANNING, ndev)));
+#endif
+ goto exit;
}
-
+#if defined(DUAL_ESCAN_RESULT_BUFFER)
escan_result = (wl_escan_result_t *) data;
+#endif
if (status == WLC_E_STATUS_PARTIAL) {
WL_INFO(("WLC_E_STATUS_PARTIAL \n"));
+ escan_result = (wl_escan_result_t *) data;
if (!escan_result) {
WL_ERR(("Invalid escan result (NULL pointer)\n"));
goto exit;
@@ -7311,12 +7947,14 @@ static s32 wl_escan_handler(struct wl_priv *wl,
WL_ERR(("Invalid bss_info length %d: ignoring\n", bi_length));
goto exit;
}
-
- if (dtoh16(escan_result->sync_id) != wl->escan_info.cur_sync_id) {
- WL_ERR(("Escan sync id mismatch: status %d cur_sync_id %d coming_sync_id %d\n"
- , status, wl->escan_info.cur_sync_id, dtoh16(escan_result->sync_id)));
+#if defined(DUAL_ESCAN_RESULT_BUFFER)
+ if (escan_result->sync_id != wl->escan_info.cur_sync_id) {
+ WL_ERR(("Escan sync id mismatch: status %d "
+ "cur_sync_id %d coming_sync_id %d\n",
+ status, wl->escan_info.cur_sync_id, escan_result->sync_id));
goto exit;
}
+#endif
if (!(wl_to_wiphy(wl)->interface_modes & BIT(NL80211_IFTYPE_ADHOC))) {
if (dtoh16(bi->capability) & DOT11_CAP_IBSS) {
@@ -7325,15 +7963,14 @@ static s32 wl_escan_handler(struct wl_priv *wl,
}
}
- ptr = (u8 *) bi;
- ptr += dtoh16(bi->ie_offset);
- if (wl_get_drv_status_all(wl, SCANNING_PEER_CHANNEL)) {
+ if (wl_get_drv_status_all(wl, FINDING_COMMON_CHANNEL)) {
p2p_dev_addr = wl_cfgp2p_retreive_p2p_dev_addr(bi, bi_length);
if (p2p_dev_addr && !memcmp(p2p_dev_addr,
wl->afx_hdl->tx_dst_addr.octet, ETHER_ADDR_LEN)) {
s32 channel = CHSPEC_CHANNEL(
wl_chspec_driver_to_host(bi->chanspec));
- WL_DBG(("ACTION FRAME SCAN : Peer found, channel : %d\n", channel));
+ WL_DBG(("ACTION FRAME SCAN : Peer " MACDBG " found, channel : %d\n",
+ STR_TO_MACD(wl->afx_hdl->tx_dst_addr.octet), channel));
wl_clr_p2p_status(wl, SCANNING);
wl->afx_hdl->peer_chan = channel;
complete(&wl->act_frm_scan);
@@ -7342,10 +7979,15 @@ static s32 wl_escan_handler(struct wl_priv *wl,
} else {
int cur_len = 0;
- list = (wl_scan_results_t *)wl->escan_info.escan_buf[wl->escan_info.cur_sync_id%2];
+#if defined(DUAL_ESCAN_RESULT_BUFFER)
+ list = (wl_scan_results_t *)
+ wl->escan_info.escan_buf[wl->escan_info.cur_sync_id%2];
+#else
+ list = (wl_scan_results_t *)wl->escan_info.escan_buf;
+#endif
#if defined(WLP2P) && defined(WL_ENABLE_P2P_IF)
if (wl->p2p_net && wl->scan_request &&
- wl->scan_request->dev == wl->p2p_net) {
+ wl->scan_request->dev == wl->p2p_net) {
#else
if (p2p_is_on(wl) && p2p_scan(wl)) {
#endif
@@ -7353,17 +7995,19 @@ static s32 wl_escan_handler(struct wl_priv *wl,
if (bi->flags & WL_BSS_FLAGS_FROM_BEACON)
goto exit;
if ((p2p_ie = wl_cfgp2p_find_p2pie(((u8 *) bi) + bi->ie_offset,
- bi->ie_length)) == NULL) {
- WL_ERR(("Couldn't find P2PIE in probe response/beacon\n"));
+ bi->ie_length)) == NULL) {
+ WL_ERR(("Couldn't find P2PIE in probe"
+ " response/beacon\n"));
goto exit;
}
}
-#define WLC_BSS_RSSI_ON_CHANNEL 0x0002
for (i = 0; i < list->count; i++) {
bss = bss ? (wl_bss_info_t *)((uintptr)bss + dtoh32(bss->length))
: list->bss_info;
+
if (!bcmp(&bi->BSSID, &bss->BSSID, ETHER_ADDR_LEN) &&
- CHSPEC_BAND(bi->chanspec) == CHSPEC_BAND(bss->chanspec) &&
+ (CHSPEC_BAND(wl_chspec_driver_to_host(bi->chanspec))
+ == CHSPEC_BAND(wl_chspec_driver_to_host(bss->chanspec))) &&
bi->SSID_len == bss->SSID_len &&
!bcmp(bi->SSID, bss->SSID, bi->SSID_len)) {
@@ -7374,9 +8018,9 @@ static s32 wl_escan_handler(struct wl_priv *wl,
(bi->flags & WL_BSS_FLAGS_FROM_BEACON))
goto exit;
- WL_DBG(("%s("MACSTR"), i=%d prev: RSSI %d"
+ WL_DBG(("%s("MACDBG"), i=%d prev: RSSI %d"
" flags 0x%x, new: RSSI %d flags 0x%x\n",
- bss->SSID, MAC2STR(bi->BSSID.octet), i,
+ bss->SSID, STR_TO_MACD(bi->BSSID.octet), i,
bss->RSSI, bss->flags, bi->RSSI, bi->flags));
if ((bss->flags & WL_BSS_FLAGS_RSSI_ONCHANNEL) ==
@@ -7384,9 +8028,9 @@ static s32 wl_escan_handler(struct wl_priv *wl,
/* preserve max RSSI if the measurements are
* both on-channel or both off-channel
*/
- WL_SCAN(("%s("MACSTR"), same onchan"
+ WL_SCAN(("%s("MACDBG"), same onchan"
", RSSI: prev %d new %d\n",
- bss->SSID, MAC2STR(bi->BSSID.octet),
+ bss->SSID, STR_TO_MACD(bi->BSSID.octet),
bss->RSSI, bi->RSSI));
bi->RSSI = MAX(bss->RSSI, bi->RSSI);
} else if ((bss->flags & WL_BSS_FLAGS_RSSI_ONCHANNEL) &&
@@ -7394,9 +8038,9 @@ static s32 wl_escan_handler(struct wl_priv *wl,
/* preserve the on-channel rssi measurement
* if the new measurement is off channel
*/
- WL_SCAN(("%s("MACSTR"), prev onchan"
+ WL_SCAN(("%s("MACDBG"), prev onchan"
", RSSI: prev %d new %d\n",
- bss->SSID, MAC2STR(bi->BSSID.octet),
+ bss->SSID, STR_TO_MACD(bi->BSSID.octet),
bss->RSSI, bi->RSSI));
bi->RSSI = bss->RSSI;
bi->flags |= WL_BSS_FLAGS_RSSI_ONCHANNEL;
@@ -7407,8 +8051,8 @@ static s32 wl_escan_handler(struct wl_priv *wl,
WL_SCAN(("bss info replacement"
" is occured(bcast:%d->probresp%d)\n",
bss->ie_length, bi->ie_length));
- WL_DBG(("%s("MACSTR"), replacement!(%d -> %d)\n",
- bss->SSID, MAC2STR(bi->BSSID.octet),
+ WL_DBG(("%s("MACDBG"), replacement!(%d -> %d)\n",
+ bss->SSID, STR_TO_MACD(bi->BSSID.octet),
prev_len, bi_length));
if (list->buflen - prev_len + bi_length
@@ -7441,99 +8085,117 @@ static s32 wl_escan_handler(struct wl_priv *wl,
WL_ERR(("Buffer is too small: ignoring\n"));
goto exit;
}
- memcpy(&(wl->escan_info.escan_buf[wl->escan_info.cur_sync_id%2][list->buflen]), bi, bi_length);
+#if defined(DUAL_ESCAN_RESULT_BUFFER)
+ memcpy(&(wl->escan_info.escan_buf[wl->escan_info.cur_sync_id%2]
+ [list->buflen]), bi, bi_length);
+#else
+ memcpy(&(wl->escan_info.escan_buf[list->buflen]), bi, bi_length);
+#endif
list->version = dtoh32(bi->version);
list->buflen += bi_length;
list->count++;
-
}
}
else if (status == WLC_E_STATUS_SUCCESS) {
wl->escan_info.escan_state = WL_ESCAN_STATE_IDLE;
- if (dtoh16(escan_result->sync_id) != wl->escan_info.cur_sync_id)
- WL_ERR(("Escan sync id mismatch: status %d cur_sync_id %d coming_sync_id %d\n"
- , status, wl->escan_info.cur_sync_id, dtoh16(escan_result->sync_id)));
- if (wl_get_drv_status_all(wl, SCANNING_PEER_CHANNEL)) {
+#if defined(DUAL_ESCAN_RESULT_BUFFER)
+ if (escan_result->sync_id != wl->escan_info.cur_sync_id)
+ WL_ERR(("Escan sync id mismatch: status %d "
+ "cur_sync_id %d coming_sync_id %d\n",
+ status, wl->escan_info.cur_sync_id, escan_result->sync_id));
+#endif
+ if (wl_get_drv_status_all(wl, FINDING_COMMON_CHANNEL)) {
WL_INFO(("ACTION FRAME SCAN DONE\n"));
wl_clr_p2p_status(wl, SCANNING);
wl_clr_drv_status(wl, SCANNING, wl->afx_hdl->dev);
if (wl->afx_hdl->peer_chan == WL_INVALID)
complete(&wl->act_frm_scan);
} else if (likely(wl->scan_request)) {
- mutex_lock(&wl->usr_sync);
- del_timer_sync(&wl->scan_timeout);
- WL_SCAN2(("ESCAN COMPLETED\n"));
-#ifndef CUSTOMER_HW_SAMSUNG
-#error bss list is informed at notify function
- wl->bss_list = (wl_scan_results_t *)wl->escan_info.escan_buf[wl->escan_info.cur_sync_id%2];
- wl_inform_bss(wl);
+ WL_INFO(("ESCAN COMPLETED\n"));
+#if defined(DUAL_ESCAN_RESULT_BUFFER)
+ wl->bss_list = (wl_scan_results_t *)
+ wl->escan_info.escan_buf[wl->escan_info.cur_sync_id%2];
+#else
+ wl->bss_list = (wl_scan_results_t *)wl->escan_info.escan_buf;
#endif
- wl_notify_escan_complete(wl, ndev, false);
- mutex_unlock(&wl->usr_sync);
+ wl_inform_bss(wl);
+ wl_notify_escan_complete(wl, ndev, false, false);
}
+#if defined(DUAL_ESCAN_RESULT_BUFFER)
wl->escan_info.cur_sync_id++;
+#endif
}
else if (status == WLC_E_STATUS_ABORT) {
wl->escan_info.escan_state = WL_ESCAN_STATE_IDLE;
- if (dtoh16(escan_result->sync_id) !=wl->escan_info.cur_sync_id)
- WL_ERR(("Escan sync id mismatch: status %d cur_sync_id %d coming_sync_id %d\n"
- , status, wl->escan_info.cur_sync_id, dtoh16(escan_result->sync_id)));
- if (wl_get_drv_status_all(wl, SCANNING_PEER_CHANNEL)) {
+#if defined(DUAL_ESCAN_RESULT_BUFFER)
+ if (escan_result->sync_id != wl->escan_info.cur_sync_id)
+ WL_ERR(("Escan sync id mismatch: status %d "
+ "cur_sync_id %d coming_sync_id %d\n",
+ status, wl->escan_info.cur_sync_id, escan_result->sync_id));
+#endif
+ if (wl_get_drv_status_all(wl, FINDING_COMMON_CHANNEL)) {
WL_INFO(("ACTION FRAME SCAN DONE\n"));
wl_clr_drv_status(wl, SCANNING, wl->afx_hdl->dev);
wl_clr_p2p_status(wl, SCANNING);
if (wl->afx_hdl->peer_chan == WL_INVALID)
complete(&wl->act_frm_scan);
} else if (likely(wl->scan_request)) {
- mutex_lock(&wl->usr_sync);
- del_timer_sync(&wl->scan_timeout);
- WL_SCAN2(("ESCAN ABORTED\n"));
-#ifndef CUSTOMER_HW_SAMSUNG
-#error bss list is informed at notify function
- wl->bss_list = (wl_scan_results_t *)wl->escan_info.escan_buf[(wl->escan_info.cur_sync_id+1)%2];
- wl_inform_bss(wl);
+ WL_INFO(("ESCAN ABORTED\n"));
+#if defined(DUAL_ESCAN_RESULT_BUFFER)
+ wl->bss_list = (wl_scan_results_t *)
+ wl->escan_info.escan_buf[(wl->escan_info.cur_sync_id+1)%2];
+#else
+ wl->bss_list = (wl_scan_results_t *)wl->escan_info.escan_buf;
#endif
- wl_notify_escan_complete(wl, ndev, true);
- mutex_unlock(&wl->usr_sync);
+ wl_inform_bss(wl);
+ wl_notify_escan_complete(wl, ndev, true, false);
}
+#if defined(DUAL_ESCAN_RESULT_BUFFER)
wl->escan_info.cur_sync_id += 2;
+#endif
}
else if (status == WLC_E_STATUS_NEWSCAN)
{
escan_result = (wl_escan_result_t *) data;
WL_ERR(("WLC_E_STATUS_NEWSCAN : scan_request[%p]\n", wl->scan_request));
- WL_ERR(("sync_id[%d], bss_count[%d]\n", escan_result->sync_id, escan_result->bss_count));
- }
- else {
+ WL_ERR(("sync_id[%d], bss_count[%d]\n", escan_result->sync_id,
+ escan_result->bss_count));
+ } else {
WL_ERR(("unexpected Escan Event %d : abort\n", status));
wl->escan_info.escan_state = WL_ESCAN_STATE_IDLE;
- if (dtoh16(escan_result->sync_id) != wl->escan_info.cur_sync_id)
- WL_ERR(("Escan sync id mismatch: status %d cur_sync_id %d coming_sync_id %d\n"
- , status, wl->escan_info.cur_sync_id, dtoh16(escan_result->sync_id)));
- if (wl_get_drv_status_all(wl, SCANNING_PEER_CHANNEL)) {
+#if defined(DUAL_ESCAN_RESULT_BUFFER)
+ if (escan_result->sync_id != wl->escan_info.cur_sync_id)
+ WL_ERR(("Escan sync id mismatch: status %d "
+ "cur_sync_id %d coming_sync_id %d\n",
+ status, wl->escan_info.cur_sync_id, escan_result->sync_id));
+#endif
+ if (wl_get_drv_status_all(wl, FINDING_COMMON_CHANNEL)) {
WL_INFO(("ACTION FRAME SCAN DONE\n"));
wl_clr_p2p_status(wl, SCANNING);
wl_clr_drv_status(wl, SCANNING, wl->afx_hdl->dev);
if (wl->afx_hdl->peer_chan == WL_INVALID)
complete(&wl->act_frm_scan);
} else if (likely(wl->scan_request)) {
- mutex_lock(&wl->usr_sync);
- del_timer_sync(&wl->scan_timeout);
-#ifndef CUSTOMER_HW_SAMSUNG
-#error bss list is informed at notify function
- wl->bss_list = (wl_scan_results_t *)wl->escan_info.escan_buf[(wl->escan_info.cur_sync_id+1)%2];
- wl_inform_bss(wl);
+#if defined(DUAL_ESCAN_RESULT_BUFFER)
+ wl->bss_list = (wl_scan_results_t *)
+ wl->escan_info.escan_buf[(wl->escan_info.cur_sync_id+1)%2];
+#else
+ wl->bss_list = (wl_scan_results_t *)wl->escan_info.escan_buf;
#endif
- wl_notify_escan_complete(wl, ndev, true);
- mutex_unlock(&wl->usr_sync);
+ wl_inform_bss(wl);
+ wl_notify_escan_complete(wl, ndev, true, false);
}
+#if defined(DUAL_ESCAN_RESULT_BUFFER)
wl->escan_info.cur_sync_id += 2;
+#endif
}
exit:
+ mutex_unlock(&wl->usr_sync);
return err;
}
-static s32 wl_notifier_change_state(struct wl_priv *wl, struct net_info *_net_info, enum wl_status state, bool set)
+static s32 wl_notifier_change_state(struct wl_priv *wl, struct net_info *_net_info,
+ enum wl_status state, bool set)
{
s32 pm = PM_FAST;
s32 err = BCME_OK;
@@ -7542,99 +8204,136 @@ static s32 wl_notifier_change_state(struct wl_priv *wl, struct net_info *_net_in
u32 prev_chan = 0;
u32 connected_cnt = 0;
struct net_info *iter, *next;
- struct net_device *primary_dev = wl_to_prmry_ndev(wl);
+ struct net_device *primary_dev = wl_to_prmry_ndev(wl);
if (set) { /* set */
switch (state) {
- case WL_STATUS_CONNECTED: {
- if ((connected_cnt = wl_get_drv_status_all(wl, CONNECTED)) > 1) {
- pm = PM_OFF;
- WL_INFO(("Do not enable the power save for VSDB mode\n"));
- } else if (_net_info->pm_block) {
- pm = PM_OFF;
- } else {
- pm = PM_FAST;
- }
- for_each_ndev(wl, iter, next) {
- if ((connected_cnt == 1) && (iter->ndev != _net_info->ndev))
- continue;
- chanspec = 0;
- chan = 0;
- if (wl_get_drv_status(wl, CONNECTED, iter->ndev)) {
- if (wldev_iovar_getint(iter->ndev, "chanspec", (s32 *)&chanspec) == BCME_OK) {
- chan = CHSPEC_CHANNEL(chanspec);
- if (CHSPEC_IS40(chanspec)) {
- if (CHSPEC_SB_UPPER(chanspec))
- chan += CH_10MHZ_APART;
- else
- chan -= CH_10MHZ_APART;
- }
- wl_update_prof(wl, iter->ndev, NULL, &chan, WL_PROF_CHAN);
+ case WL_STATUS_CONNECTED: {
+ if ((connected_cnt = wl_get_drv_status_all(wl, CONNECTED)) > 1) {
+ pm = PM_OFF;
+ WL_INFO(("Do not enable the power save for VSDB mode\n"));
+ } else if (_net_info->pm_block) {
+ pm = PM_OFF;
+ } else {
+ pm = PM_FAST;
+ }
+ for_each_ndev(wl, iter, next) {
+ if ((connected_cnt == 1) && (iter->ndev != _net_info->ndev))
+ continue;
+ chanspec = 0;
+ chan = 0;
+ if (wl_get_drv_status(wl, CONNECTED, iter->ndev)) {
+ if (wldev_iovar_getint(iter->ndev, "chanspec",
+ (s32 *)&chanspec) == BCME_OK) {
+ chan = CHSPEC_CHANNEL(chanspec);
+ if (CHSPEC_IS40(chanspec)) {
+ if (CHSPEC_SB_UPPER(chanspec))
+ chan += CH_10MHZ_APART;
+ else
+ chan -= CH_10MHZ_APART;
}
- if ((wl_get_mode_by_netdev(wl, iter->ndev) == WL_MODE_BSS)) {
+ wl_update_prof(wl, iter->ndev, NULL,
+ &chan, WL_PROF_CHAN);
+ }
+ if ((wl_get_mode_by_netdev(wl, iter->ndev)
+ == WL_MODE_BSS)) {
pm = htod32(pm);
- WL_DBG(("power save %s\n", (pm ? "enabled" : "disabled")));
- err = wldev_ioctl(iter->ndev, WLC_SET_PM, &pm, sizeof(pm), true);
+ WL_DBG(("power save %s\n",
+ (pm ? "enabled" : "disabled")));
+ err = wldev_ioctl(iter->ndev, WLC_SET_PM,
+ &pm, sizeof(pm), true);
if (unlikely(err)) {
if (err == -ENODEV)
- WL_DBG(("net_device is not ready yet\n"));
+ WL_DBG(("net_device"
+ " is not ready\n"));
else
- WL_ERR(("error (%d)\n", err));
+ WL_ERR(("error"
+ " (%d)\n", err));
break;
}
}
- if (connected_cnt > 1) {
- if (!prev_chan && chan)
- prev_chan = chan;
- else if (prev_chan && (prev_chan != chan)){
- wl->vsdb_mode = true;
- }
+ if (connected_cnt > 1) {
+ if (!prev_chan && chan)
+ prev_chan = chan;
+ else if (prev_chan && (prev_chan != chan)) {
+ wl->vsdb_mode = true;
+ }
+ if (wl->roamoff_on_concurrent) {
+ if ((err = wldev_iovar_getint(iter->ndev,
+ "roam_off", (s32 *)&iter->roam_off))
+ == BCME_OK) {
+ if ((err =
+ wldev_iovar_setint(iter->ndev,
+ "roam_off", 1)) !=
+ BCME_OK) {
+ WL_ERR((" failed to set "
+ "roam_off : %d\n", err));
+ }
+ } else
+ WL_ERR(("failed to get"
+ " roam_off : %d\n", err));
}
}
}
- if ((wl_get_mode_by_netdev(wl, _net_info->ndev) == WL_MODE_AP) && p2p_is_on(wl))
- if (wl_add_remove_eventmsg(primary_dev, WLC_E_P2P_PROBREQ_MSG, true) != BCME_OK)
- CFGP2P_ERR((" failed to set WLC_E_P2P_PROPREQ_MSG\n"));
-
- break;
}
- default:
- break;
+ if (wl_get_mode_by_netdev(wl, _net_info->ndev) == WL_MODE_AP) {
+ if (wl_add_remove_eventmsg(primary_dev,
+ WLC_E_P2P_PROBREQ_MSG, false))
+ WL_ERR((" failed to unset"
+ " WLC_E_P2P_PROPREQ_MSG\n"));
+ }
+ break;
+ }
+ default:
+ break;
}
} else { /* clear */
switch (state) {
- case WL_STATUS_CONNECTED: {
- chan = 0;
- wl_update_prof(wl, _net_info->ndev, NULL, &chan, WL_PROF_CHAN);
- if (wl_get_drv_status_all(wl, CONNECTED) == 1) {
- wl->vsdb_mode = false;
- for_each_ndev(wl, iter, next) {
- if (wl_get_drv_status(wl, CONNECTED, iter->ndev) &&
- (wl_get_mode_by_netdev(wl, iter->ndev) == WL_MODE_BSS)) {
- if (wl_get_netinfo_by_netdev(wl, iter->ndev)->pm_block)
- pm = PM_OFF;
+ case WL_STATUS_CONNECTED: {
+ chan = 0;
+ /* clear chan information when the net device is disconnected */
+ wl_update_prof(wl, _net_info->ndev, NULL, &chan, WL_PROF_CHAN);
+ if (wl_get_drv_status_all(wl, CONNECTED) == 1) {
+ wl->vsdb_mode = false;
+ for_each_ndev(wl, iter, next) {
+ if (wl_get_drv_status(wl, CONNECTED, iter->ndev) &&
+ (wl_get_mode_by_netdev(wl, iter->ndev)
+ == WL_MODE_BSS)) {
+ if (wl_get_netinfo_by_netdev(wl,
+ iter->ndev)->pm_block)
+ pm = PM_OFF;
+ else
+ pm = PM_FAST;
+ pm = htod32(pm);
+ WL_DBG(("power save %s\n",
+ (pm ? "enabled" : "disabled")));
+ err = wldev_ioctl(iter->ndev,
+ WLC_SET_PM, &pm, sizeof(pm), true);
+ if (unlikely(err)) {
+ if (err == -ENODEV)
+ WL_DBG(("net_device"
+ " is not ready\n"));
else
- pm = PM_FAST;
- pm = htod32(pm);
- WL_DBG(("power save %s\n", (pm ? "enabled" : "disabled")));
- err = wldev_ioctl(iter->ndev, WLC_SET_PM,
- &pm, sizeof(pm), true);
- if (unlikely(err)) {
- if (err == -ENODEV)
- WL_DBG(("net_device is not ready yet\n"));
- else
- WL_ERR(("error (%d)\n", err));
- break;
- }
+ WL_ERR(("error"
+ " (%d)\n", err));
+ break;
}
}
}
- if ((wl_get_mode_by_netdev(wl, _net_info->ndev) == WL_MODE_AP) && p2p_is_on(wl))
- if (wl_add_remove_eventmsg(primary_dev, WLC_E_P2P_PROBREQ_MSG, false) != BCME_OK)
- CFGP2P_ERR((" failed to unset WLC_E_P2P_PROPREQ_MSG\n"));
- break;
}
- default:
- break;
+ if (wl->roamoff_on_concurrent) {
+ for_each_ndev(wl, iter, next) {
+ if ((iter->roam_off != WL_INVALID) &&
+ ((err = wldev_iovar_setint(iter->ndev, "roam_off",
+ iter->roam_off)) == BCME_OK)) {
+ iter->roam_off = WL_INVALID;
+ } else if (err)
+ WL_ERR((" failed to set roam_off : %d\n", err));
+ }
+ }
+ break;
+ }
+ default:
+ break;
}
}
return err;
@@ -7663,7 +8362,9 @@ static s32 wl_init_scan(struct wl_priv *wl)
} else if (wl->escan_on) {
wl->evt_handler[WLC_E_ESCAN_RESULT] = wl_escan_handler;
wl->escan_info.escan_state = WL_ESCAN_STATE_IDLE;
+#if defined(DUAL_ESCAN_RESULT_BUFFER)
wl->escan_info.cur_sync_id = 0;
+#endif
}
/* Init scan_timeout timer */
init_timer(&wl->scan_timeout);
@@ -7687,9 +8388,9 @@ static s32 wl_init_priv(struct wl_priv *wl)
wl->iscan_kickstart = false;
wl->active_scan = true;
wl->rf_blocked = false;
- wl->first_remain = true;
+ wl->vsdb_mode = false;
wl->wlfc_on = false;
-
+ wl->roamoff_on_concurrent = true;
/* register interested state */
set_bit(WL_STATUS_CONNECTED, &wl->interrested_state);
spin_lock_init(&wl->cfgdrv_lock);
@@ -7728,7 +8429,7 @@ static void wl_deinit_priv(struct wl_priv *wl)
unregister_netdevice_notifier(&wl_cfg80211_netdev_notifier);
}
-#if defined(WLP2P) && (ENABLE_P2P_INTERFACE)
+#if defined(WLP2P) && defined(WL_ENABLE_P2P_IF)
static s32 wl_cfg80211_attach_p2p(void)
{
struct wl_priv *wl = wlcfg_drv_priv;
@@ -7763,7 +8464,7 @@ static s32 wl_cfg80211_detach_p2p(void)
return 0;
}
-#endif /* defined(WLP2P) && (ENABLE_P2P_INTERFACE) */
+#endif /* defined(WLP2P) && defined(WL_ENABLE_P2P_IF) */
s32 wl_cfg80211_attach_post(struct net_device *ndev)
{
@@ -7778,7 +8479,7 @@ s32 wl_cfg80211_attach_post(struct net_device *ndev)
if (wl && !wl_get_drv_status(wl, READY, ndev)) {
if (wl->wdev &&
wl_cfgp2p_supported(wl, ndev)) {
-#if !ENABLE_P2P_INTERFACE
+#if !defined(WL_ENABLE_P2P_IF)
wl->wdev->wiphy->interface_modes |=
(BIT(NL80211_IFTYPE_P2P_CLIENT)|
BIT(NL80211_IFTYPE_P2P_GO));
@@ -7786,19 +8487,20 @@ s32 wl_cfg80211_attach_post(struct net_device *ndev)
if ((err = wl_cfgp2p_init_priv(wl)) != 0)
goto fail;
-#if defined(WLP2P) && (ENABLE_P2P_INTERFACE)
+#if defined(WLP2P) && defined(WL_ENABLE_P2P_IF)
if (wl->p2p_net) {
/* Update MAC addr for p2p0 interface here. */
memcpy(wl->p2p_net->dev_addr, ndev->dev_addr, ETH_ALEN);
wl->p2p_net->dev_addr[0] |= 0x02;
- printk("%s: p2p_dev_addr="MACSTR "\n",
- wl->p2p_net->name, MAC2STR(wl->p2p_net->dev_addr));
+ WL_ERR(("%s: p2p_dev_addr="MACDBG "\n",
+ wl->p2p_net->name,
+ STR_TO_MACD(wl->p2p_net->dev_addr)));
} else {
WL_ERR(("p2p_net not yet populated."
" Couldn't update the MAC Address for p2p0 \n"));
return -ENODEV;
}
-#endif /* defined(WLP2P) && (ENABLE_P2P_INTERFACE) */
+#endif /* defined(WLP2P) && (WL_ENABLE_P2P_IF) */
wl->p2p_supported = true;
}
@@ -7836,8 +8538,6 @@ s32 wl_cfg80211_attach(struct net_device *ndev, void *data)
}
wdev->iftype = wl_mode_to_nl80211_iftype(WL_MODE_BSS);
wl = (struct wl_priv *)wiphy_priv(wdev->wiphy);
- WL_ERR(("%s: wl = 0x%08x\n", __FUNCTION__, (unsigned int)wl));
-
wl->wdev = wdev;
wl->pub = data;
INIT_LIST_HEAD(&wl->net_list);
@@ -7855,6 +8555,7 @@ s32 wl_cfg80211_attach(struct net_device *ndev, void *data)
WL_ERR(("Failed to init iwm_priv (%d)\n", err));
goto cfg80211_attach_out;
}
+
err = wl_setup_rfkill(wl, TRUE);
if (err) {
WL_ERR(("Failed to setup rfkill %d\n", err));
@@ -7868,11 +8569,11 @@ s32 wl_cfg80211_attach(struct net_device *ndev, void *data)
#if defined(COEX_DHCP)
if (wl_cfg80211_btcoex_init(wl))
goto cfg80211_attach_out;
-#endif
+#endif
wlcfg_drv_priv = wl;
-#if defined(WLP2P) && (ENABLE_P2P_INTERFACE)
+#if defined(WLP2P) && defined(WL_ENABLE_P2P_IF)
err = wl_cfg80211_attach_p2p();
if (err)
goto cfg80211_attach_out;
@@ -7897,16 +8598,17 @@ void wl_cfg80211_detach(void *para)
#if defined(COEX_DHCP)
wl_cfg80211_btcoex_deinit(wl);
-#endif
+#endif
-#if defined(WLP2P) && (ENABLE_P2P_INTERFACE)
- wl_cfg80211_detach_p2p();
-#endif
wl_setup_rfkill(wl, FALSE);
if (wl->p2p_supported) {
WL_ERR(("wl_cfgp2p_down() is not called yet\n"));
wl_cfgp2p_down(wl);
}
+
+#if defined(WLP2P) && defined(WL_ENABLE_P2P_IF)
+ wl_cfg80211_detach_p2p();
+#endif
wl_deinit_priv(wl);
wlcfg_drv_priv = NULL;
wl_cfg80211_clear_parent_dev();
@@ -7966,23 +8668,19 @@ static s32 wl_event_handler(void *data)
struct wl_priv *wl = NULL;
struct wl_event_q *e;
tsk_ctl_t *tsk = (tsk_ctl_t *)data;
- int ret;
wl = (struct wl_priv *)tsk->parent;
- WL_ERR(("tsk Enter, tsk = 0x%08x\n", (unsigned int)tsk));
+#ifndef USE_KTHREAD_API
DAEMONIZE("dhd_cfg80211_event");
- WL_ERR(("DAEMONIZE completed\n"));
complete(&tsk->completed);
- WL_ERR(("tsk completed\n"));
+#else
+ WL_ERR(("tsk Enter, tsk = 0x%08x\n", (unsigned int)tsk));
+#endif
- while ((ret = down_interruptible (&tsk->sema)) == 0) {
- WL_DBG(("down the event sema\n"));
+ while (down_interruptible (&tsk->sema) == 0) {
SMP_RD_BARRIER_DEPENDS();
- if (tsk->terminated) {
- WL_DBG(("%s was terminated[%d] ret=%d\n",
- __func__, __LINE__, ret));
+ if (tsk->terminated)
break;
- }
while ((e = wl_deq_event(wl))) {
WL_DBG(("event type (%d), if idx: %d\n", e->etype, e->emsg.ifidx));
/* All P2P device address related events comes on primary interface since
@@ -7997,17 +8695,15 @@ static s32 wl_event_handler(void *data)
if (!netdev)
netdev = wl_to_prmry_ndev(wl);
if (e->etype < WLC_E_LAST && wl->evt_handler[e->etype]) {
- WL_DBG(("call event handler\n"));
wl->evt_handler[e->etype] (wl, netdev, &e->emsg, e->edata);
} else {
-
WL_DBG(("Unknown Event (%d): ignoring\n", e->etype));
}
wl_put_event(e);
}
DHD_OS_WAKE_UNLOCK(wl->pub);
}
- WL_ERR(("%s was terminated[%d] ret=%d\n", __func__, __LINE__, ret));
+ WL_ERR(("%s was terminated\n", __func__));
complete_and_exit(&tsk->completed, 0);
return 0;
}
@@ -8017,7 +8713,8 @@ wl_cfg80211_event(struct net_device *ndev, const wl_event_msg_t * e, void *data)
{
u32 event_type = ntoh32(e->event_type);
struct wl_priv *wl = wlcfg_drv_priv;
-#if defined(PNO_SUPPORT) && defined(CONFIG_HAS_WAKELOCK)
+
+#if defined(CUSTOMER_HW4) && defined(PNO_SUPPORT) && defined(CONFIG_HAS_WAKELOCK)
int pno_wakelock_timeout = 10; /* 10 second */
#endif
@@ -8027,15 +8724,15 @@ wl_cfg80211_event(struct net_device *ndev, const wl_event_msg_t * e, void *data)
WL_DBG(("event_type (%d):" "WLC_E_" "%s\n", event_type, estr));
#endif /* (WL_DBG_LEVEL > 0) */
- if (event_type == WLC_E_PFN_NET_FOUND)
- {
-#if defined(PNO_SUPPORT) && defined(CONFIG_HAS_WAKELOCK)
+ if (event_type == WLC_E_PFN_NET_FOUND) {
+#if defined(CUSTOMER_HW4) && defined(PNO_SUPPORT) && defined(CONFIG_HAS_WAKELOCK)
net_os_wake_lock_timeout_for_pno(ndev, pno_wakelock_timeout);
#endif
- WL_ERR((" PNO Event\n"));
+ WL_DBG((" PNOEVENT: PNO_NET_FOUND\n"));
+ }
+ else if (event_type == WLC_E_PFN_NET_LOST) {
+ WL_DBG((" PNOEVENT: PNO_NET_LOST\n"));
}
- else if (event_type == WLC_E_PFN_NET_LOST)
- WL_ERR((" PNOEVENT: PNO_NET_LOST\n"));
if (likely(!wl_enq_event(wl, ndev, event_type, e, data)))
wl_wakeup_event(wl);
@@ -8110,7 +8807,6 @@ wl_enq_event(struct wl_priv *wl, struct net_device *ndev, u32 event, const wl_ev
if (data)
memcpy(e->edata, data, data_len);
flags = wl_lock_eq(wl);
- WL_DBG(("enque the event to event queue\n"));
list_add_tail(&e->eq_list, &wl->eq_list);
wl_unlock_eq(wl, flags);
@@ -8210,6 +8906,7 @@ static int wl_construct_reginfo(struct wl_priv *wl, s32 bw_cap)
bool update;
bool ht40_allowed;
u8 *pbuf = NULL;
+
#define LOCAL_BUF_LEN 1024
pbuf = kzalloc(LOCAL_BUF_LEN, GFP_KERNEL);
@@ -8229,6 +8926,7 @@ static int wl_construct_reginfo(struct wl_priv *wl, s32 bw_cap)
return err;
}
#undef LOCAL_BUF_LEN
+
list = (wl_uint32_list_t *)(void *)pbuf;
band = array_size = n_2g = n_5g = 0;
for (i = 0; i < dtoh32(list->count); i++) {
@@ -8236,6 +8934,7 @@ static int wl_construct_reginfo(struct wl_priv *wl, s32 bw_cap)
update = false;
ht40_allowed = false;
c = (chanspec_t)dtoh32(list->element[i]);
+ c = wl_chspec_driver_to_host(c);
channel = CHSPEC_CHANNEL(c);
if (CHSPEC_IS40(c)) {
if (CHSPEC_SB_UPPER(c))
@@ -8270,16 +8969,24 @@ static int wl_construct_reginfo(struct wl_priv *wl, s32 bw_cap)
else
index = *n_cnt;
if (index < array_size) {
+#if LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 38) && !defined(WL_COMPAT_WIRELESS)
+ band_chan_arr[index].center_freq =
+ ieee80211_channel_to_frequency(channel);
+#else
band_chan_arr[index].center_freq =
ieee80211_channel_to_frequency(channel, band);
+#endif
band_chan_arr[index].hw_value = channel;
if (CHSPEC_IS40(c) && ht40_allowed) {
- /* assuming the order is HT20, HT40 Upper, HT40 lower from chanspecs */
+ /* assuming the order is HT20, HT40 Upper,
+ HT40 lower from chanspecs
+ */
u32 ht40_flag = band_chan_arr[index].flags & IEEE80211_CHAN_NO_HT40;
if (CHSPEC_SB_UPPER(c)) {
if (ht40_flag == IEEE80211_CHAN_NO_HT40)
- band_chan_arr[index].flags &= ~IEEE80211_CHAN_NO_HT40;
+ band_chan_arr[index].flags &=
+ ~IEEE80211_CHAN_NO_HT40;
band_chan_arr[index].flags |= IEEE80211_CHAN_NO_HT40PLUS;
} else {
/* It should be one of
@@ -8287,7 +8994,8 @@ static int wl_construct_reginfo(struct wl_priv *wl, s32 bw_cap)
*/
band_chan_arr[index].flags &= ~IEEE80211_CHAN_NO_HT40;
if (ht40_flag == IEEE80211_CHAN_NO_HT40)
- band_chan_arr[index].flags |= IEEE80211_CHAN_NO_HT40MINUS;
+ band_chan_arr[index].flags |=
+ IEEE80211_CHAN_NO_HT40MINUS;
}
} else {
band_chan_arr[index].flags = IEEE80211_CHAN_NO_HT40;
@@ -8295,13 +9003,18 @@ static int wl_construct_reginfo(struct wl_priv *wl, s32 bw_cap)
channel |= WL_CHANSPEC_BAND_2G;
else
channel |= WL_CHANSPEC_BAND_5G;
+ channel |= WL_CHANSPEC_BW_20;
+ channel = wl_chspec_host_to_driver(channel);
err = wldev_iovar_getint(dev, "per_chan_info", &channel);
if (!err) {
if (channel & WL_CHAN_RADAR)
- band_chan_arr[index].flags |= (IEEE80211_CHAN_RADAR | IEEE80211_CHAN_NO_IBSS);
+ band_chan_arr[index].flags |=
+ (IEEE80211_CHAN_RADAR |
+ IEEE80211_CHAN_NO_IBSS);
if (channel & WL_CHAN_PASSIVE)
- band_chan_arr[index].flags |= IEEE80211_CHAN_PASSIVE_SCAN;
- }
+ band_chan_arr[index].flags |=
+ IEEE80211_CHAN_PASSIVE_SCAN;
+ }
}
if (!update)
(*n_cnt)++;
@@ -8324,80 +9037,84 @@ s32 wl_update_wiphybands(struct wl_priv *wl)
s32 err = 0;
s32 index = 0;
s32 nmode = 0;
+ bool rollback_lock = false;
s32 bw_cap = 0;
s32 cur_band = -1;
- if (wl == NULL)
+ if (wl == NULL) {
wl = wlcfg_drv_priv;
+ mutex_lock(&wl->usr_sync);
+ rollback_lock = true;
+ }
dev = wl_to_prmry_ndev(wl);
-
memset(bandlist, 0, sizeof(bandlist));
err = wldev_ioctl(dev, WLC_GET_BANDLIST, bandlist,
sizeof(bandlist), false);
if (unlikely(err)) {
- WL_ERR(("error (%d)\n", err));
- return err;
+ WL_ERR(("error real bandlist (%d)\n", err));
+ goto end_bands;
}
err = wldev_ioctl(dev, WLC_GET_BAND, &cur_band,
sizeof(s32), false);
if (unlikely(err)) {
WL_ERR(("error (%d)\n", err));
- return err;
+ goto end_bands;
}
err = wldev_iovar_getint(dev, "nmode", &nmode);
- if (err) {
- return err;
+ if (unlikely(err)) {
+ WL_ERR(("error reading nmode (%d)\n", err));
+ } else {
+ /* For nmodeonly check bw cap */
+ err = wldev_iovar_getint(dev, "mimo_bw_cap", &bw_cap);
+ if (unlikely(err)) {
+ WL_ERR(("error get mimo_bw_cap (%d)\n", err));
+ }
}
- err = wldev_iovar_getint(dev, "mimo_bw_cap", &bw_cap);
- if (err) {
- return err;
- }
-
err = wl_construct_reginfo(wl, bw_cap);
if (err) {
WL_ERR(("wl_construct_reginfo() fails err=%d\n", err));
- return err;
- }
- if ((cur_band == WLC_BAND_2G) ||
- (cur_band == WLC_BAND_5G)) {
- bandlist[0] = 1;
- bandlist[1] = cur_band;
+ if (err != BCME_UNSUPPORTED)
+ goto end_bands;
+ err = 0;
}
-
wiphy = wl_to_wiphy(wl);
nband = bandlist[0];
wiphy->bands[IEEE80211_BAND_5GHZ] = NULL;
wiphy->bands[IEEE80211_BAND_2GHZ] = NULL;
for (i = 1; i <= nband && i < ARRAYSIZE(bandlist); i++) {
index = -1;
- if (bandlist[i] == WLC_BAND_5G) {
+ if (bandlist[i] == WLC_BAND_5G && __wl_band_5ghz_a.n_channels > 0) {
wiphy->bands[IEEE80211_BAND_5GHZ] =
&__wl_band_5ghz_a;
index = IEEE80211_BAND_5GHZ;
if (bw_cap == WLC_N_BW_40ALL || bw_cap == WLC_N_BW_20IN2G_40IN5G)
wiphy->bands[index]->ht_cap.cap |= IEEE80211_HT_CAP_SGI_40;
}
- else if (bandlist[i] == WLC_BAND_2G) {
+ else if (bandlist[i] == WLC_BAND_2G && __wl_band_2ghz.n_channels > 0) {
wiphy->bands[IEEE80211_BAND_2GHZ] =
&__wl_band_2ghz;
index = IEEE80211_BAND_2GHZ;
if (bw_cap == WLC_N_BW_40ALL)
wiphy->bands[index]->ht_cap.cap |= IEEE80211_HT_CAP_SGI_40;
-
}
+
if ((index >= 0) && nmode) {
wiphy->bands[index]->ht_cap.cap |=
- (IEEE80211_HT_CAP_SGI_20 | IEEE80211_HT_CAP_DSSSCCK40);
+ (IEEE80211_HT_CAP_SGI_20 | IEEE80211_HT_CAP_DSSSCCK40);
wiphy->bands[index]->ht_cap.ht_supported = TRUE;
wiphy->bands[index]->ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K;
wiphy->bands[index]->ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16;
}
}
+
wiphy_apply_custom_regulatory(wiphy, &brcm_regdom);
- return err;
+ end_bands:
+ if (rollback_lock)
+ mutex_unlock(&wl->usr_sync);
+ return err;
}
static s32 __wl_cfg80211_up(struct wl_priv *wl)
@@ -8406,7 +9123,7 @@ static s32 __wl_cfg80211_up(struct wl_priv *wl)
struct net_device *ndev = wl_to_prmry_ndev(wl);
struct wireless_dev *wdev = ndev->ieee80211_ptr;
- WL_TRACE(("In\n"));
+ WL_DBG(("In\n"));
err = dhd_config_dongle(wl, false);
if (unlikely(err))
@@ -8433,8 +9150,12 @@ static s32 __wl_cfg80211_down(struct wl_priv *wl)
unsigned long flags;
struct net_info *iter, *next;
struct net_device *ndev = wl_to_prmry_ndev(wl);
-
- WL_TRACE(("In\n"));
+#ifdef WL_ENABLE_P2P_IF
+#if !defined(CUSTOMER_HW4)
+ struct net_device *p2p_net = wl->p2p_net;
+#endif /* !defined(CUSTOMER_HW4) */
+#endif /* WL_ENABLE_P2P_IF */
+ WL_DBG(("In\n"));
/* Check if cfg80211 interface is already down */
if (!wl_get_drv_status(wl, READY, ndev))
return err; /* it is even not ready */
@@ -8442,6 +9163,12 @@ static s32 __wl_cfg80211_down(struct wl_priv *wl)
wl_set_drv_status(wl, SCAN_ABORTING, iter->ndev);
wl_term_iscan(wl);
+ spin_lock_irqsave(&wl->cfgdrv_lock, flags);
+ if (wl->scan_request) {
+ cfg80211_scan_done(wl->scan_request, true);
+ wl->scan_request = NULL;
+ }
+ spin_unlock_irqrestore(&wl->cfgdrv_lock, flags);
for_each_ndev(wl, iter, next) {
wl_clr_drv_status(wl, READY, iter->ndev);
@@ -8453,15 +9180,16 @@ static s32 __wl_cfg80211_down(struct wl_priv *wl)
wl_clr_drv_status(wl, AP_CREATED, iter->ndev);
wl_clr_drv_status(wl, AP_CREATING, iter->ndev);
}
- spin_lock_irqsave(&wl->cfgdrv_lock, flags);
- if (wl->scan_request) {
- cfg80211_scan_done(wl->scan_request, true);
- wl->scan_request = NULL;
- }
wl_to_prmry_ndev(wl)->ieee80211_ptr->iftype =
NL80211_IFTYPE_STATION;
- spin_unlock_irqrestore(&wl->cfgdrv_lock, flags);
-
+#ifdef WL_ENABLE_P2P_IF
+#if !defined(CUSTOMER_HW4)
+ if ((p2p_net) && (p2p_net->flags & IFF_UP)) {
+ /* p2p0 interface is still UP. Bring it down */
+ p2p_net->flags &= ~IFF_UP;
+ }
+#endif
+#endif /* WL_ENABLE_P2P_IF */
DNGL_FUNC(dhd_cfg80211_down, (wl));
wl_flush_eq(wl);
wl_link_down(wl);
@@ -8480,7 +9208,7 @@ s32 wl_cfg80211_up(void *para)
dhd_pub_t *dhd;
(void)para;
- WL_TRACE(("In\n"));
+ WL_DBG(("In\n"));
wl = wlcfg_drv_priv;
if ((err = wldev_ioctl(wl_to_prmry_ndev(wl), WLC_GET_VERSION, &val,
@@ -8530,7 +9258,7 @@ s32 wl_cfg80211_down(void *para)
s32 err = 0;
(void)para;
- WL_TRACE(("In\n"));
+ WL_DBG(("In\n"));
wl = wlcfg_drv_priv;
mutex_lock(&wl->usr_sync);
err = __wl_cfg80211_down(wl);
@@ -8738,8 +9466,7 @@ static void wl_init_eq_lock(struct wl_priv *wl)
static void wl_delay(u32 ms)
{
- if (ms < 1000 / HZ) {
- cond_resched();
+ if (in_atomic() || (ms < jiffies_to_msecs(1))) {
mdelay(ms);
} else {
msleep(ms);
@@ -8810,8 +9537,8 @@ s32 wl_cfg80211_set_wps_p2p_ie(struct net_device *net, char *buf, int len,
}
if (!wl->p2p->on) {
get_primary_mac(wl, &primary_mac);
- wl_cfgp2p_generate_bss_mac(&primary_mac, &wl->p2p->dev_addr, &wl->p2p->int_addr);
-
+ wl_cfgp2p_generate_bss_mac(&primary_mac, &wl->p2p->dev_addr,
+ &wl->p2p->int_addr);
/* In case of p2p_listen command, supplicant send remain_on_channel
* without turning on P2P
*/
@@ -8822,7 +9549,7 @@ s32 wl_cfg80211_set_wps_p2p_ie(struct net_device *net, char *buf, int len,
if (unlikely(ret)) {
goto exit;
}
- }
+ }
if (net != wl_to_prmry_ndev(wl)) {
if (wl_get_mode_by_netdev(wl, net) == WL_MODE_AP) {
ndev = wl_to_p2p_bss_ndev(wl, P2PAPI_BSSCFG_CONNECTION);
@@ -8848,7 +9575,7 @@ s32 wl_cfg80211_set_wps_p2p_ie(struct net_device *net, char *buf, int len,
if (pktflag)
ret = wl_cfgp2p_set_management_ie(wl, ndev, bssidx, pktflag, buf, len);
}
-exit:
+exit:
return ret;
}
@@ -8927,6 +9654,7 @@ static void get_primary_mac(struct wl_priv *wl, struct ether_addr *mac)
0, wl->ioctl_buf, WLC_IOCTL_SMLEN, 0, &wl->ioctl_buf_sync);
memcpy(mac->octet, wl->ioctl_buf, ETHER_ADDR_LEN);
}
+
int wl_cfg80211_do_driver_init(struct net_device *net)
{
struct wl_priv *wl = *(struct wl_priv **)netdev_priv(net);
@@ -8940,7 +9668,103 @@ int wl_cfg80211_do_driver_init(struct net_device *net)
return 0;
}
-void wl_cfg80211_enable_trace(int level)
+void wl_cfg80211_enable_trace(bool set, u32 level)
+{
+ if (set)
+ wl_dbg_level = level & WL_DBG_LEVEL;
+ else
+ wl_dbg_level |= (WL_DBG_LEVEL & level);
+}
+
+#ifdef WL11U
+bcm_tlv_t *
+wl_cfg80211_find_interworking_ie(u8 *parse, u32 len)
{
- wl_dbg_level |= WL_DBG_DBG;
+ bcm_tlv_t *ie;
+
+ while ((ie = bcm_parse_tlvs(parse, (u32)len, DOT11_MNG_INTERWORKING_ID))) {
+ return (bcm_tlv_t *)ie;
+ }
+ return NULL;
+}
+
+
+static s32
+wl_cfg80211_add_iw_ie(struct wl_priv *wl, struct net_device *ndev, s32 bssidx, s32 pktflag,
+ uint8 ie_id, uint8 *data, uint8 data_len)
+{
+ s32 err = BCME_OK;
+ s32 buf_len;
+ s32 iecount;
+ ie_setbuf_t *ie_setbuf;
+
+ if (ie_id != DOT11_MNG_INTERWORKING_ID)
+ return BCME_UNSUPPORTED;
+
+ /* Validate the pktflag parameter */
+ if ((pktflag & ~(VNDR_IE_BEACON_FLAG | VNDR_IE_PRBRSP_FLAG |
+ VNDR_IE_ASSOCRSP_FLAG | VNDR_IE_AUTHRSP_FLAG |
+ VNDR_IE_PRBREQ_FLAG | VNDR_IE_ASSOCREQ_FLAG|
+ VNDR_IE_CUSTOM_FLAG))) {
+ WL_ERR(("cfg80211 Add IE: Invalid packet flag 0x%x\n", pktflag));
+ return -1;
+ }
+
+ /* use VNDR_IE_CUSTOM_FLAG flags for none vendor IE . currently fixed value */
+ pktflag = htod32(pktflag);
+
+ buf_len = sizeof(ie_setbuf_t) + data_len - 1;
+ ie_setbuf = (ie_setbuf_t *) kzalloc(buf_len, GFP_KERNEL);
+
+ if (!ie_setbuf) {
+ WL_ERR(("Error allocating buffer for IE\n"));
+ return -ENOMEM;
+ }
+
+ if (wl->iw_ie_len == data_len && !memcmp(wl->iw_ie, data, data_len)) {
+ WL_ERR(("Previous IW IE is equals to current IE\n"));
+ return err;
+ }
+
+ strncpy(ie_setbuf->cmd, "add", VNDR_IE_CMD_LEN - 1);
+ ie_setbuf->cmd[VNDR_IE_CMD_LEN - 1] = '\0';
+
+ /* Buffer contains only 1 IE */
+ iecount = htod32(1);
+ memcpy((void *)&ie_setbuf->ie_buffer.iecount, &iecount, sizeof(int));
+ memcpy((void *)&ie_setbuf->ie_buffer.ie_list[0].pktflag, &pktflag, sizeof(uint32));
+
+ /* Now, add the IE to the buffer */
+ ie_setbuf->ie_buffer.ie_list[0].ie_data.id = ie_id;
+
+ /* if already set with previous values, delete it first */
+ if (wl->iw_ie_len != 0) {
+ WL_DBG(("Different IW_IE was already set. clear first\n"));
+
+ ie_setbuf->ie_buffer.ie_list[0].ie_data.len = 0;
+
+ err = wldev_iovar_setbuf_bsscfg(ndev, "ie", ie_setbuf, buf_len,
+ wl->ioctl_buf, WLC_IOCTL_MAXLEN, bssidx, &wl->ioctl_buf_sync);
+
+ if (err != BCME_OK)
+ return err;
+ }
+
+ ie_setbuf->ie_buffer.ie_list[0].ie_data.len = data_len;
+ memcpy((uchar *)&ie_setbuf->ie_buffer.ie_list[0].ie_data.data[0], data, data_len);
+
+ err = wldev_iovar_setbuf_bsscfg(ndev, "ie", ie_setbuf, buf_len,
+ wl->ioctl_buf, WLC_IOCTL_MAXLEN, bssidx, &wl->ioctl_buf_sync);
+
+ if (err == BCME_OK) {
+ memcpy(wl->iw_ie, data, data_len);
+ wl->iw_ie_len = data_len;
+ wl->wl11u = TRUE;
+
+ err = wldev_iovar_setint_bsscfg(ndev, "grat_arp", 1, bssidx);
+ }
+
+ kfree(ie_setbuf);
+ return err;
}
+#endif /* WL11U */
diff --git a/drivers/net/wireless/bcmdhd/src/wl/sys/wl_cfg80211.h b/drivers/net/wireless/bcmdhd/wl_cfg80211.h
index 4c9e516..a712617 100644
--- a/drivers/net/wireless/bcmdhd/src/wl/sys/wl_cfg80211.h
+++ b/drivers/net/wireless/bcmdhd/wl_cfg80211.h
@@ -1,14 +1,14 @@
/*
* Linux cfg80211 driver
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,12 +16,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: wl_cfg80211.h 307885 2012-01-12 23:30:48Z $
+ * $Id: wl_cfg80211.h 357867 2012-09-20 06:57:44Z $
*/
#ifndef _wl_cfg80211_h_
@@ -52,23 +52,34 @@ struct wl_ibss;
#define dtohchanspec(i) i
#define WL_DBG_NONE 0
-#define WL_DBG_SCAN2 (1 <<5)
+#define WL_DBG_P2P_ACTION (1 << 5)
#define WL_DBG_TRACE (1 << 4)
-#define WL_DBG_SCAN (1 << 3)
-#define WL_DBG_DBG (1 << 2)
+#define WL_DBG_SCAN (1 << 3)
+#define WL_DBG_DBG (1 << 2)
#define WL_DBG_INFO (1 << 1)
#define WL_DBG_ERR (1 << 0)
/* 0 invalidates all debug messages. default is 1 */
#define WL_DBG_LEVEL 0xFF
+#if defined(DHD_DEBUG)
#define WL_ERR(args) \
do { \
if (wl_dbg_level & WL_DBG_ERR) { \
printk(KERN_INFO "CFG80211-INFO2) %s : ", __func__); \
printk args; \
+ } \
+} while (0)
+#else /* defined(DHD_DEBUG) */
+#define WL_ERR(args) \
+do { \
+ if ((wl_dbg_level & WL_DBG_ERR) && net_ratelimit()) { \
+ printk(KERN_INFO "CFG80211-INFO2) %s : ", __func__); \
+ printk args; \
} \
} while (0)
+#endif /* defined(DHD_DEBUG) */
+
#ifdef WL_INFO
#undef WL_INFO
#endif
@@ -99,6 +110,20 @@ do { \
printk args; \
} \
} while (0)
+#ifdef WL_TRACE_HW4
+#undef WL_TRACE_HW4
+#endif
+#ifdef CUSTOMER_HW4
+#define WL_TRACE_HW4(args) \
+do { \
+ if (wl_dbg_level & WL_DBG_ERR) { \
+ printk(KERN_INFO "CFG80211-TRACE) %s : ", __func__); \
+ printk args; \
+ } \
+} while (0)
+#else
+#define WL_TRACE_HW4 WL_TRACE
+#endif /* CUSTOMER_HW4 */
#if (WL_DBG_LEVEL > 0)
#define WL_DBG(args) \
do { \
@@ -112,22 +137,10 @@ do { \
#endif /* (WL_DBG_LEVEL > 0) */
-#if (WL_DBG_LEVEL > 0)
-#define WL_SCAN2(args) \
-do { \
- if (wl_dbg_level & WL_DBG_SCAN2) { \
- printk(KERN_DEBUG "CFG80211-SCAN) %s :", __func__); \
- printk args; \
- } \
-} while (0)
-#else /* !(WL_DBG_LEVEL > 0) */
-#define WL_DBG(args)
-#endif /* (WL_DBG_LEVEL > 0) */
-
#define WL_SCAN_RETRY_MAX 3
#define WL_NUM_PMKIDS_MAX MAXPMKID
-#define WL_SCAN_BUF_MAX (1024 * 8)
-#define WL_TLV_INFO_MAX 1500 /* customer want to large size IE, so increase ie length */
+#define WL_SCAN_BUF_MAX (1024 * 8)
+#define WL_TLV_INFO_MAX 1500
#define WL_SCAN_IE_LEN_MAX 2048
#define WL_BSS_INFO_MAX 2048
#define WL_ASSOC_INFO_MAX 512
@@ -135,18 +148,26 @@ do { \
#define WL_EXTRA_BUF_MAX 2048
#define WL_ISCAN_BUF_MAX 2048
#define WL_ISCAN_TIMER_INTERVAL_MS 3000
-#define WL_SCAN_ERSULTS_LAST (WL_SCAN_RESULTS_NO_MEM+1)
+#define WL_SCAN_ERSULTS_LAST (WL_SCAN_RESULTS_NO_MEM+1)
#define WL_AP_MAX 256
#define WL_FILE_NAME_MAX 256
-#define WL_DWELL_TIME 200
+#define WL_DWELL_TIME 200
#define WL_MED_DWELL_TIME 400
-#define WL_LONG_DWELL_TIME 1000
-#define IFACE_MAX_CNT 2
-#define WL_SCAN_CONNECT_DWELL_TIME_MS 100
+#define WL_MIN_DWELL_TIME 100
+#define WL_LONG_DWELL_TIME 1000
+#define IFACE_MAX_CNT 2
+#define WL_SCAN_CONNECT_DWELL_TIME_MS 200
+#define WL_SCAN_JOIN_PROBE_INTERVAL_MS 20
+#define WL_AF_TX_MAX_RETRY 5
#define WL_SCAN_TIMER_INTERVAL_MS 8000 /* Scan timeout */
-#define WL_CHANNEL_SYNC_RETRY 5
-#define WL_INVALID -1
+#define WL_CHANNEL_SYNC_RETRY 5
+#define WL_INVALID -1
+
+/* Bring down SCB Timeout to 20secs from 60secs default */
+#ifndef WL_SCB_TIMEOUT
+#define WL_SCB_TIMEOUT 20
+#endif
/* driver status */
enum wl_status {
@@ -158,25 +179,33 @@ enum wl_status {
WL_STATUS_DISCONNECTING,
WL_STATUS_AP_CREATING,
WL_STATUS_AP_CREATED,
- WL_STATUS_SENDING_ACT_FRM, /* includes scanning peer chan and sending af via "actframe" */
- WL_STATUS_SCANNING_PEER_CHANNEL, /* scanning peer chan for searching peer's channel */
- /* it will be set when upper layer requests listen and succeed in setting listen mode.
- * if set, other scan request can abort current listen state */
- WL_STATUS_REMAINING_ON_CHANNEL,
-#ifdef WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST
- /* it will be set when upper layer requests listen but scan is running.
- * it's fake listen state to keep current scan process.
- * if set, other scan request will not abort scan. */
- WL_STATUS_FAKE_REMAINING_ON_CHANNEL,
-#endif /* WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST */
-#ifdef WL_CFG80211_SYNC_GON_TIME
+ /* whole sending action frame procedure:
+ * includes a) 'finding common channel' for public action request frame
+ * and b) 'sending af via 'actframe' iovar'
+ */
+ WL_STATUS_SENDING_ACT_FRM,
+ /* find a peer to go to a common channel before sending public action req frame */
+ WL_STATUS_FINDING_COMMON_CHANNEL,
/* waiting for next af to sync time of supplicant.
- * it includes SENDING_ACT_FRM and WAITING_MORE_TIME_NEXT_ACT_FRM
+ * it includes SENDING_ACT_FRM and WAITING_NEXT_ACT_FRM_LISTEN
*/
WL_STATUS_WAITING_NEXT_ACT_FRM,
+#ifdef WL_CFG80211_SYNC_GON
/* go to listen state to wait for next af after SENDING_ACT_FRM */
- WL_STATUS_WAITING_MORE_TIME_NEXT_ACT_FRM
-#endif /* WL_CFG80211_SYNC_GON_TIME */
+ WL_STATUS_WAITING_NEXT_ACT_FRM_LISTEN,
+#endif /* WL_CFG80211_SYNC_GON */
+ /* it will be set when upper layer requests listen and succeed in setting listen mode.
+ * if set, other scan request can abort current listen state
+ */
+ WL_STATUS_REMAINING_ON_CHANNEL,
+#ifdef WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST
+ /* it's fake listen state to keep current scan state.
+ * it will be set when upper layer requests listen but scan is running. then just run
+ * a expire timer without actual listen state.
+ * if set, other scan request does not need to abort scan.
+ */
+ WL_STATUS_FAKE_REMAINING_ON_CHANNEL
+#endif /* WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST */
};
/* wi-fi mode */
@@ -278,6 +307,7 @@ struct wl_security {
u32 cipher_pairwise;
u32 cipher_group;
u32 wpa_auth;
+ u32 auth_assoc_res_status;
};
/* ibss information for currently joined ibss network */
@@ -308,6 +338,7 @@ struct net_info {
struct wireless_dev *wdev;
struct wl_profile profile;
s32 mode;
+ s32 roam_off;
unsigned long sme_state;
bool pm_block;
struct list_head list; /* list of all net_info structure */
@@ -364,16 +395,33 @@ struct wl_pmk_list {
struct escan_info {
u32 escan_state;
+#if defined(STATIC_WL_PRIV_STRUCT)
+#ifndef CONFIG_DHD_USE_STATIC_BUF
+#error STATIC_WL_PRIV_STRUCT should be used with CONFIG_DHD_USE_STATIC_BUF
+#endif
+#if defined(DUAL_ESCAN_RESULT_BUFFER)
u8 *escan_buf[2];
+#else
+ u8 *escan_buf;
+#endif
+#else
+#if defined(DUAL_ESCAN_RESULT_BUFFER)
+ u8 escan_buf[2][ESCAN_BUF_SIZE];
+#else
+ u8 escan_buf[ESCAN_BUF_SIZE];
+#endif
+#endif /* STATIC_WL_PRIV_STRUCT */
+#if defined(DUAL_ESCAN_RESULT_BUFFER)
u8 cur_sync_id;
+#endif
struct wiphy *wiphy;
struct net_device *ndev;
};
struct ap_info {
/* Structure to hold WPS, WPA IEs for a AP */
- u8 probe_res_ie[IE_MAX_LEN];
- u8 beacon_ie[IE_MAX_LEN];
+ u8 probe_res_ie[VNDR_IES_MAX_BUF_LEN];
+ u8 beacon_ie[VNDR_IES_MAX_BUF_LEN];
u32 probe_res_ie_len;
u32 beacon_ie_len;
u8 *wpa_ie;
@@ -397,8 +445,8 @@ struct btcoex_info {
struct sta_info {
/* Structure to hold WPS IE for a STA */
- u8 probe_req_ie[IE_MAX_LEN];
- u8 assoc_req_ie[IE_MAX_LEN];
+ u8 probe_req_ie[VNDR_IES_BUF_LEN];
+ u8 assoc_req_ie[VNDR_IES_BUF_LEN];
u32 probe_req_ie_len;
u32 assoc_req_ie_len;
};
@@ -411,13 +459,27 @@ struct afx_hdl {
u32 bssidx;
u32 retry;
s32 peer_chan;
- s32 peer_listen_chan; /* configured by upper layer */
- s32 my_listen_chan; /* my listen channel in GON Req frame */
+ s32 peer_listen_chan; /* search channel: configured by upper layer */
+ s32 my_listen_chan; /* listen chanel: extract it from prb req or gon req */
bool is_listen;
bool ack_recv;
bool is_active;
};
+struct parsed_ies {
+ wpa_ie_fixed_t *wps_ie;
+ u32 wps_ie_len;
+ wpa_ie_fixed_t *wpa_ie;
+ u32 wpa_ie_len;
+ bcm_tlv_t *wpa2_ie;
+ u32 wpa2_ie_len;
+};
+
+#ifdef WL11U
+/* Max length of Interworking element */
+#define IW_IES_MAX_BUF_LEN 9
+#endif
+
/* private data of cfg80211 interface */
struct wl_priv {
struct wireless_dev *wdev; /* representing wl cfg80211 device */
@@ -434,9 +496,7 @@ struct wl_priv {
spinlock_t cfgdrv_lock; /* to protect scan status (and others if needed) */
struct completion act_frm_scan;
struct completion iface_disable;
-#ifdef WL_CFG80211_SYNC_GON_TIME
struct completion wait_next_af;
-#endif /* WL_CFG80211_SYNC_GON_TIME */
struct mutex usr_sync; /* maily for up/down synchronization */
struct wl_scan_results *bss_list;
struct wl_scan_results *scan_results;
@@ -444,25 +504,31 @@ struct wl_priv {
/* scan request object for internal purpose */
struct wl_scan_req *scan_req_int;
/* information element object for internal purpose */
+#if defined(STATIC_WL_PRIV_STRUCT)
struct wl_ie *ie;
+#else
+ struct wl_ie ie;
+#endif
struct wl_iscan_ctrl *iscan; /* iscan controller */
/* association information container */
+#if defined(STATIC_WL_PRIV_STRUCT)
struct wl_connect_info *conn_info;
+#else
+ struct wl_connect_info conn_info;
+#endif
struct wl_pmk_list *pmk_list; /* wpa2 pmk list */
- tsk_ctl_t event_tsk; /* task of main event handler thread */
+ tsk_ctl_t event_tsk; /* task of main event handler thread */
void *pub;
u32 iface_cnt;
u32 channel; /* current channel */
-#ifdef WL_CFG80211_SYNC_GON_TIME
u32 af_sent_channel; /* channel action frame is sent */
- /* save the next gon af subtype when it needs to wait more time for next gon af
- * default value is 0xff (-1)
- */
- u8 next_gon_af_subtype;
- ulong saved_jiffies; /* the time to send af via "actframe" iovar */
-#endif /* WL_CFG80211_SYNC_GON_TIME */
+ /* next af subtype to cancel the remained dwell time in rx process */
+ u8 next_af_subtype;
+#ifdef WL_CFG80211_SYNC_GON
+ ulong af_tx_sent_jiffies;
+#endif /* WL_CFG80211_SYNC_GON */
bool iscan_on; /* iscan on/off switch */
bool iscan_kickstart; /* indicate iscan already started */
bool escan_on; /* escan on/off switch */
@@ -477,6 +543,7 @@ struct wl_priv {
bool scan_tried; /* indicates if first scan attempted */
bool wlfc_on;
bool vsdb_mode;
+ bool roamoff_on_concurrent;
u8 *ioctl_buf; /* ioctl buffer */
struct mutex ioctl_buf_sync;
u8 *escan_ioctl_buf;
@@ -497,13 +564,19 @@ struct wl_priv {
bool p2p_supported;
struct btcoex_info *btcoex_info;
struct timer_list scan_timeout; /* Timer for catch scan event timeout */
- bool first_remain;
#ifdef WL_CFG80211_GON_COLLISION
u8 block_gon_req_tx_count;
u8 block_gon_req_rx_count;
#endif /* WL_CFG80211_GON_COLLISION */
- s32 (*state_notifier) (struct wl_priv *wl, struct net_info *_net_info, enum wl_status state, bool set);
+ s32(*state_notifier) (struct wl_priv *wl,
+ struct net_info *_net_info, enum wl_status state, bool set);
unsigned long interrested_state;
+ wlc_ssid_t hostapd_ssid;
+#ifdef WL11U
+ bool wl11u;
+ u8 iw_ie[IW_IES_MAX_BUF_LEN];
+ u32 iw_ie_len;
+#endif /* WL11U */
};
@@ -528,6 +601,7 @@ wl_alloc_netinfo(struct wl_priv *wl, struct net_device *ndev,
_net_info->ndev = ndev;
_net_info->wdev = wdev;
_net_info->pm_block = pm_block;
+ _net_info->roam_off = WL_INVALID;
wl->iface_cnt++;
list_add(&_net_info->list, &wl->net_list);
}
@@ -577,7 +651,6 @@ wl_get_status_all(struct wl_priv *wl, s32 status)
}
return cnt;
}
-
static inline void
wl_set_status_all(struct wl_priv *wl, s32 status, u32 op)
{
@@ -588,74 +661,38 @@ wl_set_status_all(struct wl_priv *wl, s32 status, u32 op)
return; /* set all status is not allowed */
case 2:
clear_bit(status, &_net_info->sme_state);
- if (wl->state_notifier && test_bit(status, &(wl->interrested_state)))
+ if (wl->state_notifier &&
+ test_bit(status, &(wl->interrested_state)))
wl->state_notifier(wl, _net_info, status, false);
break;
case 4:
return; /* change all status is not allowed */
default:
- return; /*unknown operation */
+ return; /* unknown operation */
}
}
}
-#define wl_set_status_by_netdev(wl, status, _ndev, op) \
-{ \
- struct net_info *_net_info, *next;\
- int found = 0;\
- list_for_each_entry_safe(_net_info, next, &(wl)->net_list, list) {\
- if(_ndev && ((_net_info->ndev) == _ndev)) {\
- found = 1;\
- switch(op){\
- case 1:\
- set_bit(status, &(_net_info->sme_state));\
- if (wl->state_notifier && test_bit(status, &(wl->interrested_state))) \
- wl->state_notifier(wl, _net_info, status, true); \
- if(status == WL_STATUS_SCANNING)\
- WL_SCAN2(("<<<Set SCANNING bit %p>>>\n", _ndev));\
- break;\
- case 2:\
- clear_bit(status, &(_net_info->sme_state));\
- if (wl->state_notifier && test_bit(status, &(wl->interrested_state))) \
- wl->state_notifier(wl, _net_info, status, false); \
- if(status == WL_STATUS_SCANNING)\
- WL_SCAN2(("<<<Clear SCANNING bit %p>>>\n", _ndev));\
- break;\
- case 4:\
- change_bit(status, &(_net_info->sme_state));\
- break;\
- }\
- }\
- }\
- if(found == 0)\
- WL_ERR(("<<<Set Status command with not eixst device %p>>>\n", _ndev));\
-}
-
-#if 0
static inline void
wl_set_status_by_netdev(struct wl_priv *wl, s32 status,
struct net_device *ndev, u32 op)
{
struct net_info *_net_info, *next;
- int found = 0;
list_for_each_entry_safe(_net_info, next, &wl->net_list, list) {
if (ndev && (_net_info->ndev == ndev)) {
- found = 1;
switch (op) {
case 1:
set_bit(status, &_net_info->sme_state);
-#if (WL_DBG_LEVEL > 0)
- if(status == WL_STATUS_SCANNING )
- WL_SCAN2(("<<<Set SCANNING bit %p >>>\n", ndev));
-#endif
+ if (wl->state_notifier &&
+ test_bit(status, &(wl->interrested_state)))
+ wl->state_notifier(wl, _net_info, status, true);
break;
case 2:
clear_bit(status, &_net_info->sme_state);
-#if (WL_DBG_LEVEL > 0)
- if(status == WL_STATUS_SCANNING )
- WL_SCAN2(("<<<Clear SCANNING bit %p >>>\n", ndev));
-#endif
+ if (wl->state_notifier &&
+ test_bit(status, &(wl->interrested_state)))
+ wl->state_notifier(wl, _net_info, status, false);
break;
case 4:
change_bit(status, &_net_info->sme_state);
@@ -664,11 +701,9 @@ wl_set_status_by_netdev(struct wl_priv *wl, s32 status,
}
}
- if(found ==0 )
- WL_ERR(("<<Set Status command with not exist device %p>>\n", ndev));
}
-#endif
+
static inline u32
wl_get_status_by_netdev(struct wl_priv *wl, s32 status,
struct net_device *ndev)
@@ -721,6 +756,7 @@ static inline struct net_info *
wl_get_netinfo_by_netdev(struct wl_priv *wl, struct net_device *ndev)
{
struct net_info *_net_info, *next;
+
list_for_each_entry_safe(_net_info, next, &wl->net_list, list) {
if (ndev && (_net_info->ndev == ndev))
return _net_info;
@@ -731,10 +767,15 @@ wl_get_netinfo_by_netdev(struct wl_priv *wl, struct net_device *ndev)
#define wl_to_prmry_ndev(w) (w->wdev->netdev)
#define ndev_to_wl(n) (wdev_to_wl(n->ieee80211_ptr))
#define wl_to_sr(w) (w->scan_req_int)
+#if defined(STATIC_WL_PRIV_STRUCT)
#define wl_to_ie(w) (w->ie)
+#define wl_to_conn(w) (w->conn_info)
+#else
+#define wl_to_ie(w) (&w->ie)
+#define wl_to_conn(w) (&w->conn_info)
+#endif
#define iscan_to_wl(i) ((struct wl_priv *)(i->data))
#define wl_to_iscan(w) (w->iscan)
-#define wl_to_conn(w) (w->conn_info)
#define wiphy_from_scan(w) (w->escan_info.wiphy)
#define wl_get_drv_status_all(wl, stat) \
(wl_get_status_all(wl, WL_STATUS_ ## stat))
@@ -777,7 +818,7 @@ extern s32 wl_cfg80211_down(void *para);
extern s32 wl_cfg80211_notify_ifadd(struct net_device *ndev, s32 idx, s32 bssidx,
void* _net_attach);
extern s32 wl_cfg80211_ifdel_ops(struct net_device *net);
-extern s32 wl_cfg80211_notify_ifdel(struct net_device *ndev);
+extern s32 wl_cfg80211_notify_ifdel(void);
extern s32 wl_cfg80211_is_progress_ifadd(void);
extern s32 wl_cfg80211_is_progress_ifchange(void);
extern s32 wl_cfg80211_is_progress_ifadd(void);
@@ -792,11 +833,10 @@ extern s32 wl_cfg80211_set_p2p_ps(struct net_device *net, char* buf, int len);
extern int wl_cfg80211_hang(struct net_device *dev, u16 reason);
extern s32 wl_mode_to_nl80211_iftype(s32 mode);
int wl_cfg80211_do_driver_init(struct net_device *net);
-void wl_cfg80211_enable_trace(int level);
+void wl_cfg80211_enable_trace(bool set, u32 level);
extern s32 wl_update_wiphybands(struct wl_priv *wl);
-/* do scan abort */
-extern s32 wl_cfg80211_scan_abort(struct wl_priv *wl, struct net_device *ndev);
-
extern s32 wl_cfg80211_if_is_group_owner(void);
+extern chanspec_t wl_ch_host_to_driver(u16 channel);
extern s32 wl_add_remove_eventmsg(struct net_device *ndev, u16 event, bool add);
+extern void wl_stop_wait_next_action_frame(struct wl_priv *wl, struct net_device *ndev);
#endif /* _wl_cfg80211_h_ */
diff --git a/drivers/net/wireless/bcmdhd/src/wl/sys/wl_cfgp2p.c b/drivers/net/wireless/bcmdhd/wl_cfgp2p.c
index 9071637..a0f113e 100644
--- a/drivers/net/wireless/bcmdhd/src/wl/sys/wl_cfgp2p.c
+++ b/drivers/net/wireless/bcmdhd/wl_cfgp2p.c
@@ -2,13 +2,13 @@
* Linux cfgp2p driver
*
* Copyright (C) 1999-2012, Broadcom Corporation
- *
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,12 +16,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: wl_cfgp2p.c 308397 2012-01-15 07:32:58Z $
+ * $Id: wl_cfgp2p.c 357864 2012-09-20 06:41:42Z $
*
*/
#include <typedefs.h>
@@ -35,17 +35,13 @@
#include <linux/string.h>
#include <linux/timer.h>
#include <linux/if_arp.h>
-#include <linux/random.h>
#include <asm/uaccess.h>
#include <bcmutils.h>
#include <bcmendian.h>
#include <proto/ethernet.h>
-#include <dngl_stats.h>
-#include <dhd.h>
-#include <dhdioctl.h>
-#include <wlioctl.h>
-#include <dhd_cfg80211.h>
+#include <proto/802.11.h>
+
#include <wl_cfg80211.h>
#include <wl_cfgp2p.h>
#include <wldev_common.h>
@@ -53,7 +49,6 @@
static s8 scanparambuf[WLC_IOCTL_SMLEN];
static s8 g_mgmt_ie_buf[2048];
-extern struct wl_priv *wlcfg_drv_priv;
static bool
wl_cfgp2p_has_ie(u8 *ie, u8 **tlvs, u32 *tlvs_len, const u8 *oui, u32 oui_len, u8 type);
@@ -65,6 +60,8 @@ static int wl_cfgp2p_start_xmit(struct sk_buff *skb, struct net_device *ndev);
static int wl_cfgp2p_do_ioctl(struct net_device *net, struct ifreq *ifr, int cmd);
static int wl_cfgp2p_if_open(struct net_device *net);
static int wl_cfgp2p_if_stop(struct net_device *net);
+static s32 wl_cfgp2p_cancel_listen(struct wl_priv *wl, struct net_device *ndev,
+ bool notify);
static const struct net_device_ops wl_cfgp2p_if_ops = {
.ndo_open = wl_cfgp2p_if_open,
@@ -111,6 +108,46 @@ bool wl_cfgp2p_is_p2p_action(void *frame, u32 frame_len)
return false;
}
+
+/*
+* Currently Action frame just pass to P2P interface regardless real dst.
+* but GAS Action can be used for Hotspot2.0 as well
+* Need to distingush that it's for P2P or HS20
+*/
+#ifdef WL11U
+#define GAS_RESP_LEN 2
+#define DOUBLE_TLV_BODY_OFF 4
+#define GAS_RESP_OFFSET 4
+#define GAS_CRESP_OFFSET 5
+
+bool wl_cfgp2p_find_gas_subtype(u8 subtype, u8* data, u32 len)
+{
+ bcm_tlv_t *ie = (bcm_tlv_t *)data;
+ u8 *frame = NULL;
+ u16 id, flen;
+
+ /* Skipped first ANQP Element, if frame has anqp elemnt */
+ ie = bcm_parse_tlvs(ie, (int)len, DOT11_MNG_ADVERTISEMENT_ID);
+
+ if (ie == NULL)
+ return false;
+
+ frame = (uint8 *)ie + ie->len + TLV_HDR_LEN + GAS_RESP_LEN;
+ id = ((u16) (((frame)[1] << 8) | (frame)[0]));
+ flen = ((u16) (((frame)[3] << 8) | (frame)[2]));
+
+ /* If the contents match the OUI and the type */
+ if (flen >= WFA_OUI_LEN + 1 &&
+ id == P2PSD_GAS_NQP_INFOID &&
+ !bcmp(&frame[DOUBLE_TLV_BODY_OFF], (const uint8*)WFA_OUI, WFA_OUI_LEN) &&
+ subtype == frame[DOUBLE_TLV_BODY_OFF+WFA_OUI_LEN]) {
+ return true;
+ }
+
+ return false;
+}
+#endif /* WL11U */
+
bool wl_cfgp2p_is_gas_action(void *frame, u32 frame_len)
{
@@ -125,6 +162,22 @@ bool wl_cfgp2p_is_gas_action(void *frame, u32 frame_len)
if (sd_act_frm->category != P2PSD_ACTION_CATEGORY)
return false;
+#ifdef WL11U
+ if (sd_act_frm->action == P2PSD_ACTION_ID_GAS_IRESP)
+ return wl_cfgp2p_find_gas_subtype(P2PSD_GAS_OUI_SUBTYPE,
+ (u8 *)sd_act_frm->query_data + GAS_RESP_OFFSET,
+ frame_len);
+
+ else if (sd_act_frm->action == P2PSD_ACTION_ID_GAS_CRESP)
+ return wl_cfgp2p_find_gas_subtype(P2PSD_GAS_OUI_SUBTYPE,
+ (u8 *)sd_act_frm->query_data + GAS_CRESP_OFFSET,
+ frame_len);
+ else if (sd_act_frm->action == P2PSD_ACTION_ID_GAS_IREQ ||
+ sd_act_frm->action == P2PSD_ACTION_ID_GAS_CREQ)
+ return true;
+ else
+ return false;
+#else
if (sd_act_frm->action == P2PSD_ACTION_ID_GAS_IREQ ||
sd_act_frm->action == P2PSD_ACTION_ID_GAS_IRESP ||
sd_act_frm->action == P2PSD_ACTION_ID_GAS_CREQ ||
@@ -132,57 +185,57 @@ bool wl_cfgp2p_is_gas_action(void *frame, u32 frame_len)
return true;
else
return false;
-
+#endif /* WLC11U */
}
void wl_cfgp2p_print_actframe(bool tx, void *frame, u32 frame_len)
{
wifi_p2p_pub_act_frame_t *pact_frm;
wifi_p2p_action_frame_t *act_frm;
wifi_p2psd_gas_pub_act_frame_t *sd_act_frm;
- if(!frame || frame_len <= 2)
+ if (!frame || frame_len <= 2)
return;
if (wl_cfgp2p_is_pub_action(frame, frame_len)) {
pact_frm = (wifi_p2p_pub_act_frame_t *)frame;
- switch(pact_frm->subtype) {
+ switch (pact_frm->subtype) {
case P2P_PAF_GON_REQ:
- CFGP2P_ERR(("%s P2P Group Owner Negotiation Req Frame\n",
+ CFGP2P_ACTION(("%s P2P Group Owner Negotiation Req Frame\n",
(tx)? "TX": "RX"));
break;
case P2P_PAF_GON_RSP:
- CFGP2P_ERR(("%s P2P Group Owner Negotiation Rsp Frame\n",
+ CFGP2P_ACTION(("%s P2P Group Owner Negotiation Rsp Frame\n",
(tx)? "TX": "RX"));
break;
case P2P_PAF_GON_CONF:
- CFGP2P_ERR(("%s P2P Group Owner Negotiation Confirm Frame\n",
+ CFGP2P_ACTION(("%s P2P Group Owner Negotiation Confirm Frame\n",
(tx)? "TX": "RX"));
break;
case P2P_PAF_INVITE_REQ:
- CFGP2P_ERR(("%s P2P Invitation Request Frame\n",
+ CFGP2P_ACTION(("%s P2P Invitation Request Frame\n",
(tx)? "TX": "RX"));
break;
case P2P_PAF_INVITE_RSP:
- CFGP2P_ERR(("%s P2P Invitation Response Frame\n",
+ CFGP2P_ACTION(("%s P2P Invitation Response Frame\n",
(tx)? "TX": "RX"));
break;
case P2P_PAF_DEVDIS_REQ:
- CFGP2P_ERR(("%s P2P Device Discoverability Request Frame\n",
+ CFGP2P_ACTION(("%s P2P Device Discoverability Request Frame\n",
(tx)? "TX": "RX"));
break;
case P2P_PAF_DEVDIS_RSP:
- CFGP2P_ERR(("%s P2P Device Discoverability Response Frame\n",
+ CFGP2P_ACTION(("%s P2P Device Discoverability Response Frame\n",
(tx)? "TX": "RX"));
break;
case P2P_PAF_PROVDIS_REQ:
- CFGP2P_ERR(("%s P2P Provision Discovery Request Frame\n",
+ CFGP2P_ACTION(("%s P2P Provision Discovery Request Frame\n",
(tx)? "TX": "RX"));
break;
case P2P_PAF_PROVDIS_RSP:
- CFGP2P_ERR(("%s P2P Provision Discovery Response Frame\n",
+ CFGP2P_ACTION(("%s P2P Provision Discovery Response Frame\n",
(tx)? "TX": "RX"));
break;
default:
- CFGP2P_ERR(("%s Unknown P2P Public Action Frame\n",
+ CFGP2P_ACTION(("%s Unknown P2P Public Action Frame\n",
(tx)? "TX": "RX"));
}
@@ -191,53 +244,52 @@ void wl_cfgp2p_print_actframe(bool tx, void *frame, u32 frame_len)
act_frm = (wifi_p2p_action_frame_t *)frame;
switch (act_frm->subtype) {
case P2P_AF_NOTICE_OF_ABSENCE:
- CFGP2P_ERR(("%s P2P Notice of Absence Frame\n",
+ CFGP2P_ACTION(("%s P2P Notice of Absence Frame\n",
(tx)? "TX": "RX"));
break;
case P2P_AF_PRESENCE_REQ:
- CFGP2P_ERR(("%s P2P Presence Request Frame\n",
+ CFGP2P_ACTION(("%s P2P Presence Request Frame\n",
(tx)? "TX": "RX"));
break;
case P2P_AF_PRESENCE_RSP:
- CFGP2P_ERR(("%s P2P Presence Response Frame\n",
+ CFGP2P_ACTION(("%s P2P Presence Response Frame\n",
(tx)? "TX": "RX"));
break;
case P2P_AF_GO_DISC_REQ:
- CFGP2P_ERR(("%s P2P Discoverability Request Frame\n",
+ CFGP2P_ACTION(("%s P2P Discoverability Request Frame\n",
(tx)? "TX": "RX"));
break;
default:
- CFGP2P_ERR(("%s Unknown P2P Action Frame\n",
+ CFGP2P_ACTION(("%s Unknown P2P Action Frame\n",
(tx)? "TX": "RX"));
}
} else if (wl_cfgp2p_is_gas_action(frame, frame_len)) {
sd_act_frm = (wifi_p2psd_gas_pub_act_frame_t *)frame;
- switch(sd_act_frm->action) {
+ switch (sd_act_frm->action) {
case P2PSD_ACTION_ID_GAS_IREQ:
- CFGP2P_ERR(("%s P2P GAS Initial Request\n",
+ CFGP2P_ACTION(("%s P2P GAS Initial Request\n",
(tx)? "TX" : "RX"));
break;
case P2PSD_ACTION_ID_GAS_IRESP:
- CFGP2P_ERR(("%s P2P GAS Initial Response\n",
+ CFGP2P_ACTION(("%s P2P GAS Initial Response\n",
(tx)? "TX" : "RX"));
break;
case P2PSD_ACTION_ID_GAS_CREQ:
- CFGP2P_ERR(("%s P2P GAS Comback Request\n",
+ CFGP2P_ACTION(("%s P2P GAS Comback Request\n",
(tx)? "TX" : "RX"));
break;
case P2PSD_ACTION_ID_GAS_CRESP:
- CFGP2P_ERR(("%s P2P GAS Comback Response\n",
+ CFGP2P_ACTION(("%s P2P GAS Comback Response\n",
(tx)? "TX" : "RX"));
break;
default:
- CFGP2P_ERR(("%s Unknown P2P GAS Frame\n",
+ CFGP2P_ACTION(("%s Unknown P2P GAS Frame\n",
(tx)? "TX" : "RX"));
}
}
-
}
/*
@@ -280,7 +332,6 @@ wl_cfgp2p_init_priv(struct wl_priv *wl)
wl_to_p2p_bss_bssidx(wl, P2PAPI_BSSCFG_DEVICE) = 0;
wl_to_p2p_bss_ndev(wl, P2PAPI_BSSCFG_CONNECTION) = NULL;
wl_to_p2p_bss_bssidx(wl, P2PAPI_BSSCFG_CONNECTION) = 0;
- spin_lock_init(&wl->p2p->timer_lock);
return BCME_OK;
}
@@ -332,7 +383,7 @@ wl_cfgp2p_set_firm_p2p(struct wl_priv *wl)
ret = wldev_iovar_setbuf_bsscfg(ndev, "p2p_da_override", &null_eth_addr,
sizeof(null_eth_addr), wl->ioctl_buf, WLC_IOCTL_MAXLEN, 0, &wl->ioctl_buf_sync);
if (ret && ret != BCME_UNSUPPORTED) {
- CFGP2P_ERR(("failed to update device address\n"));
+ CFGP2P_ERR(("failed to update device address ret %d\n", ret));
}
return ret;
}
@@ -350,16 +401,15 @@ wl_cfgp2p_ifadd(struct wl_priv *wl, struct ether_addr *mac, u8 if_type,
{
wl_p2p_if_t ifreq;
s32 err;
- u32 scb_timeout=10;
+ u32 scb_timeout = WL_SCB_TIMEOUT;
struct net_device *ndev = wl_to_prmry_ndev(wl);
ifreq.type = if_type;
ifreq.chspec = chspec;
memcpy(ifreq.addr.octet, mac->octet, sizeof(ifreq.addr.octet));
- CFGP2P_INFO(("---wl p2p_ifadd %02x:%02x:%02x:%02x:%02x:%02x %s %u\n",
- ifreq.addr.octet[0], ifreq.addr.octet[1], ifreq.addr.octet[2],
- ifreq.addr.octet[3], ifreq.addr.octet[4], ifreq.addr.octet[5],
+ CFGP2P_DBG(("---wl p2p_ifadd "MACDBG" %s %u\n",
+ STR_TO_MACD(ifreq.addr.octet),
(if_type == WL_P2P_IF_GO) ? "go" : "client",
(chspec & WL_CHANSPEC_CHAN_MASK) >> WL_CHANSPEC_CHAN_SHIFT));
@@ -373,7 +423,6 @@ wl_cfgp2p_ifadd(struct wl_priv *wl, struct ether_addr *mac, u8 if_type,
if (unlikely(err < 0))
printk("'wl scb_timeout' error %d\n", err);
}
-
return err;
}
@@ -388,9 +437,8 @@ wl_cfgp2p_ifdisable(struct wl_priv *wl, struct ether_addr *mac)
s32 ret;
struct net_device *netdev = wl_to_prmry_ndev(wl);
- CFGP2P_INFO(("------primary idx %d : wl p2p_ifdis %02x:%02x:%02x:%02x:%02x:%02x\n",
- netdev->ifindex, mac->octet[0], mac->octet[1], mac->octet[2],
- mac->octet[3], mac->octet[4], mac->octet[5]));
+ CFGP2P_INFO(("------primary idx %d : wl p2p_ifdis "MACDBG"\n",
+ netdev->ifindex, STR_TO_MACD(mac->octet)));
ret = wldev_iovar_setbuf(netdev, "p2p_ifdis", mac, sizeof(*mac),
wl->ioctl_buf, WLC_IOCTL_MAXLEN, &wl->ioctl_buf_sync);
if (unlikely(ret < 0)) {
@@ -410,9 +458,8 @@ wl_cfgp2p_ifdel(struct wl_priv *wl, struct ether_addr *mac)
s32 ret;
struct net_device *netdev = wl_to_prmry_ndev(wl);
- CFGP2P_INFO(("------primary idx %d : wl p2p_ifdel %02x:%02x:%02x:%02x:%02x:%02x\n",
- netdev->ifindex, mac->octet[0], mac->octet[1], mac->octet[2],
- mac->octet[3], mac->octet[4], mac->octet[5]));
+ CFGP2P_INFO(("------primary idx %d : wl p2p_ifdel "MACDBG"\n",
+ netdev->ifindex, STR_TO_MACD(mac->octet)));
ret = wldev_iovar_setbuf(netdev, "p2p_ifdel", mac, sizeof(*mac),
wl->ioctl_buf, WLC_IOCTL_MAXLEN, &wl->ioctl_buf_sync);
if (unlikely(ret < 0)) {
@@ -432,18 +479,17 @@ wl_cfgp2p_ifchange(struct wl_priv *wl, struct ether_addr *mac, u8 if_type,
{
wl_p2p_if_t ifreq;
s32 err;
- u32 scb_timeout=10;
+ u32 scb_timeout = WL_SCB_TIMEOUT;
+
struct net_device *netdev = wl_to_p2p_bss_ndev(wl, P2PAPI_BSSCFG_CONNECTION);
ifreq.type = if_type;
ifreq.chspec = chspec;
memcpy(ifreq.addr.octet, mac->octet, sizeof(ifreq.addr.octet));
- CFGP2P_INFO(("---wl p2p_ifchange %02x:%02x:%02x:%02x:%02x:%02x %s %u"
- " chanspec 0x%04x\n",
- ifreq.addr.octet[0], ifreq.addr.octet[1], ifreq.addr.octet[2],
- ifreq.addr.octet[3], ifreq.addr.octet[4], ifreq.addr.octet[5],
- (if_type == WL_P2P_IF_GO) ? "go" : "client",
+ CFGP2P_INFO(("---wl p2p_ifchange "MACDBG" %s %u"
+ " chanspec 0x%04x\n", STR_TO_MACD(ifreq.addr.octet),
+ (if_type == WL_P2P_IF_GO) ? "go" : "client",
(chspec & WL_CHANSPEC_CHAN_MASK) >> WL_CHANSPEC_CHAN_SHIFT,
ifreq.chspec));
@@ -474,9 +520,7 @@ wl_cfgp2p_ifidx(struct wl_priv *wl, struct ether_addr *mac, s32 *index)
u8 getbuf[64];
struct net_device *dev = wl_to_prmry_ndev(wl);
- CFGP2P_INFO(("---wl p2p_if %02x:%02x:%02x:%02x:%02x:%02x\n",
- mac->octet[0], mac->octet[1], mac->octet[2],
- mac->octet[3], mac->octet[4], mac->octet[5]));
+ CFGP2P_INFO(("---wl p2p_if "MACDBG"\n", STR_TO_MACD(mac->octet)));
ret = wldev_iovar_getbuf_bsscfg(dev, "p2p_if", mac, sizeof(*mac), getbuf,
sizeof(getbuf), wl_to_p2p_bss_bssidx(wl, P2PAPI_BSSCFG_PRIMARY), NULL);
@@ -521,6 +565,7 @@ wl_cfgp2p_set_p2p_mode(struct wl_priv *wl, u8 mode, u32 channel, u16 listen_ms,
s32 ret;
struct net_device *dev;
CFGP2P_DBG(("enter\n"));
+
if (unlikely(bssidx == WL_INVALID || bssidx >= P2PAPI_BSSCFG_MAX)) {
CFGP2P_ERR((" %d index out of range\n", bssidx));
return -1;
@@ -534,7 +579,7 @@ wl_cfgp2p_set_p2p_mode(struct wl_priv *wl, u8 mode, u32 channel, u16 listen_ms,
/* Put the WL driver into P2P Listen Mode to respond to P2P probe reqs */
discovery_mode.state = mode;
- discovery_mode.chspec = CH20MHZ_CHSPEC(channel);
+ discovery_mode.chspec = wl_ch_host_to_driver(channel);
discovery_mode.dwell = listen_ms;
ret = wldev_iovar_setbuf_bsscfg(dev, "p2p_state", &discovery_mode,
sizeof(discovery_mode), wl->ioctl_buf, WLC_IOCTL_MAXLEN,
@@ -591,7 +636,7 @@ wl_cfgp2p_init_discovery(struct wl_priv *wl)
/* Set the initial discovery state to SCAN */
ret = wl_cfgp2p_set_p2p_mode(wl, WL_P2P_DISC_ST_SCAN, 0, 0,
- wl_to_p2p_bss_bssidx(wl, P2PAPI_BSSCFG_DEVICE));
+ wl_to_p2p_bss_bssidx(wl, P2PAPI_BSSCFG_DEVICE));
if (unlikely(ret != 0)) {
CFGP2P_ERR(("unable to set WL_P2P_DISC_ST_SCAN\n"));
@@ -650,6 +695,8 @@ wl_cfgp2p_enable_discovery(struct wl_priv *wl, struct net_device *dev,
const u8 *ie, u32 ie_len)
{
s32 ret = BCME_OK;
+ s32 bssidx = (wl_to_prmry_ndev(wl) == dev) ?
+ wl_to_p2p_bss_bssidx(wl, P2PAPI_BSSCFG_DEVICE) : wl_cfgp2p_find_idx(wl, dev);
if (wl_get_p2p_status(wl, DISCOVERY_ON)) {
CFGP2P_INFO((" DISCOVERY is already initialized, we have nothing to do\n"));
goto set_ie;
@@ -674,13 +721,15 @@ wl_cfgp2p_enable_discovery(struct wl_priv *wl, struct net_device *dev,
CFGP2P_ERR((" wsec error %d\n", ret));
}
set_ie:
- ret = wl_cfgp2p_set_management_ie(wl, dev,
- wl_to_p2p_bss_bssidx(wl, P2PAPI_BSSCFG_DEVICE),
- VNDR_IE_PRBREQ_FLAG, ie, ie_len);
-
- if (unlikely(ret < 0)) {
- CFGP2P_ERR(("set probreq ie occurs error %d\n", ret));
- goto exit;
+ if (ie_len) {
+ ret = wl_cfgp2p_set_management_ie(wl, dev,
+ bssidx,
+ VNDR_IE_PRBREQ_FLAG, ie, ie_len);
+
+ if (unlikely(ret < 0)) {
+ CFGP2P_ERR(("set probreq ie occurs error %d\n", ret));
+ goto exit;
+ }
}
exit:
return ret;
@@ -747,7 +796,6 @@ wl_cfgp2p_escan(struct wl_priv *wl, struct net_device *dev, u16 active,
#define P2PAPI_SCAN_AF_SEARCH_DWELL_TIME_MS 100
struct net_device *pri_dev = wl_to_p2p_bss_ndev(wl, P2PAPI_BSSCFG_PRIMARY);
- //wl_set_p2p_status(wl, SCANNING);
/* Allocate scan params which need space for 3 channels and 0 ssids */
eparams_size = (WL_SCAN_PARAMS_FIXED_SIZE +
OFFSETOF(wl_escan_params_t, params)) +
@@ -777,10 +825,15 @@ wl_cfgp2p_escan(struct wl_priv *wl, struct net_device *dev, u16 active,
* we have to set ssid to P2P WILDCARD because
* we just do broadcast scan unless setting SSID
*/
- strcpy(ssid.SSID, WL_P2P_WILDCARD_SSID);
+ strncpy(ssid.SSID, WL_P2P_WILDCARD_SSID, sizeof(ssid.SSID) - 1);
+ ssid.SSID[sizeof(ssid.SSID) - 1] = 0;
ssid.SSID_len = htod32(WL_P2P_WILDCARD_SSID_LEN);
wl_cfgp2p_set_p2p_mode(wl, WL_P2P_DISC_ST_SCAN, 0, 0, bssidx);
}
+ else {
+ CFGP2P_ERR((" invalid search state %d\n", search_state));
+ return -1;
+ }
/* Fill in the P2P scan structure at the start of the iovar param block */
@@ -800,18 +853,29 @@ wl_cfgp2p_escan(struct wl_priv *wl, struct net_device *dev, u16 active,
eparams->params.home_time = htod32(P2PAPI_SCAN_HOME_TIME_MS);
- if (num_chans == SOCIAL_CHAN_CNT)
+ /* SOCIAL_CHAN_CNT + 1 takes care of the Progressive scan supported by
+ * the supplicant
+ */
+ if ((num_chans == SOCIAL_CHAN_CNT) || (num_chans == SOCIAL_CHAN_CNT + 1))
eparams->params.active_time = htod32(P2PAPI_SCAN_SOCIAL_DWELL_TIME_MS);
else if (num_chans == AF_PEER_SEARCH_CNT)
eparams->params.active_time = htod32(P2PAPI_SCAN_AF_SEARCH_DWELL_TIME_MS);
- else if (num_chans == 1)
- eparams->params.active_time = htod32(WL_SCAN_CONNECT_DWELL_TIME_MS);
else if (wl_get_drv_status_all(wl, CONNECTED))
eparams->params.active_time = -1;
else
eparams->params.active_time = htod32(P2PAPI_SCAN_DWELL_TIME_MS);
eparams->params.nprobes = htod32((eparams->params.active_time /
P2PAPI_SCAN_NPROBS_TIME_MS));
+
+ /* Override scan params to find a peer for a connection */
+ if (num_chans == 1) {
+ eparams->params.active_time = htod32(WL_SCAN_CONNECT_DWELL_TIME_MS);
+ eparams->params.nprobes = htod32(eparams->params.active_time /
+ WL_SCAN_JOIN_PROBE_INTERVAL_MS);
+ }
+
+ if (eparams->params.nprobes <= 0)
+ eparams->params.nprobes = 1;
CFGP2P_DBG(("nprobes # %d, active_time %d\n",
eparams->params.nprobes, eparams->params.active_time));
eparams->params.passive_time = htod32(-1);
@@ -819,11 +883,15 @@ wl_cfgp2p_escan(struct wl_priv *wl, struct net_device *dev, u16 active,
(num_chans & WL_SCAN_PARAMS_COUNT_MASK));
for (i = 0; i < num_chans; i++) {
- eparams->params.channel_list[i] = htodchanspec(channels[i]);
+ eparams->params.channel_list[i] = wl_ch_host_to_driver(channels[i]);
}
eparams->version = htod32(ESCAN_REQ_VERSION);
eparams->action = htod16(action);
+#if defined(DUAL_ESCAN_RESULT_BUFFER)
eparams->sync_id = wl->escan_info.cur_sync_id;
+#else
+ eparams->sync_id = htod16(0x1234);
+#endif
CFGP2P_INFO(("SCAN CHANNELS : "));
for (i = 0; i < num_chans; i++) {
@@ -856,15 +924,13 @@ wl_cfgp2p_act_frm_search(struct wl_priv *wl, struct net_device *ndev,
u16 *default_chan_list = NULL;
if (!p2p_is_on(wl) || ndev == NULL || bssidx == WL_INVALID)
return -BCME_ERROR;
- CFGP2P_DBG((" Enter\n"));
+ CFGP2P_ERR((" Enter\n"));
if (bssidx == P2PAPI_BSSCFG_PRIMARY)
bssidx = wl_to_p2p_bss_bssidx(wl, P2PAPI_BSSCFG_DEVICE);
-
if (channel)
chan_cnt = AF_PEER_SEARCH_CNT;
else
chan_cnt = SOCIAL_CHAN_CNT;
-
default_chan_list = kzalloc(chan_cnt * sizeof(*default_chan_list), GFP_KERNEL);
if (default_chan_list == NULL) {
CFGP2P_ERR(("channel list allocation failed \n"));
@@ -900,14 +966,67 @@ exit:
#define wl_cfgp2p_is_p2p_ie(ie, tlvs, len) wl_cfgp2p_has_ie(ie, tlvs, len, \
(const uint8 *)WFA_OUI, WFA_OUI_LEN, WFA_OUI_TYPE_P2P)
/* Check whether the given IE looks like WFA WFDisplay IE. */
-#define WFA_OUI_TYPE_WFD 0x0a /* WiFi Display OUI TYPE */
+#define WFA_OUI_TYPE_WFD 0x0a /* WiFi Display OUI TYPE */
#define wl_cfgp2p_is_wfd_ie(ie, tlvs, len) wl_cfgp2p_has_ie(ie, tlvs, len, \
(const uint8 *)WFA_OUI, WFA_OUI_LEN, WFA_OUI_TYPE_WFD)
-#define SAMSUNG_OUI "\x00\x00\xf0"
-#define SAMSUNG_OUI_LEN 3
-#define wl_cfgp2p_is_customer_ie(ie, tlvs, len) wl_cfgp2p_has_ie(ie, tlvs, len, \
- (const uint8 *)SAMSUNG_OUI, 3, 0)
+static s32
+wl_cfgp2p_parse_vndr_ies(u8 *parse, u32 len,
+ struct parsed_vndr_ies *vndr_ies)
+{
+ s32 err = BCME_OK;
+ vndr_ie_t *vndrie;
+ bcm_tlv_t *ie;
+ struct parsed_vndr_ie_info *parsed_info;
+ u32 count = 0;
+ s32 remained_len;
+
+ remained_len = (s32)len;
+ memset(vndr_ies, 0, sizeof(*vndr_ies));
+
+ WL_INFO(("---> len %d\n", len));
+ ie = (bcm_tlv_t *) parse;
+ if (!bcm_valid_tlv(ie, remained_len))
+ ie = NULL;
+ while (ie) {
+ if (count >= MAX_VNDR_IE_NUMBER)
+ break;
+ if (ie->id == DOT11_MNG_VS_ID) {
+ vndrie = (vndr_ie_t *) ie;
+ /* len should be bigger than OUI length + one data length at least */
+ if (vndrie->len < (VNDR_IE_MIN_LEN + 1)) {
+ CFGP2P_ERR(("%s: invalid vndr ie. length is too small %d\n",
+ __FUNCTION__, vndrie->len));
+ goto end;
+ }
+ /* if wpa or wme ie, do not add ie */
+ if (!bcmp(vndrie->oui, (u8*)WPA_OUI, WPA_OUI_LEN) &&
+ ((vndrie->data[0] == WPA_OUI_TYPE) ||
+ (vndrie->data[0] == WME_OUI_TYPE))) {
+ CFGP2P_DBG(("Found WPA/WME oui. Do not add it\n"));
+ goto end;
+ }
+
+ parsed_info = &vndr_ies->ie_info[count++];
+
+ /* save vndr ie information */
+ parsed_info->ie_ptr = (char *)vndrie;
+ parsed_info->ie_len = (vndrie->len + TLV_HDR_LEN);
+ memcpy(&parsed_info->vndrie, vndrie, sizeof(vndr_ie_t));
+
+ vndr_ies->count = count;
+
+ CFGP2P_DBG(("\t ** OUI %02x %02x %02x, type 0x%02x \n",
+ parsed_info->vndrie.oui[0], parsed_info->vndrie.oui[1],
+ parsed_info->vndrie.oui[2], parsed_info->vndrie.data[0]));
+ }
+end:
+ ie = bcm_next_tlv(ie, &remained_len);
+ }
+ return err;
+}
+
+
/* Delete and Set a management vndr ie to firmware
* Parameters:
* @wl : wl_private data
@@ -924,25 +1043,26 @@ s32
wl_cfgp2p_set_management_ie(struct wl_priv *wl, struct net_device *ndev, s32 bssidx,
s32 pktflag, const u8 *vndr_ie, u32 vndr_ie_len)
{
- /* Vendor-specific Information Element ID */
-#define VNDR_SPEC_ELEMENT_ID 0xdd
s32 ret = BCME_OK;
- u32 pos;
- u8 *ie_buf;
u8 *curr_ie_buf = NULL;
u8 *mgmt_ie_buf = NULL;
u32 mgmt_ie_buf_len = 0;
u32 *mgmt_ie_len = 0;
u32 del_add_ie_buf_len = 0;
u32 total_ie_buf_len = 0;
- u8 ie_id, ie_len;
+ u32 parsed_ie_buf_len = 0;
+ struct parsed_vndr_ies old_vndr_ies;
+ struct parsed_vndr_ies new_vndr_ies;
+ s32 i;
+ u8 *ptr;
+ s32 remained_buf_len;
+
#define IE_TYPE(type, bsstype) (wl_to_p2p_bss_saved_ie(wl, bsstype).p2p_ ## type ## _ie)
#define IE_TYPE_LEN(type, bsstype) (wl_to_p2p_bss_saved_ie(wl, bsstype).p2p_ ## type ## _ie_len)
memset(g_mgmt_ie_buf, 0, sizeof(g_mgmt_ie_buf));
curr_ie_buf = g_mgmt_ie_buf;
- if (p2p_is_on(wl) && bssidx != -1) {
- if (bssidx == P2PAPI_BSSCFG_PRIMARY)
- bssidx = wl_to_p2p_bss_bssidx(wl, P2PAPI_BSSCFG_DEVICE);
+ CFGP2P_DBG((" bssidx %d, pktflag : 0x%02X\n", bssidx, pktflag));
+ if (wl->p2p != NULL) {
switch (pktflag) {
case VNDR_IE_PRBREQ_FLAG :
mgmt_ie_buf = IE_TYPE(probe_req, bssidx);
@@ -994,7 +1114,7 @@ wl_cfgp2p_set_management_ie(struct wl_priv *wl, struct net_device *ndev, s32 bss
return -1;
}
bssidx = 0;
- } else if (bssidx == -1 && wl_get_mode_by_netdev(wl, ndev) == WL_MODE_BSS) {
+ } else if (wl_get_mode_by_netdev(wl, ndev) == WL_MODE_BSS) {
switch (pktflag) {
case VNDR_IE_PRBREQ_FLAG :
mgmt_ie_buf = wl->sta_info->probe_req_ie;
@@ -1022,66 +1142,106 @@ wl_cfgp2p_set_management_ie(struct wl_priv *wl, struct net_device *ndev, s32 bss
CFGP2P_ERR(("extra IE size too big\n"));
ret = -ENOMEM;
} else {
+ /* parse and save new vndr_ie in curr_ie_buff before comparing it */
+ if (vndr_ie && vndr_ie_len && curr_ie_buf) {
+ ptr = curr_ie_buf;
+
+ wl_cfgp2p_parse_vndr_ies((u8*)vndr_ie,
+ vndr_ie_len, &new_vndr_ies);
+
+ for (i = 0; i < new_vndr_ies.count; i++) {
+ struct parsed_vndr_ie_info *vndrie_info =
+ &new_vndr_ies.ie_info[i];
+
+ memcpy(ptr + parsed_ie_buf_len, vndrie_info->ie_ptr,
+ vndrie_info->ie_len);
+ parsed_ie_buf_len += vndrie_info->ie_len;
+ }
+ }
+
if (mgmt_ie_buf != NULL) {
- if (vndr_ie && vndr_ie_len && (vndr_ie_len == *mgmt_ie_len) &&
- (memcmp(mgmt_ie_buf, vndr_ie, vndr_ie_len) == 0)) {
+ if (parsed_ie_buf_len && (parsed_ie_buf_len == *mgmt_ie_len) &&
+ (memcmp(mgmt_ie_buf, curr_ie_buf, parsed_ie_buf_len) == 0)) {
CFGP2P_INFO(("Previous mgmt IE is equals to current IE"));
goto exit;
}
- pos = 0;
- ie_buf = (u8 *) mgmt_ie_buf;
- while (pos < *mgmt_ie_len) {
- ie_id = ie_buf[pos++];
- ie_len = ie_buf[pos++];
- if ((ie_id == DOT11_MNG_VS_ID) &&
- (wl_cfgp2p_is_wps_ie(&ie_buf[pos-2], NULL, 0) ||
- wl_cfgp2p_is_p2p_ie(&ie_buf[pos-2], NULL, 0) ||
- wl_cfgp2p_is_wfd_ie(&ie_buf[pos-2], NULL, 0) ||
- wl_cfgp2p_is_customer_ie(&ie_buf[pos-2], NULL, 0))) {
- CFGP2P_INFO(("DELETED ID : %d, Len : %d , OUI :"
- "%02x:%02x:%02x\n", ie_id, ie_len, ie_buf[pos],
- ie_buf[pos+1], ie_buf[pos+2]));
- del_add_ie_buf_len = wl_cfgp2p_vndr_ie(wl, curr_ie_buf, bssidx, pktflag,
- ie_buf+pos, VNDR_SPEC_ELEMENT_ID, ie_buf+pos+3,
- ie_len-3, "del");
- curr_ie_buf += del_add_ie_buf_len;
- total_ie_buf_len += del_add_ie_buf_len;
- }
- pos += ie_len;
- }
+ /* parse old vndr_ie */
+ wl_cfgp2p_parse_vndr_ies(mgmt_ie_buf, *mgmt_ie_len,
+ &old_vndr_ies);
+
+ /* make a command to delete old ie */
+ for (i = 0; i < old_vndr_ies.count; i++) {
+ struct parsed_vndr_ie_info *vndrie_info =
+ &old_vndr_ies.ie_info[i];
+
+ CFGP2P_INFO(("DELETED ID : %d, Len: %d , OUI:%02x:%02x:%02x\n",
+ vndrie_info->vndrie.id, vndrie_info->vndrie.len,
+ vndrie_info->vndrie.oui[0], vndrie_info->vndrie.oui[1],
+ vndrie_info->vndrie.oui[2]));
+
+ del_add_ie_buf_len = wl_cfgp2p_vndr_ie(wl, curr_ie_buf,
+ bssidx, pktflag, vndrie_info->vndrie.oui,
+ vndrie_info->vndrie.id,
+ vndrie_info->ie_ptr + VNDR_IE_FIXED_LEN,
+ vndrie_info->ie_len - VNDR_IE_FIXED_LEN,
+ "del");
+
+ curr_ie_buf += del_add_ie_buf_len;
+ total_ie_buf_len += del_add_ie_buf_len;
+ }
}
+
*mgmt_ie_len = 0;
/* Add if there is any extra IE */
- if (mgmt_ie_buf && vndr_ie && vndr_ie_len) {
- /* save the current IE in wl struct */
- memcpy(mgmt_ie_buf, vndr_ie, vndr_ie_len);
- *mgmt_ie_len = vndr_ie_len;
- pos = 0;
- ie_buf = (u8 *) vndr_ie;
- while (pos < vndr_ie_len) {
- ie_id = ie_buf[pos++];
- ie_len = ie_buf[pos++];
- if ((ie_id == DOT11_MNG_VS_ID) &&
- (wl_cfgp2p_is_wps_ie(&ie_buf[pos-2], NULL, 0) ||
- wl_cfgp2p_is_p2p_ie(&ie_buf[pos-2], NULL, 0) ||
- wl_cfgp2p_is_wfd_ie(&ie_buf[pos-2], NULL, 0) ||
- wl_cfgp2p_is_customer_ie(&ie_buf[pos-2], NULL, 0))) {
- CFGP2P_INFO(("ADDED ID : %d, Len : %d , OUI :"
- "%02x:%02x:%02x\n", ie_id, ie_len, ie_buf[pos],
- ie_buf[pos+1], ie_buf[pos+2]));
- del_add_ie_buf_len = wl_cfgp2p_vndr_ie(wl, curr_ie_buf, bssidx, pktflag,
- ie_buf+pos, VNDR_SPEC_ELEMENT_ID, ie_buf+pos+3,
- ie_len-3, "add");
- curr_ie_buf += del_add_ie_buf_len;
- total_ie_buf_len += del_add_ie_buf_len;
+ if (mgmt_ie_buf && parsed_ie_buf_len) {
+ ptr = mgmt_ie_buf;
+
+ remained_buf_len = mgmt_ie_buf_len;
+
+ /* make a command to add new ie */
+ for (i = 0; i < new_vndr_ies.count; i++) {
+ struct parsed_vndr_ie_info *vndrie_info =
+ &new_vndr_ies.ie_info[i];
+
+ CFGP2P_INFO(("ADDED ID : %d, Len: %d(%d), OUI:%02x:%02x:%02x\n",
+ vndrie_info->vndrie.id, vndrie_info->vndrie.len,
+ vndrie_info->ie_len - 2,
+ vndrie_info->vndrie.oui[0], vndrie_info->vndrie.oui[1],
+ vndrie_info->vndrie.oui[2]));
+
+ del_add_ie_buf_len = wl_cfgp2p_vndr_ie(wl, curr_ie_buf,
+ bssidx, pktflag, vndrie_info->vndrie.oui,
+ vndrie_info->vndrie.id,
+ vndrie_info->ie_ptr + VNDR_IE_FIXED_LEN,
+ vndrie_info->ie_len - VNDR_IE_FIXED_LEN,
+ "add");
+
+ /* verify remained buf size before copy data */
+ if (remained_buf_len >= vndrie_info->ie_len) {
+ remained_buf_len -= vndrie_info->ie_len;
+ } else {
+ CFGP2P_ERR(("no space in mgmt_ie_buf: pktflag = %d, "
+ "found vndr ies # = %d(cur %d), remained len %d, "
+ "cur mgmt_ie_len %d, new ie len = %d\n",
+ pktflag, new_vndr_ies.count, i, remained_buf_len,
+ *mgmt_ie_len, vndrie_info->ie_len));
+ break;
}
- pos += ie_len;
+
+ /* save the parsed IE in wl struct */
+ memcpy(ptr + (*mgmt_ie_len), vndrie_info->ie_ptr,
+ vndrie_info->ie_len);
+ *mgmt_ie_len += vndrie_info->ie_len;
+
+ curr_ie_buf += del_add_ie_buf_len;
+ total_ie_buf_len += del_add_ie_buf_len;
}
}
if (total_ie_buf_len) {
- ret = wldev_iovar_setbuf_bsscfg(ndev, "vndr_ie", g_mgmt_ie_buf, total_ie_buf_len,
- wl->ioctl_buf, WLC_IOCTL_MAXLEN, bssidx, &wl->ioctl_buf_sync);
+ ret = wldev_iovar_setbuf_bsscfg(ndev, "vndr_ie", g_mgmt_ie_buf,
+ total_ie_buf_len, wl->ioctl_buf, WLC_IOCTL_MAXLEN,
+ bssidx, &wl->ioctl_buf_sync);
if (ret)
CFGP2P_ERR(("vndr ie set error : %d\n", ret));
}
@@ -1129,15 +1289,8 @@ wl_cfgp2p_has_ie(u8 *ie, u8 **tlvs, u32 *tlvs_len, const u8 *oui, u32 oui_len, u
{
/* If the contents match the OUI and the type */
if (ie[TLV_LEN_OFF] >= oui_len + 1 &&
- !bcmp(&ie[TLV_BODY_OFF], oui, oui_len) &&
- type != 0 &&
- type == ie[TLV_BODY_OFF + oui_len]) {
- return TRUE;
- }
-
- /* If the contents match the SAMSUNG OUI */
- if (ie[TLV_LEN_OFF] >= oui_len + 1 &&
- !bcmp(&ie[TLV_BODY_OFF], oui, oui_len)) {
+ !bcmp(&ie[TLV_BODY_OFF], oui, oui_len) &&
+ type == ie[TLV_BODY_OFF + oui_len]) {
return TRUE;
}
@@ -1180,20 +1333,6 @@ wl_cfgp2p_find_wpsie(u8 *parse, u32 len)
}
wifi_p2p_ie_t *
-wl_cfgp2p_find_customer_ie(u8 *parse, u32 *len)
-{
- bcm_tlv_t *ie;
-
- while ((ie = bcm_parse_tlvs(parse, *((int*)len), DOT11_MNG_VS_ID))) {
- if (wl_cfgp2p_has_ie((uint8 *) ie, &parse, len,
- (const uint8 *)SAMSUNG_OUI, WFA_OUI_LEN, 0)) {
- return (wifi_p2p_ie_t *)ie;
- }
- }
- return NULL;
-}
-
-wifi_p2p_ie_t *
wl_cfgp2p_find_p2pie(u8 *parse, u32 len)
{
bcm_tlv_t *ie;
@@ -1238,13 +1377,19 @@ wl_cfgp2p_vndr_ie(struct wl_priv *wl, u8 *iebuf, s32 bssidx, s32 pktflag,
strncpy(hdr.cmd, add_del_cmd, VNDR_IE_CMD_LEN - 1);
hdr.cmd[VNDR_IE_CMD_LEN - 1] = '\0';
- /* Buffer contains only 1 IE */
+ /* Set the IE count - the buffer contains only 1 IE */
iecount = htod32(1);
memcpy((void *)&hdr.vndr_ie_buffer.iecount, &iecount, sizeof(s32));
+
+ /* Copy packet flags that indicate which packets will contain this IE */
pktflag = htod32(pktflag);
memcpy((void *)&hdr.vndr_ie_buffer.vndr_ie_list[0].pktflag, &pktflag,
sizeof(u32));
+
+ /* Add the IE ID to the buffer */
hdr.vndr_ie_buffer.vndr_ie_list[0].vndr_ie_data.id = ie_id;
+
+ /* Add the IE length to the buffer */
hdr.vndr_ie_buffer.vndr_ie_list[0].vndr_ie_data.len =
(uint8) VNDR_IE_MIN_LEN + datalen;
@@ -1256,6 +1401,7 @@ wl_cfgp2p_vndr_ie(struct wl_priv *wl, u8 *iebuf, s32 bssidx, s32 pktflag,
/* Copy the aligned temporary vndr_ie buffer header to the IE buffer */
memcpy(iebuf, &hdr, sizeof(hdr) - 1);
+ /* Copy the IE data to the IE buffer */
data_offset =
(u8*)&hdr.vndr_ie_buffer.vndr_ie_list[0].vndr_ie_data.data[0] -
(u8*)&hdr;
@@ -1295,33 +1441,6 @@ wl_cfgp2p_find_idx(struct wl_priv *wl, struct net_device *ndev)
exit:
return index;
}
-s32 wl_cfgp2p_p2p_listen_suspend(void)
-{
- struct wl_priv *wl = wlcfg_drv_priv;
- bool enable = true;
- s32 ret = BCME_OK;
- s32 bssidx = -1;
- struct net_device *netdev = wl_to_prmry_ndev(wl);
- CFGP2P_ERR(("enter\n"));
- if (wl == NULL || wl->p2p == NULL || netdev == NULL)
- goto exit;
- if (wl_get_p2p_status(wl, DISCOVERY_ON) == 0)
- goto exit;
- if (!timer_pending(&wl->p2p->listen_timer))
- goto exit;
- bssidx = wl_to_p2p_bss_bssidx(wl, P2PAPI_BSSCFG_DEVICE);
- if (bssidx) {
- if (wl_to_p2p_bss_saved_ie(wl, bssidx).p2p_probe_res_ie_len)
- enable = false;
-
- if ((ret = wl_add_remove_eventmsg(netdev, WLC_E_P2P_PROBREQ_MSG, enable)) != BCME_OK) {
- CFGP2P_ERR((" failed to %s WLC_E_P2P_PROPREQ_MSG\n", enable? "set":"unset" ));
- }
-
- }
-exit:
- return ret;
-}
/*
* Callback function for WLC_E_P2P_DISC_LISTEN_COMPLETE
*/
@@ -1330,50 +1449,57 @@ wl_cfgp2p_listen_complete(struct wl_priv *wl, struct net_device *ndev,
const wl_event_msg_t *e, void *data)
{
s32 ret = BCME_OK;
- struct net_device *netdev = wl_to_prmry_ndev(wl);
+ struct net_device *netdev;
+ if (!wl || !wl->p2p)
+ return BCME_ERROR;
+ if (wl->p2p_net == ndev) {
+ netdev = wl_to_prmry_ndev(wl);
+ } else {
+ netdev = ndev;
+ }
CFGP2P_DBG((" Enter\n"));
if (wl_get_p2p_status(wl, LISTEN_EXPIRED) == 0) {
wl_set_p2p_status(wl, LISTEN_EXPIRED);
if (timer_pending(&wl->p2p->listen_timer)) {
- spin_lock_bh(&wl->p2p->timer_lock);
del_timer_sync(&wl->p2p->listen_timer);
- spin_unlock_bh(&wl->p2p->timer_lock);
}
if (wl->afx_hdl->is_listen == TRUE &&
- wl_get_drv_status_all(wl, SCANNING_PEER_CHANNEL)) {
+ wl_get_drv_status_all(wl, FINDING_COMMON_CHANNEL)) {
WL_DBG(("Listen DONE for action frame\n"));
complete(&wl->act_frm_scan);
}
-#ifdef WL_CFG80211_SYNC_GON_TIME
- else if (wl_get_drv_status_all(wl, WAITING_MORE_TIME_NEXT_ACT_FRM)) {
- wl_clr_drv_status(wl, WAITING_MORE_TIME_NEXT_ACT_FRM, ndev);
+#ifdef WL_CFG80211_SYNC_GON
+ else if (wl_get_drv_status_all(wl, WAITING_NEXT_ACT_FRM_LISTEN)) {
+ wl_clr_drv_status(wl, WAITING_NEXT_ACT_FRM_LISTEN, netdev);
WL_DBG(("Listen DONE and wake up wait_next_af !!(%d)\n",
- jiffies_to_msecs(jiffies - wl->saved_jiffies)));
+ jiffies_to_msecs(jiffies - wl->af_tx_sent_jiffies)));
if (wl_get_drv_status_all(wl, WAITING_NEXT_ACT_FRM))
- wl_clr_drv_status(wl, WAITING_NEXT_ACT_FRM, ndev);
+ wl_clr_drv_status(wl, WAITING_NEXT_ACT_FRM, netdev);
complete(&wl->wait_next_af);
}
-#endif /* WL_CFG80211_SYNC_GON_TIME */
+#endif /* WL_CFG80211_SYNC_GON */
- if (wl_get_drv_status_all(wl, REMAINING_ON_CHANNEL)
-#ifdef WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST
- || wl_get_drv_status_all(wl, FAKE_REMAINING_ON_CHANNEL)
+#ifndef WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST
+ if (wl_get_drv_status_all(wl, REMAINING_ON_CHANNEL)) {
+#else
+ if (wl_get_drv_status_all(wl, REMAINING_ON_CHANNEL) ||
+ wl_get_drv_status_all(wl, FAKE_REMAINING_ON_CHANNEL)) {
#endif /* WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST */
- ) {
WL_DBG(("Listen DONE for ramain on channel expired\n"));
- wl_clr_drv_status(wl, REMAINING_ON_CHANNEL, ndev);
+ wl_clr_drv_status(wl, REMAINING_ON_CHANNEL, netdev);
#ifdef WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST
- wl_clr_drv_status(wl, FAKE_REMAINING_ON_CHANNEL, ndev);
+ wl_clr_drv_status(wl, FAKE_REMAINING_ON_CHANNEL, netdev);
#endif /* WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST */
if (ndev && (ndev->ieee80211_ptr != NULL)) {
cfg80211_remain_on_channel_expired(ndev, wl->last_roc_id,
&wl->remain_on_chan, wl->remain_on_chan_type, GFP_KERNEL);
}
}
- if (wl_add_remove_eventmsg(netdev, WLC_E_P2P_PROBREQ_MSG, false) != BCME_OK) {
+ if (wl_add_remove_eventmsg(wl_to_prmry_ndev(wl),
+ WLC_E_P2P_PROBREQ_MSG, false) != BCME_OK) {
CFGP2P_ERR((" failed to unset WLC_E_P2P_PROPREQ_MSG\n"));
}
} else
@@ -1393,12 +1519,38 @@ wl_cfgp2p_listen_expired(unsigned long data)
{
wl_event_msg_t msg;
struct wl_priv *wl = (struct wl_priv *) data;
-
CFGP2P_DBG((" Enter\n"));
+ bzero(&msg, sizeof(wl_event_msg_t));
msg.event_type = hton32(WLC_E_P2P_DISC_LISTEN_COMPLETE);
- wl_cfg80211_event(wl_to_p2p_bss_ndev(wl, P2PAPI_BSSCFG_DEVICE), &msg, NULL);
+ wl_cfg80211_event(wl->p2p_net ? wl->p2p_net :
+ wl_to_p2p_bss_ndev(wl, P2PAPI_BSSCFG_DEVICE), &msg, NULL);
+}
+/*
+ * Routine for cancelling the P2P LISTEN
+ */
+static s32
+wl_cfgp2p_cancel_listen(struct wl_priv *wl, struct net_device *ndev,
+ bool notify)
+{
+ WL_DBG(("Enter \n"));
+ /* Irrespective of whether timer is running or not, reset
+ * the LISTEN state.
+ */
+#ifdef NOT_YET
+ wl_cfgp2p_set_p2p_mode(wl, WL_P2P_DISC_ST_SCAN, 0, 0,
+ wl_to_p2p_bss_bssidx(wl, P2PAPI_BSSCFG_DEVICE));
+#endif /* NOT_YET */
+ if (timer_pending(&wl->p2p->listen_timer)) {
+ del_timer_sync(&wl->p2p->listen_timer);
+ if (notify)
+ if (ndev && ndev->ieee80211_ptr) {
+ cfg80211_remain_on_channel_expired(ndev, wl->last_roc_id,
+ &wl->remain_on_chan, wl->remain_on_chan_type,
+ GFP_KERNEL);
+ }
+ }
+ return 0;
}
-
/*
* Do a P2P Listen on the given channel for the given duration.
* A listen consists of sitting idle and responding to P2P probe requests
@@ -1413,14 +1565,11 @@ wl_cfgp2p_listen_expired(unsigned long data)
s32
wl_cfgp2p_discover_listen(struct wl_priv *wl, s32 channel, u32 duration_ms)
{
-#define EXTRA_DEAY_TIME 100
+#define EXTRA_DELAY_TIME 100
s32 ret = BCME_OK;
struct timer_list *_timer;
s32 extra_delay;
struct net_device *netdev = wl_to_prmry_ndev(wl);
- dhd_pub_t *dhd = (dhd_pub_t *)(wl->pub);
- bool enable = true;
- s32 bssidx = wl_to_p2p_bss_bssidx(wl, P2PAPI_BSSCFG_DEVICE);
CFGP2P_DBG((" Enter Listen Channel : %d, Duration : %d\n", channel, duration_ms));
if (unlikely(wl_get_p2p_status(wl, DISCOVERY_ON) == 0)) {
@@ -1439,22 +1588,19 @@ wl_cfgp2p_discover_listen(struct wl_priv *wl, s32 channel, u32 duration_ms)
else
wl_clr_p2p_status(wl, LISTEN_EXPIRED);
#endif /* not WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST */
- if (wl_to_p2p_bss_saved_ie(wl, bssidx).p2p_probe_res_ie_len && dhd && dhd->in_suspend) {
- /* Clear WLC_E_P2P_PROBREQ_MSG in case of early suspend and p2p ie != 0 */
- enable = false;
- }
-
- if (wl_add_remove_eventmsg(netdev, WLC_E_P2P_PROBREQ_MSG, enable) != BCME_OK) {
+ if (wl_add_remove_eventmsg(netdev, WLC_E_P2P_PROBREQ_MSG, true) != BCME_OK) {
CFGP2P_ERR((" failed to set WLC_E_P2P_PROPREQ_MSG\n"));
}
- ret = wl_cfgp2p_set_p2p_mode(wl, WL_P2P_DISC_ST_LISTEN, channel, (u16) duration_ms, bssidx);
+
+ ret = wl_cfgp2p_set_p2p_mode(wl, WL_P2P_DISC_ST_LISTEN, channel, (u16) duration_ms,
+ wl_to_p2p_bss_bssidx(wl, P2PAPI_BSSCFG_DEVICE));
_timer = &wl->p2p->listen_timer;
/* We will wait to receive WLC_E_P2P_DISC_LISTEN_COMPLETE from dongle ,
- * otherwise we will wait up to duration_ms + 100ms + duration / 20
+ * otherwise we will wait up to duration_ms + 100ms + duration / 10
*/
if (ret == BCME_OK) {
- extra_delay = EXTRA_DEAY_TIME + (duration_ms / 10);
+ extra_delay = EXTRA_DELAY_TIME + (duration_ms / 10);
} else {
/* if failed to set listen, it doesn't need to wait whole duration. */
duration_ms = 100 + duration_ms / 20;
@@ -1466,7 +1612,7 @@ wl_cfgp2p_discover_listen(struct wl_priv *wl, s32 channel, u32 duration_ms)
wl_clr_p2p_status(wl, LISTEN_EXPIRED);
#endif /* WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST */
-#undef EXTRA_DEAY_TIME
+#undef EXTRA_DELAY_TIME
exit:
return ret;
}
@@ -1520,7 +1666,8 @@ wl_cfgp2p_action_tx_complete(struct wl_priv *wl, struct net_device *ndev,
}
else {
wl_set_p2p_status(wl, ACTION_TX_NOACK);
- CFGP2P_DBG(("WLC_E_ACTION_FRAME_COMPLETE : NO ACK\n"));
+ CFGP2P_INFO(("WLC_E_ACTION_FRAME_COMPLETE : NO ACK\n"));
+ wl_stop_wait_next_action_frame(wl, ndev);
}
} else {
CFGP2P_INFO((" WLC_E_ACTION_FRAME_OFFCHAN_COMPLETE is received,"
@@ -1551,16 +1698,21 @@ wl_cfgp2p_tx_action_frame(struct wl_priv *wl, struct net_device *dev,
CFGP2P_INFO(("channel : %u , dwell time : %u\n",
af_params->channel, af_params->dwell_time));
+#if defined(CONFIG_MACH_M3_JPN_DCM)
+ if (!wl)
+ return BCME_ERROR;
+#endif
+
wl_clr_p2p_status(wl, ACTION_TX_COMPLETED);
wl_clr_p2p_status(wl, ACTION_TX_NOACK);
#define MAX_WAIT_TIME 2000
if (bssidx == P2PAPI_BSSCFG_PRIMARY)
bssidx = wl_to_p2p_bss_bssidx(wl, P2PAPI_BSSCFG_DEVICE);
-#ifdef WL_CFG80211_SYNC_GON_TIME
wl->af_sent_channel = af_params->channel;
- wl->saved_jiffies = jiffies;
-#endif /* WL_CFG80211_SYNC_GON_TIME */
+#ifdef WL_CFG80211_SYNC_GON
+ wl->af_tx_sent_jiffies = jiffies;
+#endif /* WL_CFG80211_SYNC_GON */
ret = wldev_iovar_setbuf_bsscfg(dev, "actframe", af_params, sizeof(*af_params),
wl->ioctl_buf, WLC_IOCTL_MAXLEN, bssidx, &wl->ioctl_buf_sync);
@@ -1731,7 +1883,7 @@ wl_cfgp2p_supported(struct wl_priv *wl, struct net_device *ndev)
ret = wldev_iovar_getint(ndev, "p2p",
&p2p_supported);
if (ret < 0) {
- CFGP2P_ERR(("wl p2p supported IOVAR = %d\n", ret));
+ CFGP2P_ERR(("wl p2p error %d\n", ret));
return 0;
}
if (p2p_supported == 1) {
@@ -1746,10 +1898,10 @@ wl_cfgp2p_supported(struct wl_priv *wl, struct net_device *ndev)
s32
wl_cfgp2p_down(struct wl_priv *wl)
{
- if (wl->p2p == NULL)
- return 0;
- if (timer_pending(&wl->p2p->listen_timer))
- del_timer_sync(&wl->p2p->listen_timer);
+
+ wl_cfgp2p_cancel_listen(wl,
+ wl->p2p_net ? wl->p2p_net : wl_to_prmry_ndev(wl), TRUE);
+
wl_cfgp2p_deinit_priv(wl);
return 0;
}
@@ -1768,7 +1920,7 @@ wl_cfgp2p_set_p2p_noa(struct wl_priv *wl, struct net_device *ndev, char* buf, in
wl->p2p->noa.desc[0].start = 0;
- sscanf(buf, "%d %d %d", &count, &start, &duration);
+ sscanf(buf, "%10d %10d %10d", &count, &start, &duration);
CFGP2P_DBG(("set_p2p_noa count %d start %d duration %d\n",
count, start, duration));
if (count != -1)
@@ -1857,7 +2009,7 @@ wl_cfgp2p_get_p2p_noa(struct wl_priv *wl, struct net_device *ndev, char* buf, in
}
/* We have to convert the buffer data into ASCII strings */
for (i = 0; i < len; i++) {
- sprintf(buf, "%02x", _buf[i]);
+ snprintf(buf, 3, "%02x", _buf[i]);
buf += 2;
}
buf[i*2] = '\0';
@@ -1878,7 +2030,7 @@ wl_cfgp2p_set_p2p_ps(struct wl_priv *wl, struct net_device *ndev, char* buf, int
CFGP2P_DBG((" Enter\n"));
if (wl->p2p && wl->p2p->vif_created) {
- sscanf(buf, "%d %d %d", &legacy_ps, &ps, &ctw);
+ sscanf(buf, "%10d %10d %10d", &legacy_ps, &ps, &ctw);
CFGP2P_DBG((" Enter legacy_ps %d ps %d ctw %d\n", legacy_ps, ps, ctw));
if (ctw != -1) {
wl->p2p->ops.ctw = ctw;
@@ -1925,11 +2077,11 @@ wl_cfgp2p_retreive_p2pattrib(void *buf, u8 element_id)
return 0;
}
- ie = (wifi_p2p_ie_t *) buf;
+ ie = (wifi_p2p_ie_t*) buf;
len = ie->len;
/* Point subel to the P2P IE's subelt field.
- * Subtract the preceding fields (id,len,OUI,oui_type) from the length.
+ * Subtract the preceding fields (id, len, OUI, oui_type) from the length.
*/
subel = ie->subelts;
len -= 4; /* exclude OUI + OUI_TYPE */
@@ -1966,7 +2118,7 @@ wl_cfgp2p_retreive_p2pattrib(void *buf, u8 element_id)
u8 *
wl_cfgp2p_retreive_p2p_dev_addr(wl_bss_info_t *bi, u32 bi_length)
{
- wifi_p2p_ie_t *p2p_ie = NULL;
+ wifi_p2p_ie_t * p2p_ie = NULL;
u8 *capability = NULL;
bool p2p_go = 0;
u8 *ptr = NULL;
@@ -2001,6 +2153,19 @@ wl_cfgp2p_retreive_p2p_dev_addr(wl_bss_info_t *bi, u32 bi_length)
return ptr;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
+static void
+wl_cfgp2p_ethtool_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *info)
+{
+ snprintf(info->driver, sizeof(info->driver), "p2p");
+ snprintf(info->version, sizeof(info->version), "%lu", (unsigned long)(0));
+}
+
+struct ethtool_ops cfgp2p_ethtool_ops = {
+ .get_drvinfo = wl_cfgp2p_ethtool_get_drvinfo
+};
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) */
+
s32
wl_cfgp2p_register_ndev(struct wl_priv *wl)
{
@@ -2010,16 +2175,16 @@ wl_cfgp2p_register_ndev(struct wl_priv *wl)
uint8 temp_addr[ETHER_ADDR_LEN] = { 0x00, 0x90, 0x4c, 0x33, 0x22, 0x11 };
/* Allocate etherdev, including space for private structure */
- if (!(net = alloc_etherdev(sizeof(wl)))) {
+ if (!(net = alloc_etherdev(sizeof(struct wl_priv *)))) {
CFGP2P_ERR(("%s: OOM - alloc_etherdev\n", __FUNCTION__));
goto fail;
}
- strcpy(net->name, "p2p%d");
+ strncpy(net->name, "p2p%d", sizeof(net->name) - 1);
net->name[IFNAMSIZ - 1] = '\0';
/* Copy the reference to wl_priv */
- memcpy((void *)netdev_priv(net), &wl, sizeof(wl));
+ memcpy((void *)netdev_priv(net), &wl, sizeof(struct wl_priv *));
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31))
ASSERT(!net->open);
@@ -2047,6 +2212,10 @@ wl_cfgp2p_register_ndev(struct wl_priv *wl)
net->ieee80211_ptr = wdev;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
+ net->ethtool_ops = &cfgp2p_ethtool_ops;
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) */
+
SET_NETDEV_DEV(net, wiphy_dev(wdev->wiphy));
/* Associate p2p0 network interface with new wdev */
@@ -2153,13 +2322,34 @@ static int wl_cfgp2p_if_open(struct net_device *net)
static int wl_cfgp2p_if_stop(struct net_device *net)
{
+ extern struct wl_priv *wlcfg_drv_priv;
+ struct wl_priv *wl = NULL;
+ unsigned long flags;
struct wireless_dev *wdev = net->ieee80211_ptr;
-
+ int clear_flag = 0;
if (!wdev)
return -EINVAL;
+ WL_TRACE(("Enter\n"));
+ wl = wlcfg_drv_priv;
+ if (!wl)
+ return -EINVAL;
+ spin_lock_irqsave(&wl->cfgdrv_lock, flags);
+ if (wl->scan_request && wl->scan_request->dev == net) {
+ cfg80211_scan_done(wl->scan_request, true);
+ wl->scan_request = NULL;
+ clear_flag = 1;
+ }
+ spin_unlock_irqrestore(&wl->cfgdrv_lock, flags);
+ if (clear_flag)
+ wl_clr_drv_status(wl, SCANNING, net);
wdev->wiphy->interface_modes = (wdev->wiphy->interface_modes)
& (~(BIT(NL80211_IFTYPE_P2P_CLIENT)|
BIT(NL80211_IFTYPE_P2P_GO)));
+#if defined(CUSTOMER_HW4)
+ if (net->flags & IFF_UP)
+ net->flags &= ~IFF_UP;
+#endif
+
return 0;
}
diff --git a/drivers/net/wireless/bcmdhd/src/wl/sys/wl_cfgp2p.h b/drivers/net/wireless/bcmdhd/wl_cfgp2p.h
index 348aeca..808e576 100644
--- a/drivers/net/wireless/bcmdhd/src/wl/sys/wl_cfgp2p.h
+++ b/drivers/net/wireless/bcmdhd/wl_cfgp2p.h
@@ -1,14 +1,14 @@
/*
* Linux cfgp2p driver
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,12 +16,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: wl_cfgp2p.h 307885 2012-01-12 23:30:48Z $
+ * $Id: wl_cfgp2p.h 354184 2012-08-30 08:08:08Z $
*/
#ifndef _wl_cfgp2p_h_
#define _wl_cfgp2p_h_
@@ -43,15 +43,18 @@ typedef enum {
P2PAPI_BSSCFG_MAX
} p2p_bsscfg_type_t;
-#define IE_MAX_LEN 300
-#define P2P_RES_MAX_LEN 1400
+/* vendor ies max buffer length for probe response or beacon */
+#define VNDR_IES_MAX_BUF_LEN 1400
+/* normal vendor ies buffer length */
+#define VNDR_IES_BUF_LEN 512
+
/* Structure to hold all saved P2P and WPS IEs for a BSSCFG */
struct p2p_saved_ie {
- u8 p2p_probe_req_ie[IE_MAX_LEN];
- u8 p2p_probe_res_ie[P2P_RES_MAX_LEN];
- u8 p2p_assoc_req_ie[IE_MAX_LEN];
- u8 p2p_assoc_res_ie[IE_MAX_LEN];
- u8 p2p_beacon_ie[IE_MAX_LEN];
+ u8 p2p_probe_req_ie[VNDR_IES_BUF_LEN];
+ u8 p2p_probe_res_ie[VNDR_IES_MAX_BUF_LEN];
+ u8 p2p_assoc_req_ie[VNDR_IES_BUF_LEN];
+ u8 p2p_assoc_res_ie[VNDR_IES_BUF_LEN];
+ u8 p2p_beacon_ie[VNDR_IES_MAX_BUF_LEN];
u32 p2p_probe_req_ie_len;
u32 p2p_probe_res_ie_len;
u32 p2p_assoc_req_ie_len;
@@ -79,7 +82,19 @@ struct p2p_info {
wl_p2p_sched_t noa;
wl_p2p_ops_t ops;
wlc_ssid_t ssid;
- spinlock_t timer_lock;
+};
+
+#define MAX_VNDR_IE_NUMBER 5
+
+struct parsed_vndr_ie_info {
+ char *ie_ptr;
+ u32 ie_len; /* total length including id & length field */
+ vndr_ie_t vndrie;
+};
+
+struct parsed_vndr_ies {
+ u32 count;
+ struct parsed_vndr_ie_info ie_info[MAX_VNDR_IE_NUMBER];
};
/* dongle status */
@@ -94,14 +109,15 @@ enum wl_cfgp2p_status {
WLP2P_STATUS_LISTEN_EXPIRED,
WLP2P_STATUS_ACTION_TX_COMPLETED,
WLP2P_STATUS_ACTION_TX_NOACK,
- WLP2P_STATUS_SCANNING
+ WLP2P_STATUS_SCANNING,
+ WLP2P_STATUS_GO_NEG_PHASE
};
-#define wl_to_p2p_bss_ndev(w, type) ((wl)->p2p->bss_idx[type].dev)
-#define wl_to_p2p_bss_bssidx(w, type) ((wl)->p2p->bss_idx[type].bssidx)
-#define wl_to_p2p_bss_saved_ie(w, type) ((wl)->p2p->bss_idx[type].saved_ie)
-#define wl_to_p2p_bss_private(w, type) ((wl)->p2p->bss_idx[type].private_data)
+#define wl_to_p2p_bss_ndev(w, type) ((wl)->p2p->bss_idx[type].dev)
+#define wl_to_p2p_bss_bssidx(w, type) ((wl)->p2p->bss_idx[type].bssidx)
+#define wl_to_p2p_bss_saved_ie(w, type) ((wl)->p2p->bss_idx[type].saved_ie)
+#define wl_to_p2p_bss_private(w, type) ((wl)->p2p->bss_idx[type].private_data)
#define wl_to_p2p_bss(wl, type) ((wl)->p2p->bss_idx[type])
#define wl_get_p2p_status(wl, stat) ((!(wl)->p2p_supported) ? 0 : test_bit(WLP2P_STATUS_ ## stat, \
&(wl)->p2p->status))
@@ -117,8 +133,6 @@ enum wl_cfgp2p_status {
/* dword align allocation */
#define WLC_IOCTL_MAXLEN 8192
-#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
-#define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
#define CFGP2P_ERR(args) \
do { \
@@ -141,6 +155,14 @@ enum wl_cfgp2p_status {
printk args; \
} \
} while (0)
+
+#define CFGP2P_ACTION(args) \
+ do { \
+ if (wl_dbg_level & WL_DBG_P2P_ACTION) { \
+ printk(KERN_DEBUG "CFGP2P-ACTION) %s :", __func__); \
+ printk args; \
+ } \
+ } while (0)
#define INIT_TIMER(timer, func, duration, extra_delay) \
do { \
init_timer(timer); \
@@ -203,9 +225,6 @@ extern wpa_ie_fixed_t *
wl_cfgp2p_find_wpsie(u8 *parse, u32 len);
extern wifi_p2p_ie_t *
-wl_cfgp2p_find_customer_ie(u8 *parse, u32 *len);
-
-extern wifi_p2p_ie_t *
wl_cfgp2p_find_p2pie(u8 *parse, u32 len);
extern wifi_wfd_ie_t *
@@ -221,8 +240,6 @@ wl_cfgp2p_find_idx(struct wl_priv *wl, struct net_device *ndev);
extern s32
-wl_cfgp2p_p2p_listen_suspend(void);
-extern s32
wl_cfgp2p_listen_complete(struct wl_priv *wl, struct net_device *ndev,
const wl_event_msg_t *e, void *data);
extern s32
@@ -287,20 +304,28 @@ wl_cfgp2p_unregister_ndev(struct wl_priv *wl);
#define WL_P2P_WILDCARD_SSID "DIRECT-"
#define WL_P2P_WILDCARD_SSID_LEN 7
#define WL_P2P_INTERFACE_PREFIX "p2p"
-#define WL_P2P_TEMP_CHAN "11"
+#define WL_P2P_TEMP_CHAN 11
+/* If the provision discovery is for JOIN operations,
+ * then we need not do an internal scan to find GO.
+ */
+#define IS_PROV_DISC_WITHOUT_GROUP_ID(p2p_ie, len) \
+ (wl_cfgp2p_retreive_p2pattrib(p2p_ie, P2P_SEID_GROUP_ID) == NULL)
#define IS_GAS_REQ(frame, len) (wl_cfgp2p_is_gas_action(frame, len) && \
((frame->action == P2PSD_ACTION_ID_GAS_IREQ) || \
(frame->action == P2PSD_ACTION_ID_GAS_CREQ)))
-#define IS_P2P_PUB_ACT_REQ(frame, len) (wl_cfgp2p_is_pub_action(frame, len) && \
- ((frame->subtype == P2P_PAF_GON_REQ) || \
- (frame->subtype == P2P_PAF_INVITE_REQ) || \
- (frame->subtype == P2P_PAF_PROVDIS_REQ)))
+#define IS_P2P_PUB_ACT_REQ(frame, p2p_ie, len) \
+ (wl_cfgp2p_is_pub_action(frame, len) && \
+ ((frame->subtype == P2P_PAF_GON_REQ) || \
+ (frame->subtype == P2P_PAF_INVITE_REQ) || \
+ ((frame->subtype == P2P_PAF_PROVDIS_REQ) && \
+ IS_PROV_DISC_WITHOUT_GROUP_ID(p2p_ie, len))))
#define IS_P2P_PUB_ACT_RSP_SUBTYPE(subtype) ((subtype == P2P_PAF_GON_RSP) || \
((subtype == P2P_PAF_GON_CONF) || \
(subtype == P2P_PAF_INVITE_RSP) || \
(subtype == P2P_PAF_PROVDIS_RSP)))
#define IS_P2P_SOCIAL(ch) ((ch == SOCIAL_CHAN_1) || (ch == SOCIAL_CHAN_2) || (ch == SOCIAL_CHAN_3))
-#define IS_P2P_SSID(ssid, len) (!memcmp(ssid, WL_P2P_WILDCARD_SSID, WL_P2P_WILDCARD_SSID_LEN) && (len == WL_P2P_WILDCARD_SSID_LEN))
+#define IS_P2P_SSID(ssid, len) (!memcmp(ssid, WL_P2P_WILDCARD_SSID, WL_P2P_WILDCARD_SSID_LEN) && \
+ (len == WL_P2P_WILDCARD_SSID_LEN))
#endif /* _wl_cfgp2p_h_ */
diff --git a/drivers/net/wireless/bcmdhd/src/wl/sys/wl_dbg.h b/drivers/net/wireless/bcmdhd/wl_dbg.h
index 9347469..b5e7080 100644
--- a/drivers/net/wireless/bcmdhd/src/wl/sys/wl_dbg.h
+++ b/drivers/net/wireless/bcmdhd/wl_dbg.h
@@ -2,14 +2,14 @@
* Minimal debug/trace/assert driver definitions for
* Broadcom 802.11 Networking Adapter.
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -17,12 +17,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: wl_dbg.h 307767 2012-01-12 15:38:01Z $
+ * $Id: wl_dbg.h 326635 2012-04-10 03:15:29Z $
*/
@@ -60,4 +60,4 @@ extern uint32 wl_msg_level2;
extern uint32 wl_msg_level;
extern uint32 wl_msg_level2;
-#endif
+#endif
diff --git a/drivers/net/wireless/bcmdhd/src/wl/sys/wl_iw.c b/drivers/net/wireless/bcmdhd/wl_iw.c
index c25f173..6855314 100644
--- a/drivers/net/wireless/bcmdhd/src/wl/sys/wl_iw.c
+++ b/drivers/net/wireless/bcmdhd/wl_iw.c
@@ -2,13 +2,13 @@
* Linux Wireless Extensions support
*
* Copyright (C) 1999-2012, Broadcom Corporation
- *
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,12 +16,12 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: wl_iw.c 302026 2011-12-09 11:51:50Z $
+ * $Id: wl_iw.c 352251 2012-08-22 06:08:38Z $
*/
#if defined(USE_IW)
@@ -71,15 +71,15 @@ typedef const struct si_pub si_t;
#ifndef IW_AUTH_KEY_MGMT_WAPI_CERT
#define IW_AUTH_KEY_MGMT_WAPI_CERT 8
#endif
-#endif
+#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
#include <linux/rtnetlink.h>
#endif
#if defined(SOFTAP)
struct net_device *ap_net_dev = NULL;
-tsk_ctl_t ap_eth_ctl;
-#endif
+tsk_ctl_t ap_eth_ctl;
+#endif
extern bool wl_iw_conn_status_str(uint32 event_type, uint32 status,
uint32 reason, char* stringBuf, uint buflen);
@@ -102,21 +102,21 @@ extern int dhd_wait_pend8021x(struct net_device *dev);
#if WIRELESS_EXT < 19
#define IW_IOCTL_IDX(cmd) ((cmd) - SIOCIWFIRST)
#define IW_EVENT_IDX(cmd) ((cmd) - IWEVFIRST)
-#endif
+#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0))
#define DAEMONIZE(a) daemonize(a); \
allow_signal(SIGKILL); \
allow_signal(SIGTERM);
-#else
+#else
#define RAISE_RX_SOFTIRQ() \
cpu_raise_softirq(smp_processor_id(), NET_RX_SOFTIRQ)
#define DAEMONIZE(a) daemonize(); \
do { if (a) \
strncpy(current->comm, a, MIN(sizeof(current->comm), (strlen(a) + 1))); \
} while (0);
-#endif
+#endif
#define ISCAN_STATE_IDLE 0
#define ISCAN_STATE_SCANING 1
@@ -137,7 +137,7 @@ typedef struct iscan_info {
iscan_buf_t * list_hdr;
iscan_buf_t * list_cur;
-
+
long sysioc_pid;
struct semaphore sysioc_sem;
struct completion sysioc_exited;
@@ -213,7 +213,7 @@ dev_wlc_ioctl(
ifr.ifr_data = (caddr_t) &ioc;
#ifndef LINUX_HYBRID
-
+
dev_open(dev);
#endif
@@ -260,6 +260,7 @@ dev_iw_iovar_setbuf(
iolen = bcm_mkiovar(iovar, param, paramlen, bufptr, buflen);
ASSERT(iolen);
+ BCM_REFERENCE(iolen);
return (dev_wlc_ioctl(dev, WLC_SET_VAR, bufptr, iolen));
}
@@ -277,6 +278,7 @@ dev_iw_iovar_getbuf(
iolen = bcm_mkiovar(iovar, param, paramlen, bufptr, buflen);
ASSERT(iolen);
+ BCM_REFERENCE(iolen);
return (dev_wlc_ioctl(dev, WLC_GET_VAR, bufptr, buflen));
}
@@ -303,7 +305,7 @@ dev_wlc_bufvar_set(
kfree(ioctlbuf);
return error;
}
-#endif
+#endif
@@ -362,13 +364,13 @@ dev_wlc_intvar_get(
#if WIRELESS_EXT < 13
struct iw_request_info
{
- __u16 cmd;
- __u16 flags;
+ __u16 cmd;
+ __u16 flags;
};
typedef int (*iw_handler)(struct net_device *dev, struct iw_request_info *info,
void *wrqu, char *extra);
-#endif
+#endif
#if WIRELESS_EXT > 12
static int
@@ -417,7 +419,7 @@ wl_iw_set_pm(
error = dev_wlc_ioctl(dev, WLC_SET_PM, &pm, sizeof(pm));
return error;
}
-#endif
+#endif
int
wl_iw_send_priv_event(
@@ -533,14 +535,14 @@ wl_iw_set_freq(
WL_TRACE(("%s: SIOCSIWFREQ\n", dev->name));
-
+
if (fwrq->e == 0 && fwrq->m < MAXCHANNEL) {
chan = fwrq->m;
}
-
+
else {
-
+
if (fwrq->e >= 6) {
fwrq->e -= 6;
while (fwrq->e--)
@@ -549,9 +551,9 @@ wl_iw_set_freq(
while (fwrq->e++ < 6)
fwrq->m /= 10;
}
-
+
if (fwrq->m > 4000 && fwrq->m < 5000)
- sf = WF_CHAN_FACTOR_4_G;
+ sf = WF_CHAN_FACTOR_4_G;
chan = wf_mhz2channel(fwrq->m, sf);
}
@@ -559,7 +561,7 @@ wl_iw_set_freq(
if ((error = dev_wlc_ioctl(dev, WLC_SET_CHANNEL, &chan, sizeof(chan))))
return error;
-
+
return -EINPROGRESS;
}
@@ -579,7 +581,7 @@ wl_iw_get_freq(
if ((error = dev_wlc_ioctl(dev, WLC_GET_CHANNEL, &ci, sizeof(ci))))
return error;
-
+
fwrq->m = dtoh32(ci.hw_channel);
fwrq->e = dtoh32(0);
return 0;
@@ -617,7 +619,7 @@ wl_iw_set_mode(
(error = dev_wlc_ioctl(dev, WLC_SET_AP, &ap, sizeof(ap))))
return error;
-
+
return -EINPROGRESS;
}
@@ -676,10 +678,10 @@ wl_iw_get_range(
dwrq->length = sizeof(struct iw_range);
memset(range, 0, sizeof(*range));
-
+
range->min_nwid = range->max_nwid = 0;
-
+
list->count = htod32(MAXCHANNEL);
if ((error = dev_wlc_ioctl(dev, WLC_GET_VALID_CHANNELS, channels, sizeof(channels))))
return error;
@@ -697,31 +699,31 @@ wl_iw_get_range(
}
range->num_frequency = range->num_channels = i;
-
+
range->max_qual.qual = 5;
-
- range->max_qual.level = 0x100 - 200;
-
- range->max_qual.noise = 0x100 - 200;
-
+
+ range->max_qual.level = 0x100 - 200;
+
+ range->max_qual.noise = 0x100 - 200;
+
range->sensitivity = 65535;
#if WIRELESS_EXT > 11
-
+
range->avg_qual.qual = 3;
-
+
range->avg_qual.level = 0x100 + WL_IW_RSSI_GOOD;
+
+ range->avg_qual.noise = 0x100 - 75;
+#endif
- range->avg_qual.noise = 0x100 - 75;
-#endif
-
-
+
if ((error = dev_wlc_ioctl(dev, WLC_GET_CURR_RATESET, &rateset, sizeof(rateset))))
return error;
rateset.count = dtoh32(rateset.count);
range->num_bitrates = rateset.count;
for (i = 0; i < rateset.count && i < IW_MAX_BITRATES; i++)
- range->bitrate[i] = (rateset.rates[i] & 0x7f) * 500000;
+ range->bitrate[i] = (rateset.rates[i] & 0x7f) * 500000;
dev_wlc_intvar_get(dev, "nmode", &nmode);
if ((error = dev_wlc_ioctl(dev, WLC_GET_PHYTYPE, &phytype, sizeof(phytype))))
return error;
@@ -749,21 +751,21 @@ wl_iw_get_range(
}
range->num_bitrates += 8;
for (k = 0; i < range->num_bitrates; k++, i++) {
-
+
range->bitrate[i] = (nrate_list[nrate_list2copy][k]) * 500000;
}
}
-
+
if ((error = dev_wlc_ioctl(dev, WLC_GET_PHYTYPE, &i, sizeof(i))))
return error;
i = dtoh32(i);
if (i == WLC_PHY_TYPE_A)
- range->throughput = 24000000;
+ range->throughput = 24000000;
else
- range->throughput = 1500000;
-
+ range->throughput = 1500000;
+
range->min_rts = 0;
range->max_rts = 2347;
range->min_frag = 256;
@@ -780,7 +782,7 @@ wl_iw_get_range(
#endif
range->encoding_size[3] = AES_KEY_SIZE;
-
+
range->min_pmp = 0;
range->max_pmp = 0;
range->min_pmt = 0;
@@ -788,7 +790,7 @@ wl_iw_get_range(
range->pmp_flags = 0;
range->pm_capa = 0;
-
+
range->num_txpower = 2;
range->txpower[0] = 1;
range->txpower[1] = 255;
@@ -798,17 +800,17 @@ wl_iw_get_range(
range->we_version_compiled = WIRELESS_EXT;
range->we_version_source = 19;
-
+
range->retry_capa = IW_RETRY_LIMIT;
range->retry_flags = IW_RETRY_LIMIT;
range->r_time_flags = 0;
-
+
range->min_retry = 1;
range->max_retry = 255;
-
+
range->min_r_time = 0;
range->max_r_time = 0;
-#endif
+#endif
#if WIRELESS_EXT > 17
range->enc_capa = IW_ENC_CAPA_WPA;
@@ -816,13 +818,13 @@ wl_iw_get_range(
range->enc_capa |= IW_ENC_CAPA_CIPHER_CCMP;
range->enc_capa |= IW_ENC_CAPA_WPA2;
#if (defined(BCMSUP_PSK) && defined(WLFBT))
-
+
range->enc_capa |= IW_ENC_CAPA_4WAY_HANDSHAKE;
-#endif
-
+#endif
+
IW_EVENT_CAPA_SET_KERNEL(range->event_capa);
-
+
IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWAP);
IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWSCAN);
IW_EVENT_CAPA_SET(range->event_capa, IWEVTXDROP);
@@ -832,10 +834,10 @@ wl_iw_get_range(
IW_EVENT_CAPA_SET(range->event_capa, IWEVPMKIDCAND);
#if WIRELESS_EXT >= 22 && defined(IW_SCAN_CAPA_ESSID)
-
+
range->scan_capa = IW_SCAN_CAPA_ESSID;
#endif
-#endif
+#endif
return 0;
}
@@ -928,7 +930,7 @@ wl_iw_set_wap(
return -EINVAL;
}
-
+
if (ETHER_ISBCAST(awrq->sa_data) || ETHER_ISNULLADDR(awrq->sa_data)) {
scb_val_t scbval;
bzero(&scbval, sizeof(scb_val_t));
@@ -937,8 +939,8 @@ wl_iw_set_wap(
}
return 0;
}
-
-
+
+
if ((error = dev_wlc_ioctl(dev, WLC_REASSOC, awrq->sa_data, ETHER_ADDR_LEN))) {
WL_ERROR(("%s: WLC_REASSOC failed (%d).\n", __FUNCTION__, error));
return error;
@@ -960,7 +962,7 @@ wl_iw_get_wap(
awrq->sa_family = ARPHRD_ETHER;
memset(awrq->sa_data, 0, ETHER_ADDR_LEN);
-
+
(void) dev_wlc_ioctl(dev, WLC_GET_BSSID, awrq->sa_data, ETHER_ADDR_LEN);
return 0;
@@ -1006,7 +1008,7 @@ wl_iw_mlme(
return error;
}
-#endif
+#endif
static int
wl_iw_get_aplist(
@@ -1028,7 +1030,7 @@ wl_iw_get_aplist(
if (!extra)
return -EINVAL;
-
+
list = kmalloc(buflen, GFP_KERNEL);
if (!list)
return -ENOMEM;
@@ -1049,23 +1051,23 @@ wl_iw_get_aplist(
ASSERT(((uintptr)bi + dtoh32(bi->length)) <= ((uintptr)list +
buflen));
-
+
if (!(dtoh16(bi->capability) & DOT11_CAP_ESS))
continue;
-
+
memcpy(addr[dwrq->length].sa_data, &bi->BSSID, ETHER_ADDR_LEN);
addr[dwrq->length].sa_family = ARPHRD_ETHER;
qual[dwrq->length].qual = rssi_to_qual(dtoh16(bi->RSSI));
qual[dwrq->length].level = 0x100 + dtoh16(bi->RSSI);
qual[dwrq->length].noise = 0x100 + bi->phy_noise;
-
+
#if WIRELESS_EXT > 18
qual[dwrq->length].updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
#else
qual[dwrq->length].updated = 7;
-#endif
+#endif
dwrq->length++;
}
@@ -1074,7 +1076,7 @@ wl_iw_get_aplist(
if (dwrq->length) {
memcpy(&addr[dwrq->length], qual, sizeof(struct iw_quality) * dwrq->length);
-
+
dwrq->flags = 1;
}
@@ -1108,7 +1110,7 @@ wl_iw_iscan_get_aplist(
}
buf = iscan->list_hdr;
-
+
while (buf) {
list = &((wl_iscan_results_t*)buf->iscan_buf)->results;
ASSERT(list->version == WL_BSS_INFO_VERSION);
@@ -1119,23 +1121,23 @@ wl_iw_iscan_get_aplist(
ASSERT(((uintptr)bi + dtoh32(bi->length)) <= ((uintptr)list +
WLC_IW_ISCAN_MAXLEN));
-
+
if (!(dtoh16(bi->capability) & DOT11_CAP_ESS))
continue;
-
+
memcpy(addr[dwrq->length].sa_data, &bi->BSSID, ETHER_ADDR_LEN);
addr[dwrq->length].sa_family = ARPHRD_ETHER;
qual[dwrq->length].qual = rssi_to_qual(dtoh16(bi->RSSI));
qual[dwrq->length].level = 0x100 + dtoh16(bi->RSSI);
qual[dwrq->length].noise = 0x100 + bi->phy_noise;
-
+
#if WIRELESS_EXT > 18
qual[dwrq->length].updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
#else
qual[dwrq->length].updated = 7;
-#endif
+#endif
dwrq->length++;
}
@@ -1143,7 +1145,7 @@ wl_iw_iscan_get_aplist(
}
if (dwrq->length) {
memcpy(&addr[dwrq->length], qual, sizeof(struct iw_quality) * dwrq->length);
-
+
dwrq->flags = 1;
}
@@ -1163,11 +1165,11 @@ wl_iw_set_scan(
WL_TRACE(("%s: SIOCSIWSCAN\n", dev->name));
-
+
memset(&ssid, 0, sizeof(ssid));
#if WIRELESS_EXT > 17
-
+
if (wrqu->data.length == sizeof(struct iw_scan_req)) {
if (wrqu->data.flags & IW_SCAN_THIS_ESSID) {
struct iw_scan_req *req = (struct iw_scan_req *)extra;
@@ -1177,7 +1179,7 @@ wl_iw_set_scan(
}
}
#endif
-
+
(void) dev_wlc_ioctl(dev, WLC_SCAN, &ssid, sizeof(ssid));
return 0;
@@ -1196,7 +1198,7 @@ wl_iw_iscan_set_scan(
WL_TRACE(("%s: SIOCSIWSCAN\n", dev->name));
-
+
if ((!iscan) || (iscan->sysioc_pid < 0)) {
return wl_iw_set_scan(dev, info, wrqu, extra);
}
@@ -1204,11 +1206,11 @@ wl_iw_iscan_set_scan(
return 0;
}
-
+
memset(&ssid, 0, sizeof(ssid));
#if WIRELESS_EXT > 17
-
+
if (wrqu->data.length == sizeof(struct iw_scan_req)) {
if (wrqu->data.flags & IW_SCAN_THIS_ESSID) {
struct iw_scan_req *req = (struct iw_scan_req *)extra;
@@ -1226,10 +1228,9 @@ wl_iw_iscan_set_scan(
wl_iw_set_event_mask(dev);
wl_iw_iscan(iscan, &ssid, WL_SCAN_ACTION_START);
- iscan->timer.expires = jiffies + iscan->timer_ms*HZ/1000;
+ iscan->timer.expires = jiffies + msecs_to_jiffies(iscan->timer_ms);
add_timer(&iscan->timer);
iscan->timer_on = 1;
- DHD_ERROR(("TIMER_TIMER: i scan timer set(%s)\n", __FUNCTION__));
return 0;
}
@@ -1242,17 +1243,17 @@ ie_is_wpa_ie(uint8 **wpaie, uint8 **tlvs, int *tlvs_len)
uint8 *ie = *wpaie;
-
+
if ((ie[1] >= 6) &&
!bcmp((const void *)&ie[2], (const void *)(WPA_OUI "\x01"), 4)) {
return TRUE;
}
-
+
ie += ie[1] + 2;
-
+
*tlvs_len -= (int)(ie - *tlvs);
-
+
*tlvs = ie;
return FALSE;
}
@@ -1264,21 +1265,21 @@ ie_is_wps_ie(uint8 **wpsie, uint8 **tlvs, int *tlvs_len)
uint8 *ie = *wpsie;
-
+
if ((ie[1] >= 4) &&
!bcmp((const void *)&ie[2], (const void *)(WPA_OUI "\x04"), 4)) {
return TRUE;
}
-
+
ie += ie[1] + 2;
-
+
*tlvs_len -= (int)(ie - *tlvs);
-
+
*tlvs = ie;
return FALSE;
}
-#endif
+#endif
#ifdef BCMWAPI_WPI
static inline int _wpa_snprintf_hex(char *buf, size_t buf_size, const u8 *data,
@@ -1308,7 +1309,7 @@ wpa_snprintf_hex(char *buf, size_t buf_size, const u8 *data, size_t len)
{
return _wpa_snprintf_hex(buf, buf_size, data, len, 0);
}
-#endif
+#endif
static int
wl_iw_handle_scanresults_ies(char **event_p, char *end,
@@ -1324,7 +1325,7 @@ wl_iw_handle_scanresults_ies(char **event_p, char *end,
event = *event_p;
if (bi->ie_length) {
-
+
bcm_tlv_t *ie;
uint8 *ptr = ((uint8 *)bi) + sizeof(wl_bss_info_t);
int ptr_len = bi->ie_length;
@@ -1343,10 +1344,10 @@ wl_iw_handle_scanresults_ies(char **event_p, char *end,
event = IWE_STREAM_ADD_POINT(info, event, end, &iwe, (char *)ie);
}
ptr = ((uint8 *)bi) + sizeof(wl_bss_info_t);
-#endif
+#endif
while ((ie = bcm_parse_tlvs(ptr, ptr_len, DOT11_MNG_WPA_ID))) {
-
+
if (ie_is_wps_ie(((uint8 **)&ie), &ptr, &ptr_len)) {
iwe.cmd = IWEVGENIE;
iwe.u.data.length = ie->len + 2;
@@ -1376,7 +1377,7 @@ wl_iw_handle_scanresults_ies(char **event_p, char *end,
iwe.cmd = IWEVGENIE;
iwe.u.data.length = ie->len + 2;
event = IWE_STREAM_ADD_POINT(info, event, end, &iwe, (char *)ie);
-#else
+#else
iwe.cmd = IWEVCUSTOM;
custom_event_len = strlen("wapi_ie=") + 2*(ie->len + 2);
iwe.u.data.length = custom_event_len;
@@ -1393,14 +1394,15 @@ wl_iw_handle_scanresults_ies(char **event_p, char *end,
wpa_snprintf_hex(buf + 10, 2+1, &(ie->len), 1);
wpa_snprintf_hex(buf + 12, 2*ie->len+1, ie->data, ie->len);
event = IWE_STREAM_ADD_POINT(info, event, end, &iwe, buf);
-#endif
+ kfree(buf);
+#endif
break;
}
-#endif
+#endif
*event_p = event;
}
-#endif
+#endif
return 0;
}
static int
@@ -1416,7 +1418,6 @@ wl_iw_get_scan(
struct iw_event iwe;
wl_bss_info_t *bi = NULL;
int error, i, j;
- int rssi = 0;
char *event = extra, *end = extra + dwrq->length, *value;
uint buflen = dwrq->length;
@@ -1425,14 +1426,14 @@ wl_iw_get_scan(
if (!extra)
return -EINVAL;
-
+
if ((error = dev_wlc_ioctl(dev, WLC_GET_CHANNEL, &ci, sizeof(ci))))
return error;
ci.scan_channel = dtoh32(ci.scan_channel);
if (ci.scan_channel)
return -EAGAIN;
-
+
list = kmalloc(buflen, GFP_KERNEL);
if (!list)
return -ENOMEM;
@@ -1453,19 +1454,19 @@ wl_iw_get_scan(
ASSERT(((uintptr)bi + dtoh32(bi->length)) <= ((uintptr)list +
buflen));
-
+
iwe.cmd = SIOCGIWAP;
iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
memcpy(iwe.u.ap_addr.sa_data, &bi->BSSID, ETHER_ADDR_LEN);
event = IWE_STREAM_ADD_EVENT(info, event, end, &iwe, IW_EV_ADDR_LEN);
-
+
iwe.u.data.length = dtoh32(bi->SSID_len);
iwe.cmd = SIOCGIWESSID;
iwe.u.data.flags = 1;
event = IWE_STREAM_ADD_POINT(info, event, end, &iwe, bi->SSID);
-
+
if (dtoh16(bi->capability) & (DOT11_CAP_ESS | DOT11_CAP_IBSS)) {
iwe.cmd = SIOCGIWMODE;
if (dtoh16(bi->capability) & DOT11_CAP_ESS)
@@ -1475,7 +1476,7 @@ wl_iw_get_scan(
event = IWE_STREAM_ADD_EVENT(info, event, end, &iwe, IW_EV_UINT_LEN);
}
-
+
iwe.cmd = SIOCGIWFREQ;
iwe.u.freq.m = wf_channel2mhz(CHSPEC_CHANNEL(bi->chanspec),
CHSPEC_CHANNEL(bi->chanspec) <= CH_MAX_2G_CHANNEL ?
@@ -1483,20 +1484,17 @@ wl_iw_get_scan(
iwe.u.freq.e = 6;
event = IWE_STREAM_ADD_EVENT(info, event, end, &iwe, IW_EV_FREQ_LEN);
+
iwe.cmd = IWEVQUAL;
- rssi = dtoh16(bi->RSSI);
- if (rssi >= WL_IW_RSSI_INVALID)
- rssi = WL_IW_RSSI_MAXVAL;
-
- iwe.u.qual.qual = rssi_to_qual(rssi);
- iwe.u.qual.level = 0x100 + rssi;
+ iwe.u.qual.qual = rssi_to_qual(dtoh16(bi->RSSI));
+ iwe.u.qual.level = 0x100 + dtoh16(bi->RSSI);
iwe.u.qual.noise = 0x100 + bi->phy_noise;
event = IWE_STREAM_ADD_EVENT(info, event, end, &iwe, IW_EV_QUAL_LEN);
-
+
wl_iw_handle_scanresults_ies(&event, end, info, bi);
-
+
iwe.cmd = SIOCGIWENCODE;
if (dtoh16(bi->capability) & DOT11_CAP_PRIVACY)
iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
@@ -1505,11 +1503,11 @@ wl_iw_get_scan(
iwe.u.data.length = 0;
event = IWE_STREAM_ADD_POINT(info, event, end, &iwe, (char *)event);
-
+
if (bi->rateset.count) {
value = event + IW_EV_LCP_LEN;
iwe.cmd = SIOCGIWRATE;
-
+
iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
for (j = 0; j < bi->rateset.count && j < IW_MAX_BITRATES; j++) {
iwe.u.bitrate.value = (bi->rateset.rates[j] & 0x7f) * 500000;
@@ -1523,7 +1521,7 @@ wl_iw_get_scan(
kfree(list);
dwrq->length = event - extra;
- dwrq->flags = 0;
+ dwrq->flags = 0;
return 0;
}
@@ -1550,18 +1548,18 @@ wl_iw_iscan_get_scan(
if (!extra)
return -EINVAL;
-
+
if ((!iscan) || (iscan->sysioc_pid < 0)) {
return wl_iw_get_scan(dev, info, dwrq, extra);
}
-
+
if (iscan->iscan_state == ISCAN_STATE_SCANING)
return -EAGAIN;
apcnt = 0;
p_buf = iscan->list_hdr;
-
+
while (p_buf != iscan->list_cur) {
list = &((wl_iscan_results_t*)p_buf->iscan_buf)->results;
@@ -1575,23 +1573,23 @@ wl_iw_iscan_get_scan(
ASSERT(((uintptr)bi + dtoh32(bi->length)) <= ((uintptr)list +
WLC_IW_ISCAN_MAXLEN));
-
+
if (event + ETHER_ADDR_LEN + bi->SSID_len + IW_EV_UINT_LEN + IW_EV_FREQ_LEN +
IW_EV_QUAL_LEN >= end)
return -E2BIG;
-
+
iwe.cmd = SIOCGIWAP;
iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
memcpy(iwe.u.ap_addr.sa_data, &bi->BSSID, ETHER_ADDR_LEN);
event = IWE_STREAM_ADD_EVENT(info, event, end, &iwe, IW_EV_ADDR_LEN);
-
+
iwe.u.data.length = dtoh32(bi->SSID_len);
iwe.cmd = SIOCGIWESSID;
iwe.u.data.flags = 1;
event = IWE_STREAM_ADD_POINT(info, event, end, &iwe, bi->SSID);
-
+
if (dtoh16(bi->capability) & (DOT11_CAP_ESS | DOT11_CAP_IBSS)) {
iwe.cmd = SIOCGIWMODE;
if (dtoh16(bi->capability) & DOT11_CAP_ESS)
@@ -1601,7 +1599,7 @@ wl_iw_iscan_get_scan(
event = IWE_STREAM_ADD_EVENT(info, event, end, &iwe, IW_EV_UINT_LEN);
}
-
+
iwe.cmd = SIOCGIWFREQ;
iwe.u.freq.m = wf_channel2mhz(CHSPEC_CHANNEL(bi->chanspec),
CHSPEC_CHANNEL(bi->chanspec) <= CH_MAX_2G_CHANNEL ?
@@ -1609,21 +1607,17 @@ wl_iw_iscan_get_scan(
iwe.u.freq.e = 6;
event = IWE_STREAM_ADD_EVENT(info, event, end, &iwe, IW_EV_FREQ_LEN);
-
+
iwe.cmd = IWEVQUAL;
- rssi = dtoh16(bi->RSSI);
- if (rssi >= WL_IW_RSSI_INVALID)
- rssi = WL_IW_RSSI_MAXVAL;
-
- iwe.u.qual.qual = rssi_to_qual(rssi);
- iwe.u.qual.level = 0x100 + rssi;
+ iwe.u.qual.qual = rssi_to_qual(dtoh16(bi->RSSI));
+ iwe.u.qual.level = 0x100 + dtoh16(bi->RSSI);
iwe.u.qual.noise = 0x100 + bi->phy_noise;
event = IWE_STREAM_ADD_EVENT(info, event, end, &iwe, IW_EV_QUAL_LEN);
-
+
wl_iw_handle_scanresults_ies(&event, end, info, bi);
-
+
iwe.cmd = SIOCGIWENCODE;
if (dtoh16(bi->capability) & DOT11_CAP_PRIVACY)
iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
@@ -1632,14 +1626,14 @@ wl_iw_iscan_get_scan(
iwe.u.data.length = 0;
event = IWE_STREAM_ADD_POINT(info, event, end, &iwe, (char *)event);
-
- if (bi->rateset.count) {
+
+ if (bi->rateset.count <= sizeof(bi->rateset.rates)) {
if (event + IW_MAX_BITRATES*IW_EV_PARAM_LEN >= end)
return -E2BIG;
value = event + IW_EV_LCP_LEN;
iwe.cmd = SIOCGIWRATE;
-
+
iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
for (j = 0; j < bi->rateset.count && j < IW_MAX_BITRATES; j++) {
iwe.u.bitrate.value = (bi->rateset.rates[j] & 0x7f) * 500000;
@@ -1650,15 +1644,15 @@ wl_iw_iscan_get_scan(
}
}
p_buf = p_buf->next;
- }
+ }
dwrq->length = event - extra;
- dwrq->flags = 0;
+ dwrq->flags = 0;
return 0;
}
-#endif
+#endif
static int
@@ -1674,7 +1668,7 @@ wl_iw_set_essid(
WL_TRACE(("%s: SIOCSIWESSID\n", dev->name));
-
+
memset(&ssid, 0, sizeof(ssid));
if (dwrq->length && extra) {
#if WIRELESS_EXT > 20
@@ -1688,7 +1682,7 @@ wl_iw_set_essid(
if ((error = dev_wlc_ioctl(dev, WLC_SET_SSID, &ssid, sizeof(ssid))))
return error;
}
-
+
else {
scb_val_t scbval;
bzero(&scbval, sizeof(scb_val_t));
@@ -1721,12 +1715,12 @@ wl_iw_get_essid(
ssid.SSID_len = dtoh32(ssid.SSID_len);
-
+
memcpy(extra, ssid.SSID, ssid.SSID_len);
dwrq->length = ssid.SSID_len;
- dwrq->flags = 1;
+ dwrq->flags = 1;
return 0;
}
@@ -1745,7 +1739,7 @@ wl_iw_set_nick(
if (!extra)
return -EINVAL;
-
+
if (dwrq->length > sizeof(iw->nickname))
return -E2BIG;
@@ -1787,47 +1781,47 @@ static int wl_iw_set_rate(
WL_TRACE(("%s: SIOCSIWRATE\n", dev->name));
-
+
if ((error = dev_wlc_ioctl(dev, WLC_GET_CURR_RATESET, &rateset, sizeof(rateset))))
return error;
rateset.count = dtoh32(rateset.count);
if (vwrq->value < 0) {
-
+
rate = rateset.rates[rateset.count - 1] & 0x7f;
} else if (vwrq->value < rateset.count) {
-
+
rate = rateset.rates[vwrq->value] & 0x7f;
} else {
-
+
rate = vwrq->value / 500000;
}
if (vwrq->fixed) {
-
+
error_bg = dev_wlc_intvar_set(dev, "bg_rate", rate);
error_a = dev_wlc_intvar_set(dev, "a_rate", rate);
if (error_bg && error_a)
return (error_bg | error_a);
} else {
-
-
+
+
error_bg = dev_wlc_intvar_set(dev, "bg_rate", 0);
-
+
error_a = dev_wlc_intvar_set(dev, "a_rate", 0);
if (error_bg && error_a)
return (error_bg | error_a);
-
+
for (i = 0; i < rateset.count; i++)
if ((rateset.rates[i] & 0x7f) > rate)
break;
rateset.count = htod32(i);
-
+
if ((error = dev_wlc_ioctl(dev, WLC_SET_RATESET, &rateset, sizeof(rateset))))
return error;
}
@@ -1846,7 +1840,7 @@ static int wl_iw_get_rate(
WL_TRACE(("%s: SIOCGIWRATE\n", dev->name));
-
+
if ((error = dev_wlc_ioctl(dev, WLC_GET_RATE, &rate, sizeof(rate))))
return error;
rate = dtoh32(rate);
@@ -1961,7 +1955,7 @@ wl_iw_set_txpow(
uint16 txpwrmw;
WL_TRACE(("%s: SIOCSIWTXPOW\n", dev->name));
-
+
disable = vwrq->disabled ? WL_RADIO_SW_DISABLE : 0;
disable += WL_RADIO_SW_DISABLE << 16;
@@ -1969,15 +1963,15 @@ wl_iw_set_txpow(
if ((error = dev_wlc_ioctl(dev, WLC_SET_RADIO, &disable, sizeof(disable))))
return error;
-
+
if (disable & WL_RADIO_SW_DISABLE)
return 0;
-
+
if (!(vwrq->flags & IW_TXPOW_MWATT))
return -EINVAL;
-
+
if (vwrq->value < 0)
return 0;
@@ -2029,31 +2023,31 @@ wl_iw_set_retry(
WL_TRACE(("%s: SIOCSIWRETRY\n", dev->name));
-
+
if (vwrq->disabled || (vwrq->flags & IW_RETRY_LIFETIME))
return -EINVAL;
-
+
if (vwrq->flags & IW_RETRY_LIMIT) {
-
+
#if WIRELESS_EXT > 20
if ((vwrq->flags & IW_RETRY_LONG) ||(vwrq->flags & IW_RETRY_MAX) ||
!((vwrq->flags & IW_RETRY_SHORT) || (vwrq->flags & IW_RETRY_MIN))) {
#else
if ((vwrq->flags & IW_RETRY_MAX) || !(vwrq->flags & IW_RETRY_MIN)) {
-#endif
+#endif
lrl = htod32(vwrq->value);
if ((error = dev_wlc_ioctl(dev, WLC_SET_LRL, &lrl, sizeof(lrl))))
return error;
}
-
+
#if WIRELESS_EXT > 20
if ((vwrq->flags & IW_RETRY_SHORT) ||(vwrq->flags & IW_RETRY_MIN) ||
!((vwrq->flags & IW_RETRY_LONG) || (vwrq->flags & IW_RETRY_MAX))) {
#else
if ((vwrq->flags & IW_RETRY_MIN) || !(vwrq->flags & IW_RETRY_MAX)) {
-#endif
+#endif
srl = htod32(vwrq->value);
if ((error = dev_wlc_ioctl(dev, WLC_SET_SRL, &srl, sizeof(srl))))
@@ -2076,13 +2070,13 @@ wl_iw_get_retry(
WL_TRACE(("%s: SIOCGIWRETRY\n", dev->name));
- vwrq->disabled = 0;
-
+ vwrq->disabled = 0;
+
if ((vwrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME)
return -EINVAL;
-
+
if ((error = dev_wlc_ioctl(dev, WLC_GET_LRL, &lrl, sizeof(lrl))) ||
(error = dev_wlc_ioctl(dev, WLC_GET_SRL, &srl, sizeof(srl))))
return error;
@@ -2090,7 +2084,7 @@ wl_iw_get_retry(
lrl = dtoh32(lrl);
srl = dtoh32(srl);
-
+
if (vwrq->flags & IW_RETRY_MAX) {
vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_MAX;
vwrq->value = lrl;
@@ -2103,7 +2097,7 @@ wl_iw_get_retry(
return 0;
}
-#endif
+#endif
static int
wl_iw_set_encode(
@@ -2121,7 +2115,7 @@ wl_iw_set_encode(
memset(&key, 0, sizeof(key));
if ((dwrq->flags & IW_ENCODE_INDEX) == 0) {
-
+
for (key.index = 0; key.index < DOT11_MAX_DEFAULT_KEYS; key.index++) {
val = htod32(key.index);
if ((error = dev_wlc_ioctl(dev, WLC_GET_KEY_PRIMARY, &val, sizeof(val))))
@@ -2130,7 +2124,7 @@ wl_iw_set_encode(
if (val)
break;
}
-
+
if (key.index == DOT11_MAX_DEFAULT_KEYS)
key.index = 0;
} else {
@@ -2139,15 +2133,15 @@ wl_iw_set_encode(
return -EINVAL;
}
-
+
wsec = (dwrq->flags & IW_ENCODE_DISABLED) ? 0 : WEP_ENABLED;
if ((error = dev_wlc_intvar_set(dev, "wsec", wsec)))
return error;
-
+
if (!extra || !dwrq->length || (dwrq->flags & IW_ENCODE_NOKEY)) {
-
+
val = htod32(key.index);
if ((error = dev_wlc_ioctl(dev, WLC_SET_KEY_PRIMARY, &val, sizeof(val))))
return error;
@@ -2179,13 +2173,13 @@ wl_iw_set_encode(
return -EINVAL;
}
-
+
swap_key_from_BE(&key);
if ((error = dev_wlc_ioctl(dev, WLC_SET_KEY, &key, sizeof(key))))
return error;
}
-
+
val = (dwrq->flags & IW_ENCODE_RESTRICTED) ? 1 : 0;
val = htod32(val);
if ((error = dev_wlc_ioctl(dev, WLC_SET_AUTH, &val, sizeof(val))))
@@ -2207,11 +2201,11 @@ wl_iw_get_encode(
WL_TRACE(("%s: SIOCGIWENCODE\n", dev->name));
-
+
bzero(&key, sizeof(wl_wsec_key_t));
if ((dwrq->flags & IW_ENCODE_INDEX) == 0) {
-
+
for (key.index = 0; key.index < DOT11_MAX_DEFAULT_KEYS; key.index++) {
val = key.index;
if ((error = dev_wlc_ioctl(dev, WLC_GET_KEY_PRIMARY, &val, sizeof(val))))
@@ -2226,7 +2220,7 @@ wl_iw_get_encode(
if (key.index >= DOT11_MAX_DEFAULT_KEYS)
key.index = 0;
-
+
if ((error = dev_wlc_ioctl(dev, WLC_GET_WSEC, &wsec, sizeof(wsec))) ||
(error = dev_wlc_ioctl(dev, WLC_GET_AUTH, &auth, sizeof(auth))))
@@ -2236,21 +2230,21 @@ wl_iw_get_encode(
wsec = dtoh32(wsec);
auth = dtoh32(auth);
-
+
dwrq->length = MIN(IW_ENCODING_TOKEN_MAX, key.len);
-
+
dwrq->flags = key.index + 1;
if (!(wsec & (WEP_ENABLED | TKIP_ENABLED | AES_ENABLED))) {
-
+
dwrq->flags |= IW_ENCODE_DISABLED;
}
if (auth) {
-
+
dwrq->flags |= IW_ENCODE_RESTRICTED;
}
-
+
if (dwrq->length && extra)
memcpy(extra, key.data, dwrq->length);
@@ -2360,34 +2354,34 @@ wl_iw_set_encodeext(
memset(&key, 0, sizeof(key));
iwe = (struct iw_encode_ext *)extra;
-
+
if (dwrq->flags & IW_ENCODE_DISABLED) {
}
-
+
key.index = 0;
if (dwrq->flags & IW_ENCODE_INDEX)
key.index = (dwrq->flags & IW_ENCODE_INDEX) - 1;
key.len = iwe->key_len;
-
+
if (!ETHER_ISMULTI(iwe->addr.sa_data))
bcopy((void *)&iwe->addr.sa_data, (char *)&key.ea, ETHER_ADDR_LEN);
-
+
if (key.len == 0) {
if (iwe->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) {
WL_WSEC(("Changing the the primary Key to %d\n", key.index));
-
+
key.index = htod32(key.index);
error = dev_wlc_ioctl(dev, WLC_SET_KEY_PRIMARY,
&key.index, sizeof(key.index));
if (error)
return error;
}
-
+
else {
swap_key_from_BE(&key);
error = dev_wlc_ioctl(dev, WLC_SET_KEY, &key, sizeof(key));
@@ -2396,7 +2390,7 @@ wl_iw_set_encodeext(
}
}
#if (defined(BCMSUP_PSK) && defined(WLFBT))
-
+
else if (iwe->alg == IW_ENCODE_ALG_PMK) {
int j;
wsec_pmk_t pmk;
@@ -2404,7 +2398,7 @@ wl_iw_set_encodeext(
char* charptr = keystring;
uint len;
-
+
for (j = 0; j < (WSEC_MAX_PSK_LEN / 2); j++) {
sprintf(charptr, "%02x", iwe->key[j]);
charptr += 2;
@@ -2418,7 +2412,7 @@ wl_iw_set_encodeext(
if (error)
return error;
}
-#endif
+#endif
else {
if (iwe->key_len > sizeof(key.data))
@@ -2439,7 +2433,7 @@ wl_iw_set_encodeext(
bcopy(keybuf, &key.data[16], sizeof(keybuf));
}
-
+
if (iwe->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) {
uchar *ivptr;
ivptr = (uchar *)iwe->rx_seq;
@@ -2575,7 +2569,7 @@ wl_iw_set_pmksa(
dev_wlc_bufvar_set(dev, "pmkid_info", (char *)&pmkid_list, sizeof(pmkid_list));
return 0;
}
-#endif
+#endif
static int
wl_iw_get_encodeext(
@@ -2615,7 +2609,7 @@ wl_iw_set_wpaauth(
switch (paramid) {
case IW_AUTH_WPA_VERSION:
-
+
if (paramval & IW_AUTH_WPA_VERSION_DISABLED)
val = WPA_AUTH_DISABLED;
else if (paramval & (IW_AUTH_WPA_VERSION_WPA))
@@ -2683,7 +2677,7 @@ wl_iw_set_wpaauth(
if ((error = dev_wlc_intvar_set(dev, "sup_wpa", 0)))
return error;
}
-#endif
+#endif
break;
case IW_AUTH_KEY_MGMT:
@@ -2716,7 +2710,7 @@ wl_iw_set_wpaauth(
break;
case IW_AUTH_80211_AUTH_ALG:
-
+
WL_ERROR(("Setting the D11auth %d\n", paramval));
if (paramval & IW_AUTH_ALG_OPEN_SYSTEM)
val = 0;
@@ -2736,7 +2730,7 @@ wl_iw_set_wpaauth(
return error;
}
else {
-
+
}
break;
@@ -2752,7 +2746,7 @@ wl_iw_set_wpaauth(
case IW_AUTH_ROAMING_CONTROL:
WL_TRACE(("%s: IW_AUTH_ROAMING_CONTROL\n", __FUNCTION__));
-
+
break;
case IW_AUTH_PRIVACY_INVOKED: {
@@ -2770,7 +2764,7 @@ wl_iw_set_wpaauth(
return error;
if (!WSEC_ENABLED(wsec)) {
-
+
if ((error = dev_wlc_intvar_set(dev, "is_WPS_enrollee", TRUE))) {
WL_WSEC(("Failed to set iovar is_WPS_enrollee\n"));
return error;
@@ -2786,7 +2780,7 @@ wl_iw_set_wpaauth(
}
-#endif
+#endif
#ifdef BCMWAPI_WPI
@@ -2810,7 +2804,7 @@ wl_iw_set_wpaauth(
break;
-#endif
+#endif
default:
break;
@@ -2839,7 +2833,7 @@ wl_iw_get_wpaauth(
switch (paramid) {
case IW_AUTH_WPA_VERSION:
-
+
if ((error = dev_wlc_intvar_get(dev, "wpa_auth", &val)))
return error;
if (val & (WPA_AUTH_NONE | WPA_AUTH_DISABLED))
@@ -2859,7 +2853,7 @@ wl_iw_get_wpaauth(
break;
case IW_AUTH_KEY_MGMT:
-
+
if ((error = dev_wlc_intvar_get(dev, "wpa_auth", &val)))
return error;
if (VAL_PSK(val))
@@ -2881,7 +2875,7 @@ wl_iw_get_wpaauth(
break;
case IW_AUTH_80211_AUTH_ALG:
-
+
if ((error = dev_wlc_intvar_get(dev, "auth", &val)))
return error;
if (!val)
@@ -2902,90 +2896,90 @@ wl_iw_get_wpaauth(
case IW_AUTH_ROAMING_CONTROL:
WL_ERROR(("%s: IW_AUTH_ROAMING_CONTROL\n", __FUNCTION__));
-
+
break;
case IW_AUTH_PRIVACY_INVOKED:
paramval = iw->privacy_invoked;
break;
-#endif
+#endif
}
vwrq->value = paramval;
return 0;
}
-#endif
+#endif
static const iw_handler wl_iw_handler[] =
{
- (iw_handler) wl_iw_config_commit,
- (iw_handler) wl_iw_get_name,
- (iw_handler) NULL,
- (iw_handler) NULL,
- (iw_handler) wl_iw_set_freq,
- (iw_handler) wl_iw_get_freq,
- (iw_handler) wl_iw_set_mode,
- (iw_handler) wl_iw_get_mode,
- (iw_handler) NULL,
- (iw_handler) NULL,
- (iw_handler) NULL,
- (iw_handler) wl_iw_get_range,
- (iw_handler) NULL,
- (iw_handler) NULL,
- (iw_handler) NULL,
- (iw_handler) NULL,
- (iw_handler) wl_iw_set_spy,
- (iw_handler) wl_iw_get_spy,
- (iw_handler) NULL,
- (iw_handler) NULL,
- (iw_handler) wl_iw_set_wap,
- (iw_handler) wl_iw_get_wap,
+ (iw_handler) wl_iw_config_commit,
+ (iw_handler) wl_iw_get_name,
+ (iw_handler) NULL,
+ (iw_handler) NULL,
+ (iw_handler) wl_iw_set_freq,
+ (iw_handler) wl_iw_get_freq,
+ (iw_handler) wl_iw_set_mode,
+ (iw_handler) wl_iw_get_mode,
+ (iw_handler) NULL,
+ (iw_handler) NULL,
+ (iw_handler) NULL,
+ (iw_handler) wl_iw_get_range,
+ (iw_handler) NULL,
+ (iw_handler) NULL,
+ (iw_handler) NULL,
+ (iw_handler) NULL,
+ (iw_handler) wl_iw_set_spy,
+ (iw_handler) wl_iw_get_spy,
+ (iw_handler) NULL,
+ (iw_handler) NULL,
+ (iw_handler) wl_iw_set_wap,
+ (iw_handler) wl_iw_get_wap,
#if WIRELESS_EXT > 17
- (iw_handler) wl_iw_mlme,
+ (iw_handler) wl_iw_mlme,
#else
- (iw_handler) NULL,
+ (iw_handler) NULL,
#endif
- (iw_handler) wl_iw_iscan_get_aplist,
+ (iw_handler) wl_iw_iscan_get_aplist,
#if WIRELESS_EXT > 13
- (iw_handler) wl_iw_iscan_set_scan,
- (iw_handler) wl_iw_iscan_get_scan,
-#else
- (iw_handler) NULL,
- (iw_handler) NULL,
-#endif
- (iw_handler) wl_iw_set_essid,
- (iw_handler) wl_iw_get_essid,
- (iw_handler) wl_iw_set_nick,
- (iw_handler) wl_iw_get_nick,
- (iw_handler) NULL,
- (iw_handler) NULL,
- (iw_handler) wl_iw_set_rate,
- (iw_handler) wl_iw_get_rate,
- (iw_handler) wl_iw_set_rts,
- (iw_handler) wl_iw_get_rts,
- (iw_handler) wl_iw_set_frag,
- (iw_handler) wl_iw_get_frag,
- (iw_handler) wl_iw_set_txpow,
- (iw_handler) wl_iw_get_txpow,
+ (iw_handler) wl_iw_iscan_set_scan,
+ (iw_handler) wl_iw_iscan_get_scan,
+#else
+ (iw_handler) NULL,
+ (iw_handler) NULL,
+#endif
+ (iw_handler) wl_iw_set_essid,
+ (iw_handler) wl_iw_get_essid,
+ (iw_handler) wl_iw_set_nick,
+ (iw_handler) wl_iw_get_nick,
+ (iw_handler) NULL,
+ (iw_handler) NULL,
+ (iw_handler) wl_iw_set_rate,
+ (iw_handler) wl_iw_get_rate,
+ (iw_handler) wl_iw_set_rts,
+ (iw_handler) wl_iw_get_rts,
+ (iw_handler) wl_iw_set_frag,
+ (iw_handler) wl_iw_get_frag,
+ (iw_handler) wl_iw_set_txpow,
+ (iw_handler) wl_iw_get_txpow,
#if WIRELESS_EXT > 10
- (iw_handler) wl_iw_set_retry,
- (iw_handler) wl_iw_get_retry,
-#endif
- (iw_handler) wl_iw_set_encode,
- (iw_handler) wl_iw_get_encode,
- (iw_handler) wl_iw_set_power,
- (iw_handler) wl_iw_get_power,
+ (iw_handler) wl_iw_set_retry,
+ (iw_handler) wl_iw_get_retry,
+#endif
+ (iw_handler) wl_iw_set_encode,
+ (iw_handler) wl_iw_get_encode,
+ (iw_handler) wl_iw_set_power,
+ (iw_handler) wl_iw_get_power,
#if WIRELESS_EXT > 17
- (iw_handler) NULL,
- (iw_handler) NULL,
- (iw_handler) wl_iw_set_wpaie,
- (iw_handler) wl_iw_get_wpaie,
- (iw_handler) wl_iw_set_wpaauth,
- (iw_handler) wl_iw_get_wpaauth,
- (iw_handler) wl_iw_set_encodeext,
- (iw_handler) wl_iw_get_encodeext,
- (iw_handler) wl_iw_set_pmksa,
-#endif
+ (iw_handler) NULL,
+ (iw_handler) NULL,
+ (iw_handler) wl_iw_set_wpaie,
+ (iw_handler) wl_iw_get_wpaie,
+ (iw_handler) wl_iw_set_wpaauth,
+ (iw_handler) wl_iw_get_wpaauth,
+ (iw_handler) wl_iw_set_encodeext,
+ (iw_handler) wl_iw_get_encodeext,
+ (iw_handler) wl_iw_set_pmksa,
+#endif
};
#if WIRELESS_EXT > 12
@@ -3032,9 +3026,9 @@ const struct iw_handler_def wl_iw_handler_def =
.private_args = wl_iw_priv_args,
#if WIRELESS_EXT >= 19
get_wireless_stats: dhd_get_wireless_stats,
-#endif
+#endif
};
-#endif
+#endif
int
wl_iw_ioctl(
@@ -3089,7 +3083,7 @@ wl_iw_ioctl(
else
max_tokens = IW_SCAN_MAX_DATA;
break;
-#endif
+#endif
case SIOCSIWSPY:
token_size = sizeof(struct sockaddr);
@@ -3140,18 +3134,18 @@ wl_iw_conn_status_str(uint32 event_type, uint32 status, uint32 reason,
char* stringBuf, uint buflen)
{
typedef struct conn_fail_event_map_t {
- uint32 inEvent;
- uint32 inStatus;
- uint32 inReason;
- const char* outName;
- const char* outCause;
+ uint32 inEvent;
+ uint32 inStatus;
+ uint32 inReason;
+ const char* outName;
+ const char* outCause;
} conn_fail_event_map_t;
-
+
# define WL_IW_DONT_CARE 9999
const conn_fail_event_map_t event_map [] = {
-
-
+
+
{WLC_E_SET_SSID, WLC_E_STATUS_SUCCESS, WL_IW_DONT_CARE,
"Conn", "Success"},
{WLC_E_SET_SSID, WLC_E_STATUS_NO_NETWORKS, WL_IW_DONT_CARE,
@@ -3190,7 +3184,7 @@ wl_iw_conn_status_str(uint32 event_type, uint32 status, uint32 reason,
const char* cause = NULL;
int i;
-
+
for (i = 0; i < sizeof(event_map)/sizeof(event_map[0]); i++) {
const conn_fail_event_map_t* row = &event_map[i];
if (row->inEvent == event_type &&
@@ -3202,7 +3196,7 @@ wl_iw_conn_status_str(uint32 event_type, uint32 status, uint32 reason,
}
}
-
+
if (cause) {
memset(stringBuf, 0, buflen);
snprintf(stringBuf, buflen, "%s %s %02d %02d",
@@ -3230,11 +3224,11 @@ wl_iw_check_conn_fail(wl_event_msg_t *e, char* stringBuf, uint buflen)
return FALSE;
}
}
-#endif
+#endif
#ifndef IW_CUSTOM_MAX
-#define IW_CUSTOM_MAX 256
-#endif
+#define IW_CUSTOM_MAX 256
+#endif
void
wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data)
@@ -3300,7 +3294,7 @@ wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data)
WL_TRACE(("wl_iw_event status %d \n", status));
}
break;
-#endif
+#endif
#if WIRELESS_EXT > 17
case WLC_E_MIC_ERROR: {
struct iw_michaelmicfailure *micerrevt = (struct iw_michaelmicfailure *)&extra;
@@ -3356,7 +3350,7 @@ wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data)
}
break;
}
-#endif
+#endif
case WLC_E_SCAN_COMPLETE:
#if WIRELESS_EXT > 14
@@ -3369,7 +3363,7 @@ wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data)
break;
default:
-
+
break;
}
@@ -3381,16 +3375,16 @@ wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data)
}
#if WIRELESS_EXT > 14
-
+
memset(extra, 0, sizeof(extra));
if (wl_iw_check_conn_fail(e, extra, sizeof(extra))) {
cmd = IWEVCUSTOM;
wrqu.data.length = strlen(extra);
wireless_send_event(dev, cmd, &wrqu, extra);
}
-#endif
+#endif
-#endif
+#endif
}
int wl_iw_get_wireless_stats(struct net_device *dev, struct iw_statistics *wstats)
@@ -3413,9 +3407,6 @@ int wl_iw_get_wireless_stats(struct net_device *dev, struct iw_statistics *wstat
goto done;
rssi = dtoh32(scb_val.val);
- if (rssi >= WL_IW_RSSI_INVALID)
- rssi = WL_IW_RSSI_MAXVAL;
-
WL_TRACE(("wl_iw_get_wireless_stats rssi=%d ****** \n", rssi));
if (rssi <= WL_IW_RSSI_NO_SIGNAL)
wstats->qual.qual = 0;
@@ -3430,14 +3421,14 @@ int wl_iw_get_wireless_stats(struct net_device *dev, struct iw_statistics *wstat
else
wstats->qual.qual = 5;
-
+
wstats->qual.level = 0x100 + rssi;
wstats->qual.noise = 0x100 + phy_noise;
#if WIRELESS_EXT > 18
wstats->qual.updated |= (IW_QUAL_ALL_UPDATED | IW_QUAL_DBM);
#else
wstats->qual.updated |= 7;
-#endif
+#endif
#if WIRELESS_EXT > 11
WL_TRACE(("wl_iw_get_wireless_stats counters=%d\n *****", (int)sizeof(wl_cnt_t)));
@@ -3474,7 +3465,7 @@ int wl_iw_get_wireless_stats(struct net_device *dev, struct iw_statistics *wstat
WL_TRACE(("wl_iw_get_wireless_stats counters rxrunt=%d\n", dtoh32(cnt.rxrunt)));
WL_TRACE(("wl_iw_get_wireless_stats counters rxgiant=%d\n", dtoh32(cnt.rxgiant)));
-#endif
+#endif
done:
return res;
@@ -3485,7 +3476,6 @@ wl_iw_timerfunc(ulong data)
{
iscan_info_t *iscan = (iscan_info_t *)data;
iscan->timer_on = 0;
- DHD_ERROR(("TIMER_TIMER: iscan timer removed(%s)\n", __FUNCTION__));
if (iscan->iscan_state != ISCAN_STATE_IDLE) {
WL_TRACE(("timer trigger\n"));
up(&iscan->sysioc_sem);
@@ -3496,7 +3486,7 @@ static void
wl_iw_set_event_mask(struct net_device *dev)
{
char eventmask[WL_EVENTING_MASK_LEN];
- char iovbuf[WL_EVENTING_MASK_LEN + 12];
+ char iovbuf[WL_EVENTING_MASK_LEN + 12];
dev_iw_iovar_getbuf(dev, "event_msgs", "", 0, iovbuf, sizeof(iovbuf));
bcopy(iovbuf, eventmask, WL_EVENTING_MASK_LEN);
@@ -3554,7 +3544,7 @@ wl_iw_iscan(iscan_info_t *iscan, wlc_ssid_t *ssid, uint16 action)
params->action = htod16(action);
params->scan_duration = htod16(0);
-
+
(void) dev_iw_iovar_setbuf(iscan->dev, "iscan", params, params_size,
iscan->ioctlbuf, WLC_IOCTL_SMLEN);
}
@@ -3573,7 +3563,7 @@ wl_iw_iscan_get(iscan_info_t *iscan)
wl_scan_results_t *results;
uint32 status;
-
+
if (iscan->list_cur) {
buf = iscan->list_cur;
iscan->list_cur = buf->next;
@@ -3622,11 +3612,11 @@ wl_iw_iscan_get(iscan_info_t *iscan)
static void wl_iw_send_scan_complete(iscan_info_t *iscan)
{
union iwreq_data wrqu;
- char extra[IW_CUSTOM_MAX + 1];
memset(&wrqu, 0, sizeof(wrqu));
- memset(extra, 0, sizeof(extra));
- wireless_send_event(iscan->dev, SIOCGIWSCAN, &wrqu, extra);
+
+
+ wireless_send_event(iscan->dev, SIOCGIWSCAN, &wrqu, NULL);
}
static int
@@ -3642,7 +3632,6 @@ _iscan_sysioc_thread(void *data)
if (iscan->timer_on) {
del_timer(&iscan->timer);
iscan->timer_on = 0;
- DHD_ERROR(("TIMER_TIMER: iscan timer remove(%s)\n", __FUNCTION__));
}
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
@@ -3659,16 +3648,15 @@ _iscan_sysioc_thread(void *data)
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
rtnl_lock();
#endif
-
+
wl_iw_iscan(iscan, NULL, WL_SCAN_ACTION_CONTINUE);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
rtnl_unlock();
#endif
-
- iscan->timer.expires = jiffies + iscan->timer_ms*HZ/1000;
+
+ iscan->timer.expires = jiffies + msecs_to_jiffies(iscan->timer_ms);
add_timer(&iscan->timer);
iscan->timer_on = 1;
- DHD_ERROR(("TIMER_TIMER: iscan timer set(%s)\n", __FUNCTION__));
break;
case WL_SCAN_RESULTS_SUCCESS:
WL_TRACE(("iscanresults complete\n"));
@@ -3677,11 +3665,10 @@ _iscan_sysioc_thread(void *data)
break;
case WL_SCAN_RESULTS_PENDING:
WL_TRACE(("iscanresults pending\n"));
-
- iscan->timer.expires = jiffies + iscan->timer_ms*HZ/1000;
+
+ iscan->timer.expires = jiffies + msecs_to_jiffies(iscan->timer_ms);
add_timer(&iscan->timer);
iscan->timer_on = 1;
- DHD_ERROR(("TIMER_TIMER: iscan timer set(%s)\n", __FUNCTION__));
break;
case WL_SCAN_RESULTS_ABORTED:
WL_TRACE(("iscanresults aborted\n"));
@@ -3709,13 +3696,13 @@ wl_iw_attach(struct net_device *dev, void * dhdp)
return -ENOMEM;
memset(iscan, 0, sizeof(iscan_info_t));
iscan->sysioc_pid = -1;
-
+
g_iscan = iscan;
iscan->dev = dev;
iscan->iscan_state = ISCAN_STATE_IDLE;
-
+
iscan->timer_ms = 2000;
init_timer(&iscan->timer);
iscan->timer.data = (ulong)iscan;
@@ -3749,4 +3736,4 @@ void wl_iw_detach(void)
g_iscan = NULL;
}
-#endif
+#endif
diff --git a/drivers/net/wireless/bcmdhd/src/wl/sys/wl_iw.h b/drivers/net/wireless/bcmdhd/wl_iw.h
index 3929e6c..2afb5a6 100644
--- a/drivers/net/wireless/bcmdhd/src/wl/sys/wl_iw.h
+++ b/drivers/net/wireless/bcmdhd/wl_iw.h
@@ -1,14 +1,14 @@
/*
* Linux Wireless Extensions support
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,7 +16,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
@@ -33,13 +33,13 @@
#include <proto/ethernet.h>
#include <wlioctl.h>
-#define WL_SCAN_PARAMS_SSID_MAX 10
+#define WL_SCAN_PARAMS_SSID_MAX 10
#define GET_SSID "SSID="
#define GET_CHANNEL "CH="
-#define GET_NPROBE "NPROBE="
-#define GET_ACTIVE_ASSOC_DWELL "ACTIVE="
-#define GET_PASSIVE_ASSOC_DWELL "PASSIVE="
-#define GET_HOME_DWELL "HOME="
+#define GET_NPROBE "NPROBE="
+#define GET_ACTIVE_ASSOC_DWELL "ACTIVE="
+#define GET_PASSIVE_ASSOC_DWELL "PASSIVE="
+#define GET_HOME_DWELL "HOME="
#define GET_SCAN_TYPE "TYPE="
#define BAND_GET_CMD "GETBAND"
@@ -49,7 +49,7 @@
#define SETSUSPEND_CMD "SETSUSPENDOPT"
#define PNOSSIDCLR_SET_CMD "PNOSSIDCLR"
-#define PNOSETUP_SET_CMD "PNOSETUP "
+#define PNOSETUP_SET_CMD "PNOSETUP "
#define PNOENABLE_SET_CMD "PNOFORCE"
#define PNODEBUG_SET_CMD "PNODEBUG"
#define TXPOWER_SET_CMD "TXPOWER"
@@ -59,25 +59,24 @@
typedef struct wl_iw_extra_params {
- int target_channel;
+ int target_channel;
} wl_iw_extra_params_t;
struct cntry_locales_custom {
- char iso_abbrev[WLC_CNTRY_BUF_SZ];
- char custom_locale[WLC_CNTRY_BUF_SZ];
- int32 custom_locale_rev;
+ char iso_abbrev[WLC_CNTRY_BUF_SZ];
+ char custom_locale[WLC_CNTRY_BUF_SZ];
+ int32 custom_locale_rev;
};
-#define WL_IW_RSSI_MINVAL -200
-#define WL_IW_RSSI_NO_SIGNAL -91
-#define WL_IW_RSSI_VERY_LOW -80
-#define WL_IW_RSSI_LOW -70
-#define WL_IW_RSSI_GOOD -68
-#define WL_IW_RSSI_VERY_GOOD -58
-#define WL_IW_RSSI_EXCELLENT -57
-#define WL_IW_RSSI_INVALID 0
-#define WL_IW_RSSI_MAXVAL -15
+#define WL_IW_RSSI_MINVAL -200
+#define WL_IW_RSSI_NO_SIGNAL -91
+#define WL_IW_RSSI_VERY_LOW -80
+#define WL_IW_RSSI_LOW -70
+#define WL_IW_RSSI_GOOD -68
+#define WL_IW_RSSI_VERY_GOOD -58
+#define WL_IW_RSSI_EXCELLENT -57
+#define WL_IW_RSSI_INVALID 0
#define MAX_WX_STRING 80
#define SSID_FMT_BUF_LEN ((4 * 32) + 1)
#define isprint(c) bcm_isprint(c)
@@ -89,8 +88,8 @@ struct cntry_locales_custom {
#define WL_IW_SET_STOP (SIOCIWFIRSTPRIV+11)
#define WL_IW_SET_START (SIOCIWFIRSTPRIV+13)
-#define G_SCAN_RESULTS 8*1024
-#define WE_ADD_EVENT_FIX 0x80
+#define G_SCAN_RESULTS 8*1024
+#define WE_ADD_EVENT_FIX 0x80
#define G_WLAN_SET_ON 0
#define G_WLAN_SET_OFF 1
@@ -101,9 +100,9 @@ typedef struct wl_iw {
struct iw_statistics wstats;
int spy_num;
- uint32 pwsec;
- uint32 gwsec;
- bool privacy_invoked;
+ uint32 pwsec;
+ uint32 gwsec;
+ bool privacy_invoked;
struct ether_addr spy_addr[IW_MAX_SPY];
struct iw_quality spy_qual[IW_MAX_SPY];
void *wlinfo;
@@ -121,7 +120,7 @@ struct wl_ctrl {
#if WIRELESS_EXT > 12
#include <net/iw_handler.h>
extern const struct iw_handler_def wl_iw_handler_def;
-#endif
+#endif
extern int wl_iw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
extern void wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data);
@@ -132,7 +131,7 @@ int wl_iw_send_priv_event(struct net_device *dev, char *flag);
void wl_iw_detach(void);
#define CSCAN_COMMAND "CSCAN "
-#define CSCAN_TLV_PREFIX 'S'
+#define CSCAN_TLV_PREFIX 'S'
#define CSCAN_TLV_VERSION 1
#define CSCAN_TLV_SUBVERSION 0
#define CSCAN_TLV_TYPE_SSID_IE 'S'
@@ -159,4 +158,4 @@ void wl_iw_detach(void);
iwe_stream_add_point(stream, ends, iwe, extra)
#endif
-#endif
+#endif
diff --git a/drivers/net/wireless/bcmdhd/src/wl/sys/wl_linux_mon.c b/drivers/net/wireless/bcmdhd/wl_linux_mon.c
index 8a29599..af25863 100644
--- a/drivers/net/wireless/bcmdhd/src/wl/sys/wl_linux_mon.c
+++ b/drivers/net/wireless/bcmdhd/wl_linux_mon.c
@@ -1,14 +1,14 @@
/*
* Broadcom Dongle Host Driver (DHD), Linux monitor network interface
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,7 +16,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
@@ -59,15 +59,8 @@ int dhd_monitor_uninit(void);
#ifndef DHD_MAX_IFS
#define DHD_MAX_IFS 16
#endif
-
-#define MON_DEBUG 0
-#if MON_DEBUG
- #define MON_PRINT(format, ...) printk("DHD-MON: %s " format, __func__, ##__VA_ARGS__)
- #define MON_TRACE MON_PRINT
-#else
- #define MON_PRINT(format, ...)
- #define MON_TRACE MON_PRINT
-#endif
+#define MON_PRINT(format, ...) printk("DHD-MON: %s " format, __func__, ##__VA_ARGS__)
+#define MON_TRACE MON_PRINT
typedef struct monitor_interface {
int radiotap_enabled;
@@ -96,8 +89,12 @@ static const struct net_device_ops dhd_mon_if_ops = {
.ndo_open = dhd_mon_if_open,
.ndo_stop = dhd_mon_if_stop,
.ndo_start_xmit = dhd_mon_if_subif_start_xmit,
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0))
+ .ndo_set_rx_mode = dhd_mon_if_set_multicast_list,
+#else
.ndo_set_multicast_list = dhd_mon_if_set_multicast_list,
- .ndo_set_mac_address = dhd_mon_if_change_mac,
+#endif
+ .ndo_set_mac_address = dhd_mon_if_change_mac,
};
/**
diff --git a/drivers/net/wireless/bcmdhd/wl_roam.c b/drivers/net/wireless/bcmdhd/wl_roam.c
new file mode 100644
index 0000000..708fb3b
--- /dev/null
+++ b/drivers/net/wireless/bcmdhd/wl_roam.c
@@ -0,0 +1,288 @@
+/*
+ * Linux roam cache
+ *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
+ * Unless you and Broadcom execute a separate written software license
+ * agreement governing use of this software, this software is licensed to you
+ * under the terms of the GNU General Public License version 2 (the "GPL"),
+ * available at http://www.broadcom.com/licenses/GPLv2.php, with the
+ * following added to such license:
+ *
+ * As a special exception, the copyright holders of this software give you
+ * permission to link this software with independent modules, and to copy and
+ * distribute the resulting executable under terms of your choice, provided that
+ * you also meet, for each linked independent module, the terms and conditions of
+ * the license of that module. An independent module is a module which is not
+ * derived from this software. The special exception does not apply to any
+ * modifications of the software.
+ *
+ * Notwithstanding the above, under no circumstances may you combine this
+ * software in any way with any other Broadcom software provided under a license
+ * other than the GPL, without Broadcom's express prior written consent.
+ *
+ * $Id: wl_roam.c 334946 2012-05-24 20:38:00Z $
+ */
+
+#include <typedefs.h>
+#include <osl.h>
+#include <bcmwifi_channels.h>
+#include <wlioctl.h>
+
+#if defined(CUSTOMER_HW4) && defined(WES_SUPPORT)
+#include <wldev_common.h>
+
+#define WL_ERROR(x) printk x
+#endif
+
+#define WL_DBG(x)
+
+#define MAX_ROAM_CACHE 100
+
+typedef struct {
+ chanspec_t chanspec;
+ int ssid_len;
+ char ssid[36];
+} roam_channel_cache;
+
+static int n_roam_cache = 0;
+static int roam_band = WLC_BAND_AUTO;
+static roam_channel_cache roam_cache[MAX_ROAM_CACHE];
+#if defined(CUSTOMER_HW4) && defined(WES_SUPPORT)
+static int roamscan_mode = 0;
+#endif
+
+#if defined(CUSTOMER_HW4) && defined(WES_SUPPORT)
+int get_roamscan_mode(struct net_device *dev, int *mode)
+{
+ *mode = roamscan_mode;
+
+ return 0;
+}
+
+int set_roamscan_mode(struct net_device *dev, int mode)
+{
+ int error = 0;
+ roamscan_mode = mode;
+ n_roam_cache = 0;
+
+ error = wldev_iovar_setint(dev, "roamscan_mode", mode);
+ if (error) {
+ WL_ERROR(("Failed to set roamscan mode to %d, error = %d\n", mode, error));
+ }
+
+ return error;
+}
+
+int get_roamscan_channel_list(struct net_device *dev, unsigned char channels[])
+{
+ int n = 0;
+
+ if (roamscan_mode) {
+ for (n = 0; n < n_roam_cache; n++) {
+ channels[n] = roam_cache[n].chanspec & WL_CHANSPEC_CHAN_MASK;
+
+ WL_DBG(("%s: channel[%d] - [%02d] \n", __FUNCTION__, n, channels[n]));
+ }
+ }
+
+ return n;
+}
+
+int set_roamscan_channel_list(struct net_device *dev,
+ unsigned char n, unsigned char channels[], int ioctl_ver)
+{
+ int i;
+ int error;
+ struct {
+ int n;
+ chanspec_t channels[20];
+ } channel_list;
+ char iobuf[200];
+ uint band, band2G, band5G, bw;
+ roamscan_mode = 1;
+
+ if (n > 20)
+ n = 20;
+
+#ifdef D11AC_IOTYPES
+ if (ioctl_ver == 1) {
+ /* legacy chanspec */
+ band2G = WL_LCHANSPEC_BAND_2G;
+ band5G = WL_LCHANSPEC_BAND_5G;
+ bw = WL_LCHANSPEC_BW_20 | WL_LCHANSPEC_CTL_SB_NONE;
+ } else {
+ band2G = WL_CHANSPEC_BAND_2G;
+ band5G = WL_CHANSPEC_BAND_5G;
+ bw = WL_CHANSPEC_BW_20;
+ }
+#else
+ band2G = WL_CHANSPEC_BAND_2G;
+ band5G = WL_CHANSPEC_BAND_5G;
+ bw = WL_CHANSPEC_BW_20 | WL_CHANSPEC_CTL_SB_NONE;
+#endif /* D11AC_IOTYPES */
+
+ for (i = 0; i < n; i++) {
+ chanspec_t chanspec;
+
+ if (channels[i] <= 14) {
+ chanspec = band2G | bw | channels[i];
+ } else {
+ chanspec = band5G | bw | channels[i];
+ }
+ roam_cache[i].chanspec = chanspec;
+ channel_list.channels[i] = chanspec;
+
+ WL_DBG(("%s: channel[%d] - [%02d] \n", __FUNCTION__, i, channels[i]));
+ }
+
+ n_roam_cache = n;
+ channel_list.n = n;
+
+ error = wldev_iovar_setbuf(dev, "roamscan_channels", &channel_list,
+ sizeof(channel_list), iobuf, sizeof(iobuf), NULL);
+ if (error) {
+ WL_ERROR(("Failed to set roamscan channels, error = %d\n", error));
+ }
+
+ return error;
+}
+#endif /* WES_SUPPORT */
+
+void set_roam_band(int band)
+{
+ roam_band = band;
+}
+
+void reset_roam_cache(void)
+{
+#if defined(CUSTOMER_HW4) && defined(WES_SUPPORT)
+ if (roamscan_mode)
+ return;
+#endif
+
+ n_roam_cache = 0;
+}
+
+void add_roam_cache(wl_bss_info_t *bi)
+{
+ int i;
+ uint8 channel;
+
+#if defined(CUSTOMER_HW4) && defined(WES_SUPPORT)
+ if (roamscan_mode)
+ return;
+#endif
+
+ if (n_roam_cache == MAX_ROAM_CACHE)
+ return;
+
+ for (i = 0; i < n_roam_cache; i++) {
+ if ((roam_cache[i].ssid_len == bi->SSID_len) &&
+ (roam_cache[i].chanspec == bi->chanspec) &&
+ (memcmp(roam_cache[i].ssid, bi->SSID, bi->SSID_len) == 0)) {
+ /* identical one found, just return */
+ return;
+ }
+ }
+
+ roam_cache[n_roam_cache].ssid_len = bi->SSID_len;
+ channel = (bi->ctl_ch == 0) ? CHSPEC_CHANNEL(bi->chanspec) : bi->ctl_ch;
+ roam_cache[n_roam_cache].chanspec =
+ WL_CHANSPEC_BW_20 |
+ (channel <= 14 ? WL_CHANSPEC_BAND_2G : WL_CHANSPEC_BAND_5G) |
+ channel;
+ memcpy(roam_cache[n_roam_cache].ssid, bi->SSID, bi->SSID_len);
+
+ n_roam_cache++;
+}
+
+int get_roam_channel_list(int target_chan,
+ chanspec_t *channels, const wlc_ssid_t *ssid, int ioctl_ver)
+{
+ int i, n = 1;
+ uint band, band2G, band5G, bw;
+
+#ifdef D11AC_IOTYPES
+ if (ioctl_ver == 1) {
+ /* legacy chanspec */
+ band2G = WL_LCHANSPEC_BAND_2G;
+ band5G = WL_LCHANSPEC_BAND_5G;
+ bw = WL_LCHANSPEC_BW_20 | WL_LCHANSPEC_CTL_SB_NONE;
+ } else {
+ band2G = WL_CHANSPEC_BAND_2G;
+ band5G = WL_CHANSPEC_BAND_5G;
+ bw = WL_CHANSPEC_BW_20;
+ }
+#else
+ band2G = WL_CHANSPEC_BAND_2G;
+ band5G = WL_CHANSPEC_BAND_5G;
+ bw = WL_CHANSPEC_BW_20 | WL_CHANSPEC_CTL_SB_NONE;
+#endif /* D11AC_IOTYPES */
+
+ if (target_chan <= 14)
+ band = band2G;
+ else
+ band = band5G;
+ *channels = (target_chan & WL_CHANSPEC_CHAN_MASK) | band | bw;
+ WL_DBG((" %s: %02d 0x%04X\n", __FUNCTION__, target_chan, *channels));
+ ++channels;
+
+#if defined(CUSTOMER_HW4) && defined(WES_SUPPORT)
+ if (roamscan_mode) {
+ for (i = 0; i < n_roam_cache; i++) {
+ if ((roam_cache[i].chanspec & WL_CHANSPEC_CHAN_MASK) != target_chan) {
+ *channels = roam_cache[i].chanspec & WL_CHANSPEC_CHAN_MASK;
+ WL_DBG((" %s: %02d\n", __FUNCTION__, *channels));
+ if (*channels <= 14)
+ *channels |= band2G | bw;
+ else
+ *channels |= band5G | bw;
+
+ channels++;
+ n++;
+ }
+ }
+
+ return n;
+ }
+#endif /* WES_SUPPORT */
+
+ for (i = 0; i < n_roam_cache; i++) {
+ chanspec_t ch = roam_cache[i].chanspec;
+ if ((roam_cache[i].ssid_len == ssid->SSID_len) &&
+ ((ch & WL_CHANSPEC_CHAN_MASK) != target_chan) &&
+ ((roam_band == WLC_BAND_AUTO) ||
+ ((roam_band == WLC_BAND_2G) && CHSPEC_IS2G(ch)) ||
+ ((roam_band == WLC_BAND_5G) && CHSPEC_IS5G(ch))) &&
+ (memcmp(roam_cache[i].ssid, ssid->SSID, ssid->SSID_len) == 0)) {
+ /* match found, add it */
+ *channels = ch & WL_CHANSPEC_CHAN_MASK;
+ if (*channels <= 14)
+ *channels |= band2G | bw;
+ else
+ *channels |= band5G | bw;
+
+ WL_DBG((" %s: %02d 0x%04X\n", __FUNCTION__,
+ ch & WL_CHANSPEC_CHAN_MASK, *channels));
+
+ channels++; n++;
+ }
+ }
+
+ return n;
+}
+
+
+void print_roam_cache(void)
+{
+ int i;
+
+ WL_DBG((" %d cache\n", n_roam_cache));
+
+ for (i = 0; i < n_roam_cache; i++) {
+ roam_cache[i].ssid[roam_cache[i].ssid_len] = 0;
+ WL_DBG(("0x%02X %02d %s\n", roam_cache[i].chanspec,
+ roam_cache[i].ssid_len, roam_cache[i].ssid));
+ }
+}
diff --git a/drivers/net/wireless/bcmdhd/src/wl/sys/wldev_common.c b/drivers/net/wireless/bcmdhd/wldev_common.c
index 516da89..ef51480 100644
--- a/drivers/net/wireless/bcmdhd/src/wl/sys/wldev_common.c
+++ b/drivers/net/wireless/bcmdhd/wldev_common.c
@@ -1,14 +1,14 @@
/*
* Common function shared by Linux WEXT, cfg80211 and p2p drivers
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,7 +16,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
@@ -31,7 +31,6 @@
#include <wldev_common.h>
#include <bcmutils.h>
-#include <wl_iw.h>
#define htod32(i) i
#define htod16(i) i
@@ -42,16 +41,10 @@
#define WLDEV_ERROR(args) \
do { \
- printk(KERN_ERR "WLDEV-INFO2) %s : ", __func__); \
+ printk(KERN_ERR "WLDEV-ERROR) %s : ", __func__); \
printk args; \
} while (0)
-#define WLDEV_INFO(args) \
- do { \
- printk(KERN_INFO "WLDEV-INFO) %s : ", __func__); \
- printk args; \
- } while (0)
-
extern int dhd_ioctl_entry_local(struct net_device *net, wl_ioctl_t *ioc, int cmd);
s32 wldev_ioctl(
@@ -112,7 +105,10 @@ s32 wldev_iovar_setbuf(
mutex_lock(buf_sync);
}
iovar_len = wldev_mkiovar(iovar_name, param, paramlen, buf, buflen);
- ret = wldev_ioctl(dev, WLC_SET_VAR, buf, iovar_len, TRUE);
+ if (iovar_len > 0)
+ ret = wldev_ioctl(dev, WLC_SET_VAR, buf, iovar_len, TRUE);
+ else
+ ret = BCME_BUFTOOSHORT;
if (buf_sync)
mutex_unlock(buf_sync);
return ret;
@@ -230,11 +226,9 @@ s32 wldev_iovar_setbuf_bsscfg(
if (iovar_len > 0)
ret = wldev_ioctl(dev, WLC_SET_VAR, buf, iovar_len, TRUE);
else {
- if (buf_sync) {
- mutex_unlock(buf_sync);
- }
- return BCME_BUFTOOSHORT;
+ ret = BCME_BUFTOOSHORT;
}
+
if (buf_sync) {
mutex_unlock(buf_sync);
}
@@ -301,10 +295,6 @@ int wldev_get_rssi(
return error;
*prssi = dtoh32(scb_val.val);
- /* when the return value is zero. skip overrinding code */
- if (*prssi > WL_IW_RSSI_INVALID)
- *prssi = WL_IW_RSSI_MAXVAL;
-
return error;
}
@@ -338,6 +328,8 @@ int wldev_set_band(
if ((band == WLC_BAND_AUTO) || (band == WLC_BAND_5G) || (band == WLC_BAND_2G)) {
error = wldev_ioctl(dev, WLC_SET_BAND, &band, sizeof(band), 1);
+ if (!error)
+ dhd_bus_band_set(dev, band);
}
return error;
}
@@ -367,20 +359,20 @@ int wldev_set_country(
__FUNCTION__, error));
return error;
}
- }
- cspec.rev = -1;
- memcpy(cspec.country_abbrev, country_code, WLC_CNTRY_BUF_SZ);
- memcpy(cspec.ccode, country_code, WLC_CNTRY_BUF_SZ);
- get_customized_country_code((char *)&cspec.country_abbrev, &cspec);
- error = wldev_iovar_setbuf(dev, "country", &cspec, sizeof(cspec),
- smbuf, sizeof(smbuf), NULL);
- if (error < 0) {
- WLDEV_ERROR(("%s: set country for %s as %s rev %d failed\n",
+ cspec.rev = -1;
+ memcpy(cspec.country_abbrev, country_code, WLC_CNTRY_BUF_SZ);
+ memcpy(cspec.ccode, country_code, WLC_CNTRY_BUF_SZ);
+ get_customized_country_code((char *)&cspec.country_abbrev, &cspec);
+ error = wldev_iovar_setbuf(dev, "country", &cspec, sizeof(cspec),
+ smbuf, sizeof(smbuf), NULL);
+ if (error < 0) {
+ WLDEV_ERROR(("%s: set country for %s as %s rev %d failed\n",
+ __FUNCTION__, country_code, cspec.ccode, cspec.rev));
+ return error;
+ }
+ dhd_bus_country_set(dev, &cspec);
+ WLDEV_ERROR(("%s: set country for %s as %s rev %d\n",
__FUNCTION__, country_code, cspec.ccode, cspec.rev));
- return error;
}
- dhd_bus_country_set(dev, &cspec);
- WLDEV_INFO(("%s: set country for %s as %s rev %d\n",
- __FUNCTION__, country_code, cspec.ccode, cspec.rev));
return 0;
}
diff --git a/drivers/net/wireless/bcmdhd/src/wl/sys/wldev_common.h b/drivers/net/wireless/bcmdhd/wldev_common.h
index 6f7f1d6..099e83f 100644
--- a/drivers/net/wireless/bcmdhd/src/wl/sys/wldev_common.h
+++ b/drivers/net/wireless/bcmdhd/wldev_common.h
@@ -1,14 +1,14 @@
/*
* Common function shared by Linux WEXT, cfg80211 and p2p drivers
*
- * Copyright (C) 1999-2011, Broadcom Corporation
- *
+ * Copyright (C) 1999-2012, Broadcom Corporation
+ *
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
- *
+ *
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,7 +16,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
- *
+ *
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
@@ -85,6 +85,7 @@ s32 wldev_iovar_setint_bsscfg(
extern void get_customized_country_code(char *country_iso_code, wl_country_t *cspec);
extern void dhd_bus_country_set(struct net_device *dev, wl_country_t *cspec);
+extern void dhd_bus_band_set(struct net_device *dev, uint band);
extern int wldev_set_country(struct net_device *dev, char *country_code);
extern int net_os_wake_lock(struct net_device *dev);
extern int net_os_wake_unlock(struct net_device *dev);
@@ -92,13 +93,12 @@ extern int net_os_wake_lock_timeout(struct net_device *dev);
extern int net_os_wake_lock_timeout_enable(struct net_device *dev, int val);
extern int net_os_set_dtim_skip(struct net_device *dev, int val);
extern int net_os_set_suspend_disable(struct net_device *dev, int val);
-extern int net_os_set_suspend(struct net_device *dev, int val);
+extern int net_os_set_suspend(struct net_device *dev, int val, int force);
extern int wl_iw_parse_ssid_list_tlv(char** list_str, wlc_ssid_t* ssid,
int max, int *bytes_left);
-#if defined(PNO_SUPPORT) && defined(CONFIG_HAS_WAKELOCK)
+#if defined(CUSTOMER_HW4) && defined(PNO_SUPPORT) && defined(CONFIG_HAS_WAKELOCK)
int net_os_wake_lock_timeout_for_pno(struct net_device *dev, int sec);
#endif
-
/* Get the link speed from dongle, speed is in kpbs */
int wldev_get_link_speed(struct net_device *dev, int *plink_speed);