source "drivers/net/wireless/ath/Kconfig"
source "drivers/net/wireless/b43/Kconfig"
source "drivers/net/wireless/b43legacy/Kconfig"
-source "drivers/net/wireless/bcm4335/Kconfig"
+source "drivers/net/wireless/bcmdhd/Kconfig"
source "drivers/net/wireless/brcm80211/Kconfig"
source "drivers/net/wireless/sd8797/Kconfig"
source "drivers/net/wireless/hostap/Kconfig"
obj-$(CONFIG_MWIFIEX) += mwifiex/
-obj-$(CONFIG_BCM4335) += bcm4335/
+obj-$(CONFIG_BCMDHD) += bcmdhd/
+
+obj-$(CONFIG_BCM43241) += bcm43241/
+
+obj-$(CONFIG_BCM43341) += bcm43341/
obj-$(CONFIG_BRCMFMAC) += brcm80211/
obj-$(CONFIG_BRCMSMAC) += brcm80211/
--- /dev/null
+# bcmdhd
+
+DHDCFLAGS = -Wall -Wstrict-prototypes -Dlinux -DBCMDRIVER \
+ -DBCMDONGLEHOST -DUNRELEASEDCHIP -DBCMDMA32 -DBCMFILEIMAGE \
+ -DDHDTHREAD -DDHD_DEBUG -DSDTEST -DBDC -DTOE \
+ -DDHD_BCMEVENTS -DSHOW_EVENTS -DPROP_TXSTATUS -DBCMDBG \
+ -DCUSTOMER_HW2 \
+ -DMMC_SDIO_ABORT -DBCMSDIO -DBCMLXSDMMC -DBCMPLATFORM_BUS -DWLP2P \
+ -DWIFI_ACT_FRAME -DARP_OFFLOAD_SUPPORT \
+ -DKEEP_ALIVE -DGET_CUSTOM_MAC_ENABLE -DPKT_FILTER_SUPPORT \
+ -DEMBEDDED_PLATFORM -DPNO_SUPPORT \
+ -DDHD_USE_IDLECOUNT -DSET_RANDOM_MAC_SOFTAP -DROAM_ENABLE -DVSDB \
+ -DWL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST \
+ -DESCAN_RESULT_PATCH -DHT40_GO -DPASS_ARP_PACKET \
+ -DDHD_DONOT_FORWARD_BCMEVENT_AS_NETWORK_PKT -DSUPPORT_PM2_ONLY \
+ -DMIRACAST_AMPDU_SIZE=8 \
+ -Idrivers/net/wireless/bcmdhd -Idrivers/net/wireless/bcmdhd/include
+
+DHDCFLAGS += -DWL_CFG80211 -DWL_CFG80211_STA_EVENT
+DHDCFLAGS += -DDEBUGFS_CFG80211
+DHDCFLAGS += -DUSE_KTHREAD_API
+DHDCFLAGS += -DCUSTOM_DPC_CPUCORE=0
+DHDCFLAGS += -DCUSTOM_DPC_PRIO_SETTING=99
+DHDCFLAGS += -DIOCTL_RESP_TIMEOUT=5000
+
+ifeq ($(CONFIG_BCMDHD_HW_OOB),y)
+ DHDCFLAGS += -DHW_OOB -DOOB_INTR_ONLY
+else
+ DHDCFLAGS += -DSDIO_ISR_THREAD
+endif
+
+ifeq ($(CONFIG_BCMDHD_INSMOD_NO_FW_LOAD),y)
+ DHDCFLAGS += -DENABLE_INSMOD_NO_FW_LOAD
+endif
+
+ifneq ($(CONFIG_DHD_USE_SCHED_SCAN),)
+ DHDCFLAGS += -DWL_SCHED_SCAN
+endif
+
+ifeq ($(CONFIG_BCM43241),y)
+ DHDCFLAGS += -DBCM43241_CHIP
+ DHDCFLAGS += -DSDIO_CRC_ERROR_FIX
+ DHDCFLAGS += -DCUSTOM_SDIO_F2_BLKSIZE=128
+ DHDCFLAGS += -DCUSTOM_ROAM_TRIGGER_SETTING=-65
+ DHDCFLAGS += -DCUSTOM_ROAM_DELTA_SETTING=15
+ DHDCFLAGS += -DCUSTOM_KEEP_ALIVE_SETTING=28000
+ DHDCFLAGS += -DCUSTOM_PNO_EVENT_LOCK_xTIME=7
+ DHDCFLAGS += -DVSDB_BW_ALLOCATE_ENABLE
+ DHDCFLAGS += -DQMONITOR
+ DHDCFLAGS += -DDISABLE_CHIPACTIVE_BUSSLEEP
+ DHDCFLAGS += -DP2P_DISCOVERY_WAR
+endif
+
+#ifeq ($(CONFIG_BCM43341),y)
+# DHDCFLAGS += -DBCM43341_CHIP
+# DHDCFLAGS += -DVSDB_BW_ALLOCATE_ENABLE
+# DHDCFLAGS += -DQMONITOR
+# DHDCFLAGS += -DNV_BCM943341_WBFGN_MULTI_MODULE_SUPPORT
+#endif
+
+#ifeq ($(CONFIG_BCM4335),y)
+# DHDCFLAGS += -DBCM4335_CHIP
+# DHDCFLAGS += -DSDIO_CRC_ERROR_FIX
+# DHDCFLAGS += -DPROP_TXSTATUS_VSDB
+# DHDCFLAGS += -DCUSTOM_AMPDU_BA_WSIZE=40
+# DHDCFLAGS += -DCUSTOM_GLOM_SETTING=8 -DCUSTOM_RXCHAIN=1
+# DHDCFLAGS += -DBCMSDIOH_TXGLOM -DCUSTOM_TXGLOM=1 -DBCMSDIOH_TXGLOM_HIGHSPEED
+# DHDCFLAGS += -DCUSTOM_MAX_TXGLOM_SIZE=32
+# DHDCFLAGS += -DRXFRAME_THREAD
+# DHDCFLAGS += -DDHDTCPACK_SUPPRESS
+# DHDCFLAGS += -DUSE_WL_TXBF
+# DHDCFLAGS += -DUSE_WL_FRAMEBURST
+# DHDCFLAGS += -DDHD_ENABLE_LPC
+# DHDCFLAGS += -DVSDB_BW_ALLOCATE_ENABLE
+# DHDCFLAGS += -DQMONITOR
+# DHDCFLAGS += -DENABLE_4335BT_WAR
+#endif
+
+#ifeq ($(CONFIG_BCM4339),y)
+# DHDCFLAGS += -DBCM4339_CHIP
+# DHDCFLAGS += -DSDIO_CRC_ERROR_FIX
+# DHDCFLAGS += -DPROP_TXSTATUS_VSDB
+# DHDCFLAGS += -DCUSTOM_AMPDU_BA_WSIZE=40
+# DHDCFLAGS += -DCUSTOM_GLOM_SETTING=8 -DCUSTOM_RXCHAIN=1
+# DHDCFLAGS += -DBCMSDIOH_TXGLOM -DCUSTOM_TXGLOM=1 -DBCMSDIOH_TXGLOM_HIGHSPEED
+# DHDCFLAGS += -DCUSTOM_MAX_TXGLOM_SIZE=32
+# DHDCFLAGS += -DRXFRAME_THREAD
+# DHDCFLAGS += -DDHDTCPACK_SUPPRESS
+# DHDCFLAGS += -DUSE_WL_TXBF
+# DHDCFLAGS += -DUSE_WL_FRAMEBURST
+# DHDCFLAGS += -DDHD_ENABLE_LPC
+# DHDCFLAGS += -DVSDB_BW_ALLOCATE_ENABLE
+# DHDCFLAGS += -DQMONITOR
+#endif
+
+DHDOFILES = src/bcmsdh.o src/bcmsdh_linux.o src/bcmsdh_sdmmc.o src/bcmsdh_sdmmc_linux.o \
+ src/dhd_cdc.o src/dhd_cfg80211.o src/dhd_common.o src/dhd_custom_gpio.o src/dhd_ip.o \
+ src/dhd_linux.o src/dhd_linux_sched.o src/dhd_sdio.o src/dhd_wlfc.o src/aiutils.o \
+ src/bcmevent.o src/bcmutils.o src/bcmwifi_channels.o src/hndpmu.o src/linux_osl.o \
+ src/sbutils.o src/siutils.o src/wldev_common.o src/wl_android.o src/wl_cfg80211.o \
+ src/wl_cfgp2p.o src/wl_linux_mon.o
+
+ifneq ($(findstring QMONITOR, $(DHDCFLAGS)),)
+ DHDOFILES += src/dhd_qmon.o
+endif
+
+obj-$(CONFIG_BCMDHD) += bcm43241.o
+bcm43241-objs += $(DHDOFILES)
+
+EXTRA_CFLAGS = $(DHDCFLAGS)
+ifeq ($(CONFIG_BCMDHD),m)
+ EXTRA_LDFLAGS += --strip-debug
+endif
--- /dev/null
+../bcmdhd
\ No newline at end of file
--- /dev/null
+# bcmdhd
+
+DHDCFLAGS = -Wall -Wstrict-prototypes -Dlinux -DBCMDRIVER \
+ -DBCMDONGLEHOST -DUNRELEASEDCHIP -DBCMDMA32 -DBCMFILEIMAGE \
+ -DDHDTHREAD -DDHD_DEBUG -DSDTEST -DBDC -DTOE \
+ -DDHD_BCMEVENTS -DSHOW_EVENTS -DPROP_TXSTATUS -DBCMDBG \
+ -DCUSTOMER_HW2 \
+ -DMMC_SDIO_ABORT -DBCMSDIO -DBCMLXSDMMC -DBCMPLATFORM_BUS -DWLP2P \
+ -DWIFI_ACT_FRAME -DARP_OFFLOAD_SUPPORT \
+ -DKEEP_ALIVE -DGET_CUSTOM_MAC_ENABLE -DPKT_FILTER_SUPPORT \
+ -DEMBEDDED_PLATFORM -DPNO_SUPPORT \
+ -DDHD_USE_IDLECOUNT -DSET_RANDOM_MAC_SOFTAP -DROAM_ENABLE -DVSDB \
+ -DWL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST \
+ -DESCAN_RESULT_PATCH -DHT40_GO -DPASS_ARP_PACKET \
+ -DDHD_DONOT_FORWARD_BCMEVENT_AS_NETWORK_PKT -DSUPPORT_PM2_ONLY \
+ -DMIRACAST_AMPDU_SIZE=8 \
+ -Idrivers/net/wireless/bcmdhd -Idrivers/net/wireless/bcmdhd/include
+
+DHDCFLAGS += -DWL_CFG80211 -DWL_CFG80211_STA_EVENT
+DHDCFLAGS += -DDEBUGFS_CFG80211
+DHDCFLAGS += -DUSE_KTHREAD_API
+DHDCFLAGS += -DCUSTOM_DPC_CPUCORE=0
+DHDCFLAGS += -DCUSTOM_DPC_PRIO_SETTING=99
+DHDCFLAGS += -DIOCTL_RESP_TIMEOUT=5000
+
+ifeq ($(CONFIG_BCMDHD_HW_OOB),y)
+ DHDCFLAGS += -DHW_OOB -DOOB_INTR_ONLY
+else
+ DHDCFLAGS += -DSDIO_ISR_THREAD
+endif
+
+ifeq ($(CONFIG_BCMDHD_INSMOD_NO_FW_LOAD),y)
+ DHDCFLAGS += -DENABLE_INSMOD_NO_FW_LOAD
+endif
+
+ifneq ($(CONFIG_DHD_USE_SCHED_SCAN),)
+ DHDCFLAGS += -DWL_SCHED_SCAN
+endif
+
+#ifeq ($(CONFIG_BCM43241),y)
+# DHDCFLAGS += -DBCM43241_CHIP
+# DHDCFLAGS += -DSDIO_CRC_ERROR_FIX
+# DHDCFLAGS += -DCUSTOM_SDIO_F2_BLKSIZE=128
+# DHDCFLAGS += -DCUSTOM_ROAM_TRIGGER_SETTING=-65
+# DHDCFLAGS += -DCUSTOM_ROAM_DELTA_SETTING=15
+# DHDCFLAGS += -DCUSTOM_KEEP_ALIVE_SETTING=28000
+# DHDCFLAGS += -DCUSTOM_PNO_EVENT_LOCK_xTIME=7
+# DHDCFLAGS += -DVSDB_BW_ALLOCATE_ENABLE
+# DHDCFLAGS += -DQMONITOR
+# DHDCFLAGS += -DDISABLE_CHIPACTIVE_BUSSLEEP
+# DHDCFLAGS += -DP2P_DISCOVERY_WAR
+#endif
+
+ifeq ($(CONFIG_BCM43341),y)
+ DHDCFLAGS += -DBCM43341_CHIP
+ DHDCFLAGS += -DVSDB_BW_ALLOCATE_ENABLE
+ DHDCFLAGS += -DQMONITOR
+ DHDCFLAGS += -DNV_BCM943341_WBFGN_MULTI_MODULE_SUPPORT
+endif
+
+#ifeq ($(CONFIG_BCM4335),y)
+# DHDCFLAGS += -DBCM4335_CHIP
+# DHDCFLAGS += -DSDIO_CRC_ERROR_FIX
+# DHDCFLAGS += -DPROP_TXSTATUS_VSDB
+# DHDCFLAGS += -DCUSTOM_AMPDU_BA_WSIZE=40
+# DHDCFLAGS += -DCUSTOM_GLOM_SETTING=8 -DCUSTOM_RXCHAIN=1
+# DHDCFLAGS += -DBCMSDIOH_TXGLOM -DCUSTOM_TXGLOM=1 -DBCMSDIOH_TXGLOM_HIGHSPEED
+# DHDCFLAGS += -DCUSTOM_MAX_TXGLOM_SIZE=32
+# DHDCFLAGS += -DRXFRAME_THREAD
+# DHDCFLAGS += -DDHDTCPACK_SUPPRESS
+# DHDCFLAGS += -DUSE_WL_TXBF
+# DHDCFLAGS += -DUSE_WL_FRAMEBURST
+# DHDCFLAGS += -DDHD_ENABLE_LPC
+# DHDCFLAGS += -DVSDB_BW_ALLOCATE_ENABLE
+# DHDCFLAGS += -DQMONITOR
+# DHDCFLAGS += -DENABLE_4335BT_WAR
+#endif
+
+#ifeq ($(CONFIG_BCM4339),y)
+# DHDCFLAGS += -DBCM4339_CHIP
+# DHDCFLAGS += -DSDIO_CRC_ERROR_FIX
+# DHDCFLAGS += -DPROP_TXSTATUS_VSDB
+# DHDCFLAGS += -DCUSTOM_AMPDU_BA_WSIZE=40
+# DHDCFLAGS += -DCUSTOM_GLOM_SETTING=8 -DCUSTOM_RXCHAIN=1
+# DHDCFLAGS += -DBCMSDIOH_TXGLOM -DCUSTOM_TXGLOM=1 -DBCMSDIOH_TXGLOM_HIGHSPEED
+# DHDCFLAGS += -DCUSTOM_MAX_TXGLOM_SIZE=32
+# DHDCFLAGS += -DRXFRAME_THREAD
+# DHDCFLAGS += -DDHDTCPACK_SUPPRESS
+# DHDCFLAGS += -DUSE_WL_TXBF
+# DHDCFLAGS += -DUSE_WL_FRAMEBURST
+# DHDCFLAGS += -DDHD_ENABLE_LPC
+# DHDCFLAGS += -DVSDB_BW_ALLOCATE_ENABLE
+# DHDCFLAGS += -DQMONITOR
+#endif
+
+DHDOFILES = src/bcmsdh.o src/bcmsdh_linux.o src/bcmsdh_sdmmc.o src/bcmsdh_sdmmc_linux.o \
+ src/dhd_cdc.o src/dhd_cfg80211.o src/dhd_common.o src/dhd_custom_gpio.o src/dhd_ip.o \
+ src/dhd_linux.o src/dhd_linux_sched.o src/dhd_sdio.o src/dhd_wlfc.o src/aiutils.o \
+ src/bcmevent.o src/bcmutils.o src/bcmwifi_channels.o src/hndpmu.o src/linux_osl.o \
+ src/sbutils.o src/siutils.o src/wldev_common.o src/wl_android.o src/wl_cfg80211.o \
+ src/wl_cfgp2p.o src/wl_linux_mon.o
+
+ifneq ($(findstring QMONITOR, $(DHDCFLAGS)),)
+ DHDOFILES += src/dhd_qmon.o
+endif
+
+obj-$(CONFIG_BCMDHD) += bcm43341.o
+bcm43341-objs += $(DHDOFILES)
+
+EXTRA_CFLAGS = $(DHDCFLAGS)
+ifeq ($(CONFIG_BCMDHD),m)
+ EXTRA_LDFLAGS += --strip-debug
+endif
--- /dev/null
+../bcmdhd
\ No newline at end of file
+++ /dev/null
-config BCM4335
- tristate "Broadcom 4335 wireless cards support"
- depends on MMC
- ---help---
- This module adds support for wireless adapters based on
- Broadcom 4335 chipset.
-
- This driver uses the kernel's cfg80211 subsystem.
-
- If you choose to build a module, it'll be called dhd. Say M if
- unsure.
-
-config BCM4335_FW_PATH
- depends on BCM4335
- string "Firmware path"
- default "/system/etc/firmware/fw_BCM4335.bin"
- ---help---
- Path to the firmware file.
-
-config BCM4335_NVRAM_PATH
- depends on BCM4335
- string "NVRAM path"
- default "/system/etc/wifi/BCM4335.cal"
- ---help---
- Path to the calibration file.
-
-config DHD_USE_STATIC_BUF
- bool "Enable memory preallocation"
- depends on BCM4335
- default n
- ---help---
- Use memory preallocated in platform
-
-config DHD_USE_SCHED_SCAN
- bool "Use CFG80211 sched scan"
- depends on BCM4335 && CFG80211
- default y
- ---help---
- Use CFG80211 sched scan
-
-config BCM4335_WIFI_CONTROL_FUNC
- bool "Use BCM4335_wlan device"
- depends on BCM4335
- default n
- ---help---
- Use this option to get various parameters from architecture specific
- BCM4335_wlan platform device. Say n if unsure.
-
-config BCM4335_HW_OOB
- bool "Use out of band interrupt"
- depends on BCM4335
- default n
- ---help---
- Use out of band interrupt for card interrupt and wake on wireless.
+++ /dev/null
-# BCM4335
-DHDCFLAGS = -Wall -Wstrict-prototypes -Dlinux -DLINUX -DBCMDRIVER \
- -DBCMDONGLEHOST -DUNRELEASEDCHIP -DBCMDMA32 -DBCMFILEIMAGE \
- -DDHDTHREAD -DBDC -DDHD_BCMEVENTS -DSHOW_EVENTS -DBCMDBG \
- -DMMC_SDIO_ABORT -DBCMSDIO -DBCMLXSDMMC -DBCMPLATFORM_BUS -DWLP2P \
- -DWIFI_ACT_FRAME -DARP_OFFLOAD_SUPPORT \
- -DKEEP_ALIVE -DCSCAN -DPKT_FILTER_SUPPORT \
- -DEMBEDDED_PLATFORM -DPNO_SUPPORT \
- -Idrivers/net/wireless/bcm4335 -Idrivers/net/wireless/bcm4335/include
-
-#DHDCFLAGS += -DDHD_DEBUG -DBCMDBG
-
-DHDCFLAGS += -DCUSTOMER_HW2
-DHDCFLAGS += -DENABLE_INSMOD_NO_FW_LOAD
-DHDCFLAGS += -DWL_CFG80211
-DHDCFLAGS += -DWL_CFG80211_STA_EVENT
-DHDCFLAGS += -DWL_ENABLE_P2P_IF
-DHDCFLAGS += -DDHD_USE_IDLECOUNT
-DHDCFLAGS += -DDHD_USE_EARLYSUSPEND
-DHDCFLAGS += -DSUPPORT_PM2_ONLY
-DHDCFLAGS += -DESCAN_RESULT_PATCH
-DHDCFLAGS += -DPASS_ARP_PACKET
-DHDCFLAGS += -DGET_CUSTOM_MAC_ENABLE
-DHDCFLAGS += -DSET_RANDOM_MAC_SOFTAP
-DHDCFLAGS += -DVSDB -DHT40_GO
-DHDCFLAGS += -DWL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST
-DHDCFLAGS += -DPROP_TXSTATUS
-DHDCFLAGS += -DPROP_TXSTATUS_VSDB
-DHDCFLAGS += -DROAM_ENABLE
-
-#DHDCFLAGS += -DCUSTOM_DPC_PRIO_SETTING=98
-DHDCFLAGS += -DCUSTOM_DPC_CPUCORE=0
-DHDCFLAGS += -DWIFI_TURNOFF_DELAY=100
-DHDCFLAGS += -DIOCTL_RESP_TIMEOUT=5000
-DHDCFLAGS += -DSDIO_CRC_ERROR_FIX
-DHDCFLAGS += -DCUSTOM_GLOM_SETTING=5 -DCUSTOM_RXCHAIN=1
-DHDCFLAGS += -DUSE_WL_FRAMEBURST
-DHDCFLAGS += -DBCMSDIOH_TXGLOM -DCUSTOM_TXGLOM=1 -DBCMSDIOH_TXGLOM_HIGHSPEED
-DHDCFLAGS += -DDHDTCPACK_SUPPRESS
-DHDCFLAGS += -DRXFRAME_THREAD
-DHDCFLAGS += -DCUSTOM_AMPDU_BA_WSIZE=40
-
-ifneq ($(CONFIG_DHD_USE_SCHED_SCAN),)
-DHDCFLAGS += -DWL_SCHED_SCAN
-endif
-
-ifeq ($(CONFIG_BCM4335_WIFI_CONTROL_FUNC),y)
-DHDCFLAGS += -DCONFIG_WIFI_CONTROL_FUNC
-else
-DHDCFLAGS += -DCUSTOM_OOB_GPIO_NUM=2
-endif
-
-ifeq ($(CONFIG_BCM4335_HW_OOB),y)
-DHDCFLAGS += -DHW_OOB -DOOB_INTR_ONLY
-else
-DHDCFLAGS += -DSDIO_ISR_THREAD
-endif
-
-DHDOFILES = aiutils.o bcmsdh_sdmmc_linux.o dhd_linux.o siutils.o bcmutils.o \
- dhd_linux_sched.o dhd_sdio.o bcmwifi_channels.o bcmevent.o hndpmu.o \
- bcmsdh.o dhd_cdc.o bcmsdh_linux.o dhd_common.o linux_osl.o \
- bcmsdh_sdmmc.o dhd_custom_gpio.o sbutils.o wldev_common.o wl_android.o \
- wl_cfg80211.o wl_cfgp2p.o wl_linux_mon.o dhd_cfg80211.o
-
-obj-$(CONFIG_BCM4335) += bcm4335.o
-bcm4335-objs += $(DHDOFILES)
-EXTRA_CFLAGS = $(DHDCFLAGS)
-ifeq ($(CONFIG_BCM4335),m)
-EXTRA_LDFLAGS += --strip-debug
-endif
+++ /dev/null
-/*
- * 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 368924 2012-11-15 08:12:59Z $
- */
-
-#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_BL_PID_43143 0xbd1e
-#define BCM_DNGL_BL_PID_43242 0xbd1f
-#define BCM_DNGL_BL_PID_43342 0xbd21
-#define BCM_DNGL_BL_PID_4335 0xbd20
-#define BCM_DNGL_BL_PID_4350 0xbd23
-#define BCM_DNGL_BL_PID_43341 0xbd22
-
-#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 BCM43143_D11N2G_ID 0x4366
-#define BCM4334_D11N_ID 0x4380
-#define BCM4334_D11N2G_ID 0x4381
-#define BCM4334_D11N5G_ID 0x4382
-#define BCM43342_D11N_ID 0x4383
-#define BCM43342_D11N2G_ID 0x4384
-#define BCM43342_D11N5G_ID 0x4385
-#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 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 BCM943228HMB_SSID_VEN1 0x0607
-#define BCM94313HMGBL_SSID_VEN1 0x0608
-#define BCM94313HMG_SSID_VEN1 0x0609
-#define BCM943142HM_SSID_VEN1 0x0611
-
-#define BCM43143_D11N2G_ID 0x4366
-
-#define BCM43242_D11N_ID 0x4367
-#define BCM43242_D11N2G_ID 0x4368
-#define BCM43242_D11N5G_ID 0x4369
-
-#define BCM4350_D11AC_ID 0x43a3
-#define BCM4350_D11AC2G_ID 0x43a4
-#define BCM4350_D11AC5G_ID 0x43a5
-
-
-#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_USB30H_ID 0x472a
-#define BCM47XX_USB30D_ID 0x472b
-#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 BCM43143_CHIP_ID 43143
-#define BCM4324_CHIP_ID 0x4324
-#define BCM43242_CHIP_ID 43242
-#define BCM43243_CHIP_ID 43243
-#define BCM4334_CHIP_ID 0x4334
-#define BCM4335_CHIP_ID 0x4335
-#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 BCM4350_CHIP_ID 0x4350
-
-#define BCM4342_CHIP_ID 4342
-#define BCM4402_CHIP_ID 0x4402
-#define BCM4704_CHIP_ID 0x4704
-#define BCM4706_CHIP_ID 0x5300
-#define BCM4707_CHIP_ID 53010
-#define BCM53018_CHIP_ID 53018
-#define BCM4707_CHIP(chipid) (((chipid) == BCM4707_CHIP_ID) || ((chipid) == BCM53018_CHIP_ID))
-#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 BCM4707_PKG_ID 1
-#define BCM4708_PKG_ID 2
-#define BCM4709_PKG_ID 0
-
-#define PCIXX21_FLASHMEDIA0_ID 0x8033
-#define PCIXX21_SDIOH0_ID 0x8034
-
-#define BCM4335_WLCSP_PKG_ID (0x0)
-#define BCM4335_FCBGA_PKG_ID (0x1)
-#define BCM4335_WLBGA_PKG_ID (0x2)
-#define BCM4335_FCBGAD_PKG_ID (0x3)
-#define BCM4335_PKG_MASK (0x3)
-
-
-#define BFL_BTC2WIRE 0x00000001
-#define BFL_BTCOEX 0x00000001
-#define BFL_PACTRL 0x00000002
-#define BFL_AIRLINEMODE 0x00000004
-#define BFL_ADCDIV 0x00000008
-#define BFL_DIS_256QAM 0x00000008
-#define BFL_ENETROBO 0x00000010
-#define BFL_NOPLLDOWN 0x00000020
-#define BFL_CCKHIPWR 0x00000040
-#define BFL_ENETADM 0x00000080
-#define BFL_ENETVLAN 0x00000100
-#define BFL_LTECOEX 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_RXCHAIN_OFF_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_GAINBOOSTA01 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_BT_SHARE_BM_BIT0 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_DYNAMIC_VMID 0x10000000
-
-#define BFL2_SDR_EN 0x20000000
-#define BFL2_DYNAMIC_VMID 0x10000000
-#define BFL2_BT_SHARE_BM_BIT1 0x40000000
-
-
-#define BFL_SROM11_BTCOEX 0x00000001
-#define BFL_SROM11_WLAN_BT_SH_XTL 0x00000002
-#define BFL_SROM11_EXTLNA 0x00001000
-#define BFL_SROM11_EXTLNA_5GHz 0x10000000
-#define BFL_SROM11_GAINBOOSTA01 0x20000000
-#define BFL2_SROM11_APLL_WAR 0x00000002
-#define BFL2_SROM11_ANAPACTRL_2G 0x00100000
-#define BFL2_SROM11_ANAPACTRL_5G 0x00200000
-
-
-#define BFL3_FEMCTRL_SUB 0x00000007
-#define BFL3_RCAL_WAR 0x00000008
-#define BFL3_TXGAINTBLID 0x00000070
-#define BFL3_TXGAINTBLID_SHIFT 0x4
-#define BFL3_TSSI_DIV_WAR 0x00000080
-#define BFL3_TSSI_DIV_WAR_SHIFT 0x7
-#define BFL3_FEMTBL_FROM_NVRAM 0x00000100
-#define BFL3_FEMTBL_FROM_NVRAM_SHIFT 0x8
-
-
-#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 BCM943342FCAGBI_SSID 0x0641
-
-
-#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 RDL_RAM_SIZE_4360 0xA0000
-#define RDL_RAM_BASE_4360 0x60000000
-#define RDL_RAM_SIZE_43242 0x90000
-#define RDL_RAM_BASE_43242 0x60000000
-#define RDL_RAM_SIZE_43143 0x70000
-#define RDL_RAM_BASE_43143 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
+++ /dev/null
-/*
- * Broadcom PCI-SPI Host Controller Register 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.
- *
- * $Id: bcmpcispi.h 241182 2011-02-17 21:50:03Z $
- */
-#ifndef _BCM_PCI_SPI_H
-#define _BCM_PCI_SPI_H
-
-/* cpp contortions to concatenate w/arg prescan */
-#ifndef PAD
-#define _PADLINE(line) pad ## line
-#define _XSTR(line) _PADLINE(line)
-#define PAD _XSTR(__LINE__)
-#endif /* PAD */
-
-
-typedef volatile struct {
- uint32 spih_ctrl; /* 0x00 SPI Control Register */
- uint32 spih_stat; /* 0x04 SPI Status Register */
- uint32 spih_data; /* 0x08 SPI Data Register, 32-bits wide */
- uint32 spih_ext; /* 0x0C SPI Extension Register */
- uint32 PAD[4]; /* 0x10-0x1F PADDING */
-
- uint32 spih_gpio_ctrl; /* 0x20 SPI GPIO Control Register */
- uint32 spih_gpio_data; /* 0x24 SPI GPIO Data Register */
- uint32 PAD[6]; /* 0x28-0x3F PADDING */
-
- uint32 spih_int_edge; /* 0x40 SPI Interrupt Edge Register (0=Level, 1=Edge) */
- uint32 spih_int_pol; /* 0x44 SPI Interrupt Polarity Register (0=Active Low, */
- /* 1=Active High) */
- uint32 spih_int_mask; /* 0x48 SPI Interrupt Mask */
- uint32 spih_int_status; /* 0x4C SPI Interrupt Status */
- uint32 PAD[4]; /* 0x50-0x5F PADDING */
-
- uint32 spih_hex_disp; /* 0x60 SPI 4-digit hex display value */
- uint32 spih_current_ma; /* 0x64 SPI SD card current consumption in mA */
- uint32 PAD[1]; /* 0x68 PADDING */
- uint32 spih_disp_sel; /* 0x6c SPI 4-digit hex display mode select (1=current) */
- uint32 PAD[4]; /* 0x70-0x7F PADDING */
- uint32 PAD[8]; /* 0x80-0x9F PADDING */
- uint32 PAD[8]; /* 0xA0-0xBF PADDING */
- uint32 spih_pll_ctrl; /* 0xC0 PLL Control Register */
- uint32 spih_pll_status; /* 0xC4 PLL Status Register */
- uint32 spih_xtal_freq; /* 0xC8 External Clock Frequency in units of 10000Hz */
- uint32 spih_clk_count; /* 0xCC External Clock Count Register */
-
-} spih_regs_t;
-
-typedef volatile struct {
- uint32 cfg_space[0x40]; /* 0x000-0x0FF PCI Configuration Space (Read Only) */
- uint32 P_IMG_CTRL0; /* 0x100 PCI Image0 Control Register */
-
- uint32 P_BA0; /* 0x104 32 R/W PCI Image0 Base Address register */
- uint32 P_AM0; /* 0x108 32 R/W PCI Image0 Address Mask register */
- uint32 P_TA0; /* 0x10C 32 R/W PCI Image0 Translation Address register */
- uint32 P_IMG_CTRL1; /* 0x110 32 R/W PCI Image1 Control register */
- uint32 P_BA1; /* 0x114 32 R/W PCI Image1 Base Address register */
- uint32 P_AM1; /* 0x118 32 R/W PCI Image1 Address Mask register */
- uint32 P_TA1; /* 0x11C 32 R/W PCI Image1 Translation Address register */
- uint32 P_IMG_CTRL2; /* 0x120 32 R/W PCI Image2 Control register */
- uint32 P_BA2; /* 0x124 32 R/W PCI Image2 Base Address register */
- uint32 P_AM2; /* 0x128 32 R/W PCI Image2 Address Mask register */
- uint32 P_TA2; /* 0x12C 32 R/W PCI Image2 Translation Address register */
- uint32 P_IMG_CTRL3; /* 0x130 32 R/W PCI Image3 Control register */
- uint32 P_BA3; /* 0x134 32 R/W PCI Image3 Base Address register */
- uint32 P_AM3; /* 0x138 32 R/W PCI Image3 Address Mask register */
- uint32 P_TA3; /* 0x13C 32 R/W PCI Image3 Translation Address register */
- uint32 P_IMG_CTRL4; /* 0x140 32 R/W PCI Image4 Control register */
- uint32 P_BA4; /* 0x144 32 R/W PCI Image4 Base Address register */
- uint32 P_AM4; /* 0x148 32 R/W PCI Image4 Address Mask register */
- uint32 P_TA4; /* 0x14C 32 R/W PCI Image4 Translation Address register */
- uint32 P_IMG_CTRL5; /* 0x150 32 R/W PCI Image5 Control register */
- uint32 P_BA5; /* 0x154 32 R/W PCI Image5 Base Address register */
- uint32 P_AM5; /* 0x158 32 R/W PCI Image5 Address Mask register */
- uint32 P_TA5; /* 0x15C 32 R/W PCI Image5 Translation Address register */
- uint32 P_ERR_CS; /* 0x160 32 R/W PCI Error Control and Status register */
- uint32 P_ERR_ADDR; /* 0x164 32 R PCI Erroneous Address register */
- uint32 P_ERR_DATA; /* 0x168 32 R PCI Erroneous Data register */
-
- uint32 PAD[5]; /* 0x16C-0x17F PADDING */
-
- uint32 WB_CONF_SPC_BAR; /* 0x180 32 R WISHBONE Configuration Space Base Address */
- uint32 W_IMG_CTRL1; /* 0x184 32 R/W WISHBONE Image1 Control register */
- uint32 W_BA1; /* 0x188 32 R/W WISHBONE Image1 Base Address register */
- uint32 W_AM1; /* 0x18C 32 R/W WISHBONE Image1 Address Mask register */
- uint32 W_TA1; /* 0x190 32 R/W WISHBONE Image1 Translation Address reg */
- uint32 W_IMG_CTRL2; /* 0x194 32 R/W WISHBONE Image2 Control register */
- uint32 W_BA2; /* 0x198 32 R/W WISHBONE Image2 Base Address register */
- uint32 W_AM2; /* 0x19C 32 R/W WISHBONE Image2 Address Mask register */
- uint32 W_TA2; /* 0x1A0 32 R/W WISHBONE Image2 Translation Address reg */
- uint32 W_IMG_CTRL3; /* 0x1A4 32 R/W WISHBONE Image3 Control register */
- uint32 W_BA3; /* 0x1A8 32 R/W WISHBONE Image3 Base Address register */
- uint32 W_AM3; /* 0x1AC 32 R/W WISHBONE Image3 Address Mask register */
- uint32 W_TA3; /* 0x1B0 32 R/W WISHBONE Image3 Translation Address reg */
- uint32 W_IMG_CTRL4; /* 0x1B4 32 R/W WISHBONE Image4 Control register */
- uint32 W_BA4; /* 0x1B8 32 R/W WISHBONE Image4 Base Address register */
- uint32 W_AM4; /* 0x1BC 32 R/W WISHBONE Image4 Address Mask register */
- uint32 W_TA4; /* 0x1C0 32 R/W WISHBONE Image4 Translation Address reg */
- uint32 W_IMG_CTRL5; /* 0x1C4 32 R/W WISHBONE Image5 Control register */
- uint32 W_BA5; /* 0x1C8 32 R/W WISHBONE Image5 Base Address register */
- uint32 W_AM5; /* 0x1CC 32 R/W WISHBONE Image5 Address Mask register */
- uint32 W_TA5; /* 0x1D0 32 R/W WISHBONE Image5 Translation Address reg */
- uint32 W_ERR_CS; /* 0x1D4 32 R/W WISHBONE Error Control and Status reg */
- uint32 W_ERR_ADDR; /* 0x1D8 32 R WISHBONE Erroneous Address register */
- uint32 W_ERR_DATA; /* 0x1DC 32 R WISHBONE Erroneous Data register */
- uint32 CNF_ADDR; /* 0x1E0 32 R/W Configuration Cycle register */
- uint32 CNF_DATA; /* 0x1E4 32 R/W Configuration Cycle Generation Data reg */
-
- uint32 INT_ACK; /* 0x1E8 32 R Interrupt Acknowledge register */
- uint32 ICR; /* 0x1EC 32 R/W Interrupt Control register */
- uint32 ISR; /* 0x1F0 32 R/W Interrupt Status register */
-} spih_pciregs_t;
-
-/*
- * PCI Core interrupt enable and status bit definitions.
- */
-
-/* PCI Core ICR Register bit definitions */
-#define PCI_INT_PROP_EN (1 << 0) /* Interrupt Propagation Enable */
-#define PCI_WB_ERR_INT_EN (1 << 1) /* Wishbone Error Interrupt Enable */
-#define PCI_PCI_ERR_INT_EN (1 << 2) /* PCI Error Interrupt Enable */
-#define PCI_PAR_ERR_INT_EN (1 << 3) /* Parity Error Interrupt Enable */
-#define PCI_SYS_ERR_INT_EN (1 << 4) /* System Error Interrupt Enable */
-#define PCI_SOFTWARE_RESET (1U << 31) /* Software reset of the PCI Core. */
-
-
-/* PCI Core ISR Register bit definitions */
-#define PCI_INT_PROP_ST (1 << 0) /* Interrupt Propagation Status */
-#define PCI_WB_ERR_INT_ST (1 << 1) /* Wishbone Error Interrupt Status */
-#define PCI_PCI_ERR_INT_ST (1 << 2) /* PCI Error Interrupt Status */
-#define PCI_PAR_ERR_INT_ST (1 << 3) /* Parity Error Interrupt Status */
-#define PCI_SYS_ERR_INT_ST (1 << 4) /* System Error Interrupt Status */
-
-
-/* Registers on the Wishbone bus */
-#define SPIH_CTLR_INTR (1 << 0) /* SPI Host Controller Core Interrupt */
-#define SPIH_DEV_INTR (1 << 1) /* SPI Device Interrupt */
-#define SPIH_WFIFO_INTR (1 << 2) /* SPI Tx FIFO Empty Intr (FPGA Rev >= 8) */
-
-/* GPIO Bit definitions */
-#define SPIH_CS (1 << 0) /* SPI Chip Select (active low) */
-#define SPIH_SLOT_POWER (1 << 1) /* SD Card Slot Power Enable */
-#define SPIH_CARD_DETECT (1 << 2) /* SD Card Detect */
-
-/* SPI Status Register Bit definitions */
-#define SPIH_STATE_MASK 0x30 /* SPI Transfer State Machine state mask */
-#define SPIH_STATE_SHIFT 4 /* SPI Transfer State Machine state shift */
-#define SPIH_WFFULL (1 << 3) /* SPI Write FIFO Full */
-#define SPIH_WFEMPTY (1 << 2) /* SPI Write FIFO Empty */
-#define SPIH_RFFULL (1 << 1) /* SPI Read FIFO Full */
-#define SPIH_RFEMPTY (1 << 0) /* SPI Read FIFO Empty */
-
-#define SPIH_EXT_CLK (1U << 31) /* Use External Clock as PLL Clock source. */
-
-#define SPIH_PLL_NO_CLK (1 << 1) /* Set to 1 if the PLL's input clock is lost. */
-#define SPIH_PLL_LOCKED (1 << 3) /* Set to 1 when the PLL is locked. */
-
-/* Spin bit loop bound check */
-#define SPI_SPIN_BOUND 0xf4240 /* 1 million */
-
-#endif /* _BCM_PCI_SPI_H */
+++ /dev/null
-/*
- * pcicfg.h: PCI configuration constants and structures.
- *
- * 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: pcicfg.h 346935 2012-07-25 00:24:55Z $
- */
-
-#ifndef _h_pcicfg_
-#define _h_pcicfg_
-
-
-#define PCI_CFG_VID 0
-#define PCI_CFG_DID 2
-#define PCI_CFG_CMD 4
-#define PCI_CFG_STAT 6
-#define PCI_CFG_REV 8
-#define PCI_CFG_PROGIF 9
-#define PCI_CFG_SUBCL 0xa
-#define PCI_CFG_BASECL 0xb
-#define PCI_CFG_CLSZ 0xc
-#define PCI_CFG_LATTIM 0xd
-#define PCI_CFG_HDR 0xe
-#define PCI_CFG_BIST 0xf
-#define PCI_CFG_BAR0 0x10
-#define PCI_CFG_BAR1 0x14
-#define PCI_CFG_BAR2 0x18
-#define PCI_CFG_BAR3 0x1c
-#define PCI_CFG_BAR4 0x20
-#define PCI_CFG_BAR5 0x24
-#define PCI_CFG_CIS 0x28
-#define PCI_CFG_SVID 0x2c
-#define PCI_CFG_SSID 0x2e
-#define PCI_CFG_ROMBAR 0x30
-#define PCI_CFG_CAPPTR 0x34
-#define PCI_CFG_INT 0x3c
-#define PCI_CFG_PIN 0x3d
-#define PCI_CFG_MINGNT 0x3e
-#define PCI_CFG_MAXLAT 0x3f
-#define PCI_CFG_DEVCTRL 0xd8
-#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 PCIE2_BAR0_WIN2 0x70
-#define PCIE2_BAR0_CORE2_WIN 0x74
-#define PCIE2_BAR0_CORE2_WIN2 0x78
-
-#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_CONFIG_SPACE_SIZE 256
-#endif
+++ /dev/null
-/*
- * 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 368403 2012-11-13 17:20:09Z $
- */
-
-#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_wide_bw_channel_switch {
- uint8 id;
- uint8 len;
- uint8 channel_width;
- uint8 center_frequency_segment_0;
- uint8 center_frequency_segment_1;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_wide_bw_channel_switch dot11_wide_bw_chan_switch_ie_t;
-
-#define DOT11_WIDE_BW_SWITCH_IE_LEN 3
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_channel_switch_wrapper {
- uint8 id;
- uint8 len;
- dot11_wide_bw_chan_switch_ie_t wb_chan_switch_ie;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_channel_switch_wrapper dot11_chan_switch_wrapper_ie_t;
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_vht_transmit_power_envelope {
- uint8 id;
- uint8 len;
- uint8 transmit_power_info;
- uint8 local_max_transmit_power_20;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_vht_transmit_power_envelope dot11_vht_transmit_power_envelope_ie_t;
-
-
-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_STAT 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_TYPE 2
-#define WME_OUI_LEN 3
-#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_RCPI_ID 53
-#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_BSS_AVR_ACCESS_DELAY_ID 63
-#define DOT11_MNG_ANTENNA_ID 64
-#define DOT11_MNG_RSNI_ID 65
-#define DOT11_MNG_MEASUREMENT_PILOT_TX_ID 66
-#define DOT11_MNG_BSS_AVAL_ADMISSION_CAP_ID 67
-#define DOT11_MNG_BSS_AC_ACCESS_DELAY_ID 68
-#define DOT11_MNG_WAPI_ID 68
-#define DOT11_MNG_TIME_ADVERTISE_ID 69
-#define DOT11_MNG_RRM_CAP_ID 70
-#define DOT11_MNG_MULTIPLE_BSSID_ID 71
-#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_MMIE_ID 76
-#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_WIDE_BW_CHANNEL_SWITCH_ID 194
-#define DOT11_MNG_VHT_TRANSMIT_POWER_ENVELOPE_ID 195
-#define DOT11_MNG_CHANNEL_SWITCH_WRAPPER_ID 196
-
-
-#define DOT11_MNG_WPA_ID 221
-#define DOT11_MNG_PROPR_ID 221
-
-#define DOT11_MNG_VS_ID 221
-
-
-
-
-
-#define DOT11_RATE_1M 2
-#define DOT11_RATE_2M 4
-#define DOT11_RATE_5M5 11
-#define DOT11_RATE_11M 22
-#define DOT11_RATE_6M 12
-#define DOT11_RATE_9M 18
-#define DOT11_RATE_12M 24
-#define DOT11_RATE_18M 36
-#define DOT11_RATE_24M 48
-#define DOT11_RATE_36M 72
-#define DOT11_RATE_48M 96
-#define DOT11_RATE_54M 108
-#define DOT11_RATE_MAX 108
-
-
-#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_PROXY_ARP 12
-
-#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_WNM 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
-#define RCPI_IE_LEN 1
-#define RSNI_IE_LEN 1
-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;
- uint8 data[1];
-} 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
-
-
-#define DOT11_RMREP_FRAME_COUNT_REPORT 1
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_rmreq_chanload {
- uint8 id;
- uint8 len;
- uint8 token;
- uint8 mode;
- uint8 type;
- uint8 reg;
- uint8 channel;
- uint16 interval;
- uint16 duration;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_rmreq_chanload dot11_rmreq_chanload_t;
-#define DOT11_RMREQ_CHANLOAD_LEN 11
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_rmrep_chanload {
- uint8 reg;
- uint8 channel;
- uint32 starttime[2];
- uint16 duration;
- uint8 channel_load;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_rmrep_chanload dot11_rmrep_chanload_t;
-#define DOT11_RMREP_CHANLOAD_LEN 13
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_rmreq_noise {
- uint8 id;
- uint8 len;
- uint8 token;
- uint8 mode;
- uint8 type;
- uint8 reg;
- uint8 channel;
- uint16 interval;
- uint16 duration;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_rmreq_noise dot11_rmreq_noise_t;
-#define DOT11_RMREQ_NOISE_LEN 11
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_rmrep_noise {
- uint8 reg;
- uint8 channel;
- uint32 starttime[2];
- uint16 duration;
- uint8 antid;
- uint8 anpi;
- uint8 ipi0_dens;
- uint8 ipi1_dens;
- uint8 ipi2_dens;
- uint8 ipi3_dens;
- uint8 ipi4_dens;
- uint8 ipi5_dens;
- uint8 ipi6_dens;
- uint8 ipi7_dens;
- uint8 ipi8_dens;
- uint8 ipi9_dens;
- uint8 ipi10_dens;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_rmrep_noise dot11_rmrep_noise_t;
-#define DOT11_RMREP_NOISE_LEN 25
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_rmreq_frame {
- uint8 id;
- uint8 len;
- uint8 token;
- uint8 mode;
- uint8 type;
- uint8 reg;
- uint8 channel;
- uint16 interval;
- uint16 duration;
- uint8 req_type;
- struct ether_addr ta;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_rmreq_frame dot11_rmreq_frame_t;
-#define DOT11_RMREQ_FRAME_LEN 18
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_rmrep_frame {
- uint8 reg;
- uint8 channel;
- uint32 starttime[2];
- uint16 duration;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_rmrep_frame dot11_rmrep_frame_t;
-#define DOT11_RMREP_FRAME_LEN 12
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_rmrep_frmentry {
- struct ether_addr ta;
- struct ether_addr bssid;
- uint8 phy_type;
- uint8 avg_rcpi;
- uint8 last_rsni;
- uint8 last_rcpi;
- uint8 ant_id;
- uint16 frame_cnt;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_rmrep_frmentry dot11_rmrep_frmentry_t;
-#define DOT11_RMREP_FRMENTRY_LEN 19
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_rmreq_stat {
- uint8 id;
- uint8 len;
- uint8 token;
- uint8 mode;
- uint8 type;
- struct ether_addr peer;
- uint16 interval;
- uint16 duration;
- uint8 group_id;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_rmreq_stat dot11_rmreq_stat_t;
-#define DOT11_RMREQ_STAT_LEN 16
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_rmrep_stat {
- uint16 duration;
- uint8 group_id;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_rmrep_stat dot11_rmrep_stat_t;
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_rmreq_tx_stream {
- uint8 id;
- uint8 len;
- uint8 token;
- uint8 mode;
- uint8 type;
- uint16 interval;
- uint16 duration;
- struct ether_addr peer;
- uint8 traffic_id;
- uint8 bin0_range;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_rmreq_tx_stream dot11_rmreq_tx_stream_t;
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_rmrep_tx_stream {
- uint32 starttime[2];
- uint16 duration;
- struct ether_addr peer;
- uint8 traffic_id;
- uint8 reason;
- uint32 txmsdu_cnt;
- uint32 msdu_discarded_cnt;
- uint32 msdufailed_cnt;
- uint32 msduretry_cnt;
- uint32 cfpolls_lost_cnt;
- uint32 avrqueue_delay;
- uint32 avrtx_delay;
- uint8 bin0_range;
- uint32 bin0;
- uint32 bin1;
- uint32 bin2;
- uint32 bin3;
- uint32 bin4;
- uint32 bin5;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_rmrep_tx_stream dot11_rmrep_tx_stream_t;
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_rmreq_pause_time {
- uint8 id;
- uint8 len;
- uint8 token;
- uint8 mode;
- uint8 type;
- uint16 pause_time;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_rmreq_pause_time dot11_rmreq_pause_time_t;
-
-
-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
-
-
-BWL_PRE_PACKED_STRUCT struct dot11_rrmrep_nbr {
- uint8 id;
- uint8 len;
- dot11_rmrep_nbr_t nbr_rrmrep;
-} BWL_POST_PACKED_STRUCT;
-typedef struct dot11_rrmrep_nbr dot11_rrmrep_nbr_t;
-#define DOT11_RRMREP_NBR_LEN 15
-
-
-#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 HT_T_LEG_PREAMBLE 16
-#define HT_T_L_SIG 4
-#define HT_T_SIG 8
-#define HT_T_LTF1 4
-#define HT_T_GF_LTF1 8
-#define HT_T_LTFs 4
-#define HT_T_STF 4
-#define HT_T_GF_STF 8
-#define HT_T_SYML 4
-
-#define HT_N_SERVICE 16
-#define HT_N_TAIL 6
-
-
-#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_BW_MASK 0x000003
-#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_MASK 0x0003f0
-#define VHT_SIGA1_GID_SHIFT 4
-#define VHT_SIGA1_GID_TO_AP 0x00
-#define VHT_SIGA1_GID_NOT_TO_AP 0x3f
-#define VHT_SIGA1_GID_MAX_GID 0x3f
-
-#define VHT_SIGA1_NSTS_SHIFT_MASK_USER0 0x001C00
-#define VHT_SIGA1_NSTS_SHIFT 10
-
-#define VHT_SIGA1_PARTIAL_AID_MASK 0x3fe000
-#define VHT_SIGA1_PARTIAL_AID_SHIFT 13
-
-#define VHT_SIGA1_TXOP_PS_NOT_ALLOWED 0x400000
-
-
-#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_LDPC_EXTRA_OFDM_SYM 0x000008
-#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_T_LEG_PREAMBLE 16
-#define VHT_T_L_SIG 4
-#define VHT_T_SIG_A 8
-#define VHT_T_LTF 4
-#define VHT_T_STF 4
-#define VHT_T_SIG_B 4
-#define VHT_T_SYML 4
-
-#define VHT_N_SERVICE 16
-#define VHT_N_TAIL 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_SYSCAP_WET_TUNNEL 0x0100
-
-
-#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
-#define BRF1_DWDS 0x80
-
-
-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_S 2
-#define VHT_CAP_MCS_MAP_M 0x3
-
-#define VHT_CAP_MCS_MAP_NONE_ALL 0xffff
-
-#define VHT_CAP_MCS_MAP_0_9_NSS3 \
- ((VHT_CAP_MCS_MAP_0_9 << VHT_MCS_MAP_GET_SS_IDX(1)) | \
- (VHT_CAP_MCS_MAP_0_9 << VHT_MCS_MAP_GET_SS_IDX(2)) | \
- (VHT_CAP_MCS_MAP_0_9 << VHT_MCS_MAP_GET_SS_IDX(3)))
-
-#define VHT_CAP_MCS_MAP_NSS_MAX 8
-
-
-#define VHT_CAP_MCS_MAP_CREATE(mcsmap, nss, mcs) \
- do { \
- int i; \
- for (i = 1; i <= nss; i++) { \
- VHT_MCS_MAP_SET_MCS_PER_SS(i, mcs, mcsmap); \
- } \
- } while (0)
-
-
-#define VHT_MCS_CODE_TO_MCS_MAP(mcs_code) \
- ((mcs_code == VHT_CAP_MCS_MAP_0_7) ? 0xff : \
- (mcs_code == VHT_CAP_MCS_MAP_0_8) ? 0x1ff : \
- (mcs_code == VHT_CAP_MCS_MAP_0_9) ? 0x3ff : 0)
-
-
-#define VHT_MCS_MAP_TO_MCS_CODE(mcs_map) \
- ((mcs_map == 0xff) ? VHT_CAP_MCS_MAP_0_7 : \
- (mcs_map == 0x1ff) ? VHT_CAP_MCS_MAP_0_8 : \
- (mcs_map == 0x3ff) ? VHT_CAP_MCS_MAP_0_9 : VHT_CAP_MCS_MAP_NONE)
-
-
-typedef enum vht_cap_chan_width {
- VHT_CAP_CHAN_WIDTH_SUPPORT_MANDATORY = 0x00,
- VHT_CAP_CHAN_WIDTH_SUPPORT_160 = 0x04,
- VHT_CAP_CHAN_WIDTH_SUPPORT_160_8080 = 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;
-
-
-#define VHT_MPDU_LIMIT_4K 3895
-#define VHT_MPDU_LIMIT_8K 7991
-#define VHT_MPDU_LIMIT_11K 11454
-
-
-
-
-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 BRCM_VHT_FEATURES_OUITYPE 0x4
-BWL_PRE_PACKED_STRUCT struct vht_features_ie_hdr {
- uint8 oui[3];
- uint8 type;
- uint8 rate_mask;
-} BWL_POST_PACKED_STRUCT;
-typedef struct vht_features_ie_hdr vht_features_ie_hdr_t;
-
-
-#define VHT_MCS_MAP_GET_SS_IDX(nss) (((nss)-1) * VHT_CAP_MCS_MAP_S)
-#define VHT_MCS_MAP_GET_MCS_PER_SS(nss, mcsMap) \
- (((mcsMap) >> VHT_MCS_MAP_GET_SS_IDX(nss)) & VHT_CAP_MCS_MAP_M)
-#define VHT_MCS_MAP_SET_MCS_PER_SS(nss, numMcs, mcsMap) \
- do { \
- (mcsMap) &= (~(VHT_CAP_MCS_MAP_M << VHT_MCS_MAP_GET_SS_IDX(nss))); \
- (mcsMap) |= (((numMcs) & VHT_CAP_MCS_MAP_M) << VHT_MCS_MAP_GET_SS_IDX(nss)); \
- } while (0)
-#define VHT_MCS_SS_SUPPORTED(nss, mcsMap) \
- (VHT_MCS_MAP_GET_MCS_PER_SS((nss), (mcsMap)) != VHT_CAP_MCS_MAP_NONE)
-
-
-
-#define WPA_OUI "\x00\x50\xF2"
-#define WPA_OUI_TYPE 1
-#define WPA_OUI_LEN 3
-#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_TPQ 4
-#define WFA_OUI_TYPE_TPS 5
-#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 BIP_MIC_SIZE 8
-
-
-#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;
-
-
-BWL_PRE_PACKED_STRUCT struct mmic_ie {
- uint8 id;
- uint8 len;
- uint16 key_id;
- uint8 ipn[6];
- uint8 mic[BIP_MIC_SIZE];
-} BWL_POST_PACKED_STRUCT;
-typedef struct mmic_ie mmic_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
+++ /dev/null
-/*
- * 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 369617 2012-11-19 16:45:34Z $
- *
- */
-
-
-
-#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_NATIVE 94
-#define WLC_E_PKTDELAY_IND 95
-#define WLC_E_AWDL_AW 96
-#define WLC_E_AWDL_ROLE 97
-#define WLC_E_AWDL_EVENT 98
-#ifdef WLNIC
-#define WLC_E_NIC_AF_TXS 99
-#define WLC_E_NIC_NIC_REPORT 100
-#endif
-#define WLC_E_BEACON_FRAME_RX 101
-#define WLC_E_SERVICE_FOUND 102
-#define WLC_E_GAS_FRAGMENT_RX 103
-#define WLC_E_GAS_COMPLETE 104
-#define WLC_E_P2PO_ADD_DEVICE 105
-#define WLC_E_P2PO_DEL_DEVICE 106
-#define WLC_E_IBSS_COALESCE 107
-#define WLC_E_LAST 108
-
-
-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_IF_FLAGS_BSSCFG_NOIF 0x1
-
-#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
-
-
-typedef BWL_PRE_PACKED_STRUCT struct wl_event_gas {
- uint16 channel;
- uint8 dialog_token;
- uint8 fragment_id;
- uint16 status_code;
- uint16 data_len;
- uint8 data[1];
-} BWL_POST_PACKED_STRUCT wl_event_gas_t;
-
-
-typedef BWL_PRE_PACKED_STRUCT struct wl_event_sd {
- uint8 protocol;
- uint16 channel;
- uint8 dialog_token;
- uint8 fragment_id;
- uint16 status_code;
- uint16 data_len;
- uint8 data[1];
-} BWL_POST_PACKED_STRUCT wl_event_sd_t;
-
-
-#include <packed_section_end.h>
-
-#endif
+++ /dev/null
-/*
- * 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 356416 2012-09-12 16:40:42Z $
- */
-
-#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
+++ /dev/null
-/*
- * Broadcom SiliconBackplane hardware register 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.
- *
- * $Id: sbconfig.h 241182 2011-02-17 21:50:03Z $
- */
-
-#ifndef _SBCONFIG_H
-#define _SBCONFIG_H
-
-
-#ifndef PAD
-#define _PADLINE(line) pad ## line
-#define _XSTR(line) _PADLINE(line)
-#define PAD _XSTR(__LINE__)
-#endif
-
-
-#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 SBCONFIGOFF 0xf00
-#define SBCONFIGSIZE 256
-
-#define SBIPSFLAG 0x08
-#define SBTPSFLAG 0x18
-#define SBTMERRLOGA 0x48
-#define SBTMERRLOG 0x50
-#define SBADMATCH3 0x60
-#define SBADMATCH2 0x68
-#define SBADMATCH1 0x70
-#define SBIMSTATE 0x90
-#define SBINTVEC 0x94
-#define SBTMSTATELOW 0x98
-#define SBTMSTATEHIGH 0x9c
-#define SBBWA0 0xa0
-#define SBIMCONFIGLOW 0xa8
-#define SBIMCONFIGHIGH 0xac
-#define SBADMATCH0 0xb0
-#define SBTMCONFIGLOW 0xb8
-#define SBTMCONFIGHIGH 0xbc
-#define SBBCONFIG 0xc0
-#define SBBSTATE 0xc8
-#define SBACTCNFG 0xd8
-#define SBFLAGST 0xe8
-#define SBIDLOW 0xf8
-#define SBIDHIGH 0xfc
-
-
-
-#define SBIMERRLOGA 0xea8
-#define SBIMERRLOG 0xeb0
-#define SBTMPORTCONNID0 0xed8
-#define SBTMPORTLOCK0 0xef8
-
-#ifndef _LANGUAGE_ASSEMBLY
-
-typedef volatile struct _sbconfig {
- uint32 PAD[2];
- uint32 sbipsflag;
- uint32 PAD[3];
- uint32 sbtpsflag;
- uint32 PAD[11];
- uint32 sbtmerrloga;
- uint32 PAD;
- uint32 sbtmerrlog;
- uint32 PAD[3];
- uint32 sbadmatch3;
- uint32 PAD;
- uint32 sbadmatch2;
- uint32 PAD;
- uint32 sbadmatch1;
- uint32 PAD[7];
- uint32 sbimstate;
- uint32 sbintvec;
- uint32 sbtmstatelow;
- uint32 sbtmstatehigh;
- uint32 sbbwa0;
- uint32 PAD;
- uint32 sbimconfiglow;
- uint32 sbimconfighigh;
- uint32 sbadmatch0;
- uint32 PAD;
- uint32 sbtmconfiglow;
- uint32 sbtmconfighigh;
- uint32 sbbconfig;
- uint32 PAD;
- uint32 sbbstate;
- uint32 PAD[3];
- uint32 sbactcnfg;
- uint32 PAD[3];
- uint32 sbflagst;
- uint32 PAD[3];
- uint32 sbidlow;
- uint32 sbidhigh;
-} sbconfig_t;
-
-#endif
-
-
-#define SBIPS_INT1_MASK 0x3f
-#define SBIPS_INT1_SHIFT 0
-#define SBIPS_INT2_MASK 0x3f00
-#define SBIPS_INT2_SHIFT 8
-#define SBIPS_INT3_MASK 0x3f0000
-#define SBIPS_INT3_SHIFT 16
-#define SBIPS_INT4_MASK 0x3f000000
-#define SBIPS_INT4_SHIFT 24
-
-
-#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 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_SICF_SHIFT 16
-
-
-#define SBTMH_SERR 0x0001
-#define SBTMH_INT 0x0002
-#define SBTMH_BUSY 0x0004
-#define SBTMH_TO 0x0020
-
-#define SBTMH_SISF_SHIFT 16
-
-
-#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_RTO_SHIFT 4
-#define SBIMCL_CID_MASK 0xff0000
-#define SBIMCL_CID_SHIFT 16
-
-
-#define SBIMCH_IEM_MASK 0xc
-#define SBIMCH_TEM_MASK 0x30
-#define SBIMCH_TEM_SHIFT 4
-#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_ADINT0_SHIFT 3
-#define SBAM_ADINT1_MASK 0x1f8
-#define SBAM_ADINT1_SHIFT 3
-#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_BASE0_SHIFT 8
-#define SBAM_BASE1_MASK 0xfffff000
-#define SBAM_BASE1_SHIFT 12
-#define SBAM_BASE2_MASK 0xffff0000
-#define SBAM_BASE2_SHIFT 16
-
-
-#define SBTMCL_CD_MASK 0xff
-#define SBTMCL_CO_MASK 0xf800
-#define SBTMCL_CO_SHIFT 11
-#define SBTMCL_IF_MASK 0xfc0000
-#define SBTMCL_IF_SHIFT 18
-#define SBTMCL_IM_MASK 0x3000000
-#define SBTMCL_IM_SHIFT 24
-
-
-#define SBTMCH_BM_MASK 0x3
-#define SBTMCH_RM_MASK 0x3
-#define SBTMCH_RM_SHIFT 2
-#define SBTMCH_SM_MASK 0x30
-#define SBTMCH_SM_SHIFT 4
-#define SBTMCH_EM_MASK 0x300
-#define SBTMCH_EM_SHIFT 8
-#define SBTMCH_IM_MASK 0xc00
-#define SBTMCH_IM_SHIFT 10
-
-
-#define SBBC_LAT_MASK 0x3
-#define SBBC_MAX0_MASK 0xf0000
-#define SBBC_MAX0_SHIFT 16
-#define SBBC_MAX1_MASK 0xf00000
-#define SBBC_MAX1_SHIFT 20
-
-
-#define SBBS_SRD 0x1
-#define SBBS_HRD 0x2
-
-
-#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_MINLAT_SHIFT 8
-#define SBIDL_MAXLAT 0xf000
-#define SBIDL_MAXLAT_SHIFT 12
-#define SBIDL_FIRST 0x10000
-#define SBIDL_CW_MASK 0xc0000
-#define SBIDL_CW_SHIFT 18
-#define SBIDL_TP_MASK 0xf00000
-#define SBIDL_TP_SHIFT 20
-#define SBIDL_IP_MASK 0xf000000
-#define SBIDL_IP_SHIFT 24
-#define SBIDL_RV_MASK 0xf0000000
-#define SBIDL_RV_SHIFT 28
-#define SBIDL_RV_2_2 0x00000000
-#define SBIDL_RV_2_3 0x10000000
-
-
-#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_SHIFT 4
-#define SBIDH_VC_MASK 0xffff0000
-#define SBIDH_VC_SHIFT 16
-
-#define SB_COMMIT 0xfd8
-
-
-#define SB_VEND_BCM 0x4243
-
-#endif
+++ /dev/null
-/*
- * 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 348178 2012-07-31 22:27:41Z $
- */
-
-#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 D64RINGBOUNDARY (1 << D64RINGALIGN_BITS)
-
-#define D64MAXDD (D64MAXRINGSZ / sizeof (dma64dd_t))
-
-
-#define D64MAXDD_LARGE ((1 << 16) / sizeof (dma64dd_t))
-
-
-#define D64RINGBOUNDARY_LARGE (1 << 16)
-
-
-#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 (di->d64_xs0_cd_mask)
-#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 (di->d64_xs1_ad_mask)
-#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 (di->d64_rs0_cd_mask)
-#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
+++ /dev/null
-/*
- * 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
- * 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_android.c 369572 2012-11-19 12:57:59Z $
- */
-
-#include <linux/module.h>
-#include <linux/netdevice.h>
-
-#include <wl_android.h>
-#include <wldev_common.h>
-#include <wlioctl.h>
-#include <bcmutils.h>
-#include <linux_osl.h>
-#include <dhd_dbg.h>
-#include <dngl_stats.h>
-#include <dhd.h>
-#include <bcmsdbus.h>
-#ifdef WL_CFG80211
-#include <wl_cfg80211.h>
-#endif
-#if defined(CONFIG_WIFI_CONTROL_FUNC)
-#include <linux/platform_device.h>
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
-#include <linux/wlan_plat.h>
-#else
-#include <linux/wifi_tiwlan.h>
-#endif
-#endif /* CONFIG_WIFI_CONTROL_FUNC */
-
-/*
- * Android private command strings, PLEASE define new private commands here
- * so they can be updated easily in the future (if needed)
- */
-
-#define CMD_START "START"
-#define CMD_STOP "STOP"
-#define CMD_SCAN_ACTIVE "SCAN-ACTIVE"
-#define CMD_SCAN_PASSIVE "SCAN-PASSIVE"
-#define CMD_RSSI "RSSI"
-#define CMD_LINKSPEED "LINKSPEED"
-#define CMD_RXFILTER_START "RXFILTER-START"
-#define CMD_RXFILTER_STOP "RXFILTER-STOP"
-#define CMD_RXFILTER_ADD "RXFILTER-ADD"
-#define CMD_RXFILTER_REMOVE "RXFILTER-REMOVE"
-#define CMD_BTCOEXSCAN_START "BTCOEXSCAN-START"
-#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_SD_OFFLOAD "P2P_SD_"
-#define CMD_P2P_SET_PS "P2P_SET_PS"
-#define CMD_SET_AP_WPS_P2P_IE "SET_AP_WPS_P2P_IE"
-#define CMD_SETROAMMODE "SETROAMMODE"
-
-#ifdef CUSTOMER_HW4
-#ifdef SUPPORT_AUTO_CHANNEL
-#define CMD_SET_HAPD_AUTO_CHANNEL "HAPD_AUTO_CHANNEL"
-#endif /* SUPPORT_AUTO_CHANNEL */
-#ifdef SUPPORT_HIDDEN_AP
-/* Hostapd private command */
-#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 /* SUPPORT_HIDDEN_AP */
-#ifdef SUPPORT_SOFTAP_SINGL_DISASSOC
-#define CMD_HAPD_STA_DISASSOC "HAPD_STA_DISASSOC"
-#endif /* SUPPORT_SOFTAP_SINGL_DISASSOC */
-#endif /* CUSTOMER_HW4 */
-
-/* CCX Private Commands */
-#ifdef BCMCCX
-#define CMD_GETCCKM_RN "get cckm_rn"
-#define CMD_SETCCKM_KRK "set cckm_krk"
-#define CMD_GET_ASSOC_RES_IES "get assoc_res_ies"
-#endif
-
-#ifdef PNO_SUPPORT
-#define CMD_PNOSSIDCLR_SET "PNOSSIDCLR"
-#define CMD_PNOSETUP_SET "PNOSETUP "
-#define CMD_PNOENABLE_SET "PNOFORCE"
-#define CMD_PNODEBUG_SET "PNODEBUG"
-
-#define PNO_TLV_PREFIX 'S'
-#define PNO_TLV_VERSION '1'
-#define PNO_TLV_SUBVERSION '2'
-#define PNO_TLV_RESERVED '0'
-#define PNO_TLV_TYPE_SSID_IE 'S'
-#define PNO_TLV_TYPE_TIME 'T'
-#define PNO_TLV_FREQ_REPEAT 'R'
-#define PNO_TLV_FREQ_EXPO_MAX 'M'
-
-typedef struct cmd_tlv {
- char prefix;
- char version;
- char subver;
- char reserved;
-} cmd_tlv_t;
-#endif /* PNO_SUPPORT */
-
-#define CMD_OKC_SET_PMK "SET_PMK"
-#define CMD_OKC_ENABLE "OKC_ENABLE"
-
-
-#ifdef CUSTOMER_HW4
-
-#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 */
-
-#ifdef 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"
-
-#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 */
-
-#define CMD_CHANGE_RL "CHANGE_RL"
-#define CMD_RESTORE_RL "RESTORE_RL"
-#endif /* CUSTOMER_HW4 */
-typedef struct android_wifi_priv_cmd {
- char *buf;
- int used_len;
- int total_len;
-} android_wifi_priv_cmd;
-
-#ifdef WL_GENL
-static s32 wl_genl_handle_msg(struct sk_buff *skb, struct genl_info *info);
-static int wl_genl_init(void);
-static int wl_genl_deinit(void);
-
-extern struct net init_net;
-/* attribute policy: defines which attribute has which type (e.g int, char * etc)
- * possible values defined in net/netlink.h
- */
-static struct nla_policy wl_genl_policy[BCM_GENL_ATTR_MAX + 1] = {
- [BCM_GENL_ATTR_STRING] = { .type = NLA_NUL_STRING },
- [BCM_GENL_ATTR_MSG] = { .type = NLA_BINARY },
-};
-
-#define WL_GENL_VER 1
-/* family definition */
-static struct genl_family wl_genl_family = {
- .id = GENL_ID_GENERATE, /* Genetlink would generate the ID */
- .hdrsize = 0,
- .name = "bcm-genl", /* Netlink I/F for Android */
- .version = WL_GENL_VER, /* Version Number */
- .maxattr = BCM_GENL_ATTR_MAX,
-};
-
-/* commands: mapping between the command enumeration and the actual function */
-struct genl_ops wl_genl_ops = {
- .cmd = BCM_GENL_CMD_MSG,
- .flags = 0,
- .policy = wl_genl_policy,
- .doit = wl_genl_handle_msg,
- .dumpit = NULL,
-};
-
-static struct genl_multicast_group wl_genl_mcast = {
- .id = GENL_ID_GENERATE, /* Genetlink would generate the ID */
- .name = "bcm-genl-mcast",
-};
-
-#endif /* WL_GENL */
-
-/**
- * Extern function declarations (TODO: move them to dhd_linux.h)
- */
-void dhd_customer_gpio_wlan_ctrl(int onoff);
-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; }
-int wl_cfg80211_set_p2p_noa(struct net_device *net, char* buf, int len)
-{ return 0; }
-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 /* WK_CFG80211 */
-extern int dhd_os_check_if_up(void *dhdp);
-extern void *bcmsdh_get_drvdata(void);
-#if defined(PROP_TXSTATUS) && !defined(PROP_TXSTATUS_VSDB)
-extern int dhd_wlfc_init(dhd_pub_t *dhd);
-extern void dhd_wlfc_deinit(dhd_pub_t *dhd);
-#endif
-
-#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_HW4)
-extern char iface_name[IFNAMSIZ];
-#endif /* CUSTOMER_HW2 || CUSTOMER_HW4 */
-
-#ifndef WIFI_TURNOFF_DELAY
-#define WIFI_TURNOFF_DELAY 0
-#endif
-/**
- * Local (static) functions and variables
- */
-
-/* Initialize g_wifi_on to 1 so dhd_bus_start will be called for the first
- * time (only) in dhd_open, subsequential wifi on will be handled by
- * wl_android_wifi_on
- */
-static int g_wifi_on = TRUE;
-
-/**
- * Local (static) function definitions
- */
-static int wl_android_get_link_speed(struct net_device *net, char *command, int total_len)
-{
- int link_speed;
- int bytes_written;
- int error;
-
- error = wldev_get_link_speed(net, &link_speed);
- if (error)
- return -1;
-
- /* Convert Kbps to Android Mbps */
- link_speed = link_speed / 1000;
- bytes_written = snprintf(command, total_len, "LinkSpeed %d", link_speed);
- DHD_INFO(("%s: command result is %s\n", __FUNCTION__, command));
- return bytes_written;
-}
-
-static int wl_android_get_rssi(struct net_device *net, char *command, int total_len)
-{
- wlc_ssid_t ssid = {0};
- int rssi;
- int bytes_written = 0;
- int error;
-
- error = wldev_get_rssi(net, &rssi);
- if (error)
- return -1;
-
- error = wldev_get_ssid(net, &ssid);
- if (error)
- return -1;
- if ((ssid.SSID_len == 0) || (ssid.SSID_len > DOT11_MAX_SSID_LEN)) {
- DHD_ERROR(("%s: wldev_get_ssid failed\n", __FUNCTION__));
- } else {
- memcpy(command, ssid.SSID, ssid.SSID_len);
- bytes_written = ssid.SSID_len;
- }
- bytes_written += snprintf(&command[bytes_written], total_len, " rssi %d", rssi);
- DHD_INFO(("%s: command result is %s (%d)\n", __FUNCTION__, command, bytes_written));
- return bytes_written;
-}
-
-static int wl_android_set_suspendopt(struct net_device *dev, char *command, int total_len)
-{
- int suspend_flag;
- int ret_now;
- int ret = 0;
-
-#ifdef CUSTOMER_HW4
- if (!dhd_download_fw_on_driverload) {
-#endif /* CUSTOMER_HW4 */
- suspend_flag = *(command + strlen(CMD_SETSUSPENDOPT) + 1) - '0';
-
- if (suspend_flag != 0)
- suspend_flag = 1;
- ret_now = net_os_set_suspend_disable(dev, suspend_flag);
-
- if (ret_now != suspend_flag) {
- 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_HW4
- }
-#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;
-}
-
-static int wl_android_get_band(struct net_device *dev, char *command, int total_len)
-{
- uint band;
- int bytes_written;
- int error;
-
- error = wldev_get_band(dev, &band);
- if (error)
- return -1;
- bytes_written = snprintf(command, total_len, "Band %d", band);
- return bytes_written;
-}
-
-#ifdef CUSTOMER_HW4
-#ifdef ROAM_API
-int wl_android_set_roam_trigger(
- struct net_device *dev, char* command, int total_len)
-{
- int roam_trigger[2];
-
- sscanf(command, "%*s %10d", &roam_trigger[0]);
- roam_trigger[1] = WLC_BAND_ALL;
-
- return wldev_ioctl(dev, WLC_SET_ROAM_TRIGGER, roam_trigger,
- sizeof(roam_trigger), 1);
-}
-
-static int wl_android_get_roam_trigger(
- struct net_device *dev, char *command, int total_len)
-{
- int bytes_written;
- int roam_trigger[2] = {0, 0};
-
- roam_trigger[1] = WLC_BAND_2G;
- if (wldev_ioctl(dev, WLC_GET_ROAM_TRIGGER, roam_trigger,
- sizeof(roam_trigger), 0)) {
- roam_trigger[1] = WLC_BAND_5G;
- if (wldev_ioctl(dev, WLC_GET_ROAM_TRIGGER, roam_trigger,
- sizeof(roam_trigger), 0))
- return -1;
- }
-
- bytes_written = snprintf(command, total_len, "%s %d",
- CMD_ROAMTRIGGER_GET, roam_trigger[0]);
-
- return bytes_written;
-}
-
-int wl_android_set_roam_delta(
- struct net_device *dev, char* command, int total_len)
-{
- int roam_delta[2];
-
- sscanf(command, "%*s %10d", &roam_delta[0]);
- roam_delta[1] = WLC_BAND_ALL;
-
- return wldev_ioctl(dev, WLC_SET_ROAM_DELTA, roam_delta,
- sizeof(roam_delta), 1);
-}
-
-static int wl_android_get_roam_delta(
- struct net_device *dev, char *command, int total_len)
-{
- int bytes_written;
- int roam_delta[2] = {0, 0};
-
- roam_delta[1] = WLC_BAND_2G;
- if (wldev_ioctl(dev, WLC_GET_ROAM_DELTA, roam_delta,
- sizeof(roam_delta), 0)) {
- roam_delta[1] = WLC_BAND_5G;
- if (wldev_ioctl(dev, WLC_GET_ROAM_DELTA, roam_delta,
- sizeof(roam_delta), 0))
- return -1;
- }
-
- bytes_written = snprintf(command, total_len, "%s %d",
- CMD_ROAMDELTA_GET, roam_delta[0]);
-
- return bytes_written;
-}
-
-int wl_android_set_roam_scan_period(
- struct net_device *dev, char* command, int total_len)
-{
- int roam_scan_period = 0;
-
- sscanf(command, "%*s %10d", &roam_scan_period);
- return wldev_ioctl(dev, WLC_SET_ROAM_SCAN_PERIOD, &roam_scan_period,
- sizeof(roam_scan_period), 1);
-}
-
-static int wl_android_get_roam_scan_period(
- struct net_device *dev, char *command, int total_len)
-{
- int bytes_written;
- int roam_scan_period = 0;
-
- if (wldev_ioctl(dev, WLC_GET_ROAM_SCAN_PERIOD, &roam_scan_period,
- sizeof(roam_scan_period), 0))
- return -1;
-
- bytes_written = snprintf(command, total_len, "%s %d",
- CMD_ROAMSCANPERIOD_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)
-{
- int error = 0;
- wl_country_t cspec = {{0}, 0, {0} };
- char country_code[WLC_CNTRY_BUF_SZ];
- char smbuf[WLC_IOCTL_SMLEN];
- int rev = 0;
-
- memset(country_code, 0, sizeof(country_code));
- 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));
- memcpy(cspec.ccode, country_code, sizeof(country_code));
- cspec.rev = rev;
-
- error = wldev_iovar_setbuf(dev, "country", (char *)&cspec,
- sizeof(cspec), smbuf, sizeof(smbuf), NULL);
-
- if (error) {
- DHD_ERROR(("%s: set country '%s/%d' failed code %d\n",
- __FUNCTION__, cspec.ccode, cspec.rev, error));
- } else {
- dhd_bus_country_set(dev, &cspec);
- DHD_INFO(("%s: set country '%s/%d'\n",
- __FUNCTION__, cspec.ccode, cspec.rev));
- }
-
- return error;
-}
-
-static int wl_android_get_country_rev(
- 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", NULL, 0, smbuf,
- sizeof(smbuf), NULL);
-
- if (error) {
- DHD_ERROR(("%s: get country failed code %d\n",
- __FUNCTION__, error));
- return -1;
- } else {
- 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 %c%c %d",
- CMD_COUNTRYREV_GET, cspec.ccode[0], cspec.ccode[1], cspec.rev);
-
- return bytes_written;
-}
-#endif /* ROAM_API */
-
-#ifdef 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 */
-#endif /* CUSTOMER_HW4 */
-
-#if defined(PNO_SUPPORT) && !defined(WL_SCHED_SCAN)
-static int wl_android_set_pno_setup(struct net_device *dev, char *command, int total_len)
-{
- wlc_ssid_t ssids_local[MAX_PFN_LIST_COUNT];
- int res = -1;
- int nssid = 0;
- cmd_tlv_t *cmd_tlv_temp;
- char *str_ptr;
- int tlv_size_left;
- int pno_time = 0;
- int pno_repeat = 0;
- int pno_freq_expo_max = 0;
-
-#ifdef PNO_SET_DEBUG
- int i;
- char pno_in_example[] = {
- 'P', 'N', 'O', 'S', 'E', 'T', 'U', 'P', ' ',
- 'S', '1', '2', '0',
- 'S',
- 0x05,
- 'd', 'l', 'i', 'n', 'k',
- 'S',
- 0x04,
- 'G', 'O', 'O', 'G',
- 'T',
- '0', 'B',
- 'R',
- '2',
- 'M',
- '2',
- 0x00
- };
-#endif /* PNO_SET_DEBUG */
-
- DHD_INFO(("%s: command=%s, len=%d\n", __FUNCTION__, command, total_len));
-
- if (total_len < (strlen(CMD_PNOSETUP_SET) + sizeof(cmd_tlv_t))) {
- DHD_ERROR(("%s argument=%d less min size\n", __FUNCTION__, total_len));
- goto exit_proc;
- }
-
-
-#ifdef PNO_SET_DEBUG
- memcpy(command, pno_in_example, sizeof(pno_in_example));
- for (i = 0; i < sizeof(pno_in_example); i++)
- printf("%02X ", command[i]);
- printf("\n");
- total_len = sizeof(pno_in_example);
-#endif
-
- str_ptr = command + strlen(CMD_PNOSETUP_SET);
- tlv_size_left = total_len - strlen(CMD_PNOSETUP_SET);
-
- cmd_tlv_temp = (cmd_tlv_t *)str_ptr;
- memset(ssids_local, 0, sizeof(ssids_local));
-
- if ((cmd_tlv_temp->prefix == PNO_TLV_PREFIX) &&
- (cmd_tlv_temp->version == PNO_TLV_VERSION) &&
- (cmd_tlv_temp->subver == PNO_TLV_SUBVERSION)) {
-
- str_ptr += sizeof(cmd_tlv_t);
- tlv_size_left -= sizeof(cmd_tlv_t);
-
- if ((nssid = wl_iw_parse_ssid_list_tlv(&str_ptr, ssids_local,
- MAX_PFN_LIST_COUNT, &tlv_size_left)) <= 0) {
- DHD_ERROR(("SSID is not presented or corrupted ret=%d\n", nssid));
- goto exit_proc;
- } else {
- if ((str_ptr[0] != PNO_TLV_TYPE_TIME) || (tlv_size_left <= 1)) {
- DHD_ERROR(("%s scan duration corrupted field size %d\n",
- __FUNCTION__, tlv_size_left));
- goto exit_proc;
- }
- str_ptr++;
- pno_time = simple_strtoul(str_ptr, &str_ptr, 16);
- DHD_INFO(("%s: pno_time=%d\n", __FUNCTION__, pno_time));
-
- if (str_ptr[0] != 0) {
- if ((str_ptr[0] != PNO_TLV_FREQ_REPEAT)) {
- DHD_ERROR(("%s pno repeat : corrupted field\n",
- __FUNCTION__));
- goto exit_proc;
- }
- str_ptr++;
- pno_repeat = simple_strtoul(str_ptr, &str_ptr, 16);
- DHD_INFO(("%s :got pno_repeat=%d\n", __FUNCTION__, pno_repeat));
- if (str_ptr[0] != PNO_TLV_FREQ_EXPO_MAX) {
- DHD_ERROR(("%s FREQ_EXPO_MAX corrupted field size\n",
- __FUNCTION__));
- goto exit_proc;
- }
- str_ptr++;
- pno_freq_expo_max = simple_strtoul(str_ptr, &str_ptr, 16);
- DHD_INFO(("%s: pno_freq_expo_max=%d\n",
- __FUNCTION__, pno_freq_expo_max));
- }
- }
- } else {
- DHD_ERROR(("%s get wrong TLV command\n", __FUNCTION__));
- goto exit_proc;
- }
-
- res = dhd_dev_pno_set(dev, ssids_local, nssid, pno_time, pno_repeat, pno_freq_expo_max);
-
-exit_proc:
- return res;
-}
-#endif /* PNO_SUPPORT && !WL_SCHED_SCAN */
-
-static int wl_android_get_p2p_dev_addr(struct net_device *ndev, char *command, int total_len)
-{
- int ret;
- int bytes_written = 0;
-
- ret = wl_cfg80211_get_p2p_dev_addr(ndev, (struct ether_addr*)command);
- if (ret)
- return 0;
- 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;
-
- 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;
- }
- memcpy(command, &rn, 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];
-
- 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);
-
- 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;
-
- 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;
- }
-
- 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);
- }
-
- /* 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;
- }
-
- memcpy(command+sizeof(u32), buf, resp_ies_len);
- bytes_written += resp_ies_len;
- }
- return bytes_written;
-}
-
-#endif /* BCMCCX */
-
-/**
- * Global function definitions (declared in wl_android.h)
- */
-
-int wl_android_wifi_on(struct net_device *dev)
-{
- int ret = 0;
- int retry = POWERUP_MAX_RETRY;
-
- printk("%s in\n", __FUNCTION__);
- if (!dev) {
- DHD_ERROR(("%s: dev is null\n", __FUNCTION__));
- return -EINVAL;
- }
-
- dhd_net_if_lock(dev);
- if (!g_wifi_on) {
- do {
- dhd_customer_gpio_wlan_ctrl(WLAN_RESET_ON);
- ret = sdioh_start(NULL, 0);
- if (ret == 0)
- break;
- DHD_ERROR(("\nfailed to power up wifi chip, retry again (%d left) **\n\n",
- retry+1));
- dhd_customer_gpio_wlan_ctrl(WLAN_RESET_OFF);
- } while (retry-- >= 0);
- if (ret != 0) {
- DHD_ERROR(("\nfailed to power up wifi chip, max retry reached **\n\n"));
- goto exit;
- }
- ret = dhd_dev_reset(dev, FALSE);
- sdioh_start(NULL, 1);
- if (!ret) {
- if (dhd_dev_init_ioctl(dev) < 0)
- ret = -EFAULT;
- }
-#if defined(PROP_TXSTATUS) && !defined(PROP_TXSTATUS_VSDB)
- dhd_wlfc_init(bcmsdh_get_drvdata());
-#endif
- g_wifi_on = TRUE;
- }
-
-exit:
- dhd_net_if_unlock(dev);
-
- return ret;
-}
-
-int wl_android_wifi_off(struct net_device *dev)
-{
- int ret = 0;
-
- printk("%s in\n", __FUNCTION__);
- if (!dev) {
- DHD_TRACE(("%s: dev is null\n", __FUNCTION__));
- return -EINVAL;
- }
-
- dhd_net_if_lock(dev);
- if (g_wifi_on) {
-#if defined(PROP_TXSTATUS) && !defined(PROP_TXSTATUS_VSDB)
- dhd_wlfc_deinit(bcmsdh_get_drvdata());
-#endif
- ret = dhd_dev_reset(dev, TRUE);
- sdioh_stop(NULL);
- dhd_customer_gpio_wlan_ctrl(WLAN_RESET_OFF);
- g_wifi_on = FALSE;
- }
- dhd_net_if_unlock(dev);
-
- return ret;
-}
-
-static int wl_android_set_fwpath(struct net_device *net, char *command, int total_len)
-{
- if ((strlen(command) - strlen(CMD_SETFWPATH)) > MOD_PARAM_PATHLEN)
- return -1;
- bcm_strncpy_s(fw_path, sizeof(fw_path),
- command + strlen(CMD_SETFWPATH) + 1, MOD_PARAM_PATHLEN - 1);
- if (strstr(fw_path, "apsta") != NULL) {
- DHD_INFO(("GOT APSTA FIRMWARE\n"));
- ap_fw_loaded = TRUE;
- } else {
- DHD_INFO(("GOT STA FIRMWARE\n"));
- ap_fw_loaded = FALSE;
- }
- return 0;
-}
-
-
-static int
-wl_android_set_pmk(struct net_device *dev, char *command, int total_len)
-{
- uchar pmk[33];
- int error = 0;
- char smbuf[WLC_IOCTL_SMLEN];
-#ifdef OKC_DEBUG
- int i = 0;
-#endif
-
- bzero(pmk, sizeof(pmk));
- memcpy((char *)pmk, command + strlen("SET_PMK "), 32);
- error = wldev_iovar_setbuf(dev, "okc_info_pmk", pmk, 32, smbuf, sizeof(smbuf), NULL);
- if (error) {
- DHD_ERROR(("Failed to set PMK for OKC, error = %d\n", error));
- }
-#ifdef OKC_DEBUG
- DHD_ERROR(("PMK is "));
- for (i = 0; i < 32; i++)
- DHD_ERROR(("%02X ", pmk[i]));
-
- DHD_ERROR(("\n"));
-#endif
- return error;
-}
-
-static int
-wl_android_okc_enable(struct net_device *dev, char *command, int total_len)
-{
- int error = 0;
- char okc_enable = 0;
-
- okc_enable = command[strlen(CMD_OKC_ENABLE) + 1] - '0';
- error = wldev_iovar_setint(dev, "okc_enable", okc_enable);
- if (error) {
- DHD_ERROR(("Failed to %s OKC, error = %d\n",
- okc_enable ? "enable" : "disable", error));
- }
-
- return error;
-}
-
-
-#ifdef CUSTOMER_HW4
-#ifdef SUPPORT_AMPDU_MPDU_CMD
-/* CMD_AMPDU_MPDU */
-static int
-wl_android_set_ampdu_mpdu(struct net_device *dev, const char* string_num)
-{
- int err = 0;
- int ampdu_mpdu;
-
- 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) {
- DHD_ERROR(("%s : ampdu_mpdu set error. %d\n", __FUNCTION__, err));
- return -1;
- }
-
- return 0;
-}
-#endif /* SUPPORT_AMPDU_MPDU_CMD */
-
-/* SoftAP feature */
-#ifdef SUPPORT_AUTO_CHANNEL
-static int
-wl_android_set_auto_channel(struct net_device *dev, const char* string_num,
- char* command, int total_len)
-{
- int channel;
- int chosen = 0;
- int retry = 0;
- int ret = 0;
-
- /* Restrict channel to 1 - 7: 2GHz, 20MHz BW, No SB */
- u32 req_buf[8] = {7, 0x2B01, 0x2B02, 0x2B03, 0x2B04, 0x2B05, 0x2B06,
- 0x2B07};
-
- /* Auto channel select */
- wl_uint32_list_t request;
-
- channel = bcm_atoi(string_num);
- DHD_INFO(("%s : HAPD_AUTO_CHANNEL = %d\n", __FUNCTION__, channel));
-
- if (channel == 20)
- ret = wldev_ioctl(dev, WLC_START_CHANNEL_SEL, (void *)&req_buf,
- sizeof(req_buf), true);
- else { /* channel == 0 */
- request.count = htod32(0);
- ret = wldev_ioctl(dev, WLC_START_CHANNEL_SEL, (void *)&request,
- sizeof(request), true);
- }
-
- if (ret < 0) {
- DHD_ERROR(("%s: can't start auto channel scan, err = %d\n",
- __FUNCTION__, ret));
- channel = 0;
- goto done;
- }
-
- /* Wait for auto channel selection, max 2500 ms */
- bcm_mdelay(500);
-
- retry = 10;
- while (retry--) {
- ret = wldev_ioctl(dev, WLC_GET_CHANNEL_SEL, &chosen, sizeof(chosen),
- false);
- if (ret < 0 || dtoh32(chosen) == 0) {
- DHD_INFO(("%s: %d tried, ret = %d, chosen = %d\n",
- __FUNCTION__, (10 - retry), ret, chosen));
- bcm_mdelay(200);
- }
- else {
- channel = (u16)chosen & 0x00FF;
- DHD_ERROR(("%s: selected channel = %d\n", __FUNCTION__, channel));
- break;
- }
- }
-
- if (retry == 0) {
- DHD_ERROR(("%s: auto channel timed out, failed\n", __FUNCTION__));
- channel = 0;
- }
-
-done:
- snprintf(command, 4, "%d", channel);
- DHD_INFO(("%s: command result is %s\n", __FUNCTION__, command));
-
- return 4;
-}
-#endif /* SUPPORT_AUTO_CHANNEL */
-
-#ifdef 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 */
-
-#ifdef SUPPORT_SOFTAP_SINGL_DISASSOC
-static int
-wl_android_sta_diassoc(struct net_device *dev, const char* straddr)
-{
- scb_val_t scbval;
- int error = 0;
-
- DHD_INFO(("%s: deauth STA %s\n", __FUNCTION__, straddr));
-
- /* Unspecified reason */
- scbval.val = htod32(1);
- bcm_ether_atoe(straddr, &scbval.ea);
-
- DHD_INFO(("%s: deauth STA: "MACDBG "\n", __FUNCTION__,
- MAC2STRDBG(scbval.ea.octet)));
-
- error = wldev_ioctl(dev, WLC_SCB_DEAUTHENTICATE_FOR_REASON, &scbval,
- sizeof(scb_val_t), true);
- if (error) {
- DHD_ERROR(("Fail to DEAUTH station, error = %d\n", error));
- }
-
- return 1;
-}
-#endif /* SUPPORT_SOFTAP_SINGL_DISASSOC */
-
-static int
-wl_android_ch_res_rl(struct net_device *dev, bool change)
-{
- int error = 0;
- s32 srl = 7;
- s32 lrl = 4;
- printk("%s enter\n", __FUNCTION__);
- if (change) {
- srl = 4;
- lrl = 2;
- }
- 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);
- if (error) {
- DHD_ERROR(("Failed to set LRL, error = %d\n", error));
- }
- return error;
-}
-#endif /* CUSTOMER_HW4 */
-
-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(("%s: Failed to get Parameter\n", __FUNCTION__));
- return -1;
- }
-
- error = wldev_iovar_setint(dev, "roam_off", mode);
- if (error) {
- DHD_ERROR(("%s: Failed to set roaming Mode %d, error = %d\n",
- __FUNCTION__, mode, error));
- return -1;
- }
- else
- DHD_ERROR(("%s: succeeded to set roaming Mode %d, error = %d\n",
- __FUNCTION__, mode, error));
- return 0;
-}
-
-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;
- android_wifi_priv_cmd priv_cmd;
-
- net_os_wake_lock(net);
-
- if (!ifr->ifr_data) {
- ret = -EINVAL;
- goto exit;
- }
- if (copy_from_user(&priv_cmd, ifr->ifr_data, sizeof(android_wifi_priv_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;
- goto exit;
- }
- command = kmalloc((priv_cmd.total_len + 1), GFP_KERNEL);
- if (!command)
- {
- DHD_ERROR(("%s: failed to allocate memory\n", __FUNCTION__));
- ret = -ENOMEM;
- goto exit;
- }
- if (copy_from_user(command, priv_cmd.buf, priv_cmd.total_len)) {
- ret = -EFAULT;
- goto exit;
- }
- command[priv_cmd.total_len] = '\0';
-
- 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_INFO(("%s, Received regular START command\n", __FUNCTION__));
-#ifdef SUPPORT_DEEP_SLEEP
- trigger_deep_sleep = 1;
-#else
- bytes_written = wl_android_wifi_on(net);
-#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);
- }
-
- if (!g_wifi_on) {
- DHD_ERROR(("%s: Ignore private cmd \"%s\" - iface %s is down\n",
- __FUNCTION__, command, ifr->ifr_name));
- ret = 0;
- goto exit;
- }
-
- if (strnicmp(command, CMD_STOP, strlen(CMD_STOP)) == 0) {
-#ifdef SUPPORT_DEEP_SLEEP
- trigger_deep_sleep = 1;
-#else
- bytes_written = wl_android_wifi_off(net);
-#endif /* SUPPORT_DEEP_SLEEP */
- }
- else if (strnicmp(command, CMD_SCAN_ACTIVE, strlen(CMD_SCAN_ACTIVE)) == 0) {
- /* TBD: SCAN-ACTIVE */
- }
- else if (strnicmp(command, CMD_SCAN_PASSIVE, strlen(CMD_SCAN_PASSIVE)) == 0) {
- /* TBD: SCAN-PASSIVE */
- }
- else if (strnicmp(command, CMD_RSSI, strlen(CMD_RSSI)) == 0) {
- bytes_written = wl_android_get_rssi(net, command, priv_cmd.total_len);
- }
- 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_enable_packet_filter(net, 1);
- }
- else if (strnicmp(command, CMD_RXFILTER_STOP, strlen(CMD_RXFILTER_STOP)) == 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';
- bytes_written = net_os_rxfilter_add_remove(net, TRUE, filter_num);
- }
- else if (strnicmp(command, CMD_RXFILTER_REMOVE, strlen(CMD_RXFILTER_REMOVE)) == 0) {
- 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 */
- }
- else if (strnicmp(command, CMD_BTCOEXSCAN_STOP, strlen(CMD_BTCOEXSCAN_STOP)) == 0) {
- /* TBD: BTCOEXSCAN-STOP */
- }
- else if (strnicmp(command, CMD_BTCOEXMODE, strlen(CMD_BTCOEXMODE)) == 0) {
-#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_enable_packet_filter(net, 0); /* DHCP starts */
- else
- 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';
-#ifdef WL_HOST_BAND_MGMT
- s32 ret = 0;
- if ((ret = wl_cfg80211_set_band(net, band)) < 0) {
- if (ret == BCME_UNSUPPORTED) {
- /* If roam_var is unsupported, fallback to the original method */
- WL_ERR(("WL_HOST_BAND_MGMT defined, "
- "but roam_band iovar unsupported in the firmware\n"));
- } else {
- bytes_written = -1;
- goto exit;
- }
- }
- if ((band == WLC_BAND_AUTO) || (ret == BCME_UNSUPPORTED))
- bytes_written = wldev_set_band(net, band);
-#else
- bytes_written = wldev_set_band(net, band);
-#endif /* WL_HOST_BAND_MGMT */
- }
- else if (strnicmp(command, CMD_GETBAND, strlen(CMD_GETBAND)) == 0) {
- bytes_written = wl_android_get_band(net, command, priv_cmd.total_len);
- }
-#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);
- }
-#endif /* CUSTOMER_SET_COUNTRY */
-#endif /* WL_CFG80211 */
-
-#ifdef CUSTOMER_HW4
-#ifdef ROAM_API
- else if (strnicmp(command, CMD_ROAMTRIGGER_SET,
- strlen(CMD_ROAMTRIGGER_SET)) == 0) {
- bytes_written = wl_android_set_roam_trigger(net, command,
- priv_cmd.total_len);
- } else if (strnicmp(command, CMD_ROAMTRIGGER_GET,
- strlen(CMD_ROAMTRIGGER_GET)) == 0) {
- bytes_written = wl_android_get_roam_trigger(net, command,
- priv_cmd.total_len);
- } else if (strnicmp(command, CMD_ROAMDELTA_SET,
- strlen(CMD_ROAMDELTA_SET)) == 0) {
- bytes_written = wl_android_set_roam_delta(net, command,
- priv_cmd.total_len);
- } else if (strnicmp(command, CMD_ROAMDELTA_GET,
- strlen(CMD_ROAMDELTA_GET)) == 0) {
- bytes_written = wl_android_get_roam_delta(net, command,
- priv_cmd.total_len);
- } else if (strnicmp(command, CMD_ROAMSCANPERIOD_SET,
- strlen(CMD_ROAMSCANPERIOD_SET)) == 0) {
- bytes_written = wl_android_set_roam_scan_period(net, command,
- priv_cmd.total_len);
- } else if (strnicmp(command, CMD_ROAMSCANPERIOD_GET,
- strlen(CMD_ROAMSCANPERIOD_GET)) == 0) {
- bytes_written = wl_android_get_roam_scan_period(net, command,
- 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) {
- bytes_written = wl_android_set_country_rev(net, command,
- priv_cmd.total_len);
- } else if (strnicmp(command, CMD_COUNTRYREV_GET,
- strlen(CMD_COUNTRYREV_GET)) == 0) {
- bytes_written = wl_android_get_country_rev(net, command,
- priv_cmd.total_len);
- }
-#endif /* ROAM_API */
-#ifdef 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 */
-#endif /* CUSTOMER_HW4 */
-
-#if defined(PNO_SUPPORT) && !defined(WL_SCHED_SCAN)
- else if (strnicmp(command, CMD_PNOSSIDCLR_SET, strlen(CMD_PNOSSIDCLR_SET)) == 0) {
- bytes_written = dhd_dev_pno_reset(net);
- }
- else if (strnicmp(command, CMD_PNOSETUP_SET, strlen(CMD_PNOSETUP_SET)) == 0) {
- bytes_written = wl_android_set_pno_setup(net, command, priv_cmd.total_len);
- }
- else if (strnicmp(command, CMD_PNOENABLE_SET, strlen(CMD_PNOENABLE_SET)) == 0) {
- uint pfn_enabled = *(command + strlen(CMD_PNOENABLE_SET) + 1) - '0';
- bytes_written = dhd_dev_pno_enable(net, pfn_enabled);
- }
-#endif /* PNO_SUPPORT && !WL_SCHED_SCAN */
- else if (strnicmp(command, CMD_P2P_DEV_ADDR, strlen(CMD_P2P_DEV_ADDR)) == 0) {
- bytes_written = wl_android_get_p2p_dev_addr(net, command, priv_cmd.total_len);
- }
- else if (strnicmp(command, CMD_P2P_SET_NOA, strlen(CMD_P2P_SET_NOA)) == 0) {
- int skip = strlen(CMD_P2P_SET_NOA) + 1;
- 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,
- priv_cmd.total_len - skip);
- }
-#ifdef WL_CFG80211
- else if (strnicmp(command, CMD_SET_AP_WPS_P2P_IE,
- strlen(CMD_SET_AP_WPS_P2P_IE)) == 0) {
- int skip = strlen(CMD_SET_AP_WPS_P2P_IE) + 3;
- bytes_written = wl_cfg80211_set_wps_p2p_ie(net, command + skip,
- priv_cmd.total_len - skip, *(command + skip - 2) - '0');
- }
-#endif /* WL_CFG80211 */
- 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);
- else if (strnicmp(command, CMD_OKC_ENABLE, strlen(CMD_OKC_ENABLE)) == 0)
- bytes_written = wl_android_okc_enable(net, command, priv_cmd.total_len);
-#ifdef BCMCCX
- else if (strnicmp(command, CMD_GETCCKM_RN, strlen(CMD_GETCCKM_RN)) == 0) {
- bytes_written = wl_android_get_cckm_rn(net, command);
- }
- else if (strnicmp(command, CMD_SETCCKM_KRK, strlen(CMD_SETCCKM_KRK)) == 0) {
- bytes_written = wl_android_set_cckm_krk(net, command);
- }
- else if (strnicmp(command, CMD_GET_ASSOC_RES_IES, strlen(CMD_GET_ASSOC_RES_IES)) == 0) {
- bytes_written = wl_android_get_assoc_res_ies(net, command);
- }
-#endif /* BCMCCX */
-#ifdef CUSTOMER_HW4
-#ifdef SUPPORT_AMPDU_MPDU_CMD
- /* CMD_AMPDU_MPDU */
- 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 /* SUPPORT_AMPDU_MPDU_CMD */
-#ifdef SUPPORT_AUTO_CHANNEL
- else if (strnicmp(command, CMD_SET_HAPD_AUTO_CHANNEL,
- strlen(CMD_SET_HAPD_AUTO_CHANNEL)) == 0) {
- int skip = strlen(CMD_SET_HAPD_AUTO_CHANNEL) + 3;
- bytes_written = wl_android_set_auto_channel(net, (const char*)command+skip, command,
- priv_cmd.total_len);
- }
-#endif /* SUPPORT_AUTO_CHANNEL */
-#ifdef SUPPORT_HIDDEN_AP
- else if (strnicmp(command, CMD_SET_HAPD_MAX_NUM_STA,
- 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) {
- 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) {
- int skip = strlen(CMD_SET_HAPD_HIDE_SSID) + 3;
- wl_android_set_hide_ssid(net, (const char*)command+skip);
- }
-#endif /* SUPPORT_HIDDEN_AP */
-#ifdef SUPPORT_SOFTAP_SINGL_DISASSOC
- else if (strnicmp(command, CMD_HAPD_STA_DISASSOC,
- 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 */
- 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 /* 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 {
- DHD_ERROR(("Unknown PRIVATE command %s - ignored\n", command));
- snprintf(command, 3, "OK");
- bytes_written = strlen("OK");
- }
-
- if (bytes_written >= 0) {
- if ((bytes_written == 0) && (priv_cmd.total_len > 0))
- command[0] = '\0';
- if (bytes_written >= priv_cmd.total_len) {
- DHD_ERROR(("%s: bytes_written = %d\n", __FUNCTION__, bytes_written));
- bytes_written = priv_cmd.total_len;
- } else {
- bytes_written++;
- }
- priv_cmd.used_len = bytes_written;
- if (copy_to_user(priv_cmd.buf, command, bytes_written)) {
- DHD_ERROR(("%s: failed to copy data to user buffer\n", __FUNCTION__));
- ret = -EFAULT;
- }
- }
- else {
- ret = bytes_written;
- }
-
-exit:
- net_os_wake_unlock(net);
- if (command) {
- kfree(command);
- }
-
- return ret;
-}
-
-int wl_android_init(void)
-{
- int ret = 0;
-
-#ifdef ENABLE_INSMOD_NO_FW_LOAD
- dhd_download_fw_on_driverload = FALSE;
-#endif /* ENABLE_INSMOD_NO_FW_LOAD */
-#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_HW4 */
-
-#ifdef WL_GENL
- wl_genl_init();
-#endif
-
- return ret;
-}
-
-int wl_android_exit(void)
-{
- int ret = 0;
-
-#ifdef WL_GENL
- wl_genl_deinit();
-#endif /* WL_GENL */
-
- return ret;
-}
-
-void wl_android_post_init(void)
-{
- if (!dhd_download_fw_on_driverload) {
- /* Call customer gpio to turn off power with WL_REG_ON signal */
- dhd_customer_gpio_wlan_ctrl(WLAN_RESET_OFF);
- g_wifi_on = 0;
- }
-}
-
-#ifdef WL_GENL
-/* Generic Netlink Initializaiton */
-static int wl_genl_init(void)
-{
- int ret;
-
- WL_DBG(("GEN Netlink Init\n\n"));
-
- /* register new family */
- ret = genl_register_family(&wl_genl_family);
- if (ret != 0)
- goto failure;
-
- /* register functions (commands) of the new family */
- ret = genl_register_ops(&wl_genl_family, &wl_genl_ops);
- if (ret != 0) {
- WL_ERR(("register ops failed: %i\n", ret));
- genl_unregister_family(&wl_genl_family);
- goto failure;
- }
-
- ret = genl_register_mc_group(&wl_genl_family, &wl_genl_mcast);
- if (ret != 0) {
- WL_ERR(("register mc_group failed: %i\n", ret));
- genl_unregister_ops(&wl_genl_family, &wl_genl_ops);
- genl_unregister_family(&wl_genl_family);
- goto failure;
- }
-
- return 0;
-
-failure:
- WL_ERR(("Registering Netlink failed!!\n"));
- return -1;
-}
-
-/* Generic netlink deinit */
-static int wl_genl_deinit(void)
-{
- if (genl_unregister_ops(&wl_genl_family, &wl_genl_ops) < 0)
- WL_ERR(("Unregister wl_genl_ops failed\n"));
-
- if (genl_unregister_family(&wl_genl_family) < 0)
- WL_ERR(("Unregister wl_genl_ops failed\n"));
-
- return 0;
-}
-
-s32 wl_event_to_bcm_event(u16 event_type)
-{
- u16 event = -1;
-
- switch (event_type) {
- case WLC_E_SERVICE_FOUND:
- event = BCM_E_SVC_FOUND;
- break;
- case WLC_E_P2PO_ADD_DEVICE:
- event = BCM_E_DEV_FOUND;
- break;
- case WLC_E_P2PO_DEL_DEVICE:
- event = BCM_E_DEV_LOST;
- break;
- /* Above events are supported from BCM Supp ver 47 Onwards */
-
- default:
- WL_ERR(("Event not supported\n"));
- }
-
- return event;
-}
-
-s32
-wl_genl_send_msg(
- struct net_device *ndev,
- u32 event_type,
- u8 *buf,
- u16 len,
- u8 *subhdr,
- u16 subhdr_len)
-{
- int ret = 0;
- struct sk_buff *skb;
- void *msg;
- u32 attr_type = 0;
- bcm_event_hdr_t *hdr = NULL;
- int mcast = 1; /* By default sent as mutlicast type */
- int pid = 0;
- u8 *ptr = NULL, *p = NULL;
- u32 tot_len = sizeof(bcm_event_hdr_t) + subhdr_len + len;
- u16 kflags = in_atomic() ? GFP_ATOMIC : GFP_KERNEL;
-
-
- WL_DBG(("Enter \n"));
-
- /* Decide between STRING event and Data event */
- if (event_type == 0)
- attr_type = BCM_GENL_ATTR_STRING;
- else
- attr_type = BCM_GENL_ATTR_MSG;
-
- skb = genlmsg_new(NLMSG_GOODSIZE, kflags);
- if (skb == NULL) {
- ret = -ENOMEM;
- goto out;
- }
-
- msg = genlmsg_put(skb, 0, 0, &wl_genl_family, 0, BCM_GENL_CMD_MSG);
- if (msg == NULL) {
- ret = -ENOMEM;
- goto out;
- }
-
-
- if (attr_type == BCM_GENL_ATTR_STRING) {
- /* Add a BCM_GENL_MSG attribute. Since it is specified as a string.
- * make sure it is null terminated
- */
- if (subhdr || subhdr_len) {
- WL_ERR(("No sub hdr support for the ATTR STRING type \n"));
- ret = -EINVAL;
- goto out;
- }
-
- ret = nla_put_string(skb, BCM_GENL_ATTR_STRING, buf);
- if (ret != 0) {
- WL_ERR(("nla_put_string failed\n"));
- goto out;
- }
- } else {
- /* ATTR_MSG */
-
- /* Create a single buffer for all */
- p = ptr = kzalloc(tot_len, kflags);
- if (!ptr) {
- ret = -ENOMEM;
- WL_ERR(("ENOMEM!!\n"));
- goto out;
- }
-
- /* Include the bcm event header */
- hdr = (bcm_event_hdr_t *)ptr;
- hdr->event_type = wl_event_to_bcm_event(event_type);
- hdr->len = len + subhdr_len;
- ptr += sizeof(bcm_event_hdr_t);
-
- /* Copy subhdr (if any) */
- if (subhdr && subhdr_len) {
- memcpy(ptr, subhdr, subhdr_len);
- ptr += subhdr_len;
- }
-
- /* Copy the data */
- if (buf && len) {
- memcpy(ptr, buf, len);
- }
-
- ret = nla_put(skb, BCM_GENL_ATTR_MSG, tot_len, p);
- if (ret != 0) {
- WL_ERR(("nla_put_string failed\n"));
- goto out;
- }
- }
-
- if (mcast) {
- int err = 0;
- /* finalize the message */
- genlmsg_end(skb, msg);
- /* NETLINK_CB(skb).dst_group = 1; */
- if ((err = genlmsg_multicast(skb, 0, wl_genl_mcast.id, GFP_ATOMIC)) < 0)
- WL_ERR(("genlmsg_multicast for attr(%d) failed. Error:%d \n",
- attr_type, err));
- else
- WL_DBG(("Multicast msg sent successfully. attr_type:%d len:%d \n",
- attr_type, tot_len));
- } else {
- NETLINK_CB(skb).dst_group = 0; /* Not in multicast group */
-
- /* finalize the message */
- genlmsg_end(skb, msg);
-
- /* send the message back */
- if (genlmsg_unicast(&init_net, skb, pid) < 0)
- WL_ERR(("genlmsg_unicast failed\n"));
- }
-
-out:
- if (p)
- kfree(p);
- if (ret)
- nlmsg_free(skb);
-
- return ret;
-}
-
-static s32
-wl_genl_handle_msg(
- struct sk_buff *skb,
- struct genl_info *info)
-{
- struct nlattr *na;
- u8 *data = NULL;
-
- WL_DBG(("Enter \n"));
-
- if (info == NULL) {
- return -EINVAL;
- }
-
- na = info->attrs[BCM_GENL_ATTR_MSG];
- if (!na) {
- WL_ERR(("nlattribute NULL\n"));
- return -EINVAL;
- }
-
- data = (char *)nla_data(na);
- if (!data) {
- WL_ERR(("Invalid data\n"));
- return -EINVAL;
- } else {
- /* Handle the data */
- WL_DBG(("%s: Data received from pid (%d) \n", __func__, info->snd_pid));
- }
-
- return 0;
-}
-#endif /* WL_GENL */
-
-/**
- * Functions for Android WiFi card detection
- */
-#if defined(CONFIG_WIFI_CONTROL_FUNC)
-
-static int g_wifidev_registered = 0;
-static struct semaphore wifi_control_sem;
-static struct wifi_platform_data *wifi_control_data = NULL;
-static struct resource *wifi_irqres = NULL;
-
-static int wifi_add_dev(void);
-static void wifi_del_dev(void);
-
-int wl_android_wifictrl_func_add(void)
-{
- int ret = 0;
- sema_init(&wifi_control_sem, 0);
-
- ret = wifi_add_dev();
- if (ret) {
- DHD_ERROR(("%s: platform_driver_register failed\n", __FUNCTION__));
- return ret;
- }
- g_wifidev_registered = 1;
-
- /* Waiting callback after platform_driver_register is done or exit with error */
- if (down_timeout(&wifi_control_sem, msecs_to_jiffies(1000)) != 0) {
- ret = -EINVAL;
- DHD_ERROR(("%s: platform_driver_register timeout\n", __FUNCTION__));
- }
-
- return ret;
-}
-
-void wl_android_wifictrl_func_del(void)
-{
- if (g_wifidev_registered)
- {
- wifi_del_dev();
- g_wifidev_registered = 0;
- }
-}
-
-void* wl_android_prealloc(int section, unsigned long size)
-{
- void *alloc_ptr = NULL;
- if (wifi_control_data && wifi_control_data->mem_prealloc) {
- alloc_ptr = wifi_control_data->mem_prealloc(section, size);
- if (alloc_ptr) {
- DHD_INFO(("success alloc section %d\n", section));
- if (size != 0L)
- bzero(alloc_ptr, size);
- return alloc_ptr;
- }
- }
-
- DHD_ERROR(("can't alloc section %d\n", section));
- return NULL;
-}
-
-int wifi_get_irq_number(unsigned long *irq_flags_ptr)
-{
- if (wifi_irqres) {
- *irq_flags_ptr = wifi_irqres->flags & IRQF_TRIGGER_MASK;
- return (int)wifi_irqres->start;
- }
-#ifdef CUSTOM_OOB_GPIO_NUM
- return CUSTOM_OOB_GPIO_NUM;
-#else
- return -1;
-#endif
-}
-
-int wifi_set_power(int on, unsigned long msec)
-{
- DHD_ERROR(("%s = %d\n", __FUNCTION__, on));
- if (wifi_control_data && wifi_control_data->set_power) {
- wifi_control_data->set_power(on);
- }
- if (msec)
- msleep(msec);
- return 0;
-}
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
-int wifi_get_mac_addr(unsigned char *buf)
-{
- DHD_ERROR(("%s\n", __FUNCTION__));
- if (!buf)
- return -EINVAL;
- if (wifi_control_data && wifi_control_data->get_mac_addr) {
- return wifi_control_data->get_mac_addr(buf);
- }
- return -EOPNOTSUPP;
-}
-#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)) */
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
-void *wifi_get_country_code(char *ccode)
-{
- DHD_TRACE(("%s\n", __FUNCTION__));
- if (!ccode)
- return NULL;
- if (wifi_control_data && wifi_control_data->get_country_code) {
- return wifi_control_data->get_country_code(ccode);
- }
- return NULL;
-}
-#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)) */
-
-static int wifi_set_carddetect(int on)
-{
- DHD_ERROR(("%s = %d\n", __FUNCTION__, on));
- if (wifi_control_data && wifi_control_data->set_carddetect) {
- wifi_control_data->set_carddetect(on);
- }
- return 0;
-}
-
-static int wifi_probe(struct platform_device *pdev)
-{
- struct wifi_platform_data *wifi_ctrl =
- (struct wifi_platform_data *)(pdev->dev.platform_data);
-
- 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_carddetect(1); /* CardDetect (0->1) */
-
- up(&wifi_control_sem);
- return 0;
-}
-
-static int wifi_remove(struct platform_device *pdev)
-{
- struct wifi_platform_data *wifi_ctrl =
- (struct wifi_platform_data *)(pdev->dev.platform_data);
-
- DHD_ERROR(("## %s\n", __FUNCTION__));
- wifi_control_data = wifi_ctrl;
-
- wifi_set_power(0, WIFI_TURNOFF_DELAY); /* Power Off */
- wifi_set_carddetect(0); /* CardDetect (1->0) */
-
- up(&wifi_control_sem);
- return 0;
-}
-
-static int wifi_suspend(struct platform_device *pdev, pm_message_t state)
-{
- DHD_TRACE(("##> %s\n", __FUNCTION__));
-#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 39)) && defined(OOB_INTR_ONLY) && 1
- bcmsdh_oob_intr_set(0);
-#endif /* (OOB_INTR_ONLY) */
- return 0;
-}
-
-static int wifi_resume(struct platform_device *pdev)
-{
- DHD_TRACE(("##> %s\n", __FUNCTION__));
-#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 39)) && defined(OOB_INTR_ONLY) && 1
- if (dhd_os_check_if_up(bcmsdh_get_drvdata()))
- bcmsdh_oob_intr_set(1);
-#endif /* (OOB_INTR_ONLY) */
- return 0;
-}
-
-static struct platform_driver wifi_device = {
- .probe = wifi_probe,
- .remove = wifi_remove,
- .suspend = wifi_suspend,
- .resume = wifi_resume,
- .driver = {
- .name = "bcmdhd_wlan",
- }
-};
-
-static struct platform_driver wifi_device_legacy = {
- .probe = wifi_probe,
- .remove = wifi_remove,
- .suspend = wifi_suspend,
- .resume = wifi_resume,
- .driver = {
- .name = "bcm4329_wlan",
- }
-};
-
-static int wifi_add_dev(void)
-{
- int ret = 0;
- DHD_TRACE(("## Calling platform_driver_register\n"));
- 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)
-{
- DHD_TRACE(("## Unregister platform_driver_register\n"));
- platform_driver_unregister(&wifi_device);
- platform_driver_unregister(&wifi_device_legacy);
-}
-#endif /* defined(CONFIG_WIFI_CONTROL_FUNC) */
--- /dev/null
+config BCMDHD
+ tristate "Broadcom 43xx wireless cards support"
+ depends on MMC && CFG80211
+ ---help---
+ This module adds support for wireless adapters based on
+ Broadcom 43xx chipset.
+
+ This driver uses the kernel's cfg80211 subsystem.
+
+ If you choose to build a module, it'll be called dhd. Say M if
+ unsure.
+
+config BCM43241
+ bool "Broadcom 43241 wireless card support"
+ depends on BCMDHD
+
+config BCM43341
+ bool "Broadcom 43341 wireless card support"
+ depends on BCMDHD
+
+config BCM4335
+ bool "Broadcom 4335 wireless card support"
+ depends on BCMDHD
+
+config BCM4339
+ bool "Broadcom 4339 wireless card support"
+ depends on BCMDHD
+
+config BCMDHD_FW_PATH
+ depends on BCMDHD
+ string "Firmware path"
+ default "/system/etc/firmware/fw_bcmdhd.bin"
+ ---help---
+ Path to the firmware file.
+
+config BCMDHD_NVRAM_PATH
+ depends on BCMDHD
+ string "NVRAM path"
+ default "/system/etc/wifi/bcmdhd.cal"
+ ---help---
+ Path to the calibration file.
+
+config BCMDHD_HW_OOB
+ bool "Use out of band interrupt"
+ depends on BCMDHD
+ default n
+ ---help---
+ Use out of band interrupt for card interrupt and wake on wireless.
+
+config BCMDHD_INSMOD_NO_FW_LOAD
+ bool "Enable delayed firmware load"
+ depends on BCMDHD
+ default n
+ ---help---
+ Enable delayes firmware
+
+config DHD_USE_STATIC_BUF
+ bool "Enable memory preallocation"
+ depends on BCMDHD
+ default n
+ ---help---
+ 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
--- /dev/null
+# bcmdhd
+
+DHDCFLAGS = -Wall -Wstrict-prototypes -Dlinux -DBCMDRIVER \
+ -DBCMDONGLEHOST -DUNRELEASEDCHIP -DBCMDMA32 -DBCMFILEIMAGE \
+ -DDHDTHREAD -DDHD_DEBUG -DSDTEST -DBDC -DTOE \
+ -DDHD_BCMEVENTS -DSHOW_EVENTS -DPROP_TXSTATUS -DBCMDBG \
+ -DCUSTOMER_HW2 \
+ -DMMC_SDIO_ABORT -DBCMSDIO -DBCMLXSDMMC -DBCMPLATFORM_BUS -DWLP2P \
+ -DWIFI_ACT_FRAME -DARP_OFFLOAD_SUPPORT \
+ -DKEEP_ALIVE -DGET_CUSTOM_MAC_ENABLE -DPKT_FILTER_SUPPORT \
+ -DEMBEDDED_PLATFORM -DPNO_SUPPORT \
+ -DDHD_USE_IDLECOUNT -DSET_RANDOM_MAC_SOFTAP -DROAM_ENABLE -DVSDB \
+ -DWL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST \
+ -DESCAN_RESULT_PATCH -DHT40_GO -DPASS_ARP_PACKET \
+ -DDHD_DONOT_FORWARD_BCMEVENT_AS_NETWORK_PKT -DSUPPORT_PM2_ONLY \
+ -DMIRACAST_AMPDU_SIZE=8 \
+ -Idrivers/net/wireless/bcmdhd -Idrivers/net/wireless/bcmdhd/include
+
+DHDCFLAGS += -DWL_CFG80211 -DWL_CFG80211_STA_EVENT
+DHDCFLAGS += -DDEBUGFS_CFG80211
+DHDCFLAGS += -DUSE_KTHREAD_API
+DHDCFLAGS += -DCUSTOM_DPC_CPUCORE=0
+DHDCFLAGS += -DCUSTOM_DPC_PRIO_SETTING=99
+DHDCFLAGS += -DIOCTL_RESP_TIMEOUT=5000
+
+ifeq ($(CONFIG_BCMDHD_HW_OOB),y)
+ DHDCFLAGS += -DHW_OOB -DOOB_INTR_ONLY
+else
+ DHDCFLAGS += -DSDIO_ISR_THREAD
+endif
+
+ifeq ($(CONFIG_BCMDHD_INSMOD_NO_FW_LOAD),y)
+ DHDCFLAGS += -DENABLE_INSMOD_NO_FW_LOAD
+endif
+
+ifneq ($(CONFIG_DHD_USE_SCHED_SCAN),)
+ DHDCFLAGS += -DWL_SCHED_SCAN
+endif
+
+#ifeq ($(CONFIG_BCM43241),y)
+# DHDCFLAGS += -DBCM43241_CHIP
+# DHDCFLAGS += -DSDIO_CRC_ERROR_FIX
+# DHDCFLAGS += -DCUSTOM_SDIO_F2_BLKSIZE=128
+# DHDCFLAGS += -DCUSTOM_ROAM_TRIGGER_SETTING=-65
+# DHDCFLAGS += -DCUSTOM_ROAM_DELTA_SETTING=15
+# DHDCFLAGS += -DCUSTOM_KEEP_ALIVE_SETTING=28000
+# DHDCFLAGS += -DCUSTOM_PNO_EVENT_LOCK_xTIME=7
+# DHDCFLAGS += -DVSDB_BW_ALLOCATE_ENABLE
+# DHDCFLAGS += -DQMONITOR
+# DHDCFLAGS += -DDISABLE_CHIPACTIVE_BUSSLEEP
+# DHDCFLAGS += -DP2P_DISCOVERY_WAR
+#endif
+
+#ifeq ($(CONFIG_BCM43341),y)
+# DHDCFLAGS += -DBCM43341_CHIP
+# DHDCFLAGS += -DVSDB_BW_ALLOCATE_ENABLE
+# DHDCFLAGS += -DQMONITOR
+# DHDCFLAGS += -DNV_BCM943341_WBFGN_MULTI_MODULE_SUPPORT
+#endif
+
+#BCMDHD for BCM4335 and BCM4339 chip
+ifneq ($(CONFIG_BCMDHD),)
+ DHDCFLAGS += -DBCM4335_CHIP
+ DHDCFLAGS += -DSDIO_CRC_ERROR_FIX
+ DHDCFLAGS += -DPROP_TXSTATUS_VSDB
+ DHDCFLAGS += -DCUSTOM_AMPDU_BA_WSIZE=40
+ DHDCFLAGS += -DCUSTOM_GLOM_SETTING=8 -DCUSTOM_RXCHAIN=1
+ DHDCFLAGS += -DBCMSDIOH_TXGLOM -DCUSTOM_TXGLOM=1 -DBCMSDIOH_TXGLOM_HIGHSPEED
+ DHDCFLAGS += -DCUSTOM_MAX_TXGLOM_SIZE=32
+ DHDCFLAGS += -DRXFRAME_THREAD
+ DHDCFLAGS += -DDHDTCPACK_SUPPRESS
+ DHDCFLAGS += -DUSE_WL_TXBF
+ DHDCFLAGS += -DUSE_WL_FRAMEBURST
+ DHDCFLAGS += -DDHD_ENABLE_LPC
+ DHDCFLAGS += -DVSDB_BW_ALLOCATE_ENABLE
+ DHDCFLAGS += -DQMONITOR
+# DHDCFLAGS += -DENABLE_4335BT_WAR
+endif
+
+#ifeq ($(CONFIG_BCM4339),y)
+# DHDCFLAGS += -DBCM4339_CHIP
+# DHDCFLAGS += -DSDIO_CRC_ERROR_FIX
+# DHDCFLAGS += -DPROP_TXSTATUS_VSDB
+# DHDCFLAGS += -DCUSTOM_AMPDU_BA_WSIZE=40
+# DHDCFLAGS += -DCUSTOM_GLOM_SETTING=8 -DCUSTOM_RXCHAIN=1
+# DHDCFLAGS += -DBCMSDIOH_TXGLOM -DCUSTOM_TXGLOM=1 -DBCMSDIOH_TXGLOM_HIGHSPEED
+# DHDCFLAGS += -DCUSTOM_MAX_TXGLOM_SIZE=32
+# DHDCFLAGS += -DRXFRAME_THREAD
+# DHDCFLAGS += -DDHDTCPACK_SUPPRESS
+# DHDCFLAGS += -DUSE_WL_TXBF
+# DHDCFLAGS += -DUSE_WL_FRAMEBURST
+# DHDCFLAGS += -DDHD_ENABLE_LPC
+# DHDCFLAGS += -DVSDB_BW_ALLOCATE_ENABLE
+# DHDCFLAGS += -DQMONITOR
+#endif
+
+DHDOFILES = bcmsdh.o bcmsdh_linux.o bcmsdh_sdmmc.o bcmsdh_sdmmc_linux.o \
+ dhd_cdc.o dhd_cfg80211.o dhd_common.o dhd_custom_gpio.o dhd_ip.o \
+ dhd_linux.o dhd_linux_sched.o dhd_sdio.o dhd_wlfc.o aiutils.o \
+ bcmevent.o bcmutils.o bcmwifi_channels.o hndpmu.o linux_osl.o \
+ sbutils.o siutils.o wldev_common.o wl_android.o wl_cfg80211.o \
+ wl_cfgp2p.o wl_linux_mon.o
+
+ifneq ($(findstring QMONITOR, $(DHDCFLAGS)),)
+ DHDOFILES += dhd_qmon.o
+endif
+
+obj-$(CONFIG_BCMDHD) += bcmdhd.o
+bcmdhd-objs += $(DHDOFILES)
+
+EXTRA_CFLAGS = $(DHDCFLAGS)
+ifeq ($(CONFIG_BCMDHD),m)
+ EXTRA_LDFLAGS += --strip-debug
+endif
* Misc utility routines for accessing chip-specific features
* of the SiliconBackplane-based Broadcom chips.
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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 363711 2012-10-19 01:36:13Z $
+ * $Id: aiutils.c 385510 2013-02-15 21:02:07Z $
*/
#include <bcm_cfg.h>
#include <typedefs.h>
#define remap_coreid(sih, coreid) (coreid)
#define remap_corerev(sih, corerev) (corerev)
-
+/* EROM parsing */
static uint32
get_erom_ent(si_t *sih, uint32 **eromptr, uint32 mask, uint32 match)
if (((asd & ER_TAG1) != ER_ADD) ||
(((asd & AD_SP_MASK) >> AD_SP_SHIFT) != sp) ||
((asd & AD_ST_MASK) != st)) {
-
+ /* This is not what we want, "push" it back */
(*eromptr)--;
return 0;
}
}
-
+/* parse the enumeration rom to identify all cores */
void
ai_scan(si_t *sih, void *regs, uint devid)
{
break;
case PCI_BUS:
-
+ /* Set wrappers address */
sii->curwrap = (void *)((uintptr)regs + SI_CORE_SIZE);
-
+ /* Now point the window at the erom */
OSL_PCI_WRITE_CONFIG(sii->osh, PCI_BAR0_WIN, 4, erombase);
eromptr = regs;
break;
br = FALSE;
-
+ /* Grok a component */
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));
if (((mfg == MFGID_ARM) && (cid == DEF_AI_COMP)) || (nsp == 0))
continue;
if ((nmw + nsw == 0)) {
-
+ /* A component which is not a core */
if (cid == OOB_ROUTER_CORE_ID) {
asd = get_asd(sih, &eromptr, 0, 0, AD_ST_SLAVE,
&addrl, &addrh, &sizel, &sizeh);
(mpd & MPD_MUI_MASK) >> MPD_MUI_SHIFT));
}
-
+ /* First Slave Address Descriptor should be port 0:
+ * the main register space for the core
+ */
asd = get_asd(sih, &eromptr, 0, 0, AD_ST_SLAVE, &addrl, &addrh, &sizel, &sizeh);
if (asd == 0) {
do {
-
+ /* Try again to see if it is a bridge */
asd = get_asd(sih, &eromptr, 0, 0, AD_ST_BRIDGE, &addrl, &addrh,
&sizel, &sizeh);
if (asd != 0)
}
sii->coresba[idx] = addrl;
sii->coresba_size[idx] = sizel;
-
+ /* Get any more ASDs in port 0 */
j = 1;
do {
asd = get_asd(sih, &eromptr, 0, j, AD_ST_SLAVE, &addrl, &addrh,
j++;
} while (asd != 0);
-
+ /* Go through the ASDs for other slave ports */
for (i = 1; i < nsp; i++) {
j = 0;
do {
}
}
-
+ /* Now get master wrappers */
for (i = 0; i < nmw; i++) {
asd = get_asd(sih, &eromptr, i, 0, AD_ST_MWRAP, &addrl, &addrh,
&sizel, &sizeh);
sii->wrapba[idx] = addrl;
}
-
+ /* And finally slave wrappers */
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,
}
-
+ /* Don't record bridges */
if (br)
continue;
-
+ /* Done with core */
sii->numcores++;
}
return;
}
-
+/* This function changes the logical "focus" to the indicated core.
+ * Return the current core's virtual address.
+ */
void *
ai_setcoreidx(si_t *sih, uint coreidx)
{
addr = sii->coresba[coreidx];
wrap = sii->wrapba[coreidx];
-
+ /*
+ * If the user has provided an interrupt mask enabled function,
+ * then assert interrupts are disabled before switching the core.
+ */
ASSERT((sii->intrsenabled_fn == NULL) || !(*(sii)->intrsenabled_fn)((sii)->intr_arg));
switch (BUSTYPE(sih->bustype)) {
case SI_BUS:
-
+ /* map new one */
if (!sii->regs[coreidx]) {
sii->regs[coreidx] = REG_MAP(addr, SI_CORE_SIZE);
ASSERT(GOODREGS(sii->regs[coreidx]));
nmp = (cib & CIB_NMP_MASK) >> CIB_NMP_SHIFT;
nsp = (cib & CIB_NSP_MASK) >> CIB_NSP_SHIFT;
-
+ /* scan for cores */
while (eromptr < eromlim) {
if ((get_erom_ent(sih, &eromptr, ER_TAG, ER_CI) == cia) &&
(get_erom_ent(sih, &eromptr, 0, 0) == cib)) {
}
}
-
+ /* skip master ports */
for (i = 0; i < nmp; i++)
get_erom_ent(sih, &eromptr, ER_VALID, ER_VALID);
-
+ /* Skip ASDs in port 0 */
asd = get_asd(sih, &eromptr, 0, 0, AD_ST_SLAVE, &addrl, &addrh, &sizel, &sizeh);
if (asd == 0) {
-
+ /* Try again to see if it is a bridge */
asd = get_asd(sih, &eromptr, 0, 0, AD_ST_BRIDGE, &addrl, &addrh,
&sizel, &sizeh);
}
j++;
} while (asd != 0);
-
+ /* Go through the ASDs for other slave ports */
for (i = 1; i < nsp; i++) {
j = 0;
do {
return;
}
-
+/* Return the number of address spaces in current core */
int
ai_numaddrspaces(si_t *sih)
{
return 2;
}
-
+/* Return the address of the nth address space in the current core */
uint32
ai_addrspace(si_t *sih, uint asidx)
{
}
}
-
+/* Return the size of the nth address space in the current core */
uint32
ai_addrspacesize(si_t *sih, uint asidx)
{
return (R_REG(sii->osh, &ai->oobselouta30) & 0x1f);
}
+uint
+ai_flag_alt(si_t *sih)
+{
+ si_info_t *sii;
+ aidmp_t *ai;
+
+ sii = SI_INFO(sih);
+ if (BCM47162_DMP()) {
+ SI_ERROR(("%s: Attempting to read MIPS DMP registers on 47162a0", __FUNCTION__));
+ return sii->curidx;
+ }
+ if (BCM5357_DMP()) {
+ SI_ERROR(("%s: Attempting to read USB20H DMP registers on 5357b0\n", __FUNCTION__));
+ return sii->curidx;
+ }
+ if (BCM4707_DMP()) {
+ SI_ERROR(("%s: Attempting to read CHIPCOMMONB DMP registers on 4707\n",
+ __FUNCTION__));
+ return sii->curidx;
+ }
+ ai = sii->curwrap;
+
+ return ((R_REG(sii->osh, &ai->oobselouta30) >> AI_OOBSEL_1_SHIFT) & AI_OOBSEL_MASK);
+}
+
void
ai_setint(si_t *sih, int siflag)
{
((R_REG(sii->osh, &ai->resetctrl) & AIRC_RESET) == 0));
}
-
+/*
+ * Switch to 'coreidx', issue a single arbitrary 32bit register mask&set operation,
+ * switch back to the original core, and return the new value.
+ *
+ * When using the silicon backplane, no fiddling with interrupts or core switches is needed.
+ *
+ * Also, when using pci/pcie, we can optimize away the core switching for pci registers
+ * and (on newer pci cores) chipcommon registers.
+ */
uint
ai_corereg(si_t *sih, uint coreidx, uint regoff, uint mask, uint val)
{
return 0;
if (BUSTYPE(sih->bustype) == SI_BUS) {
-
+ /* If internal bus, we can always get at everything */
fast = TRUE;
-
+ /* map if does not exist */
if (!sii->regs[coreidx]) {
sii->regs[coreidx] = REG_MAP(sii->coresba[coreidx],
SI_CORE_SIZE);
}
r = (uint32 *)((uchar *)sii->regs[coreidx] + regoff);
} else if (BUSTYPE(sih->bustype) == PCI_BUS) {
-
+ /* If pci/pcie, we can get at pci/pcie regs and on newer cores to chipc */
if ((sii->coreid[coreidx] == CC_CORE_ID) && SI_FAST(sii)) {
-
+ /* Chipc registers are mapped at 12KB */
fast = TRUE;
r = (uint32 *)((char *)sii->curmap + PCI_16KB0_CCREGS_OFFSET + regoff);
} else if (sii->pub.buscoreidx == coreidx) {
-
+ /* pci registers are at either in the last 2KB of an 8KB window
+ * or, in pcie and pci rev 13 at 8KB
+ */
fast = TRUE;
if (SI_FAST(sii))
r = (uint32 *)((char *)sii->curmap +
if (!fast) {
INTR_OFF(sii, intr_val);
-
+ /* save current core index */
origidx = si_coreidx(&sii->pub);
-
+ /* switch core */
r = (uint32*) ((uchar*) ai_setcoreidx(&sii->pub, coreidx) + regoff);
}
ASSERT(r != NULL);
-
+ /* mask and set */
if (mask || val) {
w = (R_REG(sii->osh, r) & ~mask) | val;
W_REG(sii->osh, r, w);
}
-
+ /* readback */
w = R_REG(sii->osh, r);
if (!fast) {
-
+ /* restore core index */
if (origidx != coreidx)
ai_setcoreidx(&sii->pub, origidx);
ASSERT(GOODREGS(sii->curwrap));
ai = sii->curwrap;
-
+ /* if core is already in reset, just return */
if (R_REG(sii->osh, &ai->resetctrl) & AIRC_RESET)
return;
-
+ /* ensure there are no pending backplane operations */
SPINWAIT(((status = R_REG(sii->osh, &ai->resetstatus)) != 0), 300);
-
+ /* if pending backplane ops still, try waiting longer */
if (status != 0) {
-
-
+ /* 300usecs was sufficient to allow backplane ops to clear for big hammer */
+ /* during driver load we may need more time */
SPINWAIT(((status = R_REG(sii->osh, &ai->resetstatus)) != 0), 10000);
-
-
+ /* if still pending ops, continue on and try disable anyway */
+ /* this is in big hammer path, so don't call wl_reinit in this case... */
}
W_REG(sii->osh, &ai->resetctrl, AIRC_RESET);
OSL_DELAY(10);
}
-
+/* reset and re-enable a core
+ * inputs:
+ * bits - core specific bits that are set during and after reset sequence
+ * resetbits - core specific bits that are set only during reset sequence
+ */
void
ai_core_reset(si_t *sih, uint32 bits, uint32 resetbits)
{
ASSERT(GOODREGS(sii->curwrap));
ai = sii->curwrap;
-
+ /*
+ * Must do the disable sequence first to work for arbitrary current core state.
+ */
ai_core_disable(sih, (bits | resetbits));
-
+ /*
+ * Now do the initialization sequence.
+ */
W_REG(sii->osh, &ai->ioctrl, (bits | SICF_FGC | SICF_CLOCK_EN));
dummy = R_REG(sii->osh, &ai->ioctrl);
BCM_REFERENCE(dummy);
/*
* bcmevent read-only data shared by kernel or app layers
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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 374256 2012-12-12 08:34:34Z $
+ * $Id: bcmevent.c 389384 2013-03-06 12:20:17Z $
*/
#include <typedefs.h>
#include <proto/bcmeth.h>
#include <proto/bcmevent.h>
-#if WLC_E_LAST != 108
+#if WLC_E_LAST != 125
#error "You need to add an entry to bcmevent_names[] for the new event"
#endif
{ WLC_E_UNICAST_DECODE_ERROR, "UNICAST_DECODE_ERROR" },
{ WLC_E_MULTICAST_DECODE_ERROR, "MULTICAST_DECODE_ERROR" },
{ WLC_E_TRACE, "TRACE" },
-#ifdef WLBTAMP
- { WLC_E_BTA_HCI_EVENT, "BTA_HCI_EVENT" },
-#endif
{ WLC_E_IF, "IF" },
#ifdef WLP2P
{ WLC_E_P2P_DISC_LISTEN_COMPLETE, "WLC_E_P2P_DISC_LISTEN_COMPLETE" },
{ WLC_E_ACTION_FRAME_RX, "ACTION_FRAME_RX" },
{ WLC_E_ACTION_FRAME_COMPLETE, "ACTION_FRAME_COMPLETE" },
#endif
-#if 0 && (NDISVER >= 0x0620)
+#if 0 && (0>= 0x0620)
{ WLC_E_PRE_ASSOC_IND, "ASSOC_RECV" },
{ WLC_E_PRE_REASSOC_IND, "REASSOC_RECV" },
{ WLC_E_CHANNEL_ADOPTED, "CHANNEL_ADOPTED" },
{ WLC_E_AUTH_REQ, "WLC_E_AUTH_REQ" },
{ WLC_E_IBSS_COALESCE, "IBSS COALESCE" },
#endif
-#ifdef BCMWAPI_WAI
- { WLC_E_WAI_STA_EVENT, "WAI_STA_EVENT" },
- { WLC_E_WAI_MSG, "WAI_MSG" },
-#endif /* BCMWAPI_WAI */
{ WLC_E_ESCAN_RESULT, "WLC_E_ESCAN_RESULT" },
{ WLC_E_ACTION_FRAME_OFF_CHAN_COMPLETE, "WLC_E_AF_OFF_CHAN_COMPLETE" },
#ifdef WLP2P
{ WLC_E_PKTDELAY_IND, "PKTDELAY_IND" },
#endif /* WLPKTDLYSTAT */
{ WLC_E_SERVICE_FOUND, "SERVICE_FOUND" },
+ { WLC_E_GAS_FRAGMENT_RX, "GAS_FRAGMENT_RX" },
+ { WLC_E_GAS_COMPLETE, "GAS_COMPLETE" },
{ WLC_E_P2PO_ADD_DEVICE, "P2PO_DEV_FOUND" },
- { WLC_E_P2PO_DEL_DEVICE, "P2PO_DEV_FOUND" }
+ { WLC_E_P2PO_DEL_DEVICE, "P2PO_DEV_LOST" },
+#ifdef WLWNM
+ { WLC_E_WNM_STA_SLEEP, "WMM_STA_SLEEP" },
+#endif /* WLWNM */
+#if defined(WL_PROXDETECT)
+ { WLC_E_PROXD, "WLC_E_PROXD" },
+#endif
+ { WLC_E_CCA_CHAN_QUAL, "CCA_BASED_CHANNEL_QUALITY" },
};
const int bcmevent_names_size = ARRAYSIZE(bcmevent_names);
* BCMSDH interface glue
* implement bcmsdh API for SDIOH driver
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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 369547 2012-11-19 08:57:31Z $
+ * $Id: bcmsdh.c 373331 2012-12-07 04:46:22Z $
*/
/**
#include <sdio.h> /* SDIO Device and Protocol Specs */
-#ifdef CUSTOMER_HW4
-#include <dhd_sec_feature.h>
-#endif /* CUSTOMER_HW4 */
-
#define SDIOH_API_ACCESS_RETRY_LIMIT 2
const uint bcmsdh_msglevel = BCMSDH_ERROR_VAL;
}
-#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)
{
bcmsdh->vendevid = (VENDOR_BROADCOM << 16) | 0;
return (bcmsdh->vendevid);
}
-#endif /* else BCMSPI */
uint
bcmsdh_query_iofnum(void *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)
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)
/*
* SDIO access interface for drivers - linux specific (pci only)
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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 369572 2012-11-19 12:57:59Z $
+ * $Id: bcmsdh_linux.c 384887 2013-02-13 13:23:52Z $
*/
/**
#include <bcmdefs.h>
#include <bcmdevs.h>
-#if defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID)
+#if defined(OOB_INTR_ONLY)
#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) || defined(BCMSPI_ANDROID) */
+#endif
/**
* SDIO Host Controller info
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) || defined(BCMSPI_ANDROID)
+#if defined(OOB_INTR_ONLY)
spinlock_t irq_lock;
-#endif /* defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID) */
+#endif
};
static bcmsdh_hc_t *sdhcinfo = NULL;
}
#if defined(BCMPLATFORM_BUS)
-#if defined(BCMLXSDMMC) || defined(BCMSPI_ANDROID)
+#if defined(BCMLXSDMMC)
/* forward declarations */
int bcmsdh_probe(struct device *dev);
int bcmsdh_remove(struct device *dev);
/* forward declarations */
static int __devinit bcmsdh_probe(struct device *dev);
static int __devexit bcmsdh_remove(struct device *dev);
-#endif /* defined(BCMLXSDMMC) || defined(BCMSPI_ANDROID) */
+#endif
-#if !defined(BCMLXSDMMC) && !defined(BCMSPI_ANDROID)
+#if !defined(BCMLXSDMMC)
static
-#endif /* !defined(BCMLXSDMMC) && !defined(BCMSPI_ANDROID) */
+#endif
int bcmsdh_probe(struct device *dev)
{
osl_t *osh = NULL;
- bcmsdh_hc_t *sdhc = NULL;
+ bcmsdh_hc_t *sdhc = NULL, *sdhc_org = sdhcinfo;
ulong regs = 0;
bcmsdh_info_t *sdh = NULL;
-#if !defined(BCMLXSDMMC) && defined(BCMPLATFORM_BUS) && !defined(BCMSPI_ANDROID)
+#if !defined(BCMLXSDMMC) && defined(BCMPLATFORM_BUS)
struct platform_device *pdev;
struct resource *r;
-#endif /* !defined(BCMLXSDMMC) && defined(BCMPLATFORM_BUS) && !defined(BCMSPI_ANDROID) */
+#endif
int irq = 0;
uint32 vendevid;
unsigned long irq_flags = 0;
-#if !defined(BCMLXSDMMC) && defined(BCMPLATFORM_BUS) && !defined(BCMSPI_ANDROID)
+#if !defined(BCMLXSDMMC) && defined(BCMPLATFORM_BUS)
pdev = to_platform_device(dev);
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
irq = platform_get_irq(pdev, 0);
if (!r || irq < 0)
return -ENXIO;
-#endif /* !defined(BCMLXSDMMC) && defined(BCMPLATFORM_BUS) && !defined(BCMSPI_ANDROID) */
+#endif
-#if defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID)
+#if defined(OOB_INTR_ONLY)
#ifdef HW_OOB
irq_flags =
IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL | IORESOURCE_IRQ_SHAREABLE;
SDLX_MSG(("%s: Host irq is not defined\n", __FUNCTION__));
goto err;
}
-#endif /* defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID) */
+#endif
/* allocate SDIO Host Controller state info */
if (!(osh = osl_attach(dev, PCI_BUS, FALSE))) {
SDLX_MSG(("%s: osl_attach failed\n", __FUNCTION__));
sdhc->dev = (void *)dev;
-#if defined(BCMLXSDMMC) || defined(BCMSPI_ANDROID)
+#if defined(BCMLXSDMMC)
if (!(sdh = bcmsdh_attach(osh, (void *)0,
(void **)®s, irq))) {
SDLX_MSG(("%s: bcmsdh_attach failed\n", __FUNCTION__));
SDLX_MSG(("%s: bcmsdh_attach failed\n", __FUNCTION__));
goto err;
}
-#endif /* defined(BCMLXSDMMC) || defined(BCMSPI_ANDROID) */
+#endif
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) || defined(BCMSPI_ANDROID)
+#if defined(OOB_INTR_ONLY)
spin_lock_init(&sdhc->irq_lock);
-#endif /* defined(BCMLXSDMMC) || defined(BCMSPI_ANDROID) */
+#endif
/* chain SDIO Host Controller info together */
sdhc->next = sdhcinfo;
if (sdhc->sdh)
bcmsdh_detach(sdhc->osh, sdhc->sdh);
MFREE(osh, sdhc, sizeof(bcmsdh_hc_t));
+ sdhcinfo = sdhc_org;
}
if (osh)
osl_detach(osh);
return -ENODEV;
}
-#if !defined(BCMLXSDMMC) && !defined(BCMSPI_ANDROID)
+#if !defined(BCMLXSDMMC)
static
-#endif /* !defined(BCMLXSDMMC) && !defined(BCMSPI_ANDROID) */
+#endif
int bcmsdh_remove(struct device *dev)
{
bcmsdh_hc_t *sdhc, *prev;
osl_t *osh;
-
- sdhc = sdhcinfo;
- drvinfo.detach(sdhc->ch);
- bcmsdh_detach(sdhc->osh, sdhc->sdh);
-
-#if !defined(CONFIG_HAS_WAKELOCK) && (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 36))
- if (pm_dev) {
- device_init_wakeup(pm_dev, 0);
- pm_dev = NULL;
- }
-#endif /* !CONFIG_HAS_WAKELOCK */
+ int sdhcinfo_null = false;
/* find the SDIO Host Controller state for this pdev and take it out from the list */
for (sdhc = sdhcinfo, prev = NULL; sdhc; sdhc = sdhc->next) {
if (sdhc->dev == (void *)dev) {
if (prev)
prev->next = sdhc->next;
- else
- sdhcinfo = NULL;
+ else {
+ if (sdhc->next != NULL) {
+ SDLX_MSG(("%s: more SDHC exist, should be care about it\n",
+ __FUNCTION__));
+ }
+ sdhcinfo_null = true;
+ }
break;
}
prev = sdhc;
return 0;
}
+ /* detach ch & sdhc if dev is valid */
+ drvinfo.detach(sdhc->ch);
+ bcmsdh_detach(sdhc->osh, sdhc->sdh);
+
+#if !defined(CONFIG_HAS_WAKELOCK) && (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 36))
+ if (pm_dev) {
+ device_init_wakeup(pm_dev, 0);
+ pm_dev = NULL;
+ }
+#endif /* !CONFIG_HAS_WAKELOCK */
+
+ if (sdhcinfo_null == true)
+ sdhcinfo = NULL;
+
/* release SDIO Host Controller info */
osh = sdhc->osh;
MFREE(osh, sdhc, sizeof(bcmsdh_hc_t));
osl_detach(osh);
-#if !defined(BCMLXSDMMC) || defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID)
+#if !defined(BCMLXSDMMC) || defined(OOB_INTR_ONLY)
dev_set_drvdata(dev, NULL);
-#endif /* !defined(BCMLXSDMMC) || defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID) */
+#endif
return 0;
}
#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);
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) */
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)
if (bcmsdh_pci_driver.node.next)
#endif
-#ifdef BCMSPI_ANDROID
- spi_function_cleanup();
-#endif /* BCMSPI_ANDROID */
#if defined(BCMLXSDMMC)
sdio_function_cleanup();
#endif /* BCMLXSDMMC */
#endif /* BCMPLATFORM_BUS */
}
-#if defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID)
+#if defined(OOB_INTR_ONLY)
void bcmsdh_oob_intr_set(bool enable)
{
static bool curstate = 1;
if (error)
return -ENODEV;
- error = 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 = flag;
if (flag) {
enable_irq(sdhcinfo->oob_irq);
- enable_irq_wake(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_wake(sdhcinfo->oob_irq);
disable_irq(sdhcinfo->oob_irq);
}
}
sdhcinfo->oob_irq_registered = FALSE;
}
}
-#endif /* defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID) */
+#endif
#if defined(BCMLXSDMMC)
void *bcmsdh_get_drvdata(void)
/*
* BCMSDH Function Driver for the native SDIO/MMC driver in the Linux Kernel
*
- * Copyright (C) 1999-2012, Broadcom Corporation
- *
+ * Copyright (C) 1999-2013, 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
* 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 372377 2012-12-03 12:24:59Z $
+ * $Id: bcmsdh_sdmmc.c 401922 2013-05-14 02:33:11Z $
*/
#include <typedefs.h>
sd->client_block_size[1] = 64;
err_ret = sdio_set_block_size(gInstance->func[1], 64);
+ /* Release host controller F1 */
+ sdio_release_host(gInstance->func[1]);
if (err_ret) {
sd_err(("bcmsdh_sdmmc: Failed to set F1 blocksize\n"));
+ MFREE(sd->osh, sd, sizeof(sdioh_info_t));
+ return NULL;
}
- /* Release host controller F1 */
- sdio_release_host(gInstance->func[1]);
} else {
sd_err(("%s:gInstance->func[1] is null\n", __FUNCTION__));
MFREE(sd->osh, sd, sizeof(sdioh_info_t));
sd->client_block_size[2] = sd_f2_blocksize;
err_ret = sdio_set_block_size(gInstance->func[2], sd_f2_blocksize);
+ /* Release host controller F2 */
+ sdio_release_host(gInstance->func[2]);
if (err_ret) {
sd_err(("bcmsdh_sdmmc: Failed to set F2 blocksize to %d\n",
sd_f2_blocksize));
+ MFREE(sd->osh, sd, sizeof(sdioh_info_t));
+ return NULL;
}
- /* Release host controller F2 */
- sdio_release_host(gInstance->func[2]);
} else {
sd_err(("%s:gInstance->func[2] is null\n", __FUNCTION__));
MFREE(sd->osh, sd, sizeof(sdioh_info_t));
return SDIOH_API_RC_FAIL;
}
- /* Enable F1 and F2 interrupts, set master enable */
- reg |= (INTR_CTL_FUNC1_EN | INTR_CTL_FUNC2_EN | INTR_CTL_MASTER_EN);
-
+ /* Enable F1 and F2 interrupts, clear master enable */
+ reg &= ~INTR_CTL_MASTER_EN;
+ reg |= (INTR_CTL_FUNC1_EN | INTR_CTL_FUNC2_EN);
sdio_writeb(gInstance->func[0], reg, SDIOD_CCCR_INTEN, &err);
sdio_release_host(gInstance->func[0]);
/* Now set it */
si->client_block_size[func] = blksize;
-#if defined(CUSTOMER_HW4) && defined(USE_DYNAMIC_F2_BLKSIZE)
- if (gInstance == NULL || gInstance->func[func] == NULL) {
- sd_err(("%s: SDIO Device not present\n", __FUNCTION__));
- bcmerror = BCME_NORESOURCE;
- break;
- }
- 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));
- sdio_release_host(gInstance->func[func]);
-#endif /* CUSTOMER_HW4 && USE_DYNAMIC_F2_BLKSIZE */
break;
}
return SDIOH_API_RC_SUCCESS;
}
-
extern SDIOH_API_RC
sdioh_request_byte(sdioh_info_t *sd, uint rw, uint func, uint regaddr, uint8 *byte)
{
#if defined(MMC_SDIO_ABORT)
/* to allow abort command through F1 */
else if (regaddr == SDIOD_CCCR_IOABORT) {
- /* Because of SDIO3.0 host issue on Manta,
- * sometimes the abort fails.
- * Retrying again will fix this issue.
- */
while (sdio_abort_retry--) {
if (gInstance->func[func]) {
sdio_claim_host(gInstance->func[func]);
}
if (err_ret) {
- if (regaddr != 0x1001F && err_ret != -110)
+ if ((regaddr == 0x1001F) && (err_ret == -110)) {
+ } else {
sd_err(("bcmsdh_sdmmc: Failed to %s byte F%d:@0x%05x=%02x, Err: %d\n",
rw ? "Write" : "Read", func, regaddr, *byte, err_ret));
+ }
}
return ((err_ret == 0) ? SDIOH_API_RC_SUCCESS : SDIOH_API_RC_FAIL);
DHD_PM_RESUME_WAIT(sdioh_request_word_wait);
DHD_PM_RESUME_RETURN_ERROR(SDIOH_API_RC_FAIL);
-
/* Claim host controller */
sdio_claim_host(gInstance->func[func]);
sdioh_glom_clear(sdioh_info_t *sd)
{
void *pnow, *pnext;
- uint8 i = 0;
pnext = sd->glom_info.glom_pkt_head;
pnext = PKTNEXT(sd->osh, pnow);
PKTSETNEXT(sd->osh, pnow, NULL);
sd->glom_info.count--;
- i++;
}
sd->glom_info.glom_pkt_head = NULL;
bool fifo = (fix_inc == SDIOH_DATA_FIX);
uint32 SGCount = 0;
int err_ret = 0;
- void *pnext, *pprev;
+ void *pnext;
uint ttl_len, dma_len, lft_len, xfred_len, pkt_len;
uint blk_num;
int blk_size;
memset(&mmc_dat, 0, sizeof(struct mmc_data));
/* Set up DMA descriptors */
- pprev = pkt;
for (pnext = pkt;
pnext && dma_len;
pnext = PKTNEXT(sd->osh, pnext)) {
mmc_req.cmd = &mmc_cmd;
mmc_req.data = &mmc_dat;
-
sdio_claim_host(gInstance->func[func]);
mmc_set_data_timeout(&mmc_dat, gInstance->func[func]->card);
mmc_wait_for_req(gInstance->func[func]->card->host, &mmc_req);
sdio_release_host(gInstance->func[func]);
-
err_ret = mmc_cmd.error? mmc_cmd.error : mmc_dat.error;
if (0 != err_ret) {
sd_err(("%s:CMD53 %s failed with code %d\n",
__FUNCTION__,
write ? "write" : "read",
err_ret));
- sd_err(("%s:Disabling rxchain and fire it with PIO\n",
- __FUNCTION__));
- sd->use_rxchain = FALSE;
- pkt = pprev;
- lft_len = ttl_len;
- } else if (!fifo) {
+ }
+ if (!fifo) {
addr = addr + ttl_len - lft_len - dma_len;
}
}
else if (pkt_len % blk_size)
pkt_len += blk_size - (pkt_len % blk_size);
-#if defined(CUSTOMER_HW4) && defined(USE_DYNAMIC_F2_BLKSIZE)
- if (write && pkt_len > 64 && (pkt_len % 64) == 32)
- pkt_len += 32;
-#endif /* CUSTOMER_HW4 && USE_DYNAMIC_F2_BLKSIZE */
#ifdef CONFIG_MMC_MSM7X00A
if ((pkt_len % 64) == 32) {
sd_trace(("%s: Rounding up TX packet +=32\n", __FUNCTION__));
*/
extern SDIOH_API_RC
sdioh_request_buffer(sdioh_info_t *sd, uint pio_dma, uint fix_inc, uint write, uint func,
- uint addr, uint reg_width, uint buflen_u, uint8 *buffer, void *pkt)
+ uint addr, uint reg_width, uint buflen_u, uint8 *buffer, void *pkt)
{
SDIOH_API_RC Status;
- void *mypkt = NULL;
+ void *tmppkt;
+ void *orig_buf = NULL;
+ uint copylen = 0;
sd_trace(("%s: Enter\n", __FUNCTION__));
DHD_PM_RESUME_WAIT(sdioh_request_buffer_wait);
DHD_PM_RESUME_RETURN_ERROR(SDIOH_API_RC_FAIL);
- /* Case 1: we don't have a packet. */
- if (pkt == NULL) {
- sd_data(("%s: Creating new %s Packet, len=%d\n",
- __FUNCTION__, write ? "TX" : "RX", buflen_u));
-#ifdef CONFIG_DHD_USE_STATIC_BUF
- if (!(mypkt = PKTGET_STATIC(sd->osh, buflen_u, write ? TRUE : FALSE))) {
-#else
- if (!(mypkt = PKTGET(sd->osh, buflen_u, write ? TRUE : FALSE))) {
-#endif /* CONFIG_DHD_USE_STATIC_BUF */
- sd_err(("%s: PKTGET failed: len %d\n",
- __FUNCTION__, buflen_u));
- return SDIOH_API_RC_FAIL;
- }
-
- /* For a write, copy the buffer data into the packet. */
- if (write) {
- bcopy(buffer, PKTDATA(sd->osh, mypkt), buflen_u);
- }
- Status = sdioh_request_packet(sd, fix_inc, write, func, addr, mypkt);
-
- /* For a read, copy the packet data back to the buffer. */
- if (!write) {
- bcopy(PKTDATA(sd->osh, mypkt), buffer, buflen_u);
- }
-#ifdef CONFIG_DHD_USE_STATIC_BUF
- PKTFREE_STATIC(sd->osh, mypkt, write ? TRUE : FALSE);
-#else
- PKTFREE(sd->osh, mypkt, write ? TRUE : FALSE);
-#endif /* CONFIG_DHD_USE_STATIC_BUF */
- } else if (((ulong)(PKTDATA(sd->osh, pkt)) & DMA_ALIGN_MASK) != 0) {
- /* Case 2: We have a packet, but it is unaligned. */
-
- /* In this case, we cannot have a chain. */
+ if (pkt == NULL) {
+ /* Case 1: we don't have a packet. */
+ orig_buf = buffer;
+ copylen = buflen_u;
+ } else if ((ulong)PKTDATA(sd->osh, pkt) & DMA_ALIGN_MASK) {
+ /* Case 2: We have a packet, but it is unaligned.
+ * in this case, we cannot have a chain.
+ */
ASSERT(PKTNEXT(sd->osh, pkt) == NULL);
- sd_data(("%s: Creating aligned %s Packet, len=%d\n",
- __FUNCTION__, write ? "TX" : "RX", PKTLEN(sd->osh, pkt)));
-#ifdef CONFIG_DHD_USE_STATIC_BUF
- if (!(mypkt = PKTGET_STATIC(sd->osh, PKTLEN(sd->osh, pkt), write ? TRUE : FALSE))) {
-#else
- if (!(mypkt = PKTGET(sd->osh, PKTLEN(sd->osh, pkt), write ? TRUE : FALSE))) {
-#endif /* CONFIG_DHD_USE_STATIC_BUF */
- sd_err(("%s: PKTGET failed: len %d\n",
- __FUNCTION__, PKTLEN(sd->osh, pkt)));
+ orig_buf = PKTDATA(sd->osh, pkt);
+ copylen = PKTLEN(sd->osh, pkt);
+ }
+
+ tmppkt = pkt;
+ if (copylen) {
+ tmppkt = PKTGET_STATIC(sd->osh, copylen, write ? TRUE : FALSE);
+ if (tmppkt == NULL) {
+ sd_err(("%s: PKTGET failed: len %d\n", __FUNCTION__, copylen));
return SDIOH_API_RC_FAIL;
}
-
/* For a write, copy the buffer data into the packet. */
- if (write) {
- bcopy(PKTDATA(sd->osh, pkt),
- PKTDATA(sd->osh, mypkt),
- PKTLEN(sd->osh, pkt));
- }
+ if (write)
+ bcopy(orig_buf, PKTDATA(sd->osh, tmppkt), copylen);
+ }
- Status = sdioh_request_packet(sd, fix_inc, write, func, addr, mypkt);
+ Status = sdioh_request_packet(sd, fix_inc, write, func, addr, tmppkt);
+ if (copylen) {
/* For a read, copy the packet data back to the buffer. */
- if (!write) {
- bcopy(PKTDATA(sd->osh, mypkt),
- PKTDATA(sd->osh, pkt),
- PKTLEN(sd->osh, mypkt));
- }
-#ifdef CONFIG_DHD_USE_STATIC_BUF
- PKTFREE_STATIC(sd->osh, mypkt, write ? TRUE : FALSE);
-#else
- PKTFREE(sd->osh, mypkt, write ? TRUE : FALSE);
-#endif /* CONFIG_DHD_USE_STATIC_BUF */
- } else { /* case 3: We have a packet and it is aligned. */
- sd_data(("%s: Aligned %s Packet, direct DMA\n",
- __FUNCTION__, write ? "Tx" : "Rx"));
- Status = sdioh_request_packet(sd, fix_inc, write, func, addr, pkt);
+ if (!write)
+ bcopy(PKTDATA(sd->osh, tmppkt), orig_buf, PKTLEN(sd->osh, tmppkt));
+ PKTFREE_STATIC(sd->osh, tmppkt, write ? TRUE : FALSE);
}
return (Status);
/*
* BCMSDH Function Driver for the native SDIO/MMC driver in the Linux Kernel
*
- * Copyright (C) 1999-2012, Broadcom Corporation
- *
+ * Copyright (C) 1999-2013, 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
* 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 374530 2012-12-13 14:38:23Z $
+ * $Id: bcmsdh_sdmmc_linux.c 383841 2013-02-08 00:10:58Z $
*/
#include <typedefs.h>
#endif
sd_trace(("F2 found, calling bcmsdh_probe...\n"));
ret = bcmsdh_probe(&func->dev);
+ if (ret < 0 && gInstance)
+ gInstance->func[2] = NULL;
+
if (mmc_power_save_host(func->card->host))
sd_err(("%s: card power save fail", __func__));
}
if (func->num != 2)
return 0;
-#ifdef CUSTOMER_HW4
- sd_err(("%s Enter\n", __FUNCTION__));
-#else
sd_trace(("%s Enter\n", __FUNCTION__));
-#endif
if (dhd_os_check_wakelock(bcmsdh_get_drvdata()))
return -EBUSY;
sdio_flags = sdio_get_host_pm_caps(func);
sd_err(("%s: error while trying to keep power\n", __FUNCTION__));
return ret;
}
-#if defined(OOB_INTR_ONLY) && !defined(CUSTOMER_HW4)
+#if defined(OOB_INTR_ONLY)
bcmsdh_oob_intr_set(0);
-#endif /* OOB_INTR_ONLY && !CUSTOMER_HW4 */
+#endif
dhd_mmc_suspend = TRUE;
smp_mb();
static int bcmsdh_sdmmc_resume(struct device *pdev)
{
-#if defined(OOB_INTR_ONLY) && !defined(CUSTOMER_HW4)
+#if defined(OOB_INTR_ONLY)
struct sdio_func *func = dev_to_sdio_func(pdev);
-#endif /* OOB_INTR_ONLY && !CUSTOMER_HW4 */
-#ifdef CUSTOMER_HW4
- sd_err(("%s Enter\n", __FUNCTION__));
-#else
- sd_trace(("%s Enter\n", __FUNCTION__));
#endif
+ sd_trace(("%s Enter\n", __FUNCTION__));
dhd_mmc_suspend = FALSE;
-#if defined(OOB_INTR_ONLY) && !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 && !CUSTOMER_HW4 */
+#endif
smp_mb();
return 0;
return -ENOMEM;
error = sdio_register_driver(&bcmsdh_sdmmc_driver);
- if (error && gInstance) {
+ if (error) {
kfree(gInstance);
gInstance = NULL;
}
/*
* Driver O/S-independent utility routines
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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 367039 2012-11-06 11:31:19Z $
+ * $Id: bcmutils.c 380908 2013-01-24 12:26:18Z $
*/
#include <bcm_cfg.h>
"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 */
"UNDEF"
};
}
printf("\n");
}
+
+/* Look for vendor-specific IE with specified OUI and optional type */
+bcm_tlv_t *
+find_vendor_ie(void *tlvs, int tlvs_len, const char *voui, uint8 *type, int type_len)
+{
+ bcm_tlv_t *ie;
+ uint8 ie_len;
+
+ ie = (bcm_tlv_t*)tlvs;
+
+ /* make sure we are looking at a valid IE */
+ if (ie == NULL ||
+ !bcm_valid_tlv(ie, tlvs_len))
+ return NULL;
+
+ /* Walk through the IEs looking for an OUI match */
+ do {
+ ie_len = ie->len;
+ if ((ie->id == DOT11_MNG_PROPR_ID) &&
+ (ie_len >= (DOT11_OUI_LEN + type_len)) &&
+ !bcmp(ie->data, voui, DOT11_OUI_LEN))
+ {
+ /* compare optional type */
+ if (type_len == 0 ||
+ !bcmp(&ie->data[DOT11_OUI_LEN], type, type_len)) {
+ return (ie); /* a match */
+ }
+ }
+ } while ((ie = bcm_next_tlv(ie, &tlvs_len)) != NULL);
+
+ return NULL;
+}
+
#if defined(WLTINYDUMP) || defined(WLMSG_INFORM) || defined(WLMSG_ASSOC) || \
defined(WLMSG_PRPKT) || defined(WLMSG_WSEC)
#define SSID_FMT_BUF_LEN ((4 * DOT11_MAX_SSID_LEN) + 1)
return buf_len;
}
+
+/* calculate a * b + c */
+void
+bcm_uint64_multiple_add(uint32* r_high, uint32* r_low, uint32 a, uint32 b, uint32 c)
+{
+#define FORMALIZE(var) {cc += (var & 0x80000000) ? 1 : 0; var &= 0x7fffffff;}
+ uint32 r1, r0;
+ uint32 a1, a0, b1, b0, t, cc = 0;
+
+ a1 = a >> 16;
+ a0 = a & 0xffff;
+ b1 = b >> 16;
+ b0 = b & 0xffff;
+
+ r0 = a0 * b0;
+ FORMALIZE(r0);
+
+ t = (a1 * b0) << 16;
+ FORMALIZE(t);
+
+ r0 += t;
+ FORMALIZE(r0);
+
+ t = (a0 * b1) << 16;
+ FORMALIZE(t);
+
+ r0 += t;
+ FORMALIZE(r0);
+
+ FORMALIZE(c);
+
+ r0 += c;
+ FORMALIZE(r0);
+
+ r0 |= (cc % 2) ? 0x80000000 : 0;
+ r1 = a1 * b1 + ((a1 * b0) >> 16) + ((b1 * a0) >> 16) + (cc / 2);
+
+ *r_high = r1;
+ *r_low = r0;
+}
+
+/* calculate a / b */
+void
+bcm_uint64_divide(uint32* r, uint32 a_high, uint32 a_low, uint32 b)
+{
+ uint32 a1 = a_high, a0 = a_low, r0 = 0;
+
+ if (b < 2)
+ return;
+
+ while (a1 != 0) {
+ r0 += (0xffffffff / b) * a1;
+ bcm_uint64_multiple_add(&a1, &a0, ((0xffffffff % b) + 1) % b, a1, a0);
+ }
+
+ r0 += a0 / b;
+ *r = r0;
+}
+
+#ifndef setbit /* As in the header file */
+#ifdef BCMUTILS_BIT_MACROS_USE_FUNCS
+/* Set bit in byte array. */
+void
+setbit(void *array, uint bit)
+{
+ ((uint8 *)array)[bit / NBBY] |= 1 << (bit % NBBY);
+}
+
+/* Clear bit in byte array. */
+void
+clrbit(void *array, uint bit)
+{
+ ((uint8 *)array)[bit / NBBY] &= ~(1 << (bit % NBBY));
+}
+
+/* Test if bit is set in byte array. */
+bool
+isset(const void *array, uint bit)
+{
+ return (((const uint8 *)array)[bit / NBBY] & (1 << (bit % NBBY)));
+}
+
+/* Test if bit is clear in byte array. */
+bool
+isclr(const void *array, uint bit)
+{
+ return ((((const uint8 *)array)[bit / NBBY] & (1 << (bit % NBBY))) == 0);
+}
+#endif /* BCMUTILS_BIT_MACROS_USE_FUNCS */
+#endif /* setbit */
* Contents are wifi-specific, used by any kernel or app-level
* software that might want wifi things as it grows.
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
#include <bcm_cfg.h>
#include <typedefs.h>
+#include <bcmutils.h>
#ifdef BCMDRIVER
#include <osl.h>
-#include <bcmutils.h>
#define strtoul(nptr, endptr, base) bcm_strtoul((nptr), (endptr), (base))
#define tolower(c) (bcm_isupper((c)) ? ((c) + 'a' - 'A') : (c))
#else
#ifndef ASSERT
#define ASSERT(exp)
#endif
-#endif
+#endif /* BCMDRIVER */
#ifdef _bcmwifi_c_
-
+/* temporary for transitional compatibility */
#include <bcmwifi.h>
#else
#include <bcmwifi_channels.h>
#endif
#if defined(WIN32) && (defined(BCMDLL) || defined(WLMDLL))
-#include <bcmstdlib.h>
+#include <bcmstdlib.h> /* For wl/exe/GNUmakefile.brcm_wlu and GNUmakefile.wlm_dll */
#endif
#ifndef D11AC_IOTYPES
+/* Definitions for legacy Chanspec type */
+/* Chanspec ASCII representation:
+ * <channel><band><bandwidth><ctl-sideband>
+ * digit [AB] [N] [UL]
+ *
+ * <channel>: channel number of the 10MHz or 20MHz channel,
+ * or control sideband channel of 40MHz channel.
+ * <band>: A for 5GHz, B for 2.4GHz
+ * <bandwidth>: N for 10MHz, nothing for 20MHz or 40MHz
+ * (ctl-sideband spec implies 40MHz)
+ * <ctl-sideband>: U for upper, L for lower
+ *
+ * <band> may be omitted on input, and will be assumed to be
+ * 2.4GHz if channel number <= 14.
+ *
+ * Examples:
+ * 8 -> 2.4GHz channel 8, 20MHz
+ * 8b -> 2.4GHz channel 8, 20MHz
+ * 8l -> 2.4GHz channel 8, 40MHz, lower ctl sideband
+ * 8a -> 5GHz channel 8 (low 5 GHz band), 20MHz
+ * 36 -> 5GHz channel 36, 20MHz
+ * 36l -> 5GHz channel 36, 40MHz, lower ctl sideband
+ * 40u -> 5GHz channel 40, 40MHz, upper ctl sideband
+ * 180n -> channel 180, 10MHz
+ */
-
-
-
+/* given a chanspec and a string buffer, format the chanspec as a
+ * string, and return the original pointer a.
+ * Min buffer length must be CHANSPEC_STR_LEN.
+ * On error return NULL
+ */
char *
wf_chspec_ntoa(chanspec_t chspec, char *buf)
{
bw = "";
sb = "";
channel = CHSPEC_CHANNEL(chspec);
-
+ /* check for non-default band spec */
if ((CHSPEC_IS2G(chspec) && channel > CH_MAX_2G_CHANNEL) ||
(CHSPEC_IS5G(chspec) && channel <= CH_MAX_2G_CHANNEL))
band = (CHSPEC_IS2G(chspec)) ? "b" : "a";
bw = "n";
}
-
+ /* Outputs a max of 6 chars including '\0' */
snprintf(buf, 6, "%d%s%s%s", channel, band, bw, sb);
return (buf);
}
-
+/* given a chanspec string, convert to a chanspec.
+ * On error return 0
+ */
chanspec_t
wf_chspec_aton(const char *a)
{
channel = strtoul(a, &endp, 10);
-
+ /* check for no digits parsed */
if (endp == a)
return 0;
if (c == '\0')
goto done;
-
+ /* parse the optional ['A' | 'B'] band spec */
if (c == 'a' || c == 'b') {
band = (c == 'a') ? WL_CHANSPEC_BAND_5G : WL_CHANSPEC_BAND_2G;
a++;
goto done;
}
-
+ /* parse bandwidth 'N' (10MHz) or 40MHz ctl sideband ['L' | 'U'] */
if (c == 'n') {
bw = WL_CHANSPEC_BW_10;
} else if (c == 'l') {
bw = WL_CHANSPEC_BW_40;
ctl_sb = WL_CHANSPEC_CTL_SB_LOWER;
-
+ /* adjust channel to center of 40MHz band */
if (channel <= (MAXCHANNEL - CH_20MHZ_APART))
channel += CH_10MHZ_APART;
else
} else if (c == 'u') {
bw = WL_CHANSPEC_BW_40;
ctl_sb = WL_CHANSPEC_CTL_SB_UPPER;
-
+ /* adjust channel to center of 40MHz band */
if (channel > CH_20MHZ_APART)
channel -= CH_10MHZ_APART;
else
return (channel | band | bw | ctl_sb);
}
-
+/*
+ * Verify the chanspec is using a legal set of parameters, i.e. that the
+ * chanspec specified a band, bw, ctl_sb and channel and that the
+ * combination could be legal given any set of circumstances.
+ * RETURNS: TRUE is the chanspec is malformed, false if it looks good.
+ */
bool
wf_chspec_malformed(chanspec_t chanspec)
{
-
+ /* must be 2G or 5G band */
if (!CHSPEC_IS5G(chanspec) && !CHSPEC_IS2G(chanspec))
return TRUE;
-
+ /* must be 20 or 40 bandwidth */
if (!CHSPEC_IS40(chanspec) && !CHSPEC_IS20(chanspec))
return TRUE;
-
+ /* 20MHZ b/w must have no ctl sb, 40 must have a ctl sb */
if (CHSPEC_IS20(chanspec)) {
if (!CHSPEC_SB_NONE(chanspec))
return TRUE;
return FALSE;
}
-
+/*
+ * This function returns the channel number that control traffic is being sent on, for legacy
+ * channels this is just the channel number, for 40MHZ channels it is the upper or lower 20MHZ
+ * sideband depending on the chanspec selected
+ */
uint8
wf_chspec_ctlchan(chanspec_t chspec)
{
uint8 ctl_chan;
-
+ /* Is there a sideband ? */
if (CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_NONE) {
return CHSPEC_CHANNEL(chspec);
} else {
-
+ /* we only support 40MHZ with sidebands */
ASSERT(CHSPEC_BW(chspec) == WL_CHANSPEC_BW_40);
-
+ /* chanspec channel holds the centre frequency, use that and the
+ * side band information to reconstruct the control channel number
+ */
if (CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_UPPER) {
-
+ /* control chan is the upper 20 MHZ SB of the 40MHZ channel */
ctl_chan = UPPER_20_SB(CHSPEC_CHANNEL(chspec));
} else {
ASSERT(CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_LOWER);
-
+ /* control chan is the lower 20 MHZ SB of the 40MHZ channel */
ctl_chan = LOWER_20_SB(CHSPEC_CHANNEL(chspec));
}
}
ASSERT(!wf_chspec_malformed(chspec));
-
+ /* Is there a sideband ? */
if (CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_NONE) {
return chspec;
} else {
return ctl_chspec;
}
-#else
-
-
-
+#else /* D11AC_IOTYPES */
+/* Definitions for D11AC capable Chanspec type */
+/* Chanspec ASCII representation with 802.11ac capability:
+ * [<band> 'g'] <channel> ['/'<bandwidth> [<ctl-sideband>]['/'<1st80channel>'-'<2nd80channel>]]
+ *
+ * <band>:
+ * (optional) 2, 3, 4, 5 for 2.4GHz, 3GHz, 4GHz, and 5GHz respectively.
+ * Default value is 2g if channel <= 14, otherwise 5g.
+ * <channel>:
+ * channel number of the 5MHz, 10MHz, 20MHz channel,
+ * or primary channel of 40MHz, 80MHz, 160MHz, or 80+80MHz channel.
+ * <bandwidth>:
+ * (optional) 5, 10, 20, 40, 80, 160, or 80+80. Default value is 20.
+ * <primary-sideband>:
+ * (only for 2.4GHz band 40MHz) U for upper sideband primary, L for lower.
+ *
+ * For 2.4GHz band 40MHz channels, the same primary channel may be the
+ * upper sideband for one 40MHz channel, and the lower sideband for an
+ * overlapping 40MHz channel. The U/L disambiguates which 40MHz channel
+ * is being specified.
+ *
+ * For 40MHz in the 5GHz band and all channel bandwidths greater than
+ * 40MHz, the U/L specificaion is not allowed since the channels are
+ * non-overlapping and the primary sub-band is derived from its
+ * position in the wide bandwidth channel.
+ *
+ * <1st80Channel>:
+ * <2nd80Channel>:
+ * Required for 80+80, otherwise not allowed.
+ * Specifies the center channel of the first and second 80MHz band.
+ *
+ * In its simplest form, it is a 20MHz channel number, with the implied band
+ * of 2.4GHz if channel number <= 14, and 5GHz otherwise.
+ *
+ * To allow for backward compatibility with scripts, the old form for
+ * 40MHz channels is also allowed: <channel><ctl-sideband>
+ *
+ * <channel>:
+ * primary channel of 40MHz, channel <= 14 is 2GHz, otherwise 5GHz
+ * <ctl-sideband>:
+ * "U" for upper, "L" for lower (or lower case "u" "l")
+ *
+ * 5 GHz Examples:
+ * Chanspec BW Center Ch Channel Range Primary Ch
+ * 5g8 20MHz 8 - -
+ * 52 20MHz 52 - -
+ * 52/40 40MHz 54 52-56 52
+ * 56/40 40MHz 54 52-56 56
+ * 52/80 80MHz 58 52-64 52
+ * 56/80 80MHz 58 52-64 56
+ * 60/80 80MHz 58 52-64 60
+ * 64/80 80MHz 58 52-64 64
+ * 52/160 160MHz 50 36-64 52
+ * 36/160 160MGz 50 36-64 36
+ * 36/80+80/42-106 80+80MHz 42,106 36-48,100-112 36
+ *
+ * 2 GHz Examples:
+ * Chanspec BW Center Ch Channel Range Primary Ch
+ * 2g8 20MHz 8 - -
+ * 8 20MHz 8 - -
+ * 6 20MHz 6 - -
+ * 6/40l 40MHz 8 6-10 6
+ * 6l 40MHz 8 6-10 6
+ * 6/40u 40MHz 4 2-6 6
+ * 6u 40MHz 4 2-6 6
+ */
+/* bandwidth ASCII string */
static const char *wf_chspec_bw_str[] =
{
"5",
#define WF_NUM_BW \
(sizeof(wf_chspec_bw_mhz)/sizeof(uint8))
-
+/* 40MHz channels in 5GHz band */
static const uint8 wf_5g_40m_chans[] =
{38, 46, 54, 62, 102, 110, 118, 126, 134, 142, 151, 159};
#define WF_NUM_5G_40M_CHANS \
(sizeof(wf_5g_40m_chans)/sizeof(uint8))
-
+/* 80MHz channels in 5GHz band */
static const uint8 wf_5g_80m_chans[] =
{42, 58, 106, 122, 138, 155};
#define WF_NUM_5G_80M_CHANS \
(sizeof(wf_5g_80m_chans)/sizeof(uint8))
-
+/* 160MHz channels in 5GHz band */
static const uint8 wf_5g_160m_chans[] =
{50, 114};
#define WF_NUM_5G_160M_CHANS \
(sizeof(wf_5g_160m_chans)/sizeof(uint8))
-
+/* convert bandwidth from chanspec to MHz */
static uint
bw_chspec_to_mhz(chanspec_t chspec)
{
return (bw >= WF_NUM_BW ? 0 : wf_chspec_bw_mhz[bw]);
}
-
+/* bw in MHz, return the channel count from the center channel to the
+ * the channel at the edge of the band
+ */
static uint8
center_chan_to_edge(uint bw)
{
-
+ /* edge channels separated by BW - 10MHz on each side
+ * delta from cf to edge is half of that,
+ * MHz to channel num conversion is 5MHz/channel
+ */
return (uint8)(((bw - 20) / 2) / 5);
}
-
+/* return channel number of the low edge of the band
+ * given the center channel and BW
+ */
static uint8
channel_low_edge(uint center_ch, uint bw)
{
return (uint8)(center_ch - center_chan_to_edge(bw));
}
-
+/* return side band number given center channel and control channel
+ * return -1 on error
+ */
static int
channel_to_sb(uint center_ch, uint ctl_ch, uint bw)
{
uint sb;
if ((ctl_ch - lowest) % 4) {
-
+ /* bad ctl channel, not mult 4 */
return -1;
}
sb = ((ctl_ch - lowest) / 4);
-
+ /* sb must be a index to a 20MHz channel in range */
if (sb >= (bw / 20)) {
-
+ /* ctl_ch must have been too high for the center_ch */
return -1;
}
return sb;
}
-
+/* return control channel given center channel and side band */
static uint8
channel_to_ctl_chan(uint center_ch, uint bw, uint sb)
{
return (uint8)(channel_low_edge(center_ch, bw) + sb * 4);
}
-
+/* return index of 80MHz channel from channel number
+ * return -1 on error
+ */
static int
channel_80mhz_to_id(uint ch)
{
return -1;
}
-
+/* given a chanspec and a string buffer, format the chanspec as a
+ * string, and return the original pointer a.
+ * Min buffer length must be CHANSPEC_STR_LEN.
+ * On error return NULL
+ */
char *
wf_chspec_ntoa(chanspec_t chspec, char *buf)
{
band = "";
-
+ /* check for non-default band spec */
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 channel */
ctl_chan = wf_chspec_ctlchan(chspec);
-
+ /* bandwidth and ctl sideband */
if (CHSPEC_IS20(chspec)) {
snprintf(buf, CHANSPEC_STR_LEN, "%s%d", band, ctl_chan);
} else if (!CHSPEC_IS8080(chspec)) {
bw = wf_chspec_bw_str[(chspec & WL_CHANSPEC_BW_MASK) >> WL_CHANSPEC_BW_SHIFT];
#ifdef CHANSPEC_NEW_40MHZ_FORMAT
-
+ /* ctl sideband string if needed for 2g 40MHz */
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
-
+ /* ctl sideband string instead of BW for 40MHz */
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 /* CHANSPEC_NEW_40MHZ_FORMAT */
} else {
-
+ /* 80+80 */
uint chan1 = (chspec & WL_CHANSPEC_CHAN1_MASK) >> WL_CHANSPEC_CHAN1_SHIFT;
uint chan2 = (chspec & WL_CHANSPEC_CHAN2_MASK) >> WL_CHANSPEC_CHAN2_SHIFT;
-
+ /* convert to channel number */
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;
-
+ /* Outputs a max of CHANSPEC_STR_LEN chars including '\0' */
snprintf(buf, CHANSPEC_STR_LEN, "%d/80+80/%d-%d", ctl_chan, chan1, chan2);
}
char *endp = NULL;
val = strtoul(*p, &endp, 10);
-
+ /* if endp is the initial pointer value, then a number was not read */
if (endp == *p)
return 0;
-
+ /* advance the buffer pointer to the end of the integer string */
*p = endp;
-
+ /* return the parsed integer */
*num = (unsigned int)val;
return 1;
}
-
+/* given a chanspec string, convert to a chanspec.
+ * On error return 0
+ */
chanspec_t
wf_chspec_aton(const char *a)
{
chspec_sb = 0;
chspec_ch = ch1 = ch2 = 0;
-
+ /* parse channel num or band */
if (!read_uint(&a, &num))
return 0;
-
+ /* if we are looking at a 'g', then the first number was a band */
c = tolower((int)a[0]);
if (c == 'g') {
- a ++;
+ a ++; /* consume the char */
-
+ /* band must be "2" or "5" */
if (num == 2)
chspec_band = WL_CHANSPEC_BAND_2G;
else if (num == 5)
else
return 0;
-
+ /* read the channel number */
if (!read_uint(&a, &ctl_ch))
return 0;
c = tolower((int)a[0]);
}
else {
-
+ /* first number is channel, use default for band */
ctl_ch = num;
chspec_band = ((ctl_ch <= CH_MAX_2G_CHANNEL) ?
WL_CHANSPEC_BAND_2G : WL_CHANSPEC_BAND_5G);
}
if (c == '\0') {
-
+ /* default BW of 20MHz */
chspec_bw = WL_CHANSPEC_BW_20;
goto done_read;
}
- a ++;
+ a ++; /* consume the 'u','l', or '/' */
-
+ /* check 'u'/'l' */
if (c == 'u' || c == 'l') {
sb_ul = c;
chspec_bw = WL_CHANSPEC_BW_40;
goto done_read;
}
-
+ /* next letter must be '/' */
if (c != '/')
return 0;
-
+ /* read bandwidth */
if (!read_uint(&a, &bw))
return 0;
-
+ /* convert to chspec value */
if (bw == 20) {
chspec_bw = WL_CHANSPEC_BW_20;
} else if (bw == 40) {
return 0;
}
-
+ /* So far we have <band>g<chan>/<bw>
+ * Can now be followed by u/l if bw = 40,
+ * or '+80' if bw = 80, to make '80+80' bw.
+ */
c = tolower((int)a[0]);
-
+ /* if we have a 2g/40 channel, we should have a l/u spec now */
if (chspec_band == WL_CHANSPEC_BAND_2G && bw == 40) {
if (c == 'u' || c == 'l') {
- a ++;
+ a ++; /* consume the u/l char */
sb_ul = c;
goto done_read;
}
}
-
+ /* check for 80+80 */
if (c == '+') {
-
+ /* 80+80 */
static const char *plus80 = "80/";
-
+ /* must be looking at '+80/'
+ * check and consume this string.
+ */
chspec_bw = WL_CHANSPEC_BW_8080;
- a ++;
+ a ++; /* consume the char '+' */
-
+ /* consume the '80/' string */
for (i = 0; i < 3; i++) {
if (*a++ != *plus80++) {
return 0;
}
}
-
+ /* read primary 80MHz channel */
if (!read_uint(&a, &ch1))
return 0;
-
+ /* must followed by '-' */
if (a[0] != '-')
return 0;
- a ++;
+ a ++; /* consume the char */
-
+ /* read secondary 80MHz channel */
if (!read_uint(&a, &ch2))
return 0;
}
done_read:
-
+ /* skip trailing white space */
while (a[0] == ' ') {
a ++;
}
-
+ /* must be end of string */
if (a[0] != '\0')
return 0;
-
+ /* Now have all the chanspec string parts read;
+ * chspec_band, ctl_ch, chspec_bw, sb_ul, ch1, ch2.
+ * chspec_band and chspec_bw are chanspec values.
+ * Need to convert ctl_ch, sb_ul, and ch1,ch2 into
+ * a center channel (or two) and sideband.
+ */
-
+ /* if a sb u/l string was given, just use that,
+ * guaranteed to be bw = 40 by sting parse.
+ */
if (sb_ul != '\0') {
if (sb_ul == 'l') {
chspec_ch = UPPER_20_SB(ctl_ch);
chspec_sb = WL_CHANSPEC_CTL_SB_LLU;
}
}
-
+ /* if the bw is 20, center and sideband are trivial */
else if (chspec_bw == WL_CHANSPEC_BW_20) {
chspec_ch = ctl_ch;
chspec_sb = 0;
}
-
+ /* if the bw is 40/80/160, not 80+80, a single method
+ * can be used to to find the center and sideband
+ */
else if (chspec_bw != WL_CHANSPEC_BW_8080) {
-
+ /* figure out ctl sideband based on ctl channel and bandwidth */
const uint8 *center_ch = NULL;
int num_ch = 0;
int sb = -1;
}
}
-
+ /* check for no matching sb/center */
if (sb < 0) {
return 0;
}
}
-
+ /* Otherwise, bw is 80+80. Figure out channel pair and sb */
else {
int ch1_id = 0, ch2_id = 0;
int sb;
ch1_id = channel_80mhz_to_id(ch1);
ch2_id = channel_80mhz_to_id(ch2);
-
+ /* validate channels */
if (ch1 >= ch2 || ch1_id < 0 || ch2_id < 0)
return 0;
-
+ /* combined channel in chspec */
chspec_ch = (((uint16)ch1_id << WL_CHANSPEC_CHAN1_SHIFT) |
((uint16)ch2_id << WL_CHANSPEC_CHAN2_SHIFT));
-
+ /* figure out ctl sideband */
-
+ /* does the primary channel fit with the 1st 80MHz channel ? */
sb = channel_to_sb(ch1, ctl_ch, bw);
if (sb < 0) {
-
+ /* no, so does the primary channel fit with the 2nd 80MHz channel ? */
sb = channel_to_sb(ch2, ctl_ch, bw);
if (sb < 0) {
-
+ /* no match for ctl_ch to either 80MHz center channel */
return 0;
}
-
+ /* sb index is 0-3 for the low 80MHz channel, and 4-7 for
+ * the high 80MHz channel. Add 4 to to shift to high set.
+ */
sb += 4;
}
return chspec;
}
-
+/*
+ * Verify the chanspec is using a legal set of parameters, i.e. that the
+ * chanspec specified a band, bw, ctl_sb and channel and that the
+ * combination could be legal given any set of circumstances.
+ * RETURNS: TRUE is the chanspec is malformed, false if it looks good.
+ */
bool
wf_chspec_malformed(chanspec_t chanspec)
{
uint chspec_bw = CHSPEC_BW(chanspec);
uint chspec_ch = CHSPEC_CHANNEL(chanspec);
-
+ /* must be 2G or 5G band */
if (CHSPEC_IS2G(chanspec)) {
-
+ /* must be valid bandwidth */
if (chspec_bw != WL_CHANSPEC_BW_20 &&
chspec_bw != WL_CHANSPEC_BW_40) {
return TRUE;
if (chspec_bw == WL_CHANSPEC_BW_8080) {
uint ch1_id, ch2_id;
-
+ /* channel number in 80+80 must be in range */
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;
-
+ /* ch2 must be above ch1 for the chanspec */
if (ch2_id <= ch1_id)
return TRUE;
} else if (chspec_bw == WL_CHANSPEC_BW_20 || chspec_bw == WL_CHANSPEC_BW_40 ||
return TRUE;
}
} else {
-
+ /* invalid bandwidth */
return TRUE;
}
} else {
-
+ /* must be 2G or 5G band */
return TRUE;
}
-
+ /* side band needs to be consistent with bandwidth */
if (chspec_bw == WL_CHANSPEC_BW_20) {
if (CHSPEC_CTL_SB(chanspec) != WL_CHANSPEC_CTL_SB_LLL)
return TRUE;
return FALSE;
}
-
+/*
+ * Verify the chanspec specifies a valid channel according to 802.11.
+ * RETURNS: TRUE if the chanspec is a valid 802.11 channel
+ */
bool
wf_chspec_valid(chanspec_t chanspec)
{
return FALSE;
if (CHSPEC_IS2G(chanspec)) {
-
+ /* must be valid bandwidth and channel range */
if (chspec_bw == WL_CHANSPEC_BW_20) {
if (chspec_ch >= 1 && chspec_ch <= 14)
return TRUE;
ch1 = wf_5g_80m_chans[CHSPEC_CHAN1(chanspec)];
ch2 = wf_5g_80m_chans[CHSPEC_CHAN2(chanspec)];
-
+ /* the two channels must be separated by more than 80MHz by VHT req,
+ * and ch2 above ch1 for the chanspec
+ */
if (ch2 > ch1 + CH_80MHZ_APART)
return TRUE;
} else {
center_ch = wf_5g_160m_chans;
num_ch = WF_NUM_5G_160M_CHANS;
} else {
-
+ /* invalid bandwidth */
return FALSE;
}
-
+ /* check for a valid center channel */
if (chspec_bw == WL_CHANSPEC_BW_20) {
-
+ /* We don't have an array of legal 20MHz 5G channels, but they are
+ * each side of the legal 40MHz channels. Check the chanspec
+ * channel against either side of the 40MHz channels.
+ */
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; /* match found */
}
if (i == num_ch) {
-
+ /* check for legacy JP channels on failure */
if (chspec_ch == 34 || chspec_ch == 38 ||
chspec_ch == 42 || chspec_ch == 46)
i = 0;
}
} else {
-
+ /* check the chanspec channel to each legal channel */
for (i = 0; i < num_ch; i ++) {
if (chspec_ch == center_ch[i])
- break;
+ break; /* match found */
}
}
if (i < num_ch) {
-
+ /* match found */
return TRUE;
}
}
return FALSE;
}
-
+/*
+ * This function returns the channel number that control traffic is being sent on, for 20MHz
+ * channels this is just the channel number, for 40MHZ, 80MHz, 160MHz channels it is the 20MHZ
+ * sideband depending on the chanspec selected
+ */
uint8
wf_chspec_ctlchan(chanspec_t chspec)
{
ASSERT(!wf_chspec_malformed(chspec));
-
+ /* Is there a sideband ? */
if (CHSPEC_IS20(chspec)) {
return CHSPEC_CHANNEL(chspec);
} else {
sb -= 4;
}
-
+ /* convert from channel index to channel number */
center_chan = wf_5g_80m_chans[center_chan];
}
else {
}
}
-
+/*
+ * This function returns the chanspec of the control channel of a given chanspec
+ */
chanspec_t
wf_chspec_ctlchspec(chanspec_t chspec)
{
ASSERT(!wf_chspec_malformed(chspec));
-
+ /* Is there a sideband ? */
if (!CHSPEC_IS20(chspec)) {
ctl_chan = wf_chspec_ctlchan(chspec);
ctl_chspec = ctl_chan | WL_CHANSPEC_BW_20;
return ctl_chspec;
}
-
+/* return chanspec given control channel and bandwidth
+ * return 0 on error
+ */
uint16
wf_channel2chspec(uint ctl_ch, uint bw)
{
}
}
-
+ /* check for no matching sb/center */
if (sb < 0) {
return 0;
}
return chspec;
}
-#endif
-
+#endif /* D11AC_IOTYPES */
+/*
+ * This function returns the chanspec for the primary 40MHz of an 80MHz channel.
+ * The control sideband specifies the same 20MHz channel that the 80MHz channel is using
+ * as the primary 20MHz channel.
+ */
extern chanspec_t wf_chspec_primary40_chspec(chanspec_t chspec)
{
chanspec_t chspec40 = chspec;
sb = CHSPEC_CTL_SB(chspec);
if (sb == WL_CHANSPEC_CTL_SB_UL) {
-
+ /* Primary 40MHz is on upper side */
sb = WL_CHANSPEC_CTL_SB_L;
center_chan += CH_20MHZ_APART;
} else if (sb == WL_CHANSPEC_CTL_SB_UU) {
-
+ /* Primary 40MHz is on upper side */
sb = WL_CHANSPEC_CTL_SB_U;
center_chan += CH_20MHZ_APART;
} else {
-
-
+ /* Primary 40MHz is on lower side */
+ /* sideband bits are the same for LL/LU and L/U */
center_chan -= CH_20MHZ_APART;
}
-
+ /* Create primary 40MHz chanspec */
chspec40 = (WL_CHANSPEC_BAND_5G | WL_CHANSPEC_BW_40 |
sb | center_chan);
}
return chspec40;
}
-
+/*
+ * Return the channel number for a given frequency and base frequency.
+ * The returned channel number is relative to the given base frequency.
+ * If the given base frequency is zero, a base frequency of 5 GHz is assumed for
+ * frequencies from 5 - 6 GHz, and 2.407 GHz is assumed for 2.4 - 2.5 GHz.
+ *
+ * Frequency is specified in MHz.
+ * The base frequency is specified as (start_factor * 500 kHz).
+ * Constants WF_CHAN_FACTOR_2_4_G, WF_CHAN_FACTOR_5_G are defined for
+ * 2.4 GHz and 5 GHz bands.
+ *
+ * The returned channel will be in the range [1, 14] in the 2.4 GHz band
+ * and [0, 200] otherwise.
+ * -1 is returned if the start_factor is WF_CHAN_FACTOR_2_4_G and the
+ * frequency is not a 2.4 GHz channel, or if the frequency is not and even
+ * multiple of 5 MHz from the base frequency to the base plus 1 GHz.
+ *
+ * Reference 802.11 REVma, section 17.3.8.3, and 802.11B section 18.4.6.2
+ */
int
wf_mhz2channel(uint freq, uint start_factor)
{
uint base;
int offset;
-
+ /* take the default channel start frequency */
if (start_factor == 0) {
if (freq >= 2400 && freq <= 2500)
start_factor = WF_CHAN_FACTOR_2_4_G;
base = start_factor / 2;
-
+ /* check that the frequency is in 1GHz range of the base */
if ((freq < base) || (freq > base + 1000))
return -1;
offset = freq - base;
ch = offset / 5;
-
+ /* check that frequency is a 5MHz multiple from the base */
if (offset != (ch * 5))
return -1;
-
+ /* restricted channel range check for 2.4G */
if (start_factor == WF_CHAN_FACTOR_2_4_G && (ch < 1 || ch > 13))
return -1;
return ch;
}
-
+/*
+ * Return the center frequency in MHz of the given channel and base frequency.
+ * The channel number is interpreted relative to the given base frequency.
+ *
+ * The valid channel range is [1, 14] in the 2.4 GHz band and [0, 200] otherwise.
+ * The base frequency is specified as (start_factor * 500 kHz).
+ * Constants WF_CHAN_FACTOR_2_4_G, WF_CHAN_FACTOR_4_G, and WF_CHAN_FACTOR_5_G
+ * are defined for 2.4 GHz, 4 GHz, and 5 GHz bands.
+ * The channel range of [1, 14] is only checked for a start_factor of
+ * WF_CHAN_FACTOR_2_4_G (4814 = 2407 * 2).
+ * Odd start_factors produce channels on .5 MHz boundaries, in which case
+ * the answer is rounded down to an integral MHz.
+ * -1 is returned for an out of range channel.
+ *
+ * Reference 802.11 REVma, section 17.3.8.3, and 802.11B section 18.4.6.2
+ */
int
wf_channel2mhz(uint ch, uint start_factor)
{
return freq;
}
+
+/* These chan_info[] & lookup routines replicate those from wlc_phy.c because of BMAC split */
+static const struct chan_info {
+ uint16 chan; /* channel number */
+ uint16 freq; /* in MHz */
+} chan_info[] = {
+ /* 11b/11g */
+/* 0 */ {1, 2412},
+/* 1 */ {2, 2417},
+/* 2 */ {3, 2422},
+/* 3 */ {4, 2427},
+/* 4 */ {5, 2432},
+/* 5 */ {6, 2437},
+/* 6 */ {7, 2442},
+/* 7 */ {8, 2447},
+/* 8 */ {9, 2452},
+/* 9 */ {10, 2457},
+/* 10 */ {11, 2462},
+/* 11 */ {12, 2467},
+/* 12 */ {13, 2472},
+/* 13 */ {14, 2484},
+
+#ifdef BAND5G
+/* 11a japan high */
+/* 14 */ {34, 5170},
+/* 15 */ {38, 5190},
+/* 16 */ {42, 5210},
+/* 17 */ {46, 5230},
+
+/* 11a usa low */
+/* 18 */ {36, 5180},
+/* 19 */ {40, 5200},
+/* 20 */ {44, 5220},
+/* 21 */ {48, 5240},
+/* 22 */ {52, 5260},
+/* 23 */ {56, 5280},
+/* 24 */ {60, 5300},
+/* 25 */ {64, 5320},
+
+/* 11a Europe */
+/* 26 */ {100, 5500},
+/* 27 */ {104, 5520},
+/* 28 */ {108, 5540},
+/* 29 */ {112, 5560},
+/* 30 */ {116, 5580},
+/* 31 */ {120, 5600},
+/* 32 */ {124, 5620},
+/* 33 */ {128, 5640},
+/* 34 */ {132, 5660},
+/* 35 */ {136, 5680},
+/* 36 */ {140, 5700},
+
+/* 11a usa high, ref5 only */
+/* 37 */ {149, 5745},
+/* 38 */ {153, 5765},
+/* 39 */ {157, 5785},
+/* 40 */ {161, 5805},
+/* 41 */ {165, 5825},
+
+/* 11a japan */
+/* 42 */ {184, 4920},
+/* 43 */ {188, 4940},
+/* 44 */ {192, 4960},
+/* 45 */ {196, 4980},
+/* 46 */ {200, 5000},
+/* 47 */ {204, 5020},
+/* 48 */ {208, 5040},
+/* 49 */ {212, 5060},
+/* 50 */ {216, 5080}
+#endif /* BAND5G */
+};
+
+/*
+ * Converts channel frequency to channel number.
+ * Returns 0 if the frequency does not match any channel definition.
+ */
+uint
+wf_freq2channel(uint freq)
+{
+ uint i;
+
+ for (i = 0; i < ARRAYSIZE(chan_info); i++) {
+ if (chan_info[i].freq == freq)
+ return (chan_info[i].chan);
+ }
+ return (0);
+}
+
+/*
+ * Converts channel number to channel frequency.
+ * Returns 0 if the channel is out of range.
+ * Also used by some code in wlc_iw.c
+ */
+uint
+wf_channel2freq(uint channel)
+{
+ uint i;
+
+ for (i = 0; i < ARRAYSIZE(chan_info); i++)
+ if (chan_info[i].chan == channel)
+ return (chan_info[i].freq);
+ return (0);
+}
* Provides type definitions and function prototypes used to link the
* DHD OS, bus, and protocol modules.
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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 376275 2012-12-24 03:07:49Z $
+ * $Id: dhd.h 402415 2013-05-15 14:30:44Z $
*/
/****************
#include <wlioctl.h>
#include <wlfc_proto.h>
-#ifdef CUSTOMER_HW4
-#include <dhd_sec_feature.h>
-#endif /* CUSTOMER_HW4 */
-
+#if 0 && (0>= 0x0600)
+#include <wdf.h>
+#include <WdfMiniport.h>
+#endif
+#if defined(KEEP_ALIVE)
+/* Default KEEP_ALIVE Period is 55 sec to prevent AP from sending Keep Alive probe frame */
+#define KEEP_ALIVE_PERIOD 55000
+#define NULL_PKT_STR "null_pkt"
+#endif /* KEEP_ALIVE */
/* Forward decls */
struct dhd_bus;
struct dhd_prot;
struct dhd_info;
struct dhd_ioctl;
+struct dhd_cmn;
/* The level of bus communication with the dongle */
enum dhd_bus_state {
DHD_BUS_DATA /* Ready for frame transfers */
};
+#if 0 && (0>= 0x0600)
+/* Firmware requested operation mode */
+#define STA_MASK 0x0001
+#define HOSTAPD_MASK 0x0002
+#define WFD_MASK 0x0004
+#define SOFTAP_FW_MASK 0x0008
+#define P2P_GO_ENABLED 0x0010
+#define P2P_GC_ENABLED 0x0020
+#define CONCURENT_MASK 0x00F0
+#endif
+
enum dhd_op_flags {
/* Firmware requested operation mode */
DHD_FLAG_STA_MODE = (1 << (0)), /* STA only */
#define MANUFACTRING_FW "WLTEST"
-/* max sequential rxcntl timeouts to set HANG event */
-#ifndef MAX_CNTL_TIMEOUT
-#define MAX_CNTL_TIMEOUT 2
-#endif
+/* Max sequential TX/RX Control timeouts to set HANG event */
+#ifndef MAX_CNTL_TX_TIMEOUT
+#define MAX_CNTL_TX_TIMEOUT 2
+#endif /* MAX_CNTL_TX_TIMEOUT */
+#ifndef MAX_CNTL_RX_TIMEOUT
+#define MAX_CNTL_RX_TIMEOUT 1
+#endif /* MAX_CNTL_RX_TIMEOUT */
#define DHD_SCAN_ASSOC_ACTIVE_TIME 40 /* ms: Embedded default Active setting from DHD */
#define DHD_SCAN_UNASSOC_ACTIVE_TIME 80 /* ms: Embedded def. Unassoc Active setting from DHD */
WAKE_LOCK_SOFTAP_SET,
WAKE_LOCK_SOFTAP_STOP,
WAKE_LOCK_SOFTAP_START,
- WAKE_LOCK_SOFTAP_THREAD,
- WAKE_LOCK_MAX
+ WAKE_LOCK_SOFTAP_THREAD
};
enum dhd_prealloc_index {
DHD_PREALLOC_OSL_BUF,
#if defined(STATIC_WL_PRIV_STRUCT)
DHD_PREALLOC_WIPHY_ESCAN0 = 5,
-#if defined(CUSTOMER_HW4) && defined(DUAL_ESCAN_RESULT_BUFFER)
- DHD_PREALLOC_WIPHY_ESCAN1
-#endif /* CUSTOMER_HW4 && DUAL_ESCAN_RESULT_BUFFER */
#endif /* STATIC_WL_PRIV_STRUCT */
+ DHD_PREALLOC_DHD_INFO = 7
};
typedef enum {
struct dhd_bus *bus; /* Bus module handle */
struct dhd_prot *prot; /* Protocol module handle */
struct dhd_info *info; /* Info module handle */
+ struct dhd_cmn *cmn; /* dhd_common module handle */
/* Internal dhd items */
bool up; /* Driver up/down (to OS) */
*/
/* #define WL_ENABLE_P2P_IF 1 */
-#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) */
#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
-#ifdef WLBTAMP
- uint16 maxdatablks;
-#endif /* WLBTAMP */
#ifdef PROP_TXSTATUS
- int wlfc_enabled;
- void* wlfc_state;
-#endif
-#ifdef ROAM_AP_ENV_DETECTION
- bool roam_env_detection;
+ int wlfc_enabled;
+ void* wlfc_state;
+ int ptx_opt_enabled;
+ bool pending_tx_pkts;
+
+ /*
+ * implement below functions in each platform if needed.
+ */
+ /* platform specific function whether to skip flow control */
+ bool (*skip_fc)(void);
+ /* platform specific function for wlfc_enable and wlfc_deinit */
+ void (*plat_enable)(void *dhd);
+ void (*plat_deinit)(void *dhd);
#endif
bool dongle_isolation;
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 */
+ bool hang_report; /* enable hang report by default */
#ifdef WLMEDIA_HTSF
uint8 htsfdlystat_sz; /* Size of delay stats, max 255B */
#endif
struct reorder_info *reorder_bufs[WLHOST_REORDERDATA_MAXFLOWS];
#ifdef RXFRAME_THREAD
-#ifdef CUSTOMER_HW4
#define MAXSKBPEND 1024
-#else
-#define MAXSKBPEND 0x10000
-#endif
void *skbbuf[MAXSKBPEND];
uint32 store_idx;
uint32 sent_idx;
#if defined(ARP_OFFLOAD_SUPPORT)
uint32 arp_version;
#endif
-#if defined(BCMSUP_4WAY_HANDSHAKE) && defined(WLAN_AKM_SUITE_FT_8021X)
- bool fw_4way_handshake; /* Whether firmware will to do the 4way handshake. */
-#endif
} dhd_pub_t;
+typedef struct dhd_cmn {
+ osl_t *osh; /* OSL handle */
+ dhd_pub_t *dhd;
+} dhd_cmn_t;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP)
} while (0)
#define DHD_PM_RESUME_WAIT(a) _DHD_PM_RESUME_WAIT(a, 200)
#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);
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) */
}
-#ifdef DHD_DEBUG_WAKE_LOCK
-#define DHD_OS_WAKE_LOCK(pub) \
- do { \
- printf("call wake_lock: %s %d\n", \
- __FUNCTION__, __LINE__); \
- dhd_os_wake_lock(pub); \
- } while (0)
-#define DHD_OS_WAKE_UNLOCK(pub) \
- do { \
- printf("call wake_unlock: %s %d\n", \
- __FUNCTION__, __LINE__); \
- dhd_os_wake_unlock(pub); \
- } while (0)
-#define DHD_OS_WAKE_LOCK_TIMEOUT(pub) \
- do { \
- printf("call wake_lock_timeout: %s %d\n", \
- __FUNCTION__, __LINE__); \
- dhd_os_wake_lock_timeout(pub); \
- } while (0)
-#define DHD_OS_WAKE_LOCK_RX_TIMEOUT_ENABLE(pub, val) \
- do { \
- printf("call wake_lock_rx_timeout_enable[%d]: %s %d\n", \
- val, __FUNCTION__, __LINE__); \
- dhd_os_wake_lock_rx_timeout_enable(pub, val); \
- } while (0)
-#define DHD_OS_WAKE_LOCK_CTRL_TIMEOUT_ENABLE(pub, val) \
- do { \
- printf("call wake_lock_ctrl_timeout_enable[%d]: %s %d\n", \
- val, __FUNCTION__, __LINE__); \
- dhd_os_wake_lock_ctrl_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_WD_WAKE_LOCK(pub) dhd_os_wd_wake_lock(pub)
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
-#if defined(CUSTOMER_HW4) && defined(PNO_SUPPORT)
-#define DHD_PNO_TIMEOUT_MS 10000
-#endif
/* interface operations (register, remove) should be atomic, use this lock to prevent race
* condition among wifi on/off and interface operation functions
void dhd_net_if_lock(struct net_device *dev);
void dhd_net_if_unlock(struct net_device *dev);
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) && 1 && 1
-extern struct mutex _dhd_sdio_mutex_lock_;
-#endif
typedef struct dhd_if_event {
uint8 ifidx;
/* Indication from bus module to change flow-control state */
extern void dhd_txflowcontrol(dhd_pub_t *dhdp, int ifidx, bool on);
+/* Store the status of a connection attempt for later retrieval by an iovar */
+extern void dhd_store_conn_status(uint32 event, uint32 status, uint32 reason);
+
extern bool dhd_prec_enq(dhd_pub_t *dhdp, struct pktq *q, void *pkt, int prec);
/* Receive frame for delivery to OS. Callee disposes of rxp. */
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);
+
+#if defined(KEEP_ALIVE)
+extern int dhd_keep_alive_onoff(dhd_pub_t *dhd);
+#endif /* KEEP_ALIVE */
#ifdef PNO_SUPPORT
extern int dhd_pno_enable(dhd_pub_t *dhd, int pfn_enabled);
+extern int dhd_pnoenable(dhd_pub_t *dhd, int pfn_enabled);
extern int dhd_pno_clean(dhd_pub_t *dhd);
extern int dhd_pno_set(dhd_pub_t *dhd, wlc_ssid_t* ssids_local, int nssid,
ushort scan_fr, int pno_repeat, int pno_freq_expo_max);
int nssid, ushort scan_fr, int pno_repeat, int pno_freq_expo_max);
extern int dhd_dev_pno_enable(struct net_device *dev, int pfn_enabled);
extern int dhd_dev_get_pno_status(struct net_device *dev);
+extern int dhd_pno_set_add(dhd_pub_t *dhd, wl_pfn_t *netinfo, int nssid,
+ ushort scan_fr, ushort slowscan_fr, uint8 pno_repeat, uint8 pno_freq_expo_max, int16 flags);
+extern int dhd_pno_cfg(dhd_pub_t *dhd, wl_pfn_cfg_t *pcfg);
+extern int dhd_pno_suspend(dhd_pub_t *dhd, int pfn_suspend);
#endif /* PNO_SUPPORT */
#ifdef PKT_FILTER_SUPPORT
#ifdef DHD_DEBUG
extern int write_to_file(dhd_pub_t *dhd, uint8 *buf, int size);
#endif /* DHD_DEBUG */
-#if defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID)
+#if defined(OOB_INTR_ONLY)
extern int dhd_customer_oob_irq_map(unsigned long *irq_flags_ptr);
-#endif /* defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID) */
+#endif
extern void dhd_os_sdtxlock(dhd_pub_t * pub);
extern void dhd_os_sdtxunlock(dhd_pub_t * pub);
extern int dhd_wl_ioctl(dhd_pub_t *dhd_pub, int ifindex, wl_ioctl_t *ioc, void *buf, int len);
extern int dhd_wl_ioctl_cmd(dhd_pub_t *dhd_pub, int cmd, void *arg, int len, uint8 set,
int ifindex);
-
extern void dhd_common_init(osl_t *osh);
+extern void dhd_common_deinit(dhd_pub_t *dhd_pub, dhd_cmn_t *sa_cmn);
extern int dhd_do_driver_init(struct net_device *net);
extern int dhd_add_if(struct dhd_info *dhd, int ifidx, void *handle,
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);
/* 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 */
-#define DEFAULT_KEEP_ALIVE_PERIOD 55000
-#ifndef CUSTOM_KEEP_ALIVE_PERIOD
-#define CUSTOM_KEEP_ALIVE_PERIOD DEFAULT_KEEP_ALIVE_PERIOD
-#endif
+#define DEFAULT_KEEP_ALIVE_VALUE 55000 /* msec */
+#ifndef CUSTOM_KEEP_ALIVE_SETTING
+#define CUSTOM_KEEP_ALIVE_SETTING DEFAULT_KEEP_ALIVE_VALUE
+#endif /* DEFAULT_KEEP_ALIVE_VALUE */
#define NULL_PKT_STR "null_pkt"
#define CUSTOM_ROAM_DELTA_SETTING DEFAULT_ROAM_DELTA_VALUE
#endif
+/* hooks for custom PNO Event wake lock to guarantee enough time
+ for the Platform to detect Event before system suspended
+*/
+#define DEFAULT_PNO_EVENT_LOCK_xTIME 2 /* multiplay of DHD_PACKET_TIMEOUT_MS */
+#ifndef CUSTOM_PNO_EVENT_LOCK_xTIME
+#define CUSTOM_PNO_EVENT_LOCK_xTIME DEFAULT_PNO_EVENT_LOCK_xTIME
+#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
+#ifndef CUSTOM_LISTEN_INTERVAL
+#define CUSTOM_LISTEN_INTERVAL LISTEN_INTERVAL
+#endif /* CUSTOM_LISTEN_INTERVAL */
+
#define DEFAULT_SUSPEND_BCN_LI_DTIM 3
#ifndef CUSTOM_SUSPEND_BCN_LI_DTIM
#define CUSTOM_SUSPEND_BCN_LI_DTIM DEFAULT_SUSPEND_BCN_LI_DTIM
#ifdef RXFRAME_THREAD
#ifndef CUSTOM_RXF_PRIO_SETTING
-#define CUSTOM_RXF_PRIO_SETTING (DEFAULT_DHP_DPC_PRIO + 1)
+#define CUSTOM_RXF_PRIO_SETTING MAX((CUSTOM_DPC_PRIO_SETTING - 1), 1)
#endif
#endif /* RXFRAME_THREAD */
+#ifdef WLTDLS
+#ifndef CUSTOM_TDLS_IDLE_MODE_SETTING
+#define CUSTOM_TDLS_IDLE_MODE_SETTING 60000 /* 60sec to tear down TDLS of not active */
+#endif
+#endif /* WLTDLS */
+
+
+#define MAX_DTIM_SKIP_BEACON_ITERVAL 100 /* max allowed associated AP beacon for dtim skip */
+
#ifdef SDTEST
/* Echo packet generator (SDIO), pkts/s */
extern uint dhd_pktgen;
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
/* Flag to indicate if we should download firmware on driver load */
extern uint dhd_download_fw_on_driverload;
-#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 trigger_deep_sleep;
-int dhd_deepsleep(struct net_device *dev, int flag);
-#endif /* WL_CFG80211 && SUPPORT_DEEP_SLEEP */
/* For supporting multiple interfaces */
#define DHD_MAX_IFS 16
/* Please be mindful that total pkttag space is 32 octets only */
typedef struct dhd_pkttag {
/*
+ b[14:13] - encryption exemption
+ b[12 ] - 1 = event channel
b[11 ] - 1 = this packet was sent in response to one time packet request,
do not increment credit on status for this one. [WLFC_CTL_TYPE_MAC_REQUEST_PACKET].
b[10 ] - 1 = signal-only-packet to firmware [i.e. nothing to piggyback on]
#define DHD_PKTTAG_ONETIMEPKTRQST_MASK 0x1
#define DHD_PKTTAG_ONETIMEPKTRQST_SHIFT 11
+#define DHD_PKTTAG_EVENT_MASK 0x1
+#define DHD_PKTTAG_EVENT_SHIFT 12
+
+#define DHD_PKTTAG_EXEMPT_MASK 0x3
+#define DHD_PKTTAG_EXEMPT_SHIFT 13
+
#define DHD_PKTTAG_PKTDIR_MASK 0x1
#define DHD_PKTTAG_PKTDIR_SHIFT 9
#define DHD_PKTTAG_ONETIMEPKTRQST(tag) ((((dhd_pkttag_t*)(tag))->if_flags >> \
DHD_PKTTAG_ONETIMEPKTRQST_SHIFT) & DHD_PKTTAG_ONETIMEPKTRQST_MASK)
+#define DHD_PKTTAG_SETEVENT(tag, event) ((dhd_pkttag_t*)(tag))->if_flags = \
+ (((dhd_pkttag_t*)(tag))->if_flags & \
+ ~(DHD_PKTTAG_EVENT_MASK << DHD_PKTTAG_EVENT_SHIFT)) | \
+ (((event) & DHD_PKTTAG_EVENT_MASK) << DHD_PKTTAG_EVENT_SHIFT)
+#define DHD_PKTTAG_EVENT(tag) ((((dhd_pkttag_t*)(tag))->if_flags >> \
+ DHD_PKTTAG_EVENT_SHIFT) & DHD_PKTTAG_EVENT_MASK)
+
+#define DHD_PKTTAG_EXEMPT_SET(tag, value) ((dhd_pkttag_t*)(tag))->if_flags = \
+ (((dhd_pkttag_t*)(tag))->if_flags & \
+ ~(DHD_PKTTAG_EXEMPT_MASK << DHD_PKTTAG_EXEMPT_SHIFT)) | \
+ (((value) & DHD_PKTTAG_EXEMPT_MASK) << DHD_PKTTAG_EXEMPT_SHIFT)
+#define DHD_PKTTAG_EXEMPT(tag) ((((dhd_pkttag_t*)(tag))->if_flags >> \
+ DHD_PKTTAG_EXEMPT_SHIFT) & DHD_PKTTAG_EXEMPT_MASK)
+
#define DHD_PKTTAG_SETDSTN(tag, dstn_MAC_ea) memcpy(((dhd_pkttag_t*)((tag)))->dstn_ether, \
(dstn_MAC_ea), ETHER_ADDR_LEN)
#define DHD_PKTTAG_DSTN(tag) ((dhd_pkttag_t*)(tag))->dstn_ether
typedef int (*f_commitpkt_t)(void* ctx, void* p);
+int dhd_os_wlfc_block(dhd_pub_t *pub);
+int dhd_os_wlfc_unblock(dhd_pub_t *pub);
+void dhd_schedule_tx(struct dhd_info *dhd);
#ifdef PROP_TXSTATUS_DEBUG
#define DHD_WLFC_CTRINC_MAC_CLOSE(entry) do { (entry)->closed_ct++; } while (0)
/* ioctl processing for nl80211 */
int dhd_ioctl_process(dhd_pub_t *pub, int ifidx, struct dhd_ioctl *ioc);
-#if defined(CUSTOMER_HW4) && defined(SUPPORT_MULTIPLE_REVISION)
-extern int
-concate_revision(struct dhd_bus *bus, char *fwpath, int fw_path_len, char *nvpath, int nv_path_len);
-#endif /* CUSTOMER_HW4 && SUPPORT_MULTIPLE_REVISION */
+void dhd_set_bus_state(void *bus, uint32 state);
+
+/* Remove proper pkts(either one no-frag pkt or whole fragmented pkts) */
+extern bool dhd_prec_drop_pkts(osl_t *osh, struct pktq *pq, int prec);
#endif /* _dhd_h_ */
/*
* BT-AMP support routines
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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_bta.c 303834 2011-12-20 06:17:39Z $
+ * $Id: dhd_bta.c 379512 2013-01-17 22:49:08Z $
*/
-#ifndef WLBTAMP
#error "WLBTAMP is not defined"
-#endif /* WLBTAMP */
#include <typedefs.h>
#include <osl.h>
{
amp_hci_event_t *evt = (amp_hci_event_t *)data_buf;
+ ASSERT(dhdp);
+ ASSERT(evt);
+
switch (evt->ecode) {
case HCI_Command_Complete: {
cmd_complete_parms_t *parms = (cmd_complete_parms_t *)evt->parms;
/*
* BT-AMP support routines
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* Provides type definitions and function prototypes used to link the
* DHD OS, bus, and protocol modules.
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
--- /dev/null
+/*
+ * DHD Protocol Module for CDC and BDC.
+ *
+ * Copyright (C) 1999-2013, 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_cdc.c 402043 2013-05-14 12:11:22Z $
+ *
+ * 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
+ * for dongle offload.)
+ */
+
+#include <typedefs.h>
+#include <osl.h>
+
+#include <bcmutils.h>
+#include <bcmcdc.h>
+#include <bcmendian.h>
+
+#include <dngl_stats.h>
+#include <dhd.h>
+#include <dhd_proto.h>
+#include <dhd_bus.h>
+#include <dhd_dbg.h>
+
+
+#ifdef PROP_TXSTATUS
+#include <wlfc_proto.h>
+#include <dhd_wlfc.h>
+#endif
+
+
+#define RETRIES 2 /* # of retries to retrieve matching ioctl response */
+#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.
+ */
+#define ROUND_UP_MARGIN 2048 /* Biggest SDIO block size possible for
+ * round off at the end of buffer
+ */
+
+typedef struct dhd_prot {
+ uint16 reqid;
+ uint8 pending;
+ uint32 lastcmd;
+ uint8 bus_header[BUS_HEADER_LEN];
+ cdc_ioctl_t msg;
+ unsigned char buf[WLC_IOCTL_MAXLEN + ROUND_UP_MARGIN];
+} dhd_prot_t;
+
+
+static int
+dhdcdc_msg(dhd_pub_t *dhd)
+{
+ int err = 0;
+ dhd_prot_t *prot = dhd->prot;
+ int len = ltoh32(prot->msg.len) + sizeof(cdc_ioctl_t);
+
+ DHD_TRACE(("%s: Enter\n", __FUNCTION__));
+
+ DHD_OS_WAKE_LOCK(dhd);
+
+ /* NOTE : cdc->msg.len holds the desired length of the buffer to be
+ * returned. Only up to CDC_MAX_MSG_SIZE of this buffer area
+ * is actually sent to the dongle
+ */
+ if (len > CDC_MAX_MSG_SIZE)
+ len = CDC_MAX_MSG_SIZE;
+
+ /* Send request */
+ err = dhd_bus_txctl(dhd->bus, (uchar*)&prot->msg, len);
+
+ DHD_OS_WAKE_UNLOCK(dhd);
+ return err;
+}
+
+static int
+dhdcdc_cmplt(dhd_pub_t *dhd, uint32 id, uint32 len)
+{
+ int ret;
+ int cdc_len = len + sizeof(cdc_ioctl_t);
+ dhd_prot_t *prot = dhd->prot;
+
+ DHD_TRACE(("%s: Enter\n", __FUNCTION__));
+
+
+ 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);
+
+
+ return ret;
+}
+
+static int
+dhdcdc_query_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len, uint8 action)
+{
+ dhd_prot_t *prot = dhd->prot;
+ cdc_ioctl_t *msg = &prot->msg;
+ void *info;
+ int ret = 0, retries = 0;
+ uint32 id, flags = 0;
+
+ DHD_TRACE(("%s: Enter\n", __FUNCTION__));
+ DHD_CTL(("%s: cmd %d len %d\n", __FUNCTION__, cmd, len));
+
+
+ /* Respond "bcmerror" and "bcmerrorstr" with local cache */
+ if (cmd == WLC_GET_VAR && buf)
+ {
+ if (!strcmp((char *)buf, "bcmerrorstr"))
+ {
+ strncpy((char *)buf, bcmerrorstr(dhd->dongle_error), BCME_STRLEN);
+ goto done;
+ }
+ else if (!strcmp((char *)buf, "bcmerror"))
+ {
+ *(int *)buf = dhd->dongle_error;
+ goto done;
+ }
+ }
+
+ memset(msg, 0, sizeof(cdc_ioctl_t));
+
+ msg->cmd = htol32(cmd);
+ msg->len = htol32(len);
+ msg->flags = (++prot->reqid << CDCF_IOC_ID_SHIFT);
+ CDC_SET_IF_IDX(msg, ifidx);
+ /* add additional action bits */
+ action &= WL_IOCTL_ACTION_MASK;
+ msg->flags |= (action << CDCF_IOC_ACTION_SHIFT);
+ msg->flags = htol32(msg->flags);
+
+ if (buf)
+ memcpy(prot->buf, buf, len);
+
+ if ((ret = dhdcdc_msg(dhd)) < 0) {
+ if (!dhd->hang_was_sent)
+ DHD_ERROR(("dhdcdc_query_ioctl: dhdcdc_msg failed w/status %d\n", ret));
+ goto done;
+ }
+
+retry:
+ /* wait for interrupt and get first fragment */
+ if ((ret = dhdcdc_cmplt(dhd, prot->reqid, len)) < 0)
+ goto done;
+
+ flags = ltoh32(msg->flags);
+ id = (flags & CDCF_IOC_ID_MASK) >> CDCF_IOC_ID_SHIFT;
+
+ if ((id < prot->reqid) && (++retries < RETRIES))
+ goto retry;
+ if (id != prot->reqid) {
+ DHD_ERROR(("%s: %s: unexpected request id %d (expected %d)\n",
+ dhd_ifname(dhd, ifidx), __FUNCTION__, id, prot->reqid));
+ ret = -EINVAL;
+ goto done;
+ }
+
+ /* Check info buffer */
+ info = (void*)&msg[1];
+
+ /* Copy info buffer */
+ if (buf)
+ {
+ if (ret < (int)len)
+ len = ret;
+ memcpy(buf, info, len);
+ }
+
+ /* Check the ERROR flag */
+ if (flags & CDCF_IOC_ERROR)
+ {
+ ret = ltoh32(msg->status);
+ /* Cache error from dongle */
+ dhd->dongle_error = ret;
+ }
+
+done:
+ return ret;
+}
+
+
+static int
+dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len, uint8 action)
+{
+ dhd_prot_t *prot = dhd->prot;
+ cdc_ioctl_t *msg = &prot->msg;
+ int ret = 0;
+ uint32 flags, id;
+
+ DHD_TRACE(("%s: Enter\n", __FUNCTION__));
+ DHD_CTL(("%s: cmd %d len %d\n", __FUNCTION__, cmd, len));
+
+ if (dhd->busstate == DHD_BUS_DOWN) {
+ DHD_ERROR(("%s : bus is down. we have nothing to do\n", __FUNCTION__));
+ return -EIO;
+ }
+
+ /* don't talk to the dongle if fw is about to be reloaded */
+ if (dhd->hang_was_sent) {
+ DHD_ERROR(("%s: HANG was sent up earlier. Not talking to the chip\n",
+ __FUNCTION__));
+ return -EIO;
+ }
+
+
+ memset(msg, 0, sizeof(cdc_ioctl_t));
+
+ msg->cmd = htol32(cmd);
+ msg->len = htol32(len);
+ msg->flags = (++prot->reqid << CDCF_IOC_ID_SHIFT);
+ CDC_SET_IF_IDX(msg, ifidx);
+ /* add additional action bits */
+ action &= WL_IOCTL_ACTION_MASK;
+ msg->flags |= (action << CDCF_IOC_ACTION_SHIFT) | CDCF_IOC_SET;
+ msg->flags = htol32(msg->flags);
+
+ if (buf)
+ memcpy(prot->buf, buf, len);
+
+ if ((ret = dhdcdc_msg(dhd)) < 0) {
+ DHD_ERROR(("%s: dhdcdc_msg failed w/status %d\n", __FUNCTION__, ret));
+ goto done;
+ }
+
+ if ((ret = dhdcdc_cmplt(dhd, prot->reqid, len)) < 0)
+ goto done;
+
+ flags = ltoh32(msg->flags);
+ id = (flags & CDCF_IOC_ID_MASK) >> CDCF_IOC_ID_SHIFT;
+
+ if (id != prot->reqid) {
+ DHD_ERROR(("%s: %s: unexpected request id %d (expected %d)\n",
+ dhd_ifname(dhd, ifidx), __FUNCTION__, id, prot->reqid));
+ ret = -EINVAL;
+ goto done;
+ }
+
+ /* Check the ERROR flag */
+ if (flags & CDCF_IOC_ERROR)
+ {
+ ret = ltoh32(msg->status);
+ /* Cache error from dongle */
+ dhd->dongle_error = ret;
+ }
+
+done:
+ return ret;
+}
+
+
+int
+dhd_prot_ioctl(dhd_pub_t *dhd, int ifidx, wl_ioctl_t * ioc, void * buf, int len)
+{
+ dhd_prot_t *prot = dhd->prot;
+ int ret = -1;
+ uint8 action;
+
+ if ((dhd->busstate == DHD_BUS_DOWN) || dhd->hang_was_sent) {
+ DHD_ERROR(("%s : bus is down. we have nothing to do\n", __FUNCTION__));
+ goto done;
+ }
+
+ DHD_TRACE(("%s: Enter\n", __FUNCTION__));
+
+ ASSERT(len <= WLC_IOCTL_MAXLEN);
+
+ if (len > WLC_IOCTL_MAXLEN)
+ goto done;
+
+ if (prot->pending == TRUE) {
+ DHD_ERROR(("CDC packet is pending!!!! cmd=0x%x (%lu) lastcmd=0x%x (%lu)\n",
+ ioc->cmd, (unsigned long)ioc->cmd, prot->lastcmd,
+ (unsigned long)prot->lastcmd));
+ if ((ioc->cmd == WLC_SET_VAR) || (ioc->cmd == WLC_GET_VAR)) {
+ DHD_TRACE(("iovar cmd=%s\n", (char*)buf));
+ }
+ goto done;
+ }
+
+ prot->pending = TRUE;
+ prot->lastcmd = ioc->cmd;
+ action = ioc->set;
+ if (action & WL_IOCTL_ACTION_SET)
+ ret = dhdcdc_set_ioctl(dhd, ifidx, ioc->cmd, buf, len, action);
+ else {
+ ret = dhdcdc_query_ioctl(dhd, ifidx, ioc->cmd, buf, len, action);
+ if (ret > 0)
+ ioc->used = ret - sizeof(cdc_ioctl_t);
+ }
+
+ /* Too many programs assume ioctl() returns 0 on success */
+ if (ret >= 0)
+ ret = 0;
+ else {
+ cdc_ioctl_t *msg = &prot->msg;
+ ioc->needed = ltoh32(msg->len); /* len == needed when set/query fails from dongle */
+ }
+
+ /* Intercept the wme_dp ioctl here */
+ if ((!ret) && (ioc->cmd == WLC_SET_VAR) && (!strcmp(buf, "wme_dp"))) {
+ int slen, val = 0;
+
+ slen = strlen("wme_dp") + 1;
+ if (len >= (int)(slen + sizeof(int)))
+ bcopy(((char *)buf + slen), &val, sizeof(int));
+ dhd->wme_dp = (uint8) ltoh32(val);
+ }
+
+ prot->pending = FALSE;
+
+done:
+
+ return ret;
+}
+
+int
+dhd_prot_iovar_op(dhd_pub_t *dhdp, const char *name,
+ void *params, int plen, void *arg, int len, bool set)
+{
+ return BCME_UNSUPPORTED;
+}
+
+void
+dhd_prot_dump(dhd_pub_t *dhdp, struct bcmstrbuf *strbuf)
+{
+ bcm_bprintf(strbuf, "Protocol CDC: reqid %d\n", dhdp->prot->reqid);
+#ifdef PROP_TXSTATUS
+ if (dhdp->wlfc_state)
+ dhd_wlfc_dump(dhdp, strbuf);
+#endif
+}
+
+/* The FreeBSD PKTPUSH could change the packet buf pinter
+ so we need to make it changable
+*/
+#define PKTBUF pktbuf
+void
+dhd_prot_hdrpush(dhd_pub_t *dhd, int ifidx, void *PKTBUF)
+{
+#ifdef BDC
+ struct bdc_header *h;
+#endif /* BDC */
+
+ DHD_TRACE(("%s: Enter\n", __FUNCTION__));
+
+#ifdef BDC
+ /* Push BDC header used to convey priority for buses that don't */
+
+ PKTPUSH(dhd->osh, PKTBUF, BDC_HEADER_LEN);
+
+ h = (struct bdc_header *)PKTDATA(dhd->osh, PKTBUF);
+
+ h->flags = (BDC_PROTO_VER << BDC_FLAG_VER_SHIFT);
+ if (PKTSUMNEEDED(PKTBUF))
+ h->flags |= BDC_FLAG_SUM_NEEDED;
+
+
+ h->priority = (PKTPRIO(PKTBUF) & BDC_PRIORITY_MASK);
+ h->flags2 = 0;
+ h->dataOffset = 0;
+#endif /* BDC */
+ BDC_SET_IF_IDX(h, ifidx);
+}
+#undef PKTBUF /* Only defined in the above routine */
+
+int
+dhd_prot_hdrpull(dhd_pub_t *dhd, int *ifidx, void *pktbuf, uchar *reorder_buf_info,
+ uint *reorder_info_len)
+{
+#ifdef BDC
+ struct bdc_header *h;
+#endif
+ uint8 data_offset = 0;
+
+ DHD_TRACE(("%s: Enter\n", __FUNCTION__));
+
+#ifdef BDC
+ if (reorder_info_len)
+ *reorder_info_len = 0;
+ /* Pop BDC header used to convey priority for buses that don't */
+
+ if (PKTLEN(dhd->osh, pktbuf) < BDC_HEADER_LEN) {
+ DHD_ERROR(("%s: rx data too short (%d < %d)\n", __FUNCTION__,
+ PKTLEN(dhd->osh, pktbuf), BDC_HEADER_LEN));
+ return BCME_ERROR;
+ }
+
+ h = (struct bdc_header *)PKTDATA(dhd->osh, pktbuf);
+
+ if (!ifidx) {
+ /* for tx packet, skip the analysis */
+ data_offset = h->dataOffset;
+ PKTPULL(dhd->osh, pktbuf, BDC_HEADER_LEN);
+ goto exit;
+ }
+
+ if ((*ifidx = BDC_GET_IF_IDX(h)) >= DHD_MAX_IFS) {
+ DHD_ERROR(("%s: rx data ifnum out of range (%d)\n",
+ __FUNCTION__, *ifidx));
+ return BCME_ERROR;
+ }
+
+ if (((h->flags & BDC_FLAG_VER_MASK) >> BDC_FLAG_VER_SHIFT) != BDC_PROTO_VER) {
+ DHD_ERROR(("%s: non-BDC packet received, flags = 0x%x\n",
+ dhd_ifname(dhd, *ifidx), h->flags));
+ if (((h->flags & BDC_FLAG_VER_MASK) >> BDC_FLAG_VER_SHIFT) == BDC_PROTO_VER_1)
+ h->dataOffset = 0;
+ else
+ return BCME_ERROR;
+ }
+
+ if (h->flags & BDC_FLAG_SUM_GOOD) {
+ DHD_INFO(("%s: BDC packet received with good rx-csum, flags 0x%x\n",
+ dhd_ifname(dhd, *ifidx), h->flags));
+ PKTSETSUMGOOD(pktbuf, TRUE);
+ }
+
+ PKTSETPRIO(pktbuf, (h->priority & BDC_PRIORITY_MASK));
+ data_offset = h->dataOffset;
+ PKTPULL(dhd->osh, pktbuf, BDC_HEADER_LEN);
+#endif /* BDC */
+
+#ifdef PROP_TXSTATUS
+ dhd_os_wlfc_block(dhd);
+ if (dhd->wlfc_state &&
+ ((athost_wl_status_info_t*)dhd->wlfc_state)->proptxstatus_mode
+ != WLFC_FCMODE_NONE &&
+ (!DHD_PKTTAG_PKTDIR(PKTTAG(pktbuf)))) {
+ /*
+ - parse txstatus only for packets that came from the firmware
+ */
+ dhd_wlfc_parse_header_info(dhd, pktbuf, (data_offset << 2),
+ reorder_buf_info, reorder_info_len);
+ ((athost_wl_status_info_t*)dhd->wlfc_state)->stats.dhd_hdrpulls++;
+
+ }
+ dhd_os_wlfc_unblock(dhd);
+#endif /* PROP_TXSTATUS */
+
+exit:
+ PKTPULL(dhd->osh, pktbuf, (data_offset << 2));
+ return 0;
+}
+
+#if defined(PROP_TXSTATUS)
+void
+dhd_wlfc_trigger_pktcommit(dhd_pub_t *dhd)
+{
+ dhd_os_wlfc_block(dhd);
+ if (dhd->wlfc_state &&
+ (((athost_wl_status_info_t*)dhd->wlfc_state)->proptxstatus_mode
+ != WLFC_FCMODE_NONE)) {
+ dhd_wlfc_commit_packets(dhd->wlfc_state, (f_commitpkt_t)dhd_bus_txdata,
+ (void *)dhd->bus, NULL);
+ }
+ dhd_os_wlfc_unblock(dhd);
+}
+#endif
+
+
+int
+dhd_prot_attach(dhd_pub_t *dhd)
+{
+ dhd_prot_t *cdc;
+
+ if (!(cdc = (dhd_prot_t *)DHD_OS_PREALLOC(dhd->osh, DHD_PREALLOC_PROT,
+ sizeof(dhd_prot_t)))) {
+ DHD_ERROR(("%s: kmalloc failed\n", __FUNCTION__));
+ goto fail;
+ }
+ memset(cdc, 0, sizeof(dhd_prot_t));
+
+ /* ensure that the msg buf directly follows the cdc msg struct */
+ if ((uintptr)(&cdc->msg + 1) != (uintptr)cdc->buf) {
+ DHD_ERROR(("dhd_prot_t is not correctly defined\n"));
+ goto fail;
+ }
+
+ dhd->prot = cdc;
+#ifdef BDC
+ dhd->hdrlen += BDC_HEADER_LEN;
+#endif
+ dhd->maxctl = WLC_IOCTL_MAXLEN + sizeof(cdc_ioctl_t) + ROUND_UP_MARGIN;
+ return 0;
+
+fail:
+#ifndef CONFIG_DHD_USE_STATIC_BUF
+ if (cdc != NULL)
+ MFREE(dhd->osh, cdc, sizeof(dhd_prot_t));
+#endif /* CONFIG_DHD_USE_STATIC_BUF */
+ return BCME_NOMEM;
+}
+
+/* ~NOTE~ What if another thread is waiting on the semaphore? Holding it? */
+void
+dhd_prot_detach(dhd_pub_t *dhd)
+{
+#ifdef PROP_TXSTATUS
+ dhd_wlfc_deinit(dhd);
+ if (dhd->plat_deinit)
+ dhd->plat_deinit((void *)dhd);
+#endif
+#ifndef CONFIG_DHD_USE_STATIC_BUF
+ MFREE(dhd->osh, dhd->prot, sizeof(dhd_prot_t));
+#endif /* CONFIG_DHD_USE_STATIC_BUF */
+ dhd->prot = NULL;
+}
+
+void
+dhd_prot_dstats(dhd_pub_t *dhd)
+{
+ /* No stats from dongle added yet, copy bus stats */
+ dhd->dstats.tx_packets = dhd->tx_packets;
+ dhd->dstats.tx_errors = dhd->tx_errors;
+ dhd->dstats.rx_packets = dhd->rx_packets;
+ dhd->dstats.rx_errors = dhd->rx_errors;
+ dhd->dstats.rx_dropped = dhd->rx_dropped;
+ dhd->dstats.multicast = dhd->rx_multicast;
+ return;
+}
+
+int
+dhd_prot_init(dhd_pub_t *dhd)
+{
+ int ret = 0;
+ wlc_rev_info_t revinfo;
+ DHD_TRACE(("%s: Enter\n", __FUNCTION__));
+
+
+ /* Get the device rev info */
+ memset(&revinfo, 0, sizeof(revinfo));
+ ret = dhd_wl_ioctl_cmd(dhd, WLC_GET_REVINFO, &revinfo, sizeof(revinfo), FALSE, 0);
+ if (ret < 0)
+ goto done;
+
+
+#if defined(WL_CFG80211)
+ if (dhd_download_fw_on_driverload)
+#endif /* defined(WL_CFG80211) */
+ ret = dhd_preinit_ioctls(dhd);
+ /* Always assumes wl for now */
+ dhd->iswl = TRUE;
+
+done:
+ return ret;
+}
+
+void
+dhd_prot_stop(dhd_pub_t *dhd)
+{
+ /* Nothing to do for CDC */
+}
+
+
+static void
+dhd_get_hostreorder_pkts(void *osh, struct reorder_info *ptr, void **pkt,
+ uint32 *pkt_count, void **pplast, uint8 start, uint8 end)
+{
+ uint i;
+ void *plast = NULL, *p;
+ uint32 pkt_cnt = 0;
+
+ if (ptr->pend_pkts == 0) {
+ DHD_REORDER(("%s: no packets in reorder queue \n", __FUNCTION__));
+ *pplast = NULL;
+ *pkt_count = 0;
+ *pkt = NULL;
+ return;
+ }
+ if (start == end)
+ i = ptr->max_idx + 1;
+ else {
+ if (start > end)
+ i = ((ptr->max_idx + 1) - start) + end;
+ else
+ i = end - start;
+ }
+ while (i) {
+ p = (void *)(ptr->p[start]);
+ ptr->p[start] = NULL;
+
+ if (p != NULL) {
+ if (plast == NULL)
+ *pkt = p;
+ else
+ PKTSETNEXT(osh, plast, p);
+
+ plast = p;
+ pkt_cnt++;
+ }
+ i--;
+ if (start++ == ptr->max_idx)
+ start = 0;
+ }
+ *pplast = plast;
+ *pkt_count = (uint32)pkt_cnt;
+}
+
+int
+dhd_process_pkt_reorder_info(dhd_pub_t *dhd, uchar *reorder_info_buf, uint reorder_info_len,
+ void **pkt, uint32 *pkt_count)
+{
+ uint8 flow_id, max_idx, cur_idx, exp_idx;
+ struct reorder_info *ptr;
+ uint8 flags;
+ void *cur_pkt, *plast = NULL;
+ uint32 cnt = 0;
+
+ if (pkt == NULL) {
+ if (pkt_count != NULL)
+ *pkt_count = 0;
+ return 0;
+ }
+
+ flow_id = reorder_info_buf[WLHOST_REORDERDATA_FLOWID_OFFSET];
+ flags = reorder_info_buf[WLHOST_REORDERDATA_FLAGS_OFFSET];
+
+ DHD_REORDER(("flow_id %d, flags 0x%02x, idx(%d, %d, %d)\n", flow_id, flags,
+ reorder_info_buf[WLHOST_REORDERDATA_CURIDX_OFFSET],
+ reorder_info_buf[WLHOST_REORDERDATA_EXPIDX_OFFSET],
+ reorder_info_buf[WLHOST_REORDERDATA_MAXIDX_OFFSET]));
+
+ /* validate flags and flow id */
+ if (flags == 0xFF) {
+ DHD_ERROR(("%s: invalid flags...so ignore this packet\n", __FUNCTION__));
+ *pkt_count = 1;
+ 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);
+
+ DHD_REORDER(("%s: Flags indicating to delete a flow id %d\n",
+ __FUNCTION__, flow_id));
+
+ if (ptr == NULL) {
+ DHD_REORDER(("%s: received flags to cleanup, but no flow (%d) yet\n",
+ __FUNCTION__, flow_id));
+ *pkt_count = 1;
+ *pkt = cur_pkt;
+ return 0;
+ }
+
+ dhd_get_hostreorder_pkts(dhd->osh, ptr, pkt, &cnt, &plast,
+ ptr->exp_idx, ptr->exp_idx);
+ /* set it to the last packet */
+ if (plast) {
+ PKTSETNEXT(dhd->osh, plast, cur_pkt);
+ cnt++;
+ }
+ else {
+ if (cnt != 0) {
+ DHD_ERROR(("%s: del flow: something fishy, pending packets %d\n",
+ __FUNCTION__, cnt));
+ }
+ *pkt = cur_pkt;
+ cnt = 1;
+ }
+ buf_size += ((ptr->max_idx + 1) * sizeof(void *));
+ MFREE(dhd->osh, ptr, buf_size);
+ dhd->reorder_bufs[flow_id] = NULL;
+ *pkt_count = cnt;
+ return 0;
+ }
+ /* all the other cases depend on the existance of the reorder struct for that flow id */
+ if (ptr == NULL) {
+ uint32 buf_size_alloc = sizeof(reorder_info_t);
+ max_idx = reorder_info_buf[WLHOST_REORDERDATA_MAXIDX_OFFSET];
+
+ buf_size_alloc += ((max_idx + 1) * sizeof(void*));
+ /* allocate space to hold the buffers, index etc */
+
+ DHD_REORDER(("%s: alloc buffer of size %d size, reorder info id %d, maxidx %d\n",
+ __FUNCTION__, buf_size_alloc, flow_id, max_idx));
+ ptr = (struct reorder_info *)MALLOC(dhd->osh, buf_size_alloc);
+ if (ptr == NULL) {
+ DHD_ERROR(("%s: Malloc failed to alloc buffer\n", __FUNCTION__));
+ *pkt_count = 1;
+ return 0;
+ }
+ bzero(ptr, buf_size_alloc);
+ dhd->reorder_bufs[flow_id] = ptr;
+ ptr->p = (void *)(ptr+1);
+ ptr->max_idx = max_idx;
+ }
+ if (flags & WLHOST_REORDERDATA_NEW_HOLE) {
+ DHD_REORDER(("%s: new hole, so cleanup pending buffers\n", __FUNCTION__));
+ if (ptr->pend_pkts) {
+ dhd_get_hostreorder_pkts(dhd->osh, ptr, pkt, &cnt, &plast,
+ ptr->exp_idx, ptr->exp_idx);
+ ptr->pend_pkts = 0;
+ }
+ ptr->cur_idx = reorder_info_buf[WLHOST_REORDERDATA_CURIDX_OFFSET];
+ ptr->exp_idx = reorder_info_buf[WLHOST_REORDERDATA_EXPIDX_OFFSET];
+ ptr->max_idx = reorder_info_buf[WLHOST_REORDERDATA_MAXIDX_OFFSET];
+ ptr->p[ptr->cur_idx] = cur_pkt;
+ ptr->pend_pkts++;
+ *pkt_count = cnt;
+ }
+ else if (flags & WLHOST_REORDERDATA_CURIDX_VALID) {
+ cur_idx = reorder_info_buf[WLHOST_REORDERDATA_CURIDX_OFFSET];
+ exp_idx = reorder_info_buf[WLHOST_REORDERDATA_EXPIDX_OFFSET];
+
+
+ if ((exp_idx == ptr->exp_idx) && (cur_idx != ptr->exp_idx)) {
+ /* still in the current hole */
+ /* enqueue the current on the buffer chain */
+ if (ptr->p[cur_idx] != NULL) {
+ DHD_REORDER(("%s: HOLE: ERROR buffer pending..free it\n",
+ __FUNCTION__));
+ PKTFREE(dhd->osh, ptr->p[cur_idx], TRUE);
+ ptr->p[cur_idx] = NULL;
+ }
+ ptr->p[cur_idx] = cur_pkt;
+ ptr->pend_pkts++;
+ ptr->cur_idx = cur_idx;
+ DHD_REORDER(("%s: fill up a hole..pending packets is %d\n",
+ __FUNCTION__, ptr->pend_pkts));
+ *pkt_count = 0;
+ *pkt = NULL;
+ }
+ else if (ptr->exp_idx == cur_idx) {
+ /* got the right one ..flush from cur to exp and update exp */
+ DHD_REORDER(("%s: got the right one now, cur_idx is %d\n",
+ __FUNCTION__, cur_idx));
+ if (ptr->p[cur_idx] != NULL) {
+ DHD_REORDER(("%s: Error buffer pending..free it\n",
+ __FUNCTION__));
+ PKTFREE(dhd->osh, ptr->p[cur_idx], TRUE);
+ ptr->p[cur_idx] = NULL;
+ }
+ ptr->p[cur_idx] = cur_pkt;
+ ptr->pend_pkts++;
+
+ ptr->cur_idx = cur_idx;
+ ptr->exp_idx = exp_idx;
+
+ dhd_get_hostreorder_pkts(dhd->osh, ptr, pkt, &cnt, &plast,
+ cur_idx, exp_idx);
+ ptr->pend_pkts -= (uint8)cnt;
+ *pkt_count = cnt;
+ DHD_REORDER(("%s: freeing up buffers %d, still pending %d\n",
+ __FUNCTION__, cnt, ptr->pend_pkts));
+ }
+ else {
+ uint8 end_idx;
+ bool flush_current = FALSE;
+ /* both cur and exp are moved now .. */
+ DHD_REORDER(("%s:, flow %d, both moved, cur %d(%d), exp %d(%d)\n",
+ __FUNCTION__, flow_id, ptr->cur_idx, cur_idx,
+ ptr->exp_idx, exp_idx));
+ if (flags & WLHOST_REORDERDATA_FLUSH_ALL)
+ end_idx = ptr->exp_idx;
+ else
+ end_idx = exp_idx;
+
+ /* flush pkts first */
+ dhd_get_hostreorder_pkts(dhd->osh, ptr, pkt, &cnt, &plast,
+ ptr->exp_idx, end_idx);
+
+ if (cur_idx == ptr->max_idx) {
+ if (exp_idx == 0)
+ flush_current = TRUE;
+ } else {
+ if (exp_idx == cur_idx + 1)
+ flush_current = TRUE;
+ }
+ if (flush_current) {
+ if (plast)
+ PKTSETNEXT(dhd->osh, plast, cur_pkt);
+ else
+ *pkt = cur_pkt;
+ cnt++;
+ }
+ else {
+ ptr->p[cur_idx] = cur_pkt;
+ ptr->pend_pkts++;
+ }
+ ptr->exp_idx = exp_idx;
+ ptr->cur_idx = cur_idx;
+ *pkt_count = cnt;
+ }
+ }
+ else {
+ uint8 end_idx;
+ /* no real packet but update to exp_seq...that means explicit window move */
+ exp_idx = reorder_info_buf[WLHOST_REORDERDATA_EXPIDX_OFFSET];
+
+ DHD_REORDER(("%s: move the window, cur_idx is %d, exp is %d, new exp is %d\n",
+ __FUNCTION__, ptr->cur_idx, ptr->exp_idx, exp_idx));
+ if (flags & WLHOST_REORDERDATA_FLUSH_ALL)
+ end_idx = ptr->exp_idx;
+ else
+ end_idx = exp_idx;
+
+ dhd_get_hostreorder_pkts(dhd->osh, ptr, pkt, &cnt, &plast, ptr->exp_idx, end_idx);
+ ptr->pend_pkts -= (uint8)cnt;
+ if (plast)
+ PKTSETNEXT(dhd->osh, plast, cur_pkt);
+ else
+ *pkt = cur_pkt;
+ cnt++;
+ *pkt_count = cnt;
+ /* set the new expected idx */
+ ptr->exp_idx = exp_idx;
+ }
+ return 0;
+}
/*
* Linux cfg80211 driver - Dongle Host Driver (DHD) related
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
/* send to dongle only if we are not waiting for reload already */
if (dhd->hang_was_sent) {
- WL_ERR(("%s: HANG was sent up earlier\n", __FUNCTION__));
+ WL_ERR(("HANG was sent up earlier\n"));
DHD_OS_WAKE_LOCK_CTRL_TIMEOUT_ENABLE(dhd, DHD_EVENT_TIMEOUT_MS);
DHD_OS_WAKE_UNLOCK(dhd);
return OSL_ERROR(BCME_DONGLE_DOWN);
ioc_res = dev_wlc_intvar_get_reg(dev, "btc_params", 27, ¶m27);
- WL_TRACE(("%s, sample[%d], btc params: 27:%x\n",
- __FUNCTION__, i, param27));
+ WL_TRACE(("sample[%d], btc params: 27:%x\n", i, param27));
if (ioc_res < 0) {
- WL_ERR(("%s ioc read btc params error\n", __FUNCTION__));
+ WL_ERR(("ioc read btc params error\n"));
break;
}
}
if (sco_id_cnt > 2) {
- WL_TRACE(("%s, sco/esco detected, pkt id_cnt:%d samples:%d\n",
- __FUNCTION__, sco_id_cnt, i));
+ WL_TRACE(("sco/esco detected, pkt id_cnt:%d samples:%d\n",
+ sco_id_cnt, i));
res = TRUE;
break;
}
(!dev_wlc_intvar_get_reg(dev, "btc_params", 65, &saved_reg65)) &&
(!dev_wlc_intvar_get_reg(dev, "btc_params", 71, &saved_reg71))) {
saved_status = TRUE;
- WL_TRACE(("%s saved bt_params[50,51,64,65,71]:"
+ WL_TRACE(("saved bt_params[50,51,64,65,71]:"
"0x%x 0x%x 0x%x 0x%x 0x%x\n",
- __FUNCTION__, saved_reg50, saved_reg51,
+ saved_reg50, saved_reg51,
saved_reg64, saved_reg65, saved_reg71));
} else {
WL_ERR((":%s: save btc_params failed\n",
static void wl_cfg80211_bt_timerfunc(ulong data)
{
struct btcoex_info *bt_local = (struct btcoex_info *)data;
- WL_TRACE(("%s\n", __FUNCTION__));
+ WL_TRACE(("Enter\n"));
bt_local->timer_on = 0;
schedule_work(&bt_local->work);
}
/* DHCP started
* provide OPPORTUNITY window to get DHCP address
*/
- WL_TRACE(("%s bt_dhcp stm: started \n",
- __FUNCTION__));
+ WL_TRACE(("bt_dhcp stm: started \n"));
+
btcx_inf->bt_state = BT_DHCP_OPPR_WIN;
mod_timer(&btcx_inf->timer,
jiffies + msecs_to_jiffies(BT_DHCP_OPPR_WIN_TIME));
case BT_DHCP_OPPR_WIN:
if (btcx_inf->dhcp_done) {
- WL_TRACE(("%s DHCP Done before T1 expiration\n",
- __FUNCTION__));
+ WL_TRACE(("DHCP Done before T1 expiration\n"));
goto btc_coex_idle;
}
/* DHCP is not over yet, start lowering BT priority
* enforce btc_params + flags if necessary
*/
- WL_TRACE(("%s DHCP T1:%d expired\n", __FUNCTION__,
- BT_DHCP_OPPR_WIN_TIME));
+ WL_TRACE(("DHCP T1:%d expired\n", BT_DHCP_OPPR_WIN_TIME));
if (btcx_inf->dev)
wl_cfg80211_bt_setflag(btcx_inf->dev, TRUE);
btcx_inf->bt_state = BT_DHCP_FLAG_FORCE_TIMEOUT;
case BT_DHCP_FLAG_FORCE_TIMEOUT:
if (btcx_inf->dhcp_done) {
- WL_TRACE(("%s DHCP Done before T2 expiration\n",
- __FUNCTION__));
+ WL_TRACE(("DHCP Done before T2 expiration\n"));
} else {
/* Noo dhcp during T1+T2, restore BT priority */
- WL_TRACE(("%s DHCP wait interval T2:%d"
- "msec expired\n", __FUNCTION__,
- BT_DHCP_FLAG_FORCE_TIME));
+ WL_TRACE(("DHCP wait interval T2:%d msec expired\n",
+ BT_DHCP_FLAG_FORCE_TIME));
}
/* Restoring default bt priority */
break;
default:
- WL_ERR(("%s error g_status=%d !!!\n", __FUNCTION__,
- btcx_inf->bt_state));
+ WL_ERR(("error g_status=%d !!!\n", btcx_inf->bt_state));
if (btcx_inf->dev)
wl_cfg80211_bt_setflag(btcx_inf->dev, FALSE);
btcx_inf->bt_state = BT_DHCP_IDLE;
if (!wl->btcoex_info)
return;
- if (!wl->btcoex_info->timer_on) {
+ if (wl->btcoex_info->timer_on) {
wl->btcoex_info->timer_on = 0;
del_timer_sync(&wl->btcoex_info->timer);
}
strncpy((char *)&powermode_val, command + strlen("BTCOEXMODE") +1, 1);
if (strnicmp((char *)&powermode_val, "1", strlen("1")) == 0) {
- WL_TRACE_HW4(("%s: DHCP session starts\n", __FUNCTION__));
+ WL_TRACE_HW4(("DHCP session starts\n"));
+
#ifdef PKT_FILTER_SUPPORT
dhd->dhcp_in_progress = 1;
btco_inf->bt_state = BT_DHCP_START;
btco_inf->timer_on = 1;
mod_timer(&btco_inf->timer, btco_inf->timer.expires);
- WL_TRACE(("%s enable BT DHCP Timer\n",
- __FUNCTION__));
+ WL_TRACE(("enable BT DHCP Timer\n"));
}
#endif /* COEX_DHCP */
}
else if (saved_status == TRUE) {
- WL_ERR(("%s was called w/o DHCP OFF. Continue\n", __FUNCTION__));
+ WL_ERR(("was called w/o DHCP OFF. Continue\n"));
}
}
else if (strnicmp((char *)&powermode_val, "2", strlen("2")) == 0) {
+
#ifdef PKT_FILTER_SUPPORT
dhd->dhcp_in_progress = 0;
- WL_TRACE_HW4(("%s: DHCP is complete \n", __FUNCTION__));
+ WL_TRACE_HW4(("DHCP is complete \n"));
/* Enable packet filtering */
if (dhd->early_suspended) {
WL_TRACE_HW4(("DHCP is complete , enable packet filter!!!\n"));
dhd_enable_packet_filter(1, dhd);
}
-#endif
+#endif /* PKT_FILTER_SUPPORT */
/* Restoring PM mode */
#ifdef COEX_DHCP
/* Stop any bt timer because DHCP session is done */
- WL_TRACE(("%s disable BT DHCP Timer\n", __FUNCTION__));
+ WL_TRACE(("disable BT DHCP Timer\n"));
if (btco_inf->timer_on) {
btco_inf->timer_on = 0;
del_timer_sync(&btco_inf->timer);
if (btco_inf->bt_state != BT_DHCP_IDLE) {
/* need to restore original btc flags & extra btc params */
- WL_TRACE(("%s bt->bt_state:%d\n",
- __FUNCTION__, btco_inf->bt_state));
+ WL_TRACE(("bt->bt_state:%d\n", btco_inf->bt_state));
/* wake up btcoex thread to restore btlags+params */
schedule_work(&btco_inf->work);
}
}
else {
- WL_ERR(("%s Unkwown yet power setting, ignored\n",
- __FUNCTION__));
+ WL_ERR(("Unkwown yet power setting, ignored\n"));
}
snprintf(command, 3, "OK");
/*
* Linux cfg80211 driver - Dongle Host Driver (DHD) related
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
/*
* Broadcom Dongle Host Driver (DHD), common DHD core.
*
- * Copyright (C) 1999-2012, Broadcom Corporation
- *
+ * Copyright (C) 1999-2013, 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
* 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 374530 2012-12-13 14:38:23Z $
+ * $Id: dhd_common.c 395575 2013-04-08 18:22:06Z $
*/
#include <typedefs.h>
#include <osl.h>
#include <dngl_stats.h>
#include <wlioctl.h>
#include <dhd.h>
+#include <dhd_ip.h>
#include <proto/bcmevent.h>
#ifdef WL_CFG80211
#include <wl_cfg80211.h>
#endif
-#ifdef WLBTAMP
-#include <proto/bt_amp_hci.h>
-#include <dhd_bta.h>
-#endif
#ifdef SET_RANDOM_MAC_SOFTAP
#include <linux/random.h>
#include <linux/jiffies.h>
#include <dhd_wlfc.h>
#endif
-
#ifdef WLMEDIA_HTSF
extern void htsf_update(struct dhd_info *dhd, void *data);
#endif
IOV_LOGSTAMP,
IOV_GPIOOB,
IOV_IOCTLTIMEOUT,
-#ifdef WLBTAMP
- IOV_HCI_CMD, /* HCI command */
- IOV_HCI_ACL_DATA, /* HCI data packet */
-#endif
#if defined(DHD_DEBUG)
IOV_CONS,
IOV_DCONSOLE_POLL,
#ifdef PROP_TXSTATUS
IOV_PROPTXSTATUS_ENABLE,
IOV_PROPTXSTATUS_MODE,
-#endif
+ IOV_PROPTXSTATUS_OPT,
+#ifdef QMONITOR
+ IOV_QMON_TIME_THRES,
+ IOV_QMON_TIME_PERCENT,
+#endif /* QMONITOR */
+#endif /* PROP_TXSTATUS */
IOV_BUS_TYPE,
#ifdef WLMEDIA_HTSF
IOV_WLPKTDLYSTAT_SZ,
{"clearcounts", IOV_CLEARCOUNTS, 0, IOVT_VOID, 0 },
{"gpioob", IOV_GPIOOB, 0, IOVT_UINT32, 0 },
{"ioctl_timeout", IOV_IOCTLTIMEOUT, 0, IOVT_UINT32, 0 },
-#ifdef WLBTAMP
- {"HCI_cmd", IOV_HCI_CMD, 0, IOVT_BUFFER, 0},
- {"HCI_ACL_data", IOV_HCI_ACL_DATA, 0, IOVT_BUFFER, 0},
-#endif
#ifdef PROP_TXSTATUS
{"proptx", IOV_PROPTXSTATUS_ENABLE, 0, IOVT_UINT32, 0 },
/*
2 - Use explicit credit
*/
{"ptxmode", IOV_PROPTXSTATUS_MODE, 0, IOVT_UINT32, 0 },
-#endif
+ {"proptx_opt", IOV_PROPTXSTATUS_OPT, 0, IOVT_UINT32, 0 },
+#ifdef QMONITOR
+ {"qtime_thres", IOV_QMON_TIME_THRES, 0, IOVT_UINT32, 0 },
+ {"qtime_percent", IOV_QMON_TIME_PERCENT, 0, IOVT_UINT32, 0 },
+#endif /* QMONITOR */
+#endif /* PROP_TXSTATUS */
{"bustype", IOV_BUS_TYPE, 0, IOVT_UINT32, 0},
#ifdef WLMEDIA_HTSF
{"pktdlystatsz", IOV_WLPKTDLYSTAT_SZ, 0, IOVT_UINT8, 0 },
void
dhd_common_init(osl_t *osh)
{
-#ifdef CONFIG_BCM4335_FW_PATH
- bcm_strncpy_s(fw_path, sizeof(fw_path), CONFIG_BCM4335_FW_PATH, MOD_PARAM_PATHLEN-1);
-#else /* CONFIG_BCM4335_FW_PATH */
+#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 */
fw_path[0] = '\0';
-#endif /* CONFIG_BCM4335_FW_PATH */
-#ifdef CONFIG_BCM4335_NVRAM_PATH
- bcm_strncpy_s(nv_path, sizeof(nv_path), CONFIG_BCM4335_NVRAM_PATH, MOD_PARAM_PATHLEN-1);
-#else /* CONFIG_BCM4335_NVRAM_PATH */
+#endif /* CONFIG_BCMDHD_FW_PATH */
+#ifdef CONFIG_BCMDHD_NVRAM_PATH
+ bcm_strncpy_s(nv_path, sizeof(nv_path), CONFIG_BCMDHD_NVRAM_PATH, MOD_PARAM_PATHLEN-1);
+#else /* CONFIG_BCMDHD_NVRAM_PATH */
nv_path[0] = '\0';
-#endif /* CONFIG_BCM4335_NVRAM_PATH */
+#endif /* CONFIG_BCMDHD_NVRAM_PATH */
#ifdef SOFTAP
fw_path2[0] = '\0';
#endif
}
+void
+dhd_common_deinit(dhd_pub_t *dhd_pub, dhd_cmn_t *sa_cmn)
+{
+ osl_t *osh;
+ dhd_cmn_t *cmn;
+
+ if (dhd_pub != NULL)
+ cmn = dhd_pub->cmn;
+ else
+ cmn = sa_cmn;
+
+ if (!cmn)
+ return;
+
+ osh = cmn->osh;
+
+ if (dhd_pub != NULL)
+ dhd_pub->cmn = NULL;
+
+ MFREE(osh, cmn, sizeof(dhd_cmn_t));
+}
+
static int
dhd_dump(dhd_pub_t *dhdp, char *buf, int buflen)
{
bcm_bprintf(strbuf, "\n");
bcm_bprintf(strbuf, "pub.up %d pub.txoff %d pub.busstate %d\n",
dhdp->up, dhdp->txoff, dhdp->busstate);
- bcm_bprintf(strbuf, "pub.hdrlen %d pub.maxctl %d pub.rxsz %d\n",
+ bcm_bprintf(strbuf, "pub.hdrlen %u pub.maxctl %u pub.rxsz %u\n",
dhdp->hdrlen, dhdp->maxctl, dhdp->rxsz);
bcm_bprintf(strbuf, "pub.iswl %d pub.drv_version %ld pub.mac %s\n",
dhdp->iswl, dhdp->drv_version, bcm_ether_ntoa(&dhdp->mac, eabuf));
- bcm_bprintf(strbuf, "pub.bcmerror %d tickcnt %d\n", dhdp->bcmerror, dhdp->tickcnt);
+ bcm_bprintf(strbuf, "pub.bcmerror %d tickcnt %u\n", dhdp->bcmerror, dhdp->tickcnt);
bcm_bprintf(strbuf, "dongle stats:\n");
- bcm_bprintf(strbuf, "tx_packets %ld tx_bytes %ld tx_errors %ld tx_dropped %ld\n",
+ bcm_bprintf(strbuf, "tx_packets %lu tx_bytes %lu tx_errors %lu tx_dropped %lu\n",
dhdp->dstats.tx_packets, dhdp->dstats.tx_bytes,
dhdp->dstats.tx_errors, dhdp->dstats.tx_dropped);
- bcm_bprintf(strbuf, "rx_packets %ld rx_bytes %ld rx_errors %ld rx_dropped %ld\n",
+ bcm_bprintf(strbuf, "rx_packets %lu rx_bytes %lu rx_errors %lu rx_dropped %lu\n",
dhdp->dstats.rx_packets, dhdp->dstats.rx_bytes,
dhdp->dstats.rx_errors, dhdp->dstats.rx_dropped);
- bcm_bprintf(strbuf, "multicast %ld\n", dhdp->dstats.multicast);
+ bcm_bprintf(strbuf, "multicast %lu\n", dhdp->dstats.multicast);
bcm_bprintf(strbuf, "bus stats:\n");
- bcm_bprintf(strbuf, "tx_packets %ld tx_multicast %ld tx_errors %ld\n",
+ bcm_bprintf(strbuf, "tx_packets %lu tx_multicast %lu tx_errors %lu\n",
dhdp->tx_packets, dhdp->tx_multicast, dhdp->tx_errors);
- bcm_bprintf(strbuf, "tx_ctlpkts %ld tx_ctlerrs %ld\n",
+ bcm_bprintf(strbuf, "tx_ctlpkts %lu tx_ctlerrs %lu\n",
dhdp->tx_ctlpkts, dhdp->tx_ctlerrs);
- bcm_bprintf(strbuf, "rx_packets %ld rx_multicast %ld rx_errors %ld \n",
+ bcm_bprintf(strbuf, "rx_packets %lu rx_multicast %lu rx_errors %lu \n",
dhdp->rx_packets, dhdp->rx_multicast, dhdp->rx_errors);
- bcm_bprintf(strbuf, "rx_ctlpkts %ld rx_ctlerrs %ld rx_dropped %ld\n",
+ bcm_bprintf(strbuf, "rx_ctlpkts %lu rx_ctlerrs %lu rx_dropped %lu\n",
dhdp->rx_ctlpkts, dhdp->rx_ctlerrs, dhdp->rx_dropped);
- bcm_bprintf(strbuf, "rx_readahead_cnt %ld tx_realloc %ld\n",
+ bcm_bprintf(strbuf, "rx_readahead_cnt %lu tx_realloc %lu\n",
dhdp->rx_readahead_cnt, dhdp->tx_realloc);
bcm_bprintf(strbuf, "\n");
int
dhd_wl_ioctl(dhd_pub_t *dhd_pub, int ifindex, wl_ioctl_t *ioc, void *buf, int len)
{
- int ret;
+ int ret = 0;
- dhd_os_proto_block(dhd_pub);
+ if (dhd_os_proto_block(dhd_pub))
+ {
- ret = dhd_prot_ioctl(dhd_pub, ifindex, ioc, buf, len);
-#if defined(CUSTOMER_HW4)
- if ((ret || ret == -ETIMEDOUT) && (dhd_pub->up))
-#else
+ ret = dhd_prot_ioctl(dhd_pub, ifindex, ioc, buf, len);
if ((ret) && (dhd_pub->up))
-#endif /* CUSTOMER_HW4 */
/* Send hang event only if dhd_open() was success */
dhd_os_check_hang(dhd_pub, ifindex, ret);
- dhd_os_proto_unblock(dhd_pub);
+ dhd_os_proto_unblock(dhd_pub);
-#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));
- else if (ioc->cmd == WLC_SET_VAR)
- DHD_ERROR(("%s: WLC_SET_VAR: %s, ret = %d\n",
- __FUNCTION__, (char *)ioc->buf, ret));
- else
- DHD_ERROR(("%s: WLC_IOCTL: cmd: %d, ret = %d\n",
- __FUNCTION__, ioc->cmd, ret));
- }
-#endif /* OEM_ANDROID && CUSTOMER_HW4 */
+ }
return ret;
}
break;
}
-#ifdef WLBTAMP
- case IOV_SVAL(IOV_HCI_CMD): {
- amp_hci_cmd_t *cmd = (amp_hci_cmd_t *)arg;
-
- /* sanity check: command preamble present */
- if (len < HCI_CMD_PREAMBLE_SIZE)
- return BCME_BUFTOOSHORT;
-
- /* sanity check: command parameters are present */
- if (len < (int)(HCI_CMD_PREAMBLE_SIZE + cmd->plen))
- return BCME_BUFTOOSHORT;
-
- dhd_bta_docmd(dhd_pub, cmd, len);
- break;
- }
-
- case IOV_SVAL(IOV_HCI_ACL_DATA): {
- amp_hci_ACL_data_t *ACL_data = (amp_hci_ACL_data_t *)arg;
-
- /* sanity check: HCI header present */
- if (len < HCI_ACL_DATA_PREAMBLE_SIZE)
- return BCME_BUFTOOSHORT;
-
- /* sanity check: ACL data is present */
- if (len < (int)(HCI_ACL_DATA_PREAMBLE_SIZE + ACL_data->dlen))
- return BCME_BUFTOOSHORT;
-
- dhd_bta_tx_hcidata(dhd_pub, ACL_data, len);
- break;
- }
-#endif /* WLBTAMP */
#ifdef PROP_TXSTATUS
case IOV_GVAL(IOV_PROPTXSTATUS_ENABLE):
wlfc->proptxstatus_mode = int_val & 0xff;
}
break;
+#ifdef QMONITOR
+ case IOV_GVAL(IOV_QMON_TIME_THRES): {
+ int_val = dhd_qmon_thres(dhd_pub, FALSE, 0);
+ bcopy(&int_val, arg, val_size);
+ break;
+ }
+
+ case IOV_SVAL(IOV_QMON_TIME_THRES): {
+ dhd_qmon_thres(dhd_pub, TRUE, int_val);
+ break;
+ }
+
+ case IOV_GVAL(IOV_QMON_TIME_PERCENT): {
+ int_val = dhd_qmon_getpercent(dhd_pub);
+ bcopy(&int_val, arg, val_size);
+ break;
+ }
+#endif /* QMONITOR */
#endif /* PROP_TXSTATUS */
case IOV_GVAL(IOV_BUS_TYPE):
return TRUE;
}
+/*
+ * Functions to drop proper pkts from queue:
+ * If one pkt in queue is non-fragmented, drop first non-fragmented pkt only
+ * If all pkts in queue are all fragmented, find and drop one whole set fragmented pkts
+ * If can't find pkts matching upper 2 cases, drop first pkt anyway
+ */
+bool
+dhd_prec_drop_pkts(osl_t *osh, struct pktq *pq, int prec)
+{
+ struct pktq_prec *q = NULL;
+ void *p, *prev = NULL, *next = NULL, *first = NULL, *last = NULL, *prev_first = NULL;
+ pkt_frag_t frag_info;
+
+ ASSERT(osh && pq);
+ ASSERT(prec >= 0 && prec < pq->num_prec);
+
+ q = &pq->q[prec];
+ p = q->head;
+
+ if (p == NULL)
+ return FALSE;
+
+ while (p) {
+ frag_info = pkt_frag_info(osh, p);
+ if (frag_info == DHD_PKT_FRAG_NONE) {
+ break;
+ } else if (frag_info == DHD_PKT_FRAG_FIRST) {
+ if (first) {
+ /* No last frag pkt, use prev as last */
+ last = prev;
+ } else {
+ first = p;
+ prev_first = prev;
+ }
+ } else if (frag_info == DHD_PKT_FRAG_LAST) {
+ if (first) {
+ last = p;
+ break;
+ }
+ }
+
+ prev = p;
+ p = PKTLINK(p);
+ }
+
+ if ((p == NULL) || ((frag_info != DHD_PKT_FRAG_NONE) && !(first && last))) {
+ /* Not found matching pkts, use oldest */
+ prev = NULL;
+ p = q->head;
+ frag_info = 0;
+ }
+
+ if (frag_info == DHD_PKT_FRAG_NONE) {
+ first = last = p;
+ prev_first = prev;
+ }
+
+ p = first;
+ while (p) {
+ next = PKTLINK(p);
+ q->len--;
+ pq->len--;
+
+ PKTSETLINK(p, NULL);
+
+ PKTFREE(osh, p, TRUE);
+
+ if (p == last)
+ break;
+
+ p = next;
+ }
+
+ if (prev_first == NULL) {
+ if ((q->head = next) == NULL)
+ q->tail = NULL;
+ } else {
+ PKTSETLINK(prev_first, next);
+ }
+
+ return TRUE;
+}
+
static int
dhd_iovar_op(dhd_pub_t *dhd_pub, const char *name,
void *params, int plen, void *arg, int len, bool set)
case WLC_E_TRACE: {
static uint32 seqnum_prev = 0;
+ static uint32 logtrace_seqnum_prev = 0;
msgtrace_hdr_t hdr;
uint32 nblost;
char *s, *p;
break;
}
- /* There are 2 bytes available at the end of data */
- buf[MSGTRACE_HDRLEN + ntoh16(hdr.len)] = '\0';
+ if (hdr.trace_type == MSGTRACE_HDR_TYPE_MSG) {
+ /* There are 2 bytes available at the end of data */
+ buf[MSGTRACE_HDRLEN + ntoh16(hdr.len)] = '\0';
- if (ntoh32(hdr.discarded_bytes) || ntoh32(hdr.discarded_printf)) {
- printf("\nWLC_E_TRACE: [Discarded traces in dongle -->"
- "discarded_bytes %d discarded_printf %d]\n",
- ntoh32(hdr.discarded_bytes), ntoh32(hdr.discarded_printf));
- }
+ if (ntoh32(hdr.discarded_bytes) || ntoh32(hdr.discarded_printf)) {
+ printf("\nWLC_E_TRACE: [Discarded traces in dongle -->"
+ "discarded_bytes %d discarded_printf %d]\n",
+ ntoh32(hdr.discarded_bytes), ntoh32(hdr.discarded_printf));
+ }
- nblost = ntoh32(hdr.seqnum) - seqnum_prev - 1;
- if (nblost > 0) {
- printf("\nWLC_E_TRACE: [Event lost --> seqnum %d nblost %d\n",
- ntoh32(hdr.seqnum), nblost);
- }
- seqnum_prev = ntoh32(hdr.seqnum);
-
- /* Display the trace buffer. Advance from \n to \n to avoid display big
- * printf (issue with Linux printk )
- */
- p = (char *)&buf[MSGTRACE_HDRLEN];
- while ((s = strstr(p, "\n")) != NULL) {
- *s = '\0';
- printf("%s\n", p);
- p = s+1;
+ nblost = ntoh32(hdr.seqnum) - seqnum_prev - 1;
+ if (nblost > 0) {
+ printf("\nWLC_E_TRACE: [Event lost (msg) --> seqnum %d nblost %d\n",
+ ntoh32(hdr.seqnum), nblost);
+ }
+ seqnum_prev = ntoh32(hdr.seqnum);
+
+ /* Display the trace buffer. Advance from \n to \n to avoid display big
+ * printf (issue with Linux printk )
+ */
+ p = (char *)&buf[MSGTRACE_HDRLEN];
+ while (*p != '\0' && (s = strstr(p, "\n")) != NULL) {
+ *s = '\0';
+ printf("%s\n", p);
+ p = s+1;
+ }
+ if (*p) printf("%s", p);
+
+ /* Reset datalen to avoid display below */
+ datalen = 0;
+
+ } else if (hdr.trace_type == MSGTRACE_HDR_TYPE_LOG) {
+ /* Let the standard event printing work for now */
+ uint32 timestamp, w;
+ if (ntoh32(hdr.seqnum) == logtrace_seqnum_prev) {
+ printf("\nWLC_E_TRACE: [Event duplicate (log) %d",
+ logtrace_seqnum_prev);
+ } else {
+ nblost = ntoh32(hdr.seqnum) - logtrace_seqnum_prev - 1;
+ if (nblost > 0) {
+ printf("\nWLC_E_TRACE: [Event lost (log)"
+ " --> seqnum %d nblost %d\n",
+ ntoh32(hdr.seqnum), nblost);
+ }
+ logtrace_seqnum_prev = ntoh32(hdr.seqnum);
+
+ p = (char *)&buf[MSGTRACE_HDRLEN];
+ datalen -= MSGTRACE_HDRLEN;
+ w = ntoh32((uint32) *p);
+ p += 4;
+ datalen -= 4;
+ timestamp = ntoh32((uint32) *p);
+ printf("Logtrace %x timestamp %x %x",
+ logtrace_seqnum_prev, timestamp, w);
+
+ while (datalen > 4) {
+ p += 4;
+ datalen -= 4;
+ /* Print each word. DO NOT ntoh it. */
+ printf(" %8.8x", *((uint32 *) p));
+ }
+ printf("\n");
+ }
+ datalen = 0;
}
- printf("%s\n", p);
- /* Reset datalen to avoid display below */
- datalen = 0;
break;
}
switch (type) {
#ifdef PROP_TXSTATUS
case WLC_E_FIFO_CREDIT_MAP:
+ dhd_os_wlfc_block(dhd_pub);
dhd_wlfc_event(dhd_pub->info);
dhd_wlfc_FIFOcreditmap_event(dhd_pub->info, event_data);
+ dhd_os_wlfc_unblock(dhd_pub);
WLFC_DBGMESG(("WLC_E_FIFO_CREDIT_MAP:(AC0,AC1,AC2,AC3),(BC_MC),(OTHER): "
"(%d,%d,%d,%d),(%d),(%d)\n", event_data[0], event_data[1],
event_data[2],
case WLC_E_IF:
{
dhd_if_event_t *ifevent = (dhd_if_event_t *)event_data;
+
/* Ignore the event if NOIF is set */
if (ifevent->flags & WLC_E_IF_FLAGS_BSSCFG_NOIF) {
- DHD_ERROR(("WLC_E_IF: NO_IF set, event Ignored\r\n"));
+ WLFC_DBGMESG(("WLC_E_IF: NO_IF set, event Ignored\r\n"));
return (BCME_OK);
}
+
#ifdef PROP_TXSTATUS
{
uint8* ea = pvt_data->eth.ether_dhost;
((ifevent->is_AP == 0) ? "STA":"AP "),
ea[0], ea[1], ea[2], ea[3], ea[4], ea[5]));
(void)ea;
+
+ dhd_os_wlfc_block(dhd_pub);
if (ifevent->action == WLC_E_IF_CHANGE)
dhd_wlfc_interface_event(dhd_pub->info,
eWLFC_MAC_ENTRY_ACTION_UPDATE,
((ifevent->action == WLC_E_IF_ADD) ?
eWLFC_MAC_ENTRY_ACTION_ADD : eWLFC_MAC_ENTRY_ACTION_DEL),
ifevent->ifidx, ifevent->is_AP, ea);
-
+ dhd_os_wlfc_unblock(dhd_pub);
/* dhd already has created an interface by default, for 0 */
if (ifevent->ifidx == 0)
htsf_update(dhd_pub->info, event_data);
break;
#endif /* WLMEDIA_HTSF */
-#if defined(NDIS630)
- case WLC_E_NDIS_LINK:
- break;
-#else /* defined(NDIS630) && defined(BCMDONGLEHOST) */
case WLC_E_NDIS_LINK: {
uint32 temp = hton32(WLC_E_LINK);
memcpy((void *)(&pvt_data->event.event_type), &temp,
sizeof(pvt_data->event.event_type));
}
-#endif
/* These are what external supplicant/authenticator wants */
/* fall through */
case WLC_E_LINK:
idx = 0;
iov_len = bcm_mkiovar("arp_table_clear", 0, 0, iovbuf, sizeof(iovbuf));
- if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, iov_len, TRUE, idx) < 0))
+ if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, iov_len, TRUE, idx)) < 0)
DHD_ERROR(("%s failed code %d\n", __FUNCTION__, ret));
}
dhd_sendup_event_common(dhd_pub_t *dhdp, wl_event_msg_t *event, void *data)
{
switch (ntoh32(event->event_type)) {
-#ifdef WLBTAMP
- case WLC_E_BTA_HCI_EVENT:
- break;
-#endif /* WLBTAMP */
default:
break;
}
dhd_sendup_event(dhdp, event, data);
}
-#ifdef SIMPLE_ISCAN
-
-uint iscan_thread_id = 0;
-iscan_buf_t * iscan_chain = 0;
-
-iscan_buf_t *
-dhd_iscan_allocate_buf(dhd_pub_t *dhd, iscan_buf_t **iscanbuf)
-{
- iscan_buf_t *iscanbuf_alloc = 0;
- iscan_buf_t *iscanbuf_head;
-
- DHD_ISCAN(("%s: Entered\n", __FUNCTION__));
- dhd_iscan_lock();
-
- iscanbuf_alloc = (iscan_buf_t*)MALLOC(dhd->osh, sizeof(iscan_buf_t));
- if (iscanbuf_alloc == NULL)
- goto fail;
-
- iscanbuf_alloc->next = NULL;
- iscanbuf_head = *iscanbuf;
-
- DHD_ISCAN(("%s: addr of allocated node = 0x%X"
- "addr of iscanbuf_head = 0x%X dhd = 0x%X\n",
- __FUNCTION__, iscanbuf_alloc, iscanbuf_head, dhd));
-
- if (iscanbuf_head == NULL) {
- *iscanbuf = iscanbuf_alloc;
- DHD_ISCAN(("%s: Head is allocated\n", __FUNCTION__));
- goto fail;
- }
-
- while (iscanbuf_head->next)
- iscanbuf_head = iscanbuf_head->next;
-
- iscanbuf_head->next = iscanbuf_alloc;
-
-fail:
- dhd_iscan_unlock();
- return iscanbuf_alloc;
-}
-
-void
-dhd_iscan_free_buf(void *dhdp, iscan_buf_t *iscan_delete)
-{
- iscan_buf_t *iscanbuf_free = 0;
- iscan_buf_t *iscanbuf_prv = 0;
- iscan_buf_t *iscanbuf_cur;
- dhd_pub_t *dhd = dhd_bus_pub(dhdp);
- DHD_ISCAN(("%s: Entered\n", __FUNCTION__));
-
- dhd_iscan_lock();
-
- iscanbuf_cur = iscan_chain;
-
- /* If iscan_delete is null then delete the entire
- * chain or else delete specific one provided
- */
- if (!iscan_delete) {
- while (iscanbuf_cur) {
- iscanbuf_free = iscanbuf_cur;
- iscanbuf_cur = iscanbuf_cur->next;
- iscanbuf_free->next = 0;
- MFREE(dhd->osh, iscanbuf_free, sizeof(iscan_buf_t));
- }
- iscan_chain = 0;
- } else {
- while (iscanbuf_cur) {
- if (iscanbuf_cur == iscan_delete)
- break;
- iscanbuf_prv = iscanbuf_cur;
- iscanbuf_cur = iscanbuf_cur->next;
- }
- if (iscanbuf_prv)
- iscanbuf_prv->next = iscan_delete->next;
-
- iscan_delete->next = 0;
- MFREE(dhd->osh, iscan_delete, sizeof(iscan_buf_t));
-
- if (!iscanbuf_prv)
- iscan_chain = 0;
- }
- dhd_iscan_unlock();
-}
-
-iscan_buf_t *
-dhd_iscan_result_buf(void)
-{
- return iscan_chain;
-}
-
-int
-dhd_iscan_issue_request(void * dhdp, wl_iscan_params_t *pParams, uint32 size)
-{
- int rc = -1;
- dhd_pub_t *dhd = dhd_bus_pub(dhdp);
- char *buf;
- char iovar[] = "iscan";
- uint32 allocSize = 0;
- wl_ioctl_t ioctl;
-
- if (pParams) {
- allocSize = (size + strlen(iovar) + 1);
- if ((allocSize < size) || (allocSize < strlen(iovar)))
- {
- DHD_ERROR(("%s: overflow - allocation size too large %d < %d + %d!\n",
- __FUNCTION__, allocSize, size, strlen(iovar)));
- goto cleanUp;
- }
- buf = MALLOC(dhd->osh, allocSize);
-
- if (buf == NULL)
- {
- DHD_ERROR(("%s: malloc of size %d failed!\n", __FUNCTION__, allocSize));
- goto cleanUp;
- }
- ioctl.cmd = WLC_SET_VAR;
- bcm_mkiovar(iovar, (char *)pParams, size, buf, allocSize);
- rc = dhd_wl_ioctl(dhd, 0, &ioctl, buf, allocSize);
- }
-
-cleanUp:
- if (buf) {
- MFREE(dhd->osh, buf, allocSize);
- }
-
- return rc;
-}
-
-static int
-dhd_iscan_get_partial_result(void *dhdp, uint *scan_count)
-{
- wl_iscan_results_t *list_buf;
- wl_iscan_results_t list;
- wl_scan_results_t *results;
- iscan_buf_t *iscan_cur;
- int status = -1;
- dhd_pub_t *dhd = dhd_bus_pub(dhdp);
- int rc;
- wl_ioctl_t ioctl;
-
- DHD_ISCAN(("%s: Enter\n", __FUNCTION__));
-
- iscan_cur = dhd_iscan_allocate_buf(dhd, &iscan_chain);
- if (!iscan_cur) {
- DHD_ERROR(("%s: Failed to allocate node\n", __FUNCTION__));
- dhd_iscan_free_buf(dhdp, 0);
- dhd_iscan_request(dhdp, WL_SCAN_ACTION_ABORT);
- dhd_ind_scan_confirm(dhdp, FALSE);
- goto fail;
- }
-
- dhd_iscan_lock();
-
- memset(iscan_cur->iscan_buf, 0, WLC_IW_ISCAN_MAXLEN);
- list_buf = (wl_iscan_results_t*)iscan_cur->iscan_buf;
- results = &list_buf->results;
- results->buflen = WL_ISCAN_RESULTS_FIXED_SIZE;
- results->version = 0;
- results->count = 0;
-
- memset(&list, 0, sizeof(list));
- list.results.buflen = htod32(WLC_IW_ISCAN_MAXLEN);
- bcm_mkiovar("iscanresults", (char *)&list, WL_ISCAN_RESULTS_FIXED_SIZE,
- iscan_cur->iscan_buf, WLC_IW_ISCAN_MAXLEN);
- ioctl.cmd = WLC_GET_VAR;
- ioctl.set = FALSE;
- rc = dhd_wl_ioctl(dhd, 0, &ioctl, iscan_cur->iscan_buf, WLC_IW_ISCAN_MAXLEN);
-
- results->buflen = dtoh32(results->buflen);
- results->version = dtoh32(results->version);
- *scan_count = results->count = dtoh32(results->count);
- status = dtoh32(list_buf->status);
- DHD_ISCAN(("%s: Got %d resuls status = (%x)\n", __FUNCTION__, results->count, status));
-
- dhd_iscan_unlock();
-
- if (!(*scan_count)) {
- /* TODO: race condition when FLUSH already called */
- dhd_iscan_free_buf(dhdp, 0);
- }
-fail:
- return status;
-}
-
-#endif /* SIMPLE_ISCAN */
/*
* returns = TRUE if associated, FALSE if not associated
int
dhd_get_suspend_bcn_li_dtim(dhd_pub_t *dhd)
{
- int bcn_li_dtim;
+ int bcn_li_dtim = 1; /* deafult no dtim skip setting */
int ret = -1;
int dtim_assoc = 0;
-
- bcn_li_dtim = dhd->suspend_bcn_li_dtim;
+ int ap_beacon = 0;
/* Check if associated */
if (dhd_is_associated(dhd, NULL, NULL) == FALSE) {
goto exit;
}
- /* if assoc grab ap's dtim value */
+ /* read associated AP beacon interval */
+ if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_GET_BCNPRD,
+ &ap_beacon, sizeof(ap_beacon), FALSE, 0)) < 0) {
+ DHD_ERROR(("%s get beacon failed code %d\n", __FUNCTION__, ret));
+ goto exit;
+ }
+
+ /* if associated APs Beacon more that 100msec do no dtim skip */
+ if (ap_beacon > MAX_DTIM_SKIP_BEACON_ITERVAL) {
+ DHD_ERROR(("%s NO dtim skip for AP with beacon %d ms\n", __FUNCTION__, ap_beacon));
+ goto exit;
+ }
+
+ /* read associated ap's dtim setup */
if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_GET_DTIMPRD,
&dtim_assoc, sizeof(dtim_assoc), FALSE, 0)) < 0) {
DHD_ERROR(("%s failed code %d\n", __FUNCTION__, ret));
goto exit;
}
- DHD_ERROR(("%s bcn_li_dtim=%d DTIM=%d Listen=%d\n",
- __FUNCTION__, bcn_li_dtim, dtim_assoc, LISTEN_INTERVAL));
-
/* if not assocated just eixt */
if (dtim_assoc == 0) {
goto exit;
}
+ /* attemp to use platform defined dtim skip interval */
+ bcn_li_dtim = dhd->suspend_bcn_li_dtim;
+
/* check if sta listen interval fits into AP dtim */
- if (dtim_assoc > LISTEN_INTERVAL) {
+ if (dtim_assoc > CUSTOM_LISTEN_INTERVAL) {
/* AP DTIM to big for our Listen Interval : no dtim skiping */
bcn_li_dtim = 1;
DHD_ERROR(("%s DTIM=%d > Listen=%d : too big ...\n",
- __FUNCTION__, dtim_assoc, LISTEN_INTERVAL));
+ __FUNCTION__, dtim_assoc, CUSTOM_LISTEN_INTERVAL));
goto exit;
}
- if ((bcn_li_dtim * dtim_assoc) > LISTEN_INTERVAL) {
+ if ((bcn_li_dtim * dtim_assoc) > CUSTOM_LISTEN_INTERVAL) {
/* Round up dtim_skip to fit into STAs Listen Interval */
- bcn_li_dtim = (int)(LISTEN_INTERVAL / dtim_assoc);
+ bcn_li_dtim = (int)(CUSTOM_LISTEN_INTERVAL / dtim_assoc);
DHD_TRACE(("%s agjust dtim_skip as %d\n", __FUNCTION__, bcn_li_dtim));
}
+ DHD_ERROR(("%s beacon=%d bcn_li_dtim=%d DTIM=%d Listen=%d\n",
+ __FUNCTION__, ap_beacon, bcn_li_dtim, dtim_assoc, CUSTOM_LISTEN_INTERVAL));
+
exit:
return bcn_li_dtim;
}
return TRUE;
}
+
#if defined(PNO_SUPPORT)
int
dhd_pno_clean(dhd_pub_t *dhd)
strncpy(buf, str, str_len);
buf[ str_len ] = '\0';
mkeep_alive_pktp = (wl_mkeep_alive_pkt_t *) (buf + str_len + 1);
- mkeep_alive_pkt.period_msec = CUSTOM_KEEP_ALIVE_PERIOD;
+ mkeep_alive_pkt.period_msec = CUSTOM_KEEP_ALIVE_SETTING;
buf_len = str_len + 1;
mkeep_alive_pkt.version = htod16(WL_MKEEP_ALIVE_VERSION);
mkeep_alive_pkt.length = htod16(WL_MKEEP_ALIVE_FIXED_LEN);
/*
* Customer code to add GPIO control during WLAN start/stop
-* Copyright (C) 1999-2012, Broadcom Corporation
+* Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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 353280 2012-08-26 04:33:17Z $
+* $Id: dhd_custom_gpio.c 389250 2013-03-06 02:05:03Z $
*/
#include <typedefs.h>
extern void bcm_wlan_power_off(int);
extern void bcm_wlan_power_on(int);
#endif /* CUSTOMER_HW */
-#if defined(CUSTOMER_HW2) || defined(CUSTOMER_HW4)
+#if defined(CUSTOMER_HW2)
+
+
#ifdef CONFIG_WIFI_CONTROL_FUNC
int wifi_set_power(int on, unsigned long msec);
int wifi_get_irq_number(unsigned long *irq_flags_ptr);
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_HW4 */
+#endif
-#if defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID)
+#if defined(OOB_INTR_ONLY)
#if defined(BCMLXSDMMC)
extern int sdioh_mmc_irq(int irq);
#endif /* (BCMLXSDMMC) */
-#ifdef CUSTOMER_HW3
+#if defined(CUSTOMER_HW3)
#include <mach/gpio.h>
#endif
{
int host_oob_irq = 0;
-#if defined(CUSTOMER_HW2) || defined(CUSTOMER_HW4)
+#if defined(CUSTOMER_HW2)
host_oob_irq = wifi_get_irq_number(irq_flags_ptr);
#else
host_oob_irq = gpio_to_irq(dhd_oob_gpio_num);
gpio_direction_input(dhd_oob_gpio_num);
#endif /* CUSTOMER_HW */
-#endif /* CUSTOMER_HW2 || CUSTOMER_HW4 */
+#endif
return (host_oob_irq);
}
-#endif /* defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID) */
+#endif
/* Customer function to control hw specific wlan gpios */
void
#ifdef CUSTOMER_HW
bcm_wlan_power_off(2);
#endif /* CUSTOMER_HW */
-#if defined(CUSTOMER_HW2) || defined(CUSTOMER_HW4)
+#if defined(CUSTOMER_HW2)
wifi_set_power(0, 0);
#endif
WL_ERROR(("=========== WLAN placed in RESET ========\n"));
#ifdef CUSTOMER_HW
bcm_wlan_power_on(2);
#endif /* CUSTOMER_HW */
-#if defined(CUSTOMER_HW2) || defined(CUSTOMER_HW4)
+#if defined(CUSTOMER_HW2)
wifi_set_power(1, 0);
#endif
WL_ERROR(("=========== WLAN going back to live ========\n"));
}
#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 */
return;
#endif /* defined(CUSTOMER_HW2) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)) */
}
-#endif /* CUSTOMER_HW4 */
/*
* Debug/trace/assert driver definitions for Dongle Host Driver.
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
#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_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_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
--- /dev/null
+/*
+ * IP Packet Parser Module.
+ *
+ * Copyright (C) 1999-2013, 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$
+ */
+#include <typedefs.h>
+#include <osl.h>
+
+#include <proto/ethernet.h>
+#include <proto/vlan.h>
+#include <proto/802.3.h>
+#include <proto/bcmip.h>
+#include <bcmendian.h>
+
+#include <dhd_dbg.h>
+
+#include <dhd_ip.h>
+
+/* special values */
+/* 802.3 llc/snap header */
+static const uint8 llc_snap_hdr[SNAP_HDR_LEN] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00};
+
+pkt_frag_t pkt_frag_info(osl_t *osh, void *p)
+{
+ uint8 *frame;
+ int length;
+ uint8 *pt; /* Pointer to type field */
+ uint16 ethertype;
+ struct ipv4_hdr *iph; /* IP frame pointer */
+ int ipl; /* IP frame length */
+ uint16 iph_frag;
+
+ ASSERT(osh && p);
+
+ frame = PKTDATA(osh, p);
+ length = PKTLEN(osh, p);
+
+ /* Process Ethernet II or SNAP-encapsulated 802.3 frames */
+ if (length < ETHER_HDR_LEN) {
+ DHD_INFO(("%s: short eth frame (%d)\n", __FUNCTION__, length));
+ return DHD_PKT_FRAG_NONE;
+ } else if (ntoh16(*(uint16 *)(frame + ETHER_TYPE_OFFSET)) >= ETHER_TYPE_MIN) {
+ /* Frame is Ethernet II */
+ pt = frame + ETHER_TYPE_OFFSET;
+ } else if (length >= ETHER_HDR_LEN + SNAP_HDR_LEN + ETHER_TYPE_LEN &&
+ !bcmp(llc_snap_hdr, frame + ETHER_HDR_LEN, SNAP_HDR_LEN)) {
+ pt = frame + ETHER_HDR_LEN + SNAP_HDR_LEN;
+ } else {
+ DHD_INFO(("%s: non-SNAP 802.3 frame\n", __FUNCTION__));
+ return DHD_PKT_FRAG_NONE;
+ }
+
+ ethertype = ntoh16(*(uint16 *)pt);
+
+ /* Skip VLAN tag, if any */
+ if (ethertype == ETHER_TYPE_8021Q) {
+ pt += VLAN_TAG_LEN;
+
+ if (pt + ETHER_TYPE_LEN > frame + length) {
+ DHD_INFO(("%s: short VLAN frame (%d)\n", __FUNCTION__, length));
+ return DHD_PKT_FRAG_NONE;
+ }
+
+ ethertype = ntoh16(*(uint16 *)pt);
+ }
+
+ if (ethertype != ETHER_TYPE_IP) {
+ DHD_INFO(("%s: non-IP frame (ethertype 0x%x, length %d)\n",
+ __FUNCTION__, ethertype, length));
+ return DHD_PKT_FRAG_NONE;
+ }
+
+ iph = (struct ipv4_hdr *)(pt + ETHER_TYPE_LEN);
+ ipl = length - (pt + ETHER_TYPE_LEN - frame);
+
+ /* We support IPv4 only */
+ if ((ipl < IPV4_OPTIONS_OFFSET) || (IP_VER(iph) != IP_VER_4)) {
+ DHD_INFO(("%s: short frame (%d) or non-IPv4\n", __FUNCTION__, ipl));
+ return DHD_PKT_FRAG_NONE;
+ }
+
+ iph_frag = ntoh16(iph->frag);
+
+ if (iph_frag & IPV4_FRAG_DONT) {
+ return DHD_PKT_FRAG_NONE;
+ } else if ((iph_frag & IPV4_FRAG_MORE) == 0) {
+ return DHD_PKT_FRAG_LAST;
+ } else {
+ return (iph_frag & IPV4_FRAG_OFFSET_MASK)? DHD_PKT_FRAG_CONT : DHD_PKT_FRAG_FIRST;
+ }
+}
/*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Header file describing the common ip parser function.
+ *
+ * Provides type definitions and function prototypes used to parse ip packet.
+ *
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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.1D
- *
- * $Id: 802.1d.h 241182 2011-02-17 21:50:03Z $
+ * $Id$
*/
-#ifndef _802_1_D_
-#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 NUMPRIO (MAXPRIO + 1)
-
-#define ALLPRIO -1
+#ifndef _dhd_ip_h_
+#define _dhd_ip_h_
+typedef enum pkt_frag
+{
+ DHD_PKT_FRAG_NONE = 0,
+ DHD_PKT_FRAG_FIRST,
+ DHD_PKT_FRAG_CONT,
+ DHD_PKT_FRAG_LAST
+} pkt_frag_t;
-#define PRIO2PREC(prio) \
- (((prio) == PRIO_8021D_NONE || (prio) == PRIO_8021D_BE) ? ((prio^2)) : (prio))
+extern pkt_frag_t pkt_frag_info(osl_t *osh, void *p);
-#endif
+#endif /* _dhd_ip_h_ */
* Broadcom Dongle Host Driver (DHD), Linux-specific network interface
* Basically selected code segments from usb-cdc.c and usb-rndis.c
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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 376110 2012-12-21 08:38:57Z $
+ * $Id: dhd_linux.c 403379 2013-05-20 18:01:40Z $
*/
#include <typedefs.h>
#include <linux/init.h>
#include <linux/kernel.h>
+#ifdef USE_KTHREAD_API
+#include <linux/kthread.h>
+#endif
#include <linux/slab.h>
#include <linux/skbuff.h>
#include <linux/netdevice.h>
#include <linux/ethtool.h>
#include <linux/fcntl.h>
#include <linux/fs.h>
+#include <linux/ip.h>
#include <asm/uaccess.h>
#include <asm/unaligned.h>
#include <wl_cfg80211.h>
#endif
-#ifdef WLBTAMP
-#include <proto/802.11_bta.h>
-#include <proto/bt_amp_hci.h>
-#include <dhd_bta.h>
-#endif
#ifdef WLMEDIA_HTSF
#include <linux/time.h>
static histo_t vi_d1, vi_d2, vi_d3, vi_d4;
#endif /* WLMEDIA_HTSF */
-#if defined(BLOCK_IPV6_PACKET) && defined(CUSTOMER_HW4)
-#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 && CUSTOMER_HW4 */
#if defined(SOFTAP)
extern bool ap_cfg_running;
extern bool ap_fw_loaded;
#endif
+
/* enable HOSTIP cache update from the host side when an eth0:N is up */
#define AOE_IP_ALIAS_SUPPORT 1
#if defined(OOB_INTR_ONLY)
extern void dhd_enable_oob_intr(struct dhd_bus *bus, bool enable);
-#endif /* defined(OOB_INTR_ONLY) */
+#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && (1)
static void dhd_hang_process(struct work_struct *work);
#endif
#endif
#endif /* BCM_FD_AGGR */
+#ifdef PROP_TXSTATUS
+extern bool dhd_wlfc_skip_fc(void);
+extern void dhd_wlfc_plat_enable(void *dhd);
+extern void dhd_wlfc_plat_deinit(void *dhd);
+#endif /* PROP_TXSTATUS */
+
#if LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 15)
const char *
print_tainted()
#endif /* LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 15) */
/* Linux wireless extension support */
-#if defined(CONFIG_WIRELESS_EXT)
+#if defined(WL_WIRELESS_EXT)
#include <wl_iw.h>
extern wl_iw_extra_params_t g_wl_iw_params;
-#endif /* defined(CONFIG_WIRELESS_EXT) */
-
-#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
+#endif /* defined(WL_WIRELESS_EXT) */
+
#if defined(CONFIG_HAS_EARLYSUSPEND) && defined(DHD_USE_EARLYSUSPEND)
#include <linux/earlysuspend.h>
#endif /* defined(CONFIG_HAS_EARLYSUSPEND) && defined(DHD_USE_EARLYSUSPEND) */
-#endif /* CUSTOMER_HW4 && CONFIG_PARTIALSUSPEND_SLP */
extern int dhd_get_suspend_bcn_li_dtim(dhd_pub_t *dhd);
extern void dhd_pktfilter_offload_enable(dhd_pub_t * dhd, char *arg, int enable, int master_mode);
#endif
-#ifdef CUSTOMER_HW4
-#ifdef READ_MACADDR
-extern int dhd_read_macaddr(struct dhd_info *dhd, struct ether_addr *mac);
-#endif
-#ifdef RDWR_MACADDR
-extern int dhd_check_rdwr_macaddr(struct dhd_info *dhd, dhd_pub_t *dhdp, struct ether_addr *mac);
-extern int dhd_write_rdwr_macaddr(struct ether_addr *mac);
-#endif
-#ifdef WRITE_MACADDR
-extern int dhd_write_macaddr(struct ether_addr *mac);
-#endif
-#ifdef USE_CID_CHECK
-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, struct ether_addr *mac);
-#endif
-#ifdef MIMO_ANT_SETTING
-extern int dhd_sel_ant_from_file(dhd_pub_t *dhd);
-#endif
-#ifdef GLOBALCONFIG_WLAN_COUNTRY_CODE
-int dhd_customer_set_country(dhd_pub_t *dhd);
-#endif
-
-#else
#ifdef READ_MACADDR
extern int dhd_read_macaddr(struct dhd_info *dhd);
#ifdef WRITE_MACADDR
extern int dhd_write_macaddr(struct ether_addr *mac);
#endif
-#endif /* CUSTOMER_HW4 */
/* Interface control information */
typedef struct dhd_if {
/* Local private structure (extension of pub) */
typedef struct dhd_info {
-#if defined(CONFIG_WIRELESS_EXT)
+#if defined(WL_WIRELESS_EXT)
wl_iw_t iw; /* wireless extensions state (must be first) */
-#endif /* defined(CONFIG_WIRELESS_EXT) */
+#endif /* defined(WL_WIRELESS_EXT) */
dhd_pub_t pub;
htsf_t htsf;
#endif
wait_queue_head_t ioctl_resp_wait;
+ uint32 default_wd_interval;
+
struct timer_list timer;
bool wd_timer_valid;
struct tasklet_struct tasklet;
/* 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 */
- struct wake_lock *wl_wdwake; /* Wifi wd wakelock */
+ struct wake_lock wl_wifi; /* Wifi wakelock */
+ struct wake_lock wl_rxwake; /* Wifi rx wakelock */
+ struct wake_lock wl_ctrlwake; /* Wifi ctrl wakelock */
+ struct wake_lock wl_wdwake; /* Wifi wd wakelock */
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) && 1
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);
/* ARP offload enable */
uint dhd_arp_enable = TRUE;
module_param(dhd_arp_enable, uint, 0);
+
+/* ARP offload agent mode : Enable ARP Host Auto-Reply and ARP Peer Auto-Reply */
+
+uint dhd_arp_mode = ARP_OL_AGENT | ARP_OL_PEER_AUTO_REPLY;
+
+module_param(dhd_arp_mode, uint, 0);
#endif /* ARP_OFFLOAD_SUPPORT */
+
/* 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);
-#ifdef CUSTOMER_HW4
-module_param_string(nvram_path, nvram_path, MOD_PARAM_PATHLEN, 0660);
-#else
module_param_string(nvram_path, nvram_path, MOD_PARAM_PATHLEN, 0);
-#endif /* CUSTOMER_HW4 */
/* Watchdog interval */
+
+/* extend watchdog expiration to 2 seconds when DPC is running */
+#define WATCHDOG_EXTEND_INTERVAL (2000)
+
uint dhd_watchdog_ms = 10;
module_param(dhd_watchdog_ms, uint, 0);
module_param(dhd_console_ms, uint, 0644);
#endif /* defined(DHD_DEBUG) */
-#ifdef REPEAT_READFRAME
-uint dhd_doflow = 1;
-module_param(dhd_doflow, uint, 0644);
-
-uint dhd_dpcpoll = 1;
-module_param(dhd_dpcpoll, uint, 0644);
-#endif /* REPEAT_READFRAME */
-
uint dhd_slpauto = TRUE;
module_param(dhd_slpauto, uint, 0);
-/* ARP offload agent mode : Enable ARP Host Auto-Reply and ARP Peer Auto-Reply */
-#if defined(CUSTOMER_HW4)
-uint dhd_arp_mode = ARP_OL_AGENT | ARP_OL_PEER_AUTO_REPLY | ARP_OL_SNOOP;
-#else
-uint dhd_arp_mode = ARP_OL_AGENT | ARP_OL_PEER_AUTO_REPLY;
-#endif
-
-module_param(dhd_arp_mode, uint, 0);
-
#ifdef PKT_FILTER_SUPPORT
/* Global Pkt filter enable control */
uint dhd_pkt_filter_enable = TRUE;
#endif /* RXFRAME_THREAD */
/* DPC thread priority, -1 to use tasklet */
-extern int dhd_dongle_memsize;
-module_param(dhd_dongle_memsize, int, 0);
+extern int dhd_dongle_ramsize;
+module_param(dhd_dongle_ramsize, 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;
int dhd_monitor_init(void *dhd_pub);
int dhd_monitor_uninit(void);
-#if defined(CUSTOMER_HW4) && defined(CONFIG_CONTROL_PM)
-bool g_pm_control;
-void sec_control_pm(dhd_pub_t *dhd, uint *);
-#endif /* CUSTOMER_HW4 & CONFIG_CONTROL_PM */
-#if defined(CONFIG_WIRELESS_EXT)
+
+#if defined(WL_WIRELESS_EXT)
struct iw_statistics *dhd_get_wireless_stats(struct net_device *dev);
-#endif /* defined(CONFIG_WIRELESS_EXT) */
+#endif /* defined(WL_WIRELESS_EXT) */
static void dhd_dpc(ulong data);
/* forward decl */
extern int dhd_wait_pend8021x(struct net_device *dev);
+void dhd_os_wd_timer_extend(void *bus, bool extend);
#ifdef TOE
#ifndef BDC
(dhd_support_sta_mode(dhd) && !dhd->dhcp_in_progress)))
{
for (i = 0; i < dhd->pktfilter_count; i++) {
-#ifdef PASS_ARP_PACKET
+#if !defined(GAN_LITE_NAT_KEEPALIVE_FILTER) && defined(PASS_ARP_PACKET)
if (value && (i == dhd->pktfilter_count -1) &&
!(dhd->op_mode & (DHD_FLAG_P2P_GC_MODE | DHD_FLAG_P2P_GO_MODE))) {
DHD_TRACE_HW4(("Do not turn on ARP white list pkt filter:"
value, i, dhd->op_mode));
continue;
}
-#endif
+#endif /* !GAN_LITE_NAT_KEEPALIVE_FILTER && PASS_ARP_PACKET */
dhd_pktfilter_offload_enable(dhd, dhd->pktfilter[i],
value, dhd_master_mode);
}
/* wl_pkt_filter_enable_t enable_parm; */
char iovbuf[32];
int bcn_li_dtim = 0; /* Default bcn_li_dtim in resume mode is 0 */
-#ifndef DISABLE_FW_ROAM_SUSPEND
+#ifndef ENABLE_FW_ROAM_SUSPEND
uint roamvar = 1;
-#endif /* DISABLE_FW_ROAM_SUSPEND */
-#if defined(CUSTOMER_HW4) && defined(ENABLE_BCN_LI_BCN_WAKEUP)
- int bcn_li_bcn;
-#endif /* CUSTOMER_HW4 && ENABLE_BCN_LI_BCN_WAKEUP */
-#if defined(PASS_ALL_MCAST_PKTS) && defined(CUSTOMER_HW4)
- struct dhd_info *dhdinfo = dhd->info;
- uint32 allmulti;
- uint i;
-#endif /* PASS_ALL_MCAST_PKTS && CUSTOMER_HW4 */
+#endif /* ENABLE_FW_ROAM_SUSPEND */
if (!dhd)
return -ENODEV;
/* Enable packet filter, only allow unicast packet to send up */
dhd_enable_packet_filter(1, dhd);
-#if defined(PASS_ALL_MCAST_PKTS) && defined(CUSTOMER_HW4)
- allmulti = 0;
- bcm_mkiovar("allmulti", (char *)&allmulti, 4,
- iovbuf, sizeof(iovbuf));
- for (i = 0; i < DHD_MAX_IFS; i++) {
- if (dhdinfo->iflist[i] && dhdinfo->iflist[i]->net)
- dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf,
- sizeof(iovbuf), TRUE, i);
- }
-#endif /* PASS_ALL_MCAST_PKTS && CUSTOMER_HW4 */
/* If DTIM skip is set up as default, force it to wake
* each third DTIM for better power savings. Note that
TRUE, 0) < 0)
DHD_ERROR(("%s: set dtim failed\n", __FUNCTION__));
-#ifndef DISABLE_FW_ROAM_SUSPEND
+#ifndef ENABLE_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
-#if defined(CUSTOMER_HW4) && defined(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 /* CUSTOMER_HW4 && ENABLE_BCN_LI_BCN_WAKEUP */
+#endif /* ENABLE_FW_ROAM_SUSPEND */
} else {
#ifdef PKT_FILTER_SUPPORT
dhd->early_suspended = 0;
/* disable pkt filter */
dhd_enable_packet_filter(0, dhd);
#endif /* PKT_FILTER_SUPPORT */
-#if defined(PASS_ALL_MCAST_PKTS) && defined(CUSTOMER_HW4)
- allmulti = 1;
- bcm_mkiovar("allmulti", (char *)&allmulti, 4,
- iovbuf, sizeof(iovbuf));
- for (i = 0; i < DHD_MAX_IFS; i++) {
- if (dhdinfo->iflist[i] && dhdinfo->iflist[i]->net)
- dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf,
- sizeof(iovbuf), TRUE, i);
- }
-#endif /* PASS_ALL_MCAST_PKTS && CUSTOMER_HW4 */
/* restore pre-suspend setting for dtim_skip */
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);
-#ifndef DISABLE_FW_ROAM_SUSPEND
+#ifndef ENABLE_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 /* DISABLE_FW_ROAM_SUSPEND */
-#if defined(CUSTOMER_HW4) && defined(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 /* CUSTOMER_HW4 && ENABLE_BCN_LI_BCN_WAKEUP */
+#endif /* ENABLE_FW_ROAM_SUSPEND */
}
}
dhd_suspend_unlock(dhd);
uint buflen;
int ret;
-#ifdef MCAST_LIST_ACCUMULATION
- int i;
- uint32 cnt_iface[DHD_MAX_IFS];
- cnt = 0;
- allmulti = 0;
-
- for (i = 0; i < DHD_MAX_IFS; i++) {
- if (dhd->iflist[i]) {
- dev = dhd->iflist[i]->net;
- if (!dev)
- continue;
-#else
ASSERT(dhd && dhd->iflist[ifidx]);
dev = dhd->iflist[ifidx]->net;
if (!dev)
return;
-#endif /* MCAST_LIST_ACCUMULATION */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
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);
-#endif /* MCAST_LIST_ACCUMULATION */
-#else
-#ifdef MCAST_LIST_ACCUMULATION
- cnt += dev->mc_count;
#else
cnt = dev->mc_count;
-#endif /* MCAST_LIST_ACCUMULATION */
#endif /* LINUX_VERSION_CODE */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
#endif
/* Determine initial value of allmulti flag */
-#ifdef MCAST_LIST_ACCUMULATION
- allmulti |= (dev->flags & IFF_ALLMULTI) ? TRUE : FALSE;
- }
- }
-#else
allmulti = (dev->flags & IFF_ALLMULTI) ? TRUE : FALSE;
-#endif /* MCAST_LIST_ACCUMULATION */
-#if defined(PASS_ALL_MCAST_PKTS) && defined(CUSTOMER_HW4)
-#ifdef PKT_FILTER_SUPPORT
- if (!dhd->pub.early_suspended)
-#endif /* PKT_FILTER_SUPPORT */
- allmulti = TRUE;
-#endif /* PASS_ALL_MCAST_PKTS && CUSTOMER_HW4 */
/* Send down the multicast list first. */
memcpy(bufp, &cnt, sizeof(cnt));
bufp += sizeof(cnt);
-#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));
- dev = dhd->iflist[i]->net;
-#endif /* MCAST_LIST_ACCUMULATION */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
netif_addr_lock_bh(dev);
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)
netdev_for_each_mc_addr(ha, dev) {
-#ifdef MCAST_LIST_ACCUMULATION
- if (!cnt_iface[i])
-#else
if (!cnt)
-#endif /* MCAST_LIST_ACCUMULATION */
break;
memcpy(bufp, ha->addr, ETHER_ADDR_LEN);
bufp += ETHER_ADDR_LEN;
-#ifdef MCAST_LIST_ACCUMULATION
- DHD_TRACE(("_dhd_set_multicast_list: cnt "
- "%d " MACDBG "\n",
- cnt_iface[i], MAC2STRDBG(ha->addr)));
- cnt_iface[i]--;
-#else
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) {
#else
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;
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
netif_addr_unlock_bh(dev);
#endif
-#ifdef MCAST_LIST_ACCUMULATION
- }
- }
-#endif /* MCAST_LIST_ACCUMULATION */
memset(&ioc, 0, sizeof(ioc));
ioc.cmd = WLC_SET_VAR;
/* Finally, pick up the PROMISC flag as well, like the NIC driver does */
-#ifdef MCAST_LIST_ACCUMULATION
- allmulti = 0;
- for (i = 0; i < DHD_MAX_IFS; i++) {
- if (dhd->iflist[i]) {
- dev = dhd->iflist[i]->net;
- allmulti |= (dev->flags & IFF_PROMISC) ? TRUE : FALSE;
- }
- }
-#else
allmulti = (dev->flags & IFF_PROMISC) ? TRUE : FALSE;
-#endif /* MCAST_LIST_ACCUMULATION */
allmulti = htol32(allmulti);
}
/* Allocate etherdev, including space for private structure */
if (!(ifp->net = alloc_etherdev(sizeof(dhd)))) {
- DHD_ERROR(("%s: OOM - alloc_etherdev\n", __FUNCTION__));
+ DHD_ERROR(("%s: OOM - alloc_etherdev(%d)\n", __FUNCTION__, sizeof(dhd)));
ret = -ENOMEM;
}
if (ret == 0) {
}
}
-
#ifdef DHDTCPACK_SUPPRESS
uint dhd_use_tcpack_suppress = TRUE;
module_param(dhd_use_tcpack_suppress, uint, FALSE);
#endif
while (down_interruptible(&tsk->sema) == 0) {
-#ifdef MCAST_LIST_ACCUMULATION
- bool set_multicast = FALSE;
-#endif /* MCAST_LIST_ACCUMULATION */
SMP_RD_BARRIER_DEPENDS();
if (tsk->terminated) {
continue;
if (dhd->iflist[i]->set_multicast) {
dhd->iflist[i]->set_multicast = FALSE;
-#ifdef MCAST_LIST_ACCUMULATION
- set_multicast = TRUE;
-#else
_dhd_set_multicast_list(dhd, i);
-#endif /* MCAST_LIST_ACCUMULATION */
}
if (dhd->set_macaddress == i+1) {
}
}
}
-#ifdef MCAST_LIST_ACCUMULATION
- if (set_multicast)
- _dhd_set_multicast_list(dhd, 0);
-#endif /* MCAST_LIST_ACCUMULATION */
DHD_OS_WAKE_UNLOCK(&dhd->pub);
dhd_net_if_unlock_local(dhd);
/* Look into the packet and update the packet priority */
#ifndef PKTPRIO_OVERRIDE
if (PKTPRIO(pktbuf) == 0)
-#endif /* !CUSTOMER_HW4 */
+#endif
pktsetprio(pktbuf, FALSE);
#ifdef PROP_TXSTATUS
else
#endif /* DHDTCPACK_SUPPRESS */
#ifdef PROP_TXSTATUS
+ {
+ dhd_os_wlfc_block(dhdp);
if (dhdp->wlfc_state && ((athost_wl_status_info_t*)dhdp->wlfc_state)->proptxstatus_mode
!= WLFC_FCMODE_NONE) {
- dhd_os_wlfc_block(dhdp);
dhd_wlfc_commit_packets(dhdp->wlfc_state, (f_commitpkt_t)dhd_bus_txdata,
dhdp->bus, pktbuf);
if (((athost_wl_status_info_t*)dhdp->wlfc_state)->toggle_host_if) {
}
dhd_os_wlfc_unblock(dhdp);
}
- else
+ else {
+ dhd_os_wlfc_unblock(dhdp);
/* non-proptxstatus way */
- ret = dhd_bus_txdata(dhdp->bus, pktbuf);
+ ret = dhd_bus_txdata(dhdp->bus, pktbuf);
+ }
+ }
#else
ret = dhd_bus_txdata(dhdp->bus, pktbuf);
#endif /* PROP_TXSTATUS */
dhd_start_xmit(struct sk_buff *skb, struct net_device *net)
{
int ret;
+ uint datalen;
void *pktbuf;
- dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(net);
+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(net);
+ dhd_if_t *ifp = NULL;
int ifidx;
#ifdef WLMEDIA_HTSF
uint8 htsfdlystat_sz = dhd->pub.htsfdlystat_sz;
#endif
}
+ ifp = dhd->iflist[ifidx];
+ datalen = PKTLEN(dhdp->osh, skb);
+
/* Make sure there's enough room for any header */
if (skb_headroom(skb) < dhd->pub.hdrlen + htsfdlystat_sz) {
ret = dhd_sendpkt(&dhd->pub, ifidx, pktbuf);
-
done:
- if (ret)
- dhd->pub.dstats.tx_dropped++;
- else
- dhd->pub.tx_packets++;
+ if (ret) {
+ ifp->stats.tx_dropped++;
+ }
+ else {
+ dhd->pub.tx_packets++;
+ ifp->stats.tx_packets++;
+ ifp->stats.tx_bytes += datalen;
+ }
DHD_OS_WAKE_UNLOCK(&dhd->pub);
DHD_TRACE(("%s: Enter\n", __FUNCTION__));
for (i = 0; pktbuf && i < numpkt; i++, pktbuf = pnext) {
-#ifdef WLBTAMP
- struct ether_header *eh;
- struct dot11_llc_snap_header *lsh;
-#endif
+
+ pnext = PKTNEXT(dhdp->osh, pktbuf);
+ PKTSETNEXT(wl->sh.osh, pktbuf, NULL);
ifp = dhd->iflist[ifidx];
if (ifp == NULL) {
}
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) */
- pnext = PKTNEXT(dhdp->osh, pktbuf);
- PKTSETNEXT(wl->sh.osh, pktbuf, NULL);
-
-#ifdef WLBTAMP
- eh = (struct ether_header *)PKTDATA(wl->sh.osh, pktbuf);
- lsh = (struct dot11_llc_snap_header *)&eh[1];
-
- if ((ntoh16(eh->ether_type) < ETHER_TYPE_MIN) &&
- (PKTLEN(wl->sh.osh, pktbuf) >= RFC1042_HDR_LEN) &&
- bcmp(lsh, BT_SIG_SNAP_MPROT, DOT11_LLC_SNAP_HDR_LEN - 2) == 0 &&
- lsh->type == HTON16(BTA_PROT_L2CAP)) {
- amp_hci_ACL_data_t *ACL_data = (amp_hci_ACL_data_t *)
- ((uint8 *)eh + RFC1042_HDR_LEN);
- ACL_data = NULL;
- }
-#endif /* WLBTAMP */
#ifdef PROP_TXSTATUS
if (dhdp->wlfc_state && PKTLEN(wl->sh.osh, pktbuf) == 0) {
skb_pull(skb, ETH_HLEN);
/* Process special event packets and then discard them */
+ memset(&event, 0, sizeof(event));
if (ntoh16(skb->protocol) == ETHER_TYPE_BRCM) {
dhd_wl_host_event(dhd, &ifidx,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22)
&event,
&data);
-#if defined(WLBTAMP) || defined(PNO_SUPPORT)
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);
- }
-#endif /* WLBTAMP */
-#ifdef PNO_SUPPORT
+#if defined(PNO_SUPPORT)
if (event.event_type == WLC_E_PFN_NET_FOUND) {
-#ifdef CUSTOMER_HW4
- tout_ctrl = DHD_PNO_TIMEOUT_MS;
-#else
- tout_ctrl *= 2;
-#endif
+ /* enforce custom wake lock to garantee that Kernel not suspended */
+ tout_ctrl = CUSTOM_PNO_EVENT_LOCK_xTIME * DHD_PACKET_TIMEOUT_MS;
}
#endif /* PNO_SUPPORT */
-#endif /* defined(WLBTAMP) || defined(PNO_SUPPORT) */
+
+#ifdef DHD_DONOT_FORWARD_BCMEVENT_AS_NETWORK_PKT
+ PKTFREE(dhdp->osh, pktbuf, TRUE);
+ continue;
+#endif
} else {
tout_rx = DHD_PACKET_TIMEOUT_MS;
}
dhdp->dstats.rx_bytes += skb->len;
dhdp->rx_packets++; /* Local count */
-
+ ifp->stats.rx_bytes += skb->len;
+ ifp->stats.rx_packets++;
if (in_interrupt()) {
netif_rx(skb);
dhd_info_t *dhd = (dhd_info_t *)(dhdp->info);
struct ether_header *eh;
uint16 type;
-#ifdef WLBTAMP
- uint len;
-#endif
dhd_prot_hdrpull(dhdp, NULL, txp, NULL, NULL);
if (type == ETHER_TYPE_802_1X)
atomic_dec(&dhd->pend_8021x_cnt);
-#ifdef WLBTAMP
- /* Crack open the packet and check to see if it is BT HCI ACL data packet.
- * If yes generate packet completion event.
- */
- len = PKTLEN(dhdp->osh, txp);
-
- /* Generate ACL data tx completion event locally to avoid SDIO bus transaction */
- if ((type < ETHER_TYPE_MIN) && (len >= RFC1042_HDR_LEN)) {
- struct dot11_llc_snap_header *lsh = (struct dot11_llc_snap_header *)&eh[1];
-
- if (bcmp(lsh, BT_SIG_SNAP_MPROT, DOT11_LLC_SNAP_HDR_LEN - 2) == 0 &&
- ntoh16(lsh->type) == BTA_PROT_L2CAP) {
-
- dhd_bta_tx_hcidata_complete(dhdp, txp, success);
- }
- }
-#endif /* WLBTAMP */
}
static struct net_device_stats *
if (dhd->pub.dongle_reset == FALSE) {
DHD_TIMER(("%s:\n", __FUNCTION__));
-
/* Call the bus module watchdog */
dhd_bus_watchdog(&dhd->pub);
#endif
#ifdef CUSTOM_DPC_CPUCORE
- set_cpus_allowed_ptr(current, cpumask_of(CUSTOM_DPC_CPUCORE));
-#endif
+ set_cpus_allowed_ptr(current, cpumask_of(CUSTOM_DPC_CPUCORE));
+#endif /* CUSTOM_DPC_CPUCORE */
/* Run until signal received */
while (1) {
if (down_interruptible(&tsk->sema) == 0) {
+
SMP_RD_BARRIER_DEPENDS();
if (tsk->terminated) {
break;
/* Call bus dpc unless it indicated down (then clean stop) */
if (dhd->pub.busstate != DHD_BUS_DOWN) {
- if (dhd_bus_dpc(dhd->pub.bus)) {
- up(&tsk->sema);
- }
- else {
- DHD_OS_WAKE_UNLOCK(&dhd->pub);
+ dhd_os_wd_timer_extend(&dhd->pub, TRUE);
+ while (dhd_bus_dpc(dhd->pub.bus)) {
+ /* process all data */
}
+ dhd_os_wd_timer_extend(&dhd->pub, FALSE);
+ DHD_OS_WAKE_UNLOCK(&dhd->pub);
+
} else {
if (dhd->pub.up)
dhd_bus_stop(dhd->pub.bus, TRUE);
if (skb == NULL) {
continue;
}
-
while (skb) {
void *skbnext = PKTNEXT(pub->osh, skb);
PKTSETNEXT(pub->osh, skb, NULL);
return -1;
}
-#if defined(CONFIG_WIRELESS_EXT)
+#if defined(WL_WIRELESS_EXT)
/* linux wireless extensions */
if ((cmd >= SIOCIWFIRST) && (cmd <= SIOCIWLAST)) {
/* may recurse, do NOT lock */
DHD_OS_WAKE_UNLOCK(&dhd->pub);
return ret;
}
-#endif /* defined(CONFIG_WIRELESS_EXT) */
+#endif /* defined(WL_WIRELESS_EXT) */
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 4, 2)
if (cmd == SIOCETHTOOL) {
}
#endif /* WL_CFG80211 */
-#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 trigger_deep_sleep = 0;
-#endif /* WL_CFG80211 && SUPPORT_DEEP_SLEEP */
+
static int
dhd_stop(struct net_device *net)
dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(net);
DHD_OS_WAKE_LOCK(&dhd->pub);
DHD_TRACE(("%s: Enter %p\n", __FUNCTION__, net));
+
+
if (dhd->pub.up == 0) {
goto exit;
}
* For CFG80211: Clean up all the left over virtual interfaces
* when the primary Interface is brought down. [ifconfig wlan0 down]
*/
- if ((dhd->dhd_state & DHD_ATTACH_STATE_ADD_IF) &&
- (dhd->dhd_state & DHD_ATTACH_STATE_CFG80211)) {
- dhd_cleanup_virt_ifaces(dhd);
+ if (!dhd_download_fw_on_driverload) {
+ if ((dhd->dhd_state & DHD_ATTACH_STATE_ADD_IF) &&
+ (dhd->dhd_state & DHD_ATTACH_STATE_CFG80211)) {
+ dhd_cleanup_virt_ifaces(dhd);
+ }
}
}
#endif
#if defined(WL_CFG80211)
if (ifidx == 0 && !dhd_download_fw_on_driverload)
wl_android_wifi_off(net);
-#ifdef SUPPORT_DEEP_SLEEP
- else {
- /* CSP#505233: Flags to indicate if we distingish
- * power off policy when user set the memu
- * "Keep Wi-Fi on during sleep" to "Never"
- */
- if (trigger_deep_sleep) {
- dhd_deepsleep(net, 1);
- trigger_deep_sleep = 0;
- }
- }
-#endif /* SUPPORT_DEEP_SLEEP */
#endif
dhd->pub.rxcnt_timeout = 0;
dhd->pub.txcnt_timeout = 0;
+ dhd->pub.hang_was_sent = 0;
+
DHD_OS_WAKE_UNLOCK(&dhd->pub);
return 0;
}
int ifidx;
int32 ret = 0;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) && 1 && 1
- if (mutex_is_locked(&_dhd_sdio_mutex_lock_) != 0) {
- DHD_ERROR(("%s : dhd_open: call dev open before insmod complete!\n", __FUNCTION__));
- }
- mutex_lock(&_dhd_sdio_mutex_lock_);
-#endif
+
+
DHD_OS_WAKE_LOCK(&dhd->pub);
/* Update FW path if it was changed */
firmware_path[0] = '\0';
}
-#ifdef CUSTOMER_HW4
- /* 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';
- bzero(nv_path, MOD_PARAM_PATHLEN);
- strncpy(nv_path, nvram_path, sizeof(nv_path)-1);
- }
-#endif /* CUSTOMER_HW4 */
-#if defined(CUSTOMER_HW4) && defined(SUPPORT_MULTIPLE_REVISION)
- /* dhd_open() can be call several times when loading failed */
- if (strlen(firmware_path) != 0) {
- ret = concate_revision(dhd->pub.bus, fw_path, MOD_PARAM_PATHLEN,
- nv_path, MOD_PARAM_PATHLEN);
- if (ret != 0) {
- DHD_ERROR(("%s: fail to concatnate revison \n", __FUNCTION__));
- goto exit;
- }
- }
-#endif /* CUSTOMER_HW4 && SUPPORT_MULTIPLE_REVISION */
dhd->pub.dongle_trap_occured = 0;
dhd->pub.hang_was_sent = 0;
goto exit;
}
}
-#ifdef SUPPORT_DEEP_SLEEP
- else {
- /* Flags to indicate if we distingish
- * power off policy when user set the memu
- * "Keep Wi-Fi on during sleep" to "Never"
- */
- if (trigger_deep_sleep) {
- dhd_deepsleep(net, 0);
- trigger_deep_sleep = 0;
- }
- }
-#endif /* SUPPORT_DEEP_SLEEP */
#endif
if (dhd->pub.busstate != DHD_BUS_DATA) {
DHD_OS_WAKE_UNLOCK(&dhd->pub);
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) && 1 && 1
- mutex_unlock(&_dhd_sdio_mutex_lock_);
-#endif
return ret;
}
return -EINVAL;
}
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) && 1 && 1
-#ifdef MULTIPLE_SUPPLICANT
- if (mutex_is_locked(&_dhd_sdio_mutex_lock_) != 0) {
- DHD_ERROR(("%s : dhdsdio_probe is already running!\n", __FUNCTION__));
- return 0;
- }
-#endif
-#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) */
+
/* && defined(OEM_ANDROID) && defined(BCMSDIO) */
dhd = *(dhd_info_t **)netdev_priv(net);
}
} else
if ((ifp = MALLOC(dhd->pub.osh, sizeof(dhd_if_t))) == NULL) {
- DHD_ERROR(("%s: OOM - dhd_if_t\n", __FUNCTION__));
+ DHD_ERROR(("%s: OOM - dhd_if_t(%d)\n", __FUNCTION__, sizeof(dhd_if_t)));
return -ENOMEM;
}
bzero(nv_path, MOD_PARAM_PATHLEN);
strncpy(nv_path, nvram_path, sizeof(nv_path) -1);
}
-#if defined(CUSTOMER_HW4) && defined(SUPPORT_MULTIPLE_REVISION)
- if (strlen(fw_path) != 0 &&
- concate_revision(bus, fw_path, MOD_PARAM_PATHLEN,
- nv_path, MOD_PARAM_PATHLEN) != 0) {
- DHD_ERROR(("%s: fail to concatnate revison \n", __FUNCTION__));
- goto fail;
- }
-#endif /* CUSTOMER_HW4 && SUPPORT_MULTIPLE_REVISION */
/* Allocate etherdev, including space for private structure */
if (!(net = alloc_etherdev(sizeof(dhd)))) {
dhd_state |= DHD_ATTACH_STATE_NET_ALLOC;
/* Allocate primary dhd_info */
+#if defined(CONFIG_DHD_USE_STATIC_BUF)
+ dhd = (void *)dhd_os_prealloc(osh, DHD_PREALLOC_DHD_INFO, sizeof(dhd_info_t));
+ if (!dhd) {
+ DHD_INFO(("%s: OOM - Pre-alloc dhd_info\n", __FUNCTION__));
+#endif /* CONFIG_DHD_USE_STATIC_BUF */
if (!(dhd = MALLOC(osh, sizeof(dhd_info_t)))) {
DHD_ERROR(("%s: OOM - alloc dhd_info\n", __FUNCTION__));
goto fail;
}
+#if defined(CONFIG_DHD_USE_STATIC_BUF)
+ }
+#endif /* CONFIG_DHD_USE_STATIC_BUF */
memset(dhd, 0, sizeof(dhd_info_t));
#ifdef DHDTHREAD
#ifdef PROP_TXSTATUS_VSDB
dhd->pub.wlfc_enabled = FALSE;
#else
- dhd->pub.wlfc_enabled = TRUE;
+ if (!disable_proptx)
+ dhd->pub.wlfc_enabled = TRUE;
+ else
+ dhd->pub.wlfc_enabled = FALSE;
#endif /* PROP_TXSTATUS_VSDB */
+ dhd->pub.ptx_opt_enabled = FALSE;
+ dhd->pub.skip_fc = dhd_wlfc_skip_fc;
+ dhd->pub.plat_enable = dhd_wlfc_plat_enable;
+ dhd->pub.plat_deinit = dhd_wlfc_plat_deinit;
#endif /* PROP_TXSTATUS */
/* Initialize other structure content */
dhd->wakelock_rx_timeout_enable = 0;
dhd->wakelock_ctrl_timeout_enable = 0;
#ifdef CONFIG_HAS_WAKELOCK
- dhd->wl_wifi = MALLOC(osh, sizeof(struct wake_lock));
- dhd->wl_rxwake = MALLOC(osh, sizeof(struct wake_lock));
- dhd->wl_ctrlwake = MALLOC(osh, sizeof(struct wake_lock));
- dhd->wl_wdwake = MALLOC(osh, sizeof(struct wake_lock));
- if (!dhd->wl_wifi || !dhd->wl_rxwake || !dhd->wl_ctrlwake || !dhd->wl_wdwake) {
- DHD_ERROR(("%s: mem alloc for wake lock failed\n", __FUNCTION__));
- goto fail;
- }
- wake_lock_init(dhd->wl_wifi, WAKE_LOCK_SUSPEND, "wlan_wake");
- wake_lock_init(dhd->wl_rxwake, WAKE_LOCK_SUSPEND, "wlan_rx_wake");
- wake_lock_init(dhd->wl_ctrlwake, WAKE_LOCK_SUSPEND, "wlan_ctrl_wake");
- wake_lock_init(dhd->wl_wdwake, WAKE_LOCK_SUSPEND, "wlan_wd_wake");
+ wake_lock_init(&dhd->wl_wifi, WAKE_LOCK_SUSPEND, "wlan_wake");
+ wake_lock_init(&dhd->wl_rxwake, WAKE_LOCK_SUSPEND, "wlan_rx_wake");
+ wake_lock_init(&dhd->wl_ctrlwake, WAKE_LOCK_SUSPEND, "wlan_ctrl_wake");
+ wake_lock_init(&dhd->wl_wdwake, WAKE_LOCK_SUSPEND, "wlan_wd_wake");
#endif /* CONFIG_HAS_WAKELOCK */
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) && 1
mutex_init(&dhd->dhd_net_if_mutex);
dhd_monitor_init(&dhd->pub);
dhd_state |= DHD_ATTACH_STATE_CFG80211;
#endif
-#if defined(CONFIG_WIRELESS_EXT)
+#if defined(WL_WIRELESS_EXT)
/* Attach and link in the iw */
if (!(dhd_state & DHD_ATTACH_STATE_CFG80211)) {
if (wl_iw_attach(net, (void *)&dhd->pub) != 0) {
}
dhd_state |= DHD_ATTACH_STATE_WL_ATTACH;
}
-#endif /* defined(CONFIG_WIRELESS_EXT) */
+#endif /* defined(WL_WIRELESS_EXT) */
/* Set up the watchdog timer */
init_timer(&dhd->timer);
dhd->timer.data = (ulong)dhd;
dhd->timer.function = dhd_watchdog;
+ dhd->default_wd_interval = dhd_watchdog_ms;
#ifdef DHDTHREAD
/* Initialize thread based operation and lock */
if (dhd_watchdog_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
+ PROC_START(dhd_watchdog_thread, dhd, &dhd->thr_wdt_ctl, 0, "dhd_watchdog_thread");
+
} else {
dhd->thr_wdt_ctl.thr_pid = -1;
}
/* 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
+ PROC_START(dhd_dpc_thread, dhd, &dhd->thr_dpc_ctl, 0, "dhd_dpc");
} else {
/* use tasklet for dpc */
tasklet_init(&dhd->tasklet, dhd_dpc, (ulong)dhd);
#ifdef RXFRAME_THREAD
bzero(&dhd->pub.skbbuf[0], sizeof(void *) * MAXSKBPEND);
/* Initialize RXF thread */
- PROC_START(dhd_rxf_thread, dhd, &dhd->thr_rxf_ctl, 0);
+ PROC_START(dhd_rxf_thread, dhd, &dhd->thr_rxf_ctl, 0, "dhd_rxf");
#endif
#else
/* Set up the bottom half handler */
#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
+ PROC_START(_dhd_sysioc_thread, dhd, &dhd->thr_sysioc_ctl, 0, "dhd_sysioc");
} else {
dhd->thr_sysioc_ctl.thr_pid = -1;
}
/* try to download image and nvram to the dongle */
if ((dhd->pub.busstate == DHD_BUS_DOWN) &&
- (fw_path[0] != '\0') &&
- (nv_path[0] != '\0')) {
+ (fw_path[0] != '\0') && (nv_path[0] != '\0')) {
#ifdef SHOW_NVRAM_TYPE
{ /* Show nvram type in the kernel log */
int i;
/* wake lock moved to dhdsdio_download_firmware */
if (!(dhd_bus_download_firmware(dhd->pub.bus, dhd->pub.osh,
fw_path, nv_path))) {
-#ifdef CUSTOMER_HW4
- DHD_ERROR(("%s: dhdsdio_probe_download failed. "
- "firmware or nvram wrong\n",
- __FUNCTION__));
-#else
DHD_ERROR(("%s: dhdsdio_probe_download failed. firmware = %s nvram = %s\n",
__FUNCTION__, fw_path, nv_path));
-#endif /* CUSTOMER_HW4 */
#ifdef DHDTHREAD
if (dhd->threads_only)
dhd_os_sdunlock(dhdp);
#endif /* DHDTHREAD */
return ret;
}
-#if defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID)
+#if defined(OOB_INTR_ONLY)
/* Host registration for OOB interrupt */
if (bcmsdh_register_oob_intr(dhdp)) {
/* deactivate timer and wait for the handler to finish */
return -ENODEV;
}
-#ifndef BCMSPI_ANDROID
/* Enable oob at firmware */
dhd_enable_oob_intr(dhd->pub.bus, TRUE);
-#endif /* !BCMSPI_ANDROID */
-#endif /* defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID) */
+#endif
/* If bus is not ready, can't come up */
if (dhd->pub.busstate != DHD_BUS_DATA) {
dhd_os_sdunlock(dhdp);
#endif /* DHDTHREAD */
-#ifdef BCMSDIOH_TXGLOM
-#if defined(WL_CFG80211)
- if (dhd_download_fw_on_driverload)
-#endif /* defined(WL_CFG80211) */
- 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 READ_MACADDR
- dhd_read_macaddr(dhd, &dhd->pub.mac);
-#endif
-#ifdef RDWR_MACADDR
- dhd_check_rdwr_macaddr(dhd, &dhd->pub, &dhd->pub.mac);
-#endif
-#ifdef RDWR_KORICS_MACADDR
- dhd_write_rdwr_korics_macaddr(dhd, &dhd->pub.mac);
-#endif
-#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_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
-#else
#ifdef WRITE_MACADDR
dhd_write_macaddr(dhd->pub.mac.octet);
#endif
-#endif /* CUSTOMER_HW4 */
#ifdef ARP_OFFLOAD_SUPPORT
if (dhd->pend_ipaddr) {
ret = DHD_FLAG_CONCURR_SINGLE_CHAN_MODE;
if (mchan_supported)
ret |= DHD_FLAG_CONCURR_MULTI_CHAN_MODE;
-#if defined(WL_ENABLE_P2P_IF) || defined(CUSTOMER_HW4)
+#if defined(WL_ENABLE_P2P_IF)
/* For customer_hw4, although ICS,
* we still support concurrent mode
*/
int ret = 0;
char eventmask[WL_EVENTING_MASK_LEN];
char iovbuf[WL_EVENTING_MASK_LEN + 12]; /* Room for "event_msgs" + '\0' + bitvec */
-#if defined(BCMSUP_4WAY_HANDSHAKE) && defined(WLAN_AKM_SUITE_FT_8021X)
- uint32 sup_wpa = 0;
-#endif
- uint32 lpc = 1;
+ uint32 buf_key_b4_m4 = 1;
#ifdef CUSTOM_AMPDU_BA_WSIZE
uint32 ampdu_ba_wsize = CUSTOM_AMPDU_BA_WSIZE;
#endif /* CUSTOM_AMPDU_BA_WSIZE */
+#ifdef DHD_ENABLE_LPC
+ uint32 lpc = 1;
+#endif /* DHD_ENABLE_LPC */
uint power_mode = PM_FAST;
uint32 dongle_align = DHD_SDALIGN;
uint32 glom = CUSTOM_GLOM_SETTING;
-#if (defined(CUSTOMER_HW4) || defined(BOARD_PANDA)) && (defined(VSDB) || \
- defined(ROAM_ENABLE))
- uint bcn_timeout = 8;
-#else
uint bcn_timeout = 4;
-#endif /* CUSTOMER_HW4 && (VSDB || ROAM_ENABLE) */
-#if defined(CUSTOMER_HW4) && defined(ENABLE_BCN_LI_BCN_WAKEUP)
- uint32 bcn_li_bcn = 1;
-#endif /* CUSTOMER_HW4 && ENABLE_BCN_LI_BCN_WAKEUP */
uint retry_max = 3;
#if defined(ARP_OFFLOAD_SUPPORT)
int arpoe = 1;
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 */
+ uint32 listen_interval = CUSTOM_LISTEN_INTERVAL; /* Default Listen Interval in Beacons */
#ifdef ROAM_ENABLE
uint roamvar = 0;
int roam_trigger[2] = {CUSTOM_ROAM_TRIGGER_SETTING, WLC_BAND_ALL};
int roam_scan_period[2] = {10, WLC_BAND_ALL};
int roam_delta[2] = {CUSTOM_ROAM_DELTA_SETTING, 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 */
#ifdef GET_CUSTOM_MAC_ENABLE
struct ether_addr ea_addr;
#endif /* GET_CUSTOM_MAC_ENABLE */
-#ifdef OKC_SUPPORT
- uint32 okc = 1;
-#endif
+#ifdef WLTDLS
+ uint32 tdls = 1;
+ uint32 tdls_auto_op = 1;
+ uint32 tdls_idle_time = CUSTOM_TDLS_IDLE_MODE_SETTING;
+#endif /* WLTDLS */
+
#ifdef DISABLE_11N
uint32 nmode = 0;
#endif /* DISABLE_11N */
-#if defined(VSDB) && defined(CUSTOMER_HW4)
- int interference_mode = 3;
-#endif
+#ifdef USE_WL_TXBF
+ uint32 txbf = 1;
+#endif /* USE_WL_TXBF */
#ifdef USE_WL_FRAMEBURST
uint32 frameburst = 1;
#endif /* USE_WL_FRAMEBURST */
dhd->wlfc_enabled = FALSE;
/* enable WLFC only if the firmware is VSDB */
#else
- dhd->wlfc_enabled = TRUE;
+ if (!disable_proptx)
+ dhd->wlfc_enabled = TRUE;
+ else
+ dhd->wlfc_enabled = FALSE;
#endif /* PROP_TXSTATUS_VSDB */
#endif /* PROP_TXSTATUS */
dhd->suspend_bcn_li_dtim = CUSTOM_SUSPEND_BCN_LI_DTIM;
bcm_mkiovar("fullroamperiod", (char *)&roam_fullscan_period, 4, iovbuf, sizeof(iovbuf));
if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0)) < 0)
DHD_ERROR(("%s: roam fullscan period set failed %d\n", __FUNCTION__, ret));
-#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));
- 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 /* 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 WLTDLS
+ bcm_mkiovar("tdls_enable", (char *)&tdls, 4, iovbuf, sizeof(iovbuf));
+ if ((dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0)) < 0)
+ DHD_ERROR(("%s: tdls enbale failed %d\n", __FUNCTION__, ret));
+
+ bcm_mkiovar("tdls_auto_op", (char *)&tdls_auto_op, 4, iovbuf, sizeof(iovbuf));
+ if ((dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0)) < 0)
+ DHD_ERROR(("%s: tdls_auto_op failed %d\n", __FUNCTION__, ret));
+
+ bcm_mkiovar("tdls_idle_time", (char *)&tdls_idle_time, 4, iovbuf, sizeof(iovbuf));
+ if ((dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0)) < 0)
+ DHD_ERROR(("%s: tdls_idle_time failed %d\n", __FUNCTION__, ret));
+#endif /* WLTDLS */
+
+#ifdef DHD_ENABLE_LPC
/* Set lpc 1 */
bcm_mkiovar("lpc", (char *)&lpc, 4, iovbuf, sizeof(iovbuf));
if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf,
sizeof(iovbuf), TRUE, 0)) < 0) {
DHD_ERROR(("%s Set lpc failed %d\n", __FUNCTION__, ret));
}
+#endif /* DHD_ENABLE_LPC */
-#if defined(CUSTOMER_HW4) && defined(CONFIG_CONTROL_PM)
- sec_control_pm(dhd, &power_mode);
-#else
/* Set PowerSave mode */
dhd_wl_ioctl_cmd(dhd, WLC_SET_PM, (char *)&power_mode, sizeof(power_mode), TRUE, 0);
-#endif /* CUSTOMER_HW4 && CONFIG_CONTROL_PM */
/* Match Host and Dongle rx alignment */
bcm_mkiovar("bus:txglomalign", (char *)&dongle_align, 4, iovbuf, sizeof(iovbuf));
dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
#endif /* defined(AP) && !defined(WLP2P) */
-#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) {
}
}
#endif /* defined(KEEP_ALIVE) */
+#ifdef USE_WL_TXBF
+ bcm_mkiovar("txbf", (char *)&txbf, 4, iovbuf, sizeof(iovbuf));
+ if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf,
+ sizeof(iovbuf), TRUE, 0)) < 0) {
+ DHD_ERROR(("%s Set txbf failed %d\n", __FUNCTION__, ret));
+ }
+#endif /* USE_WL_TXBF */
#ifdef USE_WL_FRAMEBURST
- /* Set frameburst to 1 */
+ /* Set frameburst to value */
if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_FAKEFRAG, (char *)&frameburst,
sizeof(frameburst), TRUE, 0)) < 0) {
DHD_ERROR(("%s Set frameburst failed %d\n", __FUNCTION__, ret));
__FUNCTION__, CUSTOM_AMPDU_BA_WSIZE, ret));
}
#endif /* CUSTOM_AMPDU_BA_WSIZE */
-#if defined(BCMSUP_4WAY_HANDSHAKE) && defined(WLAN_AKM_SUITE_FT_8021X)
- /* Read 4-way handshake requirements. */
- bcm_mkiovar("sup_wpa", (char *)&sup_wpa, 4,
- iovbuf, sizeof(iovbuf));
- ret = dhd_wl_ioctl_cmd(dhd, WLC_GET_VAR, iovbuf, sizeof(iovbuf), FALSE, 0);
- if (ret >= 0)
- dhd->fw_4way_handshake = TRUE;
- DHD_TRACE(("4-way handshake mode is: %d\n", dhd->fw_4way_handshake));
-#endif /* BCMSUP_4WAY_HANDSHAKE && WLAN_AKM_SUITE_FT_8021X */
+
+ bcm_mkiovar("buf_key_b4_m4", (char *)&buf_key_b4_m4, 4, iovbuf, sizeof(iovbuf));
+ if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf,
+ sizeof(iovbuf), TRUE, 0)) < 0) {
+ DHD_ERROR(("%s buf_key_b4_m4 set failed %d\n", __FUNCTION__, ret));
+ }
/* Read event_msgs mask */
bcm_mkiovar("event_msgs", eventmask, WL_EVENTING_MASK_LEN, iovbuf, sizeof(iovbuf));
setbit(eventmask, WLC_E_DISASSOC_IND);
setbit(eventmask, WLC_E_DISASSOC);
setbit(eventmask, WLC_E_JOIN);
+ setbit(eventmask, WLC_E_START);
setbit(eventmask, WLC_E_ASSOC_IND);
setbit(eventmask, WLC_E_PSK_SUP);
setbit(eventmask, WLC_E_LINK);
#endif /* PNO_SUPPORT */
/* 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 WLTDLS
+ setbit(eventmask, WLC_E_TDLS_PEER_EVENT);
+#endif /* WLTDLS */
#ifdef WL_CFG80211
setbit(eventmask, WLC_E_ESCAN_RESULT);
if (dhd->op_mode & DHD_FLAG_P2P_MODE) {
setbit(eventmask, WLC_E_ACTION_FRAME_RX);
- setbit(eventmask, WLC_E_ACTION_FRAME_COMPLETE);
- 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 */
/* Write updated Event mask */
/* Add filter to pass multicastDNS packet and NOT filter out as Broadcast */
dhd->pktfilter[4] = "104 0 0 0 0xFFFFFFFFFFFF 0x01005E0000FB";
-#if defined(CUSTOMER_HW4) && defined(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) && defined(CUSTOMER_HW4)
- 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 && CUSTOMER_HW4 */
-#if defined(PASS_IPV4_SUSPEND) && defined(CUSTOMER_HW4)
- dhd->pktfilter_count = 5;
- dhd->pktfilter[4] = "104 0 0 0 0xFFFFFF 0x01005E";
-#endif /* PASS_IPV4_SUSPEND && CUSTOMER_HW4 */
-#endif /* GAN_LITE_NAT_KEEPALIVE_FILTER && CUSTOMER_HW4 */
+#ifdef PASS_ARP_PACKET
+ dhd->pktfilter[dhd->pktfilter_count++] = "105 0 0 12 0xFFFF 0x0806";
+#endif
#if defined(SOFTAP)
if (ap_fw_loaded) {
#endif
#endif /* DISABLE_11N */
-#if defined(VSDB) && defined(CUSTOMER_HW4)
- dhd_wl_ioctl_cmd(dhd, WLC_SET_INTERFERENCE_MODE,
- (int *)&interference_mode, sizeof(int), TRUE, 0);
-#endif
-#if defined(CUSTOMER_HW4) && defined(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 /* CUSTOMER_HW4 && ENABLE_BCN_LI_BCN_WAKEUP */
+
/* query for 'ver' to get version info from firmware */
memset(buf, 0, sizeof(buf));
ptr = buf;
bcmstrtok(&ptr, "\n", 0);
/* Print fw version info */
DHD_ERROR(("Firmware version = %s\n", buf));
+ dhd_set_version_info(dhd, buf);
/* Check and adjust IOCTL response timeout for Manufactring firmware */
if (strstr(buf, MANUFACTRING_FW) != NULL) {
}
}
+#ifdef BCMSDIOH_TXGLOM
+ if ((dhd->busstate == DHD_BUS_DATA) &&
+ bcmsdh_glom_enabled()) {
+ dhd_txglom_enable(dhd, TRUE);
+ }
+#endif /* BCMSDIOH_TXGLOM */
+
+#if defined(PROP_TXSTATUS) && !defined(PROP_TXSTATUS_VSDB)
+ if (!disable_proptx)
+ dhd_wlfc_init(dhd);
+#endif /* PROP_TXSTATUS && !PROP_TXSTATUS_VSDB */
+
done:
return ret;
}
/* Filter notifications meant for non Broadcom devices */
if ((ifa->ifa_dev->dev->netdev_ops != &dhd_ops_pri) &&
(ifa->ifa_dev->dev->netdev_ops != &dhd_ops_virt)) {
-#ifdef WLP2P
+#if defined(WL_ENABLE_P2P_IF)
if (!wl_cfgp2p_is_ifops(ifa->ifa_dev->dev->netdev_ops))
-#endif
+#endif /* WL_ENABLE_P2P_IF */
return NOTIFY_DONE;
}
#endif /* LINUX_VERSION_CODE */
net->ethtool_ops = &dhd_ethtool_ops;
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) */
-#if defined(CONFIG_WIRELESS_EXT)
+#if defined(WL_WIRELESS_EXT)
#if WIRELESS_EXT < 19
net->get_wireless_stats = dhd_get_wireless_stats;
#endif /* WIRELESS_EXT < 19 */
#if WIRELESS_EXT > 12
net->wireless_handlers = (struct iw_handler_def *)&wl_iw_handler_def;
#endif /* WIRELESS_EXT > 12 */
-#endif /* defined(CONFIG_WIRELESS_EXT) */
+#endif /* defined(WL_WIRELESS_EXT) */
dhd->pub.rxsz = DBUS_RX_BUFFER_SIZE_DHD(net);
printf("Broadcom Dongle Host Driver: register interface [%s]"
" MAC: "MACDBG"\n",
net->name,
-#if defined(CUSTOMER_HW4)
- MAC2STRDBG(dhd->pub.mac.octet));
-#else
MAC2STRDBG(net->dev_addr));
-#endif /* CUSTOMER_HW4 */
-#if defined(SOFTAP) && defined(CONFIG_WIRELESS_EXT) && !defined(WL_CFG80211)
+#if defined(SOFTAP) && defined(WL_WIRELESS_EXT) && !defined(WL_CFG80211)
wl_iw_iscan_set_scan_broadcast_prep(net, 1);
#endif
dhd_bus_stop(dhd->pub.bus, TRUE);
}
-#if defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID)
+#if defined(OOB_INTR_ONLY)
bcmsdh_unregister_oob_intr();
-#endif /* defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID) */
+#endif
}
}
}
cancel_work_sync(&dhd->work_hang);
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) */
-#if defined(CONFIG_WIRELESS_EXT)
+#if defined(WL_WIRELESS_EXT)
if (dhd->dhd_state & DHD_ATTACH_STATE_WL_ATTACH) {
/* Detatch and unlink in the iw */
wl_iw_detach();
}
-#endif /* defined(CONFIG_WIRELESS_EXT) */
+#endif /* defined(WL_WIRELESS_EXT) */
if (dhd->thr_sysioc_ctl.thr_pid >= 0) {
PROC_STOP(&dhd->thr_sysioc_ctl);
/* && defined(CONFIG_PM_SLEEP) */
if (dhd->dhd_state & DHD_ATTACH_STATE_WAKELOCKS_INIT) {
- printk("wd wakelock count:%d\n", dhd->wakelock_wd_counter);
+ DHD_TRACE(("wd wakelock count:%d\n", dhd->wakelock_wd_counter));
#ifdef CONFIG_HAS_WAKELOCK
dhd->wakelock_counter = 0;
dhd->wakelock_wd_counter = 0;
dhd->wakelock_rx_timeout_enable = 0;
dhd->wakelock_ctrl_timeout_enable = 0;
- if (dhd->wl_wifi) {
- wake_lock_destroy(dhd->wl_wifi);
- MFREE(dhd->pub.osh, dhd->wl_wifi, sizeof(struct wake_lock));
- dhd->wl_wifi = NULL;
- }
- if (dhd->wl_rxwake) {
- wake_lock_destroy(dhd->wl_rxwake);
- MFREE(dhd->pub.osh, dhd->wl_rxwake, sizeof(struct wake_lock));
- dhd->wl_rxwake = NULL;
- }
- if (dhd->wl_ctrlwake) {
- wake_lock_destroy(dhd->wl_ctrlwake);
- MFREE(dhd->pub.osh, dhd->wl_ctrlwake, sizeof(struct wake_lock));
- dhd->wl_ctrlwake = NULL;
- }
- if (dhd->wl_wdwake) {
- wake_lock_destroy(dhd->wl_wdwake);
- MFREE(dhd->pub.osh, dhd->wl_wdwake, sizeof(struct wake_lock));
- dhd->wl_wdwake = NULL;
- }
+ wake_lock_destroy(&dhd->wl_wifi);
+ wake_lock_destroy(&dhd->wl_rxwake);
+ wake_lock_destroy(&dhd->wl_ctrlwake);
+ wake_lock_destroy(&dhd->wl_wdwake);
#endif /* CONFIG_HAS_WAKELOCK */
}
}
}
}
dhd = (dhd_info_t *)dhdp->info;
- if (dhd)
- MFREE(dhd->pub.osh, dhd, sizeof(*dhd));
+#if defined(CONFIG_DHD_USE_STATIC_BUF)
+ /* If pointer is allocated by dhd_os_prealloc then avoid MFREE */
+ if (dhd != (dhd_info_t *)dhd_os_prealloc(NULL, DHD_PREALLOC_DHD_INFO, 0)) {
+#endif /* CONFIG_DHD_USE_STATIC_BUF */
+ if (dhd)
+ MFREE(dhd->pub.osh, dhd, sizeof(*dhd));
+#if defined(CONFIG_DHD_USE_STATIC_BUF)
+ }
+ else {
+ if (dhd)
+ dhd = NULL;
+ }
+#endif /* CONFIG_DHD_USE_STATIC_BUF */
}
}
}
+#if defined(CONFIG_WIFI_CONTROL_FUNC)
+extern bool g_wifi_poweron;
+#endif /* CONFIG_WIFI_CONTROL_FUNC */
+
static int __init
dhd_module_init(void)
{
break;
DHD_ERROR(("Invalid module parameters.\n"));
- return -EINVAL;
+ error = -EINVAL;
} while (0);
#endif
+ if (error)
+ goto fail_0;
#if 1 && defined(BCMLXSDMMC) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
do {
if (!chip_up) {
DHD_ERROR(("\nfailed to power up wifi chip, max retry reached, exits **\n\n"));
- return -ENODEV;
+ error = -ENODEV;
+ goto fail_0;
}
#else
dhd_customer_gpio_wlan_ctrl(WLAN_POWER_ON);
#endif
+#if defined(CONFIG_WIFI_CONTROL_FUNC) && defined(BCMLXSDMMC)
+ /* If the wifi_set_power() is failed,
+ * we need to jump error handling routines.
+ */
+ if (!g_wifi_poweron) {
+ printk("%s: wifi_set_power() failed\n", __FUNCTION__);
+ error = -ENODEV;
+ goto fail_1;
+ }
+#endif /* defined(CONFIG_WIFI_CONTROL_FUNC) */
+
#if 1 && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
sema_init(&dhd_registration_sem, 0);
#endif
goto fail_1;
}
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(BCMLXSDMMC)
/*
* Wait till MMC sdio_register_driver callback called and made driver attach.
* It's needed to make sync up exit from dhd insmod and
return error;
-#if 1 && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
+#if 1 && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(BCMLXSDMMC)
fail_2:
dhd_bus_unregister();
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) */
/* Call customer gpio to turn off power with WL_REG_ON signal */
dhd_customer_gpio_wlan_ctrl(WLAN_POWER_OFF);
+fail_0:
+
+ wl_android_exit();
+
return error;
}
return 0;
}
+void
+dhd_os_wd_timer_extend(void *bus, bool extend)
+{
+ dhd_pub_t *pub = bus;
+ dhd_info_t *dhd = (dhd_info_t *)pub->info;
+
+ if (extend)
+ dhd_os_wd_timer(bus, WATCHDOG_EXTEND_INTERVAL);
+ else
+ dhd_os_wd_timer(bus, dhd->default_wd_interval);
+}
+
+
void
dhd_os_wd_timer(void *bus, uint wdtick)
{
DHD_ERROR(("%s: dhd NULL\n", __FUNCTION__));
return;
}
- if (wdtick)
- DHD_OS_WD_WAKE_LOCK(pub);
flags = dhd_os_spin_lock(pub);
/* don't start the wd until fw is loaded */
if (pub->busstate == DHD_BUS_DOWN) {
dhd_os_spin_unlock(pub, flags);
- DHD_OS_WD_WAKE_UNLOCK(pub);
+ if (!wdtick)
+ DHD_OS_WD_WAKE_UNLOCK(pub);
return;
}
}
if (wdtick) {
+ DHD_OS_WD_WAKE_LOCK(pub);
dhd_watchdog_ms = (uint)wdtick;
/* Re arm the timer, at last watchdog period */
mod_timer(&dhd->timer, jiffies + msecs_to_jiffies(dhd_watchdog_ms));
}
#endif /* defined(CONFIG_WIFI_CONTROL_FUNC) */
-#if defined(CONFIG_WIRELESS_EXT)
+#if defined(WL_WIRELESS_EXT)
struct iw_statistics *
dhd_get_wireless_stats(struct net_device *dev)
{
else
return NULL;
}
-#endif /* defined(CONFIG_WIRELESS_EXT) */
+#endif /* defined(WL_WIRELESS_EXT) */
static int
dhd_wl_host_event(dhd_info_t *dhd, int *ifidx, void *pktdata,
if (bcmerror != BCME_OK)
return (bcmerror);
-#if defined(CONFIG_WIRELESS_EXT)
+#if defined(WL_WIRELESS_EXT)
if (event->bsscfgidx == 0) {
/*
* Wireless ext is on primary interface only
wl_iw_event(dhd->iflist[*ifidx]->net, event, *data);
}
}
-#endif /* defined(CONFIG_WIRELESS_EXT) */
+#endif /* defined(WL_WIRELESS_EXT) */
#ifdef WL_CFG80211
if ((ntoh32(event->event_type) == WLC_E_IF) &&
dhd_sendup_event(dhd_pub_t *dhdp, wl_event_msg_t *event, void *data)
{
switch (ntoh32(event->event_type)) {
-#ifdef WLBTAMP
- /* Send up locally generated AMP HCI Events */
- case WLC_E_BTA_HCI_EVENT: {
- struct sk_buff *p, *skb;
- bcm_event_t *msg;
- wl_event_msg_t *p_bcm_event;
- char *ptr;
- uint32 len;
- uint32 pktlen;
- dhd_if_t *ifp;
- dhd_info_t *dhd;
- uchar *eth;
- int ifidx;
-
- len = ntoh32(event->datalen);
- pktlen = sizeof(bcm_event_t) + len + 2;
- dhd = dhdp->info;
- ifidx = dhd_ifname2idx(dhd, event->ifname);
-
- if ((p = PKTGET(dhdp->osh, pktlen, FALSE))) {
- ASSERT(ISALIGNED((uintptr)PKTDATA(dhdp->osh, p), sizeof(uint32)));
-
- msg = (bcm_event_t *) PKTDATA(dhdp->osh, p);
-
- bcopy(&dhdp->mac, &msg->eth.ether_dhost, ETHER_ADDR_LEN);
- bcopy(&dhdp->mac, &msg->eth.ether_shost, ETHER_ADDR_LEN);
- ETHER_TOGGLE_LOCALADDR(&msg->eth.ether_shost);
-
- msg->eth.ether_type = hton16(ETHER_TYPE_BRCM);
-
- /* BCM Vendor specific header... */
- msg->bcm_hdr.subtype = hton16(BCMILCP_SUBTYPE_VENDOR_LONG);
- msg->bcm_hdr.version = BCMILCP_BCM_SUBTYPEHDR_VERSION;
- bcopy(BRCM_OUI, &msg->bcm_hdr.oui[0], DOT11_OUI_LEN);
-
- /* vendor spec header length + pvt data length (private indication
- * hdr + actual message itself)
- */
- msg->bcm_hdr.length = hton16(BCMILCP_BCM_SUBTYPEHDR_MINLENGTH +
- BCM_MSG_LEN + sizeof(wl_event_msg_t) + (uint16)len);
- msg->bcm_hdr.usr_subtype = hton16(BCMILCP_BCM_SUBTYPE_EVENT);
-
- PKTSETLEN(dhdp->osh, p, (sizeof(bcm_event_t) + len + 2));
-
- /* copy wl_event_msg_t into sk_buf */
-
- /* pointer to wl_event_msg_t in sk_buf */
- p_bcm_event = &msg->event;
- bcopy(event, p_bcm_event, sizeof(wl_event_msg_t));
-
- /* copy hci event into sk_buf */
- bcopy(data, (p_bcm_event + 1), len);
-
- msg->bcm_hdr.length = hton16(sizeof(wl_event_msg_t) +
- ntoh16(msg->bcm_hdr.length));
- PKTSETLEN(dhdp->osh, p, (sizeof(bcm_event_t) + len + 2));
-
- ptr = (char *)(msg + 1);
- /* Last 2 bytes of the message are 0x00 0x00 to signal that there
- * are no ethertypes which are following this
- */
- ptr[len+0] = 0x00;
- ptr[len+1] = 0x00;
-
- skb = PKTTONATIVE(dhdp->osh, p);
- eth = skb->data;
- len = skb->len;
-
- ifp = dhd->iflist[ifidx];
- if (ifp == NULL)
- ifp = dhd->iflist[0];
-
- ASSERT(ifp);
- skb->dev = ifp->net;
- skb->protocol = eth_type_trans(skb, skb->dev);
-
- skb->data = eth;
- skb->len = len;
-
- /* Strip header, count, deliver upward */
- skb_pull(skb, ETH_HLEN);
-
- /* Send the packet */
- if (in_interrupt()) {
- netif_rx(skb);
- } else {
- netif_rx_ni(skb);
- }
- }
- 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 */
default:
break;
if (dhd_wl_ioctl_cmd(&dhd->pub, WLC_DOWN, NULL, 0, TRUE, 0) < 0) {
DHD_TRACE(("%s: wl down failed\n", __FUNCTION__));
}
+#if defined(PROP_TXSTATUS) && !defined(PROP_TXSTATUS_VSDB)
+ dhd_wlfc_deinit(&dhd->pub);
+ if (dhd->pub.plat_deinit)
+ dhd->pub.plat_deinit((void *)&dhd->pub);
+#endif /* PROP_TXSTATUS && !PROP_TXSTATUS_VSDB */
}
ret = dhd_bus_devreset(&dhd->pub, flag);
ret = dhd_set_suspend(val, &dhd->pub);
#else
ret = dhd_suspend_resume_helper(dhd, val, force);
+#endif
+#ifdef WL_CFG80211
+ wl_cfg80211_update_power_mode(dev);
#endif
}
return ret;
filterp = "102 0 0 0 0xFFFFFF 0x01005E";
break;
case DHD_MULTICAST6_FILTER_NUM:
-#if defined(BLOCK_IPV6_PACKET) && defined(CUSTOMER_HW4)
-/* customer want to use NO IPV6 packets only */
- return ret;
-#endif /* BLOCK_IPV6_PACKET && CUSTOMER_HW4 */
filterp = "103 0 0 0 0xFFFF 0x3333";
break;
default:
{
dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
-#ifdef BCMSDIOH_TXGLOM
- if ((dhd->pub.busstate == DHD_BUS_DATA) && bcmsdh_glom_enabled()) {
- dhd_txglom_enable(&dhd->pub, TRUE);
- }
-#endif
-
-#if defined(CUSTOMER_HW4) && 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 /* CUSTOMER_HW4 && USE_STAMAC_4SOFTAP */
return dhd_preinit_ioctls(&dhd->pub);
}
dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
int ret = 0;
- if (dhd)
+ if (dhd) {
+ /* Report FW problem when enabled */
+ if (dhd->pub.hang_report) {
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
- ret = dhd_os_send_hang_message(&dhd->pub);
+ ret = dhd_os_send_hang_message(&dhd->pub);
#else
- ret = wl_cfg80211_hang(dev, WLAN_REASON_UNSPECIFIED);
+ ret = wl_cfg80211_hang(dev, WLAN_REASON_UNSPECIFIED);
#endif
+ } else {
+ DHD_ERROR(("%s: FW HANG ignored (for testing purpose) and not sent up\n",
+ __FUNCTION__));
+ /* Enforce bus down to stop any future traffic */
+ dhd->pub.busstate = DHD_BUS_DOWN;
+ }
+ }
return ret;
}
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) && OEM_ANDROID */
-void dhd_bus_country_set(struct net_device *dev, wl_country_t *cspec)
+void dhd_bus_country_set(struct net_device *dev, wl_country_t *cspec, bool notify)
{
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);
+ wl_update_wiphybands(NULL, notify);
#endif
}
}
dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
if (dhd && dhd->pub.up) {
#ifdef WL_CFG80211
- wl_update_wiphybands(NULL);
+ wl_update_wiphybands(NULL, true);
#endif
}
}
return (atomic_read(&dhd->pend_8021x_cnt));
}
-#define MAX_WAIT_FOR_8021X_TX 25
+#define MAX_WAIT_FOR_8021X_TX 50
int
dhd_wait_pend8021x(struct net_device *dev)
pend = dhd_get_pend_8021x_cnt(dhd);
}
if (ntimes == 0)
+ {
+ atomic_set(&dhd->pend_8021x_cnt, 0);
DHD_ERROR(("%s: TIMEOUT\n", __FUNCTION__));
+ }
return pend;
}
dhd->wakelock_rx_timeout_enable : dhd->wakelock_ctrl_timeout_enable;
#ifdef CONFIG_HAS_WAKELOCK
if (dhd->wakelock_rx_timeout_enable)
- wake_lock_timeout(dhd->wl_rxwake,
+ wake_lock_timeout(&dhd->wl_rxwake,
msecs_to_jiffies(dhd->wakelock_rx_timeout_enable));
if (dhd->wakelock_ctrl_timeout_enable)
- wake_lock_timeout(dhd->wl_ctrlwake,
+ wake_lock_timeout(&dhd->wl_ctrlwake,
msecs_to_jiffies(dhd->wakelock_ctrl_timeout_enable));
#endif
dhd->wakelock_rx_timeout_enable = 0;
spin_lock_irqsave(&dhd->wakelock_spinlock, flags);
#ifdef CONFIG_HAS_WAKELOCK
if (!dhd->wakelock_counter)
- wake_lock(dhd->wl_wifi);
+ wake_lock(&dhd->wl_wifi);
#elif 1 && (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 36))
if (pm_dev)
pm_stay_awake(pm_dev);
dhd->wakelock_counter--;
#ifdef CONFIG_HAS_WAKELOCK
if (!dhd->wakelock_counter)
- wake_unlock(dhd->wl_wifi);
+ wake_unlock(&dhd->wl_wifi);
#elif 1 && (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 36))
if (pm_dev)
pm_relax(pm_dev);
#endif /* CONFIG_HAS_WAKELOCK || BCMSDIO */
#ifdef CONFIG_HAS_WAKELOCK
- if (dhd && wake_lock_active(dhd->wl_wifi))
+ /* Indicate to the SD Host to avoid going to suspend if internal locks are up */
+ if (dhd && (wake_lock_active(&dhd->wl_wifi) ||
+ (wake_lock_active(&dhd->wl_wdwake))))
return 1;
#elif 1 && (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 36))
if (dhd && (dhd->wakelock_counter > 0) && pm_dev)
spin_lock_irqsave(&dhd->wakelock_spinlock, flags);
#ifdef CONFIG_HAS_WAKELOCK
/* if wakelock_wd_counter was never used : lock it at once */
- if (!dhd->wakelock_wd_counter) {
- if (dhd->wl_wdwake)
- wake_lock(dhd->wl_wdwake);
- else {
- spin_unlock_irqrestore(&dhd->wakelock_spinlock, flags);
- return 0;
- }
- }
+ if (!dhd->wakelock_wd_counter)
+ wake_lock(&dhd->wl_wdwake);
#endif
dhd->wakelock_wd_counter++;
ret = dhd->wakelock_wd_counter;
if (dhd->wakelock_wd_counter) {
dhd->wakelock_wd_counter = 0;
#ifdef CONFIG_HAS_WAKELOCK
- wake_unlock(dhd->wl_wdwake);
+ wake_unlock(&dhd->wl_wdwake);
#endif
}
spin_unlock_irqrestore(&dhd->wakelock_spinlock, flags);
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;
}
dhd = *(dhd_info_t **)netdev_priv(net);
+ if (!dhd)
+ return -EINVAL;
+
ifidx = dhd_net2idx(dhd, net);
if (ifidx == DHD_BAD_IF) {
DHD_ERROR(("%s bad ifidx\n", __FUNCTION__));
return dhd_check_hang(net, dhdp, ret);
}
-#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)
-{
- char iovbuf[20];
- uint powervar = 0;
- dhd_info_t *dhd;
- dhd_pub_t *dhdp;
- int cnt = 0;
- int ret = 0;
-
- dhd = *(dhd_info_t **)netdev_priv(dev);
- 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);
-#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("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,"
- " 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;
- }
-
- return 0;
-}
-#endif /* WL_CFG80211 && SUPPORT_DEEP_SLEEP */
#ifdef PROP_TXSTATUS
extern int dhd_wlfc_interface_entry_update(void* state, ewlfc_mac_entry_action_t action, uint8 ifid,
{
return dhd_wlfc_enable(&dhd->pub);
}
+
+void dhd_wlfc_plat_enable(void *dhd)
+{
+ return;
+}
+
+void dhd_wlfc_plat_deinit(void *dhd)
+{
+ return;
+}
+
+bool dhd_wlfc_skip_fc(void)
+{
+
+#ifdef WL_CFG80211
+ extern struct wl_priv *wlcfg_drv_priv;
+
+ /* enable flow control in vsdb mode */
+ return !(wlcfg_drv_priv && wlcfg_drv_priv->vsdb_mode);
+#else
+ return TRUE; /* skip flow control */
+#endif /* WL_CFG80211 */
+}
#endif /* PROP_TXSTATUS */
#ifdef BCMDBGFS
/*
* Expose some of the kernel scheduler routines
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* Provides type definitions and function prototypes used to link the
* DHD OS, bus, and protocol modules.
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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 364579 2012-10-24 17:56:37Z $
+ * $Id: dhd_proto.h 390836 2013-03-13 23:43:53Z $
*/
#ifndef _dhd_proto_h_
extern int dhd_preinit_ioctls(dhd_pub_t *dhd);
-#ifdef PROP_TXSTATUS
-extern int dhd_wlfc_commit_packets(void* state, f_commitpkt_t fcommit,
- void* commit_ctx, void *pktbuf);
-extern void dhd_wlfc_cleanup(dhd_pub_t *dhd, ifpkt_cb_t fn, int arg);
-extern bool ifpkt_fn(void* p, int ifid);
-#endif /* PROP_TXSTATUS */
-
extern int dhd_process_pkt_reorder_info(dhd_pub_t *dhd, uchar *reorder_info_buf,
uint reorder_info_len, void **pkt, uint32 *free_buf_count);
--- /dev/null
+/*
+ * Queue monitoring.
+ *
+ * The feature allows monitoring the DHD queue utilization to get the percentage of a time period
+ * where the number of pending packets is above a configurable theshold.
+ * Right now, this is used by a server application, interfacing a Miracast Video Encoder, and
+ * doing IOVAR "qtime_percent" at regular interval. Based on IOVAR "qtime_percent" results,
+ * the server indicates to the Video Encoder if its bitrate can be increased or must be decreased.
+ * Currently, this works only with P2P interfaces and with PROP_TXSTATUS. There is no need to handle
+ * concurrent access to the fieds because the existing concurrent accesses are protected
+ * by the PROP_TXSTATUS's lock.
+ *
+ * Copyright (C) 2013, Broadcom Corporation
+ * All Rights Reserved.
+ *
+ * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation;
+ * the contents of this file may not be disclosed to third parties, copied
+ * or duplicated in any form, in whole or in part, without the prior
+ * written permission of Broadcom Corporation.
+ *
+ * $Id: dhd_qmon.c 309265 2012-01-19 02:50:46Z $
+ *
+ */
+#include <osl.h>
+#include <bcmutils.h>
+#include <bcmendian.h>
+#include <dngl_stats.h>
+#include <wlioctl.h>
+#include <dhd.h>
+#include <dhd_qmon.h>
+#ifndef PROP_TXSTATUS
+#error "PROP_TXSTATUS must be build to build dhd_qmon.c"
+#endif
+#include <wlfc_proto.h>
+#include <dhd_wlfc.h>
+
+#if defined(BCMDRIVER)
+#define QMON_SYSUPTIME() ((uint64)(jiffies_to_usecs(jiffies)))
+#else
+ #error "target not yet supported"
+#endif
+
+static dhd_qmon_t *
+dhd_qmon_p2p_entry(dhd_pub_t *dhdp)
+{
+ wlfc_mac_descriptor_t* interfaces = NULL;
+ wlfc_mac_descriptor_t* nodes = NULL;
+ uint8 i;
+
+ if (dhdp->wlfc_state == NULL)
+ return NULL;
+
+ interfaces = ((athost_wl_status_info_t*)dhdp->wlfc_state)->destination_entries.interfaces;
+ nodes = ((athost_wl_status_info_t*)dhdp->wlfc_state)->destination_entries.nodes;
+
+ ASSERT(interfaces != NULL);
+ ASSERT(nodes != NULL);
+
+ for (i = 0; i < WLFC_MAC_DESC_TABLE_SIZE; i++) {
+ if (nodes[i].occupied &&
+ ((nodes[i].iftype == WLC_E_IF_ROLE_P2P_CLIENT) ||
+ (nodes[i].iftype == WLC_E_IF_ROLE_P2P_GO)))
+ return &nodes[i].qmon;
+ }
+
+ for (i = 0; i < WLFC_MAX_IFNUM; i++) {
+ if (interfaces[i].occupied &&
+ ((interfaces[i].iftype == WLC_E_IF_ROLE_P2P_CLIENT) ||
+ (interfaces[i].iftype == WLC_E_IF_ROLE_P2P_GO)))
+ return &nodes[i].qmon;
+ }
+
+ return NULL;
+}
+
+void
+dhd_qmon_reset(dhd_qmon_t* qmon)
+{
+ qmon->transitq_count = 0;
+ qmon->queued_time_cumul = 0;
+ qmon->queued_time_cumul_last = 0;
+ qmon->queued_time_last = 0;
+ qmon->queued_time_last_io = 0;
+}
+
+void
+dhd_qmon_tx(dhd_qmon_t* qmon)
+{
+ if ((++qmon->transitq_count > qmon->queued_time_thres) &&
+ (qmon->queued_time_last == 0)) {
+ /* Set timestamp when transit packet above a threshold */
+ qmon->queued_time_last = QMON_SYSUPTIME();
+ }
+}
+
+void
+dhd_qmon_txcomplete(dhd_qmon_t* qmon)
+{
+ uint64 now = QMON_SYSUPTIME();
+
+ qmon->transitq_count--;
+ if ((qmon->transitq_count <= qmon->queued_time_thres) &&
+ (qmon->queued_time_last != 0)) {
+ /* Set timestamp when transit packet above a threshold */
+ qmon->queued_time_cumul += now - qmon->queued_time_last;
+ qmon->queued_time_last = 0;
+ }
+}
+
+int
+dhd_qmon_thres(dhd_pub_t *dhdp, int set, int setval)
+{
+ int val = 0;
+ dhd_qmon_t* qmon = dhd_qmon_p2p_entry(dhdp);
+
+ if (qmon == NULL)
+ return 0;
+
+ if (set)
+ qmon->queued_time_thres = setval;
+ else
+ val = qmon->queued_time_thres;
+
+ return val;
+}
+
+
+int
+dhd_qmon_getpercent(dhd_pub_t *dhdp)
+{
+ int percent = 0;
+ uint64 time_cumul_adjust = 0;
+ uint64 now = QMON_SYSUPTIME();
+ dhd_qmon_t* qmon = dhd_qmon_p2p_entry(dhdp);
+ uint64 queued_time_cumul = 0;
+ uint64 queued_time_last = 0;
+
+ if (qmon == NULL)
+ return 0;
+
+ queued_time_cumul = qmon->queued_time_cumul;
+ queued_time_last = qmon->queued_time_last;
+
+ if (queued_time_last)
+ time_cumul_adjust = now - queued_time_last;
+
+ percent = (uint32)((time_cumul_adjust + queued_time_cumul
+ - qmon->queued_time_cumul_last) * 100) /
+ (uint32)(now - qmon->queued_time_last_io);
+
+ qmon->queued_time_cumul_last = queued_time_cumul + time_cumul_adjust;
+ qmon->queued_time_last_io = now;
+
+ return percent;
+}
--- /dev/null
+/*
+ * Queue monitoring.
+ *
+ * The feature allows monitoring the DHD queue utilization to get the percentage of a time period
+ * where the number of pending packets is above a configurable theshold.
+ * Right now, this is used by a server application, interfacing a Miracast Video Encoder, and
+ * doing IOVAR "qtime_percent" at regular interval. Based on IOVAR "qtime_percent" results,
+ * the server indicates to the Video Encoder if its bitrate can be increased or must be decreased.
+ * Currently, this works only with P2P interfaces and with PROP_TXSTATUS. There is no need to handle
+ * concurrent access to the fieds because the existing concurrent accesses are protected
+ * by the PROP_TXSTATUS's lock.
+ *
+ * Copyright (C) 2013, Broadcom Corporation
+ * All Rights Reserved.
+ *
+ * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation;
+ * the contents of this file may not be disclosed to third parties, copied
+ * or duplicated in any form, in whole or in part, without the prior
+ * written permission of Broadcom Corporation.
+ *
+ * $Id: dhd_qmon.h 309265 2012-01-19 02:50:46Z $
+ *
+ */
+#ifndef _dhd_qmon_h_
+#define _dhd_qmon_h_
+
+
+typedef struct dhd_qmon_s {
+ uint32 transitq_count;
+ uint32 queued_time_thres;
+ uint64 queued_time_cumul;
+ uint64 queued_time_cumul_last;
+ uint64 queued_time_last;
+ uint64 queued_time_last_io;
+} dhd_qmon_t;
+
+
+extern void dhd_qmon_reset(dhd_qmon_t* entry);
+extern void dhd_qmon_tx(dhd_qmon_t* entry);
+extern void dhd_qmon_txcomplete(dhd_qmon_t* entry);
+extern int dhd_qmon_getpercent(dhd_pub_t *dhdp);
+extern int dhd_qmon_thres(dhd_pub_t *dhdp, int set, int setval);
+
+
+#endif /* _dhd_qmon_h_ */
/*
* DHD Bus Module for SDIO
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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 376276 2012-12-24 03:13:52Z $
+ * $Id: dhd_sdio.c 402604 2013-05-16 08:36:25Z $
*/
#include <typedefs.h>
#include <sbhnddma.h>
#include <sdio.h>
-#ifdef BCMSPI
-#include <spid.h>
-#endif /* BCMSPI */
#include <sbsdio.h>
#include <sbsdpcmdev.h>
#include <bcmsdpcm.h>
#include <dhdioctl.h>
#include <sdiovar.h>
+bool dhd_mp_halting(dhd_pub_t *dhdp);
+extern void bcmsdh_waitfor_iodrain(void *sdh);
+extern void bcmsdh_reject_ioreqs(void *sdh, bool reject);
+extern bool bcmsdh_fatal_error(void *sdh);
+
#ifndef DHDSDIO_MEM_DUMP_FNAME
#define DHDSDIO_MEM_DUMP_FNAME "mem_dump"
#endif
#define PRIOMASK 7
#define TXRETRIES 2 /* # of retries for tx frames */
-
+#ifndef DHD_RXBOUND
#define DHD_RXBOUND 50 /* Default for max rx frames in one scheduling */
+#endif
+#ifndef DHD_TXBOUND
#define DHD_TXBOUND 20 /* Default for max tx frames in one scheduling */
+#endif
#define DHD_TXMINMAX 1 /* Max tx frames if rx still pending */
#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) || defined(BCMSPI_ANDROID)
+#if defined(OOB_INTR_ONLY)
extern void bcmsdh_set_irq(int flag);
-#endif /* defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID) */
+#endif
#ifdef PROP_TXSTATUS
extern void dhd_wlfc_txcomplete(dhd_pub_t *dhd, void *txp, bool success);
extern void dhd_wlfc_trigger_pktcommit(dhd_pub_t *dhd);
#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)) */
#ifdef DHD_DEBUG
/* Device console log buffer state */
#define GPIO_DEV_SRSTATE_TIMEOUT 320000 /* 320ms */
#define GPIO_DEV_WAKEUP 17 /* Host gpio17 mapped to device gpio1 wakeup */
#define CC_CHIPCTRL2_GPIO1_WAKEUP (1 << 0)
+#define CC_CHIPCTRL3_SR_ENG_ENABLE (1 << 2)
#define OVERFLOW_BLKSZ512_WM 48
#define OVERFLOW_BLKSZ512_MES 80
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
const uint dhd_deferred_tx = 1;
extern uint dhd_watchdog_ms;
+
extern void dhd_os_wd_timer(void *bus, uint wdtick);
/* Tx/Rx bounds */
uint dhd_txminmax = DHD_TXMINMAX;
/* override the RAM size if possible */
-#define DONGLE_MIN_MEMSIZE (128 *1024)
-int dhd_dongle_memsize;
+#define DONGLE_MIN_RAMSIZE (128 *1024)
+int dhd_dongle_ramsize;
+
+uint dhd_doflow = TRUE;
+uint dhd_dpcpoll = FALSE;
+
+module_param(dhd_doflow, uint, 0644);
+module_param(dhd_dpcpoll, uint, 0644);
-#ifndef REPEAT_READFRAME
-static bool dhd_doflow;
-#else
-extern bool dhd_doflow;
-#endif /* REPEAT_READFRAME */
static bool dhd_alignctl;
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;
-#elif defined(SDIO_CRC_ERROR_FIX)
+#if defined(SDIO_CRC_ERROR_FIX)
static uint watermark = 48;
static uint mesbusyctrl = 80;
#else
static const uint watermark = 8;
static const uint mesbusyctrl = 0;
-#endif /* BCMSPI */
+#endif
static const uint firstread = DHD_FIRSTREAD;
#define HDATLEN (firstread - (SDPCM_HDRLEN))
#define ALIGNMENT 4
-/* Additional alignment needed in case scatter gather is used. */
-#ifndef CUSTOM_ALIGNMENT_SG
-#define CUSTOM_ALIGNMENT_SG 32
-#endif
-#define ALIGNMENT_SG CUSTOM_ALIGNMENT_SG
-
#if defined(OOB_INTR_ONLY) && defined(HW_OOB)
extern void bcmsdh_enable_hw_oob_intr(void *sdh, bool enable);
#endif
#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) \
((bus->rxint_mode == SDIO_DEVICE_HMB_RXINT) ? I_HMB_FRAME_IND : I_XMTDATA_AVAIL)
#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, uint count);
static void dhdsdio_release_dongle(dhd_bus_t *bus, osl_t *osh, bool dongle_isolation,
bool reset_flag);
-static void dhd_dongle_setmemsize(struct dhd_bus *bus, int mem_size);
+static void dhd_dongle_setramsize(struct dhd_bus *bus, int mem_size);
static int dhd_bcmsdh_recv_buf(dhd_bus_t *bus, uint32 addr, uint fn, uint flags,
uint8 *buf, uint nbytes,
void *pkt, bcmsdh_cmplt_fn_t complete, void *handle);
}
static void
-dhd_dongle_setmemsize(struct dhd_bus *bus, int mem_size)
+dhd_dongle_setramsize(struct dhd_bus *bus, int mem_size)
{
- int32 min_size = DONGLE_MIN_MEMSIZE;
- /* Restrict the memsize to user specified limit */
+ int32 min_size = DONGLE_MIN_RAMSIZE;
+ /* Restrict the ramsize to user specified limit */
DHD_ERROR(("user: Restrict the dongle ram size to %d, min accepted %d\n",
- dhd_dongle_memsize, min_size));
- if ((dhd_dongle_memsize > min_size) &&
- (dhd_dongle_memsize < (int32)bus->orig_ramsize))
- bus->ramsize = dhd_dongle_memsize;
+ dhd_dongle_ramsize, min_size));
+ if ((dhd_dongle_ramsize > min_size) &&
+ (dhd_dongle_ramsize < (int32)bus->orig_ramsize))
+ bus->ramsize = dhd_dongle_ramsize;
}
static int
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
}
#endif /* USE_OOB_GPIO1 */
-#ifndef BCMSPI
/*
* Query if FW is in SR mode
*/
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) {
+ } else if ((bus->sih->chip == BCM4335_CHIP_ID) ||
+ (bus->sih->chip == BCM4339_CHIP_ID) ||
+ (bus->sih->chip == BCM4350_CHIP_ID)) {
core_capext = TRUE;
} else {
core_capext = bcmsdh_reg_read(bus->sdh, CORE_CAPEXT_ADDR, 4);
if (bus->sih->chip == BCM4324_CHIP_ID) {
/* FIX: Should change to query SR control register instead */
cap = TRUE;
- } else if (bus->sih->chip == BCM4335_CHIP_ID) {
+ } else if ((bus->sih->chip == BCM4335_CHIP_ID) ||
+ (bus->sih->chip == BCM4339_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 ((bus->sih->chip == BCM4350_CHIP_ID) ||
+ 0)
+ enabval &= CC_CHIPCTRL3_SR_ENG_ENABLE;
+
+
if (enabval)
cap = TRUE;
} else {
static int
dhdsdio_srwar_init(dhd_bus_t *bus)
{
-
bcmsdh_gpio_init(bus->sdh);
#ifdef USE_OOB_GPIO1
return 0;
}
-#endif /* BCMSPI */
/*
* FIX: Be sure KSO bit is enabled
cmp_val = SBSDIO_FUNC1_SLEEPCSR_KSO_MASK | SBSDIO_FUNC1_SLEEPCSR_DEVON_MASK;
bmask = cmp_val;
- usleep_range(5500, 6000);
+ msleep(3);
} else {
/* Put device to sleep, turn off KSO */
cmp_val = 0;
dhdsdio_clkctl(bus, CLK_SDONLY, FALSE);
}
- /* Double-write to be safe in case transition of AOS */
dhdsdio_clk_kso_enab(bus, TRUE);
- dhdsdio_clk_kso_enab(bus, TRUE);
- OSL_DELAY(4000);
-
- /* Wait for device ready during transition to wake-up */
- SPINWAIT(((dhdsdio_sleepcsr_get(bus)) !=
- (SBSDIO_FUNC1_SLEEPCSR_KSO_MASK |
- SBSDIO_FUNC1_SLEEPCSR_DEVON_MASK)),
- (10000));
DHD_ERROR(("%s: sleepcsr: 0x%x\n", __FUNCTION__,
dhdsdio_sleepcsr_get(bus)));
#else
err = dhdsdio_clk_kso_enab(bus, FALSE);
if (OOB_WAKEUP_ENAB(bus))
+ {
err = bcmsdh_gpioout(bus->sdh, GPIO_DEV_WAKEUP, FALSE); /* GPIO_1 is off */
-#endif
+ }
+#endif /* USE_CMD14 */
} else {
/* Exit Sleep */
/* Make sure we have SD bus access */
}
#else
if (OOB_WAKEUP_ENAB(bus))
+ {
err = bcmsdh_gpioout(bus->sdh, GPIO_DEV_WAKEUP, TRUE); /* GPIO_1 is on */
-
+ }
do {
err = dhdsdio_clk_kso_enab(bus, TRUE);
if (err)
bus->kso = on ? FALSE : TRUE;
else {
DHD_ERROR(("%s: Sleep request failed: on:%d err:%d\n", __FUNCTION__, on, err));
+ if (!on && retry > 2)
+ bus->kso = TRUE;
}
return err;
/* 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);
return BCME_ERROR;
}
}
-#ifdef BCMSPI
- dhdsdio_wkwlan(bus, FALSE);
-#endif /* BCMSPI */
}
return BCME_OK;
}
static int
dhdsdio_sdclk(dhd_bus_t *bus, bool on)
{
-#ifndef BCMSPI
int err;
int32 iovalue;
}
bus->clkstate = CLK_NONE;
}
-#endif /* BCMSPI */
return BCME_OK;
}
/* 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;
/* Leave interrupts enabled since device can exit sleep and
* interrupt host
*/
+#ifdef DISABLE_CHIPACTIVE_BUSSLEEP
+ if (((uint16)bus->sih->chip == BCM4324_CHIP_ID) && (bus->sih->chiprev < 3))
+ W_SDREG(bus->hostintmask & ~I_CHIPACTIVE, &bus->regs->hostintmask, retries);
+#endif
err = dhdsdio_clk_devsleep_iovar(bus, TRUE /* sleep */);
}
}
} else {
err = dhdsdio_clk_devsleep_iovar(bus, FALSE /* wake */);
+#ifdef DISABLE_CHIPACTIVE_BUSSLEEP
+ if (((uint16)bus->sih->chip == BCM4324_CHIP_ID) && (bus->sih->chiprev < 3))
+ W_SDREG(bus->hostintmask, &bus->regs->hostintmask, retries);
+#endif
}
if (err == 0) {
return err;
}
-#if defined(CUSTOMER_HW4) && defined(USE_DYNAMIC_F2_BLKSIZE)
-int dhdsdio_func_blocksize(dhd_pub_t *dhd, int function_num, int block_size)
-{
- int func_blk_size = function_num;
- int bcmerr = 0;
- int result;
-
- 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));
- return BCME_ERROR;
- }
-
- if (result != block_size) {
- DHD_TRACE_HW4(("%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);
- if (bcmerr != BCME_OK) {
- DHD_ERROR(("%s: Set F2 Block size error\n", __FUNCTION__));
- return BCME_ERROR;
- }
- }
-
- return BCME_OK;
-}
-#endif /* CUSTOMER_HW4 && USE_DYNAMIC_F2_BLKSIZE */
#if defined(OOB_INTR_ONLY)
void
dhdsdio_clkctl(bus, CLK_SDONLY, FALSE);
#endif /* !defined(HW_OOB) */
}
-#endif /* defined(OOB_INTR_ONLY) */
-
+#endif
#ifdef DHDTCPACK_SUPPRESS
extern bool dhd_use_tcpack_suppress;
/* is it an ack ? */
if (tcp_header[13] == 0x10) {
+#if defined(DHD_DEBUG)
uint32 tcp_seq_num = tcp_header[4] << 24 | tcp_header[5] << 16 |
tcp_header[6] << 8 | tcp_header[7];
+#endif
uint32 tcp_ack_num = tcp_header[8] << 24 | tcp_header[9] << 16 |
tcp_header[10] << 8 | tcp_header[11];
uint16 ip_tcp_ttllen = (ip_header[3] & 0xff) + (ip_header[2] << 8);
return FALSE;
}
#endif /* DHDTCPACK_SUPPRESS */
-
-
/* Writes a HW/SW header into the packet and sends it. */
/* Assumes: (a) header space already there, (b) caller holds lock */
static int
uint16 len, pad1 = 0;
uint32 swheader;
uint retries = 0;
+ uint32 real_pad = 0;
bcmsdh_info_t *sdh;
void *new;
int i;
htsfts_t *htsf_ts;
#endif
+
DHD_TRACE(("%s: Enter\n", __FUNCTION__));
sdh = bus->sdh;
#endif /* WLMEDIA_HTSF */
/* Add alignment padding, allocate new packet if needed */
- if (!((uintptr)frame & 1) && (pad1 = ((uintptr)frame % DHD_SDALIGN))) {
+ if ((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));
if (queue_only) {
uint8 alignment = ALIGNMENT;
-#if defined(BCMLXSDMMC) && defined(CUSTOMER_HW4)
- if (bus->glom_mode == SDPCM_TXGLOM_MDESC)
- alignment = ALIGNMENT_SG;
-#endif /* defined(BCMLXSDMMC) && defined(CUSTOMER_HW4) */
if (forcealign && (len & (alignment - 1)))
len = ROUNDUP(len, alignment);
/* Hardware extention tag */
hwheader2 = (len - act_len) << 16;
htol32_ua_store(hwheader1, frame + SDPCM_FRAMETAG_LEN);
htol32_ua_store(hwheader2, frame + SDPCM_FRAMETAG_LEN + 4);
+ real_pad = len - act_len;
+ if (PKTTAILROOM(osh, pkt) < real_pad) {
+ DHD_INFO(("%s 1: insufficient tailroom %d for %d real_pad\n",
+ __FUNCTION__, (int)PKTTAILROOM(osh, pkt), real_pad));
+ if (PKTPADTAILROOM(osh, pkt, real_pad)) {
+ DHD_ERROR(("CHK1: padding error size %d\n", real_pad));
+ ret = BCME_NOMEM;
+ goto done;
+ }
+#ifndef BCMLXSDMMC
+ else
+ PKTSETLEN(osh, pkt, act_len);
+#endif
+ }
#ifdef BCMLXSDMMC
PKTSETLEN(osh, pkt, len);
#endif /* BCMLXSDMMC */
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 */
+ real_pad = len - act_len;
+ if (PKTTAILROOM(osh, pkt) < real_pad) {
+ DHD_INFO(("%s 2: insufficient tailroom %d"
+ " for %d real_pad\n",
+ __FUNCTION__, (int)PKTTAILROOM(osh, pkt), real_pad));
+ if (PKTPADTAILROOM(osh, pkt, real_pad)) {
+ DHD_ERROR(("CHK2: padding error size %d."
+ " %d more pkts are discarded together.\n",
+ real_pad, bus->glom_cnt));
+ /* Save the pkt pointer in bus glom array
+ * Otherwise, this last pkt will not be
+ * cleaned under "goto done"
+ */
+ bus->glom_pkt_arr[bus->glom_cnt] = pkt;
+ bus->glom_cnt++;
+ bus->glom_total_len += len;
+ ret = BCME_NOMEM;
+ goto done;
+ }
+#ifndef BCMLXSDMMC
+ else
+ PKTSETLEN(osh, pkt, act_len);
+#endif
+ }
#ifdef BCMLXSDMMC
PKTSETLEN(osh, pkt, len);
#endif /* BCMLXSDMMC */
+ /* Post the frame pointer to sdio glom array */
dhd_bcmsdh_glom_post(bus, frame, pkt, len);
/* Save the pkt pointer in bus glom array */
bus->glom_pkt_arr[bus->glom_cnt] = pkt;
} else
#endif /* BCMSDIOH_TXGLOM */
{
+ uint32 act_len = len;
/* 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);
}
#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);
} 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))) {
DHD_ERROR(("%s: sending unrounded %d-byte packet\n", __FUNCTION__, len));
#endif
}
+ real_pad = len - act_len;
+ if (PKTTAILROOM(osh, pkt) < real_pad) {
+ DHD_INFO(("%s 3: insufficient tailroom %d for %d real_pad\n",
+ __FUNCTION__, (int)PKTTAILROOM(osh, pkt), real_pad));
+ if (PKTPADTAILROOM(osh, pkt, real_pad)) {
+ DHD_ERROR(("CHK3: padding error size %d\n", real_pad));
+ ret = BCME_NOMEM;
+ goto done;
+ } else
+ PKTSETLEN(osh, pkt, act_len);
+ }
}
do {
ret = dhd_bcmsdh_send_buf(bus, bcmsdh_cur_sbwad(sdh), SDIO_FUNC_2, F2SYNC,
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++;
} else
#endif
{
- bus->tx_seq = (bus->tx_seq + 1) % SDPCM_SEQUENCE_WRAP;
- }
+ bus->tx_seq = (bus->tx_seq + 1) % SDPCM_SEQUENCE_WRAP;
+ }
}
} while ((ret < 0) && retrydata && retries++ < TXRETRIES);
done:
#ifdef BCMSDIOH_TXGLOM
- if (bus->glom_enable) {
+ if (bus->glom_enable && !queue_only) {
dhd_bcmsdh_glom_clear(bus);
pkt_cnt = bus->glom_cnt;
} else
#ifdef BCMLXSDMMC
uint32 pad2 = 0;
#endif /* BCMLXSDMMC */
- pkt = bus->glom_pkt_arr[bus->glom_cnt - pkt_cnt];
+ if (!queue_only)
+ 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;
#ifdef BCMSDIOH_TXGLOM
/* Reset the glom array */
- if (bus->glom_enable) {
+ if (bus->glom_enable && !queue_only) {
bus->glom_cnt = 0;
bus->glom_total_len = 0;
}
}
else
ret = BCME_OK;
+
if ((pktq_len(&bus->txq) >= FCHI) && dhd_doflow)
dhd_txflowcontrol(bus->dhd, ALL_INTERFACES, ON);
}
tx_prec_map = ~bus->flowcontrol;
+
/* Send frames until the limit or some other event */
for (cnt = 0; (cnt < maxframes) && DATAOK(bus); cnt++) {
#ifdef BCMSDIOH_TXGLOM
break;
datalen = 0;
for (i = 0; i < glom_cnt; i++) {
+ uint datalen_tmp = 0;
+
if ((pkt = pkttable[i]) == NULL) {
/* This case should not happen */
DHD_ERROR(("No pkts in the queue for glomming\n"));
break;
}
- datalen += (PKTLEN(bus->dhd->osh, pkt) - SDPCM_HDRLEN);
+ datalen_tmp = (PKTLEN(bus->dhd->osh, pkt) - SDPCM_HDRLEN);
+
#ifndef SDTEST
ret = dhdsdio_txpkt(bus,
pkt,
TRUE,
(i == (glom_cnt-1))? FALSE: TRUE);
#endif
+ if (ret == BCME_OK)
+ datalen += datalen_tmp;
}
cnt += i-1;
} else
return cnt;
}
+static void
+dhdsdio_sendpendctl(dhd_bus_t *bus)
+{
+ bcmsdh_info_t *sdh = bus->sdh;
+ int ret, i;
+ uint8* frame_seq = bus->ctrl_frame_buf + SDPCM_FRAMETAG_LEN;
+
+#ifdef BCMSDIOH_TXGLOM
+ if (bus->glom_enable)
+ frame_seq += SDPCM_HWEXT_LEN;
+#endif
+
+ if (*frame_seq != bus->tx_seq) {
+ DHD_INFO(("%s IOCTL frame seq lag detected!"
+ " frm_seq:%d != bus->tx_seq:%d, corrected\n",
+ __FUNCTION__, *frame_seq, bus->tx_seq));
+ *frame_seq = bus->tx_seq;
+ }
+
+ ret = dhd_bcmsdh_send_buf(bus, bcmsdh_cur_sbwad(sdh), SDIO_FUNC_2, F2SYNC,
+ (uint8 *)bus->ctrl_frame_buf, (uint32)bus->ctrl_frame_len,
+ NULL, NULL, NULL);
+ ASSERT(ret != BCME_PENDING);
+ if (ret == BCME_NODEVICE) {
+ 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",
+ __FUNCTION__, ret));
+ bus->tx_sderrs++;
+
+ bcmsdh_abort(sdh, SDIO_FUNC_2);
+
+ bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_FRAMECTRL,
+ SFC_WF_TERM, NULL);
+ bus->f1regdata++;
+
+ for (i = 0; i < 3; i++) {
+ uint8 hi, lo;
+ hi = bcmsdh_cfg_read(sdh, SDIO_FUNC_1,
+ SBSDIO_FUNC1_WFRAMEBCHI, NULL);
+ lo = bcmsdh_cfg_read(sdh, SDIO_FUNC_1,
+ SBSDIO_FUNC1_WFRAMEBCLO, NULL);
+ bus->f1regdata += 2;
+ if ((hi == 0) && (lo == 0))
+ break;
+ }
+ }
+ if (ret == 0) {
+ bus->tx_seq = (bus->tx_seq + 1) % SDPCM_SEQUENCE_WRAP;
+ }
+
+ bus->ctrl_frame_stat = FALSE;
+ dhd_wait_event_wakeup(bus->dhd);
+}
+
int
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);
} else if (len % DHD_SDALIGN) {
len += DHD_SDALIGN - (len % DHD_SDALIGN);
}
-#endif /* BCMSPI */
/* Satisfy length-alignment requirements */
if (forcealign && (len & (ALIGNMENT - 1)))
} else {
bus->dhd->txcnt_timeout++;
if (!bus->dhd->hang_was_sent) {
-#ifdef CUSTOMER_HW4
- uint32 status, retry = 0;
- R_SDREG(status, &bus->regs->intstatus, retry);
- DHD_TRACE_HW4(("%s: txcnt_timeout, INT status=0x%08X\n",
- __FUNCTION__, status));
- DHD_TRACE_HW4(("%s : tx_max : %d, tx_seq : %d, clkstate : %d \n",
- __FUNCTION__, bus->tx_max, bus->tx_seq, bus->clkstate));
-#endif /* CUSTOMER_HW4 */
DHD_ERROR(("%s: ctrl_frame_stat == TRUE txcnt_timeout=%d\n",
__FUNCTION__, bus->dhd->txcnt_timeout));
}
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++;
else
bus->dhd->tx_ctlpkts++;
- if (bus->dhd->txcnt_timeout >= MAX_CNTL_TIMEOUT)
+ if (bus->dhd->txcnt_timeout >= MAX_CNTL_TX_TIMEOUT)
return -ETIMEDOUT;
return ret ? -EIO : 0;
#endif /* DHD_DEBUG */
}
if (timeleft == 0) {
- bus->dhd->rxcnt_timeout++;
- DHD_ERROR(("%s: rxcnt_timeout=%d\n", __FUNCTION__, bus->dhd->rxcnt_timeout));
+ if (rxlen == 0)
+ bus->dhd->rxcnt_timeout++;
+ DHD_ERROR(("%s: rxcnt_timeout=%d, rxlen=%d\n", __FUNCTION__,
+ bus->dhd->rxcnt_timeout, rxlen));
}
else
bus->dhd->rxcnt_timeout = 0;
else
bus->dhd->rx_ctlerrs++;
- if (bus->dhd->rxcnt_timeout >= MAX_CNTL_TIMEOUT)
+ if (bus->dhd->rxcnt_timeout >= MAX_CNTL_RX_TIMEOUT)
return -ETIMEDOUT;
if (bus->dhd->dongle_trap_occured)
IOV_SBREG,
IOV_SDCIS,
IOV_MEMBYTES,
- IOV_MEMSIZE,
+ IOV_RAMSIZE,
+ IOV_RAMSTART,
#ifdef DHD_DEBUG
IOV_CHECKDIED,
IOV_SERIALCONS,
IOV_FWPATH,
#endif
IOV_TXGLOMSIZE,
- IOV_TXGLOMMODE
+ IOV_TXGLOMMODE,
+ IOV_HANGREPORT
};
const bcm_iovar_t dhdsdio_iovars[] = {
{"idleclock", IOV_IDLECLOCK, 0, IOVT_INT32, 0 },
{"sd1idle", IOV_SD1IDLE, 0, IOVT_BOOL, 0 },
{"membytes", IOV_MEMBYTES, 0, IOVT_BUFFER, 2 * sizeof(int) },
- {"memsize", IOV_MEMSIZE, 0, IOVT_UINT32, 0 },
+ {"ramsize", IOV_RAMSIZE, 0, IOVT_UINT32, 0 },
+ {"ramstart", IOV_RAMSTART, 0, IOVT_UINT32, 0 },
{"dwnldstate", IOV_SET_DOWNLOAD_STATE, 0, IOVT_BOOL, 0 },
{"socram_state", IOV_SOCRAM_STATE, 0, IOVT_BOOL, 0 },
{"vars", IOV_VARS, 0, IOVT_BUFFER, 0 },
#endif
{"txglomsize", IOV_TXGLOMSIZE, 0, IOVT_UINT32, 0 },
{"txglommode", IOV_TXGLOMMODE, 0, IOVT_UINT32, 0 },
+ {"fw_hang_report", IOV_HANGREPORT, 0, IOVT_BOOL, 0 },
{NULL, 0, 0, 0, 0 }
};
bcm_bprintf(strbuf, "Bus SDIO structure:\n");
bcm_bprintf(strbuf, "hostintmask 0x%08x intstatus 0x%08x sdpcm_ver %d\n",
bus->hostintmask, bus->intstatus, bus->sdpcm_ver);
- bcm_bprintf(strbuf, "fcstate %d qlen %d tx_seq %d, max %d, rxskip %d rxlen %d rx_seq %d\n",
+ bcm_bprintf(strbuf, "fcstate %d qlen %u tx_seq %d, max %d, rxskip %d rxlen %u rx_seq %d\n",
bus->fcstate, pktq_len(&bus->txq), bus->tx_seq, bus->tx_max, bus->rxskip,
bus->rxlen, bus->rx_seq);
- bcm_bprintf(strbuf, "intr %d intrcount %d lastintrs %d spurious %d\n",
+ bcm_bprintf(strbuf, "intr %d intrcount %u lastintrs %u spurious %u\n",
bus->intr, bus->intrcount, bus->lastintrs, bus->spurious);
- bcm_bprintf(strbuf, "pollrate %d pollcnt %d regfails %d\n",
+ bcm_bprintf(strbuf, "pollrate %u pollcnt %u regfails %u\n",
bus->pollrate, bus->pollcnt, bus->regfails);
bcm_bprintf(strbuf, "\nAdditional counters:\n");
- bcm_bprintf(strbuf, "tx_sderrs %d fcqueued %d rxrtx %d rx_toolong %d rxc_errors %d\n",
+ bcm_bprintf(strbuf, "tx_sderrs %u fcqueued %u rxrtx %u rx_toolong %u rxc_errors %u\n",
bus->tx_sderrs, bus->fcqueued, bus->rxrtx, bus->rx_toolong,
bus->rxc_errors);
- bcm_bprintf(strbuf, "rx_hdrfail %d badhdr %d badseq %d\n",
+ bcm_bprintf(strbuf, "rx_hdrfail %u badhdr %u badseq %u\n",
bus->rx_hdrfail, bus->rx_badhdr, bus->rx_badseq);
- bcm_bprintf(strbuf, "fc_rcvd %d, fc_xoff %d, fc_xon %d\n",
+ bcm_bprintf(strbuf, "fc_rcvd %u, fc_xoff %u, fc_xon %u\n",
bus->fc_rcvd, bus->fc_xoff, bus->fc_xon);
- bcm_bprintf(strbuf, "rxglomfail %d, rxglomframes %d, rxglompkts %d\n",
+ bcm_bprintf(strbuf, "rxglomfail %u, rxglomframes %u, rxglompkts %u\n",
bus->rxglomfail, bus->rxglomframes, bus->rxglompkts);
- bcm_bprintf(strbuf, "f2rx (hdrs/data) %d (%d/%d), f2tx %d f1regs %d\n",
+ bcm_bprintf(strbuf, "f2rx (hdrs/data) %u (%u/%u), f2tx %u f1regs %u\n",
(bus->f2rxhdrs + bus->f2rxdata), bus->f2rxhdrs, bus->f2rxdata,
bus->f2txdata, bus->f1regdata);
{
#ifdef SDTEST
if (bus->pktgen_count) {
bcm_bprintf(strbuf, "pktgen config and count:\n");
- bcm_bprintf(strbuf, "freq %d count %d print %d total %d min %d len %d\n",
+ bcm_bprintf(strbuf, "freq %u count %u print %u total %u min %u len %u\n",
bus->pktgen_freq, bus->pktgen_count, bus->pktgen_print,
bus->pktgen_total, bus->pktgen_minlen, bus->pktgen_maxlen);
- bcm_bprintf(strbuf, "send attempts %d rcvd %d fail %d\n",
+ bcm_bprintf(strbuf, "send attempts %u rcvd %u fail %u\n",
bus->pktgen_sent, bus->pktgen_rcvd, bus->pktgen_fail);
}
#endif /* SDTEST */
#ifdef DHD_DEBUG
bcm_bprintf(strbuf, "dpc_sched %d host interrupt%spending\n",
bus->dpc_sched, (bcmsdh_intr_pending(bus->sdh) ? " " : " not "));
- bcm_bprintf(strbuf, "blocksize %d roundup %d\n", bus->blocksize, bus->roundup);
+ bcm_bprintf(strbuf, "blocksize %u roundup %u\n", bus->blocksize, bus->roundup);
#endif /* DHD_DEBUG */
bcm_bprintf(strbuf, "clkstate %d activity %d idletime %d idlecount %d sleeping %d\n",
bus->clkstate, bus->activity, bus->idletime, bus->idlecount, bus->sleeping);
/* check if CR4 */
if (si_setcore(bus->sih, ARMCR4_CORE_ID, 0)) {
- /* if address is 0, store the reset instruction to be written in 0 */
-
- if (address == 0) {
+ /*
+ * If address is start of RAM (i.e. a downloaded image),
+ * store the reset instruction to be written in 0
+ */
+ if (address == bus->dongle_ram_base) {
bus->resetinstr = *(((uint32*)params) + 2);
}
- /* Add start of RAM address to the address given by user */
- address += bus->dongle_ram_base;
} else {
/* If we know about SOCRAM, check for a fit */
if ((bus->orig_ramsize) &&
break;
}
- case IOV_GVAL(IOV_MEMSIZE):
+ case IOV_GVAL(IOV_RAMSIZE):
int_val = (int32)bus->ramsize;
bcopy(&int_val, arg, val_size);
break;
+ case IOV_GVAL(IOV_RAMSTART):
+ int_val = (int32)bus->dongle_ram_base;
+ bcopy(&int_val, arg, val_size);
+ break;
+
case IOV_GVAL(IOV_SDIOD_DRIVE):
int_val = (int32)dhd_sdiod_drive_strength;
bcopy(&int_val, arg, val_size);
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);
case IOV_SVAL(IOV_ALIGNCTL):
dhd_alignctl = bool_val;
break;
-#endif /* BCMSPI */
case IOV_GVAL(IOV_SDALIGN):
int_val = DHD_SDALIGN;
}
break;
#endif /* BCMSDIOH_TXGLOM */
+ case IOV_SVAL(IOV_HANGREPORT):
+ bus->dhd->hang_report = bool_val;
+ DHD_ERROR(("%s: Set hang_report as %d\n", __FUNCTION__, bus->dhd->hang_report));
+ break;
+
+ case IOV_GVAL(IOV_HANGREPORT):
+ int_val = (int32)bus->dhd->hang_report;
+ bcopy(&int_val, arg, val_size);
+ break;
default:
bcmerror = BCME_UNSUPPORTED;
break;
DHD_INFO(("%s: noted %s update, value now %d\n",
__FUNCTION__, "sd_blocksize", bus->blocksize));
- if (bus->sih->chip == BCM4335_CHIP_ID)
+ if ((bus->sih->chip == BCM4335_CHIP_ID) ||
+ (bus->sih->chip == BCM4339_CHIP_ID))
dhd_overflow_war(bus);
}
}
/* 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);
bus->rxskip = FALSE;
bus->tx_seq = bus->rx_seq = 0;
+ bus->tx_max = 4;
+
if (enforce_mutex)
dhd_os_sdunlock(bus->dhd);
}
uint32 rxglom;
int32 ret;
+ DHD_TRACE(("%s: Enter\n", __FUNCTION__));
+
if (enable) {
rxglom = 1;
memset(buf, 0, sizeof(buf));
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__));
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);
while (ready != enable && !dhd_timeout_expired(&tmo))
ready = bcmsdh_cfg_read(bus->sdh, SDIO_FUNC_0, SDIOD_CCCR_IORDY, NULL);
-#endif /* !BCMSPI */
-
DHD_ERROR(("%s: enable 0x%02x, ready 0x%02x (waited %uus)\n",
__FUNCTION__, enable, ready, tmo.elapsed));
/* 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);
#ifdef SDIO_CRC_ERROR_FIX
if (bus->blocksize < 512) {
mesbusyctrl = watermark = bus->blocksize / 4;
}
#endif /* SDIO_CRC_ERROR_FIX */
- if (bus->sih->chip != BCM4335_CHIP_ID) {
+ if (!((bus->sih->chip == BCM4335_CHIP_ID) ||
+ (bus->sih->chip == BCM4339_CHIP_ID))) {
bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_1, SBSDIO_WATERMARK,
(uint8)watermark, &err);
}
}
-#ifndef BCMSPI
else {
/* Disable F2 again */
bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_0, SDIOD_CCCR_IOEN, enable, NULL);
}
- if (dhdsdio_sr_cap(bus))
+ if (dhdsdio_sr_cap(bus)) {
dhdsdio_sr_init(bus);
- else
+#ifdef DISABLE_CHIPACTIVE
+ if (((uint16)bus->sih->chip == BCM4324_CHIP_ID) && (bus->sih->chiprev < 3)) {
+ bus->hostintmask &= ~I_CHIPACTIVE;
+ W_SDREG(bus->hostintmask, &bus->regs->hostintmask, retries);
+ DHD_INFO(("%s: disable I_CHIPACTIVE in hostintmask[0x%08x]\n",
+ __FUNCTION__, bus->hostintmask));
+ }
+#endif
+ } else
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)
}
bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_FRAMECTRL, SFC_RF_TERM, &err);
+ if (err) {
+ DHD_ERROR(("%s: SBSDIO_FUNC1_FRAMECTRL cmd err\n", __FUNCTION__));
+ goto fail;
+ }
bus->f1regdata++;
/* Wait until the packet has been flushed (device/FIFO stable) */
for (lastrbc = retries = 0xffff; retries > 0; retries--) {
hi = bcmsdh_cfg_read(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_RFRAMEBCHI, NULL);
- lo = bcmsdh_cfg_read(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_RFRAMEBCLO, NULL);
+ lo = bcmsdh_cfg_read(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_RFRAMEBCLO, &err);
+ if (err) {
+ DHD_ERROR(("%s: SBSDIO_FUNC1_RFAMEBCLO cmd err\n", __FUNCTION__));
+ goto fail;
+ }
+
bus->f1regdata += 2;
if ((hi == 0) && (lo == 0))
/* Clear partial in any case */
bus->nextlen = 0;
+fail:
/* If we can't reach the device, signal failure */
if (err || bcmsdh_regfail(sdh))
bus->dhd->busstate = DHD_BUS_DOWN;
/* Awake any waiters */
dhd_os_ioctl_resp_wake(bus->dhd);
}
+int
+dhd_process_pkt_reorder_info(dhd_pub_t *dhd, uchar *reorder_info_buf, uint reorder_info_len,
+ void **pkt, uint32 *pkt_count);
static uint8
dhdsdio_rxglom(dhd_bus_t *bus, uint8 rxseq)
temp = PKTNEXT(osh, temp);
}
pfirst = temp;
- if (list_tail[ifidx] == NULL) {
+ if (list_tail[ifidx] == NULL)
list_head[ifidx] = ppfirst;
- list_tail[ifidx] = pfirst;
- }
- else {
+ else
PKTSETNEXT(osh, list_tail[ifidx], ppfirst);
- list_tail[ifidx] = pfirst;
- }
+ list_tail[ifidx] = pfirst;
}
num += (uint8)free_buf_count;
/* Return TRUE if there may be more frames to read */
static uint
-#ifdef REPEAT_READFRAME
-dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished, bool tx_enable)
-#else
dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
-#endif
-
{
osl_t *osh = bus->dhd->osh;
bcmsdh_info_t *sdh = bus->sdh;
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;
/* 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;
#ifdef DHDTHREAD
/* tx more to improve rx performance */
- if (
-#ifdef REPEAT_READFRAME
- tx_enable &&
-#endif
- (bus->clkstate == CLK_AVAIL) && !bus->fcstate &&
+ if (TXCTLOK(bus) && bus->ctrl_frame_stat && (bus->clkstate == CLK_AVAIL)) {
+ dhdsdio_sendpendctl(bus);
+ } else if ((bus->clkstate == CLK_AVAIL) && !bus->fcstate &&
pktq_mlen(&bus->txq, ~bus->flowcontrol) && DATAOK(bus)) {
dhdsdio_sendfromq(bus, dhd_txbound);
}
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) {
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",
}
/* 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) */
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) {
}
bus->dhd->rx_readahead_cnt ++;
-#ifdef BCMSPI
- }
-#endif /* BCMSPI */
/* Handle Flow Control */
fcbits = SDPCM_FCMASK_VALUE(&bus->rxhdr[SDPCM_FRAMETAG_LEN]);
/* 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 */
+ DHD_ERROR(("%s: got unlikely tx max %d with tx_seq %d\n",
+ __FUNCTION__, txmax, bus->tx_seq));
+ txmax = bus->tx_max;
}
bus->tx_max = txmax;
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)) {
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 */
return intstatus;
}
-#ifdef REPEAT_READFRAME
-extern uint dhd_dpcpoll;
-#endif
-
static bool
dhdsdio_dpc(dhd_bus_t *bus)
{
}
BUS_WAKE(bus);
+
/* Make sure backplane clock is on */
dhdsdio_clkctl(bus, CLK_AVAIL, TRUE);
if (bus->clkstate != CLK_AVAIL)
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, ®s->intstatus, retries);
}
}
intstatus |= newstatus;
bus->intstatus = 0;
-
/* Handle flow-control change: read new state in case our ack
* crossed another change interrupt. If change still set, assume
* FC ON for safety, let next loop through do the debounce.
/* On frame indication, read available frames */
if (PKT_AVAILABLE(bus, intstatus)) {
-#ifdef REPEAT_READFRAME
- framecnt = dhdsdio_readframes(bus, rxlimit, &rxdone, true);
-#else
framecnt = dhdsdio_readframes(bus, rxlimit, &rxdone);
-#endif
if (rxdone || bus->rxskip)
intstatus &= ~FRAME_AVAIL_MASK(bus);
rxlimit -= MIN(framecnt, rxlimit);
DHD_INTR(("%s: enable SDIO interrupts, rxdone %d framecnt %d\n",
__FUNCTION__, rxdone, framecnt));
bus->intdis = FALSE;
-#if defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID)
- bcmsdh_oob_intr_set(1);
-#endif /* defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID) */
+#if defined(OOB_INTR_ONLY)
+ bcmsdh_oob_intr_set(1);
+#endif /* defined(OOB_INTR_ONLY) */
bcmsdh_intr_enable(sdh);
}
dhd_wlfc_trigger_pktcommit(bus->dhd);
#endif
+ if (TXCTLOK(bus) && bus->ctrl_frame_stat && (bus->clkstate == CLK_AVAIL))
+ dhdsdio_sendpendctl(bus);
- if (TXCTLOK(bus) && bus->ctrl_frame_stat && (bus->clkstate == CLK_AVAIL)) {
- int ret, i;
- uint8* frame_seq = bus->ctrl_frame_buf + SDPCM_FRAMETAG_LEN;
-
-#ifdef BCMSDIOH_TXGLOM
- if (bus->glom_enable)
- frame_seq += SDPCM_HWEXT_LEN;
-#endif
-
- if (*frame_seq != bus->tx_seq) {
- DHD_INFO(("%s IOCTL frame seq lag detected!"
- " frm_seq:%d != bus->tx_seq:%d, corrected\n",
- __FUNCTION__, *frame_seq, bus->tx_seq));
- *frame_seq = bus->tx_seq;
- }
-
- ret = dhd_bcmsdh_send_buf(bus, bcmsdh_cur_sbwad(sdh), SDIO_FUNC_2, F2SYNC,
- (uint8 *)bus->ctrl_frame_buf, (uint32)bus->ctrl_frame_len,
- NULL, NULL, NULL);
- ASSERT(ret != BCME_PENDING);
- if (ret == BCME_NODEVICE) {
- 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",
- __FUNCTION__, ret));
- bus->tx_sderrs++;
-
- bcmsdh_abort(sdh, SDIO_FUNC_2);
-
- bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_FRAMECTRL,
- SFC_WF_TERM, NULL);
- bus->f1regdata++;
-
- for (i = 0; i < 3; i++) {
- uint8 hi, lo;
- hi = bcmsdh_cfg_read(sdh, SDIO_FUNC_1,
- SBSDIO_FUNC1_WFRAMEBCHI, NULL);
- lo = bcmsdh_cfg_read(sdh, SDIO_FUNC_1,
- SBSDIO_FUNC1_WFRAMEBCLO, NULL);
- bus->f1regdata += 2;
- if ((hi == 0) && (lo == 0))
- break;
- }
- }
- if (ret == 0) {
- bus->tx_seq = (bus->tx_seq + 1) % SDPCM_SEQUENCE_WRAP;
- }
-
- bus->ctrl_frame_stat = FALSE;
- dhd_wait_event_wakeup(bus->dhd);
- }
/* Send queued frames (limit 1 if rx may still be pending) */
else if ((bus->clkstate == CLK_AVAIL) && !bus->fcstate &&
pktq_mlen(&bus->txq, ~bus->flowcontrol) && txlimit && DATAOK(bus)) {
/* 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__));
}
exit:
-#ifdef REPEAT_READFRAME
+
if (!resched && dhd_dpcpoll) {
- resched = dhdsdio_readframes(bus, dhd_rxbound, &rxdone, true);
+ if (dhdsdio_readframes(bus, dhd_rxbound, &rxdone) != 0)
+ resched = TRUE;
}
-#endif
dhd_os_sdunlock(bus->dhd);
return resched;
#if defined(SDIO_ISR_THREAD)
DHD_TRACE(("Calling dhdsdio_dpc() from %s\n", __FUNCTION__));
DHD_OS_WAKE_LOCK(bus->dhd);
- while (dhdsdio_dpc(bus));
+ dhdsdio_dpc(bus);
DHD_OS_WAKE_UNLOCK(bus->dhd);
#else
+
bus->dpc_sched = TRUE;
dhd_sched_dpc(bus->dhd);
/* 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) {
return TRUE;
if (chipid == BCM4335_CHIP_ID)
return TRUE;
+ if (chipid == BCM4339_CHIP_ID)
+ return TRUE;
if (chipid == BCM4350_CHIP_ID)
return TRUE;
return FALSE;
struct ether_addr ea_addr;
#endif /* GET_CUSTOM_MAC_ENABLE */
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25))
- if (mutex_is_locked(&_dhd_sdio_mutex_lock_) == 0) {
- DHD_ERROR(("%s : no mutex held. set lock\n", __FUNCTION__));
- }
- else {
- DHD_ERROR(("%s : mutex is locked!. wait for unlocking\n", __FUNCTION__));
- }
- mutex_lock(&_dhd_sdio_mutex_lock_);
-#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) */
/* Init global variables at run-time, not as part of the declaration.
* This is required to support init/de-init of the driver. Initialization
*/
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;
-#ifndef REPEAT_READFRAME
dhd_doflow = FALSE;
-#else
- dhd_doflow = TRUE;
-#endif
- dhd_dongle_memsize = 0;
+ dhd_dongle_ramsize = 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));
#endif /* GET_CUSTOM_MAC_ENABLE */
/* if firmware path present try to download and bring up bus */
+ bus->dhd->hang_report = TRUE;
if (dhd_download_fw_on_driverload) {
if ((ret = dhd_bus_start(bus->dhd)) != 0) {
DHD_ERROR(("%s: dhd_bus_start failed\n", __FUNCTION__));
goto fail;
}
-#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
-#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, 27)) */
return bus;
dhdsdio_release(bus, osh);
forcereturn:
-#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, 27)) */
return NULL;
}
-#ifdef REGON_BP_HANG_FIX
-static int dhd_sdio_backplane_reset(struct dhd_bus *bus)
-{
- uint32 temp = 0;
- DHD_ERROR(("Resetting the backplane to avoid failure in firmware download..\n"));
-
- temp = bcmsdh_reg_read(bus->sdh, 0x180021e0, 4);
- DHD_INFO(("SDIO Clk Control Reg = %x\n", temp));
-
- /* Force HT req from PMU */
- bcmsdh_reg_write(bus->sdh, 0x18000644, 4, 0x6000005);
-
- /* Increase the clock stretch duration. */
- bcmsdh_reg_write(bus->sdh, 0x18000630, 4, 0xC8FFC8);
-
- /* Setting ALP clock request in SDIOD clock control status register */
- bcmsdh_reg_write(bus->sdh, 0x180021e0, 4, 0x41);
-
- /* Allowing clock from SR engine to SR memory */
- bcmsdh_reg_write(bus->sdh, 0x18004400, 4, 0xf92f1);
- /* Disabling SR Engine before SR binary download. */
- bcmsdh_reg_write(bus->sdh, 0x18000650, 4, 0x3);
- bcmsdh_reg_write(bus->sdh, 0x18000654, 4, 0x0);
-
- /* Enabling clock from backplane to SR memory */
- bcmsdh_reg_write(bus->sdh, 0x18004400, 4, 0xf9af1);
-
- /* Initializing SR memory address register in SOCRAM */
- bcmsdh_reg_write(bus->sdh, 0x18004408, 4, 0x0);
-
- /* Downloading the SR binary */
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00000000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00000000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00000000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00000000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00000000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00000000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00000000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0xc0002000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00000000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00000000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00000000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00000000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00000000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00000000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00000000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00000000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00000000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00000000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00000000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00000000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00000000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00000000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00000000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00000000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00000000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00000000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00000000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00000000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00000000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00000000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00000000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00000000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x80008000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x1051f080);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x80008000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x1050f080);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x80008000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x1050f080);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x80008000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x1050f080);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00000004);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x30a00000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00000604);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x30a00000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00001604);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x30a00000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00001404);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x30a08c80);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00010001);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x14a00000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00011404);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x30a00000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00002000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x04a00000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00002000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0xf8000000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00002000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x04a00000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00002000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0xf8000000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00011604);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x30a00000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00010604);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x30a00000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00010004);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x30a00000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00010000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x14a00000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00000004);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x30a00000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00010001);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x14a00000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00010004);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x30a00000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00010000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x30a00000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00010000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x14a00000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00000000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x30a00000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00000008);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x04a00000);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0x00000008);
- bcmsdh_reg_write(bus->sdh, 0x1800440c, 4, 0xfc000000);
- /* SR Binary Download complete */
-
- /* Allowing clock from SR engine to SR memory */
- bcmsdh_reg_write(bus->sdh, 0x18004400, 4, 0xf92f1);
-
- /* Turning ON SR Engine to initiate backplane reset Repeated ?? Maharana */
- bcmsdh_reg_write(bus->sdh, 0x18000650, 4, 0x3);
- bcmsdh_reg_write(bus->sdh, 0x18000654, 4, 0x0);
- bcmsdh_reg_write(bus->sdh, 0x18000650, 4, 0x3);
- bcmsdh_reg_write(bus->sdh, 0x18000654, 4, 0x2);
- bcmsdh_reg_write(bus->sdh, 0x18000650, 4, 0x3);
- bcmsdh_reg_write(bus->sdh, 0x18000654, 4, 0x3);
- bcmsdh_reg_write(bus->sdh, 0x18000650, 4, 0x3);
- bcmsdh_reg_write(bus->sdh, 0x18000654, 4, 0x37);
- bcmsdh_reg_write(bus->sdh, 0x18000650, 4, 0x3);
- temp = bcmsdh_reg_read(bus->sdh, 0x18000654, 4);
- DHD_INFO(("0x18000654 = %x\n", temp));
- bcmsdh_reg_write(bus->sdh, 0x18000654, 4, 0x800037);
- OSL_DELAY(100000);
- /* Rolling back the original values for clock stretch and PMU timers */
- bcmsdh_reg_write(bus->sdh, 0x18000644, 4, 0x0);
- bcmsdh_reg_write(bus->sdh, 0x18000630, 4, 0xC800C8);
- /* Removing ALP clock request in SDIOD clock control status register */
- bcmsdh_reg_write(bus->sdh, 0x180021e0, 4, 0x40);
- OSL_DELAY(10000);
- return TRUE;
-}
-
-static int dhdsdio_sdio_hang_war(struct dhd_bus *bus)
-{
- uint32 temp = 0, temp2 = 0, counter = 0, BT_pwr_up = 0, BT_ready = 0;
- /* Removing reset of D11 Core */
- bcmsdh_reg_write(bus->sdh, 0x18101408, 4, 0x3);
- bcmsdh_reg_write(bus->sdh, 0x18101800, 4, 0x0);
- bcmsdh_reg_write(bus->sdh, 0x18101408, 4, 0x1);
- /* Reading CLB XTAL BT cntrl register */
- bcmsdh_reg_write(bus->sdh, 0x180013D8, 2, 0xD1);
- bcmsdh_reg_write(bus->sdh, 0x180013DA, 2, 0x12);
- bcmsdh_reg_write(bus->sdh, 0x180013D8, 2, 0x2D0);
- /* Read if BT is powered up */
- temp = bcmsdh_reg_read(bus->sdh, 0x180013DA, 2);
- /* Read BT_ready from WLAN wireless register */
- temp2 = bcmsdh_reg_read(bus->sdh, 0x1800002C, 4);
- /*
- Check if the BT is powered up and ready. The duration between BT being powered up
- and BT becoming ready is the problematic window for WLAN. If we move ahead at this
- time then we may encounter a corrupted backplane later. So we wait for BT to be ready
- and then proceed after checking the health of the backplane. If the backplane shows
- indications of failure then we have to do a full reset of the backplane using SR engine
- and then proceed.
- */
- (temp & 0xF0) ? (BT_pwr_up = 1):(BT_pwr_up = 0);
- (temp2 & (1<<17)) ? (BT_ready = 1):(BT_ready = 0);
- DHD_ERROR(("WARNING: Checking if BT is ready BT_pwr_up = %x"
- "BT_ready = %x \n", BT_pwr_up, BT_ready));
- while (BT_pwr_up && !BT_ready)
- {
- OSL_DELAY(1000);
- bcmsdh_reg_write(bus->sdh, 0x180013D8, 2, 0x2D0);
- temp = bcmsdh_reg_read(bus->sdh, 0x180013DA, 2);
- temp2 = bcmsdh_reg_read(bus->sdh, 0x1800002C, 4);
- (temp & 0xF0) ? (BT_pwr_up = 1):(BT_pwr_up = 0);
- (temp2 & (1<<17)) ? (BT_ready = 1):(BT_ready = 0);
- counter++;
- if (counter == 5000)
- {
- DHD_ERROR(("WARNING: Going ahead after 5 secs with"
- "risk of failure because BT ready is not yet set\n"));
- break;
- }
- }
- DHD_ERROR(("\nWARNING: WL Proceeding BT_pwr_up = %x BT_ready = %x"
- "\n", BT_pwr_up, BT_ready));
- counter = 0;
- OSL_DELAY(10000);
- /*
- Get the information of who accessed the crucial backplane entities
- by reading read and write access registers
- */
- DHD_TRACE(("%d: Read Value @ 0x18104808 = %x."
- "\n", __LINE__, bcmsdh_reg_read(bus->sdh, 0x18104808, 4)));
- DHD_TRACE(("%d: Read Value @ 0x1810480C = %x."
- "\n", __LINE__, bcmsdh_reg_read(bus->sdh, 0x1810480C, 4)));
- DHD_TRACE(("%d: Read Value @ 0x18106808 = %x."
- "\n", __LINE__, bcmsdh_reg_read(bus->sdh, 0x18106808, 4)));
- DHD_TRACE(("%d: Read Value @ 0x1810680C = %x."
- "\n", __LINE__, bcmsdh_reg_read(bus->sdh, 0x1810680C, 4)));
- DHD_TRACE(("%d: Read Value @ 0x18107808 = %x."
- "\n", __LINE__, bcmsdh_reg_read(bus->sdh, 0x18107808, 4)));
- DHD_TRACE(("%d: Read Value @ 0x1810780C = %x."
- "\n", __LINE__, bcmsdh_reg_read(bus->sdh, 0x1810780C, 4)));
- DHD_TRACE(("%d: Read Value @ 0x18108808 = %x."
- "\n", __LINE__, bcmsdh_reg_read(bus->sdh, 0x18108808, 4)));
- DHD_TRACE(("%d: Read Value @ 0x1810880C = %x."
- "\n", __LINE__, bcmsdh_reg_read(bus->sdh, 0x1810880C, 4)));
- DHD_TRACE(("%d: Read Value @ 0x18109808 = %x."
- "\n", __LINE__, bcmsdh_reg_read(bus->sdh, 0x18109808, 4)));
- DHD_TRACE(("%d: Read Value @ 0x1810980C = %x."
- "\n", __LINE__, bcmsdh_reg_read(bus->sdh, 0x1810980C, 4)));
- DHD_TRACE(("%d: Read Value @ 0x1810C808 = %x."
- "\n", __LINE__, bcmsdh_reg_read(bus->sdh, 0x1810c808, 4)));
- DHD_TRACE(("%d: Read Value @ 0x1810C80C = %x."
- "\n", __LINE__, bcmsdh_reg_read(bus->sdh, 0x1810c80C, 4)));
- counter = 0;
- while ((bcmsdh_reg_read(bus->sdh, 0x18104808, 4) == 5) ||
- (bcmsdh_reg_read(bus->sdh, 0x1810480C, 4) == 5) ||
- (bcmsdh_reg_read(bus->sdh, 0x18106808, 4) == 5) ||
- (bcmsdh_reg_read(bus->sdh, 0x1810680C, 4) == 5) ||
- (bcmsdh_reg_read(bus->sdh, 0x1810780C, 4) == 5) ||
- (bcmsdh_reg_read(bus->sdh, 0x1810780C, 4) == 5) ||
- (bcmsdh_reg_read(bus->sdh, 0x1810880C, 4) == 5) ||
- (bcmsdh_reg_read(bus->sdh, 0x1810880C, 4) == 5) ||
- (bcmsdh_reg_read(bus->sdh, 0x1810980C, 4) == 5) ||
- (bcmsdh_reg_read(bus->sdh, 0x1810980C, 4) == 5) ||
- (bcmsdh_reg_read(bus->sdh, 0x1810C80C, 4) == 5) ||
- (bcmsdh_reg_read(bus->sdh, 0x1810C80C, 4) == 5))
- {
- if (++counter > 10)
- {
- DHD_ERROR(("Unable to recover the backkplane corruption"
- "..Tried %d times.. Exiting\n", counter));
- break;
- }
- OSL_DELAY(10000);
- dhd_sdio_backplane_reset(bus);
- /*
- Get the information of who accessed the crucial backplane
- entities by reading read and write access registers
- */
- DHD_ERROR(("%d: Read Value @ 0x18104808 = %x."
- "\n", __LINE__, bcmsdh_reg_read(bus->sdh, 0x18104808, 4)));
- DHD_ERROR(("%d: Read Value @ 0x1810480C = %x."
- "\n", __LINE__, bcmsdh_reg_read(bus->sdh, 0x1810480C, 4)));
- DHD_ERROR(("%d: Read Value @ 0x18106808 = %x."
- "\n", __LINE__, bcmsdh_reg_read(bus->sdh, 0x18106808, 4)));
- DHD_ERROR(("%d: Read Value @ 0x1810680C = %x."
- "\n", __LINE__, bcmsdh_reg_read(bus->sdh, 0x1810680C, 4)));
- DHD_ERROR(("%d: Read Value @ 0x18107808 = %x."
- "\n", __LINE__, bcmsdh_reg_read(bus->sdh, 0x18107808, 4)));
- DHD_ERROR(("%d: Read Value @ 0x1810780C = %x."
- "\n", __LINE__, bcmsdh_reg_read(bus->sdh, 0x1810780C, 4)));
- DHD_ERROR(("%d: Read Value @ 0x18108808 = %x."
- "\n", __LINE__, bcmsdh_reg_read(bus->sdh, 0x18108808, 4)));
- DHD_ERROR(("%d: Read Value @ 0x1810880C = %x."
- "\n", __LINE__, bcmsdh_reg_read(bus->sdh, 0x1810880C, 4)));
- DHD_ERROR(("%d: Read Value @ 0x18109808 = %x."
- "\n", __LINE__, bcmsdh_reg_read(bus->sdh, 0x18109808, 4)));
- DHD_ERROR(("%d: Read Value @ 0x1810980C = %x."
- "\n", __LINE__, bcmsdh_reg_read(bus->sdh, 0x1810980C, 4)));
- DHD_ERROR(("%d: Read Value @ 0x1810C808 = %x."
- "\n", __LINE__, bcmsdh_reg_read(bus->sdh, 0x1810c808, 4)));
- DHD_ERROR(("%d: Read Value @ 0x1810C80C = %x."
- "\n", __LINE__, bcmsdh_reg_read(bus->sdh, 0x1810c80C, 4)));
- }
- /* Set the WL ready to indicate BT that we are done with backplane reset */
- DHD_ERROR(("Setting up AXI_OK\n"));
- bcmsdh_reg_write(bus->sdh, 0x18000658, 4, 0x3);
- temp = bcmsdh_reg_read(bus->sdh, 0x1800065c, 4);
- temp |= 0x80000000;
- bcmsdh_reg_write(bus->sdh, 0x1800065c, 4, temp);
- return TRUE;
-}
-#endif /* REGON_BP_HANG_FIX */
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;
-#endif /* !BCMSPI */
bus->alp_only = TRUE;
bus->sih = NULL;
DHD_ERROR(("%s: FAILED to return to SI_ENUM_BASE\n", __FUNCTION__));
}
-#ifdef DHD_DEBUG
- DHD_ERROR(("F1 signature read @0x18000000=0x%4x\n",
- bcmsdh_reg_read(bus->sdh, SI_ENUM_BASE, 4)));
-
-#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 */
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);
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))) {
goto fail;
}
-#ifdef REGON_BP_HANG_FIX
- /* WAR - for 43241 B0-B1-B2. B3 onwards do not need this */
- if (((uint16)bus->sih->chip == BCM4324_CHIP_ID) && (bus->sih->chiprev < 3))
- dhdsdio_sdio_hang_war(bus);
-#endif /* REGON_BP_HANG_FIX */
+
+#ifdef DHD_DEBUG
+ DHD_ERROR(("F1 signature OK, socitype:0x%x chip:0x%4x rev:0x%x pkg:0x%x\n",
+ bus->sih->socitype, bus->sih->chip, bus->sih->chiprev,
+ bus->sih->chippkg));
+#endif /* DHD_DEBUG */
+
bcmsdh_chipinfo(sdh, bus->sih->chip, bus->sih->chiprev);
/* also populate base address */
switch ((uint16)bus->sih->chip) {
case BCM4335_CHIP_ID:
+ case BCM4339_CHIP_ID:
bus->dongle_ram_base = CR4_4335_RAM_BASE;
break;
case BCM4350_CHIP_ID:
}
}
bus->ramsize = bus->orig_ramsize;
- if (dhd_dongle_memsize)
- dhd_dongle_setmemsize(bus, dhd_dongle_memsize);
+ if (dhd_dongle_ramsize)
+ dhd_dongle_setramsize(bus, dhd_dongle_ramsize);
DHD_ERROR(("DHD: dongle ram size is set to %d(orig %d) at 0x%x\n",
bus->ramsize, bus->orig_ramsize, bus->dongle_ram_base));
/* 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) &&
val |= CC_XMTDATAAVAIL_CTRL;
W_REG(osh, &bus->regs->corecontrol, val);
}
-#endif /* BCMSPI */
pktq_init(&bus->txq, (PRIOMASK + 1), QLEN);
return TRUE;
fail:
- if (bus->sih != NULL)
+ if (bus->sih != NULL) {
si_detach(bus->sih);
+ bus->sih = NULL;
+ }
return FALSE;
}
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;
DHD_INFO(("%s: Initial value for %s is %d\n",
__FUNCTION__, "sd_blocksize", bus->blocksize));
- if (bus->sih->chip == BCM4335_CHIP_ID)
+ if ((bus->sih->chip == BCM4335_CHIP_ID) ||
+ (bus->sih->chip == BCM4339_CHIP_ID))
dhd_overflow_war(bus);
}
bus->roundup = MIN(max_roundup, bus->blocksize);
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;
}
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;
DHD_TRACE(("%s: Enter\n", __FUNCTION__));
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25))
- if (mutex_is_locked(&_dhd_sdio_mutex_lock_) == 0) {
- DHD_ERROR(("%s : no mutex held. set lock\n", __FUNCTION__));
- }
- else {
- DHD_ERROR(("%s : mutex is locked!. wait for unlocking\n", __FUNCTION__));
- }
- mutex_lock(&_dhd_sdio_mutex_lock_);
-#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) */
if (bus) {
dhdsdio_release(bus, bus->dhd->osh);
}
-#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__));
return bcmerror;
}
+#ifdef NV_BCM943341_WBFGN_MULTI_MODULE_SUPPORT
+enum {
+ BCM943341_INVALID = 0,
+ BCM943341_WBFGN_2,
+ BCM943341_WBFGN_3,
+ BCM943341_WBFGN_4,
+};
+
+static uint16
+dhdsdio_read_boardrev_cis(struct dhd_bus *bus)
+{
+ osl_t *osh;
+ void *sdh;
+ uint8 *cis_fn0 = NULL;
+ uint16 boardrev = 0;
+ int idx = 0;
+ int err = 0;
+
+ osh = bus->dhd->osh;
+ sdh = bus->sdh;
+
+ DHD_TRACE(("%s: Enter\n", __func__));
+
+ cis_fn0 = MALLOC(osh, SBSDIO_CIS_SIZE_LIMIT);
+ if (!cis_fn0) {
+ DHD_ERROR(("%s: cis_fn0 alloc failed\n", __func__));
+ goto cleanup;
+ }
+
+ bzero(cis_fn0, SBSDIO_CIS_SIZE_LIMIT);
+
+ err = bcmsdh_cis_read(sdh, 0, cis_fn0, SBSDIO_CIS_SIZE_LIMIT);
+
+ if (err) {
+ DHD_ERROR(("%s: : cis_fn0 read failed, err: %d\n", __func__,
+ err));
+ goto cleanup;
+ }
+
+ idx = 0;
+ while (idx < SBSDIO_CIS_SIZE_LIMIT) {
+ uint8 tuple = cis_fn0[idx++];
+
+ /* read tuple type */
+ if (tuple == 0x0) {
+ /* CISTPL_NULL */
+ continue;
+ } else if (tuple == 0xff) {
+ /* CISTPL_END */
+ DHD_INFO(("CISTPL_END\n"));
+ break;
+ } else {
+ int offset = cis_fn0[idx++];
+ uint8 type = cis_fn0[idx];
+
+ if (tuple == 0x80) {
+ /* Vendor Unique Tuple */
+ if (type == 0x00) {
+ /* sromrev */
+ DHD_INFO(("sromrev: 0x%02x\n",
+ cis_fn0[idx+1]));
+ } else if (type == 0x02) {
+ /* boardrev */
+ boardrev = *((uint16 *)&cis_fn0[idx+1]);
+ DHD_INFO(("boardrev: 0x%04x\n",
+ boardrev));
+ } else if (type == 0x1b) {
+ /* boardtype */
+ DHD_INFO(("boardtype: 0x%04x\n",
+ *((uint16 *)&cis_fn0[idx+1])));
+ } else if (type == 0x19) {
+ /* mac address */
+ DHD_INFO(("mac address\n"));
+ } else {
+ DHD_INFO(("Unk Unique Tuple:0x%02x\n",
+ type));
+ }
+ }
+ idx += offset;
+ continue;
+ }
+ }
+
+cleanup:
+
+ if (cis_fn0)
+ MFREE(osh, cis_fn0, SBSDIO_CIS_SIZE_LIMIT);
+
+ return boardrev;
+}
+
+static int
+dhdsdio_boardrev_bcm943341wbfgn(struct dhd_bus *bus)
+{
+ int boardrev;
+
+ DHD_TRACE(("%s: Enter\n", __func__));
+
+ switch (dhd_bus_chiprev_id(bus->dhd)) {
+ case 0x0: /* a0/a1 */
+ if (dhdsdio_read_boardrev_cis(bus) == 0x1303) {
+ DHD_ERROR(("%s: BCM943341_WBFGN_3\n", __func__));
+ boardrev = BCM943341_WBFGN_3;
+ } else {
+ DHD_ERROR(("%s: BCM943341_WBFGN_2\n", __func__));
+ boardrev = BCM943341_WBFGN_2;
+ }
+ break;
+ case 0x2: /* b0 */
+ DHD_ERROR(("%s: BCM943341_WBFGN_4\n", __func__));
+ boardrev = BCM943341_WBFGN_4;
+ break;
+ default:
+ DHD_ERROR(("%s: Unknown board\n", __func__));
+ boardrev = BCM943341_INVALID;
+ break;
+ }
+
+ return boardrev;
+}
+#endif /* NV_BCM943341_WBFGN_MULTI_MODULE_SUPPORT */
+
static int
_dhdsdio_download_firmware(struct dhd_bus *bus)
{
int bcmerror = -1;
+ char *p;
bool embed = FALSE; /* download embedded firmware */
bool dlok = FALSE; /* download firmware succeeded */
#endif
}
+#ifdef NV_BCM943341_WBFGN_MULTI_MODULE_SUPPORT
+ if (dhd_bus_chip_id(bus->dhd) == BCM43341_CHIP_ID) {
+ int boardrev = dhdsdio_boardrev_bcm943341wbfgn(bus);
+ char *ptr = strstr(bus->nv_path, "nvram");
+ DHD_ERROR(("nvram path: %s\n", ptr));
+ if (ptr) {
+ switch (boardrev) {
+ case BCM943341_WBFGN_2:
+ strcpy(ptr, "nvram.txt");
+ break;
+ case BCM943341_WBFGN_3:
+ strcpy(ptr, "nvram_43341_rev3.txt");
+ break;
+ case BCM943341_WBFGN_4:
+ strcpy(ptr, "nvram_43341_rev4.txt");
+ break;
+ default:
+ DHD_ERROR(("%s:Unknown bcm943341_wbfgn board\n",
+ __func__));
+ break;
+ }
+ } else {
+ DHD_ERROR(("%s: Invalid nv_path for bcm943341\n",
+ __func__));
+ goto err;
+ }
+
+ if (strstr(bus->fw_path, "fw_bcmdhd_apsta")) { /* HOTSPOT mode */
+ char *ptr_fw = strstr(bus->fw_path, "fw_bcmdhd_apsta");
+ if (boardrev == BCM943341_WBFGN_2
+ || boardrev == BCM943341_WBFGN_3) {
+ strcpy(ptr_fw, "fw_bcmdhd_apsta_a0.bin");
+ }
+ } else if (strstr(bus->fw_path, "fw_bcmdhd")) { /* STATION mode */
+ char *ptr_fw = strstr(bus->fw_path, "fw_bcmdhd");
+ if (boardrev == BCM943341_WBFGN_2
+ || boardrev == BCM943341_WBFGN_3) {
+ strcpy(ptr_fw, "fw_bcmdhd_a0.bin");
+ }
+ } else {
+ DHD_ERROR(("%s: Invalid fw_path for bcm943341: %s\n",
+ __func__, bus->fw_path));
+ goto err;
+ }
+
+ DHD_ERROR(("%s: Modified nv_path for bcm943341_wbfgn_x: %s\n",
+ __func__, bus->nv_path));
+ DHD_ERROR(("%s: Modified fw_path for bcm943341_wbfgn_x: %s\n",
+ __func__, bus->fw_path));
+ }
+#endif /* NV_BCM943341_WBFGN_MULTI_MODULE_SUPPORT */
+
/* Keep arm in reset */
if (dhdsdio_download_state(bus, TRUE)) {
DHD_ERROR(("%s: error placing ARM core in reset\n", __FUNCTION__));
/* Stop the bus, disable F2 */
dhd_bus_stop(bus, FALSE);
-#if defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID)
+#if defined(OOB_INTR_ONLY)
/* Clean up any pending IRQ */
bcmsdh_set_irq(FALSE);
-#endif /* defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID) */
+#endif
/* Clean tx/rx buffer pointers, detach from the dongle */
dhdsdio_release_dongle(bus, bus->dhd->osh, TRUE, TRUE);
/* 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) || defined(BCMSPI_ANDROID)
+#if defined(OOB_INTR_ONLY)
bcmsdh_set_irq(TRUE);
-#ifndef BCMSPI_ANDROID
dhd_enable_oob_intr(bus, TRUE);
-#endif /* !BCMSPI_ANDROID */
-#endif /* defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID) */
+#endif
bus->dhd->dongle_reset = FALSE;
bus->dhd->up = TRUE;
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)
{
bus = dhdp->bus;
return dhdsdio_membytes(bus, set, address, data, size);
}
-#if defined(CUSTOMER_HW4) && defined(SUPPORT_MULTIPLE_REVISION)
-static int
-concate_revision_bcm4334(dhd_bus_t *bus, char *path, int path_len)
+
+int
+dhd_enableOOB(dhd_pub_t *dhd, bool sleep)
{
-#define REV_ID_ADDR 0x1E008F90
-#define BCM4334_B1_UNIQUE 0x30312E36
+ dhd_bus_t *bus = dhd->bus;
+ sdpcmd_regs_t *regs = bus->regs;
+ uint retries = 0;
+
+ if (sleep) {
+ dhdsdio_clkctl(bus, CLK_AVAIL, FALSE);
+ /* Tell device to start using OOB wakeup */
+ W_SDREG(SMB_USE_OOB, ®s->tosbmailbox, retries);
+ if (retries > retry_limit) {
+ DHD_ERROR(("CANNOT SIGNAL CHIP, WILL NOT WAKE UP!!\n"));
+ return BCME_BUSY;
+ }
+ /* Turn off our contribution to the HT clock request */
+ dhdsdio_clkctl(bus, CLK_SDONLY, FALSE);
+ } else {
+ /* Make sure the controller has the bus up */
+ dhdsdio_clkctl(bus, CLK_AVAIL, FALSE);
- uint chipver;
- uint32 unique_id;
- uint8 data[4];
- char chipver_tag[4] = "_b?";
+ /* Send misc interrupt to indicate OOB not needed */
+ W_SDREG(0, ®s->tosbmailboxdata, retries);
+ if (retries <= retry_limit)
+ W_SDREG(SMB_DEV_INT, ®s->tosbmailbox, retries);
- 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"));
- strcpy(chipver_tag, "_b0");
- } else if (chipver == 2) {
- DHD_ERROR(("----- CHIP bcm4334_B1 -----\n"));
- strcpy(chipver_tag, "_b1");
- } else if (chipver == 3) {
- DHD_ERROR(("----- CHIP bcm4334_B2 -----\n"));
- strcpy(chipver_tag, "_b2");
- }
- else {
- DHD_ERROR(("----- Invalid chip version -----\n"));
- return -1;
+ if (retries > retry_limit)
+ DHD_ERROR(("CANNOT SIGNAL CHIP TO CLEAR OOB!!\n"));
+
+ /* Make sure we have SD bus access */
+ dhdsdio_clkctl(bus, CLK_SDONLY, FALSE);
}
- strcat(path, chipver_tag);
-#undef REV_ID_ADDR
-#undef BCM4334_B1_UNIQUE
- return 0;
+ return BCME_OK;
}
-static int
-concate_revision_bcm4335
- (dhd_bus_t *bus, char *fw_path, int fw_path_len, char *nv_path, int nv_path_len)
+void
+dhd_bus_pktq_flush(dhd_pub_t *dhdp)
{
+ dhd_bus_t *bus = dhdp->bus;
+ /* Clear the data packet queues */
+ pktq_flush(dhdp->osh, &bus->txq, TRUE, NULL, 0);
+}
- uint chipver;
- char chipver_tag[4] = {0, };
+int
+dhd_sr_config(dhd_pub_t *dhd, bool on)
+{
+ dhd_bus_t *bus = dhd->bus;
- DHD_TRACE(("%s: BCM4335 Multiple Revision Check\n", __FUNCTION__));
- if (bus->sih->chip != BCM4335_CHIP_ID) {
- DHD_ERROR(("%s:Chip is not BCM4335\n", __FUNCTION__));
+ if (!bus->_srenab)
return -1;
- }
- chipver = bus->sih->chiprev;
- DHD_ERROR(("CHIP VER = [0x%x]\n", chipver));
- if (chipver == 0x0) {
- DHD_ERROR(("----- CHIP bcm4335_A0 -----\n"));
- strcpy(chipver_tag, "_a0");
- } else if (chipver == 0x1) {
- DHD_ERROR(("----- CHIP bcm4335_B0 -----\n"));
- }
- strcat(fw_path, chipver_tag);
- strcat(nv_path, chipver_tag);
-
- return 0;
+ return dhdsdio_clk_devsleep_iovar(bus, on);
}
-int
-concate_revision(dhd_bus_t *bus, char *fw_path, int fw_path_len, char *nv_path, int nv_path_len)
+
+uint16
+dhd_get_chipid(dhd_pub_t *dhd)
{
- if (!bus || !bus->sih) {
- DHD_ERROR(("%s:Bus is Invalid\n", __FUNCTION__));
- return -1;
- }
- switch (bus->sih->chip) {
- case BCM4334_CHIP_ID:
- return concate_revision_bcm4334(bus, fw_path, fw_path_len);
- case BCM4335_CHIP_ID:
- return concate_revision_bcm4335(bus, fw_path, fw_path_len,
- nv_path, nv_path_len);
- }
+ dhd_bus_t *bus = dhd->bus;
- DHD_ERROR(("REVISION SPECIFIC feature is not required\n"));
- return 0;
+ if (bus && bus->sih)
+ return (uint16)bus->sih->chip;
+ else
+ return 0;
}
-#endif /* CUSTOMER_HW4 && SUPPORT_MULTIPLE_REVISION */
/*
- * DHD Protocol Module for CDC and BDC.
+ * DHD PROP_TXSTATUS Module.
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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 374530 2012-12-13 14:38:23Z $
+ * $Id: dhd_wlfc.c 402043 2013-05-14 12:11:22Z $
*
- * 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
- * for dongle offload.)
*/
#include <typedefs.h>
#include <osl.h>
#include <bcmutils.h>
-#include <bcmcdc.h>
#include <bcmendian.h>
#include <dngl_stats.h>
#include <dhd.h>
-#include <dhd_proto.h>
+
#include <dhd_bus.h>
#include <dhd_dbg.h>
-
#ifdef PROP_TXSTATUS
#include <wlfc_proto.h>
#include <dhd_wlfc.h>
#endif
-#define RETRIES 2 /* # of retries to retrieve matching ioctl response */
-#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.
- */
-#define ROUND_UP_MARGIN 2048 /* Biggest SDIO block size possible for
- * round off at the end of buffer
- */
+
#define BUS_RETRIES 1 /* # of retries before aborting a bus tx operation */
} dhd_wlfc_commit_info_t;
#endif /* PROP_TXSTATUS */
-#if defined(CUSTOMER_HW4) && defined(USE_DYNAMIC_F2_BLKSIZE)
-extern uint sd_f2_blocksize;
-extern int dhdsdio_func_blocksize(dhd_pub_t *dhd, int function_num, int block_size);
-#endif /* CUSTOMER_HW4 && USE_DYNAMIC_F2_BLKSIZE */
-
-typedef struct dhd_prot {
- uint16 reqid;
- uint8 pending;
- uint32 lastcmd;
- uint8 bus_header[BUS_HEADER_LEN];
- cdc_ioctl_t msg;
- unsigned char buf[WLC_IOCTL_MAXLEN + ROUND_UP_MARGIN];
-} dhd_prot_t;
-
-
-static int
-dhdcdc_msg(dhd_pub_t *dhd)
-{
- int err = 0;
- dhd_prot_t *prot = dhd->prot;
- int len = ltoh32(prot->msg.len) + sizeof(cdc_ioctl_t);
-
- DHD_TRACE(("%s: Enter\n", __FUNCTION__));
-
- DHD_OS_WAKE_LOCK(dhd);
-
- /* NOTE : cdc->msg.len holds the desired length of the buffer to be
- * returned. Only up to CDC_MAX_MSG_SIZE of this buffer area
- * is actually sent to the dongle
- */
- if (len > CDC_MAX_MSG_SIZE)
- len = CDC_MAX_MSG_SIZE;
-
- /* Send request */
- err = dhd_bus_txctl(dhd->bus, (uchar*)&prot->msg, len);
-
- DHD_OS_WAKE_UNLOCK(dhd);
- return err;
-}
-
-static int
-dhdcdc_cmplt(dhd_pub_t *dhd, uint32 id, uint32 len)
-{
- int ret;
- int cdc_len = len + sizeof(cdc_ioctl_t);
- dhd_prot_t *prot = dhd->prot;
-
- DHD_TRACE(("%s: Enter\n", __FUNCTION__));
-
-#if defined(CUSTOMER_HW4)
- DHD_OS_WAKE_LOCK(dhd);
-#endif /* OEM_ANDROID && CUSTOMER_HW4 */
-
- 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);
-
-#if defined(CUSTOMER_HW4)
- DHD_OS_WAKE_UNLOCK(dhd);
-#endif /* OEM_ANDROID && CUSTOMER_HW4 */
-
- return ret;
-}
-
-static int
-dhdcdc_query_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len, uint8 action)
-{
- dhd_prot_t *prot = dhd->prot;
- cdc_ioctl_t *msg = &prot->msg;
- void *info;
- int ret = 0, retries = 0;
- uint32 id, flags = 0;
-
- DHD_TRACE(("%s: Enter\n", __FUNCTION__));
- DHD_CTL(("%s: cmd %d len %d\n", __FUNCTION__, cmd, len));
-
-
- /* Respond "bcmerror" and "bcmerrorstr" with local cache */
- if (cmd == WLC_GET_VAR && buf)
- {
- if (!strcmp((char *)buf, "bcmerrorstr"))
- {
- strncpy((char *)buf, bcmerrorstr(dhd->dongle_error), BCME_STRLEN);
- goto done;
- }
- else if (!strcmp((char *)buf, "bcmerror"))
- {
- *(int *)buf = dhd->dongle_error;
- goto done;
- }
- }
-
- 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);
- CDC_SET_IF_IDX(msg, ifidx);
- /* add additional action bits */
- action &= WL_IOCTL_ACTION_MASK;
- msg->flags |= (action << CDCF_IOC_ACTION_SHIFT);
- msg->flags = htol32(msg->flags);
-
- if (buf)
- memcpy(prot->buf, buf, len);
-
- if ((ret = dhdcdc_msg(dhd)) < 0) {
- if (!dhd->hang_was_sent)
- DHD_ERROR(("dhdcdc_query_ioctl: dhdcdc_msg failed w/status %d\n", ret));
- goto done;
- }
-
-retry:
- /* wait for interrupt and get first fragment */
- if ((ret = dhdcdc_cmplt(dhd, prot->reqid, len)) < 0)
- goto done;
-
- flags = ltoh32(msg->flags);
- id = (flags & CDCF_IOC_ID_MASK) >> CDCF_IOC_ID_SHIFT;
-
- if ((id < prot->reqid) && (++retries < RETRIES))
- goto retry;
- if (id != prot->reqid) {
- DHD_ERROR(("%s: %s: unexpected request id %d (expected %d)\n",
- dhd_ifname(dhd, ifidx), __FUNCTION__, id, prot->reqid));
- ret = -EINVAL;
- goto done;
- }
-
- /* Check info buffer */
- info = (void*)&msg[1];
-
- /* Copy info buffer */
- if (buf)
- {
- if (ret < (int)len)
- len = ret;
- memcpy(buf, info, len);
- }
-
- /* Check the ERROR flag */
- if (flags & CDCF_IOC_ERROR)
- {
- ret = ltoh32(msg->status);
- /* Cache error from dongle */
- dhd->dongle_error = ret;
- }
-
-done:
- return ret;
-}
-
-#if defined(CUSTOMER_HW4) && defined(CONFIG_CONTROL_PM)
-extern bool g_pm_control;
-#endif /* CUSTOMER_HW4 & CONFIG_CONTROL_PM */
-
-static int
-dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len, uint8 action)
-{
- dhd_prot_t *prot = dhd->prot;
- cdc_ioctl_t *msg = &prot->msg;
- int ret = 0;
- uint32 flags, id;
-
- DHD_TRACE(("%s: Enter\n", __FUNCTION__));
- DHD_CTL(("%s: cmd %d len %d\n", __FUNCTION__, cmd, len));
-
- if (dhd->busstate == DHD_BUS_DOWN) {
- DHD_ERROR(("%s : bus is down. we have nothing to do\n", __FUNCTION__));
- return -EIO;
- }
-
- /* don't talk to the dongle if fw is about to be reloaded */
- if (dhd->hang_was_sent) {
- DHD_ERROR(("%s: HANG was sent up earlier. Not talking to the chip\n",
- __FUNCTION__));
- return -EIO;
- }
-
-#if defined(CUSTOMER_HW4) && defined(CONFIG_CONTROL_PM)
- if ((g_pm_control == TRUE) && (cmd == WLC_SET_PM))
- {
- DHD_ERROR(("SET PM ignored!!!!!!!!!!!!!!!!!!!!!!\n"));
- goto done;
- }
-#endif /* CUSTOMER_HW4 && CONFIG_CONTROL_PM */
-
- memset(msg, 0, sizeof(cdc_ioctl_t));
-
- msg->cmd = htol32(cmd);
- msg->len = htol32(len);
- msg->flags = (++prot->reqid << CDCF_IOC_ID_SHIFT);
- CDC_SET_IF_IDX(msg, ifidx);
- /* add additional action bits */
- action &= WL_IOCTL_ACTION_MASK;
- msg->flags |= (action << CDCF_IOC_ACTION_SHIFT) | CDCF_IOC_SET;
- msg->flags = htol32(msg->flags);
- if (buf)
- memcpy(prot->buf, buf, len);
-
- if ((ret = dhdcdc_msg(dhd)) < 0) {
- DHD_ERROR(("%s: dhdcdc_msg failed w/status %d\n", __FUNCTION__, ret));
- goto done;
- }
-
- if ((ret = dhdcdc_cmplt(dhd, prot->reqid, len)) < 0)
- goto done;
-
- flags = ltoh32(msg->flags);
- id = (flags & CDCF_IOC_ID_MASK) >> CDCF_IOC_ID_SHIFT;
-
- if (id != prot->reqid) {
- DHD_ERROR(("%s: %s: unexpected request id %d (expected %d)\n",
- dhd_ifname(dhd, ifidx), __FUNCTION__, id, prot->reqid));
- ret = -EINVAL;
- goto done;
- }
-
- /* Check the ERROR flag */
- if (flags & CDCF_IOC_ERROR)
- {
- ret = ltoh32(msg->status);
- /* Cache error from dongle */
- dhd->dongle_error = ret;
- }
-
-done:
- return ret;
-}
-
-
-int
-dhd_prot_ioctl(dhd_pub_t *dhd, int ifidx, wl_ioctl_t * ioc, void * buf, int len)
-{
- dhd_prot_t *prot = dhd->prot;
- int ret = -1;
- uint8 action;
-#if defined(NDIS630)
- bool acquired = FALSE;
-#endif
-
- if ((dhd->busstate == DHD_BUS_DOWN) || dhd->hang_was_sent) {
- DHD_ERROR(("%s : bus is down. we have nothing to do\n", __FUNCTION__));
- goto done;
- }
-#if defined(NDIS630)
- if (dhd_os_proto_block(dhd))
- {
- acquired = TRUE;
- }
- else
- {
- /* attempt to acquire protocol mutex timed out. */
- ret = -1;
- return ret;
- }
-#endif /* NDIS630 */
-
- DHD_TRACE(("%s: Enter\n", __FUNCTION__));
-
- ASSERT(len <= WLC_IOCTL_MAXLEN);
-
- if (len > WLC_IOCTL_MAXLEN)
- goto done;
-
- if (prot->pending == TRUE) {
- DHD_ERROR(("CDC packet is pending!!!! cmd=0x%x (%lu) lastcmd=0x%x (%lu)\n",
- ioc->cmd, (unsigned long)ioc->cmd, prot->lastcmd,
- (unsigned long)prot->lastcmd));
- if ((ioc->cmd == WLC_SET_VAR) || (ioc->cmd == WLC_GET_VAR)) {
- DHD_TRACE(("iovar cmd=%s\n", (char*)buf));
- }
- goto done;
- }
-
- prot->pending = TRUE;
- prot->lastcmd = ioc->cmd;
- action = ioc->set;
- if (action & WL_IOCTL_ACTION_SET)
- ret = dhdcdc_set_ioctl(dhd, ifidx, ioc->cmd, buf, len, action);
- else {
- ret = dhdcdc_query_ioctl(dhd, ifidx, ioc->cmd, buf, len, action);
- if (ret > 0)
- ioc->used = ret - sizeof(cdc_ioctl_t);
- }
-
- /* Too many programs assume ioctl() returns 0 on success */
- if (ret >= 0)
- ret = 0;
- else {
- cdc_ioctl_t *msg = &prot->msg;
- ioc->needed = ltoh32(msg->len); /* len == needed when set/query fails from dongle */
- }
-
- /* Intercept the wme_dp ioctl here */
- if ((!ret) && (ioc->cmd == WLC_SET_VAR) && (!strcmp(buf, "wme_dp"))) {
- int slen, val = 0;
-
- slen = strlen("wme_dp") + 1;
- if (len >= (int)(slen + sizeof(int)))
- bcopy(((char *)buf + slen), &val, sizeof(int));
- dhd->wme_dp = (uint8) ltoh32(val);
- }
-
- prot->pending = FALSE;
-
-done:
-#if defined(NDIS630)
- if (acquired)
- dhd_os_proto_unblock(dhd);
-#endif
- return ret;
-}
+#ifdef PROP_TXSTATUS
-int
-dhd_prot_iovar_op(dhd_pub_t *dhdp, const char *name,
- void *params, int plen, void *arg, int len, bool set)
-{
- return BCME_UNSUPPORTED;
-}
+#ifdef QMONITOR
+#define DHD_WLFC_QMON_COMPLETE(entry) dhd_qmon_txcomplete(&entry->qmon)
+#else
+#define DHD_WLFC_QMON_COMPLETE(entry)
+#endif /* QMONITOR */
-#ifdef PROP_TXSTATUS
void
dhd_wlfc_dump(dhd_pub_t *dhdp, struct bcmstrbuf *strbuf)
{
wlfc_mac_descriptor_t* table = ctx->destination_entries.nodes;
uint8 ifid = DHD_PKTTAG_IF(PKTTAG(p));
uint8* dstn = DHD_PKTTAG_DSTN(PKTTAG(p));
+ wlfc_mac_descriptor_t* entry = NULL;
+ int iftype = ctx->destination_entries.interfaces[ifid].iftype;
- 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)) &&
+ /* Multicast destination and P2P clients get the interface entry.
+ * STA gets the interface entry if there is no exact match. For
+ * example, TDLS destinations have their own entry.
+ */
+ if ((iftype == WLC_E_IF_ROLE_STA || ETHER_ISMULTI(dstn) ||
+ iftype == WLC_E_IF_ROLE_P2P_CLIENT) &&
(ctx->destination_entries.interfaces[ifid].occupied)) {
- return &ctx->destination_entries.interfaces[ifid];
+ entry = &ctx->destination_entries.interfaces[ifid];
}
+ if (entry != NULL && ETHER_ISMULTI(dstn))
+ return entry;
+
for (i = 0; i < WLFC_MAC_DESC_TABLE_SIZE; i++) {
if (table[i].occupied) {
if (table[i].interface_id == ifid) {
- if (!memcmp(table[i].ea, dstn, ETHER_ADDR_LEN))
- return &table[i];
+ if (!memcmp(table[i].ea, dstn, ETHER_ADDR_LEN)) {
+ entry = &table[i];
+ break;
+ }
}
}
}
- return &ctx->destination_entries.other;
+
+ return entry != NULL ? entry : &ctx->destination_entries.other;
}
static int
/* free the hanger slot */
dhd_wlfc_hanger_poppkt(ctx->hanger, hslot, &pktout, 1);
PKTFREE(ctx->osh, p, TRUE);
- rc = BCME_ERROR;
- return rc;
+ ctx->stats.rollback_failed++;
+ return BCME_ERROR;
}
if (pkt_type == eWLFC_PKTTYPE_DELAYED) {
static void
_dhd_wlfc_flow_control_check(athost_wl_status_info_t* ctx, struct pktq* pq, uint8 if_id)
{
+ dhd_pub_t *dhdp;
+
+ ASSERT(ctx);
+
+ dhdp = (dhd_pub_t *)ctx->dhdp;
+
+ if (dhdp && dhdp->skip_fc && dhdp->skip_fc())
+ return;
+
if ((pq->len <= WLFC_FLOWCONTROL_LOWATER) && (ctx->hostif_flow_state[if_id] == ON)) {
/* start traffic */
ctx->hostif_flow_state[if_id] = OFF;
ctx->host_ifidx = if_id;
ctx->toggle_host_if = 1;
}
+
return;
}
for (i = 0; i < total_entries; i++) {
entry = &table[(token_pos + i) % total_entries];
- if (entry->occupied) {
+ if (entry->occupied && !entry->deleting) {
if (!_dhd_wlfc_is_destination_closed(ctx, entry, prec)) {
p = pktq_mdeq(&entry->psq,
/* higher precedence will be picked up first,
NBITVAL((prec << 1)),
&pout);
*needs_hdr = 1;
- }
+ }
if (p != NULL) {
/* did the packet come from suppress sub-queue? */
return NULL;
}
+void *
+_dhd_wlfc_pktq_peek_tail(struct pktq *pq, int *prec_out)
+{
+ int prec;
+
+ ASSERT(pq);
+
+ if (pq->len == 0)
+ return NULL;
+
+ for (prec = 0; prec < pq->hi_prec; prec++)
+ /* only pick packets from dealyed-q */
+ if (((prec & 1) == 0) && pq->q[prec].head)
+ break;
+
+ if (prec_out)
+ *prec_out = prec;
+
+ return (pq->q[prec].tail);
+}
+
+bool
+_dhd_wlfc_prec_enq_with_drop(dhd_pub_t *dhdp, struct pktq *pq, void *pkt, int prec)
+{
+ void *p = NULL;
+ int eprec = -1; /* precedence to evict from */
+
+ ASSERT(dhdp && pq && pkt);
+ ASSERT(prec >= 0 && prec < pq->num_prec);
+
+ /* Fast case, precedence queue is not full and we are also not
+ * exceeding total queue length
+ */
+ if (!pktq_pfull(pq, prec) && !pktq_full(pq)) {
+ pktq_penq(pq, prec, pkt);
+ return TRUE;
+ }
+
+ /* Determine precedence from which to evict packet, if any */
+ if (pktq_pfull(pq, prec))
+ eprec = prec;
+ else if (pktq_full(pq)) {
+ p = _dhd_wlfc_pktq_peek_tail(pq, &eprec);
+ if (!p) {
+ WLFC_DBGMESG(("Error: %s():%d\n", __FUNCTION__, __LINE__));
+ return FALSE;
+ }
+ if ((eprec > prec) || (eprec < 0)) {
+ if (!pktq_pempty(pq, prec)) {
+ eprec = prec;
+ } else {
+ return FALSE;
+ }
+ }
+ }
+
+ /* Evict if needed */
+ if (eprec >= 0) {
+ /* Detect queueing to unconfigured precedence */
+ ASSERT(!pktq_pempty(pq, eprec));
+ /* Evict all fragmented frames */
+ dhd_prec_drop_pkts(dhdp->osh, pq, eprec);
+ }
+
+ /* Enqueue */
+ p = pktq_penq(pq, prec, pkt);
+ if (!p) {
+ WLFC_DBGMESG(("Error: %s():%d\n", __FUNCTION__, __LINE__));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
static int
_dhd_wlfc_enque_delayq(athost_wl_status_info_t* ctx, void* pktbuf, int prec)
{
- delayed packets go to sub_queue[2*prec + 0] to ensure
order of delivery.
*/
- if (WLFC_PKTQ_PENQ(&entry->psq, (prec << 1), pktbuf) == NULL) {
+ if (_dhd_wlfc_prec_enq_with_drop(ctx->dhdp, &entry->psq, pktbuf, (prec << 1))
+ == FALSE) {
WLFC_DBGMESG(("D"));
- /* dhd_txcomplete(ctx->dhdp, p, FALSE); */
+ /* dhd_txcomplete(ctx->dhdp, pktbuf, FALSE); */
PKTFREE(ctx->osh, pktbuf, TRUE);
ctx->stats.delayq_full_error++;
return BCME_ERROR;
}
+
+#ifdef QMONITOR
+ dhd_qmon_tx(&entry->qmon);
+#endif
/*
A packet has been pushed, update traffic availability bitmap,
if applicable
{
int rc = BCME_OK;
+#ifdef QMONITOR
+ dhd_qmon_reset(&entry->qmon);
+#endif
+
if (action == eWLFC_MAC_ENTRY_ACTION_ADD) {
entry->occupied = 1;
entry->state = WLFC_STATE_OPEN;
memcpy(&entry->ea[0], ea, ETHER_ADDR_LEN);
}
else if (action == eWLFC_MAC_ENTRY_ACTION_DEL) {
+ /* When the entry is deleted, the packets that are queued in the entry must be
+ cleanup. The cleanup action should be before the occupied is set as 0. The
+ flag deleting is set to avoid de-queue action when these queues are being
+ cleanup
+ */
+ entry->deleting = 1;
+ dhd_wlfc_cleanup(ctx->dhdp, ifpkt_fn, ifid);
+ _dhd_wlfc_flow_control_check(ctx, &entry->psq, ifid);
+ entry->deleting = 0;
+
entry->occupied = 0;
+ entry->suppressed = 0;
entry->state = WLFC_STATE_CLOSE;
entry->requested_credit = 0;
+ entry->transit_count = 0;
+ entry->suppr_transit_count = 0;
+ entry->suppress_count = 0;
+ memset(&entry->ea[0], 0, ETHER_ADDR_LEN);
+
/* enable after packets are queued-deqeued properly.
pktq_flush(dhd->osh, &entry->psq, FALSE, NULL, 0);
*/
entry = &ctx->destination_entries.interfaces[ifid];
ret = _dhd_wlfc_mac_entry_update(ctx, entry, action, ifid, iftype, ea);
- if (action == eWLFC_MAC_ENTRY_ACTION_DEL)
- dhd_wlfc_cleanup(ctx->dhdp, ifpkt_fn, ifid);
return ret;
}
*/
rc = _dhd_wlfc_rollback_packet_toq(ctx, commit_info->p,
(commit_info->pkt_type), hslot);
- if (rc != BCME_OK)
- ctx->stats.rollback_failed++;
rc = BCME_ERROR;
}
for (ac = AC_COUNT; ac >= 0; ac--) {
- int initial_credit_count = ctx->FIFO_credit[ac];
+ bool bQueueIdle = TRUE;
/* packets from delayQ with less priority are fresh and they'd need header and
* have no MAC entry
if (commit_info.p == NULL)
break;
+ bQueueIdle = FALSE;
+
commit_info.pkt_type = (commit_info.needs_hdr) ? eWLFC_PKTTYPE_DELAYED :
eWLFC_PKTTYPE_SUPPRESSED;
ctx->FIFO_credit[ac] -= credit;
- /* If no credits were used, the queue is idle and can be re-used
- Note that resv credits cannot be borrowed
- */
- if (initial_credit_count == ctx->FIFO_credit[ac]) {
+ /* If no pkts can be dequed, the credit can be borrowed */
+ if (bQueueIdle) {
ac_available |= (1 << ac);
credit_count += ctx->FIFO_credit[ac];
}
}
}
}
-
return BCME_OK;
}
/* indicate failure and free the packet */
dhd_txcomplete(dhd, pktbuf, FALSE);
entry->transit_count--;
+ DHD_WLFC_QMON_COMPLETE(entry);
/* packet is transmitted Successfully by dongle
* after first suppress.
*/
else {
dhd_txcomplete(dhd, pktbuf, TRUE);
entry->transit_count--;
+ DHD_WLFC_QMON_COMPLETE(entry);
/* This packet is transmitted Successfully by dongle
* even after first suppress.
/* indicate failure and free the packet */
dhd_txcomplete(dhd, pktbuf, FALSE);
entry->transit_count--;
- /* packet is transmitted Successfully by dongle after first suppress. */
+ DHD_WLFC_QMON_COMPLETE(entry);
+ /* This packet is transmitted Successfully by
+ * dongle even after first suppress.
+ */
if (entry->suppressed) {
entry->suppr_transit_count--;
}
else {
dhd_txcomplete(dhd, pktbuf, TRUE);
entry->transit_count--;
+ DHD_WLFC_QMON_COMPLETE(entry);
/* This packet is transmitted Successfully by dongle even after first suppress. */
if (entry->suppressed) {
}
}
-static int
+int
dhd_wlfc_parse_header_info(dhd_pub_t *dhd, void* pktbuf, int tlv_hdr_len, uchar *reorder_info_buf,
uint *reorder_info_len)
{
wlfc->allow_credit_borrow = TRUE;
wlfc->borrow_defer_timestamp = 0;
-#if defined(CUSTOMER_HW4) && defined(USE_DYNAMIC_F2_BLKSIZE)
- dhdsdio_func_blocksize(dhd, 2, DYNAMIC_F2_BLKSIZE_FOR_NONLEGACY);
-#endif /* CUSTOMER_HW4 && USE_DYNAMIC_F2_BLKSIZE */
+
return BCME_OK;
}
h->items[i].state = WLFC_HANGER_ITEM_STATE_FREE;
}
} else if (h->items[i].state == WLFC_HANGER_ITEM_STATE_INUSE_SUPPRESSED) {
- /* These are freed from the psq so no need to free again */
- h->items[i].state = WLFC_HANGER_ITEM_STATE_FREE;
+ if (fn == NULL || (*fn)(h->items[i].pkt, arg)) {
+ /* These are freed from the psq so no need to free again */
+ h->items[i].state = WLFC_HANGER_ITEM_STATE_FREE;
+ }
}
}
return;
MFREE(dhd->osh, dhd->wlfc_state, sizeof(athost_wl_status_info_t));
dhd->wlfc_state = NULL;
dhd_os_wlfc_unblock(dhd);
-#if defined(CUSTOMER_HW4) && defined(USE_DYNAMIC_F2_BLKSIZE)
- dhdsdio_func_blocksize(dhd, 2, sd_f2_blocksize);
-#endif /* CUSTOMER_HW4 && USE_DYNAMIC_F2_BLKSIZE */
- return;
-}
-#endif /* PROP_TXSTATUS */
-
-void
-dhd_prot_dump(dhd_pub_t *dhdp, struct bcmstrbuf *strbuf)
-{
- bcm_bprintf(strbuf, "Protocol CDC: reqid %d\n", dhdp->prot->reqid);
-#ifdef PROP_TXSTATUS
- if (dhdp->wlfc_state)
- dhd_wlfc_dump(dhdp, strbuf);
-#endif
-}
-
-/* The FreeBSD PKTPUSH could change the packet buf pinter
- so we need to make it changable
-*/
-#define PKTBUF pktbuf
-void
-dhd_prot_hdrpush(dhd_pub_t *dhd, int ifidx, void *PKTBUF)
-{
-#ifdef BDC
- struct bdc_header *h;
-#endif /* BDC */
-
- DHD_TRACE(("%s: Enter\n", __FUNCTION__));
-
-#ifdef BDC
- /* Push BDC header used to convey priority for buses that don't */
-
- PKTPUSH(dhd->osh, PKTBUF, BDC_HEADER_LEN);
-
- h = (struct bdc_header *)PKTDATA(dhd->osh, PKTBUF);
-
- h->flags = (BDC_PROTO_VER << BDC_FLAG_VER_SHIFT);
- if (PKTSUMNEEDED(PKTBUF))
- h->flags |= BDC_FLAG_SUM_NEEDED;
-
-
- h->priority = (PKTPRIO(PKTBUF) & BDC_PRIORITY_MASK);
- h->flags2 = 0;
- h->dataOffset = 0;
-#endif /* BDC */
- BDC_SET_IF_IDX(h, ifidx);
-}
-#undef PKTBUF /* Only defined in the above routine */
-
-int
-dhd_prot_hdrpull(dhd_pub_t *dhd, int *ifidx, void *pktbuf, uchar *reorder_buf_info,
- uint *reorder_info_len)
-{
-#ifdef BDC
- struct bdc_header *h;
-#endif
- uint8 data_offset = 0;
-
- DHD_TRACE(("%s: Enter\n", __FUNCTION__));
-
-#ifdef BDC
- if (reorder_info_len)
- *reorder_info_len = 0;
- /* Pop BDC header used to convey priority for buses that don't */
-
- if (PKTLEN(dhd->osh, pktbuf) < BDC_HEADER_LEN) {
- DHD_ERROR(("%s: rx data too short (%d < %d)\n", __FUNCTION__,
- PKTLEN(dhd->osh, pktbuf), BDC_HEADER_LEN));
- return BCME_ERROR;
- }
-
- h = (struct bdc_header *)PKTDATA(dhd->osh, pktbuf);
-
-#if defined(NDIS630)
- h->dataOffset = 0;
-#endif
-
- if (!ifidx) {
- /* for tx packet, skip the analysis */
- data_offset = h->dataOffset;
- PKTPULL(dhd->osh, pktbuf, BDC_HEADER_LEN);
- goto exit;
- }
-
- if ((*ifidx = BDC_GET_IF_IDX(h)) >= DHD_MAX_IFS) {
- DHD_ERROR(("%s: rx data ifnum out of range (%d)\n",
- __FUNCTION__, *ifidx));
- return BCME_ERROR;
- }
-
- if (((h->flags & BDC_FLAG_VER_MASK) >> BDC_FLAG_VER_SHIFT) != BDC_PROTO_VER) {
- DHD_ERROR(("%s: non-BDC packet received, flags = 0x%x\n",
- dhd_ifname(dhd, *ifidx), h->flags));
- if (((h->flags & BDC_FLAG_VER_MASK) >> BDC_FLAG_VER_SHIFT) == BDC_PROTO_VER_1)
- h->dataOffset = 0;
- else
- return BCME_ERROR;
- }
-
- if (h->flags & BDC_FLAG_SUM_GOOD) {
- DHD_INFO(("%s: BDC packet received with good rx-csum, flags 0x%x\n",
- dhd_ifname(dhd, *ifidx), h->flags));
- PKTSETSUMGOOD(pktbuf, TRUE);
- }
-
- PKTSETPRIO(pktbuf, (h->priority & BDC_PRIORITY_MASK));
- data_offset = h->dataOffset;
- PKTPULL(dhd->osh, pktbuf, BDC_HEADER_LEN);
-#endif /* BDC */
-
-#if !defined(NDIS630)
- if (PKTLEN(dhd->osh, pktbuf) < (uint32) (data_offset << 2)) {
- DHD_ERROR(("%s: rx data too short (%d < %d)\n", __FUNCTION__,
- PKTLEN(dhd->osh, pktbuf), (data_offset * 4)));
- return BCME_ERROR;
- }
-#endif
-#ifdef PROP_TXSTATUS
- if (dhd->wlfc_state &&
- ((athost_wl_status_info_t*)dhd->wlfc_state)->proptxstatus_mode
- != WLFC_FCMODE_NONE &&
- (!DHD_PKTTAG_PKTDIR(PKTTAG(pktbuf)))) {
- /*
- - parse txstatus only for packets that came from the firmware
- */
- dhd_os_wlfc_block(dhd);
- dhd_wlfc_parse_header_info(dhd, pktbuf, (data_offset << 2),
- reorder_buf_info, reorder_info_len);
- ((athost_wl_status_info_t*)dhd->wlfc_state)->stats.dhd_hdrpulls++;
- dhd_os_wlfc_unblock(dhd);
- }
-#endif /* PROP_TXSTATUS */
-
-exit:
-#if !defined(NDIS630)
- PKTPULL(dhd->osh, pktbuf, (data_offset << 2));
-#endif
- return 0;
-}
-
-#if defined(PROP_TXSTATUS)
-void
-dhd_wlfc_trigger_pktcommit(dhd_pub_t *dhd)
-{
- if (dhd->wlfc_state &&
- (((athost_wl_status_info_t*)dhd->wlfc_state)->proptxstatus_mode
- != WLFC_FCMODE_NONE)) {
- dhd_os_wlfc_block(dhd);
- dhd_wlfc_commit_packets(dhd->wlfc_state, (f_commitpkt_t)dhd_bus_txdata,
- (void *)dhd->bus, NULL);
- dhd_os_wlfc_unblock(dhd);
- }
-}
-#endif
-
-
-int
-dhd_prot_attach(dhd_pub_t *dhd)
-{
- dhd_prot_t *cdc;
-
- if (!(cdc = (dhd_prot_t *)DHD_OS_PREALLOC(dhd->osh, DHD_PREALLOC_PROT,
- sizeof(dhd_prot_t)))) {
- DHD_ERROR(("%s: kmalloc failed\n", __FUNCTION__));
- goto fail;
- }
- memset(cdc, 0, sizeof(dhd_prot_t));
-
- /* ensure that the msg buf directly follows the cdc msg struct */
- if ((uintptr)(&cdc->msg + 1) != (uintptr)cdc->buf) {
- DHD_ERROR(("dhd_prot_t is not correctly defined\n"));
- goto fail;
- }
-
- dhd->prot = cdc;
-#ifdef BDC
- dhd->hdrlen += BDC_HEADER_LEN;
-#endif
- dhd->maxctl = WLC_IOCTL_MAXLEN + sizeof(cdc_ioctl_t) + ROUND_UP_MARGIN;
- return 0;
-
-fail:
-#ifndef CONFIG_DHD_USE_STATIC_BUF
- if (cdc != NULL)
- MFREE(dhd->osh, cdc, sizeof(dhd_prot_t));
-#endif /* CONFIG_DHD_USE_STATIC_BUF */
- return BCME_NOMEM;
-}
-/* ~NOTE~ What if another thread is waiting on the semaphore? Holding it? */
-void
-dhd_prot_detach(dhd_pub_t *dhd)
-{
-#ifdef PROP_TXSTATUS
- dhd_wlfc_deinit(dhd);
-#endif
-#ifndef CONFIG_DHD_USE_STATIC_BUF
- MFREE(dhd->osh, dhd->prot, sizeof(dhd_prot_t));
-#endif /* CONFIG_DHD_USE_STATIC_BUF */
- dhd->prot = NULL;
-}
-
-void
-dhd_prot_dstats(dhd_pub_t *dhd)
-{
- /* No stats from dongle added yet, copy bus stats */
- dhd->dstats.tx_packets = dhd->tx_packets;
- dhd->dstats.tx_errors = dhd->tx_errors;
- dhd->dstats.rx_packets = dhd->rx_packets;
- dhd->dstats.rx_errors = dhd->rx_errors;
- dhd->dstats.rx_dropped = dhd->rx_dropped;
- dhd->dstats.multicast = dhd->rx_multicast;
return;
}
-
-int
-dhd_prot_init(dhd_pub_t *dhd)
-{
- int ret = 0;
- wlc_rev_info_t revinfo;
- DHD_TRACE(("%s: Enter\n", __FUNCTION__));
-
-
- /* Get the device rev info */
- memset(&revinfo, 0, sizeof(revinfo));
- ret = dhd_wl_ioctl_cmd(dhd, WLC_GET_REVINFO, &revinfo, sizeof(revinfo), FALSE, 0);
- if (ret < 0)
- goto done;
-
-
-#if defined(WL_CFG80211)
- if (dhd_download_fw_on_driverload)
-#endif /* defined(WL_CFG80211) */
- ret = dhd_preinit_ioctls(dhd);
-
-#ifdef PROP_TXSTATUS
- ret = dhd_wlfc_init(dhd);
-#endif
-
- /* Always assumes wl for now */
- dhd->iswl = TRUE;
-
-done:
- return ret;
-}
-
-void
-dhd_prot_stop(dhd_pub_t *dhd)
-{
- /* Nothing to do for CDC */
-}
-
-
-static void
-dhd_get_hostreorder_pkts(void *osh, struct reorder_info *ptr, void **pkt,
- uint32 *pkt_count, void **pplast, uint8 start, uint8 end)
-{
- uint i;
- void *plast = NULL, *p;
- uint32 pkt_cnt = 0;
-
- if (ptr->pend_pkts == 0) {
- DHD_REORDER(("%s: no packets in reorder queue \n", __FUNCTION__));
- *pplast = NULL;
- *pkt_count = 0;
- *pkt = NULL;
- return;
- }
- if (start == end)
- i = ptr->max_idx + 1;
- else {
- if (start > end)
- i = ((ptr->max_idx + 1) - start) + end;
- else
- i = end - start;
- }
- while (i) {
- p = (void *)(ptr->p[start]);
- ptr->p[start] = NULL;
-
- if (p != NULL) {
- if (plast == NULL)
- *pkt = p;
- else
- PKTSETNEXT(osh, plast, p);
-
- plast = p;
- pkt_cnt++;
- }
- i--;
- if (start++ == ptr->max_idx)
- start = 0;
- }
- *pplast = plast;
- *pkt_count = (uint32)pkt_cnt;
-}
-
-int
-dhd_process_pkt_reorder_info(dhd_pub_t *dhd, uchar *reorder_info_buf, uint reorder_info_len,
- void **pkt, uint32 *pkt_count)
-{
- uint8 flow_id, max_idx, cur_idx, exp_idx;
- struct reorder_info *ptr;
- uint8 flags;
- void *cur_pkt, *plast = NULL;
- uint32 cnt = 0;
-
- if (pkt == NULL) {
- if (pkt_count != NULL)
- *pkt_count = 0;
- return 0;
- }
-
- flow_id = reorder_info_buf[WLHOST_REORDERDATA_FLOWID_OFFSET];
- flags = reorder_info_buf[WLHOST_REORDERDATA_FLAGS_OFFSET];
-
- DHD_REORDER(("flow_id %d, flags 0x%02x, idx(%d, %d, %d)\n", flow_id, flags,
- reorder_info_buf[WLHOST_REORDERDATA_CURIDX_OFFSET],
- reorder_info_buf[WLHOST_REORDERDATA_EXPIDX_OFFSET],
- reorder_info_buf[WLHOST_REORDERDATA_MAXIDX_OFFSET]));
-
- /* validate flags and flow id */
- if (flags == 0xFF) {
- DHD_ERROR(("%s: invalid flags...so ignore this packet\n", __FUNCTION__));
- *pkt_count = 1;
- 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);
-
- DHD_REORDER(("%s: Flags indicating to delete a flow id %d\n",
- __FUNCTION__, flow_id));
-
- if (ptr == NULL) {
- DHD_REORDER(("%s: received flags to cleanup, but no flow (%d) yet\n",
- __FUNCTION__, flow_id));
- *pkt_count = 1;
- *pkt = cur_pkt;
- return 0;
- }
-
- dhd_get_hostreorder_pkts(dhd->osh, ptr, pkt, &cnt, &plast,
- ptr->exp_idx, ptr->exp_idx);
- /* set it to the last packet */
- if (plast) {
- PKTSETNEXT(dhd->osh, plast, cur_pkt);
- cnt++;
- }
- else {
- if (cnt != 0) {
- DHD_ERROR(("%s: del flow: something fishy, pending packets %d\n",
- __FUNCTION__, cnt));
- }
- *pkt = cur_pkt;
- cnt = 1;
- }
- buf_size += ((ptr->max_idx + 1) * sizeof(void *));
- MFREE(dhd->osh, ptr, buf_size);
- dhd->reorder_bufs[flow_id] = NULL;
- *pkt_count = cnt;
- return 0;
- }
- /* all the other cases depend on the existance of the reorder struct for that flow id */
- if (ptr == NULL) {
- uint32 buf_size_alloc = sizeof(reorder_info_t);
- max_idx = reorder_info_buf[WLHOST_REORDERDATA_MAXIDX_OFFSET];
-
- buf_size_alloc += ((max_idx + 1) * sizeof(void*));
- /* allocate space to hold the buffers, index etc */
-
- DHD_REORDER(("%s: alloc buffer of size %d size, reorder info id %d, maxidx %d\n",
- __FUNCTION__, buf_size_alloc, flow_id, max_idx));
- ptr = (struct reorder_info *)MALLOC(dhd->osh, buf_size_alloc);
- if (ptr == NULL) {
- DHD_ERROR(("%s: Malloc failed to alloc buffer\n", __FUNCTION__));
- *pkt_count = 1;
- return 0;
- }
- bzero(ptr, buf_size_alloc);
- dhd->reorder_bufs[flow_id] = ptr;
- ptr->p = (void *)(ptr+1);
- ptr->max_idx = max_idx;
- }
- if (flags & WLHOST_REORDERDATA_NEW_HOLE) {
- DHD_REORDER(("%s: new hole, so cleanup pending buffers\n", __FUNCTION__));
- if (ptr->pend_pkts) {
- dhd_get_hostreorder_pkts(dhd->osh, ptr, pkt, &cnt, &plast,
- ptr->exp_idx, ptr->exp_idx);
- ptr->pend_pkts = 0;
- }
- ptr->cur_idx = reorder_info_buf[WLHOST_REORDERDATA_CURIDX_OFFSET];
- ptr->exp_idx = reorder_info_buf[WLHOST_REORDERDATA_EXPIDX_OFFSET];
- ptr->max_idx = reorder_info_buf[WLHOST_REORDERDATA_MAXIDX_OFFSET];
- ptr->p[ptr->cur_idx] = cur_pkt;
- ptr->pend_pkts++;
- *pkt_count = cnt;
- }
- else if (flags & WLHOST_REORDERDATA_CURIDX_VALID) {
- cur_idx = reorder_info_buf[WLHOST_REORDERDATA_CURIDX_OFFSET];
- exp_idx = reorder_info_buf[WLHOST_REORDERDATA_EXPIDX_OFFSET];
-
-
- if ((exp_idx == ptr->exp_idx) && (cur_idx != ptr->exp_idx)) {
- /* still in the current hole */
- /* enqueue the current on the buffer chain */
- if (ptr->p[cur_idx] != NULL) {
- DHD_REORDER(("%s: HOLE: ERROR buffer pending..free it\n",
- __FUNCTION__));
- PKTFREE(dhd->osh, ptr->p[cur_idx], TRUE);
- ptr->p[cur_idx] = NULL;
- }
- ptr->p[cur_idx] = cur_pkt;
- ptr->pend_pkts++;
- ptr->cur_idx = cur_idx;
- DHD_REORDER(("%s: fill up a hole..pending packets is %d\n",
- __FUNCTION__, ptr->pend_pkts));
- *pkt_count = 0;
- *pkt = NULL;
- }
- else if (ptr->exp_idx == cur_idx) {
- /* got the right one ..flush from cur to exp and update exp */
- DHD_REORDER(("%s: got the right one now, cur_idx is %d\n",
- __FUNCTION__, cur_idx));
- if (ptr->p[cur_idx] != NULL) {
- DHD_REORDER(("%s: Error buffer pending..free it\n",
- __FUNCTION__));
- PKTFREE(dhd->osh, ptr->p[cur_idx], TRUE);
- ptr->p[cur_idx] = NULL;
- }
- ptr->p[cur_idx] = cur_pkt;
- ptr->pend_pkts++;
-
- ptr->cur_idx = cur_idx;
- ptr->exp_idx = exp_idx;
-
- dhd_get_hostreorder_pkts(dhd->osh, ptr, pkt, &cnt, &plast,
- cur_idx, exp_idx);
- ptr->pend_pkts -= (uint8)cnt;
- *pkt_count = cnt;
- DHD_REORDER(("%s: freeing up buffers %d, still pending %d\n",
- __FUNCTION__, cnt, ptr->pend_pkts));
- }
- else {
- uint8 end_idx;
- bool flush_current = FALSE;
- /* both cur and exp are moved now .. */
- DHD_REORDER(("%s:, flow %d, both moved, cur %d(%d), exp %d(%d)\n",
- __FUNCTION__, flow_id, ptr->cur_idx, cur_idx,
- ptr->exp_idx, exp_idx));
- if (flags & WLHOST_REORDERDATA_FLUSH_ALL)
- end_idx = ptr->exp_idx;
- else
- end_idx = exp_idx;
-
- /* flush pkts first */
- dhd_get_hostreorder_pkts(dhd->osh, ptr, pkt, &cnt, &plast,
- ptr->exp_idx, end_idx);
-
- if (cur_idx == ptr->max_idx) {
- if (exp_idx == 0)
- flush_current = TRUE;
- } else {
- if (exp_idx == cur_idx + 1)
- flush_current = TRUE;
- }
- if (flush_current) {
- if (plast)
- PKTSETNEXT(dhd->osh, plast, cur_pkt);
- else
- *pkt = cur_pkt;
- cnt++;
- }
- else {
- ptr->p[cur_idx] = cur_pkt;
- ptr->pend_pkts++;
- }
- ptr->exp_idx = exp_idx;
- ptr->cur_idx = cur_idx;
- *pkt_count = cnt;
- }
- }
- else {
- uint8 end_idx;
- /* no real packet but update to exp_seq...that means explicit window move */
- exp_idx = reorder_info_buf[WLHOST_REORDERDATA_EXPIDX_OFFSET];
-
- DHD_REORDER(("%s: move the window, cur_idx is %d, exp is %d, new exp is %d\n",
- __FUNCTION__, ptr->cur_idx, ptr->exp_idx, exp_idx));
- if (flags & WLHOST_REORDERDATA_FLUSH_ALL)
- end_idx = ptr->exp_idx;
- else
- end_idx = exp_idx;
-
- dhd_get_hostreorder_pkts(dhd->osh, ptr, pkt, &cnt, &plast, ptr->exp_idx, end_idx);
- ptr->pend_pkts -= (uint8)cnt;
- if (plast)
- PKTSETNEXT(dhd->osh, plast, cur_pkt);
- else
- *pkt = cur_pkt;
- cnt++;
- *pkt_count = cnt;
- /* set the new expected idx */
- ptr->exp_idx = exp_idx;
- }
- return 0;
-}
+#endif /* PROP_TXSTATUS */
/*
-* Copyright (C) 1999-2012, Broadcom Corporation
+* Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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 364470 2012-10-24 04:52:47Z $
+* $Id: dhd_wlfc.h 398418 2013-04-24 15:18:27Z $
*
*/
#ifndef __wlfc_host_driver_definitions_h__
#define __wlfc_host_driver_definitions_h__
+#ifdef QMONITOR
+#include <dhd_qmon.h>
+#endif
+
+
/* 16 bits will provide an absolute max of 65536 slots */
#define WLFC_HANGER_MAXITEMS 1024
#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 256
-#define WLFC_FLOWCONTROL_HIWATER 128
-#define WLFC_FLOWCONTROL_LOWATER 64
+#define WLFC_PSQ_LEN 2048
+
+#define WLFC_FLOWCONTROL_HIWATER (2048 - 256)
+#define WLFC_FLOWCONTROL_LOWATER 256
typedef struct wlfc_mac_descriptor {
uint8 occupied;
*/
uint suppress_count;
/* flag. TRUE when in suppress state */
- uint8 suppressed;
+ uint8 suppressed;
+ uint8 deleting;
+
+#ifdef QMONITOR
+ dhd_qmon_t qmon;
+#endif /* QMONITOR */
#ifdef PROP_TXSTATUS_DEBUG
uint32 dstncredit_sent_packets;
int dhd_os_wlfc_block(dhd_pub_t *pub);
int dhd_os_wlfc_unblock(dhd_pub_t *pub);
+void dhd_wlfc_dump(dhd_pub_t *dhdp, struct bcmstrbuf *strbuf);
+int dhd_wlfc_init(dhd_pub_t *dhd);
+void dhd_wlfc_deinit(dhd_pub_t *dhd);
+int dhd_wlfc_parse_header_info(dhd_pub_t *dhd, void* pktbuf, int tlv_hdr_len,
+ uchar *reorder_info_buf, uint *reorder_info_len);
+int dhd_wlfc_commit_packets(void* state, f_commitpkt_t fcommit,
+ void* commit_ctx, void *pktbuf);
+void dhd_wlfc_cleanup(dhd_pub_t *dhd, ifpkt_cb_t fn, int arg);
+bool ifpkt_fn(void* p, int ifid);
#endif /* __wlfc_host_driver_definitions_h__ */
* Common stats definitions for clients of dongle
* ports
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
/*
* Dongle WL Header definitions
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* Misc utility routines for accessing PMU corerev specific features
* of the SiliconBackplane-based Broadcom chips.
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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 367414 2012-11-08 00:40:54Z $
+ * $Id: hndpmu.c 385540 2013-02-15 23:14:50Z $
*/
/*
{1, 0x1},
{0, 0x0} };
+
+/*
+ * SDIO Drive Strength to sel value table for 43143 PMU Rev 17, see Confluence 43143 Toplevel
+ * architecture page, section 'PMU Chip Control 1 Register definition', click link to picture
+ * BCM43143_sel_sdio_signals.jpg. Valid after PMU Chip Control 0 Register, bit31 (override) has
+ * been written '1'.
+ */
+#if !defined(BCM_SDIO_VDDIO) || BCM_SDIO_VDDIO == 33
+
+static const sdiod_drive_str_t sdiod_drive_strength_tab7_3v3[] = {
+ /* note: for 14, 10, 6 and 2mA hw timing is not met according to rtl team */
+ {16, 0x7},
+ {12, 0x5},
+ {8, 0x3},
+ {4, 0x1} }; /* note: 43143 does not support tristate */
+
+#else
+
+static const sdiod_drive_str_t sdiod_drive_strength_tab7_1v8[] = {
+ /* note: for 7, 5, 3 and 1mA hw timing is not met according to rtl team */
+ {8, 0x7},
+ {6, 0x5},
+ {4, 0x3},
+ {2, 0x1} }; /* note: 43143 does not support tristate */
+
+#endif /* BCM_SDIO_VDDIO */
+
#define SDIOD_DRVSTR_KEY(chip, pmu) (((chip) << 16) | (pmu))
+/**
+ * Balance between stable SDIO operation and power consumption is achieved using this function.
+ * Note that each drive strength table is for a specific VDDIO of the SDIO pads, ideally this
+ * function should read the VDDIO itself to select the correct table. For now it has been solved
+ * with the 'BCM_SDIO_VDDIO' preprocessor constant.
+ *
+ * 'drivestrength': desired pad drive strength in mA. Drive strength of 0 requests tri-state (if
+ * hardware supports this), if no hw support drive strength is not programmed.
+ */
void
si_sdiod_drive_strength_init(si_t *sih, osl_t *osh, uint32 drivestrength)
{
chipcregs_t *cc;
uint origidx, intr_val = 0;
sdiod_drive_str_t *str_tab = NULL;
- uint32 str_mask = 0;
+ uint32 str_mask = 0; /* only alter desired bits in PMU chipcontrol 1 register */
uint32 str_shift = 0;
+ uint32 str_ovr_pmuctl = PMU_CHIPCTL0; /* PMU chipcontrol register containing override bit */
+ uint32 str_ovr_pmuval = 0; /* position of bit within this register */
if (!(sih->cccaps & CC_CAP_PMU)) {
return;
str_mask = 0x00001800;
str_shift = 11;
break;
+ case SDIOD_DRVSTR_KEY(BCM43143_CHIP_ID, 17):
+#if !defined(BCM_SDIO_VDDIO) || BCM_SDIO_VDDIO == 33
+ if (drivestrength >= ARRAYLAST(sdiod_drive_strength_tab7_3v3)->strength) {
+ str_tab = (sdiod_drive_str_t *)&sdiod_drive_strength_tab7_3v3;
+ }
+#else
+ if (drivestrength >= ARRAYLAST(sdiod_drive_strength_tab7_1v8)->strength) {
+ str_tab = (sdiod_drive_str_t *)&sdiod_drive_strength_tab7_1v8;
+ }
+#endif /* BCM_SDIO_VDDIO */
+ str_mask = 0x00000007;
+ str_ovr_pmuval = PMU43143_CC0_SDIO_DRSTR_OVR;
+ 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));
-
break;
}
if (i > 0 && drivestrength > str_tab[i].strength)
i--;
- W_REG(osh, &cc->chipcontrol_addr, 1);
+ W_REG(osh, &cc->chipcontrol_addr, PMU_CHIPCTL1);
cc_data_temp = R_REG(osh, &cc->chipcontrol_data);
cc_data_temp &= ~str_mask;
cc_data_temp |= str_tab[i].sel << str_shift;
W_REG(osh, &cc->chipcontrol_data, cc_data_temp);
-
+ if (str_ovr_pmuval) { /* enables the selected drive strength */
+ W_REG(osh, &cc->chipcontrol_addr, str_ovr_pmuctl);
+ OR_REG(osh, &cc->chipcontrol_data, str_ovr_pmuval);
+ }
PMU_MSG(("SDIO: %dmA drive strength requested; set to %dmA\n",
drivestrength, str_tab[i].strength));
}
/* Return to original core */
si_restore_core(sih, origidx, intr_val);
-}
+} /* si_sdiod_drive_strength_init */
/*
* Broadcom AMBA Interconnect definitions.
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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: aidmp.h 241182 2011-02-17 21:50:03Z $
+ * $Id: aidmp.h 385510 2013-02-15 21:02:07Z $
*/
#ifndef _AIDMP_H
#define _AIDMP_H
-
+/* Manufacturer Ids */
#define MFGID_ARM 0x43b
#define MFGID_BRCM 0x4bf
#define MFGID_MIPS 0x4a7
-
+/* Component Classes */
#define CC_SIM 0
#define CC_EROM 1
#define CC_CORESIGHT 9
#define CC_GEN 0xe
#define CC_PRIMECELL 0xf
-
+/* Enumeration ROM registers */
#define ER_EROMENTRY 0x000
#define ER_REMAPCONTROL 0xe00
#define ER_REMAPSELECT 0xe04
#define ER_ITCR 0xf00
#define ER_ITIP 0xf04
-
+/* Erom entries */
#define ER_TAG 0xe
#define ER_TAG1 0x6
#define ER_VALID 1
#define ER_END 0xe
#define ER_BAD 0xffffffff
-
+/* EROM CompIdentA */
#define CIA_MFG_MASK 0xfff00000
#define CIA_MFG_SHIFT 20
#define CIA_CID_MASK 0x000fff00
#define CIA_CCL_MASK 0x000000f0
#define CIA_CCL_SHIFT 4
-
+/* EROM CompIdentB */
#define CIB_REV_MASK 0xff000000
#define CIB_REV_SHIFT 24
#define CIB_NSW_MASK 0x00f80000
#define CIB_NMP_MASK 0x000001f0
#define CIB_NMP_SHIFT 4
-
+/* EROM MasterPortDesc */
#define MPD_MUI_MASK 0x0000ff00
#define MPD_MUI_SHIFT 8
#define MPD_MP_MASK 0x000000f0
#define MPD_MP_SHIFT 4
-
+/* EROM AddrDesc */
#define AD_ADDR_MASK 0xfffff000
#define AD_SP_MASK 0x00000f00
#define AD_SP_SHIFT 8
#define AD_SZ_SZD 0x00000030
#define AD_AG32 0x00000008
#define AD_ADDR_ALIGN 0x00000fff
-#define AD_SZ_BASE 0x00001000
-
+#define AD_SZ_BASE 0x00001000 /* 4KB */
+/* EROM SizeDesc */
#define SD_SZ_MASK 0xfffff000
#define SD_SG32 0x00000008
#define SD_SZ_ALIGN 0x00000fff
#ifndef _LANGUAGE_ASSEMBLY
typedef volatile struct _aidmp {
- uint32 oobselina30;
- uint32 oobselina74;
+ uint32 oobselina30; /* 0x000 */
+ uint32 oobselina74; /* 0x004 */
uint32 PAD[6];
- uint32 oobselinb30;
- uint32 oobselinb74;
+ uint32 oobselinb30; /* 0x020 */
+ uint32 oobselinb74; /* 0x024 */
uint32 PAD[6];
- uint32 oobselinc30;
- uint32 oobselinc74;
+ uint32 oobselinc30; /* 0x040 */
+ uint32 oobselinc74; /* 0x044 */
uint32 PAD[6];
- uint32 oobselind30;
- uint32 oobselind74;
+ uint32 oobselind30; /* 0x060 */
+ uint32 oobselind74; /* 0x064 */
uint32 PAD[38];
- uint32 oobselouta30;
- uint32 oobselouta74;
+ uint32 oobselouta30; /* 0x100 */
+ uint32 oobselouta74; /* 0x104 */
uint32 PAD[6];
- uint32 oobseloutb30;
- uint32 oobseloutb74;
+ uint32 oobseloutb30; /* 0x120 */
+ uint32 oobseloutb74; /* 0x124 */
uint32 PAD[6];
- uint32 oobseloutc30;
- uint32 oobseloutc74;
+ uint32 oobseloutc30; /* 0x140 */
+ uint32 oobseloutc74; /* 0x144 */
uint32 PAD[6];
- uint32 oobseloutd30;
- uint32 oobseloutd74;
+ uint32 oobseloutd30; /* 0x160 */
+ uint32 oobseloutd74; /* 0x164 */
uint32 PAD[38];
- uint32 oobsynca;
- uint32 oobseloutaen;
+ uint32 oobsynca; /* 0x200 */
+ uint32 oobseloutaen; /* 0x204 */
uint32 PAD[6];
- uint32 oobsyncb;
- uint32 oobseloutben;
+ uint32 oobsyncb; /* 0x220 */
+ uint32 oobseloutben; /* 0x224 */
uint32 PAD[6];
- uint32 oobsyncc;
- uint32 oobseloutcen;
+ uint32 oobsyncc; /* 0x240 */
+ uint32 oobseloutcen; /* 0x244 */
uint32 PAD[6];
- uint32 oobsyncd;
- uint32 oobseloutden;
+ uint32 oobsyncd; /* 0x260 */
+ uint32 oobseloutden; /* 0x264 */
uint32 PAD[38];
- uint32 oobaextwidth;
- uint32 oobainwidth;
- uint32 oobaoutwidth;
+ uint32 oobaextwidth; /* 0x300 */
+ uint32 oobainwidth; /* 0x304 */
+ uint32 oobaoutwidth; /* 0x308 */
uint32 PAD[5];
- uint32 oobbextwidth;
- uint32 oobbinwidth;
- uint32 oobboutwidth;
+ uint32 oobbextwidth; /* 0x320 */
+ uint32 oobbinwidth; /* 0x324 */
+ uint32 oobboutwidth; /* 0x328 */
uint32 PAD[5];
- uint32 oobcextwidth;
- uint32 oobcinwidth;
- uint32 oobcoutwidth;
+ uint32 oobcextwidth; /* 0x340 */
+ uint32 oobcinwidth; /* 0x344 */
+ uint32 oobcoutwidth; /* 0x348 */
uint32 PAD[5];
- uint32 oobdextwidth;
- uint32 oobdinwidth;
- uint32 oobdoutwidth;
+ uint32 oobdextwidth; /* 0x360 */
+ uint32 oobdinwidth; /* 0x364 */
+ uint32 oobdoutwidth; /* 0x368 */
uint32 PAD[37];
- uint32 ioctrlset;
- uint32 ioctrlclear;
- uint32 ioctrl;
+ uint32 ioctrlset; /* 0x400 */
+ uint32 ioctrlclear; /* 0x404 */
+ uint32 ioctrl; /* 0x408 */
uint32 PAD[61];
- uint32 iostatus;
+ uint32 iostatus; /* 0x500 */
uint32 PAD[127];
- uint32 ioctrlwidth;
- uint32 iostatuswidth;
+ uint32 ioctrlwidth; /* 0x700 */
+ uint32 iostatuswidth; /* 0x704 */
uint32 PAD[62];
- uint32 resetctrl;
- uint32 resetstatus;
- uint32 resetreadid;
- uint32 resetwriteid;
+ uint32 resetctrl; /* 0x800 */
+ uint32 resetstatus; /* 0x804 */
+ uint32 resetreadid; /* 0x808 */
+ uint32 resetwriteid; /* 0x80c */
uint32 PAD[60];
- uint32 errlogctrl;
- uint32 errlogdone;
- uint32 errlogstatus;
- uint32 errlogaddrlo;
- uint32 errlogaddrhi;
- uint32 errlogid;
- uint32 errloguser;
- uint32 errlogflags;
+ uint32 errlogctrl; /* 0x900 */
+ uint32 errlogdone; /* 0x904 */
+ uint32 errlogstatus; /* 0x908 */
+ uint32 errlogaddrlo; /* 0x90c */
+ uint32 errlogaddrhi; /* 0x910 */
+ uint32 errlogid; /* 0x914 */
+ uint32 errloguser; /* 0x918 */
+ uint32 errlogflags; /* 0x91c */
uint32 PAD[56];
- uint32 intstatus;
+ uint32 intstatus; /* 0xa00 */
uint32 PAD[255];
- uint32 config;
+ uint32 config; /* 0xe00 */
uint32 PAD[63];
- uint32 itcr;
+ uint32 itcr; /* 0xf00 */
uint32 PAD[3];
- uint32 itipooba;
- uint32 itipoobb;
- uint32 itipoobc;
- uint32 itipoobd;
+ uint32 itipooba; /* 0xf10 */
+ uint32 itipoobb; /* 0xf14 */
+ uint32 itipoobc; /* 0xf18 */
+ uint32 itipoobd; /* 0xf1c */
uint32 PAD[4];
- uint32 itipoobaout;
- uint32 itipoobbout;
- uint32 itipoobcout;
- uint32 itipoobdout;
+ uint32 itipoobaout; /* 0xf30 */
+ uint32 itipoobbout; /* 0xf34 */
+ uint32 itipoobcout; /* 0xf38 */
+ uint32 itipoobdout; /* 0xf3c */
uint32 PAD[4];
- uint32 itopooba;
- uint32 itopoobb;
- uint32 itopoobc;
- uint32 itopoobd;
+ uint32 itopooba; /* 0xf50 */
+ uint32 itopoobb; /* 0xf54 */
+ uint32 itopoobc; /* 0xf58 */
+ uint32 itopoobd; /* 0xf5c */
uint32 PAD[4];
- uint32 itopoobain;
- uint32 itopoobbin;
- uint32 itopoobcin;
- uint32 itopoobdin;
+ uint32 itopoobain; /* 0xf70 */
+ uint32 itopoobbin; /* 0xf74 */
+ uint32 itopoobcin; /* 0xf78 */
+ uint32 itopoobdin; /* 0xf7c */
uint32 PAD[4];
- uint32 itopreset;
+ uint32 itopreset; /* 0xf90 */
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; /* 0xfd0 */
+ uint32 peripherialid5; /* 0xfd4 */
+ uint32 peripherialid6; /* 0xfd8 */
+ uint32 peripherialid7; /* 0xfdc */
+ uint32 peripherialid0; /* 0xfe0 */
+ uint32 peripherialid1; /* 0xfe4 */
+ uint32 peripherialid2; /* 0xfe8 */
+ uint32 peripherialid3; /* 0xfec */
+ uint32 componentid0; /* 0xff0 */
+ uint32 componentid1; /* 0xff4 */
+ uint32 componentid2; /* 0xff8 */
+ uint32 componentid3; /* 0xffc */
} aidmp_t;
-#endif
-
+#endif /* _LANGUAGE_ASSEMBLY */
+/* Out-of-band Router registers */
#define OOB_BUSCONFIG 0x020
#define OOB_STATUSA 0x100
#define OOB_STATUSB 0x104
#define OOB_ITOPOOBC 0xf38
#define OOB_ITOPOOBD 0xf3c
-
+/* DMP wrapper registers */
#define AI_OOBSELINA30 0x000
#define AI_OOBSELINA74 0x004
#define AI_OOBSELINB30 0x020
#define AI_COMPONENTID2 0xff8
#define AI_COMPONENTID3 0xffc
-
+/* resetctrl */
#define AIRC_RESET 1
-
+/* config */
#define AICFG_OOB 0x00000020
#define AICFG_IOS 0x00000010
#define AICFG_IOC 0x00000008
#define AICFG_ERRL 0x00000002
#define AICFG_RST 0x00000001
-
+/* bit defines for AI_OOBSELOUTB74 reg */
#define OOB_SEL_OUTEN_B_5 15
#define OOB_SEL_OUTEN_B_6 23
-#endif
+/* AI_OOBSEL for A/B/C/D, 0-7 */
+#define AI_OOBSEL_MASK 0x1F
+#define AI_OOBSEL_0_SHIFT 0
+#define AI_OOBSEL_1_SHIFT 8
+#define AI_OOBSEL_2_SHIFT 16
+#define AI_OOBSEL_3_SHIFT 24
+#define AI_OOBSEL_4_SHIFT 0
+#define AI_OOBSEL_5_SHIFT 8
+#define AI_OOBSEL_6_SHIFT 16
+#define AI_OOBSEL_7_SHIFT 24
+
+#endif /* _AIDMP_H */
/*
* BCM common config options
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
#ifndef _bcm_cfg_h_
#define _bcm_cfg_h_
-#endif
+#endif /* _bcm_cfg_h_ */
* and instrumentation on top of the heap, without modifying the heap
* allocation implementation.
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
*
* Definitions subject to change without notice.
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
#include <proto/ethernet.h>
typedef struct cdc_ioctl {
- uint32 cmd;
- uint32 len;
- uint32 flags;
- uint32 status;
+ uint32 cmd; /* ioctl command value */
+ uint32 len; /* lower 16: output buflen; upper 16: input buflen (excludes header) */
+ uint32 flags; /* flag defns given below */
+ uint32 status; /* status code returned from the device */
} cdc_ioctl_t;
-
+/* Max valid buffer size that can be sent to the dongle */
#define CDC_MAX_MSG_SIZE ETHER_MAX_LEN
-
-#define CDCL_IOC_OUTLEN_MASK 0x0000FFFF
-
+/* len field is divided into input and output buffer lengths */
+#define CDCL_IOC_OUTLEN_MASK 0x0000FFFF /* maximum or expected response length, */
+ /* excluding IOCTL header */
#define CDCL_IOC_OUTLEN_SHIFT 0
-#define CDCL_IOC_INLEN_MASK 0xFFFF0000
+#define CDCL_IOC_INLEN_MASK 0xFFFF0000 /* input buffer length, excluding IOCTL header */
#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
+/* CDC flag definitions */
+#define CDCF_IOC_ERROR 0x01 /* 0=success, 1=ioctl cmd failed */
+#define CDCF_IOC_SET 0x02 /* 0=get, 1=set cmd */
+#define CDCF_IOC_OVL_IDX_MASK 0x3c /* overlay region index mask */
+#define CDCF_IOC_OVL_RSV 0x40 /* 1=reserve this overlay region */
+#define CDCF_IOC_OVL 0x80 /* 1=this ioctl corresponds to an overlay */
+#define CDCF_IOC_ACTION_MASK 0xfe /* SET/GET, OVL_IDX, OVL_RSV, OVL mask */
+#define CDCF_IOC_ACTION_SHIFT 1 /* SET/GET, OVL_IDX, OVL_RSV, OVL shift */
+#define CDCF_IOC_IF_MASK 0xF000 /* I/F index */
#define CDCF_IOC_IF_SHIFT 12
-#define CDCF_IOC_ID_MASK 0xFFFF0000
-#define CDCF_IOC_ID_SHIFT 16
+#define CDCF_IOC_ID_MASK 0xFFFF0000 /* used to uniquely id an ioctl req/resp pairing */
+#define CDCF_IOC_ID_SHIFT 16 /* # of bits of shift for ID Mask */
#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)
#define CDC_SET_IF_IDX(hdr, idx) \
((hdr)->flags = (((hdr)->flags & ~CDCF_IOC_IF_MASK) | ((idx) << CDCF_IOC_IF_SHIFT)))
-
+/*
+ * BDC header
+ *
+ * The BDC header is used on data packets to convey priority across USB.
+ */
struct bdc_header {
- uint8 flags;
- uint8 priority;
+ uint8 flags; /* Flags */
+ uint8 priority; /* 802.1d Priority 0:2 bits, 4:7 USB flow control info */
uint8 flags2;
- uint8 dataOffset;
+ uint8 dataOffset; /* Offset from end of BDC header to packet data, in
+ * 4-byte words. Leaves room for optional headers.
+ */
};
#define BDC_HEADER_LEN 4
+/* flags field bitmap */
+#define BDC_FLAG_80211_PKT 0x01 /* Packet is in 802.11 format (dongle -> host) */
+#define BDC_FLAG_SUM_GOOD 0x04 /* Dongle has verified good RX checksums */
+#define BDC_FLAG_SUM_NEEDED 0x08 /* Dongle needs to do TX checksums: host->device */
+#define BDC_FLAG_EVENT_MSG 0x08 /* Payload contains an event msg: device->host */
+#define BDC_FLAG_VER_MASK 0xf0 /* Protocol version mask */
+#define BDC_FLAG_VER_SHIFT 4 /* Protocol version shift */
-#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
-
-
+/* priority field bitmap */
#define BDC_PRIORITY_MASK 0x07
-#define BDC_PRIORITY_FC_MASK 0xf0
-#define BDC_PRIORITY_FC_SHIFT 4
+#define BDC_PRIORITY_FC_MASK 0xf0 /* flow control info mask */
+#define BDC_PRIORITY_FC_SHIFT 4 /* flow control info shift */
-
-#define BDC_FLAG2_IF_MASK 0x0f
+/* flags2 field bitmap */
+#define BDC_FLAG2_IF_MASK 0x0f /* interface index (host <-> dongle) */
#define BDC_FLAG2_IF_SHIFT 0
-#define BDC_FLAG2_FC_FLAG 0x10
-
-
-
-#define BDC_PROTO_VER_1 1
-#define BDC_PROTO_VER 2
+#define BDC_FLAG2_FC_FLAG 0x10 /* flag to indicate if pkt contains */
+ /* FLOW CONTROL info only */
+/* version numbers */
+#define BDC_PROTO_VER_1 1 /* Old Protocol version */
+#define BDC_PROTO_VER 2 /* Protocol version */
+/* flags2.if field access macros */
#define BDC_GET_IF_IDX(hdr) \
((int)((((hdr)->flags2) & BDC_FLAG2_IF_MASK) >> BDC_FLAG2_IF_SHIFT))
#define BDC_SET_IF_IDX(hdr, idx) \
((hdr)->flags = (((hdr)->flags & ~BDC_FLAG_PAD_MASK) | \
(((idx) & BDC_FLAG_PAD_IDX) << BDC_FLAG_PAD_SHIFT)))
-#endif
+#endif /* _bcmcdc_h_ */
/*
* Misc system wide definitions
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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 366265 2012-11-01 20:08:27Z $
+ * $Id: bcmdefs.h 381895 2013-01-30 07:06:40Z $
*/
#ifndef _bcmdefs_h_
#define _bcmdefs_h_
+/*
+ * One doesn't need to include this file explicitly, gets included automatically if
+ * typedefs.h is included.
+ */
-
-
+/* Use BCM_REFERENCE to suppress warnings about intentionally-unused function
+ * arguments or local variables.
+ */
#define BCM_REFERENCE(data) ((void)(data))
-
+/* Compile-time assert can be used in place of ASSERT if the expression evaluates
+ * to a constant at compile time.
+ */
#define STATIC_ASSERT(expr) { \
- \
+ /* Make sure the expression is constant. */ \
typedef enum { _STATIC_ASSERT_NOT_CONSTANT = (expr) } _static_assert_e; \
- \
+ /* Make sure the expression is true. */ \
typedef char STATIC_ASSERT_FAIL[(expr) ? 1 : -1]; \
}
-
+/* Reclaiming text and data :
+ * The following macros specify special linker sections that can be reclaimed
+ * after a system is considered 'up'.
+ * BCMATTACHFN is also used for detach functions (it's not worth having a BCMDETACHFN,
+ * as in most cases, the attach function calls the detach function to clean up on error).
+ */
#define bcmreclaimed 0
#define _data _data
#define BCMNMIATTACHFN(_fn) _fn
#define BCMNMIATTACHDATA(_data) _data
#define CONST const
-#ifndef BCMFASTPATH
#if defined(__ARM_ARCH_7A__)
+#define BCM47XX_CA9
+#else
+#undef BCM47XX_CA9
+#endif
+#ifndef BCMFASTPATH
+#if defined(BCM47XX_CA9)
#define BCMFASTPATH __attribute__ ((__section__ (".text.fastpath")))
#define BCMFASTPATH_HOST __attribute__ ((__section__ (".text.fastpath_host")))
#else
#define BCMFASTPATH
#define BCMFASTPATH_HOST
#endif
-#endif
-
+#endif /* BCMFASTPATH */
+/* Put some library data/code into ROM to reduce RAM requirements */
#define _data _data
#define BCMROMDAT_NAME(_data) _data
#define _fn _fn
#define BCMROMDAT_APATCH(data)
#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
-
-
+/* Bus types */
+#define SI_BUS 0 /* SOC Interconnect */
+#define PCI_BUS 1 /* PCI target */
+#define PCMCIA_BUS 2 /* PCMCIA target */
+#define SDIO_BUS 3 /* SDIO target */
+#define JTAG_BUS 4 /* JTAG */
+#define USB_BUS 5 /* USB (does not support R/W REG) */
+#define SPI_BUS 6 /* gSPI target */
+#define RPC_BUS 7 /* RPC target */
+
+/* Allows size optimization for single-bus image */
#ifdef BCMBUSTYPE
#define BUSTYPE(bus) (BCMBUSTYPE)
#else
#define BUSTYPE(bus) (bus)
#endif
-
+/* Allows size optimization for single-backplane image */
#ifdef BCMCHIPTYPE
#define CHIPTYPE(bus) (BCMCHIPTYPE)
#else
#endif
-
+/* Allows size optimization for SPROM support */
#if defined(BCMSPROMBUS)
#define SPROMBUS (BCMSPROMBUS)
#elif defined(SI_PCMCIA_SROM)
#define SPROMBUS (PCI_BUS)
#endif
-
+/* Allows size optimization for single-chip image */
#ifdef BCMCHIPID
#define CHIPID(chip) (BCMCHIPID)
#else
#define CHIPREV(rev) (rev)
#endif
+/* Defines for DMA Address Width - Shared between OSL and HNDDMA */
+#define DMADDR_MASK_32 0x0 /* Address mask for 32-bits */
+#define DMADDR_MASK_30 0xc0000000 /* Address mask for 30-bits */
+#define DMADDR_MASK_0 0xffffffff /* Address mask for 0-bits (hi-part) */
-#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 /* 30-bit addressing capability */
+#define DMADDRWIDTH_32 32 /* 32-bit addressing capability */
+#define DMADDRWIDTH_63 63 /* 64-bit addressing capability */
+#define DMADDRWIDTH_64 64 /* 64-bit addressing capability */
#ifdef BCMDMA64OSL
typedef struct {
do { \
(_pa) = (_val); \
} while (0)
-#endif
-
+#endif /* BCMDMA64OSL */
+/* One physical DMA segment */
typedef struct {
dmaaddr_t addr;
uint32 length;
typedef struct {
- void *oshdmah;
- uint origsize;
+ void *oshdmah; /* Opaque handle for OSL to store its information */
+ uint origsize; /* Size of the virtual packet */
uint nsegs;
hnddma_seg_t segs[MAX_DMA_SEGS];
} hnddma_seg_map_t;
-
+/* packet headroom necessary to accommodate the largest header in the system, (i.e TXOFF).
+ * By doing, we avoid the need to allocate an extra buffer for the header when bridging to WL.
+ * There is a compile time check in wlc.c which ensure that this value is at least as big
+ * as TXOFF. This value is used in dma_rxfill (hnddma.c).
+ */
#if defined(BCM_RPC_NOCOPY) || defined(BCM_RCP_TXNOCOPY)
-
+/* add 40 bytes to allow for extra RPC header and info */
#define BCMEXTRAHDROOM 260
-#else
+#else /* BCM_RPC_NOCOPY || BCM_RPC_TXNOCOPY */
+#if defined(BCM47XX_CA9)
+#define BCMEXTRAHDROOM 224
+#else
#define BCMEXTRAHDROOM 204
-#endif
-
+#endif /* linux && BCM47XX_CA9 */
+#endif /* BCM_RPC_NOCOPY || BCM_RPC_TXNOCOPY */
+/* Packet alignment for most efficient SDIO (can change based on platform) */
#ifndef SDALIGN
#define SDALIGN 32
#endif
-
+/* Headroom required for dongle-to-host communication. Packets allocated
+ * locally in the dongle (e.g. for CDC ioctls or RNDIS messages) should
+ * leave this much room in front for low-level message headers which may
+ * be needed to get across the dongle bus to the host. (These messages
+ * don't go over the network, so room for the full WL header above would
+ * be a waste.).
+*/
#define BCMDONGLEHDRSZ 12
#define BCMDONGLEPADSZ 16
#define BCMASSERT_SUPPORT
#endif
-
+/* Macros for doing definition and get/set of bitfields
+ * Usage example, e.g. a three-bit field (bits 4-6):
+ * #define <NAME>_M BITFIELD_MASK(3)
+ * #define <NAME>_S 4
+ * ...
+ * regval = R_REG(osh, ®s->regfoo);
+ * field = GFIELD(regval, <NAME>);
+ * regval = SFIELD(regval, <NAME>, 1);
+ * W_REG(osh, ®s->regfoo, regval);
+ */
#define BITFIELD_MASK(width) \
(((unsigned)1 << (width)) - 1)
#define GFIELD(val, field) \
(((val) & (~(field ## _M << field ## _S))) | \
((unsigned)(bits) << field ## _S))
-
+/* define BCMSMALL to remove misc features for memory-constrained environments */
#ifdef BCMSMALL
#undef BCMSPACE
-#define bcmspace FALSE
+#define bcmspace FALSE /* if (bcmspace) code is discarded */
#else
#define BCMSPACE
-#define bcmspace TRUE
+#define bcmspace TRUE /* if (bcmspace) code is retained */
#endif
-
+/* Max. nvram variable table size */
#define MAXSZ_NVRAM_VARS 4096
-
+/* Max size for reclaimable NVRAM array */
#ifdef DL_NVRAM
#define NVRAM_ARRAY_MAXSIZE DL_NVRAM
#else
#define NVRAM_ARRAY_MAXSIZE MAXSZ_NVRAM_VARS
-#endif
+#endif /* DL_NVRAM */
#ifdef BCMUSBDEV_ENABLED
extern uint32 gFWID;
#endif
-#endif
+#endif /* _bcmdefs_h_ */
--- /dev/null
+/*
+ * Broadcom device-specific manifest constants.
+ *
+ * Copyright (C) 1999-2013, 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 401468 2013-05-10 13:46:09Z $
+ */
+
+#ifndef _BCMDEVS_H
+#define _BCMDEVS_H
+
+/* PCI vendor IDs */
+#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 /* Silicon Image, used by Arasan SDIO Host */
+#define VENDOR_BUFFALO 0x1154 /* Buffalo vendor id */
+#define VENDOR_TI 0x104c /* Texas Instruments */
+#define VENDOR_RICOH 0x1180 /* Ricoh */
+#define VENDOR_JMICRON 0x197b
+
+
+/* PCMCIA vendor IDs */
+#define VENDOR_BROADCOM_PCMCIA 0x02d0
+
+/* SDIO vendor IDs */
+#define VENDOR_BROADCOM_SDIO 0x00BF
+
+/* DONGLE VID/PIDs */
+#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_BL_PID_43143 0xbd1e
+#define BCM_DNGL_BL_PID_43242 0xbd1f
+#define BCM_DNGL_BL_PID_43342 0xbd21
+#define BCM_DNGL_BL_PID_4335 0xbd20
+#define BCM_DNGL_BL_PID_4350 0xbd23
+#define BCM_DNGL_BL_PID_43341 0xbd22
+
+#define BCM_DNGL_BDC_PID 0x0bdc
+#define BCM_DNGL_JTAG_PID 0x4a44
+
+/* HW USB BLOCK [CPULESS USB] PIDs */
+#define BCM_HWUSB_PID_43239 43239
+
+/* PCI Device IDs */
+#define BCM4210_DEVICE_ID 0x1072 /* never used */
+#define BCM4230_DEVICE_ID 0x1086 /* never used */
+#define BCM4401_ENET_ID 0x170c /* 4401b0 production enet cards */
+#define BCM3352_DEVICE_ID 0x3352 /* bcm3352 device id */
+#define BCM3360_DEVICE_ID 0x3360 /* bcm3360 device id */
+#define BCM4211_DEVICE_ID 0x4211
+#define BCM4231_DEVICE_ID 0x4231
+#define BCM4303_D11B_ID 0x4303 /* 4303 802.11b */
+#define BCM4311_D11G_ID 0x4311 /* 4311 802.11b/g id */
+#define BCM4311_D11DUAL_ID 0x4312 /* 4311 802.11a/b/g id */
+#define BCM4311_D11A_ID 0x4313 /* 4311 802.11a id */
+#define BCM4328_D11DUAL_ID 0x4314 /* 4328/4312 802.11a/g id */
+#define BCM4328_D11G_ID 0x4315 /* 4328/4312 802.11g id */
+#define BCM4328_D11A_ID 0x4316 /* 4328/4312 802.11a id */
+#define BCM4318_D11G_ID 0x4318 /* 4318 802.11b/g id */
+#define BCM4318_D11DUAL_ID 0x4319 /* 4318 802.11a/b/g id */
+#define BCM4318_D11A_ID 0x431a /* 4318 802.11a id */
+#define BCM4325_D11DUAL_ID 0x431b /* 4325 802.11a/g id */
+#define BCM4325_D11G_ID 0x431c /* 4325 802.11g id */
+#define BCM4325_D11A_ID 0x431d /* 4325 802.11a id */
+#define BCM4306_D11G_ID 0x4320 /* 4306 802.11g */
+#define BCM4306_D11A_ID 0x4321 /* 4306 802.11a */
+#define BCM4306_UART_ID 0x4322 /* 4306 uart */
+#define BCM4306_V90_ID 0x4323 /* 4306 v90 codec */
+#define BCM4306_D11DUAL_ID 0x4324 /* 4306 dual A+B */
+#define BCM4306_D11G_ID2 0x4325 /* BCM4306_D11G_ID; INF w/loose binding war */
+#define BCM4321_D11N_ID 0x4328 /* 4321 802.11n dualband id */
+#define BCM4321_D11N2G_ID 0x4329 /* 4321 802.11n 2.4Ghz band id */
+#define BCM4321_D11N5G_ID 0x432a /* 4321 802.11n 5Ghz band id */
+#define BCM4322_D11N_ID 0x432b /* 4322 802.11n dualband device */
+#define BCM4322_D11N2G_ID 0x432c /* 4322 802.11n 2.4GHz device */
+#define BCM4322_D11N5G_ID 0x432d /* 4322 802.11n 5GHz device */
+#define BCM4329_D11N_ID 0x432e /* 4329 802.11n dualband device */
+#define BCM4329_D11N2G_ID 0x432f /* 4329 802.11n 2.4G device */
+#define BCM4329_D11N5G_ID 0x4330 /* 4329 802.11n 5G device */
+#define BCM4315_D11DUAL_ID 0x4334 /* 4315 802.11a/g id */
+#define BCM4315_D11G_ID 0x4335 /* 4315 802.11g id */
+#define BCM4315_D11A_ID 0x4336 /* 4315 802.11a id */
+#define BCM4319_D11N_ID 0x4337 /* 4319 802.11n dualband device */
+#define BCM4319_D11N2G_ID 0x4338 /* 4319 802.11n 2.4G device */
+#define BCM4319_D11N5G_ID 0x4339 /* 4319 802.11n 5G device */
+#define BCM43231_D11N2G_ID 0x4340 /* 43231 802.11n 2.4GHz device */
+#define BCM43221_D11N2G_ID 0x4341 /* 43221 802.11n 2.4GHz device */
+#define BCM43222_D11N_ID 0x4350 /* 43222 802.11n dualband device */
+#define BCM43222_D11N2G_ID 0x4351 /* 43222 802.11n 2.4GHz device */
+#define BCM43222_D11N5G_ID 0x4352 /* 43222 802.11n 5GHz device */
+#define BCM43224_D11N_ID 0x4353 /* 43224 802.11n dualband device */
+#define BCM43224_D11N_ID_VEN1 0x0576 /* Vendor specific 43224 802.11n db device */
+#define BCM43226_D11N_ID 0x4354 /* 43226 802.11n dualband device */
+#define BCM43236_D11N_ID 0x4346 /* 43236 802.11n dualband device */
+#define BCM43236_D11N2G_ID 0x4347 /* 43236 802.11n 2.4GHz device */
+#define BCM43236_D11N5G_ID 0x4348 /* 43236 802.11n 5GHz device */
+#define BCM43225_D11N2G_ID 0x4357 /* 43225 802.11n 2.4GHz device */
+#define BCM43421_D11N_ID 0xA99D /* 43421 802.11n dualband device */
+#define BCM4313_D11N2G_ID 0x4727 /* 4313 802.11n 2.4G device */
+#define BCM4330_D11N_ID 0x4360 /* 4330 802.11n dualband device */
+#define BCM4330_D11N2G_ID 0x4361 /* 4330 802.11n 2.4G device */
+#define BCM4330_D11N5G_ID 0x4362 /* 4330 802.11n 5G device */
+#define BCM4336_D11N_ID 0x4343 /* 4336 802.11n 2.4GHz device */
+#define BCM6362_D11N_ID 0x435f /* 6362 802.11n dualband device */
+#define BCM6362_D11N2G_ID 0x433f /* 6362 802.11n 2.4Ghz band id */
+#define BCM6362_D11N5G_ID 0x434f /* 6362 802.11n 5Ghz band id */
+#define BCM4331_D11N_ID 0x4331 /* 4331 802.11n dualband id */
+#define BCM4331_D11N2G_ID 0x4332 /* 4331 802.11n 2.4Ghz band id */
+#define BCM4331_D11N5G_ID 0x4333 /* 4331 802.11n 5Ghz band id */
+#define BCM43237_D11N_ID 0x4355 /* 43237 802.11n dualband device */
+#define BCM43237_D11N5G_ID 0x4356 /* 43237 802.11n 5GHz device */
+#define BCM43227_D11N2G_ID 0x4358 /* 43228 802.11n 2.4GHz device */
+#define BCM43228_D11N_ID 0x4359 /* 43228 802.11n DualBand device */
+#define BCM43228_D11N5G_ID 0x435a /* 43228 802.11n 5GHz device */
+#define BCM43362_D11N_ID 0x4363 /* 43362 802.11n 2.4GHz device */
+#define BCM43239_D11N_ID 0x4370 /* 43239 802.11n dualband device */
+#define BCM4324_D11N_ID 0x4374 /* 4324 802.11n dualband device */
+#define BCM43217_D11N2G_ID 0x43a9 /* 43217 802.11n 2.4GHz device */
+#define BCM43131_D11N2G_ID 0x43aa /* 43131 802.11n 2.4GHz device */
+#define BCM4314_D11N2G_ID 0x4364 /* 4314 802.11n 2.4G device */
+#define BCM43142_D11N2G_ID 0x4365 /* 43142 802.11n 2.4G device */
+#define BCM43143_D11N2G_ID 0x4366 /* 43143 802.11n 2.4G device */
+#define BCM4334_D11N_ID 0x4380 /* 4334 802.11n dualband device */
+#define BCM4334_D11N2G_ID 0x4381 /* 4334 802.11n 2.4G device */
+#define BCM4334_D11N5G_ID 0x4382 /* 4334 802.11n 5G device */
+#define BCM43342_D11N_ID 0x4383 /* 43342 802.11n dualband device */
+#define BCM43342_D11N2G_ID 0x4384 /* 43342 802.11n 2.4G device */
+#define BCM43342_D11N5G_ID 0x4385 /* 43342 802.11n 5G device */
+#define BCM43341_D11N_ID 0x4386 /* 43341 802.11n dualband device */
+#define BCM43341_D11N2G_ID 0x4387 /* 43341 802.11n 2.4G device */
+#define BCM43341_D11N5G_ID 0x4388 /* 43341 802.11n 5G device */
+#define BCM4360_D11AC_ID 0x43a0
+#define BCM4360_D11AC2G_ID 0x43a1
+#define BCM4360_D11AC5G_ID 0x43a2
+#define BCM4335_D11AC_ID 0x43ae
+#define BCM4335_D11AC2G_ID 0x43af
+#define BCM4335_D11AC5G_ID 0x43b0
+#define BCM4352_D11AC_ID 0x43b1 /* 4352 802.11ac dualband device */
+#define BCM4352_D11AC2G_ID 0x43b2 /* 4352 802.11ac 2.4G device */
+#define BCM4352_D11AC5G_ID 0x43b3 /* 4352 802.11ac 5G device */
+
+/* PCI Subsystem ID */
+#define BCM943228HMB_SSID_VEN1 0x0607
+#define BCM94313HMGBL_SSID_VEN1 0x0608
+#define BCM94313HMG_SSID_VEN1 0x0609
+#define BCM943142HM_SSID_VEN1 0x0611
+
+#define BCM43143_D11N2G_ID 0x4366 /* 43143 802.11n 2.4G device */
+
+#define BCM43242_D11N_ID 0x4367 /* 43242 802.11n dualband device */
+#define BCM43242_D11N2G_ID 0x4368 /* 43242 802.11n 2.4G device */
+#define BCM43242_D11N5G_ID 0x4369 /* 43242 802.11n 5G device */
+
+#define BCM4350_D11AC_ID 0x43a3
+#define BCM4350_D11AC2G_ID 0x43a4
+#define BCM4350_D11AC5G_ID 0x43a5
+
+
+#define BCMGPRS_UART_ID 0x4333 /* Uart id used by 4306/gprs card */
+#define BCMGPRS2_UART_ID 0x4344 /* Uart id used by 4306/gprs card */
+#define FPGA_JTAGM_ID 0x43f0 /* FPGA jtagm device id */
+#define BCM_JTAGM_ID 0x43f1 /* BCM jtagm device id */
+#define SDIOH_FPGA_ID 0x43f2 /* sdio host fpga */
+#define BCM_SDIOH_ID 0x43f3 /* BCM sdio host id */
+#define SDIOD_FPGA_ID 0x43f4 /* sdio device fpga */
+#define SPIH_FPGA_ID 0x43f5 /* PCI SPI Host Controller FPGA */
+#define BCM_SPIH_ID 0x43f6 /* Synopsis SPI Host Controller */
+#define MIMO_FPGA_ID 0x43f8 /* FPGA mimo minimacphy device id */
+#define BCM_JTAGM2_ID 0x43f9 /* BCM alternate jtagm device id */
+#define SDHCI_FPGA_ID 0x43fa /* Standard SDIO Host Controller FPGA */
+#define BCM4402_ENET_ID 0x4402 /* 4402 enet */
+#define BCM4402_V90_ID 0x4403 /* 4402 v90 codec */
+#define BCM4410_DEVICE_ID 0x4410 /* bcm44xx family pci iline */
+#define BCM4412_DEVICE_ID 0x4412 /* bcm44xx family pci enet */
+#define BCM4430_DEVICE_ID 0x4430 /* bcm44xx family cardbus iline */
+#define BCM4432_DEVICE_ID 0x4432 /* bcm44xx family cardbus enet */
+#define BCM4704_ENET_ID 0x4706 /* 4704 enet (Use 47XX_ENET_ID instead!) */
+#define BCM4710_DEVICE_ID 0x4710 /* 4710 primary function 0 */
+#define BCM47XX_AUDIO_ID 0x4711 /* 47xx audio codec */
+#define BCM47XX_V90_ID 0x4712 /* 47xx v90 codec */
+#define BCM47XX_ENET_ID 0x4713 /* 47xx enet */
+#define BCM47XX_EXT_ID 0x4714 /* 47xx external i/f */
+#define BCM47XX_GMAC_ID 0x4715 /* 47xx Unimac based GbE */
+#define BCM47XX_USBH_ID 0x4716 /* 47xx usb host */
+#define BCM47XX_USBD_ID 0x4717 /* 47xx usb device */
+#define BCM47XX_IPSEC_ID 0x4718 /* 47xx ipsec */
+#define BCM47XX_ROBO_ID 0x4719 /* 47xx/53xx roboswitch core */
+#define BCM47XX_USB20H_ID 0x471a /* 47xx usb 2.0 host */
+#define BCM47XX_USB20D_ID 0x471b /* 47xx usb 2.0 device */
+#define BCM47XX_ATA100_ID 0x471d /* 47xx parallel ATA */
+#define BCM47XX_SATAXOR_ID 0x471e /* 47xx serial ATA & XOR DMA */
+#define BCM47XX_GIGETH_ID 0x471f /* 47xx GbE (5700) */
+#define BCM4712_MIPS_ID 0x4720 /* 4712 base devid */
+#define BCM4716_DEVICE_ID 0x4722 /* 4716 base devid */
+#define BCM47XX_USB30H_ID 0x472a /* 47xx usb 3.0 host */
+#define BCM47XX_USB30D_ID 0x472b /* 47xx usb 3.0 device */
+#define BCM47XX_SMBUS_EMU_ID 0x47fe /* 47xx emulated SMBus device */
+#define BCM47XX_XOR_EMU_ID 0x47ff /* 47xx emulated XOR engine */
+#define EPI41210_DEVICE_ID 0xa0fa /* bcm4210 */
+#define EPI41230_DEVICE_ID 0xa10e /* bcm4230 */
+#define JINVANI_SDIOH_ID 0x4743 /* Jinvani SDIO Gold Host */
+#define BCM27XX_SDIOH_ID 0x2702 /* BCM27xx Standard SDIO Host */
+#define PCIXX21_FLASHMEDIA_ID 0x803b /* TI PCI xx21 Standard Host Controller */
+#define PCIXX21_SDIOH_ID 0x803c /* TI PCI xx21 Standard Host Controller */
+#define R5C822_SDIOH_ID 0x0822 /* Ricoh Co Ltd R5C822 SD/SDIO/MMC/MS/MSPro Host */
+#define JMICRON_SDIOH_ID 0x2381 /* JMicron Standard SDIO Host Controller */
+
+/* Chip IDs */
+#define BCM4306_CHIP_ID 0x4306 /* 4306 chipcommon chipid */
+#define BCM4311_CHIP_ID 0x4311 /* 4311 PCIe 802.11a/b/g */
+#define BCM43111_CHIP_ID 43111 /* 43111 chipcommon chipid (OTP chipid) */
+#define BCM43112_CHIP_ID 43112 /* 43112 chipcommon chipid (OTP chipid) */
+#define BCM4312_CHIP_ID 0x4312 /* 4312 chipcommon chipid */
+#define BCM4313_CHIP_ID 0x4313 /* 4313 chip id */
+#define BCM43131_CHIP_ID 43131 /* 43131 chip id (OTP chipid) */
+#define BCM4315_CHIP_ID 0x4315 /* 4315 chip id */
+#define BCM4318_CHIP_ID 0x4318 /* 4318 chipcommon chipid */
+#define BCM4319_CHIP_ID 0x4319 /* 4319 chip id */
+#define BCM4320_CHIP_ID 0x4320 /* 4320 chipcommon chipid */
+#define BCM4321_CHIP_ID 0x4321 /* 4321 chipcommon chipid */
+#define BCM43217_CHIP_ID 43217 /* 43217 chip id (OTP chipid) */
+#define BCM4322_CHIP_ID 0x4322 /* 4322 chipcommon chipid */
+#define BCM43221_CHIP_ID 43221 /* 43221 chipcommon chipid (OTP chipid) */
+#define BCM43222_CHIP_ID 43222 /* 43222 chipcommon chipid */
+#define BCM43224_CHIP_ID 43224 /* 43224 chipcommon chipid */
+#define BCM43225_CHIP_ID 43225 /* 43225 chipcommon chipid */
+#define BCM43227_CHIP_ID 43227 /* 43227 chipcommon chipid */
+#define BCM43228_CHIP_ID 43228 /* 43228 chipcommon chipid */
+#define BCM43226_CHIP_ID 43226 /* 43226 chipcommon chipid */
+#define BCM43231_CHIP_ID 43231 /* 43231 chipcommon chipid (OTP chipid) */
+#define BCM43234_CHIP_ID 43234 /* 43234 chipcommon chipid */
+#define BCM43235_CHIP_ID 43235 /* 43235 chipcommon chipid */
+#define BCM43236_CHIP_ID 43236 /* 43236 chipcommon chipid */
+#define BCM43237_CHIP_ID 43237 /* 43237 chipcommon chipid */
+#define BCM43238_CHIP_ID 43238 /* 43238 chipcommon chipid */
+#define BCM43239_CHIP_ID 43239 /* 43239 chipcommon chipid */
+#define BCM43420_CHIP_ID 43420 /* 43222 chipcommon chipid (OTP, RBBU) */
+#define BCM43421_CHIP_ID 43421 /* 43224 chipcommon chipid (OTP, RBBU) */
+#define BCM43428_CHIP_ID 43428 /* 43228 chipcommon chipid (OTP, RBBU) */
+#define BCM43431_CHIP_ID 43431 /* 4331 chipcommon chipid (OTP, RBBU) */
+#define BCM43460_CHIP_ID 43460 /* 4360 chipcommon chipid (OTP, RBBU) */
+#define BCM4325_CHIP_ID 0x4325 /* 4325 chip id */
+#define BCM4328_CHIP_ID 0x4328 /* 4328 chip id */
+#define BCM4329_CHIP_ID 0x4329 /* 4329 chipcommon chipid */
+#define BCM4331_CHIP_ID 0x4331 /* 4331 chipcommon chipid */
+#define BCM4336_CHIP_ID 0x4336 /* 4336 chipcommon chipid */
+#define BCM43362_CHIP_ID 43362 /* 43362 chipcommon chipid */
+#define BCM4330_CHIP_ID 0x4330 /* 4330 chipcommon chipid */
+#define BCM6362_CHIP_ID 0x6362 /* 6362 chipcommon chipid */
+#define BCM4314_CHIP_ID 0x4314 /* 4314 chipcommon chipid */
+#define BCM43142_CHIP_ID 43142 /* 43142 chipcommon chipid */
+#define BCM43143_CHIP_ID 43143 /* 43143 chipcommon chipid */
+#define BCM4324_CHIP_ID 0x4324 /* 4324 chipcommon chipid */
+#define BCM43242_CHIP_ID 43242 /* 43242 chipcommon chipid */
+#define BCM43243_CHIP_ID 43243 /* 43243 chipcommon chipid */
+#define BCM4334_CHIP_ID 0x4334 /* 4334 chipcommon chipid */
+#define BCM4335_CHIP_ID 0x4335 /* 4335 chipcommon chipid */
+#define BCM4339_CHIP_ID 0x4339 /* 4339 chipcommon chipid */
+#define BCM4360_CHIP_ID 0x4360 /* 4360 chipcommon chipid */
+#define BCM4352_CHIP_ID 0x4352 /* 4352 chipcommon chipid */
+#define BCM43526_CHIP_ID 0xAA06
+#define BCM43341_CHIP_ID 43341 /* 43341 chipcommon chipid */
+#define BCM43342_CHIP_ID 43342 /* 43342 chipcommon chipid */
+#define BCM4350_CHIP_ID 0x4350 /* 4350 chipcommon chipid */
+
+#define BCM4342_CHIP_ID 4342 /* 4342 chipcommon chipid (OTP, RBBU) */
+#define BCM4402_CHIP_ID 0x4402 /* 4402 chipid */
+#define BCM4704_CHIP_ID 0x4704 /* 4704 chipcommon chipid */
+#define BCM4706_CHIP_ID 0x5300 /* 4706 chipcommon chipid */
+#define BCM4707_CHIP_ID 53010 /* 4707 chipcommon chipid */
+#define BCM53018_CHIP_ID 53018 /* 53018 chipcommon chipid */
+#define BCM4707_CHIP(chipid) (((chipid) == BCM4707_CHIP_ID) || ((chipid) == BCM53018_CHIP_ID))
+#define BCM4710_CHIP_ID 0x4710 /* 4710 chipid */
+#define BCM4712_CHIP_ID 0x4712 /* 4712 chipcommon chipid */
+#define BCM4716_CHIP_ID 0x4716 /* 4716 chipcommon chipid */
+#define BCM47162_CHIP_ID 47162 /* 47162 chipcommon chipid */
+#define BCM4748_CHIP_ID 0x4748 /* 4716 chipcommon chipid (OTP, RBBU) */
+#define BCM4749_CHIP_ID 0x4749 /* 5357 chipcommon chipid (OTP, RBBU) */
+#define BCM4785_CHIP_ID 0x4785 /* 4785 chipcommon chipid */
+#define BCM5350_CHIP_ID 0x5350 /* 5350 chipcommon chipid */
+#define BCM5352_CHIP_ID 0x5352 /* 5352 chipcommon chipid */
+#define BCM5354_CHIP_ID 0x5354 /* 5354 chipcommon chipid */
+#define BCM5365_CHIP_ID 0x5365 /* 5365 chipcommon chipid */
+#define BCM5356_CHIP_ID 0x5356 /* 5356 chipcommon chipid */
+#define BCM5357_CHIP_ID 0x5357 /* 5357 chipcommon chipid */
+#define BCM53572_CHIP_ID 53572 /* 53572 chipcommon chipid */
+
+/* Package IDs */
+#define BCM4303_PKG_ID 2 /* 4303 package id */
+#define BCM4309_PKG_ID 1 /* 4309 package id */
+#define BCM4712LARGE_PKG_ID 0 /* 340pin 4712 package id */
+#define BCM4712SMALL_PKG_ID 1 /* 200pin 4712 package id */
+#define BCM4712MID_PKG_ID 2 /* 225pin 4712 package id */
+#define BCM4328USBD11G_PKG_ID 2 /* 4328 802.11g USB package id */
+#define BCM4328USBDUAL_PKG_ID 3 /* 4328 802.11a/g USB package id */
+#define BCM4328SDIOD11G_PKG_ID 4 /* 4328 802.11g SDIO package id */
+#define BCM4328SDIODUAL_PKG_ID 5 /* 4328 802.11a/g SDIO package id */
+#define BCM4329_289PIN_PKG_ID 0 /* 4329 289-pin package id */
+#define BCM4329_182PIN_PKG_ID 1 /* 4329N 182-pin package id */
+#define BCM5354E_PKG_ID 1 /* 5354E package id */
+#define BCM4716_PKG_ID 8 /* 4716 package id */
+#define BCM4717_PKG_ID 9 /* 4717 package id */
+#define BCM4718_PKG_ID 10 /* 4718 package id */
+#define BCM5356_PKG_NONMODE 1 /* 5356 package without nmode suppport */
+#define BCM5358U_PKG_ID 8 /* 5358U package id */
+#define BCM5358_PKG_ID 9 /* 5358 package id */
+#define BCM47186_PKG_ID 10 /* 47186 package id */
+#define BCM5357_PKG_ID 11 /* 5357 package id */
+#define BCM5356U_PKG_ID 12 /* 5356U package id */
+#define BCM53572_PKG_ID 8 /* 53572 package id */
+#define BCM5357C0_PKG_ID 8 /* 5357c0 package id (the same as 53572) */
+#define BCM47188_PKG_ID 9 /* 47188 package id */
+#define BCM5358C0_PKG_ID 0xa /* 5358c0 package id */
+#define BCM5356C0_PKG_ID 0xb /* 5356c0 package id */
+#define BCM4331TT_PKG_ID 8 /* 4331 12x12 package id */
+#define BCM4331TN_PKG_ID 9 /* 4331 12x9 package id */
+#define BCM4331TNA0_PKG_ID 0xb /* 4331 12x9 package id */
+#define BCM4706L_PKG_ID 1 /* 4706L package id */
+
+#define HDLSIM5350_PKG_ID 1 /* HDL simulator package id for a 5350 */
+#define HDLSIM_PKG_ID 14 /* HDL simulator package id */
+#define HWSIM_PKG_ID 15 /* Hardware simulator package id */
+#define BCM43224_FAB_CSM 0x8 /* the chip is manufactured by CSM */
+#define BCM43224_FAB_SMIC 0xa /* the chip is manufactured by SMIC */
+#define BCM4336_WLBGA_PKG_ID 0x8
+#define BCM4330_WLBGA_PKG_ID 0x0
+#define BCM4314PCIE_ARM_PKG_ID (8 | 0) /* 4314 QFN PCI package id, bit 3 tie high */
+#define BCM4314SDIO_PKG_ID (8 | 1) /* 4314 QFN SDIO package id */
+#define BCM4314PCIE_PKG_ID (8 | 2) /* 4314 QFN PCI (ARM-less) package id */
+#define BCM4314SDIO_ARM_PKG_ID (8 | 3) /* 4314 QFN SDIO (ARM-less) package id */
+#define BCM4314SDIO_FPBGA_PKG_ID (8 | 4) /* 4314 FpBGA SDIO package id */
+#define BCM4314DEV_PKG_ID (8 | 6) /* 4314 Developement package id */
+
+#define BCM4707_PKG_ID 1 /* 4707 package id */
+#define BCM4708_PKG_ID 2 /* 4708 package id */
+#define BCM4709_PKG_ID 0 /* 4709 package id */
+
+#define PCIXX21_FLASHMEDIA0_ID 0x8033 /* TI PCI xx21 Standard Host Controller */
+#define PCIXX21_SDIOH0_ID 0x8034 /* TI PCI xx21 Standard Host Controller */
+
+#define BCM4335_WLCSP_PKG_ID (0x0) /* WLCSP Module/Mobile SDIO/HSIC. */
+#define BCM4335_FCBGA_PKG_ID (0x1) /* FCBGA PC/Embeded/Media PCIE/SDIO */
+#define BCM4335_WLBGA_PKG_ID (0x2) /* WLBGA COB/Mobile SDIO/HSIC. */
+#define BCM4335_FCBGAD_PKG_ID (0x3) /* FCBGA Debug Debug/Dev All if's. */
+#define BCM4335_PKG_MASK (0x3)
+
+/* boardflags */
+#define BFL_BTC2WIRE 0x00000001 /* old 2wire Bluetooth coexistence, OBSOLETE */
+#define BFL_BTCOEX 0x00000001 /* Board supports BTCOEX */
+#define BFL_PACTRL 0x00000002 /* Board has gpio 9 controlling the PA */
+#define BFL_AIRLINEMODE 0x00000004 /* Board implements gpio 13 radio disable indication, UNUSED */
+#define BFL_ADCDIV 0x00000008 /* Board has the rssi ADC divider */
+#define BFL_DIS_256QAM 0x00000008
+#define BFL_ENETROBO 0x00000010 /* Board has robo switch or core */
+#define BFL_NOPLLDOWN 0x00000020 /* Not ok to power down the chip pll and oscillator */
+#define BFL_CCKHIPWR 0x00000040 /* Can do high-power CCK transmission */
+#define BFL_ENETADM 0x00000080 /* Board has ADMtek switch */
+#define BFL_ENETVLAN 0x00000100 /* Board has VLAN capability */
+#define BFL_LTECOEX 0x00000200 /* Board has LTE coex capability */
+#define BFL_NOPCI 0x00000400 /* Board leaves PCI floating */
+#define BFL_FEM 0x00000800 /* Board supports the Front End Module */
+#define BFL_EXTLNA 0x00001000 /* Board has an external LNA in 2.4GHz band */
+#define BFL_HGPA 0x00002000 /* Board has a high gain PA */
+#define BFL_BTC2WIRE_ALTGPIO 0x00004000
+/* Board's BTC 2wire is in the alternate gpios OBSLETE */
+#define BFL_ALTIQ 0x00008000 /* Alternate I/Q settings */
+#define BFL_NOPA 0x00010000 /* Board has no PA */
+#define BFL_RSSIINV 0x00020000 /* Board's RSSI uses positive slope(not TSSI) */
+#define BFL_PAREF 0x00040000 /* Board uses the PARef LDO */
+#define BFL_3TSWITCH 0x00080000 /* Board uses a triple throw switch shared with BT */
+#define BFL_PHASESHIFT 0x00100000 /* Board can support phase shifter */
+#define BFL_BUCKBOOST 0x00200000 /* Power topology uses BUCKBOOST */
+#define BFL_FEM_BT 0x00400000 /* Board has FEM and switch to share antenna w/ BT */
+#define BFL_RXCHAIN_OFF_BT 0x00400000 /* one rxchain is to be shut off when BT is active */
+#define BFL_NOCBUCK 0x00800000 /* Power topology doesn't use CBUCK */
+#define BFL_CCKFAVOREVM 0x01000000 /* Favor CCK EVM over spectral mask */
+#define BFL_PALDO 0x02000000 /* Power topology uses PALDO */
+#define BFL_LNLDO2_2P5 0x04000000 /* Select 2.5V as LNLDO2 output voltage */
+#define BFL_FASTPWR 0x08000000
+#define BFL_UCPWRCTL_MININDX 0x08000000 /* Enforce min power index to avoid FEM damage */
+#define BFL_EXTLNA_5GHz 0x10000000 /* Board has an external LNA in 5GHz band */
+#define BFL_TRSW_1by2 0x20000000 /* Board has 2 TRSW's in 1by2 designs */
+#define BFL_GAINBOOSTA01 0x20000000 /* 5g Gainboost for core0 and core1 */
+#define BFL_LO_TRSW_R_5GHz 0x40000000 /* In 5G do not throw TRSW to T for clipLO gain */
+#define BFL_ELNA_GAINDEF 0x80000000 /* Backoff InitGain based on elna_2g/5g field
+ * when this flag is set
+ */
+#define BFL_EXTLNA_TX 0x20000000 /* Temp boardflag to indicate to */
+
+/* boardflags2 */
+#define BFL2_RXBB_INT_REG_DIS 0x00000001 /* Board has an external rxbb regulator */
+#define BFL2_APLL_WAR 0x00000002 /* Flag to implement alternative A-band PLL settings */
+#define BFL2_TXPWRCTRL_EN 0x00000004 /* Board permits enabling TX Power Control */
+#define BFL2_2X4_DIV 0x00000008 /* Board supports the 2X4 diversity switch */
+#define BFL2_5G_PWRGAIN 0x00000010 /* Board supports 5G band power gain */
+#define BFL2_PCIEWAR_OVR 0x00000020 /* Board overrides ASPM and Clkreq settings */
+#define BFL2_CAESERS_BRD 0x00000040 /* Board is Caesers brd (unused by sw) */
+#define BFL2_BTC3WIRE 0x00000080 /* Board support legacy 3 wire or 4 wire */
+#define BFL2_BTCLEGACY 0x00000080 /* Board support legacy 3/4 wire, to replace
+ * BFL2_BTC3WIRE
+ */
+#define BFL2_SKWRKFEM_BRD 0x00000100 /* 4321mcm93 board uses Skyworks FEM */
+#define BFL2_SPUR_WAR 0x00000200 /* Board has a WAR for clock-harmonic spurs */
+#define BFL2_GPLL_WAR 0x00000400 /* Flag to narrow G-band PLL loop b/w */
+#define BFL2_TRISTATE_LED 0x00000800 /* Tri-state the LED */
+#define BFL2_SINGLEANT_CCK 0x00001000 /* Tx CCK pkts on Ant 0 only */
+#define BFL2_2G_SPUR_WAR 0x00002000 /* WAR to reduce and avoid clock-harmonic spurs in 2G */
+#define BFL2_BPHY_ALL_TXCORES 0x00004000 /* Transmit bphy frames using all tx cores */
+#define BFL2_FCC_BANDEDGE_WAR 0x00008000 /* Activates WAR to improve FCC bandedge performance */
+#define BFL2_GPLL_WAR2 0x00010000 /* Flag to widen G-band PLL loop b/w */
+#define BFL2_IPALVLSHIFT_3P3 0x00020000
+#define BFL2_INTERNDET_TXIQCAL 0x00040000 /* Use internal envelope detector for TX IQCAL */
+#define BFL2_XTALBUFOUTEN 0x00080000 /* Keep the buffered Xtal output from radio on */
+ /* Most drivers will turn it off without this flag */
+ /* to save power. */
+
+#define BFL2_ANAPACTRL_2G 0x00100000 /* 2G ext PAs are controlled by analog PA ctrl lines */
+#define BFL2_ANAPACTRL_5G 0x00200000 /* 5G ext PAs are controlled by analog PA ctrl lines */
+#define BFL2_ELNACTRL_TRSW_2G 0x00400000 /* AZW4329: 2G gmode_elna_gain controls TR Switch */
+#define BFL2_BT_SHARE_ANT0 0x00800000 /* WLAN/BT share antenna 0 */
+#define BFL2_BT_SHARE_BM_BIT0 0x00800000 /* bit 0 of WLAN/BT shared core bitmap */
+#define BFL2_TEMPSENSE_HIGHER 0x01000000 /* The tempsense threshold can sustain higher value
+ * than programmed. The exact delta is decided by
+ * driver per chip/boardtype. This can be used
+ * when tempsense qualification happens after shipment
+ */
+#define BFL2_BTC3WIREONLY 0x02000000 /* standard 3 wire btc only. 4 wire not supported */
+#define BFL2_PWR_NOMINAL 0x04000000 /* 0: power reduction on, 1: no power reduction */
+#define BFL2_EXTLNA_PWRSAVE 0x08000000 /* boardflag to enable ucode to apply power save */
+ /* ucode control of eLNA during Tx */
+#define BFL2_4313_RADIOREG 0x10000000
+ /* board rework */
+#define BFL2_DYNAMIC_VMID 0x10000000 /* boardflag to enable dynamic Vmid idle TSSI CAL */
+#define BFL2_SDR_EN 0x20000000 /* SDR enabled or disabled */
+#define BFL2_LNA1BYPFORTR2G 0x40000000 /* acphy, enable lna1 bypass for clip gain, 2g */
+#define BFL2_LNA1BYPFORTR5G 0x80000000 /* acphy, enable lna1 bypass for clip gain, 5g */
+
+/* SROM 11 - 11ac boardflag definitions */
+#define BFL_SROM11_BTCOEX 0x00000001 /* Board supports BTCOEX */
+#define BFL_SROM11_WLAN_BT_SH_XTL 0x00000002 /* bluetooth and wlan share same crystal */
+#define BFL_SROM11_EXTLNA 0x00001000 /* Board has an external LNA in 2.4GHz band */
+#define BFL_SROM11_EXTLNA_5GHz 0x10000000 /* Board has an external LNA in 5GHz band */
+#define BFL_SROM11_GAINBOOSTA01 0x20000000 /* 5g Gainboost for core0 and core1 */
+#define BFL2_SROM11_APLL_WAR 0x00000002 /* Flag to implement alternative A-band PLL settings */
+#define BFL2_SROM11_ANAPACTRL_2G 0x00100000 /* 2G ext PAs are ctrl-ed by analog PA ctrl lines */
+#define BFL2_SROM11_ANAPACTRL_5G 0x00200000 /* 5G ext PAs are ctrl-ed by analog PA ctrl lines */
+
+/* boardflags3 */
+#define BFL3_FEMCTRL_SUB 0x00000007 /* acphy, subrevs of femctrl on top of srom_femctrl */
+#define BFL3_RCAL_WAR 0x00000008 /* acphy, rcal war active on this board (4335a0) */
+#define BFL3_TXGAINTBLID 0x00000070 /* acphy, txgain table id */
+#define BFL3_TXGAINTBLID_SHIFT 0x4 /* acphy, txgain table id shift bit */
+#define BFL3_TSSI_DIV_WAR 0x00000080 /* acphy, Seperate paparam for 20/40/80 */
+#define BFL3_TSSI_DIV_WAR_SHIFT 0x7 /* acphy, Seperate paparam for 20/40/80 shift bit */
+#define BFL3_FEMTBL_FROM_NVRAM 0x00000100 /* acphy, femctrl table is read from nvram */
+#define BFL3_FEMTBL_FROM_NVRAM_SHIFT 0x8 /* acphy, femctrl table is read from nvram */
+#define BFL3_AGC_CFG_2G 0x00000200 /* acphy, gain control configuration for 2G */
+#define BFL3_AGC_CFG_5G 0x00000400 /* acphy, gain control configuration for 5G */
+#define BFL3_PPR_BIT_EXT 0x00000800 /* acphy, bit position for 1bit extension for ppr */
+#define BFL3_PPR_BIT_EXT_SHIFT 11 /* acphy, bit shift for 1bit extension for ppr */
+#define BFL3_BBPLL_SPR_MODE_DIS 0x00001000 /* acphy, disables bbpll spur modes */
+#define BFL3_RCAL_OTP_VAL_EN 0x00002000 /* acphy, to read rcal_trim value from otp */
+#define BFL3_2GTXGAINTBL_BLANK 0x00004000 /* acphy, blank the first X ticks of 2g gaintbl */
+#define BFL3_2GTXGAINTBL_BLANK_SHIFT 14 /* acphy, blank the first X ticks of 2g gaintbl */
+#define BFL3_5GTXGAINTBL_BLANK 0x00008000 /* acphy, blank the first X ticks of 5g gaintbl */
+#define BFL3_5GTXGAINTBL_BLANK_SHIFT 15 /* acphy, blank the first X ticks of 5g gaintbl */
+#define BFL3_BT_SHARE_BM_BIT1 0x40000000 /* bit 1 of WLAN/BT shared core bitmap */
+#define BFL3_PHASETRACK_MAX_ALPHABETA 0x00010000 /* acphy, to max out alpha,beta to 511 */
+#define BFL3_PHASETRACK_MAX_ALPHABETA_SHIFT 16 /* acphy, to max out alpha,beta to 511 */
+#define BFL3_BT_SHARE_BM_BIT1 0x40000000 /* bit 1 of WLAN/BT shared core bitmap */
+#define BFL3_EN_NONBRCM_TXBF 0x10000000 /* acphy, enable non-brcm TXBF */
+#define BFL3_EN_P2PLINK_TXBF 0x20000000 /* acphy, enable TXBF in p2p links */
+
+/* board specific GPIO assignment, gpio 0-3 are also customer-configurable led */
+#define BOARD_GPIO_BTC3W_IN 0x850 /* bit 4 is RF_ACTIVE, bit 6 is STATUS, bit 11 is PRI */
+#define BOARD_GPIO_BTC3W_OUT 0x020 /* bit 5 is TX_CONF */
+#define BOARD_GPIO_BTCMOD_IN 0x010 /* bit 4 is the alternate BT Coexistence Input */
+#define BOARD_GPIO_BTCMOD_OUT 0x020 /* bit 5 is the alternate BT Coexistence Out */
+#define BOARD_GPIO_BTC_IN 0x080 /* bit 7 is BT Coexistence Input */
+#define BOARD_GPIO_BTC_OUT 0x100 /* bit 8 is BT Coexistence Out */
+#define BOARD_GPIO_PACTRL 0x200 /* bit 9 controls the PA on new 4306 boards */
+#define BOARD_GPIO_12 0x1000 /* gpio 12 */
+#define BOARD_GPIO_13 0x2000 /* gpio 13 */
+#define BOARD_GPIO_BTC4_IN 0x0800 /* gpio 11, coex4, in */
+#define BOARD_GPIO_BTC4_BT 0x2000 /* gpio 12, coex4, bt active */
+#define BOARD_GPIO_BTC4_STAT 0x4000 /* gpio 14, coex4, status */
+#define BOARD_GPIO_BTC4_WLAN 0x8000 /* gpio 15, coex4, wlan active */
+#define BOARD_GPIO_1_WLAN_PWR 0x02 /* throttle WLAN power on X21 board */
+#define BOARD_GPIO_3_WLAN_PWR 0x08 /* throttle WLAN power on X28 board */
+#define BOARD_GPIO_4_WLAN_PWR 0x10 /* throttle WLAN power on X19 board */
+
+#define GPIO_BTC4W_OUT_4312 0x010 /* bit 4 is BT_IODISABLE */
+#define GPIO_BTC4W_OUT_43224 0x020 /* bit 5 is BT_IODISABLE */
+#define GPIO_BTC4W_OUT_43224_SHARED 0x0e0 /* bit 5 is BT_IODISABLE */
+#define GPIO_BTC4W_OUT_43225 0x0e0 /* bit 5 BT_IODISABLE, bit 6 SW_BT, bit 7 SW_WL */
+#define GPIO_BTC4W_OUT_43421 0x020 /* bit 5 is BT_IODISABLE */
+#define GPIO_BTC4W_OUT_4313 0x060 /* bit 5 SW_BT, bit 6 SW_WL */
+#define GPIO_BTC4W_OUT_4331_SHARED 0x010 /* GPIO 4 */
+
+#define PCI_CFG_GPIO_SCS 0x10 /* PCI config space bit 4 for 4306c0 slow clock source */
+#define PCI_CFG_GPIO_HWRAD 0x20 /* PCI config space GPIO 13 for hw radio disable */
+#define PCI_CFG_GPIO_XTAL 0x40 /* PCI config space GPIO 14 for Xtal power-up */
+#define PCI_CFG_GPIO_PLL 0x80 /* PCI config space GPIO 15 for PLL power-down */
+
+/* power control defines */
+#define PLL_DELAY 150 /* us pll on delay */
+#define FREF_DELAY 200 /* us fref change delay */
+#define MIN_SLOW_CLK 32 /* us Slow clock period */
+#define XTAL_ON_DELAY 1000 /* us crystal power-on delay */
+
+
+/* 43341 Boards */
+#define BCM943341WLABGS_SSID 0x062d
+
+/* 43342 Boards */
+#define BCM943342FCAGBI_SSID 0x0641
+
+/* # of GPIO pins */
+#define GPIO_NUMPINS 32
+
+/* These values are used by dhd host driver. */
+#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 RDL_RAM_SIZE_4360 0xA0000
+#define RDL_RAM_BASE_4360 0x60000000
+#define RDL_RAM_SIZE_43242 0x90000
+#define RDL_RAM_BASE_43242 0x60000000
+#define RDL_RAM_SIZE_43143 0x70000
+#define RDL_RAM_BASE_43143 0x60000000
+#define RDL_RAM_SIZE_4350 0xC0000
+#define RDL_RAM_BASE_4350 0x180800
+
+/* generic defs for nvram "muxenab" bits
+* Note: these differ for 4335a0. refer bcmchipc.h for specific mux options.
+*/
+#define MUXENAB_UART 0x00000001
+#define MUXENAB_GPIO 0x00000002
+#define MUXENAB_ERCX 0x00000004 /* External Radio BT coex */
+#define MUXENAB_JTAG 0x00000008
+#define MUXENAB_HOST_WAKE 0x00000010 /* configure GPIO for SDIO host_wake */
+#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 /* configure alternative GPIO for SDIO host_wake */
+
+/* Boot flags */
+#define FLASH_KERNEL_NFLASH 0x00000001
+#define FLASH_BOOT_NFLASH 0x00000002
+
+#endif /* _BCMDEVS_H */
/*
* Byte order utilities
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
#include <typedefs.h>
-
+/* Reverse the bytes in a 16-bit value */
#define BCMSWAP16(val) \
((uint16)((((uint16)(val) & (uint16)0x00ffU) << 8) | \
(((uint16)(val) & (uint16)0xff00U) >> 8)))
-
+/* Reverse the bytes in a 32-bit value */
#define BCMSWAP32(val) \
((uint32)((((uint32)(val) & (uint32)0x000000ffU) << 24) | \
(((uint32)(val) & (uint32)0x0000ff00U) << 8) | \
(((uint32)(val) & (uint32)0x00ff0000U) >> 8) | \
(((uint32)(val) & (uint32)0xff000000U) >> 24)))
-
+/* Reverse the two 16-bit halves of a 32-bit value */
#define BCMSWAP32BY16(val) \
((uint32)((((uint32)(val) & (uint32)0x0000ffffU) << 16) | \
(((uint32)(val) & (uint32)0xffff0000U) >> 16)))
-
+/* Byte swapping macros
+ * Host <=> Network (Big Endian) for 16- and 32-bit values
+ * Host <=> Little-Endian for 16- and 32-bit values
+ */
#ifndef hton16
#define HTON16(i) BCMSWAP16(i)
#define hton16(i) bcmswap16(i)
#define htol16(i) (i)
#define HTOL32(i) (i)
#define htol32(i) (i)
-#endif
+#endif /* hton16 */
#define ltoh16_buf(buf, i)
#define htol16_buf(buf, i)
-
+/* Unaligned loads and stores in host byte order */
#define load32_ua(a) ltoh32_ua(a)
#define store32_ua(a, v) htol32_ua_store(v, a)
#define load16_ua(a) ltoh16_ua(a)
#ifdef __GNUC__
-
+/* GNU macro versions avoid referencing the argument multiple times, while also
+ * avoiding the -fno-inline used in ROM builds.
+ */
#define bcmswap16(val) ({ \
uint16 _val = (val); \
_NTOH32_UA(_bytes); \
})
-#else
-
+#else /* !__GNUC__ */
+/* Inline versions avoid referencing the argument multiple times */
static INLINE uint16
bcmswap16(uint16 val)
{
return BCMSWAP32BY16(val);
}
-
-
-
+/* Reverse pairs of bytes in a buffer (not for high-performance use) */
+/* buf - start of buffer of shorts to swap */
+/* len - byte length of buffer */
static INLINE void
bcmswap16_buf(uint16 *buf, uint len)
{
}
}
-
+/*
+ * Store 16-bit value to unaligned little-endian byte array.
+ */
static INLINE void
htol16_ua_store(uint16 val, uint8 *bytes)
{
bytes[1] = val >> 8;
}
-
+/*
+ * Store 32-bit value to unaligned little-endian byte array.
+ */
static INLINE void
htol32_ua_store(uint32 val, uint8 *bytes)
{
bytes[3] = val >> 24;
}
-
+/*
+ * Store 16-bit value to unaligned network-(big-)endian byte array.
+ */
static INLINE void
hton16_ua_store(uint16 val, uint8 *bytes)
{
bytes[1] = val & 0xff;
}
-
+/*
+ * Store 32-bit value to unaligned network-(big-)endian byte array.
+ */
static INLINE void
hton32_ua_store(uint32 val, uint8 *bytes)
{
bytes[3] = val & 0xff;
}
-
+/*
+ * Load 16-bit value from unaligned little-endian byte array.
+ */
static INLINE uint16
ltoh16_ua(const void *bytes)
{
return _LTOH16_UA((const uint8 *)bytes);
}
-
+/*
+ * Load 32-bit value from unaligned little-endian byte array.
+ */
static INLINE uint32
ltoh32_ua(const void *bytes)
{
return _LTOH32_UA((const uint8 *)bytes);
}
-
+/*
+ * Load 16-bit value from unaligned big-(network-)endian byte array.
+ */
static INLINE uint16
ntoh16_ua(const void *bytes)
{
return _NTOH16_UA((const uint8 *)bytes);
}
-
+/*
+ * Load 32-bit value from unaligned big-(network-)endian byte array.
+ */
static INLINE uint32
ntoh32_ua(const void *bytes)
{
return _NTOH32_UA((const uint8 *)bytes);
}
-#endif
-#endif
+#endif /* !__GNUC__ */
+#endif /* !_BCMENDIAN_H_ */
/*
* Performance counters software interface.
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* Definitions for API from sdio common code (bcmsdh) to individual
* host controller drivers.
*
- * Copyright (C) 1999-2012, Broadcom Corporation
- *
+ * Copyright (C) 1999-2013, 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
* 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 369543 2012-11-19 08:23:46Z $
+ * $Id: bcmsdbus.h 401994 2013-05-14 06:53:19Z $
*/
#ifndef _sdio_api_h_
#ifdef BCMSDIOH_TXGLOM
/* Max number of glommed pkts */
-#define SDPCM_MAXGLOM_SIZE 16
+#ifdef CUSTOM_MAX_TXGLOM_SIZE
+#define SDPCM_MAXGLOM_SIZE CUSTOM_MAX_TXGLOM_SIZE
+#else
+#define SDPCM_MAXGLOM_SIZE 10
+#endif /* CUSTOM_MAX_TXGLOM_SIZE */
#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 */
#ifdef BCMSDIOH_TXGLOM_HIGHSPEED
#define SDPCM_DEFGLOM_MODE SDPCM_TXGLOM_MDESC
+#ifdef CUSTOM_DEF_TXGLOM_SIZE
+#define SDPCM_DEFGLOM_SIZE CUSTOM_DEF_TXGLOM_SIZE
+#else
#define SDPCM_DEFGLOM_SIZE 10
+#endif /* CUSTOM_DEF_TXGLOM_SIZE */
#else
#define SDPCM_DEFGLOM_MODE SDPCM_TXGLOM_CPY
#define SDPCM_DEFGLOM_SIZE 3
+#endif /* BCMSDIOH_TXGLOM_HIGHSPEED */
+
+#if SDPCM_DEFGLOM_SIZE > SDPCM_MAXGLOM_SIZE
+#warning "SDPCM_DEFGLOM_SIZE cannot be higher than SDPCM_MAXGLOM_SIZE!!"
+#undef SDPCM_DEFGLOM_SIZE
+#define SDPCM_DEFGLOM_SIZE SDPCM_MAXGLOM_SIZE
#endif
#endif /* BCMSDIOH_TXGLOM */
-
typedef int SDIOH_API_RC;
/* SDio Host structure */
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
* export functions to client drivers
* abstract OS and BUS specific details of SDIO
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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 365575 2012-10-30 05:25:07Z $
+ * $Id: bcmsdh.h 391577 2013-03-18 21:28:17Z $
*/
/**
* implementation may maintain a single "default" handle (e.g. the first or
* most recent one) to enable single-instance implementations to pass NULL.
*/
-
-#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
extern bcmsdh_info_t *bcmsdh_attach(osl_t *osh, void *cfghdl, void **regsva, uint irq);
-#endif
/* Detach - freeup resources allocated in attach */
extern int bcmsdh_detach(osl_t *osh, void *sdh);
extern int bcmsdh_reg_sdio_notify(void* semaphore);
extern void bcmsdh_unreg_sdio_notify(void);
-#if defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID)
+#if defined(OOB_INTR_ONLY)
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) || defined(BCMSPI_ANDROID) */
+#endif
/* Function to pass device-status bits to DHD. */
extern uint32 bcmsdh_get_dstatus(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);
/*
* BCMSDH Function Driver for the native SDIO/MMC driver in the Linux Kernel
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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 370612 2012-11-22 11:49:12Z $
+ * $Id: bcmsdh_sdmmc.h 396592 2013-04-13 16:14:38Z $
*/
#ifndef __BCMSDH_SDMMC_H__
#define sd_data(x)
#define sd_ctrl(x)
-#ifdef CUSTOMER_HW4
-#undef sd_err
-#define sd_err(x) do {printf x;} while (0)
-#define sd_trace_hw4 sd_err
-#else
-#define sd_trace_hw4 sd_trace
-#endif
#define sd_sync_dma(sd, read, nbytes)
#define sd_init_dma(sd)
#define CLIENT_INTR 0x100 /* Get rid of this! */
#ifdef BCMSDIOH_TXGLOM
-/* Setting the MAX limit to 10 */
-#define SDIOH_MAXGLOM_SIZE 16
typedef struct glom_buf {
void *glom_pkt_head;
void *glom_pkt_tail;
uint32 count; /* Total number of pkts queued */
} glom_buf_t;
-#endif
+#endif /* BCMSDIOH_TXGLOM */
struct sdioh_info {
osl_t *osh; /* osh handler */
* Broadcom SDIO/PCMCIA
* Software-specific definitions shared between device and host side
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
/*
* SD-SPI Protocol Conversion - BCMSDH->SPI Translation Layer
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
/*
* 'Standard' SDIO HOST CONTROLLER driver
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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 372377 2012-12-03 12:24:59Z $
+ * $Id: bcmsdstd.h 343301 2012-07-06 13:07:32Z $
*/
#ifndef _BCM_SD_STD_H
#define _BCM_SD_STD_H
/*
* Broadcom SPI Low-Level Hardware Driver API
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
/*
* Misc useful os-independent macros and functions.
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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 365744 2012-10-30 22:01:29Z $
+ * $Id: bcmutils.h 382763 2013-02-04 10:21:08Z $
*/
#ifndef _bcmutils_h_
#include <wlioctl.h>
#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
+/* ctype replacement */
+#define _BCM_U 0x01 /* upper */
+#define _BCM_L 0x02 /* lower */
+#define _BCM_D 0x04 /* digit */
+#define _BCM_C 0x08 /* cntrl */
+#define _BCM_P 0x10 /* punct */
+#define _BCM_S 0x20 /* white space (space/lf/tab) */
+#define _BCM_X 0x40 /* hex digit */
+#define _BCM_SP 0x80 /* hard space (0x20) */
extern const unsigned char bcm_ctype[];
#define bcm_ismask(x) (bcm_ctype[(int)(unsigned char)(x)])
#define bcm_tolower(c) (bcm_isupper((c)) ? ((c) + 'a' - 'A') : (c))
#define bcm_toupper(c) (bcm_islower((c)) ? ((c) + 'A' - 'a') : (c))
-
+/* Buffer structure for collecting string-formatted data
+* using bcm_bprintf() API.
+* Use bcm_binit() to initialize before use
+*/
struct bcmstrbuf {
- char *buf;
- unsigned int size;
- char *origbuf;
- unsigned int origsize;
+ char *buf; /* pointer to current position in origbuf */
+ unsigned int size; /* current (residual) size in bytes */
+ char *origbuf; /* unmodified pointer to orignal buffer */
+ unsigned int origsize; /* unmodified orignal buffer size in bytes */
};
-
+/* ** driver-only section ** */
#ifdef BCMDRIVER
#include <osl.h>
-#define GPIO_PIN_NOTDEFINED 0x20
-
+#define GPIO_PIN_NOTDEFINED 0x20 /* Pin not defined */
+/*
+ * Spin at most 'us' microseconds while 'exp' is true.
+ * Caller should explicitly test 'exp' when this completes
+ * and take appropriate error action if 'exp' is still true.
+ */
#define SPINWAIT(exp, us) { \
uint countdown = (us) + 9; \
while ((exp) && (countdown >= 10)) {\
} \
}
-
+/* osl multi-precedence packet queue */
#ifndef PKTQ_LEN_DEFAULT
-#define PKTQ_LEN_DEFAULT 128
+#define PKTQ_LEN_DEFAULT 128 /* Max 128 packets */
#endif
#ifndef PKTQ_MAX_PREC
-#define PKTQ_MAX_PREC 16
+#define PKTQ_MAX_PREC 16 /* Maximum precedence levels */
#endif
typedef struct pktq_prec {
- void *head;
- void *tail;
- uint16 len;
- uint16 max;
+ void *head; /* first packet to dequeue */
+ void *tail; /* last packet to dequeue */
+ uint16 len; /* number of queued packets */
+ uint16 max; /* maximum number of queued packets */
} 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 rtsfail;
- uint32 acked;
+ uint32 requested; /* packets requested to be stored */
+ uint32 stored; /* packets stored */
+ uint32 saved; /* packets saved,
+ because a lowest priority queue has given away one packet
+ */
+ uint32 selfsaved; /* packets saved,
+ because an older packet from the same queue has been dropped
+ */
+ uint32 full_dropped; /* packets dropped,
+ because pktq is full with higher precedence packets
+ */
+ uint32 dropped; /* packets dropped because pktq per that precedence is full */
+ uint32 sacrificed; /* packets dropped,
+ in order to save one from a queue of a highest priority
+ */
+ uint32 busy; /* packets droped because of hardware/transmission error */
+ uint32 retry; /* packets re-sent because they were not received */
+ uint32 ps_retry; /* packets retried again prior to moving power save mode */
+ uint32 retry_drop; /* packets finally dropped after retry limit */
+ uint32 max_avail; /* the high-water mark of the queue capacity for packets -
+ goes to zero as queue fills
+ */
+ uint32 max_used; /* the high-water mark of the queue utilisation for packets -
+ increases with use ('inverse' of max_avail)
+ */
+ uint32 queue_capacity; /* the maximum capacity of the queue */
+ uint32 rtsfail; /* count of rts attempts that failed to receive cts */
+ uint32 acked; /* count of packets sent (acked) successfully */
} pktq_counters_t;
-#endif
+#endif /* PKTQ_LOG */
#define PKTQ_COMMON \
- uint16 num_prec; \
- uint16 hi_prec; \
- uint16 max; \
- uint16 len;
-
+ uint16 num_prec; /* number of precedences in use */ \
+ uint16 hi_prec; /* rapid dequeue hint (>= highest non-empty prec) */ \
+ uint16 max; /* total max packets */ \
+ uint16 len; /* total number of packets */
+/* multi-priority pkt queue */
struct pktq {
PKTQ_COMMON
-
+ /* q array must be last since # of elements can be either PKTQ_MAX_PREC or 1 */
struct pktq_prec q[PKTQ_MAX_PREC];
#ifdef PKTQ_LOG
- pktq_counters_t _prec_cnt[PKTQ_MAX_PREC];
- pktq_counters_t _prec_bytes[PKTQ_MAX_PREC];
- uint32 _logtime;
+ pktq_counters_t _prec_cnt[PKTQ_MAX_PREC]; /* Counters per queue */
+ pktq_counters_t _prec_bytes[PKTQ_MAX_PREC]; /* Byte count per queue */
+ uint32 _logtime; /* timestamp of last counter clear */
#endif
};
-
+/* simple, non-priority pkt queue */
struct spktq {
PKTQ_COMMON
-
+ /* q array must be last since # of elements can be either PKTQ_MAX_PREC or 1 */
struct pktq_prec q[1];
};
#define PKTQ_PREC_ITER(pq, prec) for (prec = (pq)->num_prec - 1; prec >= 0; prec--)
-
+/* fn(pkt, arg). return true if pkt belongs to if */
typedef bool (*ifpkt_cb_t)(void*, int);
#ifdef BCMPKTPOOL
#define POOL_ENAB(pool) ((pool) && (pool)->inited)
-#if defined(BCM4329C0)
-#define SHARED_POOL (pktpool_shared_ptr)
-#else
#define SHARED_POOL (pktpool_shared)
-#endif
-#else
+#else /* BCMPKTPOOL */
#define POOL_ENAB(bus) 0
#define SHARED_POOL ((struct pktpool *)NULL)
-#endif
+#endif /* BCMPKTPOOL */
#ifndef PKTPOOL_LEN_MAX
#define PKTPOOL_LEN_MAX 40
-#endif
+#endif /* PKTPOOL_LEN_MAX */
#define PKTPOOL_CB_MAX 3
struct pktpool;
} pktpool_cbinfo_t;
#ifdef BCMDBG_POOL
-
+/* pkt pool debug states */
#define POOL_IDLE 0
#define POOL_RXFILL 1
#define POOL_RXDH 2
} pktpool_dbg_t;
typedef struct {
- uint8 txdh;
- uint8 txd11;
- uint8 enq;
- uint8 rxdh;
- uint8 rxd11;
- uint8 rxfill;
- uint8 idle;
+ uint8 txdh; /* tx to host */
+ uint8 txd11; /* tx to d11 */
+ uint8 enq; /* waiting in q */
+ uint8 rxdh; /* rx from host */
+ uint8 rxd11; /* rx from d11 */
+ uint8 rxfill; /* dma_rxfill */
+ uint8 idle; /* avail in pool */
} pktpool_stats_t;
-#endif
+#endif /* BCMDBG_POOL */
typedef struct pktpool {
bool inited;
#endif
} pktpool_t;
-#if defined(BCM4329C0)
-extern pktpool_t *pktpool_shared_ptr;
-#else
extern pktpool_t *pktpool_shared;
-#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);
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 /* BCMDBG_POOL */
+/* forward definition of ether_addr structure used by some function prototypes */
struct ether_addr;
extern int ether_isbcast(const void *ea);
extern int ether_isnulladdr(const void *ea);
-
+/* operations on a specific precedence in packet queue */
#define pktq_psetmax(pq, prec, _max) ((pq)->q[prec].max = (_max))
#define pktq_pmax(pq, prec) ((pq)->q[prec].max)
extern void *pktq_pdeq_prev(struct pktq *pq, int prec, void *prev_p);
extern void *pktq_pdeq_with_fn(struct pktq *pq, int prec, ifpkt_cb_t fn, int arg);
extern void *pktq_pdeq_tail(struct pktq *pq, int prec);
-
+/* Empty the queue at particular precedence level */
extern void pktq_pflush(osl_t *osh, struct pktq *pq, int prec, bool dir,
ifpkt_cb_t fn, int arg);
-
+/* Remove a specified packet from its queue */
extern bool pktq_pdel(struct pktq *pq, void *p, int prec);
-
+/* operations on a set of precedences in packet queue */
extern int pktq_mlen(struct pktq *pq, uint prec_bmp);
extern void *pktq_mdeq(struct pktq *pq, uint prec_bmp, int *prec_out);
extern void *pktq_mpeek(struct pktq *pq, uint prec_bmp, int *prec_out);
-
+/* operations on packet queue as a whole */
#define pktq_len(pq) ((int)(pq)->len)
#define pktq_max(pq) ((int)(pq)->max)
#define pktq_full(pq) ((pq)->len >= (pq)->max)
#define pktq_empty(pq) ((pq)->len == 0)
-
+/* operations for single precedence queues */
#define pktenq(pq, p) pktq_penq(((struct pktq *)(void *)pq), 0, (p))
#define pktenq_head(pq, p) pktq_penq_head(((struct pktq *)(void *)pq), 0, (p))
#define pktdeq(pq) pktq_pdeq(((struct pktq *)(void *)pq), 0)
extern void pktq_init(struct pktq *pq, int num_prec, int max_len);
extern void pktq_set_max_plen(struct pktq *pq, int prec, int max_len);
-
+/* prec_out may be NULL if caller is not interested in return value */
extern void *pktq_deq(struct pktq *pq, int *prec_out);
extern void *pktq_deq_tail(struct pktq *pq, int *prec_out);
extern void *pktq_peek(struct pktq *pq, int *prec_out);
extern void *pktq_peek_tail(struct pktq *pq, int *prec_out);
extern void pktq_flush(osl_t *osh, struct pktq *pq, bool dir, ifpkt_cb_t fn, int arg);
-
-
+/* externs */
+/* packet */
extern uint pktcopy(osl_t *osh, void *p, uint offset, int len, uchar *buf);
extern uint pktfrombuf(osl_t *osh, void *p, uint offset, int len, uchar *buf);
extern uint pkttotlen(osl_t *osh, void *p);
extern uint8 *pktdataoffset(osl_t *osh, void *p, uint offset);
extern void *pktoffset(osl_t *osh, void *p, uint offset);
-
-#define PKTPRIO_VDSCP 0x100
-#define PKTPRIO_VLAN 0x200
-#define PKTPRIO_UPD 0x400
-#define PKTPRIO_DSCP 0x800
+/* Get priority from a packet and pass it back in scb (or equiv) */
+#define PKTPRIO_VDSCP 0x100 /* DSCP prio found after VLAN tag */
+#define PKTPRIO_VLAN 0x200 /* VLAN prio found */
+#define PKTPRIO_UPD 0x400 /* DSCP used to update VLAN prio */
+#define PKTPRIO_DSCP 0x800 /* DSCP prio found */
extern uint pktsetprio(void *pkt, bool update_vtag);
-
+/* string */
extern int bcm_atoi(const char *s);
extern ulong bcm_strtoul(const char *cp, char **endp, uint base);
extern char *bcmstrstr(const char *haystack, const char *needle);
int bcmstrnicmp(const char* s1, const char* s2, int cnt);
-
+/* ethernet address */
extern char *bcm_ether_ntoa(const struct ether_addr *ea, char *buf);
extern int bcm_ether_atoe(const char *p, struct ether_addr *ea);
-
+/* ip address */
struct ipv4_addr;
extern char *bcm_ip_ntoa(struct ipv4_addr *ia, char *buf);
-
+/* delay */
extern void bcm_mdelay(uint ms);
-
+/* variable access */
#define NVRAM_RECLAIM_CHECK(name)
extern char *getvar(char *vars, const char *name);
extern char *bcm_nvram_vars(uint *length);
extern int bcm_nvram_cache(void *sih);
+/* Support for sharing code across in-driver iovar implementations.
+ * The intent is that a driver use this structure to map iovar names
+ * to its (private) iovar identifiers, and the lookup function to
+ * find the entry. Macros are provided to map ids and get/set actions
+ * into a single number space for a switch statement.
+ */
-
-
+/* iovar structure */
typedef struct bcm_iovar {
- const char *name;
- uint16 varid;
- uint16 flags;
- uint16 type;
- uint16 minlen;
+ const char *name; /* name for lookup and display */
+ uint16 varid; /* id for switch */
+ uint16 flags; /* driver-specific flag bits */
+ uint16 type; /* base type of argument */
+ uint16 minlen; /* min length for buffer vars */
} bcm_iovar_t;
+/* varid definitions are per-driver, may use these get/set bits */
+/* IOVar action bits for id mapping */
+#define IOV_GET 0 /* Get an iovar */
+#define IOV_SET 1 /* Set an iovar */
-
-#define IOV_GET 0
-#define IOV_SET 1
-
-
+/* Varid to actionid mapping */
#define IOV_GVAL(id) ((id) * 2)
#define IOV_SVAL(id) ((id) * 2 + IOV_SET)
#define IOV_ISSET(actionid) ((actionid & IOV_SET) == IOV_SET)
#define IOV_ID(actionid) (actionid >> 1)
-
+/* flags are per-driver based on driver attributes */
extern const bcm_iovar_t *bcm_iovar_lookup(const bcm_iovar_t *table, const char *name);
extern int bcm_iovar_lencheck(const bcm_iovar_t *table, void *arg, int len, bool set);
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 /* BCMDRIVER */
+
+/* Base type definitions */
+#define IOVT_VOID 0 /* no value (implictly set only) */
+#define IOVT_BOOL 1 /* any value ok (zero/nonzero) */
+#define IOVT_INT8 2 /* integer values are range-checked */
+#define IOVT_UINT8 3 /* unsigned int 8 bits */
+#define IOVT_INT16 4 /* int 16 bits */
+#define IOVT_UINT16 5 /* unsigned int 16 bits */
+#define IOVT_INT32 6 /* int 32 bits */
+#define IOVT_UINT32 7 /* unsigned int 32 bits */
+#define IOVT_BUFFER 8 /* buffer is size-checked as per minlen */
#define BCM_IOVT_VALID(type) (((unsigned int)(type)) <= IOVT_BUFFER)
-
+/* Initializer for IOV type strings */
#define BCM_IOV_TYPE_INIT { \
"void", \
"bool", \
(type == IOVT_INT32) || \
(type == IOVT_UINT32))
+/* ** driver/apps-shared section ** */
-
-#define BCME_STRLEN 64
+#define BCME_STRLEN 64 /* Max string length for BCM errors */
#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_LAST BCME_NONRESIDENT
-
-
+/*
+ * error codes could be added but the defined ones shouldn't be changed/deleted
+ * these error codes are exposed to the user code
+ * when ever a new error code is added to this list
+ * please update errorstring table with the related error string and
+ * update osl files with os specific errorcode map
+*/
+
+#define BCME_OK 0 /* Success */
+#define BCME_ERROR -1 /* Error generic */
+#define BCME_BADARG -2 /* Bad Argument */
+#define BCME_BADOPTION -3 /* Bad option */
+#define BCME_NOTUP -4 /* Not up */
+#define BCME_NOTDOWN -5 /* Not down */
+#define BCME_NOTAP -6 /* Not AP */
+#define BCME_NOTSTA -7 /* Not STA */
+#define BCME_BADKEYIDX -8 /* BAD Key Index */
+#define BCME_RADIOOFF -9 /* Radio Off */
+#define BCME_NOTBANDLOCKED -10 /* Not band locked */
+#define BCME_NOCLK -11 /* No Clock */
+#define BCME_BADRATESET -12 /* BAD Rate valueset */
+#define BCME_BADBAND -13 /* BAD Band */
+#define BCME_BUFTOOSHORT -14 /* Buffer too short */
+#define BCME_BUFTOOLONG -15 /* Buffer too long */
+#define BCME_BUSY -16 /* Busy */
+#define BCME_NOTASSOCIATED -17 /* Not Associated */
+#define BCME_BADSSIDLEN -18 /* Bad SSID len */
+#define BCME_OUTOFRANGECHAN -19 /* Out of Range Channel */
+#define BCME_BADCHAN -20 /* Bad Channel */
+#define BCME_BADADDR -21 /* Bad Address */
+#define BCME_NORESOURCE -22 /* Not Enough Resources */
+#define BCME_UNSUPPORTED -23 /* Unsupported */
+#define BCME_BADLEN -24 /* Bad length */
+#define BCME_NOTREADY -25 /* Not Ready */
+#define BCME_EPERM -26 /* Not Permitted */
+#define BCME_NOMEM -27 /* No Memory */
+#define BCME_ASSOCIATED -28 /* Associated */
+#define BCME_RANGE -29 /* Not In Range */
+#define BCME_NOTFOUND -30 /* Not Found */
+#define BCME_WME_NOT_ENABLED -31 /* WME Not Enabled */
+#define BCME_TSPEC_NOTFOUND -32 /* TSPEC Not Found */
+#define BCME_ACM_NOTSUPPORTED -33 /* ACM Not Supported */
+#define BCME_NOT_WME_ASSOCIATION -34 /* Not WME Association */
+#define BCME_SDIO_ERROR -35 /* SDIO Bus Error */
+#define BCME_DONGLE_DOWN -36 /* Dongle Not Accessible */
+#define BCME_VERSION -37 /* Incorrect version */
+#define BCME_TXFAIL -38 /* TX failure */
+#define BCME_RXFAIL -39 /* RX failure */
+#define BCME_NODEVICE -40 /* Device not present */
+#define BCME_NMODE_DISABLED -41 /* NMODE disabled */
+#define BCME_NONRESIDENT -42 /* access to nonresident overlay */
+#define BCME_SCANREJECT -43 /* reject scan request */
+#define BCME_USAGE_ERROR -44 /* WLCMD usage error */
+#define BCME_IOCTL_ERROR -45 /* WLCMD ioctl error */
+#define BCME_SERIAL_PORT_ERR -46 /* RWL serial port error */
+#define BCME_LAST BCME_SERIAL_PORT_ERR
+
+/* These are collection of BCME Error strings */
#define BCMERRSTRINGTABLE { \
"OK", \
"Undefined error", \
"Device Not Present", \
"NMODE Disabled", \
"Nonresident overlay access", \
+ "Scan Rejected", \
+ "WLCMD usage error", \
+ "WLCMD ioctl error", \
+ "RWL serial port error", \
}
#ifndef ABS
#define ABS(a) (((a) < 0) ? -(a) : (a))
-#endif
+#endif /* ABS */
#ifndef MIN
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
-#endif
+#endif /* MIN */
#ifndef MAX
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
-#endif
-
+#endif /* MAX */
+/* limit to [min, max] */
#ifndef LIMIT_TO_RANGE
#define LIMIT_TO_RANGE(x, min, max) \
((x) < (min) ? (min) : ((x) > (max) ? (max) : (x)))
-#endif
-
+#endif /* LIMIT_TO_RANGE */
+/* limit to max */
#ifndef LIMIT_TO_MAX
#define LIMIT_TO_MAX(x, max) \
(((x) > (max) ? (max) : (x)))
-#endif
-
+#endif /* LIMIT_TO_MAX */
+/* limit to min */
#ifndef LIMIT_TO_MIN
#define LIMIT_TO_MIN(x, min) \
(((x) < (min) ? (min) : (x)))
-#endif
+#endif /* LIMIT_TO_MIN */
#define CEIL(x, y) (((x) + ((y) - 1)) / (y))
#define ROUNDUP(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
#ifndef OFFSETOF
#ifdef __ARMCC_VERSION
-
+/*
+ * The ARM RVCT compiler complains when using OFFSETOF where a constant
+ * expression is expected, such as an initializer for a static object.
+ * offsetof from the runtime library doesn't have that problem.
+ */
#include <stddef.h>
#define OFFSETOF(type, member) offsetof(type, member)
#else
#define OFFSETOF(type, member) ((uint)(uintptr)&((type *)0)->member)
-#endif
-#endif
+#endif /* __ARMCC_VERSION */
+#endif /* OFFSETOF */
#ifndef ARRAYSIZE
#define ARRAYSIZE(a) (sizeof(a) / sizeof(a[0]))
#endif
+#ifndef ARRAYLAST /* returns pointer to last array element */
+#define ARRAYLAST(a) (&a[ARRAYSIZE(a)-1])
+#endif
+/* Reference a function; used to prevent a static function from being optimized out */
extern void *_bcmutils_dummy_fn;
#define REFERENCE_FUNCTION(f) (_bcmutils_dummy_fn = (void *)(f))
-
+/* bit map related macros */
#ifndef setbit
-#ifndef NBBY
-#define NBBY 8
-#endif
+#ifndef NBBY /* the BSD family defines NBBY */
+#define NBBY 8 /* 8 bits per byte */
+#endif /* #ifndef NBBY */
+#ifdef BCMUTILS_BIT_MACROS_USE_FUNCS
+extern void setbit(void *array, uint bit);
+extern void clrbit(void *array, uint bit);
+extern bool isset(const void *array, uint bit);
+extern bool isclr(const void *array, uint bit);
+#else
#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
+#endif /* setbit */
#define isbitset(a, i) (((a) & (1 << (i))) != 0)
#define NBITMASK(nbits) MAXBITVAL(nbits)
#define MAXNBVAL(nbyte) MAXBITVAL((nbyte) * 8)
-
+/* basic mux operation - can be optimized on several architectures */
#define MUX(pred, true, false) ((pred) ? (true) : (false))
-
+/* modulo inc/dec - assumes x E [0, bound - 1] */
#define MODDEC(x, bound) MUX((x) == 0, (bound) - 1, (x) - 1)
#define MODINC(x, bound) MUX((x) == (bound) - 1, 0, (x) + 1)
-
+/* modulo inc/dec, bound = 2^k */
#define MODDEC_POW2(x, bound) (((x) - 1) & ((bound) - 1))
#define MODINC_POW2(x, bound) (((x) + 1) & ((bound) - 1))
-
+/* modulo add/sub - assumes x, y E [0, bound - 1] */
#define MODADD(x, y, bound) \
MUX((x) + (y) >= (bound), (x) + (y) - (bound), (x) + (y))
#define MODSUB(x, y, bound) \
MUX(((int)(x)) - ((int)(y)) < 0, (x) - (y) + (bound), (x) - (y))
-
+/* module add/sub, bound = 2^k */
#define MODADD_POW2(x, y, bound) (((x) + (y)) & ((bound) - 1))
#define MODSUB_POW2(x, y, bound) (((x) - (y)) & ((bound) - 1))
+/* crc defines */
+#define CRC8_INIT_VALUE 0xff /* Initial CRC8 checksum value */
+#define CRC8_GOOD_VALUE 0x9f /* Good final CRC8 checksum value */
+#define CRC16_INIT_VALUE 0xffff /* Initial CRC16 checksum value */
+#define CRC16_GOOD_VALUE 0xf0b8 /* Good final CRC16 checksum value */
+#define CRC32_INIT_VALUE 0xffffffff /* Initial CRC32 checksum value */
+#define CRC32_GOOD_VALUE 0xdebb20e3 /* Good final CRC32 checksum value */
-#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
-
-
+/* use for direct output of MAC address in printf etc */
#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], \
#else
#define MACDBG "%02x:%02x:%02x"
#define MAC2STRDBG(ea) (ea)[0], (ea)[4], (ea)[5]
-#endif
-
+#endif /* SIMPLE_MAC_PRINT */
+/* bcm_format_flags() bit description structure */
typedef struct bcm_bit_desc {
uint32 bit;
const char* name;
} bcm_bit_desc_t;
-
+/* bcm_format_field */
typedef struct bcm_bit_desc_ex {
uint32 mask;
const bcm_bit_desc_t *bitfield;
} bcm_bit_desc_ex_t;
-
+/* tag_ID/length/value_buffer tuple */
typedef struct bcm_tlv {
uint8 id;
uint8 len;
uint8 data[1];
} bcm_tlv_t;
-
+/* Check that bcm_tlv_t fits into the given buflen */
#define bcm_valid_tlv(elt, buflen) ((buflen) >= 2 && (int)(buflen) >= (int)(2 + (elt)->len))
+/* buffer length for ethernet address from bcm_ether_ntoa() */
+#define ETHER_ADDR_STR_LEN 18 /* 18-bytes of Ethernet address buffer length */
-#define ETHER_ADDR_STR_LEN 18
-
-
-
+/* crypto utility function */
+/* 128-bit xor: *dst = *src1 xor *src2. dst1, src1 and src2 may have any alignment */
static INLINE void
xor_128bit_block(const uint8 *src1, const uint8 *src2, uint8 *dst)
{
1 ||
#endif
(((uintptr)src1 | (uintptr)src2 | (uintptr)dst) & 3) == 0) {
-
-
+ /* ARM CM3 rel time: 1229 (727 if alignment check could be omitted) */
+ /* x86 supports unaligned. This version runs 6x-9x faster on x86. */
((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 {
-
+ /* ARM CM3 rel time: 4668 (4191 if alignment check could be omitted) */
int k;
for (k = 0; k < 16; k++)
dst[k] = src1[k] ^ src2[k];
}
}
-
-
+/* externs */
+/* crc */
extern uint8 hndcrc8(uint8 *p, uint nbytes, uint8 crc);
extern uint16 hndcrc16(uint8 *p, uint nbytes, uint16 crc);
extern uint32 hndcrc32(uint8 *p, uint nbytes, uint32 crc);
-
+/* format/print */
#if defined(DHD_DEBUG) || defined(WLMSG_PRHDRS) || defined(WLMSG_PRPKT) || \
defined(WLMSG_ASSOC)
-
+/* print out the value a field has: fields may have 1-32 bits and may hold any value */
extern int bcm_format_field(const bcm_bit_desc_ex_t *bd, uint32 field, char* buf, int len);
-
+/* print out which bits in flags are set */
extern int bcm_format_flags(const bcm_bit_desc_t *bd, uint32 flags, char* buf, int len);
#endif
extern void printbig(char *buf);
extern void prhex(const char *msg, uchar *buf, uint len);
-
+/* IE parsing */
extern bcm_tlv_t *bcm_next_tlv(bcm_tlv_t *elt, int *buflen);
extern bcm_tlv_t *bcm_parse_tlvs(void *buf, int buflen, uint key);
extern bcm_tlv_t *bcm_parse_ordered_tlvs(void *buf, int buflen, uint key);
-
+/* bcmerror */
extern const char *bcmerrorstr(int bcmerror);
+/* extern bcm_tlv_t *bcm_parse_tlvs(void *buf, int buflen, uint key); */
-
-
+/* multi-bool data type: set of bools, mbool is true if any is set */
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)) /* set one bool */
+#define mboolclr(mb, bit) ((mb) &= ~(bit)) /* clear one bool */
+#define mboolisset(mb, bit) (((mb) & (bit)) != 0) /* TRUE if one bool is set */
#define mboolmaskset(mb, mask, val) ((mb) = (((mb) & ~(mask)) | (val)))
-
+/* generic datastruct to help dump routines */
struct fielddesc {
const char *nameandfmt;
uint32 offset;
extern int bcm_bprintf(struct bcmstrbuf *b, const char *fmt, ...);
-
+/* power conversion */
extern uint16 bcm_qdbm_to_mw(uint8 qdbm);
extern uint8 bcm_mw_to_qdbm(uint16 mw);
extern uint bcm_mkiovar(char *name, char *data, uint datalen, char *buf, uint len);
unsigned int process_nvram_vars(char *varbuf, unsigned int len);
+extern bcm_tlv_t *find_vendor_ie(void *tlvs, int tlvs_len,
+ const char *voui, uint8 *type, int type_len);
+
+/* calculate a * b + c */
+extern void bcm_uint64_multiple_add(uint32* r_high, uint32* r_low, uint32 a, uint32 b, uint32 c);
+/* calculate a / b */
+extern void bcm_uint64_divide(uint32* r, uint32 a_high, uint32 a_low, uint32 b);
#ifdef __cplusplus
}
#endif
-#endif
+#endif /* _bcmutils_h_ */
* This header file housing the define and function prototype use by
* both the wl driver, tools & Apps.
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
#define _bcmwifi_channels_h_
-
+/* A chanspec holds the channel number, band, bandwidth and control sideband */
typedef uint16 chanspec_t;
-
+/* channel defines */
#define CH_UPPER_SB 0x01
#define CH_LOWER_SB 0x02
#define CH_EWA_VALID 0x04
#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 /* 2G band channels are 5 Mhz apart */
+#define CH_MAX_2G_CHANNEL 14 /* Max channel in 2G band */
+#define MAXCHANNEL 224 /* max # supported channels. The max channel no is 216,
+ * this is that + 1 rounded up to a multiple of NBBY (8).
+ * DO NOT MAKE it > 255: channels are uint8's all over
+ */
#define CHSPEC_CTLOVLP(sp1, sp2, sep) (ABS(wf_chspec_ctlchan(sp1) - wf_chspec_ctlchan(sp2)) < \
(sep))
-
+/* All builds use the new 11ac ratespec/chanspec */
#undef D11AC_IOTYPES
#define D11AC_IOTYPES
#define WL_CHANSPEC_BAND_2G 0x2000
#define INVCHANSPEC 255
-
+/* channel defines */
#define LOWER_20_SB(channel) (((channel) > CH_10MHZ_APART) ? ((channel) - CH_10MHZ_APART) : 0)
#define UPPER_20_SB(channel) (((channel) < (MAXCHANNEL - CH_10MHZ_APART)) ? \
((channel) + CH_10MHZ_APART) : 0)
#define CHSPEC_CHANNEL(chspec) ((uint8)((chspec) & WL_CHANSPEC_CHAN_MASK))
#define CHSPEC_BAND(chspec) ((chspec) & WL_CHANSPEC_BAND_MASK)
-
+/* chanspec stores radio channel & flags to indicate control channel location, i.e. upper/lower */
#define CHSPEC_CTL_SB(chspec) ((chspec) & WL_CHANSPEC_CTL_SB_MASK)
#define CHSPEC_BW(chspec) ((chspec) & WL_CHANSPEC_BW_MASK)
#define CHSPEC_IS40(chspec) 0
#endif
-#else
+#else /* !WL11N_20MHZONLY */
#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)
#define CHSPEC_IS40(chspec) (((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_40)
#endif
-#endif
+#endif /* !WL11N_20MHZONLY */
#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)
#define CHANSPEC_STR_LEN 8
-#else
+#else /* D11AC_IOTYPES */
#define WL_CHANSPEC_CHAN_MASK 0x00ff
#define WL_CHANSPEC_CHAN_SHIFT 0
#define WL_CHANSPEC_BAND_5G 0xc000
#define INVCHANSPEC 255
-
+/* channel defines */
#define LOWER_20_SB(channel) (((channel) > CH_10MHZ_APART) ? \
((channel) - CH_10MHZ_APART) : 0)
#define UPPER_20_SB(channel) (((channel) < (MAXCHANNEL - CH_10MHZ_APART)) ? \
((channel) | (ctlsb) | \
WL_CHANSPEC_BW_160 | WL_CHANSPEC_BAND_5G)
-
+/* simple MACROs to get different fields of chanspec */
#define CHSPEC_CHANNEL(chspec) ((uint8)((chspec) & WL_CHANSPEC_CHAN_MASK))
#define CHSPEC_CHAN1(chspec) ((chspec) & WL_CHANSPEC_CHAN1_MASK)
#define CHSPEC_CHAN2(chspec) ((chspec) & WL_CHANSPEC_CHAN2_MASK)
#define CHSPEC_IS8080(chspec) 0
#endif
-#else
+#else /* !WL11N_20MHZONLY */
#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)
#define CHSPEC_IS8080(chspec) (((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_8080)
#endif
-#endif
+#endif /* !WL11N_20MHZONLY */
#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)
(((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_40))
#define CHSPEC2WLC_BAND(chspec) (CHSPEC_IS5G(chspec) ? WLC_BAND_5G : WLC_BAND_2G)
-
+/**
+ * Number of chars needed for wf_chspec_ntoa() destination character buffer.
+ */
#define CHANSPEC_STR_LEN 20
-
+/* Legacy Chanspec defines
+ * These are the defines for the previous format of the chanspec_t
+ */
#define WL_LCHANSPEC_CHAN_MASK 0x00ff
#define WL_LCHANSPEC_CHAN_SHIFT 0
#define LCHSPEC_CREATE(chan, band, bw, sb) ((uint16)((chan) | (sb) | (bw) | (band)))
-#endif
-
-
-
-
-#define WF_CHAN_FACTOR_2_4_G 4814
+#endif /* D11AC_IOTYPES */
+/*
+ * WF_CHAN_FACTOR_* constants are used to calculate channel frequency
+ * given a channel number.
+ * chan_freq = chan_factor * 500Mhz + chan_number * 5
+ */
-#define WF_CHAN_FACTOR_5_G 10000
-
+/**
+ * Channel Factor for the starting frequence of 2.4 GHz channels.
+ * The value corresponds to 2407 MHz.
+ */
+#define WF_CHAN_FACTOR_2_4_G 4814 /* 2.4 GHz band, 2407 MHz */
-#define WF_CHAN_FACTOR_4_G 8000
+/**
+ * Channel Factor for the starting frequence of 5 GHz channels.
+ * The value corresponds to 5000 MHz.
+ */
+#define WF_CHAN_FACTOR_5_G 10000 /* 5 GHz band, 5000 MHz */
-#define WLC_2G_25MHZ_OFFSET 5
+/**
+ * Channel Factor for the starting frequence of 4.9 GHz channels.
+ * The value corresponds to 4000 MHz.
+ */
+#define WF_CHAN_FACTOR_4_G 8000 /* 4.9 GHz band for Japan */
+#define WLC_2G_25MHZ_OFFSET 5 /* 2.4GHz band channel offset */
+/**
+ * Convert chanspec to ascii string
+ *
+ * @param chspec chanspec format
+ * @param buf ascii string of chanspec
+ *
+ * @return pointer to buf with room for at least CHANSPEC_STR_LEN bytes
+ *
+ * @see CHANSPEC_STR_LEN
+ */
extern char * wf_chspec_ntoa(chanspec_t chspec, char *buf);
-
+/**
+ * Convert ascii string to chanspec
+ *
+ * @param a pointer to input string
+ *
+ * @return >= 0 if successful or 0 otherwise
+ */
extern chanspec_t wf_chspec_aton(const char *a);
-
+/**
+ * Verify the chanspec fields are valid.
+ *
+ * Verify the chanspec is using a legal set field values, i.e. that the chanspec
+ * specified a band, bw, ctl_sb and channel and that the combination could be
+ * legal given some set of circumstances.
+ *
+ * @param chanspec input chanspec to verify
+ *
+ * @return TRUE if the chanspec is malformed, FALSE if it looks good.
+ */
extern bool wf_chspec_malformed(chanspec_t chanspec);
-
+/**
+ * Verify the chanspec specifies a valid channel according to 802.11.
+ *
+ * @param chanspec input chanspec to verify
+ *
+ * @return TRUE if the chanspec is a valid 802.11 channel
+ */
extern bool wf_chspec_valid(chanspec_t chanspec);
-
+/**
+ * Return the primary (control) channel.
+ *
+ * This function returns the channel number of the primary 20MHz channel. For
+ * 20MHz channels this is just the channel number. For 40MHz or wider channels
+ * it is the primary 20MHz channel specified by the chanspec.
+ *
+ * @param chspec input chanspec
+ *
+ * @return Returns the channel number of the primary 20MHz channel
+ */
extern uint8 wf_chspec_ctlchan(chanspec_t chspec);
-
+/**
+ * Return the primary (control) chanspec.
+ *
+ * This function returns the chanspec of the primary 20MHz channel. For 20MHz
+ * channels this is just the chanspec. For 40MHz or wider channels it is the
+ * chanspec of the primary 20MHZ channel specified by the chanspec.
+ *
+ * @param chspec input chanspec
+ *
+ * @return Returns the chanspec of the primary 20MHz channel
+ */
extern chanspec_t wf_chspec_ctlchspec(chanspec_t chspec);
-
+/**
+ * Return a channel number corresponding to a frequency.
+ *
+ * This function returns the chanspec for the primary 40MHz of an 80MHz channel.
+ * The control sideband specifies the same 20MHz channel that the 80MHz channel is using
+ * as the primary 20MHz channel.
+ */
extern chanspec_t wf_chspec_primary40_chspec(chanspec_t chspec);
-
+/*
+ * Return the channel number for a given frequency and base frequency.
+ * The returned channel number is relative to the given base frequency.
+ * If the given base frequency is zero, a base frequency of 5 GHz is assumed for
+ * frequencies from 5 - 6 GHz, and 2.407 GHz is assumed for 2.4 - 2.5 GHz.
+ *
+ * Frequency is specified in MHz.
+ * The base frequency is specified as (start_factor * 500 kHz).
+ * Constants WF_CHAN_FACTOR_2_4_G, WF_CHAN_FACTOR_5_G are defined for
+ * 2.4 GHz and 5 GHz bands.
+ *
+ * The returned channel will be in the range [1, 14] in the 2.4 GHz band
+ * and [0, 200] otherwise.
+ * -1 is returned if the start_factor is WF_CHAN_FACTOR_2_4_G and the
+ * frequency is not a 2.4 GHz channel, or if the frequency is not and even
+ * multiple of 5 MHz from the base frequency to the base plus 1 GHz.
+ *
+ * Reference 802.11 REVma, section 17.3.8.3, and 802.11B section 18.4.6.2
+ *
+ * @param freq frequency in MHz
+ * @param start_factor base frequency in 500 kHz units, e.g. 10000 for 5 GHz
+ *
+ * @return Returns a channel number
+ *
+ * @see WF_CHAN_FACTOR_2_4_G
+ * @see WF_CHAN_FACTOR_5_G
+ */
extern int wf_mhz2channel(uint freq, uint start_factor);
-
+/**
+ * Return the center frequency in MHz of the given channel and base frequency.
+ *
+ * Return the center frequency in MHz of the given channel and base frequency.
+ * The channel number is interpreted relative to the given base frequency.
+ *
+ * The valid channel range is [1, 14] in the 2.4 GHz band and [0, 200] otherwise.
+ * The base frequency is specified as (start_factor * 500 kHz).
+ * Constants WF_CHAN_FACTOR_2_4_G, WF_CHAN_FACTOR_5_G are defined for
+ * 2.4 GHz and 5 GHz bands.
+ * The channel range of [1, 14] is only checked for a start_factor of
+ * WF_CHAN_FACTOR_2_4_G (4814).
+ * Odd start_factors produce channels on .5 MHz boundaries, in which case
+ * the answer is rounded down to an integral MHz.
+ * -1 is returned for an out of range channel.
+ *
+ * Reference 802.11 REVma, section 17.3.8.3, and 802.11B section 18.4.6.2
+ *
+ * @param channel input channel number
+ * @param start_factor base frequency in 500 kHz units, e.g. 10000 for 5 GHz
+ *
+ * @return Returns a frequency in MHz
+ *
+ * @see WF_CHAN_FACTOR_2_4_G
+ * @see WF_CHAN_FACTOR_5_G
+ */
extern int wf_channel2mhz(uint channel, uint start_factor);
-
+/**
+ * Convert ctl chan and bw to chanspec
+ *
+ * @param ctl_ch channel
+ * @param bw bandwidth
+ *
+ * @return > 0 if successful or 0 otherwise
+ *
+ */
extern uint16 wf_channel2chspec(uint ctl_ch, uint bw);
-#endif
+extern uint wf_channel2freq(uint channel);
+extern uint wf_freq2channel(uint freq);
+
+
+#endif /* _bcmwifi_channels_h_ */
/*
* Indices for 802.11 a/b/g/n/ac 1-3 chain symmetric transmit rates
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
#ifdef __cplusplus
extern "C" {
-#endif
+#endif /* __cplusplus */
#define WL_RATESET_SZ_DSSS 4
#define WL_TX_CHAINS_MAX 3
-#define WL_RATE_DISABLED (-128)
-
+#define WL_RATE_DISABLED (-128) /* Power value corresponding to unsupported rate */
+/* Transmit channel bandwidths */
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_40IN80
} wl_tx_bw_t;
-
+/*
+ * Transmit modes.
+ * Not all modes are listed here, only those required for disambiguation. e.g. SPEXP is not listed
+ */
typedef enum wl_tx_mode {
WL_TX_MODE_NONE,
WL_TX_MODE_STBC,
} wl_tx_mode_t;
-
+/* Number of transmit chains */
typedef enum wl_tx_chains {
WL_TX_CHAINS_1 = 1,
WL_TX_CHAINS_2,
} wl_tx_chains_t;
-
+/* Number of transmit streams */
typedef enum wl_tx_nss {
WL_TX_NSS_1 = 1,
WL_TX_NSS_2,
typedef enum clm_rates {
-
+ /************
+ * 1 chain *
+ ************
+ */
-
+ /* 1 Stream */
WL_RATE_1X1_DSSS_1 = 0,
WL_RATE_1X1_DSSS_2 = 1,
WL_RATE_1X1_DSSS_5_5 = 2,
WL_RATE_1X1_VHT9SS1 = 21,
-
+ /************
+ * 2 chains *
+ ************
+ */
-
+ /* 1 Stream expanded + 1 */
WL_RATE_1X2_DSSS_1 = 22,
WL_RATE_1X2_DSSS_2 = 23,
WL_RATE_1X2_DSSS_5_5 = 24,
WL_RATE_1X2_VHT8SS1 = 42,
WL_RATE_1X2_VHT9SS1 = 43,
-
+ /* 2 Streams */
WL_RATE_2X2_STBC_MCS0 = 44,
WL_RATE_2X2_STBC_MCS1 = 45,
WL_RATE_2X2_STBC_MCS2 = 46,
WL_RATE_2X2_VHT8SS2 = 62,
WL_RATE_2X2_VHT9SS2 = 63,
-
+ /************
+ * 3 chains *
+ ************
+ */
-
+ /* 1 Stream expanded + 2 */
WL_RATE_1X3_DSSS_1 = 64,
WL_RATE_1X3_DSSS_2 = 65,
WL_RATE_1X3_DSSS_5_5 = 66,
WL_RATE_1X3_VHT8SS1 = 84,
WL_RATE_1X3_VHT9SS1 = 85,
-
+ /* 2 Streams expanded + 1 */
WL_RATE_2X3_STBC_MCS0 = 86,
WL_RATE_2X3_STBC_MCS1 = 87,
WL_RATE_2X3_STBC_MCS2 = 88,
WL_RATE_2X3_VHT8SS2 = 104,
WL_RATE_2X3_VHT9SS2 = 105,
-
+ /* 3 Streams */
WL_RATE_3X3_SDM_MCS16 = 106,
WL_RATE_3X3_SDM_MCS17 = 107,
WL_RATE_3X3_SDM_MCS18 = 108,
WL_RATE_3X3_VHT9SS3 = 115,
-
+ /****************************
+ * TX Beamforming, 2 chains *
+ ****************************
+ */
-
+ /* 1 Stream expanded + 1 */
WL_RATE_1X2_TXBF_OFDM_6 = 116,
WL_RATE_1X2_TXBF_OFDM_9 = 117,
WL_RATE_1X2_TXBF_VHT8SS1 = 132,
WL_RATE_1X2_TXBF_VHT9SS1 = 133,
-
+ /* 2 Streams */
WL_RATE_2X2_TXBF_SDM_MCS8 = 134,
WL_RATE_2X2_TXBF_SDM_MCS9 = 135,
WL_RATE_2X2_TXBF_VHT7SS2 = 141,
-
+ /****************************
+ * TX Beamforming, 3 chains *
+ ****************************
+ */
-
+ /* 1 Stream expanded + 2 */
WL_RATE_1X3_TXBF_OFDM_6 = 142,
WL_RATE_1X3_TXBF_OFDM_9 = 143,
WL_RATE_1X3_TXBF_VHT8SS1 = 158,
WL_RATE_1X3_TXBF_VHT9SS1 = 159,
-
+ /* 2 Streams expanded + 1 */
WL_RATE_2X3_TXBF_SDM_MCS8 = 160,
WL_RATE_2X3_TXBF_SDM_MCS9 = 161,
WL_RATE_2X3_TXBF_VHT8SS2 = 168,
WL_RATE_2X3_TXBF_VHT9SS2 = 169,
-
+ /* 3 Streams */
WL_RATE_3X3_TXBF_SDM_MCS16 = 170,
WL_RATE_3X3_TXBF_SDM_MCS17 = 171,
WL_RATE_3X3_TXBF_VHT7SS3 = 177
} clm_rates_t;
-
+/* Number of rate codes */
#define WL_NUMRATES 178
#ifdef __cplusplus
}
-#endif
+#endif /* __cplusplus */
-#endif
+#endif /* _bcmwifi_rates_h_ */
*
* Definitions subject to change without notice.
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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 358413 2012-09-24 04:50:47Z $
+ * $Id: dhdioctl.h 390859 2013-03-14 01:09:31Z $
*/
#ifndef _dhdioctl_h_
#define DHD_GLOM_VAL 0x0400
#define DHD_EVENT_VAL 0x0800
#define DHD_BTA_VAL 0x1000
-#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
/*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
#define EPI_MAJOR_VERSION 1
-#define EPI_MINOR_VERSION 61
+#define EPI_MINOR_VERSION 88
-#define EPI_RC_NUMBER 17
+#define EPI_RC_NUMBER 21
#define EPI_INCREMENTAL_NUMBER 0
#define EPI_BUILD_NUMBER 0
-#define EPI_VERSION 1, 61, 17, 0
+#define EPI_VERSION 1, 88, 21, 0
-#define EPI_VERSION_NUM 0x013d1100
+#define EPI_VERSION_NUM 0x01581500
-#define EPI_VERSION_DEV 1.61.17
+#define EPI_VERSION_DEV 1.88.21
/* Driver Version String, ASCII, 32 chars max */
#ifdef BCMINTERNAL
-#define EPI_VERSION_STR "1.61.17 (r BCMINT)"
+#define EPI_VERSION_STR "1.88.21 (r BCMINT)"
#else
#ifdef WLTEST
-#define EPI_VERSION_STR "1.61.17 (r WLTEST)"
+#define EPI_VERSION_STR "1.88.21 (r WLTEST)"
#else
-#define EPI_VERSION_STR "1.61.17 (r)"
+#define EPI_VERSION_STR "1.88.21 (r)"
#endif
#endif /* BCMINTERNAL */
/*
* HND SiliconBackplane PMU support.
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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.h 344142 2012-07-11 10:50:39Z $
+ * $Id: hndpmu.h 385540 2013-02-15 23:14:50Z $
*/
#ifndef _hndpmu_h_
/*
* HNDRTE arm trap handling.
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
/*
* Console support for hndrte.
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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: hndrte_cons.h 300516 2011-12-04 17:39:44Z $
+ * $Id: hndrte_cons.h 383834 2013-02-07 23:21:51Z $
*/
#ifndef _HNDRTE_CONS_H
#define _HNDRTE_CONS_H
char cbuf[CBUF_LEN];
} hndrte_cons_t;
+hndrte_cons_t *hndrte_get_active_cons_state(void);
+
#endif /* _HNDRTE_CONS_H */
--- /dev/null
+/*
+ * HND Run Time Environment debug info area
+ *
+ * Copyright (C) 1999-2013, 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: hndrte_debug.h 342211 2012-07-02 02:23:04Z $
+ */
+
+#ifndef _HNDRTE_DEBUG_H
+#define _HNDRTE_DEBUG_H
+
+/* Magic number at a magic location to find HNDRTE_DEBUG pointers */
+#define HNDRTE_DEBUG_PTR_PTR_ADDR 0xf8
+#define HNDRTE_DEBUG_PTR_PTR_MAGIC 0x50504244 /* DBPP */
+
+#ifndef _LANGUAGE_ASSEMBLY
+
+/* Includes only when building dongle code */
+
+
+#define NUM_EVENT_LOG_SETS 4
+
+/* We use explicit sizes here since this gets included from different
+ * systems. The sizes must be the size of the creating system
+ * (currently 32 bit ARM) since this is gleaned from dump.
+ */
+
+/* Define pointers for use on other systems */
+#define _HD_EVLOG_P uint32
+#define _HD_CONS_P uint32
+#define _HD_TRAP_P uint32
+
+typedef struct hndrte_debug {
+ uint32 magic;
+#define HNDRTE_DEBUG_MAGIC 0x47424544 /* 'DEBG' */
+
+ uint32 version; /* Debug struct version */
+#define HNDRTE_DEBUG_VERSION 1
+
+ uint32 fwid; /* 4 bytes of fw info */
+ char epivers[32];
+
+ _HD_TRAP_P trap_ptr; /* trap_t data struct */
+ _HD_CONS_P console; /* Console */
+
+ uint32 ram_base;
+ uint32 ram_size;
+
+ uint32 rom_base;
+ uint32 rom_size;
+
+ _HD_EVLOG_P event_log_top;
+
+} hndrte_debug_t;
+
+/*
+ * timeval_t and prstatus_t are copies of the Linux structures.
+ * Included here because we need the definitions for the target processor
+ * (32 bits) and not the definition on the host this is running on
+ * (which could be 64 bits).
+ */
+
+typedef struct { /* Time value with microsecond resolution */
+ uint32 tv_sec; /* Seconds */
+ uint32 tv_usec; /* Microseconds */
+} timeval_t;
+
+
+/* Linux/ARM 32 prstatus for notes section */
+typedef struct prstatus {
+ int32 si_signo; /* Signal number */
+ int32 si_code; /* Extra code */
+ int32 si_errno; /* Errno */
+ uint16 pr_cursig; /* Current signal. */
+ uint16 unused;
+ uint32 pr_sigpend; /* Set of pending signals. */
+ uint32 pr_sighold; /* Set of held signals. */
+ uint32 pr_pid;
+ uint32 pr_ppid;
+ uint32 pr_pgrp;
+ uint32 pr_sid;
+ timeval_t pr_utime; /* User time. */
+ timeval_t pr_stime; /* System time. */
+ timeval_t pr_cutime; /* Cumulative user time. */
+ timeval_t pr_cstime; /* Cumulative system time. */
+ uint32 uregs[18];
+ int32 pr_fpvalid; /* True if math copro being used. */
+} prstatus_t;
+
+#ifdef DUMP_INFO
+extern hndrte_debug_t hndrte_debug_info __attribute__ ((weak));
+#endif
+
+#endif /* LANGUAGE_ASSEMBLY */
+
+#endif /* _HNDRTE_DEBUG_H */
/*
* Broadcom HND chip & on-chip-interconnect-related definitions.
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
/*
* Linux OS Independent Layer
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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 366012 2012-10-31 19:10:55Z $
+ * $Id: linux_osl.h 401964 2013-05-14 03:50:28Z $
*/
#ifndef _linux_osl_h_
#include <typedefs.h>
-
+/* Linux Kernel: File Operations: start */
extern void * osl_os_open_image(char * filename);
extern int osl_os_get_image_block(char * buf, int len, void * image);
extern void osl_os_close_image(void * image);
extern int osl_os_image_size(void *image);
-
+/* Linux Kernel: File Operations: end */
#ifdef BCMDRIVER
-
+/* OSL initialization */
extern osl_t *osl_attach(void *pdev, uint bustype, bool pkttag);
extern void osl_detach(osl_t *osh);
-
+/* Global ASSERT type */
extern uint32 g_assert_type;
-
+/* ASSERT */
#if defined(BCMASSERT_LOG)
#define ASSERT(exp) \
do { if (!(exp)) osl_assert(#exp, __FILE__, __LINE__); } while (0)
#if GCC_VERSION > 30100
#define ASSERT(exp) do {} while (0)
#else
-
+ /* ASSERT could cause segmentation fault on GCC3.1, use empty instead */
#define ASSERT(exp)
- #endif
- #endif
+ #endif /* GCC_VERSION > 30100 */
+ #endif /* __GNUC__ */
#endif
-
+/* microsecond delay */
#define OSL_DELAY(usec) osl_delay(usec)
extern void osl_delay(uint usec);
extern void osl_pcmcia_read_attr(osl_t *osh, uint offset, void *buf, int size);
extern void osl_pcmcia_write_attr(osl_t *osh, uint offset, void *buf, int size);
-
+/* PCI configuration space access macros */
#define OSL_PCI_READ_CONFIG(osh, offset, size) \
osl_pci_read_config((osh), (offset), (size))
#define OSL_PCI_WRITE_CONFIG(osh, offset, size, val) \
extern uint32 osl_pci_read_config(osl_t *osh, uint offset, uint size);
extern void osl_pci_write_config(osl_t *osh, uint offset, uint size, uint val);
-
+/* PCI device bus # and slot # */
#define OSL_PCI_BUS(osh) osl_pci_bus(osh)
#define OSL_PCI_SLOT(osh) osl_pci_slot(osh)
extern uint osl_pci_bus(osl_t *osh);
extern uint osl_pci_slot(osl_t *osh);
extern struct pci_dev *osl_pci_device(osl_t *osh);
-
+/* Pkttag flag should be part of public information */
typedef struct {
bool pkttag;
- bool mmbus;
- pktfree_cb_fn_t tx_fn;
- void *tx_ctx;
+ bool mmbus; /* Bus supports memory-mapped register accesses */
+ pktfree_cb_fn_t tx_fn; /* Callback function for PKTFREE */
+ void *tx_ctx; /* Context to the callback function */
void *unused[3];
} osl_pubinfo_t;
} while (0)
-
+/* host/bus architecture-specific byte swap */
#define BUS_SWAP32(v) (v)
#define MALLOC(osh, size) osl_malloc((osh), (size))
#define MALLOC_FAILED(osh) osl_malloc_failed((osh))
extern uint osl_malloc_failed(osl_t *osh);
-
+/* allocate/free shared (dma-able) consistent memory */
#define DMA_CONSISTENT_ALIGN osl_dma_consistent_align()
#define DMA_ALLOC_CONSISTENT(osh, size, align, tot, pap, dmah) \
osl_dma_alloc_consistent((osh), (size), (align), (tot), (pap))
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);
+/* map/unmap direction */
+#define DMA_TX 1 /* TX direction for DMA */
+#define DMA_RX 2 /* RX direction for DMA */
-#define DMA_TX 1
-#define DMA_RX 2
-
-
+/* map/unmap shared (dma-able) memory */
#define DMA_UNMAP(osh, pa, size, direction, p, dmah) \
osl_dma_unmap((osh), (pa), (size), (direction))
extern uint osl_dma_map(osl_t *osh, void *va, uint size, int direction, void *p,
hnddma_seg_map_t *txp_dmah);
extern void osl_dma_unmap(osl_t *osh, uint pa, uint size, int direction);
-
+/* API for DMA addressing capability */
#define OSL_DMADDRWIDTH(osh, addrwidth) do {} while (0)
-
+/* register access macros */
#include <bcmsdh.h>
#define OSL_WRITE_REG(osh, r, v) (bcmsdh_reg_write(NULL, (uintptr)(r), sizeof(*(r)), (v)))
#define OSL_READ_REG(osh, r) (bcmsdh_reg_read(NULL, (uintptr)(r), sizeof(*(r))))
#define OSL_ERROR(bcmerror) osl_error(bcmerror)
extern int osl_error(int bcmerror);
+/* the largest reasonable packet buffer driver uses for ethernet MTU in bytes */
+#define PKTBUFSZ 2048 /* largest reasonable packet buffer, driver uses for ethernet MTU */
-#define PKTBUFSZ 2048
-
-
-#include <linuxver.h>
-#include <linux/kernel.h>
-#include <linux/string.h>
+/*
+ * BINOSL selects the slightly slower function-call-based binary compatible osl.
+ * Macros expand to calls to functions defined in linux_osl.c .
+ */
+#include <linuxver.h> /* use current 2.4.x calling conventions */
+#include <linux/kernel.h> /* for vsn/printf's */
+#include <linux/string.h> /* for mem*, str* */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 29)
#define OSL_SYSUPTIME() ((uint32)jiffies_to_msecs(jiffies))
#else
#define OSL_SYSUPTIME() ((uint32)jiffies * (1000 / HZ))
-#endif
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 29) */
#define printf(fmt, args...) printk(fmt , ## args)
-#include <linux/kernel.h>
-#include <linux/string.h>
-
+#include <linux/kernel.h> /* for vsn/printf's */
+#include <linux/string.h> /* for mem*, str* */
+/* bcopy's: Linux kernel doesn't provide these (anymore) */
#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))
-
+/* register access macros */
#define R_REG(osh, r) (\
SELECT_BUS_READ(osh, \
#define AND_REG(osh, r, v) W_REG(osh, (r), R_REG(osh, r) & (v))
#define OR_REG(osh, r, v) W_REG(osh, (r), R_REG(osh, r) | (v))
-
+/* bcopy, bcmp, and bzero functions */
#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))
-
+/* uncached/cached virtual address */
#define OSL_UNCACHED(va) ((void *)va)
#define OSL_CACHED(va) ((void *)va)
-
+/* ARM NorthStar */
#define OSL_CACHE_FLUSH(va, len)
#define OSL_PREF_RANGE_LD(va, sz)
#define OSL_PREF_RANGE_ST(va, sz)
-
+/* get processor cycle count */
#if defined(__i386__)
#define OSL_GETCYCLES(x) rdtscl((x))
#else
#define OSL_GETCYCLES(x) ((x) = 0)
#endif
-
+/* dereference an address that may cause a bus exception */
#define BUSPROBE(val, addr) ({ (val) = R_REG(NULL, (addr)); 0; })
-
+/* map/unmap physical to virtual I/O */
#if !defined(CONFIG_MMC_MSM7X00A)
#define REG_MAP(pa, size) ioremap_nocache((unsigned long)(pa), (unsigned long)(size))
#else
#define REG_MAP(pa, size) (void *)(0)
-#endif
+#endif /* !defined(CONFIG_MMC_MSM7X00A */
#define REG_UNMAP(va) iounmap((va))
-
+/* shared (dma-able) memory access macros */
#define R_SM(r) *(r)
#define W_SM(r, v) (*(r) = (v))
#define BZERO_SM(r, len) memset((r), '\0', (len))
+/* Because the non BINOSL implemenation of the PKT OSL routines are macros (for
+ * performance reasons), we need the Linux headers.
+ */
+#include <linuxver.h> /* use current 2.4.x calling conventions */
-#include <linuxver.h>
-
-
+/* packet primitives */
+#ifdef BCMDBG_CTRACE
+#define PKTGET(osh, len, send) osl_pktget((osh), (len), __LINE__, __FILE__)
+#define PKTDUP(osh, skb) osl_pktdup((osh), (skb), __LINE__, __FILE__)
+#else
#define PKTGET(osh, len, send) osl_pktget((osh), (len))
#define PKTDUP(osh, skb) osl_pktdup((osh), (skb))
+#endif /* BCMDBG_CTRACE */
#define PKTLIST_DUMP(osh, buf)
#define PKTDBG_TRACE(osh, pkt, bit)
#define PKTFREE(osh, skb, send) osl_pktfree((osh), (skb), (send))
#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
+#else
+#define PKTGET_STATIC PKTGET
+#define PKTFREE_STATIC PKTFREE
+#endif /* CONFIG_DHD_USE_STATIC_BUF */
#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))
#define PKTTAILROOM(osh, skb) skb_tailroom((struct sk_buff*)(skb))
+#define PKTPADTAILROOM(osh, skb, padlen) osh_pktpadtailroom((osh), (skb), (padlen))
#define PKTNEXT(osh, skb) (((struct sk_buff*)(skb))->next)
#define PKTSETNEXT(osh, skb, x) (((struct sk_buff*)(skb))->next = (struct sk_buff*)(x))
#define PKTSETLEN(osh, skb, len) __skb_trim((struct sk_buff*)(skb), (len))
#define PKTPOOL(osh, skb) FALSE
#define PKTSHRINK(osh, m) (m)
+#ifdef BCMDBG_CTRACE
+#define DEL_CTRACE(zosh, zskb) { \
+ unsigned long zflags; \
+ spin_lock_irqsave(&(zosh)->ctrace_lock, zflags); \
+ list_del(&(zskb)->ctrace_list); \
+ (zosh)->ctrace_num--; \
+ (zskb)->ctrace_start = 0; \
+ (zskb)->ctrace_count = 0; \
+ spin_unlock_irqrestore(&(zosh)->ctrace_lock, zflags); \
+}
+
+#define UPDATE_CTRACE(zskb, zfile, zline) { \
+ struct sk_buff *_zskb = (struct sk_buff *)(zskb); \
+ if (_zskb->ctrace_count < CTRACE_NUM) { \
+ _zskb->func[_zskb->ctrace_count] = zfile; \
+ _zskb->line[_zskb->ctrace_count] = zline; \
+ _zskb->ctrace_count++; \
+ } \
+ else { \
+ _zskb->func[_zskb->ctrace_start] = zfile; \
+ _zskb->line[_zskb->ctrace_start] = zline; \
+ _zskb->ctrace_start++; \
+ if (_zskb->ctrace_start >= CTRACE_NUM) \
+ _zskb->ctrace_start = 0; \
+ } \
+}
+
+#define ADD_CTRACE(zosh, zskb, zfile, zline) { \
+ unsigned long zflags; \
+ spin_lock_irqsave(&(zosh)->ctrace_lock, zflags); \
+ list_add(&(zskb)->ctrace_list, &(zosh)->ctrace_list); \
+ (zosh)->ctrace_num++; \
+ UPDATE_CTRACE(zskb, zfile, zline); \
+ spin_unlock_irqrestore(&(zosh)->ctrace_lock, zflags); \
+}
+
+#define PKTCALLER(zskb) UPDATE_CTRACE((struct sk_buff *)zskb, (char *)__FUNCTION__, __LINE__)
+#endif /* BCMDBG_CTRACE */
+
#ifdef CTFPOOL
#define CTFPOOL_REFILL_THRESH 3
typedef struct ctfpool {
uint fast_frees;
uint slow_allocs;
} ctfpool_t;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
#define FASTBUF (1 << 0)
-#define CTFBUF (1 << 1)
#define PKTSETFAST(osh, skb) ((((struct sk_buff*)(skb))->pktc_flags) |= FASTBUF)
#define PKTCLRFAST(osh, skb) ((((struct sk_buff*)(skb))->pktc_flags) &= (~FASTBUF))
-#define PKTSETCTF(osh, skb) ((((struct sk_buff*)(skb))->pktc_flags) |= CTFBUF)
-#define PKTCLRCTF(osh, skb) ((((struct sk_buff*)(skb))->pktc_flags) &= (~CTFBUF))
#define PKTISFAST(osh, skb) ((((struct sk_buff*)(skb))->pktc_flags) & FASTBUF)
-#define PKTISCTF(osh, skb) ((((struct sk_buff*)(skb))->pktc_flags) & CTFBUF)
#define PKTFAST(osh, skb) (((struct sk_buff*)(skb))->pktc_flags)
-#else
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22)
#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)
-#define PKTCLRCTF(osh, skb) ((((struct sk_buff*)(skb))->mac_len) &= (~CTFBUF))
#define PKTISFAST(osh, skb) ((((struct sk_buff*)(skb))->mac_len) & FASTBUF)
-#define PKTISCTF(osh, skb) ((((struct sk_buff*)(skb))->mac_len) & CTFBUF)
#define PKTFAST(osh, skb) (((struct sk_buff*)(skb))->mac_len)
-#endif
#else
#define FASTBUF (1 << 0)
-#define CTFBUF (1 << 1)
#define PKTSETFAST(osh, skb) ((((struct sk_buff*)(skb))->__unused) |= FASTBUF)
#define PKTCLRFAST(osh, skb) ((((struct sk_buff*)(skb))->__unused) &= (~FASTBUF))
-#define PKTSETCTF(osh, skb) ((((struct sk_buff*)(skb))->__unused) |= CTFBUF)
-#define PKTCLRCTF(osh, skb) ((((struct sk_buff*)(skb))->__unused) &= (~CTFBUF))
#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
+#endif /* 2.6.22 */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
#define CTFPOOLPTR(osh, skb) (((struct sk_buff*)(skb))->ctfpool)
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
+#else /* CTFPOOL */
+#define PKTSETFAST(osh, skb)
+#define PKTCLRFAST(osh, skb)
+#define PKTISFAST(osh, skb) (FALSE)
+#endif /* CTFPOOL */
+#define PKTSETCTF(osh, skb)
+#define PKTCLRCTF(osh, skb)
+#define PKTISCTF(osh, skb) (FALSE)
#ifdef HNDCTF
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
#define SKIPCT (1 << 2)
#define PKTSETCHAINED(osh, skb) (((struct sk_buff*)(skb))->pktc_flags |= CHAINED)
#define PKTCLRCHAINED(osh, skb) (((struct sk_buff*)(skb))->pktc_flags &= (~CHAINED))
#define PKTISCHAINED(skb) (((struct sk_buff*)(skb))->pktc_flags & CHAINED)
-#else
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22)
#define SKIPCT (1 << 18)
#define CHAINED (1 << 19)
#define PKTSETSKIPCT(osh, skb) (((struct sk_buff*)(skb))->mac_len |= SKIPCT)
#define PKTSETCHAINED(osh, skb) (((struct sk_buff*)(skb))->mac_len |= CHAINED)
#define PKTCLRCHAINED(osh, skb) (((struct sk_buff*)(skb))->mac_len &= (~CHAINED))
#define PKTISCHAINED(skb) (((struct sk_buff*)(skb))->mac_len & CHAINED)
-#endif
-#else
+#else /* 2.6.22 */
#define SKIPCT (1 << 2)
#define CHAINED (1 << 3)
#define PKTSETSKIPCT(osh, skb) (((struct sk_buff*)(skb))->__unused |= SKIPCT)
#define PKTSETCHAINED(osh, skb) (((struct sk_buff*)(skb))->__unused |= CHAINED)
#define PKTCLRCHAINED(osh, skb) (((struct sk_buff*)(skb))->__unused &= (~CHAINED))
#define PKTISCHAINED(skb) (((struct sk_buff*)(skb))->__unused & CHAINED)
-#endif
+#endif /* 2.6.22 */
typedef struct ctf_mark {
uint32 value;
} ctf_mark_t;
#define CTF_MARK(m) (m.value)
-#else
+#else /* HNDCTF */
#define PKTSETSKIPCT(osh, skb)
#define PKTCLRSKIPCT(osh, skb)
#define PKTSKIPCT(osh, skb)
#define CTF_MARK(m) 0
-#endif
+#endif /* HNDCTF */
extern void osl_pktfree(osl_t *osh, void *skb, bool send);
extern void *osl_pktget_static(osl_t *osh, uint len);
extern void osl_pktfree_static(osl_t *osh, void *skb, bool send);
-
+extern int osh_pktpadtailroom(osl_t *osh, void* skb, int pad);
+
+#ifdef BCMDBG_CTRACE
+#define PKT_CTRACE_DUMP(osh, b) osl_ctrace_dump((osh), (b))
+extern void *osl_pktget(osl_t *osh, uint len, int line, char *file);
+extern void *osl_pkt_frmnative(osl_t *osh, void *skb, int line, char *file);
+extern int osl_pkt_is_frmnative(osl_t *osh, struct sk_buff *pkt);
+extern void *osl_pktdup(osl_t *osh, void *skb, int line, char *file);
+struct bcmstrbuf;
+extern void osl_ctrace_dump(osl_t *osh, struct bcmstrbuf *b);
+#else
extern void *osl_pkt_frmnative(osl_t *osh, void *skb);
extern void *osl_pktget(osl_t *osh, uint len);
extern void *osl_pktdup(osl_t *osh, void *skb);
+#endif /* BCMDBG_CTRACE */
extern struct sk_buff *osl_pkt_tonative(osl_t *osh, void *pkt);
+#ifdef BCMDBG_CTRACE
+#define PKTFRMNATIVE(osh, skb) osl_pkt_frmnative(((osl_t *)osh), \
+ (struct sk_buff*)(skb), __LINE__, __FILE__)
+#define PKTISFRMNATIVE(osh, skb) osl_pkt_is_frmnative((osl_t *)(osh), (struct sk_buff *)(skb))
+#else
#define PKTFRMNATIVE(osh, skb) osl_pkt_frmnative(((osl_t *)osh), (struct sk_buff*)(skb))
+#endif /* BCMDBG_CTRACE */
#define PKTTONATIVE(osh, pkt) osl_pkt_tonative((osl_t *)(osh), (pkt))
#define PKTLINK(skb) (((struct sk_buff*)(skb))->prev)
#define PKTSUMNEEDED(skb) (((struct sk_buff*)(skb))->ip_summed == CHECKSUM_HW)
#define PKTSETSUMGOOD(skb, x) (((struct sk_buff*)(skb))->ip_summed = \
((x) ? CHECKSUM_UNNECESSARY : CHECKSUM_NONE))
-
+/* PKTSETSUMNEEDED and PKTSUMGOOD are not possible because skb->ip_summed is overloaded */
#define PKTSHARED(skb) (((struct sk_buff*)(skb))->cloned)
#ifdef CONFIG_NF_CONNTRACK_MARK
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0))
#define PKTMARK(p) (((struct sk_buff *)(p))->mark)
#define PKTSETMARK(p, m) ((struct sk_buff *)(p))->mark = (m)
-#else
+#else /* !2.6.0 */
#define PKTMARK(p) (((struct sk_buff *)(p))->nfmark)
#define PKTSETMARK(p, m) ((struct sk_buff *)(p))->nfmark = (m)
-#endif
-#else
+#endif /* 2.6.0 */
+#else /* CONFIG_NF_CONNTRACK_MARK */
#define PKTMARK(p) 0
#define PKTSETMARK(p, m)
-#endif
+#endif /* CONFIG_NF_CONNTRACK_MARK */
#define PKTALLOCED(osh) osl_pktalloced(osh)
extern uint osl_pktalloced(osl_t *osh);
osl_dma_map((osh), (va), (size), (direction), (p), (dmah))
#ifdef PKTC
-
+/* Use 8 bytes of skb tstamp field to store below info */
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 CHAIN_NODE(skb) ((struct chain_node*)(((struct sk_buff*)skb)->pktc_cb))
#define PKTCSETATTR(s, f, p, b) ({CHAIN_NODE(s)->flags = (f); CHAIN_NODE(s)->pkts = (p); \
CHAIN_NODE(s)->bytes = (b);})
CHAIN_NODE(s)->bytes)
#define PKTCCNT(skb) (CHAIN_NODE(skb)->pkts)
#define PKTCLEN(skb) (CHAIN_NODE(skb)->bytes)
+#define PKTCGETFLAGS(skb) (CHAIN_NODE(skb)->flags)
+#define PKTCSETFLAGS(skb, f) (CHAIN_NODE(skb)->flags = (f))
+#define PKTCCLRFLAGS(skb) (CHAIN_NODE(skb)->flags = 0)
#define PKTCFLAGS(skb) (CHAIN_NODE(skb)->flags)
#define PKTCSETCNT(skb, c) (CHAIN_NODE(skb)->pkts = (c))
#define PKTCINCRCNT(skb) (CHAIN_NODE(skb)->pkts++)
ASSERT((skb) != NULL); \
FOREACH_CHAINED_PKT((skb), nskb) { \
PKTCLRCHAINED((osh), (skb)); \
- PKTCCLRATTR((skb)); \
+ PKTCCLRFLAGS((skb)); \
PKTFREE((osh), (skb), (send)); \
} \
} while (0)
(t) = (p); \
} \
} while (0)
-#endif
-
-#else
+#endif /* PKTC */
+#else /* ! BCMDRIVER */
+/* ASSERT */
#define ASSERT(exp) do {} while (0)
-
+/* MALLOC and MFREE */
#define MALLOC(o, l) malloc(l)
#define MFREE(o, p, l) free(p)
#include <stdlib.h>
-
+/* str* and mem* functions */
#include <string.h>
-
+/* *printf functions */
#include <stdio.h>
-
+/* bcopy, bcmp, and bzero */
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
+#endif /* ! BCMDRIVER */
-#endif
+#endif /* _linux_osl_h_ */
* 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-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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 367714 2012-11-09 03:26:01Z $
+ * $Id: linuxver.h 397171 2013-04-17 14:22:23Z $
*/
#ifndef _linuxver_h_
#else
#include <linux/autoconf.h>
#endif
-#endif
+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)) */
#include <linux/module.h>
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 0))
-
+/* __NO_VERSION__ must be defined for all linkables except one in 2.2 */
#ifdef __UNDEF_NO_VERSION__
#undef __NO_VERSION__
#else
#define __NO_VERSION__
#endif
-#endif
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 0) */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
#define module_param(_name_, _type_, _perm_) MODULE_PARM(_name_, "i")
MODULE_PARM(_string_, "c" __MODULE_STRING(_size_))
#endif
-
+/* linux/malloc.h is deprecated, use linux/slab.h instead. */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 9))
#include <linux/malloc.h>
#else
#include <linux/semaphore.h>
#else
#include <asm/semaphore.h>
-#endif
+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) */
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28))
#undef IP_TOS
-#endif
+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28)) */
#include <asm/io.h>
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 41))
#ifndef flush_scheduled_work
#define flush_scheduled_work() flush_scheduled_tasks()
#endif
-#endif
+#endif /* LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 41) */
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0))
+#define DAEMONIZE(a)
+#elif ((LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)) && \
+ (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)))
#define DAEMONIZE(a) daemonize(a); \
allow_signal(SIGKILL); \
allow_signal(SIGTERM);
-#else
+#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)))); \
} while (0);
-#endif
+#endif /* LINUX_VERSION_CODE */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)
#define MY_INIT_WORK(_work, _func) INIT_WORK(_work, _func)
#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))
-
+/* Exclude RHEL 5 */
typedef void (*work_func_t)(void *work);
#endif
-#endif
+#endif /* >= 2.6.20 */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0))
-
+/* Some distributions have their own 2.6.x compatibility layers */
#ifndef IRQ_NONE
typedef void irqreturn_t;
#define IRQ_NONE
#endif
#else
typedef irqreturn_t(*FN_ISR) (int irq, void *dev_id, struct pt_regs *ptregs);
-#endif
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
#define IRQF_SHARED SA_SHIRQ
-#endif
+#endif /* < 2.6.18 */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 17)
#ifdef CONFIG_NET_RADIO
#define CONFIG_WIRELESS_EXT
#endif
-#endif
+#endif /* < 2.6.17 */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 67)
#define MOD_INC_USE_COUNT
#define MOD_DEC_USE_COUNT
-#endif
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 67) */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 32)
#include <linux/sched.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 14)
#include <net/ieee80211.h>
#endif
-#endif
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30) */
-#ifdef CUSTOMER_HW4
-#include <linux/kthread.h>
-#endif
#ifndef __exit
#define __exit
#define pci_get_drvdata(dev) (dev)->sysdata
#define pci_set_drvdata(dev, value) (dev)->sysdata = (value)
-
+/*
+ * New-style (2.4.x) PCI/hot-pluggable PCI/CardBus registration
+ */
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; /* Vendor and device ID or PCI_ANY_ID */
+ unsigned int subvendor, subdevice; /* Subsystem ID's or PCI_ANY_ID */
+ unsigned int class, class_mask; /* (class,subclass,prog-if) triplet */
+ unsigned long driver_data; /* Data private to the driver */
};
struct pci_driver {
struct list_head node;
char *name;
- const struct pci_device_id *id_table;
+ const struct pci_device_id *id_table; /* NULL if wants all devices */
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); /* New device inserted */
+ void (*remove)(struct pci_dev *dev); /* Device removed (NULL if not a hot-plug
+ * capable driver)
+ */
+ void (*suspend)(struct pci_dev *dev); /* Device suspended */
+ void (*resume)(struct pci_dev *dev); /* Device woken up */
};
#define MODULE_DEVICE_TABLE(type, name)
#define PCI_ANY_ID (~0)
-
+/* compatpci.c */
#define pci_module_init pci_register_driver
extern int pci_register_driver(struct pci_driver *drv);
extern void pci_unregister_driver(struct pci_driver *drv);
-#endif
+#endif /* PCI registration */
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 18))
#define pci_module_init pci_register_driver
#define module_init(x) __initcall(x);
#define module_exit(x) __exitcall(x);
#endif
-#endif
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 2, 18) */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31)
#define WL_USE_NETDEV_OPS
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 42))
-
+/*
+ * DMA mapping
+ *
+ * See linux/Documentation/DMA-mapping.txt
+ */
#ifndef PCI_DMA_TODEVICE
#define PCI_DMA_TODEVICE 1
typedef u32 dma_addr_t;
-
+/* Pure 2^n version of get_order */
static inline int get_order(unsigned long size)
{
int order;
#define pci_map_single(cookie, address, size, dir) virt_to_bus(address)
#define pci_unmap_single(cookie, address, size, dir)
-#endif
+#endif /* DMA mapping */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 43))
#define dev_kfree_skb_any(a) dev_kfree_skb(a)
#define netif_down(dev) do { (dev)->start = 0; } while (0)
-
+/* pcmcia-cs provides its own netdevice compatibility layer */
#ifndef _COMPAT_NETDEVICE_H
-
+/*
+ * SoftNet
+ *
+ * For pre-softnet kernels we need to tell the upper layer not to
+ * re-enter start_xmit() while we are in there. However softnet
+ * guarantees not to enter while we are in there so there is no need
+ * to do the netif_stop_queue() dance unless the transmit queue really
+ * gets stuck. This should also improve performance according to tests
+ * done by Aman Singla.
+ */
#define dev_kfree_skb_irq(a) dev_kfree_skb(a)
#define netif_wake_queue(dev) \
#define netif_queue_stopped(dev) (dev)->tbusy
#define netif_running(dev) (dev)->start
-#endif
+#endif /* _COMPAT_NETDEVICE_H */
#define netif_device_attach(dev) netif_start_queue(dev)
#define netif_device_detach(dev) netif_stop_queue(dev)
-
+/* 2.4.x renamed bottom halves to tasklets */
#define tasklet_struct tq_struct
static inline void tasklet_schedule(struct tasklet_struct *tasklet)
{
}
#define tasklet_kill(tasklet) { do {} while (0); }
-
+/* 2.4.x introduced del_timer_sync() */
#define del_timer_sync(timer) del_timer(timer)
#else
#define netif_down(dev)
-#endif
+#endif /* SoftNet */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 3))
-
+/*
+ * Emit code to initialise a tq_struct's routine and data pointers
+ */
#define PREPARE_TQUEUE(_tq, _routine, _data) \
do { \
(_tq)->routine = _routine; \
(_tq)->data = _data; \
} while (0)
-
+/*
+ * Emit code to initialise all of a tq_struct
+ */
#define INIT_TQUEUE(_tq, _routine, _data) \
do { \
INIT_LIST_HEAD(&(_tq)->list); \
PREPARE_TQUEUE((_tq), (_routine), (_data)); \
} while (0)
-#endif
-
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 3) */
+/* Power management related macro & routines */
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 9)
#define PCI_SAVE_STATE(a, b) pci_save_state(a)
#define PCI_RESTORE_STATE(a, b) pci_restore_state(a)
for (i = 0; i < 16; i++)
pci_write_config_dword(dev, i * 4, buffer[i]);
}
-
+ /*
+ * otherwise, write the context information we know from bootup.
+ * This works around a problem where warm-booting from Windows
+ * combined with a D3(hot)->D0 transition causes PCI config
+ * header data to be forgotten.
+ */
else {
for (i = 0; i < 6; i ++)
pci_write_config_dword(dev,
}
return 0;
}
-#endif
-
+#endif /* PCI power management */
+/* Old cp0 access macros deprecated in 2.4.19 */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 19))
#define read_c0_count() read_32bit_cp0_register(CP0_COUNT)
#endif
-
+/* Module refcount handled internally in 2.6.x */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24))
#ifndef SET_MODULE_OWNER
#define SET_MODULE_OWNER(dev) do {} while (0)
#define OLD_MOD_INC_USE_COUNT do {} while (0)
#define OLD_MOD_DEC_USE_COUNT do {} while (0)
#endif
-#else
+#else /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24) */
#ifndef SET_MODULE_OWNER
#define SET_MODULE_OWNER(dev) do {} while (0)
#endif
#endif
#define OLD_MOD_INC_USE_COUNT MOD_INC_USE_COUNT
#define OLD_MOD_DEC_USE_COUNT MOD_DEC_USE_COUNT
-#endif
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24) */
#ifndef SET_NETDEV_DEV
#define SET_NETDEV_DEV(net, pdev) do {} while (0)
#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 1, 0))
#ifndef HAVE_FREE_NETDEV
#define free_netdev(dev) kfree(dev)
#endif
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3, 1, 0) */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0))
-
+/* struct packet_type redefined in 2.6.x */
#define af_packet_priv data
#endif
-
+/* suspend args */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
#define DRV_SUSPEND_STATE_TYPE pm_message_t
#else
#endif
typedef struct {
- void *parent;
+ void *parent; /* some external entity that the thread supposed to work for */
+ char *proc_name;
struct task_struct *p_task;
long thr_pid;
- int prio;
+ int prio; /* priority */
struct semaphore sema;
int terminated;
struct completion completed;
} tsk_ctl_t;
-
-
+/* requires tsk_ctl_t tsk argument, the caller's priv data is passed in owner ptr */
+/* note this macro assumes there may be only one context waiting on thread's completion */
#ifdef DHD_DEBUG
#define DBG_THR(x) printk x
#else
#define SMP_RD_BARRIER_DEPENDS(x) smp_rmb(x)
#endif
-
-#define PROC_START(thread_func, owner, tsk_ctl, flags) \
+#ifdef USE_KTHREAD_API
+#define PROC_START(thread_func, owner, tsk_ctl, flags, name) \
{ \
sema_init(&((tsk_ctl)->sema), 0); \
init_completion(&((tsk_ctl)->completed)); \
(tsk_ctl)->parent = owner; \
+ (tsk_ctl)->proc_name = name; \
(tsk_ctl)->terminated = FALSE; \
- (tsk_ctl)->thr_pid = kernel_thread(thread_func, tsk_ctl, flags); \
- if ((tsk_ctl)->thr_pid > 0) \
- wait_for_completion(&((tsk_ctl)->completed)); \
- DBG_THR(("%s thr:%lx started\n", __FUNCTION__, (tsk_ctl)->thr_pid)); \
+ (tsk_ctl)->p_task = kthread_run(thread_func, tsk_ctl, (char*)name); \
+ (tsk_ctl)->thr_pid = (tsk_ctl)->p_task->pid; \
+ DBG_THR(("%s(): thread:%s:%lx started\n", __FUNCTION__, \
+ (tsk_ctl)->proc_name, (tsk_ctl)->thr_pid)); \
}
-
-#ifdef USE_KTHREAD_API
-#define PROC_START2(thread_func, owner, tsk_ctl, flags, name) \
+#else
+#define PROC_START(thread_func, owner, tsk_ctl, flags, name) \
{ \
sema_init(&((tsk_ctl)->sema), 0); \
init_completion(&((tsk_ctl)->completed)); \
(tsk_ctl)->parent = owner; \
+ (tsk_ctl)->proc_name = name; \
(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)); \
+ (tsk_ctl)->thr_pid = kernel_thread(thread_func, tsk_ctl, flags); \
+ if ((tsk_ctl)->thr_pid > 0) \
+ wait_for_completion(&((tsk_ctl)->completed)); \
+ DBG_THR(("%s(): thread:%s:%lx started\n", __FUNCTION__, \
+ (tsk_ctl)->proc_name, (tsk_ctl)->thr_pid)); \
}
-#endif
+#endif /* USE_KTHREAD_API */
#define PROC_STOP(tsk_ctl) \
{ \
smp_wmb(); \
up(&((tsk_ctl)->sema)); \
wait_for_completion(&((tsk_ctl)->completed)); \
- DBG_THR(("%s thr:%lx terminated OK\n", __FUNCTION__, (tsk_ctl)->thr_pid)); \
+ DBG_THR(("%s(): thread:%s:%lx terminated OK\n", __FUNCTION__, \
+ (tsk_ctl)->proc_name, (tsk_ctl)->thr_pid)); \
(tsk_ctl)->thr_pid = -1; \
}
-
+/* ----------------------- */
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31))
#define KILL_PROC(nr, sig) \
kill_proc(pid, sig, 1); \
}
#endif
-#endif
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31) */
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0))
#include <linux/time.h>
__ret; \
})
-#endif
-
+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)) */
+/*
+For < 2.6.24, wl creates its own netdev but doesn't
+align the priv area like the genuine alloc_netdev().
+Since netdev_priv() always gives us the aligned address, it will
+not match our unaligned address for < 2.6.24
+*/
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24))
#define DEV_PRIV(dev) (dev->priv)
#else
#define WL_ISR(i, d, p) wl_isr((i), (d))
#else
#define WL_ISR(i, d, p) wl_isr((i), (d), (p))
-#endif
+#endif /* < 2.6.20 */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0))
#define netdev_priv(dev) dev->priv
-#endif
+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)) */
-#endif
+#endif /* _linuxver_h_ */
/*
* Command line options parser.
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
/*
* Trace messages sent over HBUS
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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: msgtrace.h 281527 2011-09-02 17:12:53Z $
+ * $Id: msgtrace.h 369735 2012-11-19 22:50:22Z $
*/
#ifndef _MSGTRACE_H
/* Message trace header */
typedef BWL_PRE_PACKED_STRUCT struct msgtrace_hdr {
uint8 version;
- uint8 spare;
+ uint8 trace_type;
+#define MSGTRACE_HDR_TYPE_MSG 0
+#define MSGTRACE_HDR_TYPE_LOG 1
uint16 len; /* Len of the trace */
uint32 seqnum; /* Sequence number of message. Useful if the messsage has been lost
* because of DMA error or a bus reset (ex: SDIO Func2)
*/
+ /* Msgtrace type only */
uint32 discarded_bytes; /* Number of discarded bytes because of trace overflow */
uint32 discarded_printf; /* Number of discarded printf because of trace overflow */
} BWL_POST_PACKED_STRUCT msgtrace_hdr_t;
uint16 hdrlen, uint8 *buf, uint16 buflen);
extern void msgtrace_start(void);
extern void msgtrace_stop(void);
-extern void msgtrace_sent(void);
+extern int msgtrace_sent(void);
extern void msgtrace_put(char *buf, int count);
extern void msgtrace_init(void *hdl1, void *hdl2, msgtrace_func_send_t func_send);
extern bool msgtrace_event_enabled(void);
/*
* OS Abstraction Layer
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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 346935 2012-07-25 00:24:55Z $
+ * $Id: osl.h 370064 2012-11-20 21:00:25Z $
*/
#ifndef _osl_h_
#define _osl_h_
-
+/* osl handle type forward declaration */
typedef struct osl_info osl_t;
typedef struct osl_dmainfo osldma_t;
-#define OSL_PKTTAG_SZ 32
-
+#define OSL_PKTTAG_SZ 32 /* Size of PktTag */
+/* Drivers use PKTFREESETCB to register a callback function when a packet is freed by OSL */
typedef void (*pktfree_cb_fn_t)(void *ctx, void *pkt, unsigned int status);
-
+/* Drivers use REGOPSSET() to register register read/write funcitons */
typedef unsigned int (*osl_rreg_fn_t)(void *ctx, volatile void *reg, unsigned int size);
typedef void (*osl_wreg_fn_t)(void *ctx, volatile void *reg, unsigned int val, unsigned int size);
#define PKTCTFMAP(osh, p)
-
+/* --------------------------------------------------------------------------
+** Register manipulation macros.
+*/
#define SET_REG(osh, r, mask, val) W_REG((osh), (r), ((R_REG((osh), r) & ~(mask)) | (val)))
#ifndef AND_REG
#define AND_REG(osh, r, v) W_REG(osh, (r), R_REG(osh, r) & (v))
-#endif
+#endif /* !AND_REG */
#ifndef OR_REG
#define OR_REG(osh, r, v) W_REG(osh, (r), R_REG(osh, r) | (v))
-#endif
+#endif /* !OR_REG */
#if !defined(OSL_SYSUPTIME)
#define OSL_SYSUPTIME() (0)
#define OSL_SYSUPTIME_SUPPORT FALSE
#else
#define OSL_SYSUPTIME_SUPPORT TRUE
-#endif
+#endif /* OSL_SYSUPTIME */
#if !defined(PKTC)
#define PKTCGETATTR(s) (0)
#define PKTCSETATTR(skb, f, p, b)
#define PKTCCLRATTR(skb)
-#define PKTCCNT(skb) (0)
-#define PKTCLEN(skb) (0)
+#define PKTCCNT(skb) (1)
+#define PKTCLEN(skb) PKTLEN(NULL, skb)
+#define PKTCGETFLAGS(skb) (0)
+#define PKTCSETFLAGS(skb, f)
+#define PKTCCLRFLAGS(skb)
#define PKTCFLAGS(skb) (0)
#define PKTCSETCNT(skb, c)
#define PKTCINCRCNT(skb)
#define FOREACH_CHAINED_PKT(skb, nskb) \
for ((nskb) = NULL; (skb) != NULL; (skb) = (nskb))
#define PKTCFREE PKTFREE
-#endif
+#endif /* !linux || !PKTC */
#ifndef HNDCTF
#define PKTSETCHAINED(osh, skb)
#define PKTISCHAINED(skb) (FALSE)
#endif
-#endif
+#endif /* _osl_h_ */
* #include <packed_section_end.h>
*
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
*/
-
+/* Error check - BWL_PACKED_SECTION is defined in packed_section_start.h
+ * and undefined in packed_section_end.h. If it is NOT defined at this
+ * point, then there is a missing include of packed_section_start.h.
+ */
#ifdef BWL_PACKED_SECTION
#undef BWL_PACKED_SECTION
#else
-
+/* Compiler-specific directives for structure packing are declared in
+ * packed_section_start.h. This marks the end of the structure packing section,
+ * so, undef them here.
+ */
#undef BWL_PRE_PACKED_STRUCT
#undef BWL_POST_PACKED_STRUCT
* #include <packed_section_end.h>
*
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
*/
-
+/* Error check - BWL_PACKED_SECTION is defined in packed_section_start.h
+ * and undefined in packed_section_end.h. If it is already defined at this
+ * point, then there is a missing include of packed_section_end.h.
+ */
#ifdef BWL_PACKED_SECTION
#error "BWL_PACKED_SECTION is already defined!"
#else
-
+/* Declare compiler-specific directives for structure packing. */
#if defined(__GNUC__) || defined(__lint)
#define BWL_PRE_PACKED_STRUCT
#define BWL_POST_PACKED_STRUCT __attribute__ ((packed))
--- /dev/null
+/*
+ * pcicfg.h: PCI configuration constants and structures.
+ *
+ * Copyright (C) 1999-2013, 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: pcicfg.h 346935 2012-07-25 00:24:55Z $
+ */
+
+#ifndef _h_pcicfg_
+#define _h_pcicfg_
+
+/* A structure for the config registers is nice, but in most
+ * systems the config space is not memory mapped, so we need
+ * field offsetts. :-(
+ */
+#define PCI_CFG_VID 0
+#define PCI_CFG_DID 2
+#define PCI_CFG_CMD 4
+#define PCI_CFG_STAT 6
+#define PCI_CFG_REV 8
+#define PCI_CFG_PROGIF 9
+#define PCI_CFG_SUBCL 0xa
+#define PCI_CFG_BASECL 0xb
+#define PCI_CFG_CLSZ 0xc
+#define PCI_CFG_LATTIM 0xd
+#define PCI_CFG_HDR 0xe
+#define PCI_CFG_BIST 0xf
+#define PCI_CFG_BAR0 0x10
+#define PCI_CFG_BAR1 0x14
+#define PCI_CFG_BAR2 0x18
+#define PCI_CFG_BAR3 0x1c
+#define PCI_CFG_BAR4 0x20
+#define PCI_CFG_BAR5 0x24
+#define PCI_CFG_CIS 0x28
+#define PCI_CFG_SVID 0x2c
+#define PCI_CFG_SSID 0x2e
+#define PCI_CFG_ROMBAR 0x30
+#define PCI_CFG_CAPPTR 0x34
+#define PCI_CFG_INT 0x3c
+#define PCI_CFG_PIN 0x3d
+#define PCI_CFG_MINGNT 0x3e
+#define PCI_CFG_MAXLAT 0x3f
+#define PCI_CFG_DEVCTRL 0xd8
+#define PCI_BAR0_WIN 0x80 /* backplane addres space accessed by BAR0 */
+#define PCI_BAR1_WIN 0x84 /* backplane addres space accessed by BAR1 */
+#define PCI_SPROM_CONTROL 0x88 /* sprom property control */
+#define PCI_BAR1_CONTROL 0x8c /* BAR1 region burst control */
+#define PCI_INT_STATUS 0x90 /* PCI and other cores interrupts */
+#define PCI_INT_MASK 0x94 /* mask of PCI and other cores interrupts */
+#define PCI_TO_SB_MB 0x98 /* signal backplane interrupts */
+#define PCI_BACKPLANE_ADDR 0xa0 /* address an arbitrary location on the system backplane */
+#define PCI_BACKPLANE_DATA 0xa4 /* data at the location specified by above address */
+#define PCI_CLK_CTL_ST 0xa8 /* pci config space clock control/status (>=rev14) */
+#define PCI_BAR0_WIN2 0xac /* backplane addres space accessed by second 4KB of BAR0 */
+#define PCI_GPIO_IN 0xb0 /* pci config space gpio input (>=rev3) */
+#define PCI_GPIO_OUT 0xb4 /* pci config space gpio output (>=rev3) */
+#define PCI_GPIO_OUTEN 0xb8 /* pci config space gpio output enable (>=rev3) */
+
+#define PCI_BAR0_SHADOW_OFFSET (2 * 1024) /* bar0 + 2K accesses sprom shadow (in pci core) */
+#define PCI_BAR0_SPROM_OFFSET (4 * 1024) /* bar0 + 4K accesses external sprom */
+#define PCI_BAR0_PCIREGS_OFFSET (6 * 1024) /* bar0 + 6K accesses pci core registers */
+#define PCI_BAR0_PCISBR_OFFSET (4 * 1024) /* pci core SB registers are at the end of the
+ * 8KB window, so their address is the "regular"
+ * address plus 4K
+ */
+/*
+ * PCIE GEN2 changed some of the above locations for
+ * Bar0WrapperBase, SecondaryBAR0Window and SecondaryBAR0WrapperBase
+ * BAR0 maps 32K of register space
+*/
+#define PCIE2_BAR0_WIN2 0x70 /* backplane addres space accessed by second 4KB of BAR0 */
+#define PCIE2_BAR0_CORE2_WIN 0x74 /* backplane addres space accessed by second 4KB of BAR0 */
+#define PCIE2_BAR0_CORE2_WIN2 0x78 /* backplane addres space accessed by second 4KB of BAR0 */
+
+#define PCI_BAR0_WINSZ (16 * 1024) /* bar0 window size Match with corerev 13 */
+/* On pci corerev >= 13 and all pcie, the bar0 is now 16KB and it maps: */
+#define PCI_16KB0_PCIREGS_OFFSET (8 * 1024) /* bar0 + 8K accesses pci/pcie core registers */
+#define PCI_16KB0_CCREGS_OFFSET (12 * 1024) /* bar0 + 12K accesses chipc core registers */
+#define PCI_16KBB0_WINSZ (16 * 1024) /* bar0 window size */
+
+
+#define PCI_CONFIG_SPACE_SIZE 256
+#endif /* _h_pcicfg_ */
--- /dev/null
+/*
+ * Copyright (C) 1999-2013, 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 386067 2013-02-19 15:24:20Z $
+ */
+
+#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>
+
+/* This marks the start of a packed structure section. */
+#include <packed_section_start.h>
+
+
+#define DOT11_TU_TO_US 1024 /* 802.11 Time Unit is 1024 microseconds */
+
+/* Generic 802.11 frame constants */
+#define DOT11_A3_HDR_LEN 24 /* d11 header length with A3 */
+#define DOT11_A4_HDR_LEN 30 /* d11 header length with A4 */
+#define DOT11_MAC_HDR_LEN DOT11_A3_HDR_LEN /* MAC header length */
+#define DOT11_FCS_LEN 4 /* d11 FCS length */
+#define DOT11_ICV_LEN 4 /* d11 ICV length */
+#define DOT11_ICV_AES_LEN 8 /* d11 ICV/AES length */
+#define DOT11_QOS_LEN 2 /* d11 QoS length */
+#define DOT11_HTC_LEN 4 /* d11 HT Control field length */
+
+#define DOT11_KEY_INDEX_SHIFT 6 /* d11 key index shift */
+#define DOT11_IV_LEN 4 /* d11 IV length */
+#define DOT11_IV_TKIP_LEN 8 /* d11 IV TKIP length */
+#define DOT11_IV_AES_OCB_LEN 4 /* d11 IV/AES/OCB length */
+#define DOT11_IV_AES_CCM_LEN 8 /* d11 IV/AES/CCM length */
+#define DOT11_IV_MAX_LEN 8 /* maximum iv len for any encryption */
+
+/* Includes MIC */
+#define DOT11_MAX_MPDU_BODY_LEN 2304 /* max MPDU body length */
+/* A4 header + QoS + CCMP + PDU + ICV + FCS = 2352 */
+#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) /* d11 max MPDU length */
+
+#define DOT11_MAX_SSID_LEN 32 /* d11 max ssid length */
+
+/* dot11RTSThreshold */
+#define DOT11_DEFAULT_RTS_LEN 2347 /* d11 default RTS length */
+#define DOT11_MAX_RTS_LEN 2347 /* d11 max RTS length */
+
+/* dot11FragmentationThreshold */
+#define DOT11_MIN_FRAG_LEN 256 /* d11 min fragmentation length */
+#define DOT11_MAX_FRAG_LEN 2346 /* Max frag is also limited by aMPDUMaxLength
+ * of the attached PHY
+ */
+#define DOT11_DEFAULT_FRAG_LEN 2346 /* d11 default fragmentation length */
+
+/* dot11BeaconPeriod */
+#define DOT11_MIN_BEACON_PERIOD 1 /* d11 min beacon period */
+#define DOT11_MAX_BEACON_PERIOD 0xFFFF /* d11 max beacon period */
+
+/* dot11DTIMPeriod */
+#define DOT11_MIN_DTIM_PERIOD 1 /* d11 min DTIM period */
+#define DOT11_MAX_DTIM_PERIOD 0xFF /* d11 max DTIM period */
+
+/* 802.2 LLC/SNAP header used by 802.11 per 802.1H */
+#define DOT11_LLC_SNAP_HDR_LEN 8 /* d11 LLC/SNAP header length */
+#define DOT11_OUI_LEN 3 /* d11 OUI length */
+BWL_PRE_PACKED_STRUCT struct dot11_llc_snap_header {
+ uint8 dsap; /* always 0xAA */
+ uint8 ssap; /* always 0xAA */
+ uint8 ctl; /* always 0x03 */
+ uint8 oui[DOT11_OUI_LEN]; /* RFC1042: 0x00 0x00 0x00
+ * Bridge-Tunnel: 0x00 0x00 0xF8
+ */
+ uint16 type; /* ethertype */
+} BWL_POST_PACKED_STRUCT;
+
+/* RFC1042 header used by 802.11 per 802.1H */
+#define RFC1042_HDR_LEN (ETHER_HDR_LEN + DOT11_LLC_SNAP_HDR_LEN) /* RCF1042 header length */
+
+/* Generic 802.11 MAC header */
+/*
+ * N.B.: This struct reflects the full 4 address 802.11 MAC header.
+ * The fields are defined such that the shorter 1, 2, and 3
+ * address headers just use the first k fields.
+ */
+BWL_PRE_PACKED_STRUCT struct dot11_header {
+ uint16 fc; /* frame control */
+ uint16 durid; /* duration/ID */
+ struct ether_addr a1; /* address 1 */
+ struct ether_addr a2; /* address 2 */
+ struct ether_addr a3; /* address 3 */
+ uint16 seq; /* sequence control */
+ struct ether_addr a4; /* address 4 */
+} BWL_POST_PACKED_STRUCT;
+
+/* Control frames */
+
+BWL_PRE_PACKED_STRUCT struct dot11_rts_frame {
+ uint16 fc; /* frame control */
+ uint16 durid; /* duration/ID */
+ struct ether_addr ra; /* receiver address */
+ struct ether_addr ta; /* transmitter address */
+} BWL_POST_PACKED_STRUCT;
+#define DOT11_RTS_LEN 16 /* d11 RTS frame length */
+
+BWL_PRE_PACKED_STRUCT struct dot11_cts_frame {
+ uint16 fc; /* frame control */
+ uint16 durid; /* duration/ID */
+ struct ether_addr ra; /* receiver address */
+} BWL_POST_PACKED_STRUCT;
+#define DOT11_CTS_LEN 10 /* d11 CTS frame length */
+
+BWL_PRE_PACKED_STRUCT struct dot11_ack_frame {
+ uint16 fc; /* frame control */
+ uint16 durid; /* duration/ID */
+ struct ether_addr ra; /* receiver address */
+} BWL_POST_PACKED_STRUCT;
+#define DOT11_ACK_LEN 10 /* d11 ACK frame length */
+
+BWL_PRE_PACKED_STRUCT struct dot11_ps_poll_frame {
+ uint16 fc; /* frame control */
+ uint16 durid; /* AID */
+ struct ether_addr bssid; /* receiver address, STA in AP */
+ struct ether_addr ta; /* transmitter address */
+} BWL_POST_PACKED_STRUCT;
+#define DOT11_PS_POLL_LEN 16 /* d11 PS poll frame length */
+
+BWL_PRE_PACKED_STRUCT struct dot11_cf_end_frame {
+ uint16 fc; /* frame control */
+ uint16 durid; /* duration/ID */
+ struct ether_addr ra; /* receiver address */
+ struct ether_addr bssid; /* transmitter address, STA in AP */
+} BWL_POST_PACKED_STRUCT;
+#define DOT11_CS_END_LEN 16 /* d11 CF-END frame length */
+
+/* RWL wifi protocol: The Vendor Specific Action frame is defined for vendor-specific signaling
+* category+OUI+vendor specific content ( this can be variable)
+*/
+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;
+
+/* generic vender specific action frame with variable length */
+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
+
+/* BA/BAR Control parameters */
+#define DOT11_BA_CTL_POLICY_NORMAL 0x0000 /* normal ack */
+#define DOT11_BA_CTL_POLICY_NOACK 0x0001 /* no ack */
+#define DOT11_BA_CTL_POLICY_MASK 0x0001 /* ack policy mask */
+
+#define DOT11_BA_CTL_MTID 0x0002 /* multi tid BA */
+#define DOT11_BA_CTL_COMPRESSED 0x0004 /* compressed bitmap */
+
+#define DOT11_BA_CTL_NUMMSDU_MASK 0x0FC0 /* num msdu in bitmap mask */
+#define DOT11_BA_CTL_NUMMSDU_SHIFT 6 /* num msdu in bitmap shift */
+
+#define DOT11_BA_CTL_TID_MASK 0xF000 /* tid mask */
+#define DOT11_BA_CTL_TID_SHIFT 12 /* tid shift */
+
+/* control frame header (BA/BAR) */
+BWL_PRE_PACKED_STRUCT struct dot11_ctl_header {
+ uint16 fc; /* frame control */
+ uint16 durid; /* duration/ID */
+ struct ether_addr ra; /* receiver address */
+ struct ether_addr ta; /* transmitter address */
+} BWL_POST_PACKED_STRUCT;
+#define DOT11_CTL_HDR_LEN 16 /* control frame hdr len */
+
+/* BAR frame payload */
+BWL_PRE_PACKED_STRUCT struct dot11_bar {
+ uint16 bar_control; /* BAR Control */
+ uint16 seqnum; /* Starting Sequence control */
+} BWL_POST_PACKED_STRUCT;
+#define DOT11_BAR_LEN 4 /* BAR frame payload length */
+
+#define DOT11_BA_BITMAP_LEN 128 /* bitmap length */
+#define DOT11_BA_CMP_BITMAP_LEN 8 /* compressed bitmap length */
+/* BA frame payload */
+BWL_PRE_PACKED_STRUCT struct dot11_ba {
+ uint16 ba_control; /* BA Control */
+ uint16 seqnum; /* Starting Sequence control */
+ uint8 bitmap[DOT11_BA_BITMAP_LEN]; /* Block Ack Bitmap */
+} BWL_POST_PACKED_STRUCT;
+#define DOT11_BA_LEN 4 /* BA frame payload len (wo bitmap) */
+
+/* Management frame header */
+BWL_PRE_PACKED_STRUCT struct dot11_management_header {
+ uint16 fc; /* frame control */
+ uint16 durid; /* duration/ID */
+ struct ether_addr da; /* receiver address */
+ struct ether_addr sa; /* transmitter address */
+ struct ether_addr bssid; /* BSS ID */
+ uint16 seq; /* sequence control */
+} BWL_POST_PACKED_STRUCT;
+#define DOT11_MGMT_HDR_LEN 24 /* d11 management header length */
+
+/* Management frame payloads */
+
+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 /* 802.11 beacon/probe frame fixed length */
+#define DOT11_BCN_PRB_FIXED_LEN 12 /* 802.11 beacon/probe frame fixed length */
+
+BWL_PRE_PACKED_STRUCT struct dot11_auth {
+ uint16 alg; /* algorithm */
+ uint16 seq; /* sequence control */
+ uint16 status; /* status code */
+} BWL_POST_PACKED_STRUCT;
+#define DOT11_AUTH_FIXED_LEN 6 /* length of auth frame without challenge IE */
+
+BWL_PRE_PACKED_STRUCT struct dot11_assoc_req {
+ uint16 capability; /* capability information */
+ uint16 listen; /* listen interval */
+} BWL_POST_PACKED_STRUCT;
+#define DOT11_ASSOC_REQ_FIXED_LEN 4 /* length of assoc frame without info elts */
+
+BWL_PRE_PACKED_STRUCT struct dot11_reassoc_req {
+ uint16 capability; /* capability information */
+ uint16 listen; /* listen interval */
+ struct ether_addr ap; /* Current AP address */
+} BWL_POST_PACKED_STRUCT;
+#define DOT11_REASSOC_REQ_FIXED_LEN 10 /* length of assoc frame without info elts */
+
+BWL_PRE_PACKED_STRUCT struct dot11_assoc_resp {
+ uint16 capability; /* capability information */
+ uint16 status; /* status code */
+ uint16 aid; /* association ID */
+} BWL_POST_PACKED_STRUCT;
+#define DOT11_ASSOC_RESP_FIXED_LEN 6 /* length of assoc resp frame without info elts */
+
+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 /* d11 action measurement header length */
+
+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;
+
+BWL_PRE_PACKED_STRUCT struct dot11_action_vht_oper_mode {
+ uint8 category;
+ uint8 action;
+ uint8 mode;
+} BWL_POST_PACKED_STRUCT;
+
+#define SM_PWRSAVE_ENABLE 1
+#define SM_PWRSAVE_MODE 2
+
+/* ************* 802.11h related definitions. ************* */
+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 /* length of IE data, not including 2 byte header */
+
+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;
+
+/* Extension Channel Offset IE: 802.11n-D1.0 spec. added sideband
+ * offset for 40MHz operation. The possible 3 values are:
+ * 1 = above control channel
+ * 3 = below control channel
+ * 0 = no extension channel
+ */
+BWL_PRE_PACKED_STRUCT struct dot11_extch {
+ uint8 id; /* IE ID, 62, DOT11_MNG_EXT_CHANNEL_OFFSET */
+ uint8 len; /* IE length */
+ uint8 extch;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_extch dot11_extch_ie_t;
+
+BWL_PRE_PACKED_STRUCT struct dot11_brcm_extch {
+ uint8 id; /* IE ID, 221, DOT11_MNG_PROPR_ID */
+ uint8 len; /* IE length */
+ uint8 oui[3]; /* Proprietary OUI, BRCM_PROP_OUI */
+ uint8 type; /* type inidicates what follows */
+ 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 /* 802.11n ID not yet assigned */
+#define DOT11_EXTCH_IE_LEN 1
+#define DOT11_EXT_CH_MASK 0x03 /* extension channel mask */
+#define DOT11_EXT_CH_UPPER 0x01 /* ext. ch. on upper sb */
+#define DOT11_EXT_CH_LOWER 0x03 /* ext. ch. on lower sb */
+#define DOT11_EXT_CH_NONE 0x00 /* no extension ch. */
+
+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
+
+/* CSA IE data structure */
+BWL_PRE_PACKED_STRUCT struct dot11_channel_switch {
+ uint8 id; /* id DOT11_MNG_CHANNEL_SWITCH_ID */
+ uint8 len; /* length of IE */
+ uint8 mode; /* mode 0 or 1 */
+ uint8 channel; /* channel switch to */
+ uint8 count; /* number of beacons before switching */
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_channel_switch dot11_chan_switch_ie_t;
+
+#define DOT11_SWITCH_IE_LEN 3 /* length of IE data, not including 2 byte header */
+/* CSA mode - 802.11h-2003 $7.3.2.20 */
+#define DOT11_CSA_MODE_ADVISORY 0 /* no DOT11_CSA_MODE_NO_TX restriction imposed */
+#define DOT11_CSA_MODE_NO_TX 1 /* no transmission upon receiving CSA frame. */
+
+BWL_PRE_PACKED_STRUCT struct dot11_action_switch_channel {
+ uint8 category;
+ uint8 action;
+ dot11_chan_switch_ie_t chan_switch_ie; /* for switch IE */
+ dot11_brcm_extch_ie_t extch_ie; /* extension channel offset */
+} BWL_POST_PACKED_STRUCT;
+
+BWL_PRE_PACKED_STRUCT struct dot11_csa_body {
+ uint8 mode; /* mode 0 or 1 */
+ uint8 reg; /* regulatory class */
+ uint8 channel; /* channel switch to */
+ uint8 count; /* number of beacons before switching */
+} BWL_POST_PACKED_STRUCT;
+
+/* 11n Extended Channel Switch IE data structure */
+BWL_PRE_PACKED_STRUCT struct dot11_ext_csa {
+ uint8 id; /* id DOT11_MNG_EXT_CHANNEL_SWITCH_ID */
+ uint8 len; /* length of IE */
+ struct dot11_csa_body b; /* body of the ie */
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_ext_csa dot11_ext_csa_ie_t;
+#define DOT11_EXT_CSA_IE_LEN 4 /* length of extended channel switch IE body */
+
+BWL_PRE_PACKED_STRUCT struct dot11_action_ext_csa {
+ uint8 category;
+ uint8 action;
+ dot11_ext_csa_ie_t chan_switch_ie; /* for switch IE */
+} BWL_POST_PACKED_STRUCT;
+
+BWL_PRE_PACKED_STRUCT struct dot11y_action_ext_csa {
+ uint8 category;
+ uint8 action;
+ struct dot11_csa_body b; /* body of the ie */
+} BWL_POST_PACKED_STRUCT;
+
+/* Wide Bandwidth Channel Switch IE data structure */
+BWL_PRE_PACKED_STRUCT struct dot11_wide_bw_channel_switch {
+ uint8 id; /* id DOT11_MNG_WIDE_BW_CHANNEL_SWITCH_ID */
+ uint8 len; /* length of IE */
+ uint8 channel_width; /* new channel width */
+ uint8 center_frequency_segment_0; /* center frequency segment 0 */
+ uint8 center_frequency_segment_1; /* center frequency segment 1 */
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_wide_bw_channel_switch dot11_wide_bw_chan_switch_ie_t;
+
+#define DOT11_WIDE_BW_SWITCH_IE_LEN 3 /* length of IE data, not including 2 byte header */
+
+/* Channel Switch Wrapper IE data structure */
+BWL_PRE_PACKED_STRUCT struct dot11_channel_switch_wrapper {
+ uint8 id; /* id DOT11_MNG_WIDE_BW_CHANNEL_SWITCH_ID */
+ uint8 len; /* length of IE */
+ dot11_wide_bw_chan_switch_ie_t wb_chan_switch_ie;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_channel_switch_wrapper dot11_chan_switch_wrapper_ie_t;
+
+/* VHT Transmit Power Envelope IE data structure */
+BWL_PRE_PACKED_STRUCT struct dot11_vht_transmit_power_envelope {
+ uint8 id; /* id DOT11_MNG_WIDE_BW_CHANNEL_SWITCH_ID */
+ uint8 len; /* length of IE */
+ uint8 transmit_power_info;
+ uint8 local_max_transmit_power_20;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_vht_transmit_power_envelope dot11_vht_transmit_power_envelope_ie_t;
+
+
+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 /* length of OBSS Coexistence INFO IE */
+
+#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 /* fixed length of regclass */
+
+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 8
+
+#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
+#define DOT11_11AC_EXTCAP_LEN_TDLS 8
+
+#define DOT11_EXTCAP_LEN_FMS 2
+#define DOT11_EXTCAP_LEN_PROXY_ARP 2
+#define DOT11_EXTCAP_LEN_TFS 3
+#define DOT11_EXTCAP_LEN_WNM_SLEEP 3
+#define DOT11_EXTCAP_LEN_TIMBC 3
+#define DOT11_EXTCAP_LEN_BSSTRANS 3
+#define DOT11_EXTCAP_LEN_DMS 4
+#define DOT11_EXTCAP_LEN_WNM_NOTIFICATION 6
+#define DOT11_EXTCAP_LEN_TDLS_WBW 8
+#define DOT11_EXTCAP_LEN_OPMODE_NOTIFICATION 8
+
+BWL_PRE_PACKED_STRUCT struct dot11_extcap {
+ uint8 extcap[DOT11_EXTCAP_LEN_MAX];
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_extcap dot11_extcap_t;
+
+/* TDLS Capabilities */
+#define DOT11_TDLS_CAP_TDLS 37 /* TDLS support */
+#define DOT11_TDLS_CAP_PU_BUFFER_STA 28 /* TDLS Peer U-APSD buffer STA support */
+#define DOT11_TDLS_CAP_PEER_PSM 20 /* TDLS Peer PSM support */
+#define DOT11_TDLS_CAP_CH_SW 30 /* TDLS Channel switch */
+#define DOT11_TDLS_CAP_PROH 38 /* TDLS prohibited */
+#define DOT11_TDLS_CAP_CH_SW_PROH 39 /* TDLS Channel switch prohibited */
+#define DOT11_TDLS_CAP_TDLS_WIDER_BW 61 /* TDLS Wider Band-Width */
+
+#define TDLS_CAP_MAX_BIT 39 /* TDLS max bit defined in ext cap */
+
+/* 802.11h/802.11k Measurement Request/Report IEs */
+/* Measurement Type field */
+#define DOT11_MEASURE_TYPE_BASIC 0 /* d11 measurement basic type */
+#define DOT11_MEASURE_TYPE_CCA 1 /* d11 measurement CCA type */
+#define DOT11_MEASURE_TYPE_RPI 2 /* d11 measurement RPI type */
+#define DOT11_MEASURE_TYPE_CHLOAD 3 /* d11 measurement Channel Load type */
+#define DOT11_MEASURE_TYPE_NOISE 4 /* d11 measurement Noise Histogram type */
+#define DOT11_MEASURE_TYPE_BEACON 5 /* d11 measurement Beacon type */
+#define DOT11_MEASURE_TYPE_FRAME 6 /* d11 measurement Frame type */
+#define DOT11_MEASURE_TYPE_STAT 7 /* d11 measurement STA Statistics type */
+#define DOT11_MEASURE_TYPE_LCI 8 /* d11 measurement LCI type */
+#define DOT11_MEASURE_TYPE_TXSTREAM 9 /* d11 measurement TX Stream type */
+#define DOT11_MEASURE_TYPE_PAUSE 255 /* d11 measurement pause type */
+
+/* Measurement Request Modes */
+#define DOT11_MEASURE_MODE_PARALLEL (1<<0) /* d11 measurement parallel */
+#define DOT11_MEASURE_MODE_ENABLE (1<<1) /* d11 measurement enable */
+#define DOT11_MEASURE_MODE_REQUEST (1<<2) /* d11 measurement request */
+#define DOT11_MEASURE_MODE_REPORT (1<<3) /* d11 measurement report */
+#define DOT11_MEASURE_MODE_DUR (1<<4) /* d11 measurement dur mandatory */
+/* Measurement Report Modes */
+#define DOT11_MEASURE_MODE_LATE (1<<0) /* d11 measurement late */
+#define DOT11_MEASURE_MODE_INCAPABLE (1<<1) /* d11 measurement incapable */
+#define DOT11_MEASURE_MODE_REFUSED (1<<2) /* d11 measurement refuse */
+/* Basic Measurement Map bits */
+#define DOT11_MEASURE_BASIC_MAP_BSS ((uint8)(1<<0)) /* d11 measurement basic map BSS */
+#define DOT11_MEASURE_BASIC_MAP_OFDM ((uint8)(1<<1)) /* d11 measurement map OFDM */
+#define DOT11_MEASURE_BASIC_MAP_UKNOWN ((uint8)(1<<2)) /* d11 measurement map unknown */
+#define DOT11_MEASURE_BASIC_MAP_RADAR ((uint8)(1<<3)) /* d11 measurement map radar */
+#define DOT11_MEASURE_BASIC_MAP_UNMEAS ((uint8)(1<<4)) /* d11 measurement map unmeasuremnt */
+
+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 /* d11 measurement request IE length */
+/* length of Measure Request IE data not including variable len */
+#define DOT11_MNG_IE_MREQ_FIXED_LEN 3 /* d11 measurement request IE fixed length */
+
+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;
+
+/* length of Measure Report IE data not including variable len */
+#define DOT11_MNG_IE_MREP_FIXED_LEN 3 /* d11 measurement response IE fixed length */
+
+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 /* d11 measurement basic report length */
+
+BWL_PRE_PACKED_STRUCT struct dot11_quiet {
+ uint8 id;
+ uint8 len;
+ uint8 count; /* TBTTs until beacon interval in quiet starts */
+ uint8 period; /* Beacon intervals between periodic quiet periods ? */
+ uint16 duration; /* Length of quiet period, in TU's */
+ uint16 offset; /* TU's offset from TBTT in Count field */
+} 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;
+
+/* WME Elements */
+#define WME_OUI "\x00\x50\xf2" /* WME OUI */
+#define WME_OUI_LEN 3
+#define WME_OUI_TYPE 2 /* WME type */
+#define WME_TYPE 2 /* WME type, deprecated */
+#define WME_SUBTYPE_IE 0 /* Information Element */
+#define WME_SUBTYPE_PARAM_IE 1 /* Parameter Element */
+#define WME_SUBTYPE_TSPEC 2 /* Traffic Specification */
+#define WME_VER 1 /* WME version */
+
+/* WME Access Category Indices (ACIs) */
+#define AC_BE 0 /* Best Effort */
+#define AC_BK 1 /* Background */
+#define AC_VI 2 /* Video */
+#define AC_VO 3 /* Voice */
+#define AC_COUNT 4 /* number of ACs */
+
+typedef uint8 ac_bitmap_t; /* AC bitmap of (1 << AC_xx) */
+
+#define AC_BITMAP_NONE 0x0 /* No ACs */
+#define AC_BITMAP_ALL 0xf /* All ACs */
+#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))))
+
+/* WME Information Element (IE) */
+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 /* WME IE length */
+
+BWL_PRE_PACKED_STRUCT struct edcf_acparam {
+ uint8 ACI;
+ uint8 ECW;
+ uint16 TXOP; /* stored in network order (ls octet first) */
+} BWL_POST_PACKED_STRUCT;
+typedef struct edcf_acparam edcf_acparam_t;
+
+/* WME Parameter Element (PE) */
+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 /* WME Parameter IE length */
+
+/* QoS Info field for IE as sent from AP */
+#define WME_QI_AP_APSD_MASK 0x80 /* U-APSD Supported mask */
+#define WME_QI_AP_APSD_SHIFT 7 /* U-APSD Supported shift */
+#define WME_QI_AP_COUNT_MASK 0x0f /* Parameter set count mask */
+#define WME_QI_AP_COUNT_SHIFT 0 /* Parameter set count shift */
+
+/* QoS Info field for IE as sent from STA */
+#define WME_QI_STA_MAXSPLEN_MASK 0x60 /* Max Service Period Length mask */
+#define WME_QI_STA_MAXSPLEN_SHIFT 5 /* Max Service Period Length shift */
+#define WME_QI_STA_APSD_ALL_MASK 0xf /* APSD all AC bits mask */
+#define WME_QI_STA_APSD_ALL_SHIFT 0 /* APSD all AC bits shift */
+#define WME_QI_STA_APSD_BE_MASK 0x8 /* APSD AC_BE mask */
+#define WME_QI_STA_APSD_BE_SHIFT 3 /* APSD AC_BE shift */
+#define WME_QI_STA_APSD_BK_MASK 0x4 /* APSD AC_BK mask */
+#define WME_QI_STA_APSD_BK_SHIFT 2 /* APSD AC_BK shift */
+#define WME_QI_STA_APSD_VI_MASK 0x2 /* APSD AC_VI mask */
+#define WME_QI_STA_APSD_VI_SHIFT 1 /* APSD AC_VI shift */
+#define WME_QI_STA_APSD_VO_MASK 0x1 /* APSD AC_VO mask */
+#define WME_QI_STA_APSD_VO_SHIFT 0 /* APSD AC_VO shift */
+
+/* ACI */
+#define EDCF_AIFSN_MIN 1 /* AIFSN minimum value */
+#define EDCF_AIFSN_MAX 15 /* AIFSN maximum value */
+#define EDCF_AIFSN_MASK 0x0f /* AIFSN mask */
+#define EDCF_ACM_MASK 0x10 /* ACM mask */
+#define EDCF_ACI_MASK 0x60 /* ACI mask */
+#define EDCF_ACI_SHIFT 5 /* ACI shift */
+#define EDCF_AIFSN_SHIFT 12 /* 4 MSB(0xFFF) in ifs_ctl for AC idx */
+
+/* ECW */
+#define EDCF_ECW_MIN 0 /* cwmin/cwmax exponent minimum value */
+#define EDCF_ECW_MAX 15 /* cwmin/cwmax exponent maximum value */
+#define EDCF_ECW2CW(exp) ((1 << (exp)) - 1)
+#define EDCF_ECWMIN_MASK 0x0f /* cwmin exponent form mask */
+#define EDCF_ECWMAX_MASK 0xf0 /* cwmax exponent form mask */
+#define EDCF_ECWMAX_SHIFT 4 /* cwmax exponent form shift */
+
+/* TXOP */
+#define EDCF_TXOP_MIN 0 /* TXOP minimum value */
+#define EDCF_TXOP_MAX 65535 /* TXOP maximum value */
+#define EDCF_TXOP2USEC(txop) ((txop) << 5)
+
+/* Default BE ACI value for non-WME connection STA */
+#define NON_EDCF_AC_BE_ACI_STA 0x02
+
+/* Default EDCF parameters that AP advertises for STA to use; WMM draft Table 12 */
+#define EDCF_AC_BE_ACI_STA 0x03 /* STA ACI value for best effort AC */
+#define EDCF_AC_BE_ECW_STA 0xA4 /* STA ECW value for best effort AC */
+#define EDCF_AC_BE_TXOP_STA 0x0000 /* STA TXOP value for best effort AC */
+#define EDCF_AC_BK_ACI_STA 0x27 /* STA ACI value for background AC */
+#define EDCF_AC_BK_ECW_STA 0xA4 /* STA ECW value for background AC */
+#define EDCF_AC_BK_TXOP_STA 0x0000 /* STA TXOP value for background AC */
+#define EDCF_AC_VI_ACI_STA 0x42 /* STA ACI value for video AC */
+#define EDCF_AC_VI_ECW_STA 0x43 /* STA ECW value for video AC */
+#define EDCF_AC_VI_TXOP_STA 0x005e /* STA TXOP value for video AC */
+#define EDCF_AC_VO_ACI_STA 0x62 /* STA ACI value for audio AC */
+#define EDCF_AC_VO_ECW_STA 0x32 /* STA ECW value for audio AC */
+#define EDCF_AC_VO_TXOP_STA 0x002f /* STA TXOP value for audio AC */
+
+/* Default EDCF parameters that AP uses; WMM draft Table 14 */
+#define EDCF_AC_BE_ACI_AP 0x03 /* AP ACI value for best effort AC */
+#define EDCF_AC_BE_ECW_AP 0x64 /* AP ECW value for best effort AC */
+#define EDCF_AC_BE_TXOP_AP 0x0000 /* AP TXOP value for best effort AC */
+#define EDCF_AC_BK_ACI_AP 0x27 /* AP ACI value for background AC */
+#define EDCF_AC_BK_ECW_AP 0xA4 /* AP ECW value for background AC */
+#define EDCF_AC_BK_TXOP_AP 0x0000 /* AP TXOP value for background AC */
+#define EDCF_AC_VI_ACI_AP 0x41 /* AP ACI value for video AC */
+#define EDCF_AC_VI_ECW_AP 0x43 /* AP ECW value for video AC */
+#define EDCF_AC_VI_TXOP_AP 0x005e /* AP TXOP value for video AC */
+#define EDCF_AC_VO_ACI_AP 0x61 /* AP ACI value for audio AC */
+#define EDCF_AC_VO_ECW_AP 0x32 /* AP ECW value for audio AC */
+#define EDCF_AC_VO_TXOP_AP 0x002f /* AP TXOP value for audio AC */
+
+/* EDCA Parameter IE */
+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 /* EDCA Parameter IE length */
+
+/* QoS Capability IE */
+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; /* 11, DOT11_MNG_QBSS_LOAD_ID */
+ uint8 length;
+ uint16 station_count; /* total number of STAs associated */
+ uint8 channel_utilization; /* % of time, normalized to 255, QAP sensed medium busy */
+ uint16 aac; /* available admission capacity */
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_qbss_load_ie dot11_qbss_load_ie_t;
+#define BSS_LOAD_IE_SIZE 7 /* BSS load IE size */
+
+/* nom_msdu_size */
+#define FIXED_MSDU_SIZE 0x8000 /* MSDU size is fixed */
+#define MSDU_SIZE_MASK 0x7fff /* (Nominal or fixed) MSDU size */
+
+/* surplus_bandwidth */
+/* Represented as 3 bits of integer, binary point, 13 bits fraction */
+#define INTEGER_SHIFT 13 /* integer shift */
+#define FRACTION_MASK 0x1FFF /* fraction mask */
+
+/* Management Notification Frame */
+BWL_PRE_PACKED_STRUCT struct dot11_management_notification {
+ uint8 category; /* DOT11_ACTION_NOTIFICATION */
+ uint8 action;
+ uint8 token;
+ uint8 status;
+ uint8 data[1]; /* Elements */
+} BWL_POST_PACKED_STRUCT;
+#define DOT11_MGMT_NOTIFICATION_LEN 4 /* Fixed length */
+
+/* Timeout Interval IE */
+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
+
+/* WME Action Codes */
+#define WME_ADDTS_REQUEST 0 /* WME ADDTS request */
+#define WME_ADDTS_RESPONSE 1 /* WME ADDTS response */
+#define WME_DELTS_REQUEST 2 /* WME DELTS request */
+
+/* WME Setup Response Status Codes */
+#define WME_ADMISSION_ACCEPTED 0 /* WME admission accepted */
+#define WME_INVALID_PARAMETERS 1 /* WME invalide parameters */
+#define WME_ADMISSION_REFUSED 3 /* WME admission refused */
+
+/* Macro to take a pointer to a beacon or probe response
+ * body and return the char* pointer to the SSID info element
+ */
+#define BCN_PRB_SSID(body) ((char*)(body) + DOT11_BCN_PRB_LEN)
+
+/* Authentication frame payload constants */
+#define DOT11_OPEN_SYSTEM 0 /* d11 open authentication */
+#define DOT11_SHARED_KEY 1 /* d11 shared authentication */
+#define DOT11_FAST_BSS 2 /* d11 fast bss authentication */
+#define DOT11_CHALLENGE_LEN 128 /* d11 challenge text length */
+
+/* Frame control macros */
+#define FC_PVER_MASK 0x3 /* PVER mask */
+#define FC_PVER_SHIFT 0 /* PVER shift */
+#define FC_TYPE_MASK 0xC /* type mask */
+#define FC_TYPE_SHIFT 2 /* type shift */
+#define FC_SUBTYPE_MASK 0xF0 /* subtype mask */
+#define FC_SUBTYPE_SHIFT 4 /* subtype shift */
+#define FC_TODS 0x100 /* to DS */
+#define FC_TODS_SHIFT 8 /* to DS shift */
+#define FC_FROMDS 0x200 /* from DS */
+#define FC_FROMDS_SHIFT 9 /* from DS shift */
+#define FC_MOREFRAG 0x400 /* more frag. */
+#define FC_MOREFRAG_SHIFT 10 /* more frag. shift */
+#define FC_RETRY 0x800 /* retry */
+#define FC_RETRY_SHIFT 11 /* retry shift */
+#define FC_PM 0x1000 /* PM */
+#define FC_PM_SHIFT 12 /* PM shift */
+#define FC_MOREDATA 0x2000 /* more data */
+#define FC_MOREDATA_SHIFT 13 /* more data shift */
+#define FC_WEP 0x4000 /* WEP */
+#define FC_WEP_SHIFT 14 /* WEP shift */
+#define FC_ORDER 0x8000 /* order */
+#define FC_ORDER_SHIFT 15 /* order shift */
+
+/* sequence control macros */
+#define SEQNUM_SHIFT 4 /* seq. number shift */
+#define SEQNUM_MAX 0x1000 /* max seqnum + 1 */
+#define FRAGNUM_MASK 0xF /* frag. number mask */
+
+/* Frame Control type/subtype defs */
+
+/* FC Types */
+#define FC_TYPE_MNG 0 /* management type */
+#define FC_TYPE_CTL 1 /* control type */
+#define FC_TYPE_DATA 2 /* data type */
+
+/* Management Subtypes */
+#define FC_SUBTYPE_ASSOC_REQ 0 /* assoc. request */
+#define FC_SUBTYPE_ASSOC_RESP 1 /* assoc. response */
+#define FC_SUBTYPE_REASSOC_REQ 2 /* reassoc. request */
+#define FC_SUBTYPE_REASSOC_RESP 3 /* reassoc. response */
+#define FC_SUBTYPE_PROBE_REQ 4 /* probe request */
+#define FC_SUBTYPE_PROBE_RESP 5 /* probe response */
+#define FC_SUBTYPE_BEACON 8 /* beacon */
+#define FC_SUBTYPE_ATIM 9 /* ATIM */
+#define FC_SUBTYPE_DISASSOC 10 /* disassoc. */
+#define FC_SUBTYPE_AUTH 11 /* authentication */
+#define FC_SUBTYPE_DEAUTH 12 /* de-authentication */
+#define FC_SUBTYPE_ACTION 13 /* action */
+#define FC_SUBTYPE_ACTION_NOACK 14 /* action no-ack */
+
+/* Control Subtypes */
+#define FC_SUBTYPE_CTL_WRAPPER 7 /* Control Wrapper */
+#define FC_SUBTYPE_BLOCKACK_REQ 8 /* Block Ack Req */
+#define FC_SUBTYPE_BLOCKACK 9 /* Block Ack */
+#define FC_SUBTYPE_PS_POLL 10 /* PS poll */
+#define FC_SUBTYPE_RTS 11 /* RTS */
+#define FC_SUBTYPE_CTS 12 /* CTS */
+#define FC_SUBTYPE_ACK 13 /* ACK */
+#define FC_SUBTYPE_CF_END 14 /* CF-END */
+#define FC_SUBTYPE_CF_END_ACK 15 /* CF-END ACK */
+
+/* Data Subtypes */
+#define FC_SUBTYPE_DATA 0 /* Data */
+#define FC_SUBTYPE_DATA_CF_ACK 1 /* Data + CF-ACK */
+#define FC_SUBTYPE_DATA_CF_POLL 2 /* Data + CF-Poll */
+#define FC_SUBTYPE_DATA_CF_ACK_POLL 3 /* Data + CF-Ack + CF-Poll */
+#define FC_SUBTYPE_NULL 4 /* Null */
+#define FC_SUBTYPE_CF_ACK 5 /* CF-Ack */
+#define FC_SUBTYPE_CF_POLL 6 /* CF-Poll */
+#define FC_SUBTYPE_CF_ACK_POLL 7 /* CF-Ack + CF-Poll */
+#define FC_SUBTYPE_QOS_DATA 8 /* QoS Data */
+#define FC_SUBTYPE_QOS_DATA_CF_ACK 9 /* QoS Data + CF-Ack */
+#define FC_SUBTYPE_QOS_DATA_CF_POLL 10 /* QoS Data + CF-Poll */
+#define FC_SUBTYPE_QOS_DATA_CF_ACK_POLL 11 /* QoS Data + CF-Ack + CF-Poll */
+#define FC_SUBTYPE_QOS_NULL 12 /* QoS Null */
+#define FC_SUBTYPE_QOS_CF_POLL 14 /* QoS CF-Poll */
+#define FC_SUBTYPE_QOS_CF_ACK_POLL 15 /* QoS CF-Ack + CF-Poll */
+
+/* Data Subtype Groups */
+#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_SUBTYPE_ANY_PSPOLL(s) (((s) & 10) != 0)
+
+/* Type/Subtype Combos */
+#define FC_KIND_MASK (FC_TYPE_MASK | FC_SUBTYPE_MASK) /* FC kind mask */
+
+#define FC_KIND(t, s) (((t) << FC_TYPE_SHIFT) | ((s) << FC_SUBTYPE_SHIFT)) /* FC kind */
+
+#define FC_SUBTYPE(fc) (((fc) & FC_SUBTYPE_MASK) >> FC_SUBTYPE_SHIFT) /* Subtype from FC */
+#define FC_TYPE(fc) (((fc) & FC_TYPE_MASK) >> FC_TYPE_SHIFT) /* Type from FC */
+
+#define FC_ASSOC_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ASSOC_REQ) /* assoc. request */
+#define FC_ASSOC_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ASSOC_RESP) /* assoc. response */
+#define FC_REASSOC_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_REASSOC_REQ) /* reassoc. request */
+#define FC_REASSOC_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_REASSOC_RESP) /* reassoc. response */
+#define FC_PROBE_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_REQ) /* probe request */
+#define FC_PROBE_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_RESP) /* probe response */
+#define FC_BEACON FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_BEACON) /* beacon */
+#define FC_DISASSOC FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_DISASSOC) /* disassoc */
+#define FC_AUTH FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_AUTH) /* authentication */
+#define FC_DEAUTH FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_DEAUTH) /* deauthentication */
+#define FC_ACTION FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ACTION) /* action */
+#define FC_ACTION_NOACK FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ACTION_NOACK) /* action no-ack */
+
+#define FC_CTL_WRAPPER FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CTL_WRAPPER) /* Control Wrapper */
+#define FC_BLOCKACK_REQ FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_BLOCKACK_REQ) /* Block Ack Req */
+#define FC_BLOCKACK FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_BLOCKACK) /* Block Ack */
+#define FC_PS_POLL FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_PS_POLL) /* PS poll */
+#define FC_RTS FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_RTS) /* RTS */
+#define FC_CTS FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CTS) /* CTS */
+#define FC_ACK FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_ACK) /* ACK */
+#define FC_CF_END FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CF_END) /* CF-END */
+#define FC_CF_END_ACK FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CF_END_ACK) /* CF-END ACK */
+
+#define FC_DATA FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_DATA) /* data */
+#define FC_NULL_DATA FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_NULL) /* null data */
+#define FC_DATA_CF_ACK FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_DATA_CF_ACK) /* data CF ACK */
+#define FC_QOS_DATA FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_QOS_DATA) /* QoS data */
+#define FC_QOS_NULL FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_QOS_NULL) /* QoS null */
+
+/* QoS Control Field */
+
+/* 802.1D Priority */
+#define QOS_PRIO_SHIFT 0 /* QoS priority shift */
+#define QOS_PRIO_MASK 0x0007 /* QoS priority mask */
+#define QOS_PRIO(qos) (((qos) & QOS_PRIO_MASK) >> QOS_PRIO_SHIFT) /* QoS priority */
+
+/* Traffic Identifier */
+#define QOS_TID_SHIFT 0 /* QoS TID shift */
+#define QOS_TID_MASK 0x000f /* QoS TID mask */
+#define QOS_TID(qos) (((qos) & QOS_TID_MASK) >> QOS_TID_SHIFT) /* QoS TID */
+
+/* End of Service Period (U-APSD) */
+#define QOS_EOSP_SHIFT 4 /* QoS End of Service Period shift */
+#define QOS_EOSP_MASK 0x0010 /* QoS End of Service Period mask */
+#define QOS_EOSP(qos) (((qos) & QOS_EOSP_MASK) >> QOS_EOSP_SHIFT) /* Qos EOSP */
+
+/* Ack Policy */
+#define QOS_ACK_NORMAL_ACK 0 /* Normal Ack */
+#define QOS_ACK_NO_ACK 1 /* No Ack (eg mcast) */
+#define QOS_ACK_NO_EXP_ACK 2 /* No Explicit Ack */
+#define QOS_ACK_BLOCK_ACK 3 /* Block Ack */
+#define QOS_ACK_SHIFT 5 /* QoS ACK shift */
+#define QOS_ACK_MASK 0x0060 /* QoS ACK mask */
+#define QOS_ACK(qos) (((qos) & QOS_ACK_MASK) >> QOS_ACK_SHIFT) /* QoS ACK */
+
+/* A-MSDU flag */
+#define QOS_AMSDU_SHIFT 7 /* AMSDU shift */
+#define QOS_AMSDU_MASK 0x0080 /* AMSDU mask */
+
+/* Management Frames */
+
+/* Management Frame Constants */
+
+/* Fixed fields */
+#define DOT11_MNG_AUTH_ALGO_LEN 2 /* d11 management auth. algo. length */
+#define DOT11_MNG_AUTH_SEQ_LEN 2 /* d11 management auth. seq. length */
+#define DOT11_MNG_BEACON_INT_LEN 2 /* d11 management beacon interval length */
+#define DOT11_MNG_CAP_LEN 2 /* d11 management cap. length */
+#define DOT11_MNG_AP_ADDR_LEN 6 /* d11 management AP address length */
+#define DOT11_MNG_LISTEN_INT_LEN 2 /* d11 management listen interval length */
+#define DOT11_MNG_REASON_LEN 2 /* d11 management reason length */
+#define DOT11_MNG_AID_LEN 2 /* d11 management AID length */
+#define DOT11_MNG_STATUS_LEN 2 /* d11 management status length */
+#define DOT11_MNG_TIMESTAMP_LEN 8 /* d11 management timestamp length */
+
+/* DUR/ID field in assoc resp is 0xc000 | AID */
+#define DOT11_AID_MASK 0x3fff /* d11 AID mask */
+
+/* Reason Codes */
+#define DOT11_RC_RESERVED 0 /* d11 RC reserved */
+#define DOT11_RC_UNSPECIFIED 1 /* Unspecified reason */
+#define DOT11_RC_AUTH_INVAL 2 /* Previous authentication no longer valid */
+#define DOT11_RC_DEAUTH_LEAVING 3 /* Deauthenticated because sending station
+ * is leaving (or has left) IBSS or ESS
+ */
+#define DOT11_RC_INACTIVITY 4 /* Disassociated due to inactivity */
+#define DOT11_RC_BUSY 5 /* Disassociated because AP is unable to handle
+ * all currently associated stations
+ */
+#define DOT11_RC_INVAL_CLASS_2 6 /* Class 2 frame received from
+ * nonauthenticated station
+ */
+#define DOT11_RC_INVAL_CLASS_3 7 /* Class 3 frame received from
+ * nonassociated station
+ */
+#define DOT11_RC_DISASSOC_LEAVING 8 /* Disassociated because sending station is
+ * leaving (or has left) BSS
+ */
+#define DOT11_RC_NOT_AUTH 9 /* Station requesting (re)association is not
+ * authenticated with responding station
+ */
+#define DOT11_RC_BAD_PC 10 /* Unacceptable power capability element */
+#define DOT11_RC_BAD_CHANNELS 11 /* Unacceptable supported channels element */
+/* 12 is unused */
+
+/* 32-39 are QSTA specific reasons added in 11e */
+#define DOT11_RC_UNSPECIFIED_QOS 32 /* unspecified QoS-related reason */
+#define DOT11_RC_INSUFFCIENT_BW 33 /* QAP lacks sufficient bandwidth */
+#define DOT11_RC_EXCESSIVE_FRAMES 34 /* excessive number of frames need ack */
+#define DOT11_RC_TX_OUTSIDE_TXOP 35 /* transmitting outside the limits of txop */
+#define DOT11_RC_LEAVING_QBSS 36 /* QSTA is leaving the QBSS (or restting) */
+#define DOT11_RC_BAD_MECHANISM 37 /* does not want to use the mechanism */
+#define DOT11_RC_SETUP_NEEDED 38 /* mechanism needs a setup */
+#define DOT11_RC_TIMEOUT 39 /* timeout */
+
+#define DOT11_RC_MAX 23 /* Reason codes > 23 are reserved */
+
+#define DOT11_RC_TDLS_PEER_UNREACH 25
+#define DOT11_RC_TDLS_DOWN_UNSPECIFIED 26
+
+/* Status Codes */
+#define DOT11_SC_SUCCESS 0 /* Successful */
+#define DOT11_SC_FAILURE 1 /* Unspecified failure */
+#define DOT11_SC_TDLS_WAKEUP_SCH_ALT 2 /* TDLS wakeup schedule rejected but alternative */
+ /* schedule provided */
+#define DOT11_SC_TDLS_WAKEUP_SCH_REJ 3 /* TDLS wakeup schedule rejected */
+#define DOT11_SC_TDLS_SEC_DISABLED 5 /* TDLS Security disabled */
+#define DOT11_SC_LIFETIME_REJ 6 /* Unacceptable lifetime */
+#define DOT11_SC_NOT_SAME_BSS 7 /* Not in same BSS */
+#define DOT11_SC_CAP_MISMATCH 10 /* Cannot support all requested
+ * capabilities in the Capability
+ * Information field
+ */
+#define DOT11_SC_REASSOC_FAIL 11 /* Reassociation denied due to inability
+ * to confirm that association exists
+ */
+#define DOT11_SC_ASSOC_FAIL 12 /* Association denied due to reason
+ * outside the scope of this standard
+ */
+#define DOT11_SC_AUTH_MISMATCH 13 /* Responding station does not support
+ * the specified authentication
+ * algorithm
+ */
+#define DOT11_SC_AUTH_SEQ 14 /* Received an Authentication frame
+ * with authentication transaction
+ * sequence number out of expected
+ * sequence
+ */
+#define DOT11_SC_AUTH_CHALLENGE_FAIL 15 /* Authentication rejected because of
+ * challenge failure
+ */
+#define DOT11_SC_AUTH_TIMEOUT 16 /* Authentication rejected due to timeout
+ * waiting for next frame in sequence
+ */
+#define DOT11_SC_ASSOC_BUSY_FAIL 17 /* Association denied because AP is
+ * unable to handle additional
+ * associated stations
+ */
+#define DOT11_SC_ASSOC_RATE_MISMATCH 18 /* Association denied due to requesting
+ * station not supporting all of the
+ * data rates in the BSSBasicRateSet
+ * parameter
+ */
+#define DOT11_SC_ASSOC_SHORT_REQUIRED 19 /* Association denied due to requesting
+ * station not supporting the Short
+ * Preamble option
+ */
+#define DOT11_SC_ASSOC_PBCC_REQUIRED 20 /* Association denied due to requesting
+ * station not supporting the PBCC
+ * Modulation option
+ */
+#define DOT11_SC_ASSOC_AGILITY_REQUIRED 21 /* Association denied due to requesting
+ * station not supporting the Channel
+ * Agility option
+ */
+#define DOT11_SC_ASSOC_SPECTRUM_REQUIRED 22 /* Association denied because Spectrum
+ * Management capability is required.
+ */
+#define DOT11_SC_ASSOC_BAD_POWER_CAP 23 /* Association denied because the info
+ * in the Power Cap element is
+ * unacceptable.
+ */
+#define DOT11_SC_ASSOC_BAD_SUP_CHANNELS 24 /* Association denied because the info
+ * in the Supported Channel element is
+ * unacceptable
+ */
+#define DOT11_SC_ASSOC_SHORTSLOT_REQUIRED 25 /* Association denied due to requesting
+ * station not supporting the Short Slot
+ * Time option
+ */
+#define DOT11_SC_ASSOC_ERPBCC_REQUIRED 26 /* Association denied due to requesting
+ * station not supporting the ER-PBCC
+ * Modulation option
+ */
+#define DOT11_SC_ASSOC_DSSSOFDM_REQUIRED 27 /* Association denied due to requesting
+ * station not supporting the DSS-OFDM
+ * option
+ */
+#define DOT11_SC_ASSOC_R0KH_UNREACHABLE 28 /* Association denied due to AP
+ * being unable to reach the R0 Key Holder
+ */
+#define DOT11_SC_ASSOC_TRY_LATER 30 /* Association denied temporarily, try again later
+ */
+#define DOT11_SC_ASSOC_MFP_VIOLATION 31 /* Association denied due to Robust Management
+ * frame policy violation
+ */
+#define DOT11_SC_ASSOC_HT_REQUIRED 32 /* Association denied because the requesting
+ * station does not support HT features
+ */
+
+#define DOT11_SC_DECLINED 37 /* request declined */
+#define DOT11_SC_INVALID_PARAMS 38 /* One or more params have invalid values */
+#define DOT11_SC_INVALID_PAIRWISE_CIPHER 42 /* invalid pairwise cipher */
+#define DOT11_SC_INVALID_AKMP 43 /* Association denied due to invalid AKMP */
+#define DOT11_SC_INVALID_RSNIE_CAP 45 /* invalid RSN IE capabilities */
+#define DOT11_SC_DLS_NOT_ALLOWED 48 /* DLS is not allowed in the BSS by policy */
+#define DOT11_SC_INVALID_PMKID 53 /* Association denied due to invalid PMKID */
+#define DOT11_SC_INVALID_MDID 54 /* Association denied due to invalid MDID */
+#define DOT11_SC_INVALID_FTIE 55 /* Association denied due to invalid FTIE */
+
+#define DOT11_SC_ADV_PROTO_NOT_SUPPORTED 59 /* ad proto not supported */
+#define DOT11_SC_NO_OUTSTAND_REQ 60 /* no outstanding req */
+#define DOT11_SC_RSP_NOT_RX_FROM_SERVER 61 /* no response from server */
+#define DOT11_SC_TIMEOUT 62 /* timeout */
+#define DOT11_SC_QUERY_RSP_TOO_LARGE 63 /* query rsp too large */
+#define DOT11_SC_SERVER_UNREACHABLE 65 /* server unreachable */
+
+#define DOT11_SC_UNEXP_MSG 70 /* Unexpected message */
+#define DOT11_SC_INVALID_SNONCE 71 /* Invalid SNonce */
+#define DOT11_SC_INVALID_RSNIE 72 /* Invalid contents of RSNIE */
+#define DOT11_SC_ASSOC_VHT_REQUIRED 104 /* Association denied because the requesting
+ * station does not support VHT features.
+ */
+
+#define DOT11_SC_TRANSMIT_FAILURE 79 /* transmission failure */
+
+/* Info Elts, length of INFORMATION portion of Info Elts */
+#define DOT11_MNG_DS_PARAM_LEN 1 /* d11 management DS parameter length */
+#define DOT11_MNG_IBSS_PARAM_LEN 2 /* d11 management IBSS parameter length */
+
+/* TIM Info element has 3 bytes fixed info in INFORMATION field,
+ * followed by 1 to 251 bytes of Partial Virtual Bitmap
+ */
+#define DOT11_MNG_TIM_FIXED_LEN 3 /* d11 management TIM fixed length */
+#define DOT11_MNG_TIM_DTIM_COUNT 0 /* d11 management DTIM count */
+#define DOT11_MNG_TIM_DTIM_PERIOD 1 /* d11 management DTIM period */
+#define DOT11_MNG_TIM_BITMAP_CTL 2 /* d11 management TIM BITMAP control */
+#define DOT11_MNG_TIM_PVB 3 /* d11 management TIM PVB */
+
+/* TLV defines */
+#define TLV_TAG_OFF 0 /* tag offset */
+#define TLV_LEN_OFF 1 /* length offset */
+#define TLV_HDR_LEN 2 /* header length */
+#define TLV_BODY_OFF 2 /* body offset */
+
+/* Management Frame Information Element IDs */
+#define DOT11_MNG_SSID_ID 0 /* d11 management SSID id */
+#define DOT11_MNG_RATES_ID 1 /* d11 management rates id */
+#define DOT11_MNG_FH_PARMS_ID 2 /* d11 management FH parameter id */
+#define DOT11_MNG_DS_PARMS_ID 3 /* d11 management DS parameter id */
+#define DOT11_MNG_CF_PARMS_ID 4 /* d11 management CF parameter id */
+#define DOT11_MNG_TIM_ID 5 /* d11 management TIM id */
+#define DOT11_MNG_IBSS_PARMS_ID 6 /* d11 management IBSS parameter id */
+#define DOT11_MNG_COUNTRY_ID 7 /* d11 management country id */
+#define DOT11_MNG_HOPPING_PARMS_ID 8 /* d11 management hopping parameter id */
+#define DOT11_MNG_HOPPING_TABLE_ID 9 /* d11 management hopping table id */
+#define DOT11_MNG_REQUEST_ID 10 /* d11 management request id */
+#define DOT11_MNG_QBSS_LOAD_ID 11 /* d11 management QBSS Load id */
+#define DOT11_MNG_EDCA_PARAM_ID 12 /* 11E EDCA Parameter id */
+#define DOT11_MNG_TSPEC_ID 13 /* d11 management TSPEC id */
+#define DOT11_MNG_TCLAS_ID 14 /* d11 management TCLAS id */
+#define DOT11_MNG_CHALLENGE_ID 16 /* d11 management chanllenge id */
+#define DOT11_MNG_PWR_CONSTRAINT_ID 32 /* 11H PowerConstraint */
+#define DOT11_MNG_PWR_CAP_ID 33 /* 11H PowerCapability */
+#define DOT11_MNG_TPC_REQUEST_ID 34 /* 11H TPC Request */
+#define DOT11_MNG_TPC_REPORT_ID 35 /* 11H TPC Report */
+#define DOT11_MNG_SUPP_CHANNELS_ID 36 /* 11H Supported Channels */
+#define DOT11_MNG_CHANNEL_SWITCH_ID 37 /* 11H ChannelSwitch Announcement */
+#define DOT11_MNG_MEASURE_REQUEST_ID 38 /* 11H MeasurementRequest */
+#define DOT11_MNG_MEASURE_REPORT_ID 39 /* 11H MeasurementReport */
+#define DOT11_MNG_QUIET_ID 40 /* 11H Quiet */
+#define DOT11_MNG_IBSS_DFS_ID 41 /* 11H IBSS_DFS */
+#define DOT11_MNG_ERP_ID 42 /* d11 management ERP id */
+#define DOT11_MNG_TS_DELAY_ID 43 /* d11 management TS Delay id */
+#define DOT11_MNG_TCLAS_PROC_ID 44 /* d11 management TCLAS processing id */
+#define DOT11_MNG_HT_CAP 45 /* d11 mgmt HT cap id */
+#define DOT11_MNG_QOS_CAP_ID 46 /* 11E QoS Capability id */
+#define DOT11_MNG_NONERP_ID 47 /* d11 management NON-ERP id */
+#define DOT11_MNG_RSN_ID 48 /* d11 management RSN id */
+#define DOT11_MNG_EXT_RATES_ID 50 /* d11 management ext. rates id */
+#define DOT11_MNG_AP_CHREP_ID 51 /* 11k AP Channel report id */
+#define DOT11_MNG_NEIGHBOR_REP_ID 52 /* 11k & 11v Neighbor report id */
+#define DOT11_MNG_RCPI_ID 53 /* 11k RCPI */
+#define DOT11_MNG_MDIE_ID 54 /* 11r Mobility domain id */
+#define DOT11_MNG_FTIE_ID 55 /* 11r Fast Bss Transition id */
+#define DOT11_MNG_FT_TI_ID 56 /* 11r Timeout Interval id */
+#define DOT11_MNG_RDE_ID 57 /* 11r RIC Data Element id */
+#define DOT11_MNG_REGCLASS_ID 59 /* d11 management regulatory class id */
+#define DOT11_MNG_EXT_CSA_ID 60 /* d11 Extended CSA */
+#define DOT11_MNG_HT_ADD 61 /* d11 mgmt additional HT info */
+#define DOT11_MNG_EXT_CHANNEL_OFFSET 62 /* d11 mgmt ext channel offset */
+#define DOT11_MNG_BSS_AVR_ACCESS_DELAY_ID 63 /* 11k bss average access delay */
+#define DOT11_MNG_ANTENNA_ID 64 /* 11k antenna id */
+#define DOT11_MNG_RSNI_ID 65 /* 11k RSNI id */
+#define DOT11_MNG_MEASUREMENT_PILOT_TX_ID 66 /* 11k measurement pilot tx info id */
+#define DOT11_MNG_BSS_AVAL_ADMISSION_CAP_ID 67 /* 11k bss aval admission cap id */
+#define DOT11_MNG_BSS_AC_ACCESS_DELAY_ID 68 /* 11k bss AC access delay id */
+#define DOT11_MNG_WAPI_ID 68 /* d11 management WAPI id */
+#define DOT11_MNG_TIME_ADVERTISE_ID 69 /* 11p time advertisement */
+#define DOT11_MNG_RRM_CAP_ID 70 /* 11k radio measurement capability */
+#define DOT11_MNG_MULTIPLE_BSSID_ID 71 /* 11k multiple BSSID id */
+#define DOT11_MNG_HT_BSS_COEXINFO_ID 72 /* d11 mgmt OBSS Coexistence INFO */
+#define DOT11_MNG_HT_BSS_CHANNEL_REPORT_ID 73 /* d11 mgmt OBSS Intolerant Channel list */
+#define DOT11_MNG_HT_OBSS_ID 74 /* d11 mgmt OBSS HT info */
+#define DOT11_MNG_MMIE_ID 76 /* d11 mgmt MIC IE */
+#define DOT11_MNG_BSS_MAX_IDLE_PERIOD_ID 90 /* 11v bss max idle id */
+#define DOT11_MNG_TFS_REQUEST_ID 91 /* 11v tfs request id */
+#define DOT11_MNG_TFS_RESPONSE_ID 92 /* 11v tfs response id */
+#define DOT11_MNG_WNM_SLEEP_MODE_ID 93 /* 11v wnm-sleep mode id */
+#define DOT11_MNG_TIMBC_REQ_ID 94 /* 11v TIM broadcast request id */
+#define DOT11_MNG_TIMBC_RESP_ID 95 /* 11v TIM broadcast response id */
+#define DOT11_MNG_CHANNEL_USAGE 97 /* 11v channel usage */
+#define DOT11_MNG_TIME_ZONE_ID 98 /* 11v time zone */
+#define DOT11_MNG_DMS_REQUEST_ID 99 /* 11v dms request id */
+#define DOT11_MNG_DMS_RESPONSE_ID 100 /* 11v dms response id */
+#define DOT11_MNG_LINK_IDENTIFIER_ID 101 /* 11z TDLS Link Identifier IE */
+#define DOT11_MNG_WAKEUP_SCHEDULE_ID 102 /* 11z TDLS Wakeup Schedule IE */
+#define DOT11_MNG_CHANNEL_SWITCH_TIMING_ID 104 /* 11z TDLS Channel Switch Timing IE */
+#define DOT11_MNG_PTI_CONTROL_ID 105 /* 11z TDLS PTI Control IE */
+#define DOT11_MNG_PU_BUFFER_STATUS_ID 106 /* 11z TDLS PU Buffer Status IE */
+#define DOT11_MNG_INTERWORKING_ID 107 /* 11u interworking */
+#define DOT11_MNG_ADVERTISEMENT_ID 108 /* 11u advertisement protocol */
+#define DOT11_MNG_EXP_BW_REQ_ID 109 /* 11u expedited bandwith request */
+#define DOT11_MNG_QOS_MAP_ID 110 /* 11u QoS map set */
+#define DOT11_MNG_ROAM_CONSORT_ID 111 /* 11u roaming consortium */
+#define DOT11_MNG_EMERGCY_ALERT_ID 112 /* 11u emergency alert identifier */
+#define DOT11_MNG_EXT_CAP_ID 127 /* d11 mgmt ext capability */
+#define DOT11_MNG_VHT_CAP_ID 191 /* d11 mgmt VHT cap id */
+#define DOT11_MNG_VHT_OPERATION_ID 192 /* d11 mgmt VHT op id */
+#define DOT11_MNG_WIDE_BW_CHANNEL_SWITCH_ID 194 /* Wide BW Channel Switch IE */
+#define DOT11_MNG_VHT_TRANSMIT_POWER_ENVELOPE_ID 195 /* VHT transmit Power Envelope IE */
+#define DOT11_MNG_CHANNEL_SWITCH_WRAPPER_ID 196 /* Channel Switch Wrapper IE */
+#define DOT11_MNG_AID_ID 197 /* Association ID IE */
+#define DOT11_MNG_OPER_MODE_NOTIF_ID 199 /* d11 mgmt VHT oper mode notif */
+
+
+#define DOT11_MNG_WPA_ID 221 /* d11 management WPA id */
+#define DOT11_MNG_PROPR_ID 221 /* d11 management proprietary id */
+/* should start using this one instead of above two */
+#define DOT11_MNG_VS_ID 221 /* d11 management Vendor Specific IE */
+
+/* Rate Defines */
+
+/* Valid rates for the Supported Rates and Extended Supported Rates IEs.
+ * Encoding is the rate in 500kbps units, rouding up for fractional values.
+ * 802.11-2012, section 6.5.5.2, DATA_RATE parameter enumerates all the values.
+ * The rate values cover DSSS, HR/DSSS, ERP, and OFDM phy rates.
+ * The defines below do not cover the rates specific to 10MHz, {3, 4.5, 27},
+ * and 5MHz, {1.5, 2.25, 3, 4.5, 13.5}, which are not supported by Broadcom devices.
+ */
+
+#define DOT11_RATE_1M 2 /* 1 Mbps in 500kbps units */
+#define DOT11_RATE_2M 4 /* 2 Mbps in 500kbps units */
+#define DOT11_RATE_5M5 11 /* 5.5 Mbps in 500kbps units */
+#define DOT11_RATE_11M 22 /* 11 Mbps in 500kbps units */
+#define DOT11_RATE_6M 12 /* 6 Mbps in 500kbps units */
+#define DOT11_RATE_9M 18 /* 9 Mbps in 500kbps units */
+#define DOT11_RATE_12M 24 /* 12 Mbps in 500kbps units */
+#define DOT11_RATE_18M 36 /* 18 Mbps in 500kbps units */
+#define DOT11_RATE_24M 48 /* 24 Mbps in 500kbps units */
+#define DOT11_RATE_36M 72 /* 36 Mbps in 500kbps units */
+#define DOT11_RATE_48M 96 /* 48 Mbps in 500kbps units */
+#define DOT11_RATE_54M 108 /* 54 Mbps in 500kbps units */
+#define DOT11_RATE_MAX 108 /* highest rate (54 Mbps) in 500kbps units */
+
+/* Supported Rates and Extended Supported Rates IEs
+ * The supported rates octets are defined a the MSB indicatin a Basic Rate
+ * and bits 0-6 as the rate value
+ */
+#define DOT11_RATE_BASIC 0x80 /* flag for a Basic Rate */
+#define DOT11_RATE_MASK 0x7F /* mask for numeric part of rate */
+
+/* BSS Membership Selector parameters
+ * 802.11-2012 and 802.11ac_D4.0 sec 8.4.2.3
+ * These selector values are advertised in Supported Rates and Extended Supported Rates IEs
+ * in the supported rates list with the Basic rate bit set.
+ * Constants below include the basic bit.
+ */
+#define DOT11_BSS_MEMBERSHIP_HT 0xFF /* Basic 0x80 + 127, HT Required to join */
+#define DOT11_BSS_MEMBERSHIP_VHT 0xFE /* Basic 0x80 + 126, VHT Required to join */
+
+/* ERP info element bit values */
+#define DOT11_MNG_ERP_LEN 1 /* ERP is currently 1 byte long */
+#define DOT11_MNG_NONERP_PRESENT 0x01 /* NonERP (802.11b) STAs are present
+ *in the BSS
+ */
+#define DOT11_MNG_USE_PROTECTION 0x02 /* Use protection mechanisms for
+ *ERP-OFDM frames
+ */
+#define DOT11_MNG_BARKER_PREAMBLE 0x04 /* Short Preambles: 0 == allowed,
+ * 1 == not allowed
+ */
+/* TS Delay element offset & size */
+#define DOT11_MGN_TS_DELAY_LEN 4 /* length of TS DELAY IE */
+#define TS_DELAY_FIELD_SIZE 4 /* TS DELAY field size */
+
+/* Capability Information Field */
+#define DOT11_CAP_ESS 0x0001 /* d11 cap. ESS */
+#define DOT11_CAP_IBSS 0x0002 /* d11 cap. IBSS */
+#define DOT11_CAP_POLLABLE 0x0004 /* d11 cap. pollable */
+#define DOT11_CAP_POLL_RQ 0x0008 /* d11 cap. poll request */
+#define DOT11_CAP_PRIVACY 0x0010 /* d11 cap. privacy */
+#define DOT11_CAP_SHORT 0x0020 /* d11 cap. short */
+#define DOT11_CAP_PBCC 0x0040 /* d11 cap. PBCC */
+#define DOT11_CAP_AGILITY 0x0080 /* d11 cap. agility */
+#define DOT11_CAP_SPECTRUM 0x0100 /* d11 cap. spectrum */
+#define DOT11_CAP_QOS 0x0200 /* d11 cap. qos */
+#define DOT11_CAP_SHORTSLOT 0x0400 /* d11 cap. shortslot */
+#define DOT11_CAP_APSD 0x0800 /* d11 cap. apsd */
+#define DOT11_CAP_RRM 0x1000 /* d11 cap. 11k radio measurement */
+#define DOT11_CAP_CCK_OFDM 0x2000 /* d11 cap. CCK/OFDM */
+#define DOT11_CAP_DELAY_BA 0x4000 /* d11 cap. delayed block ack */
+#define DOT11_CAP_IMMEDIATE_BA 0x8000 /* d11 cap. immediate block ack */
+
+/* Extended capabilities IE bitfields */
+/* 20/40 BSS Coexistence Management support bit position */
+#define DOT11_EXT_CAP_OBSS_COEX_MGMT 0
+/* scheduled PSMP support bit position */
+#define DOT11_EXT_CAP_SPSMP 6
+/* Flexible Multicast Service */
+#define DOT11_EXT_CAP_FMS 11
+/* proxy ARP service support bit position */
+#define DOT11_EXT_CAP_PROXY_ARP 12
+/* Traffic Filter Service */
+#define DOT11_EXT_CAP_TFS 16
+/* WNM-Sleep Mode */
+#define DOT11_EXT_CAP_WNM_SLEEP 17
+/* TIM Broadcast service */
+#define DOT11_EXT_CAP_TIMBC 18
+/* BSS Transition Management support bit position */
+#define DOT11_EXT_CAP_BSSTRANS_MGMT 19
+/* Direct Multicast Service */
+#define DOT11_EXT_CAP_DMS 26
+/* Interworking support bit position */
+#define DOT11_EXT_CAP_IW 31
+/* service Interval granularity bit position and mask */
+#define DOT11_EXT_CAP_SI 41
+#define DOT11_EXT_CAP_SI_MASK 0x0E
+/* WNM notification */
+#define DOT11_EXT_CAP_WNM_NOTIF 46
+/* Operating mode notification - VHT (11ac D3.0 - 8.4.2.29) */
+#define DOT11_EXT_CAP_OPER_MODE_NOTIF 62
+
+/* VHT Operating mode bit fields - (11ac D3.0 - 8.4.1.50) */
+#define DOT11_OPER_MODE_CHANNEL_WIDTH_SHIFT 0
+#define DOT11_OPER_MODE_CHANNEL_WIDTH_MASK 0x3
+#define DOT11_OPER_MODE_RXNSS_SHIFT 4
+#define DOT11_OPER_MODE_RXNSS_MASK 0x70
+#define DOT11_OPER_MODE_RXNSS_TYPE_SHIFT 7
+#define DOT11_OPER_MODE_RXNSS_TYPE_MASK 0x80
+
+#define DOT11_OPER_MODE(type, nss, chanw) (\
+ ((type) << DOT11_OPER_MODE_RXNSS_TYPE_SHIFT &\
+ DOT11_OPER_MODE_RXNSS_TYPE_MASK) |\
+ (((nss) - 1) << DOT11_OPER_MODE_RXNSS_SHIFT & DOT11_OPER_MODE_RXNSS_MASK) |\
+ ((chanw) << DOT11_OPER_MODE_CHANNEL_WIDTH_SHIFT &\
+ DOT11_OPER_MODE_CHANNEL_WIDTH_MASK))
+
+#define DOT11_OPER_MODE_CHANNEL_WIDTH(mode) \
+ (((mode) & DOT11_OPER_MODE_CHANNEL_WIDTH_MASK)\
+ >> DOT11_OPER_MODE_CHANNEL_WIDTH_SHIFT)
+#define DOT11_OPER_MODE_RXNSS(mode) \
+ ((((mode) & DOT11_OPER_MODE_RXNSS_MASK) \
+ >> DOT11_OPER_MODE_RXNSS_SHIFT) + 1)
+#define DOT11_OPER_MODE_RXNSS_TYPE(mode) \
+ (((mode) & DOT11_OPER_MODE_RXNSS_TYPE_MASK)\
+ >> DOT11_OPER_MODE_RXNSS_TYPE_SHIFT)
+
+#define DOT11_OPER_MODE_20MHZ 0
+#define DOT11_OPER_MODE_40MHZ 1
+#define DOT11_OPER_MODE_80MHZ 2
+#define DOT11_OPER_MODE_160MHZ 3
+#define DOT11_OPER_MODE_8080MHZ 3
+
+#define DOT11_OPER_MODE_CHANNEL_WIDTH_20MHZ(mode) (\
+ ((mode) & DOT11_OPER_MODE_CHANNEL_WIDTH_MASK) == DOT11_OPER_MODE_20MHZ)
+#define DOT11_OPER_MODE_CHANNEL_WIDTH_40MHZ(mode) (\
+ ((mode) & DOT11_OPER_MODE_CHANNEL_WIDTH_MASK) == DOT11_OPER_MODE_40MHZ)
+#define DOT11_OPER_MODE_CHANNEL_WIDTH_80MHZ(mode) (\
+ ((mode) & DOT11_OPER_MODE_CHANNEL_WIDTH_MASK) == DOT11_OPER_MODE_80MHZ)
+#define DOT11_OPER_MODE_CHANNEL_WIDTH_160MHZ(mode) (\
+ ((mode) & DOT11_OPER_MODE_CHANNEL_WIDTH_MASK) == DOT11_OPER_MODE_160MHZ)
+#define DOT11_OPER_MODE_CHANNEL_WIDTH_8080MHZ(mode) (\
+ ((mode) & DOT11_OPER_MODE_CHANNEL_WIDTH_MASK) == DOT11_OPER_MODE_8080MHZ)
+
+/* Operating mode information element 802.11ac D3.0 - 8.4.2.168 */
+BWL_PRE_PACKED_STRUCT struct dot11_oper_mode_notif_ie {
+ uint8 mode;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_oper_mode_notif_ie dot11_oper_mode_notif_ie_t;
+
+#define DOT11_OPER_MODE_NOTIF_IE_LEN 1
+
+/* Extended Capability Information Field */
+#define DOT11_OBSS_COEX_MNG_SUPPORT 0x01 /* 20/40 BSS Coexistence Management support */
+
+/*
+ * Action Frame Constants
+ */
+#define DOT11_ACTION_HDR_LEN 2 /* action frame category + action field */
+#define DOT11_ACTION_CAT_OFF 0 /* category offset */
+#define DOT11_ACTION_ACT_OFF 1 /* action offset */
+
+/* Action Category field (sec 8.4.1.11) */
+#define DOT11_ACTION_CAT_ERR_MASK 0x80 /* category error mask */
+#define DOT11_ACTION_CAT_MASK 0x7F /* category mask */
+#define DOT11_ACTION_CAT_SPECT_MNG 0 /* category spectrum management */
+#define DOT11_ACTION_CAT_QOS 1 /* category QoS */
+#define DOT11_ACTION_CAT_DLS 2 /* category DLS */
+#define DOT11_ACTION_CAT_BLOCKACK 3 /* category block ack */
+#define DOT11_ACTION_CAT_PUBLIC 4 /* category public */
+#define DOT11_ACTION_CAT_RRM 5 /* category radio measurements */
+#define DOT11_ACTION_CAT_FBT 6 /* category fast bss transition */
+#define DOT11_ACTION_CAT_HT 7 /* category for HT */
+#define DOT11_ACTION_CAT_SA_QUERY 8 /* security association query */
+#define DOT11_ACTION_CAT_PDPA 9 /* protected dual of public action */
+#define DOT11_ACTION_CAT_WNM 10 /* category for WNM */
+#define DOT11_ACTION_CAT_UWNM 11 /* category for Unprotected WNM */
+#define DOT11_ACTION_NOTIFICATION 17
+#define DOT11_ACTION_CAT_VHT 21 /* VHT action */
+#define DOT11_ACTION_CAT_VSP 126 /* protected vendor specific */
+#define DOT11_ACTION_CAT_VS 127 /* category Vendor Specific */
+
+/* Spectrum Management Action IDs (sec 7.4.1) */
+#define DOT11_SM_ACTION_M_REQ 0 /* d11 action measurement request */
+#define DOT11_SM_ACTION_M_REP 1 /* d11 action measurement response */
+#define DOT11_SM_ACTION_TPC_REQ 2 /* d11 action TPC request */
+#define DOT11_SM_ACTION_TPC_REP 3 /* d11 action TPC response */
+#define DOT11_SM_ACTION_CHANNEL_SWITCH 4 /* d11 action channel switch */
+#define DOT11_SM_ACTION_EXT_CSA 5 /* d11 extened CSA for 11n */
+
+/* HT action ids */
+#define DOT11_ACTION_ID_HT_CH_WIDTH 0 /* notify channel width action id */
+#define DOT11_ACTION_ID_HT_MIMO_PS 1 /* mimo ps action id */
+
+/* Public action ids */
+#define DOT11_PUB_ACTION_BSS_COEX_MNG 0 /* 20/40 Coexistence Management action id */
+#define DOT11_PUB_ACTION_CHANNEL_SWITCH 4 /* d11 action channel switch */
+
+/* Block Ack action types */
+#define DOT11_BA_ACTION_ADDBA_REQ 0 /* ADDBA Req action frame type */
+#define DOT11_BA_ACTION_ADDBA_RESP 1 /* ADDBA Resp action frame type */
+#define DOT11_BA_ACTION_DELBA 2 /* DELBA action frame type */
+
+/* ADDBA action parameters */
+#define DOT11_ADDBA_PARAM_AMSDU_SUP 0x0001 /* AMSDU supported under BA */
+#define DOT11_ADDBA_PARAM_POLICY_MASK 0x0002 /* policy mask(ack vs delayed) */
+#define DOT11_ADDBA_PARAM_POLICY_SHIFT 1 /* policy shift */
+#define DOT11_ADDBA_PARAM_TID_MASK 0x003c /* tid mask */
+#define DOT11_ADDBA_PARAM_TID_SHIFT 2 /* tid shift */
+#define DOT11_ADDBA_PARAM_BSIZE_MASK 0xffc0 /* buffer size mask */
+#define DOT11_ADDBA_PARAM_BSIZE_SHIFT 6 /* buffer size shift */
+
+#define DOT11_ADDBA_POLICY_DELAYED 0 /* delayed BA policy */
+#define DOT11_ADDBA_POLICY_IMMEDIATE 1 /* immediate BA policy */
+
+/* Fast Transition action types */
+#define DOT11_FT_ACTION_FT_RESERVED 0
+#define DOT11_FT_ACTION_FT_REQ 1 /* FBT request - for over-the-DS FBT */
+#define DOT11_FT_ACTION_FT_RES 2 /* FBT response - for over-the-DS FBT */
+#define DOT11_FT_ACTION_FT_CON 3 /* FBT confirm - for OTDS with RRP */
+#define DOT11_FT_ACTION_FT_ACK 4 /* FBT ack */
+
+/* DLS action types */
+#define DOT11_DLS_ACTION_REQ 0 /* DLS Request */
+#define DOT11_DLS_ACTION_RESP 1 /* DLS Response */
+#define DOT11_DLS_ACTION_TD 2 /* DLS Teardown */
+
+/* Wireless Network Management (WNM) action types */
+#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_BSSTRANS_QUERY 6
+#define DOT11_WNM_ACTION_BSSTRANS_REQ 7
+#define DOT11_WNM_ACTION_BSSTRANS_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_TIMBC_REQ 18
+#define DOT11_WNM_ACTION_TIMBC_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_RESP 27
+
+/* Unprotected Wireless Network Management (WNM) action types */
+#define DOT11_UWNM_ACTION_TIM 0
+#define DOT11_UWNM_ACTION_TIMING_MEASUREMENT 1
+
+#define DOT11_MNG_COUNTRY_ID_LEN 3
+
+/* VHT category action types - 802.11ac D3.0 - 8.5.23.1 */
+#define DOT11_VHT_ACTION_CBF 0 /* Compressed Beamforming */
+#define DOT11_VHT_ACTION_GID_MGMT 1 /* Group ID Management */
+#define DOT11_VHT_ACTION_OPER_MODE_NOTIF 2 /* Operating mode notif'n */
+
+/* DLS Request frame header */
+BWL_PRE_PACKED_STRUCT struct dot11_dls_req {
+ uint8 category; /* category of action frame (2) */
+ uint8 action; /* DLS action: req (0) */
+ struct ether_addr da; /* destination address */
+ struct ether_addr sa; /* source address */
+ uint16 cap; /* capability */
+ uint16 timeout; /* timeout value */
+ uint8 data[1]; /* IE:support rate, extend support rate, HT cap */
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_dls_req dot11_dls_req_t;
+#define DOT11_DLS_REQ_LEN 18 /* Fixed length */
+
+/* DLS response frame header */
+BWL_PRE_PACKED_STRUCT struct dot11_dls_resp {
+ uint8 category; /* category of action frame (2) */
+ uint8 action; /* DLS action: req (0) */
+ uint16 status; /* status code field */
+ struct ether_addr da; /* destination address */
+ struct ether_addr sa; /* source address */
+ uint8 data[1]; /* optional: capability, rate ... */
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_dls_resp dot11_dls_resp_t;
+#define DOT11_DLS_RESP_LEN 16 /* Fixed length */
+
+
+/* ************* 802.11v related definitions. ************* */
+
+/* BSS Management Transition Query frame header */
+BWL_PRE_PACKED_STRUCT struct dot11_bsstrans_query {
+ uint8 category; /* category of action frame (10) */
+ uint8 action; /* WNM action: trans_query (6) */
+ uint8 token; /* dialog token */
+ uint8 reason; /* transition query reason */
+ uint8 data[1]; /* Elements */
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_bsstrans_query dot11_bsstrans_query_t;
+#define DOT11_BSSTRANS_QUERY_LEN 4 /* Fixed length */
+
+/* BSS Management Transition Request frame header */
+BWL_PRE_PACKED_STRUCT struct dot11_bsstrans_req {
+ uint8 category; /* category of action frame (10) */
+ uint8 action; /* WNM action: trans_req (7) */
+ uint8 token; /* dialog token */
+ uint8 reqmode; /* transition request mode */
+ uint16 disassoc_tmr; /* disassociation timer */
+ uint8 validity_intrvl; /* validity interval */
+ uint8 data[1]; /* optional: BSS term duration, ... */
+ /* ...session info URL, candidate list */
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_bsstrans_req dot11_bsstrans_req_t;
+#define DOT11_BSSTRANS_REQ_LEN 7 /* Fixed length */
+
+/* BSS Mgmt Transition Request Mode Field - 802.11v */
+#define DOT11_BSSTRANS_REQMODE_PREF_LIST_INCL 0x01
+#define DOT11_BSSTRANS_REQMODE_ABRIDGED 0x02
+#define DOT11_BSSTRANS_REQMODE_DISASSOC_IMMINENT 0x04
+#define DOT11_BSSTRANS_REQMODE_BSS_TERM_INCL 0x08
+#define DOT11_BSSTRANS_REQMODE_ESS_DISASSOC_IMNT 0x10
+
+/* BSS Management transition response frame header */
+BWL_PRE_PACKED_STRUCT struct dot11_bsstrans_resp {
+ uint8 category; /* category of action frame (10) */
+ uint8 action; /* WNM action: trans_resp (8) */
+ uint8 token; /* dialog token */
+ uint8 status; /* transition status */
+ uint8 term_delay; /* validity interval */
+ uint8 data[1]; /* optional: BSSID target, candidate list */
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_bsstrans_resp dot11_bsstrans_resp_t;
+#define DOT11_BSSTRANS_RESP_LEN 5 /* Fixed length */
+
+/* BSS Mgmt Transition Response Status Field */
+#define DOT11_BSSTRANS_RESP_STATUS_ACCEPT 0
+#define DOT11_BSSTRANS_RESP_STATUS_REJECT 1
+#define DOT11_BSSTRANS_RESP_STATUS_REJ_INSUFF_BCN 2
+#define DOT11_BSSTRANS_RESP_STATUS_REJ_INSUFF_CAP 3
+#define DOT11_BSSTRANS_RESP_STATUS_REJ_TERM_UNDESIRED 4
+#define DOT11_BSSTRANS_RESP_STATUS_REJ_TERM_DELAY_REQ 5
+#define DOT11_BSSTRANS_RESP_STATUS_REJ_BSS_LIST_PROVIDED 6
+#define DOT11_BSSTRANS_RESP_STATUS_REJ_NO_SUITABLE_BSS 7
+#define DOT11_BSSTRANS_RESP_STATUS_REJ_LEAVING_ESS 8
+
+
+/* BSS Max Idle Period information element */
+BWL_PRE_PACKED_STRUCT struct dot11_bss_max_idle_period_ie {
+ uint8 id; /* 90, DOT11_MNG_BSS_MAX_IDLE_PERIOD_ID */
+ uint8 len;
+ uint16 max_idle_period; /* in unit of 1000 TUs */
+ uint8 idle_opt;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_bss_max_idle_period_ie dot11_bss_max_idle_period_ie_t;
+#define DOT11_BSS_MAX_IDLE_PERIOD_IE_LEN 3 /* bss max idle period IE size */
+#define DOT11_BSS_MAX_IDLE_PERIOD_OPT_PROTECTED 1 /* BSS max idle option */
+
+/* TIM Broadcast request information element */
+BWL_PRE_PACKED_STRUCT struct dot11_timbc_req_ie {
+ uint8 id; /* 94, DOT11_MNG_TIMBC_REQ_ID */
+ uint8 len;
+ uint8 interval; /* in unit of beacon interval */
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_timbc_req_ie dot11_timbc_req_ie_t;
+#define DOT11_TIMBC_REQ_IE_LEN 1 /* Fixed length */
+
+/* TIM Broadcast request frame header */
+BWL_PRE_PACKED_STRUCT struct dot11_timbc_req {
+ uint8 category; /* category of action frame (10) */
+ uint8 action; /* WNM action: DOT11_WNM_ACTION_TIMBC_REQ(18) */
+ uint8 token; /* dialog token */
+ uint8 data[1]; /* TIM broadcast request element */
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_timbc_req dot11_timbc_req_t;
+#define DOT11_TIMBC_REQ_LEN 3 /* Fixed length */
+
+/* TIM Broadcast response information element */
+BWL_PRE_PACKED_STRUCT struct dot11_timbc_resp_ie {
+ uint8 id; /* 95, DOT11_MNG_TIM_BROADCAST_RESP_ID */
+ uint8 len;
+ uint8 status; /* status of add request */
+ uint8 interval; /* in unit of beacon interval */
+ int32 offset; /* in unit of ms */
+ uint16 high_rate; /* in unit of 0.5 Mb/s */
+ uint16 low_rate; /* in unit of 0.5 Mb/s */
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_timbc_resp_ie dot11_timbc_resp_ie_t;
+#define DOT11_TIMBC_DENY_RESP_IE_LEN 1 /* Deny. Fixed length */
+#define DOT11_TIMBC_ACCEPT_RESP_IE_LEN 10 /* Accept. Fixed length */
+
+#define DOT11_TIMBC_STATUS_ACCEPT 0
+#define DOT11_TIMBC_STATUS_ACCEPT_TSTAMP 1
+#define DOT11_TIMBC_STATUS_DENY 2
+#define DOT11_TIMBC_STATUS_OVERRIDDEN 3
+
+/* TIM Broadcast request frame header */
+BWL_PRE_PACKED_STRUCT struct dot11_timbc_resp {
+ uint8 category; /* category of action frame (10) */
+ uint8 action; /* action: DOT11_WNM_ACTION_TIMBC_RESP(19) */
+ uint8 token; /* dialog token */
+ uint8 data[1]; /* TIM broadcast response element */
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_timbc_resp dot11_timbc_resp_t;
+#define DOT11_TIMBC_RESP_LEN 3 /* Fixed length */
+
+/* TIM element */
+BWL_PRE_PACKED_STRUCT struct dot11_tim_ie {
+ uint8 id; /* 5, DOT11_MNG_TIM_ID */
+ uint8 len; /* 4 - 255 */
+ uint8 dtim_count; /* DTIM decrementing counter */
+ uint8 dtim_period; /* DTIM period */
+ uint8 bitmap_control; /* AID 0 + bitmap offset */
+ uint8 pvb[1]; /* Partial Virtual Bitmap, variable length */
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_tim_ie dot11_tim_ie_t;
+#define DOT11_TIM_IE_FIXED_LEN 3 /* Fixed length, without id and len */
+#define DOT11_TIM_IE_FIXED_TOTAL_LEN 5 /* Fixed length, with id and len */
+
+/* TIM Broadcast frame header */
+BWL_PRE_PACKED_STRUCT struct dot11_timbc {
+ uint8 category; /* category of action frame (11) */
+ uint8 action; /* action: TIM (0) */
+ uint8 check_beacon; /* need to check-beacon */
+ uint8 tsf[8]; /* Time Synchronization Function */
+ dot11_tim_ie_t tim_ie; /* TIM element */
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_timbc dot11_timbc_t;
+#define DOT11_TIMBC_HDR_LEN (sizeof(dot11_timbc_t) - sizeof(dot11_tim_ie_t))
+#define DOT11_TIMBC_FIXED_LEN (sizeof(dot11_timbc_t) - 1) /* Fixed length */
+#define DOT11_TIMBC_LEN 11 /* Fixed length */
+
+/* TCLAS frame classifier type */
+BWL_PRE_PACKED_STRUCT struct dot11_tclas_fc_hdr {
+ uint8 type;
+ uint8 mask;
+ uint8 data[1];
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_tclas_fc_hdr dot11_tclas_fc_hdr_t;
+#define DOT11_TCLAS_FC_HDR_LEN 2 /* Fixed length */
+
+#define DOT11_TCLAS_MASK_0 0x1
+#define DOT11_TCLAS_MASK_1 0x2
+#define DOT11_TCLAS_MASK_2 0x4
+#define DOT11_TCLAS_MASK_3 0x8
+#define DOT11_TCLAS_MASK_4 0x10
+#define DOT11_TCLAS_MASK_5 0x20
+#define DOT11_TCLAS_MASK_6 0x40
+#define DOT11_TCLAS_MASK_7 0x80
+
+#define DOT11_TCLAS_FC_0_ETH 0
+#define DOT11_TCLAS_FC_1_IP 1
+#define DOT11_TCLAS_FC_2_8021Q 2
+#define DOT11_TCLAS_FC_3_OFFSET 3
+#define DOT11_TCLAS_FC_4_IP_HIGHER 4
+#define DOT11_TCLAS_FC_5_8021D 5
+
+/* TCLAS frame classifier type 0 parameters for Ethernet */
+BWL_PRE_PACKED_STRUCT struct dot11_tclas_fc_0_eth {
+ uint8 type;
+ uint8 mask;
+ uint8 sa[ETHER_ADDR_LEN];
+ uint8 da[ETHER_ADDR_LEN];
+ uint16 eth_type;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_tclas_fc_0_eth dot11_tclas_fc_0_eth_t;
+#define DOT11_TCLAS_FC_0_ETH_LEN 16
+
+/* TCLAS frame classifier type 1 parameters for IPV4 */
+BWL_PRE_PACKED_STRUCT struct dot11_tclas_fc_1_ipv4 {
+ uint8 type;
+ uint8 mask;
+ uint8 version;
+ uint32 src_ip;
+ uint32 dst_ip;
+ uint16 src_port;
+ uint16 dst_port;
+ uint8 dscp;
+ uint8 protocol;
+ uint8 reserved;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_tclas_fc_1_ipv4 dot11_tclas_fc_1_ipv4_t;
+#define DOT11_TCLAS_FC_1_IPV4_LEN 18
+
+/* TCLAS frame classifier type 2 parameters for 802.1Q */
+BWL_PRE_PACKED_STRUCT struct dot11_tclas_fc_2_8021q {
+ uint8 type;
+ uint8 mask;
+ uint16 tci;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_tclas_fc_2_8021q dot11_tclas_fc_2_8021q_t;
+#define DOT11_TCLAS_FC_2_8021Q_LEN 4
+
+/* TCLAS frame classifier type 3 parameters for filter offset */
+BWL_PRE_PACKED_STRUCT struct dot11_tclas_fc_3_filter {
+ uint8 type;
+ uint8 mask;
+ uint16 offset;
+ uint8 data[1];
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_tclas_fc_3_filter dot11_tclas_fc_3_filter_t;
+#define DOT11_TCLAS_FC_3_FILTER_LEN 4
+
+/* TCLAS frame classifier type 4 parameters for IPV4 is the same as TCLAS type 1 */
+typedef struct dot11_tclas_fc_1_ipv4 dot11_tclas_fc_4_ipv4_t;
+#define DOT11_TCLAS_FC_4_IPV4_LEN DOT11_TCLAS_FC_1_IPV4_LEN
+
+/* TCLAS frame classifier type 4 parameters for IPV6 */
+BWL_PRE_PACKED_STRUCT struct dot11_tclas_fc_4_ipv6 {
+ uint8 type;
+ uint8 mask;
+ uint8 version;
+ uint8 saddr[16];
+ uint8 daddr[16];
+ uint16 src_port;
+ uint16 dst_port;
+ uint8 dscp;
+ uint8 nexthdr;
+ uint8 flow_lbl[3];
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_tclas_fc_4_ipv6 dot11_tclas_fc_4_ipv6_t;
+#define DOT11_TCLAS_FC_4_IPV6_LEN 44
+
+/* TCLAS frame classifier type 5 parameters for 802.1D */
+BWL_PRE_PACKED_STRUCT struct dot11_tclas_fc_5_8021d {
+ uint8 type;
+ uint8 mask;
+ uint8 pcp;
+ uint8 cfi;
+ uint16 vid;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_tclas_fc_5_8021d dot11_tclas_fc_5_8021d_t;
+#define DOT11_TCLAS_FC_5_8021D_LEN 6
+
+/* TCLAS frame classifier type parameters */
+BWL_PRE_PACKED_STRUCT union dot11_tclas_fc {
+ uint8 data[1];
+ dot11_tclas_fc_hdr_t hdr;
+ dot11_tclas_fc_0_eth_t t0_eth;
+ dot11_tclas_fc_1_ipv4_t t1_ipv4;
+ dot11_tclas_fc_2_8021q_t t2_8021q;
+ dot11_tclas_fc_3_filter_t t3_filter;
+ dot11_tclas_fc_4_ipv4_t t4_ipv4;
+ dot11_tclas_fc_4_ipv6_t t4_ipv6;
+ dot11_tclas_fc_5_8021d_t t5_8021d;
+} BWL_POST_PACKED_STRUCT;
+typedef union dot11_tclas_fc dot11_tclas_fc_t;
+
+#define DOT11_TCLAS_FC_MIN_LEN 4
+#define DOT11_TCLAS_FC_MAX_LEN 254
+
+/* TCLAS information element */
+BWL_PRE_PACKED_STRUCT struct dot11_tclas_ie {
+ uint8 id; /* 14, DOT11_MNG_TCLAS_ID */
+ uint8 len;
+ uint8 user_priority;
+ dot11_tclas_fc_t fc;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_tclas_ie dot11_tclas_ie_t;
+#define DOT11_TCLAS_IE_LEN 3 /* Fixed length, include id and len */
+
+/* TCLAS processing information element */
+BWL_PRE_PACKED_STRUCT struct dot11_tclas_proc_ie {
+ uint8 id; /* 44, DOT11_MNG_TCLAS_PROC_ID */
+ uint8 len;
+ uint8 process;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_tclas_proc_ie dot11_tclas_proc_ie_t;
+#define DOT11_TCLAS_PROC_IE_LEN 3 /* Fixed length, include id and len */
+
+#define DOT11_TCLAS_PROC_MATCHALL 0 /* All high level element need to match */
+#define DOT11_TCLAS_PROC_MATCHONE 1 /* One high level element need to match */
+#define DOT11_TCLAS_PROC_NONMATCH 2 /* Non match to any high level element */
+
+
+/* TSPEC element defined in 802.11 std section 8.4.2.32 - Not supported */
+#define DOT11_TSPEC_IE_LEN 57 /* Fixed length */
+
+/* TFS request information element */
+BWL_PRE_PACKED_STRUCT struct dot11_tfs_req_ie {
+ uint8 id; /* 91, DOT11_MNG_TFS_REQUEST_ID */
+ uint8 len;
+ uint8 tfs_id;
+ uint8 tfs_actcode;
+ uint8 data[1];
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_tfs_req_ie dot11_tfs_req_ie_t;
+#define DOT11_TFS_REQ_IE_LEN 4 /* Fixed length, include id and len */
+
+#define DOT11_TFS_ACTCODE_DELETE 1
+#define DOT11_TFS_ACTCODE_MODIFY 2
+
+/* TFS request subelement */
+BWL_PRE_PACKED_STRUCT struct dot11_tfs_req_se {
+ uint8 sub_id;
+ uint8 length;
+ uint8 data[1];
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_tfs_req_se dot11_tfs_req_se_t;
+
+BWL_PRE_PACKED_STRUCT struct dot11_tfs_se {
+ uint8 sub_id;
+ uint8 len;
+ uint8 data[1];
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_tfs_se dot11_tfs_se_t;
+#define DOT11_TFS_REQ_SUBELEM_LEN 2 /* Fixed length, include id and len */
+
+#define DOT11_TFS_SUBELEM_ID_TFS 1
+#define DOT11_TFS_SUBELEM_ID_VENDOR 221
+
+/* TFS response information element */
+BWL_PRE_PACKED_STRUCT struct dot11_tfs_resp_ie {
+ uint8 id; /* 92, DOT11_MNG_TFS_RESPONSE_ID */
+ uint8 len;
+ uint8 data[1];
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_tfs_resp_ie dot11_tfs_resp_ie_t;
+#define DOT11_TFS_RESP_IE_LEN 2 /* Fixed length, include id and len */
+
+/* TFS status subelement */
+BWL_PRE_PACKED_STRUCT struct dot11_tfs_status_se {
+ uint8 id; /* 92, DOT11_MNG_TFS_RESPONSE_ID */
+ uint8 len;
+ uint8 resp_st;
+ uint8 tfs_id;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_tfs_status_se dot11_tfs_status_se_t;
+
+#define DOT11_TFS_STATUS_SE_LEN 4 /* TFS Status Subelement length */
+#define DOT11_TFS_STATUS_SE_DATA_LEN 2 /* TFS status Subelement Data length */
+
+#define DOT11_TFS_STATUS_SE_ID_TFS_ST 1
+#define DOT11_TFS_STATUS_SE_ID_TFS 2
+#define DOT11_TFS_STATUS_SE_ID_VENDOR 221
+
+#define DOT11_TFS_RESP_ST_ACCEPT 0
+#define DOT11_TFS_RESP_ST_DENY_FORMAT 1
+#define DOT11_TFS_RESP_ST_DENY_RESOURCE 2
+#define DOT11_TFS_RESP_ST_DENY_POLICY 4
+#define DOT11_TFS_RESP_ST_PREFERRED_AP_INCAP 14
+
+
+/* TFS Management Request frame header */
+BWL_PRE_PACKED_STRUCT struct dot11_tfs_req {
+ uint8 category; /* category of action frame (10) */
+ uint8 action; /* WNM action: tfs request (13) */
+ uint8 token; /* dialog token */
+ uint8 data[1]; /* Elements */
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_tfs_req dot11_tfs_req_t;
+#define DOT11_TFS_REQ_LEN 3 /* Fixed length */
+
+/* TFS Management Response frame header */
+BWL_PRE_PACKED_STRUCT struct dot11_tfs_resp {
+ uint8 category; /* category of action frame (10) */
+ uint8 action; /* WNM action: tfs request (14) */
+ uint8 token; /* dialog token */
+ uint8 data[1]; /* Elements */
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_tfs_resp dot11_tfs_resp_t;
+#define DOT11_TFS_RESP_LEN 3 /* Fixed length */
+
+/* TFS Management Notify frame header */
+BWL_PRE_PACKED_STRUCT struct dot11_tfs_notify {
+ uint8 category; /* category of action frame (10) */
+ uint8 action; /* WNM action: tfs request (15) */
+ uint8 num_tfs_id; /* number of TFS IDs */
+ uint8 data[1]; /* Elements */
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_tfs_notify dot11_tfs_notify_t;
+#define DOT11_TFS_NOTIFY_LEN 3 /* Fixed length */
+
+#define DOT11_TFS_NOTIFY_ACT_DEL 1
+#define DOT11_TFS_NOTIFY_ACT_NOTIFY 2
+
+/* WNM-Sleep Management Request frame header */
+BWL_PRE_PACKED_STRUCT struct dot11_wnm_sleep_req {
+ uint8 category; /* category of action frame (10) */
+ uint8 action; /* WNM action: wnm-sleep request (16) */
+ uint8 token; /* dialog token */
+ uint8 data[1]; /* Elements */
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_wnm_sleep_req dot11_wnm_sleep_req_t;
+#define DOT11_WNM_SLEEP_REQ_LEN 3 /* Fixed length */
+
+/* WNM-Sleep Management Response frame header */
+BWL_PRE_PACKED_STRUCT struct dot11_wnm_sleep_resp {
+ uint8 category; /* category of action frame (10) */
+ uint8 action; /* WNM action: wnm-sleep request (17) */
+ uint8 token; /* dialog token */
+ uint16 key_len; /* key data length */
+ uint8 data[1]; /* Elements */
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_wnm_sleep_resp dot11_wnm_sleep_resp_t;
+#define DOT11_WNM_SLEEP_RESP_LEN 5 /* Fixed length */
+
+#define DOT11_WNM_SLEEP_SUBELEM_ID_GTK 0
+#define DOT11_WNM_SLEEP_SUBELEM_ID_IGTK 1
+
+BWL_PRE_PACKED_STRUCT struct dot11_wnm_sleep_subelem_gtk {
+ uint8 sub_id;
+ uint8 len;
+ uint16 key_info;
+ uint8 key_length;
+ uint8 rsc[8];
+ uint8 key[1];
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_wnm_sleep_subelem_gtk dot11_wnm_sleep_subelem_gtk_t;
+#define DOT11_WNM_SLEEP_SUBELEM_GTK_FIXED_LEN 11 /* without sub_id, len, and key */
+#define DOT11_WNM_SLEEP_SUBELEM_GTK_MAX_LEN 43 /* without sub_id and len */
+
+BWL_PRE_PACKED_STRUCT struct dot11_wnm_sleep_subelem_igtk {
+ uint8 sub_id;
+ uint8 len;
+ uint16 key_id;
+ uint8 pn[6];
+ uint8 key[16];
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_wnm_sleep_subelem_igtk dot11_wnm_sleep_subelem_igtk_t;
+#define DOT11_WNM_SLEEP_SUBELEM_IGTK_LEN 24 /* Fixed length */
+
+BWL_PRE_PACKED_STRUCT struct dot11_wnm_sleep_ie {
+ uint8 id; /* 93, DOT11_MNG_WNM_SLEEP_MODE_ID */
+ uint8 len;
+ uint8 act_type;
+ uint8 resp_status;
+ uint16 interval;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_wnm_sleep_ie dot11_wnm_sleep_ie_t;
+#define DOT11_WNM_SLEEP_IE_LEN 4 /* Fixed length */
+
+#define DOT11_WNM_SLEEP_ACT_TYPE_ENTER 0
+#define DOT11_WNM_SLEEP_ACT_TYPE_EXIT 1
+
+#define DOT11_WNM_SLEEP_RESP_ACCEPT 0
+#define DOT11_WNM_SLEEP_RESP_UPDATE 1
+#define DOT11_WNM_SLEEP_RESP_DENY 2
+#define DOT11_WNM_SLEEP_RESP_DENY_TEMP 3
+#define DOT11_WNM_SLEEP_RESP_DENY_KEY 4
+#define DOT11_WNM_SLEEP_RESP_DENY_INUSE 5
+#define DOT11_WNM_SLEEP_RESP_LAST 6
+
+/* DMS Management Request frame header */
+BWL_PRE_PACKED_STRUCT struct dot11_dms_req {
+ uint8 category; /* category of action frame (10) */
+ uint8 action; /* WNM action: dms request (23) */
+ uint8 token; /* dialog token */
+ uint8 data[1]; /* Elements */
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_dms_req dot11_dms_req_t;
+#define DOT11_DMS_REQ_LEN 3 /* Fixed length */
+
+/* DMS Management Response frame header */
+BWL_PRE_PACKED_STRUCT struct dot11_dms_resp {
+ uint8 category; /* category of action frame (10) */
+ uint8 action; /* WNM action: dms request (24) */
+ uint8 token; /* dialog token */
+ uint8 data[1]; /* Elements */
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_dms_resp dot11_dms_resp_t;
+#define DOT11_DMS_RESP_LEN 3 /* Fixed length */
+
+/* DMS request information element */
+BWL_PRE_PACKED_STRUCT struct dot11_dms_req_ie {
+ uint8 id; /* 99, DOT11_MNG_DMS_REQUEST_ID */
+ uint8 len;
+ uint8 data[1];
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_dms_req_ie dot11_dms_req_ie_t;
+#define DOT11_DMS_REQ_IE_LEN 2 /* Fixed length */
+
+/* DMS response information element */
+BWL_PRE_PACKED_STRUCT struct dot11_dms_resp_ie {
+ uint8 id; /* 100, DOT11_MNG_DMS_RESPONSE_ID */
+ uint8 len;
+ uint8 data[1];
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_dms_resp_ie dot11_dms_resp_ie_t;
+#define DOT11_DMS_RESP_IE_LEN 2 /* Fixed length */
+
+/* DMS request descriptor */
+BWL_PRE_PACKED_STRUCT struct dot11_dms_req_desc {
+ uint8 dms_id;
+ uint8 len;
+ uint8 type;
+ uint8 data[1];
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_dms_req_desc dot11_dms_req_desc_t;
+#define DOT11_DMS_REQ_DESC_LEN 3 /* Fixed length */
+
+#define DOT11_DMS_REQ_TYPE_ADD 0
+#define DOT11_DMS_REQ_TYPE_REMOVE 1
+#define DOT11_DMS_REQ_TYPE_CHANGE 2
+
+/* DMS response status */
+BWL_PRE_PACKED_STRUCT struct dot11_dms_resp_st {
+ uint8 dms_id;
+ uint8 len;
+ uint8 type;
+ uint16 lsc;
+ uint8 data[1];
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_dms_resp_st dot11_dms_resp_st_t;
+#define DOT11_DMS_RESP_STATUS_LEN 5 /* Fixed length */
+
+#define DOT11_DMS_RESP_TYPE_ACCEPT 0
+#define DOT11_DMS_RESP_TYPE_DENY 1
+#define DOT11_DMS_RESP_TYPE_TERM 2
+
+#define DOT11_DMS_RESP_LSC_UNSUPPORTED 0xFFFF
+
+BWL_PRE_PACKED_STRUCT struct dot11_addba_req {
+ uint8 category; /* category of action frame (3) */
+ uint8 action; /* action: addba req */
+ uint8 token; /* identifier */
+ uint16 addba_param_set; /* parameter set */
+ uint16 timeout; /* timeout in seconds */
+ uint16 start_seqnum; /* starting sequence number */
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_addba_req dot11_addba_req_t;
+#define DOT11_ADDBA_REQ_LEN 9 /* length of addba req frame */
+
+BWL_PRE_PACKED_STRUCT struct dot11_addba_resp {
+ uint8 category; /* category of action frame (3) */
+ uint8 action; /* action: addba resp */
+ uint8 token; /* identifier */
+ uint16 status; /* status of add request */
+ uint16 addba_param_set; /* negotiated parameter set */
+ uint16 timeout; /* negotiated timeout in seconds */
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_addba_resp dot11_addba_resp_t;
+#define DOT11_ADDBA_RESP_LEN 9 /* length of addba resp frame */
+
+/* DELBA action parameters */
+#define DOT11_DELBA_PARAM_INIT_MASK 0x0800 /* initiator mask */
+#define DOT11_DELBA_PARAM_INIT_SHIFT 11 /* initiator shift */
+#define DOT11_DELBA_PARAM_TID_MASK 0xf000 /* tid mask */
+#define DOT11_DELBA_PARAM_TID_SHIFT 12 /* tid shift */
+
+BWL_PRE_PACKED_STRUCT struct dot11_delba {
+ uint8 category; /* category of action frame (3) */
+ uint8 action; /* action: addba req */
+ uint16 delba_param_set; /* paarmeter set */
+ uint16 reason; /* reason for dellba */
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_delba dot11_delba_t;
+#define DOT11_DELBA_LEN 6 /* length of delba frame */
+
+/* SA Query action field value */
+#define SA_QUERY_REQUEST 0
+#define SA_QUERY_RESPONSE 1
+
+/* ************* 802.11r related definitions. ************* */
+
+/* Over-the-DS Fast Transition Request frame header */
+BWL_PRE_PACKED_STRUCT struct dot11_ft_req {
+ uint8 category; /* category of action frame (6) */
+ uint8 action; /* action: ft req */
+ uint8 sta_addr[ETHER_ADDR_LEN];
+ uint8 tgt_ap_addr[ETHER_ADDR_LEN];
+ uint8 data[1]; /* Elements */
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_ft_req dot11_ft_req_t;
+#define DOT11_FT_REQ_FIXED_LEN 14
+
+/* Over-the-DS Fast Transition Response frame header */
+BWL_PRE_PACKED_STRUCT struct dot11_ft_res {
+ uint8 category; /* category of action frame (6) */
+ uint8 action; /* action: ft resp */
+ uint8 sta_addr[ETHER_ADDR_LEN];
+ uint8 tgt_ap_addr[ETHER_ADDR_LEN];
+ uint16 status; /* status code */
+ uint8 data[1]; /* Elements */
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_ft_res dot11_ft_res_t;
+#define DOT11_FT_RES_FIXED_LEN 16
+
+/* RDE RIC Data Element. */
+BWL_PRE_PACKED_STRUCT struct dot11_rde_ie {
+ uint8 id; /* 11r, DOT11_MNG_RDE_ID */
+ uint8 length;
+ uint8 rde_id; /* RDE identifier. */
+ uint8 rd_count; /* Resource Descriptor Count. */
+ uint16 status; /* Status Code. */
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_rde_ie dot11_rde_ie_t;
+
+/* 11r - Size of the RDE (RIC Data Element) IE, including TLV header. */
+#define DOT11_MNG_RDE_IE_LEN sizeof(dot11_rde_ie_t)
+
+
+/* ************* 802.11k related definitions. ************* */
+
+/* Radio measurements enabled capability ie */
+
+#define DOT11_RRM_CAP_LEN 5 /* length of rrm cap bitmap */
+#define RCPI_IE_LEN 1
+#define RSNI_IE_LEN 1
+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;
+
+/* Bitmap definitions for cap ie */
+#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
+
+
+/* Operating Class (formerly "Regulatory Class") definitions */
+#define DOT11_OP_CLASS_NONE 255
+
+BWL_PRE_PACKED_STRUCT struct do11_ap_chrep {
+ uint8 id;
+ uint8 len;
+ uint8 reg;
+ uint8 chanlist[1];
+} BWL_POST_PACKED_STRUCT;
+typedef struct do11_ap_chrep dot11_ap_chrep_t;
+
+/* Radio Measurements action ids */
+#define DOT11_RM_ACTION_RM_REQ 0 /* Radio measurement request */
+#define DOT11_RM_ACTION_RM_REP 1 /* Radio measurement report */
+#define DOT11_RM_ACTION_LM_REQ 2 /* Link measurement request */
+#define DOT11_RM_ACTION_LM_REP 3 /* Link measurement report */
+#define DOT11_RM_ACTION_NR_REQ 4 /* Neighbor report request */
+#define DOT11_RM_ACTION_NR_REP 5 /* Neighbor report response */
+
+/* Generic radio measurement action frame header */
+BWL_PRE_PACKED_STRUCT struct dot11_rm_action {
+ uint8 category; /* category of action frame (5) */
+ uint8 action; /* radio measurement action */
+ uint8 token; /* dialog 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; /* category of action frame (5) */
+ uint8 action; /* radio measurement action */
+ uint8 token; /* dialog token */
+ uint16 reps; /* no. of repetitions */
+ uint8 data[1];
+} 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
+
+/* Definitions for "mode" bits in rm req */
+#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 /* Duration Mandatory */
+
+/* Definitions for "mode" bits in rm rep */
+#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
+
+/* Beacon request measurement mode */
+#define DOT11_RMREQ_BCN_PASSIVE 0
+#define DOT11_RMREQ_BCN_ACTIVE 1
+#define DOT11_RMREQ_BCN_TABLE 2
+
+/* Sub-element IDs for Beacon Request */
+#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 DOT11_MNG_AP_CHREP_ID
+
+/* Reporting Detail element definition */
+#define DOT11_RMREQ_BCN_REPDET_FIXED 0 /* Fixed length fields only */
+#define DOT11_RMREQ_BCN_REPDET_REQUEST 1 /* + requested information elems */
+#define DOT11_RMREQ_BCN_REPDET_ALL 2 /* All fields */
+
+/* Sub-element IDs for Beacon Report */
+#define DOT11_RMREP_BCN_FRM_BODY 1
+
+/* Sub-element IDs for Frame Report */
+#define DOT11_RMREP_FRAME_COUNT_REPORT 1
+
+/* Channel load request */
+BWL_PRE_PACKED_STRUCT struct dot11_rmreq_chanload {
+ uint8 id;
+ uint8 len;
+ uint8 token;
+ uint8 mode;
+ uint8 type;
+ uint8 reg;
+ uint8 channel;
+ uint16 interval;
+ uint16 duration;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_rmreq_chanload dot11_rmreq_chanload_t;
+#define DOT11_RMREQ_CHANLOAD_LEN 11
+
+/* Channel load report */
+BWL_PRE_PACKED_STRUCT struct dot11_rmrep_chanload {
+ uint8 reg;
+ uint8 channel;
+ uint32 starttime[2];
+ uint16 duration;
+ uint8 channel_load;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_rmrep_chanload dot11_rmrep_chanload_t;
+#define DOT11_RMREP_CHANLOAD_LEN 13
+
+/* Noise histogram request */
+BWL_PRE_PACKED_STRUCT struct dot11_rmreq_noise {
+ uint8 id;
+ uint8 len;
+ uint8 token;
+ uint8 mode;
+ uint8 type;
+ uint8 reg;
+ uint8 channel;
+ uint16 interval;
+ uint16 duration;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_rmreq_noise dot11_rmreq_noise_t;
+#define DOT11_RMREQ_NOISE_LEN 11
+
+/* Noise histogram report */
+BWL_PRE_PACKED_STRUCT struct dot11_rmrep_noise {
+ uint8 reg;
+ uint8 channel;
+ uint32 starttime[2];
+ uint16 duration;
+ uint8 antid;
+ uint8 anpi;
+ uint8 ipi0_dens;
+ uint8 ipi1_dens;
+ uint8 ipi2_dens;
+ uint8 ipi3_dens;
+ uint8 ipi4_dens;
+ uint8 ipi5_dens;
+ uint8 ipi6_dens;
+ uint8 ipi7_dens;
+ uint8 ipi8_dens;
+ uint8 ipi9_dens;
+ uint8 ipi10_dens;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_rmrep_noise dot11_rmrep_noise_t;
+#define DOT11_RMREP_NOISE_LEN 25
+
+/* Frame request */
+BWL_PRE_PACKED_STRUCT struct dot11_rmreq_frame {
+ uint8 id;
+ uint8 len;
+ uint8 token;
+ uint8 mode;
+ uint8 type;
+ uint8 reg;
+ uint8 channel;
+ uint16 interval;
+ uint16 duration;
+ uint8 req_type;
+ struct ether_addr ta;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_rmreq_frame dot11_rmreq_frame_t;
+#define DOT11_RMREQ_FRAME_LEN 18
+
+/* Frame report */
+BWL_PRE_PACKED_STRUCT struct dot11_rmrep_frame {
+ uint8 reg;
+ uint8 channel;
+ uint32 starttime[2];
+ uint16 duration;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_rmrep_frame dot11_rmrep_frame_t;
+#define DOT11_RMREP_FRAME_LEN 12
+
+/* Frame report entry */
+BWL_PRE_PACKED_STRUCT struct dot11_rmrep_frmentry {
+ struct ether_addr ta;
+ struct ether_addr bssid;
+ uint8 phy_type;
+ uint8 avg_rcpi;
+ uint8 last_rsni;
+ uint8 last_rcpi;
+ uint8 ant_id;
+ uint16 frame_cnt;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_rmrep_frmentry dot11_rmrep_frmentry_t;
+#define DOT11_RMREP_FRMENTRY_LEN 19
+
+/* STA statistics request */
+BWL_PRE_PACKED_STRUCT struct dot11_rmreq_stat {
+ uint8 id;
+ uint8 len;
+ uint8 token;
+ uint8 mode;
+ uint8 type;
+ struct ether_addr peer;
+ uint16 interval;
+ uint16 duration;
+ uint8 group_id;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_rmreq_stat dot11_rmreq_stat_t;
+#define DOT11_RMREQ_STAT_LEN 16
+
+/* STA statistics report */
+BWL_PRE_PACKED_STRUCT struct dot11_rmrep_stat {
+ uint16 duration;
+ uint8 group_id;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_rmrep_stat dot11_rmrep_stat_t;
+
+/* Transmit stream/category measurement request */
+BWL_PRE_PACKED_STRUCT struct dot11_rmreq_tx_stream {
+ uint8 id;
+ uint8 len;
+ uint8 token;
+ uint8 mode;
+ uint8 type;
+ uint16 interval;
+ uint16 duration;
+ struct ether_addr peer;
+ uint8 traffic_id;
+ uint8 bin0_range;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_rmreq_tx_stream dot11_rmreq_tx_stream_t;
+
+/* Transmit stream/category measurement report */
+BWL_PRE_PACKED_STRUCT struct dot11_rmrep_tx_stream {
+ uint32 starttime[2];
+ uint16 duration;
+ struct ether_addr peer;
+ uint8 traffic_id;
+ uint8 reason;
+ uint32 txmsdu_cnt;
+ uint32 msdu_discarded_cnt;
+ uint32 msdufailed_cnt;
+ uint32 msduretry_cnt;
+ uint32 cfpolls_lost_cnt;
+ uint32 avrqueue_delay;
+ uint32 avrtx_delay;
+ uint8 bin0_range;
+ uint32 bin0;
+ uint32 bin1;
+ uint32 bin2;
+ uint32 bin3;
+ uint32 bin4;
+ uint32 bin5;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_rmrep_tx_stream dot11_rmrep_tx_stream_t;
+
+/* Measurement pause request */
+BWL_PRE_PACKED_STRUCT struct dot11_rmreq_pause_time {
+ uint8 id;
+ uint8 len;
+ uint8 token;
+ uint8 mode;
+ uint8 type;
+ uint16 pause_time;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_rmreq_pause_time dot11_rmreq_pause_time_t;
+
+
+/* Neighbor Report subelements ID (11k & 11v) */
+#define DOT11_NGBR_TSF_INFO_SE_ID 1
+#define DOT11_NGBR_CCS_SE_ID 2
+#define DOT11_NGBR_BSSTRANS_PREF_SE_ID 3
+#define DOT11_NGBR_BSS_TERM_DUR_SE_ID 4
+#define DOT11_NGBR_BEARING_SE_ID 5
+
+/* Neighbor Report, BSS Transition Candidate Preference subelement */
+BWL_PRE_PACKED_STRUCT struct dot11_ngbr_bsstrans_pref_se {
+ uint8 sub_id;
+ uint8 len;
+ uint8 preference;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_ngbr_bsstrans_pref_se dot11_ngbr_bsstrans_pref_se_t;
+#define DOT11_NGBR_BSSTRANS_PREF_SE_LEN 1
+
+/* Neighbor Report, BSS Termination Duration subelement */
+BWL_PRE_PACKED_STRUCT struct dot11_ngbr_bss_term_dur_se {
+ uint8 sub_id;
+ uint8 len;
+ uint8 tsf[8];
+ uint16 duration;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_ngbr_bss_term_dur_se dot11_ngbr_bss_term_dur_se_t;
+#define DOT11_NGBR_BSS_TERM_DUR_SE_LEN 10
+
+/* Neighbor Report BSSID Information Field */
+#define DOT11_NGBR_BI_REACHABILTY_UNKN 0x0002
+#define DOT11_NGBR_BI_REACHABILTY 0x0003
+#define DOT11_NGBR_BI_SEC 0x0004
+#define DOT11_NGBR_BI_KEY_SCOPE 0x0008
+#define DOT11_NGBR_BI_CAP 0x03f0
+#define DOT11_NGBR_BI_CAP_SPEC_MGMT 0x0010
+#define DOT11_NGBR_BI_CAP_QOS 0x0020
+#define DOT11_NGBR_BI_CAP_APSD 0x0040
+#define DOT11_NGBR_BI_CAP_RDIO_MSMT 0x0080
+#define DOT11_NGBR_BI_CAP_DEL_BA 0x0100
+#define DOT11_NGBR_BI_CAP_IMM_BA 0x0200
+#define DOT11_NGBR_BI_MOBILITY 0x0400
+#define DOT11_NGBR_BI_HT 0x0800
+
+/* Neighbor Report element (11k & 11v) */
+BWL_PRE_PACKED_STRUCT struct dot11_neighbor_rep_ie {
+ uint8 id;
+ uint8 len;
+ struct ether_addr bssid;
+ uint32 bssid_info;
+ uint8 reg; /* Operating class */
+ uint8 channel;
+ uint8 phytype;
+ uint8 data[1]; /* Variable size subelements */
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_neighbor_rep_ie dot11_neighbor_rep_ie_t;
+#define DOT11_NEIGHBOR_REP_IE_FIXED_LEN 13
+
+
+/* MLME Enumerations */
+#define DOT11_BSSTYPE_INFRASTRUCTURE 0 /* d11 infrastructure */
+#define DOT11_BSSTYPE_INDEPENDENT 1 /* d11 independent */
+#define DOT11_BSSTYPE_ANY 2 /* d11 any BSS type */
+#define DOT11_SCANTYPE_ACTIVE 0 /* d11 scan active */
+#define DOT11_SCANTYPE_PASSIVE 1 /* d11 scan passive */
+
+/* Link Measurement */
+BWL_PRE_PACKED_STRUCT struct dot11_lmreq {
+ uint8 category; /* category of action frame (5) */
+ uint8 action; /* radio measurement action */
+ uint8 token; /* dialog token */
+ uint8 txpwr; /* Transmit Power Used */
+ uint8 maxtxpwr; /* Max Transmit Power */
+} 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; /* category of action frame (5) */
+ uint8 action; /* radio measurement action */
+ uint8 token; /* dialog token */
+ dot11_tpc_rep_t tpc; /* TPC element */
+ uint8 rxant; /* Receive Antenna ID */
+ uint8 txant; /* Transmit Antenna ID */
+ uint8 rcpi; /* RCPI */
+ uint8 rsni; /* RSNI */
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_lmrep dot11_lmrep_t;
+#define DOT11_LMREP_LEN 11
+
+/* 802.11 BRCM "Compromise" Pre N constants */
+#define PREN_PREAMBLE 24 /* green field preamble time */
+#define PREN_MM_EXT 12 /* extra mixed mode preamble time */
+#define PREN_PREAMBLE_EXT 4 /* extra preamble (multiply by unique_streams-1) */
+
+/* 802.11N PHY constants */
+#define RIFS_11N_TIME 2 /* NPHY RIFS time */
+
+/* 802.11 HT PLCP format 802.11n-2009, sec 20.3.9.4.3
+ * HT-SIG is composed of two 24 bit parts, HT-SIG1 and HT-SIG2
+ */
+/* HT-SIG1 */
+#define HT_SIG1_MCS_MASK 0x00007F
+#define HT_SIG1_CBW 0x000080
+#define HT_SIG1_HT_LENGTH 0xFFFF00
+
+/* HT-SIG2 */
+#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
+
+/* HT Timing-related parameters (802.11-2012, sec 20.3.6) */
+#define HT_T_LEG_PREAMBLE 16
+#define HT_T_L_SIG 4
+#define HT_T_SIG 8
+#define HT_T_LTF1 4
+#define HT_T_GF_LTF1 8
+#define HT_T_LTFs 4
+#define HT_T_STF 4
+#define HT_T_GF_STF 8
+#define HT_T_SYML 4
+
+#define HT_N_SERVICE 16 /* bits in SERVICE field */
+#define HT_N_TAIL 6 /* tail bits per BCC encoder */
+
+/* 802.11 A PHY constants */
+#define APHY_SLOT_TIME 9 /* APHY slot time */
+#define APHY_SIFS_TIME 16 /* APHY SIFS time */
+#define APHY_DIFS_TIME (APHY_SIFS_TIME + (2 * APHY_SLOT_TIME)) /* APHY DIFS time */
+#define APHY_PREAMBLE_TIME 16 /* APHY preamble time */
+#define APHY_SIGNAL_TIME 4 /* APHY signal time */
+#define APHY_SYMBOL_TIME 4 /* APHY symbol time */
+#define APHY_SERVICE_NBITS 16 /* APHY service nbits */
+#define APHY_TAIL_NBITS 6 /* APHY tail nbits */
+#define APHY_CWMIN 15 /* APHY cwmin */
+
+/* 802.11 B PHY constants */
+#define BPHY_SLOT_TIME 20 /* BPHY slot time */
+#define BPHY_SIFS_TIME 10 /* BPHY SIFS time */
+#define BPHY_DIFS_TIME 50 /* BPHY DIFS time */
+#define BPHY_PLCP_TIME 192 /* BPHY PLCP time */
+#define BPHY_PLCP_SHORT_TIME 96 /* BPHY PLCP short time */
+#define BPHY_CWMIN 31 /* BPHY cwmin */
+
+/* 802.11 G constants */
+#define DOT11_OFDM_SIGNAL_EXTENSION 6 /* d11 OFDM signal extension */
+
+#define PHY_CWMAX 1023 /* PHY cwmax */
+
+#define DOT11_MAXNUMFRAGS 16 /* max # fragments per MSDU */
+
+/* 802.11 VHT constants */
+
+typedef int vht_group_id_t;
+
+/* for VHT-A1 */
+/* SIG-A1 reserved bits */
+#define VHT_SIGA1_CONST_MASK 0x800004
+
+#define VHT_SIGA1_BW_MASK 0x000003
+#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_MASK 0x0003f0
+#define VHT_SIGA1_GID_SHIFT 4
+#define VHT_SIGA1_GID_TO_AP 0x00
+#define VHT_SIGA1_GID_NOT_TO_AP 0x3f
+#define VHT_SIGA1_GID_MAX_GID 0x3f
+
+#define VHT_SIGA1_NSTS_SHIFT_MASK_USER0 0x001C00
+#define VHT_SIGA1_NSTS_SHIFT 10
+
+#define VHT_SIGA1_PARTIAL_AID_MASK 0x3fe000
+#define VHT_SIGA1_PARTIAL_AID_SHIFT 13
+
+#define VHT_SIGA1_TXOP_PS_NOT_ALLOWED 0x400000
+
+/* for VHT-A2 */
+#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_LDPC_EXTRA_OFDM_SYM 0x000008
+#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
+
+/* VHT Timing-related parameters (802.11ac D4.0, sec 22.3.6) */
+#define VHT_T_LEG_PREAMBLE 16
+#define VHT_T_L_SIG 4
+#define VHT_T_SIG_A 8
+#define VHT_T_LTF 4
+#define VHT_T_STF 4
+#define VHT_T_SIG_B 4
+#define VHT_T_SYML 4
+
+#define VHT_N_SERVICE 16 /* bits in SERVICE field */
+#define VHT_N_TAIL 6 /* tail bits per BCC encoder */
+
+
+/* dot11Counters Table - 802.11 spec., Annex D */
+typedef struct d11cnt {
+ uint32 txfrag; /* dot11TransmittedFragmentCount */
+ uint32 txmulti; /* dot11MulticastTransmittedFrameCount */
+ uint32 txfail; /* dot11FailedCount */
+ uint32 txretry; /* dot11RetryCount */
+ uint32 txretrie; /* dot11MultipleRetryCount */
+ uint32 rxdup; /* dot11FrameduplicateCount */
+ uint32 txrts; /* dot11RTSSuccessCount */
+ uint32 txnocts; /* dot11RTSFailureCount */
+ uint32 txnoack; /* dot11ACKFailureCount */
+ uint32 rxfrag; /* dot11ReceivedFragmentCount */
+ uint32 rxmulti; /* dot11MulticastReceivedFrameCount */
+ uint32 rxcrc; /* dot11FCSErrorCount */
+ uint32 txfrmsnt; /* dot11TransmittedFrameCount */
+ uint32 rxundec; /* dot11WEPUndecryptableCount */
+} d11cnt_t;
+
+/* OUI for BRCM proprietary IE */
+#define BRCM_PROP_OUI "\x00\x90\x4C" /* Broadcom proprietary OUI */
+
+
+/* brcm syscap_ie cap */
+#define BRCM_SYSCAP_WET_TUNNEL 0x0100 /* Device with WET_TUNNEL support */
+
+/* BRCM OUI: Used in the proprietary(221) IE in all broadcom devices */
+#define BRCM_OUI "\x00\x10\x18" /* Broadcom OUI */
+
+/* BRCM info element */
+BWL_PRE_PACKED_STRUCT struct brcm_ie {
+ uint8 id; /* IE ID, 221, DOT11_MNG_PROPR_ID */
+ uint8 len; /* IE length */
+ uint8 oui[3]; /* Proprietary OUI, BRCM_OUI */
+ uint8 ver; /* type/ver of this IE */
+ uint8 assoc; /* # of assoc STAs */
+ uint8 flags; /* misc flags */
+ uint8 flags1; /* misc flags */
+ uint16 amsdu_mtu_pref; /* preferred A-MSDU MTU */
+} BWL_POST_PACKED_STRUCT;
+typedef struct brcm_ie brcm_ie_t;
+#define BRCM_IE_LEN 11 /* BRCM IE length */
+#define BRCM_IE_VER 2 /* BRCM IE version */
+#define BRCM_IE_LEGACY_AES_VER 1 /* BRCM IE legacy AES version */
+
+/* brcm_ie flags */
+#define BRF_LZWDS 0x4 /* lazy wds enabled */
+#define BRF_BLOCKACK 0x8 /* BlockACK capable */
+
+/* brcm_ie flags1 */
+#define BRF1_AMSDU 0x1 /* A-MSDU capable */
+#define BRF1_WMEPS 0x4 /* AP is capable of handling WME + PS w/o APSD */
+#define BRF1_PSOFIX 0x8 /* AP has fixed PS mode out-of-order packets */
+#define BRF1_RX_LARGE_AGG 0x10 /* device can rx large aggregates */
+#define BRF1_RFAWARE_DCS 0x20 /* RFAWARE dynamic channel selection (DCS) */
+#define BRF1_SOFTAP 0x40 /* Configure as Broadcom SOFTAP */
+#define BRF1_DWDS 0x80 /* DWDS capable */
+
+/* Vendor IE structure */
+BWL_PRE_PACKED_STRUCT struct vndr_ie {
+ uchar id;
+ uchar len;
+ uchar oui [3];
+ uchar data [1]; /* Variable size data */
+} BWL_POST_PACKED_STRUCT;
+typedef struct vndr_ie vndr_ie_t;
+
+#define VNDR_IE_HDR_LEN 2 /* id + len field */
+#define VNDR_IE_MIN_LEN 3 /* size of the oui field */
+#define VNDR_IE_FIXED_LEN (VNDR_IE_HDR_LEN + VNDR_IE_MIN_LEN)
+
+#define VNDR_IE_MAX_LEN 255 /* vendor IE max length, without ID and len */
+
+/* BRCM PROP DEVICE PRIMARY MAC ADDRESS IE */
+BWL_PRE_PACKED_STRUCT struct member_of_brcm_prop_ie {
+ uchar id;
+ uchar len;
+ uchar oui[3];
+ uint8 type; /* type inidicates what follows */
+ struct ether_addr ea; /* Device Primary MAC Adrress */
+} BWL_POST_PACKED_STRUCT;
+typedef struct member_of_brcm_prop_ie member_of_brcm_prop_ie_t;
+
+#define MEMBER_OF_BRCM_PROP_IE_LEN 10 /* IE max length */
+#define MEMBER_OF_BRCM_PROP_IE_TYPE 54
+
+/* BRCM Reliable Multicast IE */
+BWL_PRE_PACKED_STRUCT struct relmcast_brcm_prop_ie {
+ uchar id;
+ uchar len;
+ uchar oui[3];
+ uint8 type; /* type inidicates what follows */
+ struct ether_addr ea; /* The ack sender's MAC Adrress */
+ struct ether_addr mcast_ea; /* The multicast MAC address */
+ uint8 updtmo; /* time interval(second) for client to send null packet to report its rssi */
+} BWL_POST_PACKED_STRUCT;
+typedef struct relmcast_brcm_prop_ie relmcast_brcm_prop_ie_t;
+
+#define RELMCAST_BRCM_PROP_IE_LEN (sizeof(relmcast_brcm_prop_ie_t)-2) /* IE length */
+#define RELMCAST_BRCM_PROP_IE_TYPE 55
+
+/* ************* HT definitions. ************* */
+#define MCSSET_LEN 16 /* 16-bits per 8-bit set to give 128-bits bitmap of MCS Index */
+#define MAX_MCS_NUM (128) /* max mcs number = 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 dot11_ht_cap_ie {
+ uint8 id;
+ uint8 len;
+ ht_cap_ie_t ht_cap;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_ht_cap_ie dot11_ht_cap_ie_t;
+
+/* CAP IE: HT 1.0 spec. simply stole a 802.11 IE, we use our prop. IE until this is resolved */
+/* the capability IE is primarily used to convey this nodes abilities */
+BWL_PRE_PACKED_STRUCT struct ht_prop_cap_ie {
+ uint8 id; /* IE ID, 221, DOT11_MNG_PROPR_ID */
+ uint8 len; /* IE length */
+ uint8 oui[3]; /* Proprietary OUI, BRCM_PROP_OUI */
+ uint8 type; /* type inidicates what follows */
+ 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 /* overhead bytes for prop oui ie */
+#define HT_CAP_IE_LEN 26 /* HT capability len (based on .11n d2.0) */
+#define HT_CAP_IE_TYPE 51
+
+#define HT_CAP_LDPC_CODING 0x0001 /* Support for rx of LDPC coded pkts */
+#define HT_CAP_40MHZ 0x0002 /* FALSE:20Mhz, TRUE:20/40MHZ supported */
+#define HT_CAP_MIMO_PS_MASK 0x000C /* Mimo PS mask */
+#define HT_CAP_MIMO_PS_SHIFT 0x0002 /* Mimo PS shift */
+#define HT_CAP_MIMO_PS_OFF 0x0003 /* Mimo PS, no restriction */
+#define HT_CAP_MIMO_PS_RTS 0x0001 /* Mimo PS, send RTS/CTS around MIMO frames */
+#define HT_CAP_MIMO_PS_ON 0x0000 /* Mimo PS, MIMO disallowed */
+#define HT_CAP_GF 0x0010 /* Greenfield preamble support */
+#define HT_CAP_SHORT_GI_20 0x0020 /* 20MHZ short guard interval support */
+#define HT_CAP_SHORT_GI_40 0x0040 /* 40Mhz short guard interval support */
+#define HT_CAP_TX_STBC 0x0080 /* Tx STBC support */
+#define HT_CAP_RX_STBC_MASK 0x0300 /* Rx STBC mask */
+#define HT_CAP_RX_STBC_SHIFT 8 /* Rx STBC shift */
+#define HT_CAP_DELAYED_BA 0x0400 /* delayed BA support */
+#define HT_CAP_MAX_AMSDU 0x0800 /* Max AMSDU size in bytes , 0=3839, 1=7935 */
+
+#define HT_CAP_DSSS_CCK 0x1000 /* DSSS/CCK supported by the BSS */
+#define HT_CAP_PSMP 0x2000 /* Power Save Multi Poll support */
+#define HT_CAP_40MHZ_INTOLERANT 0x4000 /* 40MHz Intolerant */
+#define HT_CAP_LSIG_TXOP 0x8000 /* L-SIG TXOP protection support */
+
+#define HT_CAP_RX_STBC_NO 0x0 /* no rx STBC support */
+#define HT_CAP_RX_STBC_ONE_STREAM 0x1 /* rx STBC support of 1 spatial stream */
+#define HT_CAP_RX_STBC_TWO_STREAM 0x2 /* rx STBC support of 1-2 spatial streams */
+#define HT_CAP_RX_STBC_THREE_STREAM 0x3 /* rx STBC support of 1-3 spatial streams */
+
+
+#define HT_CAP_TXBF_CAP_IMPLICIT_TXBF_RX 0x1
+#define HT_CAP_TXBF_CAP_NDP_TX 0x8
+#define HT_CAP_TXBF_CAP_NDP_RX 0x10
+#define HT_CAP_TXBF_CAP_EXPLICIT_CSI 0x100
+#define HT_CAP_TXBF_CAP_EXPLICIT_NC_STEERING 0x200
+#define HT_CAP_TXBF_CAP_EXPLICIT_C_STEERING 0x400
+#define HT_CAP_TXBF_CAP_EXPLICIT_CSI_FB_MASK 0x1800
+#define HT_CAP_TXBF_CAP_EXPLICIT_CSI_FB_SHIFT 11
+#define HT_CAP_TXBF_CAP_EXPLICIT_NC_FB_MASK 0x6000
+#define HT_CAP_TXBF_CAP_EXPLICIT_NC_FB_SHIFT 13
+#define HT_CAP_TXBF_CAP_EXPLICIT_C_FB_MASK 0x18000
+#define HT_CAP_TXBF_CAP_EXPLICIT_C_FB_SHIFT 15
+#define HT_CAP_TXBF_CAP_CSI_BFR_ANT_SHIFT 19
+#define HT_CAP_TXBF_CAP_NC_BFR_ANT_SHIFT 21
+#define HT_CAP_TXBF_CAP_C_BFR_ANT_SHIFT 23
+#define HT_CAP_TXBF_CAP_C_BFR_ANT_MASK 0x1800000
+
+#define HT_CAP_TXBF_CAP_CHAN_ESTIM_SHIFT 27
+#define HT_CAP_TXBF_CAP_CHAN_ESTIM_MASK 0x18000000
+
+#define HT_CAP_TXBF_FB_TYPE_NONE 0
+#define HT_CAP_TXBF_FB_TYPE_DELAYED 1
+#define HT_CAP_TXBF_FB_TYPE_IMMEDIATE 2
+#define HT_CAP_TXBF_FB_TYPE_BOTH 3
+
+#define HT_CAP_TX_BF_CAP_EXPLICIT_CSI_FB_MASK 0x400
+#define HT_CAP_TX_BF_CAP_EXPLICIT_CSI_FB_SHIFT 10
+#define HT_CAP_TX_BF_CAP_EXPLICIT_COMPRESSED_FB_MASK 0x18000
+#define HT_CAP_TX_BF_CAP_EXPLICIT_COMPRESSED_FB_SHIFT 15
+
+#define VHT_MAX_MPDU 11454 /* max mpdu size for now (bytes) */
+#define VHT_MPDU_MSDU_DELTA 56 /* Difference in spec - vht mpdu, amsdu len */
+/* Max AMSDU len - per spec */
+#define VHT_MAX_AMSDU (VHT_MAX_MPDU - VHT_MPDU_MSDU_DELTA)
+
+#define HT_MAX_AMSDU 7935 /* max amsdu size (bytes) per the HT spec */
+#define HT_MIN_AMSDU 3835 /* min amsdu size (bytes) per the HT spec */
+
+#define HT_PARAMS_RX_FACTOR_MASK 0x03 /* ampdu rcv factor mask */
+#define HT_PARAMS_DENSITY_MASK 0x1C /* ampdu density mask */
+#define HT_PARAMS_DENSITY_SHIFT 2 /* ampdu density shift */
+
+/* HT/AMPDU specific define */
+#define AMPDU_MAX_MPDU_DENSITY 7 /* max mpdu density; in 1/4 usec units */
+#define AMPDU_DENSITY_NONE 0 /* No density requirement */
+#define AMPDU_DENSITY_1over4_US 1 /* 1/4 us density */
+#define AMPDU_DENSITY_1over2_US 2 /* 1/2 us density */
+#define AMPDU_DENSITY_1_US 3 /* 1 us density */
+#define AMPDU_DENSITY_2_US 4 /* 2 us density */
+#define AMPDU_DENSITY_4_US 5 /* 4 us density */
+#define AMPDU_DENSITY_8_US 6 /* 8 us density */
+#define AMPDU_DENSITY_16_US 7 /* 16 us density */
+#define AMPDU_RX_FACTOR_8K 0 /* max rcv ampdu len (8kb) */
+#define AMPDU_RX_FACTOR_16K 1 /* max rcv ampdu len (16kb) */
+#define AMPDU_RX_FACTOR_32K 2 /* max rcv ampdu len (32kb) */
+#define AMPDU_RX_FACTOR_64K 3 /* max rcv ampdu len (64kb) */
+#define AMPDU_RX_FACTOR_BASE 8*1024 /* ampdu factor base for rx len */
+
+#define AMPDU_DELIMITER_LEN 4 /* length of ampdu delimiter */
+#define AMPDU_DELIMITER_LEN_MAX 63 /* max length of ampdu delimiter(enforced in HW) */
+
+#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; /* control channel number */
+ uint8 byte1; /* ext ch,rec. ch. width, RIFS support */
+ uint16 opmode; /* operation mode */
+ uint16 misc_bits; /* misc bits */
+ uint8 basic_mcs[MCSSET_LEN]; /* required MCS set */
+} BWL_POST_PACKED_STRUCT;
+typedef struct ht_add_ie ht_add_ie_t;
+
+/* ADD IE: HT 1.0 spec. simply stole a 802.11 IE, we use our prop. IE until this is resolved */
+/* the additional IE is primarily used to convey the current BSS configuration */
+BWL_PRE_PACKED_STRUCT struct ht_prop_add_ie {
+ uint8 id; /* IE ID, 221, DOT11_MNG_PROPR_ID */
+ uint8 len; /* IE length */
+ uint8 oui[3]; /* Proprietary OUI, BRCM_PROP_OUI */
+ uint8 type; /* indicates what follows */
+ 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
+
+/* byte1 defn's */
+#define HT_BW_ANY 0x04 /* set, STA can use 20 or 40MHz */
+#define HT_RIFS_PERMITTED 0x08 /* RIFS allowed */
+
+/* opmode defn's */
+#define HT_OPMODE_MASK 0x0003 /* protection mode mask */
+#define HT_OPMODE_SHIFT 0 /* protection mode shift */
+#define HT_OPMODE_PURE 0x0000 /* protection mode PURE */
+#define HT_OPMODE_OPTIONAL 0x0001 /* protection mode optional */
+#define HT_OPMODE_HT20IN40 0x0002 /* protection mode 20MHz HT in 40MHz BSS */
+#define HT_OPMODE_MIXED 0x0003 /* protection mode Mixed Mode */
+#define HT_OPMODE_NONGF 0x0004 /* protection mode non-GF */
+#define DOT11N_TXBURST 0x0008 /* Tx burst limit */
+#define DOT11N_OBSS_NONHT 0x0010 /* OBSS Non-HT STA present */
+
+/* misc_bites defn's */
+#define HT_BASIC_STBC_MCS 0x007f /* basic STBC MCS */
+#define HT_DUAL_STBC_PROT 0x0080 /* Dual STBC Protection */
+#define HT_SECOND_BCN 0x0100 /* Secondary beacon support */
+#define HT_LSIG_TXOP 0x0200 /* L-SIG TXOP Protection full support */
+#define HT_PCO_ACTIVE 0x0400 /* PCO active */
+#define HT_PCO_PHASE 0x0800 /* PCO phase */
+#define HT_DUALCTS_PROTECTION 0x0080 /* DUAL CTS protection needed */
+
+/* Tx Burst Limits */
+#define DOT11N_2G_TXBURST_LIMIT 6160 /* 2G band Tx burst limit per 802.11n Draft 1.10 (usec) */
+#define DOT11N_5G_TXBURST_LIMIT 3080 /* 5G band Tx burst limit per 802.11n Draft 1.10 (usec) */
+
+/* Macros for opmode */
+#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) /* mixed mode present */
+#define HT_HT20_PRESENT(add_ie) ((ltoh16_ua(&add_ie->opmode) & HT_OPMODE_MASK) \
+ == HT_OPMODE_HT20IN40) /* 20MHz HT present */
+#define HT_OPTIONAL_PRESENT(add_ie) ((ltoh16_ua(&add_ie->opmode) & HT_OPMODE_MASK) \
+ == HT_OPMODE_OPTIONAL) /* Optional protection present */
+#define HT_USE_PROTECTION(add_ie) (HT_HT20_PRESENT((add_ie)) || \
+ HT_MIXEDMODE_PRESENT((add_ie))) /* use protection */
+#define HT_NONGF_PRESENT(add_ie) ((ltoh16_ua(&add_ie->opmode) & HT_OPMODE_NONGF) \
+ == HT_OPMODE_NONGF) /* non-GF present */
+#define DOT11N_TXBURST_PRESENT(add_ie) ((ltoh16_ua(&add_ie->opmode) & DOT11N_TXBURST) \
+ == DOT11N_TXBURST) /* Tx Burst present */
+#define DOT11N_OBSS_NONHT_PRESENT(add_ie) ((ltoh16_ua(&add_ie->opmode) & DOT11N_OBSS_NONHT) \
+ == DOT11N_OBSS_NONHT) /* OBSS Non-HT present */
+
+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) /* HT OBSS len (based on 802.11n d3.0) */
+
+/* HT control field */
+#define HT_CTRL_LA_TRQ 0x00000002 /* sounding request */
+#define HT_CTRL_LA_MAI 0x0000003C /* MCS request or antenna selection indication */
+#define HT_CTRL_LA_MAI_SHIFT 2
+#define HT_CTRL_LA_MAI_MRQ 0x00000004 /* MCS request */
+#define HT_CTRL_LA_MAI_MSI 0x00000038 /* MCS request sequence identifier */
+#define HT_CTRL_LA_MFSI 0x000001C0 /* MFB sequence identifier */
+#define HT_CTRL_LA_MFSI_SHIFT 6
+#define HT_CTRL_LA_MFB_ASELC 0x0000FE00 /* MCS feedback, antenna selection command/data */
+#define HT_CTRL_LA_MFB_ASELC_SH 9
+#define HT_CTRL_LA_ASELC_CMD 0x00000C00 /* ASEL command */
+#define HT_CTRL_LA_ASELC_DATA 0x0000F000 /* ASEL data */
+#define HT_CTRL_CAL_POS 0x00030000 /* Calibration position */
+#define HT_CTRL_CAL_SEQ 0x000C0000 /* Calibration sequence */
+#define HT_CTRL_CSI_STEERING 0x00C00000 /* CSI/Steering */
+#define HT_CTRL_CSI_STEER_SHIFT 22
+#define HT_CTRL_CSI_STEER_NFB 0 /* no fedback required */
+#define HT_CTRL_CSI_STEER_CSI 1 /* CSI, H matrix */
+#define HT_CTRL_CSI_STEER_NCOM 2 /* non-compressed beamforming */
+#define HT_CTRL_CSI_STEER_COM 3 /* compressed beamforming */
+#define HT_CTRL_NDP_ANNOUNCE 0x01000000 /* NDP announcement */
+#define HT_CTRL_AC_CONSTRAINT 0x40000000 /* AC Constraint */
+#define HT_CTRL_RDG_MOREPPDU 0x80000000 /* RDG/More PPDU */
+
+#define HT_OPMODE_OPTIONAL 0x0001 /* protection mode optional */
+#define HT_OPMODE_HT20IN40 0x0002 /* protection mode 20MHz HT in 40MHz BSS */
+#define HT_OPMODE_MIXED 0x0003 /* protection mode Mixed Mode */
+#define HT_OPMODE_NONGF 0x0004 /* protection mode non-GF */
+#define DOT11N_TXBURST 0x0008 /* Tx burst limit */
+#define DOT11N_OBSS_NONHT 0x0010 /* OBSS Non-HT STA present */
+
+/* ************* VHT definitions. ************* */
+
+/*
+ * VHT Capabilites IE (sec 8.4.2.160)
+ */
+
+BWL_PRE_PACKED_STRUCT struct vht_cap_ie {
+ uint32 vht_cap_info;
+ /* supported MCS set - 64 bit field */
+ 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;
+
+/* 4B cap_info + 8B supp_mcs */
+#define VHT_CAP_IE_LEN 12
+
+/* VHT Capabilities Info field - 32bit - in VHT Cap IE */
+#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
+
+/* VHT Supported MCS Set - 64-bit - in VHT Cap IE */
+#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_S 2 /* num bits for 1-stream */
+#define VHT_CAP_MCS_MAP_M 0x3 /* mask for 1-stream */
+/* assumes VHT_CAP_MCS_MAP_NONE is 3 and 2 bits are used for encoding */
+#define VHT_CAP_MCS_MAP_NONE_ALL 0xffff
+/* mcsmap with MCS0-9 for Nss = 3 */
+#define VHT_CAP_MCS_MAP_0_9_NSS3 \
+ ((VHT_CAP_MCS_MAP_0_9 << VHT_MCS_MAP_GET_SS_IDX(1)) | \
+ (VHT_CAP_MCS_MAP_0_9 << VHT_MCS_MAP_GET_SS_IDX(2)) | \
+ (VHT_CAP_MCS_MAP_0_9 << VHT_MCS_MAP_GET_SS_IDX(3)))
+
+#define VHT_CAP_MCS_MAP_NSS_MAX 8
+
+/* get mcsmap with given mcs for given nss streams */
+#define VHT_CAP_MCS_MAP_CREATE(mcsmap, nss, mcs) \
+ do { \
+ int i; \
+ for (i = 1; i <= nss; i++) { \
+ VHT_MCS_MAP_SET_MCS_PER_SS(i, mcs, mcsmap); \
+ } \
+ } while (0)
+
+/* Map the mcs code to mcs bit map */
+#define VHT_MCS_CODE_TO_MCS_MAP(mcs_code) \
+ ((mcs_code == VHT_CAP_MCS_MAP_0_7) ? 0xff : \
+ (mcs_code == VHT_CAP_MCS_MAP_0_8) ? 0x1ff : \
+ (mcs_code == VHT_CAP_MCS_MAP_0_9) ? 0x3ff : 0)
+
+/* Map the mcs bit map to mcs code */
+#define VHT_MCS_MAP_TO_MCS_CODE(mcs_map) \
+ ((mcs_map == 0xff) ? VHT_CAP_MCS_MAP_0_7 : \
+ (mcs_map == 0x1ff) ? VHT_CAP_MCS_MAP_0_8 : \
+ (mcs_map == 0x3ff) ? VHT_CAP_MCS_MAP_0_9 : VHT_CAP_MCS_MAP_NONE)
+
+/* VHT Capabilities Supported Channel Width */
+typedef enum vht_cap_chan_width {
+ VHT_CAP_CHAN_WIDTH_SUPPORT_MANDATORY = 0x00,
+ VHT_CAP_CHAN_WIDTH_SUPPORT_160 = 0x04,
+ VHT_CAP_CHAN_WIDTH_SUPPORT_160_8080 = 0x08
+} vht_cap_chan_width_t;
+
+/* VHT Capabilities Supported max MPDU LEN (sec 8.4.2.160.2) */
+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;
+
+/* Maximum MPDU Length byte counts for the VHT Capabilities advertised limits */
+#define VHT_MPDU_LIMIT_4K 3895
+#define VHT_MPDU_LIMIT_8K 7991
+#define VHT_MPDU_LIMIT_11K 11454
+
+
+/*
+ * VHT Operation IE (sec 8.4.2.161)
+ */
+
+BWL_PRE_PACKED_STRUCT struct vht_op_ie {
+ uint8 chan_width;
+ uint8 chan1;
+ uint8 chan2;
+ uint16 supp_mcs; /* same def as above in vht cap */
+} BWL_POST_PACKED_STRUCT;
+typedef struct vht_op_ie vht_op_ie_t;
+
+/* 3B VHT Op info + 2B Basic MCS */
+#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;
+
+/* AID length */
+#define AID_IE_LEN 2
+/*
+ * BRCM vht features IE header
+ * The header if the fixed part of the IE
+ * On the 5GHz band this is the entire IE,
+ * on 2.4GHz the VHT IEs as defined in the 802.11ac
+ * specification follows
+ *
+ *
+ * VHT features rates bitmap.
+ * Bit0: 5G MCS 0-9 BW 160MHz
+ * Bit1: 5G MCS 0-9 support BW 80MHz
+ * Bit2: 5G MCS 0-9 support BW 20MHz
+ * Bit3: 2.4G MCS 0-9 support BW 20MHz
+ * Bits:4-7 Reserved for future use
+ *
+ */
+#define VHT_FEATURES_IE_TYPE 0x4
+BWL_PRE_PACKED_STRUCT struct vht_features_ie_hdr {
+ uint8 oui[3]; /* Proprietary OUI, BRCM_PROP_OUI */
+ uint8 type; /* type of this IE = 4 */
+ uint8 rate_mask; /* VHT rate mask */
+} BWL_POST_PACKED_STRUCT;
+typedef struct vht_features_ie_hdr vht_features_ie_hdr_t;
+
+/* Def for rx & tx basic mcs maps - ea ss num has 2 bits of info */
+#define VHT_MCS_MAP_GET_SS_IDX(nss) (((nss)-1) * VHT_CAP_MCS_MAP_S)
+#define VHT_MCS_MAP_GET_MCS_PER_SS(nss, mcsMap) \
+ (((mcsMap) >> VHT_MCS_MAP_GET_SS_IDX(nss)) & VHT_CAP_MCS_MAP_M)
+#define VHT_MCS_MAP_SET_MCS_PER_SS(nss, numMcs, mcsMap) \
+ do { \
+ (mcsMap) &= (~(VHT_CAP_MCS_MAP_M << VHT_MCS_MAP_GET_SS_IDX(nss))); \
+ (mcsMap) |= (((numMcs) & VHT_CAP_MCS_MAP_M) << VHT_MCS_MAP_GET_SS_IDX(nss)); \
+ } while (0)
+#define VHT_MCS_SS_SUPPORTED(nss, mcsMap) \
+ (VHT_MCS_MAP_GET_MCS_PER_SS((nss), (mcsMap)) != VHT_CAP_MCS_MAP_NONE)
+
+
+/* ************* WPA definitions. ************* */
+#define WPA_OUI "\x00\x50\xF2" /* WPA OUI */
+#define WPA_OUI_LEN 3 /* WPA OUI length */
+#define WPA_OUI_TYPE 1
+#define WPA_VERSION 1 /* WPA version */
+#define WPA2_OUI "\x00\x0F\xAC" /* WPA2 OUI */
+#define WPA2_OUI_LEN 3 /* WPA2 OUI length */
+#define WPA2_VERSION 1 /* WPA2 version */
+#define WPA2_VERSION_LEN 2 /* WAP2 version length */
+
+/* ************* WPS definitions. ************* */
+#define WPS_OUI "\x00\x50\xF2" /* WPS OUI */
+#define WPS_OUI_LEN 3 /* WPS OUI length */
+#define WPS_OUI_TYPE 4
+
+/* ************* WFA definitions. ************* */
+
+#ifdef P2P_IE_OVRD
+#define WFA_OUI MAC_OUI
+#else
+#define WFA_OUI "\x50\x6F\x9A" /* WFA OUI */
+#endif /* P2P_IE_OVRD */
+#define WFA_OUI_LEN 3 /* WFA OUI length */
+#ifdef P2P_IE_OVRD
+#define WFA_OUI_TYPE_P2P MAC_OUI_TYPE_P2P
+#else
+#define WFA_OUI_TYPE_TPC 8
+#define WFA_OUI_TYPE_P2P 9
+#endif
+
+#define WFA_OUI_TYPE_TPC 8
+#ifdef WLTDLS
+#define WFA_OUI_TYPE_TPQ 4 /* WFD Tunneled Probe ReQuest */
+#define WFA_OUI_TYPE_TPS 5 /* WFD Tunneled Probe ReSponse */
+#define WFA_OUI_TYPE_WFD 10
+#endif /* WTDLS */
+#define WFA_OUI_TYPE_HS20 0x10
+
+/* RSN authenticated key managment suite */
+#define RSN_AKM_NONE 0 /* None (IBSS) */
+#define RSN_AKM_UNSPECIFIED 1 /* Over 802.1x */
+#define RSN_AKM_PSK 2 /* Pre-shared Key */
+#define RSN_AKM_FBT_1X 3 /* Fast Bss transition using 802.1X */
+#define RSN_AKM_FBT_PSK 4 /* Fast Bss transition using Pre-shared Key */
+#define RSN_AKM_MFP_1X 5 /* SHA256 key derivation, using 802.1X */
+#define RSN_AKM_MFP_PSK 6 /* SHA256 key derivation, using Pre-shared Key */
+#define RSN_AKM_TPK 7 /* TPK(TDLS Peer Key) handshake */
+
+/* Key related defines */
+#define DOT11_MAX_DEFAULT_KEYS 4 /* number of default keys */
+#define DOT11_MAX_KEY_SIZE 32 /* max size of any key */
+#define DOT11_MAX_IV_SIZE 16 /* max size of any IV */
+#define DOT11_EXT_IV_FLAG (1<<5) /* flag to indicate IV is > 4 bytes */
+#define DOT11_WPA_KEY_RSC_LEN 8 /* WPA RSC key len */
+
+#define WEP1_KEY_SIZE 5 /* max size of any WEP key */
+#define WEP1_KEY_HEX_SIZE 10 /* size of WEP key in hex. */
+#define WEP128_KEY_SIZE 13 /* max size of any WEP key */
+#define WEP128_KEY_HEX_SIZE 26 /* size of WEP key in hex. */
+#define TKIP_MIC_SIZE 8 /* size of TKIP MIC */
+#define TKIP_EOM_SIZE 7 /* max size of TKIP EOM */
+#define TKIP_EOM_FLAG 0x5a /* TKIP EOM flag byte */
+#define TKIP_KEY_SIZE 32 /* size of any TKIP key */
+#define TKIP_MIC_AUTH_TX 16 /* offset to Authenticator MIC TX key */
+#define TKIP_MIC_AUTH_RX 24 /* offset to Authenticator MIC RX key */
+#define TKIP_MIC_SUP_RX TKIP_MIC_AUTH_TX /* offset to Supplicant MIC RX key */
+#define TKIP_MIC_SUP_TX TKIP_MIC_AUTH_RX /* offset to Supplicant MIC TX key */
+#define AES_KEY_SIZE 16 /* size of AES key */
+#define AES_MIC_SIZE 8 /* size of AES MIC */
+#define BIP_KEY_SIZE 16 /* size of BIP key */
+#define BIP_MIC_SIZE 8 /* sizeof BIP MIC */
+
+/* WCN */
+#define WCN_OUI "\x00\x50\xf2" /* WCN OUI */
+#define WCN_TYPE 4 /* WCN type */
+
+
+/* 802.11r protocol definitions */
+
+/* Mobility Domain IE */
+BWL_PRE_PACKED_STRUCT struct dot11_mdid_ie {
+ uint8 id;
+ uint8 len;
+ uint16 mdid; /* Mobility Domain Id */
+ uint8 cap;
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_mdid_ie dot11_mdid_ie_t;
+
+#define FBT_MDID_CAP_OVERDS 0x01 /* Fast Bss transition over the DS support */
+#define FBT_MDID_CAP_RRP 0x02 /* Resource request protocol support */
+
+/* Fast Bss Transition IE */
+BWL_PRE_PACKED_STRUCT struct dot11_ft_ie {
+ uint8 id;
+ uint8 len;
+ uint16 mic_control; /* 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; /* timeout interval type */
+ uint32 value; /* timeout interval value */
+} BWL_POST_PACKED_STRUCT;
+typedef struct dot11_timeout_ie dot11_timeout_ie_t;
+
+/* GTK ie */
+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;
+
+/* Management MIC ie */
+BWL_PRE_PACKED_STRUCT struct mmic_ie {
+ uint8 id; /* IE ID: 0xDD */
+ uint8 len; /* IE length */
+ uint16 key_id; /* key id */
+ uint8 ipn[6]; /* ipn */
+ uint8 mic[BIP_MIC_SIZE]; /* mic */
+} BWL_POST_PACKED_STRUCT;
+typedef struct mmic_ie mmic_ie_t;
+
+#define BSSID_INVALID "\x00\x00\x00\x00\x00\x00"
+#define BSSID_BROADCAST "\xFF\xFF\xFF\xFF\xFF\xFF"
+
+
+/* ************* WMM Parameter definitions. ************* */
+#define WMM_OUI "\x00\x50\xF2" /* WNN OUI */
+#define WMM_OUI_LEN 3 /* WMM OUI length */
+#define WMM_OUI_TYPE 2 /* WMM OUT type */
+#define WMM_VERSION 1
+#define WMM_VERSION_LEN 1
+
+/* WMM OUI subtype */
+#define WMM_OUI_SUBTYPE_PARAMETER 1
+#define WMM_PARAMETER_IE_LEN 24
+
+/* Link Identifier Element */
+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
+
+/* Link Wakeup Schedule Element */
+BWL_PRE_PACKED_STRUCT struct wakeup_sch_ie {
+ uint8 id;
+ uint8 len;
+ uint32 offset; /* in ms between TSF0 and start of 1st Awake Window */
+ uint32 interval; /* in ms bwtween the start of 2 Awake Windows */
+ uint32 awake_win_slots; /* in backof slots, duration of Awake Window */
+ uint32 max_wake_win; /* in ms, max duration of Awake Window */
+ uint16 idle_cnt; /* number of consecutive Awake Windows */
+} BWL_POST_PACKED_STRUCT;
+typedef struct wakeup_sch_ie wakeup_sch_ie_t;
+#define TDLS_WAKEUP_SCH_IE_LEN 18
+
+/* Channel Switch Timing Element */
+BWL_PRE_PACKED_STRUCT struct channel_switch_timing_ie {
+ uint8 id;
+ uint8 len;
+ uint16 switch_time; /* in ms, time to switch channels */
+ uint16 switch_timeout; /* in ms */
+} BWL_POST_PACKED_STRUCT;
+typedef struct channel_switch_timing_ie channel_switch_timing_ie_t;
+#define TDLS_CHANNEL_SWITCH_TIMING_IE_LEN 4
+
+/* PTI Control Element */
+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
+
+/* PU Buffer Status Element */
+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
+
+/* 802.11u GAS action frames */
+#define GAS_REQUEST_ACTION_FRAME 10
+#define GAS_RESPONSE_ACTION_FRAME 11
+#define GAS_COMEBACK_REQUEST_ACTION_FRAME 12
+#define GAS_COMEBACK_RESPONSE_ACTION_FRAME 13
+
+/* 802.11u interworking access network options */
+#define IW_ANT_MASK 0x0f
+#define IW_INTERNET_MASK 0x10
+#define IW_ASRA_MASK 0x20
+#define IW_ESR_MASK 0x40
+#define IW_UESA_MASK 0x80
+
+/* 802.11u interworking access network type */
+#define IW_ANT_PRIVATE_NETWORK 0
+#define IW_ANT_PRIVATE_NETWORK_WITH_GUEST 1
+#define IW_ANT_CHARGEABLE_PUBLIC_NETWORK 2
+#define IW_ANT_FREE_PUBLIC_NETWORK 3
+#define IW_ANT_PERSONAL_DEVICE_NETWORK 4
+#define IW_ANT_EMERGENCY_SERVICES_NETWORK 5
+#define IW_ANT_TEST_NETWORK 14
+#define IW_ANT_WILDCARD_NETWORK 15
+
+/* 802.11u advertisement protocol */
+#define ADVP_ANQP_PROTOCOL_ID 0
+
+/* 802.11u advertisement protocol masks */
+#define ADVP_QRL_MASK 0x7f
+#define ADVP_PAME_BI_MASK 0x80
+
+/* 802.11u advertisement protocol values */
+#define ADVP_QRL_REQUEST 0x00
+#define ADVP_QRL_RESPONSE 0x7f
+#define ADVP_PAME_BI_DEPENDENT 0x00
+#define ADVP_PAME_BI_INDEPENDENT ADVP_PAME_BI_MASK
+
+/* 802.11u ANQP information ID */
+#define ANQP_ID_QUERY_LIST 256
+#define ANQP_ID_CAPABILITY_LIST 257
+#define ANQP_ID_VENUE_NAME_INFO 258
+#define ANQP_ID_EMERGENCY_CALL_NUMBER_INFO 259
+#define ANQP_ID_NETWORK_AUTHENTICATION_TYPE_INFO 260
+#define ANQP_ID_ROAMING_CONSORTIUM_LIST 261
+#define ANQP_ID_IP_ADDRESS_TYPE_AVAILABILITY_INFO 262
+#define ANQP_ID_NAI_REALM_LIST 263
+#define ANQP_ID_G3PP_CELLULAR_NETWORK_INFO 264
+#define ANQP_ID_AP_GEOSPATIAL_LOCATION 265
+#define ANQP_ID_AP_CIVIC_LOCATION 266
+#define ANQP_ID_AP_LOCATION_PUBLIC_ID_URI 267
+#define ANQP_ID_DOMAIN_NAME_LIST 268
+#define ANQP_ID_EMERGENCY_ALERT_ID_URI 269
+#define ANQP_ID_EMERGENCY_NAI 271
+#define ANQP_ID_VENDOR_SPECIFIC_LIST 56797
+
+/* 802.11u ANQP OUI */
+#define ANQP_OUI_SUBTYPE 9
+
+/* 802.11u venue name */
+#define VENUE_LANGUAGE_CODE_SIZE 3
+#define VENUE_NAME_SIZE 255
+
+/* 802.11u venue groups */
+#define VENUE_UNSPECIFIED 0
+#define VENUE_ASSEMBLY 1
+#define VENUE_BUSINESS 2
+#define VENUE_EDUCATIONAL 3
+#define VENUE_FACTORY 4
+#define VENUE_INSTITUTIONAL 5
+#define VENUE_MERCANTILE 6
+#define VENUE_RESIDENTIAL 7
+#define VENUE_STORAGE 8
+#define VENUE_UTILITY 9
+#define VENUE_VEHICULAR 10
+#define VENUE_OUTDOOR 11
+
+/* 802.11u network authentication type indicator */
+#define NATI_ACCEPTANCE_OF_TERMS_CONDITIONS 0
+#define NATI_ONLINE_ENROLLMENT_SUPPORTED 1
+#define NATI_HTTP_HTTPS_REDIRECTION 2
+#define NATI_DNS_REDIRECTION 3
+
+/* 802.11u IP address type availability - IPv6 */
+#define IPA_IPV6_SHIFT 0
+#define IPA_IPV6_MASK (0x03 << IPA_IPV6_SHIFT)
+#define IPA_IPV6_NOT_AVAILABLE 0x00
+#define IPA_IPV6_AVAILABLE 0x01
+#define IPA_IPV6_UNKNOWN_AVAILABILITY 0x02
+
+/* 802.11u IP address type availability - IPv4 */
+#define IPA_IPV4_SHIFT 2
+#define IPA_IPV4_MASK (0x3f << IPA_IPV4_SHIFT)
+#define IPA_IPV4_NOT_AVAILABLE 0x00
+#define IPA_IPV4_PUBLIC 0x01
+#define IPA_IPV4_PORT_RESTRICT 0x02
+#define IPA_IPV4_SINGLE_NAT 0x03
+#define IPA_IPV4_DOUBLE_NAT 0x04
+#define IPA_IPV4_PORT_RESTRICT_SINGLE_NAT 0x05
+#define IPA_IPV4_PORT_RESTRICT_DOUBLE_NAT 0x06
+#define IPA_IPV4_UNKNOWN_AVAILABILITY 0x07
+
+/* 802.11u NAI realm encoding */
+#define REALM_ENCODING_RFC4282 0
+#define REALM_ENCODING_UTF8 1
+
+/* 802.11u IANA EAP method type numbers */
+#define REALM_EAP_TLS 13
+#define REALM_EAP_SIM 18
+#define REALM_EAP_TTLS 21
+#define REALM_EAP_AKA 23
+#define REALM_EAP_PSK 47
+#define REALM_EAP_AKAP 50
+
+/* 802.11u authentication ID */
+#define REALM_EXPANDED_EAP 1
+#define REALM_NON_EAP_INNER_AUTHENTICATION 2
+#define REALM_INNER_AUTHENTICATION_EAP 3
+#define REALM_EXPANDED_INNER_EAP 4
+#define REALM_CREDENTIAL 5
+#define REALM_TUNNELED_EAP_CREDENTIAL 6
+#define REALM_VENDOR_SPECIFIC_EAP 221
+
+/* 802.11u non-EAP inner authentication type */
+#define REALM_PAP 1
+#define REALM_CHAP 2
+#define REALM_MSCHAP 3
+#define REALM_MSCHAPV2 4
+
+/* 802.11u credential type */
+#define REALM_SIM 1
+#define REALM_USIM 2
+#define REALM_NFC 3
+#define REALM_HARDWARE_TOKEN 4
+#define REALM_SOFTOKEN 5
+#define REALM_CERTIFICATE 6
+#define REALM_USERNAME_PASSWORD 7
+#define REALM_SERVER_SIDE 8
+
+/* 802.11u 3GPP PLMN */
+#define G3PP_GUD_VERSION 0
+#define G3PP_PLMN_LIST_IE 0
+
+/* hotspot2.0 indication element (vendor specific) */
+BWL_PRE_PACKED_STRUCT struct hs20_ie {
+ uint8 oui[3];
+ uint8 type;
+ uint8 config;
+} BWL_POST_PACKED_STRUCT;
+typedef struct hs20_ie hs20_ie_t;
+#define HS20_IE_LEN 5 /* HS20 IE length */
+
+/* This marks the end of a packed structure section. */
+#include <packed_section_end.h>
+
+#endif /* _802_11_H_ */
/*
* BT-AMP (BlueTooth Alternate Mac and Phy) 802.11 PAL (Protocol Adaptation Layer)
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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: 802.11_bta.h 294267 2011-11-04 23:41:52Z $
+ * $Id: 802.11_bta.h 382882 2013-02-04 23:24:31Z $
*/
#ifndef _802_11_BTA_H_
/*
* 802.11e protocol header file
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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: 802.11e.h 241182 2011-02-17 21:50:03Z $
+ * $Id: 802.11e.h 382883 2013-02-04 23:26:09Z $
*/
#ifndef _802_11e_H_
#define QBSS_LOAD_IE_LEN 5 /* QBSS Load IE length */
#define QBSS_LOAD_AAC_OFF 3 /* AAC offset in IE */
-#define CAC_ADDTS_RESP_TIMEOUT 300 /* default ADDTS response timeout in ms */
+#define CAC_ADDTS_RESP_TIMEOUT 1000 /* default ADDTS response timeout in ms */
+ /* DEFVAL dot11ADDTSResponseTimeout = 1s */
/* 802.11e ADDTS status code */
#define DOT11E_STATUS_ADMISSION_ACCEPTED 0 /* TSPEC Admission accepted status */
#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 */
--- /dev/null
+/*
+ * Copyright (C) 1999-2013, 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.1D
+ *
+ * $Id: 802.1d.h 382882 2013-02-04 23:24:31Z $
+ */
+
+#ifndef _802_1_D_
+#define _802_1_D_
+
+/* 802.1D priority defines */
+#define PRIO_8021D_NONE 2 /* None = - */
+#define PRIO_8021D_BK 1 /* BK - Background */
+#define PRIO_8021D_BE 0 /* BE - Best-effort */
+#define PRIO_8021D_EE 3 /* EE - Excellent-effort */
+#define PRIO_8021D_CL 4 /* CL - Controlled Load */
+#define PRIO_8021D_VI 5 /* Vi - Video */
+#define PRIO_8021D_VO 6 /* Vo - Voice */
+#define PRIO_8021D_NC 7 /* NC - Network Control */
+#define MAXPRIO 7 /* 0-7 */
+#define NUMPRIO (MAXPRIO + 1)
+
+#define ALLPRIO -1 /* All prioirty */
+
+/* Converts prio to precedence since the numerical value of
+ * PRIO_8021D_BE and PRIO_8021D_NONE are swapped.
+ */
+#define PRIO2PREC(prio) \
+ (((prio) == PRIO_8021D_NONE || (prio) == PRIO_8021D_BE) ? ((prio^2)) : (prio))
+
+#endif /* _802_1_D__ */
--- /dev/null
+/*
+ * Copyright (C) 2013, Broadcom Corporation
+ * All Rights Reserved.
+ *
+ * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation;
+ * the contents of this file may not be disclosed to third parties, copied
+ * or duplicated in any form, in whole or in part, without the prior
+ * written permission of Broadcom Corporation.
+ *
+ * Fundamental constants relating to 802.3
+ *
+ * $Id: 802.3.h 382882 2013-02-04 23:24:31Z $
+ */
+
+#ifndef _802_3_h_
+#define _802_3_h_
+
+/* This marks the start of a packed structure section. */
+#include <packed_section_start.h>
+
+#define SNAP_HDR_LEN 6 /* 802.3 SNAP header length */
+#define DOT3_OUI_LEN 3 /* 802.3 oui length */
+
+BWL_PRE_PACKED_STRUCT struct dot3_mac_llc_snap_header {
+ uint8 ether_dhost[ETHER_ADDR_LEN]; /* dest mac */
+ uint8 ether_shost[ETHER_ADDR_LEN]; /* src mac */
+ uint16 length; /* frame length incl header */
+ uint8 dsap; /* always 0xAA */
+ uint8 ssap; /* always 0xAA */
+ uint8 ctl; /* always 0x03 */
+ uint8 oui[DOT3_OUI_LEN]; /* RFC1042: 0x00 0x00 0x00
+ * Bridge-Tunnel: 0x00 0x00 0xF8
+ */
+ uint16 type; /* ethertype */
+} BWL_POST_PACKED_STRUCT;
+
+/* This marks the end of a packed structure section. */
+#include <packed_section_end.h>
+
+#endif /* #ifndef _802_3_h_ */
/*
* Broadcom Ethernettype protocol definitions
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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: bcmeth.h 294352 2011-11-06 19:23:00Z $
+ * $Id: bcmeth.h 382882 2013-02-04 23:24:31Z $
*/
-
+/*
+ * Broadcom Ethernet protocol defines
+ */
#ifndef _BCMETH_H_
#define _BCMETH_H_
#include <typedefs.h>
#endif
-
+/* This marks the start of a packed structure section. */
#include <packed_section_start.h>
+/* ETHER_TYPE_BRCM is defined in ethernet.h */
+/*
+ * Following the 2byte BRCM ether_type is a 16bit BRCM subtype field
+ * in one of two formats: (only subtypes 32768-65535 are in use now)
+ *
+ * subtypes 0-32767:
+ * 8 bit subtype (0-127)
+ * 8 bit length in bytes (0-255)
+ *
+ * subtypes 32768-65535:
+ * 16 bit big-endian subtype
+ * 16 bit big-endian length in bytes (0-65535)
+ *
+ * length is the number of additional bytes beyond the 4 or 6 byte header
+ *
+ * Reserved values:
+ * 0 reserved
+ * 5-15 reserved for iLine protocol assignments
+ * 17-126 reserved, assignable
+ * 127 reserved
+ * 32768 reserved
+ * 32769-65534 reserved, assignable
+ * 65535 reserved
+ */
-
-
-
+/*
+ * While adding the subtypes and their specific processing code make sure
+ * bcmeth_bcm_hdr_t is the first data structure in the user specific data structure definition
+ */
#define BCMILCP_SUBTYPE_RATE 1
#define BCMILCP_SUBTYPE_LINK 2
#define BCMILCP_BCM_SUBTYPE_RESERVED 0
#define BCMILCP_BCM_SUBTYPE_EVENT 1
#define BCMILCP_BCM_SUBTYPE_SES 2
-
-
+/*
+ * The EAPOL type is not used anymore. Instead EAPOL messages are now embedded
+ * within BCMILCP_BCM_SUBTYPE_EVENT type messages
+ */
+/* #define BCMILCP_BCM_SUBTYPE_EAPOL 3 */
#define BCMILCP_BCM_SUBTYPE_DPT 4
#define BCMILCP_BCM_SUBTYPEHDR_MINLENGTH 8
#define BCMILCP_BCM_SUBTYPEHDR_VERSION 0
-
+/* These fields are stored in network order */
typedef BWL_PRE_PACKED_STRUCT struct bcmeth_hdr
{
- uint16 subtype;
+ uint16 subtype; /* Vendor specific..32769 */
uint16 length;
- uint8 version;
- uint8 oui[3];
-
+ uint8 version; /* Version is 0 */
+ uint8 oui[3]; /* Broadcom OUI */
+ /* user specific Data */
uint16 usr_subtype;
} BWL_POST_PACKED_STRUCT bcmeth_hdr_t;
-
+/* This marks the end of a packed structure section. */
#include <packed_section_end.h>
-#endif
+#endif /* _BCMETH_H_ */
--- /dev/null
+/*
+ * Broadcom Event protocol definitions
+ *
+ * Copyright (C) 1999-2013, 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 386716 2013-02-21 18:16:10Z $
+ *
+ */
+
+/*
+ * Broadcom Ethernet Events protocol defines
+ *
+ */
+
+#ifndef _BCMEVENT_H_
+#define _BCMEVENT_H_
+
+#ifndef _TYPEDEFS_H_
+#include <typedefs.h>
+#endif
+/* #include <ethernet.h> -- TODO: req., excluded to overwhelming coupling (break up ethernet.h) */
+#include <proto/bcmeth.h>
+
+/* This marks the start of a packed structure section. */
+#include <packed_section_start.h>
+
+#define BCM_EVENT_MSG_VERSION 2 /* wl_event_msg_t struct version */
+#define BCM_MSG_IFNAME_MAX 16 /* max length of interface name */
+
+/* flags */
+#define WLC_EVENT_MSG_LINK 0x01 /* link is up */
+#define WLC_EVENT_MSG_FLUSHTXQ 0x02 /* flush tx queue on MIC error */
+#define WLC_EVENT_MSG_GROUP 0x04 /* group MIC error */
+#define WLC_EVENT_MSG_UNKBSS 0x08 /* unknown source bsscfg */
+#define WLC_EVENT_MSG_UNKIF 0x10 /* unknown source OS i/f */
+
+/* these fields are stored in network order */
+
+/* version 1 */
+typedef BWL_PRE_PACKED_STRUCT struct
+{
+ uint16 version;
+ uint16 flags; /* see flags below */
+ uint32 event_type; /* Message (see below) */
+ uint32 status; /* Status code (see below) */
+ uint32 reason; /* Reason code (if applicable) */
+ uint32 auth_type; /* WLC_E_AUTH */
+ uint32 datalen; /* data buf */
+ struct ether_addr addr; /* Station address (if applicable) */
+ char ifname[BCM_MSG_IFNAME_MAX]; /* name of the packet incoming interface */
+} BWL_POST_PACKED_STRUCT wl_event_msg_v1_t;
+
+/* the current version */
+typedef BWL_PRE_PACKED_STRUCT struct
+{
+ uint16 version;
+ uint16 flags; /* see flags below */
+ uint32 event_type; /* Message (see below) */
+ uint32 status; /* Status code (see below) */
+ uint32 reason; /* Reason code (if applicable) */
+ uint32 auth_type; /* WLC_E_AUTH */
+ uint32 datalen; /* data buf */
+ struct ether_addr addr; /* Station address (if applicable) */
+ char ifname[BCM_MSG_IFNAME_MAX]; /* name of the packet incoming interface */
+ uint8 ifidx; /* destination OS i/f index */
+ uint8 bsscfgidx; /* source bsscfg index */
+} BWL_POST_PACKED_STRUCT wl_event_msg_t;
+
+/* used by driver msgs */
+typedef BWL_PRE_PACKED_STRUCT struct bcm_event {
+ struct ether_header eth;
+ bcmeth_hdr_t bcm_hdr;
+ wl_event_msg_t event;
+ /* data portion follows */
+} BWL_POST_PACKED_STRUCT bcm_event_t;
+
+#define BCM_MSG_LEN (sizeof(bcm_event_t) - sizeof(bcmeth_hdr_t) - sizeof(struct ether_header))
+
+/* Event messages */
+#define WLC_E_SET_SSID 0 /* indicates status of set SSID */
+#define WLC_E_JOIN 1 /* differentiates join IBSS from found (WLC_E_START) IBSS */
+#define WLC_E_START 2 /* STA founded an IBSS or AP started a BSS */
+#define WLC_E_AUTH 3 /* 802.11 AUTH request */
+#define WLC_E_AUTH_IND 4 /* 802.11 AUTH indication */
+#define WLC_E_DEAUTH 5 /* 802.11 DEAUTH request */
+#define WLC_E_DEAUTH_IND 6 /* 802.11 DEAUTH indication */
+#define WLC_E_ASSOC 7 /* 802.11 ASSOC request */
+#define WLC_E_ASSOC_IND 8 /* 802.11 ASSOC indication */
+#define WLC_E_REASSOC 9 /* 802.11 REASSOC request */
+#define WLC_E_REASSOC_IND 10 /* 802.11 REASSOC indication */
+#define WLC_E_DISASSOC 11 /* 802.11 DISASSOC request */
+#define WLC_E_DISASSOC_IND 12 /* 802.11 DISASSOC indication */
+#define WLC_E_QUIET_START 13 /* 802.11h Quiet period started */
+#define WLC_E_QUIET_END 14 /* 802.11h Quiet period ended */
+#define WLC_E_BEACON_RX 15 /* BEACONS received/lost indication */
+#define WLC_E_LINK 16 /* generic link indication */
+#define WLC_E_MIC_ERROR 17 /* TKIP MIC error occurred */
+#define WLC_E_NDIS_LINK 18 /* NDIS style link indication */
+#define WLC_E_ROAM 19 /* roam attempt occurred: indicate status & reason */
+#define WLC_E_TXFAIL 20 /* change in dot11FailedCount (txfail) */
+#define WLC_E_PMKID_CACHE 21 /* WPA2 pmkid cache indication */
+#define WLC_E_RETROGRADE_TSF 22 /* current AP's TSF value went backward */
+#define WLC_E_PRUNE 23 /* AP was pruned from join list for reason */
+#define WLC_E_AUTOAUTH 24 /* report AutoAuth table entry match for join attempt */
+#define WLC_E_EAPOL_MSG 25 /* Event encapsulating an EAPOL message */
+#define WLC_E_SCAN_COMPLETE 26 /* Scan results are ready or scan was aborted */
+#define WLC_E_ADDTS_IND 27 /* indicate to host addts fail/success */
+#define WLC_E_DELTS_IND 28 /* indicate to host delts fail/success */
+#define WLC_E_BCNSENT_IND 29 /* indicate to host of beacon transmit */
+#define WLC_E_BCNRX_MSG 30 /* Send the received beacon up to the host */
+#define WLC_E_BCNLOST_MSG 31 /* indicate to host loss of beacon */
+#define WLC_E_ROAM_PREP 32 /* before attempting to roam */
+#define WLC_E_PFN_NET_FOUND 33 /* PFN network found event */
+#define WLC_E_PFN_NET_LOST 34 /* PFN network lost event */
+#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 /* PSM microcode watchdog fired */
+#define WLC_E_PROBREQ_MSG 44 /* probe request received */
+#define WLC_E_SCAN_CONFIRM_IND 45
+#define WLC_E_PSK_SUP 46 /* WPA Handshake fail */
+#define WLC_E_COUNTRY_CODE_CHANGED 47
+#define WLC_E_EXCEEDED_MEDIUM_TIME 48 /* WMMAC excedded medium time */
+#define WLC_E_ICV_ERROR 49 /* WEP ICV error occurred */
+#define WLC_E_UNICAST_DECODE_ERROR 50 /* Unsupported unicast encrypted frame */
+#define WLC_E_MULTICAST_DECODE_ERROR 51 /* Unsupported multicast encrypted frame */
+#define WLC_E_TRACE 52
+#define WLC_E_IF 54 /* I/F change (for dongle host notification) */
+#define WLC_E_P2P_DISC_LISTEN_COMPLETE 55 /* listen state expires */
+#define WLC_E_RSSI 56 /* indicate RSSI change based on configured levels */
+#define WLC_E_PFN_SCAN_COMPLETE 57 /* PFN completed scan of network list */
+#define WLC_E_EXTLOG_MSG 58
+#define WLC_E_ACTION_FRAME 59 /* Action frame Rx */
+#define WLC_E_ACTION_FRAME_COMPLETE 60 /* Action frame Tx complete */
+#define WLC_E_PRE_ASSOC_IND 61 /* assoc request received */
+#define WLC_E_PRE_REASSOC_IND 62 /* re-assoc request received */
+#define WLC_E_CHANNEL_ADOPTED 63
+#define WLC_E_AP_STARTED 64 /* AP started */
+#define WLC_E_DFS_AP_STOP 65 /* AP stopped due to DFS */
+#define WLC_E_DFS_AP_RESUME 66 /* AP resumed due to DFS */
+#define WLC_E_WAI_STA_EVENT 67 /* WAI stations event */
+#define WLC_E_WAI_MSG 68 /* event encapsulating an WAI message */
+#define WLC_E_ESCAN_RESULT 69 /* escan result event */
+#define WLC_E_ACTION_FRAME_OFF_CHAN_COMPLETE 70 /* action frame off channel complete */
+#define WLC_E_PROBRESP_MSG 71 /* probe response received */
+#define WLC_E_P2P_PROBREQ_MSG 72 /* P2P Probe request received */
+#define WLC_E_DCS_REQUEST 73
+#define WLC_E_FIFO_CREDIT_MAP 74 /* credits for D11 FIFOs. [AC0,AC1,AC2,AC3,BC_MC,ATIM] */
+#define WLC_E_ACTION_FRAME_RX 75 /* Received action frame event WITH
+ * wl_event_rx_frame_data_t header
+ */
+#define WLC_E_WAKE_EVENT 76 /* Wake Event timer fired, used for wake WLAN test mode */
+#define WLC_E_RM_COMPLETE 77 /* Radio measurement complete */
+#define WLC_E_HTSFSYNC 78 /* Synchronize TSF with the host */
+#define WLC_E_OVERLAY_REQ 79 /* request an overlay IOCTL/iovar from the host */
+#define WLC_E_CSA_COMPLETE_IND 80 /* 802.11 CHANNEL SWITCH ACTION completed */
+#define WLC_E_EXCESS_PM_WAKE_EVENT 81 /* excess PM Wake Event to inform host */
+#define WLC_E_PFN_SCAN_NONE 82 /* no PFN networks around */
+#define WLC_E_PFN_SCAN_ALLGONE 83 /* last found PFN network gets lost */
+#define WLC_E_GTK_PLUMBED 84
+#define WLC_E_ASSOC_IND_NDIS 85 /* 802.11 ASSOC indication for NDIS only */
+#define WLC_E_REASSOC_IND_NDIS 86 /* 802.11 REASSOC indication for NDIS only */
+#define WLC_E_ASSOC_REQ_IE 87
+#define WLC_E_ASSOC_RESP_IE 88
+#define WLC_E_ASSOC_RECREATED 89 /* association recreated on resume */
+#define WLC_E_ACTION_FRAME_RX_NDIS 90 /* rx action frame event for NDIS only */
+#define WLC_E_AUTH_REQ 91 /* authentication request received */
+#define WLC_E_TDLS_PEER_EVENT 92 /* discovered peer, connected/disconnected peer */
+#define WLC_E_SPEEDY_RECREATE_FAIL 93 /* fast assoc recreation failed */
+#define WLC_E_NATIVE 94 /* port-specific event and payload (e.g. NDIS) */
+#define WLC_E_PKTDELAY_IND 95 /* event for tx pkt delay suddently jump */
+#define WLC_E_AWDL_AW 96 /* AWDL AW period starts */
+#define WLC_E_AWDL_ROLE 97 /* AWDL Master/Slave/NE master role event */
+#define WLC_E_AWDL_EVENT 98 /* Generic AWDL event */
+#ifdef WLNIC
+#define WLC_E_NIC_AF_TXS 99 /* NIC AF txstatus */
+#define WLC_E_NIC_NIC_REPORT 100 /* NIC period report */
+#endif
+#define WLC_E_BEACON_FRAME_RX 101
+#define WLC_E_SERVICE_FOUND 102 /* desired service found */
+#define WLC_E_GAS_FRAGMENT_RX 103 /* GAS fragment received */
+#define WLC_E_GAS_COMPLETE 104 /* GAS sessions all complete */
+#define WLC_E_P2PO_ADD_DEVICE 105 /* New device found by p2p offload */
+#define WLC_E_P2PO_DEL_DEVICE 106 /* device has been removed by p2p offload */
+#define WLC_E_WNM_STA_SLEEP 107 /* WNM event to notify STA enter sleep mode */
+#define WLC_E_NONE 108 /* event removed, free to be reused */
+#define WLC_E_PROXD 109 /* Proximity Detection event */
+#define WLC_E_IBSS_COALESCE 110 /* IBSS Coalescing */
+#define WLC_E_AWDL_AW_EXT_END 111 /* AWDL extended period ends */
+#define WLC_E_AWDL_AW_EXT_START 112 /* SWDL AW extension start */
+#define WLC_E_AWDL_AW_START 113 /* AWDL start Event to inform host */
+#define WLC_E_AWDL_RADIO_OFF 114 /* Radio Off */
+#define WLC_E_AWDL_PEER_STATE 115 /* AWDL peer state open/close */
+#define WLC_E_AWDL_SYNC_STATE_CHANGED 116 /* AWDL sync role changed */
+#define WLC_E_AWDL_CHIP_RESET 117 /* infroms the interface of a chip rest */
+#define WLC_E_AWDL_INTERLEAVED_SCAN_START 118
+#define WLC_E_AWDL_INTERLEAVED_SCAN_STOP 119
+#define WLC_E_AWDL_PEER_CACHE_CONTROL 120
+#define WLC_E_CSA_START_IND 121
+#define WLC_E_CSA_DONE_IND 122
+#define WLC_E_CSA_FAILURE_IND 123
+#define WLC_E_CCA_CHAN_QUAL 124 /* CCA based channel quality report */
+#define WLC_E_LAST 125 /* highest val + 1 for range checking */
+
+
+/* Table of event name strings for UIs and debugging dumps */
+typedef struct {
+ uint event;
+ const char *name;
+} bcmevent_name_t;
+
+extern const bcmevent_name_t bcmevent_names[];
+extern const int bcmevent_names_size;
+
+/* Event status codes */
+#define WLC_E_STATUS_SUCCESS 0 /* operation was successful */
+#define WLC_E_STATUS_FAIL 1 /* operation failed */
+#define WLC_E_STATUS_TIMEOUT 2 /* operation timed out */
+#define WLC_E_STATUS_NO_NETWORKS 3 /* failed due to no matching network found */
+#define WLC_E_STATUS_ABORT 4 /* operation was aborted */
+#define WLC_E_STATUS_NO_ACK 5 /* protocol failure: packet not ack'd */
+#define WLC_E_STATUS_UNSOLICITED 6 /* AUTH or ASSOC packet was unsolicited */
+#define WLC_E_STATUS_ATTEMPT 7 /* attempt to assoc to an auto auth configuration */
+#define WLC_E_STATUS_PARTIAL 8 /* scan results are incomplete */
+#define WLC_E_STATUS_NEWSCAN 9 /* scan aborted by another scan */
+#define WLC_E_STATUS_NEWASSOC 10 /* scan aborted due to assoc in progress */
+#define WLC_E_STATUS_11HQUIET 11 /* 802.11h quiet period started */
+#define WLC_E_STATUS_SUPPRESS 12 /* user disabled scanning (WLC_SET_SCANSUPPRESS) */
+#define WLC_E_STATUS_NOCHANS 13 /* no allowable channels to scan */
+#define WLC_E_STATUS_CS_ABORT 15 /* abort channel select */
+#define WLC_E_STATUS_ERROR 16 /* request failed due to error */
+
+/* roam reason codes */
+#define WLC_E_REASON_INITIAL_ASSOC 0 /* initial assoc */
+#define WLC_E_REASON_LOW_RSSI 1 /* roamed due to low RSSI */
+#define WLC_E_REASON_DEAUTH 2 /* roamed due to DEAUTH indication */
+#define WLC_E_REASON_DISASSOC 3 /* roamed due to DISASSOC indication */
+#define WLC_E_REASON_BCNS_LOST 4 /* roamed due to lost beacons */
+
+/* Roam codes used primarily by CCX */
+#define WLC_E_REASON_FAST_ROAM_FAILED 5 /* roamed due to fast roam failure */
+#define WLC_E_REASON_DIRECTED_ROAM 6 /* roamed due to request by AP */
+#define WLC_E_REASON_TSPEC_REJECTED 7 /* roamed due to TSPEC rejection */
+#define WLC_E_REASON_BETTER_AP 8 /* roamed due to finding better AP */
+#define WLC_E_REASON_MINTXRATE 9 /* roamed because at mintxrate for too long */
+#define WLC_E_REASON_TXFAIL 10 /* We can hear AP, but AP can't hear us */
+
+#define WLC_E_REASON_REQUESTED_ROAM 11 /* roamed due to BSS Mgmt Transition request by AP */
+
+
+/* prune reason codes */
+#define WLC_E_PRUNE_ENCR_MISMATCH 1 /* encryption mismatch */
+#define WLC_E_PRUNE_BCAST_BSSID 2 /* AP uses a broadcast BSSID */
+#define WLC_E_PRUNE_MAC_DENY 3 /* STA's MAC addr is in AP's MAC deny list */
+#define WLC_E_PRUNE_MAC_NA 4 /* STA's MAC addr is not in AP's MAC allow list */
+#define WLC_E_PRUNE_REG_PASSV 5 /* AP not allowed due to regulatory restriction */
+#define WLC_E_PRUNE_SPCT_MGMT 6 /* AP does not support STA locale spectrum mgmt */
+#define WLC_E_PRUNE_RADAR 7 /* AP is on a radar channel of STA locale */
+#define WLC_E_RSN_MISMATCH 8 /* STA does not support AP's RSN */
+#define WLC_E_PRUNE_NO_COMMON_RATES 9 /* No rates in common with AP */
+#define WLC_E_PRUNE_BASIC_RATES 10 /* STA does not support all basic rates of BSS */
+#define WLC_E_PRUNE_CIPHER_NA 12 /* BSS's cipher not supported */
+#define WLC_E_PRUNE_KNOWN_STA 13 /* AP is already known to us as a STA */
+#define WLC_E_PRUNE_WDS_PEER 15 /* AP is already known to us as a WDS peer */
+#define WLC_E_PRUNE_QBSS_LOAD 16 /* QBSS LOAD - AAC is too low */
+#define WLC_E_PRUNE_HOME_AP 17 /* prune home AP */
+
+/* WPA failure reason codes carried in the WLC_E_PSK_SUP event */
+#define WLC_E_SUP_OTHER 0 /* Other reason */
+#define WLC_E_SUP_DECRYPT_KEY_DATA 1 /* Decryption of key data failed */
+#define WLC_E_SUP_BAD_UCAST_WEP128 2 /* Illegal use of ucast WEP128 */
+#define WLC_E_SUP_BAD_UCAST_WEP40 3 /* Illegal use of ucast WEP40 */
+#define WLC_E_SUP_UNSUP_KEY_LEN 4 /* Unsupported key length */
+#define WLC_E_SUP_PW_KEY_CIPHER 5 /* Unicast cipher mismatch in pairwise key */
+#define WLC_E_SUP_MSG3_TOO_MANY_IE 6 /* WPA IE contains > 1 RSN IE in key msg 3 */
+#define WLC_E_SUP_MSG3_IE_MISMATCH 7 /* WPA IE mismatch in key message 3 */
+#define WLC_E_SUP_NO_INSTALL_FLAG 8 /* INSTALL flag unset in 4-way msg */
+#define WLC_E_SUP_MSG3_NO_GTK 9 /* encapsulated GTK missing from msg 3 */
+#define WLC_E_SUP_GRP_KEY_CIPHER 10 /* Multicast cipher mismatch in group key */
+#define WLC_E_SUP_GRP_MSG1_NO_GTK 11 /* encapsulated GTK missing from group msg 1 */
+#define WLC_E_SUP_GTK_DECRYPT_FAIL 12 /* GTK decrypt failure */
+#define WLC_E_SUP_SEND_FAIL 13 /* message send failure */
+#define WLC_E_SUP_DEAUTH 14 /* received FC_DEAUTH */
+#define WLC_E_SUP_WPA_PSK_TMO 15 /* WPA PSK 4-way handshake timeout */
+
+/* Event data for events that include frames received over the air */
+/* WLC_E_PROBRESP_MSG
+ * WLC_E_P2P_PROBREQ_MSG
+ * WLC_E_ACTION_FRAME_RX
+ */
+#ifdef WLAWDL
+#define WLC_E_AWDL_SCAN_START 1 /* Scan start indication to host */
+#define WLC_E_AWDL_SCAN_DONE 0 /* Scan Done indication to host */
+
+#define WLC_E_AWDL_RX_ACT_FRAME 1
+#define WLC_E_AWDL_RX_PRB_RESP 2
+
+#endif
+typedef BWL_PRE_PACKED_STRUCT struct wl_event_rx_frame_data {
+ uint16 version;
+ uint16 channel; /* Matches chanspec_t format from bcmwifi_channels.h */
+ int32 rssi;
+ uint32 mactime;
+ uint32 rate;
+} BWL_POST_PACKED_STRUCT wl_event_rx_frame_data_t;
+
+#define BCM_RX_FRAME_DATA_VERSION 1
+
+/* WLC_E_IF event data */
+typedef struct wl_event_data_if {
+ uint8 ifidx; /* RTE virtual device index (for dongle) */
+ uint8 opcode; /* see I/F opcode */
+ uint8 reserved; /* bit mask (WLC_E_IF_FLAGS_XXX ) */
+ uint8 bssidx; /* bsscfg index */
+ uint8 role; /* see I/F role */
+} wl_event_data_if_t;
+
+/* opcode in WLC_E_IF event */
+#define WLC_E_IF_ADD 1 /* bsscfg add */
+#define WLC_E_IF_DEL 2 /* bsscfg delete */
+#define WLC_E_IF_CHANGE 3 /* bsscfg role change */
+
+/* I/F role code in WLC_E_IF event */
+#define WLC_E_IF_ROLE_STA 0 /* Infra STA */
+#define WLC_E_IF_ROLE_AP 1 /* Access Point */
+#define WLC_E_IF_ROLE_WDS 2 /* WDS link */
+#define WLC_E_IF_ROLE_P2P_GO 3 /* P2P Group Owner */
+#define WLC_E_IF_ROLE_P2P_CLIENT 4 /* P2P Client */
+
+/* WLC_E_RSSI event data */
+typedef struct wl_event_data_rssi {
+ int32 rssi;
+ int32 snr;
+ int32 noise;
+} wl_event_data_rssi_t;
+
+/* WLC_E_IF flag */
+#define WLC_E_IF_FLAGS_BSSCFG_NOIF 0x1 /* no host I/F creation needed */
+
+/* Reason codes for LINK */
+#define WLC_E_LINK_BCN_LOSS 1 /* Link down because of beacon loss */
+#define WLC_E_LINK_DISASSOC 2 /* Link down because of disassoc */
+#define WLC_E_LINK_ASSOC_REC 3 /* Link down because assoc recreate failed */
+#define WLC_E_LINK_BSSCFG_DIS 4 /* Link down due to bsscfg down */
+
+/* reason codes for WLC_E_OVERLAY_REQ event */
+#define WLC_E_OVL_DOWNLOAD 0 /* overlay download request */
+#define WLC_E_OVL_UPDATE_IND 1 /* device indication of host overlay update */
+
+/* reason codes for WLC_E_TDLS_PEER_EVENT event */
+#define WLC_E_TDLS_PEER_DISCOVERED 0 /* peer is ready to establish TDLS */
+#define WLC_E_TDLS_PEER_CONNECTED 1
+#define WLC_E_TDLS_PEER_DISCONNECTED 2
+
+#ifdef WLAWDL
+/* WLC_E_AWDL_EVENT subtypes */
+#define WLC_E_AWDL_SCAN_STATUS 0
+#define WLC_E_AWDL_RX_ACT_FRAME 1
+#define WLC_E_AWDL_RX_PRB_RESP 2
+#define WLC_E_AWDL_PHYCAL_STATUS 3
+#define WLC_E_AWDL_WOWL_NULLPKT 4
+#define WLC_E_AWDL_OOB_AF_STATUS 5
+
+/* WLC_E_AWDL_SCAN_STATUS status values */
+#define WLC_E_AWDL_SCAN_START 1 /* Scan start indication to host */
+#define WLC_E_AWDL_SCAN_DONE 0 /* Scan Done indication to host */
+#define WLC_E_AWDL_PHYCAL_START 1 /* Phy calibration start indication to host */
+#define WLC_E_AWDL_PHYCAL_DONE 0 /* Phy calibration done indication to host */
+#endif
+
+/* GAS event data */
+typedef BWL_PRE_PACKED_STRUCT struct wl_event_gas {
+ uint16 channel; /* channel of GAS protocol */
+ uint8 dialog_token; /* GAS dialog token */
+ uint8 fragment_id; /* fragment id */
+ uint16 status_code; /* status code on GAS completion */
+ uint16 data_len; /* length of data to follow */
+ uint8 data[1]; /* variable length specified by data_len */
+} BWL_POST_PACKED_STRUCT wl_event_gas_t;
+
+/* service discovery TLV */
+typedef BWL_PRE_PACKED_STRUCT struct wl_sd_tlv {
+ uint16 length; /* length of response_data */
+ uint8 protocol; /* service protocol type */
+ uint8 transaction_id; /* service transaction id */
+ uint8 status_code; /* status code */
+ uint8 data[1]; /* response data */
+} BWL_POST_PACKED_STRUCT wl_sd_tlv_t;
+
+/* service discovery event data */
+typedef BWL_PRE_PACKED_STRUCT struct wl_event_sd {
+ uint16 channel; /* channel */
+ uint8 count; /* number of tlvs */
+ wl_sd_tlv_t tlv[1]; /* service discovery TLV */
+} BWL_POST_PACKED_STRUCT wl_event_sd_t;
+
+/* Reason codes for WLC_E_PROXD */
+#define WLC_E_PROXD_FOUND 1 /* Found a proximity device */
+#define WLC_E_PROXD_GONE 2 /* Lost a proximity device */
+
+/* WLC_E_AWDL_AW event data */
+typedef BWL_PRE_PACKED_STRUCT struct awdl_aws_event_data {
+ uint32 fw_time; /* firmware PMU time */
+ struct ether_addr current_master; /* Current master Mac addr */
+ uint16 aw_counter; /* AW seq# */
+ uint8 aw_ext_count; /* AW extension count */
+ uint8 aw_role; /* AW role */
+ uint8 flags; /* AW event flag */
+ uint16 aw_chan;
+} BWL_POST_PACKED_STRUCT awdl_aws_event_data_t;
+
+/* For awdl_aws_event_data_t.flags */
+#define AWDL_AW_LAST_EXT 0x01
+
+/* This marks the end of a packed structure section. */
+#include <packed_section_end.h>
+
+#endif /* _BCMEVENT_H_ */
/*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
*
* Fundamental constants relating to IP Protocol
*
- * $Id: bcmip.h 346935 2012-07-25 00:24:55Z $
+ * $Id: bcmip.h 384540 2013-02-12 04:28:58Z $
*/
#ifndef _bcmip_h_
#include <typedefs.h>
#endif
-
+/* This marks the start of a packed structure section. */
#include <packed_section_start.h>
-
-#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
+/* IPV4 and IPV6 common */
+#define IP_VER_OFFSET 0x0 /* offset to version field */
+#define IP_VER_MASK 0xf0 /* version mask */
+#define IP_VER_SHIFT 4 /* version shift */
+#define IP_VER_4 4 /* version number for IPV4 */
+#define IP_VER_6 6 /* version number for IPV6 */
#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 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_MIN_HEADER_LEN 20
-
-
-#define IPV4_VER_MASK 0xf0
-#define IPV4_VER_SHIFT 4
-
-#define IPV4_HLEN_MASK 0x0f
+#define IP_PROT_ICMP 0x1 /* ICMP protocol */
+#define IP_PROT_IGMP 0x2 /* IGMP protocol */
+#define IP_PROT_TCP 0x6 /* TCP protocol */
+#define IP_PROT_UDP 0x11 /* UDP protocol type */
+#define IP_PROT_ICMP6 0x3a /* ICMPv6 protocol type */
+
+/* IPV4 field offsets */
+#define IPV4_VER_HL_OFFSET 0 /* version and ihl byte offset */
+#define IPV4_TOS_OFFSET 1 /* type of service offset */
+#define IPV4_PKTLEN_OFFSET 2 /* packet length offset */
+#define IPV4_PKTFLAG_OFFSET 6 /* more-frag,dont-frag flag offset */
+#define IPV4_PROT_OFFSET 9 /* protocol type offset */
+#define IPV4_CHKSUM_OFFSET 10 /* IP header checksum offset */
+#define IPV4_SRC_IP_OFFSET 12 /* src IP addr offset */
+#define IPV4_DEST_IP_OFFSET 16 /* dest IP addr offset */
+#define IPV4_OPTIONS_OFFSET 20 /* IP options offset */
+#define IPV4_MIN_HEADER_LEN 20 /* Minimum size for an IP header (no options) */
+
+/* IPV4 field decodes */
+#define IPV4_VER_MASK 0xf0 /* IPV4 version mask */
+#define IPV4_VER_SHIFT 4 /* IPV4 version shift */
+
+#define IPV4_HLEN_MASK 0x0f /* IPV4 header length mask */
#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 /* IPV4 address length */
#define IPV4_ADDR_NULL(a) ((((uint8 *)(a))[0] | ((uint8 *)(a))[1] | \
((uint8 *)(a))[2] | ((uint8 *)(a))[3]) == 0)
#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 /* DiffServ codepoint mask */
+#define IPV4_TOS_DSCP_SHIFT 2 /* DiffServ codepoint shift */
#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 /* Historical precedence mask */
+#define IPV4_TOS_PREC_SHIFT 5 /* Historical precedence shift */
-#define IPV4_TOS_LOWDELAY 0x10
-#define IPV4_TOS_THROUGHPUT 0x8
-#define IPV4_TOS_RELIABILITY 0x4
+#define IPV4_TOS_LOWDELAY 0x10 /* Lowest delay requested */
+#define IPV4_TOS_THROUGHPUT 0x8 /* Best throughput requested */
+#define IPV4_TOS_RELIABILITY 0x4 /* Most reliable delivery requested */
#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_ADDR_STR_LEN 16
+#define IPV4_FRAG_RESV 0x8000 /* Reserved */
+#define IPV4_FRAG_DONT 0x4000 /* Don't fragment */
+#define IPV4_FRAG_MORE 0x2000 /* More fragments */
+#define IPV4_FRAG_OFFSET_MASK 0x1fff /* Fragment offset */
+#define IPV4_ADDR_STR_LEN 16 /* Max IP address length in string format */
+/* IPV4 packet formats */
BWL_PRE_PACKED_STRUCT struct ipv4_addr {
uint8 addr[IPV4_ADDR_LEN];
} BWL_POST_PACKED_STRUCT;
BWL_PRE_PACKED_STRUCT struct ipv4_hdr {
- uint8 version_ihl;
- uint8 tos;
- uint16 tot_len;
+ uint8 version_ihl; /* Version and Internet Header Length */
+ uint8 tos; /* Type Of Service */
+ uint16 tot_len; /* Number of bytes in packet (max 65535) */
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; /* 3 flag bits and fragment offset */
+ uint8 ttl; /* Time To Live */
+ uint8 prot; /* Protocol */
+ uint16 hdr_chksum; /* IP header checksum */
+ uint8 src_ip[IPV4_ADDR_LEN]; /* Source IP Address */
+ uint8 dst_ip[IPV4_ADDR_LEN]; /* Destination IP Address */
} BWL_POST_PACKED_STRUCT;
+/* IPV6 field offsets */
+#define IPV6_PAYLOAD_LEN_OFFSET 4 /* payload length offset */
+#define IPV6_NEXT_HDR_OFFSET 6 /* next header/protocol offset */
+#define IPV6_HOP_LIMIT_OFFSET 7 /* hop limit offset */
+#define IPV6_SRC_IP_OFFSET 8 /* src IP addr offset */
+#define IPV6_DEST_IP_OFFSET 24 /* dst IP addr offset */
-#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
-
-
+/* IPV6 field decodes */
#define IPV6_TRAFFIC_CLASS(ipv6_body) \
(((((uint8 *)(ipv6_body))[0] & 0x0f) << 4) | \
((((uint8 *)(ipv6_body))[1] & 0xf0) >> 4))
#define IPV6_PROT(ipv6_body) IPV6_NEXT_HDR(ipv6_body)
-#define IPV6_ADDR_LEN 16
-
+#define IPV6_ADDR_LEN 16 /* IPV6 address length */
+/* IPV4 TOS or IPV6 Traffic Classifier or 0 */
#define IP_TOS46(ip_body) \
(IP_VER(ip_body) == IP_VER_4 ? IPV4_TOS(ip_body) : \
IP_VER(ip_body) == IP_VER_6 ? IPV6_TRAFFIC_CLASS(ip_body) : 0)
-
+/* IPV6 extension headers (options) */
#define IPV6_EXTHDR_HOP 0
#define IPV6_EXTHDR_ROUTING 43
#define IPV6_EXTHDR_FRAGMENT 44
#define IPV4_ISMULTI(a) (((a) & 0xf0000000) == 0xe0000000)
-
+/* This marks the end of a packed structure section. */
#include <packed_section_end.h>
-#endif
+#endif /* _bcmip_h_ */
/*
* BT-AMP (BlueTooth Alternate Mac and Phy) HCI (Host/Controller Interface)
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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: bt_amp_hci.h 294267 2011-11-04 23:41:52Z $
+ * $Id: bt_amp_hci.h 382882 2013-02-04 23:24:31Z $
*/
#ifndef _bt_amp_hci_h
*
* Copyright (C) 2002 Broadcom Corporation
*
- * $Id: eapol.h 241182 2011-02-17 21:50:03Z $
+ * $Id: eapol.h 382882 2013-02-04 23:24:31Z $
*/
#ifndef _eapol_h_
/*
* From FreeBSD 2.2.7: Fundamental constants relating to ethernet.
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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 354714 2012-09-03 03:12:21Z $
+ * $Id: ethernet.h 384540 2013-02-12 04:28:58Z $
*/
-#ifndef _NET_ETHERNET_H_
+#ifndef _NET_ETHERNET_H_ /* use native BSD ethernet.h when available */
#define _NET_ETHERNET_H_
#ifndef _TYPEDEFS_H_
#include "typedefs.h"
#endif
-
+/* This marks the start of a packed structure section. */
#include <packed_section_start.h>
-
+/*
+ * The number of bytes in an ethernet (MAC) address.
+ */
#define ETHER_ADDR_LEN 6
-
+/*
+ * The number of bytes in the type field.
+ */
#define ETHER_TYPE_LEN 2
-
+/*
+ * The number of bytes in the trailing CRC field.
+ */
#define ETHER_CRC_LEN 4
-
+/*
+ * The length of the combined header.
+ */
#define ETHER_HDR_LEN (ETHER_ADDR_LEN * 2 + ETHER_TYPE_LEN)
-
+/*
+ * The minimum packet length.
+ */
#define ETHER_MIN_LEN 64
-
+/*
+ * The minimum packet user data length.
+ */
#define ETHER_MIN_DATA 46
-
+/*
+ * The maximum packet length.
+ */
#define ETHER_MAX_LEN 1518
-
+/*
+ * The maximum packet user data length.
+ */
#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
+/* ether types */
+#define ETHER_TYPE_MIN 0x0600 /* Anything less than MIN is a length */
+#define ETHER_TYPE_IP 0x0800 /* IP */
+#define ETHER_TYPE_ARP 0x0806 /* ARP */
+#define ETHER_TYPE_8021Q 0x8100 /* 802.1Q */
+#define ETHER_TYPE_IPV6 0x86dd /* IPv6 */
+#define ETHER_TYPE_BRCM 0x886c /* Broadcom Corp. */
+#define ETHER_TYPE_802_1X 0x888e /* 802.1x */
#ifdef PLC
-#define ETHER_TYPE_88E1 0x88e1
-#define ETHER_TYPE_8912 0x8912
-#define ETHER_TYPE_GIGLED 0xffff
-#endif
-#define ETHER_TYPE_802_1X_PREAUTH 0x88c7
-#define ETHER_TYPE_WAI 0x88b4
-#define ETHER_TYPE_89_0D 0x890d
+#define ETHER_TYPE_88E1 0x88e1 /* GIGLE */
+#define ETHER_TYPE_8912 0x8912 /* GIGLE */
+#define ETHER_TYPE_GIGLED 0xffff /* GIGLE */
+#endif /* PLC */
+#define ETHER_TYPE_802_1X_PREAUTH 0x88c7 /* 802.1x preauthentication */
+#define ETHER_TYPE_WAI 0x88b4 /* WAI */
+#define ETHER_TYPE_89_0D 0x890d /* 89-0d frame for TDLS */
-#define ETHER_TYPE_IPV6 0x86dd
+#define ETHER_TYPE_PPP_SES 0x8864 /* PPPoE Session */
+/* Broadcom subtype follows ethertype; First 2 bytes are reserved; Next 2 are subtype; */
+#define ETHER_BRCM_SUBTYPE_LEN 4 /* Broadcom 4 byte subtype */
-#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)
-
+/* ether header */
+#define ETHER_DEST_OFFSET (0 * ETHER_ADDR_LEN) /* dest address offset */
+#define ETHER_SRC_OFFSET (1 * ETHER_ADDR_LEN) /* src address offset */
+#define ETHER_TYPE_OFFSET (2 * ETHER_ADDR_LEN) /* ether type offset */
+/*
+ * A macro to validate a length with
+ */
#define ETHER_IS_VALID_LEN(foo) \
((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN)
((uint8 *)ea)[5] = ((mgrp_ip) >> 0) & 0xff; \
}
-#ifndef __INCif_etherh
-
+#ifndef __INCif_etherh /* Quick and ugly hack for VxWorks */
+/*
+ * Structure of a 10Mb/s Ethernet header.
+ */
BWL_PRE_PACKED_STRUCT struct ether_header {
uint8 ether_dhost[ETHER_ADDR_LEN];
uint8 ether_shost[ETHER_ADDR_LEN];
uint16 ether_type;
} BWL_POST_PACKED_STRUCT;
-
+/*
+ * Structure of a 48-bit Ethernet address.
+ */
BWL_PRE_PACKED_STRUCT struct ether_addr {
uint8 octet[ETHER_ADDR_LEN];
} BWL_POST_PACKED_STRUCT;
-#endif
-
+#endif /* !__INCif_etherh Quick and ugly hack for VxWorks */
+/*
+ * Takes a pointer, set, test, clear, toggle locally admininistered
+ * address bit in the 48-bit Ethernet address.
+ */
#define ETHER_SET_LOCALADDR(ea) (((uint8 *)(ea))[0] = (((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))
-
+/* Takes a pointer, marks unicast address bit in the MAC address */
#define ETHER_SET_UNICAST(ea) (((uint8 *)(ea))[0] = (((uint8 *)(ea))[0] & ~1))
-
+/*
+ * Takes a pointer, returns true if a 48-bit multicast address
+ * (including broadcast, since it is all ones)
+ */
#define ETHER_ISMULTI(ea) (((const uint8 *)(ea))[0] & 1)
-
-#define eacmp(a, b) ((((uint16 *)(a))[0] ^ ((uint16 *)(b))[0]) | \
- (((uint16 *)(a))[1] ^ ((uint16 *)(b))[1]) | \
- (((uint16 *)(a))[2] ^ ((uint16 *)(b))[2]))
+/* compare two ethernet addresses - assumes the pointers can be referenced as shorts */
+#define eacmp(a, b) ((((const uint16 *)(a))[0] ^ ((const uint16 *)(b))[0]) | \
+ (((const uint16 *)(a))[1] ^ ((const uint16 *)(b))[1]) | \
+ (((const uint16 *)(a))[2] ^ ((const uint16 *)(b))[2]))
#define ether_cmp(a, b) eacmp(a, b)
-
+/* copy an ethernet address - assumes the pointers can be referenced as shorts */
#define eacopy(s, d) \
do { \
((uint16 *)(d))[0] = ((const uint16 *)(s))[0]; \
#define ether_copy(s, d) eacopy(s, d)
+/* Copy an ethernet address in reverse order */
+#define ether_rcopy(s, d) \
+do { \
+ ((uint16 *)(d))[2] = ((uint16 *)(s))[2]; \
+ ((uint16 *)(d))[1] = ((uint16 *)(s))[1]; \
+ ((uint16 *)(d))[0] = ((uint16 *)(s))[0]; \
+} while (0)
+
+
static const struct ether_addr ether_bcast = {{255, 255, 255, 255, 255, 255}};
static const struct ether_addr ether_null = {{0, 0, 0, 0, 0, 0}};
static const struct ether_addr ether_ipv6_mcast = {{0x33, 0x33, 0x00, 0x00, 0x00, 0x01}};
-#define ETHER_ISBCAST(ea) ((((uint8 *)(ea))[0] & \
- ((uint8 *)(ea))[1] & \
- ((uint8 *)(ea))[2] & \
- ((uint8 *)(ea))[3] & \
- ((uint8 *)(ea))[4] & \
- ((uint8 *)(ea))[5]) == 0xff)
-#define ETHER_ISNULLADDR(ea) ((((uint8 *)(ea))[0] | \
- ((uint8 *)(ea))[1] | \
- ((uint8 *)(ea))[2] | \
- ((uint8 *)(ea))[3] | \
- ((uint8 *)(ea))[4] | \
- ((uint8 *)(ea))[5]) == 0)
+#define ETHER_ISBCAST(ea) ((((const uint8 *)(ea))[0] & \
+ ((const uint8 *)(ea))[1] & \
+ ((const uint8 *)(ea))[2] & \
+ ((const uint8 *)(ea))[3] & \
+ ((const uint8 *)(ea))[4] & \
+ ((const uint8 *)(ea))[5]) == 0xff)
+#define ETHER_ISNULLADDR(ea) ((((const uint8 *)(ea))[0] | \
+ ((const uint8 *)(ea))[1] | \
+ ((const uint8 *)(ea))[2] | \
+ ((const uint8 *)(ea))[3] | \
+ ((const uint8 *)(ea))[4] | \
+ ((const uint8 *)(ea))[5]) == 0)
#define ETHER_ISNULLDEST(da) ((((const uint16 *)(da))[0] | \
((const uint16 *)(da))[1] | \
#define ETHER_ISUCAST(ea) ((((uint8 *)(ea))[0] & 0x01) == 0)
-
+/* This marks the end of a packed structure section. */
#include <packed_section_end.h>
-#endif
+#endif /* _NET_ETHERNET_H_ */
--- /dev/null
+/*
+ * Copyright (C) 1999-2013, 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 384536 2013-02-12 04:13:09Z $
+ */
+
+#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 /* ID filed length */
+#define P2P_ATTR_LEN_LEN 2 /* length field length */
+#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 /* Listen 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 /* Operating Channel */
+#define P2P_SEID_INVITE_FLAGS 18 /* Invitation Flags */
+#define P2P_SEID_VNDR 221 /* Vendor-specific subelement */
+
+#define P2P_SE_VS_ID_SERVICES 0x1b /* BRCM proprietary 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;
+
+/* WiFi P2P IE subelement: Listen Channel */
+BWL_PRE_PACKED_STRUCT struct wifi_p2p_listen_channel_se_s {
+ uint8 eltId; /* SE ID: P2P_SEID_CHANNEL */
+ uint8 len[2]; /* SE length not including eltId, len fields */
+ uint8 country[3]; /* Country String */
+ uint8 op_class; /* Operating Class */
+ uint8 channel; /* Channel */
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2p_listen_channel_se_s wifi_p2p_listen_channel_se_t;
+
+/* WiFi P2P IE subelement: P2P Group BSSID */
+BWL_PRE_PACKED_STRUCT struct wifi_p2p_grp_bssid_se_s {
+ uint8 eltId; /* SE ID: P2P_SEID_GRP_BSSID */
+ uint8 len[2]; /* SE length not including eltId, len fields */
+ uint8 mac[6]; /* P2P group bssid */
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2p_grp_bssid_se_s wifi_p2p_grp_bssid_se_t;
+
+/* WiFi P2P IE subelement: P2P Group ID */
+BWL_PRE_PACKED_STRUCT struct wifi_p2p_grp_id_se_s {
+ uint8 eltId; /* SE ID: P2P_SEID_GROUP_ID */
+ uint8 len[2]; /* SE length not including eltId, len fields */
+ uint8 mac[6]; /* P2P device address */
+ uint8 ssid[1]; /* ssid. device id. variable length */
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2p_grp_id_se_s wifi_p2p_grp_id_se_t;
+
+/* WiFi P2P IE subelement: P2P Interface */
+BWL_PRE_PACKED_STRUCT struct wifi_p2p_intf_se_s {
+ uint8 eltId; /* SE ID: P2P_SEID_P2P_IF */
+ uint8 len[2]; /* SE length not including eltId, len fields */
+ uint8 mac[6]; /* P2P device address */
+ uint8 ifaddrs; /* P2P Interface Address count */
+ uint8 ifaddr[1][6]; /* P2P Interface Address list */
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2p_intf_se_s wifi_p2p_intf_se_t;
+
+/* WiFi P2P IE subelement: Status */
+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_CHAN_LIST */
+ 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 Primary Device Type structure */
+BWL_PRE_PACKED_STRUCT struct wifi_p2p_pri_devtype_s {
+ uint16 cat_id; /* Category ID */
+ uint8 OUI[3]; /* WFA OUI: 0x0050F2 */
+ uint8 oui_type; /* WPS_OUI_TYPE */
+ uint16 sub_cat_id; /* Sub Category ID */
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2p_pri_devtype_s wifi_p2p_pri_devtype_t;
+
+/* WiFi P2P IE's Device Info subelement */
+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;
+
+/* WiFi IE subelement: Operating Channel */
+BWL_PRE_PACKED_STRUCT struct wifi_p2p_op_channel_se_s {
+ uint8 eltId; /* SE ID: P2P_SEID_OP_CHANNEL */
+ uint8 len[2]; /* SE length not including eltId, len fields */
+ uint8 country[3]; /* Country String */
+ uint8 op_class; /* Operating Class */
+ uint8 channel; /* Channel */
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2p_op_channel_se_s wifi_p2p_op_channel_se_t;
+
+/* WiFi IE subelement: INVITATION FLAGS */
+BWL_PRE_PACKED_STRUCT struct wifi_p2p_invite_flags_se_s {
+ uint8 eltId; /* SE ID: P2P_SEID_INVITE_FLAGS */
+ uint8 len[2]; /* SE length not including eltId, len fields */
+ uint8 flags; /* Flags */
+} BWL_POST_PACKED_STRUCT;
+typedef struct wifi_p2p_invite_flags_se_s wifi_p2p_invite_flags_se_t;
+
+/* WiFi P2P Action Frame */
+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 Response */
+#define P2P_PAF_SUBTYPE_INVALID 255 /* Invalid Subtype */
+
+/* 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
+
+#define P2P_NOA_SE_MAX_DESC 2 /* max NoA descriptors in presence request */
+
+/* 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_ */
/*
* SD-SPI Protocol Standard
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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: sdspi.h 241182 2011-02-17 21:50:03Z $
+ * $Id: sdspi.h 382882 2013-02-04 23:24:31Z $
*/
#ifndef _SD_SPI_H
#define _SD_SPI_H
/*
* 802.1Q VLAN protocol definitions
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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: vlan.h 346935 2012-07-25 00:24:55Z $
+ * $Id: vlan.h 382883 2013-02-04 23:26:09Z $
*/
#ifndef _vlan_h_
#include <typedefs.h>
#endif
-
+/* This marks the start of a packed structure section. */
#include <packed_section_start.h>
-#define VLAN_VID_MASK 0xfff
-#define VLAN_CFI_SHIFT 12
-#define VLAN_PRI_SHIFT 13
+#ifndef VLAN_VID_MASK
+#define VLAN_VID_MASK 0xfff /* low 12 bits are vlan id */
+#endif
+
+#define VLAN_CFI_SHIFT 12 /* canonical format indicator bit */
+#define VLAN_PRI_SHIFT 13 /* user priority */
-#define VLAN_PRI_MASK 7
+#define VLAN_PRI_MASK 7 /* 3 bits of priority */
-#define VLAN_TPID_OFFSET 12
-#define VLAN_TCI_OFFSET 14
+#define VLAN_TPID_OFFSET 12 /* offset of tag protocol id field */
+#define VLAN_TCI_OFFSET 14 /* offset of tag ctrl info field */
#define VLAN_TAG_LEN 4
-#define VLAN_TAG_OFFSET (2 * ETHER_ADDR_LEN)
+#define VLAN_TAG_OFFSET (2 * ETHER_ADDR_LEN) /* offset in Ethernet II packet only */
-#define VLAN_TPID 0x8100
+#define VLAN_TPID 0x8100 /* VLAN ethertype/Tag Protocol ID */
struct vlan_header {
- uint16 vlan_type;
- uint16 vlan_tag;
+ uint16 vlan_type; /* 0x8100 */
+ uint16 vlan_tag; /* priority, cfi and vid */
};
struct ethervlan_header {
uint8 ether_dhost[ETHER_ADDR_LEN];
uint8 ether_shost[ETHER_ADDR_LEN];
- uint16 vlan_type;
- uint16 vlan_tag;
+ uint16 vlan_type; /* 0x8100 */
+ uint16 vlan_tag; /* priority, cfi and vid */
uint16 ether_type;
};
-#define ETHERVLAN_HDR_LEN (ETHER_HDR_LEN + VLAN_TAG_LEN)
+struct dot3_mac_llc_snapvlan_header {
+ uint8 ether_dhost[ETHER_ADDR_LEN]; /* dest mac */
+ uint8 ether_shost[ETHER_ADDR_LEN]; /* src mac */
+ uint16 length; /* frame length incl header */
+ uint8 dsap; /* always 0xAA */
+ uint8 ssap; /* always 0xAA */
+ uint8 ctl; /* always 0x03 */
+ uint8 oui[3]; /* RFC1042: 0x00 0x00 0x00
+ * Bridge-Tunnel: 0x00 0x00 0xF8
+ */
+ uint16 vlan_type; /* 0x8100 */
+ uint16 vlan_tag; /* priority, cfi and vid */
+ uint16 ether_type; /* ethertype */
+};
+#define ETHERVLAN_HDR_LEN (ETHER_HDR_LEN + VLAN_TAG_LEN)
+/* This marks the end of a packed structure section. */
#include <packed_section_end.h>
#define ETHERVLAN_MOVE_HDR(d, s) \
*(struct ethervlan_header *)(d) = t; \
} while (0)
-#endif
+#endif /* _vlan_h_ */
/*
* Fundamental types and constants relating to WPA
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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: wpa.h 369547 2012-11-19 08:57:31Z $
+ * $Id: wpa.h 384536 2013-02-12 04:13:09Z $
*/
#ifndef _proto_wpa_h_
#include <proto/ethernet.h>
-
+/* This marks the start of a packed structure section. */
#include <packed_section_start.h>
-#ifdef CUSTOMER_HW4
-#include <dhd_sec_feature.h>
-#endif
-
-
-
-
-#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
+/* Reason Codes */
+
+/* 13 through 23 taken from IEEE Std 802.11i-2004 */
+#define DOT11_RC_INVALID_WPA_IE 13 /* Invalid info. element */
+#define DOT11_RC_MIC_FAILURE 14 /* Michael failure */
+#define DOT11_RC_4WH_TIMEOUT 15 /* 4-way handshake timeout */
+#define DOT11_RC_GTK_UPDATE_TIMEOUT 16 /* Group key update timeout */
+#define DOT11_RC_WPA_IE_MISMATCH 17 /* WPA IE in 4-way handshake differs from
+ * (re-)assoc. request/probe response
+ */
+#define DOT11_RC_INVALID_MC_CIPHER 18 /* Invalid multicast cipher */
+#define DOT11_RC_INVALID_UC_CIPHER 19 /* Invalid unicast cipher */
+#define DOT11_RC_INVALID_AKMP 20 /* Invalid authenticated key management protocol */
+#define DOT11_RC_BAD_WPA_VERSION 21 /* Unsupported WPA version */
+#define DOT11_RC_INVALID_WPA_CAP 22 /* Invalid WPA IE capabilities */
+#define DOT11_RC_8021X_AUTH_FAIL 23 /* 802.1X authentication failure */
#define WPA2_PMKID_LEN 16
-
+/* WPA IE fixed portion */
typedef BWL_PRE_PACKED_STRUCT struct
{
- uint8 tag;
- uint8 length;
- uint8 oui[3];
- uint8 oui_type;
+ uint8 tag; /* TAG */
+ uint8 length; /* TAG length */
+ uint8 oui[3]; /* IE OUI */
+ uint8 oui_type; /* OUI type */
BWL_PRE_PACKED_STRUCT struct {
uint8 low;
uint8 high;
- } BWL_POST_PACKED_STRUCT version;
+ } BWL_POST_PACKED_STRUCT version; /* IE 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; /* TAG */
+ uint8 length; /* TAG length */
BWL_PRE_PACKED_STRUCT struct {
uint8 low;
uint8 high;
- } BWL_POST_PACKED_STRUCT version;
+ } BWL_POST_PACKED_STRUCT version; /* IE 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
typedef uint8 wpa_pmkid_t[WPA2_PMKID_LEN];
-
+/* WPA suite/multicast suite */
typedef BWL_PRE_PACKED_STRUCT struct
{
uint8 oui[3];
} BWL_POST_PACKED_STRUCT wpa_suite_t, wpa_suite_mcast_t;
#define WPA_SUITE_LEN 4
-
+/* WPA unicast suite list/key management suite list */
typedef BWL_PRE_PACKED_STRUCT struct
{
BWL_PRE_PACKED_STRUCT struct {
wpa_pmkid_t list[1];
} BWL_POST_PACKED_STRUCT wpa_pmkid_list_t;
+/* WPA cipher suites */
+#define WPA_CIPHER_NONE 0 /* None */
+#define WPA_CIPHER_WEP_40 1 /* WEP (40-bit) */
+#define WPA_CIPHER_TKIP 2 /* TKIP: default for WPA */
+#define WPA_CIPHER_AES_OCB 3 /* AES (OCB) */
+#define WPA_CIPHER_AES_CCM 4 /* AES (CCM) */
+#define WPA_CIPHER_WEP_104 5 /* WEP (104-bit) */
+#define WPA_CIPHER_BIP 6 /* WEP (104-bit) */
+#define WPA_CIPHER_TPK 7 /* Group addressed traffic not allowed */
-#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
#define IS_WPA_CIPHER(cipher) ((cipher) == WPA_CIPHER_NONE || \
(cipher) == WPA_CIPHER_WEP_40 || \
(cipher) == WPA_CIPHER_AES_CCM || \
(cipher) == WPA_CIPHER_TPK)
-#ifdef BCMWAPI_WAI
-#define IS_WAPI_CIPHER(cipher) ((cipher) == WAPI_CIPHER_NONE || \
- (cipher) == WAPI_CSE_WPI_SMS4)
-
-#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
-
-
-#define WPA_TKIP_CM_DETECT 60
-#define WPA_TKIP_CM_BLOCK 60
-
-
-#define RSN_CAP_LEN 2
+/* 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) */
+/* RSN IE defines */
+#define RSN_CAP_LEN 2 /* Length of RSN capabilities field (2 octets) */
+/* RSN Capabilities defined in 802.11i */
#define RSN_CAP_PREAUTH 0x0001
#define RSN_CAP_NOPAIRWISE 0x0002
#define RSN_CAP_PTK_REPLAY_CNTR_MASK 0x000C
#define RSN_CAP_16_REPLAY_CNTRS 3
#define RSN_CAP_MFPR 0x0040
#define RSN_CAP_MFPC 0x0080
+#define RSN_CAP_SPPC 0x0400
+#define RSN_CAP_SPPR 0x0800
-
+/* WPA capabilities defined in 802.11i */
#define WPA_CAP_4_REPLAY_CNTRS RSN_CAP_4_REPLAY_CNTRS
#define WPA_CAP_16_REPLAY_CNTRS RSN_CAP_16_REPLAY_CNTRS
#define WPA_CAP_REPLAY_CNTR_SHIFT RSN_CAP_PTK_REPLAY_CNTR_SHIFT
#define WPA_CAP_REPLAY_CNTR_MASK RSN_CAP_PTK_REPLAY_CNTR_MASK
+/* WPA capabilities defined in 802.11zD9.0 */
+#define WPA_CAP_PEER_KEY_ENABLE (0x1 << 1) /* bit 9 */
-#define WPA_CAP_PEER_KEY_ENABLE (0x1 << 1)
-
-
-#define WPA_CAP_LEN RSN_CAP_LEN
-#define WPA_PMKID_CNT_LEN 2
+/* WPA Specific defines */
+#define WPA_CAP_LEN RSN_CAP_LEN /* Length of RSN capabilities in RSN IE (2 octets) */
+#define WPA_PMKID_CNT_LEN 2 /* Length of RSN PMKID count (2 octests) */
#define WPA_CAP_WPA2_PREAUTH RSN_CAP_PREAUTH
#define WPA2_PMKID_COUNT_LEN 2
-#ifdef BCMWAPI_WAI
-#define WAPI_CAP_PREAUTH RSN_CAP_PREAUTH
-
-
-#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
-#define WAPI_MSK_REKEY_COUNT 0x4000000
-#endif
-
+/* This marks the end of a packed structure section. */
#include <packed_section_end.h>
-#endif
+#endif /* _proto_wpa_h_ */
* 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 368270 2012-11-12 23:46:50Z $
+ * $Id: sbchipc.h 385540 2013-02-15 23:14:50Z $
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
#ifndef _LANGUAGE_ASSEMBLY
-
+/* cpp contortions to concatenate w/arg prescan */
#ifndef PAD
#define _PADLINE(line) pad ## line
#define _XSTR(line) _PADLINE(line)
#define PAD _XSTR(__LINE__)
-#endif
+#endif /* PAD */
typedef struct eci_prerev35 {
uint32 eci_output;
typedef struct flash_config {
uint32 PAD[19];
-
+ /* Flash struct configuration registers (0x18c) for BCM4706 (corerev = 31) */
uint32 flashstrconfig;
} flash_config_t;
typedef volatile struct {
- uint32 chipid;
+ uint32 chipid; /* 0x0 */
uint32 capabilities;
- uint32 corecontrol;
+ uint32 corecontrol; /* corerev >= 1 */
uint32 bist;
-
- uint32 otpstatus;
+ /* OTP */
+ uint32 otpstatus; /* 0x10, corerev >= 10 */
uint32 otpcontrol;
uint32 otpprog;
- uint32 otplayout;
+ uint32 otplayout; /* corerev >= 23 */
-
- uint32 intstatus;
+ /* Interrupt control */
+ uint32 intstatus; /* 0x20 */
uint32 intmask;
-
- uint32 chipcontrol;
- uint32 chipstatus;
+ /* Chip specific regs */
+ uint32 chipcontrol; /* 0x28, rev >= 11 */
+ uint32 chipstatus; /* 0x2c, rev >= 11 */
-
- uint32 jtagcmd;
+ /* Jtag Master */
+ uint32 jtagcmd; /* 0x30, rev >= 10 */
uint32 jtagir;
uint32 jtagdr;
uint32 jtagctrl;
-
- uint32 flashcontrol;
+ /* serial flash interface registers */
+ uint32 flashcontrol; /* 0x40 */
uint32 flashaddress;
uint32 flashdata;
- uint32 otplayoutextension;
+ uint32 otplayoutextension; /* rev >= 35 */
-
- uint32 broadcastaddress;
+ /* Silicon backplane configuration broadcast control */
+ uint32 broadcastaddress; /* 0x50 */
uint32 broadcastdata;
-
- uint32 gpiopullup;
- uint32 gpiopulldown;
- uint32 gpioin;
- uint32 gpioout;
- uint32 gpioouten;
- uint32 gpiocontrol;
- uint32 gpiointpolarity;
- uint32 gpiointmask;
-
-
+ /* gpio - cleared only by power-on-reset */
+ uint32 gpiopullup; /* 0x58, corerev >= 20 */
+ uint32 gpiopulldown; /* 0x5c, corerev >= 20 */
+ uint32 gpioin; /* 0x60 */
+ uint32 gpioout; /* 0x64 */
+ uint32 gpioouten; /* 0x68 */
+ uint32 gpiocontrol; /* 0x6C */
+ uint32 gpiointpolarity; /* 0x70 */
+ uint32 gpiointmask; /* 0x74 */
+
+ /* GPIO events corerev >= 11 */
uint32 gpioevent;
uint32 gpioeventintmask;
-
- uint32 watchdog;
+ /* Watchdog timer */
+ uint32 watchdog; /* 0x80 */
-
+ /* GPIO events corerev >= 11 */
uint32 gpioeventintpolarity;
-
- uint32 gpiotimerval;
+ /* GPIO based LED powersave registers corerev >= 16 */
+ uint32 gpiotimerval; /* 0x88 */
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;
+ /* clock control */
+ uint32 clockcontrol_n; /* 0x90 */
+ uint32 clockcontrol_sb; /* aka m0 */
+ uint32 clockcontrol_pci; /* aka m1 */
+ uint32 clockcontrol_m2; /* mii/uart/mipsref */
+ uint32 clockcontrol_m3; /* cpu */
+ uint32 clkdiv; /* corerev >= 3 */
+ uint32 gpiodebugsel; /* corerev >= 28 */
+ uint32 capabilities_ext; /* 0xac */
+
+ /* pll delay registers (corerev >= 4) */
+ uint32 pll_on_delay; /* 0xb0 */
uint32 fref_sel_delay;
- uint32 slow_clk_ctl;
+ uint32 slow_clk_ctl; /* 5 < corerev < 10 */
uint32 PAD;
-
- uint32 system_clk_ctl;
+ /* Instaclock registers (corerev >= 10) */
+ uint32 system_clk_ctl; /* 0xc0 */
uint32 clkstatestretch;
uint32 PAD[2];
-
- uint32 bp_addrlow;
+ /* Indirect backplane access (corerev >= 22) */
+ uint32 bp_addrlow; /* 0xd0 */
uint32 bp_addrhigh;
uint32 bp_data;
uint32 PAD;
uint32 bp_indaccess;
-
+ /* SPI registers, corerev >= 37 */
uint32 gsioctrl;
uint32 gsioaddress;
uint32 gsiodata;
-
+ /* More clock dividers (corerev >= 32) */
uint32 clkdiv2;
-
+ /* FAB ID (corerev >= 40) */
uint32 otpcontrol1;
- uint32 fabid;
+ uint32 fabid; /* 0xf8 */
-
- uint32 eromptr;
+ /* In AI chips, pointer to erom */
+ uint32 eromptr; /* 0xfc */
-
- uint32 pcmcia_config;
+ /* ExtBus control registers (corerev >= 3) */
+ uint32 pcmcia_config; /* 0x100 */
uint32 pcmcia_memwait;
uint32 pcmcia_attrwait;
uint32 pcmcia_iowait;
uint32 prog_waitcount;
uint32 flash_config;
uint32 flash_waitcount;
- uint32 SECI_config;
+ uint32 SECI_config; /* 0x130 SECI configuration */
uint32 SECI_status;
uint32 SECI_statusmask;
uint32 SECI_rxnibchanged;
uint32 PAD[20];
-
- uint32 sromcontrol;
+ /* SROM interface (corerev >= 32) */
+ uint32 sromcontrol; /* 0x190 */
uint32 sromaddress;
uint32 sromdata;
- uint32 PAD[1];
-
- uint32 nflashctrl;
+ uint32 PAD[1]; /* 0x19C */
+ /* NAND flash registers for BCM4706 (corerev = 31) */
+ uint32 nflashctrl; /* 0x1a0 */
uint32 nflashconf;
uint32 nflashcoladdr;
uint32 nflashrowaddr;
uint32 nflashdata;
- uint32 nflashwaitcnt0;
+ uint32 nflashwaitcnt0; /* 0x1b4 */
uint32 PAD[2];
- uint32 seci_uart_data;
+ uint32 seci_uart_data; /* 0x1C0 */
uint32 seci_uart_bauddiv;
uint32 seci_uart_fcr;
uint32 seci_uart_lcr;
uint32 seci_uart_lsr;
uint32 seci_uart_msr;
uint32 seci_uart_baudadj;
-
- uint32 clk_ctl_st;
+ /* Clock control and hardware workarounds (corerev >= 20) */
+ uint32 clk_ctl_st; /* 0x1e0 */
uint32 hw_war;
uint32 PAD[70];
-
- uint8 uart0data;
+ /* UARTs */
+ uint8 uart0data; /* 0x300 */
uint8 uart0imr;
uint8 uart0fcr;
uint8 uart0lcr;
uint8 uart0lsr;
uint8 uart0msr;
uint8 uart0scratch;
- uint8 PAD[248];
+ uint8 PAD[248]; /* corerev >= 1 */
- uint8 uart1data;
+ uint8 uart1data; /* 0x400 */
uint8 uart1imr;
uint8 uart1fcr;
uint8 uart1lcr;
uint8 uart1scratch;
uint32 PAD[126];
-
-
- uint32 pmucontrol;
+ /* PMU registers (corerev >= 20) */
+ /* Note: all timers driven by ILP clock are updated asynchronously to HT/ALP.
+ * The CPU must read them twice, compare, and retry if different.
+ */
+ uint32 pmucontrol; /* 0x600 */
uint32 pmucapabilities;
uint32 pmustatus;
uint32 res_state;
uint32 res_timer;
uint32 clkstretch;
uint32 pmuwatchdog;
- uint32 gpiosel;
- uint32 gpioenable;
+ uint32 gpiosel; /* 0x638, rev >= 1 */
+ uint32 gpioenable; /* 0x63c, rev >= 1 */
uint32 res_req_timer_sel;
uint32 res_req_timer;
uint32 res_req_mask;
uint32 PAD;
- uint32 chipcontrol_addr;
- uint32 chipcontrol_data;
+ uint32 chipcontrol_addr; /* 0x650 */
+ uint32 chipcontrol_data; /* 0x654 */
uint32 regcontrol_addr;
uint32 regcontrol_data;
uint32 pllcontrol_addr;
uint32 pllcontrol_data;
- uint32 pmustrapopt;
- uint32 pmu_xtalfreq;
- uint32 retention_ctl;
+ uint32 pmustrapopt; /* 0x668, corerev >= 28 */
+ uint32 pmu_xtalfreq; /* 0x66C, pmurev >= 10 */
+ uint32 retention_ctl; /* 0x670 */
uint32 PAD[3];
- uint32 retention_grpidx;
- uint32 retention_grpctl;
+ uint32 retention_grpidx; /* 0x680 */
+ uint32 retention_grpctl; /* 0x684 */
uint32 PAD[94];
- uint16 sromotp[512];
+ uint16 sromotp[512]; /* 0x800 */
#ifdef NFLASH_SUPPORT
-
- uint32 nand_revision;
+ /* Nand flash MLC controller registers (corerev >= 38) */
+ uint32 nand_revision; /* 0xC00 */
uint32 nand_cmd_start;
uint32 nand_cmd_addr_x;
uint32 nand_cmd_addr;
uint32 nand_cache_data;
uint32 nand_ctrl_config;
uint32 nand_ctrl_status;
-#endif
- uint32 gci_corecaps0;
+#endif /* NFLASH_SUPPORT */
+ uint32 gci_corecaps0; /* GCI starting at 0xC00 */
uint32 gci_corecaps1;
uint32 gci_corecaps2;
uint32 gci_corectrl;
- uint32 gci_corestat;
- uint32 gci_intstat;
- uint32 gci_intmask;
- uint32 gci_wakemask;
- uint32 gci_levelintstat;
- uint32 gci_eventintstat;
+ uint32 gci_corestat; /* 0xC10 */
+ uint32 gci_intstat; /* 0xC14 */
+ uint32 gci_intmask; /* 0xC18 */
+ uint32 gci_wakemask; /* 0xC1C */
+ uint32 gci_levelintstat; /* 0xC20 */
+ uint32 gci_eventintstat; /* 0xC24 */
uint32 PAD[6];
- uint32 gci_indirect_addr;
- uint32 gci_gpioctl;
+ uint32 gci_indirect_addr; /* 0xC40 */
+ uint32 gci_gpioctl; /* 0xC44 */
uint32 PAD;
- uint32 gci_gpiomask;
+ uint32 gci_gpiomask; /* 0xC4C */
uint32 PAD;
- uint32 gci_miscctl;
+ uint32 gci_miscctl; /* 0xC54 */
uint32 PAD[2];
- uint32 gci_input[32];
- uint32 gci_event[32];
- uint32 gci_output[4];
- uint32 gci_control_0;
- uint32 gci_control_1;
- uint32 gci_level_polreg;
- uint32 gci_levelintmask;
- uint32 gci_eventintmask;
+ uint32 gci_input[32]; /* C60 */
+ uint32 gci_event[32]; /* CE0 */
+ uint32 gci_output[4]; /* D60 */
+ uint32 gci_control_0; /* 0xD70 */
+ uint32 gci_control_1; /* 0xD74 */
+ uint32 gci_level_polreg; /* 0xD78 */
+ uint32 gci_levelintmask; /* 0xD7C */
+ uint32 gci_eventintmask; /* 0xD80 */
uint32 PAD[3];
- uint32 gci_inbandlevelintmask;
- uint32 gci_inbandeventintmask;
+ uint32 gci_inbandlevelintmask; /* 0xD90 */
+ uint32 gci_inbandeventintmask; /* 0xD94 */
uint32 PAD[2];
- uint32 gci_seciauxtx;
- uint32 gci_seciauxrx;
- uint32 gci_secitx_datatag;
- uint32 gci_secirx_datatag;
- uint32 gci_secitx_datamask;
- uint32 gci_seciusef0tx_reg;
- uint32 gci_secif0tx_offset;
- uint32 gci_secif0rx_offset;
- uint32 gci_secif1tx_offset;
+ uint32 gci_seciauxtx; /* 0xDA0 */
+ uint32 gci_seciauxrx; /* 0xDA4 */
+ uint32 gci_secitx_datatag; /* 0xDA8 */
+ uint32 gci_secirx_datatag; /* 0xDAC */
+ uint32 gci_secitx_datamask; /* 0xDB0 */
+ uint32 gci_seciusef0tx_reg; /* 0xDB4 */
+ uint32 gci_secif0tx_offset; /* 0xDB8 */
+ uint32 gci_secif0rx_offset; /* 0xDBC */
+ uint32 gci_secif1tx_offset; /* 0xDC0 */
uint32 PAD[3];
- uint32 gci_uartescval;
+ uint32 gci_uartescval; /* DD0 */
uint32 PAD[3];
- uint32 gci_secibauddiv;
- uint32 gci_secifcr;
- uint32 gci_secilcr;
- uint32 gci_secimcr;
+ uint32 gci_secibauddiv; /* DE0 */
+ uint32 gci_secifcr; /* DE4 */
+ uint32 gci_secilcr; /* DE8 */
+ uint32 gci_secimcr; /* DEC */
uint32 PAD[2];
- uint32 gci_baudadj;
+ uint32 gci_baudadj; /* DF8 */
uint32 PAD;
- uint32 gci_chipctrl;
- uint32 gci_chipsts;
+ uint32 gci_chipctrl; /* 0xE00 */
+ uint32 gci_chipsts; /* 0xE04 */
} chipcregs_t;
-#endif
+#endif /* _LANGUAGE_ASSEMBLY */
#define CC_CHIPID 0
#define PMU_REG_CONTROL_DATA 0x65C
#define PMU_PLL_CONTROL_ADDR 0x660
#define PMU_PLL_CONTROL_DATA 0x664
-#define CC_SROM_OTP 0x800
+#define CC_SROM_OTP 0x800 /* SROM/OTP address space */
#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
-
+/* NAND flash support */
#define CC_NAND_REVISION 0xC00
#define CC_NAND_CMD_START 0xC04
#define CC_NAND_CMD_ADDR 0xC0C
#define CC_NAND_DEVID 0xC60
#define CC_NAND_DEVID_EXT 0xC64
#define CC_NAND_INTFC_STATUS 0xC6C
-#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
+#endif /* NFLASH_SUPPORT */
+
+/* chipid */
+#define CID_ID_MASK 0x0000ffff /* Chip Id mask */
+#define CID_REV_MASK 0x000f0000 /* Chip Revision mask */
+#define CID_REV_SHIFT 16 /* Chip Revision shift */
+#define CID_PKG_MASK 0x00f00000 /* Package Option mask */
+#define CID_PKG_SHIFT 20 /* Package Option shift */
+#define CID_CC_MASK 0x0f000000 /* CoreCount (corerev >= 4) */
#define CID_CC_SHIFT 24
-#define CID_TYPE_MASK 0xf0000000
+#define CID_TYPE_MASK 0xf0000000 /* Chip Type */
#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_EXT_GCI_PRESENT 0x00000004
-
-
+/* capabilities */
+#define CC_CAP_UARTS_MASK 0x00000003 /* Number of UARTs */
+#define CC_CAP_MIPSEB 0x00000004 /* MIPS is in big-endian mode */
+#define CC_CAP_UCLKSEL 0x00000018 /* UARTs clock select */
+#define CC_CAP_UINTCLK 0x00000008 /* UARTs are driven by internal divided clock */
+#define CC_CAP_UARTGPIO 0x00000020 /* UARTs own GPIOs 15:12 */
+#define CC_CAP_EXTBUS_MASK 0x000000c0 /* External bus mask */
+#define CC_CAP_EXTBUS_NONE 0x00000000 /* No ExtBus present */
+#define CC_CAP_EXTBUS_FULL 0x00000040 /* ExtBus: PCMCIA, IDE & Prog */
+#define CC_CAP_EXTBUS_PROG 0x00000080 /* ExtBus: ProgIf only */
+#define CC_CAP_FLASH_MASK 0x00000700 /* Type of flash */
+#define CC_CAP_PLL_MASK 0x00038000 /* Type of PLL */
+#define CC_CAP_PWR_CTL 0x00040000 /* Power control */
+#define CC_CAP_OTPSIZE 0x00380000 /* OTP Size (0 = none) */
+#define CC_CAP_OTPSIZE_SHIFT 19 /* OTP Size shift */
+#define CC_CAP_OTPSIZE_BASE 5 /* OTP Size base */
+#define CC_CAP_JTAGP 0x00400000 /* JTAG Master Present */
+#define CC_CAP_ROM 0x00800000 /* Internal boot rom active */
+#define CC_CAP_BKPLN64 0x08000000 /* 64-bit backplane */
+#define CC_CAP_PMU 0x10000000 /* PMU Present, rev >= 20 */
+#define CC_CAP_ECI 0x20000000 /* ECI Present, rev >= 21 */
+#define CC_CAP_SROM 0x40000000 /* Srom Present, rev >= 32 */
+#define CC_CAP_NFLASH 0x80000000 /* Nand flash present, rev >= 35 */
+
+#define CC_CAP2_SECI 0x00000001 /* SECI Present, rev >= 36 */
+#define CC_CAP2_GSIO 0x00000002 /* GSIO (spi/i2c) present, rev >= 37 */
+
+/* capabilities extension */
+#define CC_CAP_EXT_SECI_PRESENT 0x00000001 /* SECI present */
+#define CC_CAP_EXT_GCI_PRESENT 0x00000004 /* GCI present */
+
+/* WL Channel Info to BT via GCI - bits 40 - 47 */
#define GCI_WL_CHN_INFO_MASK (0xFF00)
-
+/* PLL type */
#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 /* 48MHz base, 3 dividers */
+#define PLL_TYPE2 0x00020000 /* 48MHz, 4 dividers */
+#define PLL_TYPE3 0x00030000 /* 25MHz, 2 dividers */
+#define PLL_TYPE4 0x00008000 /* 48MHz, 4 dividers */
+#define PLL_TYPE5 0x00018000 /* 25MHz, 4 dividers */
+#define PLL_TYPE6 0x00028000 /* 100/200 or 120/240 only */
+#define PLL_TYPE7 0x00038000 /* 25MHz, 4 dividers */
+
+/* ILP clock */
#define ILP_CLOCK 32000
-
+/* ALP clock on pre-PMU chips */
#define ALP_CLOCK 20000000
#ifdef CFG_SIM
#define NS_FAST_MEM_CLOCK 800000000
#define NS_MEM_CLOCK 533000000
#define NS_SLOW_MEM_CLOCK 400000000
-#endif
-
+#endif /* CFG_SIM */
+/* HT clock */
#define HT_CLOCK 80000000
+/* corecontrol */
+#define CC_UARTCLKO 0x00000001 /* Drive UART with internal clock */
+#define CC_SE 0x00000002 /* sync clk out enable (corerev >= 3) */
+#define CC_ASYNCGPIO 0x00000004 /* 1=generate GPIO interrupt without backplane clock */
+#define CC_UARTCLKEN 0x00000008 /* enable UART Clock (corerev > = 21 */
-#define CC_UARTCLKO 0x00000001
-#define CC_SE 0x00000002
-#define CC_ASYNCGPIO 0x00000004
-#define CC_UARTCLKEN 0x00000008
-
-
+/* 4321 chipcontrol */
#define CHIPCTRL_4321A0_DEFAULT 0x3a4
#define CHIPCTRL_4321A1_DEFAULT 0x0a4
-#define CHIPCTRL_4321_PLL_DOWN 0x800000
-
+#define CHIPCTRL_4321_PLL_DOWN 0x800000 /* serdes PLL down override */
+/* Fields in the otpstatus register in rev >= 21 */
#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 /* manuf row is locked */
+#define OTPS_OL_OR1 0x00000002 /* otp redundancy row 1 is locked */
+#define OTPS_OL_OR2 0x00000004 /* otp redundancy row 2 is locked */
+#define OTPS_OL_GU 0x00000008 /* general use region is locked */
#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 /* h/w subregion is programmed */
+#define OTPS_GUP_SW 0x00000200 /* s/w subregion is programmed */
+#define OTPS_GUP_CI 0x00000400 /* chipid/pkgopt subregion is programmed */
+#define OTPS_GUP_FUSE 0x00000800 /* fuse subregion is programmed */
#define OTPS_READY 0x00001000
-#define OTPS_RV(x) (1 << (16 + (x)))
+#define OTPS_RV(x) (1 << (16 + (x))) /* redundancy entry valid */
#define OTPS_RV_MASK 0x0fff0000
#define OTPS_PROGOK 0x40000000
-
+/* Fields in the otpcontrol register in rev >= 21 */
#define OTPC_PROGSEL 0x00000001
#define OTPC_PCOUNT_MASK 0x0000000e
#define OTPC_PCOUNT_SHIFT 1
#define OTPC_ODM 0x00000800
#define OTPC_PROGEN 0x80000000
-
+/* Fields in the 40nm otpcontrol register in rev >= 40 */
#define OTPC_40NM_PROGSEL_SHIFT 0
#define OTPC_40NM_PCOUNT_SHIFT 1
#define OTPC_40NM_PCOUNT_WR 0xA
#define OTPC1_TM_V1X 0x84
#define OTPC1_TM_R1X 0x4
-
+/* Fields in otpprog in rev >= 21 and HND OTP */
#define OTPP_COL_MASK 0x000000ff
#define OTPP_COL_SHIFT 0
#define OTPP_ROW_MASK 0x0000ff00
#define OTPP_VALUE_MASK 0x20000000
#define OTPP_VALUE_SHIFT 29
#define OTPP_START_BUSY 0x80000000
-#define OTPP_READ 0x40000000
-
+#define OTPP_READ 0x40000000 /* HND OTP */
+/* Fields in otplayout register */
#define OTPL_HWRGN_OFF_MASK 0x00000FFF
#define OTPL_HWRGN_OFF_SHIFT 0
#define OTPL_WRAP_REVID_MASK 0x00F80000
#define OTPL_WRAP_TYPE_65NM 0
#define OTPL_WRAP_TYPE_40NM 1
-
+/* otplayout reg corerev >= 36 */
#define OTP_CISFORMAT_NEW 0x80000000
-
+/* Opcodes for OTPP_OC field */
#define OTPPOC_READ 0
#define OTPPOC_BIT_PROG 1
#define OTPPOC_VERIFY 3
#define OTPPOC_ROW_LOCK 8
#define OTPPOC_PRESCN_TEST 9
-
+/* Opcodes for OTPP_OC field (40NM) */
#define OTPPOC_READ_40NM 0
#define OTPPOC_PROG_ENABLE_40NM 1
#define OTPPOC_PROG_DISABLE_40NM 2
#define OTPPOC_OVST_READ_40NM 14
#define OTPPOC_OVST_PROG_40NM 15
-
+/* Fields in otplayoutextension */
#define OTPLAYOUTEXT_FUSE_MASK 0x3FF
+/* Jtagm characteristics that appeared at a given corerev */
+#define JTAGM_CREV_OLD 10 /* Old command set, 16bit max IR */
+#define JTAGM_CREV_IRP 22 /* Able to do pause-ir */
+#define JTAGM_CREV_RTI 28 /* Able to do return-to-idle */
-#define JTAGM_CREV_OLD 10
-#define JTAGM_CREV_IRP 22
-#define JTAGM_CREV_RTI 28
-
-
+/* jtagcmd */
#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 /* Test-logic-reset */
+#define JCMD_STATE_PIR 0x20000000 /* Pause IR */
+#define JCMD_STATE_PDR 0x40000000 /* Pause DR */
+#define JCMD_STATE_RTI 0x60000000 /* Run-test-idle */
#define JCMD0_ACC_MASK 0x0000f000
#define JCMD0_ACC_IRDR 0x00000000
#define JCMD0_ACC_DR 0x00001000
#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 /* Changes for corerev 11 */
#define JCMD_ACC_IRDR 0x00000000
#define JCMD_ACC_DR 0x00010000
#define JCMD_ACC_IR 0x00020000
#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 /* rev 28: return to run-test-idle */
+#define JCMD_ACC_DR_I 0x00080000 /* rev 28: return to run-test-idle */
#define JCMD_IRW_MASK 0x00001f00
#define JCMD_IRW_SHIFT 8
#define JCMD_DRW_MASK 0x0000003f
+/* jtagctrl */
+#define JCTRL_FORCE_CLK 4 /* Force clock */
+#define JCTRL_EXT_EN 2 /* Enable external targets */
+#define JCTRL_EN 1 /* Enable Jtag master */
-#define JCTRL_FORCE_CLK 4
-#define JCTRL_EXT_EN 2
-#define JCTRL_EN 1
-
-
+/* Fields in clkdiv */
#define CLKD_SFLASH 0x0f000000
#define CLKD_SFLASH_SHIFT 24
#define CLKD_OTP 0x000f0000
#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
+/* intstatus/intmask */
+#define CI_GPIO 0x00000001 /* gpio intr */
+#define CI_EI 0x00000002 /* extif intr (corerev >= 3) */
+#define CI_TEMP 0x00000004 /* temp. ctrl intr (corerev >= 15) */
+#define CI_SIRQ 0x00000008 /* serial IRQ intr (corerev >= 15) */
+#define CI_ECI 0x00000010 /* eci intr (corerev >= 21) */
+#define CI_PMU 0x00000020 /* pmu intr (corerev >= 21) */
+#define CI_UART 0x00000040 /* uart intr (corerev >= 21) */
+#define CI_WDRESET 0x80000000 /* watchdog reset occurred */
+
+/* slow_clk_ctl */
+#define SCC_SS_MASK 0x00000007 /* slow clock source mask */
+#define SCC_SS_LPO 0x00000000 /* source of slow clock is LPO */
+#define SCC_SS_XTAL 0x00000001 /* source of slow clock is crystal */
+#define SCC_SS_PCI 0x00000002 /* source of slow clock is PCI */
+#define SCC_LF 0x00000200 /* LPOFreqSel, 1: 160Khz, 0: 32KHz */
+#define SCC_LP 0x00000400 /* LPOPowerDown, 1: LPO is disabled,
+ * 0: LPO is enabled
+ */
+#define SCC_FS 0x00000800 /* ForceSlowClk, 1: sb/cores running on slow clock,
+ * 0: power logic control
+ */
+#define SCC_IP 0x00001000 /* IgnorePllOffReq, 1/0: power logic ignores/honors
+ * PLL clock disable requests from core
+ */
+#define SCC_XC 0x00002000 /* XtalControlEn, 1/0: power logic does/doesn't
+ * disable crystal when appropriate
+ */
+#define SCC_XP 0x00004000 /* XtalPU (RO), 1/0: crystal running/disabled */
+#define SCC_CD_MASK 0xffff0000 /* ClockDivider (SlowClk = 1/(4+divisor)) */
#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
+/* system_clk_ctl */
+#define SYCC_IE 0x00000001 /* ILPen: Enable Idle Low Power */
+#define SYCC_AE 0x00000002 /* ALPen: Enable Active Low Power */
+#define SYCC_FP 0x00000004 /* ForcePLLOn */
+#define SYCC_AR 0x00000008 /* Force ALP (or HT if ALPen is not set */
+#define SYCC_HR 0x00000010 /* Force HT */
+#define SYCC_CD_MASK 0xffff0000 /* ClkDiv (ILP = 1/(4 * (divisor + 1)) */
#define SYCC_CD_SHIFT 16
-
+/* Indirect backplane access */
#define BPIA_BYTEEN 0x0000000f
#define BPIA_SZ1 0x00000001
#define BPIA_SZ2 0x00000003
#define BPIA_BUSY 0x00000200
#define BPIA_ERROR 0x00000400
-
-#define CF_EN 0x00000001
-#define CF_EM_MASK 0x0000000e
+/* pcmcia/prog/flash_config */
+#define CF_EN 0x00000001 /* enable */
+#define CF_EM_MASK 0x0000000e /* mode */
#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 /* flash/asynchronous mode */
+#define CF_EM_SYNC 2 /* synchronous mode */
+#define CF_EM_PCMCIA 4 /* pcmcia mode */
+#define CF_DS 0x00000010 /* destsize: 0=8bit, 1=16bit */
+#define CF_BS 0x00000020 /* byteswap */
+#define CF_CD_MASK 0x000000c0 /* clock divider */
#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 PM_W0_MASK 0x0000003f
-#define PM_W1_MASK 0x00001f00
+#define CF_CD_DIV2 0x00000000 /* backplane/2 */
+#define CF_CD_DIV3 0x00000040 /* backplane/3 */
+#define CF_CD_DIV4 0x00000080 /* backplane/4 */
+#define CF_CE 0x00000100 /* clock enable */
+#define CF_SB 0x00000200 /* size/bytestrobe (synch only) */
+
+/* pcmcia_memwait */
+#define PM_W0_MASK 0x0000003f /* waitcount0 */
+#define PM_W1_MASK 0x00001f00 /* waitcount1 */
#define PM_W1_SHIFT 8
-#define PM_W2_MASK 0x001f0000
+#define PM_W2_MASK 0x001f0000 /* waitcount2 */
#define PM_W2_SHIFT 16
-#define PM_W3_MASK 0x1f000000
+#define PM_W3_MASK 0x1f000000 /* waitcount3 */
#define PM_W3_SHIFT 24
-
-#define PA_W0_MASK 0x0000003f
-#define PA_W1_MASK 0x00001f00
+/* pcmcia_attrwait */
+#define PA_W0_MASK 0x0000003f /* waitcount0 */
+#define PA_W1_MASK 0x00001f00 /* waitcount1 */
#define PA_W1_SHIFT 8
-#define PA_W2_MASK 0x001f0000
+#define PA_W2_MASK 0x001f0000 /* waitcount2 */
#define PA_W2_SHIFT 16
-#define PA_W3_MASK 0x1f000000
+#define PA_W3_MASK 0x1f000000 /* waitcount3 */
#define PA_W3_SHIFT 24
-
-#define PI_W0_MASK 0x0000003f
-#define PI_W1_MASK 0x00001f00
+/* pcmcia_iowait */
+#define PI_W0_MASK 0x0000003f /* waitcount0 */
+#define PI_W1_MASK 0x00001f00 /* waitcount1 */
#define PI_W1_SHIFT 8
-#define PI_W2_MASK 0x001f0000
+#define PI_W2_MASK 0x001f0000 /* waitcount2 */
#define PI_W2_SHIFT 16
-#define PI_W3_MASK 0x1f000000
+#define PI_W3_MASK 0x1f000000 /* waitcount3 */
#define PI_W3_SHIFT 24
-
-#define PW_W0_MASK 0x0000001f
-#define PW_W1_MASK 0x00001f00
+/* prog_waitcount */
+#define PW_W0_MASK 0x0000001f /* waitcount0 */
+#define PW_W1_MASK 0x00001f00 /* waitcount1 */
#define PW_W1_SHIFT 8
-#define PW_W2_MASK 0x001f0000
+#define PW_W2_MASK 0x001f0000 /* waitcount2 */
#define PW_W2_SHIFT 16
-#define PW_W3_MASK 0x1f000000
+#define PW_W3_MASK 0x1f000000 /* waitcount3 */
#define PW_W3_SHIFT 24
#define PW_W0 0x0000000c
#define PW_W2 0x00020000
#define PW_W3 0x01000000
-
-#define FW_W0_MASK 0x0000003f
-#define FW_W1_MASK 0x00001f00
+/* flash_waitcount */
+#define FW_W0_MASK 0x0000003f /* waitcount0 */
+#define FW_W1_MASK 0x00001f00 /* waitcount1 */
#define FW_W1_SHIFT 8
-#define FW_W2_MASK 0x001f0000
+#define FW_W2_MASK 0x001f0000 /* waitcount2 */
#define FW_W2_SHIFT 16
-#define FW_W3_MASK 0x1f000000
+#define FW_W3_MASK 0x1f000000 /* waitcount3 */
#define FW_W3_SHIFT 24
-
+/* When Srom support present, fields in sromcontrol */
#define SRC_START 0x80000000
#define SRC_BUSY 0x80000000
#define SRC_OPCODE 0x60000000
#define SRC_SIZE_SHIFT 1
#define SRC_PRESENT 0x00000001
-
+/* Fields in pmucontrol */
#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 /* rev 2 */
+#define PCTL_NOILP_ON_WAIT 0x00000200 /* rev 1 */
#define PCTL_HT_REQ_EN 0x00000100
#define PCTL_ALP_REQ_EN 0x00000080
#define PCTL_XTALFREQ_MASK 0x0000007c
#define PCTL_ILP_DIV_EN 0x00000002
#define PCTL_LPO_SEL 0x00000001
-
+/* Retention Control */
#define PMU_RCTL_CLK_DIV_SHIFT 0
#define PMU_RCTL_CHAIN_LEN_SHIFT 12
#define PMU_RCTL_MACPHY_DISABLE_SHIFT 26
#define PMU_RCTL_MEMRETSLP_LOG_SHIFT 29
#define PMU_RCTL_MEMRETSLP_LOG_MASK (1 << 29)
-
+/* Retention Group Control */
#define PMU_RCTLGRP_CHAIN_LEN_SHIFT 0
#define PMU_RCTLGRP_RMODE_ENABLE_SHIFT 14
#define PMU_RCTLGRP_RMODE_ENABLE_MASK (1 << 14)
#define PMU_RCTLGRP_DFT_ENABLE_MASK (1 << 15)
#define PMU_RCTLGRP_NSRST_DISABLE_SHIFT 16
#define PMU_RCTLGRP_NSRST_DISABLE_MASK (1 << 16)
-
+/* Retention Group Control special for 4334 */
#define PMU4334_RCTLGRP_CHAIN_LEN_GRP0 338
#define PMU4334_RCTLGRP_CHAIN_LEN_GRP1 315
-
+/* Retention Group Control special for 43341 */
#define PMU43341_RCTLGRP_CHAIN_LEN_GRP0 366
#define PMU43341_RCTLGRP_CHAIN_LEN_GRP1 330
-
+/* Fields in clkstretch */
#define CSTRETCH_HT 0xffff0000
#define CSTRETCH_ALP 0x0000ffff
-
+/* gpiotimerval */
#define GPIO_ONTIME_SHIFT 16
-
-#define CN_N1_MASK 0x3f
-#define CN_N2_MASK 0x3f00
+/* clockcontrol_n */
+#define CN_N1_MASK 0x3f /* n1 control */
+#define CN_N2_MASK 0x3f00 /* n2 control */
#define CN_N2_SHIFT 8
-#define CN_PLLC_MASK 0xf0000
+#define CN_PLLC_MASK 0xf0000 /* pll control */
#define CN_PLLC_SHIFT 16
-
-#define CC_M1_MASK 0x3f
-#define CC_M2_MASK 0x3f00
+/* clockcontrol_sb/pci/uart */
+#define CC_M1_MASK 0x3f /* m1 control */
+#define CC_M2_MASK 0x3f00 /* m2 control */
#define CC_M2_SHIFT 8
-#define CC_M3_MASK 0x3f0000
+#define CC_M3_MASK 0x3f0000 /* m3 control */
#define CC_M3_SHIFT 16
-#define CC_MC_MASK 0x1f000000
+#define CC_MC_MASK 0x1f000000 /* mux control */
#define CC_MC_SHIFT 24
-
-#define CC_F6_2 0x02
-#define CC_F6_3 0x03
-#define CC_F6_4 0x05
+/* N3M Clock control magic field values */
+#define CC_F6_2 0x02 /* A factor of 2 in */
+#define CC_F6_3 0x03 /* 6-bit fields like */
+#define CC_F6_4 0x05 /* N1, M1 or M3 */
#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 /* 5-bit fields get this added */
#define CC_MC_BYPASS 0x08
#define CC_MC_M1 0x04
#define CC_MC_M1M2M3 0x01
#define CC_MC_M1M3 0x11
-
-#define CC_T2_BIAS 2
-#define CC_T2M2_BIAS 3
+/* Type 2 Clock control magic field values */
+#define CC_T2_BIAS 2 /* n1, n2, m1 & m3 bias */
+#define CC_T2M2_BIAS 3 /* m2 bias */
#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
+/* Type 6 Clock control magic field values */
+#define CC_T6_MMASK 1 /* bits of interest in m */
+#define CC_T6_M0 120000000 /* sb clock for m = 0 */
+#define CC_T6_M1 100000000 /* sb clock for m = 1 */
#define SB2MIPS_T6(sb) (2 * (sb))
+/* Common clock base */
+#define CC_CLOCK_BASE1 24000000 /* Half the clock freq */
+#define CC_CLOCK_BASE2 12500000 /* Alternate crystal on some PLLs */
-#define CC_CLOCK_BASE1 24000000
-#define CC_CLOCK_BASE2 12500000
-
-
+/* Clock control values for 200MHz in 5350 */
#define CLKC_5350_N 0x0311
#define CLKC_5350_M 0x04020009
-
-#define FLASH_NONE 0x000
-#define SFLASH_ST 0x100
-#define SFLASH_AT 0x200
+/* Flash types in the chipcommon capabilities register */
+#define FLASH_NONE 0x000 /* No flash */
+#define SFLASH_ST 0x100 /* ST serial flash */
+#define SFLASH_AT 0x200 /* Atmel serial flash */
#define NFLASH 0x300
-#define PFLASH 0x700
+#define PFLASH 0x700 /* Parallel flash */
#define QSPIFLASH_ST 0x800
#define QSPIFLASH_AT 0x900
-
-#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
-
-
-
+/* Bits in the ExtBus config registers */
+#define CC_CFG_EN 0x0001 /* Enable */
+#define CC_CFG_EM_MASK 0x000e /* Extif Mode */
+#define CC_CFG_EM_ASYNC 0x0000 /* Async/Parallel flash */
+#define CC_CFG_EM_SYNC 0x0002 /* Synchronous */
+#define CC_CFG_EM_PCMCIA 0x0004 /* PCMCIA */
+#define CC_CFG_EM_IDE 0x0006 /* IDE */
+#define CC_CFG_DS 0x0010 /* Data size, 0=8bit, 1=16bit */
+#define CC_CFG_CD_MASK 0x00e0 /* Sync: Clock divisor, rev >= 20 */
+#define CC_CFG_CE 0x0100 /* Sync: Clock enable, rev >= 20 */
+#define CC_CFG_SB 0x0200 /* Sync: Size/Bytestrobe, rev >= 20 */
+#define CC_CFG_IS 0x0400 /* Extif Sync Clk Select, rev >= 20 */
+
+/* ExtBus address space */
+#define CC_EB_BASE 0x1a000000 /* Chipc ExtBus base address */
+#define CC_EB_PCMCIA_MEM 0x1a000000 /* PCMCIA 0 memory base address */
+#define CC_EB_PCMCIA_IO 0x1a200000 /* PCMCIA 0 I/O base address */
+#define CC_EB_PCMCIA_CFG 0x1a400000 /* PCMCIA 0 config base address */
+#define CC_EB_IDE 0x1a800000 /* IDE memory base */
+#define CC_EB_PCMCIA1_MEM 0x1a800000 /* PCMCIA 1 memory base address */
+#define CC_EB_PCMCIA1_IO 0x1aa00000 /* PCMCIA 1 I/O base address */
+#define CC_EB_PCMCIA1_CFG 0x1ac00000 /* PCMCIA 1 config base address */
+#define CC_EB_PROGIF 0x1b000000 /* ProgIF Async/Sync base address */
+
+
+/* Start/busy bit in flashcontrol */
#define SFLASH_OPCODE 0x000000ff
#define SFLASH_ACTION 0x00000700
-#define SFLASH_CS_ACTIVE 0x00001000
+#define SFLASH_CS_ACTIVE 0x00001000 /* Chip Select Active, rev >= 20 */
#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_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_ST_WIP 0x01
-#define SFLASH_ST_WEL 0x02
-#define SFLASH_ST_BP_MASK 0x1c
+/* flashcontrol action codes */
+#define SFLASH_ACT_OPONLY 0x0000 /* Issue opcode only */
+#define SFLASH_ACT_OP1D 0x0100 /* opcode + 1 data byte */
+#define SFLASH_ACT_OP3A 0x0200 /* opcode + 3 addr bytes */
+#define SFLASH_ACT_OP3A1D 0x0300 /* opcode + 3 addr & 1 data bytes */
+#define SFLASH_ACT_OP3A4D 0x0400 /* opcode + 3 addr & 4 data bytes */
+#define SFLASH_ACT_OP3A4X4D 0x0500 /* opcode + 3 addr, 4 don't care & 4 data bytes */
+#define SFLASH_ACT_OP3A1X4D 0x0700 /* opcode + 3 addr, 1 don't care & 4 data bytes */
+
+/* flashcontrol action+opcodes for ST flashes */
+#define SFLASH_ST_WREN 0x0006 /* Write Enable */
+#define SFLASH_ST_WRDIS 0x0004 /* Write Disable */
+#define SFLASH_ST_RDSR 0x0105 /* Read Status Register */
+#define SFLASH_ST_WRSR 0x0101 /* Write Status Register */
+#define SFLASH_ST_READ 0x0303 /* Read Data Bytes */
+#define SFLASH_ST_PP 0x0302 /* Page Program */
+#define SFLASH_ST_SE 0x02d8 /* Sector Erase */
+#define SFLASH_ST_BE 0x00c7 /* Bulk Erase */
+#define SFLASH_ST_DP 0x00b9 /* Deep Power-down */
+#define SFLASH_ST_RES 0x03ab /* Read Electronic Signature */
+#define SFLASH_ST_CSA 0x1000 /* Keep chip select asserted */
+#define SFLASH_ST_SSE 0x0220 /* Sub-sector Erase */
+
+#define SFLASH_MXIC_RDID 0x0390 /* Read Manufacture ID */
+#define SFLASH_MXIC_MFID 0xc2 /* MXIC Manufacture ID */
+
+/* Status register bits for ST flashes */
+#define SFLASH_ST_WIP 0x01 /* Write In Progress */
+#define SFLASH_ST_WEL 0x02 /* Write Enable Latch */
+#define SFLASH_ST_BP_MASK 0x1c /* Block Protect */
#define SFLASH_ST_BP_SHIFT 2
-#define SFLASH_ST_SRWD 0x80
-
+#define SFLASH_ST_SRWD 0x80 /* Status Register Write Disable */
+/* flashcontrol action+opcodes for Atmel flashes */
#define SFLASH_AT_READ 0x07e8
#define SFLASH_AT_PAGE_READ 0x07d2
#define SFLASH_AT_BUF1_READ
#define SFLASH_AT_BUF1_REPROGRAM 0x0258
#define SFLASH_AT_BUF2_REPROGRAM 0x0259
-
+/* Status register bits for Atmel flashes */
#define SFLASH_AT_READY 0x80
#define SFLASH_AT_MISMATCH 0x40
#define SFLASH_AT_ID_MASK 0x38
#define SFLASH_AT_ID_SHIFT 3
-
+/* SPI register bits, corerev >= 37 */
#define GSIO_START 0x80000000
#define GSIO_BUSY GSIO_START
+/*
+ * These are the UART port assignments, expressed as offsets from the base
+ * register. These assignments should hold for any serial port based on
+ * a 8250, 16450, or 16550(A).
+ */
-
-#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 /* In: Receive buffer (DLAB=0) */
+#define UART_TX 0 /* Out: Transmit buffer (DLAB=0) */
+#define UART_DLL 0 /* Out: Divisor Latch Low (DLAB=1) */
+#define UART_IER 1 /* In/Out: Interrupt Enable Register (DLAB=0) */
+#define UART_DLM 1 /* Out: Divisor Latch High (DLAB=1) */
+#define UART_IIR 2 /* In: Interrupt Identity Register */
+#define UART_FCR 2 /* Out: FIFO Control Register */
+#define UART_LCR 3 /* Out: Line Control Register */
+#define UART_MCR 4 /* Out: Modem Control Register */
+#define UART_LSR 5 /* In: Line Status Register */
+#define UART_MSR 6 /* In: Modem Status Register */
+#define UART_SCR 7 /* I/O: Scratch Register */
+#define UART_LCR_DLAB 0x80 /* Divisor latch access bit */
+#define UART_LCR_WLEN8 0x03 /* Word length: 8 bits */
+#define UART_MCR_OUT2 0x08 /* MCR GPIO out 2 */
+#define UART_MCR_LOOP 0x10 /* Enable loopback test mode */
+#define UART_LSR_RX_FIFO 0x80 /* Receive FIFO error */
+#define UART_LSR_TDHR 0x40 /* Data-hold-register empty */
+#define UART_LSR_THRE 0x20 /* Transmit-hold-register empty */
+#define UART_LSR_BREAK 0x10 /* Break interrupt */
+#define UART_LSR_FRAMING 0x08 /* Framing error */
+#define UART_LSR_PARITY 0x04 /* Parity error */
+#define UART_LSR_OVERRUN 0x02 /* Overrun error */
+#define UART_LSR_RXRDY 0x01 /* Receiver ready */
+#define UART_FCR_FIFO_ENABLE 1 /* FIFO control register bit controlling FIFO enable/disable */
+
+/* Interrupt Identity Register (IIR) bits */
+#define UART_IIR_FIFO_MASK 0xc0 /* IIR FIFO disable/enabled mask */
+#define UART_IIR_INT_MASK 0xf /* IIR interrupt ID source */
+#define UART_IIR_MDM_CHG 0x0 /* Modem status changed */
+#define UART_IIR_NOINT 0x1 /* No interrupt pending */
+#define UART_IIR_THRE 0x2 /* THR empty */
+#define UART_IIR_RCVD_DATA 0x4 /* Received data available */
+#define UART_IIR_RCVR_STATUS 0x6 /* Receiver status */
+#define UART_IIR_CHAR_TIME 0xc /* Character time */
+
+/* Interrupt Enable Register (IER) bits */
+#define UART_IER_EDSSI 8 /* enable modem status interrupt */
+#define UART_IER_ELSI 4 /* enable receiver line status interrupt */
+#define UART_IER_ETBEI 2 /* enable transmitter holding register empty interrupt */
+#define UART_IER_ERBFI 1 /* enable data available interrupt */
+
+/* pmustatus */
#define PST_EXTLPOAVAIL 0x0100
#define PST_WDRESET 0x0080
#define PST_INTPEND 0x0040
#define PST_HTAVAIL 0x0004
#define PST_RESINIT 0x0003
-
+/* pmucapabilities */
#define PCAP_REV_MASK 0x000000ff
#define PCAP_RC_MASK 0x00001f00
#define PCAP_RC_SHIFT 8
#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 /* PMU corerev >= 5 */
#define PCAP5_PC_SHIFT 17
#define PCAP5_VC_MASK 0x07c00000
#define PCAP5_VC_SHIFT 22
#define PCAP5_CC_MASK 0xf8000000
#define PCAP5_CC_SHIFT 27
-
-
+/* PMU Resource Request Timer registers */
+/* This is based on PmuRev0 */
#define PRRT_TIME_MASK 0x03ff
#define PRRT_INTEN 0x0400
#define PRRT_REQ_ACTIVE 0x0800
#define PRRT_HT_REQ 0x2000
#define PRRT_HQ_REQ 0x4000
-
+/* PMU resource bit position */
#define PMURES_BIT(bit) (1 << (bit))
-
+/* PMU resource number limit */
#define PMURES_MAX_RESNUM 30
-
+/* PMU chip control0 register */
#define PMU_CHIPCTL0 0
+#define PMU43143_CC0_SDIO_DRSTR_OVR (1 << 31) /* sdio drive strength override enable */
-
+/* clock req types */
#define PMU_CC1_CLKREQ_TYPE_SHIFT 19
#define PMU_CC1_CLKREQ_TYPE_MASK (1 << PMU_CC1_CLKREQ_TYPE_SHIFT)
#define CLKREQ_TYPE_CONFIG_OPENDRAIN 0
#define CLKREQ_TYPE_CONFIG_PUSHPULL 1
-
+/* PMU chip control1 register */
#define PMU_CHIPCTL1 1
#define PMU_CC1_RXC_DLL_BYPASS 0x00010000
#define PMU_CC1_SW_TYPE_EPHYRMII 0x00000080
#define PMU_CC1_SW_TYPE_RGMII 0x000000c0
-
+/* PMU chip control2 register */
#define PMU_CHIPCTL2 2
-
+/* PMU chip control3 register */
#define PMU_CHIPCTL3 3
#define PMU_CC3_ENABLE_SDIO_WAKEUP_SHIFT 19
#define PMU_CC3_ENABLE_RF_SHIFT 22
#define PMU_CC3_RF_DISABLE_IVALUE_SHIFT 23
+/* PMU chip control5 register */
+#define PMU_CHIPCTL5 5
-
-
+/* PMU corerev and chip specific PLL controls.
+ * PMU<rev>_PLL<num>_XX where <rev> is PMU corerev and <num> is an arbitrary number
+ * to differentiate different PLLs controlled by the same PMU rev.
+ */
+/* pllcontrol registers */
+/* PDIV, div_phy, div_arm, div_adc, dith_sel, ioff, kpd_scale, lsb_sel, mash_sel, lf_c & lf_r */
#define PMU0_PLL0_PLLCTL0 0
#define PMU0_PLL0_PC0_PDIV_MASK 1
#define PMU0_PLL0_PC0_PDIV_FREQ 25000
#define PMU0_PLL0_PC0_DIV_ARM_SHIFT 3
#define PMU0_PLL0_PC0_DIV_ARM_BASE 8
-
+/* PC0_DIV_ARM for PLLOUT_ARM */
#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 /* Default */
#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
#define PMU0_PLL0_PC0_DIV_ARM_58_6MHZ 7
-
+/* Wildcard base, stop_mod, en_lf_tp, en_cal & lf_r2 */
#define PMU0_PLL0_PLLCTL1 1
#define PMU0_PLL0_PC1_WILD_INT_MASK 0xf0000000
#define PMU0_PLL0_PC1_WILD_INT_SHIFT 28
#define PMU0_PLL0_PC1_WILD_FRAC_SHIFT 8
#define PMU0_PLL0_PC1_STOP_MOD 0x00000040
-
+/* Wildcard base, vco_calvar, vco_swc, vco_var_selref, vso_ical & vco_sel_avdd */
#define PMU0_PLL0_PLLCTL2 2
#define PMU0_PLL0_PC2_WILD_INT_MASK 0xf
#define PMU0_PLL0_PC2_WILD_INT_SHIFT 4
-
-
+/* pllcontrol registers */
+/* ndiv_pwrdn, pwrdn_ch<x>, refcomp_pwrdn, dly_ch<x>, p1div, p2div, _bypass_sdmod */
#define PMU1_PLL0_PLLCTL0 0
#define PMU1_PLL0_PC0_P1DIV_MASK 0x00f00000
#define PMU1_PLL0_PC0_P1DIV_SHIFT 20
#define PMU1_PLL0_PC0_P2DIV_MASK 0x0f000000
#define PMU1_PLL0_PC0_P2DIV_SHIFT 24
-
+/* m<x>div */
#define PMU1_PLL0_PLLCTL1 1
#define PMU1_PLL0_PC1_M1DIV_MASK 0x000000ff
#define PMU1_PLL0_PC1_M1DIV_SHIFT 0
#define DOT11MAC_880MHZ_CLK_DIVISOR_MASK (0xFF << DOT11MAC_880MHZ_CLK_DIVISOR_SHIFT)
#define DOT11MAC_880MHZ_CLK_DIVISOR_VAL (0xE << DOT11MAC_880MHZ_CLK_DIVISOR_SHIFT)
-
+/* m<x>div, ndiv_dither_mfb, ndiv_mode, ndiv_int */
#define PMU1_PLL0_PLLCTL2 2
#define PMU1_PLL0_PC2_M5DIV_MASK 0x000000ff
#define PMU1_PLL0_PC2_M5DIV_SHIFT 0
#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 /* recommended for 4319 */
#define PMU1_PLL0_PC2_NDIV_INT_MASK 0x1ff00000
#define PMU1_PLL0_PC2_NDIV_INT_SHIFT 20
-
+/* ndiv_frac */
#define PMU1_PLL0_PLLCTL3 3
#define PMU1_PLL0_PC3_NDIV_FRAC_MASK 0x00ffffff
#define PMU1_PLL0_PC3_NDIV_FRAC_SHIFT 0
-
+/* pll_ctrl */
#define PMU1_PLL0_PLLCTL4 4
-
+/* pll_ctrl, vco_rng, clkdrive_ch<x> */
#define PMU1_PLL0_PLLCTL5 5
#define PMU1_PLL0_PC5_CLK_DRV_MASK 0xffffff00
#define PMU1_PLL0_PC5_CLK_DRV_SHIFT 8
-
+/* PMU rev 2 control words */
#define PMU2_PHY_PLL_PLLCTL 4
#define PMU2_SI_PLL_PLLCTL 10
-
-
-
+/* PMU rev 2 */
+/* pllcontrol registers */
+/* ndiv_pwrdn, pwrdn_ch<x>, refcomp_pwrdn, dly_ch<x>, p1div, p2div, _bypass_sdmod */
#define PMU2_PLL_PLLCTL0 0
#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_SHIFT 24
-
+/* m<x>div */
#define PMU2_PLL_PLLCTL1 1
#define PMU2_PLL_PC1_M1DIV_MASK 0x000000ff
#define PMU2_PLL_PC1_M1DIV_SHIFT 0
#define PMU2_PLL_PC1_M4DIV_MASK 0xff000000
#define PMU2_PLL_PC1_M4DIV_SHIFT 24
-
+/* m<x>div, ndiv_dither_mfb, ndiv_mode, ndiv_int */
#define PMU2_PLL_PLLCTL2 2
#define PMU2_PLL_PC2_M5DIV_MASK 0x000000ff
#define PMU2_PLL_PC2_M5DIV_SHIFT 0
#define PMU2_PLL_PC2_NDIV_INT_MASK 0x1ff00000
#define PMU2_PLL_PC2_NDIV_INT_SHIFT 20
-
+/* ndiv_frac */
#define PMU2_PLL_PLLCTL3 3
#define PMU2_PLL_PC3_NDIV_FRAC_MASK 0x00ffffff
#define PMU2_PLL_PC3_NDIV_FRAC_SHIFT 0
-
+/* pll_ctrl */
#define PMU2_PLL_PLLCTL4 4
-
+/* pll_ctrl, vco_rng, clkdrive_ch<x> */
#define PMU2_PLL_PLLCTL5 5
#define PMU2_PLL_PC5_CLKDRIVE_CH1_MASK 0x00000f00
#define PMU2_PLL_PC5_CLKDRIVE_CH1_SHIFT 8
#define PMU2_PLL_PC5_CLKDRIVE_CH6_MASK 0xf0000000
#define PMU2_PLL_PC5_CLKDRIVE_CH6_SHIFT 28
-
+/* PMU rev 5 (& 6) */
#define PMU5_PLL_P1P2_OFF 0
#define PMU5_PLL_P1_MASK 0x0f000000
#define PMU5_PLL_P1_SHIFT 24
#define PMU5_PLL_PCHI_OFF 5
#define PMU5_PLL_PCHI_MASK 0x0000003f
-
+/* pmu XtalFreqRatio */
#define PMU_XTALFREQ_REG_ILPCTR_MASK 0x00001FFF
#define PMU_XTALFREQ_REG_MEASURE_MASK 0x80000000
#define PMU_XTALFREQ_REG_MEASURE_SHIFT 31
-
+/* Divider allocation in 4716/47162/5356/5357 */
#define PMU5_MAINPLL_CPU 1
#define PMU5_MAINPLL_MEM 2
#define PMU5_MAINPLL_SI 3
-
+/* 4706 PMU */
#define PMU4706_MAINPLL_PLL0 0
-#define PMU6_4706_PROCPLL_OFF 4
+#define PMU6_4706_PROCPLL_OFF 4 /* The CPU PLL */
#define PMU6_4706_PROC_P2DIV_MASK 0x000f0000
#define PMU6_4706_PROC_P2DIV_SHIFT 16
#define PMU6_4706_PROC_P1DIV_MASK 0x0000f000
#define PMU7_PLL_PLLCTL11_MASK 0xffffff00
#define PMU7_PLL_PLLCTL11_VAL 0x22222200
-
+/* PMU rev 15 */
#define PMU15_PLL_PLLCTL0 0
#define PMU15_PLL_PC0_CLKSEL_MASK 0x00000003
#define PMU15_PLL_PC0_CLKSEL_SHIFT 0
#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 /* 96 Mhz */
+#define PMU15_ARM_98MHZ 98400000 /* 98.4 Mhz */
+#define PMU15_ARM_97MHZ 97000000 /* 97 Mhz */
#define PMU17_PLLCTL2_NDIVTYPE_MASK 0x00000070
#define PMU17_PLLCTL0_BBPLL_DRST 3
#define PMU17_PLLCTL0_BBPLL_DISBL_CLK 8
-
+/* PLL usage in 4716/47162 */
#define PMU4716_MAINPLL_PLL0 12
-
+/* PLL usage in 5356/5357 */
#define PMU5356_MAINPLL_PLL0 0
#define PMU5357_MAINPLL_PLL0 0
-
+/* 4716/47162 resources */
#define RES4716_PROC_PLL_ON 0x00000040
#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 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
-
-
+/* 4716/4717/4718 Chip specific ChipControl register bits */
+#define CCTRL_471X_I2S_PINS_ENABLE 0x0080 /* I2S pins off by default, shared w/ pflash */
+
+/* 5357 Chip specific ChipControl register bits */
+/* 2nd - 32-bit reg */
+#define CCTRL_5357_I2S_PINS_ENABLE 0x00040000 /* I2S pins enable */
+#define CCTRL_5357_I2CSPI_PINS_ENABLE 0x00080000 /* I2C/SPI pins enable */
+
+/* 5354 resources */
+#define RES5354_EXT_SWITCHER_PWM 0 /* 0x00001 */
+#define RES5354_BB_SWITCHER_PWM 1 /* 0x00002 */
+#define RES5354_BB_SWITCHER_BURST 2 /* 0x00004 */
+#define RES5354_BB_EXT_SWITCHER_BURST 3 /* 0x00008 */
+#define RES5354_ILP_REQUEST 4 /* 0x00010 */
+#define RES5354_RADIO_SWITCHER_PWM 5 /* 0x00020 */
+#define RES5354_RADIO_SWITCHER_BURST 6 /* 0x00040 */
+#define RES5354_ROM_SWITCH 7 /* 0x00080 */
+#define RES5354_PA_REF_LDO 8 /* 0x00100 */
+#define RES5354_RADIO_LDO 9 /* 0x00200 */
+#define RES5354_AFE_LDO 10 /* 0x00400 */
+#define RES5354_PLL_LDO 11 /* 0x00800 */
+#define RES5354_BG_FILTBYP 12 /* 0x01000 */
+#define RES5354_TX_FILTBYP 13 /* 0x02000 */
+#define RES5354_RX_FILTBYP 14 /* 0x04000 */
+#define RES5354_XTAL_PU 15 /* 0x08000 */
+#define RES5354_XTAL_EN 16 /* 0x10000 */
+#define RES5354_BB_PLL_FILTBYP 17 /* 0x20000 */
+#define RES5354_RF_PLL_FILTBYP 18 /* 0x40000 */
+#define RES5354_BB_PLL_PU 19 /* 0x80000 */
+
+/* 5357 Chip specific ChipControl register bits */
+#define CCTRL5357_EXTPA (1<<14) /* extPA in ChipControl 1, bit 14 */
+#define CCTRL5357_ANT_MUX_2o3 (1<<15) /* 2o3 in ChipControl 1, bit 15 */
+#define CCTRL5357_NFLASH (1<<16) /* Nandflash in ChipControl 1, bit 16 */
+
+/* 43217 Chip specific ChipControl register bits */
+#define CCTRL43217_EXTPA_C0 (1<<13) /* core0 extPA in ChipControl 1, bit 13 */
+#define CCTRL43217_EXTPA_C1 (1<<8) /* core1 extPA in ChipControl 1, bit 8 */
+
+/* 43228 Chip specific ChipControl register bits */
+#define CCTRL43228_EXTPA_C0 (1<<14) /* core1 extPA in ChipControl 1, bit 14 */
+#define CCTRL43228_EXTPA_C1 (1<<9) /* core0 extPA in ChipControl 1, bit 1 */
+
+/* 4328 resources */
+#define RES4328_EXT_SWITCHER_PWM 0 /* 0x00001 */
+#define RES4328_BB_SWITCHER_PWM 1 /* 0x00002 */
+#define RES4328_BB_SWITCHER_BURST 2 /* 0x00004 */
+#define RES4328_BB_EXT_SWITCHER_BURST 3 /* 0x00008 */
+#define RES4328_ILP_REQUEST 4 /* 0x00010 */
+#define RES4328_RADIO_SWITCHER_PWM 5 /* 0x00020 */
+#define RES4328_RADIO_SWITCHER_BURST 6 /* 0x00040 */
+#define RES4328_ROM_SWITCH 7 /* 0x00080 */
+#define RES4328_PA_REF_LDO 8 /* 0x00100 */
+#define RES4328_RADIO_LDO 9 /* 0x00200 */
+#define RES4328_AFE_LDO 10 /* 0x00400 */
+#define RES4328_PLL_LDO 11 /* 0x00800 */
+#define RES4328_BG_FILTBYP 12 /* 0x01000 */
+#define RES4328_TX_FILTBYP 13 /* 0x02000 */
+#define RES4328_RX_FILTBYP 14 /* 0x04000 */
+#define RES4328_XTAL_PU 15 /* 0x08000 */
+#define RES4328_XTAL_EN 16 /* 0x10000 */
+#define RES4328_BB_PLL_FILTBYP 17 /* 0x20000 */
+#define RES4328_RF_PLL_FILTBYP 18 /* 0x40000 */
+#define RES4328_BB_PLL_PU 19 /* 0x80000 */
+
+/* 4325 A0/A1 resources */
+#define RES4325_BUCK_BOOST_BURST 0 /* 0x00000001 */
+#define RES4325_CBUCK_BURST 1 /* 0x00000002 */
+#define RES4325_CBUCK_PWM 2 /* 0x00000004 */
+#define RES4325_CLDO_CBUCK_BURST 3 /* 0x00000008 */
+#define RES4325_CLDO_CBUCK_PWM 4 /* 0x00000010 */
+#define RES4325_BUCK_BOOST_PWM 5 /* 0x00000020 */
+#define RES4325_ILP_REQUEST 6 /* 0x00000040 */
+#define RES4325_ABUCK_BURST 7 /* 0x00000080 */
+#define RES4325_ABUCK_PWM 8 /* 0x00000100 */
+#define RES4325_LNLDO1_PU 9 /* 0x00000200 */
+#define RES4325_OTP_PU 10 /* 0x00000400 */
+#define RES4325_LNLDO3_PU 11 /* 0x00000800 */
+#define RES4325_LNLDO4_PU 12 /* 0x00001000 */
+#define RES4325_XTAL_PU 13 /* 0x00002000 */
+#define RES4325_ALP_AVAIL 14 /* 0x00004000 */
+#define RES4325_RX_PWRSW_PU 15 /* 0x00008000 */
+#define RES4325_TX_PWRSW_PU 16 /* 0x00010000 */
+#define RES4325_RFPLL_PWRSW_PU 17 /* 0x00020000 */
+#define RES4325_LOGEN_PWRSW_PU 18 /* 0x00040000 */
+#define RES4325_AFE_PWRSW_PU 19 /* 0x00080000 */
+#define RES4325_BBPLL_PWRSW_PU 20 /* 0x00100000 */
+#define RES4325_HT_AVAIL 21 /* 0x00200000 */
+
+/* 4325 B0/C0 resources */
+#define RES4325B0_CBUCK_LPOM 1 /* 0x00000002 */
+#define RES4325B0_CBUCK_BURST 2 /* 0x00000004 */
+#define RES4325B0_CBUCK_PWM 3 /* 0x00000008 */
+#define RES4325B0_CLDO_PU 4 /* 0x00000010 */
+
+/* 4325 C1 resources */
+#define RES4325C1_LNLDO2_PU 12 /* 0x00001000 */
+
+/* 4325 chip-specific ChipStatus register bits */
#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 /* OTP is powered up, use def. CIS, no SPROM */
+#define CST4325_SPROM_SEL 1 /* OTP is powered up, SPROM is present */
+#define CST4325_OTP_SEL 2 /* OTP is powered up, no SPROM */
+#define CST4325_OTP_PWRDN 3 /* OTP is powered down, SPROM is present */
#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_MASK 0x00000200 /* 1 for 2b, 0 for to 2a */
#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 RES4329_RESERVED0 0 /* 0x00000001 */
+#define RES4329_CBUCK_LPOM 1 /* 0x00000002 */
+#define RES4329_CBUCK_BURST 2 /* 0x00000004 */
+#define RES4329_CBUCK_PWM 3 /* 0x00000008 */
+#define RES4329_CLDO_PU 4 /* 0x00000010 */
+#define RES4329_PALDO_PU 5 /* 0x00000020 */
+#define RES4329_ILP_REQUEST 6 /* 0x00000040 */
+#define RES4329_RESERVED7 7 /* 0x00000080 */
+#define RES4329_RESERVED8 8 /* 0x00000100 */
+#define RES4329_LNLDO1_PU 9 /* 0x00000200 */
+#define RES4329_OTP_PU 10 /* 0x00000400 */
+#define RES4329_RESERVED11 11 /* 0x00000800 */
+#define RES4329_LNLDO2_PU 12 /* 0x00001000 */
+#define RES4329_XTAL_PU 13 /* 0x00002000 */
+#define RES4329_ALP_AVAIL 14 /* 0x00004000 */
+#define RES4329_RX_PWRSW_PU 15 /* 0x00008000 */
+#define RES4329_TX_PWRSW_PU 16 /* 0x00010000 */
+#define RES4329_RFPLL_PWRSW_PU 17 /* 0x00020000 */
+#define RES4329_LOGEN_PWRSW_PU 18 /* 0x00040000 */
+#define RES4329_AFE_PWRSW_PU 19 /* 0x00080000 */
+#define RES4329_BBPLL_PWRSW_PU 20 /* 0x00100000 */
+#define RES4329_HT_AVAIL 21 /* 0x00200000 */
#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 /* OTP is powered up, use def. CIS, no SPROM */
+#define CST4329_SPROM_SEL 1 /* OTP is powered up, SPROM is present */
+#define CST4329_OTP_SEL 2 /* OTP is powered up, no SPROM */
+#define CST4329_OTP_PWRDN 3 /* OTP is powered down, SPROM is present */
#define CST4329_SPI_SDIO_MODE_MASK 0x00000004
#define CST4329_SPI_SDIO_MODE_SHIFT 2
-
+/* 4312 chip-specific ChipStatus register bits */
#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 /* OTP is powered up, use def. CIS, no SPROM */
+#define CST4312_SPROM_SEL 1 /* OTP is powered up, SPROM is present */
+#define CST4312_OTP_SEL 2 /* OTP is powered up, no SPROM */
+#define CST4312_OTP_BAD 3 /* OTP is broken, SPROM is present */
+
+/* 4312 resources (all PMU chips with little memory constraint) */
+#define RES4312_SWITCHER_BURST 0 /* 0x00000001 */
+#define RES4312_SWITCHER_PWM 1 /* 0x00000002 */
+#define RES4312_PA_REF_LDO 2 /* 0x00000004 */
+#define RES4312_CORE_LDO_BURST 3 /* 0x00000008 */
+#define RES4312_CORE_LDO_PWM 4 /* 0x00000010 */
+#define RES4312_RADIO_LDO 5 /* 0x00000020 */
+#define RES4312_ILP_REQUEST 6 /* 0x00000040 */
+#define RES4312_BG_FILTBYP 7 /* 0x00000080 */
+#define RES4312_TX_FILTBYP 8 /* 0x00000100 */
+#define RES4312_RX_FILTBYP 9 /* 0x00000200 */
+#define RES4312_XTAL_PU 10 /* 0x00000400 */
+#define RES4312_ALP_AVAIL 11 /* 0x00000800 */
+#define RES4312_BB_PLL_FILTBYP 12 /* 0x00001000 */
+#define RES4312_RF_PLL_FILTBYP 13 /* 0x00002000 */
+#define RES4312_HT_AVAIL 14 /* 0x00004000 */
+
+/* 4322 resources */
#define RES4322_RF_LDO 0
#define RES4322_ILP_REQUEST 1
#define RES4322_XTAL_PU 2
#define RES4322_HT_PHY_AVAIL 7
#define RES4322_OTP_PU 8
-
+/* 4322 chip-specific ChipStatus register bits */
#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 /* no OTP, no SPROM */
+#define CST4322_SPROM_PRESENT 1 /* SPROM is present */
+#define CST4322_OTP_PRESENT 2 /* OTP is present */
#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 /* boot from SRAM, ARM in reset */
+#define CST4322_BOOT_FROM_ROM 1 /* boot from ROM */
+#define CST4322_BOOT_FROM_FLASH 2 /* boot from FLASH */
#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 /* ST serial FLASH */
+#define CST4322_FLASH_TYPE_SHIFT_ATMEL 1 /* ATMEL flash */
#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 /* resinitmode: ILP available */
+#define CST4322_RES_INIT_MODE_ILPREQ 1 /* resinitmode: ILP request */
+#define CST4322_RES_INIT_MODE_ALPAVAIL 2 /* resinitmode: ALP available */
+#define CST4322_RES_INIT_MODE_HTAVAIL 3 /* resinitmode: HT available */
#define CST4322_PCIPLLCLK_GATING 0x00010000
#define CST4322_CLK_SWITCH_PCI_TO_ALP 0x00020000
#define CST4322_PCI_CARDBUS_MODE 0x00040000
+/* 43224 chip-specific ChipControl register bits */
+#define CCTRL43224_GPIO_TOGGLE 0x8000 /* gpio[3:0] pins as btcoex or s/w gpio */
+#define CCTRL_43224A0_12MA_LED_DRIVE 0x00F000F0 /* 12 mA drive strength */
+#define CCTRL_43224B0_12MA_LED_DRIVE 0xF0 /* 12 mA drive strength for later 43224s */
-#define CCTRL43224_GPIO_TOGGLE 0x8000
-#define CCTRL_43224A0_12MA_LED_DRIVE 0x00F000F0
-#define CCTRL_43224B0_12MA_LED_DRIVE 0xF0
-
-
+/* 43236 resources */
#define RES43236_REGULATOR 0
#define RES43236_ILP_REQUEST 1
#define RES43236_XTAL_PU 2
#define RES43236_SI_PLL_ON 4
#define RES43236_HT_SI_AVAIL 5
+/* 43236 chip-specific ChipControl register bits */
+#define CCTRL43236_BT_COEXIST (1<<0) /* 0 disable */
+#define CCTRL43236_SECI (1<<1) /* 0 SECI is disabled (JATG functional) */
+#define CCTRL43236_EXT_LNA (1<<2) /* 0 disable */
+#define CCTRL43236_ANT_MUX_2o3 (1<<3) /* 2o3 mux, chipcontrol bit 3 */
+#define CCTRL43236_GSIO (1<<4) /* 0 disable */
-#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)
-
-
+/* 43236 Chip specific ChipStatus register bits */
#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 /* USB/HSIC */
+#define CST43236_BP_CLK 0x00000200 /* 120/96Mbps */
#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 /* boot from SRAM, ARM in reset */
+#define CST43236_BOOT_FROM_ROM 1 /* boot from ROM */
+#define CST43236_BOOT_FROM_FLASH 2 /* boot from FLASH */
#define CST43236_BOOT_FROM_INVALID 3
-
+/* 43237 resources */
#define RES43237_REGULATOR 0
#define RES43237_ILP_REQUEST 1
#define RES43237_XTAL_PU 2
#define RES43237_SI_PLL_ON 4
#define RES43237_HT_SI_AVAIL 5
+/* 43237 chip-specific ChipControl register bits */
+#define CCTRL43237_BT_COEXIST (1<<0) /* 0 disable */
+#define CCTRL43237_SECI (1<<1) /* 0 SECI is disabled (JATG functional) */
+#define CCTRL43237_EXT_LNA (1<<2) /* 0 disable */
+#define CCTRL43237_ANT_MUX_2o3 (1<<3) /* 2o3 mux, chipcontrol bit 3 */
+#define CCTRL43237_GSIO (1<<4) /* 0 disable */
-#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)
-
-
+/* 43237 Chip specific ChipStatus register bits */
#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 /* USB/HSIC */
+#define CST43237_BP_CLK 0x00000200 /* 120/96Mbps */
#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 /* boot from SRAM, ARM in reset */
+#define CST43237_BOOT_FROM_ROM 1 /* boot from ROM */
+#define CST43237_BOOT_FROM_FLASH 2 /* boot from FLASH */
#define CST43237_BOOT_FROM_INVALID 3
-
+/* 43239 resources */
#define RES43239_OTP_PU 9
#define RES43239_MACPHY_CLKAVAIL 23
#define RES43239_HT_AVAIL 24
-
+/* 43239 Chip specific ChipStatus register bits */
#define CST43239_SPROM_MASK 0x00000002
#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)) /* SDIO || gSPI */
+#define CST43239_CHIPMODE_USB20D(cs) (~(cs) & (1 << 15)) /* USB || USBDA */
+#define CST43239_CHIPMODE_SDIO(cs) (((cs) & (1 << 0)) == 0) /* SDIO */
+#define CST43239_CHIPMODE_GSPI(cs) (((cs) & (1 << 0)) == (1 << 0)) /* gSPI */
+/* 4324 resources */
+/* 43242 use same PMU as 4324 */
#define RES4324_LPLDO_PU 0
#define RES4324_RESET_PULLDN_DIS 1
#define RES4324_PMU_BG_PU 2
#define RES4324_HT_AVAIL 29
#define RES4324_MACPHY_CLKAVAIL 30
-
+/* 4324 Chip specific ChipStatus register bits */
#define CST4324_SPROM_MASK 0x00000080
#define CST4324_SFLASH_MASK 0x00400000
#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)) /* SDIO || gSPI */
+#define CST4324_CHIPMODE_USB20D(cs) (((cs) & CST4324_CHIPMODE_MASK) == 0x6) /* USB || USBDA */
+/* 43242 Chip specific ChipStatus register bits */
#define CST43242_SFLASH_MASK 0x00000008
-
+/* 4331 resources */
#define RES4331_REGULATOR 0
#define RES4331_ILP_REQUEST 1
#define RES4331_XTAL_PU 2
#define RES4331_SI_PLL_ON 4
#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
+/* 4331 chip-specific ChipControl register bits */
+#define CCTRL4331_BT_COEXIST (1<<0) /* 0 disable */
+#define CCTRL4331_SECI (1<<1) /* 0 SECI is disabled (JATG functional) */
+#define CCTRL4331_EXT_LNA_G (1<<2) /* 0 disable */
+#define CCTRL4331_SPROM_GPIO13_15 (1<<3) /* sprom/gpio13-15 mux */
+#define CCTRL4331_EXTPA_EN (1<<4) /* 0 ext pa disable, 1 ext pa enabled */
+#define CCTRL4331_GPIOCLK_ON_SPROMCS (1<<5) /* set drive out GPIO_CLK on sprom_cs pin */
+#define CCTRL4331_PCIE_MDIO_ON_SPROMCS (1<<6) /* use sprom_cs pin as PCIE mdio interface */
+#define CCTRL4331_EXTPA_ON_GPIO2_5 (1<<7) /* aband extpa will be at gpio2/5 and sprom_dout */
+#define CCTRL4331_OVR_PIPEAUXCLKEN (1<<8) /* override core control on pipe_AuxClkEnable */
+#define CCTRL4331_OVR_PIPEAUXPWRDOWN (1<<9) /* override core control on pipe_AuxPowerDown */
+#define CCTRL4331_PCIE_AUXCLKEN (1<<10) /* pcie_auxclkenable */
+#define CCTRL4331_PCIE_PIPE_PLLDOWN (1<<11) /* pcie_pipe_pllpowerdown */
+#define CCTRL4331_EXTPA_EN2 (1<<12) /* 0 ext pa disable, 1 ext pa enabled */
+#define CCTRL4331_EXT_LNA_A (1<<13) /* 0 disable */
+#define CCTRL4331_BT_SHD0_ON_GPIO4 (1<<16) /* enable bt_shd0 at gpio4 */
+#define CCTRL4331_BT_SHD1_ON_GPIO5 (1<<17) /* enable bt_shd1 at gpio5 */
+#define CCTRL4331_EXTPA_ANA_EN (1<<24) /* 0 ext pa disable, 1 ext pa enabled */
+
+/* 4331 Chip specific ChipStatus register bits */
+#define CST4331_XTAL_FREQ 0x00000001 /* crystal frequency 20/40Mhz */
#define CST4331_SPROM_OTP_SEL_MASK 0x00000006
#define CST4331_SPROM_OTP_SEL_SHIFT 1
#define CST4331_SPROM_PRESENT 0x00000002
#define CST4331_LDO_RF 0x00000008
#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
+/* 4315 resource */
+#define RES4315_CBUCK_LPOM 1 /* 0x00000002 */
+#define RES4315_CBUCK_BURST 2 /* 0x00000004 */
+#define RES4315_CBUCK_PWM 3 /* 0x00000008 */
+#define RES4315_CLDO_PU 4 /* 0x00000010 */
+#define RES4315_PALDO_PU 5 /* 0x00000020 */
+#define RES4315_ILP_REQUEST 6 /* 0x00000040 */
+#define RES4315_LNLDO1_PU 9 /* 0x00000200 */
+#define RES4315_OTP_PU 10 /* 0x00000400 */
+#define RES4315_LNLDO2_PU 12 /* 0x00001000 */
+#define RES4315_XTAL_PU 13 /* 0x00002000 */
+#define RES4315_ALP_AVAIL 14 /* 0x00004000 */
+#define RES4315_RX_PWRSW_PU 15 /* 0x00008000 */
+#define RES4315_TX_PWRSW_PU 16 /* 0x00010000 */
+#define RES4315_RFPLL_PWRSW_PU 17 /* 0x00020000 */
+#define RES4315_LOGEN_PWRSW_PU 18 /* 0x00040000 */
+#define RES4315_AFE_PWRSW_PU 19 /* 0x00080000 */
+#define RES4315_BBPLL_PWRSW_PU 20 /* 0x00100000 */
+#define RES4315_HT_AVAIL 21 /* 0x00200000 */
+
+/* 4315 chip-specific ChipStatus register bits */
+#define CST4315_SPROM_OTP_SEL_MASK 0x00000003 /* gpio [7:6], SDIO CIS selection */
+#define CST4315_DEFCIS_SEL 0x00000000 /* use default CIS, OTP is powered up */
+#define CST4315_SPROM_SEL 0x00000001 /* use SPROM, OTP is powered up */
+#define CST4315_OTP_SEL 0x00000002 /* use OTP, OTP is powered up */
+#define CST4315_OTP_PWRDN 0x00000003 /* use SPROM, OTP is powered down */
+#define CST4315_SDIO_MODE 0x00000004 /* gpio [8], sdio/usb mode */
#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 /* PALDO is configured with external PNP */
#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
-
-
+/* 4319 resources */
+#define RES4319_CBUCK_LPOM 1 /* 0x00000002 */
+#define RES4319_CBUCK_BURST 2 /* 0x00000004 */
+#define RES4319_CBUCK_PWM 3 /* 0x00000008 */
+#define RES4319_CLDO_PU 4 /* 0x00000010 */
+#define RES4319_PALDO_PU 5 /* 0x00000020 */
+#define RES4319_ILP_REQUEST 6 /* 0x00000040 */
+#define RES4319_LNLDO1_PU 9 /* 0x00000200 */
+#define RES4319_OTP_PU 10 /* 0x00000400 */
+#define RES4319_LNLDO2_PU 12 /* 0x00001000 */
+#define RES4319_XTAL_PU 13 /* 0x00002000 */
+#define RES4319_ALP_AVAIL 14 /* 0x00004000 */
+#define RES4319_RX_PWRSW_PU 15 /* 0x00008000 */
+#define RES4319_TX_PWRSW_PU 16 /* 0x00010000 */
+#define RES4319_RFPLL_PWRSW_PU 17 /* 0x00020000 */
+#define RES4319_LOGEN_PWRSW_PU 18 /* 0x00040000 */
+#define RES4319_AFE_PWRSW_PU 19 /* 0x00080000 */
+#define RES4319_BBPLL_PWRSW_PU 20 /* 0x00100000 */
+#define RES4319_HT_AVAIL 21 /* 0x00200000 */
+
+/* 4319 chip-specific ChipStatus register bits */
#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 /* gpio [7:6], SDIO CIS selection */
#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 /* use default CIS, OTP is powered up */
+#define CST4319_SPROM_SEL 0x00000040 /* use SPROM, OTP is powered up */
+#define CST4319_OTP_SEL 0x00000080 /* use OTP, OTP is powered up */
+#define CST4319_OTP_PWRDN 0x000000c0 /* use SPROM, OTP is powered down */
+#define CST4319_SDIO_USB_MODE 0x00000100 /* gpio [8], sdio/usb mode */
#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 /* PALDO is configured with external PNP */
#define CST4319_CBUCK_MODE_MASK 0x00060000
#define CST4319_CBUCK_MODE_BURST 0x00020000
#define CST4319_CBUCK_MODE_LPBURST 0x00060000
#define CCTL_4319USB_48MHZ_PLL_SEL 1
#define CCTL_4319USB_24MHZ_PLL_SEL 2
-
+/* PMU resources for 4336 */
#define RES4336_CBUCK_LPOM 0
#define RES4336_CBUCK_BURST 1
#define RES4336_CBUCK_LP_PWM 2
#define RES4336_HT_AVAIL 24
#define RES4336_RSVD 25
-
+/* 4336 chip-specific ChipStatus register bits */
#define CST4336_SPI_MODE_MASK 0x00000001
#define CST4336_SPROM_PRESENT 0x00000002
#define CST4336_OTP_PRESENT 0x00000004
#define CST4336_CBUCK_MODE_MASK 0x00000600
#define CST4336_CBUCK_MODE_SHIFT 9
-
+/* 4336 Chip specific PMU ChipControl register bits */
#define PCTL_4336_SERIAL_ENAB (1 << 24)
-
+/* 4330 resources */
#define RES4330_CBUCK_LPOM 0
#define RES4330_CBUCK_BURST 1
#define RES4330_CBUCK_LP_PWM 2
#define RES4330_5gTX_PWRSW_PU 26
#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)
+/* 4330 chip-specific ChipStatus register bits */
+#define CST4330_CHIPMODE_SDIOD(cs) (((cs) & 0x7) < 6) /* SDIO || gSPI */
+#define CST4330_CHIPMODE_USB20D(cs) (((cs) & 0x7) >= 6) /* USB || USBDA */
+#define CST4330_CHIPMODE_SDIO(cs) (((cs) & 0x4) == 0) /* SDIO */
+#define CST4330_CHIPMODE_GSPI(cs) (((cs) & 0x6) == 4) /* gSPI */
+#define CST4330_CHIPMODE_USB(cs) (((cs) & 0x7) == 6) /* USB packet-oriented */
+#define CST4330_CHIPMODE_USBDA(cs) (((cs) & 0x7) == 7) /* USB Direct Access */
#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 /* takes priority over OTP if both set */
#define CST4330_ILPDIV_EN 0x00000100
#define CST4330_LPO_SEL 0x00000200
#define CST4330_RES_INIT_MODE_SHIFT 10
#define SOCDEVRAM_BP_ADDR 0x1E000000
#define SOCDEVRAM_ARM_ADDR 0x00800000
-
+/* 4330 Chip specific PMU ChipControl register bits */
#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
+/* 4330 Chip specific ChipControl register bits */
+#define CCTRL_4330_GPIO_SEL 0x00000001 /* 1=select GPIOs to be muxed out */
+#define CCTRL_4330_ERCX_SEL 0x00000002 /* 1=select ERCX BT coex to be muxed out */
+#define CCTRL_4330_SDIO_HOST_WAKE 0x00000004 /* SDIO: 1=configure GPIO0 for host wake */
+#define CCTRL_4330_JTAG_DISABLE 0x00000008 /* 1=disable JTAG interface on mux'd pins */
#define PMU_VREG0_ADDR 0
#define PMU_VREG0_DISABLE_PULLD_BT_SHIFT 2
#define PMU_VREG4_LPLDO2_1p15V 1
#define PMU_VREG4_LPLDO2_1p20V 2
#define PMU_VREG4_LPLDO2_1p10V 3
-#define PMU_VREG4_LPLDO2_0p90V 4
+#define PMU_VREG4_LPLDO2_0p90V 4 /* 4 - 7 is 0.90V */
#define PMU_VREG4_HSICLDO_BYPASS_SHIFT 27
#define PMU_VREG4_HSICLDO_BYPASS_MASK 0x1
#define PMU_VREG5_HSICDVDD_PD_SHIFT 11
#define PMU_VREG5_HSICDVDD_PD_MASK 0x1
-
+/* 4334 resources */
#define RES4334_LPLDO_PU 0
#define RES4334_RESET_PULLDN_DIS 1
#define RES4334_PMU_BG_PU 2
#define RES4334_HT_AVAIL 29
#define RES4334_MACPHY_CLK_AVAIL 30
-
+/* 4334 chip-specific ChipStatus register bits */
#define CST4334_CHIPMODE_MASK 7
#define CST4334_SDIO_MODE 0x00000000
#define CST4334_SPI_MODE 0x00000004
#define CST4334_RES_INIT_MODE_MASK 0x00000C00
#define CST4334_RES_INIT_MODE_SHIFT 10
-
+/* 4334 Chip specific PMU ChipControl register bits */
#define PCTL_4334_GPIO3_ENAB (1 << 3)
-
+/* 4334 Chip control */
#define CCTRL4334_PMU_WAKEUP_GPIO1 (1 << 0)
#define CCTRL4334_PMU_WAKEUP_HSIC (1 << 1)
#define CCTRL4334_PMU_WAKEUP_AOS (1 << 2)
#define CCTRL4334_HSIC_INBAND_GPIO1 (1 << 4)
#define CCTRL4334_HSIC_LDO_PU (1 << 23)
-
+/* 4334 Chip control 3 */
#define CCTRL4334_BLOCK_EXTRNL_WAKE (1 << 4)
#define CCTRL4334_SAVERESTORE_FIX (1 << 5)
-
+/* 43341 Chip control 3 */
#define CCTRL43341_BLOCK_EXTRNL_WAKE (1 << 13)
#define CCTRL43341_SAVERESTORE_FIX (1 << 14)
#define CCTRL43341_BT_ISO_SEL (1 << 16)
-
-#define CCTRL1_4334_GPIO_SEL (1 << 0)
-#define CCTRL1_4334_ERCX_SEL (1 << 1)
-#define CCTRL1_4334_SDIO_HOST_WAKE (1 << 2)
-#define CCTRL1_4334_JTAG_DISABLE (1 << 3)
-#define CCTRL1_4334_UART_ON_4_5 (1 << 28)
-
-
-#define CCTRL1_4324_GPIO_SEL (1 << 0)
-#define CCTRL1_4324_SDIO_HOST_WAKE (1 << 2)
-
-
-
-#define CST43143_REMAP_TO_ROM (3 << 0)
-#define CST43143_SDIO_EN (1 << 2)
-#define CST43143_SDIO_ISO (1 << 3)
-#define CST43143_USB_CPU_LESS (1 << 4)
-#define CST43143_CBUCK_MODE (3 << 6)
-#define CST43143_POK_CBUCK (1 << 8)
+/* 4334 Chip specific ChipControl1 register bits */
+#define CCTRL1_4334_GPIO_SEL (1 << 0) /* 1=select GPIOs to be muxed out */
+#define CCTRL1_4334_ERCX_SEL (1 << 1) /* 1=select ERCX BT coex to be muxed out */
+#define CCTRL1_4334_SDIO_HOST_WAKE (1 << 2) /* SDIO: 1=configure GPIO0 for host wake */
+#define CCTRL1_4334_JTAG_DISABLE (1 << 3) /* 1=disable JTAG interface on mux'd pins */
+#define CCTRL1_4334_UART_ON_4_5 (1 << 28) /* 1=UART_TX/UART_RX muxed on GPIO_4/5 (4334B0/1) */
+
+/* 4324 Chip specific ChipControl1 register bits */
+#define CCTRL1_4324_GPIO_SEL (1 << 0) /* 1=select GPIOs to be muxed out */
+#define CCTRL1_4324_SDIO_HOST_WAKE (1 << 2) /* SDIO: 1=configure GPIO0 for host wake */
+
+/* 43143 chip-specific ChipStatus register bits based on Confluence documentation */
+/* register contains strap values sampled during POR */
+#define CST43143_REMAP_TO_ROM (3 << 0) /* 00=Boot SRAM, 01=Boot ROM, 10=Boot SFLASH */
+#define CST43143_SDIO_EN (1 << 2) /* 0 = USB Enab, SDIO pins are GPIO or I2S */
+#define CST43143_SDIO_ISO (1 << 3) /* 1 = SDIO isolated */
+#define CST43143_USB_CPU_LESS (1 << 4) /* 1 = CPULess mode Enabled */
+#define CST43143_CBUCK_MODE (3 << 6) /* Indicates what controller mode CBUCK is in */
+#define CST43143_POK_CBUCK (1 << 8) /* 1 = 1.2V CBUCK voltage ready */
#define CST43143_PMU_OVRSPIKE (1 << 9)
#define CST43143_PMU_OVRTEMP (0xF << 10)
#define CST43143_SR_FLL_CAL_DONE (1 << 14)
#define CST43143_USB_PLL_LOCKDET (1 << 15)
#define CST43143_PMU_PLL_LOCKDET (1 << 16)
-#define CST43143_CHIPMODE_SDIOD(cs) (((cs) & CST43143_SDIO_EN) != 0)
-
-
+#define CST43143_CHIPMODE_SDIOD(cs) (((cs) & CST43143_SDIO_EN) != 0) /* SDIO */
+/* 43143 Chip specific ChipControl register bits */
+/* 00: SECI is disabled (JATG functional), 01: 2 wire, 10: 4 wire */
#define CCTRL_43143_SECI (1<<0)
#define CCTRL_43143_BT_LEGACY (1<<1)
-#define CCTRL_43143_I2S_MODE (1<<2)
-#define CCTRL_43143_I2S_MASTER (1<<3)
-#define CCTRL_43143_I2S_FULL (1<<4)
-#define CCTRL_43143_GSIO (1<<5)
-#define CCTRL_43143_RF_SWCTRL_MASK (7<<6)
+#define CCTRL_43143_I2S_MODE (1<<2) /* 0: SDIO enabled */
+#define CCTRL_43143_I2S_MASTER (1<<3) /* 0: I2S MCLK input disabled */
+#define CCTRL_43143_I2S_FULL (1<<4) /* 0: I2S SDIN and SPDIF_TX inputs disabled */
+#define CCTRL_43143_GSIO (1<<5) /* 0: sFlash enabled */
+#define CCTRL_43143_RF_SWCTRL_MASK (7<<6) /* 0: disabled */
#define CCTRL_43143_RF_SWCTRL_0 (1<<6)
#define CCTRL_43143_RF_SWCTRL_1 (2<<6)
#define CCTRL_43143_RF_SWCTRL_2 (4<<6)
-#define CCTRL_43143_RF_XSWCTRL (1<<9)
-#define CCTRL_43143_HOST_WAKE0 (1<<11)
-#define CCTRL_43143_HOST_WAKE1 (1<<12)
-
-
-#define RES43143_EXT_SWITCHER_PWM 0
-#define RES43143_XTAL_PU 1
-#define RES43143_ILP_REQUEST 2
-#define RES43143_ALP_AVAIL 3
-#define RES43143_WL_CORE_READY 4
-#define RES43143_BBPLL_PWRSW_PU 5
-#define RES43143_HT_AVAIL 6
-#define RES43143_RADIO_PU 7
-#define RES43143_MACPHY_CLK_AVAIL 8
-#define RES43143_OTP_PU 9
-#define RES43143_LQ_AVAIL 10
+#define CCTRL_43143_RF_XSWCTRL (1<<9) /* 0: UART enabled */
+#define CCTRL_43143_HOST_WAKE0 (1<<11) /* 1: SDIO separate interrupt output from GPIO4 */
+#define CCTRL_43143_HOST_WAKE1 (1<<12) /* 1: SDIO separate interrupt output from GPIO16 */
+
+/* 43143 resources, based on pmu_params.xls V1.19 */
+#define RES43143_EXT_SWITCHER_PWM 0 /* 0x00001 */
+#define RES43143_XTAL_PU 1 /* 0x00002 */
+#define RES43143_ILP_REQUEST 2 /* 0x00004 */
+#define RES43143_ALP_AVAIL 3 /* 0x00008 */
+#define RES43143_WL_CORE_READY 4 /* 0x00010 */
+#define RES43143_BBPLL_PWRSW_PU 5 /* 0x00020 */
+#define RES43143_HT_AVAIL 6 /* 0x00040 */
+#define RES43143_RADIO_PU 7 /* 0x00080 */
+#define RES43143_MACPHY_CLK_AVAIL 8 /* 0x00100 */
+#define RES43143_OTP_PU 9 /* 0x00200 */
+#define RES43143_LQ_AVAIL 10 /* 0x00400 */
#define PMU43143_XTAL_CORE_SIZE_MASK 0x3F
-
+/* 4313 resources */
#define RES4313_BB_PU_RSRC 0
#define RES4313_ILP_REQ_RSRC 1
#define RES4313_XTAL_PU_RSRC 2
#define RES4313_HT_AVAIL_RSRC 14
#define RES4313_MACPHY_CLK_AVAIL_RSRC 15
-
+/* 4313 chip-specific ChipStatus register bits */
#define CST4313_SPROM_PRESENT 1
#define CST4313_OTP_PRESENT 2
#define CST4313_SPROM_OTP_SEL_MASK 0x00000002
#define CST4313_SPROM_OTP_SEL_SHIFT 0
+/* 4313 Chip specific ChipControl register bits */
+#define CCTRL_4313_12MA_LED_DRIVE 0x00000007 /* 12 mA drive strengh for later 4313 */
-#define CCTRL_4313_12MA_LED_DRIVE 0x00000007
-
-
+/* PMU respources for 4314 */
#define RES4314_LPLDO_PU 0
#define RES4314_PMU_SLEEP_DIS 1
#define RES4314_PMU_BG_PU 2
#define RES4314_HT_AVAIL 28
#define RES4314_MACPHY_CLK_AVAIL 29
-
+/* 4314 chip-specific ChipStatus register bits */
#define CST4314_OTP_ENABLED 0x00200000
-
+/* 43228 resources */
#define RES43228_NOT_USED 0
#define RES43228_ILP_REQUEST 1
#define RES43228_XTAL_PU 2
#define RES43228_PLL_EN 4
#define RES43228_HT_PHY_AVAIL 5
-
+/* 43228 chipstatus reg bits */
#define CST43228_ILP_DIV_EN 0x1
#define CST43228_OTP_PRESENT 0x2
#define CST43228_SERDES_REFCLK_PADSEL 0x4
#define CST43228_SDIO_OTP_PRESENT 0x10
#define CST43228_SDIO_RESET 0x20
+/* 4706 chipstatus reg bits */
+#define CST4706_PKG_OPTION (1<<0) /* 0: full-featured package 1: low-cost package */
+#define CST4706_SFLASH_PRESENT (1<<1) /* 0: parallel, 1: serial flash is present */
+#define CST4706_SFLASH_TYPE (1<<2) /* 0: 8b-p/ST-s flash, 1: 16b-p/Atmal-s flash */
+#define CST4706_MIPS_BENDIAN (1<<3) /* 0: little, 1: big endian */
+#define CST4706_PCIE1_DISABLE (1<<5) /* PCIE1 enable strap pin */
-#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)
-
-
+/* 4706 flashstrconfig reg bits */
#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 /* 2nd serial flash present */
+#define FLSTRCF4706_PF1 0x00000002 /* 2nd parallel flash present */
+#define FLSTRCF4706_SF1_TYPE 0x00000004 /* 2nd serial flash type : 0 : ST, 1 : Atmel */
+#define FLSTRCF4706_NF1 0x00000008 /* 2nd NAND flash present */
+#define FLSTRCF4706_1ST_MADDR_SEG_MASK 0x000000f0 /* Valid value mask */
+#define FLSTRCF4706_1ST_MADDR_SEG_4MB 0x00000010 /* 4MB */
+#define FLSTRCF4706_1ST_MADDR_SEG_8MB 0x00000020 /* 8MB */
+#define FLSTRCF4706_1ST_MADDR_SEG_16MB 0x00000030 /* 16MB */
+#define FLSTRCF4706_1ST_MADDR_SEG_32MB 0x00000040 /* 32MB */
+#define FLSTRCF4706_1ST_MADDR_SEG_64MB 0x00000050 /* 64MB */
+#define FLSTRCF4706_1ST_MADDR_SEG_128MB 0x00000060 /* 128MB */
+#define FLSTRCF4706_1ST_MADDR_SEG_256MB 0x00000070 /* 256MB */
+
+/* 4360 Chip specific ChipControl register bits */
#define CCTRL4360_I2C_MODE (1 << 0)
#define CCTRL4360_UART_MODE (1 << 1)
#define CCTRL4360_SECI_MODE (1 << 2)
#define CCTRL4360_SECI_ON_GPIO01 (1 << 24)
-
+/* 4360 PMU resources and chip status bits */
#define RES4360_REGULATOR 0
#define RES4360_ILP_AVAIL 1
#define RES4360_ILP_REQ 2
#define CCTRL_4360_UART_SEL 0x2
+/* defines to detect active host interface in use */
+#define CHIP_HOSTIF_PCIEMODE 0x1
+#define CHIP_HOSTIF_USBMODE 0x2
+#define CHIP_HOSTIF_SDIOMODE 0x4
+#define CHIP_HOSTIF_PCIE(sih) (si_chip_hostif(sih) == CHIP_HOSTIF_PCIEMODE)
+#define CHIP_HOSTIF_SDIO(sih) (si_chip_hostif(sih) == CHIP_HOSTIF_SDIOMODE)
+/* 4335 resources */
#define RES4335_LPLDO_PO 0
#define RES4335_PMU_BG_PU 1
#define RES4335_PMU_SLEEP 2
#define RES4335_HT_AVAIL 29
#define RES4335_MACPHY_CLKAVAIL 30
-
+/* 4335 Chip specific ChipStatus register bits */
#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 CST4335_CHIPMODE_SDIOD(cs) (((cs) & (1 << 0)) != 0) /* SDIO */
+#define CST4335_CHIPMODE_GSPI(cs) (((cs) & (1 << 1)) != 0) /* gSPI */
+#define CST4335_CHIPMODE_USB20D(cs) (((cs) & (1 << 2)) != 0) /* USB || USBDA */
+#define CST4335_CHIPMODE_PCIE(cs) (((cs) & (1 << 3)) != 0) /* PCIE */
-#define CCTRL1_4335_GPIO_SEL (1 << 0)
-#define CCTRL1_4335_SDIO_HOST_WAKE (1 << 2)
+/* 4335 Chip specific ChipControl1 register bits */
+#define CCTRL1_4335_GPIO_SEL (1 << 0) /* 1=select GPIOs to be muxed out */
+#define CCTRL1_4335_SDIO_HOST_WAKE (1 << 2) /* SDIO: 1=configure GPIO0 for host wake */
#define CR4_4335_RAM_BASE (0x180000)
+#define PATCHTBL_SIZE (0x800)
#define CR4_4350_RAM_BASE (0x180000)
#define CR4_4360_RAM_BASE (0x0)
+/* 4335 chip OTP present & OTP select bits. */
+#define SPROM4335_OTP_SELECT 0x00000010
+#define SPROM4335_OTP_PRESENT 0x00000020
+
+/* 4335 GCI specific bits. */
+#define CC4335_GCI_STRAP_OVERRIDE_SFLASH_PRESENT (1 << 24)
+#define CC4335_GCI_STRAP_OVERRIDE_SFLASH_TYPE 25
+#define CC4335_GCI_FUNC_SEL_PAD_SDIO 0x00707770
+/* SFLASH clkdev specific bits. */
+#define CC4335_SFLASH_CLKDIV_MASK 0x1F000000
+#define CC4335_SFLASH_CLKDIV_SHIFT 25
+/* 4335 OTP bits for SFLASH. */
+#define CC4335_SROM_OTP_SFLASH 40
+#define CC4335_SROM_OTP_SFLASH_PRESENT 0x1
+#define CC4335_SROM_OTP_SFLASH_TYPE 0x2
+#define CC4335_SROM_OTP_SFLASH_CLKDIV_MASK 0x003C
+#define CC4335_SROM_OTP_SFLASH_CLKDIV_SHIFT 2
+/* 4335 resources--END */
+
+
+/* 4350 Chipcommon ChipStatus bits */
#define CST4350_SDIO_MODE 0x00000001
#define CST4350_HSIC20D_MODE 0x00000002
#define CST4350_BP_ON_HSIC_CLK 0x00000004
#define CST4350_GSPI_MODE 0x08000000
#define CST4350_PACKAGE_OPTION 0xF0000000
-
+/* strap_host_ifc strap value */
#define CST4350_HOST_IFC_MASK 0x00700000
#define CST4350_HOST_IFC_SHIFT 20
-
+/* host_ifc raw mode */
#define CST4350_IFC_MODE_SDIOD 0x0
#define CST4350_IFC_MODE_HSIC20D 0x1
#define CST4350_IFC_MODE_HSIC30D 0x2
#define CST4350_CHIPMODE_HSIC30D(cs) (CST4350_IFC_MODE(cs) == (CST4350_IFC_MODE_HSIC30D))
#define CST4350_CHIPMODE_USB30D(cs) (CST4350_IFC_MODE(cs) == (CST4350_IFC_MODE_USB30D))
#define CST4350_CHIPMODE_USB30D_WL(cs) (CST4350_IFC_MODE(cs) == (CST4350_IFC_MODE_USB30D_WL))
+#define CST4350_CHIPMODE_PCIE(cs) (CST4350_IFC_MODE(cs) == (CST4350_IFC_MODE_PCIE))
-
+/* 4350 PMU resources */
#define RES4350_LPLDO_PU 0
#define RES4350_PMU_BG_PU 1
#define RES4350_PMU_SLEEP 2
#define MUXENAB4350_UART_MASK (0x0000000f)
-
+/* 4350 GCI function sel values */
#define CC4350_FNSEL_HWDEF (0)
#define CC4350_FNSEL_SAMEASPIN (1)
#define CC4350_FNSEL_UART (2)
#define CC4350_FNSEL_PUP (14)
#define CC4350_FNSEL_TRISTATE (15)
-
+/* 4350 GPIO */
#define CC4350_PIN_GPIO_00 (0)
#define CC4350_PIN_GPIO_01 (1)
#define CC4350_PIN_GPIO_02 (2)
#define CC4350_PIN_GPIO_14 (14)
#define CC4350_PIN_GPIO_15 (15)
-
+#define CC2_4350_MEMLPLDO_PWRSW_EN_MASK (1 << 21)
+#define CC2_4350_MEMLPLDO_PWRSW_EN_SHIFT (21)
+#define CC2_4350_SDIO_AOS_WAKEUP_MASK (1 << 24)
+#define CC2_4350_SDIO_AOS_WAKEUP_SHIFT (24)
+
+/* Applies to 4335/4350/4345 */
+#define CC3_SR_CLK_SR_MEM_MASK (1 << 0)
+#define CC3_SR_CLK_SR_MEM_SHIFT (0)
+#define CC3_SR_BIT1_TBD_MASK (1 << 1)
+#define CC3_SR_BIT1_TBD_SHIFT (1)
+#define CC3_SR_ENGINE_ENABLE_MASK (1 << 2)
+#define CC3_SR_ENGINE_ENABLE_SHIFT (2)
+#define CC3_SR_BIT3_TBD_MASK (1 << 3)
+#define CC3_SR_BIT3_TBD_SHIFT (3)
+#define CC3_SR_MINDIV_FAST_CLK_MASK (0xF << 4)
+#define CC3_SR_MINDIV_FAST_CLK_SHIFT (4)
+#define CC3_SR_R23_SR2_RISE_EDGE_TRIG_MASK (1 << 8)
+#define CC3_SR_R23_SR2_RISE_EDGE_TRIG_SHIFT (8)
+#define CC3_SR_R23_SR2_FALL_EDGE_TRIG_MASK (1 << 9)
+#define CC3_SR_R23_SR2_FALL_EDGE_TRIG_SHIFT (9)
+#define CC3_SR_R23_SR_RISE_EDGE_TRIG_MASK (1 << 10)
+#define CC3_SR_R23_SR_RISE_EDGE_TRIG_SHIFT (10)
+#define CC3_SR_R23_SR_FALL_EDGE_TRIG_MASK (1 << 11)
+#define CC3_SR_R23_SR_FALL_EDGE_TRIG_SHIFT (11)
+#define CC3_SR_NUM_CLK_HIGH_MASK (0x7 << 12)
+#define CC3_SR_NUM_CLK_HIGH_SHIFT (12)
+#define CC3_SR_BIT15_TBD_MASK (1 << 15)
+#define CC3_SR_BIT15_TBD_SHIFT (15)
+#define CC3_SR_PHY_FUNC_PIC_MASK (1 << 16)
+#define CC3_SR_PHY_FUNC_PIC_SHIFT (16)
+#define CC3_SR_BIT17_19_TBD_MASK (0x7 << 17)
+#define CC3_SR_BIT17_19_TBD_SHIFT (17)
+#define CC3_SR_CHIP_TRIGGER_1_MASK (1 << 20)
+#define CC3_SR_CHIP_TRIGGER_1_SHIFT (20)
+#define CC3_SR_CHIP_TRIGGER_2_MASK (1 << 21)
+#define CC3_SR_CHIP_TRIGGER_2_SHIFT (21)
+#define CC3_SR_CHIP_TRIGGER_3_MASK (1 << 22)
+#define CC3_SR_CHIP_TRIGGER_3_SHIFT (22)
+#define CC3_SR_CHIP_TRIGGER_4_MASK (1 << 23)
+#define CC3_SR_CHIP_TRIGGER_4_SHIFT (23)
+#define CC3_SR_ALLOW_SBC_FUNC_PIC_MASK (1 << 24)
+#define CC3_SR_ALLOW_SBC_FUNC_PIC_SHIFT (24)
+#define CC3_SR_BIT25_26_TBD_MASK (0x3 << 25)
+#define CC3_SR_BIT25_26_TBD_SHIFT (25)
+#define CC3_SR_ALLOW_SBC_STBY_MASK (1 << 27)
+#define CC3_SR_ALLOW_SBC_STBY_SHIFT (27)
+#define CC3_SR_GPIO_MUX_MASK (0xF << 28)
+#define CC3_SR_GPIO_MUX_SHIFT (28)
+
+/* Applies to 4335/4350/4345 */
+#define CC4_SR_INIT_ADDR_MASK (0x3FF0000)
+#define CC4_4350_SR_ASM_ADDR (0x30)
+#define CC4_4335_SR_ASM_ADDR (0x48)
+#define CC4_SR_INIT_ADDR_SHIFT (16)
+
+#define CC4_4350_EN_SR_CLK_ALP_MASK (1 << 30)
+#define CC4_4350_EN_SR_CLK_ALP_SHIFT (30)
+#define CC4_4350_EN_SR_CLK_HT_MASK (1 << 31)
+#define CC4_4350_EN_SR_CLK_HT_SHIFT (31)
+
+#define VREG4_4350_MEMLPDO_PU_MASK (1 << 31)
+#define VREG4_4350_MEMLPDO_PU_SHIFT 31
+
+#define CC6_4350_PCIE_CLKREQ_WAKEUP_MASK (1 << 4)
+#define CC6_4350_PCIE_CLKREQ_WAKEUP_SHIFT (4)
+#define CC6_4350_PMU_WAKEUP_ALPAVAIL_MASK (1 << 6)
+#define CC6_4350_PMU_WAKEUP_ALPAVAIL_SHIFT (6)
+
+/* GCI chipcontrol register indices */
#define CC_GCI_CHIPCTRL_00 (0)
#define CC_GCI_CHIPCTRL_01 (1)
#define CC_GCI_CHIPCTRL_02 (2)
#define CC_GCI_CHIPCTRL_07 (7)
#define CC_GCI_CHIPCTRL_08 (8)
-#define CC_GCI_NUMCHIPCTRLREGS(cap1) ((cap1 & 0xF00) >> 8)
+#define CC_GCI_06_JTAG_SEL_SHIFT 4
+#define CC_GCI_06_JTAG_SEL_MASK (1 << 4)
+#define CC_GCI_NUMCHIPCTRLREGS(cap1) ((cap1 & 0xF00) >> 8)
+/* 4335 pins
+* note: only the values set as default/used are added here.
+*/
#define CC4335_PIN_GPIO_00 (0)
#define CC4335_PIN_GPIO_01 (1)
#define CC4335_PIN_GPIO_02 (2)
#define CC4335_PIN_RF_SW_CTRL_8 (30)
#define CC4335_PIN_RF_SW_CTRL_9 (31)
-
+/* 4335 GCI function sel values
+*/
#define CC4335_FNSEL_HWDEF (0)
#define CC4335_FNSEL_SAMEASPIN (1)
#define CC4335_FNSEL_GPIO0 (2)
#define CC4335_FNSEL_PUP (14)
#define CC4335_FNSEL_TRI (15)
-
+/* find the 4 bit mask given the bit position */
#define GCIMASK(pos) (((uint32)0xF) << pos)
-
+/* get the value which can be used to directly OR with chipcontrol reg */
#define GCIPOSVAL(val, pos) ((((uint32)val) << pos) & GCIMASK(pos))
-
+/* 4335 MUX options. each nibble belongs to a setting. Non-zero value specifies a logic
+* for now only UART for bootloader.
+*/
#define MUXENAB4335_UART_MASK (0x0000000f)
+#define MUXENAB4335_UART_SHIFT 0
+#define MUXENAB4335_HOSTWAKE_MASK (0x000000f0) /* configure GPIO for SDIO host_wake */
+#define MUXENAB4335_HOSTWAKE_SHIFT 4
+#define MUXENAB4335_GETIX(val, name) \
+ ((((val) & MUXENAB4335_ ## name ## _MASK) >> MUXENAB4335_ ## name ## _SHIFT) - 1)
-
+/* defines to detect active host interface in use */
#define CHIP_HOSTIF_USB(sih) (si_chip_hostif(sih) & CST4360_MODE_USB)
-
+/*
+* Maximum delay for the PMU state transition in us.
+* This is an upper bound intended for spinwaits etc.
+*/
#define PMU_MAX_TRANSITION_DLY 15000
-
+/* PMU resource up transition time in ILP cycles */
#define PMURES_UP_TRANSITION 2
-
+/* SECI configuration */
#define SECI_MODE_UART 0x0
#define SECI_MODE_SECI 0x1
#define SECI_MODE_LEGACY_3WIRE_BT 0x2
#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 /* (bits 5, 6, 7) */
#define SECI_UPD_SECI (1 << 7)
#define SECI_SIGNOFF_0 0xDB
#define SECI_SIGNOFF_1 0
-
+/* seci clk_ctl_st bits */
#define CLKCTL_STS_SECI_CLK_REQ (1 << 8)
#define CLKCTL_STS_SECI_CLK_AVAIL (1 << 24)
#define SECI_UART_SECI_IN_STATE (1 << 2)
#define SECI_UART_SECI_IN2_STATE (1 << 3)
-
-#define SECI_UART_LCR_STOP_BITS (1 << 0)
+/* SECI UART LCR/MCR register bits */
+#define SECI_UART_LCR_STOP_BITS (1 << 0) /* 0 - 1bit, 1 - 2bits */
#define SECI_UART_LCR_PARITY_EN (1 << 1)
-#define SECI_UART_LCR_PARITY (1 << 2)
+#define SECI_UART_LCR_PARITY (1 << 2) /* 0 - odd, 1 - even */
#define SECI_UART_LCR_RX_EN (1 << 3)
-#define SECI_UART_LCR_LBRK_CTRL (1 << 4)
+#define SECI_UART_LCR_LBRK_CTRL (1 << 4) /* 1 => SECI_OUT held low */
#define SECI_UART_LCR_TXO_EN (1 << 5)
#define SECI_UART_LCR_RTSO_EN (1 << 6)
#define SECI_UART_LCR_SLIPMODE_EN (1 << 7)
#define SECI_UART_MCR_BAUD_ADJ_EN (1 << 7)
#define SECI_UART_MCR_XONOFF_RPT (1 << 9)
+/* WLAN channel numbers - used from wifi.h */
-
-
+/* WLAN BW */
#define ECI_BW_20 0x0
#define ECI_BW_25 0x1
#define ECI_BW_30 0x2
#define ECI_BW_50 0x6
#define ECI_BW_ALL 0x7
-
+/* WLAN - number of antenna */
#define WLAN_NUM_ANT1 TXANT_0
#define WLAN_NUM_ANT2 TXANT_1
-#endif
+#endif /* _SBCHIPC_H */
--- /dev/null
+/*
+ * Broadcom SiliconBackplane hardware register definitions.
+ *
+ * Copyright (C) 1999-2013, 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: sbconfig.h 241182 2011-02-17 21:50:03Z $
+ */
+
+#ifndef _SBCONFIG_H
+#define _SBCONFIG_H
+
+/* cpp contortions to concatenate w/arg prescan */
+#ifndef PAD
+#define _PADLINE(line) pad ## line
+#define _XSTR(line) _PADLINE(line)
+#define PAD _XSTR(__LINE__)
+#endif
+
+/* enumeration in SB is based on the premise that cores are contiguos in the
+ * enumeration space.
+ */
+#define SB_BUS_SIZE 0x10000 /* Each bus gets 64Kbytes for cores */
+#define SB_BUS_BASE(b) (SI_ENUM_BASE + (b) * SB_BUS_SIZE)
+#define SB_BUS_MAXCORES (SB_BUS_SIZE / SI_CORE_SIZE) /* Max cores per bus */
+
+/*
+ * Sonics Configuration Space Registers.
+ */
+#define SBCONFIGOFF 0xf00 /* core sbconfig regs are top 256bytes of regs */
+#define SBCONFIGSIZE 256 /* sizeof (sbconfig_t) */
+
+#define SBIPSFLAG 0x08
+#define SBTPSFLAG 0x18
+#define SBTMERRLOGA 0x48 /* sonics >= 2.3 */
+#define SBTMERRLOG 0x50 /* sonics >= 2.3 */
+#define SBADMATCH3 0x60
+#define SBADMATCH2 0x68
+#define SBADMATCH1 0x70
+#define SBIMSTATE 0x90
+#define SBINTVEC 0x94
+#define SBTMSTATELOW 0x98
+#define SBTMSTATEHIGH 0x9c
+#define SBBWA0 0xa0
+#define SBIMCONFIGLOW 0xa8
+#define SBIMCONFIGHIGH 0xac
+#define SBADMATCH0 0xb0
+#define SBTMCONFIGLOW 0xb8
+#define SBTMCONFIGHIGH 0xbc
+#define SBBCONFIG 0xc0
+#define SBBSTATE 0xc8
+#define SBACTCNFG 0xd8
+#define SBFLAGST 0xe8
+#define SBIDLOW 0xf8
+#define SBIDHIGH 0xfc
+
+/* All the previous registers are above SBCONFIGOFF, but with Sonics 2.3, we have
+ * a few registers *below* that line. I think it would be very confusing to try
+ * and change the value of SBCONFIGOFF, so I'm definig them as absolute offsets here,
+ */
+
+#define SBIMERRLOGA 0xea8
+#define SBIMERRLOG 0xeb0
+#define SBTMPORTCONNID0 0xed8
+#define SBTMPORTLOCK0 0xef8
+
+#ifndef _LANGUAGE_ASSEMBLY
+
+typedef volatile struct _sbconfig {
+ uint32 PAD[2];
+ uint32 sbipsflag; /* initiator port ocp slave flag */
+ uint32 PAD[3];
+ uint32 sbtpsflag; /* target port ocp slave flag */
+ uint32 PAD[11];
+ uint32 sbtmerrloga; /* (sonics >= 2.3) */
+ uint32 PAD;
+ uint32 sbtmerrlog; /* (sonics >= 2.3) */
+ uint32 PAD[3];
+ uint32 sbadmatch3; /* address match3 */
+ uint32 PAD;
+ uint32 sbadmatch2; /* address match2 */
+ uint32 PAD;
+ uint32 sbadmatch1; /* address match1 */
+ uint32 PAD[7];
+ uint32 sbimstate; /* initiator agent state */
+ uint32 sbintvec; /* interrupt mask */
+ uint32 sbtmstatelow; /* target state */
+ uint32 sbtmstatehigh; /* target state */
+ uint32 sbbwa0; /* bandwidth allocation table0 */
+ uint32 PAD;
+ uint32 sbimconfiglow; /* initiator configuration */
+ uint32 sbimconfighigh; /* initiator configuration */
+ uint32 sbadmatch0; /* address match0 */
+ uint32 PAD;
+ uint32 sbtmconfiglow; /* target configuration */
+ uint32 sbtmconfighigh; /* target configuration */
+ uint32 sbbconfig; /* broadcast configuration */
+ uint32 PAD;
+ uint32 sbbstate; /* broadcast state */
+ uint32 PAD[3];
+ uint32 sbactcnfg; /* activate configuration */
+ uint32 PAD[3];
+ uint32 sbflagst; /* current sbflags */
+ uint32 PAD[3];
+ uint32 sbidlow; /* identification */
+ uint32 sbidhigh; /* identification */
+} sbconfig_t;
+
+#endif /* _LANGUAGE_ASSEMBLY */
+
+/* sbipsflag */
+#define SBIPS_INT1_MASK 0x3f /* which sbflags get routed to mips interrupt 1 */
+#define SBIPS_INT1_SHIFT 0
+#define SBIPS_INT2_MASK 0x3f00 /* which sbflags get routed to mips interrupt 2 */
+#define SBIPS_INT2_SHIFT 8
+#define SBIPS_INT3_MASK 0x3f0000 /* which sbflags get routed to mips interrupt 3 */
+#define SBIPS_INT3_SHIFT 16
+#define SBIPS_INT4_MASK 0x3f000000 /* which sbflags get routed to mips interrupt 4 */
+#define SBIPS_INT4_SHIFT 24
+
+/* sbtpsflag */
+#define SBTPS_NUM0_MASK 0x3f /* interrupt sbFlag # generated by this core */
+#define SBTPS_F0EN0 0x40 /* interrupt is always sent on the backplane */
+
+/* sbtmerrlog */
+#define SBTMEL_CM 0x00000007 /* command */
+#define SBTMEL_CI 0x0000ff00 /* connection id */
+#define SBTMEL_EC 0x0f000000 /* error code */
+#define SBTMEL_ME 0x80000000 /* multiple error */
+
+/* sbimstate */
+#define SBIM_PC 0xf /* pipecount */
+#define SBIM_AP_MASK 0x30 /* arbitration policy */
+#define SBIM_AP_BOTH 0x00 /* use both timeslaces and token */
+#define SBIM_AP_TS 0x10 /* use timesliaces only */
+#define SBIM_AP_TK 0x20 /* use token only */
+#define SBIM_AP_RSV 0x30 /* reserved */
+#define SBIM_IBE 0x20000 /* inbanderror */
+#define SBIM_TO 0x40000 /* timeout */
+#define SBIM_BY 0x01800000 /* busy (sonics >= 2.3) */
+#define SBIM_RJ 0x02000000 /* reject (sonics >= 2.3) */
+
+/* sbtmstatelow */
+#define SBTML_RESET 0x0001 /* reset */
+#define SBTML_REJ_MASK 0x0006 /* reject field */
+#define SBTML_REJ 0x0002 /* reject */
+#define SBTML_TMPREJ 0x0004 /* temporary reject, for error recovery */
+
+#define SBTML_SICF_SHIFT 16 /* Shift to locate the SI control flags in sbtml */
+
+/* sbtmstatehigh */
+#define SBTMH_SERR 0x0001 /* serror */
+#define SBTMH_INT 0x0002 /* interrupt */
+#define SBTMH_BUSY 0x0004 /* busy */
+#define SBTMH_TO 0x0020 /* timeout (sonics >= 2.3) */
+
+#define SBTMH_SISF_SHIFT 16 /* Shift to locate the SI status flags in sbtmh */
+
+/* sbbwa0 */
+#define SBBWA_TAB0_MASK 0xffff /* lookup table 0 */
+#define SBBWA_TAB1_MASK 0xffff /* lookup table 1 */
+#define SBBWA_TAB1_SHIFT 16
+
+/* sbimconfiglow */
+#define SBIMCL_STO_MASK 0x7 /* service timeout */
+#define SBIMCL_RTO_MASK 0x70 /* request timeout */
+#define SBIMCL_RTO_SHIFT 4
+#define SBIMCL_CID_MASK 0xff0000 /* connection id */
+#define SBIMCL_CID_SHIFT 16
+
+/* sbimconfighigh */
+#define SBIMCH_IEM_MASK 0xc /* inband error mode */
+#define SBIMCH_TEM_MASK 0x30 /* timeout error mode */
+#define SBIMCH_TEM_SHIFT 4
+#define SBIMCH_BEM_MASK 0xc0 /* bus error mode */
+#define SBIMCH_BEM_SHIFT 6
+
+/* sbadmatch0 */
+#define SBAM_TYPE_MASK 0x3 /* address type */
+#define SBAM_AD64 0x4 /* reserved */
+#define SBAM_ADINT0_MASK 0xf8 /* type0 size */
+#define SBAM_ADINT0_SHIFT 3
+#define SBAM_ADINT1_MASK 0x1f8 /* type1 size */
+#define SBAM_ADINT1_SHIFT 3
+#define SBAM_ADINT2_MASK 0x1f8 /* type2 size */
+#define SBAM_ADINT2_SHIFT 3
+#define SBAM_ADEN 0x400 /* enable */
+#define SBAM_ADNEG 0x800 /* negative decode */
+#define SBAM_BASE0_MASK 0xffffff00 /* type0 base address */
+#define SBAM_BASE0_SHIFT 8
+#define SBAM_BASE1_MASK 0xfffff000 /* type1 base address for the core */
+#define SBAM_BASE1_SHIFT 12
+#define SBAM_BASE2_MASK 0xffff0000 /* type2 base address for the core */
+#define SBAM_BASE2_SHIFT 16
+
+/* sbtmconfiglow */
+#define SBTMCL_CD_MASK 0xff /* clock divide */
+#define SBTMCL_CO_MASK 0xf800 /* clock offset */
+#define SBTMCL_CO_SHIFT 11
+#define SBTMCL_IF_MASK 0xfc0000 /* interrupt flags */
+#define SBTMCL_IF_SHIFT 18
+#define SBTMCL_IM_MASK 0x3000000 /* interrupt mode */
+#define SBTMCL_IM_SHIFT 24
+
+/* sbtmconfighigh */
+#define SBTMCH_BM_MASK 0x3 /* busy mode */
+#define SBTMCH_RM_MASK 0x3 /* retry mode */
+#define SBTMCH_RM_SHIFT 2
+#define SBTMCH_SM_MASK 0x30 /* stop mode */
+#define SBTMCH_SM_SHIFT 4
+#define SBTMCH_EM_MASK 0x300 /* sb error mode */
+#define SBTMCH_EM_SHIFT 8
+#define SBTMCH_IM_MASK 0xc00 /* int mode */
+#define SBTMCH_IM_SHIFT 10
+
+/* sbbconfig */
+#define SBBC_LAT_MASK 0x3 /* sb latency */
+#define SBBC_MAX0_MASK 0xf0000 /* maxccntr0 */
+#define SBBC_MAX0_SHIFT 16
+#define SBBC_MAX1_MASK 0xf00000 /* maxccntr1 */
+#define SBBC_MAX1_SHIFT 20
+
+/* sbbstate */
+#define SBBS_SRD 0x1 /* st reg disable */
+#define SBBS_HRD 0x2 /* hold reg disable */
+
+/* sbidlow */
+#define SBIDL_CS_MASK 0x3 /* config space */
+#define SBIDL_AR_MASK 0x38 /* # address ranges supported */
+#define SBIDL_AR_SHIFT 3
+#define SBIDL_SYNCH 0x40 /* sync */
+#define SBIDL_INIT 0x80 /* initiator */
+#define SBIDL_MINLAT_MASK 0xf00 /* minimum backplane latency */
+#define SBIDL_MINLAT_SHIFT 8
+#define SBIDL_MAXLAT 0xf000 /* maximum backplane latency */
+#define SBIDL_MAXLAT_SHIFT 12
+#define SBIDL_FIRST 0x10000 /* this initiator is first */
+#define SBIDL_CW_MASK 0xc0000 /* cycle counter width */
+#define SBIDL_CW_SHIFT 18
+#define SBIDL_TP_MASK 0xf00000 /* target ports */
+#define SBIDL_TP_SHIFT 20
+#define SBIDL_IP_MASK 0xf000000 /* initiator ports */
+#define SBIDL_IP_SHIFT 24
+#define SBIDL_RV_MASK 0xf0000000 /* sonics backplane revision code */
+#define SBIDL_RV_SHIFT 28
+#define SBIDL_RV_2_2 0x00000000 /* version 2.2 or earlier */
+#define SBIDL_RV_2_3 0x10000000 /* version 2.3 */
+
+/* sbidhigh */
+#define SBIDH_RC_MASK 0x000f /* revision code */
+#define SBIDH_RCE_MASK 0x7000 /* revision code extension field */
+#define SBIDH_RCE_SHIFT 8
+#define SBCOREREV(sbidh) \
+ ((((sbidh) & SBIDH_RCE_MASK) >> SBIDH_RCE_SHIFT) | ((sbidh) & SBIDH_RC_MASK))
+#define SBIDH_CC_MASK 0x8ff0 /* core code */
+#define SBIDH_CC_SHIFT 4
+#define SBIDH_VC_MASK 0xffff0000 /* vendor code */
+#define SBIDH_VC_SHIFT 16
+
+#define SB_COMMIT 0xfd8 /* update buffered registers value */
+
+/* vendor codes */
+#define SB_VEND_BCM 0x4243 /* Broadcom's SB vendor code */
+
+#endif /* _SBCONFIG_H */
--- /dev/null
+/*
+ * Generic Broadcom Home Networking Division (HND) DMA engine HW interface
+ * This supports the following chips: BCM42xx, 44xx, 47xx .
+ *
+ * Copyright (C) 1999-2013, 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 373617 2012-12-07 23:03:08Z $
+ */
+
+#ifndef _sbhnddma_h_
+#define _sbhnddma_h_
+
+/* DMA structure:
+ * support two DMA engines: 32 bits address or 64 bit addressing
+ * basic DMA register set is per channel(transmit or receive)
+ * a pair of channels is defined for convenience
+ */
+
+
+/* 32 bits addressing */
+
+/* dma registers per channel(xmt or rcv) */
+typedef volatile struct {
+ uint32 control; /* enable, et al */
+ uint32 addr; /* descriptor ring base address (4K aligned) */
+ uint32 ptr; /* last descriptor posted to chip */
+ uint32 status; /* current active descriptor, et al */
+} dma32regs_t;
+
+typedef volatile struct {
+ dma32regs_t xmt; /* dma tx channel */
+ dma32regs_t rcv; /* dma rx channel */
+} dma32regp_t;
+
+typedef volatile struct { /* diag access */
+ uint32 fifoaddr; /* diag address */
+ uint32 fifodatalow; /* low 32bits of data */
+ uint32 fifodatahigh; /* high 32bits of data */
+ uint32 pad; /* reserved */
+} dma32diag_t;
+
+/*
+ * DMA Descriptor
+ * Descriptors are only read by the hardware, never written back.
+ */
+typedef volatile struct {
+ uint32 ctrl; /* misc control bits & bufcount */
+ uint32 addr; /* data buffer address */
+} dma32dd_t;
+
+/*
+ * Each descriptor ring must be 4096byte aligned, and fit within a single 4096byte page.
+ */
+#define D32RINGALIGN_BITS 12
+#define D32MAXRINGSZ (1 << D32RINGALIGN_BITS)
+#define D32RINGALIGN (1 << D32RINGALIGN_BITS)
+
+#define D32MAXDD (D32MAXRINGSZ / sizeof (dma32dd_t))
+
+/* transmit channel control */
+#define XC_XE ((uint32)1 << 0) /* transmit enable */
+#define XC_SE ((uint32)1 << 1) /* transmit suspend request */
+#define XC_LE ((uint32)1 << 2) /* loopback enable */
+#define XC_FL ((uint32)1 << 4) /* flush request */
+#define XC_MR_MASK 0x000000C0 /* Multiple outstanding reads */
+#define XC_MR_SHIFT 6
+#define XC_PD ((uint32)1 << 11) /* parity check disable */
+#define XC_AE ((uint32)3 << 16) /* address extension bits */
+#define XC_AE_SHIFT 16
+#define XC_BL_MASK 0x001C0000 /* BurstLen bits */
+#define XC_BL_SHIFT 18
+#define XC_PC_MASK 0x00E00000 /* Prefetch control */
+#define XC_PC_SHIFT 21
+#define XC_PT_MASK 0x03000000 /* Prefetch threshold */
+#define XC_PT_SHIFT 24
+
+/* Multiple outstanding reads */
+#define DMA_MR_1 0
+#define DMA_MR_2 1
+/* 2, 3: reserved */
+
+/* DMA Burst Length in bytes */
+#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
+
+/* Prefetch control */
+#define DMA_PC_0 0
+#define DMA_PC_4 1
+#define DMA_PC_8 2
+#define DMA_PC_16 3
+/* others: reserved */
+
+/* Prefetch threshold */
+#define DMA_PT_1 0
+#define DMA_PT_2 1
+#define DMA_PT_4 2
+#define DMA_PT_8 3
+
+/* transmit descriptor table pointer */
+#define XP_LD_MASK 0xfff /* last valid descriptor */
+
+/* transmit channel status */
+#define XS_CD_MASK 0x0fff /* current descriptor pointer */
+#define XS_XS_MASK 0xf000 /* transmit state */
+#define XS_XS_SHIFT 12
+#define XS_XS_DISABLED 0x0000 /* disabled */
+#define XS_XS_ACTIVE 0x1000 /* active */
+#define XS_XS_IDLE 0x2000 /* idle wait */
+#define XS_XS_STOPPED 0x3000 /* stopped */
+#define XS_XS_SUSP 0x4000 /* suspend pending */
+#define XS_XE_MASK 0xf0000 /* transmit errors */
+#define XS_XE_SHIFT 16
+#define XS_XE_NOERR 0x00000 /* no error */
+#define XS_XE_DPE 0x10000 /* descriptor protocol error */
+#define XS_XE_DFU 0x20000 /* data fifo underrun */
+#define XS_XE_BEBR 0x30000 /* bus error on buffer read */
+#define XS_XE_BEDA 0x40000 /* bus error on descriptor access */
+#define XS_AD_MASK 0xfff00000 /* active descriptor */
+#define XS_AD_SHIFT 20
+
+/* receive channel control */
+#define RC_RE ((uint32)1 << 0) /* receive enable */
+#define RC_RO_MASK 0xfe /* receive frame offset */
+#define RC_RO_SHIFT 1
+#define RC_FM ((uint32)1 << 8) /* direct fifo receive (pio) mode */
+#define RC_SH ((uint32)1 << 9) /* separate rx header descriptor enable */
+#define RC_OC ((uint32)1 << 10) /* overflow continue */
+#define RC_PD ((uint32)1 << 11) /* parity check disable */
+#define RC_AE ((uint32)3 << 16) /* address extension bits */
+#define RC_AE_SHIFT 16
+#define RC_BL_MASK 0x001C0000 /* BurstLen bits */
+#define RC_BL_SHIFT 18
+#define RC_PC_MASK 0x00E00000 /* Prefetch control */
+#define RC_PC_SHIFT 21
+#define RC_PT_MASK 0x03000000 /* Prefetch threshold */
+#define RC_PT_SHIFT 24
+
+/* receive descriptor table pointer */
+#define RP_LD_MASK 0xfff /* last valid descriptor */
+
+/* receive channel status */
+#define RS_CD_MASK 0x0fff /* current descriptor pointer */
+#define RS_RS_MASK 0xf000 /* receive state */
+#define RS_RS_SHIFT 12
+#define RS_RS_DISABLED 0x0000 /* disabled */
+#define RS_RS_ACTIVE 0x1000 /* active */
+#define RS_RS_IDLE 0x2000 /* idle wait */
+#define RS_RS_STOPPED 0x3000 /* reserved */
+#define RS_RE_MASK 0xf0000 /* receive errors */
+#define RS_RE_SHIFT 16
+#define RS_RE_NOERR 0x00000 /* no error */
+#define RS_RE_DPE 0x10000 /* descriptor protocol error */
+#define RS_RE_DFO 0x20000 /* data fifo overflow */
+#define RS_RE_BEBW 0x30000 /* bus error on buffer write */
+#define RS_RE_BEDA 0x40000 /* bus error on descriptor access */
+#define RS_AD_MASK 0xfff00000 /* active descriptor */
+#define RS_AD_SHIFT 20
+
+/* fifoaddr */
+#define FA_OFF_MASK 0xffff /* offset */
+#define FA_SEL_MASK 0xf0000 /* select */
+#define FA_SEL_SHIFT 16
+#define FA_SEL_XDD 0x00000 /* transmit dma data */
+#define FA_SEL_XDP 0x10000 /* transmit dma pointers */
+#define FA_SEL_RDD 0x40000 /* receive dma data */
+#define FA_SEL_RDP 0x50000 /* receive dma pointers */
+#define FA_SEL_XFD 0x80000 /* transmit fifo data */
+#define FA_SEL_XFP 0x90000 /* transmit fifo pointers */
+#define FA_SEL_RFD 0xc0000 /* receive fifo data */
+#define FA_SEL_RFP 0xd0000 /* receive fifo pointers */
+#define FA_SEL_RSD 0xe0000 /* receive frame status data */
+#define FA_SEL_RSP 0xf0000 /* receive frame status pointers */
+
+/* descriptor control flags */
+#define CTRL_BC_MASK 0x00001fff /* buffer byte count, real data len must <= 4KB */
+#define CTRL_AE ((uint32)3 << 16) /* address extension bits */
+#define CTRL_AE_SHIFT 16
+#define CTRL_PARITY ((uint32)3 << 18) /* parity bit */
+#define CTRL_EOT ((uint32)1 << 28) /* end of descriptor table */
+#define CTRL_IOC ((uint32)1 << 29) /* interrupt on completion */
+#define CTRL_EOF ((uint32)1 << 30) /* end of frame */
+#define CTRL_SOF ((uint32)1 << 31) /* start of frame */
+
+/* control flags in the range [27:20] are core-specific and not defined here */
+#define CTRL_CORE_MASK 0x0ff00000
+
+/* 64 bits addressing */
+
+/* dma registers per channel(xmt or rcv) */
+typedef volatile struct {
+ uint32 control; /* enable, et al */
+ uint32 ptr; /* last descriptor posted to chip */
+ uint32 addrlow; /* descriptor ring base address low 32-bits (8K aligned) */
+ uint32 addrhigh; /* descriptor ring base address bits 63:32 (8K aligned) */
+ uint32 status0; /* current descriptor, xmt state */
+ uint32 status1; /* active descriptor, xmt error */
+} dma64regs_t;
+
+typedef volatile struct {
+ dma64regs_t tx; /* dma64 tx channel */
+ dma64regs_t rx; /* dma64 rx channel */
+} dma64regp_t;
+
+typedef volatile struct { /* diag access */
+ uint32 fifoaddr; /* diag address */
+ uint32 fifodatalow; /* low 32bits of data */
+ uint32 fifodatahigh; /* high 32bits of data */
+ uint32 pad; /* reserved */
+} dma64diag_t;
+
+/*
+ * DMA Descriptor
+ * Descriptors are only read by the hardware, never written back.
+ */
+typedef volatile struct {
+ uint32 ctrl1; /* misc control bits */
+ uint32 ctrl2; /* buffer count and address extension */
+ uint32 addrlow; /* memory address of the date buffer, bits 31:0 */
+ uint32 addrhigh; /* memory address of the date buffer, bits 63:32 */
+} dma64dd_t;
+
+/*
+ * Each descriptor ring must be 8kB aligned, and fit within a contiguous 8kB physical addresss.
+ */
+#define D64RINGALIGN_BITS 13
+#define D64MAXRINGSZ (1 << D64RINGALIGN_BITS)
+#define D64RINGBOUNDARY (1 << D64RINGALIGN_BITS)
+
+#define D64MAXDD (D64MAXRINGSZ / sizeof (dma64dd_t))
+
+/* for cores with large descriptor ring support, descriptor ring size can be up to 4096 */
+#define D64MAXDD_LARGE ((1 << 16) / sizeof (dma64dd_t))
+
+/* for cores with large descriptor ring support (4k descriptors), descriptor ring cannot cross
+ * 64K boundary
+ */
+#define D64RINGBOUNDARY_LARGE (1 << 16)
+
+/*
+ * Default DMA Burstlen values for USBRev >= 12 and SDIORev >= 11.
+ * When this field contains the value N, the burst length is 2**(N + 4) bytes.
+ */
+#define D64_DEF_USBBURSTLEN 2
+#define D64_DEF_SDIOBURSTLEN 1
+
+
+#ifndef D64_USBBURSTLEN
+#define D64_USBBURSTLEN DMA_BL_64
+#endif
+#ifndef D64_SDIOBURSTLEN
+#define D64_SDIOBURSTLEN DMA_BL_32
+#endif
+
+/* transmit channel control */
+#define D64_XC_XE 0x00000001 /* transmit enable */
+#define D64_XC_SE 0x00000002 /* transmit suspend request */
+#define D64_XC_LE 0x00000004 /* loopback enable */
+#define D64_XC_FL 0x00000010 /* flush request */
+#define D64_XC_MR_MASK 0x000000C0 /* Multiple outstanding reads */
+#define D64_XC_MR_SHIFT 6
+#define D64_XC_PD 0x00000800 /* parity check disable */
+#define D64_XC_AE 0x00030000 /* address extension bits */
+#define D64_XC_AE_SHIFT 16
+#define D64_XC_BL_MASK 0x001C0000 /* BurstLen bits */
+#define D64_XC_BL_SHIFT 18
+#define D64_XC_PC_MASK 0x00E00000 /* Prefetch control */
+#define D64_XC_PC_SHIFT 21
+#define D64_XC_PT_MASK 0x03000000 /* Prefetch threshold */
+#define D64_XC_PT_SHIFT 24
+
+/* transmit descriptor table pointer */
+#define D64_XP_LD_MASK 0x00001fff /* last valid descriptor */
+
+/* transmit channel status */
+#define D64_XS0_CD_MASK (di->d64_xs0_cd_mask) /* current descriptor pointer */
+#define D64_XS0_XS_MASK 0xf0000000 /* transmit state */
+#define D64_XS0_XS_SHIFT 28
+#define D64_XS0_XS_DISABLED 0x00000000 /* disabled */
+#define D64_XS0_XS_ACTIVE 0x10000000 /* active */
+#define D64_XS0_XS_IDLE 0x20000000 /* idle wait */
+#define D64_XS0_XS_STOPPED 0x30000000 /* stopped */
+#define D64_XS0_XS_SUSP 0x40000000 /* suspend pending */
+
+#define D64_XS1_AD_MASK (di->d64_xs1_ad_mask) /* active descriptor */
+#define D64_XS1_XE_MASK 0xf0000000 /* transmit errors */
+#define D64_XS1_XE_SHIFT 28
+#define D64_XS1_XE_NOERR 0x00000000 /* no error */
+#define D64_XS1_XE_DPE 0x10000000 /* descriptor protocol error */
+#define D64_XS1_XE_DFU 0x20000000 /* data fifo underrun */
+#define D64_XS1_XE_DTE 0x30000000 /* data transfer error */
+#define D64_XS1_XE_DESRE 0x40000000 /* descriptor read error */
+#define D64_XS1_XE_COREE 0x50000000 /* core error */
+
+/* receive channel control */
+#define D64_RC_RE 0x00000001 /* receive enable */
+#define D64_RC_RO_MASK 0x000000fe /* receive frame offset */
+#define D64_RC_RO_SHIFT 1
+#define D64_RC_FM 0x00000100 /* direct fifo receive (pio) mode */
+#define D64_RC_SH 0x00000200 /* separate rx header descriptor enable */
+#define D64_RC_OC 0x00000400 /* overflow continue */
+#define D64_RC_PD 0x00000800 /* parity check disable */
+#define D64_RC_GE 0x00004000 /* Glom enable */
+#define D64_RC_AE 0x00030000 /* address extension bits */
+#define D64_RC_AE_SHIFT 16
+#define D64_RC_BL_MASK 0x001C0000 /* BurstLen bits */
+#define D64_RC_BL_SHIFT 18
+#define D64_RC_PC_MASK 0x00E00000 /* Prefetch control */
+#define D64_RC_PC_SHIFT 21
+#define D64_RC_PT_MASK 0x03000000 /* Prefetch threshold */
+#define D64_RC_PT_SHIFT 24
+
+/* flags for dma controller */
+#define DMA_CTRL_PEN (1 << 0) /* partity enable */
+#define DMA_CTRL_ROC (1 << 1) /* rx overflow continue */
+#define DMA_CTRL_RXMULTI (1 << 2) /* allow rx scatter to multiple descriptors */
+#define DMA_CTRL_UNFRAMED (1 << 3) /* Unframed Rx/Tx data */
+#define DMA_CTRL_USB_BOUNDRY4KB_WAR (1 << 4)
+#define DMA_CTRL_DMA_AVOIDANCE_WAR (1 << 5) /* DMA avoidance WAR for 4331 */
+
+/* receive descriptor table pointer */
+#define D64_RP_LD_MASK 0x00001fff /* last valid descriptor */
+
+/* receive channel status */
+#define D64_RS0_CD_MASK (di->d64_rs0_cd_mask) /* current descriptor pointer */
+#define D64_RS0_RS_MASK 0xf0000000 /* receive state */
+#define D64_RS0_RS_SHIFT 28
+#define D64_RS0_RS_DISABLED 0x00000000 /* disabled */
+#define D64_RS0_RS_ACTIVE 0x10000000 /* active */
+#define D64_RS0_RS_IDLE 0x20000000 /* idle wait */
+#define D64_RS0_RS_STOPPED 0x30000000 /* stopped */
+#define D64_RS0_RS_SUSP 0x40000000 /* suspend pending */
+
+#define D64_RS1_AD_MASK 0x0001ffff /* active descriptor */
+#define D64_RS1_RE_MASK 0xf0000000 /* receive errors */
+#define D64_RS1_RE_SHIFT 28
+#define D64_RS1_RE_NOERR 0x00000000 /* no error */
+#define D64_RS1_RE_DPO 0x10000000 /* descriptor protocol error */
+#define D64_RS1_RE_DFU 0x20000000 /* data fifo overflow */
+#define D64_RS1_RE_DTE 0x30000000 /* data transfer error */
+#define D64_RS1_RE_DESRE 0x40000000 /* descriptor read error */
+#define D64_RS1_RE_COREE 0x50000000 /* core error */
+
+/* fifoaddr */
+#define D64_FA_OFF_MASK 0xffff /* offset */
+#define D64_FA_SEL_MASK 0xf0000 /* select */
+#define D64_FA_SEL_SHIFT 16
+#define D64_FA_SEL_XDD 0x00000 /* transmit dma data */
+#define D64_FA_SEL_XDP 0x10000 /* transmit dma pointers */
+#define D64_FA_SEL_RDD 0x40000 /* receive dma data */
+#define D64_FA_SEL_RDP 0x50000 /* receive dma pointers */
+#define D64_FA_SEL_XFD 0x80000 /* transmit fifo data */
+#define D64_FA_SEL_XFP 0x90000 /* transmit fifo pointers */
+#define D64_FA_SEL_RFD 0xc0000 /* receive fifo data */
+#define D64_FA_SEL_RFP 0xd0000 /* receive fifo pointers */
+#define D64_FA_SEL_RSD 0xe0000 /* receive frame status data */
+#define D64_FA_SEL_RSP 0xf0000 /* receive frame status pointers */
+
+/* descriptor control flags 1 */
+#define D64_CTRL_COREFLAGS 0x0ff00000 /* core specific flags */
+#define D64_CTRL1_EOT ((uint32)1 << 28) /* end of descriptor table */
+#define D64_CTRL1_IOC ((uint32)1 << 29) /* interrupt on completion */
+#define D64_CTRL1_EOF ((uint32)1 << 30) /* end of frame */
+#define D64_CTRL1_SOF ((uint32)1 << 31) /* start of frame */
+
+/* descriptor control flags 2 */
+#define D64_CTRL2_BC_MASK 0x00007fff /* buffer byte count. real data len must <= 16KB */
+#define D64_CTRL2_AE 0x00030000 /* address extension bits */
+#define D64_CTRL2_AE_SHIFT 16
+#define D64_CTRL2_PARITY 0x00040000 /* parity bit */
+
+/* control flags in the range [27:20] are core-specific and not defined here */
+#define D64_CTRL_CORE_MASK 0x0ff00000
+
+#define D64_RX_FRM_STS_LEN 0x0000ffff /* frame length mask */
+#define D64_RX_FRM_STS_OVFL 0x00800000 /* RxOverFlow */
+#define D64_RX_FRM_STS_DSCRCNT 0x0f000000 /* no. of descriptors used - 1, d11corerev >= 22 */
+#define D64_RX_FRM_STS_DATATYPE 0xf0000000 /* core-dependent data type */
+
+/* receive frame status */
+typedef volatile struct {
+ uint16 len;
+ uint16 flags;
+} dma_rxh_t;
+
+#endif /* _sbhnddma_h_ */
/*
* BCM43XX Sonics SiliconBackplane PCMCIA core hardware definitions.
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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 356305 2012-09-12 04:55:06Z $
+ * $Id: sbpcmcia.h 381094 2013-01-25 04:45:06Z $
*/
#ifndef _SBPCMCIA_H
#define _SBPCMCIA_H
+/* All the addresses that are offsets in attribute space are divided
+ * by two to account for the fact that odd bytes are invalid in
+ * attribute space and our read/write routines make the space appear
+ * as if they didn't exist. Still we want to show the original numbers
+ * as documented in the hnd_pcmcia core manual.
+ */
-
-
+/* PCMCIA Function Configuration Registers */
#define PCMCIA_FCR (0x700 / 2)
#define FCR0_OFF 0
#define PCMCIA_FCR2 (0x780 / 2)
#define PCMCIA_FCR3 (0x7c0 / 2)
-
+/* Standard PCMCIA FCR registers */
#define PCMCIA_COR 0
#define F2_MEMOFF 0x3000
#define F3_MEMOFF 0x4000
-
+/* Memory base in the function fcr's */
#define MEM_ADDR0 (0x728 / 2)
#define MEM_ADDR1 (0x72a / 2)
#define MEM_ADDR2 (0x72c / 2)
-
+/* PCMCIA base plus Srom access in fcr0: */
#define PCMCIA_ADDR0 (0x072e / 2)
#define PCMCIA_ADDR1 (0x0730 / 2)
#define PCMCIA_ADDR2 (0x0732 / 2)
#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) /* Corerev >= 2 && <= 5 */
+#define SROM_INFO (0x07be / 2) /* Corerev >= 6 */
+/* Values for srom_cs: */
#define SROM_IDLE 0
#define SROM_WRITE 1
#define SROM_READ 2
#define SROM_WDS 7
#define SROM_DONE 8
-
+/* Fields in srom_info: */
#define SRI_SZ_MASK 0x03
#define SRI_BLANK 0x04
#define SRI_OTP 0x80
+/* sbtmstatelow */
+#define SBTML_INT_ACK 0x40000 /* ack the sb interrupt */
+#define SBTML_INT_EN 0x20000 /* enable sb interrupt */
-#define SBTML_INT_ACK 0x40000
-#define SBTML_INT_EN 0x20000
-
-
-#define SBTMH_INT_STATUS 0x40000
+/* sbtmstatehigh */
+#define SBTMH_INT_STATUS 0x40000 /* sb interrupt status */
-#endif
+#endif /* _SBPCMCIA_H */
*
* SDIO core support 1bit, 4 bit SDIO mode as well as SPI mode.
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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 369545 2012-11-19 08:38:45Z $
+ * $Id: sbsdio.h 383835 2013-02-07 23:32:39Z $
*/
#ifndef _SBSDIO_H
/* 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 */
* Broadcom SiliconBackplane SDIO/PCMCIA hardware-specific
* device core support
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
/*
* BCM47XX Sonics SiliconBackplane embedded ram core
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
#ifndef _LANGUAGE_ASSEMBLY
-
+/* cpp contortions to concatenate w/arg prescan */
#ifndef PAD
#define _PADLINE(line) pad ## line
#define _XSTR(line) _PADLINE(line)
#define PAD _XSTR(__LINE__)
-#endif
-
+#endif /* PAD */
+/* Memcsocram core registers */
typedef volatile struct sbsocramregs {
uint32 coreinfo;
uint32 bwalloc;
uint32 bankidx;
uint32 standbyctrl;
- uint32 errlogstatus;
- uint32 errlogaddr;
-
+ uint32 errlogstatus; /* rev 6 */
+ uint32 errlogaddr; /* rev 6 */
+ /* used for patching rev 3 & 5 */
uint32 cambankidx;
uint32 cambankstandbyctrl;
uint32 cambankpatchctrl;
uint32 cambankdatareg;
uint32 cambankmaskreg;
uint32 PAD[1];
- uint32 bankinfo;
+ uint32 bankinfo; /* corev 8 */
uint32 PAD[15];
uint32 extmemconfig;
uint32 extmemparitycsr;
uint32 extmemwrctrlandsize;
uint32 PAD[84];
uint32 workaround;
- uint32 pwrctl;
+ uint32 pwrctl; /* corerev >= 2 */
uint32 PAD[133];
- uint32 sr_control;
- uint32 sr_status;
- uint32 sr_address;
- uint32 sr_data;
+ uint32 sr_control; /* corerev >= 15 */
+ uint32 sr_status; /* corerev >= 15 */
+ uint32 sr_address; /* corerev >= 15 */
+ uint32 sr_data; /* corerev >= 15 */
} sbsocramregs_t;
-#endif
-
+#endif /* _LANGUAGE_ASSEMBLY */
+/* Register offsets */
#define SR_COREINFO 0x00
#define SR_BWALLOC 0x04
#define SR_BISTSTAT 0x0c
#define SR_BANKSTBYCTL 0x14
#define SR_PWRCTL 0x1e8
-
-#define SRCI_PT_MASK 0x00070000
+/* Coreinfo register */
+#define SRCI_PT_MASK 0x00070000 /* corerev >= 6; port type[18:16] */
#define SRCI_PT_SHIFT 16
-
+/* port types : SRCI_PT_<processorPT>_<backplanePT> */
#define SRCI_PT_OCP_OCP 0
#define SRCI_PT_AXI_OCP 1
#define SRCI_PT_ARM7AHB_OCP 2
#define SRCI_PT_CM3AHB_OCP 3
#define SRCI_PT_AXI_AXI 4
#define SRCI_PT_AHB_AXI 5
-
+/* corerev >= 3 */
#define SRCI_LSS_MASK 0x00f00000
#define SRCI_LSS_SHIFT 20
#define SRCI_LRS_MASK 0x0f000000
#define SRCI_LRS_SHIFT 24
-
+/* In corerev 0, the memory size is 2 to the power of the
+ * base plus 16 plus to the contents of the memsize field plus 1.
+ */
#define SRCI_MS0_MASK 0xf
#define SR_MS0_BASE 16
-
+/*
+ * In corerev 1 the bank size is 2 ^ the bank size field plus 14,
+ * the memory size is number of banks times bank size.
+ * The same applies to rom size.
+ */
#define SRCI_ROMNB_MASK 0xf000
#define SRCI_ROMNB_SHIFT 12
#define SRCI_ROMBSZ_MASK 0xf00
#define SR_BSZ_BASE 14
-
+/* Standby control register */
#define SRSC_SBYOVR_MASK 0x80000000
#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 /* rev >= 3 */
#define SRSC_SBYEN_SHIFT 24
-
-#define SRPC_PMU_STBYDIS_MASK 0x00000010
+/* Power control register */
+#define SRPC_PMU_STBYDIS_MASK 0x00000010 /* rev >= 3 */
#define SRPC_PMU_STBYDIS_SHIFT 4
#define SRPC_STBYOVRVAL_MASK 0x00000008
#define SRPC_STBYOVRVAL_SHIFT 3
#define SRPC_STBYOVR_MASK 0x00000007
#define SRPC_STBYOVR_SHIFT 0
-
+/* Extra core capability register */
#define SRECC_NUM_BANKS_MASK 0x000000F0
#define SRECC_NUM_BANKS_SHIFT 4
#define SRECC_BANKSIZE_MASK 0x0000000F
#define SRECC_BANKSIZE(value) (1 << (value))
-
+/* CAM bank patch control */
#define SRCBPC_PATCHENABLE 0x80000000
#define SRP_ADDRESS 0x0001FFFC
#define SRP_VALID 0x8000
-
+/* CAM bank command reg */
#define SRCMD_WRITE 0x00020000
#define SRCMD_READ 0x00010000
#define SRCMD_DONE 0x80000000
#define SRCMD_DONE_DLY 1000
-
+/* bankidx and bankinfo reg defines corerev >= 8 */
#define SOCRAM_BANKINFO_SZMASK 0x7f
#define SOCRAM_BANKIDX_ROM_MASK 0x100
#define SOCRAM_BANKIDX_MEMTYPE_SHIFT 8
-
+/* socram bankinfo memtype */
#define SOCRAM_MEMTYPE_RAM 0
#define SOCRAM_MEMTYPE_R0M 1
#define SOCRAM_MEMTYPE_DEVRAM 2
#define SOCRAM_BANKINFO_STDBY_MASK 0x400
#define SOCRAM_BANKINFO_STDBY_TIMER 0x800
-
+/* bankinfo rev >= 10 */
#define SOCRAM_BANKINFO_DEVRAMSEL_SHIFT 13
#define SOCRAM_BANKINFO_DEVRAMSEL_MASK 0x2000
#define SOCRAM_BANKINFO_DEVRAMPRO_SHIFT 14
#define SOCRAM_BANKINFO_DEVRAMREMAP_SHIFT 24
#define SOCRAM_BANKINFO_DEVRAMREMAP_MASK 0x01000000
-
+/* extracoreinfo register */
#define SOCRAM_DEVRAMBANK_MASK 0xF000
#define SOCRAM_DEVRAMBANK_SHIFT 12
-
+/* bank info to calculate bank size */
#define SOCRAM_BANKINFO_SZBASE 8192
-#define SOCRAM_BANKSIZE_SHIFT 13
+#define SOCRAM_BANKSIZE_SHIFT 13 /* SOCRAM_BANKINFO_SZBASE */
-#endif
+#endif /* _SBSOCRAM_H */
* SDIO spec header file
* Protocol and standard (common) device definitions
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* SDIO Host Controller Spec header file
* Register map and definitions for the Standard Host Controller
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* Structure used by apps whose drivers access SDIO drivers.
* Pulled out separately so dhdu and wlu can both use it.
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
#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>
* Misc utility routines for accessing the SOC Interconnects
* of Broadcom HNBU chips.
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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 364853 2012-10-25 18:54:06Z $
+ * $Id: siutils.h 385510 2013-02-15 21:02:07Z $
*/
#ifndef _siutils_h_
#define _siutils_h_
-
+/*
+ * Data structure to export all chip specific common variables
+ * public (read-only) portion of siutils handle returned by si_attach()/si_kattach()
+ */
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; /* SOCI_SB, SOCI_AI */
+
+ uint bustype; /* SI_BUS, PCI_BUS */
+ uint buscoretype; /* PCI_CORE_ID, PCIE_CORE_ID, PCMCIA_CORE_ID */
+ uint buscorerev; /* buscore rev */
+ uint buscoreidx; /* buscore index */
+ int ccrev; /* chip common core rev */
+ uint32 cccaps; /* chip common capabilities */
+ uint32 cccaps_ext; /* chip common capabilities extension */
+ int pmurev; /* pmu core rev */
+ uint32 pmucaps; /* pmu capabilities */
+ uint boardtype; /* board type */
+ uint boardrev; /* board rev */
+ uint boardvendor; /* board vendor */
+ uint boardflags; /* board flags */
+ uint boardflags2; /* board flags2 */
+ uint chip; /* chip number */
+ uint chiprev; /* chip revision */
+ uint chippkg; /* chip package option */
+ uint32 chipst; /* chip status */
+ bool issim; /* chip is in simulation or emulation */
+ uint socirev; /* SOC interconnect rev */
bool pci_pr32414;
};
-
+/* for HIGH_ONLY driver, the si_t must be writable to allow states sync from BMAC to HIGH driver
+ * for monolithic driver, it is readonly to prevent accident change
+ */
typedef const struct si_pub si_t;
-
-#define SI_OSH NULL
+/*
+ * Many of the routines below take an 'sih' handle as their first arg.
+ * Allocate this by calling si_attach(). Free it by calling si_detach().
+ * At any one time, the sih is logically focused on one particular si core
+ * (the "current core").
+ * Use si_setcore() or si_setcoreidx() to change the association to another core.
+ */
+#define SI_OSH NULL /* Use for si_kattach when no osh is available */
#define BADIDX (SI_MAXCORES + 1)
+/* clkctl xtal what flags */
+#define XTAL 0x1 /* primary crystal oscillator (2050) */
+#define PLL 0x2 /* main chip pll */
-#define XTAL 0x1
-#define PLL 0x2
-
-
-#define CLK_FAST 0
-#define CLK_DYNAMIC 2
-
-
-#define GPIO_DRV_PRIORITY 0
-#define GPIO_APP_PRIORITY 1
-#define GPIO_HI_PRIORITY 2
+/* clkctl clk mode */
+#define CLK_FAST 0 /* force fast (pll) clock */
+#define CLK_DYNAMIC 2 /* enable dynamic clock control */
+/* GPIO usage priorities */
+#define GPIO_DRV_PRIORITY 0 /* Driver */
+#define GPIO_APP_PRIORITY 1 /* Application */
+#define GPIO_HI_PRIORITY 2 /* Highest priority. Ignore GPIO reservation */
+/* GPIO pull up/down */
#define GPIO_PULLUP 0
#define GPIO_PULLDN 1
+/* GPIO event regtype */
+#define GPIO_REGEVT 0 /* GPIO register event */
+#define GPIO_REGEVT_INTMSK 1 /* GPIO register event int mask */
+#define GPIO_REGEVT_INTPOL 2 /* GPIO register event int polarity */
-#define GPIO_REGEVT 0
-#define GPIO_REGEVT_INTMSK 1
-#define GPIO_REGEVT_INTPOL 2
-
-
-#define SI_DEVPATH_BUFSZ 16
-
+/* device path */
+#define SI_DEVPATH_BUFSZ 16 /* min buffer size in bytes */
+/* SI routine enumeration: to be used by update function with multiple hooks */
#define SI_DOATTACH 1
#define SI_PCIDOWN 2
#define SI_PCIUP 3
#define ISSIM_ENAB(sih) 0
-
+/* PMU clock/power control */
#if defined(BCMPMUCTL)
#define PMUCTL_ENAB(sih) (BCMPMUCTL)
#else
#define PMUCTL_ENAB(sih) ((sih)->cccaps & CC_CAP_PMU)
#endif
-
+/* chipcommon clock/power control (exclusive with PMU's) */
#if defined(BCMPMUCTL) && BCMPMUCTL
#define CCCTL_ENAB(sih) (0)
#define CCPLL_ENAB(sih) (0)
#endif
typedef void (*gpio_handler_t)(uint32 stat, void *arg);
-
+/* External BT Coex enable mask */
#define CC_BTCOEX_EN_MASK 0x01
-
+/* External PA enable mask */
#define GPIO_CTRL_EPA_EN_MASK 0x40
-
+/* WL/BT control enable mask */
#define GPIO_CTRL_5_6_EN_MASK 0x60
#define GPIO_CTRL_7_6_EN_MASK 0xC0
#define GPIO_OUT_7_EN_MASK 0x80
-
+/* CR4 specific defines used by the host driver */
#define SI_CR4_CAP (0x04)
#define SI_CR4_BANKIDX (0x40)
#define SI_CR4_BANKINFO (0x44)
#define ARMCR4_BSZ_MULT 8192
-
+/* === exported functions === */
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);
extern uint si_corelist(si_t *sih, uint coreid[]);
extern uint si_coreid(si_t *sih);
extern uint si_flag(si_t *sih);
+extern uint si_flag_alt(si_t *sih);
extern uint si_intflag(si_t *sih);
extern uint si_coreidx(si_t *sih);
extern uint si_coreunit(si_t *sih);
extern void *si_coreregs(si_t *sih);
extern uint si_wrapperreg(si_t *sih, uint32 offset, uint32 mask, uint32 val);
extern uint si_core_wrapperreg(si_t *sih, uint32 coreidx, uint32 offset, uint32 mask, uint32 val);
+extern void *si_wrapperregs(si_t *sih);
extern uint32 si_core_cflags(si_t *sih, uint32 mask, uint32 val);
extern void si_core_cflags_wo(si_t *sih, uint32 mask, uint32 val);
extern uint32 si_core_sflags(si_t *sih, uint32 mask, uint32 val);
extern void si_core_reset(si_t *sih, uint32 bits, uint32 resetbits);
extern void si_core_disable(si_t *sih, uint32 bits);
extern uint32 si_clock_rate(uint32 pll_type, uint32 n, uint32 m);
+extern uint si_chip_hostif(si_t *sih);
extern bool si_read_pmu_autopll(si_t *sih);
extern uint32 si_clock(si_t *sih);
extern uint32 si_alp_clock(si_t *sih);
extern uint32 si_gpioevent(si_t *sih, uint regtype, uint32 mask, uint32 val);
extern uint32 si_gpio_int_enable(si_t *sih, bool enable);
-
+/* GPIO event handlers */
extern void *si_gpio_handler_register(si_t *sih, uint32 e, bool lev, gpio_handler_t cb, void *arg);
extern void si_gpio_handler_unregister(si_t *sih, void* gpioh);
extern void si_gpio_handler_process(si_t *sih);
-
+/* Wake-on-wireless-LAN (WOWL) */
extern bool si_pci_pmecap(si_t *sih);
struct osl_info;
extern bool si_pci_fastpmecap(struct osl_info *osh);
#define si_gci(sih) 0
static INLINE void * si_gci_init(si_t *sih) {return NULL;}
-
+/* OTP status */
extern bool si_is_otp_disabled(si_t *sih);
extern bool si_is_otp_powered(si_t *sih);
extern void si_otp_power(si_t *sih, bool on);
-
+/* SPROM availability */
extern bool si_is_sprom_available(si_t *sih);
extern bool si_is_sprom_enabled(si_t *sih);
extern void si_sprom_enable(si_t *sih, bool enable);
-
+/* OTP/SROM CIS stuff */
extern int si_cis_source(si_t *sih);
#define CIS_DEFAULT 0
#define CIS_SROM 1
#define CIS_OTP 2
-
-#define DEFAULT_FAB 0x0
-#define CSM_FAB7 0x1
-#define TSMC_FAB12 0x2
-#define SMIC_FAB4 0x3
+/* Fab-id information */
+#define DEFAULT_FAB 0x0 /* Original/first fab used for this chip */
+#define CSM_FAB7 0x1 /* CSM Fab7 chip */
+#define TSMC_FAB12 0x2 /* TSMC Fab12/Fab14 chip */
+#define SMIC_FAB4 0x3 /* SMIC Fab4 chip */
extern int si_otp_fabid(si_t *sih, uint16 *fabid, bool rw);
extern uint16 si_fabid(si_t *sih);
-
+/*
+ * Build device path. Path size must be >= SI_DEVPATH_BUFSZ.
+ * The returned path is NULL terminated and has trailing '/'.
+ * Return 0 on success, nonzero otherwise.
+ */
extern int si_devpath(si_t *sih, char *path, int size);
-
+/* Read variable with prepending the devpath to the name */
extern char *si_getdevpathvar(si_t *sih, const char *name);
extern int si_getdevpathintvar(si_t *sih, const char *name);
extern char *si_coded_devpathvar(si_t *sih, char *varname, int var_len, const char *name);
extern void si_chipcontrl_epa4331(si_t *sih, bool on);
extern void si_chipcontrl_epa4331_wowl(si_t *sih, bool enter_wowl);
extern void si_chipcontrl_srom4360(si_t *sih, bool on);
-
+/* Enable BT-COEX & Ex-PA for 4313 */
extern void si_epa_4313war(si_t *sih);
extern void si_btc_enable_chipcontrol(si_t *sih);
-
+/* BT/WL selection for 4313 bt combo >= P250 boards */
extern void si_btcombo_p250_4313_war(si_t *sih);
extern void si_btcombo_43228_war(si_t *sih);
extern void si_clk_pmu_htavail_set(si_t *sih, bool set_clear);
extern void si_pmu_synth_pwrsw_4313_war(si_t *sih);
extern uint si_pll_reset(si_t *sih);
-
+/* === debug routines === */
extern bool si_taclear(si_t *sih, bool details);
+extern uint32 si_ccreg(si_t *sih, uint32 offset, uint32 mask, uint32 val);
extern uint32 si_pciereg(si_t *sih, uint32 offset, uint32 mask, uint32 val, uint type);
extern uint32 si_pcieserdesreg(si_t *sih, uint32 mdioslave, uint32 offset, uint32 mask, uint32 val);
extern void si_pcie_set_request_size(si_t *sih, uint16 size);
extern uint8 si_gci_get_chipctrlreg_idx(uint32 pin, uint32 *regidx, uint32 *pos);
extern uint32 si_gci_chipcontrol(si_t *sih, uint reg, uint32 mask, uint32 val);
-#endif
+#define CHIPCTRLREG2 0x2
+#define CHIPCTRLREG3 0x3
+#define CHIPCTRLREG4 0x4
+#define MINRESMASKREG 0x618
+#define CHIPCTRLADDR 0x650
+#define CHIPCTRLDATA 0x654
+#define RSRCTABLEADDR 0x620
+#define RSRCUPDWNTIME 0x628
+#define PMUREG_RESREQ_MASK 0x68c
+
+void
+si_update_masks(si_t *sih);
+
+void
+si_force_islanding(si_t *sih, bool enable);
+
+#endif /* _siutils_h_ */
/*
* TRX image file header format.
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
/*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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: typedefs.h 286783 2011-09-29 06:18:57Z $
+ * $Id: typedefs.h 397286 2013-04-18 01:42:19Z $
*/
#ifndef _TYPEDEFS_H_
#ifdef SITE_TYPEDEFS
-
+/*
+ * Define SITE_TYPEDEFS in the compile to include a site-specific
+ * typedef file "site_typedefs.h".
+ *
+ * If SITE_TYPEDEFS is not defined, then the code section below makes
+ * inferences about the compile environment based on defined symbols and
+ * possibly compiler pragmas.
+ *
+ * Following these two sections is the Default Typedefs section.
+ * This section is only processed if USE_TYPEDEF_DEFAULTS is
+ * defined. This section has a default set of typedefs and a few
+ * preprocessor symbols (TRUE, FALSE, NULL, ...).
+ */
#include "site_typedefs.h"
#else
-
+/*
+ * Infer the compile environment based on preprocessor symbols and pragmas.
+ * Override type definitions as needed, and include configuration-dependent
+ * header files to define types.
+ */
#ifdef __cplusplus
#define TRUE true
#endif
-#else
+#else /* ! __cplusplus */
-#endif
+#endif /* ! __cplusplus */
#if defined(__x86_64__)
#define TYPEDEF_UINTPTR
+
#if defined(__sparc__)
#define TYPEDEF_ULONG
#endif
-
+/*
+ * If this is either a Linux hybrid build or the per-port code of a hybrid build
+ * then use the Linux header files to get some of the typedefs. Otherwise, define
+ * them entirely in this file. We can't always define the types because we get
+ * a duplicate typedef error; there is no way to "undefine" a typedef.
+ * We know when it's per-port code because each file defines LINUX_PORT at the top.
+ */
#if !defined(LINUX_HYBRID) || defined(LINUX_PORT)
#define TYPEDEF_UINT
#ifndef TARGETENV_android
#define TYPEDEF_USHORT
#define TYPEDEF_ULONG
-#endif
+#endif /* TARGETENV_android */
#ifdef __KERNEL__
#include <linux/version.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19))
#define TYPEDEF_BOOL
-#endif
-
+#endif /* >= 2.6.19 */
+/* special detection for 2.6.18-128.7.1.0.1.el5 */
#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 /* == 2.6.18 */
+#endif /* __KERNEL__ */
+#endif /* !defined(LINUX_HYBRID) || defined(LINUX_PORT) */
+/* Do not support the (u)int64 types with strict ansi for GNU C */
#if defined(__GNUC__) && defined(__STRICT_ANSI__)
#define TYPEDEF_INT64
#define TYPEDEF_UINT64
-#endif
-
+#endif /* defined(__GNUC__) && defined(__STRICT_ANSI__) */
+/* ICL accepts unsigned 64 bit type only, and complains in ANSI mode
+ * for signed or unsigned
+ */
#if defined(__ICL)
#define TYPEDEF_INT64
#define TYPEDEF_UINT64
#endif
-#endif
+#endif /* __ICL */
#if !defined(__DJGPP__)
-
+/* pick up ushort & uint from standard types.h */
#if defined(__KERNEL__)
-
+/* See note above */
#if !defined(LINUX_HYBRID) || defined(LINUX_PORT)
-#include <linux/types.h>
-#endif
+#include <linux/types.h> /* sys/types.h and linux/types.h are oil and water */
+#endif /* !defined(LINUX_HYBRID) || defined(LINUX_PORT) */
#else
#include <sys/types.h>
-#endif
+#endif /* linux && __KERNEL__ */
#endif
-
+/* use the default typedefs in the next section of this file */
#define USE_TYPEDEF_DEFAULTS
-#endif
-
+#endif /* SITE_TYPEDEFS */
+/*
+ * Default Typedefs
+ */
#ifdef USE_TYPEDEF_DEFAULTS
#undef USE_TYPEDEF_DEFAULTS
#ifndef TYPEDEF_BOOL
-typedef unsigned char bool;
+typedef /* @abstract@ */ unsigned char bool;
#endif
-
+/* define uchar, ushort, uint, ulong */
#ifndef TYPEDEF_UCHAR
typedef unsigned char uchar;
typedef unsigned long ulong;
#endif
-
+/* define [u]int8/16/32/64, uintptr */
#ifndef TYPEDEF_UINT8
typedef unsigned char uint8;
typedef signed long long int64;
#endif
-
+/* define float32/64, float_t */
#ifndef TYPEDEF_FLOAT32
typedef float float32;
typedef double float64;
#endif
-
+/*
+ * abstracted floating point type allows for compile time selection of
+ * single or double precision arithmetic. Compiling with -DFLOAT32
+ * selects single precision; the default is double precision.
+ */
#ifndef TYPEDEF_FLOAT_T
#if defined(FLOAT32)
typedef float32 float_t;
-#else
+#else /* default to double precision floating point */
typedef float64 float_t;
#endif
-#endif
-
+#endif /* TYPEDEF_FLOAT_T */
+/* define macro values */
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
-#define TRUE 1
+#define TRUE 1 /* TRUE */
#endif
#ifndef NULL
#endif
#ifndef ON
-#define ON 1
+#define ON 1 /* ON = 1 */
#endif
-#define AUTO (-1)
-
+#define AUTO (-1) /* Auto = -1 */
+/* define PTRSZ, INLINE */
#ifndef PTRSZ
#define PTRSZ sizeof(char*)
#endif
-
+/* Detect compiler type. */
#if defined(__GNUC__) || defined(__lint)
#define BWL_COMPILER_GNU
#elif defined(__CC_ARM) && __CC_ARM
#else
#define INLINE
#endif
-#endif
+#endif /* INLINE */
#undef TYPEDEF_BOOL
#undef TYPEDEF_UCHAR
#undef TYPEDEF_FLOAT64
#undef TYPEDEF_FLOAT_T
-#endif
-
+#endif /* USE_TYPEDEF_DEFAULTS */
+/* Suppress unused parameter warning */
#define UNUSED_PARAMETER(x) (void)(x)
-
+/* Avoid warning for discarded const or volatile qualifier in special cases (-Wcast-qual) */
#define DISCARD_QUAL(ptr, type) ((type *)(uintptr)(ptr))
-
+/*
+ * Including the bcmdefs.h here, to make sure everyone including typedefs.h
+ * gets this automatically
+*/
#include <bcmdefs.h>
-#endif
+#endif /* _TYPEDEFS_H_ */
/*
-* Copyright (C) 1999-2012, Broadcom Corporation
+* Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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 358262 2012-09-21 21:39:29Z $
+* $Id: wlfc_proto.h 381382 2013-01-27 07:13:00Z $
*
*/
#ifndef __wlfc_proto_definitions_h__
---------------------------------------------------------------------------
| 3 | 2 | (count, handle, prec_bmp)| Set the credit depth for a MAC dstn
---------------------------------------------------------------------------
- | 4 | 4 | see pkttag comments | TXSTATUS
+ | 4 | 4+ | see pkttag comments | TXSTATUS
+ | | | TX status & timestamps | Present only when pkt timestamp is enabled
---------------------------------------------------------------------------
| 5 | 4 | see pkttag comments | PKKTTAG [host->firmware]
---------------------------------------------------------------------------
| 13 | 3 | (count, handle, prec_bmp)| One time request for packet to a specific
| | | | MAC destination.
---------------------------------------------------------------------------
+ | 15 | 12 | (pkttag, timestamps) | Send TX timestamp at reception from host
+ ---------------------------------------------------------------------------
+ | 16 | 12 | (pkttag, timestamps) | Send WLAN RX timestamp along with RX frame
+ ---------------------------------------------------------------------------
| 255 | N/A | N/A | FILLER - This is a special type
| | | | that has no length or value.
| | | | Typically used for padding.
#define WLFC_CTL_TYPE_MAC_REQUEST_PACKET 13
#define WLFC_CTL_TYPE_HOST_REORDER_RXPKTS 14
+#define WLFC_CTL_TYPE_TX_ENTRY_STAMP 15
+#define WLFC_CTL_TYPE_RX_STAMP 16
+
#define WLFC_CTL_TYPE_TRANS_ID 18
#define WLFC_CTL_TYPE_COMP_TXSTATUS 19
*
* Definitions subject to change without notice.
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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 369547 2012-11-19 08:57:31Z $
+ * $Id: wlioctl.h 397263 2013-04-18 00:36:48Z $
*/
#ifndef _wlioctl_h_
#include <bcmcdc.h>
#endif /* LINUX_POSTMOGRIFY_REMOVAL */
-#ifdef CUSTOMER_HW4
-#include <dhd_sec_feature.h>
-#endif /* CUSTOMER_HW4 */
-
/* 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.
} rem_ioctl_t;
#define REMOTE_SIZE sizeof(rem_ioctl_t)
+
+typedef struct {
+ uint32 num;
+ chanspec_t list[1];
+} chanspec_list_t;
+
#define ACTION_FRAME_SIZE 1800
typedef struct wl_action_frame {
typedef struct wlc_ssid {
uint32 SSID_len;
- uchar SSID[32];
+ uchar SSID[DOT11_MAX_SSID_LEN];
} wlc_ssid_t;
#ifndef LINUX_POSTMOGRIFY_REMOVAL
#define WL_SCANFLAGS_RESERVED 0x02 /* Reserved */
#define WL_SCANFLAGS_PROHIBITED 0x04 /* allow scanning prohibited channels */
#define WL_SCANFLAGS_OFFCHAN 0x08 /* allow scanning/reporting off-channel APs */
+#define WL_SCANFLAGS_HOTSPOT 0x10 /* automatic ANQP to hotspot APs */
#define WL_SCAN_PARAMS_SSID_MAX 10
/* Used in EXT_STA */
#define DNGL_RXCTXT_SIZE 45
-#if defined(SIMPLE_ISCAN)
-#define ISCAN_RETRY_CNT 5
-#define ISCAN_STATE_IDLE 0
-#define ISCAN_STATE_SCANING 1
-#define ISCAN_STATE_PENDING 2
-
-/* the buf lengh can be WLC_IOCTL_MAXLEN (8K) to reduce iteration */
-#define WLC_IW_ISCAN_MAXLEN 2048
-typedef struct iscan_buf {
- struct iscan_buf * next;
- char iscan_buf[WLC_IW_ISCAN_MAXLEN];
-} iscan_buf_t;
-#endif /* SIMPLE_ISCAN */
#define ESCAN_REQ_VERSION 1
} 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 */
#define CRYPTO_ALGO_AES_CCM 4
#define CRYPTO_ALGO_AES_OCB_MSDU 5
#define CRYPTO_ALGO_AES_OCB_MPDU 6
-#if !defined(BCMCCX) && !defined(BCMEXTCCX)
+#if !defined(BCMEXTCCX)
#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 /* !BCMCCX && !BCMEXTCCX */
-#ifdef BCMWAPI_WPI
-#define CRYPTO_ALGO_SMS4 11
-#endif /* BCMWAPI_WPI */
+#endif
#define CRYPTO_ALGO_PMK 12 /* for 802.1x supp to set PMK before 4-way */
#define CRYPTO_ALGO_BIP 13 /* 802.11w BIP (aes cmac) */
#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) || defined(BCMEXTCCX)
+#if defined(BCMEXTCCX)
#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 /* BCMCCX || BCMEXTCCX */
+#endif
#define WL_IBSS_PEER_GROUP_KEY (1 << 6) /* Indicates a group key for a IBSS PEER */
typedef struct wl_wsec_key {
#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
-#endif /* BCMWAPI_WPI */
/* wsec macros for operating on the above definitions */
#define WSEC_WEP_ENABLED(wsec) ((wsec) & WEP_ENABLED)
#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)
-#endif /* BCMWAPI_WAI */
#define MFP_CAPABLE 0x0200
#define MFP_REQUIRED 0x0400
#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)
+#if defined(BCMEXTCCX)
#define WPA_AUTH_CCKM 0x0008 /* CCKM */
#define WPA2_AUTH_CCKM 0x0010 /* CCKM2 */
-#endif /* BCMCCX || BCMEXTCCX */
+#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 */
#define BRCM_AUTH_PSK 0x0100 /* BRCM specific PSK */
#define BRCM_AUTH_DPT 0x0200 /* DPT PSK without group keys */
-#if defined(BCMWAPI_WAI) || defined(BCMWAPI_WPI)
-#define WPA_AUTH_WAPI 0x0400
-#define WAPI_AUTH_NONE WPA_AUTH_NONE /* none (IBSS) */
-#define WAPI_AUTH_UNSPECIFIED 0x0400 /* over AS */
-#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 WPA_AUTH_PFN_ANY 0xffffffff /* for PFN, match only ssid */
/* pmkid */
-/* Due to pmkid_info driver IOVar/dhd implementation, leave this as 16 for now. */
#define MAXPMKID 16
typedef struct _pmkid {
/* #define WLC_SET_WAI_REKEY 315 */ /* for WAPI, deprecated use iovar instead */
#define WLC_SET_NAT_CONFIG 316 /* for configuring NAT filter driver */
#define WLC_GET_NAT_STATE 317
-#define WLC_LAST 318
+#define WLC_GET_RSSI_QDB 318 /* qdB portion of the RSSI */
+#define WLC_LAST 319
#ifndef EPICTRL_COOKIE
#define EPICTRL_COOKIE 0xABADCEDE
/* WLC_GET_AUTH, WLC_SET_AUTH values */
#define WL_AUTH_OPEN_SYSTEM 0 /* d11 open authentication */
#define WL_AUTH_SHARED_KEY 1 /* d11 shared authentication */
-#define WL_AUTH_OPEN_SHARED 2 /* try open, then shared if open failed w/rc 13 */
+#define WL_AUTH_OPEN_SHARED 2 /* try open, then shared if open failed w/rc 13 */
+
#endif /* LINUX_POSTMOGRIFY_REMOVAL */
/* Bit masks for radio disabled status - returned by WL_GET_RADIO */
#define WL_SPURAVOID_ON1 1
#define WL_SPURAVOID_ON2 2
+
+#define WL_4335_SPURAVOID_ON1 1
+#define WL_4335_SPURAVOID_ON2 2
+#define WL_4335_SPURAVOID_ON3 3
+#define WL_4335_SPURAVOID_ON4 4
+#define WL_4335_SPURAVOID_ON5 5
+#define WL_4335_SPURAVOID_ON6 6
+#define WL_4335_SPURAVOID_ON7 7
+#define WL_4335_SPURAVOID_ON8 8
+#define WL_4335_SPURAVOID_ON9 9
+
/* Override bit for WLC_SET_TXPWR. if set, ignore other level limits */
#define WL_TXPWR_OVERRIDE (1U<<31)
#define WL_TXPWR_NEG (1U<<30)
chanspec_t chanspec; /* txpwr report for this channel */
chanspec_t local_chanspec; /* channel on which we are associated */
uint32 buflen; /* ppr buffer length */
- uint8 pprbuf[1]; /* Latest target power buffer buffer */
+ uint8 pprbuf[1]; /* Latest target power buffer */
} wl_txppr_t;
#define WL_TXPPR_VERSION 0
#define WL_PSTA_VAL 0x00008000
#define WL_TBTT_VAL 0x00010000
#define WL_NIC_VAL 0x00020000
-#define WL_PWRSEL_VAL 0x00040000
-#define WL_TRF_MGMT_VAL 0x00080000
-#define WL_L2FILTER_VAL 0x00100000
+#define WL_PWRSEL_VAL 0x00040000
+#define WL_TRF_MGMT_VAL 0x00080000
+#define WL_L2FILTER_VAL 0x00100000
#define WL_TSO_VAL 0x00200000
#define WL_MQ_VAL 0x00400000
+/* These 3 levels are currently not used in trunk but in Aardvark and Phoenix2 with != values */
+#define WL_LPC_VAL 0x00800000
+#define WL_TXBF_VAL 0x01000000
+#define WL_P2PO_VAL 0x02000000
+/* This level is synchronized with other branches */
+#define WL_WNM_VAL 0x04000000
+/* This level is currently not used in trunk but used in Phoenix2 */
+#define WL_SRSCAN_VAL 0x08000000
/* use top-bit for WL_TIME_STAMP_VAL because this is a modifier
* rather than a message-type of its own
#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
#endif /* LINUX_POSTMOGRIFY_REMOVAL */
+/* Service discovery */
+typedef struct {
+ uint8 transaction_id; /* Transaction id */
+ uint8 protocol; /* Service protocol type */
+ uint16 query_len; /* Length of query */
+ uint16 response_len; /* Length of response */
+ uint8 qrbuf[1];
+} wl_p2po_qr_t;
+
+typedef struct {
+ uint16 period; /* extended listen period */
+ uint16 interval; /* extended listen interval */
+} wl_p2po_listen_t;
+
+/* ANQP offload */
+
+#define ANQPO_MAX_QUERY_SIZE 256
+typedef struct {
+ uint16 max_retransmit; /* -1 use default, max retransmit on no ACK from peer */
+ uint16 response_timeout; /* -1 use default, msec to wait for resp after tx packet */
+ uint16 max_comeback_delay; /* -1 use default, max comeback delay in resp else fail */
+ uint16 max_retries; /* -1 use default, max retries on failure */
+ uint16 query_len; /* length of ANQP query */
+ uint8 query_data[1]; /* ANQP encoded query (max ANQPO_MAX_QUERY_SIZE) */
+} wl_anqpo_set_t;
+
+typedef struct {
+ uint16 channel; /* channel of the peer */
+ struct ether_addr addr; /* addr of the peer */
+} wl_anqpo_peer_t;
+
+#define ANQPO_MAX_PEER_LIST 64
+typedef struct {
+ uint16 count; /* number of peers in list */
+ wl_anqpo_peer_t peer[1]; /* max ANQPO_MAX_PEER_LIST */
+} wl_anqpo_peer_list_t;
+
+#define ANQPO_MAX_IGNORE_SSID 64
+typedef struct {
+ bool is_clear; /* set to clear list (not used on GET) */
+ uint16 count; /* number of SSID in list */
+ wlc_ssid_t ssid[1]; /* max ANQPO_MAX_IGNORE_SSID */
+} wl_anqpo_ignore_ssid_list_t;
+
+#define ANQPO_MAX_IGNORE_BSSID 64
+typedef struct {
+ bool is_clear; /* set to clear list (not used on GET) */
+ uint16 count; /* number of addr in list */
+ struct ether_addr bssid[1]; /* max ANQPO_MAX_IGNORE_BSSID */
+} wl_anqpo_ignore_bssid_list_t;
+
/* TCP Checksum Offload defines */
#define TOE_TX_CSUM_OL 0x00000001
#define TOE_RX_CSUM_OL 0x00000002
uint32 num_pkts_discarded; /* # packets discarded by dongle for all filters */
} wl_pkt_filter_stats_t;
+#define RSN_KCK_LENGTH 16
+#define RSN_KEK_LENGTH 16
+#define RSN_REPLAY_LEN 8
+typedef struct _gtkrefresh {
+ uchar KCK[RSN_KCK_LENGTH];
+ uchar KEK[RSN_KEK_LENGTH];
+ uchar ReplayCounter[RSN_REPLAY_LEN];
+} gtk_keyinfo_t, *pgtk_keyinfo_t;
+
/* Sequential Commands ioctl */
typedef struct wl_seq_cmd_ioctl {
uint32 cmd; /* common ioctl definition */
int32 rssi; /* RSSI */
int32 snr; /* signal to noise ratio */
uint16 rxpktcnt[NUM_80211_RATES+1];
+ uint8 rssi_qdb; /* qdB portion of the computed rssi */
} wl_pkteng_stats_t;
#define LOGRRC_FIX_LEN 8
#define IOBUF_ALLOWED_NUM_OF_LOGREC(type, len) ((len - LOGRRC_FIX_LEN)/sizeof(type))
-#ifdef BCMWAPI_WAI
-#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];
-};
-#endif /* BCMWAPI_WAI */
/* channel interference measurement (chanim) related defines */
uint8 tune; /* Debug */
} txdelay_params_t;
+#define WL_RELMCAST_MAX_CLIENT 32
+#define WL_RELMCAST_FLAG_INBLACKLIST 1
+#define WL_RELMCAST_FLAG_ACTIVEACKER 2
+#define WL_RELMCAST_FLAG_RELMCAST 4
+
+#define WL_RELMCAST_VER 1
+
+typedef struct wl_relmcast_client {
+ uint8 flag;
+ int16 rssi;
+ struct ether_addr addr;
+} wl_relmcast_client_t;
+
+typedef struct wl_relmcast_st {
+ uint8 ver;
+ uint8 num;
+ wl_relmcast_client_t clients[WL_RELMCAST_MAX_CLIENT];
+} wl_relmcast_status_t;
+
#endif /* LINUX_POSTMOGRIFY_REMOVAL */
/* fbt_cap: FBT assoc / reassoc modes. */
uint16 reps;
} statreq_t;
-#ifdef EVENT_LOG_COMPILE
-typedef struct wlc_event_log_set_s {
+typedef struct wl_el_set_params_s {
uint8 set; /* Set number */
uint32 size; /* Size to make/expand */
-} wlc_event_log_set_t;
+} wl_el_set_params_t;
-typedef struct wlc_event_log_tag_s {
+typedef struct wl_el_tag_params_s {
uint16 tag;
uint8 set;
uint8 flags;
-} wlc_event_log_tag_t;
-#endif /* EVENT_LOG_COMPILE */
+} wl_el_tag_params_t;
#endif /* _wlioctl_h_ */
/*
* Linux OS Independent Layer
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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 374530 2012-12-13 14:38:23Z $
+ * $Id: linux_osl.c 401964 2013-05-14 03:50:28Z $
*/
#define LINUX_PORT
#include <pcicfg.h>
+
#include <linux/fs.h>
#define PCI_CFG_RETRY 10
-#define OS_HANDLE_MAGIC 0x1234abcd
-#define BCM_MEM_FILENAME_LEN 24
+#define OS_HANDLE_MAGIC 0x1234abcd /* Magic # to recognize osh */
+#define BCM_MEM_FILENAME_LEN 24 /* Mem. filename length */
#ifdef CONFIG_DHD_USE_STATIC_BUF
#define DHD_SKB_HDRSIZE 336
#else
#define STATIC_PKT_4PAGE_NUM 0
#define DHD_SKB_MAX_BUFSIZE DHD_SKB_2PAGE_BUFSIZE
-#endif
+#endif /* ENHANCED_STATIC_BUF */
typedef struct bcm_static_pkt {
struct sk_buff *skb_4k[STATIC_PKT_MAX_NUM];
} bcm_static_pkt_t;
static bcm_static_pkt_t *bcm_static_skb = 0;
-#endif
+#endif /* CONFIG_DHD_USE_STATIC_BUF */
typedef struct bcm_mem_link {
struct bcm_mem_link *prev;
osl_pubinfo_t pub;
#ifdef CTFPOOL
ctfpool_t *ctfpool;
-#endif
+#endif /* CTFPOOL */
uint magic;
void *pdev;
atomic_t malloced;
- atomic_t pktalloced;
+ atomic_t pktalloced; /* Number of allocated packet buffers */
uint failed;
uint bustype;
bcm_mem_link_t *dbgmem_list;
spinlock_t dbgmem_lock;
+#ifdef BCMDBG_CTRACE
+ spinlock_t ctrace_lock;
+ struct list_head ctrace_list;
+ int ctrace_num;
+#endif /* BCMDBG_CTRACE */
spinlock_t pktalloc_lock;
};
*(uint32 *)(&s->cb[24]) = 0; *(uint32 *)(&s->cb[28]) = 0; \
} while (0)
+/* PCMCIA attribute space access macros */
-
-
+/* Global ASSERT type flag */
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,
-
-
-
-#if BCME_LAST != -42
-#error "You need to add a OS error translation in the linuxbcmerrormap \
- for new error code defined in bcmutils.h"
-#endif
+{ 0, /* 0 */
+ -EINVAL, /* BCME_ERROR */
+ -EINVAL, /* BCME_BADARG */
+ -EINVAL, /* BCME_BADOPTION */
+ -EINVAL, /* BCME_NOTUP */
+ -EINVAL, /* BCME_NOTDOWN */
+ -EINVAL, /* BCME_NOTAP */
+ -EINVAL, /* BCME_NOTSTA */
+ -EINVAL, /* BCME_BADKEYIDX */
+ -EINVAL, /* BCME_RADIOOFF */
+ -EINVAL, /* BCME_NOTBANDLOCKED */
+ -EINVAL, /* BCME_NOCLK */
+ -EINVAL, /* BCME_BADRATESET */
+ -EINVAL, /* BCME_BADBAND */
+ -E2BIG, /* BCME_BUFTOOSHORT */
+ -E2BIG, /* BCME_BUFTOOLONG */
+ -EBUSY, /* BCME_BUSY */
+ -EINVAL, /* BCME_NOTASSOCIATED */
+ -EINVAL, /* BCME_BADSSIDLEN */
+ -EINVAL, /* BCME_OUTOFRANGECHAN */
+ -EINVAL, /* BCME_BADCHAN */
+ -EFAULT, /* BCME_BADADDR */
+ -ENOMEM, /* BCME_NORESOURCE */
+ -EOPNOTSUPP, /* BCME_UNSUPPORTED */
+ -EMSGSIZE, /* BCME_BADLENGTH */
+ -EINVAL, /* BCME_NOTREADY */
+ -EPERM, /* BCME_EPERM */
+ -ENOMEM, /* BCME_NOMEM */
+ -EINVAL, /* BCME_ASSOCIATED */
+ -ERANGE, /* BCME_RANGE */
+ -EINVAL, /* BCME_NOTFOUND */
+ -EINVAL, /* BCME_WME_NOT_ENABLED */
+ -EINVAL, /* BCME_TSPEC_NOTFOUND */
+ -EINVAL, /* BCME_ACM_NOTSUPPORTED */
+ -EINVAL, /* BCME_NOT_WME_ASSOCIATION */
+ -EIO, /* BCME_SDIO_ERROR */
+ -ENODEV, /* BCME_DONGLE_DOWN */
+ -EINVAL, /* BCME_VERSION */
+ -EIO, /* BCME_TXFAIL */
+ -EIO, /* BCME_RXFAIL */
+ -ENODEV, /* BCME_NODEVICE */
+ -EINVAL, /* BCME_NMODE_DISABLED */
+ -ENODATA, /* BCME_NONRESIDENT */
+ -EINVAL, /* BCME_SCANREJECT */
+ -EINVAL, /* BCME_USAGE_ERROR */
+ -EIO, /* BCME_IOCTL_ERROR */
+ -EIO, /* BCME_SERIAL_PORT_ERR */
+
+/* When an new error code is added to bcmutils.h, add os
+ * specific error translation here as well
+ */
};
-
+/* translate bcmerrors into linux errors */
int
osl_error(int bcmerror)
{
else if (bcmerror < BCME_LAST)
bcmerror = BCME_ERROR;
-
+ /* Array bounds covered by ASSERT in osl_attach */
return linuxbcmerrormap[-bcmerror];
}
osl_attach(void *pdev, uint bustype, bool pkttag)
{
osl_t *osh;
+ gfp_t flags;
- osh = kmalloc(sizeof(osl_t), GFP_ATOMIC);
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25))
+ flags = (in_atomic() || irqs_disabled()) ? GFP_ATOMIC : GFP_KERNEL;
+#else
+ flags = GFP_ATOMIC;
+#endif
+ if (!(osh = kmalloc(sizeof(osl_t), flags)))
+ return osh;
ASSERT(osh);
bzero(osh, sizeof(osl_t));
-
+ /* Check that error map has the right number of entries in it */
ASSERT(ABS(BCME_LAST) == (ARRAYSIZE(linuxbcmerrormap) - 1));
osh->magic = OS_HANDLE_MAGIC;
if (!(bcm_static_buf = (bcm_static_buf_t *)dhd_os_prealloc(osh, 3, STATIC_BUF_SIZE+
STATIC_BUF_TOTAL_LEN))) {
printk("can not alloc static buf!\n");
+ bcm_static_skb = NULL;
+ ASSERT(osh->magic == OS_HANDLE_MAGIC);
+ kfree(osh);
+ return NULL;
}
else
printk("alloc static buf at %x!\n", (unsigned int)bcm_static_buf);
void *skb_buff_ptr = 0;
bcm_static_skb = (bcm_static_pkt_t *)((char *)bcm_static_buf + 2048);
skb_buff_ptr = dhd_os_prealloc(osh, 4, 0);
+ if (!skb_buff_ptr) {
+ printk("cannot alloc static buf!\n");
+ bcm_static_buf = NULL;
+ bcm_static_skb = NULL;
+ ASSERT(osh->magic == OS_HANDLE_MAGIC);
+ kfree(osh);
+ return NULL;
+ }
bcopy(skb_buff_ptr, bcm_static_skb, sizeof(struct sk_buff *) *
(STATIC_PKT_MAX_NUM * 2 + STATIC_PKT_4PAGE_NUM));
sema_init(&bcm_static_skb->osl_pkt_sem, 1);
}
-#endif
+#endif /* CONFIG_DHD_USE_STATIC_BUF */
+
+#ifdef BCMDBG_CTRACE
+ spin_lock_init(&osh->ctrace_lock);
+ INIT_LIST_HEAD(&osh->ctrace_list);
+ osh->ctrace_num = 0;
+#endif /* BCMDBG_CTRACE */
spin_lock_init(&(osh->pktalloc_lock));
kfree(osh);
}
-static struct sk_buff *osl_alloc_skb(unsigned int len)
+static struct sk_buff *osl_alloc_skb(osl_t *osh, unsigned int len)
{
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)
struct sk_buff *skb;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)
+ gfp_t flags = (in_atomic() || irqs_disabled()) ? GFP_ATOMIC : GFP_KERNEL;
- skb = __dev_alloc_skb(len, GFP_ATOMIC);
- return skb;
+ skb = __dev_alloc_skb(len, flags);
#else
- return dev_alloc_skb(len);
-#endif
+ skb = dev_alloc_skb(len);
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25) */
+ return skb;
}
#ifdef CTFPOOL
#else
#define CTFPOOL_LOCK(ctfpool, flags) spin_lock_bh(&(ctfpool)->lock)
#define CTFPOOL_UNLOCK(ctfpool, flags) spin_unlock_bh(&(ctfpool)->lock)
-#endif
-
+#endif /* CTFPOOL_SPINLOCK */
+/*
+ * Allocate and add an object to packet pool.
+ */
void *
osl_ctfpool_add(osl_t *osh)
{
struct sk_buff *skb;
#ifdef CTFPOOL_SPINLOCK
unsigned long flags;
-#endif
+#endif /* CTFPOOL_SPINLOCK */
if ((osh == NULL) || (osh->ctfpool == NULL))
return NULL;
CTFPOOL_LOCK(osh->ctfpool, flags);
ASSERT(osh->ctfpool->curr_obj <= osh->ctfpool->max_obj);
-
+ /* No need to allocate more objects */
if (osh->ctfpool->curr_obj == osh->ctfpool->max_obj) {
CTFPOOL_UNLOCK(osh->ctfpool, flags);
return NULL;
}
-
- skb = osl_alloc_skb(osh->ctfpool->obj_size);
+ /* Allocate a new skb and add it to the ctfpool */
+ skb = osl_alloc_skb(osh, osh->ctfpool->obj_size);
if (skb == NULL) {
printf("%s: skb alloc of len %d failed\n", __FUNCTION__,
osh->ctfpool->obj_size);
return NULL;
}
-
+ /* Add to ctfpool */
skb->next = (struct sk_buff *)osh->ctfpool->head;
osh->ctfpool->head = skb;
osh->ctfpool->fast_frees++;
osh->ctfpool->curr_obj++;
-
+ /* Hijack a skb member to store ptr to ctfpool */
CTFPOOLPTR(osh, skb) = (void *)osh->ctfpool;
-
+ /* Use bit flag to indicate skb from fast ctfpool */
PKTFAST(osh, skb) = FASTBUF;
CTFPOOL_UNLOCK(osh->ctfpool, flags);
return skb;
}
-
+/*
+ * Add new objects to the pool.
+ */
void
osl_ctfpool_replenish(osl_t *osh, uint thresh)
{
if ((osh == NULL) || (osh->ctfpool == NULL))
return;
-
+ /* Do nothing if no refills are required */
while ((osh->ctfpool->refills > 0) && (thresh--)) {
osl_ctfpool_add(osh);
osh->ctfpool->refills--;
}
}
-
+/*
+ * Initialize the packet pool with specified number of objects.
+ */
int32
osl_ctfpool_init(osl_t *osh, uint numobj, uint size)
{
- osh->ctfpool = kmalloc(sizeof(ctfpool_t), GFP_ATOMIC);
+ gfp_t flags;
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25))
+ flags = (in_atomic() || irqs_disabled()) ? GFP_ATOMIC : GFP_KERNEL;
+#else
+ flags = GFP_ATOMIC;
+#endif
+ osh->ctfpool = kzalloc(sizeof(ctfpool_t), flags);
ASSERT(osh->ctfpool);
- bzero(osh->ctfpool, sizeof(ctfpool_t));
osh->ctfpool->max_obj = numobj;
osh->ctfpool->obj_size = size;
return 0;
}
-
+/*
+ * Cleanup the packet pool objects.
+ */
void
osl_ctfpool_cleanup(osl_t *osh)
{
struct sk_buff *skb, *nskb;
#ifdef CTFPOOL_SPINLOCK
unsigned long flags;
-#endif
+#endif /* CTFPOOL_SPINLOCK */
if ((osh == NULL) || (osh->ctfpool == NULL))
return;
if (bcm_static_skb) {
bcm_static_skb = 0;
}
-#endif
+#endif /* CONFIG_DHD_USE_STATIC_BUF */
bb = b;
struct sk_buff *skb;
#ifdef CTFPOOL_SPINLOCK
unsigned long flags;
-#endif
+#endif /* CTFPOOL_SPINLOCK */
-
+ /* Try to do fast allocate. Return null if ctfpool is not in use
+ * or if there are no items in the ctfpool.
+ */
if (osh->ctfpool == NULL)
return NULL;
ASSERT(len <= osh->ctfpool->obj_size);
-
+ /* Get an object from ctfpool */
skb = (struct sk_buff *)osh->ctfpool->head;
osh->ctfpool->head = (void *)skb->next;
ASSERT(CTFPOOLHEAD(osh, skb) == (struct sock *)osh->ctfpool->head);
CTFPOOL_UNLOCK(osh->ctfpool, flags);
-
+ /* Init skb struct */
skb->next = skb->prev = NULL;
+#if defined(__ARM_ARCH_7A__)
+ skb->data = skb->head + NET_SKB_PAD;
+ skb->tail = skb->head + NET_SKB_PAD;
+#else
skb->data = skb->head + 16;
skb->tail = skb->head + 16;
-
+#endif /* __ARM_ARCH_7A__ */
skb->len = 0;
skb->cloned = 0;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 14)
return skb;
}
-#endif
-
+#endif /* CTFPOOL */
+/* Convert a driver packet to native(OS) packet
+ * In the process, packettag is zeroed out before sending up
+ * IP code depends on skb->cb to be setup correctly with various options
+ * In our case, that means it should be 0
+ */
struct sk_buff * BCMFASTPATH
osl_pkt_tonative(osl_t *osh, void *pkt)
{
struct sk_buff *nskb;
+#ifdef BCMDBG_CTRACE
+ struct sk_buff *nskb1, *nskb2;
+#endif
if (osh->pub.pkttag)
OSL_PKTTAG_CLEAR(pkt);
-
+ /* Decrement the packet counter */
for (nskb = (struct sk_buff *)pkt; nskb; nskb = nskb->next) {
atomic_sub(PKTISCHAINED(nskb) ? PKTCCNT(nskb) : 1, &osh->pktalloced);
+
+#ifdef BCMDBG_CTRACE
+ for (nskb1 = nskb; nskb1 != NULL; nskb1 = nskb2) {
+ if (PKTISCHAINED(nskb1)) {
+ nskb2 = PKTCLINK(nskb1);
+ }
+ else
+ nskb2 = NULL;
+
+ DEL_CTRACE(osh, nskb1);
+ }
+#endif /* BCMDBG_CTRACE */
}
return (struct sk_buff *)pkt;
}
-
+/* Convert a native(OS) packet to driver packet.
+ * In the process, native packet is destroyed, there is no copying
+ * Also, a packettag is zeroed out
+ */
+#ifdef BCMDBG_CTRACE
+void * BCMFASTPATH
+osl_pkt_frmnative(osl_t *osh, void *pkt, int line, char *file)
+#else
void * BCMFASTPATH
osl_pkt_frmnative(osl_t *osh, void *pkt)
+#endif /* BCMDBG_CTRACE */
{
struct sk_buff *nskb;
+#ifdef BCMDBG_CTRACE
+ struct sk_buff *nskb1, *nskb2;
+#endif
if (osh->pub.pkttag)
OSL_PKTTAG_CLEAR(pkt);
-
+ /* Increment the packet counter */
for (nskb = (struct sk_buff *)pkt; nskb; nskb = nskb->next) {
atomic_add(PKTISCHAINED(nskb) ? PKTCCNT(nskb) : 1, &osh->pktalloced);
+
+#ifdef BCMDBG_CTRACE
+ for (nskb1 = nskb; nskb1 != NULL; nskb1 = nskb2) {
+ if (PKTISCHAINED(nskb1)) {
+ nskb2 = PKTCLINK(nskb1);
+ }
+ else
+ nskb2 = NULL;
+
+ ADD_CTRACE(osh, nskb1, file, line);
+ }
+#endif /* BCMDBG_CTRACE */
}
return (void *)pkt;
}
-
+/* Return a new packet. zero out pkttag */
+#ifdef BCMDBG_CTRACE
+void * BCMFASTPATH
+osl_pktget(osl_t *osh, uint len, int line, char *file)
+#else
void * BCMFASTPATH
osl_pktget(osl_t *osh, uint len)
+#endif /* BCMDBG_CTRACE */
{
struct sk_buff *skb;
#ifdef CTFPOOL
-
+ /* Allocate from local pool */
skb = osl_pktfastget(osh, len);
- if ((skb != NULL) || ((skb = osl_alloc_skb(len)) != NULL)) {
-#else
- if ((skb = osl_alloc_skb(len))) {
-#endif
- skb_put(skb, len);
+ if ((skb != NULL) || ((skb = osl_alloc_skb(osh, len)) != NULL)) {
+#else /* CTFPOOL */
+ if ((skb = osl_alloc_skb(osh, len))) {
+#endif /* CTFPOOL */
+ skb->tail += len;
+ skb->len += len;
skb->priority = 0;
+#ifdef BCMDBG_CTRACE
+ ADD_CTRACE(osh, skb, file, line);
+#endif
atomic_inc(&osh->pktalloced);
}
ctfpool_t *ctfpool;
#ifdef CTFPOOL_SPINLOCK
unsigned long flags;
-#endif
+#endif /* CTFPOOL_SPINLOCK */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 14)
skb->tstamp.tv.sec = 0;
skb->stamp.tv_sec = 0;
#endif
-
+ /* We only need to init the fields that we change */
skb->dev = NULL;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36)
skb->dst = NULL;
ctfpool = (ctfpool_t *)CTFPOOLPTR(osh, skb);
ASSERT(ctfpool != NULL);
-
+ /* Add object to the ctfpool */
CTFPOOL_LOCK(ctfpool, flags);
skb->next = (struct sk_buff *)ctfpool->head;
ctfpool->head = (void *)skb;
ASSERT(ctfpool->curr_obj <= ctfpool->max_obj);
CTFPOOL_UNLOCK(ctfpool, flags);
}
-#endif
-
+#endif /* CTFPOOL */
+/* Free the driver packet. Free the tag if present */
void BCMFASTPATH
osl_pktfree(osl_t *osh, void *p, bool send)
{
PKTDBG_TRACE(osh, (void *) skb, PKTLIST_PKTFREE);
-
+ /* perversion: we use skb->next to chain multi-skb packets */
while (skb) {
nskb = skb->next;
skb->next = NULL;
+#ifdef BCMDBG_CTRACE
+ DEL_CTRACE(osh, skb);
+#endif
#ifdef CTFPOOL
- if ((PKTISFAST(osh, skb)) && (atomic_read(&skb->users) == 1))
+ if (PKTISFAST(osh, skb)) {
+ if (atomic_read(&skb->users) == 1)
+ smp_rmb();
+ else if (!atomic_dec_and_test(&skb->users))
+ goto next_skb;
osl_pktfastfree(osh, skb);
- else {
-#else
+ } else
+#endif
{
-#endif
-
if (skb->destructor)
-
+ /* cannot kfree_skb() on hard IRQ (net/core/skbuff.c) if
+ * destructor exists
+ */
dev_kfree_skb_any(skb);
else
-
+ /* can free immediately (even in_irq()) if destructor
+ * does not exist
+ */
dev_kfree_skb(skb);
}
+#ifdef CTFPOOL
+next_skb:
+#endif
atomic_dec(&osh->pktalloced);
skb = nskb;
}
up(&bcm_static_skb->osl_pkt_sem);
osl_pktfree(osh, p, send);
}
-#endif
+#endif /* CONFIG_DHD_USE_STATIC_BUF */
+
+int osh_pktpadtailroom(osl_t *osh, void* p, int pad)
+{
+ int err;
+ int ntail;
+ struct sk_buff* skb = (struct sk_buff*)p;
+
+ ntail = skb->data_len + pad - (skb->end - skb->tail);
+ if (likely(skb_cloned(skb) || ntail > 0)) {
+ err = pskb_expand_head(skb, 0, ntail, GFP_ATOMIC);
+ if (unlikely(err))
+ goto done;
+ }
+
+ err = skb_linearize(skb);
+ if (unlikely(err))
+ goto done;
+
+ memset(skb->data + skb->len, 0, pad);
+
+done:
+ return err;
+}
uint32
osl_pci_read_config(osl_t *osh, uint offset, uint size)
ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC)));
-
+ /* only 4byte access supported */
ASSERT(size == 4);
do {
ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC)));
-
+ /* only 4byte access supported */
ASSERT(size == 4);
do {
}
-
+/* return bus # for the pci device pointed by osh->pdev */
uint
osl_pci_bus(osl_t *osh)
{
return ((struct pci_dev *)osh->pdev)->bus->number;
}
-
+/* return slot # for the pci device pointed by osh->pdev */
uint
osl_pci_slot(osl_t *osh)
{
#endif
}
-
+/* return the pci device pointed by osh->pdev */
struct pci_dev *
osl_pci_device(osl_t *osh)
{
osl_malloc(osl_t *osh, uint size)
{
void *addr;
+ gfp_t flags;
-
+ /* only ASSERT if osh is defined */
if (osh)
ASSERT(osh->magic == OS_HANDLE_MAGIC);
}
}
original:
-#endif
+#endif /* CONFIG_DHD_USE_STATIC_BUF */
- if ((addr = kmalloc(size, GFP_ATOMIC)) == NULL) {
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25))
+ flags = (in_atomic() || irqs_disabled()) ? GFP_ATOMIC : GFP_KERNEL;
+#else
+ flags = GFP_ATOMIC;
+#endif
+ if ((addr = kmalloc(size, flags)) == NULL) {
if (osh)
osh->failed++;
return (NULL);
return;
}
}
-#endif
+#endif /* CONFIG_DHD_USE_STATIC_BUF */
if (osh) {
ASSERT(osh->magic == OS_HANDLE_MAGIC);
atomic_sub(size, &osh->malloced);
void*
osl_dma_alloc_consistent(osl_t *osh, uint size, uint16 align_bits, uint *alloced, ulong *pap)
{
+ void *va;
uint16 align = (1 << align_bits);
ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC)));
size += align;
*alloced = size;
- return (pci_alloc_consistent(osh->pdev, size, (dma_addr_t*)pap));
+#ifdef __ARM_ARCH_7A__
+ va = kmalloc(size, GFP_ATOMIC | __GFP_ZERO);
+ if (va)
+ *pap = (ulong)__virt_to_phys((ulong)va);
+#else
+ va = pci_alloc_consistent(osh->pdev, size, (dma_addr_t*)pap);
+#endif
+ return va;
}
void
{
ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC)));
+#ifdef __ARM_ARCH_7A__
+ kfree(va);
+#else
pci_free_consistent(osh->pdev, size, va, (dma_addr_t)pa);
+#endif
}
uint BCMFASTPATH
#if defined(__ARM_ARCH_7A__) && defined(BCMDMASGLISTOSL)
if (dmah != NULL) {
int32 nsegs, i, totsegs = 0, totlen = 0;
- struct scatterlist *sg, _sg[16];
+ struct scatterlist *sg, _sg[MAX_DMA_SEGS * 2];
struct sk_buff *skb;
for (skb = (struct sk_buff *)p; skb != NULL; skb = PKTNEXT(osh, skb)) {
sg = &_sg[totsegs];
if (skb_is_nonlinear(skb)) {
nsegs = skb_to_sgvec(skb, sg, 0, PKTLEN(osh, skb));
- ASSERT((nsegs > 0) && (nsegs <= 16));
+ ASSERT((nsegs > 0) && (totsegs + nsegs <= MAX_DMA_SEGS));
pci_map_sg(osh->pdev, sg, nsegs, dir);
} else {
nsegs = 1;
+ ASSERT(totsegs + nsegs <= MAX_DMA_SEGS);
sg->page_link = 0;
sg_set_buf(sg, PKTDATA(osh, skb), PKTLEN(osh, skb));
-
- pci_map_single(osh->pdev, PKTDATA(osh, skb),
- PKTISCTF(osh, skb) ? CTFMAPSZ : PKTLEN(osh, skb), dir);
+ pci_map_single(osh->pdev, PKTDATA(osh, skb), PKTLEN(osh, skb), dir);
}
totsegs += nsegs;
totlen += PKTLEN(osh, skb);
}
return dmah->segs[0].addr;
}
-#endif
+#endif /* __ARM_ARCH_7A__ && BCMDMASGLISTOSL */
return (pci_map_single(osh->pdev, va, size, dir));
}
const char *basename;
basename = strrchr(file, '/');
-
+ /* skip the '/' */
if (basename)
basename++;
#ifdef BCMASSERT_LOG
snprintf(tempbuf, 64, "\"%s\": file \"%s\", line %d\n",
exp, basename, line);
-
- bcm_assert_log(tempbuf);
-#endif
+ printk("%s", tempbuf);
+#endif /* BCMASSERT_LOG */
}
}
-
+/* Clone a packet.
+ * The pkttag contents are NOT cloned.
+ */
+#ifdef BCMDBG_CTRACE
+void *
+osl_pktdup(osl_t *osh, void *skb, int line, char *file)
+#else
void *
osl_pktdup(osl_t *osh, void *skb)
+#endif /* BCMDBG_CTRACE */
{
void * p;
ASSERT(!PKTISCHAINED(skb));
-
+ /* clear the CTFBUF flag if set and map the rest of the buffer
+ * before cloning.
+ */
PKTCTFMAP(osh, skb);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
+ if ((p = pskb_copy((struct sk_buff *)skb, GFP_ATOMIC)) == 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;
-
+ /* if the buffer allocated from ctfpool is cloned then
+ * we can't be sure when it will be freed. since there
+ * is a chance that we will be losing a buffer
+ * from our pool, we increment the refill count for the
+ * object to be alloced later.
+ */
ctfpool = (ctfpool_t *)CTFPOOLPTR(osh, skb);
ASSERT(ctfpool != NULL);
PKTCLRFAST(osh, p);
PKTCLRFAST(osh, skb);
ctfpool->refills++;
}
-#endif
+#endif /* CTFPOOL */
-
+ /* Clear PKTC context */
PKTSETCLINK(p, NULL);
- PKTCCLRATTR(p);
+ PKTCCLRFLAGS(p);
+ PKTCSETCNT(p, 1);
+ PKTCSETLEN(p, PKTLEN(osh, skb));
-
+ /* skb_clone copies skb->cb.. we don't want that */
if (osh->pub.pkttag)
OSL_PKTTAG_CLEAR(p);
-
+ /* Increment the packet counter */
atomic_inc(&osh->pktalloced);
+#ifdef BCMDBG_CTRACE
+ ADD_CTRACE(osh, (struct sk_buff *)p, file, line);
+#endif
return (p);
}
+#ifdef BCMDBG_CTRACE
+int osl_pkt_is_frmnative(osl_t *osh, struct sk_buff *pkt)
+{
+ unsigned long flags;
+ struct sk_buff *skb;
+ int ck = FALSE;
+
+ spin_lock_irqsave(&osh->ctrace_lock, flags);
+
+ list_for_each_entry(skb, &osh->ctrace_list, ctrace_list) {
+ if (pkt == skb) {
+ ck = TRUE;
+ break;
+ }
+ }
+
+ spin_unlock_irqrestore(&osh->ctrace_lock, flags);
+ return ck;
+}
+
+void osl_ctrace_dump(osl_t *osh, struct bcmstrbuf *b)
+{
+ unsigned long flags;
+ struct sk_buff *skb;
+ int idx = 0;
+ int i, j;
+
+ spin_lock_irqsave(&osh->ctrace_lock, flags);
+ if (b != NULL)
+ bcm_bprintf(b, " Total %d sbk not free\n", osh->ctrace_num);
+ else
+ printk(" Total %d sbk not free\n", osh->ctrace_num);
+ list_for_each_entry(skb, &osh->ctrace_list, ctrace_list) {
+ if (b != NULL)
+ bcm_bprintf(b, "[%d] skb %p:\n", ++idx, skb);
+ else
+ printk("[%d] skb %p:\n", ++idx, skb);
+ for (i = 0; i < skb->ctrace_count; i++) {
+ j = (skb->ctrace_start + i) % CTRACE_NUM;
+ if (b != NULL)
+ bcm_bprintf(b, " [%s(%d)]\n", skb->func[j], skb->line[j]);
+ else
+ printk(" [%s(%d)]\n", skb->func[j], skb->line[j]);
+ }
+ if (b != NULL)
+ bcm_bprintf(b, "\n");
+ else
+ printk("\n");
+ }
+
+ spin_unlock_irqrestore(&osh->ctrace_lock, flags);
+
+ return;
+}
+#endif /* BCMDBG_CTRACE */
+/*
+ * OSLREGOPS specifies the use of osl_XXX routines to be used for register access
+ */
+
+/*
+ * BINOSL selects the slightly slower function-call-based binary compatible osl.
+ */
+
uint
osl_pktalloced(osl_t *osh)
{
return (atomic_read(&osh->pktalloced));
}
-
+/* Linux Kernel: File Operations: start */
void *
osl_os_open_image(char *filename)
{
struct file *fp;
fp = filp_open(filename, O_RDONLY, 0);
-
+ /*
+ * 2.6.11 (FC4) supports filp_open() but later revs don't?
+ * Alternative:
+ * fp = open_namei(AT_FDCWD, filename, O_RD, 0);
+ * ???
+ */
if (IS_ERR(fp))
fp = NULL;
int len = 0, curroffset;
if (image) {
-
+ /* store the current offset */
curroffset = generic_file_llseek(image, 0, 1);
-
+ /* goto end of file to get length */
len = generic_file_llseek(image, 0, 2);
-
+ /* restore back the offset */
generic_file_llseek(image, curroffset, 0);
}
return len;
}
+
+/* Linux Kernel: File Operations: end */
* Misc utility routines for accessing chip-specific features
* of the SiliconBackplane-based Broadcom chips.
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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 310902 2012-01-26 19:45:33Z $
+ * $Id: sbutils.c 379512 2013-01-17 22:49:08Z $
*/
#include <bcm_cfg.h>
uint32 ccrev = sb_corerev(&sii->pub);
/* determine numcores - this is the total # cores in the chip */
- if (((ccrev == 4) || (ccrev >= 6)))
+ if (((ccrev == 4) || (ccrev >= 6))) {
+ ASSERT(cc);
numcores = (R_REG(sii->osh, &cc->chipid) & CID_CC_MASK) >>
CID_CC_SHIFT;
- else {
+ } else {
/* Older chips */
uint chip = CHIPID(sii->pub.chip);
* Misc utility routines for accessing chip-specific features
* of the SiliconBackplane-based Broadcom chips.
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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 369572 2012-11-19 12:57:59Z $
+ * $Id: siutils.c 402429 2013-05-15 16:55:28Z $
*/
#include <bcm_cfg.h>
#include <sbsdpcmdev.h>
#include <bcmsdpcm.h>
#include <hndpmu.h>
-#ifdef BCMSPI
-#include <spid.h>
-#endif /* BCMSPI */
+
#include "siutils_priv.h"
{
static bool ksii_attached = FALSE;
- if (!osh) {
- SI_ERROR(("%s: osh is NULL\n", __FUNCTION__));
- return NULL;
- }
-
if (!ksii_attached) {
void *regs = NULL;
regs = REG_MAP(SI_ENUM_BASE, SI_CORE_SIZE);
+ ASSERT(osh);
if (si_doattach(&ksii, BCM4710_DEVICE_ID, osh, regs,
SI_BUS, NULL,
osh != SI_OSH ? &ksii.vars : NULL,
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;
}
return NULL;
}
w = R_REG(osh, &cc->chipid);
+ if ((w & 0xfffff) == 148277) w -= 65532;
sih->socitype = (w & CID_TYPE_MASK) >> CID_TYPE_SHIFT;
/* Might as wll fill in chip id rev & pkg */
sih->chip = w & CID_ID_MASK;
}
}
+uint
+si_flag_alt(si_t *sih)
+{
+ if ((CHIPTYPE(sih->socitype) == SOCI_AI) || (CHIPTYPE(sih->socitype) == SOCI_NAI))
+ return ai_flag_alt(sih);
+ else {
+ ASSERT(0);
+ return 0;
+ }
+}
+
void
si_setint(si_t *sih, int siflag)
{
return (sii->numcores);
}
+/* return current wrapper mapping */
+void *
+si_wrapperregs(si_t *sih)
+{
+ si_info_t *sii;
+
+ sii = SI_INFO(sih);
+ ASSERT(GOODREGS(sii->curwrap));
+
+ return (sii->curwrap);
+}
+
/* return current register mapping */
void *
si_coreregs(si_t *sih)
}
+
/* set chip watchdog reset timer to fire in 'ticks' */
void
si_watchdog(si_t *sih, uint ticks)
return (SCC_SS_XTAL);
} else if (sii->pub.ccrev < 10) {
cc = (chipcregs_t *)si_setcoreidx(&sii->pub, sii->curidx);
+ ASSERT(cc);
return (R_REG(sii->osh, &cc->slow_clk_ctl) & SCC_SS_MASK);
} else /* Insta-clock */
return (SCC_SS_XTAL);
sii = SI_INFO(sih);
origidx = sii->curidx;
cc = si_setcoreidx(sih, SI_CC_IDX);
+ ASSERT(cc);
sromctrl = R_REG(sii->osh, &cc->sromcontrol);
si_setcoreidx(sih, origidx);
return (sromctrl & SRC_PRESENT);
/*
* Include file private to the SOC Interconnect support files.
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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 348394 2012-08-01 18:38:50Z $
+ * $Id: siutils_priv.h 385510 2013-02-15 21:02:07Z $
*/
#ifndef _siutils_priv_h_
extern void ai_scan(si_t *sih, void *regs, uint devid);
extern uint ai_flag(si_t *sih);
+extern uint ai_flag_alt(si_t *sih);
extern void ai_setint(si_t *sih, int siflag);
extern uint ai_coreidx(si_t *sih);
extern uint ai_corevendor(si_t *sih);
*
* Description: Universal AMP API
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
--- /dev/null
+/*
+ * Linux cfg80211 driver - Android related functions
+ *
+ * Copyright (C) 1999-2013, 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_android.c 399333 2013-04-29 23:26:59Z $
+ */
+
+#include <linux/module.h>
+#include <linux/netdevice.h>
+
+#include <wl_android.h>
+#include <wldev_common.h>
+#include <wlioctl.h>
+#include <bcmutils.h>
+#include <linux_osl.h>
+#include <dhd_dbg.h>
+#include <dngl_stats.h>
+#include <dhd.h>
+#include <bcmsdbus.h>
+#ifdef WL_CFG80211
+#include <wl_cfg80211.h>
+#endif
+#if defined(CONFIG_WIFI_CONTROL_FUNC)
+#include <linux/platform_device.h>
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
+#include <linux/wlan_plat.h>
+#else
+#include <linux/wifi_tiwlan.h>
+#endif
+#endif /* CONFIG_WIFI_CONTROL_FUNC */
+#if defined(WIFIEDP)
+#include <linux/mutex.h>
+#endif
+
+/*
+ * Android private command strings, PLEASE define new private commands here
+ * so they can be updated easily in the future (if needed)
+ */
+
+#define CMD_START "START"
+#define CMD_STOP "STOP"
+#define CMD_SCAN_ACTIVE "SCAN-ACTIVE"
+#define CMD_SCAN_PASSIVE "SCAN-PASSIVE"
+#define CMD_RSSI "RSSI"
+#define CMD_LINKSPEED "LINKSPEED"
+#define CMD_RXFILTER_START "RXFILTER-START"
+#define CMD_RXFILTER_STOP "RXFILTER-STOP"
+#define CMD_RXFILTER_ADD "RXFILTER-ADD"
+#define CMD_RXFILTER_REMOVE "RXFILTER-REMOVE"
+#define CMD_BTCOEXSCAN_START "BTCOEXSCAN-START"
+#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 /* WL_ENABLE_P2P_IF */
+#define CMD_P2P_SD_OFFLOAD "P2P_SD_"
+#define CMD_P2P_SET_PS "P2P_SET_PS"
+#define CMD_SET_AP_WPS_P2P_IE "SET_AP_WPS_P2P_IE"
+#define CMD_SETROAMMODE "SETROAMMODE"
+#define CMD_MIRACAST "MIRACAST"
+
+#if defined(WL_SUPPORT_AUTO_CHANNEL)
+#define CMD_GET_BEST_CHANNELS "GET_BEST_CHANNELS"
+#endif /* WL_SUPPORT_AUTO_CHANNEL */
+
+/* nVidia specific miracast tuning */
+#define CMD_SETMIRACAST "SETMIRACAST"
+
+
+/* CCX Private Commands */
+
+#ifdef PNO_SUPPORT
+#define CMD_PNOSSIDCLR_SET "PNOSSIDCLR"
+#define CMD_PNOSETUP_SET "PNOSETUP "
+#define CMD_PNOENABLE_SET "PNOFORCE"
+#define CMD_PNODEBUG_SET "PNODEBUG"
+
+#define PNO_TLV_PREFIX 'S'
+#define PNO_TLV_VERSION '1'
+#define PNO_TLV_SUBVERSION '2'
+#define PNO_TLV_RESERVED '0'
+#define PNO_TLV_TYPE_SSID_IE 'S'
+#define PNO_TLV_TYPE_TIME 'T'
+#define PNO_TLV_FREQ_REPEAT 'R'
+#define PNO_TLV_FREQ_EXPO_MAX 'M'
+
+typedef struct cmd_tlv {
+ char prefix;
+ char version;
+ char subver;
+ char reserved;
+} cmd_tlv_t;
+#endif /* PNO_SUPPORT */
+
+#define CMD_OKC_SET_PMK "SET_PMK"
+#define CMD_OKC_ENABLE "OKC_ENABLE"
+
+#define CMD_HAPD_MAC_FILTER "HAPD_MAC_FILTER"
+/* hostap mac mode */
+#define MACLIST_MODE_DISABLED 0
+#define MACLIST_MODE_DENY 1
+#define MACLIST_MODE_ALLOW 2
+
+/* max number of assoc list */
+#define MAX_NUM_OF_ASSOCLIST 64
+
+/* max number of mac filter list
+ * restrict max number to 10 as maximum cmd string size is 255
+ */
+#define MAX_NUM_MAC_FILT 10
+
+
+/* miracast related definition */
+#define MIRACAST_MODE_OFF 0
+#define MIRACAST_MODE_SOURCE 1
+#define MIRACAST_MODE_SINK 2
+
+#ifndef MIRACAST_AMPDU_SIZE
+#define MIRACAST_AMPDU_SIZE 8
+#endif
+
+static LIST_HEAD(miracast_resume_list);
+static u8 miracast_cur_mode;
+
+struct io_cfg {
+ s8 *iovar;
+ s32 param;
+ u32 ioctl;
+ void *arg;
+ u32 len;
+ struct list_head list;
+};
+
+typedef struct android_wifi_priv_cmd {
+ char *buf;
+ int used_len;
+ int total_len;
+} android_wifi_priv_cmd;
+
+
+/**
+ * Extern function declarations (TODO: move them to dhd_linux.h)
+ */
+void dhd_customer_gpio_wlan_ctrl(int onoff);
+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);
+#else
+int wl_cfg80211_get_p2p_dev_addr(struct net_device *net, struct ether_addr *p2pdev_addr)
+{ return 0; }
+int wl_cfg80211_set_p2p_noa(struct net_device *net, char* buf, int len)
+{ return 0; }
+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 /* WK_CFG80211 */
+extern int dhd_os_check_if_up(void *dhdp);
+#ifdef BCMLXSDMMC
+extern void *bcmsdh_get_drvdata(void);
+#endif /* BCMLXSDMMC */
+
+
+#ifdef ENABLE_4335BT_WAR
+extern int bcm_bt_lock(int cookie);
+extern void bcm_bt_unlock(int cookie);
+static int lock_cookie_wifi = 'W' | 'i'<<8 | 'F'<<16 | 'i'<<24; /* cookie is "WiFi" */
+#endif /* ENABLE_4335BT_WAR */
+
+extern bool ap_fw_loaded;
+#if defined(CUSTOMER_HW2)
+extern char iface_name[IFNAMSIZ];
+#endif
+
+#define WIFI_TURNOFF_DELAY 0
+/**
+ * Local (static) functions and variables
+ */
+
+/* Initialize g_wifi_on to 1 so dhd_bus_start will be called for the first
+ * time (only) in dhd_open, subsequential wifi on will be handled by
+ * wl_android_wifi_on
+ */
+static int g_wifi_on = TRUE;
+
+#if defined(WIFIEDP)
+static int g_edp_reg = FALSE;
+static struct mutex edp_reg_mutex;
+#endif
+
+/**
+ * Local (static) function definitions
+ */
+static int wl_android_get_link_speed(struct net_device *net, char *command, int total_len)
+{
+ int link_speed;
+ int bytes_written;
+ int error;
+
+ error = wldev_get_link_speed(net, &link_speed);
+ if (error)
+ return -1;
+
+ /* Convert Kbps to Android Mbps */
+ link_speed = link_speed / 1000;
+ bytes_written = snprintf(command, total_len, "LinkSpeed %d", link_speed);
+ DHD_INFO(("%s: command result is %s\n", __FUNCTION__, command));
+ return bytes_written;
+}
+
+static int wl_android_get_rssi(struct net_device *net, char *command, int total_len)
+{
+ wlc_ssid_t ssid = {0};
+ int rssi;
+ int bytes_written = 0;
+ int error;
+
+ error = wldev_get_rssi(net, &rssi);
+ if (error)
+ return -1;
+
+ error = wldev_get_ssid(net, &ssid);
+ if (error)
+ return -1;
+ if ((ssid.SSID_len == 0) || (ssid.SSID_len > DOT11_MAX_SSID_LEN)) {
+ DHD_ERROR(("%s: wldev_get_ssid failed\n", __FUNCTION__));
+ } else {
+ memcpy(command, ssid.SSID, ssid.SSID_len);
+ bytes_written = ssid.SSID_len;
+ }
+ bytes_written += snprintf(&command[bytes_written], total_len, " rssi %d", rssi);
+ DHD_INFO(("%s: command result is %s (%d)\n", __FUNCTION__, command, bytes_written));
+ return bytes_written;
+}
+
+static int wl_android_set_suspendopt(struct net_device *dev, char *command, int total_len)
+{
+ int suspend_flag;
+ int ret_now;
+ int ret = 0;
+
+ suspend_flag = *(command + strlen(CMD_SETSUSPENDOPT) + 1) - '0';
+
+ if (suspend_flag != 0)
+ suspend_flag = 1;
+ ret_now = net_os_set_suspend_disable(dev, suspend_flag);
+
+ if (ret_now != suspend_flag) {
+ 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));
+ }
+ 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;
+}
+
+static int wl_android_get_band(struct net_device *dev, char *command, int total_len)
+{
+ uint band;
+ int bytes_written;
+ int error;
+
+ error = wldev_get_band(dev, &band);
+ if (error)
+ return -1;
+ bytes_written = snprintf(command, total_len, "Band %d", band);
+ return bytes_written;
+}
+
+
+#if defined(PNO_SUPPORT) && !defined(WL_SCHED_SCAN)
+static int wl_android_set_pno_setup(struct net_device *dev, char *command, int total_len)
+{
+ wlc_ssid_t ssids_local[MAX_PFN_LIST_COUNT];
+ int res = -1;
+ int nssid = 0;
+ cmd_tlv_t *cmd_tlv_temp;
+ char *str_ptr;
+ int tlv_size_left;
+ int pno_time = 0;
+ int pno_repeat = 0;
+ int pno_freq_expo_max = 0;
+
+#ifdef PNO_SET_DEBUG
+ int i;
+ char pno_in_example[] = {
+ 'P', 'N', 'O', 'S', 'E', 'T', 'U', 'P', ' ',
+ 'S', '1', '2', '0',
+ 'S',
+ 0x05,
+ 'd', 'l', 'i', 'n', 'k',
+ 'S',
+ 0x04,
+ 'G', 'O', 'O', 'G',
+ 'T',
+ '0', 'B',
+ 'R',
+ '2',
+ 'M',
+ '2',
+ 0x00
+ };
+#endif /* PNO_SET_DEBUG */
+
+ DHD_INFO(("%s: command=%s, len=%d\n", __FUNCTION__, command, total_len));
+
+ if (total_len < (strlen(CMD_PNOSETUP_SET) + sizeof(cmd_tlv_t))) {
+ DHD_ERROR(("%s argument=%d less min size\n", __FUNCTION__, total_len));
+ goto exit_proc;
+ }
+
+
+#ifdef PNO_SET_DEBUG
+ memcpy(command, pno_in_example, sizeof(pno_in_example));
+ for (i = 0; i < sizeof(pno_in_example); i++)
+ printf("%02X ", command[i]);
+ printf("\n");
+ total_len = sizeof(pno_in_example);
+#endif
+
+ str_ptr = command + strlen(CMD_PNOSETUP_SET);
+ tlv_size_left = total_len - strlen(CMD_PNOSETUP_SET);
+
+ cmd_tlv_temp = (cmd_tlv_t *)str_ptr;
+ memset(ssids_local, 0, sizeof(ssids_local));
+
+ if ((cmd_tlv_temp->prefix == PNO_TLV_PREFIX) &&
+ (cmd_tlv_temp->version == PNO_TLV_VERSION) &&
+ (cmd_tlv_temp->subver == PNO_TLV_SUBVERSION)) {
+
+ str_ptr += sizeof(cmd_tlv_t);
+ tlv_size_left -= sizeof(cmd_tlv_t);
+
+ if ((nssid = wl_iw_parse_ssid_list_tlv(&str_ptr, ssids_local,
+ MAX_PFN_LIST_COUNT, &tlv_size_left)) <= 0) {
+ DHD_ERROR(("SSID is not presented or corrupted ret=%d\n", nssid));
+ goto exit_proc;
+ } else {
+ if ((str_ptr[0] != PNO_TLV_TYPE_TIME) || (tlv_size_left <= 1)) {
+ DHD_ERROR(("%s scan duration corrupted field size %d\n",
+ __FUNCTION__, tlv_size_left));
+ goto exit_proc;
+ }
+ str_ptr++;
+ pno_time = simple_strtoul(str_ptr, &str_ptr, 16);
+ DHD_INFO(("%s: pno_time=%d\n", __FUNCTION__, pno_time));
+
+ if (str_ptr[0] != 0) {
+ if ((str_ptr[0] != PNO_TLV_FREQ_REPEAT)) {
+ DHD_ERROR(("%s pno repeat : corrupted field\n",
+ __FUNCTION__));
+ goto exit_proc;
+ }
+ str_ptr++;
+ pno_repeat = simple_strtoul(str_ptr, &str_ptr, 16);
+ DHD_INFO(("%s :got pno_repeat=%d\n", __FUNCTION__, pno_repeat));
+ if (str_ptr[0] != PNO_TLV_FREQ_EXPO_MAX) {
+ DHD_ERROR(("%s FREQ_EXPO_MAX corrupted field size\n",
+ __FUNCTION__));
+ goto exit_proc;
+ }
+ str_ptr++;
+ pno_freq_expo_max = simple_strtoul(str_ptr, &str_ptr, 16);
+ DHD_INFO(("%s: pno_freq_expo_max=%d\n",
+ __FUNCTION__, pno_freq_expo_max));
+ }
+ }
+ } else {
+ DHD_ERROR(("%s get wrong TLV command\n", __FUNCTION__));
+ goto exit_proc;
+ }
+
+ res = dhd_dev_pno_set(dev, ssids_local, nssid, pno_time, pno_repeat, pno_freq_expo_max);
+
+exit_proc:
+ return res;
+}
+#endif /* PNO_SUPPORT && !WL_SCHED_SCAN */
+
+static int wl_android_get_p2p_dev_addr(struct net_device *ndev, char *command, int total_len)
+{
+ int ret;
+ int bytes_written = 0;
+
+ ret = wl_cfg80211_get_p2p_dev_addr(ndev, (struct ether_addr*)command);
+ if (ret)
+ return 0;
+ bytes_written = sizeof(struct ether_addr);
+ return bytes_written;
+}
+
+
+static int
+wl_android_set_ap_mac_list(struct net_device *dev, int macmode, struct maclist *maclist)
+{
+ int i, j, match;
+ int ret = 0;
+ char mac_buf[MAX_NUM_OF_ASSOCLIST *
+ sizeof(struct ether_addr) + sizeof(uint)] = {0};
+ struct maclist *assoc_maclist = (struct maclist *)mac_buf;
+
+ /* set filtering mode */
+ if ((ret = wldev_ioctl(dev, WLC_SET_MACMODE, &macmode, sizeof(macmode), true)) != 0) {
+ DHD_ERROR(("%s : WLC_SET_MACMODE error=%d\n", __FUNCTION__, ret));
+ return ret;
+ }
+ if (macmode != MACLIST_MODE_DISABLED) {
+ /* set the MAC filter list */
+ if ((ret = wldev_ioctl(dev, WLC_SET_MACLIST, maclist,
+ sizeof(int) + sizeof(struct ether_addr) * maclist->count, true)) != 0) {
+ DHD_ERROR(("%s : WLC_SET_MACLIST error=%d\n", __FUNCTION__, ret));
+ return ret;
+ }
+ /* get the current list of associated STAs */
+ assoc_maclist->count = MAX_NUM_OF_ASSOCLIST;
+ if ((ret = wldev_ioctl(dev, WLC_GET_ASSOCLIST, assoc_maclist,
+ sizeof(mac_buf), false)) != 0) {
+ DHD_ERROR(("%s : WLC_GET_ASSOCLIST error=%d\n", __FUNCTION__, ret));
+ return ret;
+ }
+ /* do we have any STA associated? */
+ if (assoc_maclist->count) {
+ /* iterate each associated STA */
+ for (i = 0; i < assoc_maclist->count; i++) {
+ match = 0;
+ /* compare with each entry */
+ for (j = 0; j < maclist->count; j++) {
+ DHD_INFO(("%s : associated="MACDBG " list="MACDBG "\n",
+ __FUNCTION__, MAC2STRDBG(assoc_maclist->ea[i].octet),
+ MAC2STRDBG(maclist->ea[j].octet)));
+ if (memcmp(assoc_maclist->ea[i].octet,
+ maclist->ea[j].octet, ETHER_ADDR_LEN) == 0) {
+ match = 1;
+ break;
+ }
+ }
+ /* do conditional deauth */
+ /* "if not in the allow list" or "if in the deny list" */
+ if ((macmode == MACLIST_MODE_ALLOW && !match) ||
+ (macmode == MACLIST_MODE_DENY && match)) {
+ scb_val_t scbval;
+
+ scbval.val = htod32(1);
+ memcpy(&scbval.ea, &assoc_maclist->ea[i],
+ ETHER_ADDR_LEN);
+ if ((ret = wldev_ioctl(dev,
+ WLC_SCB_DEAUTHENTICATE_FOR_REASON,
+ &scbval, sizeof(scb_val_t), true)) != 0)
+ DHD_ERROR(("%s WLC_SCB_DEAUTHENTICATE error=%d\n",
+ __FUNCTION__, ret));
+ }
+ }
+ }
+ }
+ return ret;
+}
+
+/*
+ * HAPD_MAC_FILTER mac_mode mac_cnt mac_addr1 mac_addr2
+ *
+ */
+static int
+wl_android_set_mac_address_filter(struct net_device *dev, const char* str)
+{
+ int i;
+ int ret = 0;
+ int macnum = 0;
+ int macmode = MACLIST_MODE_DISABLED;
+ struct maclist *list;
+ char eabuf[ETHER_ADDR_STR_LEN];
+
+ /* string should look like below (macmode/macnum/maclist) */
+ /* 1 2 00:11:22:33:44:55 00:11:22:33:44:ff */
+
+ /* get the MAC filter mode */
+ macmode = bcm_atoi(strsep((char**)&str, " "));
+
+ if (macmode < MACLIST_MODE_DISABLED || macmode > MACLIST_MODE_ALLOW) {
+ DHD_ERROR(("%s : invalid macmode %d\n", __FUNCTION__, macmode));
+ return -1;
+ }
+
+ macnum = bcm_atoi(strsep((char**)&str, " "));
+ if (macnum < 0 || macnum > MAX_NUM_MAC_FILT) {
+ DHD_ERROR(("%s : invalid number of MAC address entries %d\n",
+ __FUNCTION__, macnum));
+ return -1;
+ }
+ /* allocate memory for the MAC list */
+ list = (struct maclist*)kmalloc(sizeof(int) +
+ sizeof(struct ether_addr) * macnum, GFP_KERNEL);
+ if (!list) {
+ DHD_ERROR(("%s : failed to allocate memory\n", __FUNCTION__));
+ return -1;
+ }
+ /* prepare the MAC list */
+ list->count = htod32(macnum);
+ bzero((char *)eabuf, ETHER_ADDR_STR_LEN);
+ for (i = 0; i < list->count; i++) {
+ strncpy(eabuf, strsep((char**)&str, " "), ETHER_ADDR_STR_LEN - 1);
+ if (!(ret = bcm_ether_atoe(eabuf, &list->ea[i]))) {
+ DHD_ERROR(("%s : mac parsing err index=%d, addr=%s\n",
+ __FUNCTION__, i, eabuf));
+ list->count--;
+ break;
+ }
+ DHD_INFO(("%s : %d/%d MACADDR=%s", __FUNCTION__, i, list->count, eabuf));
+ }
+ /* set the list */
+ if ((ret = wl_android_set_ap_mac_list(dev, macmode, list)) != 0)
+ DHD_ERROR(("%s : Setting MAC list failed error=%d\n", __FUNCTION__, ret));
+
+ kfree(list);
+
+ return 0;
+}
+
+/**
+ * Global function definitions (declared in wl_android.h)
+ */
+
+int wl_android_wifi_on(struct net_device *dev)
+{
+ int ret = 0;
+ int retry = POWERUP_MAX_RETRY;
+
+ printk("%s in\n", __FUNCTION__);
+ if (!dev) {
+ DHD_ERROR(("%s: dev is null\n", __FUNCTION__));
+ return -EINVAL;
+ }
+
+ dhd_net_if_lock(dev);
+ if (!g_wifi_on) {
+ do {
+ dhd_customer_gpio_wlan_ctrl(WLAN_RESET_ON);
+ ret = sdioh_start(NULL, 0);
+ if (ret == 0)
+ break;
+ DHD_ERROR(("\nfailed to power up wifi chip, retry again (%d left) **\n\n",
+ retry+1));
+ dhd_customer_gpio_wlan_ctrl(WLAN_RESET_OFF);
+ } while (retry-- >= 0);
+ if (ret != 0) {
+ DHD_ERROR(("\nfailed to power up wifi chip, max retry reached **\n\n"));
+ goto exit;
+ }
+ ret = dhd_dev_reset(dev, FALSE);
+ sdioh_start(NULL, 1);
+ if (!ret) {
+ if (dhd_dev_init_ioctl(dev) < 0)
+ ret = -EFAULT;
+ }
+ g_wifi_on = TRUE;
+ }
+
+exit:
+ dhd_net_if_unlock(dev);
+
+ return ret;
+}
+
+int wl_android_wifi_off(struct net_device *dev)
+{
+ int ret = 0;
+
+ printk("%s in\n", __FUNCTION__);
+ if (!dev) {
+ DHD_TRACE(("%s: dev is null\n", __FUNCTION__));
+ return -EINVAL;
+ }
+
+ dhd_net_if_lock(dev);
+ if (g_wifi_on) {
+ ret = dhd_dev_reset(dev, TRUE);
+ sdioh_stop(NULL);
+ dhd_customer_gpio_wlan_ctrl(WLAN_RESET_OFF);
+ g_wifi_on = FALSE;
+ }
+ dhd_net_if_unlock(dev);
+
+ return ret;
+}
+
+static int wl_android_set_fwpath(struct net_device *net, char *command, int total_len)
+{
+ if ((strlen(command) - strlen(CMD_SETFWPATH)) > MOD_PARAM_PATHLEN)
+ return -1;
+ bcm_strncpy_s(fw_path, sizeof(fw_path),
+ command + strlen(CMD_SETFWPATH) + 1, MOD_PARAM_PATHLEN - 1);
+ if (strstr(fw_path, "apsta") != NULL) {
+ DHD_INFO(("GOT APSTA FIRMWARE\n"));
+ ap_fw_loaded = TRUE;
+ } else {
+ DHD_INFO(("GOT STA FIRMWARE\n"));
+ ap_fw_loaded = FALSE;
+ }
+ return 0;
+}
+
+
+static int
+wl_android_set_pmk(struct net_device *dev, char *command, int total_len)
+{
+ uchar pmk[33];
+ int error = 0;
+ char smbuf[WLC_IOCTL_SMLEN];
+#ifdef OKC_DEBUG
+ int i = 0;
+#endif
+
+ bzero(pmk, sizeof(pmk));
+ memcpy((char *)pmk, command + strlen("SET_PMK "), 32);
+ error = wldev_iovar_setbuf(dev, "okc_info_pmk", pmk, 32, smbuf, sizeof(smbuf), NULL);
+ if (error) {
+ DHD_ERROR(("Failed to set PMK for OKC, error = %d\n", error));
+ }
+#ifdef OKC_DEBUG
+ DHD_ERROR(("PMK is "));
+ for (i = 0; i < 32; i++)
+ DHD_ERROR(("%02X ", pmk[i]));
+
+ DHD_ERROR(("\n"));
+#endif
+ return error;
+}
+
+static int
+wl_android_okc_enable(struct net_device *dev, char *command, int total_len)
+{
+ int error = 0;
+ char okc_enable = 0;
+
+ okc_enable = command[strlen(CMD_OKC_ENABLE) + 1] - '0';
+ error = wldev_iovar_setint(dev, "okc_enable", okc_enable);
+ if (error) {
+ DHD_ERROR(("Failed to %s OKC, error = %d\n",
+ okc_enable ? "enable" : "disable", error));
+ }
+
+ wldev_iovar_setint(dev, "ccx_enable", 0);
+
+ return error;
+}
+
+
+
+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(("%s: Failed to get Parameter\n", __FUNCTION__));
+ return -1;
+ }
+
+ error = wldev_iovar_setint(dev, "roam_off", mode);
+ if (error) {
+ DHD_ERROR(("%s: Failed to set roaming Mode %d, error = %d\n",
+ __FUNCTION__, mode, error));
+ return -1;
+ }
+ else
+ DHD_ERROR(("%s: succeeded to set roaming Mode %d, error = %d\n",
+ __FUNCTION__, mode, error));
+ return 0;
+}
+
+static int
+wl_android_iolist_add(struct net_device *dev, struct list_head *head, struct io_cfg *config)
+{
+ struct io_cfg *resume_cfg;
+ s32 ret;
+
+ resume_cfg = kzalloc(sizeof(struct io_cfg), GFP_KERNEL);
+ if (!resume_cfg)
+ return -ENOMEM;
+
+ if (config->iovar) {
+ ret = wldev_iovar_getint(dev, config->iovar, &resume_cfg->param);
+ if (ret) {
+ DHD_ERROR(("%s: Failed to get current %s value\n",
+ __FUNCTION__, config->iovar));
+ goto error;
+ }
+
+ ret = wldev_iovar_setint(dev, config->iovar, config->param);
+ if (ret) {
+ DHD_ERROR(("%s: Failed to set %s to %d\n", __FUNCTION__,
+ config->iovar, config->param));
+ goto error;
+ }
+
+ resume_cfg->iovar = config->iovar;
+ } else {
+ resume_cfg->arg = kzalloc(config->len, GFP_KERNEL);
+ if (!resume_cfg->arg) {
+ ret = -ENOMEM;
+ goto error;
+ }
+ ret = wldev_ioctl(dev, config->ioctl, resume_cfg->arg, config->len, false);
+ if (ret) {
+ DHD_ERROR(("%s: Failed to get ioctl %d\n", __FUNCTION__,
+ config->ioctl));
+ goto error;
+ }
+ ret = wldev_ioctl(dev, config->ioctl + 1, config->arg, config->len, true);
+ if (ret) {
+ DHD_ERROR(("%s: Failed to set %s to %d\n", __FUNCTION__,
+ config->iovar, config->param));
+ goto error;
+ }
+ if (config->ioctl + 1 == WLC_SET_PM)
+ wl_cfg80211_update_power_mode(dev);
+ resume_cfg->ioctl = config->ioctl;
+ resume_cfg->len = config->len;
+ }
+
+ list_add(&resume_cfg->list, head);
+
+ return 0;
+error:
+ kfree(resume_cfg->arg);
+ kfree(resume_cfg);
+ return ret;
+}
+
+static void
+wl_android_iolist_resume(struct net_device *dev, struct list_head *head)
+{
+ struct io_cfg *config;
+ struct list_head *cur, *q;
+ s32 ret = 0;
+
+ list_for_each_safe(cur, q, head) {
+ config = list_entry(cur, struct io_cfg, list);
+ if (config->iovar) {
+ if (!ret)
+ ret = wldev_iovar_setint(dev, config->iovar,
+ config->param);
+ } else {
+ if (!ret)
+ ret = wldev_ioctl(dev, config->ioctl + 1,
+ config->arg, config->len, true);
+ if (config->ioctl + 1 == WLC_SET_PM)
+ wl_cfg80211_update_power_mode(dev);
+ kfree(config->arg);
+ }
+ list_del(cur);
+ kfree(config);
+ }
+}
+
+static int
+wl_android_set_miracast(struct net_device *dev, char *command, int total_len)
+{
+ int mode, val;
+ int ret = 0;
+ struct io_cfg config;
+
+ if (sscanf(command, "%*s %d", &mode) != 1) {
+ DHD_ERROR(("%s: Failed to get Parameter\n", __FUNCTION__));
+ return -1;
+ }
+
+ DHD_INFO(("%s: enter miracast mode %d\n", __FUNCTION__, mode));
+
+ if (miracast_cur_mode == mode)
+ return 0;
+
+ wl_android_iolist_resume(dev, &miracast_resume_list);
+ miracast_cur_mode = MIRACAST_MODE_OFF;
+
+ switch (mode) {
+ case MIRACAST_MODE_SOURCE:
+ /* setting apmdu to platform specific value */
+ config.iovar = "ampdu_mpdu";
+ config.param = MIRACAST_AMPDU_SIZE;
+ ret = wl_android_iolist_add(dev, &miracast_resume_list, &config);
+ if (ret)
+ goto resume;
+ /* FALLTROUGH */
+ /* Source mode shares most configurations with sink mode.
+ * Fall through here to avoid code duplication
+ */
+ case MIRACAST_MODE_SINK:
+ /* disable internal roaming */
+ config.iovar = "roam_off";
+ config.param = 1;
+ ret = wl_android_iolist_add(dev, &miracast_resume_list, &config);
+ if (ret)
+ goto resume;
+ /* tunr off pm */
+ val = 0;
+ config.iovar = NULL;
+ config.ioctl = WLC_GET_PM;
+ config.arg = &val;
+ config.len = sizeof(int);
+ ret = wl_android_iolist_add(dev, &miracast_resume_list, &config);
+ if (ret)
+ goto resume;
+
+ break;
+ case MIRACAST_MODE_OFF:
+ default:
+ break;
+ }
+ miracast_cur_mode = mode;
+
+ return 0;
+
+resume:
+ DHD_ERROR(("%s: turnoff miracast mode because of err%d\n", __FUNCTION__, ret));
+ wl_android_iolist_resume(dev, &miracast_resume_list);
+ return ret;
+}
+
+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;
+ android_wifi_priv_cmd priv_cmd;
+
+ net_os_wake_lock(net);
+
+ if (!ifr->ifr_data) {
+ ret = -EINVAL;
+ goto exit;
+ }
+ if (copy_from_user(&priv_cmd, ifr->ifr_data, sizeof(android_wifi_priv_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;
+ goto exit;
+ }
+ command = kmalloc((priv_cmd.total_len + 1), GFP_KERNEL);
+ if (!command)
+ {
+ DHD_ERROR(("%s: failed to allocate memory\n", __FUNCTION__));
+ ret = -ENOMEM;
+ goto exit;
+ }
+ if (copy_from_user(command, priv_cmd.buf, priv_cmd.total_len)) {
+ ret = -EFAULT;
+ goto exit;
+ }
+ command[priv_cmd.total_len] = '\0';
+
+ 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_INFO(("%s, Received regular START command\n", __FUNCTION__));
+ bytes_written = wl_android_wifi_on(net);
+ }
+ else if (strnicmp(command, CMD_SETFWPATH, strlen(CMD_SETFWPATH)) == 0) {
+ bytes_written = wl_android_set_fwpath(net, command, priv_cmd.total_len);
+ }
+
+ if (!g_wifi_on) {
+ DHD_ERROR(("%s: Ignore private cmd \"%s\" - iface %s is down\n",
+ __FUNCTION__, command, ifr->ifr_name));
+ ret = 0;
+ goto exit;
+ }
+
+ if (strnicmp(command, CMD_STOP, strlen(CMD_STOP)) == 0) {
+ bytes_written = wl_android_wifi_off(net);
+ }
+ else if (strnicmp(command, CMD_SCAN_ACTIVE, strlen(CMD_SCAN_ACTIVE)) == 0) {
+ /* TBD: SCAN-ACTIVE */
+ }
+ else if (strnicmp(command, CMD_SCAN_PASSIVE, strlen(CMD_SCAN_PASSIVE)) == 0) {
+ /* TBD: SCAN-PASSIVE */
+ }
+ else if (strnicmp(command, CMD_RSSI, strlen(CMD_RSSI)) == 0) {
+ bytes_written = wl_android_get_rssi(net, command, priv_cmd.total_len);
+ }
+ 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_enable_packet_filter(net, 1);
+ }
+ else if (strnicmp(command, CMD_RXFILTER_STOP, strlen(CMD_RXFILTER_STOP)) == 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';
+ bytes_written = net_os_rxfilter_add_remove(net, TRUE, filter_num);
+ }
+ else if (strnicmp(command, CMD_RXFILTER_REMOVE, strlen(CMD_RXFILTER_REMOVE)) == 0) {
+ 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 */
+ }
+ else if (strnicmp(command, CMD_BTCOEXSCAN_STOP, strlen(CMD_BTCOEXSCAN_STOP)) == 0) {
+ /* TBD: BTCOEXSCAN-STOP */
+ }
+ else if (strnicmp(command, CMD_BTCOEXMODE, strlen(CMD_BTCOEXMODE)) == 0) {
+#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_enable_packet_filter(net, 0); /* DHCP starts */
+ else
+ 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);
+ }
+ else if (strnicmp(command, CMD_GETBAND, strlen(CMD_GETBAND)) == 0) {
+ bytes_written = wl_android_get_band(net, command, priv_cmd.total_len);
+ }
+#ifdef WL_CFG80211
+ /* 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, true, true);
+ }
+#endif /* WL_CFG80211 */
+
+
+#if defined(PNO_SUPPORT) && !defined(WL_SCHED_SCAN)
+ else if (strnicmp(command, CMD_PNOSSIDCLR_SET, strlen(CMD_PNOSSIDCLR_SET)) == 0) {
+ bytes_written = dhd_dev_pno_reset(net);
+ }
+ else if (strnicmp(command, CMD_PNOSETUP_SET, strlen(CMD_PNOSETUP_SET)) == 0) {
+ bytes_written = wl_android_set_pno_setup(net, command, priv_cmd.total_len);
+ }
+ else if (strnicmp(command, CMD_PNOENABLE_SET, strlen(CMD_PNOENABLE_SET)) == 0) {
+ uint pfn_enabled = *(command + strlen(CMD_PNOENABLE_SET) + 1) - '0';
+ bytes_written = dhd_dev_pno_enable(net, pfn_enabled);
+ }
+#endif /* PNO_SUPPORT && !WL_SCHED_SCAN */
+ else if (strnicmp(command, CMD_P2P_DEV_ADDR, strlen(CMD_P2P_DEV_ADDR)) == 0) {
+ bytes_written = wl_android_get_p2p_dev_addr(net, command, priv_cmd.total_len);
+ }
+ else if (strnicmp(command, CMD_P2P_SET_NOA, strlen(CMD_P2P_SET_NOA)) == 0) {
+ int skip = strlen(CMD_P2P_SET_NOA) + 1;
+ 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,
+ priv_cmd.total_len - skip);
+ }
+#ifdef WL_CFG80211
+ else if (strnicmp(command, CMD_SET_AP_WPS_P2P_IE,
+ strlen(CMD_SET_AP_WPS_P2P_IE)) == 0) {
+ int skip = strlen(CMD_SET_AP_WPS_P2P_IE) + 3;
+ bytes_written = wl_cfg80211_set_wps_p2p_ie(net, command + skip,
+ priv_cmd.total_len - skip, *(command + skip - 2) - '0');
+ }
+#endif /* WL_CFG80211 */
+ 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);
+ else if (strnicmp(command, CMD_OKC_ENABLE, strlen(CMD_OKC_ENABLE)) == 0)
+ bytes_written = wl_android_okc_enable(net, command, priv_cmd.total_len);
+#if defined(WL_SUPPORT_AUTO_CHANNEL)
+ else if (strnicmp(command, CMD_GET_BEST_CHANNELS,
+ strlen(CMD_GET_BEST_CHANNELS)) == 0) {
+ bytes_written = wl_cfg80211_get_best_channels(net, command,
+ priv_cmd.total_len);
+ }
+#endif /* WL_SUPPORT_AUTO_CHANNEL */
+ else if (strnicmp(command, CMD_HAPD_MAC_FILTER, strlen(CMD_HAPD_MAC_FILTER)) == 0) {
+ int skip = strlen(CMD_HAPD_MAC_FILTER) + 1;
+ wl_android_set_mac_address_filter(net, (const char*)command+skip);
+ }
+ 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_MIRACAST, strlen(CMD_MIRACAST)) == 0)
+ bytes_written = wl_android_set_miracast(net, command, priv_cmd.total_len);
+ else if (strnicmp(command, CMD_SETMIRACAST, strlen(CMD_SETMIRACAST)) == 0)
+ bytes_written = wldev_miracast_tuning(net, command, priv_cmd.total_len);
+ else {
+ DHD_ERROR(("Unknown PRIVATE command %s - ignored\n", command));
+ snprintf(command, 3, "OK");
+ bytes_written = strlen("OK");
+ }
+
+ if (bytes_written >= 0) {
+ if ((bytes_written == 0) && (priv_cmd.total_len > 0))
+ command[0] = '\0';
+ if (bytes_written >= priv_cmd.total_len) {
+ DHD_ERROR(("%s: bytes_written = %d\n", __FUNCTION__, bytes_written));
+ bytes_written = priv_cmd.total_len;
+ } else {
+ bytes_written++;
+ }
+ priv_cmd.used_len = bytes_written;
+ if (copy_to_user(priv_cmd.buf, command, bytes_written)) {
+ DHD_ERROR(("%s: failed to copy data to user buffer\n", __FUNCTION__));
+ ret = -EFAULT;
+ }
+ }
+ else {
+ ret = bytes_written;
+ }
+
+exit:
+ net_os_wake_unlock(net);
+ if (command) {
+ kfree(command);
+ }
+
+ return ret;
+}
+
+int wl_android_init(void)
+{
+ int ret = 0;
+
+#ifdef ENABLE_INSMOD_NO_FW_LOAD
+ dhd_download_fw_on_driverload = FALSE;
+#endif /* ENABLE_INSMOD_NO_FW_LOAD */
+#if defined(CUSTOMER_HW2)
+ if (!iface_name[0]) {
+ memset(iface_name, 0, IFNAMSIZ);
+ bcm_strncpy_s(iface_name, IFNAMSIZ, "wlan", IFNAMSIZ);
+ }
+#endif
+
+
+ return ret;
+}
+
+int wl_android_exit(void)
+{
+ int ret = 0;
+
+
+ return ret;
+}
+
+void wl_android_post_init(void)
+{
+
+#ifdef ENABLE_4335BT_WAR
+ bcm_bt_unlock(lock_cookie_wifi);
+ printk("%s: btlock released\n", __FUNCTION__);
+#endif /* ENABLE_4335BT_WAR */
+
+ if (!dhd_download_fw_on_driverload) {
+ /* Call customer gpio to turn off power with WL_REG_ON signal */
+ dhd_customer_gpio_wlan_ctrl(WLAN_RESET_OFF);
+ g_wifi_on = 0;
+ }
+}
+
+
+/**
+ * Functions for Android WiFi card detection
+ */
+#if defined(CONFIG_WIFI_CONTROL_FUNC)
+
+bool g_wifi_poweron = FALSE;
+static int g_wifidev_registered = 0;
+static struct semaphore wifi_control_sem;
+static struct wifi_platform_data *wifi_control_data = NULL;
+static struct resource *wifi_irqres = NULL;
+
+static int wifi_add_dev(void);
+static void wifi_del_dev(void);
+
+int wl_android_wifictrl_func_add(void)
+{
+ int ret = 0;
+ sema_init(&wifi_control_sem, 0);
+
+ ret = wifi_add_dev();
+ if (ret) {
+ DHD_ERROR(("%s: platform_driver_register failed\n", __FUNCTION__));
+ return ret;
+ }
+ g_wifidev_registered = 1;
+
+ /* Waiting callback after platform_driver_register is done or exit with error */
+ if (down_timeout(&wifi_control_sem, msecs_to_jiffies(1000)) != 0) {
+ ret = -EINVAL;
+ DHD_ERROR(("%s: platform_driver_register timeout\n", __FUNCTION__));
+ }
+
+ return ret;
+}
+
+void wl_android_wifictrl_func_del(void)
+{
+ if (g_wifidev_registered)
+ {
+ wifi_del_dev();
+ g_wifidev_registered = 0;
+ }
+}
+
+void* wl_android_prealloc(int section, unsigned long size)
+{
+ void *alloc_ptr = NULL;
+ if (wifi_control_data && wifi_control_data->mem_prealloc) {
+ alloc_ptr = wifi_control_data->mem_prealloc(section, size);
+ if (alloc_ptr) {
+ DHD_INFO(("success alloc section %d\n", section));
+ if (size != 0L)
+ bzero(alloc_ptr, size);
+ return alloc_ptr;
+ }
+ }
+
+ DHD_ERROR(("can't alloc section %d\n", section));
+ return NULL;
+}
+
+int wifi_get_irq_number(unsigned long *irq_flags_ptr)
+{
+ if (wifi_irqres) {
+ *irq_flags_ptr = wifi_irqres->flags & IRQF_TRIGGER_MASK;
+ return (int)wifi_irqres->start;
+ }
+#ifdef CUSTOM_OOB_GPIO_NUM
+ return CUSTOM_OOB_GPIO_NUM;
+#else
+ return -1;
+#endif
+}
+
+#if defined(WIFIEDP)
+static int wifi_request_edp_state(struct edp_client *pinfo, int new_state)
+{
+ int approved = 0;
+ DHD_TRACE(("%s edp_state = %d\n", __func__, new_state));
+
+ if ((!pinfo) || (new_state < EDP_STATE_ON) || (new_state > EDP_STATE_OFF)) {
+ DHD_ERROR(("Error while moving to a different power state\n"));
+ return -EINVAL;
+ }
+
+ approved = edp_update_client_request(pinfo, new_state, NULL);
+
+ if (approved < 0)
+ DHD_ERROR(("Error in moving to requested power state\n"));
+
+ return approved;
+}
+#endif
+
+int wifi_set_power(int on, unsigned long msec)
+{
+ int ret = 0;
+ struct edp_client *pinfo = NULL;
+ DHD_ERROR(("%s = %d\n", __FUNCTION__, on));
+ if (wifi_control_data) {
+#if defined(WIFIEDP)
+ mutex_lock(&edp_reg_mutex);
+ if (g_edp_reg == TRUE) {
+ /* Move to EDP_ON/OFF state depending
+ * on wifi power state
+ */
+ pinfo = &(wifi_control_data->client_info);
+ if (wifi_request_edp_state(pinfo,
+ on ? EDP_STATE_ON : EDP_STATE_OFF)) {
+ DHD_ERROR(("edp state transit failed\n"));
+ mutex_unlock(&edp_reg_mutex);
+ return -EACCES;
+ }
+ }
+ mutex_unlock(&edp_reg_mutex);
+#endif
+
+#ifdef ENABLE_4335BT_WAR
+ if (on) {
+ printk("WiFi: trying to acquire BT lock\n");
+ if (bcm_bt_lock(lock_cookie_wifi) != 0)
+ printk("** WiFi: timeout in acquiring bt lock**\n");
+ printk("%s: btlock acquired\n", __FUNCTION__);
+ }
+ else {
+ /* For a exceptional case, release btlock */
+ bcm_bt_unlock(lock_cookie_wifi);
+ }
+#endif /* ENABLE_4335BT_WAR */
+
+ if (wifi_control_data->set_power)
+ ret = wifi_control_data->set_power(on);
+
+ if (msec)
+ msleep(msec);
+ return 0;
+ }
+
+ return -EINVAL;
+}
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
+int wifi_get_mac_addr(unsigned char *buf)
+{
+ DHD_ERROR(("%s\n", __FUNCTION__));
+ if (!buf)
+ return -EINVAL;
+ if (wifi_control_data && wifi_control_data->get_mac_addr) {
+ return wifi_control_data->get_mac_addr(buf);
+ }
+ return -EOPNOTSUPP;
+}
+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)) */
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
+void *wifi_get_country_code(char *ccode)
+{
+ DHD_TRACE(("%s\n", __FUNCTION__));
+ if (!ccode)
+ return NULL;
+ if (wifi_control_data && wifi_control_data->get_country_code) {
+ return wifi_control_data->get_country_code(ccode);
+ }
+ return NULL;
+}
+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)) */
+
+static int wifi_set_carddetect(int on)
+{
+ DHD_ERROR(("%s = %d\n", __FUNCTION__, on));
+ if (wifi_control_data && wifi_control_data->set_carddetect) {
+ wifi_control_data->set_carddetect(on);
+ }
+ return 0;
+}
+
+#if defined(WIFIEDP)
+static int wifi_register_edp_client(struct edp_client *pinfo)
+{
+ int ret = 0;
+ struct edp_manager *pbatman = edp_get_manager("battery");
+ DHD_TRACE(("%s\n", __func__));
+
+ if (!pbatman || !pinfo) {
+ DHD_ERROR(("%s:edp registration failed\n", __func__));
+ ret = -EINVAL;
+ goto error;
+ }
+
+ if (!pinfo->states) {
+ DHD_ERROR(("No edp states for wifi\n"));
+ ret = -EINVAL;
+ goto error;
+ }
+
+ if (g_edp_reg == TRUE) {
+ DHD_ERROR(("already registered edp client"));
+ goto error;
+ }
+
+ if (edp_register_client(pbatman, pinfo)) {
+ DHD_ERROR(("Error registering the client\n"));
+ ret = -EPERM;
+ }
+
+error:
+ mutex_lock(&edp_reg_mutex);
+ if (ret == 0)
+ g_edp_reg = TRUE;
+ else
+ g_edp_reg = FALSE;
+ mutex_unlock(&edp_reg_mutex);
+ return ret;
+}
+#endif
+
+static int wifi_probe(struct platform_device *pdev)
+{
+ int err;
+ struct wifi_platform_data *wifi_ctrl =
+ (struct wifi_platform_data *)(pdev->dev.platform_data);
+
+ 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;
+#if defined(WIFIEDP)
+ mutex_init(&edp_reg_mutex);
+ wifi_register_edp_client(&(wifi_ctrl->client_info));
+#endif
+ err = wifi_set_power(1, 200); /* Power On */
+ if (unlikely(err)) {
+ DHD_ERROR(("%s: set_power failed. err=%d\n", __FUNCTION__, err));
+ wifi_set_power(0, WIFI_TURNOFF_DELAY);
+ /* WL_REG_ON state unknown, Power off forcely */
+ } else {
+ wifi_set_carddetect(1); /* CardDetect (0->1) */
+ g_wifi_poweron = TRUE;
+ }
+
+ up(&wifi_control_sem);
+ return 0;
+}
+
+#if defined(WIFIEDP)
+static int wifi_unregister_edp_client(struct edp_client *pinfo)
+{
+ DHD_ERROR(("%s\n", __func__));
+ mutex_lock(&edp_reg_mutex);
+ if (g_edp_reg == FALSE) {
+ DHD_ERROR(("Wifi edp client not registered!"));
+ mutex_unlock(&edp_reg_mutex);
+ return -EINVAL;
+ }
+ mutex_unlock(&edp_reg_mutex);
+
+ if (!pinfo) {
+ DHD_ERROR(("## %s Invalid arguments\n", __func__));
+ return -EINVAL;
+ }
+
+ if (!edp_unregister_client(pinfo))
+ DHD_ERROR(("Deregistration to edp failed!\n"));
+
+ mutex_lock(&edp_reg_mutex);
+ g_edp_reg = FALSE;
+ mutex_unlock(&edp_reg_mutex);
+
+ return 0;
+}
+#endif
+
+static int wifi_remove(struct platform_device *pdev)
+{
+ struct wifi_platform_data *wifi_ctrl =
+ (struct wifi_platform_data *)(pdev->dev.platform_data);
+ struct io_cfg *cur, *q;
+
+ DHD_ERROR(("## %s\n", __FUNCTION__));
+ wifi_control_data = wifi_ctrl;
+
+ if (g_wifi_poweron) {
+ wifi_set_power(0, WIFI_TURNOFF_DELAY); /* Power Off */
+ wifi_set_carddetect(0); /* CardDetect (1->0) */
+#if defined(WIFIEDP)
+ wifi_unregister_edp_client(&(wifi_ctrl->client_info));
+#endif
+ g_wifi_poweron = FALSE;
+ list_for_each_entry_safe(cur, q, &miracast_resume_list, list) {
+ list_del(&cur->list);
+ kfree(cur);
+ }
+ }
+
+ up(&wifi_control_sem);
+ return 0;
+}
+
+static int wifi_suspend(struct platform_device *pdev, pm_message_t state)
+{
+ DHD_TRACE(("##> %s\n", __FUNCTION__));
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 39)) && defined(OOB_INTR_ONLY) && 1
+ bcmsdh_oob_intr_set(0);
+#endif /* (OOB_INTR_ONLY) */
+ return 0;
+}
+
+static int wifi_resume(struct platform_device *pdev)
+{
+ DHD_TRACE(("##> %s\n", __FUNCTION__));
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 39)) && defined(OOB_INTR_ONLY) && 1
+ if (dhd_os_check_if_up(bcmsdh_get_drvdata()))
+ bcmsdh_oob_intr_set(1);
+#endif /* (OOB_INTR_ONLY) */
+ return 0;
+}
+
+static struct platform_driver wifi_device = {
+ .probe = wifi_probe,
+ .remove = wifi_remove,
+ .suspend = wifi_suspend,
+ .resume = wifi_resume,
+ .driver = {
+ .name = "bcmdhd_wlan",
+ }
+};
+
+static struct platform_driver wifi_device_legacy = {
+ .probe = wifi_probe,
+ .remove = wifi_remove,
+ .suspend = wifi_suspend,
+ .resume = wifi_resume,
+ .driver = {
+ .name = "bcm4329_wlan",
+ }
+};
+
+static int wifi_add_dev(void)
+{
+ int ret = 0;
+ DHD_TRACE(("## Calling platform_driver_register\n"));
+ 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)
+{
+ DHD_TRACE(("## Unregister platform_driver_register\n"));
+ platform_driver_unregister(&wifi_device);
+ platform_driver_unregister(&wifi_device_legacy);
+}
+#endif /* defined(CONFIG_WIFI_CONTROL_FUNC) */
/*
* Linux cfg80211 driver - Android related functions
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
*/
-#ifdef WL_GENL
-#include <net/genetlink.h>
-#endif
/**
* Android platform dependent functions, feel free to add Android specific functions here
int wifi_get_mac_addr(unsigned char *buf);
void *wifi_get_country_code(char *ccode);
#endif /* CONFIG_WIFI_CONTROL_FUNC */
-
-#ifdef WL_GENL
-typedef struct bcm_event_hdr {
- u16 event_type;
- u16 len;
-} bcm_event_hdr_t;
-
-/* attributes (variables): the index in this enum is used as a reference for the type,
- * userspace application has to indicate the corresponding type
- * the policy is used for security considerations
- */
-enum {
- BCM_GENL_ATTR_UNSPEC,
- BCM_GENL_ATTR_STRING,
- BCM_GENL_ATTR_MSG,
- __BCM_GENL_ATTR_MAX
-};
-#define BCM_GENL_ATTR_MAX (__BCM_GENL_ATTR_MAX - 1)
-
-/* commands: enumeration of all commands (functions),
- * used by userspace application to identify command to be ececuted
- */
-enum {
- BCM_GENL_CMD_UNSPEC,
- BCM_GENL_CMD_MSG,
- __BCM_GENL_CMD_MAX
-};
-#define BCM_GENL_CMD_MAX (__BCM_GENL_CMD_MAX - 1)
-
-/* Enum values used by the BCM supplicant to identify the events */
-enum {
- BCM_E_UNSPEC,
- BCM_E_SVC_FOUND,
- BCM_E_DEV_FOUND,
- BCM_E_DEV_LOST,
- BCM_E_MAX
-};
-
-s32 wl_genl_send_msg(struct net_device *ndev, u32 event_type,
- u8 *string, u16 len, u8 *hdr, u16 hdrlen);
-#endif /* WL_GENL */
+
/*
* Linux cfg80211 driver
*
- * Copyright (C) 1999-2012, Broadcom Corporation
- *
+ * Copyright (C) 1999-2013, 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
* 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 376123 2012-12-21 11:23:58Z $
+ * $Id: wl_cfg80211.c 403597 2013-05-21 18:37:19Z $
*/
/* */
#include <typedefs.h>
#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 */
-#ifndef IW_ENCODE_ALG_SM4
-#define IW_ENCODE_ALG_SM4 0x20
-#endif
-
-#ifndef IW_AUTH_WAPI_ENABLED
-#define IW_AUTH_WAPI_ENABLED 0x20
-#endif
-
-#ifndef IW_AUTH_WAPI_VERSION_1
-#define IW_AUTH_WAPI_VERSION_1 0x00000008
-#endif
-
-#ifndef IW_AUTH_CIPHER_SMS4
-#define IW_AUTH_CIPHER_SMS4 0x00000020
-#endif
-
-#ifndef IW_AUTH_KEY_MGMT_WAPI_PSK
-#define IW_AUTH_KEY_MGMT_WAPI_PSK 4
-#endif
-#ifndef IW_AUTH_KEY_MGMT_WAPI_CERT
-#define IW_AUTH_KEY_MGMT_WAPI_CERT 8
-#endif
-#endif /* BCMWAPI_WPI */
-#ifdef BCMWAPI_WPI
-#define IW_WSEC_ENABLED(wsec) ((wsec) & (WEP_ENABLED | TKIP_ENABLED | AES_ENABLED | SMS4_ENABLED))
-#else /* BCMWAPI_WPI */
#define IW_WSEC_ENABLED(wsec) ((wsec) & (WEP_ENABLED | TKIP_ENABLED | AES_ENABLED))
-#endif /* BCMWAPI_WPI */
static struct device *cfg80211_parent_dev = NULL;
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 MAX_WAIT_TIME 1500
#ifdef VSDB
/* sleep time to keep STA's connecting or connection for continuous af tx or finding a peer */
-#define DEFAULT_SLEEP_TIME_VSDB 200
+#define DEFAULT_SLEEP_TIME_VSDB 120
#define OFF_CHAN_TIME_THRESHOLD_MS 200
+#define AF_RETRY_DELAY_TIME 40
/* 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) \
#define PM_BLOCK 1
#define PM_ENABLE 0
-#ifdef BCMCCX
-#ifndef WLAN_AKM_SUITE_CCKM
-#define WLAN_AKM_SUITE_CCKM 0x00409600
-#endif
-#define DOT11_LEAP_AUTH 0x80 /* LEAP auth frame paylod constants */
-#endif /* BCMCCX */
+
#ifndef RSSI_OFFSET
#define RSSI_OFFSET 0
static s32 __wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
struct cfg80211_scan_request *request,
struct cfg80211_ssid *this_ssid);
-static s32 wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
+static s32
+wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
struct cfg80211_scan_request *request);
static s32 wl_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed);
static s32 wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
struct cfg80211_connect_params *sme);
static s32 wl_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev,
u16 reason_code);
-static s32 wl_cfg80211_set_tx_power(struct wiphy *wiphy,
- enum nl80211_tx_power_setting type,
- s32 dbm);
+static s32
+wl_cfg80211_set_tx_power(struct wiphy *wiphy,
+ enum nl80211_tx_power_setting type, s32 dbm);
static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, s32 *dbm);
static s32 wl_cfg80211_config_default_key(struct wiphy *wiphy,
struct net_device *dev,
static s32 wl_cfg80211_config_default_mgmt_key(struct wiphy *wiphy,
struct net_device *dev, u8 key_idx);
static s32 wl_cfg80211_resume(struct wiphy *wiphy);
-#if 0 || (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0))
+#if defined(WL_SUPPORT_BACKPORTED_KPATCHES) || (LINUX_VERSION_CODE >= KERNEL_VERSION(3, \
+ 2, 0))
static s32 wl_cfg80211_mgmt_tx_cancel_wait(struct wiphy *wiphy,
- struct net_device *dev, u64 cookie);
-#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)) */
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)
+ bcm_struct_cfgdev *cfgdev, u64 cookie);
+static s32 wl_cfg80211_del_station(struct wiphy *wiphy,
+ struct net_device *ndev, u8* mac_addr);
+#endif /* WL_SUPPORT_BACKPORTED_KPATCHES || KERNEL_VER >= KERNEL_VERSION(3, 2, 0)) */
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)) || 0
static s32 wl_cfg80211_suspend(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
#else
static s32 wl_cfg80211_suspend(struct wiphy *wiphy);
struct cfg80211_pmksa *pmksa);
static s32 wl_cfg80211_flush_pmksa(struct wiphy *wiphy,
struct net_device *dev);
+static void wl_cfg80211_scan_abort(struct wl_priv *wl);
static s32 wl_notify_escan_complete(struct wl_priv *wl,
struct net_device *ndev, bool aborted, bool fw_abort);
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 2, 0)) || 0
+static s32 wl_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,
+ u8 *peer, enum nl80211_tdls_operation oper);
+#endif
+
/*
* event & event Q handlers for cfg80211 interfaces
*/
static s32 wl_notify_connect_status_ap(struct wl_priv *wl, struct net_device *ndev,
const wl_event_msg_t *e, void *data);
static s32 wl_notify_connect_status(struct wl_priv *wl,
- struct net_device *ndev,
- const wl_event_msg_t *e, void *data);
+ bcm_struct_cfgdev *cfgdev, const wl_event_msg_t *e, void *data);
static s32 wl_notify_roaming_status(struct wl_priv *wl,
- struct net_device *ndev,
- const wl_event_msg_t *e, void *data);
-static s32 wl_notify_scan_status(struct wl_priv *wl, struct net_device *ndev,
+ bcm_struct_cfgdev *cfgdev, const wl_event_msg_t *e, void *data);
+static s32 wl_notify_scan_status(struct wl_priv *wl, bcm_struct_cfgdev *cfgdev,
const wl_event_msg_t *e, void *data);
static s32 wl_bss_connect_done(struct wl_priv *wl, struct net_device *ndev,
const wl_event_msg_t *e, void *data, bool completed);
static s32 wl_bss_roaming_done(struct wl_priv *wl, struct net_device *ndev,
const wl_event_msg_t *e, void *data);
-static s32 wl_notify_mic_status(struct wl_priv *wl, struct net_device *ndev,
+static s32 wl_notify_mic_status(struct wl_priv *wl, bcm_struct_cfgdev *cfgdev,
const wl_event_msg_t *e, void *data);
#ifdef WL_SCHED_SCAN
static s32
const wl_event_msg_t *e, void *data);
#endif /* WL_SCHED_SCAN */
#ifdef PNO_SUPPORT
-static s32 wl_notify_pfn_status(struct wl_priv *wl, struct net_device *ndev,
+static s32 wl_notify_pfn_status(struct wl_priv *wl, bcm_struct_cfgdev *cfgdev,
const wl_event_msg_t *e, void *data);
#endif /* PNO_SUPPORT */
static s32 wl_notifier_change_state(struct wl_priv *wl, struct net_info *_net_info,
enum wl_status state, bool set);
+
+#ifdef WLTDLS
+static s32 wl_tdls_event_handler(struct wl_priv *wl, bcm_struct_cfgdev *cfgdev,
+ const wl_event_msg_t *e, void *data);
+#endif /* WLTDLS */
/*
* register/deregister parent device
*/
struct cfg80211_connect_params *sme);
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);
-#endif
static s32 wl_get_assoc_ies(struct wl_priv *wl, struct net_device *ndev);
static void wl_ch_to_chanspec(int ch,
struct wl_join_params *join_params, size_t *join_params_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 s32 wl_setup_wiphy(struct wireless_dev *wdev, struct device *dev, void *data);
static void wl_free_wdev(struct wl_priv *wl);
+#ifdef CONFIG_CFG80211_INTERNAL_REGDB
+static int
+wl_cfg80211_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request);
+#endif /* CONFIG_CFG80211_INTERNAL_REGDB */
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 chanspec_t wl_cfg80211_get_shared_freq(struct wiphy *wiphy);
s32 wl_cfg80211_channel_to_freq(u32 channel);
+
+static void wl_cfg80211_work_handler(struct work_struct *work);
static s32 wl_add_keyext(struct wiphy *wiphy, struct net_device *dev,
u8 key_idx, const u8 *mac_addr,
struct key_params *params);
*/
static int wl_setup_rfkill(struct wl_priv *wl, bool setup);
static int wl_rfkill_set(void *data, bool blocked);
+#ifdef DEBUGFS_CFG80211
+static s32 wl_setup_debugfs(struct wl_priv *wl);
+static s32 wl_free_debugfs(struct wl_priv *wl);
+#endif
static wl_scan_params_t *wl_cfg80211_scan_alloc_params(int channel,
int nprobes, int *out_params_size);
-static void get_primary_mac(struct wl_priv *wl, struct ether_addr *mac);
/*
* Some external functions, TODO: move them to dhd_linux.h
int dhd_monitor_uninit(void);
int dhd_start_xmit(struct sk_buff *skb, struct net_device *net);
-#if defined(CUSTOMER_HW4) && defined(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 ioctl_ver);
-void print_roam_cache(void);
-void set_roam_band(int band);
-#endif /* CUSTOMER_HW4 && ROAM_CHANNEL_CACHE */
#define RETURN_EIO_IF_NOT_UP(wlpriv) \
extern void dhd_wlfc_deinit(dhd_pub_t *dhd);
#endif /* PROP_TXSTATUS_VSDB */
-#if defined(CUSTOMER_HW4) && defined(USE_DYNAMIC_F2_BLKSIZE)
-extern int
-dhdsdio_func_blocksize(dhd_pub_t *dhd, int function_num, int block_size);
-#endif /* CUSTOMER_HW4 && USE_DYNAMIC_F2_BLKSIZE */
#if (WL_DBG_LEVEL > 0)
#define WL_DBG_ESTR_MAX 50
WLAN_CIPHER_SUITE_TKIP,
WLAN_CIPHER_SUITE_CCMP,
WLAN_CIPHER_SUITE_AES_CMAC,
-#ifdef BCMWAPI_WPI
- WLAN_CIPHER_SUITE_SMS4,
-#endif
-#if defined(WLFBT) && defined(WLAN_CIPHER_SUITE_PMK)
- WLAN_CIPHER_SUITE_PMK,
-#endif
};
-#ifdef WL_CFG80211_GON_COLLISION
-#define BLOCK_GON_REQ_MAX_NUM 5
-#endif /* WL_CFG80211_GON_COLLISION */
/* IOCtl version read from targeted driver */
static int ioctl_version;
+#ifdef DEBUGFS_CFG80211
+#define S_SUBLOGLEVEL 20
+static const struct {
+ u32 log_level;
+ char *sublogname;
+} sublogname_map[] = {
+ {WL_DBG_ERR, "ERR"},
+ {WL_DBG_INFO, "INFO"},
+ {WL_DBG_DBG, "DBG"},
+ {WL_DBG_SCAN, "SCAN"},
+ {WL_DBG_TRACE, "TRACE"},
+ {WL_DBG_P2P_ACTION, "P2PACTION"}
+};
+#endif
/* Return a new chanspec given a legacy chanspec
* Returns INVCHANSPEC on error
BIT(IEEE80211_STYPE_AUTH >> 4) |
BIT(IEEE80211_STYPE_DEAUTH >> 4) |
BIT(IEEE80211_STYPE_ACTION >> 4)
- }
+ },
};
static void swap_key_from_BE(struct wl_wsec_key *key)
key->iv_initialized = dtoh32(key->iv_initialized);
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0)) && !0
/* For debug: Dump the contents of the encoded wps ie buffe */
static void
wl_validate_wps_ie(char *wps_ie, s32 wps_ie_len, bool *pbc)
subel += subelt_len;
}
}
-#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0) */
+#endif
static chanspec_t wl_cfg80211_get_shared_freq(struct wiphy *wiphy)
{
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", chspec));
}
return chspec;
}
-static struct net_device* wl_cfg80211_add_monitor_if(char *name)
+static bcm_struct_cfgdev *
+wl_cfg80211_add_monitor_if(char *name)
{
-#if defined(WLP2P) && defined(WL_ENABLE_P2P_IF)
+#if defined(WL_ENABLE_P2P_IF)
WL_INFO(("wl_cfg80211_add_monitor_if: No more support monitor interface\n"));
return ERR_PTR(-EOPNOTSUPP);
#else
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) */
+ return ndev_to_cfgdev(ndev);
+#endif
}
-static struct net_device *
-wl_cfg80211_add_virtual_iface(struct wiphy *wiphy, char *name,
+static bcm_struct_cfgdev *
+wl_cfg80211_add_virtual_iface(struct wiphy *wiphy,
+ char *name,
enum nl80211_iftype type, u32 *flags,
struct vif_params *params)
{
dhd = (dhd_pub_t *)(wl->pub);
#endif /* PROP_TXSTATUS_VSDB */
-
/* Use primary I/F for sending cmds down to firmware */
_ndev = wl_to_prmry_ndev(wl);
mode = WL_MODE_IBSS;
return NULL;
case NL80211_IFTYPE_MONITOR:
- return wl_cfg80211_add_monitor_if(name);
+ return wl_cfg80211_add_monitor_if((char *)name);
case NL80211_IFTYPE_P2P_CLIENT:
case NL80211_IFTYPE_STATION:
wlif_type = WL_P2P_IF_CLIENT;
rtnl_unlock();
rollback_lock = true;
}
- WL_INFO(("%s: Released the lock and wait till IF_DEL is complete\n",
- __func__));
+ WL_INFO(("Released the lock and wait till IF_DEL is complete\n"));
timeout = wait_event_interruptible_timeout(wl->netif_change_event,
(wl_get_p2p_status(wl, IF_DELETING) == false),
msecs_to_jiffies(MAX_WAIT_TIME));
memset(wl->p2p->vir_ifname, 0, IFNAMSIZ);
strncpy(wl->p2p->vir_ifname, name, IFNAMSIZ - 1);
- wl_notify_escan_complete(wl, _ndev, true, true);
+ wl_cfg80211_scan_abort(wl);
#ifdef PROP_TXSTATUS_VSDB
if (!wl->wlfc_on && !disable_proptx) {
dhd->wlfc_enabled = true;
rollback_lock = true;
}
if (net_attach && !net_attach(wl->pub, _ndev->ifindex)) {
-#ifdef CUSTOMER_HW4
- wl_alloc_netinfo(wl, _ndev, vwdev, mode, PM_BLOCK);
-#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);
+
+ if (mode != WL_MODE_AP)
+ wldev_iovar_setint(_ndev, "buf_key_b4_m4", 1);
+
WL_ERR((" virtual interface(%s) is "
"created net attach done\n", wl->p2p->vir_ifname));
if (mode == WL_MODE_AP)
else if (type == NL80211_IFTYPE_P2P_GO)
dhd_mode = DHD_FLAG_P2P_GO_MODE;
DNGL_FUNC(dhd_cfg80211_set_p2p_info, (wl, dhd_mode));
+#ifdef PROP_TXSTATUS_VSDB
+ if (dhd->plat_enable)
+ dhd->plat_enable((void *)dhd);
+#endif /* PROP_TXSTATUS_VSDB */
+ /* reinitialize completion to clear previous count */
+ INIT_COMPLETION(wl->iface_disable);
} else {
/* put back the rtnl_lock again */
if (rollback_lock)
/* put back the rtnl_lock again */
if (rollback_lock)
rtnl_lock();
- return _ndev;
-
+ return ndev_to_cfgdev(_ndev);
} else {
wl_clr_p2p_status(wl, IF_ADD);
WL_ERR((" virtual interface(%s) is not created \n", wl->p2p->vir_ifname));
if (dhd->wlfc_enabled && wl->wlfc_on) {
dhd->wlfc_enabled = false;
dhd_wlfc_deinit(dhd);
+ if (dhd->plat_deinit)
+ dhd->plat_deinit((void *)dhd);
wl->wlfc_on = false;
}
#endif /* PROP_TXSTATUS_VSDB */
}
static s32
-wl_cfg80211_del_virtual_iface(struct wiphy *wiphy, struct net_device *dev)
+wl_cfg80211_del_virtual_iface(struct wiphy *wiphy, bcm_struct_cfgdev *cfgdev)
{
+ struct net_device *dev = NULL;
struct ether_addr p2p_mac;
struct wl_priv *wl = wiphy_priv(wiphy);
s32 timeout = -1;
s32 index = -1;
WL_DBG(("Enter\n"));
- if (wl->p2p_net == dev) {
- /* Since there is no ifidx corresponding to p2p0, cmds to
- * firmware should be routed through primary I/F
- */
- dev = wl_to_prmry_ndev(wl);
- }
+ dev = cfgdev_to_wlc_ndev(cfgdev, wl);
+
if (wl_cfgp2p_find_idx(wl, dev, &index) != BCME_OK) {
WL_ERR(("Find p2p index from ndev(%p) failed\n", dev));
return BCME_ERROR;
}
wldev_iovar_setint(dev, "mpc", 1);
+ if (wl->pm_enable_work_on) {
+ cancel_delayed_work_sync(&wl->pm_enable_work);
+ wl->pm_enable_work_on = false;
+ }
+
/* for GC */
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 GO !!!\n"));
wait_for_completion_timeout(&wl->iface_disable,
msecs_to_jiffies(500));
- } else {
- msleep(300);
}
}
wl_cfgp2p_clear_management_ie(wl, index);
+
+ if (wl_get_mode_by_netdev(wl, dev) != WL_MODE_AP)
+ wldev_iovar_setint(dev, "buf_key_b4_m4", 0);
+
/* delete interface after link down */
ret = wl_cfgp2p_ifdel(wl, &p2p_mac);
/* Firmware could not delete the interface so we will not get WLC_E_IF
{
s32 ap = 0;
s32 infra = 0;
- s32 err = BCME_OK;
+ s32 ibss = 0;
s32 wlif_type;
s32 mode = 0;
+ s32 err = BCME_OK;
chanspec_t chspec;
struct wl_priv *wl = wiphy_priv(wiphy);
dhd_pub_t *dhd = (dhd_pub_t *)(wl->pub);
break;
case NL80211_IFTYPE_ADHOC:
mode = WL_MODE_IBSS;
+ ibss = 1;
break;
case NL80211_IFTYPE_STATION:
case NL80211_IFTYPE_P2P_CLIENT:
ndev->name, ap, infra, type));
wl_set_p2p_status(wl, IF_CHANGING);
wl_clr_p2p_status(wl, IF_CHANGED);
- err = wl_cfgp2p_ifchange(wl, &wl->p2p->int_addr, htod32(wlif_type), chspec);
+ wl_cfgp2p_ifchange(wl, &wl->p2p->int_addr, htod32(wlif_type), chspec);
wait_event_interruptible_timeout(wl->netif_change_event,
(wl_get_p2p_status(wl, IF_CHANGED) == true),
msecs_to_jiffies(MAX_WAIT_TIME));
WL_ERR(("struct ap_saved_ie allocation failed\n"));
return -ENOMEM;
}
-#if defined(CUSTOMER_HW4) && defined(USE_DYNAMIC_F2_BLKSIZE)
- dhdsdio_func_blocksize(dhd, 2, DYNAMIC_F2_BLKSIZE_FOR_NONLEGACY);
-#endif /* CUSTOMER_HW4 && USE_DYNAMIC_F2_BLKSIZE */
} else {
WL_ERR(("Cannot change the interface for GO or SOFTAP\n"));
return -EINVAL;
}
} else {
- infra = htod32(infra);
- err = wldev_ioctl(ndev, WLC_SET_INFRA, &infra, sizeof(s32), true);
- if (err) {
- WL_ERR(("WLC_SET_INFRA error (%d)\n", err));
- return -EAGAIN;
- }
+ WL_DBG(("Change_virtual_iface for transition from GO/AP to client/STA"));
+ }
+
+ if (ibss) {
+ infra = 0;
wl_set_mode_by_netdev(wl, ndev, mode);
+ err = wldev_ioctl(ndev, WLC_SET_INFRA, &infra, sizeof(s32), true);
+ if (err < 0) {
+ WL_ERR(("SET Adhoc error %d\n", err));
+ return -EINVAL;
+ }
}
ndev->ieee80211_ptr->iftype = type;
{
struct wl_priv *wl = wlcfg_drv_priv;
bool rollback_lock = false;
- s32 index = 0;
+ s32 type = -1;
+ s32 bssidx = -1;
+
#ifdef PROP_TXSTATUS_VSDB
dhd_pub_t *dhd = (dhd_pub_t *)(wl->pub);
#endif /* PROP_TXSTATUS_VSDB */
ndev, wl->p2p->vir_ifname));
memset(wl->p2p->vir_ifname, '\0', IFNAMSIZ);
- if (wl_cfgp2p_find_idx(wl, ndev, &index) != BCME_OK) {
- WL_ERR(("Find p2p index from ndev(%p) failed\n", ndev));
+ if (wl_cfgp2p_find_idx(wl, ndev, &bssidx) != BCME_OK) {
+ WL_ERR(("Find p2p bssidx from ndev(%p) failed\n", ndev));
+ return BCME_ERROR;
+ }
+ if (wl_cfgp2p_find_type(wl, bssidx, &type) != BCME_OK) {
+ WL_ERR(("Find p2p type from bssidx(%d) failed\n", bssidx));
return BCME_ERROR;
}
- wl_to_p2p_bss_ndev(wl, index) = NULL;
- wl_to_p2p_bss_bssidx(wl, index) = WL_INVALID;
+ wl_to_p2p_bss_ndev(wl, type) = NULL;
+ wl_to_p2p_bss_bssidx(wl, type) = WL_INVALID;
wl->p2p->vif_created = false;
- WL_DBG(("index : %d\n", index));
+ WL_DBG(("type : %d\n", type));
#ifdef PROP_TXSTATUS_VSDB
if (dhd->wlfc_enabled && wl->wlfc_on) {
dhd->wlfc_enabled = false;
dhd_wlfc_deinit(dhd);
+ if (dhd->plat_deinit)
+ dhd->plat_deinit((void *)dhd);
wl->wlfc_on = false;
}
#endif /* PROP_TXSTATUS_VSDB */
continue;
if (request->channels[i]->band == IEEE80211_BAND_2GHZ) {
-#ifdef WL_HOST_BAND_MGMT
- if (wl->curr_band == WLC_BAND_5G) {
- WL_DBG(("In 5G only mode, omit 2G channel:%d\n", channel));
- continue;
- }
-#endif /* WL_HOST_BAND_MGMT */
chanspec |= WL_CHANSPEC_BAND_2G;
} else {
-#ifdef WL_HOST_BAND_MGMT
- if (wl->curr_band == WLC_BAND_2G) {
- WL_DBG(("In 2G only mode, omit 5G channel:%d\n", channel));
- continue;
- }
-#endif /* WL_HOST_BAND_MGMT */
chanspec |= WL_CHANSPEC_BAND_5G;
}
htod32((n_ssids << WL_SCAN_PARAMS_NSSID_SHIFT) |
(n_channels & WL_SCAN_PARAMS_COUNT_MASK));
- if (n_channels == 1 && wl_get_drv_status_all(wl, CONNECTED)) {
- params->active_time = WL_SCAN_CONNECT_DWELL_TIME_MS;
+ if (n_channels == 1) {
+ params->active_time = htod32(WL_SCAN_CONNECT_DWELL_TIME_MS);
+ params->nprobes = htod32(params->active_time / WL_SCAN_JOIN_PROBE_INTERVAL_MS);
}
}
struct wl_iscan_params *params = NULL;
s32 err = 0;
- if (request == NULL) {
- err = -EINVAL;
- goto done;
- }
- 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;
+ if (request != NULL) {
+ 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;
+ /* 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;
return err;
}
-#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 */
static s32
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) {
+ /* scan request can come with empty request : perform all default scan */
+ if (!wl) {
err = -EINVAL;
goto exit;
}
/* LEGACY SCAN TRIGGER */
WL_SCAN((" LEGACY E-SCAN START\n"));
-#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;
+ /* if scan request is not empty parse scan request paramters */
+ if (request != NULL) {
+ 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;
- WL_SCAN(("request->n_channels=%d\n", request->n_channels));
- g_first_broadcast_scan = false;
- is_first_init_2g_scan = true;
- }
+ /* Allocate space for populating ssids in wl_iscan_params struct */
+ params_size += sizeof(struct wlc_ssid) * n_ssids;
}
-
-#endif /* USE_INITIAL_2G_SCAN */
-
- 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;
}
wl_scan_prep(¶ms->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 */
params->version = htod32(ESCAN_REQ_VERSION);
params->action = htod16(action);
-#if defined(CUSTOMER_HW4) && defined(DUAL_ESCAN_RESULT_BUFFER)
- params->sync_id = wl->escan_info.cur_sync_id;
-#else
- params->sync_id = htod16(0x1234);
-#endif
+ wl_escan_set_sync_id(params->sync_id, wl);
if (params_size + sizeof("escan") >= WLC_IOCTL_MEDLEN) {
WL_ERR(("ioctl buffer length not sufficient\n"));
kfree(params);
}
err = wldev_iovar_setbuf(ndev, "escan", params, params_size,
wl->escan_ioctl_buf, WLC_IOCTL_MEDLEN, NULL);
- if (unlikely(err))
- WL_ERR((" Escan set error (%d)\n", err));
+ if (unlikely(err)) {
+ if (err == BCME_EPERM)
+ /* Scan Not permitted at this point of time */
+ WL_DBG((" Escan not permitted at this time (%d)\n", err));
+ else
+ WL_ERR((" Escan set error (%d)\n", err));
+ }
kfree(params);
}
else if (p2p_is_on(wl) && p2p_scan(wl)) {
n_valid_chan = dtoh32(list->count);
for (i = 0; i < num_chans; i++)
{
-#ifdef WL_HOST_BAND_MGMT
- int channel_band = 0;
-#endif /* WL_HOST_BAND_MGMT */
_freq = request->channels[i]->center_freq;
channel = ieee80211_frequency_to_channel(_freq);
-#ifdef WL_HOST_BAND_MGMT
- channel_band = (channel > CH_MAX_2G_CHANNEL) ?
- WLC_BAND_5G : WLC_BAND_2G;
- if ((wl->curr_band != WLC_BAND_AUTO) &&
- (wl->curr_band != channel_band) &&
- !IS_P2P_SOCIAL_CHANNEL(channel))
- continue;
-#endif /* WL_HOST_BAND_MGMT */
/* ignore DFS channels */
if (request->channels[i]->flags &
}
err = wl_cfgp2p_escan(wl, ndev, wl->active_scan, num_chans, default_chan_list,
search_state, action,
- wl_to_p2p_bss_bssidx(wl, P2PAPI_BSSCFG_DEVICE));
+ wl_to_p2p_bss_bssidx(wl, P2PAPI_BSSCFG_DEVICE), NULL);
+
+ if (!err)
+ wl->p2p->search_state = search_state;
+
kfree(default_chan_list);
}
exit:
if (unlikely(err)) {
- WL_ERR(("error (%d)\n", err));
+ /* Don't print Error incase of Scan suppress */
+ if ((err == BCME_EPERM) && wl->scan_suppressed)
+ WL_DBG(("Escan failed: Scan Suppressed \n"));
+ else
+ WL_ERR(("error (%d)\n", err));
}
return err;
}
wl_scan_results_t *results;
WL_SCAN(("Enter \n"));
mutex_lock(&wl->usr_sync);
-#if defined(CUSTOMER_HW4) && 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 = wl_escan_get_buf(wl, FALSE);
results->version = 0;
results->count = 0;
results->buflen = WL_SCAN_RESULTS_FIXED_SIZE;
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;
unsigned long flags;
static s32 busy_count = 0;
- /* If scan req comes for p2p0, send it over primary I/F
- * Scan results will be delivered corresponding to cfg80211_scan_request
- */
- if (ndev == wl->p2p_net) {
- ndev = wl_to_prmry_ndev(wl);
+ dhd_pub_t *dhd;
+
+ dhd = (dhd_pub_t *)(wl->pub);
+ if (dhd->op_mode & DHD_FLAG_HOSTAP_MODE) {
+ WL_ERR(("Invalid Scan Command at SoftAP mode\n"));
+ return -EINVAL;
}
+ ndev = ndev_to_wlc_ndev(ndev, wl);
+
if (WL_DRV_STATUS_SENDING_AF_FRM_EXT(wl)) {
WL_ERR(("Sending Action Frames. Try it again.\n"));
return -EAGAIN;
err = BCME_ERROR;
goto scan_out;
}
-#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);
- wl->wl11u = FALSE;
- /* we don't care about error */
- }
-#endif /* WL11U */
err = wl_cfgp2p_set_management_ie(wl, ndev, bssidx,
VNDR_IE_PRBREQ_FLAG, (u8 *)request->ie,
request->ie_len);
/* we don't do iscan in ibss */
ssids = this_ssid;
}
+ if (request && !p2p_scan(wl))
+ WL_TRACE_HW4(("START SCAN\n"));
wl->scan_request = request;
wl_set_drv_status(wl, SCANNING, ndev);
if (iscan_req) {
else
WL_ERR(("GET BSSID failed with %d\n", ret));
- wl_cfg80211_disconnect(wiphy, ndev, DOT11_RC_DISASSOC_LEAVING);
+ wl_cfg80211_scan_abort(wl);
}
} else {
busy_count = 0;
err = __wl_cfg80211_scan(wiphy, ndev, request, NULL);
if (unlikely(err)) {
- WL_ERR(("scan error (%d)\n", err));
+ if ((err == BCME_EPERM) && wl->scan_suppressed)
+ WL_DBG(("scan not permitted at this time (%d)\n", err));
+ else
+ WL_ERR(("scan error (%d)\n", err));
return err;
}
return err;
}
+
static s32
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 |
-#endif
WPA_AUTH_UNSPECIFIED;
else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2)
val = WPA2_AUTH_PSK|
-#ifdef BCMCCX
- WPA2_AUTH_CCKM |
-#endif
WPA2_AUTH_UNSPECIFIED;
else
val = WPA_AUTH_DISABLED;
if (is_wps_conn(sme))
val = WPA_AUTH_DISABLED;
-#ifdef BCMWAPI_WPI
- if (sme->crypto.wpa_versions & NL80211_WAPI_VERSION_1) {
- WL_DBG((" * wl_set_wpa_version, set wpa_auth"
- " to WPA_AUTH_WAPI 0x400"));
- val = WAPI_AUTH_PSK | WAPI_AUTH_UNSPECIFIED;
- }
-#endif
WL_DBG(("setting wpa_auth to 0x%0x\n", val));
err = wldev_iovar_setint_bsscfg(dev, "wpa_auth", val, bssidx);
if (unlikely(err)) {
return err;
}
-#ifdef BCMWAPI_WPI
-static s32
-wl_set_set_wapi_ie(struct net_device *dev, struct cfg80211_connect_params *sme)
-{
- struct wl_priv *wl = wlcfg_drv_priv;
- s32 err = 0;
- s32 bssidx;
- if (wl_cfgp2p_find_idx(wl, dev, &bssidx) != BCME_OK) {
- WL_ERR(("Find p2p index from dev(%p) failed\n", dev));
- return BCME_ERROR;
- }
-
- WL_DBG((" %s \n", __FUNCTION__));
-
- if (sme->crypto.wpa_versions & NL80211_WAPI_VERSION_1) {
- err = wldev_iovar_setbuf_bsscfg(dev, "wapiie", sme->ie,
- sme->ie_len, wl->ioctl_buf, WLC_IOCTL_MAXLEN, bssidx, &wl->ioctl_buf_sync);
-
- if (unlikely(err)) {
- WL_ERR(("===> set_wapi_ie Error (%d)\n", err));
- return err;
- }
- } else
- WL_DBG((" * skip \n"));
- return err;
-}
-#endif /* BCMWAPI_WPI */
static s32
wl_set_auth_type(struct net_device *dev, struct cfg80211_connect_params *sme)
val = WL_AUTH_OPEN_SHARED;
WL_DBG(("automatic\n"));
break;
-#ifdef BCMCCX
- case NL80211_AUTHTYPE_NETWORK_EAP:
- WL_DBG(("network eap\n"));
- val = DOT11_LEAP_AUTH;
-#endif
- break;
default:
val = 2;
WL_ERR(("invalid auth type (%d)\n", sme->auth_type));
s32 pval = 0;
s32 gval = 0;
s32 err = 0;
-#ifdef BCMWAPI_WPI
- s32 val = 0;
-#endif
+ s32 wsec_val = 0;
+
s32 bssidx;
if (wl_cfgp2p_find_idx(wl, dev, &bssidx) != BCME_OK) {
WL_ERR(("Find p2p index from dev(%p) failed\n", dev));
case WLAN_CIPHER_SUITE_AES_CMAC:
pval = AES_ENABLED;
break;
-#ifdef BCMWAPI_WPI
- case WLAN_CIPHER_SUITE_SMS4:
- val = SMS4_ENABLED;
- pval = SMS4_ENABLED;
- break;
-#endif
default:
WL_ERR(("invalid cipher pairwise (%d)\n",
sme->crypto.ciphers_pairwise[0]));
return -EINVAL;
}
}
-#if defined(BCMSUP_4WAY_HANDSHAKE) && defined(WLAN_AKM_SUITE_FT_8021X)
- /* Ensure in-dongle supplicant is turned on when FBT wants to do the 4-way
- * handshake.
- * Note that the FW feature flag only exists on kernels that support the
- * FT-EAP AKM suite.
- */
- if (wl->wdev->wiphy->features & NL80211_FEATURE_FW_4WAY_HANDSHAKE) {
- if (pval == AES_ENABLED)
- err = wldev_iovar_setint_bsscfg(dev, "sup_wpa", 1, bssidx);
- else
- err = wldev_iovar_setint_bsscfg(dev, "sup_wpa", 0, bssidx);
-
- if (err) {
- WL_ERR(("FBT: Error setting sup_wpa (%d)\n", err));
- return err;
- }
- }
-#endif /* BCMSUP_4WAY_HANDSHAKE && WLAN_AKM_SUITE_FT_8021X */
if (sme->crypto.cipher_group) {
switch (sme->crypto.cipher_group) {
case WLAN_CIPHER_SUITE_WEP40:
case WLAN_CIPHER_SUITE_AES_CMAC:
gval = AES_ENABLED;
break;
-#ifdef BCMWAPI_WPI
- case WLAN_CIPHER_SUITE_SMS4:
- val = SMS4_ENABLED;
- gval = SMS4_ENABLED;
- break;
-#endif
default:
WL_ERR(("invalid cipher group (%d)\n",
sme->crypto.cipher_group));
/* WPS-2.0 allows no security */
err = wldev_iovar_setint_bsscfg(dev, "wsec", 0, bssidx);
} else {
-#ifdef BCMWAPI_WPI
- if (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_SMS4) {
- WL_DBG((" NO, is_wps_conn, WAPI set to SMS4_ENABLED"));
- err = wldev_iovar_setint_bsscfg(dev, "wsec", val, bssidx);
- } else {
-#endif
WL_DBG((" NO, is_wps_conn, Set pval | gval to WSEC"));
+ wsec_val = pval | gval;
+
+ WL_DBG((" Set WSEC to fW 0x%x \n", wsec_val));
err = wldev_iovar_setint_bsscfg(dev, "wsec",
- pval | gval, bssidx);
-#ifdef BCMWAPI_WPI
- }
-#endif
+ wsec_val, bssidx);
}
if (unlikely(err)) {
WL_ERR(("error (%d)\n", err));
return err;
}
if (val & (WPA_AUTH_PSK |
-#ifdef BCMCCX
- WPA_AUTH_CCKM |
-#endif
WPA_AUTH_UNSPECIFIED)) {
switch (sme->crypto.akm_suites[0]) {
case WLAN_AKM_SUITE_8021X:
case WLAN_AKM_SUITE_PSK:
val = WPA_AUTH_PSK;
break;
-#ifdef BCMCCX
- case WLAN_AKM_SUITE_CCKM:
- val = WPA_AUTH_CCKM;
- break;
-#endif
default:
WL_ERR(("invalid cipher group (%d)\n",
sme->crypto.cipher_group));
return -EINVAL;
}
} else if (val & (WPA2_AUTH_PSK |
-#ifdef BCMCCX
- WPA2_AUTH_CCKM |
-#endif
WPA2_AUTH_UNSPECIFIED)) {
switch (sme->crypto.akm_suites[0]) {
case WLAN_AKM_SUITE_8021X:
case WLAN_AKM_SUITE_PSK:
val = WPA2_AUTH_PSK;
break;
-#if defined(WLFBT) && defined(WLAN_AKM_SUITE_FT_8021X)
- case WLAN_AKM_SUITE_FT_8021X:
- val = WPA2_AUTH_UNSPECIFIED | WPA2_AUTH_FT;
- break;
-#endif
-#if defined(WLFBT) && defined(WLAN_AKM_SUITE_FT_PSK)
- case WLAN_AKM_SUITE_FT_PSK:
- val = WPA2_AUTH_PSK | WPA2_AUTH_FT;
- break;
-#endif
-#ifdef BCMCCX
- case WLAN_AKM_SUITE_CCKM:
- val = WPA2_AUTH_CCKM;
- break;
-#endif
- default:
- WL_ERR(("invalid cipher group (%d)\n",
- sme->crypto.cipher_group));
- return -EINVAL;
- }
- }
-#ifdef BCMWAPI_WPI
- else if (val & (WAPI_AUTH_PSK | WAPI_AUTH_UNSPECIFIED)) {
- switch (sme->crypto.akm_suites[0]) {
- case WLAN_AKM_SUITE_WAPI_CERT:
- val = WAPI_AUTH_UNSPECIFIED;
- break;
- case WLAN_AKM_SUITE_WAPI_PSK:
- val = WAPI_AUTH_PSK;
- break;
default:
WL_ERR(("invalid cipher group (%d)\n",
sme->crypto.cipher_group));
return -EINVAL;
}
}
-#endif
WL_DBG(("setting wpa_auth to %d\n", val));
+
err = wldev_iovar_setint_bsscfg(dev, "wpa_auth", val, bssidx);
if (unlikely(err)) {
WL_ERR(("could not set wpa_auth (%d)\n", err));
WL_DBG(("wpa_versions 0x%x cipher_pairwise 0x%x\n",
sec->wpa_versions, sec->cipher_pairwise));
if (!(sec->wpa_versions & (NL80211_WPA_VERSION_1 |
-#ifdef BCMWAPI_WPI
- NL80211_WPA_VERSION_2 | NL80211_WAPI_VERSION_1)) &&
-#else
NL80211_WPA_VERSION_2)) &&
-#endif
(sec->cipher_pairwise & (WLAN_CIPHER_SUITE_WEP40 |
-#ifdef BCMWAPI_WPI
- WLAN_CIPHER_SUITE_WEP104 | WLAN_CIPHER_SUITE_SMS4)))
-#else
WLAN_CIPHER_SUITE_WEP104)))
-#endif
{
memset(&key, 0, sizeof(key));
key.len = (u32) sme->key_len;
case WLAN_CIPHER_SUITE_WEP104:
key.algo = CRYPTO_ALGO_WEP128;
break;
-#ifdef BCMWAPI_WPI
- case WLAN_CIPHER_SUITE_SMS4:
- key.algo = CRYPTO_ALGO_SMS4;
- break;
-#endif
default:
WL_ERR(("Invalid algorithm (%d)\n",
sme->crypto.ciphers_pairwise[0]));
#endif /* ESCAN_RESULT_PATCH */
-#if defined(CUSTOMER_HW4) && defined(ROAM_CHANNEL_CACHE)
-#define MAX_ROAM_CACHE_NUM 100
-#endif /* CUSTOMER_HW4 && ROAM_CHANNEL_CACHE */
static s32
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;
-#if defined(ROAM_ENABLE) && defined(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;
bcm_tlv_t *wpa2_ie;
u32 chan_cnt = 0;
struct ether_addr bssid;
s32 bssidx;
-#if defined(CUSTOMER_HW4) && defined(ROAM_CHANNEL_CACHE)
- chanspec_t chanspec_list[MAX_ROAM_CACHE_NUM];
-#endif /* CUSTOMER_HW4 && ROAM_CHANNEL_CACHE */
int ret;
+ int wait_cnt;
WL_DBG(("In\n"));
return -EOPNOTSUPP;
}
+ if (unlikely(sme->ssid_len > DOT11_MAX_SSID_LEN)) {
+ WL_ERR(("Invalid SSID info: SSID=%s, length=%d\n",
+ sme->ssid, sme->ssid_len));
+ return -EINVAL;
+ }
+
RETURN_EIO_IF_NOT_UP(wl);
/*
* Cancel ongoing scan to sync up with sme state machine of cfg80211.
*/
-#if (defined(BCM4334_CHIP) || !defined(ESCAN_RESULT_PATCH))
+#if !defined(ESCAN_RESULT_PATCH)
if (wl->scan_request) {
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 defined(ESCAN_RESULT_PATCH)
if (sme->bssid)
memcpy(connect_req_bssid, sme->bssid, ETHER_ADDR_LEN);
WL_ERR(("error (%d)\n", err));
return err;
}
- while (wl_get_drv_status(wl, DISCONNECTING, dev)) {
- WL_ERR(("Waiting for disconnection terminated.\n"));
- msleep(20);
+ wait_cnt = 500/10;
+ while (wl_get_drv_status(wl, DISCONNECTING, dev) && wait_cnt) {
+ WL_DBG(("Waiting for disconnection terminated, wait_cnt: %d\n",
+ wait_cnt));
+ wait_cnt--;
+ msleep(10);
}
} else
WL_DBG(("Currently not associated!\n"));
+ } else {
+ /* if status is DISCONNECTING, wait for disconnection terminated max 500 ms */
+ wait_cnt = 500/10;
+ while (wl_get_drv_status(wl, DISCONNECTING, dev) && wait_cnt) {
+ WL_DBG(("Waiting for disconnection terminated, wait_cnt: %d\n", wait_cnt));
+ wait_cnt--;
+ msleep(10);
+ }
}
+
/* Clean BSSID */
bzero(&bssid, sizeof(bssid));
if (!wl_get_drv_status(wl, DISCONNECTING, dev))
return err;
}
}
-#if defined(ROAM_ENABLE) && defined(ROAM_AP_ENV_DETECTION)
- if (dhd->roam_env_detection && (wldev_iovar_setint(dev, "roam_env_detection",
- 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);
- if (unlikely(err)) {
- WL_ERR((" failed to restore roam_trigger for auto env detection\n"));
- }
- }
-#endif /* ROAM_AP_ENV_DETECTION */
if (chan) {
-#if defined(CUSTOMER_HW4) && defined(ROAM_CHANNEL_CACHE)
- wlc_ssid_t ssid;
- int band;
-
- err = wldev_get_band(dev, &band);
- if (!err) {
- set_roam_band(band);
- }
-
- 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, ioctl_version);
-#else
wl->channel = ieee80211_frequency_to_channel(chan->center_freq);
chan_cnt = 1;
-#endif /* CUSTOMER_HW4 && ROAM_CHANNEL_CACHE */
WL_DBG(("channel (%d), center_req (%d), %d channels\n", wl->channel,
chan->center_freq, chan_cnt));
} else
wl->channel = 0;
-#ifdef BCMWAPI_WPI
- WL_DBG(("1. enable wapi auth\n"));
- if (sme->crypto.wpa_versions & NL80211_WAPI_VERSION_1) {
- WL_DBG(("2. set wapi ie \n"));
- err = wl_set_set_wapi_ie(dev, sme);
- if (unlikely(err))
- return err;
- } else
- WL_DBG(("2. Not wapi ie \n"));
-#endif
WL_DBG(("ie (%p), ie_len (%zd)\n", sme->ie, sme->ie_len));
WL_DBG(("3. set wapi version \n"));
err = wl_set_wpa_version(dev, sme);
WL_ERR(("Invalid wpa_version\n"));
return err;
}
-#ifdef BCMWAPI_WPI
- if (sme->crypto.wpa_versions & NL80211_WAPI_VERSION_1)
- WL_DBG(("4. WAPI Dont Set wl_set_auth_type\n"));
- else {
- WL_DBG(("4. wl_set_auth_type\n"));
-#endif
err = wl_set_auth_type(dev, sme);
if (unlikely(err)) {
WL_ERR(("Invalid auth type\n"));
return err;
}
-#ifdef BCMWAPI_WPI
- }
-#endif
err = wl_set_set_cipher(dev, sme);
if (unlikely(err)) {
wl_update_prof(wl, dev, NULL, &ext_join_params->ssid, WL_PROF_SSID);
ext_join_params->ssid.SSID_len = htod32(ext_join_params->ssid.SSID_len);
/* increate dwell time to receive probe response or detect Beacon
- * from target AP at a noisy air only during connect command
+ * from target AP at a noisy air only when channel info is provided in connect command
*/
- ext_join_params->scan.active_time = WL_SCAN_JOIN_ACTIVE_DWELL_TIME_MS;
- ext_join_params->scan.passive_time = WL_SCAN_JOIN_PASSIVE_DWELL_TIME_MS;
+ ext_join_params->scan.active_time = chan_cnt ? WL_SCAN_JOIN_ACTIVE_DWELL_TIME_MS : -1;
+ ext_join_params->scan.passive_time = chan_cnt ? WL_SCAN_JOIN_PASSIVE_DWELL_TIME_MS : -1;
/* 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_JOIN_PROBE_INTERVAL_MS);
+ ext_join_params->scan.nprobes = chan_cnt ?
+ (ext_join_params->scan.active_time/WL_SCAN_JOIN_PROBE_INTERVAL_MS) : -1;
ext_join_params->scan.home_time = -1;
if (sme->bssid)
memcpy(&ext_join_params->assoc.bssid, ðer_bcast, ETH_ALEN);
ext_join_params->assoc.chanspec_num = chan_cnt;
if (chan_cnt) {
-#if defined(CUSTOMER_HW4) && defined(ROAM_CHANNEL_CACHE)
- memcpy(ext_join_params->assoc.chanspec_list, chanspec_list,
- sizeof(chanspec_t) * chan_cnt);
-#else
u16 channel, band, bw, ctl_sb;
chanspec_t chspec;
channel = wl->channel;
ext_join_params->assoc.chanspec_list[0] |= chspec;
ext_join_params->assoc.chanspec_list[0] =
wl_chspec_host_to_driver(ext_join_params->assoc.chanspec_list[0]);
-#endif /* CUSTOMER_HW4 && ROAM_CHANNEL_CACHE */
}
ext_join_params->assoc.chanspec_num = htod32(ext_join_params->assoc.chanspec_num);
if (ext_join_params->ssid.SSID_len < IEEE80211_MAX_SSID_LEN) {
/*
* Cancel ongoing scan to sync up with sme state machine of cfg80211.
*/
-#if (defined(BCM4334_CHIP) || !defined(ESCAN_RESULT_PATCH))
+#if !defined(ESCAN_RESULT_PATCH)
/* Let scan aborted by F/W */
if (wl->scan_request) {
wl_notify_escan_complete(wl, dev, true, true);
u16 txpwrmw;
s32 err = 0;
s32 disable = 0;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)) || 0
+ dbm = MBM_TO_DBM(dbm);
+#endif
RETURN_EIO_IF_NOT_UP(wl);
switch (type) {
WL_ERR(("WLC_GET_WSEC error (%d)\n", err));
return err;
}
- if (wsec & WEP_ENABLED) {
+ /* fix IOT issue with Apple Airport */
+ if (wsec == WEP_ENABLED) {
/* Just select a new current key */
index = (u32) key_idx;
index = htod32(index);
key.algo = CRYPTO_ALGO_AES_CCM;
WL_DBG(("WLAN_CIPHER_SUITE_CCMP\n"));
break;
-#ifdef BCMWAPI_WPI
- case WLAN_CIPHER_SUITE_SMS4:
- key.algo = CRYPTO_ALGO_SMS4;
- WL_DBG(("WLAN_CIPHER_SUITE_SMS4\n"));
- break;
-#endif
default:
WL_ERR(("Invalid cipher (0x%x)\n", params->cipher));
return -EINVAL;
return BCME_ERROR;
}
- if (mac_addr) {
- wl_add_keyext(wiphy, dev, key_idx, mac_addr, params);
- goto exit;
+ if (mac_addr &&
+ ((params->cipher != WLAN_CIPHER_SUITE_WEP40) &&
+ (params->cipher != WLAN_CIPHER_SUITE_WEP104))) {
+ wl_add_keyext(wiphy, dev, key_idx, mac_addr, params);
+ goto exit;
}
memset(&key, 0, sizeof(key));
val = AES_ENABLED;
WL_DBG(("WLAN_CIPHER_SUITE_CCMP\n"));
break;
-#ifdef BCMWAPI_WPI
- case WLAN_CIPHER_SUITE_SMS4:
- key.algo = CRYPTO_ALGO_SMS4;
- WL_DBG(("WLAN_CIPHER_SUITE_SMS4\n"));
- val = SMS4_ENABLED;
- break;
-#endif /* BCMWAPI_WPI */
-#if defined(WLFBT) && defined(WLAN_CIPHER_SUITE_PMK)
- case WLAN_CIPHER_SUITE_PMK: {
- int j;
- wsec_pmk_t pmk;
- char keystring[WSEC_MAX_PSK_LEN + 1];
- char* charptr = keystring;
- uint len;
-
- /* copy the raw hex key to the appropriate format */
- for (j = 0; j < (WSEC_MAX_PSK_LEN / 2); j++) {
- sprintf(charptr, "%02x", params->key[j]);
- charptr += 2;
- }
- len = strlen(keystring);
- pmk.key_len = htod16(len);
- bcopy(keystring, pmk.key, len);
- pmk.flags = htod16(WSEC_PASSPHRASE);
-
- err = wldev_ioctl(dev, WLC_SET_WSEC_PMK, &pmk, sizeof(pmk), true);
- if (err)
- return err;
- } break;
-#endif /* WLFBT && WLAN_CIPHER_SUITE_PMK */
default:
WL_ERR(("Invalid cipher (0x%x)\n", params->cipher));
return -EINVAL;
params.cipher = WLAN_CIPHER_SUITE_AES_CMAC;
WL_DBG(("WLAN_CIPHER_SUITE_AES_CMAC\n"));
break;
-#ifdef BCMWAPI_WPI
- case WLAN_CIPHER_SUITE_SMS4:
- key.algo = CRYPTO_ALGO_SMS4;
- WL_DBG(("WLAN_CIPHER_SUITE_SMS4\n"));
- break;
-#endif
default:
WL_ERR(("Invalid algo (0x%x)\n", wsec));
return -EINVAL;
s32 rate;
s32 err = 0;
sta_info_t *sta;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)) || 0
s8 eabuf[ETHER_ADDR_STR_LEN];
#endif
dhd_pub_t *dhd = (dhd_pub_t *)(wl->pub);
sta->idle = dtoh32(sta->idle);
sta->in = dtoh32(sta->in);
sinfo->inactive_time = sta->idle * 1000;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)) || 0
if (sta->flags & WL_STA_ASSOC) {
sinfo->filled |= STATION_INFO_CONNECTED_TIME;
sinfo->connected_time = sta->in;
return err;
}
+/* Function to update sta power save mode for Kernel wifi stack */
+int wl_cfg80211_update_power_mode(struct net_device *dev)
+{
+ int pm = -1;
+ int err;
+
+ err = wldev_ioctl(dev, WLC_GET_PM, &pm, sizeof(pm), false);
+ if (err || (pm == -1)) {
+ WL_ERR(("error (%d)\n", err));
+ } else {
+ pm = (pm == PM_OFF) ? false : true;
+ WL_DBG(("%s: %d\n", __func__, pm));
+ if (dev->ieee80211_ptr)
+ dev->ieee80211_ptr->ps = pm;
+ }
+ return err;
+}
+
static s32
wl_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
bool enabled, s32 timeout)
s32 err = 0;
struct wl_priv *wl = wiphy_priv(wiphy);
struct net_info *_net_info = wl_get_netinfo_by_netdev(wl, dev);
-
+#if !defined(SUPPORT_PM2_ONLY)
+ dhd_pub_t *dhd = (dhd_pub_t *)(wl->pub);
+#endif /* (OEM_ANDROID) */
RETURN_EIO_IF_NOT_UP(wl);
-
- if (wl->p2p_net == dev || _net_info == NULL) {
+ WL_DBG(("Enter\n"));
+#if defined(WL_ENABLE_P2P_IF)
+ if (wl->p2p_net == dev || _net_info == NULL || wl->vsdb_mode ||
+ !wl_get_drv_status(wl, CONNECTED, dev)) {
+#else
+ if (_net_info == NULL || wl->vsdb_mode ||
+ !wl_get_drv_status(wl, CONNECTED, dev)) {
+#endif /* WL_ENABLE_P2P_IF */
return err;
}
+ WL_DBG(("%s: Enter power save enabled %d\n", dev->name, enabled));
+
+ /* Delete pm_enable_work */
+ if (wl->pm_enable_work_on) {
+ cancel_delayed_work_sync(&wl->pm_enable_work);
+ wl->pm_enable_work_on = false;
+ }
+#if !defined(SUPPORT_PM2_ONLY)
+ /* android has special hooks to change pm when kernel suspended */
+ pm = enabled ? ((dhd->in_suspend) ? PM_MAX : PM_FAST) : PM_OFF;
+#else
pm = enabled ? PM_FAST : PM_OFF;
- /* Do not enable the power save after assoc if it is p2p interface */
- if (_net_info->pm_block || wl->vsdb_mode) {
- /* Do not enable the power save if it is p2p interface or vsdb mode is set */
- WL_DBG(("%s:Do not enable the power save for pm_block %d or vsdb_mode %d\n",
- dev->name, _net_info->pm_block, wl->vsdb_mode));
+#endif /* SUPPORT_PM2_ONLY */
+ if (_net_info->pm_block) {
+ WL_ERR(("%s:Do not enable the power save for pm_block %d\n",
+ dev->name, _net_info->pm_block));
pm = PM_OFF;
}
pm = htod32(pm);
return err;
}
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)) || 0
static s32 wl_cfg80211_suspend(struct wiphy *wiphy, struct cfg80211_wowlan *wow)
#else
static s32 wl_cfg80211_suspend(struct wiphy *wiphy)
params_size = WL_SCAN_PARAMS_FIXED_SIZE + 1 * sizeof(uint16);
params = (wl_scan_params_t*) kzalloc(params_size, GFP_KERNEL);
if (params == NULL) {
- WL_ERR(("%s: mem alloc failed (%d bytes)\n", __func__, params_size));
+ WL_ERR(("mem alloc failed (%d bytes)\n", params_size));
return params;
}
memset(params, 0, params_size);
}
static s32
-wl_cfg80211_remain_on_channel(struct wiphy *wiphy, struct net_device *dev,
+wl_cfg80211_remain_on_channel(struct wiphy *wiphy, bcm_struct_cfgdev *cfgdev,
struct ieee80211_channel * channel,
enum nl80211_channel_type channel_type,
unsigned int duration, u64 *cookie)
{
s32 target_channel;
u32 id;
+ s32 err = BCME_OK;
struct ether_addr primary_mac;
struct net_device *ndev = NULL;
-
- s32 err = BCME_OK;
struct wl_priv *wl = wiphy_priv(wiphy);
- 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"));
+ ndev = cfgdev_to_wlc_ndev(cfgdev, wl);
- if (wl->p2p_net == dev) {
- ndev = wl_to_prmry_ndev(wl);
- } else {
- ndev = dev;
- }
+ WL_DBG(("Enter, channel: %d, duration ms (%d) SCANNING ?? %s \n",
+ ieee80211_frequency_to_channel(channel->center_freq),
+ duration, (wl_get_drv_status(wl, SCANNING, ndev)) ? "YES":"NO"));
if (!wl->p2p) {
WL_ERR(("wl->p2p is not initialized\n"));
}
#ifndef WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST
- if (wl_get_drv_status(wl, SCANNING, ndev)) {
- wl_notify_escan_complete(wl, ndev, true, true);
+ if (wl_get_drv_status_all(wl, SCANNING)) {
+ wl_notify_escan_complete(wl, wl->escan_info.ndev, true, true);
}
#endif /* not WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST */
target_channel = ieee80211_frequency_to_channel(channel->center_freq);
memcpy(&wl->remain_on_chan, channel, sizeof(struct ieee80211_channel));
+#if defined(WL_ENABLE_P2P_IF)
wl->remain_on_chan_type = channel_type;
+#endif /* WL_ENABLE_P2P_IF */
id = ++wl->last_roc_id;
if (id == 0)
id = ++wl->last_roc_id;
exit:
if (err == BCME_OK) {
WL_INFO(("Success\n"));
- cfg80211_ready_on_channel(dev, *cookie, channel,
+ cfg80211_ready_on_channel(cfgdev, *cookie, channel,
channel_type, duration, GFP_KERNEL);
} else {
WL_ERR(("Fail to Set (err=%d cookie:%llu)\n", err, *cookie));
}
static s32
-wl_cfg80211_cancel_remain_on_channel(struct wiphy *wiphy, struct net_device *dev,
- u64 cookie)
+wl_cfg80211_cancel_remain_on_channel(struct wiphy *wiphy,
+ bcm_struct_cfgdev *cfgdev, u64 cookie)
{
s32 err = 0;
- WL_DBG((" enter ) netdev_ifidx: %d \n", dev->ifindex));
+
+ WL_DBG((" enter ) netdev_ifidx: %d \n", cfgdev->ifindex));
return err;
}
(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);
+ wl->afx_hdl->bssidx, wl->afx_hdl->peer_listen_chan,
+ NULL);
}
if (unlikely(ret != BCME_OK)) {
WL_ERR(("ERROR occurred! returned value is (%d)\n", ret));
/* 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(WL_AF_SEARCH_TIME_MAX));
if ((wl->afx_hdl->peer_chan != WL_INVALID) ||
!(wl_get_drv_status(wl, FINDING_COMMON_CHANNEL, dev)))
wl->afx_hdl->my_listen_chan));
/* listen on my listen channel */
wl->afx_hdl->is_listen = TRUE;
- schedule_work(&wl->afx_hdl->work);
+ schedule_work(&wl->afx_hdl->work);
wait_for_completion_timeout(&wl->act_frm_scan,
- msecs_to_jiffies(MAX_WAIT_TIME));
+ msecs_to_jiffies(WL_AF_SEARCH_TIME_MAX));
}
- if (!wl_get_drv_status(wl, FINDING_COMMON_CHANNEL, dev))
+ if ((wl->afx_hdl->peer_chan != WL_INVALID) ||
+ !(wl_get_drv_status(wl, FINDING_COMMON_CHANNEL, dev)))
break;
+
wl->afx_hdl->retry++;
WL_AF_TX_KEEP_PRI_CONNECTION_VSDB(wl);
* 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
(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
/* 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;
}
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;
+ af_params->dwell_time = WL_MED_DWELL_TIME + 100;
break;
}
case P2P_PAF_GON_CONF: {
/* 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 */
#endif /* WL_CFG80211_SYNC_GON */
break;
case P2P_PAF_DEVDIS_REQ: {
- config_af_params->search_channel = true;
+ if (IS_ACTPUB_WITHOUT_GROUP_ID(&act_frm->elts[0],
+ action_frame->len)) {
+ config_af_params->search_channel = true;
+ }
wl->next_af_subtype = act_frm->subtype + 1;
/* maximize dwell time to wait for RESP frame */
#endif /* WL_CFG80211_SYNC_GON */
break;
case P2P_PAF_PROVDIS_REQ: {
- if (IS_PROV_DISC_WITHOUT_GROUP_ID(&act_frm->elts[0],
+ if (IS_ACTPUB_WITHOUT_GROUP_ID(&act_frm->elts[0],
action_frame->len)) {
config_af_params->search_channel = true;
}
}
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;
+ af_params->dwell_time = WL_MIN_DWELL_TIME;
#ifdef WL_CFG80211_SYNC_GON
config_af_params->extra_listen = false;
#endif /* WL_CFG80211_SYNC_GON */
static bool
wl_cfg80211_send_action_frame(struct wiphy *wiphy, struct net_device *dev,
- struct net_device *ndev, wl_af_params_t *af_params,
+ bcm_struct_cfgdev *cfgdev, 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);
#endif
dhd_pub_t *dhd = (dhd_pub_t *)(wl->pub);
- 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];
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
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) {
+ action == P2PSD_ACTION_ID_GAS_CREQ) {
/* configure service discovery query frame */
config_af_params.search_channel = true;
af_params->dwell_time = WL_MED_DWELL_TIME;
} else if (action == P2PSD_ACTION_ID_GAS_IRESP ||
- action == P2PSD_ACTION_ID_GAS_IRESP) {
+ action == P2PSD_ACTION_ID_GAS_CRESP) {
/* configure service discovery response frame */
af_params->dwell_time = WL_MIN_DWELL_TIME;
} else {
} 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 scan is ongoing, abort current scan. */
if (wl_get_drv_status_all(wl, SCANNING)) {
- wl_notify_escan_complete(wl, ndev, true, true);
+ wl_notify_escan_complete(wl, wl->escan_info.ndev, true, true);
}
/* set status and destination address before sending af */
if (wl_cfg80211_af_searching_channel(wl, dev) == WL_INVALID) {
WL_ERR(("couldn't find peer's channel.\n"));
+ wl_cfgp2p_print_actframe(true, action_frame->data, action_frame->len,
+ af_params->channel);
goto exit;
}
+ wl_clr_drv_status(wl, SCANNING, wl->afx_hdl->dev);
+ /*
+ * Abort scan even for VSDB scenarios. Scan gets aborted in firmware
+ * but after the check of piggyback algorithm.
+ * To take care of current piggback algo, lets abort the scan here itself.
+ */
+ wl_notify_escan_complete(wl, dev, true, true);
/* 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 */
off_chan_started_jiffies = jiffies;
#endif /* VSDB */
+ wl_cfgp2p_print_actframe(true, action_frame->data, action_frame->len, af_params->channel);
+
/* Now send a tx action frame */
ack = wl_cfgp2p_tx_action_frame(wl, dev, af_params, bssidx) ? false : true;
OFF_CHAN_TIME_THRESHOLD_MS) {
WL_AF_TX_KEEP_PRI_CONNECTION_VSDB(wl);
off_chan_started_jiffies = jiffies;
- }
+ } else
+ msleep(AF_RETRY_DELAY_TIME);
}
#endif /* VSDB */
ack = wl_cfgp2p_tx_action_frame(wl, dev, af_params, bssidx) ?
* 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;
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) {
return ack;
}
+#define MAX_NUM_OF_ASSOCIATED_DEV 64
static s32
-wl_cfg80211_mgmt_tx(struct wiphy *wiphy, struct net_device *ndev,
+wl_cfg80211_mgmt_tx(struct wiphy *wiphy, bcm_struct_cfgdev *cfgdev,
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,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)) || 0
bool no_cck,
#endif
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)) || 0
bool dont_wait_for_ack,
#endif
u64 *cookie)
WL_DBG(("Enter \n"));
- if (ndev == wl->p2p_net) {
- dev = wl_to_prmry_ndev(wl);
- } else {
- /* If TX req is for any valid ifidx. Use as is */
- dev = ndev;
- }
+ dev = cfgdev_to_wlc_ndev(cfgdev, wl);
- /* find bssidx based on ndev */
+ /* find bssidx based on dev */
if (wl_cfgp2p_find_idx(wl, dev, &bssidx) != BCME_OK) {
- WL_ERR(("Find p2p index from ndev(%p) failed\n", dev));
+ WL_ERR(("Find p2p index from dev(%p) failed\n", dev));
return BCME_ERROR;
}
if (p2p_is_on(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);
+ cfg80211_mgmt_tx_status(cfgdev, *cookie, buf, len, true, GFP_KERNEL);
goto exit;
} else if (ieee80211_is_disassoc(mgmt->frame_control) ||
ieee80211_is_deauth(mgmt->frame_control)) {
+ char mac_buf[MAX_NUM_OF_ASSOCIATED_DEV *
+ sizeof(struct ether_addr) + sizeof(uint)] = {0};
+ int num_associated = 0;
+ struct maclist *assoc_maclist = (struct maclist *)mac_buf;
+ if (!bcmp((const uint8 *)BSSID_BROADCAST,
+ (const struct ether_addr *)mgmt->da, ETHER_ADDR_LEN)) {
+ assoc_maclist->count = MAX_NUM_OF_ASSOCIATED_DEV;
+ err = wldev_ioctl(dev, WLC_GET_ASSOCLIST,
+ assoc_maclist, sizeof(mac_buf), false);
+ if (err < 0)
+ WL_ERR(("WLC_GET_ASSOCLIST error %d\n", err));
+ else
+ num_associated = assoc_maclist->count;
+ }
memcpy(scb_val.ea.octet, mgmt->da, ETH_ALEN);
scb_val.val = mgmt->u.disassoc.reason_code;
err = wldev_ioctl(dev, WLC_SCB_DEAUTHENTICATE_FOR_REASON, &scb_val,
sizeof(scb_val_t), true);
if (err < 0)
WL_ERR(("WLC_SCB_DEAUTHENTICATE_FOR_REASON error %d\n", err));
- WL_DBG(("Disconnect STA : %s scb_val.val %d\n",
+ WL_ERR(("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);
+ if (num_associated) {
+ wl_delay(400);
+ }
+ cfg80211_mgmt_tx_status(cfgdev, *cookie, buf, len, true, GFP_KERNEL);
goto exit;
} else if (ieee80211_is_action(mgmt->frame_control)) {
memcpy(action_frame->data, &buf[DOT11_MGMT_HDR_LEN], action_frame->len);
- ack = wl_cfg80211_send_action_frame(wiphy, dev, ndev, af_params,
+ ack = wl_cfg80211_send_action_frame(wiphy, dev, cfgdev, af_params,
action_frame, action_frame->len, bssidx);
-
- cfg80211_mgmt_tx_status(ndev, *cookie, buf, len, ack, GFP_KERNEL);
+ cfg80211_mgmt_tx_status(cfgdev, *cookie, buf, len, ack, GFP_KERNEL);
kfree(af_params);
exit:
static void
-wl_cfg80211_mgmt_frame_register(struct wiphy *wiphy, struct net_device *dev,
+wl_cfg80211_mgmt_frame_register(struct wiphy *wiphy, bcm_struct_cfgdev *cfgdev,
u16 frame_type, bool reg)
{
- WL_DBG(("%s: frame_type: %x, reg: %d\n", __func__, frame_type, reg));
+ WL_DBG(("frame_type: %x, reg: %d\n", frame_type, reg));
if (frame_type != (IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_REQ))
return;
} param = {0, 0};
struct wl_priv *wl = wiphy_priv(wiphy);
- if (wl->p2p_net == dev) {
- dev = wl_to_prmry_ndev(wl);
- }
+ dev = ndev_to_wlc_ndev(dev, wl);
_chan = ieee80211_frequency_to_channel(chan->center_freq);
WL_ERR(("netdev_ifidx(%d), chan_type(%d) target channel(%d) \n",
dev->ifindex, channel_type, _chan));
-#ifdef NOT_YET
- switch (channel_type) {
- case NL80211_CHAN_HT40MINUS:
- /* secondary channel is below the control channel */
- chspec = CH40MHZ_CHSPEC(channel, WL_CHANSPEC_CTL_SB_UPPER);
- break;
- case NL80211_CHAN_HT40PLUS:
- /* secondary channel is above the control channel */
- chspec = CH40MHZ_CHSPEC(channel, WL_CHANSPEC_CTL_SB_LOWER);
- break;
- default:
- chspec = CH20MHZ_CHSPEC(channel);
-
- }
-#endif /* NOT_YET */
if (chan->band == IEEE80211_BAND_5GHZ) {
param.band = WLC_BAND_5G;
case WPA_CIPHER_AES_CCM:
gval = AES_ENABLED;
break;
-#ifdef BCMWAPI_WPI
- case WAPI_CIPHER_SMS4:
- gval = SMS4_ENABLED;
- break;
-#endif
default:
WL_ERR(("No Security Info\n"));
break;
case WPA_CIPHER_AES_CCM:
pval = AES_ENABLED;
break;
-#ifdef BCMWAPI_WPI
- case WAPI_CIPHER_SMS4:
- pval = SMS4_ENABLED;
- break;
-#endif
default:
WL_ERR(("No Security Info\n"));
}
}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)) || 0
static s32 wl_cfg80211_bcn_set_params(
struct cfg80211_ap_settings *info,
struct net_device *dev,
return err;
}
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) */
+#endif
static s32
wl_cfg80211_parse_ies(u8 *ptr, u32 len, struct parsed_ies *ies)
goto exit;
}
+ /* Do abort scan before creating GO */
+ wl_cfg80211_scan_abort(wl);
+
if ((err = wl_cfgp2p_bss(wl, dev, bssidx, 1)) < 0) {
WL_ERR(("GO Bring up error %d\n", err));
goto exit;
return err;
}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)) || 0
s32
-wl_cfg80211_parse_set_ies(
+wl_cfg80211_parse_ap_ies(
struct net_device *dev,
struct cfg80211_beacon_data *info,
- struct parsed_ies *ies,
- u32 dev_role,
- s32 bssidx)
+ struct parsed_ies *ies)
{
- struct wl_priv *wl = wlcfg_drv_priv;
struct parsed_ies prb_ies;
+ struct wl_priv *wl = wlcfg_drv_priv;
+ dhd_pub_t *dhd = (dhd_pub_t *)(wl->pub);
+ u8 *vndr = NULL;
+ u32 vndr_ie_len = 0;
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) {
goto fail;
}
+ if (dhd->op_mode & DHD_FLAG_HOSTAP_MODE) {
+ /* SoftAP mode */
+ struct ieee80211_mgmt *mgmt;
+ mgmt = (struct ieee80211_mgmt *)info->probe_resp;
+ if (mgmt != NULL) {
+ vndr = (u8 *)&mgmt->u.probe_resp.variable;
+ vndr_ie_len = info->probe_resp_len -
+ offsetof(struct ieee80211_mgmt, u.probe_resp.variable);
+ }
+ } else {
+ /* Other mode */
+ vndr = (u8 *)info->proberesp_ies;
+ vndr_ie_len = info->proberesp_ies_len;
+ }
+
+ /* Parse Probe Response IEs */
+ if (wl_cfg80211_parse_ies(vndr, vndr_ie_len, &prb_ies) < 0) {
+ WL_ERR(("PROBE RESP get IEs failed \n"));
+ err = -EINVAL;
+ }
+
+fail:
+
+ return err;
+}
+
+s32
+wl_cfg80211_set_ies(
+ struct net_device *dev,
+ struct cfg80211_beacon_data *info,
+ s32 bssidx)
+{
+ struct wl_priv *wl = wlcfg_drv_priv;
+ dhd_pub_t *dhd = (dhd_pub_t *)(wl->pub);
+ u8 *vndr = NULL;
+ u32 vndr_ie_len = 0;
+ s32 err = BCME_OK;
+
/* Set Beacon IEs to FW */
if ((err = wl_cfgp2p_set_management_ie(wl, dev, bssidx,
VNDR_IE_BEACON_FLAG, (u8 *)info->tail,
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;
+ if (dhd->op_mode & DHD_FLAG_HOSTAP_MODE) {
+ /* SoftAP mode */
+ struct ieee80211_mgmt *mgmt;
+ mgmt = (struct ieee80211_mgmt *)info->probe_resp;
+ if (mgmt != NULL) {
+ vndr = (u8 *)&mgmt->u.probe_resp.variable;
+ vndr_ie_len = info->probe_resp_len -
+ offsetof(struct ieee80211_mgmt, u.probe_resp.variable);
+ }
+ } else {
+ /* Other mode */
+ vndr = (u8 *)info->proberesp_ies;
+ vndr_ie_len = info->proberesp_ies_len;
}
/* 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) {
+ VNDR_IE_PRBRSP_FLAG, vndr, vndr_ie_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) */
+#endif
static s32 wl_cfg80211_hostapd_sec(
struct net_device *dev,
return 0;
}
-/* #if defined(WL_SUPPORT_BACKPORTED_KPATCHES) || (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)) */
+#if defined(WL_SUPPORT_BACKPORTED_KPATCHES) || (LINUX_VERSION_CODE >= KERNEL_VERSION(3, \
+ 2, 0))
+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];
+ int err;
+ char mac_buf[MAX_NUM_OF_ASSOCIATED_DEV *
+ sizeof(struct ether_addr) + sizeof(uint)] = {0};
+ struct maclist *assoc_maclist = (struct maclist *)mac_buf;
+ int num_associated = 0;
+
+ WL_DBG(("Entry\n"));
+ if (mac_addr == NULL) {
+ WL_DBG(("mac_addr is NULL ignore it\n"));
+ return 0;
+ }
+
+ dev = ndev_to_wlc_ndev(ndev, wl);
+
+ 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;
+ }
+ }
+
+ assoc_maclist->count = MAX_NUM_OF_ASSOCIATED_DEV;
+ err = wldev_ioctl(ndev, WLC_GET_ASSOCLIST,
+ assoc_maclist, sizeof(mac_buf), false);
+ if (err < 0)
+ WL_ERR(("WLC_GET_ASSOCLIST error %d\n", err));
+ else
+ num_associated = assoc_maclist->count;
+
+ memcpy(scb_val.ea.octet, mac_addr, ETHER_ADDR_LEN);
+ scb_val.val = DOT11_RC_DEAUTH_LEAVING;
+ err = wldev_ioctl(dev, WLC_SCB_DEAUTHENTICATE_FOR_REASON, &scb_val,
+ sizeof(scb_val_t), true);
+ if (err < 0)
+ WL_ERR(("WLC_SCB_DEAUTHENTICATE_FOR_REASON err %d\n", err));
+ WL_ERR(("Disconnect STA : %s scb_val.val %d\n",
+ bcm_ether_ntoa((const struct ether_addr *)mac_addr, eabuf),
+ scb_val.val));
+ if (num_associated)
+ wl_delay(400);
+ return 0;
+}
+#endif /* WL_SUPPORT_BACKPORTED_KPATCHES || KERNEL_VER >= KERNEL_VERSION(3, 2, 0)) */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)) || 0
static s32
wl_cfg80211_start_ap(
struct wiphy *wiphy,
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) {
+ }
+#if defined(WL_ENABLE_P2P_IF)
+ 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;
}
+#endif /* WL_ENABLE_P2P_IF */
if (wl_cfgp2p_find_idx(wl, dev, &bssidx) != BCME_OK) {
WL_ERR(("Find p2p index from dev(%p) failed\n", dev));
return BCME_ERROR;
WL_DBG(("Start AP req on P2P connection iface\n"));
}
+#if 0 || (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
+ if ((err = wl_cfg80211_set_channel(wiphy, dev,
+ dev->ieee80211_ptr->preset_chandef.chan,
+ NL80211_CHAN_HT20) < 0)) {
+ WL_ERR(("Set channel failed \n"));
+ goto fail;
+ }
+#endif
+
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)) {
+ /* Parse IEs */
+ if ((err = wl_cfg80211_parse_ap_ies(dev, &info->beacon, &ies) < 0)) {
WL_ERR(("Set IEs failed \n"));
goto fail;
}
WL_DBG(("** AP/GO Created **\n"));
+ /* Set IEs to FW */
+ if ((err = wl_cfg80211_set_ies(dev, &info->beacon, bssidx) < 0))
+ WL_ERR(("Set IEs failed \n"));
+
fail:
if (err) {
WL_ERR(("ADD/SET beacon failed\n"));
WL_DBG(("Enter \n"));
if (dev == wl_to_prmry_ndev(wl)) {
dev_role = NL80211_IFTYPE_AP;
- } else if (dev == wl->p2p_net) {
+ }
+#if defined(WL_ENABLE_P2P_IF)
+ else if (dev == wl->p2p_net) {
/* Group Add request on p2p0 */
dev = wl_to_prmry_ndev(wl);
dev_role = NL80211_IFTYPE_P2P_GO;
}
+#endif /* WL_ENABLE_P2P_IF */
if (wl_cfgp2p_find_idx(wl, dev, &bssidx) != BCME_OK) {
WL_ERR(("Find p2p index from dev(%p) failed\n", dev));
return BCME_ERROR;
/* 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));
+ 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;
}
- if ((err = wldev_ioctl(dev, WLC_SET_AP, &ap, sizeof(s32), true)) < 0) {
- WL_ERR(("setting AP mode failed %d \n", err));
+ 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;
}
if (dev == wl_to_prmry_ndev(wl)) {
dev_role = NL80211_IFTYPE_AP;
- } else if (dev == wl->p2p_net) {
+ }
+#if defined(WL_ENABLE_P2P_IF)
+ else if (dev == wl->p2p_net) {
/* Group Add request on p2p0 */
dev = wl_to_prmry_ndev(wl);
dev_role = NL80211_IFTYPE_P2P_GO;
}
+#endif /* WL_ENABLE_P2P_IF */
if (wl_cfgp2p_find_idx(wl, dev, &bssidx) != BCME_OK) {
WL_ERR(("Find p2p index from dev(%p) failed\n", dev));
return BCME_ERROR;
dev_role = NL80211_IFTYPE_P2P_GO;
}
+ /* Parse IEs */
+ if ((err = wl_cfg80211_parse_ap_ies(dev, info, &ies) < 0)) {
+ WL_ERR(("Parse IEs failed \n"));
+ goto fail;
+ }
+
/* Set IEs to FW */
- if ((err = wl_cfg80211_parse_set_ies(dev, info,
- &ies, dev_role, bssidx) < 0)) {
+ if ((err = wl_cfg80211_set_ies(dev, info, bssidx) < 0)) {
WL_ERR(("Set IEs failed \n"));
goto fail;
}
if (dev == wl_to_prmry_ndev(wl)) {
dev_role = NL80211_IFTYPE_AP;
- } else if (dev == wl->p2p_net) {
+ }
+#if defined(WL_ENABLE_P2P_IF)
+ else if (dev == wl->p2p_net) {
/* Group Add request on p2p0 */
dev = wl_to_prmry_ndev(wl);
dev_role = NL80211_IFTYPE_P2P_GO;
}
+#endif /* WL_ENABLE_P2P_IF */
if (wl_cfgp2p_find_idx(wl, dev, &bssidx) != BCME_OK) {
WL_ERR(("Find p2p index from dev(%p) failed\n", dev));
return BCME_ERROR;
return err;
}
-#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0) */
+#endif
#ifdef WL_SCHED_SCAN
#define PNO_TIME 30
.mgmt_tx = wl_cfg80211_mgmt_tx,
.mgmt_frame_register = wl_cfg80211_mgmt_frame_register,
.change_bss = wl_cfg80211_change_bss,
+#if !0 && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0))
.set_channel = wl_cfg80211_set_channel,
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0)
+#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0)) && !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,
-#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0) */
+#endif
#ifdef WL_SCHED_SCAN
.sched_scan_start = wl_cfg80211_sched_scan_start,
.sched_scan_stop = wl_cfg80211_sched_scan_stop,
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) */
-#if 0 || (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0))
- /* .del_station = wl_cfg80211_del_station, */
+#if defined(WL_SUPPORT_BACKPORTED_KPATCHES) || (LINUX_VERSION_CODE >= KERNEL_VERSION(3, \
+ 2, 0))
+ .del_station = wl_cfg80211_del_station,
.mgmt_tx_cancel_wait = wl_cfg80211_mgmt_tx_cancel_wait,
-#endif
+#endif /* WL_SUPPORT_BACKPORTED_KPATCHES || KERNEL_VERSION >= (3,2,0) */
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 2, 0)) || 0
+ .tdls_oper = wl_cfg80211_tdls_oper
+#endif
};
s32 wl_mode_to_nl80211_iftype(s32 mode)
return err;
}
-static s32 wl_setup_wiphy(struct wireless_dev *wdev, struct device *sdiofunc_dev)
+#ifdef CONFIG_CFG80211_INTERNAL_REGDB
+/* Kernel Network Support->Wireless->Regulatory rules database
+ options should be enabled and regulatory CRDA regdb table populated in Kernel
+ for proper country reg notification
+*/
+static int
+wl_cfg80211_reg_notifier(
+ struct wiphy *wiphy,
+ struct regulatory_request *request)
+{
+ struct wl_priv *wl = (struct wl_priv *)wiphy_priv(wiphy);
+ int ret = 0;
+
+ if (!request || !wl) {
+ WL_ERR(("Invalid arg\n"));
+ return -EINVAL;
+ }
+
+ WL_DBG(("ccode: %c%c Initiator: %d\n",
+ request->alpha2[0], request->alpha2[1], request->initiator));
+
+ /* We support only REGDOM_SET_BY_USER as of now */
+ if ((request->initiator != NL80211_REGDOM_SET_BY_USER) &&
+ (request->initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE)) {
+ WL_ERR(("reg_notifier for intiator:%d not supported : set default\n",
+ request->initiator));
+ /* in case of no supported country by regdb
+ lets driver setup platform default Locale
+ */
+ }
+
+ WL_ERR(("Set country code %c%c from %s\n",
+ request->alpha2[0], request->alpha2[1],
+ ((request->initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE) ? " 11d AP" : "User")));
+
+ if ((ret = wldev_set_country(wl_to_prmry_ndev(wl), request->alpha2,
+ false, (request->initiator == NL80211_REGDOM_SET_BY_USER ? true : false))) < 0) {
+ WL_ERR(("set country Failed :%d\n", ret));
+ }
+
+ return ret;
+}
+#endif /* CONFIG_CFG80211_INTERNAL_REGDB */
+
+static s32 wl_setup_wiphy(struct wireless_dev *wdev, struct device *sdiofunc_dev, void *data)
{
s32 err = 0;
+
wdev->wiphy =
wiphy_new(&wl_cfg80211_ops, sizeof(struct wl_priv));
if (unlikely(!wdev->wiphy)) {
#endif /* WL_SCHED_SCAN */
wdev->wiphy->interface_modes =
BIT(NL80211_IFTYPE_STATION)
-#if !(defined(WLP2P) && defined(WL_ENABLE_P2P_IF))
+ | BIT(NL80211_IFTYPE_ADHOC)
+#if !defined(WL_ENABLE_P2P_IF)
| BIT(NL80211_IFTYPE_MONITOR)
-#endif
+#endif /* !WL_ENABLE_P2P_IF */
| BIT(NL80211_IFTYPE_AP);
+
wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = &__wl_band_2ghz;
wdev->wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
#endif /* !WL_POWERSAVE_DISABLED */
wdev->wiphy->flags |= WIPHY_FLAG_NETNS_OK |
WIPHY_FLAG_4ADDR_AP |
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 39)
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 39)) && !0
WIPHY_FLAG_SUPPORTS_SEPARATE_DEFAULT_KEYS |
#endif
WIPHY_FLAG_4ADDR_STATION;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)
/* wdev->wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM; */
#endif
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)) || 0
wdev->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL |
WIPHY_FLAG_OFFCHAN_TX;
#endif
-#if 0 || (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
+#if defined(WL_SUPPORT_BACKPORTED_KPATCHES) || (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_SUPPORT_BACKPORTED_KPATCHES) || (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)) */
+#ifdef CONFIG_CFG80211_INTERNAL_REGDB
+ wdev->wiphy->reg_notifier = wl_cfg80211_reg_notifier;
+#endif /* CONFIG_CFG80211_INTERNAL_REGDB */
+
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 2, 0)) || 0
+ wdev->wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS;
+#endif
WL_DBG(("Registering custom regulatory)\n"));
wdev->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY;
wiphy_apply_custom_regulatory(wdev->wiphy, &brcm_regdom);
bss_list = wl->bss_list;
WL_DBG(("scanned AP count (%d)\n", bss_list->count));
-#if defined(CUSTOMER_HW4) && defined(ROAM_CHANNEL_CACHE)
- reset_roam_cache();
-#endif /* CUSTOMER_HW4 && ROAM_CHANNEL_CACHE */
bi = next_bss(bss_list, bi);
for_each_bss(bss_list, bi, i) {
-#if defined(CUSTOMER_HW4) && defined(ROAM_CHANNEL_CACHE)
- add_roam_cache(bi);
-#endif /* CUSTOMER_HW4 && ROAM_CHANNEL_CACHE */
err = wl_inform_single_bss(wl, bi, 0);
if (unlikely(err))
break;
}
-#if defined(CUSTOMER_HW4) && defined(ROAM_CHANNEL_CACHE)
- /* print_roam_cache(); */
-#endif /* CUSTOMER_HW4 && ROAM_CHANNEL_CACHE */
return err;
}
offsetof(struct wl_cfg80211_bss_info, frame_buf));
notif_bss_info->frame_len = offsetof(struct ieee80211_mgmt,
u.beacon.variable) + wl_get_ielen(wl);
-#if LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 38) && !defined(WL_COMPAT_WIRELESS)
+#if LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 38)
freq = ieee80211_channel_to_frequency(notif_bss_info->channel);
(void)band->band;
#else
signal = notif_bss_info->rssi * 100;
if (!mgmt->u.probe_resp.timestamp) {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
+#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)
u32 reason = ntoh32(e->reason);
u32 len = ntoh32(e->datalen);
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0)) && !defined(WL_CFG80211_STA_EVENT)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0)) && !defined(WL_CFG80211_STA_EVENT) \
+ && !0
bool isfree = false;
u8 *mgmt_frame;
u8 bsscfgidx = e->bsscfgidx;
channel_info_t ci;
#else
struct station_info sinfo;
-#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0)) && !WL_CFG80211_STA_EVENT */
+#endif
WL_DBG(("event %d status %d reason %d\n", event, ntoh32(e->status), reason));
/* if link down, bsscfg is disabled. */
if (event == WLC_E_LINK && reason == WLC_E_LINK_BSSCFG_DIS &&
wl_get_p2p_status(wl, IF_DELETING) && (ndev != wl_to_prmry_ndev(wl))) {
+ wl_add_remove_eventmsg(ndev, WLC_E_PROBREQ_MSG, false);
WL_INFO(("AP mode link down !! \n"));
complete(&wl->iface_disable);
return 0;
}
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0)) && !defined(WL_CFG80211_STA_EVENT)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0)) && !defined(WL_CFG80211_STA_EVENT) \
+ && !0
WL_DBG(("Enter \n"));
if (!len && (event == WLC_E_DEAUTH)) {
len = 2; /* reason code field */
kfree(body);
return -EINVAL;
}
-#if LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 38) && !defined(WL_COMPAT_WIRELESS)
+#if LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 38)
freq = ieee80211_channel_to_frequency(channel);
(void)band->band;
#else
isfree = true;
if (event == WLC_E_ASSOC_IND && reason == DOT11_SC_SUCCESS) {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)) || 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) */
+#endif
} else if (event == WLC_E_DISASSOC_IND) {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)) || 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) */
+#endif
} else if ((event == WLC_E_DEAUTH_IND) || (event == WLC_E_DEAUTH)) {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)) || 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) */
+#endif
}
exit:
if (body)
kfree(body);
return err;
-#else /* LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0) && !WL_CFG80211_STA_EVENT */
+#else /* LINUX_VERSION < VERSION(3,2,0) && !WL_CFG80211_STA_EVENT && !WL_COMPAT_WIRELESS */
sinfo.filled = 0;
if (((event == WLC_E_ASSOC_IND) || (event == WLC_E_REASSOC_IND)) &&
reason == DOT11_SC_SUCCESS) {
} 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) && !WL_CFG80211_STA_EVENT */
+#endif
return err;
}
}
static s32
-wl_notify_connect_status(struct wl_priv *wl, struct net_device *ndev,
+wl_notify_connect_status(struct wl_priv *wl, bcm_struct_cfgdev *cfgdev,
const wl_event_msg_t *e, void *data)
{
bool act;
+ struct net_device *ndev = NULL;
s32 err = 0;
u32 event = ntoh32(e->event_type);
+ ndev = cfgdev_to_wlc_ndev(cfgdev, wl);
+
if (wl_get_mode_by_netdev(wl, ndev) == WL_MODE_AP) {
wl_notify_connect_status_ap(wl, ndev, e, data);
- } else {
+ } else if (wl_get_mode_by_netdev(wl, ndev) == WL_MODE_BSS) {
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) {
if (wl_is_linkup(wl, e, ndev)) {
wl_link_up(wl);
act = true;
- if (wl_is_ibssmode(wl, ndev)) {
- printk("cfg80211_ibss_joined\n");
- cfg80211_ibss_joined(ndev, (s8 *)&e->addr,
- GFP_KERNEL);
- WL_DBG(("joined in IBSS network\n"));
- } else {
- if (!wl_get_drv_status(wl, DISCONNECTING, ndev)) {
+ if (!wl_get_drv_status(wl, DISCONNECTING, ndev)) {
printk("wl_bss_connect_done succeeded with " MACDBG "\n",
MAC2STRDBG((u8*)(&e->addr)));
wl_bss_connect_done(wl, ndev, e, data, true);
WL_DBG(("joined in BSS network \"%s\"\n",
((struct wlc_ssid *)
wl_read_prof(wl, ndev, WL_PROF_SSID))->SSID));
- }
}
wl_update_prof(wl, ndev, e, &act, WL_PROF_ACT);
wl_update_prof(wl, ndev, NULL, (void *)&e->addr, WL_PROF_BSSID);
} else {
printk("%s nothing\n", __FUNCTION__);
}
+ } else if (wl_get_mode_by_netdev(wl, ndev) == WL_MODE_IBSS) {
+ u16 flags = ntoh16(e->flags);
+ u32 status = ntoh32(e->status);
+ struct wl_profile *profile = wl_get_profile_by_netdev(wl, ndev);
+
+ if (event == WLC_E_JOIN) {
+ WL_DBG(("joined in IBSS network\n"));
+ }
+ if (event == WLC_E_START) {
+ WL_DBG(("started IBSS network\n"));
+ }
+ if (event == WLC_E_JOIN || event == WLC_E_START) {
+ wl_link_up(wl);
+ wl_get_assoc_ies(wl, ndev);
+ wl_update_prof(wl, ndev, NULL, (void *)&e->addr, WL_PROF_BSSID);
+ wl_update_bss_info(wl, ndev, 1);
+ cfg80211_ibss_joined(ndev, (s8 *)&e->addr, GFP_KERNEL);
+ wl_set_drv_status(wl, CONNECTED, ndev);
+ profile->active = true;
+ } else if ((event == WLC_E_LINK && !(flags & WLC_EVENT_MSG_LINK)) ||
+ event == WLC_E_DEAUTH_IND || event == WLC_E_DISASSOC_IND) {
+ wl_clr_drv_status(wl, CONNECTED, ndev);
+ wl_link_down(wl);
+ wl_init_prof(wl, ndev);
+ }
+ else if (event == WLC_E_SET_SSID && status == WLC_E_STATUS_NO_NETWORKS) {
+ WL_DBG(("no action - join fail (IBSS mode)\n"));
+ }
+ else {
+ WL_DBG(("no action (IBSS mode)\n"));
+ }
}
return err;
}
static s32
-wl_notify_roaming_status(struct wl_priv *wl, struct net_device *ndev,
+wl_notify_roaming_status(struct wl_priv *wl, bcm_struct_cfgdev *cfgdev,
const wl_event_msg_t *e, void *data)
{
bool act;
+ struct net_device *ndev = NULL;
s32 err = 0;
u32 event = be32_to_cpu(e->event_type);
u32 status = be32_to_cpu(e->status);
+
WL_DBG(("Enter \n"));
+
+ ndev = cfgdev_to_wlc_ndev(cfgdev, wl);
+
if (event == WLC_E_ROAM && status == WLC_E_STATUS_SUCCESS) {
if (wl_get_drv_status(wl, CONNECTED, ndev))
wl_bss_roaming_done(wl, ndev, e, data);
if (conn_info->req_ie_len <= MAX_REQ_LINE)
memcpy(conn_info->req_ie, wl->extra_buf, conn_info->req_ie_len);
else {
- WL_ERR(("%s IE size %d above max %d size \n",
- __FUNCTION__, conn_info->req_ie_len, MAX_REQ_LINE));
+ WL_ERR(("IE size %d above max %d size \n",
+ conn_info->req_ie_len, MAX_REQ_LINE));
return err;
}
} else {
if (conn_info->resp_ie_len <= MAX_REQ_LINE)
memcpy(conn_info->resp_ie, wl->extra_buf, conn_info->resp_ie_len);
else {
- WL_ERR(("%s IE size %d above max %d size \n",
- __FUNCTION__, conn_info->resp_ie_len, MAX_REQ_LINE));
+ WL_ERR(("IE size %d above max %d size \n",
+ conn_info->resp_ie_len, MAX_REQ_LINE));
return err;
}
} else {
static void wl_ch_to_chanspec(int ch, struct wl_join_params *join_params,
size_t *join_params_size)
{
-#ifndef ROAM_CHANNEL_CACHE
chanspec_t chanspec = 0;
-#endif
if (ch != 0) {
-#if defined(CUSTOMER_HW4) && defined(ROAM_CHANNEL_CACHE)
- int n_channels;
-
- n_channels = get_roam_channel_list(ch, join_params->params.chanspec_list,
- &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);
-#else
join_params->params.chanspec_num = 1;
join_params->params.chanspec_list[0] = ch;
join_params->params.chanspec_num =
htod32(join_params->params.chanspec_num);
-
-#endif /* CUSTOMER_HW4 && 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));
wiphy = wl_to_wiphy(wl);
- if (wl_is_ibssmode(wl, ndev))
- return err;
-
ssid = (struct wlc_ssid *)wl_read_prof(wl, ndev, WL_PROF_SSID);
curbssid = wl_read_prof(wl, ndev, WL_PROF_BSSID);
bss = cfg80211_get_bss(wiphy, NULL, curbssid,
struct wl_connect_info *conn_info = wl_to_conn(wl);
s32 err = 0;
u8 *curbssid;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)) || 0
struct wl_bss_info *bss_info;
struct wiphy *wiphy = wl_to_wiphy(wl);
struct ieee80211_supported_band *band;
u8 *buf;
u16 channel;
u32 freq;
-#endif /* LINUX_VERSION > 2.6.39 */
+#endif
wl_get_assoc_ies(wl, ndev);
wl_update_prof(wl, ndev, NULL, (void *)(e->addr.octet), WL_PROF_BSSID);
wl_update_bss_info(wl, ndev, 1);
wl_update_pmklist(ndev, wl->pmk_list, err);
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)) || 0
/* channel info for cfg80211_roamed introduced in 2.6.39-rc1 */
buf = kzalloc(WL_EXTRA_BUF_MAX, GFP_KERNEL);
if (!buf)
notify_channel = ieee80211_get_channel(wiphy, freq);
done:
kfree(buf);
-#endif /* LINUX_VERSION > 2.6.39 */
+#endif
printk("wl_bss_roaming_done succeeded to " MACDBG "\n",
MAC2STRDBG((u8*)(&e->addr)));
cfg80211_roamed(ndev,
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)) || 0
notify_channel,
#endif
curbssid,
{
struct wl_connect_info *conn_info = wl_to_conn(wl);
struct wl_security *sec = wl_read_prof(wl, ndev, WL_PROF_SEC);
-#if defined(ROAM_ENABLE) && defined(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);
if (!sec) {
memcpy(curbssid, connect_req_bssid, ETHER_ADDR_LEN);
}
-#if defined(BCM4334_CHIP)
- if (wl->scan_request) {
- wl_notify_escan_complete(wl, ndev, true, true);
- }
-#endif
#else
if (wl->scan_request) {
wl_notify_escan_complete(wl, ndev, true, true);
wl_update_bss_info(wl, ndev, 0);
wl_update_pmklist(ndev, wl->pmk_list, err);
wl_set_drv_status(wl, CONNECTED, ndev);
-#if defined(ROAM_ENABLE) && defined(ROAM_AP_ENV_DETECTION)
- if (dhd->roam_env_detection)
- wldev_iovar_setint(ndev, "roam_env_detection",
- AP_ENV_INDETERMINATE);
-#endif /* ROAM_AP_ENV_DETECTION */
+ if (ndev != wl_to_prmry_ndev(wl)) {
+ /* reinitialize completion to clear previous count */
+ INIT_COMPLETION(wl->iface_disable);
+ }
}
cfg80211_connect_result(ndev,
curbssid,
}
static s32
-wl_notify_mic_status(struct wl_priv *wl, struct net_device *ndev,
+wl_notify_mic_status(struct wl_priv *wl, bcm_struct_cfgdev *cfgdev,
const wl_event_msg_t *e, void *data)
{
+ struct net_device *ndev = NULL;
u16 flags = ntoh16(e->flags);
enum nl80211_key_type key_type;
+ ndev = cfgdev_to_wlc_ndev(cfgdev, wl);
+
mutex_lock(&wl->usr_sync);
if (flags & WLC_EVENT_MSG_GROUP)
key_type = NL80211_KEYTYPE_GROUP;
#ifdef PNO_SUPPORT
static s32
-wl_notify_pfn_status(struct wl_priv *wl, struct net_device *ndev,
+wl_notify_pfn_status(struct wl_priv *wl, bcm_struct_cfgdev *cfgdev,
const wl_event_msg_t *e, void *data)
{
+ struct net_device *ndev = NULL;
+
WL_ERR((">>> PNO Event\n"));
+ ndev = cfgdev_to_wlc_ndev(cfgdev, wl);
+
#ifndef WL_SCHED_SCAN
-#ifndef CUSTOMER_HW4
mutex_lock(&wl->usr_sync);
/* TODO: Use cfg80211_sched_scan_results(wiphy); */
cfg80211_disconnected(ndev, 0, NULL, 0, GFP_KERNEL);
mutex_unlock(&wl->usr_sync);
-#endif /* !CUSTOMER_HW4 */
#else
/* If cfg80211 scheduled scan is supported, report the pno results via sched
* scan results
#endif /* PNO_SUPPORT */
static s32
-wl_notify_scan_status(struct wl_priv *wl, struct net_device *ndev,
+wl_notify_scan_status(struct wl_priv *wl, bcm_struct_cfgdev *cfgdev,
const wl_event_msg_t *e, void *data)
{
struct channel_info channel_inform;
struct wl_scan_results *bss_list;
+ struct net_device *ndev = NULL;
u32 len = WL_SCAN_BUF_MAX;
s32 err = 0;
unsigned long flags;
if (wl->iscan_on && wl->iscan_kickstart)
return wl_wakeup_iscan(wl_to_iscan(wl));
+ ndev = cfgdev_to_wlc_ndev(cfgdev, wl);
+
mutex_lock(&wl->usr_sync);
wl_clr_drv_status(wl, SCANNING, ndev);
err = wldev_ioctl(ndev, WLC_GET_CHANNEL, &channel_inform,
memset(bss_list, 0, len);
bss_list->buflen = htod32(len);
err = wldev_ioctl(ndev, WLC_SCAN_RESULTS, bss_list, len, false);
- if (unlikely(err)) {
+ if (unlikely(err) && unlikely(!wl->scan_suppressed)) {
WL_ERR(("%s Scan_results error (%d)\n", ndev->name, err));
err = -EINVAL;
goto scan_done_out;
mutex_unlock(&wl->usr_sync);
return err;
}
+
static s32
wl_frame_get_mgmt(u16 fc, const struct ether_addr *da,
const struct ether_addr *sa, const struct ether_addr *bssid,
return err;
}
-#ifdef WL_CFG80211_GON_COLLISION
-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 (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)) {
- return;
- }
- }
-
- 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)
+wl_stop_wait_next_action_frame(struct wl_priv *wl)
{
- 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))) {
+ if (wl_get_drv_status_all(wl, SENDING_ACT_FRM)) {
+ if (!(wl_get_p2p_status(wl, ACTION_TX_COMPLETED) ||
+ wl_get_p2p_status(wl, ACTION_TX_NOACK)))
+ wl_set_p2p_status(wl, ACTION_TX_COMPLETED);
+
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);
+ wl_cfg80211_scan_abort(wl);
}
#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);
+ wl_cfg80211_scan_abort(wl);
}
#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,
+wl_notify_rx_mgmt_frame(struct wl_priv *wl, bcm_struct_cfgdev *cfgdev,
const wl_event_msg_t *e, void *data)
+
{
struct ieee80211_supported_band *band;
struct wiphy *wiphy = wl_to_wiphy(wl);
bool isfree = false;
s32 err = 0;
s32 freq;
- struct net_device *dev = NULL;
+ struct net_device *ndev = NULL;
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;
memset(&bssid, 0, ETHER_ADDR_LEN);
- if (wl->p2p_net == ndev) {
- dev = wl_to_prmry_ndev(wl);
- } else {
- dev = ndev;
- }
+ ndev = cfgdev_to_wlc_ndev(cfgdev, wl);
if (channel <= CH_MAX_2G_CHANNEL)
band = wiphy->bands[IEEE80211_BAND_2GHZ];
WL_ERR(("No valid band"));
return -EINVAL;
}
-#if LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 38) && !defined(WL_COMPAT_WIRELESS)
+#if LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 38)
freq = ieee80211_channel_to_frequency(channel);
(void)band->band;
#else
freq = ieee80211_channel_to_frequency(channel, band->band);
#endif
if (event == WLC_E_ACTION_FRAME_RX) {
- wldev_iovar_getbuf_bsscfg(dev, "cur_etheraddr",
+ wldev_iovar_getbuf_bsscfg(ndev, "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);
+ err = wldev_ioctl(ndev, WLC_GET_BSSID, &bssid, ETHER_ADDR_LEN, false);
if (err < 0)
WL_ERR(("WLC_GET_BSSID error %d\n", err));
memcpy(da.octet, wl->ioctl_buf, ETHER_ADDR_LEN);
&mgmt_frame, &mgmt_frame_len,
(u8 *)((wl_event_rx_frame_data_t *)rxframe + 1));
if (err < 0) {
- WL_ERR(("%s: Error in receiving action frame len %d channel %d freq %d\n",
- __func__, mgmt_frame_len, channel, freq));
+ WL_ERR(("Error in receiving action frame len %d channel %d freq %d\n",
+ mgmt_frame_len, channel, freq));
goto exit;
}
isfree = true;
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);
+ wl_clr_drv_status(wl, WAITING_NEXT_ACT_FRM, ndev);
/* Stop waiting for next AF. */
- wl_stop_wait_next_action_frame(wl, ndev);
+ wl_stop_wait_next_action_frame(wl);
}
}
(void) sd_act_frm;
* 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 defined(WL_ENABLE_P2P_IF)
+ if (wl->p2p_net == cfgdev)
+ cfgdev = wl_to_prmry_ndev(wl);
+#endif /* WL_ENABLE_P2P_IF */
}
if (act_frm) {
-#ifdef WL_CFG80211_GON_COLLISION
- if (act_frm->subtype == P2P_PAF_GON_REQ) {
- 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));
- wl->block_gon_req_rx_count--;
- 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 (wl_get_drv_status_all(wl, WAITING_NEXT_ACT_FRM)) {
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);
+ wl_clr_drv_status(wl, WAITING_NEXT_ACT_FRM, ndev);
/* Stop waiting for next AF. */
- wl_stop_wait_next_action_frame(wl, ndev);
+ if (act_frm->subtype != P2P_PAF_GON_CONF)
+ wl_stop_wait_next_action_frame(wl);
}
}
}
wl_cfgp2p_print_actframe(false, &mgmt_frame[DOT11_MGMT_HDR_LEN],
- mgmt_frame_len - DOT11_MGMT_HDR_LEN);
+ mgmt_frame_len - DOT11_MGMT_HDR_LEN, channel);
/*
* 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))) {
- wldev_iovar_setint(dev, "mpc", 1);
+ wldev_iovar_setint(ndev, "mpc", 1);
}
if (act_frm && (act_frm->subtype == P2P_PAF_GON_CONF)) {
WL_DBG(("P2P: GO_NEG_PHASE status cleared \n"));
WL_DBG((" Event %s\n", (event == WLC_E_P2P_PROBREQ_MSG) ?
"WLC_E_P2P_PROBREQ_MSG":"WLC_E_PROBREQ_MSG"));
-#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, FINDING_COMMON_CHANNEL)) {
- s32 channel = CHSPEC_CHANNEL(hton16(rxframe->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 */
/* Filter any P2P probe reqs arriving during the
* GO-NEG Phase
}
}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)
- cfg80211_rx_mgmt(ndev, freq, 0, mgmt_frame, mgmt_frame_len, GFP_ATOMIC);
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)) || 0
+ cfg80211_rx_mgmt(cfgdev, 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) */
+ cfg80211_rx_mgmt(cfgdev, freq, mgmt_frame, mgmt_frame_len, GFP_ATOMIC);
+#endif
- WL_DBG(("%s: mgmt_frame_len (%d) , e->datalen (%d), channel (%d), freq (%d)\n", __func__,
+ WL_DBG(("mgmt_frame_len (%d) , e->datalen (%d), channel (%d), freq (%d)\n",
mgmt_frame_len, ntoh32(e->datalen), channel, freq));
exit:
if (isfree)
/* If target scan is not reliable, set the below define to "1" to do a
* full escan
*/
-#define FULL_ESCAN_ON_PFN_NET_FOUND 0
+#define FULL_ESCAN_ON_PFN_NET_FOUND 1
static s32
wl_notify_sched_scan_results(struct wl_priv *wl, struct net_device *ndev,
const wl_event_msg_t *e, void *data)
wl->evt_handler[WLC_E_P2P_DISC_LISTEN_COMPLETE] = wl_cfgp2p_listen_complete;
wl->evt_handler[WLC_E_ACTION_FRAME_COMPLETE] = wl_cfgp2p_action_tx_complete;
wl->evt_handler[WLC_E_ACTION_FRAME_OFF_CHAN_COMPLETE] = wl_cfgp2p_action_tx_complete;
+ wl->evt_handler[WLC_E_JOIN] = wl_notify_connect_status;
+ wl->evt_handler[WLC_E_START] = wl_notify_connect_status;
#ifdef PNO_SUPPORT
wl->evt_handler[WLC_E_PFN_NET_FOUND] = wl_notify_pfn_status;
#endif /* PNO_SUPPORT */
+#ifdef WLTDLS
+ wl->evt_handler[WLC_E_TDLS_PEER_EVENT] = wl_tdls_event_handler;
+#endif /* WLTDLS */
}
+#if defined(STATIC_WL_PRIV_STRUCT)
+static void
+wl_init_escan_result_buf(struct wl_priv *wl)
+{
+ wl->escan_info.escan_buf = dhd_os_prealloc(NULL, DHD_PREALLOC_WIPHY_ESCAN0, 0);
+ bzero(wl->escan_info.escan_buf, ESCAN_BUF_SIZE);
+}
+
+static void
+wl_deinit_escan_result_buf(struct wl_priv *wl)
+{
+ wl->escan_info.escan_buf = NULL;
+
+}
+#endif /* STATIC_WL_PRIV_STRUCT */
+
static s32 wl_init_priv_mem(struct wl_priv *wl)
{
WL_DBG(("Enter \n"));
WL_ERR(("wl->ie alloc failed\n"));
goto init_priv_mem_out;
}
-#if defined(CUSTOMER_HW4) && 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 = dhd_os_prealloc(NULL, DHD_PREALLOC_WIPHY_ESCAN0, 0);
- bzero(wl->escan_info.escan_buf, ESCAN_BUF_SIZE);
-#endif /* CUSTOMER_HW4 && DUAL_ESCAN_RESULT_BUFFER */
+ wl_init_escan_result_buf(wl);
#endif /* STATIC_WL_PRIV_STRUCT */
wl->afx_hdl = (void *)kzalloc(sizeof(*wl->afx_hdl), GFP_KERNEL);
if (unlikely(!wl->afx_hdl)) {
wl->conn_info = NULL;
kfree(wl->ie);
wl->ie = NULL;
-#if defined(CUSTOMER_HW4) && 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 /* CUSTOMER_HW4 && DUAL_ESCAN_RESULT_BUFFER */
+ wl_deinit_escan_result_buf(wl);
#endif /* STATIC_WL_PRIV_STRUCT */
if (wl->afx_hdl) {
cancel_work_sync(&wl->afx_hdl->work);
/* 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
+ PROC_START(wl_event_handler, wl, &wl->event_tsk, 0, "wl_event_handler");
if (wl->event_tsk.thr_pid < 0)
ret = -ENOMEM;
return ret;
del_timer_sync(&iscan->timer);
iscan->timer_on = 0;
}
- WL_DBG(("%s was terminated\n", __func__));
+ WL_DBG(("was terminated\n"));
return 0;
}
static void wl_scan_timeout(unsigned long data)
{
+ wl_event_msg_t msg;
struct wl_priv *wl = (struct wl_priv *)data;
- if (wl->scan_request) {
- WL_ERR(("timer expired\n"));
- 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);
+ if (!(wl->scan_request)) {
+ WL_ERR(("timer expired but no scan request\n"));
+ return;
+ }
+ bzero(&msg, sizeof(wl_event_msg_t));
+ WL_ERR(("timer expired\n"));
+ if (wl->escan_on) {
+ msg.event_type = hton32(WLC_E_ESCAN_RESULT);
+ msg.status = hton32(WLC_E_STATUS_TIMEOUT);
+ msg.reason = 0xFFFFFFFF;
+ wl_cfg80211_event(wl_to_prmry_ndev(wl), &msg, NULL);
+ } else {
+ /* Need to check it try to access SDIO */
+ WL_ERR(("SCAN Timeout(ISCAN)\n"));
+ wl_notify_iscan_complete(wl_to_iscan(wl), true);
}
}
+
static void wl_iscan_timer(unsigned long data)
{
struct wl_iscan_ctrl *iscan = (struct wl_iscan_ctrl *)data;
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));
+ WL_ERR(("[NETDEV_DOWN] work_pending (%d th)\n", refcnt));
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(100);
set_current_state(TASK_RUNNING);
.notifier_call = wl_cfg80211_netdev_notifier_call,
};
+static void wl_cfg80211_scan_abort(struct wl_priv *wl)
+{
+ wl_scan_params_t *params = NULL;
+ s32 params_size = 0;
+ s32 err = BCME_OK;
+ struct net_device *dev = wl_to_prmry_ndev(wl);
+ if (!in_atomic()) {
+ /* Our scan params only need space for 1 channel and 0 ssids */
+ params = wl_cfg80211_scan_alloc_params(-1, 0, ¶ms_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(dev, WLC_SCAN, params, params_size, true);
+ if (err < 0) {
+ WL_ERR(("scan abort failed \n"));
+ }
+ kfree(params);
+ }
+ }
+}
static s32 wl_notify_escan_complete(struct wl_priv *wl,
struct net_device *ndev,
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 (!ndev) {
+ WL_ERR(("ndev is null\n"));
+ return err;
+ }
if (wl->escan_info.ndev != ndev) {
WL_ERR(("ndev is different %p %p\n", wl->escan_info.ndev, ndev));
}
if (wl->scan_request) {
- if (wl->scan_request->dev == wl->p2p_net)
- dev = wl_to_prmry_ndev(wl);
- else
+ dev = wl_to_prmry_ndev(wl);
+#if defined(WL_ENABLE_P2P_IF)
+ if (wl->scan_request->dev != wl->p2p_net)
dev = wl->scan_request->dev;
+#endif /* WL_ENABLE_P2P_IF */
}
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));
+ "doing scan_abort for ndev %p primary %p",
+ ndev, wl_to_prmry_ndev(wl)));
dev = ndev;
}
if (fw_abort && !in_atomic()) {
- /* Our scan params only need space for 1 channel and 0 ssids */
- params = wl_cfg80211_scan_alloc_params(-1, 0, ¶ms_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(dev, WLC_SCAN, params, params_size, true);
- if (err < 0) {
- WL_ERR(("scan abort failed \n"));
- }
- }
+ wl_cfg80211_scan_abort(wl);
}
+
if (timer_pending(&wl->scan_timeout))
del_timer_sync(&wl->scan_timeout);
#if defined(ESCAN_RESULT_PATCH)
if (likely(wl->scan_request)) {
-#if defined(CUSTOMER_HW4) && defined(DUAL_ESCAN_RESULT_BUFFER)
- u8 temp_id = wl->escan_info.cur_sync_id;
- if (aborted)
- wl->bss_list =
- (wl_scan_results_t *)wl->escan_info.escan_buf[(temp_id+1)%2];
- 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 /* CUSTOMER_HW4 && DUAL_ESCAN_RESULT_BUFFER */
+ wl->bss_list = wl_escan_get_buf(wl, aborted);
wl_inform_bss(wl);
}
#endif /* ESCAN_RESULT_PATCH */
#ifdef WL_SCHED_SCAN
if (wl->sched_scan_req && !wl->scan_request) {
WL_PNO((">>> REPORTING SCHED SCAN RESULTS \n"));
- if (aborted)
- cfg80211_sched_scan_stopped(wl->sched_scan_req->wiphy);
- else
+ if (!aborted)
cfg80211_sched_scan_results(wl->sched_scan_req->wiphy);
wl->sched_scan_running = FALSE;
wl->sched_scan_req = NULL;
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,
- struct net_device *ndev,
+static s32 wl_escan_handler(struct wl_priv *wl, bcm_struct_cfgdev *cfgdev,
const wl_event_msg_t *e, void *data)
{
s32 err = BCME_OK;
wl_bss_info_t *bss = NULL;
wl_scan_results_t *list;
wifi_p2p_ie_t * p2p_ie;
+ struct net_device *ndev = NULL;
u32 bi_length;
u32 i;
u8 *p2p_dev_addr = NULL;
WL_DBG((" enter event type : %d, status : %d \n",
ntoh32(e->event_type), ntoh32(e->status)));
+ ndev = cfgdev_to_wlc_ndev(cfgdev, wl);
+
mutex_lock(&wl->usr_sync);
/* P2P SCAN is coming from primary interface */
if (wl_get_p2p_status(wl, SCANNING)) {
if (!ndev || !wl->escan_on ||
(!wl_get_drv_status(wl, SCANNING, ndev) &&
!wl->sched_scan_running)) {
-#if defined(CUSTOMER_HW4) && 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)));
-#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 /* CUSTOMER_HW4 && DUAL_ESCAN_RESULT_BUFFER */
goto exit;
}
-#if defined(CUSTOMER_HW4) && 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;
WL_ERR(("Invalid bss_info length %d: ignoring\n", bi_length));
goto exit;
}
-#if defined(CUSTOMER_HW4) && 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));
+ if (wl_escan_check_sync_id(status, escan_result->sync_id,
+ wl->escan_info.cur_sync_id) < 0)
goto exit;
- }
-#endif /* CUSTOMER_HW4 && DUAL_ESCAN_RESULT_BUFFER */
if (!(wl_to_wiphy(wl)->interface_modes & BIT(NL80211_IFTYPE_ADHOC))) {
if (dtoh16(bi->capability) & DOT11_CAP_IBSS) {
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(
+ s32 channel = wf_chspec_ctlchan(
wl_chspec_driver_to_host(bi->chanspec));
- WL_DBG(("ACTION FRAME SCAN : Peer " MACDBG " found, channel : %d\n",
- MAC2STRDBG(wl->afx_hdl->tx_dst_addr.octet), channel));
+
+ if ((channel > MAXCHANNEL) || (channel <= 0))
+ channel = WL_INVALID;
+ else
+ WL_ERR(("ACTION FRAME SCAN : Peer " MACDBG " found,"
+ " channel : %d\n",
+ MAC2STRDBG(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);
}
} else {
- int cur_len = 0;
-#if defined(CUSTOMER_HW4) && 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 /* CUSTOMER_HW4 && DUAL_ESCAN_RESULT_BUFFER */
-#if defined(WLP2P) && defined(WL_ENABLE_P2P_IF)
- if (wl->p2p_net && wl->scan_request &&
- wl->scan_request->dev == wl->p2p_net) {
-#else
- if (p2p_is_on(wl) && p2p_scan(wl)) {
-#endif
-#ifdef WL_HOST_BAND_MGMT
- s32 channel = 0;
- s32 channel_band = 0;
-#endif /* WL_HOST_BAND_MGMT */
+ int cur_len = WL_SCAN_RESULTS_FIXED_SIZE;
+ list = wl_escan_get_buf(wl, FALSE);
+ if (scan_req_match(wl)) {
/* p2p scan && allow only probe response */
- if (bi->flags & WL_BSS_FLAGS_FROM_BEACON)
+ if ((wl->p2p->search_state != WL_P2P_DISC_ST_SCAN) &&
+ (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) {
" response/beacon\n"));
goto exit;
}
-#ifdef WL_HOST_BAND_MGMT
- channel = CHSPEC_CHANNEL(wl_chspec_driver_to_host(bi->chanspec));
- channel_band = (channel > CH_MAX_2G_CHANNEL) ?
- WLC_BAND_5G : WLC_BAND_2G;
-
-
- if ((wl->curr_band == WLC_BAND_5G) &&
- (channel_band == WLC_BAND_2G)) {
- /* Avoid sending the GO results in band conflict */
- if (wl_cfgp2p_retreive_p2pattrib(p2p_ie,
- P2P_SEID_GROUP_ID) != NULL)
- goto exit;
- }
-#endif /* WL_HOST_BAND_MGMT */
}
for (i = 0; i < list->count; i++) {
bss = bss ? (wl_bss_info_t *)((uintptr)bss + dtoh32(bss->length))
WL_ERR(("Buffer is too small: ignoring\n"));
goto exit;
}
-#if defined(CUSTOMER_HW4) && 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 /* CUSTOMER_HW4 && DUAL_ESCAN_RESULT_BUFFER */
+
+ memcpy(&(((char *)list)[list->buflen]), bi, bi_length);
list->version = dtoh32(bi->version);
list->buflen += bi_length;
list->count++;
}
else if (status == WLC_E_STATUS_SUCCESS) {
+#ifdef P2P_DISCOVERY_WAR
+ if (wl->p2p_net && wl->scan_request &&
+ wl->scan_request->dev == wl->p2p_net &&
+ !wl->p2p->vif_created) {
+ if (wldev_iovar_setint(wl_to_prmry_ndev(wl), "mpc", 1) < 0) {
+ WL_ERR(("mpc enabling back failed\n"));
+ }
+ }
+#endif
wl->escan_info.escan_state = WL_ESCAN_STATE_IDLE;
-#if defined(CUSTOMER_HW4) && 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 /* CUSTOMER_HW4 && DUAL_ESCAN_RESULT_BUFFER */
+ wl_escan_print_sync_id(status, wl->escan_info.cur_sync_id,
+ escan_result->sync_id);
+
if (wl_get_drv_status_all(wl, FINDING_COMMON_CHANNEL)) {
WL_INFO(("ACTION FRAME SCAN DONE\n"));
wl_clr_p2p_status(wl, SCANNING);
complete(&wl->act_frm_scan);
} else if ((likely(wl->scan_request)) || (wl->sched_scan_running)) {
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 /* CUSTOMER_HW4 && DUAL_ESCAN_RESULT_BUFFER */
+ wl->bss_list = wl_escan_get_buf(wl, FALSE);
+ if (!scan_req_match(wl)) {
+ WL_TRACE_HW4(("SCAN COMPLETED: scanned AP count=%d\n",
+ wl->bss_list->count));
+ }
wl_inform_bss(wl);
wl_notify_escan_complete(wl, ndev, false, false);
}
-#if defined(CUSTOMER_HW4) && defined(DUAL_ESCAN_RESULT_BUFFER)
- wl->escan_info.cur_sync_id++;
-#endif
+ wl_escan_increment_sync_id(wl, SCAN_BUF_NEXT);
}
else if (status == WLC_E_STATUS_ABORT) {
+#ifdef P2P_DISCOVERY_WAR
+ if (wl->p2p_net && wl->scan_request &&
+ wl->scan_request->dev == wl->p2p_net &&
+ !wl->p2p->vif_created) {
+ if (wldev_iovar_setint(wl_to_prmry_ndev(wl), "mpc", 1) < 0) {
+ WL_ERR(("mpc enabling back failed\n"));
+ }
+ }
+#endif
wl->escan_info.escan_state = WL_ESCAN_STATE_IDLE;
-#if defined(CUSTOMER_HW4) && 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 /* CUSTOMER_HW4 && DUAL_ESCAN_RESULT_BUFFER */
+ wl_escan_print_sync_id(status, escan_result->sync_id,
+ wl->escan_info.cur_sync_id);
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);
complete(&wl->act_frm_scan);
} else if ((likely(wl->scan_request)) || (wl->sched_scan_running)) {
WL_INFO(("ESCAN ABORTED\n"));
-#if defined(CUSTOMER_HW4) && 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 /* CUSTOMER_HW4 && DUAL_ESCAN_RESULT_BUFFER */
+ wl->bss_list = wl_escan_get_buf(wl, TRUE);
+ if (!scan_req_match(wl)) {
+ WL_TRACE_HW4(("SCAN ABORTED: scanned AP count=%d\n",
+ wl->bss_list->count));
+ }
wl_inform_bss(wl);
wl_notify_escan_complete(wl, ndev, true, false);
}
-#if defined(CUSTOMER_HW4) && defined(DUAL_ESCAN_RESULT_BUFFER)
- wl->escan_info.cur_sync_id += 2;
-#endif
+ wl_escan_increment_sync_id(wl, SCAN_BUF_CNT);
} 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 if (status == WLC_E_STATUS_TIMEOUT) {
+ WL_ERR(("WLC_E_STATUS_TIMEOUT : scan_request[%p]\n", wl->scan_request));
+ WL_ERR(("escan_on[%d], reason[0x%x]\n", wl->escan_on, e->reason));
+ if (e->reason == 0xFFFFFFFF) {
+ wl_notify_escan_complete(wl, wl->escan_info.ndev, true, true);
+ }
} else {
WL_ERR(("unexpected Escan Event %d : abort\n", status));
wl->escan_info.escan_state = WL_ESCAN_STATE_IDLE;
-#if defined(CUSTOMER_HW4) && 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 /* CUSTOMER_HW4 && DUAL_ESCAN_RESULT_BUFFER */
+ wl_escan_print_sync_id(status, escan_result->sync_id,
+ wl->escan_info.cur_sync_id);
if (wl_get_drv_status_all(wl, FINDING_COMMON_CHANNEL)) {
WL_INFO(("ACTION FRAME SCAN DONE\n"));
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)) || (wl->sched_scan_running)) {
-#if defined(CUSTOMER_HW4) && 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 /* CUSTOMER_HW4 && DUAL_ESCAN_RESULT_BUFFER */
+ wl->bss_list = wl_escan_get_buf(wl, TRUE);
+ if (!scan_req_match(wl)) {
+ WL_TRACE_HW4(("SCAN ABORTED(UNEXPECTED): "
+ "scanned AP count=%d\n",
+ wl->bss_list->count));
+ }
wl_inform_bss(wl);
wl_notify_escan_complete(wl, ndev, true, false);
}
-#if defined(CUSTOMER_HW4) && defined(DUAL_ESCAN_RESULT_BUFFER)
- wl->escan_info.cur_sync_id += 2;
-#endif
+ wl_escan_increment_sync_id(wl, 2);
}
exit:
mutex_unlock(&wl->usr_sync);
static void wl_cfg80211_determine_vsdb_mode(struct wl_priv *wl)
{
-#ifdef CUSTOMER_HW4
- u32 connected_cnt = wl_get_drv_status_all(wl, CONNECTED);
- if (connected_cnt > 1) {
- wl->vsdb_mode = true;
- } else {
- wl->vsdb_mode = false;
- }
- return;
-#else
struct net_info *iter, *next;
u32 chan = 0;
u32 chanspec = 0;
}
}
return;
-#endif /* CUSTOMER_HW4 */
}
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;
+ u32 mode;
u32 chan = 0;
struct net_info *iter, *next;
struct net_device *primary_dev = wl_to_prmry_ndev(wl);
if (state != WL_STATUS_CONNECTED)
return 0;
-
+ mode = wl_get_mode_by_netdev(wl, _net_info->ndev);
if (set) {
- if (wl_get_mode_by_netdev(wl, _net_info->ndev) == WL_MODE_AP) {
- pm = PM_OFF;
- WL_DBG(("%s:AP power save %s\n", _net_info->ndev->name,
- pm ? "enabled" : "disabled"));
- if ((err = wldev_ioctl(_net_info->ndev, WLC_SET_PM,
- &pm, sizeof(pm), true)) != 0) {
- if (err == -ENODEV)
- WL_DBG(("%s:net_device is not ready\n",
- _net_info->ndev->name));
- else
- WL_ERR(("%s:error (%d)\n", _net_info->ndev->name, err));
- }
+ wl_cfg80211_concurrent_roam(wl, 1);
+
+ if (mode == 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"));
- return 0;
}
- wl_cfg80211_concurrent_roam(wl, 1);
wl_cfg80211_determine_vsdb_mode(wl);
- pm = PM_OFF;
- for_each_ndev(wl, iter, next) {
- if ((!wl->vsdb_mode) && (iter->ndev != _net_info->ndev)) {
- /* Do not touch the other interfaces power save
- * if we are not in vsdb mode
- */
- continue;
+ if (wl->vsdb_mode || _net_info->pm_block) {
+ if (wl->pm_enable_work_on) {
+ cancel_delayed_work_sync(&wl->pm_enable_work);
+ wl->pm_enable_work_on = false;
}
- /* Save the current power mode */
- iter->pm_restore = true;
- err = wldev_ioctl(iter->ndev, WLC_GET_PM, &iter->pm,
- sizeof(iter->pm), true);
- WL_DBG(("%s:power save %s\n", iter->ndev->name,
- iter->pm ? "enabled" : "disabled"));
- if ((err = wldev_ioctl(iter->ndev, WLC_SET_PM, &pm,
- sizeof(pm), true)) != 0) {
- if (err == -ENODEV)
- WL_DBG(("%s:netdev not ready\n", iter->ndev->name));
- else
- WL_ERR(("%s:error (%d)\n", iter->ndev->name, err));
- iter->ndev->ieee80211_ptr->ps = pm ? true: false;
+ /* save PM_FAST in _net_info to restore this
+ * if _net_info->pm_block is false
+ */
+ if (!_net_info->pm_block && (mode == WL_MODE_BSS)) {
+ _net_info->pm = PM_FAST;
+ _net_info->pm_restore = true;
+ }
+ pm = PM_OFF;
+ for_each_ndev(wl, iter, next) {
+ if (iter->pm_restore)
+ continue;
+ /* Save the current power mode */
+ err = wldev_ioctl(iter->ndev, WLC_GET_PM, &iter->pm,
+ sizeof(iter->pm), false);
+ WL_DBG(("%s:power save %s\n", iter->ndev->name,
+ iter->pm ? "enabled" : "disabled"));
+ if (!err && iter->pm) {
+ iter->pm_restore = true;
+ }
+
+ }
+ for_each_ndev(wl, iter, next) {
+ if ((err = wldev_ioctl(iter->ndev, WLC_SET_PM, &pm,
+ sizeof(pm), true)) != 0) {
+ if (err == -ENODEV)
+ WL_DBG(("%s:netdev not ready\n", iter->ndev->name));
+ else
+ WL_ERR(("%s:error (%d)\n", iter->ndev->name, err));
+ } else
+ iter->ndev->ieee80211_ptr->ps = false;
+ }
+ } else {
+ /* add PM Enable timer to go to power save mode
+ * if supplicant control pm mode, it will be cleared or
+ * updated by wl_cfg80211_set_power_mgmt() if not - for static IP & HW4 P2P,
+ * PM will be configured when timer expired
+ */
+
+ /*
+ * before calling pm_enable_timer, we need to set PM -1 for all ndev
+ */
+ pm = PM_OFF;
+
+ for_each_ndev(wl, iter, next) {
+ if ((err = wldev_ioctl(iter->ndev, WLC_SET_PM, &pm,
+ sizeof(pm), true)) != 0) {
+ if (err == -ENODEV)
+ WL_DBG(("%s:netdev not ready\n", iter->ndev->name));
+ else
+ WL_ERR(("%s:error (%d)\n", iter->ndev->name, err));
+ }
}
+ wl->pm_enable_work_on = true;
+ schedule_delayed_work(&wl->pm_enable_work,
+ msecs_to_jiffies(WL_PM_ENABLE_TIMEOUT));
}
}
else { /* clear */
wl_update_prof(wl, _net_info->ndev, NULL, &chan, WL_PROF_CHAN);
wl_cfg80211_determine_vsdb_mode(wl);
for_each_ndev(wl, iter, next) {
- if (iter->pm_restore) {
+ if (iter->pm_restore && iter->pm) {
WL_DBG(("%s:restoring power save %s\n",
iter->ndev->name, (iter->pm ? "enabled" : "disabled")));
err = wldev_ioctl(iter->ndev,
break;
}
iter->pm_restore = 0;
+ iter->ndev->ieee80211_ptr->ps = true;
}
}
wl_cfg80211_concurrent_roam(wl, 0);
} 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(CUSTOMER_HW4) && defined(DUAL_ESCAN_RESULT_BUFFER)
- wl->escan_info.cur_sync_id = 0;
-#endif
+ wl_escan_init_sync_id(wl);
}
/* Init scan_timeout timer */
init_timer(&wl->scan_timeout);
return -ENOMEM;
wl_init_event_handler(wl);
mutex_init(&wl->usr_sync);
+ mutex_init(&wl->event_sync);
err = wl_init_scan(wl);
if (err)
return err;
unregister_netdevice_notifier(&wl_cfg80211_netdev_notifier);
}
-#if defined(WLP2P) && defined(WL_ENABLE_P2P_IF)
+#if defined(WL_ENABLE_P2P_IF)
static s32 wl_cfg80211_attach_p2p(void)
{
struct wl_priv *wl = wlcfg_drv_priv;
WL_TRACE(("Enter \n"));
if (wl_cfgp2p_register_ndev(wl) < 0) {
- WL_ERR(("%s: P2P attach failed. \n", __func__));
+ WL_ERR(("P2P attach failed. \n"));
return -ENODEV;
}
return 0;
}
-#endif /* defined(WLP2P) && defined(WL_ENABLE_P2P_IF) */
+#endif /* WL_ENABLE_P2P_IF */
s32 wl_cfg80211_attach_post(struct net_device *ndev)
{
wl->wdev->wiphy->interface_modes |=
(BIT(NL80211_IFTYPE_P2P_CLIENT)|
BIT(NL80211_IFTYPE_P2P_GO));
-#endif
+#endif /* !WL_ENABLE_P2P_IF */
if ((err = wl_cfgp2p_init_priv(wl)) != 0)
goto fail;
-#if defined(WLP2P) && defined(WL_ENABLE_P2P_IF)
+#if 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);
" Couldn't update the MAC Address for p2p0 \n"));
return -ENODEV;
}
-#endif /* defined(WLP2P) && (WL_ENABLE_P2P_IF) */
+#endif /* WL_ENABLE_P2P_IF */
wl->p2p_supported = true;
}
WL_ERR(("Could not allocate wireless device\n"));
return -ENOMEM;
}
- err = wl_setup_wiphy(wdev, dev);
+ err = wl_setup_wiphy(wdev, dev, data);
if (unlikely(err)) {
kfree(wdev);
return -ENOMEM;
WL_ERR(("Failed to setup rfkill %d\n", err));
goto cfg80211_attach_out;
}
+#ifdef DEBUGFS_CFG80211
+ err = wl_setup_debugfs(wl);
+ if (err) {
+ WL_ERR(("Failed to setup debugfs %d\n", err));
+ goto cfg80211_attach_out;
+ }
+#endif
err = register_netdevice_notifier(&wl_cfg80211_netdev_notifier);
if (err) {
WL_ERR(("Failed to register notifierl %d\n", err));
goto cfg80211_attach_out;
}
#if defined(COEX_DHCP)
- if (wl_cfg80211_btcoex_init(wl))
+ err = wl_cfg80211_btcoex_init(wl);
+ if (err)
goto cfg80211_attach_out;
-#endif
+#endif
wlcfg_drv_priv = wl;
-#if defined(WLP2P) && defined(WL_ENABLE_P2P_IF)
+#if defined(WL_ENABLE_P2P_IF)
err = wl_cfg80211_attach_p2p();
if (err)
goto cfg80211_attach_out;
-#endif
+#endif /* WL_ENABLE_P2P_IF */
return err;
cfg80211_attach_out:
- err = wl_setup_rfkill(wl, FALSE);
+ wl_setup_rfkill(wl, FALSE);
wl_free_wdev(wl);
return err;
}
#if defined(COEX_DHCP)
wl_cfg80211_btcoex_deinit(wl);
-#endif
+#endif
wl_setup_rfkill(wl, FALSE);
+#ifdef DEBUGFS_CFG80211
+ wl_free_debugfs(wl);
+#endif
if (wl->p2p_supported) {
if (timer_pending(&wl->p2p->listen_timer))
del_timer_sync(&wl->p2p->listen_timer);
wl_cfgp2p_deinit_priv(wl);
}
-#if defined(WLP2P) && defined(WL_ENABLE_P2P_IF)
+#if defined(WL_ENABLE_P2P_IF)
wl_cfg80211_detach_p2p();
#endif
+
wl_deinit_priv(wl);
wlcfg_drv_priv = NULL;
wl_cfg80211_clear_parent_dev();
}
}
+#if defined(WL_ENABLE_P2P_IF)
static int wl_is_p2p_event(struct wl_event_q *e)
{
switch (e->etype) {
case WLC_E_ACTION_FRAME_COMPLETE:
if (e->emsg.ifidx != 0) {
- WL_TRACE(("P2P Event on Virtual I/F (ifidx:%d) \n",
- e->emsg.ifidx));
+ WL_TRACE(("P2P event(%d) on virtual interface(ifidx:%d)\n",
+ e->etype, e->emsg.ifidx));
/* We are only bothered about the P2P events received
* on primary interface. For rest of them return false
* so that it is sent over the interface corresponding
*/
return FALSE;
} else {
- WL_TRACE(("P2P Event on Primary I/F (ifidx:%d)."
- " Sent it to p2p0 \n", e->emsg.ifidx));
+ WL_TRACE(("P2P event(%d) on interface(ifidx:%d)\n",
+ e->etype, e->emsg.ifidx));
return TRUE;
}
break;
default:
- WL_TRACE(("NON-P2P Event %d on ifidx (ifidx:%d) \n",
+ WL_TRACE(("NON-P2P event(%d) on interface(ifidx:%d)\n",
e->etype, e->emsg.ifidx));
return FALSE;
}
}
+#endif
static s32 wl_event_handler(void *data)
{
- struct net_device *netdev;
struct wl_priv *wl = NULL;
struct wl_event_q *e;
tsk_ctl_t *tsk = (tsk_ctl_t *)data;
+ bcm_struct_cfgdev *cfgdev = NULL;
wl = (struct wl_priv *)tsk->parent;
* there is no corresponding bsscfg for P2P interface. Map it to p2p0
* interface.
*/
+#if defined(WL_ENABLE_P2P_IF)
if ((wl_is_p2p_event(e) == TRUE) && (wl->p2p_net)) {
- netdev = wl->p2p_net;
+ cfgdev = wl->p2p_net;
} else {
- netdev = dhd_idx2net((struct dhd_pub *)(wl->pub), e->emsg.ifidx);
+ cfgdev = dhd_idx2net((struct dhd_pub *)(wl->pub),
+ e->emsg.ifidx);
+ }
+#endif
+
+ if (!cfgdev) {
+#if defined(WL_ENABLE_P2P_IF)
+ cfgdev = wl_to_prmry_ndev(wl);
+#endif
}
- if (!netdev)
- netdev = wl_to_prmry_ndev(wl);
if (e->etype < WLC_E_LAST && wl->evt_handler[e->etype]) {
- wl->evt_handler[e->etype] (wl, netdev, &e->emsg, e->edata);
+ wl->evt_handler[e->etype] (wl, cfgdev, &e->emsg, e->edata);
} else {
WL_DBG(("Unknown Event (%d): ignoring\n", e->etype));
}
}
DHD_OS_WAKE_UNLOCK(wl->pub);
}
- WL_ERR(("%s was terminated\n", __func__));
+ WL_ERR(("was terminated\n"));
complete_and_exit(&tsk->completed, 0);
return 0;
}
return 0;
}
-s32 wl_add_remove_eventmsg(struct net_device *ndev, u16 event, bool add)
+void wl_cfg80211_add_to_eventbuffer(struct wl_eventmsg_buf *ev, u16 event, bool set)
+{
+ if (!ev || (event > WLC_E_LAST))
+ return;
+
+ if (ev->num < MAX_EVENT_BUF_NUM) {
+ ev->event[ev->num].type = event;
+ ev->event[ev->num].set = set;
+ ev->num++;
+ } else {
+ WL_ERR(("evenbuffer doesn't support > %u events. Update"
+ " the define MAX_EVENT_BUF_NUM \n", MAX_EVENT_BUF_NUM));
+ ASSERT(0);
+ }
+}
+
+s32 wl_cfg80211_apply_eventbuffer(
+ struct net_device *ndev,
+ struct wl_priv *wl,
+ wl_eventmsg_buf_t *ev)
{
+ char eventmask[WL_EVENTING_MASK_LEN];
+ int i, ret = 0;
s8 iovbuf[WL_EVENTING_MASK_LEN + 12];
- s8 eventmask[WL_EVENTING_MASK_LEN];
- s32 err = 0;
- if (!ndev)
- return -ENODEV;
- /* Setup event_msgs */
+ if (!ev || (!ev->num))
+ return -EINVAL;
+
+ mutex_lock(&wl->event_sync);
+
+ /* Read event_msgs mask */
bcm_mkiovar("event_msgs", NULL, 0, iovbuf,
sizeof(iovbuf));
- err = wldev_ioctl(ndev, WLC_GET_VAR, iovbuf, sizeof(iovbuf), false);
- if (unlikely(err)) {
- WL_ERR(("Get event_msgs error (%d)\n", err));
- goto eventmsg_out;
+ ret = wldev_ioctl(ndev, WLC_GET_VAR, iovbuf, sizeof(iovbuf), false);
+ if (unlikely(ret)) {
+ WL_ERR(("Get event_msgs error (%d)\n", ret));
+ goto exit;
}
memcpy(eventmask, iovbuf, WL_EVENTING_MASK_LEN);
- if (add) {
+
+ /* apply the set bits */
+ for (i = 0; i < ev->num; i++) {
+ if (ev->event[i].set)
+ setbit(eventmask, ev->event[i].type);
+ else
+ clrbit(eventmask, ev->event[i].type);
+ }
+
+ /* Write updated Event mask */
+ bcm_mkiovar("event_msgs", eventmask, WL_EVENTING_MASK_LEN, iovbuf,
+ sizeof(iovbuf));
+ ret = wldev_ioctl(ndev, WLC_SET_VAR, iovbuf, sizeof(iovbuf), true);
+ if (unlikely(ret)) {
+ WL_ERR(("Set event_msgs error (%d)\n", ret));
+ }
+
+exit:
+ mutex_unlock(&wl->event_sync);
+ return ret;
+}
+
+s32 wl_add_remove_eventmsg(struct net_device *ndev, u16 event, bool add)
+{
+ s8 iovbuf[WL_EVENTING_MASK_LEN + 12];
+ s8 eventmask[WL_EVENTING_MASK_LEN];
+ s32 err = 0;
+ struct wl_priv *wl = wlcfg_drv_priv;
+
+ if (!ndev || !wl)
+ return -ENODEV;
+
+ mutex_lock(&wl->event_sync);
+
+ /* Setup event_msgs */
+ bcm_mkiovar("event_msgs", NULL, 0, iovbuf,
+ sizeof(iovbuf));
+ err = wldev_ioctl(ndev, WLC_GET_VAR, iovbuf, sizeof(iovbuf), false);
+ if (unlikely(err)) {
+ WL_ERR(("Get event_msgs error (%d)\n", err));
+ goto eventmsg_out;
+ }
+ memcpy(eventmask, iovbuf, WL_EVENTING_MASK_LEN);
+ if (add) {
setbit(eventmask, event);
} else {
clrbit(eventmask, event);
}
eventmsg_out:
+ mutex_unlock(&wl->event_sync);
return err;
-
}
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)
+#if LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 38)
band_chan_arr[index].center_freq =
ieee80211_channel_to_frequency(channel);
#else
if (channel & WL_CHAN_PASSIVE)
band_chan_arr[index].flags |=
IEEE80211_CHAN_PASSIVE_SCAN;
- } else if (err == BCME_UNSUPPORTED)
+ } else if (err == BCME_UNSUPPORTED) {
dfs_radar_disabled = TRUE;
+ WL_ERR(("does not support per_chan_info\n"));
+ }
}
}
if (!update)
return err;
}
-s32 wl_update_wiphybands(struct wl_priv *wl)
+s32 wl_update_wiphybands(struct wl_priv *wl, bool notify)
{
struct wiphy *wiphy;
struct net_device *dev;
err = wldev_ioctl(dev, WLC_GET_BANDLIST, bandlist,
sizeof(bandlist), false);
if (unlikely(err)) {
- WL_ERR(("error real bandlist (%d)\n", err));
+ WL_ERR(("error read bandlist (%d)\n", err));
goto end_bands;
}
err = wldev_ioctl(dev, WLC_GET_BAND, &cur_band,
wiphy->bands[IEEE80211_BAND_2GHZ] = bands[IEEE80211_BAND_2GHZ];
wiphy->bands[IEEE80211_BAND_5GHZ] = bands[IEEE80211_BAND_5GHZ];
- wiphy_apply_custom_regulatory(wiphy, &brcm_regdom);
+ /* check if any bands populated otherwise makes 2Ghz as default */
+ if (wiphy->bands[IEEE80211_BAND_2GHZ] == NULL &&
+ wiphy->bands[IEEE80211_BAND_5GHZ] == NULL) {
+ /* Setup 2Ghz band as default */
+ wiphy->bands[IEEE80211_BAND_2GHZ] = &__wl_band_2ghz;
+ }
+
+ if (notify)
+ wiphy_apply_custom_regulatory(wiphy, &brcm_regdom);
+
end_bands:
if (rollback_lock)
mutex_unlock(&wl->usr_sync);
static s32 __wl_cfg80211_up(struct wl_priv *wl)
{
s32 err = 0;
-#ifdef WL_HOST_BAND_MGMT
- s32 ret = 0;
-#endif /* WL_HOST_BAND_MGMT */
struct net_device *ndev = wl_to_prmry_ndev(wl);
struct wireless_dev *wdev = ndev->ieee80211_ptr;
if (unlikely(err && err != -EINPROGRESS)) {
WL_ERR(("wl_config_ifmode failed\n"));
}
- err = wl_update_wiphybands(wl);
+ err = wl_update_wiphybands(wl, true);
if (unlikely(err)) {
WL_ERR(("wl_update_wiphybands failed\n"));
}
err = dhd_monitor_init(wl->pub);
err = wl_invoke_iscan(wl);
-#ifdef WL_HOST_BAND_MGMT
- /* By default the curr_band is initialized to BAND_AUTO */
- if ((ret = wl_cfg80211_set_band(ndev, WLC_BAND_AUTO)) < 0) {
- if (ret == BCME_UNSUPPORTED) {
- /* Don't fail the initialization, lets just
- * fall back to the original method
- */
- WL_ERR(("WL_HOST_BAND_MGMT defined, "
- "but roam_band iovar not supported \n"));
- } else {
- WL_ERR(("roam_band failed. ret=%d", ret));
- err = -1;
- }
- }
-#endif /* WL_HOST_BAND_MGMT */
+ INIT_DELAYED_WORK(&wl->pm_enable_work, wl_cfg80211_work_handler);
wl_set_drv_status(wl, READY, ndev);
return err;
}
unsigned long flags;
struct net_info *iter, *next;
struct net_device *ndev = wl_to_prmry_ndev(wl);
+#if defined(WL_CFG80211) && defined(WL_ENABLE_P2P_IF)
struct net_device *p2p_net = wl->p2p_net;
+#endif /* WL_CFG80211 && WL_ENABLE_P2P_IF */
u32 bssidx = 0;
WL_DBG(("In\n"));
+ if (wl->pm_enable_work_on) {
+ cancel_delayed_work_sync(&wl->pm_enable_work);
+ wl->pm_enable_work_on = false;
+ }
/* If primary BSS is operational (for e.g SoftAP), bring it down */
}
wl_to_prmry_ndev(wl)->ieee80211_ptr->iftype =
NL80211_IFTYPE_STATION;
- if (p2p_net)
- dev_close(p2p_net);
+#if defined(WL_CFG80211) && defined(WL_ENABLE_P2P_IF)
+ if (p2p_net)
+ dev_close(p2p_net);
+#endif /* WL_CFG80211 && WL_ENABLE_P2P_IF */
DNGL_FUNC(dhd_cfg80211_down, (wl));
wl_flush_eq(wl);
wl_link_down(wl);
if (unlikely(err))
return err;
}
-#if defined(BCMSUP_4WAY_HANDSHAKE) && defined(WLAN_AKM_SUITE_FT_8021X)
- if (dhd->fw_4way_handshake)
- wl->wdev->wiphy->features |= NL80211_FEATURE_FW_4WAY_HANDSHAKE;
-#endif
err = __wl_cfg80211_up(wl);
if (unlikely(err))
WL_ERR(("__wl_cfg80211_up failed\n"));
{
int freq = 0;
-#if LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 38) && !defined(WL_COMPAT_WIRELESS)
+#if LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 38)
freq = ieee80211_channel_to_frequency(channel);
#else
{
return freq;
}
+
+#ifdef WLTDLS
+static s32
+wl_tdls_event_handler(struct wl_priv *wl, bcm_struct_cfgdev *cfgdev,
+ const wl_event_msg_t *e, void *data) {
+
+ struct net_device *ndev = NULL;
+ u32 reason = ntoh32(e->reason);
+ s8 *msg = NULL;
+
+ ndev = cfgdev_to_wlc_ndev(cfgdev, wl);
+
+ switch (reason) {
+ case WLC_E_TDLS_PEER_DISCOVERED :
+ msg = " TDLS PEER DISCOVERD ";
+ break;
+ case WLC_E_TDLS_PEER_CONNECTED :
+ msg = " TDLS PEER CONNECTED ";
+ break;
+ case WLC_E_TDLS_PEER_DISCONNECTED :
+ msg = "TDLS PEER DISCONNECTED ";
+ break;
+ }
+ if (msg) {
+ WL_ERR(("%s: " MACDBG " on %s ndev\n", msg, MAC2STRDBG((u8*)(&e->addr)),
+ (wl_to_prmry_ndev(wl) == ndev) ? "primary" : "secondary"));
+ }
+ return 0;
+
+}
+#endif /* WLTDLS */
+
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 2, 0)) || 0
+static s32
+wl_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,
+ u8 *peer, enum nl80211_tdls_operation oper)
+{
+ s32 ret = 0;
+#ifdef WLTDLS
+ struct wl_priv *wl;
+ tdls_iovar_t info;
+ wl = wlcfg_drv_priv;
+ memset(&info, 0, sizeof(tdls_iovar_t));
+ if (peer)
+ memcpy(&info.ea, peer, ETHER_ADDR_LEN);
+ switch (oper) {
+ case NL80211_TDLS_DISCOVERY_REQ:
+ info.mode = TDLS_MANUAL_EP_DISCOVERY;
+ break;
+ case NL80211_TDLS_SETUP:
+ info.mode = TDLS_MANUAL_EP_CREATE;
+ break;
+ case NL80211_TDLS_TEARDOWN:
+ info.mode = TDLS_MANUAL_EP_DELETE;
+ break;
+ default:
+ WL_ERR(("Unsupported operation : %d\n", oper));
+ goto out;
+ }
+ ret = wldev_iovar_setbuf(dev, "tdls_endpoint", &info, sizeof(info),
+ wl->ioctl_buf, WLC_IOCTL_MAXLEN, &wl->ioctl_buf_sync);
+ if (ret) {
+ WL_ERR(("tdls_endpoint error %d\n", ret));
+ }
+out:
+#endif /* WLTDLS */
+ return ret;
+}
+#endif
+
s32 wl_cfg80211_set_wps_p2p_ie(struct net_device *net, char *buf, int len,
enum wl_management_type type)
{
ndev = net;
bssidx = 0;
} else if (wl->p2p) {
- if (net == wl->p2p_net) {
- net = wl_to_prmry_ndev(wl);
- }
+ net = ndev_to_wlc_ndev(net, wl);
if (!wl->p2p->on) {
get_primary_mac(wl, &primary_mac);
wl_cfgp2p_generate_bss_mac(&primary_mac, &wl->p2p->dev_addr,
return ret;
}
+#ifdef WL_SUPPORT_AUTO_CHANNEL
+static s32
+wl_cfg80211_set_auto_channel_scan_state(struct net_device *ndev)
+{
+ u32 val = 0;
+ s32 ret = BCME_ERROR;
+ struct wl_priv *wl = wlcfg_drv_priv;
+
+ /* Disable mpc, to avoid automatic interface down. */
+ val = 0;
+
+ ret = wldev_iovar_setbuf_bsscfg(ndev, "mpc", (void *)&val,
+ sizeof(val), wl->ioctl_buf, WLC_IOCTL_SMLEN, 0,
+ &wl->ioctl_buf_sync);
+ if (ret < 0) {
+ WL_ERR(("set 'mpc' failed, error = %d\n", ret));
+ goto done;
+ }
+
+ /* Set interface up, explicitly. */
+ val = 1;
+
+ ret = wldev_ioctl(ndev, WLC_UP, (void *)&val, sizeof(val), true);
+ if (ret < 0) {
+ WL_ERR(("set interface up failed, error = %d\n", ret));
+ goto done;
+ }
+
+ /* Stop all scan explicitly, till auto channel selection complete. */
+ wl_set_drv_status(wl, SCANNING, ndev);
+ ret = wl_notify_escan_complete(wl, ndev, true, true);
+ if (ret < 0) {
+ WL_ERR(("set scan abort failed, error = %d\n", ret));
+ goto done;
+ }
+
+done:
+ return ret;
+}
+
+static bool
+wl_cfg80211_valid_chanspec_p2p(chanspec_t chanspec)
+{
+ bool valid = false;
+
+ /* channel 1 to 14 */
+ if ((chanspec >= 0x2b01) && (chanspec <= 0x2b0e)) {
+ valid = true;
+ }
+ /* channel 36 to 48 */
+ else if ((chanspec >= 0x1b24) && (chanspec <= 0x1b30)) {
+ valid = true;
+ }
+ /* channel 149 to 161 */
+ else if ((chanspec >= 0x1b95) && (chanspec <= 0x1ba1)) {
+ valid = true;
+ }
+ else {
+ valid = false;
+ WL_INFO(("invalid P2P chanspec, channel = %d, chanspec = %04x\n",
+ CHSPEC_CHANNEL(chanspec), chanspec));
+ }
+
+ return valid;
+}
+
+static s32
+wl_cfg80211_get_chanspecs_2g(struct net_device *ndev, void *buf, s32 buflen)
+{
+ s32 ret = BCME_ERROR;
+ struct wl_priv *wl = NULL;
+ wl_uint32_list_t *list = NULL;
+ chanspec_t chanspec = 0;
+
+ memset(buf, 0, buflen);
+
+ wl = wlcfg_drv_priv;
+ list = (wl_uint32_list_t *)buf;
+ list->count = htod32(WL_NUMCHANSPECS);
+
+ /* Restrict channels to 2.4GHz, 20MHz BW, no SB. */
+ chanspec |= (WL_CHANSPEC_BAND_2G | WL_CHANSPEC_BW_20 |
+ WL_CHANSPEC_CTL_SB_NONE);
+ chanspec = wl_chspec_host_to_driver(chanspec);
+
+ ret = wldev_iovar_getbuf_bsscfg(ndev, "chanspecs", (void *)&chanspec,
+ sizeof(chanspec), buf, buflen, 0, &wl->ioctl_buf_sync);
+ if (ret < 0) {
+ WL_ERR(("get 'chanspecs' failed, error = %d\n", ret));
+ }
+
+ return ret;
+}
+
+static s32
+wl_cfg80211_get_chanspecs_5g(struct net_device *ndev, void *buf, s32 buflen)
+{
+ u32 channel = 0;
+ s32 ret = BCME_ERROR;
+ s32 i = 0;
+ s32 j = 0;
+ struct wl_priv *wl = NULL;
+ wl_uint32_list_t *list = NULL;
+ chanspec_t chanspec = 0;
+
+ memset(buf, 0, buflen);
+
+ wl = wlcfg_drv_priv;
+ list = (wl_uint32_list_t *)buf;
+ list->count = htod32(WL_NUMCHANSPECS);
+
+ /* Restrict channels to 5GHz, 20MHz BW, no SB. */
+ chanspec |= (WL_CHANSPEC_BAND_5G | WL_CHANSPEC_BW_20 |
+ WL_CHANSPEC_CTL_SB_NONE);
+ chanspec = wl_chspec_host_to_driver(chanspec);
+
+ ret = wldev_iovar_getbuf_bsscfg(ndev, "chanspecs", (void *)&chanspec,
+ sizeof(chanspec), buf, buflen, 0, &wl->ioctl_buf_sync);
+ if (ret < 0) {
+ WL_ERR(("get 'chanspecs' failed, error = %d\n", ret));
+ goto done;
+ }
+
+ /* Skip DFS and inavlid P2P channel. */
+ for (i = 0, j = 0; i < dtoh32(list->count); i++) {
+ chanspec = (chanspec_t) dtoh32(list->element[i]);
+ channel = CHSPEC_CHANNEL(chanspec);
+
+ ret = wldev_iovar_getint(ndev, "per_chan_info", &channel);
+ if (ret < 0) {
+ WL_ERR(("get 'per_chan_info' failed, error = %d\n", ret));
+ goto done;
+ }
+
+ if (CHANNEL_IS_RADAR(channel) ||
+ !(wl_cfg80211_valid_chanspec_p2p(chanspec))) {
+ continue;
+ } else {
+ list->element[j] = list->element[i];
+ }
+
+ j++;
+ }
+
+ list->count = j;
+
+done:
+ return ret;
+}
+
+static s32
+wl_cfg80211_get_best_channel(struct net_device *ndev, void *buf, int buflen,
+ int *channel)
+{
+ s32 ret = BCME_ERROR;
+ int chosen = 0;
+ int retry = 0;
+
+ /* Start auto channel selection scan. */
+ ret = wldev_ioctl(ndev, WLC_START_CHANNEL_SEL, buf, buflen, true);
+ if (ret < 0) {
+ WL_ERR(("can't start auto channel scan, error = %d\n", ret));
+ *channel = 0;
+ goto done;
+ }
+
+ /* Wait for auto channel selection, worst case possible delay is 5250ms. */
+ retry = CHAN_SEL_RETRY_COUNT;
+
+ while (retry--) {
+ bcm_mdelay(CHAN_SEL_IOCTL_DELAY);
+
+ ret = wldev_ioctl(ndev, WLC_GET_CHANNEL_SEL, &chosen, sizeof(chosen),
+ false);
+ if ((ret == 0) && (dtoh32(chosen) != 0)) {
+ *channel = (u16)(chosen & 0x00FF);
+ WL_INFO(("selected channel = %d\n", *channel));
+ break;
+ }
+ WL_INFO(("attempt = %d, ret = %d, chosen = %d\n",
+ (CHAN_SEL_RETRY_COUNT - retry), ret, dtoh32(chosen)));
+ }
+
+ if (retry <= 0) {
+ WL_ERR(("failure, auto channel selection timed out\n"));
+ *channel = 0;
+ ret = BCME_ERROR;
+ }
+
+done:
+ return ret;
+}
+
+static s32
+wl_cfg80211_restore_auto_channel_scan_state(struct net_device *ndev)
+{
+ u32 val = 0;
+ s32 ret = BCME_ERROR;
+ struct wl_priv *wl = wlcfg_drv_priv;
+
+ /* Clear scan stop driver status. */
+ wl_clr_drv_status(wl, SCANNING, ndev);
+
+ /* Enable mpc back to 1, irrespective of initial state. */
+ val = 1;
+
+ ret = wldev_iovar_setbuf_bsscfg(ndev, "mpc", (void *)&val,
+ sizeof(val), wl->ioctl_buf, WLC_IOCTL_SMLEN, 0,
+ &wl->ioctl_buf_sync);
+ if (ret < 0) {
+ WL_ERR(("set 'mpc' failed, error = %d\n", ret));
+ }
+
+ return ret;
+}
+
+s32
+wl_cfg80211_get_best_channels(struct net_device *dev, char* cmd, int total_len)
+{
+ int channel = 0;
+ s32 ret = BCME_ERROR;
+ u8 *buf = NULL;
+ char *pos = cmd;
+ struct wl_priv *wl = NULL;
+ struct net_device *ndev = NULL;
+
+ memset(cmd, 0, total_len);
+
+ buf = kmalloc(CHANSPEC_BUF_SIZE, GFP_KERNEL);
+ if (buf == NULL) {
+ WL_ERR(("failed to allocate chanspec buffer\n"));
+ return -ENOMEM;
+ }
+
+ /*
+ * Always use primary interface, irrespective of interface on which
+ * command came.
+ */
+ wl = wlcfg_drv_priv;
+ ndev = wl_to_prmry_ndev(wl);
+
+ /*
+ * Make sure that FW and driver are in right state to do auto channel
+ * selection scan.
+ */
+ ret = wl_cfg80211_set_auto_channel_scan_state(ndev);
+ if (ret < 0) {
+ WL_ERR(("can't set auto channel scan state, error = %d\n", ret));
+ goto done;
+ }
+
+ /* Best channel selection in 2.4GHz band. */
+ ret = wl_cfg80211_get_chanspecs_2g(ndev, (void *)buf, CHANSPEC_BUF_SIZE);
+ if (ret < 0) {
+ WL_ERR(("can't get chanspecs in 2.4GHz, error = %d\n", ret));
+ goto done;
+ }
+
+ ret = wl_cfg80211_get_best_channel(ndev, (void *)buf, CHANSPEC_BUF_SIZE,
+ &channel);
+ if (ret < 0) {
+ WL_ERR(("can't select best channel scan in 2.4GHz, error = %d\n", ret));
+ goto done;
+ }
+
+ if (CHANNEL_IS_2G(channel)) {
+ channel = ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ);
+ } else {
+ WL_ERR(("invalid 2.4GHz channel, channel = %d\n", channel));
+ channel = 0;
+ }
+
+ sprintf(pos, "%04d ", channel);
+ pos += 5;
+
+ /* Best channel selection in 5GHz band. */
+ ret = wl_cfg80211_get_chanspecs_5g(ndev, (void *)buf, CHANSPEC_BUF_SIZE);
+ if (ret < 0) {
+ WL_ERR(("can't get chanspecs in 5GHz, error = %d\n", ret));
+ goto done;
+ }
+
+ ret = wl_cfg80211_get_best_channel(ndev, (void *)buf, CHANSPEC_BUF_SIZE,
+ &channel);
+ if (ret < 0) {
+ WL_ERR(("can't select best channel scan in 5GHz, error = %d\n", ret));
+ goto done;
+ }
+
+ if (CHANNEL_IS_5G(channel)) {
+ channel = ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ);
+ } else {
+ WL_ERR(("invalid 5GHz channel, channel = %d\n", channel));
+ channel = 0;
+ }
+
+ sprintf(pos, "%04d ", channel);
+ pos += 5;
+
+ /* Set overall best channel same as 5GHz best channel. */
+ sprintf(pos, "%04d ", channel);
+ pos += 5;
+
+done:
+ if (NULL != buf) {
+ kfree(buf);
+ }
+
+ /* Restore FW and driver back to normal state. */
+ ret = wl_cfg80211_restore_auto_channel_scan_state(ndev);
+ if (ret < 0) {
+ WL_ERR(("can't restore auto channel scan state, error = %d\n", ret));
+ }
+
+ return (pos - cmd);
+}
+#endif /* WL_SUPPORT_AUTO_CHANNEL */
+
static const struct rfkill_ops wl_rfkill_ops = {
.set_block = wl_rfkill_set
};
return err;
}
+#ifdef DEBUGFS_CFG80211
+/**
+* Format : echo "SCAN:1 DBG:1" > /sys/kernel/debug/dhd/debug_level
+* to turn on SCAN and DBG log.
+* To turn off SCAN partially, echo "SCAN:0" > /sys/kernel/debug/dhd/debug_level
+* To see current setting of debug level,
+* cat /sys/kernel/debug/dhd/debug_level
+*/
+static ssize_t
+wl_debuglevel_write(struct file *file, const char __user *userbuf,
+ size_t count, loff_t *ppos)
+{
+ char tbuf[S_SUBLOGLEVEL * ARRAYSIZE(sublogname_map)], sublog[S_SUBLOGLEVEL];
+ char *params, *token, *colon;
+ uint i, tokens, log_on = 0;
+ memset(tbuf, 0, sizeof(tbuf));
+ memset(sublog, 0, sizeof(sublog));
+ if (copy_from_user(&tbuf, userbuf, min_t(size_t, sizeof(tbuf), count)))
+ return -EFAULT;
+
+ params = &tbuf[0];
+ colon = strchr(params, '\n');
+ if (colon != NULL)
+ *colon = '\0';
+ while ((token = strsep(¶ms, " ")) != NULL) {
+ memset(sublog, 0, sizeof(sublog));
+ if (token == NULL || !*token)
+ break;
+ if (*token == '\0')
+ continue;
+ colon = strchr(token, ':');
+ if (colon != NULL) {
+ *colon = ' ';
+ }
+ tokens = sscanf(token, "%s %u", sublog, &log_on);
+ if (colon != NULL)
+ *colon = ':';
+
+ if (tokens == 2) {
+ for (i = 0; i < ARRAYSIZE(sublogname_map); i++) {
+ if (!strncmp(sublog, sublogname_map[i].sublogname,
+ strlen(sublogname_map[i].sublogname))) {
+ if (log_on)
+ wl_dbg_level |=
+ (sublogname_map[i].log_level);
+ else
+ wl_dbg_level &=
+ ~(sublogname_map[i].log_level);
+ }
+ }
+ } else
+ WL_ERR(("%s: can't parse '%s' as a "
+ "SUBMODULE:LEVEL (%d tokens)\n",
+ tbuf, token, tokens));
+
+
+ }
+ return count;
+}
+
+static ssize_t
+wl_debuglevel_read(struct file *file, char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ char *param;
+ char tbuf[S_SUBLOGLEVEL * ARRAYSIZE(sublogname_map)];
+ uint i;
+ memset(tbuf, 0, sizeof(tbuf));
+ param = &tbuf[0];
+ for (i = 0; i < ARRAYSIZE(sublogname_map); i++) {
+ param += snprintf(param, sizeof(tbuf) - 1, "%s:%d ",
+ sublogname_map[i].sublogname,
+ (wl_dbg_level & sublogname_map[i].log_level) ? 1 : 0);
+ }
+ *param = '\n';
+ return simple_read_from_buffer(user_buf, count, ppos, tbuf, strlen(&tbuf[0]));
+
+}
+static const struct file_operations fops_debuglevel = {
+ .open = NULL,
+ .write = wl_debuglevel_write,
+ .read = wl_debuglevel_read,
+ .owner = THIS_MODULE,
+ .llseek = NULL,
+};
+
+static s32 wl_setup_debugfs(struct wl_priv *wl)
+{
+ s32 err = 0;
+ struct dentry *_dentry;
+ if (!wl)
+ return -EINVAL;
+ wl->debugfs = debugfs_create_dir(KBUILD_MODNAME, NULL);
+ if (!wl->debugfs || IS_ERR(wl->debugfs)) {
+ if (wl->debugfs == ERR_PTR(-ENODEV))
+ WL_ERR(("Debugfs is not enabled on this kernel\n"));
+ else
+ WL_ERR(("Can not create debugfs directory\n"));
+ wl->debugfs = NULL;
+ goto exit;
+
+ }
+ _dentry = debugfs_create_file("debug_level", S_IRUSR | S_IWUSR,
+ wl->debugfs, wl, &fops_debuglevel);
+ if (!_dentry || IS_ERR(_dentry)) {
+ WL_ERR(("failed to create debug_level debug file\n"));
+ wl_free_debugfs(wl);
+ }
+exit:
+ return err;
+}
+static s32 wl_free_debugfs(struct wl_priv *wl)
+{
+ if (!wl)
+ return -EINVAL;
+ if (wl->debugfs)
+ debugfs_remove_recursive(wl->debugfs);
+ wl->debugfs = NULL;
+ return 0;
+}
+#endif /* DEBUGFS_CFG80211 */
+
struct device *wl_cfg80211_get_parent_dev(void)
{
return cfg80211_parent_dev;
cfg80211_parent_dev = NULL;
}
-static void get_primary_mac(struct wl_priv *wl, struct ether_addr *mac)
+void get_primary_mac(struct wl_priv *wl, struct ether_addr *mac)
{
wldev_iovar_getbuf_bsscfg(wl_to_prmry_ndev(wl), "cur_etheraddr", NULL,
0, wl->ioctl_buf, WLC_IOCTL_SMLEN, 0, &wl->ioctl_buf_sync);
else
wl_dbg_level |= (WL_DBG_LEVEL & level);
}
-#if 0 || (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0))
+#if defined(WL_SUPPORT_BACKPORTED_KPATCHES) || (LINUX_VERSION_CODE >= KERNEL_VERSION(3, \
+ 2, 0))
static s32
wl_cfg80211_mgmt_tx_cancel_wait(struct wiphy *wiphy,
- struct net_device *dev, u64 cookie)
+ bcm_struct_cfgdev *cfgdev, u64 cookie)
{
/* CFG80211 checks for tx_cancel_wait callback when ATTR_DURATION
* is passed with CMD_FRAME. This callback is supposed to cancel
}
#endif /* WL_SUPPORT_BACKPORTED_PATCHES || KERNEL >= 3.2.0 */
-#ifdef WL11U
-bcm_tlv_t *
-wl_cfg80211_find_interworking_ie(u8 *parse, u32 len)
-{
- 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)
+static void wl_cfg80211_work_handler(struct work_struct * work)
{
+ struct wl_priv *wl = NULL;
+ struct net_info *iter, *next;
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 */
-
-#ifdef WL_HOST_BAND_MGMT
-s32
-wl_cfg80211_set_band(struct net_device *ndev, int band)
-{
- struct wl_priv *wl = wlcfg_drv_priv;
- int ret = 0;
- char ioctl_buf[50];
+ s32 pm = PM_FAST;
- if ((band < WLC_BAND_AUTO) || (band > WLC_BAND_2G)) {
- WL_ERR(("Invalid band\n"));
- return -EINVAL;
+ wl = container_of(work, struct wl_priv, pm_enable_work.work);
+ WL_DBG(("Enter \n"));
+ if (!wl) {
+ WL_ERR(("wl_priv ptr NULL"));
+ return;
}
+ if (wl->pm_enable_work_on) {
+ wl->pm_enable_work_on = 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))
+ continue;
+ if (iter->ndev) {
+ if ((err = wldev_ioctl(iter->ndev, WLC_SET_PM,
+ &pm, sizeof(pm), true)) != 0) {
+ if (err == -ENODEV)
+ WL_DBG(("%s:netdev not ready\n", iter->ndev->name));
+ else
+ WL_ERR(("%s:error (%d)\n", iter->ndev->name, err));
+ } else
+ iter->ndev->ieee80211_ptr->ps = true;
+ }
+ }
- if ((ret = wldev_iovar_setbuf(ndev, "roam_band", &band,
- sizeof(int), ioctl_buf, sizeof(ioctl_buf), NULL)) < 0) {
- WL_ERR(("seting roam_band failed code=%d\n", ret));
- return ret;
}
-
- WL_DBG(("Setting band to %d\n", band));
- wl->curr_band = band;
-
- return 0;
}
-#endif /* WL_HOST_BAND_MGMT */
/*
* Linux cfg80211 driver
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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 369167 2012-11-16 10:33:43Z $
+ * $Id: wl_cfg80211.h 401713 2013-05-13 12:11:03Z $
*/
#ifndef _wl_cfg80211_h_
/* 0 invalidates all debug messages. default is 1 */
#define WL_DBG_LEVEL 0xFF
-#ifdef CUSTOMER_HW4
-#define CFG80211_ERROR_TEXT "CFG80211-INFO2) "
-#else
#define CFG80211_ERROR_TEXT "CFG80211-ERROR) "
-#endif
#if defined(DHD_DEBUG)
#define WL_ERR(args) \
#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 { \
#define WL_SCAN_IE_LEN_MAX 2048
#define WL_BSS_INFO_MAX 2048
#define WL_ASSOC_INFO_MAX 512
-#define WL_IOCTL_LEN_MAX 1024
+#define WL_IOCTL_LEN_MAX 2048
#define WL_EXTRA_BUF_MAX 2048
#define WL_ISCAN_BUF_MAX 2048
#define WL_ISCAN_TIMER_INTERVAL_MS 3000
#define WL_SCAN_JOIN_PASSIVE_DWELL_TIME_MS 400
#define WL_AF_TX_MAX_RETRY 5
+#define WL_AF_SEARCH_TIME_MAX 450
+#define WL_AF_TX_EXTRA_TIME_MAX 200
+
#define WL_SCAN_TIMER_INTERVAL_MS 8000 /* Scan timeout */
#define WL_CHANNEL_SYNC_RETRY 5
#define WL_INVALID -1
#define WL_SCB_TIMEOUT 20
#endif
+/* SCAN_SUPPRESS timer values in ms */
+#define WL_SCAN_SUPPRESS_TIMEOUT 31000 /* default Framwork DHCP timeout is 30 sec */
+#define WL_SCAN_SUPPRESS_RETRY 3000
+
+#define WL_PM_ENABLE_TIMEOUT 3000
+
/* driver status */
enum wl_status {
WL_STATUS_READY = 0,
struct ieee80211_channel channel;
};
-typedef s32(*EVENT_HANDLER) (struct wl_priv *wl,
- struct net_device *ndev, const wl_event_msg_t *e, void *data);
+typedef s32(*EVENT_HANDLER) (struct wl_priv *wl, bcm_struct_cfgdev *cfgdev,
+ const wl_event_msg_t *e, void *data);
/* bss inform structure for cfg80211 interface */
struct wl_cfg80211_bss_info {
#ifndef CONFIG_DHD_USE_STATIC_BUF
#error STATIC_WL_PRIV_STRUCT should be used with CONFIG_DHD_USE_STATIC_BUF
#endif /* CONFIG_DHD_USE_STATIC_BUF */
-#if defined(CUSTOMER_HW4) && defined(DUAL_ESCAN_RESULT_BUFFER)
- u8 *escan_buf[2];
-#else
u8 *escan_buf;
-#endif /* CUSTOMER_HW4 && DUAL_ESCAN_RESULT_BUFFER */
-#else
-#if defined(CUSTOMER_HW4) && defined(DUAL_ESCAN_RESULT_BUFFER)
- u8 escan_buf[2][ESCAN_BUF_SIZE];
#else
u8 escan_buf[ESCAN_BUF_SIZE];
-#endif /* CUSTOMER_HW4 && DUAL_ESCAN_RESULT_BUFFER */
#endif /* STATIC_WL_PRIV_STRUCT */
-#if defined(CUSTOMER_HW4) && defined(DUAL_ESCAN_RESULT_BUFFER)
- u8 cur_sync_id;
-#endif /* CUSTOMER_HW4 && DUAL_ESCAN_RESULT_BUFFER */
struct wiphy *wiphy;
struct net_device *ndev;
};
};
-#ifdef WL11U
-/* Max length of Interworking element */
-#define IW_IES_MAX_BUF_LEN 9
-#endif
+
+#define MAX_EVENT_BUF_NUM 16
+typedef struct wl_eventmsg_buf {
+ u16 num;
+ struct {
+ u16 type;
+ bool set;
+ } event [MAX_EVENT_BUF_NUM];
+} wl_eventmsg_buf_t;
/* private data of cfg80211 interface */
struct wl_priv {
struct wireless_dev *wdev; /* representing wl cfg80211 device */
struct wireless_dev *p2p_wdev; /* representing wl cfg80211 device for P2P */
+
struct net_device *p2p_net; /* reference to p2p0 interface */
struct wl_conf *conf;
#else
struct wl_connect_info conn_info;
#endif
-
+#ifdef DEBUGFS_CFG80211
+ struct dentry *debugfs;
+#endif /* DEBUGFS_CFG80211 */
struct wl_pmk_list *pmk_list; /* wpa2 pmk list */
tsk_ctl_t event_tsk; /* task of main event handler thread */
void *pub;
bool p2p_supported;
struct btcoex_info *btcoex_info;
struct timer_list scan_timeout; /* Timer for catch scan event timeout */
-#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);
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 */
bool sched_scan_running; /* scheduled scan req status */
#ifdef WL_SCHED_SCAN
struct cfg80211_sched_scan_request *sched_scan_req; /* scheduled scan req */
#endif /* WL_SCHED_SCAN */
-#ifdef WL_HOST_BAND_MGMT
- u8 curr_band;
-#endif /* WL_HOST_BAND_MGMT */
+ bool scan_suppressed;
+ struct timer_list scan_supp_timer;
+ struct work_struct wlan_work;
+ struct mutex event_sync; /* maily for up/down synchronization */
+ bool pm_enable_work_on;
+ struct delayed_work pm_enable_work;
};
}
#define wl_to_wiphy(w) (w->wdev->wiphy)
#define wl_to_prmry_ndev(w) (w->wdev->netdev)
+#define wl_to_prmry_wdev(w) (w->wdev)
+#define wl_to_p2p_wdev(w) (w->p2p_wdev)
#define ndev_to_wl(n) (wdev_to_wl(n->ieee80211_ptr))
+#define ndev_to_wdev(ndev) (ndev->ieee80211_ptr)
+#define wdev_to_ndev(wdev) (wdev->netdev)
+
+#if defined(WL_ENABLE_P2P_IF)
+#define ndev_to_wlc_ndev(ndev, wl) ((ndev == wl->p2p_net) ? \
+ wl_to_prmry_ndev(wl) : ndev)
+#else
+#define ndev_to_wlc_ndev(ndev, wl) (ndev)
+#endif /* WL_ENABLE_P2P_IF */
+
+#if defined(WL_ENABLE_P2P_IF)
+#define cfgdev_to_wlc_ndev(cfgdev, wl) ndev_to_wlc_ndev(cfgdev, wl)
+#else
+#define cfgdev_to_wlc_ndev(cfgdev, wl) (cfgdev)
+#endif
+
+#define ndev_to_cfgdev(ndev) (ndev)
+
+#if defined(WL_ENABLE_P2P_IF)
+#define scan_req_match(wl) (((wl) && (wl->scan_request) && \
+ (wl->scan_request->dev == wl->p2p_net)) ? true : false)
+#else
+#define scan_req_match(wl) (((wl) && p2p_is_on(wl) && p2p_scan(wl)) ? \
+ true : false)
+#endif
+
#define wl_to_sr(w) (w->scan_req_int)
#if defined(STATIC_WL_PRIV_STRUCT)
#define wl_to_ie(w) (w->ie)
extern s32 wl_cfg80211_set_wps_p2p_ie(struct net_device *net, char *buf, int len,
enum wl_management_type type);
extern s32 wl_cfg80211_set_p2p_ps(struct net_device *net, char* buf, int len);
+#ifdef WL_SUPPORT_AUTO_CHANNEL
+#define CHANSPEC_BUF_SIZE 1024
+#define CHAN_SEL_IOCTL_DELAY 300
+#define CHAN_SEL_RETRY_COUNT 15
+#define CHANNEL_IS_RADAR(channel) (((channel & WL_CHAN_RADAR) || \
+ (channel & WL_CHAN_PASSIVE)) ? true : false)
+#define CHANNEL_IS_2G(channel) (((channel >= 1) && (channel <= 14)) ? \
+ true : false)
+#define CHANNEL_IS_5G(channel) (((channel >= 36) && (channel <= 165)) ? \
+ true : false)
+extern s32 wl_cfg80211_get_best_channels(struct net_device *dev, char* command,
+ int total_len);
+#endif /* WL_SUPPORT_AUTO_CHANNEL */
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(bool set, u32 level);
-extern s32 wl_update_wiphybands(struct wl_priv *wl);
+extern s32 wl_update_wiphybands(struct wl_priv *wl, bool notify);
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);
-#ifdef WL_HOST_BAND_MGMT
-extern s32 wl_cfg80211_set_band(struct net_device *ndev, int band);
-#endif /* WL_HOST_BAND_MGMT */
+extern void wl_stop_wait_next_action_frame(struct wl_priv *wl);
+extern int wl_cfg80211_update_power_mode(struct net_device *dev);
+extern void wl_cfg80211_add_to_eventbuffer(wl_eventmsg_buf_t *ev, u16 event, bool set);
+extern s32 wl_cfg80211_apply_eventbuffer(struct net_device *ndev,
+ struct wl_priv *wl, wl_eventmsg_buf_t *ev);
+extern void get_primary_mac(struct wl_priv *wl, struct ether_addr *mac);
+#define SCAN_BUF_CNT 2
+#define SCAN_BUF_NEXT 1
+#define wl_escan_set_sync_id(a, b) ((a) = htod16(0x1234))
+#define wl_escan_get_buf(a, b) ((wl_scan_results_t *) (a)->escan_info.escan_buf)
+#define wl_escan_check_sync_id(a, b, c) 0
+#define wl_escan_print_sync_id(a, b, c)
+#define wl_escan_increment_sync_id(a, b)
+#define wl_escan_init_sync_id(a)
#endif /* _wl_cfg80211_h_ */
/*
* Linux cfgp2p driver
*
- * Copyright (C) 1999-2012, Broadcom Corporation
- *
+ * Copyright (C) 1999-2013, 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
* 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 374530 2012-12-13 14:38:23Z $
+ * $Id: wl_cfgp2p.c 396420 2013-04-12 06:55:45Z $
*
*/
#include <typedefs.h>
wl_cfgp2p_has_ie(u8 *ie, u8 **tlvs, u32 *tlvs_len, const u8 *oui, u32 oui_len, u8 type);
static u32
-wl_cfgp2p_vndr_ie(struct wl_priv *wl, u8 *iebuf, s32 bssidx, s32 pktflag,
+wl_cfgp2p_vndr_ie(struct wl_priv *wl, u8 *iebuf, s32 pktflag,
s8 *oui, s32 ie_id, s8 *data, s32 datalen, const s8* add_del_cmd);
+static s32 wl_cfgp2p_cancel_listen(struct wl_priv *wl, struct net_device *ndev,
+ struct wireless_dev *wdev, bool notify);
+#if defined(WL_ENABLE_P2P_IF)
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,
.ndo_stop = wl_cfgp2p_if_stop,
- .ndo_do_ioctl = wl_cfgp2p_do_ioctl,
- .ndo_start_xmit = wl_cfgp2p_start_xmit,
+ .ndo_do_ioctl = wl_cfgp2p_do_ioctl,
+ .ndo_start_xmit = wl_cfgp2p_start_xmit,
};
+#endif /* WL_ENABLE_P2P_IF */
bool wl_cfgp2p_is_pub_action(void *frame, u32 frame_len)
{
return false;
}
-#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)
{
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 ||
return true;
else
return false;
-#endif /* WL11U */
}
-void wl_cfgp2p_print_actframe(bool tx, void *frame, u32 frame_len)
+void wl_cfgp2p_print_actframe(bool tx, void *frame, u32 frame_len, u32 channel)
{
wifi_p2p_pub_act_frame_t *pact_frm;
wifi_p2p_action_frame_t *act_frm;
pact_frm = (wifi_p2p_pub_act_frame_t *)frame;
switch (pact_frm->subtype) {
case P2P_PAF_GON_REQ:
- CFGP2P_ACTION(("%s P2P Group Owner Negotiation Req Frame\n",
- (tx)? "TX": "RX"));
+ CFGP2P_ACTION(("%s P2P Group Owner Negotiation Req Frame,"
+ " channel=%d\n", (tx)? "TX": "RX", channel));
break;
case P2P_PAF_GON_RSP:
- CFGP2P_ACTION(("%s P2P Group Owner Negotiation Rsp Frame\n",
- (tx)? "TX": "RX"));
+ CFGP2P_ACTION(("%s P2P Group Owner Negotiation Rsp Frame,"
+ " channel=%d\n", (tx)? "TX": "RX", channel));
break;
case P2P_PAF_GON_CONF:
- CFGP2P_ACTION(("%s P2P Group Owner Negotiation Confirm Frame\n",
- (tx)? "TX": "RX"));
+ CFGP2P_ACTION(("%s P2P Group Owner Negotiation Confirm Frame,"
+ " channel=%d\n", (tx)? "TX": "RX", channel));
break;
case P2P_PAF_INVITE_REQ:
- CFGP2P_ACTION(("%s P2P Invitation Request Frame\n",
- (tx)? "TX": "RX"));
+ CFGP2P_ACTION(("%s P2P Invitation Request Frame,"
+ " channel=%d\n", (tx)? "TX": "RX", channel));
break;
case P2P_PAF_INVITE_RSP:
- CFGP2P_ACTION(("%s P2P Invitation Response Frame\n",
- (tx)? "TX": "RX"));
+ CFGP2P_ACTION(("%s P2P Invitation Response Frame,"
+ " channel=%d\n", (tx)? "TX": "RX", channel));
break;
case P2P_PAF_DEVDIS_REQ:
- CFGP2P_ACTION(("%s P2P Device Discoverability Request Frame\n",
- (tx)? "TX": "RX"));
+ CFGP2P_ACTION(("%s P2P Device Discoverability Request Frame,"
+ " channel=%d\n", (tx)? "TX": "RX", channel));
break;
case P2P_PAF_DEVDIS_RSP:
- CFGP2P_ACTION(("%s P2P Device Discoverability Response Frame\n",
- (tx)? "TX": "RX"));
+ CFGP2P_ACTION(("%s P2P Device Discoverability Response Frame,"
+ " channel=%d\n", (tx)? "TX": "RX", channel));
break;
case P2P_PAF_PROVDIS_REQ:
- CFGP2P_ACTION(("%s P2P Provision Discovery Request Frame\n",
- (tx)? "TX": "RX"));
+ CFGP2P_ACTION(("%s P2P Provision Discovery Request Frame,"
+ " channel=%d\n", (tx)? "TX": "RX", channel));
break;
case P2P_PAF_PROVDIS_RSP:
- CFGP2P_ACTION(("%s P2P Provision Discovery Response Frame\n",
- (tx)? "TX": "RX"));
+ CFGP2P_ACTION(("%s P2P Provision Discovery Response Frame,"
+ " channel=%d\n", (tx)? "TX": "RX", channel));
break;
default:
- CFGP2P_ACTION(("%s Unknown P2P Public Action Frame\n",
- (tx)? "TX": "RX"));
+ CFGP2P_ACTION(("%s Unknown P2P Public Action Frame,"
+ " channel=%d\n", (tx)? "TX": "RX", channel));
}
act_frm = (wifi_p2p_action_frame_t *)frame;
switch (act_frm->subtype) {
case P2P_AF_NOTICE_OF_ABSENCE:
- CFGP2P_ACTION(("%s P2P Notice of Absence Frame\n",
- (tx)? "TX": "RX"));
+ CFGP2P_ACTION(("%s P2P Notice of Absence Frame,"
+ " channel=%d\n", (tx)? "TX": "RX", channel));
break;
case P2P_AF_PRESENCE_REQ:
- CFGP2P_ACTION(("%s P2P Presence Request Frame\n",
- (tx)? "TX": "RX"));
+ CFGP2P_ACTION(("%s P2P Presence Request Frame,"
+ " channel=%d\n", (tx)? "TX": "RX", channel));
break;
case P2P_AF_PRESENCE_RSP:
- CFGP2P_ACTION(("%s P2P Presence Response Frame\n",
- (tx)? "TX": "RX"));
+ CFGP2P_ACTION(("%s P2P Presence Response Frame,"
+ " channel=%d\n", (tx)? "TX": "RX", channel));
break;
case P2P_AF_GO_DISC_REQ:
- CFGP2P_ACTION(("%s P2P Discoverability Request Frame\n",
- (tx)? "TX": "RX"));
+ CFGP2P_ACTION(("%s P2P Discoverability Request Frame,"
+ " channel=%d\n", (tx)? "TX": "RX", channel));
break;
default:
- CFGP2P_ACTION(("%s Unknown P2P Action Frame\n",
- (tx)? "TX": "RX"));
+ CFGP2P_ACTION(("%s Unknown P2P Action Frame,"
+ " channel=%d\n", (tx)? "TX": "RX", channel));
}
} 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) {
case P2PSD_ACTION_ID_GAS_IREQ:
- CFGP2P_ACTION(("%s P2P GAS Initial Request\n",
- (tx)? "TX" : "RX"));
+ CFGP2P_ACTION(("%s P2P GAS Initial Request,"
+ " channel=%d\n", (tx)? "TX" : "RX", channel));
break;
case P2PSD_ACTION_ID_GAS_IRESP:
- CFGP2P_ACTION(("%s P2P GAS Initial Response\n",
- (tx)? "TX" : "RX"));
+ CFGP2P_ACTION(("%s P2P GAS Initial Response,"
+ " channel=%d\n", (tx)? "TX" : "RX", channel));
break;
case P2PSD_ACTION_ID_GAS_CREQ:
- CFGP2P_ACTION(("%s P2P GAS Comback Request\n",
- (tx)? "TX" : "RX"));
+ CFGP2P_ACTION(("%s P2P GAS Comback Request,"
+ " channel=%d\n", (tx)? "TX" : "RX", channel));
break;
case P2PSD_ACTION_ID_GAS_CRESP:
- CFGP2P_ACTION(("%s P2P GAS Comback Response\n",
- (tx)? "TX" : "RX"));
+ CFGP2P_ACTION(("%s P2P GAS Comback Response,"
+ " channel=%d\n", (tx)? "TX" : "RX", channel));
break;
default:
- CFGP2P_ACTION(("%s Unknown P2P GAS Frame\n",
- (tx)? "TX" : "RX"));
+ CFGP2P_ACTION(("%s Unknown P2P GAS Frame,"
+ " channel=%d\n", (tx)? "TX" : "RX", channel));
}
/* Disable a P2P BSS.
* Parameters:
- * @mac : MAC address of the BSS to create
+ * @mac : MAC address of the BSS to disable
* Returns 0 if success.
*/
s32
/* Delete a P2P BSS.
* Parameters:
- * @mac : MAC address of the BSS to create
+ * @mac : MAC address of the BSS to delete
* Returns 0 if success.
*/
s32
struct net_device *dev;
CFGP2P_DBG(("enter\n"));
- if (unlikely(bssidx == WL_INVALID || bssidx >= P2PAPI_BSSCFG_MAX)) {
+ if (unlikely(bssidx == WL_INVALID)) {
CFGP2P_ERR((" %d index out of range\n", bssidx));
return -1;
}
- dev = wl_to_p2p_bss_ndev(wl, bssidx);
+ dev = wl_cfgp2p_find_ndev(wl, bssidx);
if (unlikely(dev == NULL)) {
CFGP2P_ERR(("bssidx %d is not assigned\n", bssidx));
return BCME_NOTFOUND;
}
+#ifdef P2P_DISCOVERY_WAR
+ if (mode == WL_P2P_DISC_ST_LISTEN || mode == WL_P2P_DISC_ST_SEARCH) {
+ if (!wl->p2p->vif_created) {
+ if (wldev_iovar_setint(wl_to_prmry_ndev(wl), "mpc", 0) < 0) {
+ WL_ERR(("mpc disabling failed\n"));
+ }
+ }
+ }
+#endif
+
/* Put the WL driver into P2P Listen Mode to respond to P2P probe reqs */
discovery_mode.state = mode;
discovery_mode.chspec = wl_ch_host_to_driver(channel);
/* Do a scan abort to stop the driver's scan engine in case it is still
* waiting out an action frame tx dwell time.
*/
-#ifdef NOT_YET
- if (wl_get_p2p_status(wl, SCANNING)) {
- p2pwlu_scan_abort(hdl, FALSE);
- }
-#endif
wl_clr_p2p_status(wl, DISCOVERY_ON);
ret = wl_cfgp2p_deinit_discovery(wl);
s32
wl_cfgp2p_escan(struct wl_priv *wl, struct net_device *dev, u16 active,
u32 num_chans, u16 *channels,
- s32 search_state, u16 action, u32 bssidx)
+ s32 search_state, u16 action, u32 bssidx, struct ether_addr *tx_dst_addr)
{
s32 ret = BCME_OK;
s32 memsize;
else
eparams->params.scan_type = DOT11_SCANTYPE_PASSIVE;
- memcpy(&eparams->params.bssid, ðer_bcast, ETHER_ADDR_LEN);
+ if (tx_dst_addr == NULL)
+ memcpy(&eparams->params.bssid, ðer_bcast, ETHER_ADDR_LEN);
+ else
+ memcpy(&eparams->params.bssid, tx_dst_addr, ETHER_ADDR_LEN);
+
if (ssid.SSID_len)
memcpy(&eparams->params.ssid, &ssid, sizeof(wlc_ssid_t));
}
eparams->version = htod32(ESCAN_REQ_VERSION);
eparams->action = htod16(action);
-#if defined(CUSTOMER_HW4) && defined(DUAL_ESCAN_RESULT_BUFFER)
- eparams->sync_id = wl->escan_info.cur_sync_id;
-#else
- eparams->sync_id = htod16(0x1234);
-#endif /* CUSTOMER_HW4 && DUAL_ESCAN_RESULT_BUFFER */
+ wl_escan_set_sync_id(eparams->sync_id, wl);
CFGP2P_INFO(("SCAN CHANNELS : "));
for (i = 0; i < num_chans; i++) {
*/
s32
wl_cfgp2p_act_frm_search(struct wl_priv *wl, struct net_device *ndev,
- s32 bssidx, s32 channel)
+ s32 bssidx, s32 channel, struct ether_addr *tx_dst_addr)
{
s32 ret = 0;
u32 chan_cnt = 0;
if (!p2p_is_on(wl) || ndev == NULL || bssidx == WL_INVALID)
return -BCME_ERROR;
CFGP2P_ERR((" Enter\n"));
- if (bssidx == P2PAPI_BSSCFG_PRIMARY)
- bssidx = wl_to_p2p_bss_bssidx(wl, P2PAPI_BSSCFG_DEVICE);
+ if (bssidx == wl_to_p2p_bss_bssidx(wl, P2PAPI_BSSCFG_PRIMARY))
+ bssidx = wl_to_p2p_bss_bssidx(wl, P2PAPI_BSSCFG_DEVICE);
if (channel)
chan_cnt = AF_PEER_SEARCH_CNT;
else
}
ret = wl_cfgp2p_escan(wl, ndev, true, chan_cnt,
default_chan_list, WL_P2P_DISC_ST_SEARCH,
- WL_SCAN_ACTION_START, bssidx);
+ WL_SCAN_ACTION_START, bssidx, tx_dst_addr);
kfree(default_chan_list);
exit:
return ret;
#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. */
+#ifndef WFA_OUI_TYPE_WFD
#define WFA_OUI_TYPE_WFD 0x0a /* WiFi Display OUI TYPE */
+#endif
#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)
struct parsed_vndr_ies new_vndr_ies;
s32 i;
u8 *ptr;
+ s32 type = -1;
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;
CFGP2P_DBG((" bssidx %d, pktflag : 0x%02X\n", bssidx, pktflag));
if (wl->p2p != NULL) {
+ if (wl_cfgp2p_find_type(wl, bssidx, &type)) {
+ CFGP2P_ERR(("cannot find type from bssidx : %d\n", bssidx));
+ return BCME_ERROR;
+ }
+
switch (pktflag) {
case VNDR_IE_PRBREQ_FLAG :
- mgmt_ie_buf = IE_TYPE(probe_req, bssidx);
- mgmt_ie_len = &IE_TYPE_LEN(probe_req, bssidx);
- mgmt_ie_buf_len = sizeof(IE_TYPE(probe_req, bssidx));
+ mgmt_ie_buf = IE_TYPE(probe_req, type);
+ mgmt_ie_len = &IE_TYPE_LEN(probe_req, type);
+ mgmt_ie_buf_len = sizeof(IE_TYPE(probe_req, type));
break;
case VNDR_IE_PRBRSP_FLAG :
- mgmt_ie_buf = IE_TYPE(probe_res, bssidx);
- mgmt_ie_len = &IE_TYPE_LEN(probe_res, bssidx);
- mgmt_ie_buf_len = sizeof(IE_TYPE(probe_res, bssidx));
+ mgmt_ie_buf = IE_TYPE(probe_res, type);
+ mgmt_ie_len = &IE_TYPE_LEN(probe_res, type);
+ mgmt_ie_buf_len = sizeof(IE_TYPE(probe_res, type));
break;
case VNDR_IE_ASSOCREQ_FLAG :
- mgmt_ie_buf = IE_TYPE(assoc_req, bssidx);
- mgmt_ie_len = &IE_TYPE_LEN(assoc_req, bssidx);
- mgmt_ie_buf_len = sizeof(IE_TYPE(assoc_req, bssidx));
+ mgmt_ie_buf = IE_TYPE(assoc_req, type);
+ mgmt_ie_len = &IE_TYPE_LEN(assoc_req, type);
+ mgmt_ie_buf_len = sizeof(IE_TYPE(assoc_req, type));
break;
case VNDR_IE_ASSOCRSP_FLAG :
- mgmt_ie_buf = IE_TYPE(assoc_res, bssidx);
- mgmt_ie_len = &IE_TYPE_LEN(assoc_res, bssidx);
- mgmt_ie_buf_len = sizeof(IE_TYPE(assoc_res, bssidx));
+ mgmt_ie_buf = IE_TYPE(assoc_res, type);
+ mgmt_ie_len = &IE_TYPE_LEN(assoc_res, type);
+ mgmt_ie_buf_len = sizeof(IE_TYPE(assoc_res, type));
break;
case VNDR_IE_BEACON_FLAG :
- mgmt_ie_buf = IE_TYPE(beacon, bssidx);
- mgmt_ie_len = &IE_TYPE_LEN(beacon, bssidx);
- mgmt_ie_buf_len = sizeof(IE_TYPE(beacon, bssidx));
+ mgmt_ie_buf = IE_TYPE(beacon, type);
+ mgmt_ie_len = &IE_TYPE_LEN(beacon, type);
+ mgmt_ie_buf_len = sizeof(IE_TYPE(beacon, type));
break;
default:
mgmt_ie_buf = NULL;
mgmt_ie_len = NULL;
CFGP2P_ERR(("not suitable type\n"));
- return -1;
+ return BCME_ERROR;
}
} else if (wl_get_mode_by_netdev(wl, ndev) == WL_MODE_AP) {
switch (pktflag) {
mgmt_ie_buf = NULL;
mgmt_ie_len = NULL;
CFGP2P_ERR(("not suitable type\n"));
- return -1;
+ return BCME_ERROR;
}
bssidx = 0;
} else if (wl_get_mode_by_netdev(wl, ndev) == WL_MODE_BSS) {
mgmt_ie_buf = NULL;
mgmt_ie_len = NULL;
CFGP2P_ERR(("not suitable type\n"));
- return -1;
+ return BCME_ERROR;
}
bssidx = 0;
} else {
CFGP2P_ERR(("not suitable type\n"));
- return -1;
+ return BCME_ERROR;
}
if (vndr_ie_len > mgmt_ie_buf_len) {
vndrie_info->vndrie.oui[2]));
del_add_ie_buf_len = wl_cfgp2p_vndr_ie(wl, curr_ie_buf,
- bssidx, pktflag, vndrie_info->vndrie.oui,
+ 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,
vndrie_info->vndrie.oui[2]));
del_add_ie_buf_len = wl_cfgp2p_vndr_ie(wl, curr_ie_buf,
- bssidx, pktflag, vndrie_info->vndrie.oui,
+ 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,
s32 vndrie_flag[] = {VNDR_IE_BEACON_FLAG, VNDR_IE_PRBRSP_FLAG, VNDR_IE_ASSOCRSP_FLAG,
VNDR_IE_PRBREQ_FLAG, VNDR_IE_ASSOCREQ_FLAG};
s32 index = -1;
+ s32 type = -1;
struct net_device *ndev = wl_cfgp2p_find_ndev(wl, bssidx);
#define INIT_IE(IE_TYPE, BSS_TYPE) \
do { \
CFGP2P_ERR(("invalid %s\n", (bssidx < 0) ? "bssidx" : "ndev"));
return BCME_BADARG;
}
+
+ if (wl_cfgp2p_find_type(wl, bssidx, &type)) {
+ CFGP2P_ERR(("invalid argument\n"));
+ return BCME_BADARG;
+ }
for (index = 0; index < ARRAYSIZE(vndrie_flag); index++) {
/* clean up vndr ies in dongle */
wl_cfgp2p_set_management_ie(wl, ndev, bssidx, vndrie_flag[index], NULL, 0);
}
- INIT_IE(probe_req, bssidx);
- INIT_IE(probe_res, bssidx);
- INIT_IE(assoc_req, bssidx);
- INIT_IE(assoc_res, bssidx);
- INIT_IE(beacon, bssidx);
+ INIT_IE(probe_req, type);
+ INIT_IE(probe_res, type);
+ INIT_IE(assoc_req, type);
+ INIT_IE(assoc_res, type);
+ INIT_IE(beacon, type);
return BCME_OK;
}
return NULL;
}
static u32
-wl_cfgp2p_vndr_ie(struct wl_priv *wl, u8 *iebuf, s32 bssidx, s32 pktflag,
+wl_cfgp2p_vndr_ie(struct wl_priv *wl, u8 *iebuf, s32 pktflag,
s8 *oui, s32 ie_id, s8 *data, s32 datalen, const s8* add_del_cmd)
{
vndr_ie_setbuf_t hdr; /* aligned temporary vndr_ie buffer header */
* Parameters:
* @wl : wl_private data
* @ndev : net device to search bssidx
- * Returns bssidx for ndev
+ * @bssidx : output arg to store bssidx of the bsscfg of firmware.
+ * Returns error
*/
s32
-wl_cfgp2p_find_idx(struct wl_priv *wl, struct net_device *ndev, s32 *index)
+wl_cfgp2p_find_idx(struct wl_priv *wl, struct net_device *ndev, s32 *bssidx)
{
u32 i;
- *index = WL_INVALID;
-
- if (ndev == NULL) {
- CFGP2P_ERR((" ndev is NULL\n"));
+ if (ndev == NULL || bssidx == NULL) {
+ CFGP2P_ERR((" argument is invalid\n"));
return BCME_BADARG;
}
if (!wl->p2p_supported) {
- *index = P2PAPI_BSSCFG_PRIMARY;
+ *bssidx = P2PAPI_BSSCFG_PRIMARY;
return BCME_OK;
}
+ /* we cannot find the bssidx of DISCOVERY BSS
+ * because the ndev is same with ndev of PRIMARY BSS.
+ */
for (i = 0; i < P2PAPI_BSSCFG_MAX; i++) {
if (ndev == wl_to_p2p_bss_ndev(wl, i)) {
- *index = wl_to_p2p_bss_bssidx(wl, i);
+ *bssidx = wl_to_p2p_bss_bssidx(wl, i);
return BCME_OK;
}
}
exit:
return ndev;
}
+/*
+ * Search the driver array idx based on bssidx argument
+ * Parameters:
+ * @wl : wl_private data
+ * @bssidx : bssidx which indicate bsscfg->idx of firmware.
+ * @type : output arg to store array idx of p2p->bss.
+ * Returns error
+ */
+
+s32
+wl_cfgp2p_find_type(struct wl_priv *wl, s32 bssidx, s32 *type)
+{
+ u32 i;
+ if (bssidx < 0 || type == NULL) {
+ CFGP2P_ERR((" argument is invalid\n"));
+ goto exit;
+ }
+
+ for (i = 0; i < P2PAPI_BSSCFG_MAX; i++) {
+ if (bssidx == wl_to_p2p_bss_bssidx(wl, i)) {
+ *type = i;
+ return BCME_OK;
+ }
+ }
+
+exit:
+ return BCME_BADARG;
+}
/*
* Callback function for WLC_E_P2P_DISC_LISTEN_COMPLETE
*/
s32
-wl_cfgp2p_listen_complete(struct wl_priv *wl, struct net_device *ndev,
- const wl_event_msg_t *e, void *data)
+wl_cfgp2p_listen_complete(struct wl_priv *wl, bcm_struct_cfgdev *cfgdev,
+ const wl_event_msg_t *e, void *data)
{
s32 ret = BCME_OK;
- struct net_device *netdev;
+ struct net_device *ndev = NULL;
+
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"));
+
+ ndev = cfgdev_to_wlc_ndev(cfgdev, wl);
+
+#ifdef P2P_DISCOVERY_WAR
+ if (!wl->p2p->vif_created) {
+ if (wldev_iovar_setint(ndev, "mpc", 1) < 0) {
+ WL_ERR(("mpc enabling back failed\n"));
+ }
+ }
+#endif
+
if (wl_get_p2p_status(wl, LISTEN_EXPIRED) == 0) {
wl_set_p2p_status(wl, LISTEN_EXPIRED);
if (timer_pending(&wl->p2p->listen_timer)) {
}
#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_clr_drv_status(wl, WAITING_NEXT_ACT_FRM_LISTEN, ndev);
WL_DBG(("Listen DONE and wake up wait_next_af !!(%d)\n",
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, netdev);
+ wl_clr_drv_status(wl, WAITING_NEXT_ACT_FRM, ndev);
complete(&wl->wait_next_af);
}
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, netdev);
+ wl_clr_drv_status(wl, REMAINING_ON_CHANNEL, ndev);
#ifdef WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST
- wl_clr_drv_status(wl, FAKE_REMAINING_ON_CHANNEL, netdev);
+ wl_clr_drv_status(wl, FAKE_REMAINING_ON_CHANNEL, ndev);
#endif /* WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST */
if (ndev && (ndev->ieee80211_ptr != NULL)) {
- cfg80211_remain_on_channel_expired(ndev, wl->last_roc_id,
+ cfg80211_remain_on_channel_expired(cfgdev, wl->last_roc_id,
&wl->remain_on_chan, wl->remain_on_chan_type, GFP_KERNEL);
}
}
CFGP2P_DBG((" Enter\n"));
bzero(&msg, sizeof(wl_event_msg_t));
msg.event_type = hton32(WLC_E_P2P_DISC_LISTEN_COMPLETE);
+#if defined(WL_ENABLE_P2P_IF)
wl_cfg80211_event(wl->p2p_net ? wl->p2p_net :
wl_to_p2p_bss_ndev(wl, P2PAPI_BSSCFG_DEVICE), &msg, NULL);
+#else
+ wl_cfg80211_event(wl_to_p2p_bss_ndev(wl, P2PAPI_BSSCFG_DEVICE), &msg,
+ NULL);
+#endif /* WL_ENABLE_P2P_IF */
}
/*
* Routine for cancelling the P2P LISTEN
*/
static s32
wl_cfgp2p_cancel_listen(struct wl_priv *wl, struct net_device *ndev,
- bool notify)
+ struct wireless_dev *wdev, 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);
+ &wl->remain_on_chan, wl->remain_on_chan_type, GFP_KERNEL);
}
}
return 0;
* Callback function for WLC_E_ACTION_FRAME_COMPLETE, WLC_E_ACTION_FRAME_OFF_CHAN_COMPLETE
*/
s32
-wl_cfgp2p_action_tx_complete(struct wl_priv *wl, struct net_device *ndev,
+wl_cfgp2p_action_tx_complete(struct wl_priv *wl, bcm_struct_cfgdev *cfgdev,
const wl_event_msg_t *e, void *data)
{
s32 ret = BCME_OK;
u32 event_type = ntoh32(e->event_type);
u32 status = ntoh32(e->status);
CFGP2P_DBG((" Enter\n"));
- if (event_type == WLC_E_ACTION_FRAME_COMPLETE) {
+ if (wl_get_drv_status_all(wl, SENDING_ACT_FRM)) {
+ if (event_type == WLC_E_ACTION_FRAME_COMPLETE) {
- CFGP2P_INFO((" WLC_E_ACTION_FRAME_COMPLETE is received : %d\n", status));
- if (status == WLC_E_STATUS_SUCCESS) {
- wl_set_p2p_status(wl, ACTION_TX_COMPLETED);
- CFGP2P_DBG(("WLC_E_ACTION_FRAME_COMPLETE : ACK\n"));
- }
- else {
- wl_set_p2p_status(wl, ACTION_TX_NOACK);
- 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,"
- "status : %d\n", status));
+ CFGP2P_INFO((" WLC_E_ACTION_FRAME_COMPLETE is received : %d\n", status));
+ if (status == WLC_E_STATUS_SUCCESS) {
+ wl_set_p2p_status(wl, ACTION_TX_COMPLETED);
+ CFGP2P_DBG(("WLC_E_ACTION_FRAME_COMPLETE : ACK\n"));
+ }
+ else {
+ if (!wl_get_p2p_status(wl, ACTION_TX_COMPLETED)) {
+ wl_set_p2p_status(wl, ACTION_TX_NOACK);
+ CFGP2P_INFO(("WLC_E_ACTION_FRAME_COMPLETE : NO ACK\n"));
+ wl_stop_wait_next_action_frame(wl);
+ }
+ }
+ } else {
+ CFGP2P_INFO((" WLC_E_ACTION_FRAME_OFFCHAN_COMPLETE is received,"
+ "status : %d\n", status));
- if (wl_get_drv_status_all(wl, SENDING_ACT_FRM))
- complete(&wl->send_af_done);
+ if (wl_get_drv_status_all(wl, SENDING_ACT_FRM))
+ complete(&wl->send_af_done);
+ }
}
return ret;
}
{
s32 ret = BCME_OK;
s32 timeout = 0;
+ wl_eventmsg_buf_t buf;
CFGP2P_INFO(("\n"));
wl_clr_p2p_status(wl, ACTION_TX_COMPLETED);
wl_clr_p2p_status(wl, ACTION_TX_NOACK);
-#define MAX_WAIT_TIME 2000
+
+ bzero(&buf, sizeof(wl_eventmsg_buf_t));
+ wl_cfg80211_add_to_eventbuffer(&buf, WLC_E_ACTION_FRAME_OFF_CHAN_COMPLETE, true);
+ wl_cfg80211_add_to_eventbuffer(&buf, WLC_E_ACTION_FRAME_COMPLETE, true);
+ if ((ret = wl_cfg80211_apply_eventbuffer(wl_to_prmry_ndev(wl), wl, &buf)) < 0)
+ return ret;
+
if (bssidx == P2PAPI_BSSCFG_PRIMARY)
bssidx = wl_to_p2p_bss_bssidx(wl, P2PAPI_BSSCFG_DEVICE);
wl->ioctl_buf, WLC_IOCTL_MAXLEN, bssidx, &wl->ioctl_buf_sync);
if (ret < 0) {
-
CFGP2P_ERR((" sending action frame is failed\n"));
goto exit;
}
- timeout = wait_for_completion_timeout(&wl->send_af_done, msecs_to_jiffies(MAX_WAIT_TIME));
+ timeout = wait_for_completion_timeout(&wl->send_af_done,
+ msecs_to_jiffies(af_params->dwell_time + WL_AF_TX_EXTRA_TIME_MAX));
if (timeout > 0 && wl_get_p2p_status(wl, ACTION_TX_COMPLETED)) {
CFGP2P_INFO(("tx action frame operation is completed\n"));
exit:
CFGP2P_INFO((" via act frame iovar : status = %d\n", ret));
-#undef MAX_WAIT_TIME
+
+ bzero(&buf, sizeof(wl_eventmsg_buf_t));
+ wl_cfg80211_add_to_eventbuffer(&buf, WLC_E_ACTION_FRAME_OFF_CHAN_COMPLETE, false);
+ wl_cfg80211_add_to_eventbuffer(&buf, WLC_E_ACTION_FRAME_COMPLETE, false);
+ if ((ret = wl_cfg80211_apply_eventbuffer(wl_to_prmry_ndev(wl), wl, &buf)) < 0)
+ WL_ERR(("TX frame events revert back failed \n"));
+
return ret;
}
s32
wl_cfgp2p_down(struct wl_priv *wl)
{
+ struct net_device *ndev = NULL;
+ struct wireless_dev *wdev = NULL;
s32 i = 0, index = -1;
- wl_cfgp2p_cancel_listen(wl,
- wl->p2p_net ? wl->p2p_net : wl_to_prmry_ndev(wl), TRUE);
+
+#if defined(WL_ENABLE_P2P_IF)
+ ndev = wl->p2p_net ? wl->p2p_net : wl_to_prmry_ndev(wl);
+ wdev = ndev_to_wdev(ndev);
+#endif
+
+ wl_cfgp2p_cancel_listen(wl, ndev, wdev, TRUE);
for (i = 0; i < P2PAPI_BSSCFG_MAX; i++) {
index = wl_to_p2p_bss_bssidx(wl, i);
if (index != WL_INVALID)
}
if ((legacy_ps != -1) && ((legacy_ps == PM_MAX) || (legacy_ps == PM_OFF))) {
+#if defined(SUPPORT_PM2_ONLY)
+ if (legacy_ps == PM_MAX)
+ legacy_ps = PM_FAST;
+#endif /* SUPPORT_PM2_ONLY */
+
ret = wldev_ioctl(wl_to_p2p_bss_ndev(wl, P2PAPI_BSSCFG_CONNECTION),
WLC_SET_PM, &legacy_ps, sizeof(legacy_ps), true);
if (unlikely(ret)) {
CFGP2P_ERR(("error (%d)\n", ret));
+ } else {
+ wl_cfg80211_update_power_mode(ndev);
}
}
else
}
#define P2P_GROUP_CAPAB_GO_BIT 0x01
+
+u8*
+wl_cfgp2p_find_attrib_in_all_p2p_Ies(u8 *parse, u32 len, u32 attrib)
+{
+ bcm_tlv_t *ie;
+ u8* pAttrib;
+
+ CFGP2P_INFO(("Starting parsing parse %p attrib %d remaining len %d ", parse, attrib, len));
+ while ((ie = bcm_parse_tlvs(parse, (int)len, DOT11_MNG_VS_ID))) {
+ if (wl_cfgp2p_is_p2p_ie((uint8*)ie, &parse, &len) == TRUE) {
+ /* Have the P2p ie. Now check for attribute */
+ if ((pAttrib = wl_cfgp2p_retreive_p2pattrib(parse, attrib)) != NULL) {
+ CFGP2P_INFO(("P2P attribute %d was found at parse %p",
+ attrib, parse));
+ return pAttrib;
+ }
+ else {
+ parse += (ie->len + TLV_HDR_LEN);
+ len -= (ie->len + TLV_HDR_LEN);
+ CFGP2P_INFO(("P2P Attribute %d not found Moving parse"
+ " to %p len to %d", attrib, parse, len));
+ }
+ }
+ else {
+ /* It was not p2p IE. parse will get updated automatically to next TLV */
+ CFGP2P_INFO(("IT was NOT P2P IE parse %p len %d", parse, len));
+ }
+ }
+ CFGP2P_ERR(("P2P attribute %d was NOT found", attrib));
+ return NULL;
+}
+
u8 *
wl_cfgp2p_retreive_p2p_dev_addr(wl_bss_info_t *bi, u32 bi_length)
{
- wifi_p2p_ie_t * p2p_ie = NULL;
u8 *capability = NULL;
bool p2p_go = 0;
u8 *ptr = NULL;
- if (!(p2p_ie = wl_cfgp2p_find_p2pie(((u8 *) bi) + bi->ie_offset, bi->ie_length))) {
- WL_ERR(("P2P IE not found"));
- return NULL;
- }
-
- if (!(capability = wl_cfgp2p_retreive_p2pattrib(p2p_ie, P2P_SEID_P2P_INFO))) {
+ if ((capability = wl_cfgp2p_find_attrib_in_all_p2p_Ies(((u8 *) bi) + bi->ie_offset,
+ bi->ie_length, P2P_SEID_P2P_INFO)) == NULL) {
WL_ERR(("P2P Capability attribute not found"));
return NULL;
}
}
/* In probe responses, DEVICE INFO attribute will be present */
- if (!(ptr = wl_cfgp2p_retreive_p2pattrib(p2p_ie, P2P_SEID_DEV_INFO))) {
+ if (!(ptr = wl_cfgp2p_find_attrib_in_all_p2p_Ies(((u8 *) bi) + bi->ie_offset,
+ bi->ie_length, P2P_SEID_DEV_INFO))) {
/* If DEVICE_INFO is not found, this might be a beacon frame.
* check for DEVICE_ID in the beacon frame.
*/
- ptr = wl_cfgp2p_retreive_p2pattrib(p2p_ie, P2P_SEID_DEV_ID);
+ ptr = wl_cfgp2p_find_attrib_in_all_p2p_Ies(((u8 *) bi) + bi->ie_offset,
+ bi->ie_length, P2P_SEID_DEV_ID);
}
if (!ptr)
};
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) */
+#if defined(WL_ENABLE_P2P_IF)
s32
wl_cfgp2p_register_ndev(struct wl_priv *wl)
{
}
static int wl_cfgp2p_start_xmit(struct sk_buff *skb, struct net_device *ndev)
{
- CFGP2P_DBG(("(%s) is not used for data operations. Droping the packet. \n", ndev->name));
+
+ if (skb)
+ {
+ CFGP2P_DBG(("(%s) is not used for data operations.Droping the packet.\n",
+ ndev->name));
+ dev_kfree_skb_any(skb);
+ }
+
return 0;
}
{
return (if_ops == &wl_cfgp2p_if_ops);
}
+#endif /* WL_ENABLE_P2P_IF */
/*
* Linux cfgp2p driver
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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 368092 2012-11-12 04:28:36Z $
+ * $Id: wl_cfgp2p.h 401719 2013-05-13 12:47:24Z $
*/
#ifndef _wl_cfgp2p_h_
#define _wl_cfgp2p_h_
struct p2p_info {
bool on; /* p2p on/off switch */
bool scan;
+ int16 search_state;
bool vif_created;
s8 vir_ifname[IFNAMSIZ];
unsigned long status;
struct ether_addr dev_addr;
struct ether_addr int_addr;
- struct p2p_bss bss_idx[P2PAPI_BSSCFG_MAX];
+ struct p2p_bss bss[P2PAPI_BSSCFG_MAX];
struct timer_list listen_timer;
wl_p2p_sched_t noa;
wl_p2p_ops_t ops;
};
-#define wl_to_p2p_bss_ndev(wl, type) ((wl)->p2p->bss_idx[type].dev)
-#define wl_to_p2p_bss_bssidx(wl, type) ((wl)->p2p->bss_idx[type].bssidx)
-#define wl_to_p2p_bss_saved_ie(wl, type) ((wl)->p2p->bss_idx[type].saved_ie)
-#define wl_to_p2p_bss_private(wl, type) ((wl)->p2p->bss_idx[type].private_data)
-#define wl_to_p2p_bss(wl, type) ((wl)->p2p->bss_idx[type])
+#define wl_to_p2p_bss_ndev(wl, type) ((wl)->p2p->bss[type].dev)
+#define wl_to_p2p_bss_bssidx(wl, type) ((wl)->p2p->bss[type].bssidx)
+#define wl_to_p2p_bss_saved_ie(wl, type) ((wl)->p2p->bss[type].saved_ie)
+#define wl_to_p2p_bss_private(wl, type) ((wl)->p2p->bss[type].private_data)
+#define wl_to_p2p_bss(wl, type) ((wl)->p2p->bss[type])
#define wl_get_p2p_status(wl, stat) ((!(wl)->p2p_supported) ? 0 : test_bit(WLP2P_STATUS_ ## stat, \
&(wl)->p2p->status))
#define wl_set_p2p_status(wl, stat) ((!(wl)->p2p_supported) ? 0 : set_bit(WLP2P_STATUS_ ## stat, \
/* dword align allocation */
#define WLC_IOCTL_MAXLEN 8192
-#ifdef CUSTOMER_HW4
-#define CFGP2P_ERROR_TEXT "CFGP2P-INFO2) "
-#else
#define CFGP2P_ERROR_TEXT "CFGP2P-ERROR) "
-#endif
#define CFGP2P_ERR(args) \
timer->data = (unsigned long) wl; \
add_timer(timer); \
} while (0);
+
+#if !0 && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0))
+#define WL_CFG80211_P2P_DEV_IF
+#endif
+
+#if defined(WL_ENABLE_P2P_IF) && (0 || (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)))
+#error Disable 'WL_ENABLE_P2P_IF', if 'WL_CFG80211_P2P_DEV_IF' is enabled \
+ or kernel version is 3.8.0 or above
+#endif
+
+#if !defined(WLP2P) && defined(WL_ENABLE_P2P_IF)
+#error WLP2P not defined
+#endif
+
+#define bcm_struct_cfgdev struct net_device
+
extern void
wl_cfgp2p_listen_expired(unsigned long data);
extern bool
extern bool
wl_cfgp2p_is_gas_action(void *frame, u32 frame_len);
extern void
-wl_cfgp2p_print_actframe(bool tx, void *frame, u32 frame_len);
+wl_cfgp2p_print_actframe(bool tx, void *frame, u32 frame_len, u32 channel);
extern s32
wl_cfgp2p_init_priv(struct wl_priv *wl);
extern void
extern s32
wl_cfgp2p_escan(struct wl_priv *wl, struct net_device *dev, u16 active, u32 num_chans,
u16 *channels,
- s32 search_state, u16 action, u32 bssidx);
+ s32 search_state, u16 action, u32 bssidx, struct ether_addr *tx_dst_addr);
extern s32
wl_cfgp2p_act_frm_search(struct wl_priv *wl, struct net_device *ndev,
- s32 bssidx, s32 channel);
+ s32 bssidx, s32 channel, struct ether_addr *tx_dst_addr);
extern wpa_ie_fixed_t *
wl_cfgp2p_find_wpaie(u8 *parse, u32 len);
wl_cfgp2p_find_idx(struct wl_priv *wl, struct net_device *ndev, s32 *index);
extern struct net_device *
wl_cfgp2p_find_ndev(struct wl_priv *wl, s32 bssidx);
+extern s32
+wl_cfgp2p_find_type(struct wl_priv *wl, s32 bssidx, s32 *type);
+
extern s32
-wl_cfgp2p_listen_complete(struct wl_priv *wl, struct net_device *ndev,
- const wl_event_msg_t *e, void *data);
+wl_cfgp2p_listen_complete(struct wl_priv *wl, bcm_struct_cfgdev *cfgdev,
+ const wl_event_msg_t *e, void *data);
extern s32
wl_cfgp2p_discover_listen(struct wl_priv *wl, s32 channel, u32 duration_ms);
wl_cfgp2p_discover_enable_search(struct wl_priv *wl, u8 enable);
extern s32
-wl_cfgp2p_action_tx_complete(struct wl_priv *wl, struct net_device *ndev,
- const wl_event_msg_t *e, void *data);
+wl_cfgp2p_action_tx_complete(struct wl_priv *wl, bcm_struct_cfgdev *cfgdev,
+ const wl_event_msg_t *e, void *data);
+
extern s32
wl_cfgp2p_tx_action_frame(struct wl_priv *wl, struct net_device *dev,
wl_af_params_t *af_params, s32 bssidx);
extern u8 *
wl_cfgp2p_retreive_p2pattrib(void *buf, u8 element_id);
+extern u8*
+wl_cfgp2p_find_attrib_in_all_p2p_Ies(u8 *parse, u32 len, u32 attrib);
+
extern u8 *
wl_cfgp2p_retreive_p2p_dev_addr(wl_bss_info_t *bi, u32 bi_length);
extern bool
wl_cfgp2p_is_ifops(const struct net_device_ops *if_ops);
+
/* WiFi Direct */
#define SOCIAL_CHAN_1 1
#define SOCIAL_CHAN_2 6
#define WL_P2P_TEMP_CHAN 11
/* If the provision discovery is for JOIN operations,
+ * or the device discoverablity frame is destined to GO
* then we need not do an internal scan to find GO.
-*/
-#define IS_PROV_DISC_WITHOUT_GROUP_ID(p2p_ie, len) \
+ */
+#define IS_ACTPUB_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, 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) || \
* Minimal debug/trace/assert driver definitions for
* Broadcom 802.11 Networking Adapter.
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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 357993 2012-09-20 21:58:56Z $
+ * $Id: wl_dbg.h 376019 2012-12-21 01:00:06Z $
*/
#ifndef _wl_dbg_h_
#define _wl_dbg_h_
-
+/* wl_msg_level is a bit vector with defs in wlioctl.h */
extern uint32 wl_msg_level;
extern uint32 wl_msg_level2;
#endif
-
+/* To disable a message completely ... until you need it again */
#define WL_NONE(args)
#define WL_ERROR(args)
extern uint32 wl_msg_level;
extern uint32 wl_msg_level2;
-#endif
+#endif /* _wl_dbg_h_ */
/*
* Linux Wireless Extensions support
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* 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 367054 2012-11-06 15:06:04Z $
+ * $Id: wl_iw.c 396420 2013-04-12 06:55:45Z $
*/
#if defined(USE_IW)
#include <linux/if_arp.h>
#include <asm/uaccess.h>
-
typedef const struct si_pub si_t;
#include <wlioctl.h>
#include <wl_dbg.h>
#include <wl_iw.h>
-#ifdef BCMWAPI_WPI
-
-#ifndef IW_ENCODE_ALG_SM4
-#define IW_ENCODE_ALG_SM4 0x20
-#endif
-
-#ifndef IW_AUTH_WAPI_ENABLED
-#define IW_AUTH_WAPI_ENABLED 0x20
-#endif
-
-#ifndef IW_AUTH_WAPI_VERSION_1
-#define IW_AUTH_WAPI_VERSION_1 0x00000008
-#endif
-
-#ifndef IW_AUTH_CIPHER_SMS4
-#define IW_AUTH_CIPHER_SMS4 0x00000020
-#endif
-
-#ifndef IW_AUTH_KEY_MGMT_WAPI_PSK
-#define IW_AUTH_KEY_MGMT_WAPI_PSK 4
-#endif
-
-#ifndef IW_AUTH_KEY_MGMT_WAPI_CERT
-#define IW_AUTH_KEY_MGMT_WAPI_CERT 8
-#endif
-#endif
-
+/* Broadcom extensions to WEXT, linux upstream has obsoleted WEXT */
#ifndef IW_AUTH_KEY_MGMT_FT_802_1X
#define IW_AUTH_KEY_MGMT_FT_802_1X 0x04
#endif
#define IW_AUTH_KEY_MGMT_FT_PSK 0x08
#endif
+#ifndef IW_ENC_CAPA_FW_ROAM_ENABLE
+#define IW_ENC_CAPA_FW_ROAM_ENABLE 0x00000020
+#endif
+
+/* FC9: wireless.h 2.6.25-14.fc9.i686 is missing these, even though WIRELESS_EXT is set to latest
+ * version 22.
+ */
#ifndef IW_ENCODE_ALG_PMK
#define IW_ENCODE_ALG_PMK 4
#endif
#ifndef IW_ENC_CAPA_4WAY_HANDSHAKE
#define IW_ENC_CAPA_4WAY_HANDSHAKE 0x00000010
#endif
-
+/* End FC9. */
#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; /* apsta AP netdev waiter thread */
+#endif /* SOFTAP */
extern bool wl_iw_conn_status_str(uint32 event_type, uint32 status,
uint32 reason, char* stringBuf, uint buflen);
#define MAX_WLIW_IOCTL_LEN 1024
-
+/* IOCTL swapping mode for Big Endian host with Little Endian dongle. Default to off */
#define htod32(i) i
#define htod16(i) i
#define dtoh32(i) i
#if WIRELESS_EXT < 19
#define IW_IOCTL_IDX(cmd) ((cmd) - SIOCIWFIRST)
#define IW_EVENT_IDX(cmd) ((cmd) - IWEVFIRST)
-#endif
+#endif /* WIRELESS_EXT < 19 */
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0))
+#define DAEMONIZE(a)
+#elif ((LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)) && \
+ (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)))
#define DAEMONIZE(a) daemonize(a); \
allow_signal(SIGKILL); \
allow_signal(SIGTERM);
-#else
+#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
+#endif /* LINUX_VERSION_CODE */
#define ISCAN_STATE_IDLE 0
#define ISCAN_STATE_SCANING 1
-
+/* the buf lengh can be WLC_IOCTL_MAXLEN (8K) to reduce iteration */
#define WLC_IW_ISCAN_MAXLEN 2048
typedef struct iscan_buf {
struct iscan_buf * next;
iscan_buf_t * list_hdr;
iscan_buf_t * list_cur;
-
+ /* Thread to work on iscan */
long sysioc_pid;
struct semaphore sysioc_sem;
struct completion sysioc_exited;
static void wl_iw_set_event_mask(struct net_device *dev);
static int wl_iw_iscan(iscan_info_t *iscan, wlc_ssid_t *ssid, uint16 action);
-
+/* priv_link becomes netdev->priv and is the link between netdev and wlif struct */
typedef struct priv_link {
wl_iw_t *wliw;
} priv_link_t;
-
+/* dev to priv_link */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24))
#define WL_DEV_LINK(dev) (priv_link_t*)(dev->priv)
#else
#define WL_DEV_LINK(dev) (priv_link_t*)netdev_priv(dev)
#endif
-
+/* dev to wl_iw_t */
#define IW_DEV_IF(dev) ((wl_iw_t*)(WL_DEV_LINK(dev))->wliw)
static void swap_key_from_BE(
ifr.ifr_data = (caddr_t) &ioc;
#ifndef LINUX_HYBRID
-
+ /* Causes an extraneous 'up'. If specific ioctls are failing due
+ to device down, then we can investigate those ioctls.
+ */
dev_open(dev);
#endif
return ret;
}
-
+/*
+set named driver variable to int value and return error indication
+calling example: dev_wlc_intvar_set(dev, "arate", rate)
+*/
static int
dev_wlc_intvar_set(
kfree(ioctlbuf);
return error;
}
-#endif
-
+#endif /* WIRELESS_EXT > 17 */
+/*
+get named driver variable to int value and return error indication
+calling example: dev_wlc_bufvar_get(dev, "arate", &rate)
+*/
static int
dev_wlc_bufvar_get(
return (error);
}
-
+/*
+get named driver variable to int value and return error indication
+calling example: dev_wlc_intvar_get(dev, "arate", &rate)
+*/
static int
dev_wlc_intvar_get(
return (error);
}
-
+/* Maintain backward compatibility */
#if WIRELESS_EXT < 13
struct iw_request_info
{
- __u16 cmd;
- __u16 flags;
+ __u16 cmd; /* Wireless Extension command */
+ __u16 flags; /* More to come ;-) */
};
typedef int (*iw_handler)(struct net_device *dev, struct iw_request_info *info,
void *wrqu, char *extra);
-#endif
+#endif /* WIRELESS_EXT < 13 */
#if WIRELESS_EXT > 12
static int
error = dev_wlc_ioctl(dev, WLC_SET_PM, &pm, sizeof(pm));
return error;
}
-#endif
+
+#if WIRELESS_EXT > 17
+#endif /* WIRELESS_EXT > 17 */
+#endif /* WIRELESS_EXT > 12 */
int
wl_iw_send_priv_event(
WL_TRACE(("%s: SIOCSIWFREQ\n", dev->name));
-
+ /* Setting by channel number */
if (fwrq->e == 0 && fwrq->m < MAXCHANNEL) {
chan = fwrq->m;
}
-
+ /* Setting by frequency */
else {
-
+ /* Convert to MHz as best we can */
if (fwrq->e >= 6) {
fwrq->e -= 6;
while (fwrq->e--)
while (fwrq->e++ < 6)
fwrq->m /= 10;
}
-
+ /* handle 4.9GHz frequencies as Japan 4 GHz based channelization */
if (fwrq->m > 4000 && fwrq->m < 5000)
- sf = WF_CHAN_FACTOR_4_G;
+ sf = WF_CHAN_FACTOR_4_G; /* start factor for 4 GHz */
chan = wf_mhz2channel(fwrq->m, sf);
}
if ((error = dev_wlc_ioctl(dev, WLC_SET_CHANNEL, &chan, sizeof(chan))))
return error;
-
+ /* -EINPROGRESS: Call commit handler */
return -EINPROGRESS;
}
if ((error = dev_wlc_ioctl(dev, WLC_GET_CHANNEL, &ci, sizeof(ci))))
return error;
-
+ /* Return radio channel in channel form */
fwrq->m = dtoh32(ci.hw_channel);
fwrq->e = dtoh32(0);
return 0;
(error = dev_wlc_ioctl(dev, WLC_SET_AP, &ap, sizeof(ap))))
return error;
-
+ /* -EINPROGRESS: Call commit handler */
return -EINPROGRESS;
}
dwrq->length = sizeof(struct iw_range);
memset(range, 0, sizeof(*range));
-
+ /* We don't use nwids */
range->min_nwid = range->max_nwid = 0;
-
+ /* Set available channels/frequencies */
list->count = htod32(MAXCHANNEL);
if ((error = dev_wlc_ioctl(dev, WLC_GET_VALID_CHANNELS, channels, sizeof(channels))))
return error;
}
range->num_frequency = range->num_channels = i;
-
+ /* Link quality (use NDIS cutoffs) */
range->max_qual.qual = 5;
-
- range->max_qual.level = 0x100 - 200;
-
- range->max_qual.noise = 0x100 - 200;
-
+ /* Signal level (use RSSI) */
+ range->max_qual.level = 0x100 - 200; /* -200 dBm */
+ /* Noise level (use noise) */
+ range->max_qual.noise = 0x100 - 200; /* -200 dBm */
+ /* Signal level threshold range (?) */
range->sensitivity = 65535;
#if WIRELESS_EXT > 11
-
+ /* Link quality (use NDIS cutoffs) */
range->avg_qual.qual = 3;
-
+ /* Signal level (use RSSI) */
range->avg_qual.level = 0x100 + WL_IW_RSSI_GOOD;
-
- range->avg_qual.noise = 0x100 - 75;
-#endif
+ /* Noise level (use noise) */
+ range->avg_qual.noise = 0x100 - 75; /* -75 dBm */
+#endif /* WIRELESS_EXT > 11 */
-
+ /* Set available bitrates */
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; /* convert to bps */
if ((error = dev_wlc_intvar_get(dev, "nmode", &nmode)))
return error;
if ((error = dev_wlc_ioctl(dev, WLC_GET_PHYTYPE, &phytype, sizeof(phytype))))
nrate_list2copy = 3;
}
range->num_bitrates += 8;
+ ASSERT(range->num_bitrates < IW_MAX_BITRATES);
for (k = 0; i < range->num_bitrates; k++, i++) {
-
+ /* convert to bps */
range->bitrate[i] = (nrate_list[nrate_list2copy][k]) * 500000;
}
}
-
+ /* Set an indication of the max TCP throughput
+ * in bit/s that we can expect using this interface.
+ * May be use for QoS stuff... Jean II
+ */
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; /* 24 Mbits/s */
else
- range->throughput = 1500000;
+ range->throughput = 1500000; /* 1.5 Mbits/s */
-
+ /* RTS and fragmentation thresholds */
range->min_rts = 0;
range->max_rts = 2347;
range->min_frag = 256;
#endif
range->encoding_size[3] = AES_KEY_SIZE;
-
+ /* Do not support power micro-management */
range->min_pmp = 0;
range->max_pmp = 0;
range->min_pmt = 0;
range->pmp_flags = 0;
range->pm_capa = 0;
-
+ /* Transmit Power - values are in mW */
range->num_txpower = 2;
range->txpower[0] = 1;
range->txpower[1] = 255;
range->we_version_compiled = WIRELESS_EXT;
range->we_version_source = 19;
-
+ /* Only support retry limits */
range->retry_capa = IW_RETRY_LIMIT;
range->retry_flags = IW_RETRY_LIMIT;
range->r_time_flags = 0;
-
+ /* SRL and LRL limits */
range->min_retry = 1;
range->max_retry = 255;
-
+ /* Retry lifetime limits unsupported */
range->min_r_time = 0;
range->max_r_time = 0;
-#endif
+#endif /* WIRELESS_EXT > 10 */
#if WIRELESS_EXT > 17
range->enc_capa = IW_ENC_CAPA_WPA;
range->enc_capa |= IW_ENC_CAPA_CIPHER_CCMP;
range->enc_capa |= IW_ENC_CAPA_WPA2;
-
+ /* Determine driver FBT capability. */
if (dev_wlc_intvar_get(dev, "fbt_cap", &fbt_cap) == 0) {
if (fbt_cap == WLC_FBT_CAP_DRV_4WAY_AND_REASSOC) {
-
+ /* Tell the host (e.g. wpa_supplicant) to let driver do the handshake */
range->enc_capa |= IW_ENC_CAPA_4WAY_HANDSHAKE;
}
}
-
+#ifdef BCMFW_ROAM_ENABLE_WEXT
+ /* Advertise firmware roam capability to the external supplicant */
+ range->enc_capa |= IW_ENC_CAPA_FW_ROAM_ENABLE;
+#endif /* BCMFW_ROAM_ENABLE_WEXT */
+
+ /* Event capability (kernel) */
IW_EVENT_CAPA_SET_KERNEL(range->event_capa);
-
+ /* Event capability (driver) */
IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWAP);
IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWSCAN);
IW_EVENT_CAPA_SET(range->event_capa, IWEVTXDROP);
IW_EVENT_CAPA_SET(range->event_capa, IWEVPMKIDCAND);
#if WIRELESS_EXT >= 22 && defined(IW_SCAN_CAPA_ESSID)
-
+ /* FC7 wireless.h defines EXT 22 but doesn't define scan_capa bits */
range->scan_capa = IW_SCAN_CAPA_ESSID;
#endif
-#endif
+#endif /* WIRELESS_EXT > 17 */
return 0;
}
return -EINVAL;
}
-
+ /* Ignore "auto" or "off" */
if (ETHER_ISBCAST(awrq->sa_data) || ETHER_ISNULLADDR(awrq->sa_data)) {
scb_val_t scbval;
bzero(&scbval, sizeof(scb_val_t));
}
return 0;
}
-
-
+ /* WL_ASSOC(("Assoc to %s\n", bcm_ether_ntoa((struct ether_addr *)&(awrq->sa_data),
+ * eabuf)));
+ */
+ /* Reassociate to the specified AP */
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;
awrq->sa_family = ARPHRD_ETHER;
memset(awrq->sa_data, 0, ETHER_ADDR_LEN);
-
+ /* Ignore error (may be down or disassociated) */
(void) dev_wlc_ioctl(dev, WLC_GET_BSSID, awrq->sa_data, ETHER_ADDR_LEN);
return 0;
return error;
}
-#endif
+#endif /* WIRELESS_EXT > 17 */
static int
wl_iw_get_aplist(
if (!extra)
return -EINVAL;
-
+ /* Get scan results (too large to put on the stack) */
list = kmalloc(buflen, GFP_KERNEL);
if (!list)
return -ENOMEM;
ASSERT(((uintptr)bi + dtoh32(bi->length)) <= ((uintptr)list +
buflen));
-
+ /* Infrastructure only */
if (!(dtoh16(bi->capability) & DOT11_CAP_ESS))
continue;
-
+ /* BSSID */
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;
-
+ /* Updated qual, level, and noise */
#if WIRELESS_EXT > 18
qual[dwrq->length].updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
#else
qual[dwrq->length].updated = 7;
-#endif
+#endif /* WIRELESS_EXT > 18 */
dwrq->length++;
}
if (dwrq->length) {
memcpy(&addr[dwrq->length], qual, sizeof(struct iw_quality) * dwrq->length);
-
+ /* Provided qual */
dwrq->flags = 1;
}
}
buf = iscan->list_hdr;
-
+ /* Get scan results (too large to put on the stack) */
while (buf) {
list = &((wl_iscan_results_t*)buf->iscan_buf)->results;
ASSERT(list->version == WL_BSS_INFO_VERSION);
ASSERT(((uintptr)bi + dtoh32(bi->length)) <= ((uintptr)list +
WLC_IW_ISCAN_MAXLEN));
-
+ /* Infrastructure only */
if (!(dtoh16(bi->capability) & DOT11_CAP_ESS))
continue;
-
+ /* BSSID */
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;
-
+ /* Updated qual, level, and noise */
#if WIRELESS_EXT > 18
qual[dwrq->length].updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
#else
qual[dwrq->length].updated = 7;
-#endif
+#endif /* WIRELESS_EXT > 18 */
dwrq->length++;
}
}
if (dwrq->length) {
memcpy(&addr[dwrq->length], qual, sizeof(struct iw_quality) * dwrq->length);
-
+ /* Provided qual */
dwrq->flags = 1;
}
WL_TRACE(("%s: SIOCSIWSCAN\n", dev->name));
-
+ /* default Broadcast scan */
memset(&ssid, 0, sizeof(ssid));
#if WIRELESS_EXT > 17
-
+ /* check for given essid */
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;
}
}
#endif
-
+ /* Ignore error (most likely scan in progress) */
(void) dev_wlc_ioctl(dev, WLC_SCAN, &ssid, sizeof(ssid));
return 0;
WL_TRACE(("%s: SIOCSIWSCAN\n", dev->name));
-
+ /* use backup if our thread is not successful */
if ((!iscan) || (iscan->sysioc_pid < 0)) {
return wl_iw_set_scan(dev, info, wrqu, extra);
}
return 0;
}
-
+ /* default Broadcast scan */
memset(&ssid, 0, sizeof(ssid));
#if WIRELESS_EXT > 17
-
+ /* check for given essid */
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;
static bool
ie_is_wpa_ie(uint8 **wpaie, uint8 **tlvs, int *tlvs_len)
{
-
-
+/* Is this body of this tlvs entry a WPA entry? If */
+/* not update the tlvs buffer pointer/length */
uint8 *ie = *wpaie;
-
+ /* If the contents match the WPA_OUI and type=1 */
if ((ie[1] >= 6) &&
!bcmp((const void *)&ie[2], (const void *)(WPA_OUI "\x01"), 4)) {
return TRUE;
}
-
+ /* point to the next ie */
ie += ie[1] + 2;
-
+ /* calculate the length of the rest of the buffer */
*tlvs_len -= (int)(ie - *tlvs);
-
+ /* update the pointer to the start of the buffer */
*tlvs = ie;
return FALSE;
}
static bool
ie_is_wps_ie(uint8 **wpsie, uint8 **tlvs, int *tlvs_len)
{
-
-
+/* Is this body of this tlvs entry a WPS entry? If */
+/* not update the tlvs buffer pointer/length */
uint8 *ie = *wpsie;
-
+ /* If the contents match the WPA_OUI and type=4 */
if ((ie[1] >= 4) &&
!bcmp((const void *)&ie[2], (const void *)(WPA_OUI "\x04"), 4)) {
return TRUE;
}
-
+ /* point to the next ie */
ie += ie[1] + 2;
-
+ /* calculate the length of the rest of the buffer */
*tlvs_len -= (int)(ie - *tlvs);
-
+ /* update the pointer to the start of the buffer */
*tlvs = ie;
return FALSE;
}
-#endif
+#endif /* WIRELESS_EXT > 17 */
-#ifdef BCMWAPI_WPI
-static inline int _wpa_snprintf_hex(char *buf, size_t buf_size, const u8 *data,
- size_t len, int uppercase)
-{
- size_t i;
- char *pos = buf, *end = buf + buf_size;
- int ret;
- if (buf_size == 0)
- return 0;
- for (i = 0; i < len; i++) {
- ret = snprintf(pos, end - pos, uppercase ? "%02X" : "%02x",
- data[i]);
- if (ret < 0 || ret >= end - pos) {
- end[-1] = '\0';
- return pos - buf;
- }
- pos += ret;
- }
- end[-1] = '\0';
- return pos - buf;
-}
-
-
-static int
-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
static int
wl_iw_handle_scanresults_ies(char **event_p, char *end,
#if WIRELESS_EXT > 17
struct iw_event iwe;
char *event;
-#ifdef BCMWAPI_WPI
- char *buf;
- int custom_event_len;
-#endif
event = *event_p;
if (bi->ie_length) {
-
+ /* look for wpa/rsn ies in the ie list... */
bcm_tlv_t *ie;
uint8 *ptr = ((uint8 *)bi) + sizeof(wl_bss_info_t);
int ptr_len = bi->ie_length;
ptr = ((uint8 *)bi) + sizeof(wl_bss_info_t);
while ((ie = bcm_parse_tlvs(ptr, ptr_len, DOT11_MNG_WPA_ID))) {
-
+ /* look for WPS IE */
if (ie_is_wps_ie(((uint8 **)&ie), &ptr, &ptr_len)) {
iwe.cmd = IWEVGENIE;
iwe.u.data.length = ie->len + 2;
}
}
-#ifdef BCMWAPI_WPI
- ptr = ((uint8 *)bi) + sizeof(wl_bss_info_t);
- ptr_len = bi->ie_length;
-
- while ((ie = bcm_parse_tlvs(ptr, ptr_len, DOT11_MNG_WAPI_ID))) {
- WL_TRACE(("%s: found a WAPI IE...\n", __FUNCTION__));
-#ifdef WAPI_IE_USE_GENIE
- iwe.cmd = IWEVGENIE;
- iwe.u.data.length = ie->len + 2;
- event = IWE_STREAM_ADD_POINT(info, event, end, &iwe, (char *)ie);
-#else
- iwe.cmd = IWEVCUSTOM;
- custom_event_len = strlen("wapi_ie=") + 2*(ie->len + 2);
- iwe.u.data.length = custom_event_len;
-
- buf = kmalloc(custom_event_len+1, GFP_KERNEL);
- if (buf == NULL)
- {
- WL_ERROR(("malloc(%d) returned NULL...\n", custom_event_len));
- break;
- }
-
- memcpy(buf, "wapi_ie=", 8);
- wpa_snprintf_hex(buf + 8, 2+1, &(ie->id), 1);
- 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);
- kfree(buf);
-#endif
- break;
- }
-#endif
*event_p = event;
}
-#endif
+#endif /* WIRELESS_EXT > 17 */
return 0;
}
static int
if (!extra)
return -EINVAL;
-
+ /* Check for scan in progress */
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;
-
+ /* Get scan results (too large to put on the stack) */
list = kmalloc(buflen, GFP_KERNEL);
if (!list)
return -ENOMEM;
ASSERT(((uintptr)bi + dtoh32(bi->length)) <= ((uintptr)list +
buflen));
-
+ /* First entry must be the BSSID */
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);
-
+ /* SSID */
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);
-
+ /* Mode */
if (dtoh16(bi->capability) & (DOT11_CAP_ESS | DOT11_CAP_IBSS)) {
iwe.cmd = SIOCGIWMODE;
if (dtoh16(bi->capability) & DOT11_CAP_ESS)
event = IWE_STREAM_ADD_EVENT(info, event, end, &iwe, IW_EV_UINT_LEN);
}
-
+ /* Channel */
iwe.cmd = SIOCGIWFREQ;
iwe.u.freq.m = wf_channel2mhz(CHSPEC_CHANNEL(bi->chanspec),
CHSPEC_CHANNEL(bi->chanspec) <= CH_MAX_2G_CHANNEL ?
iwe.u.freq.e = 6;
event = IWE_STREAM_ADD_EVENT(info, event, end, &iwe, IW_EV_FREQ_LEN);
-
+ /* Channel quality */
iwe.cmd = IWEVQUAL;
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);
-
+ /* WPA, WPA2, WPS, WAPI IEs */
wl_iw_handle_scanresults_ies(&event, end, info, bi);
-
+ /* Encryption */
iwe.cmd = SIOCGIWENCODE;
if (dtoh16(bi->capability) & DOT11_CAP_PRIVACY)
iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
iwe.u.data.length = 0;
event = IWE_STREAM_ADD_POINT(info, event, end, &iwe, (char *)event);
-
+ /* Rates */
if (bi->rateset.count) {
value = event + IW_EV_LCP_LEN;
iwe.cmd = SIOCGIWRATE;
-
+ /* Those two flags are ignored... */
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;
kfree(list);
dwrq->length = event - extra;
- dwrq->flags = 0;
+ dwrq->flags = 0; /* todo */
return 0;
}
if (!extra)
return -EINVAL;
-
+ /* use backup if our thread is not successful */
if ((!iscan) || (iscan->sysioc_pid < 0)) {
return wl_iw_get_scan(dev, info, dwrq, extra);
}
-
+ /* Check for scan in progress */
if (iscan->iscan_state == ISCAN_STATE_SCANING)
return -EAGAIN;
apcnt = 0;
p_buf = iscan->list_hdr;
-
+ /* Get scan results */
while (p_buf != iscan->list_cur) {
list = &((wl_iscan_results_t*)p_buf->iscan_buf)->results;
ASSERT(((uintptr)bi + dtoh32(bi->length)) <= ((uintptr)list +
WLC_IW_ISCAN_MAXLEN));
-
+ /* overflow check cover fields before wpa IEs */
if (event + ETHER_ADDR_LEN + bi->SSID_len + IW_EV_UINT_LEN + IW_EV_FREQ_LEN +
IW_EV_QUAL_LEN >= end)
return -E2BIG;
-
+ /* First entry must be the BSSID */
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);
-
+ /* SSID */
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);
-
+ /* Mode */
if (dtoh16(bi->capability) & (DOT11_CAP_ESS | DOT11_CAP_IBSS)) {
iwe.cmd = SIOCGIWMODE;
if (dtoh16(bi->capability) & DOT11_CAP_ESS)
event = IWE_STREAM_ADD_EVENT(info, event, end, &iwe, IW_EV_UINT_LEN);
}
-
+ /* Channel */
iwe.cmd = SIOCGIWFREQ;
iwe.u.freq.m = wf_channel2mhz(CHSPEC_CHANNEL(bi->chanspec),
CHSPEC_CHANNEL(bi->chanspec) <= CH_MAX_2G_CHANNEL ?
iwe.u.freq.e = 6;
event = IWE_STREAM_ADD_EVENT(info, event, end, &iwe, IW_EV_FREQ_LEN);
-
+ /* Channel quality */
iwe.cmd = IWEVQUAL;
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);
-
+ /* WPA, WPA2, WPS, WAPI IEs */
wl_iw_handle_scanresults_ies(&event, end, info, bi);
-
+ /* Encryption */
iwe.cmd = SIOCGIWENCODE;
if (dtoh16(bi->capability) & DOT11_CAP_PRIVACY)
iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
iwe.u.data.length = 0;
event = IWE_STREAM_ADD_POINT(info, event, end, &iwe, (char *)event);
-
+ /* Rates */
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;
-
+ /* Those two flags are ignored... */
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;
}
}
p_buf = p_buf->next;
- }
+ } /* while (p_buf) */
dwrq->length = event - extra;
- dwrq->flags = 0;
+ dwrq->flags = 0; /* todo */
return 0;
}
-#endif
+#endif /* WIRELESS_EXT > 13 */
static int
WL_TRACE(("%s: SIOCSIWESSID\n", dev->name));
-
+ /* default Broadcast SSID */
memset(&ssid, 0, sizeof(ssid));
if (dwrq->length && extra) {
#if WIRELESS_EXT > 20
if ((error = dev_wlc_ioctl(dev, WLC_SET_SSID, &ssid, sizeof(ssid))))
return error;
}
-
+ /* If essid null then it is "iwconfig <interface> essid off" command */
else {
scb_val_t scbval;
bzero(&scbval, sizeof(scb_val_t));
ssid.SSID_len = dtoh32(ssid.SSID_len);
-
+ /* Get the current SSID */
memcpy(extra, ssid.SSID, ssid.SSID_len);
dwrq->length = ssid.SSID_len;
- dwrq->flags = 1;
+ dwrq->flags = 1; /* active */
return 0;
}
if (!extra)
return -EINVAL;
-
+ /* Check the size of the string */
if (dwrq->length > sizeof(iw->nickname))
return -E2BIG;
WL_TRACE(("%s: SIOCSIWRATE\n", dev->name));
-
+ /* Get current rateset */
if ((error = dev_wlc_ioctl(dev, WLC_GET_CURR_RATESET, &rateset, sizeof(rateset))))
return error;
rateset.count = dtoh32(rateset.count);
if (vwrq->value < 0) {
-
+ /* Select maximum rate */
rate = rateset.rates[rateset.count - 1] & 0x7f;
} else if (vwrq->value < rateset.count) {
-
+ /* Select rate by rateset index */
rate = rateset.rates[vwrq->value] & 0x7f;
} else {
-
+ /* Specified rate in bps */
rate = vwrq->value / 500000;
}
if (vwrq->fixed) {
-
+ /*
+ Set rate override,
+ Since the is a/b/g-blind, both a/bg_rate are enforced.
+ */
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 {
-
-
+ /*
+ clear rate override
+ Since the is a/b/g-blind, both a/bg_rate are enforced.
+ */
+ /* 0 is for clearing rate override */
error_bg = dev_wlc_intvar_set(dev, "bg_rate", 0);
-
+ /* 0 is for clearing rate override */
error_a = dev_wlc_intvar_set(dev, "a_rate", 0);
if (error_bg && error_a)
return (error_bg | error_a);
-
+ /* Remove rates above selected rate */
for (i = 0; i < rateset.count; i++)
if ((rateset.rates[i] & 0x7f) > rate)
break;
rateset.count = htod32(i);
-
+ /* Set current rateset */
if ((error = dev_wlc_ioctl(dev, WLC_SET_RATESET, &rateset, sizeof(rateset))))
return error;
}
WL_TRACE(("%s: SIOCGIWRATE\n", dev->name));
-
+ /* Report the current tx rate */
if ((error = dev_wlc_ioctl(dev, WLC_GET_RATE, &rate, sizeof(rate))))
return error;
rate = dtoh32(rate);
uint16 txpwrmw;
WL_TRACE(("%s: SIOCSIWTXPOW\n", dev->name));
-
+ /* Make sure radio is off or on as far as software is concerned */
disable = vwrq->disabled ? WL_RADIO_SW_DISABLE : 0;
disable += WL_RADIO_SW_DISABLE << 16;
if ((error = dev_wlc_ioctl(dev, WLC_SET_RADIO, &disable, sizeof(disable))))
return error;
-
+ /* If Radio is off, nothing more to do */
if (disable & WL_RADIO_SW_DISABLE)
return 0;
-
+ /* Only handle mW */
if (!(vwrq->flags & IW_TXPOW_MWATT))
return -EINVAL;
-
+ /* Value < 0 means just "on" or "off" */
if (vwrq->value < 0)
return 0;
WL_TRACE(("%s: SIOCSIWRETRY\n", dev->name));
-
+ /* Do not handle "off" or "lifetime" */
if (vwrq->disabled || (vwrq->flags & IW_RETRY_LIFETIME))
return -EINVAL;
-
+ /* Handle "[min|max] limit" */
if (vwrq->flags & IW_RETRY_LIMIT) {
-
+ /* "max limit" or just "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 /* WIRELESS_EXT > 20 */
lrl = htod32(vwrq->value);
if ((error = dev_wlc_ioctl(dev, WLC_SET_LRL, &lrl, sizeof(lrl))))
return error;
}
-
+ /* "min limit" or just "limit" */
#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 /* WIRELESS_EXT > 20 */
srl = htod32(vwrq->value);
if ((error = dev_wlc_ioctl(dev, WLC_SET_SRL, &srl, sizeof(srl))))
WL_TRACE(("%s: SIOCGIWRETRY\n", dev->name));
- vwrq->disabled = 0;
+ vwrq->disabled = 0; /* Can't be disabled */
-
+ /* Do not handle lifetime queries */
if ((vwrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME)
return -EINVAL;
-
+ /* Get retry limits */
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;
lrl = dtoh32(lrl);
srl = dtoh32(srl);
-
+ /* Note : by default, display the min retry number */
if (vwrq->flags & IW_RETRY_MAX) {
vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_MAX;
vwrq->value = lrl;
return 0;
}
-#endif
+#endif /* WIRELESS_EXT > 10 */
static int
wl_iw_set_encode(
memset(&key, 0, sizeof(key));
if ((dwrq->flags & IW_ENCODE_INDEX) == 0) {
-
+ /* Find the current key */
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))))
if (val)
break;
}
-
+ /* Default to 0 */
if (key.index == DOT11_MAX_DEFAULT_KEYS)
key.index = 0;
} else {
return -EINVAL;
}
-
+ /* Interpret "off" to mean no encryption */
wsec = (dwrq->flags & IW_ENCODE_DISABLED) ? 0 : WEP_ENABLED;
if ((error = dev_wlc_intvar_set(dev, "wsec", wsec)))
return error;
-
+ /* Old API used to pass a NULL pointer instead of IW_ENCODE_NOKEY */
if (!extra || !dwrq->length || (dwrq->flags & IW_ENCODE_NOKEY)) {
-
+ /* Just select a new current key */
val = htod32(key.index);
if ((error = dev_wlc_ioctl(dev, WLC_SET_KEY_PRIMARY, &val, sizeof(val))))
return error;
return -EINVAL;
}
-
+ /* Set the new key/index */
swap_key_from_BE(&key);
if ((error = dev_wlc_ioctl(dev, WLC_SET_KEY, &key, sizeof(key))))
return error;
}
-
+ /* Interpret "restricted" to mean shared key authentication */
val = (dwrq->flags & IW_ENCODE_RESTRICTED) ? 1 : 0;
val = htod32(val);
if ((error = dev_wlc_ioctl(dev, WLC_SET_AUTH, &val, sizeof(val))))
WL_TRACE(("%s: SIOCGIWENCODE\n", dev->name));
-
+ /* assure default values of zero for things we don't touch */
bzero(&key, sizeof(wl_wsec_key_t));
if ((dwrq->flags & IW_ENCODE_INDEX) == 0) {
-
+ /* Find the current key */
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))))
if (key.index >= DOT11_MAX_DEFAULT_KEYS)
key.index = 0;
-
+ /* Get info */
if ((error = dev_wlc_ioctl(dev, WLC_GET_WSEC, &wsec, sizeof(wsec))) ||
(error = dev_wlc_ioctl(dev, WLC_GET_AUTH, &auth, sizeof(auth))))
wsec = dtoh32(wsec);
auth = dtoh32(auth);
-
+ /* Get key length */
dwrq->length = MIN(IW_ENCODING_TOKEN_MAX, key.len);
-
+ /* Get flags */
dwrq->flags = key.index + 1;
if (!(wsec & (WEP_ENABLED | TKIP_ENABLED | AES_ENABLED))) {
-
+ /* Interpret "off" to mean no encryption */
dwrq->flags |= IW_ENCODE_DISABLED;
}
if (auth) {
-
+ /* Interpret "restricted" to mean shared key authentication */
dwrq->flags |= IW_ENCODE_RESTRICTED;
}
-
+ /* Get key */
if (dwrq->length && extra)
memcpy(extra, key.data, dwrq->length);
char *extra
)
{
-#if defined(BCMWAPI_WPI)
- uchar buf[WLC_IOCTL_SMLEN] = {0};
- uchar *p = buf;
- int wapi_ie_size;
-
- WL_TRACE(("%s: SIOCSIWGENIE\n", dev->name));
-
- if (extra[0] == DOT11_MNG_WAPI_ID)
- {
- wapi_ie_size = iwp->length;
- memcpy(p, extra, iwp->length);
- dev_wlc_bufvar_set(dev, "wapiie", buf, wapi_ie_size);
- }
- else
-#endif
dev_wlc_bufvar_set(dev, "wpaie", extra, iwp->length);
return 0;
memset(&key, 0, sizeof(key));
iwe = (struct iw_encode_ext *)extra;
-
+ /* disable encryption completely */
if (dwrq->flags & IW_ENCODE_DISABLED) {
}
-
+ /* get the key index */
key.index = 0;
if (dwrq->flags & IW_ENCODE_INDEX)
key.index = (dwrq->flags & IW_ENCODE_INDEX) - 1;
key.len = iwe->key_len;
-
+ /* Instead of bcast for ea address for default wep keys, driver needs it to be Null */
if (!ETHER_ISMULTI(iwe->addr.sa_data))
bcopy((void *)&iwe->addr.sa_data, (char *)&key.ea, ETHER_ADDR_LEN);
-
+ /* check for key index change */
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));
-
+ /* change the 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;
}
-
+ /* key delete */
else {
swap_key_from_BE(&key);
error = dev_wlc_ioctl(dev, WLC_SET_KEY, &key, sizeof(key));
return error;
}
}
-
+ /* This case is used to allow an external 802.1x supplicant
+ * to pass the PMK to the in-driver supplicant for use in
+ * the 4-way handshake.
+ */
else if (iwe->alg == IW_ENCODE_ALG_PMK) {
int j;
wsec_pmk_t pmk;
char* charptr = keystring;
uint len;
-
+ /* copy the raw hex key to the appropriate format */
for (j = 0; j < (WSEC_MAX_PSK_LEN / 2); j++) {
sprintf(charptr, "%02x", iwe->key[j]);
charptr += 2;
bcopy(keybuf, &key.data[16], sizeof(keybuf));
}
-
+ /* rx iv */
if (iwe->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) {
uchar *ivptr;
ivptr = (uchar *)iwe->rx_seq;
case IW_ENCODE_ALG_CCMP:
key.algo = CRYPTO_ALGO_AES_CCM;
break;
-#ifdef BCMWAPI_WPI
- case IW_ENCODE_ALG_SM4:
- key.algo = CRYPTO_ALGO_SMS4;
- if (iwe->ext_flags & IW_ENCODE_EXT_GROUP_KEY) {
- key.flags &= ~WL_PRIMARY_KEY;
- }
- break;
-#endif
default:
break;
}
dev_wlc_bufvar_set(dev, "pmkid_info", (char *)&pmkid_list, sizeof(pmkid_list));
return 0;
}
-#endif
+#endif /* WIRELESS_EXT > 17 */
static int
wl_iw_get_encodeext(
switch (paramid) {
case IW_AUTH_WPA_VERSION:
-
+ /* supported wpa version disabled or wpa or wpa2 */
if (paramval & IW_AUTH_WPA_VERSION_DISABLED)
val = WPA_AUTH_DISABLED;
else if (paramval & (IW_AUTH_WPA_VERSION_WPA))
val = WPA_AUTH_PSK | WPA_AUTH_UNSPECIFIED;
else if (paramval & IW_AUTH_WPA_VERSION_WPA2)
val = WPA2_AUTH_PSK | WPA2_AUTH_UNSPECIFIED;
-#ifdef BCMWAPI_WPI
- else if (paramval & IW_AUTH_WAPI_VERSION_1)
- val = WAPI_AUTH_UNSPECIFIED;
-#endif
WL_TRACE(("%s: %d: setting wpa_auth to 0x%0x\n", __FUNCTION__, __LINE__, val));
if ((error = dev_wlc_intvar_set(dev, "wpa_auth", val)))
return error;
val |= TKIP_ENABLED;
if (cipher_combined & IW_AUTH_CIPHER_CCMP)
val |= AES_ENABLED;
-#ifdef BCMWAPI_WPI
- val &= ~SMS4_ENABLED;
- if (cipher_combined & IW_AUTH_CIPHER_SMS4)
- val |= SMS4_ENABLED;
-#endif
if (iw->privacy_invoked && !val) {
WL_WSEC(("%s: %s: 'Privacy invoked' TRUE but clearing wsec, assuming "
if ((error = dev_wlc_intvar_set(dev, "wsec", val)))
return error;
-
+ /* Ensure in-dongle supplicant is turned on when FBT wants to do the 4-way
+ * handshake.
+ */
if (dev_wlc_intvar_get(dev, "fbt_cap", &fbt_cap) == 0) {
if (fbt_cap == WLC_FBT_CAP_DRV_4WAY_AND_REASSOC) {
if ((paramid == IW_AUTH_CIPHER_PAIRWISE) && (val & AES_ENABLED)) {
if (paramval & (IW_AUTH_KEY_MGMT_FT_802_1X | IW_AUTH_KEY_MGMT_FT_PSK))
val |= WPA2_AUTH_FT;
}
-#ifdef BCMWAPI_WPI
- if (paramval & (IW_AUTH_KEY_MGMT_WAPI_PSK | IW_AUTH_KEY_MGMT_WAPI_CERT))
- val = WAPI_AUTH_UNSPECIFIED;
-#endif
WL_TRACE(("%s: %d: setting wpa_auth to %d\n", __FUNCTION__, __LINE__, val));
if ((error = dev_wlc_intvar_set(dev, "wpa_auth", val)))
return error;
break;
case IW_AUTH_80211_AUTH_ALG:
-
+ /* open shared */
WL_ERROR(("Setting the D11auth %d\n", paramval));
if (paramval & IW_AUTH_ALG_OPEN_SYSTEM)
val = 0;
return error;
}
else {
-
+ /* If WPA is enabled, wpa_auth is set elsewhere */
}
break;
case IW_AUTH_ROAMING_CONTROL:
WL_TRACE(("%s: IW_AUTH_ROAMING_CONTROL\n", __FUNCTION__));
-
+ /* driver control or user space app control */
break;
case IW_AUTH_PRIVACY_INVOKED: {
return error;
if (!WSEC_ENABLED(wsec)) {
-
+ /* if privacy is true, but wsec is false, we are a WPS enrollee */
if ((error = dev_wlc_intvar_set(dev, "is_WPS_enrollee", TRUE))) {
WL_WSEC(("Failed to set iovar is_WPS_enrollee\n"));
return error;
}
-#endif
+#endif /* WIRELESS_EXT > 17 */
-#ifdef BCMWAPI_WPI
-
- case IW_AUTH_WAPI_ENABLED:
- if ((error = dev_wlc_intvar_get(dev, "wsec", &val)))
- return error;
- if (paramval) {
- val |= SMS4_ENABLED;
- if ((error = dev_wlc_intvar_set(dev, "wsec", val))) {
- WL_ERROR(("%s: setting wsec to 0x%0x returned error %d\n",
- __FUNCTION__, val, error));
- return error;
- }
- if ((error = dev_wlc_intvar_set(dev, "wpa_auth", WAPI_AUTH_UNSPECIFIED))) {
- WL_ERROR(("%s: setting wpa_auth(%d) returned %d\n",
- __FUNCTION__, WAPI_AUTH_UNSPECIFIED,
- error));
- return error;
- }
- }
-
- break;
-
-#endif
default:
break;
switch (paramid) {
case IW_AUTH_WPA_VERSION:
-
+ /* supported wpa version disabled or wpa or wpa2 */
if ((error = dev_wlc_intvar_get(dev, "wpa_auth", &val)))
return error;
if (val & (WPA_AUTH_NONE | WPA_AUTH_DISABLED))
break;
case IW_AUTH_KEY_MGMT:
-
+ /* psk, 1x */
if ((error = dev_wlc_intvar_get(dev, "wpa_auth", &val)))
return error;
if (VAL_PSK(val))
break;
case IW_AUTH_80211_AUTH_ALG:
-
+ /* open, shared, leap */
if ((error = dev_wlc_intvar_get(dev, "auth", &val)))
return error;
if (!val)
case IW_AUTH_ROAMING_CONTROL:
WL_ERROR(("%s: IW_AUTH_ROAMING_CONTROL\n", __FUNCTION__));
-
+ /* driver control or user space app control */
break;
case IW_AUTH_PRIVACY_INVOKED:
paramval = iw->privacy_invoked;
break;
-#endif
+#endif /* WIRELESS_EXT > 17 */
}
vwrq->value = paramval;
return 0;
}
-#endif
+#endif /* WIRELESS_EXT > 17 */
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, /* SIOCSIWCOMMIT */
+ (iw_handler) wl_iw_get_name, /* SIOCGIWNAME */
+ (iw_handler) NULL, /* SIOCSIWNWID */
+ (iw_handler) NULL, /* SIOCGIWNWID */
+ (iw_handler) wl_iw_set_freq, /* SIOCSIWFREQ */
+ (iw_handler) wl_iw_get_freq, /* SIOCGIWFREQ */
+ (iw_handler) wl_iw_set_mode, /* SIOCSIWMODE */
+ (iw_handler) wl_iw_get_mode, /* SIOCGIWMODE */
+ (iw_handler) NULL, /* SIOCSIWSENS */
+ (iw_handler) NULL, /* SIOCGIWSENS */
+ (iw_handler) NULL, /* SIOCSIWRANGE */
+ (iw_handler) wl_iw_get_range, /* SIOCGIWRANGE */
+ (iw_handler) NULL, /* SIOCSIWPRIV */
+ (iw_handler) NULL, /* SIOCGIWPRIV */
+ (iw_handler) NULL, /* SIOCSIWSTATS */
+ (iw_handler) NULL, /* SIOCGIWSTATS */
+ (iw_handler) wl_iw_set_spy, /* SIOCSIWSPY */
+ (iw_handler) wl_iw_get_spy, /* SIOCGIWSPY */
+ (iw_handler) NULL, /* -- hole -- */
+ (iw_handler) NULL, /* -- hole -- */
+ (iw_handler) wl_iw_set_wap, /* SIOCSIWAP */
+ (iw_handler) wl_iw_get_wap, /* SIOCGIWAP */
#if WIRELESS_EXT > 17
- (iw_handler) wl_iw_mlme,
+ (iw_handler) wl_iw_mlme, /* SIOCSIWMLME */
#else
- (iw_handler) NULL,
+ (iw_handler) NULL, /* -- hole -- */
#endif
- (iw_handler) wl_iw_iscan_get_aplist,
+ (iw_handler) wl_iw_iscan_get_aplist, /* SIOCGIWAPLIST */
#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, /* SIOCSIWSCAN */
+ (iw_handler) wl_iw_iscan_get_scan, /* SIOCGIWSCAN */
+#else /* WIRELESS_EXT > 13 */
+ (iw_handler) NULL, /* SIOCSIWSCAN */
+ (iw_handler) NULL, /* SIOCGIWSCAN */
+#endif /* WIRELESS_EXT > 13 */
+ (iw_handler) wl_iw_set_essid, /* SIOCSIWESSID */
+ (iw_handler) wl_iw_get_essid, /* SIOCGIWESSID */
+ (iw_handler) wl_iw_set_nick, /* SIOCSIWNICKN */
+ (iw_handler) wl_iw_get_nick, /* SIOCGIWNICKN */
+ (iw_handler) NULL, /* -- hole -- */
+ (iw_handler) NULL, /* -- hole -- */
+ (iw_handler) wl_iw_set_rate, /* SIOCSIWRATE */
+ (iw_handler) wl_iw_get_rate, /* SIOCGIWRATE */
+ (iw_handler) wl_iw_set_rts, /* SIOCSIWRTS */
+ (iw_handler) wl_iw_get_rts, /* SIOCGIWRTS */
+ (iw_handler) wl_iw_set_frag, /* SIOCSIWFRAG */
+ (iw_handler) wl_iw_get_frag, /* SIOCGIWFRAG */
+ (iw_handler) wl_iw_set_txpow, /* SIOCSIWTXPOW */
+ (iw_handler) wl_iw_get_txpow, /* SIOCGIWTXPOW */
#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, /* SIOCSIWRETRY */
+ (iw_handler) wl_iw_get_retry, /* SIOCGIWRETRY */
+#endif /* WIRELESS_EXT > 10 */
+ (iw_handler) wl_iw_set_encode, /* SIOCSIWENCODE */
+ (iw_handler) wl_iw_get_encode, /* SIOCGIWENCODE */
+ (iw_handler) wl_iw_set_power, /* SIOCSIWPOWER */
+ (iw_handler) wl_iw_get_power, /* SIOCGIWPOWER */
#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, /* -- hole -- */
+ (iw_handler) NULL, /* -- hole -- */
+ (iw_handler) wl_iw_set_wpaie, /* SIOCSIWGENIE */
+ (iw_handler) wl_iw_get_wpaie, /* SIOCGIWGENIE */
+ (iw_handler) wl_iw_set_wpaauth, /* SIOCSIWAUTH */
+ (iw_handler) wl_iw_get_wpaauth, /* SIOCGIWAUTH */
+ (iw_handler) wl_iw_set_encodeext, /* SIOCSIWENCODEEXT */
+ (iw_handler) wl_iw_get_encodeext, /* SIOCGIWENCODEEXT */
+ (iw_handler) wl_iw_set_pmksa, /* SIOCSIWPMKSA */
+#endif /* WIRELESS_EXT > 17 */
};
#if WIRELESS_EXT > 12
enum {
WL_IW_SET_LEDDC = SIOCIWFIRSTPRIV,
WL_IW_SET_VLANMODE,
- WL_IW_SET_PM
+ WL_IW_SET_PM,
+#if WIRELESS_EXT > 17
+#endif /* WIRELESS_EXT > 17 */
+ WL_IW_SET_LAST
};
static iw_handler wl_iw_priv_handler[] = {
wl_iw_set_leddc,
wl_iw_set_vlanmode,
- wl_iw_set_pm
+ wl_iw_set_pm,
+#if WIRELESS_EXT > 17
+#endif /* WIRELESS_EXT > 17 */
+ NULL
};
static struct iw_priv_args wl_iw_priv_args[] = {
IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
0,
"set_pm"
- }
+ },
+#if WIRELESS_EXT > 17
+#endif /* WIRELESS_EXT > 17 */
+ { 0, 0, 0, { 0 } }
};
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 /* WIRELESS_EXT >= 19 */
};
-#endif
+#endif /* WIRELESS_EXT > 12 */
int
wl_iw_ioctl(
else
max_tokens = IW_SCAN_MAX_DATA;
break;
-#endif
+#endif /* WIRELESS_EXT > 13 */
case SIOCSIWSPY:
token_size = sizeof(struct sockaddr);
return ret;
}
-
+/* Convert a connection status event into a connection status string.
+ * Returns TRUE if a matching connection status string was found.
+ */
bool
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; /* input: event type to match */
+ uint32 inStatus; /* input: event status code to match */
+ uint32 inReason; /* input: event reason code to match */
+ const char* outName; /* output: failure type */
+ const char* outCause; /* output: failure cause */
} conn_fail_event_map_t;
-
+ /* Map of WLC_E events to connection failure strings */
# define WL_IW_DONT_CARE 9999
const conn_fail_event_map_t event_map [] = {
-
-
+ /* inEvent inStatus inReason */
+ /* outName outCause */
{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,
const char* cause = NULL;
int i;
-
+ /* Search the event map table for a matching event */
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 &&
}
}
-
+ /* If found, generate a connection failure string and return TRUE */
if (cause) {
memset(stringBuf, 0, buflen);
snprintf(stringBuf, buflen, "%s %s %02d %02d",
}
#if (WIRELESS_EXT > 14)
-
+/* Check if we have received an event that indicates connection failure
+ * If so, generate a connection failure report string.
+ * The caller supplies a buffer to hold the generated string.
+ */
static bool
wl_iw_check_conn_fail(wl_event_msg_t *e, char* stringBuf, uint buflen)
{
return FALSE;
}
}
-#endif
+#endif /* WIRELESS_EXT > 14 */
#ifndef IW_CUSTOM_MAX
-#define IW_CUSTOM_MAX 256
-#endif
+#define IW_CUSTOM_MAX 256 /* size of extra buffer used for translation of events */
+#endif /* IW_CUSTOM_MAX */
void
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 /* WIRELESS_EXT > 14 */
#if WIRELESS_EXT > 17
case WLC_E_MIC_ERROR: {
struct iw_michaelmicfailure *micerrevt = (struct iw_michaelmicfailure *)&extra;
}
break;
}
-#endif
+#endif /* WIRELESS_EXT > 17 */
case WLC_E_SCAN_COMPLETE:
#if WIRELESS_EXT > 14
break;
default:
-
+ /* Cannot translate event */
break;
}
}
#if WIRELESS_EXT > 14
-
+ /* Look for WLC events that indicate a connection failure.
+ * If found, generate an IWEVCUSTOM event.
+ */
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 /* WIRELESS_EXT > 14 */
-#endif
+#endif /* WIRELESS_EXT > 13 */
}
int wl_iw_get_wireless_stats(struct net_device *dev, struct iw_statistics *wstats)
else
wstats->qual.qual = 5;
-
+ /* Wraps to 0 if RSSI is 0 */
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 /* WIRELESS_EXT > 18 */
#if WIRELESS_EXT > 11
WL_TRACE(("wl_iw_get_wireless_stats counters=%d\n *****", (int)sizeof(wl_cnt_t)));
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 /* WIRELESS_EXT > 11 */
done:
return res;
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]; /* Room for "event_msgs" + '\0' + bitvec */
dev_iw_iovar_getbuf(dev, "event_msgs", "", 0, iovbuf, sizeof(iovbuf));
bcopy(iovbuf, eventmask, WL_EVENTING_MASK_LEN);
params->action = htod16(action);
params->scan_duration = htod16(0);
-
+ /* params_size += OFFSETOF(wl_iscan_params_t, params); */
(void) dev_iw_iovar_setbuf(iscan->dev, "iscan", params, params_size,
iscan->ioctlbuf, WLC_IOCTL_SMLEN);
}
wl_scan_results_t *results;
uint32 status;
-
+ /* buffers are allocated on demand */
if (iscan->list_cur) {
buf = iscan->list_cur;
iscan->list_cur = buf->next;
memset(&wrqu, 0, sizeof(wrqu));
-
+ /* wext expects to get no data for SIOCGIWSCAN Event */
wireless_send_event(iscan->dev, SIOCGIWSCAN, &wrqu, NULL);
}
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
rtnl_lock();
#endif
-
+ /* make sure our buffer size is enough before going next round */
wl_iw_iscan(iscan, NULL, WL_SCAN_ACTION_CONTINUE);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
rtnl_unlock();
#endif
-
+ /* Reschedule the timer */
iscan->timer.expires = jiffies + msecs_to_jiffies(iscan->timer_ms);
add_timer(&iscan->timer);
iscan->timer_on = 1;
break;
case WL_SCAN_RESULTS_PENDING:
WL_TRACE(("iscanresults pending\n"));
-
+ /* Reschedule the timer */
iscan->timer.expires = jiffies + msecs_to_jiffies(iscan->timer_ms);
add_timer(&iscan->timer);
iscan->timer_on = 1;
return -ENOMEM;
memset(iscan, 0, sizeof(iscan_info_t));
iscan->sysioc_pid = -1;
-
+ /* we only care about main interface so save a global here */
g_iscan = iscan;
iscan->dev = dev;
iscan->iscan_state = ISCAN_STATE_IDLE;
-
+ /* Set up the timer */
iscan->timer_ms = 2000;
init_timer(&iscan->timer);
iscan->timer.data = (ulong)iscan;
g_iscan = NULL;
}
-#endif
+#endif /* USE_IW */
/*
* Linux Wireless Extensions support
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
#define DTIM_SKIP_SET_CMD "DTIMSKIPSET"
#define SETSUSPEND_CMD "SETSUSPENDOPT"
#define PNOSSIDCLR_SET_CMD "PNOSSIDCLR"
-
-#define PNOSETUP_SET_CMD "PNOSETUP "
+/* Lin - Is the extra space needed? */
+#define PNOSETUP_SET_CMD "PNOSETUP " /* TLV command has extra end space */
#define PNOENABLE_SET_CMD "PNOFORCE"
#define PNODEBUG_SET_CMD "PNODEBUG"
#define TXPOWER_SET_CMD "TXPOWER"
#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
#define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
-
+/* Structure to keep global parameters */
typedef struct wl_iw_extra_params {
- int target_channel;
+ int target_channel; /* 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]; /* ISO 3166-1 country abbreviation */
+ char custom_locale[WLC_CNTRY_BUF_SZ]; /* Custom firmware locale */
+ int32 custom_locale_rev; /* Custom local revisin default -1 */
};
-
-
-#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
+/* ============================================== */
+/* Defines from wlc_pub.h */
+#define WL_IW_RSSI_MINVAL -200 /* Low value, e.g. for forcing roam */
+#define WL_IW_RSSI_NO_SIGNAL -91 /* NDIS RSSI link quality cutoffs */
+#define WL_IW_RSSI_VERY_LOW -80 /* Very low quality cutoffs */
+#define WL_IW_RSSI_LOW -70 /* Low quality cutoffs */
+#define WL_IW_RSSI_GOOD -68 /* Good quality cutoffs */
+#define WL_IW_RSSI_VERY_GOOD -58 /* Very good quality cutoffs */
+#define WL_IW_RSSI_EXCELLENT -57 /* Excellent quality cutoffs */
+#define WL_IW_RSSI_INVALID 0 /* invalid RSSI value */
#define MAX_WX_STRING 80
#define SSID_FMT_BUF_LEN ((4 * 32) + 1)
#define isprint(c) bcm_isprint(c)
struct iw_statistics wstats;
int spy_num;
- uint32 pwsec;
- uint32 gwsec;
- bool privacy_invoked;
+ uint32 pwsec; /* pairwise wsec setting */
+ uint32 gwsec; /* group wsec setting */
+ bool privacy_invoked; /* IW_AUTH_PRIVACY_INVOKED setting */
struct ether_addr spy_addr[IW_MAX_SPY];
struct iw_quality spy_qual[IW_MAX_SPY];
void *wlinfo;
#if WIRELESS_EXT > 12
#include <net/iw_handler.h>
extern const struct iw_handler_def wl_iw_handler_def;
-#endif
+#endif /* WIRELESS_EXT > 12 */
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);
iwe_stream_add_point(stream, ends, iwe, extra)
#endif
-#endif
+#endif /* _wl_iw_h_ */
/*
* Broadcom Dongle Host Driver (DHD), Linux monitor network interface
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
/*
* Common function shared by Linux WEXT, cfg80211 and p2p drivers
*
- * Copyright (C) 1999-2012, Broadcom Corporation
- *
+ * Copyright (C) 1999-2013, 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
* 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.
iovar_len = wldev_mkiovar(iovar_name, param, paramlen, buf, buflen);
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;
- }
+ else
+ ret = BCME_BUFTOOSHORT;
+
if (buf_sync)
mutex_unlock(buf_sync);
return ret;
}
int wldev_set_country(
- struct net_device *dev, char *country_code)
+ struct net_device *dev, char *country_code, bool notify, bool user_enforced)
{
int error = -1;
wl_country_t cspec = {{0}, 0, {0}};
if (!country_code)
return error;
- error = wldev_iovar_getbuf(dev, "country", &cspec, sizeof(cspec),
- smbuf, sizeof(smbuf), NULL);
- if (error < 0)
+ bzero(&scbval, sizeof(scb_val_t));
+ error = wldev_iovar_getbuf(dev, "country", NULL, 0, &cspec, sizeof(cspec), NULL);
+ if (error < 0) {
WLDEV_ERROR(("%s: get country failed = %d\n", __FUNCTION__, error));
+ return error;
+ }
if ((error < 0) ||
- (strncmp(country_code, smbuf, WLC_CNTRY_BUF_SZ) != 0)) {
- bzero(&scbval, sizeof(scb_val_t));
- error = wldev_ioctl(dev, WLC_DISASSOC, &scbval, sizeof(scb_val_t), true);
- if (error < 0) {
- WLDEV_ERROR(("%s: set country failed due to Disassoc error %d\n",
- __FUNCTION__, error));
- return error;
+ (strncmp(country_code, cspec.ccode, WLC_CNTRY_BUF_SZ) != 0)) {
+
+ if (user_enforced) {
+ bzero(&scbval, sizeof(scb_val_t));
+ error = wldev_ioctl(dev, WLC_DISASSOC, &scbval, sizeof(scb_val_t), true);
+ if (error < 0) {
+ WLDEV_ERROR(("%s: set country failed due to Disassoc error %d\n",
+ __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);
__FUNCTION__, country_code, cspec.ccode, cspec.rev));
return error;
}
- dhd_bus_country_set(dev, &cspec);
+ dhd_bus_country_set(dev, &cspec, notify);
WLDEV_ERROR(("%s: set country for %s as %s rev %d\n",
__FUNCTION__, country_code, cspec.ccode, cspec.rev));
}
return 0;
}
+
+/* tuning performance for miracast */
+int wldev_miracast_tuning(
+ struct net_device *dev, char *command, int total_len)
+{
+ int error = 0;
+ int mode = 0;
+ int ampdu_mpdu;
+ int roam_off;
+#ifdef VSDB_BW_ALLOCATE_ENABLE
+ int mchan_algo;
+ int mchan_bw;
+#endif /* VSDB_BW_ALLOCATE_ENABLE */
+
+ if (sscanf(command, "%*s %d", &mode) != 1) {
+ WLDEV_ERROR(("Failed to get mode\n"));
+ return -1;
+ }
+
+ WLDEV_ERROR(("mode: %d\n", mode));
+
+ if (mode == 0) {
+ /* Normal mode: restore everything to default */
+ ampdu_mpdu = -1; /* FW default */
+#if defined(ROAM_ENABLE)
+ roam_off = 0; /* roam enable */
+#elif defined(DISABLE_BUILTIN_ROAM)
+ roam_off = 1; /* roam disable */
+#endif
+#ifdef VSDB_BW_ALLOCATE_ENABLE
+ mchan_algo = 0; /* Default */
+ mchan_bw = 50; /* 50:50 */
+#endif /* VSDB_BW_ALLOCATE_ENABLE */
+ }
+ else if (mode == 1) {
+ /* Miracast source mode */
+ ampdu_mpdu = 8; /* for tx latency */
+#if defined(ROAM_ENABLE) || defined(DISABLE_BUILTIN_ROAM)
+ roam_off = 1; /* roam disable */
+#endif
+#ifdef VSDB_BW_ALLOCATE_ENABLE
+ mchan_algo = 1; /* BW based */
+ mchan_bw = 25; /* 25:75 */
+#endif /* VSDB_BW_ALLOCATE_ENABLE */
+ }
+ else if (mode == 2) {
+ /* Miracast sink/PC Gaming mode */
+ ampdu_mpdu = -1; /* FW default */
+#if defined(ROAM_ENABLE) || defined(DISABLE_BUILTIN_ROAM)
+ roam_off = 1; /* roam disable */
+#endif
+#ifdef VSDB_BW_ALLOCATE_ENABLE
+ mchan_algo = 0; /* Default */
+ mchan_bw = 50; /* 50:50 */
+#endif /* VSDB_BW_ALLOCATE_ENABLE */
+ }
+ else {
+ WLDEV_ERROR(("Unknown mode: %d\n", mode));
+ return -1;
+ }
+
+ /* Update ampdu_mpdu */
+ error = wldev_iovar_setint(dev, "ampdu_mpdu", ampdu_mpdu);
+ if (error) {
+ WLDEV_ERROR(("Failed to set ampdu_mpdu: mode:%d, error:%d\n",
+ mode, error));
+ return -1;
+ }
+
+#if defined(ROAM_ENABLE) || defined(DISABLE_BUILTIN_ROAM)
+ error = wldev_iovar_setint(dev, "roam_off", roam_off);
+ if (error) {
+ WLDEV_ERROR(("Failed to set roam_off: mode:%d, error:%d\n",
+ mode, error));
+ return -1;
+ }
+#endif /* ROAM_ENABLE || DISABLE_BUILTIN_ROAM */
+
+#ifdef VSDB_BW_ALLOCATE_ENABLE
+ error = wldev_iovar_setint(dev, "mchan_algo", mchan_algo);
+ if (error) {
+ WLDEV_ERROR(("Failed to set mchan_algo: mode:%d, error:%d\n",
+ mode, error));
+ return -1;
+ }
+
+ error = wldev_iovar_setint(dev, "mchan_bw", mchan_bw);
+ if (error) {
+ WLDEV_ERROR(("Failed to set mchan_bw: mode:%d, error:%d\n",
+ mode, error));
+ return -1;
+ }
+#endif /* VSDB_BW_ALLOCATE_ENABLE */
+
+ return error;
+}
+
/*
* Common function shared by Linux WEXT, cfg80211 and p2p drivers
*
- * Copyright (C) 1999-2012, Broadcom Corporation
- *
+ * Copyright (C) 1999-2013, 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
* 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.
struct net_device *dev, s8 *iovar, s32 val, s32 bssidx);
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_country_set(struct net_device *dev, wl_country_t *cspec, bool notify);
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 wldev_set_country(struct net_device *dev, char *country_code, bool notify,
+ bool user_enforced);
extern int net_os_wake_lock(struct net_device *dev);
extern int net_os_wake_unlock(struct net_device *dev);
extern int net_os_wake_lock_timeout(struct net_device *dev);
int wldev_set_band(struct net_device *dev, uint band);
+int wldev_miracast_tuning(struct net_device *dev, char *command, int total_len);
+
#endif /* __WLDEV_COMMON_H__ */