net: wireless: update bcmdhd driver to 101.10.591.52.27 (20240409-1)(20240411-2)

Change-Id: Id8ace96051346f2bae7236c66a6c2968c9aa07b6
Signed-off-by: Alex Zhao <zzc@rock-chips.com>
This commit is contained in:
Alex Zhao
2024-04-15 14:28:54 +08:00
committed by Tao Huang
parent 44a66b84b0
commit 487057acaf
96 changed files with 10490 additions and 2109 deletions

View File

@@ -31,7 +31,6 @@ CONFIG_BCMDHD_OOB := y
#CONFIG_BCMDHD_CUSB := y
#CONFIG_BCMDHD_NO_POWER_OFF := y
CONFIG_BCMDHD_PROPTXSTATUS := y
CONFIG_BCMDHD_AG := y
CONFIG_DHD_USE_STATIC_BUF := y
CONFIG_BCMDHD_STATIC_BUF_IN_DHD := y
#CONFIG_BCMDHD_ANDROID_VERSION := 14
@@ -90,7 +89,9 @@ ifneq ($(CONFIG_CFG80211),)
DHDOFILES += dhd_cfg80211.o wl_cfgvif.o wl_roam.o
DHDCFLAGS += -DWL_CFG80211 -DWLP2P -DWL_CFG80211_STA_EVENT
DHDCFLAGS += -DWL_CFG80211_GON_COLLISION
DHDCFLAGS += -DWL_CAP_HE -DWL_6G_BAND -DWL_5P9G
DHDCFLAGS += -DCONFIG_CFG80211_INTERNAL_REGDB #-DEXT_REG_INFO
DHDCFLAGS += -DWL_CAP_HE -DWL_6G_BAND -DWL_5P9G -DWL_P2P_6G
DHDCFLAGS += -DWL11U
# DHDCFLAGS += -DCONFIG_6GHZ_BKPORT
DHDCFLAGS += -DWL_IFACE_COMB_NUM_CHANNELS
DHDCFLAGS += -DCUSTOM_PNO_EVENT_LOCK_xTIME=10
@@ -99,10 +100,12 @@ ifneq ($(CONFIG_CFG80211),)
DHDCFLAGS += -DESCAN_RESULT_PATCH -DESCAN_BUF_OVERFLOW_MGMT
DHDCFLAGS += -DVSDB -DWL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST
DHDCFLAGS += -DWLTDLS -DMIRACAST_AMPDU_SIZE=8
# DHDCFLAGS += -DHOSTAPD_BW_SUPPORT
# DHDCFLAGS += -DHOSTAPD_BW_SUPPORT
DHDCFLAGS += -DWL_VIRTUAL_APSTA -DSTA_MGMT -DSOFTAP_UAPSD_OFF
DHDCFLAGS += -DWL_SOFTAP_ACS #-DACS_MONITOR
DHDCFLAGS += -DNUM_SCB_MAX_PROBE=3
DHDCFLAGS += -DWL_SCB_TIMEOUT=10
# DHDCFLAGS += -DWL_BEACON_RATE
DHDCFLAGS += -DEXPLICIT_DISCIF_CLEANUP
DHDCFLAGS += -DDHD_USE_SCAN_WAKELOCK
DHDCFLAGS += -DSPECIFIC_MAC_GEN_SCHEME
@@ -112,7 +115,7 @@ ifneq ($(CONFIG_CFG80211),)
DHDCFLAGS += -DROAM_CHANNEL_CACHE -DDHD_LOSSLESS_ROAMING
# DHDCFLAGS += -DWL_CFGVENDOR_SEND_HANG_EVENT
DHDCFLAGS += -DGTK_OFFLOAD_SUPPORT
DHDCFLAGS += -DWL_STATIC_IF #-DDHD_MAX_STATIC_IFS=2
# DHDCFLAGS += -DWL_STATIC_IF #-DDHD_MAX_STATIC_IFS=2
DHDCFLAGS += -DWL_CLIENT_SAE
DHDCFLAGS += -DCONNECT_INFO_WAR -DWL_ROAM_WAR
DHDCFLAGS += -DVNDR_IE_WAR
@@ -128,7 +131,7 @@ DHDCFLAGS += -DBCMSDIO -DMMC_SDIO_ABORT -DUSE_SDIOFIFO_IOVAR -DBCMLXSDMMC \
-DRXFRAME_THREAD -DDHDENABLE_TAILPAD -DSUPPORT_P2P_GO_PS \
-DBCMSDIO_RXLIM_POST -DBCMSDIO_TXSEQ_SYNC -DCONSOLE_DPC \
-DBCMSDIO_INTSTATUS_WAR
DHDCFLAGS += -DMMC_HW_RESET -DMMC_SW_RESET #-DBUS_POWER_RESTORE
DHDCFLAGS += -DMMC_HW_RESET #-DMMC_SW_RESET #-DBUS_POWER_RESTORE
ifeq ($(CONFIG_BCMDHD_OOB),y)
DHDCFLAGS += -DOOB_INTR_ONLY -DCUSTOMER_OOB -DHW_OOB
ifeq ($(CONFIG_BCMDHD_DISABLE_WOWLAN),y)
@@ -233,8 +236,8 @@ endif
endif
ifeq ($(CONFIG_64BIT),y)
DHDCFLAGS := $(filter-out -DBCMDMA32,$(DHDCFLAGS))
DHDCFLAGS += -DBCMDMA64OSL
DHDCFLAGS := $(filter-out -DBCMDMA32,$(DHDCFLAGS))
DHDCFLAGS += -DBCMDMA64OSL
endif
# For Android VTS
@@ -249,14 +252,15 @@ ifneq ($(CONFIG_CFG80211),)
DHDCFLAGS += -DGSCAN_SUPPORT -DRTT_SUPPORT
DHDCFLAGS += -DLINKSTAT_SUPPORT -DLINKSTAT_EXT_SUPPORT
DHDCFLAGS += -DCUSTOM_COUNTRY_CODE -DDHD_GET_VALID_CHANNELS
DHDCFLAGS += -DDEBUGABILITY -DDBG_PKT_MON
DHDCFLAGS += -DDEBUGABILITY -DDEBUGABILITY_DISABLE_MEMDUMP -DDBG_PKT_MON
DHDCFLAGS += -DDHD_LOG_DUMP -DDHD_FW_COREDUMP
DHDCFLAGS += -DDHD_PKT_LOGGING_DBGRING -DDHD_PKT_LOGGING
DHDCFLAGS += -DAPF -DNDO_CONFIG_SUPPORT -DRSSI_MONITOR_SUPPORT
DHDCFLAGS += -DDHD_WAKE_STATUS
DHDCFLAGS += -DWL_SOFTAP_ACS
DHDCFLAGS += -DWL_LATENCY_MODE
DHDOFILES += dhd_rtt.o
DHDOFILES += dhd_log_dump.o
DHDOFILES += dhd_pktlog.o
endif
else
DHDCFLAGS += -DANDROID_VERSION=0
@@ -409,8 +413,8 @@ ifeq ($(CONFIG_BCMDHD_DTS),y)
endif
DHDCFLAGS += -DCUSTOMER_HW -DDHD_OF_SUPPORT
DHDCFLAGS += -DCUSTOMER_HW_ROCKCHIP
# DHDCFLAGS += -DCUSTOMER_HW_ROCKCHIP_RK3588
DHDCFLAGS += -DBCM_USE_PLATFORM_STRLCPY
# DHDCFLAGS += -DGET_CUSTOM_MAC_ENABLE
endif
ifneq ($(CONFIG_BCMDHD_PCIE),)
@@ -470,7 +474,7 @@ BCMDHD_ROOT = $(src)
#$(warning "BCMDHD_ROOT=$(BCMDHD_ROOT)")
EXTRA_CFLAGS = $(DHDCFLAGS)
EXTRA_CFLAGS += -DDHD_COMPILED=\"$(BCMDHD_ROOT)\"
EXTRA_CFLAGS += -I$(srctree)/$(BCMDHD_ROOT)/include/ -I$(srctree)/$(BCMDHD_ROOT)/
EXTRA_CFLAGS += -I$(BCMDHD_ROOT)/include/ -I$(BCMDHD_ROOT)/
ifeq ($(CONFIG_AP6XXX),m)
EXTRA_LDFLAGS += --strip-debug
endif

View File

@@ -1238,8 +1238,8 @@ ai_core_disable(const si_t *sih, uint32 bits)
* bits - core specific bits that are set during and after reset sequence
* resetbits - core specific bits that are set only during reset sequence
*/
static void
BCMPOSTTRAPFN(_ai_core_reset)(const si_t *sih, uint32 bits, uint32 resetbits)
static bool
_ai_core_reset(const si_t *sih, uint32 bits, uint32 resetbits)
{
const si_info_t *sii = SI_INFO(sih);
aidmp_t *ai;
@@ -1249,6 +1249,12 @@ BCMPOSTTRAPFN(_ai_core_reset)(const si_t *sih, uint32 bits, uint32 resetbits)
ASSERT(GOODREGS(sii->curwrap));
ai = sii->curwrap;
if (R_REG(sii->osh, &ai->resetstatus) == 0xffffffff &&
R_REG(sii->osh, &ai->ioctrl) == 0xffffffff &&
R_REG(sii->osh, &ai->resetctrl) == 0xffffffff) {
SI_ERROR(("%s: fail, resetstatus&ioctrl&resetctrl is 0xffffffff\n", __func__));
return FALSE;
}
/* ensure there are no pending backplane operations */
SPINWAIT(((dummy = R_REG(sii->osh, &ai->resetstatus)) != 0), 300);
@@ -1258,6 +1264,12 @@ BCMPOSTTRAPFN(_ai_core_reset)(const si_t *sih, uint32 bits, uint32 resetbits)
}
#endif /* BCMDBG_ERR */
SI_ERROR(("%s: &ai->ioctrl = 0x%x, &ai->resetctrl = 0x%x, &ai->resetstatus = 0x%x\n",
__func__,
R_REG(sii->osh, &ai->ioctrl),
R_REG(sii->osh, &ai->resetctrl),
R_REG(sii->osh, &ai->resetstatus)));
/* put core into reset state */
W_REG(sii->osh, &ai->resetctrl, AIRC_RESET);
OSL_DELAY(10);
@@ -1322,28 +1334,31 @@ BCMPOSTTRAPFN(_ai_core_reset)(const si_t *sih, uint32 bits, uint32 resetbits)
}
#endif /* UCM_CORRUPTION_WAR */
OSL_DELAY(1);
return TRUE;
}
void
BCMPOSTTRAPFN(ai_core_reset)(si_t *sih, uint32 bits, uint32 resetbits)
bool
ai_core_reset(si_t *sih, uint32 bits, uint32 resetbits)
{
si_info_t *sii = SI_INFO(sih);
const si_cores_info_t *cores_info = (const si_cores_info_t *)sii->cores_info;
uint idx = sii->curidx;
bool ret = TRUE;
if (cores_info->wrapba3[idx] != 0) {
ai_setcoreidx_3rdwrap(sih, idx);
_ai_core_reset(sih, bits, resetbits);
ret = _ai_core_reset(sih, bits, resetbits);
ai_setcoreidx(sih, idx);
}
if (cores_info->wrapba2[idx] != 0) {
ai_setcoreidx_2ndwrap(sih, idx);
_ai_core_reset(sih, bits, resetbits);
ret = _ai_core_reset(sih, bits, resetbits);
ai_setcoreidx(sih, idx);
}
_ai_core_reset(sih, bits, resetbits);
ret = _ai_core_reset(sih, bits, resetbits);
return ret;
}
#ifdef BOOKER_NIC400_INF

View File

@@ -933,6 +933,7 @@ uint
bcmsdh_set_mode(void *sdh, uint mode)
{
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
return (sdioh_set_mode(bcmsdh->sdioh, mode));
}

View File

@@ -308,8 +308,11 @@ bcmsdh_register(bcmsdh_driver_t *driver)
drvinfo = *driver;
SDLX_MSG(("%s: register client driver\n", __FUNCTION__));
error = bcmsdh_register_client_driver();
if (error)
SDLX_ERR(("%s: failed %d\n", __FUNCTION__, error));
if (error) {
SDLX_MSG(("%s: failed %d\n", __FUNCTION__, error));
bcmsdh_unregister_client_driver();
memset(&drvinfo, 0, sizeof(drvinfo));
}
return error;
}

View File

@@ -45,6 +45,10 @@
#define SDIO_VENDOR_ID_BROADCOM 0x02d0
#endif /* !defined(SDIO_VENDOR_ID_BROADCOM) */
#if !defined(SDIO_VENDOR_ID_SYNAPTICS)
#define SDIO_VENDOR_ID_SYNAPTICS 0x06cb
#endif /* !defined(SDIO_VENDOR_ID_SYNAPTICS) */
#define SDIO_DEVICE_ID_BROADCOM_DEFAULT 0x0000
extern void wl_cfg80211_set_parent_dev(void *dev);
@@ -73,7 +77,9 @@ PBCMSDH_SDMMC_INSTANCE gInstance;
/* Maximum number of bcmsdh_sdmmc devices supported by driver */
#define BCMSDH_SDMMC_MAX_DEVICES 1
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)) && defined(CONFIG_PM_SLEEP)
extern volatile bool dhd_mmc_suspend;
#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)) && defined(CONFIG_PM_SLEEP) */
static int sdioh_probe(struct sdio_func *func)
{
@@ -83,7 +89,8 @@ static int sdioh_probe(struct sdio_func *func)
osl_t *osh = NULL;
sdioh_info_t *sdioh = NULL;
sd_err(("bus num (host idx)=%d, slot num (rca)=%d\n", host_idx, rca));
sd_err(("bus num (host idx)=%d, slot num (rca)=%d, caps=0x%x\n",
host_idx, rca, func->card->host->caps));
adapter = dhd_wifi_platform_get_adapter(SDIO_BUS, host_idx, rca);
if (adapter != NULL) {
sd_err(("found adapter info '%s'\n", adapter->name));
@@ -102,23 +109,31 @@ static int sdioh_probe(struct sdio_func *func)
wl_cfg80211_set_parent_dev(&func->dev);
#endif
/* allocate SDIO Host Controller state info */
osh = osl_attach(&func->dev, SDIO_BUS, TRUE);
if (osh == NULL) {
sd_err(("%s: osl_attach failed\n", __FUNCTION__));
goto fail;
}
osl_static_mem_init(osh, adapter);
sdioh = sdioh_attach(osh, func);
if (sdioh == NULL) {
sd_err(("%s: sdioh_attach failed\n", __FUNCTION__));
goto fail;
}
sdioh->bcmsdh = bcmsdh_probe(osh, &func->dev, sdioh, adapter, SDIO_BUS, host_idx, rca);
if (sdioh->bcmsdh == NULL) {
sd_err(("%s: bcmsdh_probe failed\n", __FUNCTION__));
goto fail;
}
/* allocate SDIO Host Controller state info */
osh = osl_attach(&func->dev, SDIO_BUS, TRUE);
if (osh == NULL) {
sd_err(("%s: osl_attach failed\n", __FUNCTION__));
goto fail;
}
osl_static_mem_init(osh, adapter);
sdioh = sdioh_attach(osh, func);
if (sdioh == NULL) {
sd_err(("%s: sdioh_attach failed\n", __FUNCTION__));
goto fail;
}
if (!(func->card->host->caps & MMC_CAP_NONREMOVABLE)) {
sd_err(("%s: MMC_CAP_NONREMOVABLE not enabled in SDIO driver\n", __FUNCTION__));
// func->card->host->caps |= MMC_CAP_NONREMOVABLE;
}
if ((func->card->host->caps & MMC_CAP_NEEDS_POLL)) {
sd_err(("%s: MMC_CAP_NEEDS_POLL enabled in SDIO driver\n", __FUNCTION__));
// func->card->host->caps &= ~MMC_CAP_NEEDS_POLL;
}
sdioh->bcmsdh = bcmsdh_probe(osh, &func->dev, sdioh, adapter, SDIO_BUS, host_idx, rca);
if (sdioh->bcmsdh == NULL) {
sd_err(("%s: bcmsdh_probe failed\n", __FUNCTION__));
goto fail;
}
sdio_set_drvdata(func, sdioh);
return 0;
@@ -212,8 +227,10 @@ static const struct sdio_device_id bcmsdh_sdmmc_ids[] = {
{ SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, BCM43013_D11N_ID) },
{ SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, BCM43013_D11N2G_ID) },
{ SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, BCM43013_D11N5G_ID) },
{ SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_ANY_ID) },
{ SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, BCM4381_CHIP_ID) },
{ SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, BCM4382_CHIP_ID) },
{ SDIO_DEVICE(SDIO_VENDOR_ID_SYNAPTICS, BCM43711_CHIP_ID) },
{ SDIO_DEVICE_CLASS(SDIO_CLASS_NONE) },
{ 0, 0, 0, 0 /* end: all zeroes */
},
@@ -221,7 +238,7 @@ static const struct sdio_device_id bcmsdh_sdmmc_ids[] = {
MODULE_DEVICE_TABLE(sdio, bcmsdh_sdmmc_ids);
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)) && defined(CONFIG_PM)
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)) && defined(CONFIG_PM_SLEEP)
static int bcmsdh_sdmmc_suspend(struct device *pdev)
{
int err;
@@ -284,7 +301,7 @@ static const struct dev_pm_ops bcmsdh_sdmmc_pm_ops = {
.suspend = bcmsdh_sdmmc_suspend,
.resume = bcmsdh_sdmmc_resume,
};
#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)) && defined(CONFIG_PM) */
#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)) && defined(CONFIG_PM_SLEEP) */
#if defined(BCMLXSDMMC)
static struct semaphore *notify_semaphore = NULL;
@@ -292,7 +309,16 @@ static struct semaphore *notify_semaphore = NULL;
static int dummy_probe(struct sdio_func *func,
const struct sdio_device_id *id)
{
sd_err(("%s: enter\n", __FUNCTION__));
if (func)
sd_err(("%s: func->num=0x%x; \n", __FUNCTION__, func->num));
if (id) {
sd_err(("%s: class=0x%x; vendor=0x%x; device=0x%x\n", __FUNCTION__,
id->class, id->vendor, id->device));
if ((id->vendor != SDIO_VENDOR_ID_BROADCOM) &&
(id->vendor != SDIO_VENDOR_ID_SYNAPTICS))
return -ENODEV;
}
if (func && (func->num != 2)) {
return 0;
}
@@ -332,11 +358,11 @@ static struct sdio_driver bcmsdh_sdmmc_driver = {
.remove = bcmsdh_sdmmc_remove,
.name = "bcmsdh_sdmmc",
.id_table = bcmsdh_sdmmc_ids,
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)) && defined(CONFIG_PM)
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)) && defined(CONFIG_PM_SLEEP)
.drv = {
.pm = &bcmsdh_sdmmc_pm_ops,
},
#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)) && defined(CONFIG_PM) */
#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)) && defined(CONFIG_PM_SLEEP) */
};
struct sdos_info {

View File

@@ -63,7 +63,7 @@ uint sd_msglevel = SDH_ERROR_VAL;
uint sd_hiok = TRUE; /* Use hi-speed mode if available? */
uint sd_sdmode = SDIOH_MODE_SD4; /* Use SD4 mode by default */
uint sd_f2_blocksize = 64; /* Default blocksize */
uint sd_f2_blocksize = 256; /* Default blocksize */
uint sd_f1_blocksize = BLOCK_SIZE_4318; /* Default blocksize */
#define sd3_trace(x)

View File

@@ -515,8 +515,15 @@ static struct pci_device_id bcmsdh_pci_devid[] __devinitdata = {
class: 0,
class_mask: 0,
driver_data: 0,
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0))
override_only: 0,
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)) */
},
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0))
{ 0, 0, 0, 0, 0, 0, 0, 0}
#else
{ 0, 0, 0, 0, 0, 0, 0}
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)) */
};
MODULE_DEVICE_TABLE(pci, bcmsdh_pci_devid);

View File

@@ -1804,9 +1804,10 @@ BCMFASTPATH(bcm_mwbmap_alloc)(struct bcm_mwbmap * mwbmap_hdl)
}
MWBMAP_ASSERT(C_bcm_count_leading_zeros(bitmap) ==
bcm_count_leading_zeros(bitmap));
bitix = (BCM_MWBMAP_BITS_WORD - 1)
- bcm_count_leading_zeros(bitmap); /* use asm clz */
wordix = BCM_MWBMAP_MULOP(wordix) + bitix;
bitix = bcm_count_leading_zeros(bitmap); /* use asm clz */
bitix = (bitix <= (BCM_MWBMAP_BITS_WORD - 1)) ?
((BCM_MWBMAP_BITS_WORD - 1) - bitix) : 0;
wordix = BCM_MWBMAP_MULOP(wordix) + bitix;
/* Clear bit if wd count is 0, without conditional branch */
#if defined(BCM_MWBMAP_USE_CNTSETBITS)

View File

@@ -200,8 +200,14 @@ static inline int usb_submit_urb_linux(struct urb *urb)
#define URB_QUEUE_BULK 0
#endif /* WL_URB_ZPKT */
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0))
#define CALLBACK_ARGS struct urb *urb
#define CALLBACK_ARGS_DATA urb
#else
#define CALLBACK_ARGS struct urb *urb, struct pt_regs *regs
#define CALLBACK_ARGS_DATA urb, regs
#endif /* 5.18 */
#define CONFIGDESC(usb) (&((usb)->actconfig)->desc)
#define IFPTR(usb, idx) ((usb)->actconfig->interface[idx])
#define IFALTS(usb, idx) (IFPTR((usb), (idx))->altsetting[0])
@@ -4555,7 +4561,7 @@ dbus_get_fwfile(int devid, int chiprev, uint8 **fw, int *fwlen,
const struct firmware *firmware = NULL;
s8 *device_id = NULL;
s8 *chip_rev = "";
s8 file_name[64];
s8 file_name[64] = {0, };
int ret;
switch (devid) {

View File

@@ -72,6 +72,7 @@ int get_scheduler_policy(struct task_struct *p);
#define ENODATA 6
#define EREMOTEIO 7
#define ENODEV 8
#define ENOCSI 50 /* No CSI structure available */
#define ERESTARTSYS 512
#endif /* LINUX */
#define MAX_EVENT 16
@@ -98,6 +99,9 @@ int get_scheduler_policy(struct task_struct *p);
#include <WdfMiniport.h>
#endif /* (BCMWDF) */
#ifdef WL_CFGVENDOR_SEND_HANG_EVENT
#include <dnglioctl.h>
#endif /* WL_CFGVENDOR_SEND_HANG_EVENT */
#include <dngl_stats.h>
#include <hnd_pktq.h>
@@ -108,7 +112,9 @@ int get_scheduler_policy(struct task_struct *p);
#if defined(LINUX) || defined(linux)
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) && LINUX_VERSION_CODE < \
KERNEL_VERSION(3, 18, 0) || defined(CONFIG_BCMDHD_VENDOR_EXT))
#ifndef WL_VENDOR_EXT_SUPPORT
#define WL_VENDOR_EXT_SUPPORT
#endif /* WL_VENDOR_EXT_SUPPORT */
#endif /* 3.18 > KERNEL_VER >= 3.14 || defined(CONFIG_BCMDHD_VENDOR_EXT) */
#endif /* defined (LINUX) || defined(linux) */
@@ -345,6 +351,10 @@ enum dhd_bus_devreset_type {
#ifndef MSEC_PER_SEC
#define MSEC_PER_SEC 1000u
#endif
#define TIMESPEC64_TO_US(ts) \
(((ts).tv_sec * USEC_PER_SEC) + ((ts).tv_nsec / NSEC_PER_USEC))
#if (defined(LINUX) || defined(linux))
/* (u64)result = (u64)dividend / (u64)divisor */
#define DIV_U64_BY_U64(dividend, divisor) div64_u64(dividend, divisor)
@@ -506,19 +516,62 @@ enum dhd_op_flags {
#endif /* DHD_DEBUG */
/* Enable Flow ring pre-memory allocation by default for Android */
#ifdef OEM_ANDROID
#define FLOW_RING_PREALLOC
#endif /* OEM_ANDROID */
#ifndef CONFIG_BCMDHD_FW_PATH
#ifdef OEM_ANDROID
#define CONFIG_BCMDHD_FW_PATH "/system/vendor/etc/wifi/fw_bcmdhd.bin"
#else
#define CONFIG_BCMDHD_FW_PATH "/var/run/rtecdc.bin"
#endif /* OEM_ANDROID */
#endif /* CONFIG_BCMDHD_FW_PATH */
#ifndef CONFIG_BCMDHD_NVRAM_PATH
#ifdef OEM_ANDROID
#define CONFIG_BCMDHD_NVRAM_PATH "/system/vendor/etc/wifi/bcmdhd.cal"
#else
#define CONFIG_BCMDHD_NVRAM_PATH "/var/run/nvram.txt"
#endif /* OEM_ANDROID */
#endif /* CONFIG_BCMDHD_NVRAM_PATH */
#ifndef CONFIG_BCMDHD_CLM_PATH
#ifdef OEM_ANDROID
#define CONFIG_BCMDHD_CLM_PATH "/etc/wifi/bcmdhd_clm.blob"
#elif defined(LINUX) || defined(linux)
#define CONFIG_BCMDHD_CLM_PATH "/var/run/bcmdhd_clm.blob"
#else
/* clm download will fail on empty path */
#define CONFIG_BCMDHD_CLM_PATH ""
#endif /* OEM_ANDROID */
#endif /* CONFIG_BCMDHD_CLM_PATH */
#ifdef DHD_LINUX_STD_FW_API
#ifndef CONFIG_BCMDHD_CONFIG_SAR_PATH
#define CONFIG_BCMDHD_CONFIG_SAR_PATH "sar_config.ini"
#endif /* CONFIG_BCMDHD_CONFIG_SAR_PATH */
#ifndef CONFIG_BCMDHD_CONFIG_PATH
#define CONFIG_BCMDHD_CONFIG_PATH "wlan_config.ini"
#endif /* CONFIG_BCMDHD_CONFIG_PATH */
#else
#ifndef CONFIG_BCMDHD_CONFIG_SAR_PATH
#ifdef OEM_ANDROID
#define CONFIG_BCMDHD_CONFIG_SAR_PATH "/system/vendor/etc/wifi/sar_config.ini"
#else /* OEM_ANDROID */
#define CONFIG_BCMDHD_CONFIG_SAR_PATH "/var/run/sar_config.ini"
#endif /* OEM_ANDROID */
#endif /* CONFIG_BCMDHD_CONFIG_SAR_PATH */
#ifndef CONFIG_BCMDHD_CONFIG_PATH
#ifdef OEM_ANDROID
#define CONFIG_BCMDHD_CONFIG_PATH "/system/vendor/etc/wifi/wlan_config.ini"
#else /* OEM_ANDROID */
#define CONFIG_BCMDHD_CONFIG_PATH "/var/run/wlan_config.ini"
#endif /* OEM_ANDROID */
#endif /* CONFIG_BCMDHD_CONFIG_PATH */
#endif /* DHD_LINUX_STD_FW_API */
#define WL_CCODE_NULL_COUNTRY "#n"
#define FW_VER_STR_LEN 128
@@ -955,14 +1008,18 @@ enum {
#if defined(CUSTOMER_HW7_DEBUG)
#define DHD_COMMON_DUMP_PATH PLATFORM_PATH
#elif defined(CUSTOM_DHD_COMMON_DUMP_PATH)
#define DHD_COMMON_DUMP_PATH CUSTOM_DHD_COMMON_DUMP_PATH
#elif defined(BOARD_HIKEY)
#ifndef DHD_COMMON_DUMP_PATH
#define DHD_COMMON_DUMP_PATH "/data/misc/wifi/"
#endif /* !DHD_COMMON_DUMP_PATH */
#elif defined(__ARM_ARCH_7A__)
#elif defined(OEM_ANDROID) && defined(__ARM_ARCH_7A__)
#define DHD_COMMON_DUMP_PATH "/data/vendor/wifi/"
#else
#elif defined(OEM_ANDROID) /* For Brix Live Image */
#define DHD_COMMON_DUMP_PATH "/installmedia/"
#else /* Default */
#define DHD_COMMON_DUMP_PATH "/root/"
#endif /* CUSTOMER_HW7_DEBUG */
#define DHD_MEMDUMP_LONGSTR_LEN 180
@@ -1042,7 +1099,9 @@ typedef struct dhd_if_tx_status_latency {
#define GDB_PROXY_STOP_MASK 1
/* Enable Reserve STA flowrings only for Android */
#if defined(OEM_ANDROID)
#define DHD_LIMIT_MULTI_CLIENT_FLOWRINGS
#endif /* OEM_ANDROID */
typedef enum {
FW_UNLOADED = 0,
@@ -1296,8 +1355,10 @@ typedef struct dhd_pub {
int op_mode; /* STA, HostAPD, WFD, SoftAP */
#if defined(LINUX) || defined(linux)
#if defined(OEM_ANDROID)
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 /* defined(OEM_ANDROID) */
#endif /* defined (LINUX) || defined(linux) */
#ifdef NDIS
@@ -1681,6 +1742,11 @@ typedef struct dhd_pub {
#endif /* defined (LINUX) || defined(linux) */
bool debug_buf_dest_support;
uint32 debug_buf_dest_stat[DEBUG_BUF_DEST_MAX];
#ifdef WL_CFGVENDOR_SEND_HANG_EVENT
char *hang_info;
int hang_info_cnt;
char debug_dump_time_hang_str[DEBUG_DUMP_TIME_BUF_LEN];
#endif /* WL_CFGVENDOR_SEND_HANG_EVENT */
char debug_dump_time_str[DEBUG_DUMP_TIME_BUF_LEN];
void *event_log_filter;
uint tput_test_done;
@@ -1774,6 +1840,12 @@ typedef struct dhd_pub {
#ifdef SUPPORT_OTA_UPDATE
ota_update_info_t ota_update_info;
#endif /* SUPPORT_OTA_UPDATE */
#ifdef CSI_SUPPORT
struct mutex csi_lock;
struct list_head csi_list;
uint csi_count;
uint csi_data_send_manner;
#endif /* CSI_SUPPORT */
bool stop_in_progress;
#ifdef SYNA_SAR_CUSTOMER_PARAMETER
uint32 dhd_sar_mode;
@@ -1802,6 +1874,9 @@ typedef struct dhd_pub {
#endif /* DEVICE_TX_STUCK_DETECT && ASSOC_CHECK_SR */
uint32 p2p_disc_busy_cnt;
bool skip_memdump_map_read;
#if defined(DHD_SI_WD_RESET)
bool si_wd;
#endif
#ifdef CSI_SUPPORT
struct list_head csi_list;
int csi_count;
@@ -2013,7 +2088,7 @@ int dhd_pno_clean(dhd_pub_t *dhd);
* Wake locks are an Android power management concept. They are used by applications and services
* to request CPU resources.
*/
#if defined(linux)
#if defined(linux) && defined(OEM_ANDROID)
extern int dhd_os_wake_lock(dhd_pub_t *pub);
extern int dhd_os_wake_unlock(dhd_pub_t *pub);
extern int dhd_os_wake_lock_waive(dhd_pub_t *pub);
@@ -2046,30 +2121,39 @@ extern int dhd_set_1905_almac(dhd_pub_t *dhdp, uint8 ifidx, uint8* ea, bool mcas
inline static void MUTEX_LOCK_SOFTAP_SET_INIT(dhd_pub_t * dhdp)
{
#if defined(OEM_ANDROID)
mutex_init(&dhdp->wl_softap_lock);
#endif /* OEM_ANDROID */
}
inline static void MUTEX_LOCK_SOFTAP_SET(dhd_pub_t * dhdp)
{
#if defined(OEM_ANDROID)
mutex_lock(&dhdp->wl_softap_lock);
#endif /* OEM_ANDROID */
}
inline static void MUTEX_UNLOCK_SOFTAP_SET(dhd_pub_t * dhdp)
{
#if defined(OEM_ANDROID)
mutex_unlock(&dhdp->wl_softap_lock);
#endif /* OEM_ANDROID */
}
#ifdef DHD_DEBUG_WAKE_LOCK
extern int dhd_wakelock_counter_get(dhd_pub_t *pub);
extern int dhd_wakelock_wd_counter_get(dhd_pub_t *pub);
#define DHD_OS_WAKE_LOCK(pub) \
do { \
printf("call wake_lock: %s %d\n", \
__FUNCTION__, __LINE__); \
printf("call wake_lock: %s %d (%d)\n", \
__FUNCTION__, __LINE__, dhd_wakelock_counter_get(pub)); \
dhd_os_wake_lock(pub); \
} while (0)
#define DHD_OS_WAKE_UNLOCK(pub) \
do { \
printf("call wake_unlock: %s %d\n", \
__FUNCTION__, __LINE__); \
printf("call wake_unlock: %s %d (%d)\n", \
__FUNCTION__, __LINE__, dhd_wakelock_counter_get(pub)); \
dhd_os_wake_unlock(pub); \
} while (0)
#define DHD_EVENT_WAKE_LOCK(pub) \
@@ -2168,6 +2252,18 @@ inline static void MUTEX_UNLOCK_SOFTAP_SET(dhd_pub_t * dhdp)
__FUNCTION__, __LINE__); \
dhd_os_wake_lock_destroy(dhd); \
} while (0)
#define DHD_OS_WD_WAKE_LOCK(pub) \
do { \
printf("call dhd_os_WD_wake_lock: %s %d (%d)\n", \
__FUNCTION__, __LINE__, dhd_wakelock_wd_counter_get(pub)); \
dhd_os_wd_wake_lock(pub); \
} while (0)
#define DHD_OS_WD_WAKE_UNLOCK(pub) \
do { \
printf("call dhd_os_WD_wake_unlock: %s %d (%d)\n", \
__FUNCTION__, __LINE__, dhd_wakelock_wd_counter_get(pub)); \
dhd_os_wd_wake_unlock(pub); \
} 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)
@@ -2190,10 +2286,9 @@ inline static void MUTEX_UNLOCK_SOFTAP_SET(dhd_pub_t * dhdp)
#define DHD_OS_WAKE_LOCK_RESTORE(pub) dhd_os_wake_lock_restore(pub)
#define DHD_OS_WAKE_LOCK_INIT(dhd) dhd_os_wake_lock_init(dhd);
#define DHD_OS_WAKE_LOCK_DESTROY(dhd) dhd_os_wake_lock_destroy(dhd);
#endif /* DHD_DEBUG_WAKE_LOCK */
#define DHD_OS_WD_WAKE_LOCK(pub) dhd_os_wd_wake_lock(pub)
#define DHD_OS_WD_WAKE_UNLOCK(pub) dhd_os_wd_wake_unlock(pub)
#endif /* DHD_DEBUG_WAKE_LOCK */
#ifdef DHD_USE_SCAN_WAKELOCK
#ifdef DHD_DEBUG_SCAN_WAKELOCK
@@ -2244,7 +2339,7 @@ inline static void MUTEX_UNLOCK_SOFTAP_SET(dhd_pub_t * dhdp)
#define DHD_OS_WAKE_LOCK_INIT(dhd)
#define DHD_OS_WAKE_LOCK_DESTROY(dhd)
#endif
#endif /* #defined(linux) && defined(OEM_ANDROID) */
#ifdef BCMPCIE_OOB_HOST_WAKE
#define OOB_WAKE_LOCK_TIMEOUT 500
@@ -2475,6 +2570,8 @@ extern void dhd_bus_wakeup_work(dhd_pub_t *dhdp);
#define MAX_FEATURE_SET_CONCURRRENT_GROUPS 3
#if defined(linux) || defined(LINUX) || defined(OEM_ANDROID)
extern int dhd_dev_indoor_cfg(struct net_device *dev, u8 enable);
extern int dhd_dev_get_feature_set(struct net_device *dev);
extern int dhd_dev_get_feature_set_matrix(struct net_device *dev, int num);
extern int dhd_dev_cfg_rand_mac_oui(struct net_device *dev, uint8 *oui);
@@ -2490,6 +2587,7 @@ extern int dhd_dev_set_nodfs(struct net_device *dev, uint nodfs);
extern int dhd_dev_ndo_cfg(struct net_device *dev, u8 enable);
extern int dhd_dev_ndo_update_inet6addr(struct net_device * dev);
#endif /* NDO_CONFIG_SUPPORT */
#endif /* (linux) || (LINUX) || (OEM_ANDROID) */
extern int dhd_set_rand_mac_oui(dhd_pub_t *dhd);
#ifdef GSCAN_SUPPORT
extern int dhd_dev_set_lazy_roam_cfg(struct net_device *dev,
@@ -2618,6 +2716,8 @@ typedef enum _eCountry_type {
SYNA_COUNTRY_TYPE_FCC,
SYNA_COUNTRY_TYPE_EU,
SYNA_COUNTRY_TYPE_LATAM,
SYNA_COUNTRY_TYPE_CANADA,
SYNA_COUNTRY_TYPE_JAPAN,
SYNA_COUNTRY_TYPE_QTY,
SYNA_COUNTRY_TYPE_INVALID = SYNA_COUNTRY_TYPE_QTY
} eCountry_flag_type;
@@ -2633,7 +2733,7 @@ typedef struct _dhd_sar_parameter {
extern eCountry_flag_type syna_country_check_type(char *cntry);
extern int syna_country_update_type_list(eCountry_flag_type type, char *list_str);
extern int dhd_sar_init_parameter(eCountry_flag_type type, int advance_mode,
extern int dhd_sar_init_parameter(dhd_pub_t *dhd, eCountry_flag_type type, int advance_mode,
char *list_str);
extern int dhd_sar_reset_parameter(void);
extern int dhd_sar_set_parameter(dhd_pub_t *dhd_pub, int advance_mode);
@@ -2835,7 +2935,9 @@ extern int dhd_wl_ioctl_set_intiovar(dhd_pub_t *dhd_pub, char *name, uint val,
int cmd, uint8 set, int ifidx);
extern void dhd_common_init(osl_t *osh);
#if defined(linux) || defined(LINUX) || defined(OEM_ANDROID)
extern int dhd_do_driver_init(struct net_device *net);
#endif
extern int dhd_event_ifadd(struct dhd_info *dhd, struct wl_event_data_if *ifevent,
char *name, uint8 *mac);
extern int dhd_event_ifdel(struct dhd_info *dhd, struct wl_event_data_if *ifevent,
@@ -2884,6 +2986,9 @@ extern int dhd_bus_resume(dhd_pub_t *dhdpub, int stage);
extern int dhd_bus_membytes(dhd_pub_t *dhdp, bool set, uint32 address, uint8 *data, uint size);
extern void dhd_print_buf(void *pbuf, int len, int bytes_per_line);
extern bool dhd_is_associated(dhd_pub_t *dhd, uint8 ifidx, int *retval);
#if defined(LINUX) || defined(linux)
extern bool dhd_scan_associated(dhd_pub_t *dhd, struct net_device *dev);
#endif /* LINUX */
#if defined(BCMSDIO) || defined(BCMPCIE)
extern uint dhd_bus_chip_id(dhd_pub_t *dhdp);
extern uint dhd_bus_chiprev_id(dhd_pub_t *dhdp);
@@ -3029,8 +3134,10 @@ typedef struct dmaxref_mem_map {
dhd_dma_buf_t *dstmem;
} dmaxref_mem_map_t;
#if defined(OEM_ANDROID)
extern int wl_iw_iscan_set_scan_broadcast_prep(struct net_device *dev, uint flag);
extern int wl_iw_send_priv_event(struct net_device *dev, char *flag);
#endif /* defined(OEM_ANDROID) */
#ifdef DHD_PCIE_NATIVE_RUNTIMEPM
extern void dhd_flush_rx_tx_wq(dhd_pub_t *dhdp);
@@ -3179,15 +3286,17 @@ extern uint dhd_force_tx_queueing;
#define CUSTOM_SUSPEND_BCN_LI_DTIM DEFAULT_SUSPEND_BCN_LI_DTIM
#endif
#ifdef OEM_ANDROID
#ifndef BCN_TIMEOUT_IN_SUSPEND
#define BCN_TIMEOUT_IN_SUSPEND 6 /* bcn timeout value in suspend mode */
#endif
#endif /* OEM_ANDROID */
#ifndef CUSTOM_RXF_PRIO_SETTING
#define CUSTOM_RXF_PRIO_SETTING MAX((CUSTOM_DPC_PRIO_SETTING - 1), 1)
#endif
#define DEFAULT_WIFI_TURNOFF_DELAY 0
#define DEFAULT_WIFI_TURNOFF_DELAY 10
#ifndef WIFI_TURNOFF_DELAY
#define WIFI_TURNOFF_DELAY DEFAULT_WIFI_TURNOFF_DELAY
#endif /* WIFI_TURNOFF_DELAY */
@@ -3207,7 +3316,11 @@ extern uint dhd_force_tx_queueing;
#endif /* DEFAULT_DHD_WATCHDOG_INTERVAL_MS */
#if defined(DHD_DEBUG)
#ifdef OEM_ANDROID
#define DEFAULT_DHD_CONSOLE_INTERVAL_MS 0 /* android by default disable console msgs */
#else
#define DEFAULT_DHD_CONSOLE_INTERVAL_MS 250 /* msec */
#endif /* OEM_ANDROID */
#ifndef CUSTOM_DHD_CONSOLE_MS
#define CUSTOM_DHD_CONSOLE_MS DEFAULT_DHD_CONSOLE_INTERVAL_MS
@@ -3269,9 +3382,11 @@ extern uint dhd_force_tx_queueing;
#define MAX_DTIM_ALLOWED_INTERVAL 600 /* max allowed total beacon interval for DTIM skip */
#endif
#ifdef OEM_ANDROID
#ifndef MIN_DTIM_FOR_ROAM_THRES_EXTEND
#define MIN_DTIM_FOR_ROAM_THRES_EXTEND 600 /* minimum dtim interval to extend roam threshold */
#endif
#endif /* OEM_ANDROID */
#ifdef CONFIG_ROAM_RSSI_LIMIT
extern int dhd_roam_rssi_limit_get(dhd_pub_t *dhd, int *lmt2g, int *lmt5g);
@@ -4012,6 +4127,7 @@ extern int dhd_prot_debug_info_print(dhd_pub_t *dhd);
extern bool dhd_bus_skip_clm(dhd_pub_t *dhdp);
extern void dhd_pcie_dump_rc_conf_space_cap(dhd_pub_t *dhd);
extern bool dhd_pcie_dump_int_regs(dhd_pub_t *dhd);
extern bool dhd_pcie_check_lps_d3_acked(dhd_pub_t *dhd);
void dhd_prot_ctrl_info_print(dhd_pub_t *dhd);
#else
#define dhd_prot_debug_info_print(x)
@@ -4439,6 +4555,9 @@ static inline uint32 next_larger_power2(uint32 num)
extern struct dhd_if * dhd_get_ifp(dhd_pub_t *dhdp, uint32 ifidx);
uint8 dhd_d11_slices_num_get(dhd_pub_t *dhdp);
#if defined(WL_AUTO_QOS) && defined(DHD_QOS_ON_SOCK_FLOW)
extern void dhd_wl_sock_qos_set_status(dhd_pub_t *dhdp, unsigned long on_off);
#endif /* WL_AUTO_QOS && DHD_QOS_ON_SOCK_FLOW */
extern void *dhd_get_roam_evt(dhd_pub_t *dhdp);
#if defined(DISABLE_HE_ENAB) || defined(CUSTOM_CONTROL_HE_ENAB)
@@ -4610,6 +4729,9 @@ static INLINE int dhd_kern_path(char *name, int flags, struct path *file_path)
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)) && (RHEL_RELEASE_CODE < \
RHEL_RELEASE_VERSION(7, 6))
#define DHD_VFS_UNLINK(dir, file_path, c) vfs_unlink(DHD_VFS_INODE(dir), file_path.dentry)
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0))
#define DHD_VFS_UNLINK(dir, file_path, c) \
vfs_unlink(mnt_idmap(file_path.mnt), DHD_VFS_INODE(dir), file_path.dentry, c)
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0))
#define DHD_VFS_UNLINK(dir, file_path, c) \
vfs_unlink(mnt_user_ns(file_path.mnt), DHD_VFS_INODE(dir), file_path.dentry, c)
@@ -4650,7 +4772,7 @@ void dhd_dump_wake_status(dhd_pub_t *dhdp, wake_counts_t *wcp, struct ether_head
#ifdef SUPPORT_OTA_UPDATE
void dhd_ota_buf_clean(dhd_pub_t *dhdp);
#endif /* SUPPORT_OTA_UPDATE */
#if !defined(AP) && defined(WLP2P)
#if defined(OEM_ANDROID) && !defined(AP) && defined(WLP2P)
extern uint32 dhd_get_concurrent_capabilites(dhd_pub_t *dhd);
#endif
#ifdef DHD_CUSTOM_CONFIG_RTS_IN_SUSPEND
@@ -4662,6 +4784,10 @@ extern uint32 dhd_get_concurrent_capabilites(dhd_pub_t *dhd);
#endif
int dhd_config_rts_in_suspend(dhd_pub_t *dhdp, bool suspend);
#endif /* DHD_CUSTOM_CONFIG_RTS_IN_SUSPEND */
extern void dhd_unregister_net(struct net_device *net, bool need_rtnl_lock);
extern int dhd_register_net(struct net_device *net, bool need_rtnl_lock);
#ifdef WL_MONITOR
void dhd_set_monitor(dhd_pub_t *pub, int ifidx, int val);
#ifdef BCMSDIO

View File

@@ -272,6 +272,11 @@ extern void dhd_bus_handle_mb_data(struct dhd_bus *bus, uint32 d2h_mb_data);
/* dump the device trap informtation */
extern void dhd_bus_dump_trap_info(struct dhd_bus *bus, struct bcmstrbuf *b);
extern void dhd_bus_copy_trap_sig(struct dhd_bus *bus, trap_t *tr);
#ifdef WL_CFGVENDOR_SEND_HANG_EVENT
void copy_hang_info_linkdown(dhd_pub_t *dhd);
void copy_ext_trap_sig(dhd_pub_t *dhd, trap_t *tr);
void copy_hang_info_trap(dhd_pub_t *dhd);
#endif /* WL_CFGVENDOR_SEND_HANG_EVENT */
/* Function to set default min res mask */
extern bool dhd_bus_set_default_min_res_mask(struct dhd_bus *bus);

View File

@@ -207,14 +207,13 @@ typedef struct ccode_list_map_t {
const char *ccode_ww;
} ccode_list_map_t;
extern const char ccode_43438[];
extern const char ccode_43455c0[];
extern const char ccode_4356a2[];
extern const char ccode_4359c0[];
extern const char ccode_4358u[];
const ccode_list_map_t ccode_list_map[] = {
/* ChipID Chiprev ccode */
#if defined(BCMSDIO) || defined(BCMPCIE)
{BCM4354_CHIP_ID, 2, ccode_4356a2, "XZ/11"},
{BCM4356_CHIP_ID, 2, ccode_4356a2, "XZ/11"},
{BCM4359_CHIP_ID, 9, ccode_4359c0, "XZ/11"},
#endif
#ifdef BCMSDIO
{BCM43430_CHIP_ID, 0, ccode_43438, ""},
{BCM43430_CHIP_ID, 1, ccode_43438, ""},
@@ -223,26 +222,58 @@ const ccode_list_map_t ccode_list_map[] = {
{BCM43454_CHIP_ID, 6, ccode_43455c0, "XZ/11"},
{BCM4345_CHIP_ID, 9, ccode_43455c0, "XZ/11"},
{BCM43454_CHIP_ID, 9, ccode_43455c0, "XZ/11"},
{BCM4354_CHIP_ID, 2, ccode_4356a2, "XZ/11"},
{BCM4356_CHIP_ID, 2, ccode_4356a2, "XZ/11"},
{BCM4371_CHIP_ID, 2, ccode_4356a2, "XZ/11"},
{BCM4359_CHIP_ID, 9, ccode_4359c0, "XZ/11"},
#endif
#ifdef BCMPCIE
{BCM4354_CHIP_ID, 2, ccode_4356a2, "XZ/11"},
{BCM4356_CHIP_ID, 2, ccode_4356a2, "XZ/11"},
{BCM4359_CHIP_ID, 9, ccode_4359c0, "XZ/11"},
{BCM4375_CHIP_ID, 5, ccode_4375b4, ""},
#endif
#ifdef BCMDBUS
{BCM43569_CHIP_ID, 2, ccode_4358u, "XW/0"},
{BCM43569_CHIP_ID, 2, ccode_4358u, "XZ/11"},
#endif
};
/*
* [ccode]:[disable_6g_band][disable_5g_band][ww_2g_chan_only]
* [ccode]:[x][xxxx][x]
*/
const char ccode_all_map[] = \
"AA:000002 "\
"AU:E08203 "\
"BH:F0E042 BR:00E002 "\
"CA:00E203 CN:F0E042 "\
"EU:E08002 "\
"GB:E08002 "\
"ID:F0F042 IL:F08002 IN:F08002 "\
"JP:E00082 "\
"KR:00E002 "\
"NZ:E0E002 "\
"PH:F0C002 "\
"RU:E0C302 "\
"SG:E0E002 "\
"TR:F00882 TW:F0E043 "\
"US:000003 "\
"VN:F0E002 "\
"ZA:F00882 ";
typedef struct ccode_all_chip_t {
uint chip;
uint chiprev;
} ccode_all_chip_t;
const ccode_all_chip_t ccode_all_chip[] = {
/* ChipID Chiprev */
// {0, 0},
#if defined(BCMSDIO) || defined(BCMPCIE)
{BCM43752_CHIP_ID, 4},
{BCM43756_CHIP_ID, 4},
{BCM43756_CHIP_ID, 6},
#endif
};
int
dhd_ccode_map_country_list(dhd_pub_t *dhd, wl_country_t *cspec)
{
int bcmerror = -1, i;
int ret = -1, i;
uint chip = dhd->conf->chip, chiprev = dhd->conf->chiprev;
const char *ccode_list = NULL, *ccode_ww = NULL;
char *pch;
@@ -260,17 +291,86 @@ dhd_ccode_map_country_list(dhd_pub_t *dhd, wl_country_t *cspec)
pch = strstr(ccode_list, cspec->ccode);
if (pch) {
cspec->rev = (int)simple_strtol(pch+strlen(cspec->ccode)+1, NULL, 0);
bcmerror = 0;
ret = 0;
}
}
if (dhd->op_mode != DHD_FLAG_MFG_MODE) {
if (bcmerror && ccode_ww && strlen(ccode_ww)>=4) {
if (ret && ccode_ww && strlen(ccode_ww)>=4) {
memcpy(cspec->ccode, ccode_ww, 2);
cspec->rev = (int)simple_strtol(ccode_ww+3, NULL, 0);
}
}
return bcmerror;
return ret;
}
#define WW_2G_CHAN_ONLY_MASK 0x00000F
#define DISABLE_5G_BAND_MASK 0x0FFFF0
#define DISABLE_6G_BAND_MASK 0xF00000
#define DISABLE_5G_BAND_OFFSET 4
#define DISABLE_6G_BAND_OFFSET 20
int
dhd_ccode_map_country_all(dhd_pub_t *dhd, wl_country_t *cspec)
{
int ret = -1, i;
struct dhd_conf *conf = dhd->conf;
wl_ccode_all_t *ccode_all = &dhd->conf->ccode_all;
uint chip = conf->chip, chiprev = conf->chiprev, val;
char *pch, *pick_tmp;
bool picked = FALSE;
if (conf->ccode_all_list) {
pch = strstr(conf->ccode_all_list, cspec->ccode);
if (!pch)
goto exit;
pick_tmp = bcmstrtok(&pch, ", ", 0);
if (!pick_tmp)
goto exit;
ccode_all->ww_2g_chan_only = 0x2;
ccode_all->disable_5g_band = 0;
ccode_all->disable_6g_band = 0;
pch = strstr(pick_tmp, "2g");
if (pch) {
ccode_all->ww_2g_chan_only = (int)simple_strtol(pch+strlen("2g"), NULL, 16);
picked = TRUE;
}
pch = strstr(pick_tmp, "5g");
if (pch) {
ccode_all->disable_5g_band = (int)simple_strtol(pch+strlen("5g"), NULL, 16);
picked = TRUE;
}
pch = strstr(pick_tmp, "6g");
if (pch) {
ccode_all->disable_6g_band = (int)simple_strtol(pch+strlen("6g"), NULL, 16);
picked = TRUE;
}
if (picked) {
memcpy(cspec->ccode, &ccode_all->cspec.ccode, WLC_CNTRY_BUF_SZ);
return 0;
}
}
exit:
for (i=0; i<sizeof(ccode_all_chip)/sizeof(ccode_all_chip[0]); i++) {
const ccode_all_chip_t* row = &ccode_all_chip[i];
if ((row->chip == chip && row->chiprev == chiprev) ||
(row->chip == 0 && row->chiprev == 0)) {
pch = strstr(ccode_all_map, cspec->ccode);
if (pch) {
val = simple_strtol(pch+strlen(cspec->ccode)+1, NULL, 16);
ccode_all->ww_2g_chan_only = val & WW_2G_CHAN_ONLY_MASK;
ccode_all->disable_5g_band = (val & DISABLE_5G_BAND_MASK) >> DISABLE_5G_BAND_OFFSET;
ccode_all->disable_6g_band = (val & DISABLE_6G_BAND_MASK) >> DISABLE_6G_BAND_OFFSET;
memcpy(cspec->ccode, &ccode_all->cspec.ccode, WLC_CNTRY_BUF_SZ);
ret = 0;
break;
}
}
}
return ret;
}
#endif

View File

@@ -178,6 +178,12 @@ dhdcdc_query_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len, uin
}
}
if (ifidx >= DHD_MAX_IFS) {
DHD_ERROR(("%s: IF index %d Invalid for the dongle FW\n",
__FUNCTION__, ifidx));
return -EIO;
}
memset(msg, 0, sizeof(cdc_ioctl_t));
#ifdef BCMSPI
@@ -294,6 +300,12 @@ dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len, uint8
DHD_TRACE_HW4(("%s: SET PM to %d\n", __FUNCTION__, buf ? *(char *)buf : 0));
}
if (ifidx >= DHD_MAX_IFS) {
DHD_ERROR(("%s: IF index %d Invalid for the dongle FW\n",
__FUNCTION__, ifidx));
return -EIO;
}
memset(msg, 0, sizeof(cdc_ioctl_t));
msg->cmd = htol32(cmd);
@@ -651,6 +663,14 @@ dhd_sync_with_dongle(dhd_pub_t *dhd)
DHD_TRACE(("%s: Enter\n", __FUNCTION__));
#ifndef OEM_ANDROID
/* Get the device MAC address */
strcpy(buf, "cur_etheraddr");
ret = dhd_wl_ioctl_cmd(dhd, WLC_GET_VAR, buf, sizeof(buf), FALSE, 0);
if (ret < 0)
goto done;
memcpy(dhd->mac.octet, buf, ETHER_ADDR_LEN);
#endif /* OEM_ANDROID */
#ifdef DHD_FW_COREDUMP
/* Check the memdump capability */
dhd_get_memdump_info(dhd);

View File

@@ -56,6 +56,16 @@ static int dhd_dongle_up = FALSE;
static s32 wl_dongle_up(struct net_device *ndev);
static s32 wl_dongle_down(struct net_device *ndev);
#ifndef OEM_ANDROID
static s32 wl_dongle_power(struct net_device *ndev, u32 power_mode);
#ifdef BCMSDIO /* glomming is a sdio specific feature */
static s32 wl_dongle_glom(struct net_device *ndev, s32 glom, u32 dongle_align);
#endif
static s32 wl_dongle_scantime(struct net_device *ndev, s32 scan_assoc_time, s32 scan_unassoc_time);
static s32 wl_dongle_offload(struct net_device *ndev, s32 arpoe, s32 arp_ol);
static s32 wl_pattern_atoh(s8 *src, s8 *dst);
static s32 wl_dongle_filter(struct net_device *ndev, u32 filter_mode);
#endif /* !OEM_ANDROID */
/**
* Function implementations
@@ -213,6 +223,46 @@ wl_dongle_down(struct net_device *ndev)
return err;
}
#ifndef OEM_ANDROID
static s32 wl_dongle_power(struct net_device *ndev, u32 power_mode)
{
s32 err = 0;
WL_TRACE(("In\n"));
err = wldev_ioctl_set(ndev, WLC_SET_PM, &power_mode, sizeof(power_mode));
if (unlikely(err)) {
WL_ERR(("WLC_SET_PM error (%d)\n", err));
}
return err;
}
#ifdef BCMSDIO
static s32
wl_dongle_glom(struct net_device *ndev, s32 glom, u32 dongle_align)
{
s32 err = 0;
/* Match Host and Dongle rx alignment */
err = wldev_iovar_setint(ndev, "bus:txglomalign", dongle_align);
if (unlikely(err)) {
WL_ERR(("txglomalign error (%d)\n", err));
goto dongle_glom_out;
}
/* disable glom option per default */
if (glom != DEFAULT_GLOM_VALUE) {
err = wldev_iovar_setint(ndev, "bus:txglom", glom);
if (unlikely(err)) {
WL_ERR(("txglom error (%d)\n", err));
goto dongle_glom_out;
}
}
dongle_glom_out:
return err;
}
#endif /* BCMSDIO */
#endif /* !OEM_ANDROID */
s32
wl_dongle_roam(struct net_device *ndev, u32 roamvar, u32 bcn_timeout)
{
@@ -237,6 +287,204 @@ dongle_rom_out:
return err;
}
#ifndef OEM_ANDROID
static s32
wl_dongle_scantime(struct net_device *ndev, s32 scan_assoc_time,
s32 scan_unassoc_time)
{
s32 err = 0;
err = wldev_ioctl_set(ndev, WLC_SET_SCAN_CHANNEL_TIME, &scan_assoc_time,
sizeof(scan_assoc_time));
if (err) {
if (err == -EOPNOTSUPP) {
WL_INFORM(("Scan assoc time is not supported\n"));
} else {
WL_ERR(("Scan assoc time error (%d)\n", err));
}
goto dongle_scantime_out;
}
err = wldev_ioctl_set(ndev, WLC_SET_SCAN_UNASSOC_TIME, &scan_unassoc_time,
sizeof(scan_unassoc_time));
if (err) {
if (err == -EOPNOTSUPP) {
WL_INFORM(("Scan unassoc time is not supported\n"));
} else {
WL_ERR(("Scan unassoc time error (%d)\n", err));
}
goto dongle_scantime_out;
}
dongle_scantime_out:
return err;
}
static s32
wl_dongle_offload(struct net_device *ndev, s32 arpoe, s32 arp_ol)
{
s8 iovbuf[WLC_IOCTL_SMLEN];
s32 err = 0;
s32 len;
struct bcm_cfg80211 *cfg = wl_get_cfg(ndev);
dhd_pub_t *dhd = (dhd_pub_t *)(cfg->pub);
/* Set ARP offload */
len = bcm_mkiovar("arpoe", (char *)&arpoe, sizeof(arpoe), iovbuf, sizeof(iovbuf));
if (!len) {
WL_ERR(("%s: bcm_mkiovar failed:%d\n", __FUNCTION__, len));
return BCME_BADARG;
}
err = wldev_ioctl_set(ndev, WLC_SET_VAR, iovbuf, len);
if (err) {
if (err == -EOPNOTSUPP)
WL_INFORM(("arpoe is not supported\n"));
else
WL_ERR(("arpoe error (%d)\n", err));
goto dongle_offload_out;
}
len = bcm_mkiovar("arp_ol", (char *)&arp_ol, sizeof(arp_ol), iovbuf, sizeof(iovbuf));
if (!len) {
WL_ERR(("%s: bcm_mkiovar failed:%d\n", __FUNCTION__, len));
return BCME_BADARG;
}
err = wldev_ioctl_set(ndev, WLC_SET_VAR, iovbuf, len);
if (err) {
if (err == -EOPNOTSUPP)
WL_INFORM(("arp_ol is not supported\n"));
else
WL_ERR(("arp_ol error (%d)\n", err));
goto dongle_offload_out;
}
dhd->arpoe_enable = TRUE;
dhd->arpol_configured = TRUE;
WL_ERR(("arpoe:%d arpol:%d\n",
dhd->arpoe_enable, dhd->arpol_configured));
dongle_offload_out:
return err;
}
static s32 wl_pattern_atoh(s8 *src, s8 *dst)
{
int i;
if (strncmp(src, "0x", 2) != 0 && strncmp(src, "0X", 2) != 0) {
WL_ERR(("Mask invalid format. Needs to start with 0x\n"));
return -1;
}
src = src + 2; /* Skip past 0x */
if (strlen(src) % 2 != 0) {
WL_ERR(("Mask invalid format. Needs to be of even length\n"));
return -1;
}
for (i = 0; *src != '\0'; i++) {
char num[3];
if ((num[0] = src[0]) != '\0') {
num[1] = src[1];
}
num[2] = '\0';
dst[i] = (u8) simple_strtoul(num, NULL, 16);
src += 2;
}
return i;
}
static s32 wl_dongle_filter(struct net_device *ndev, u32 filter_mode)
{
const s8 *str;
struct wl_pkt_filter pkt_filter;
struct wl_pkt_filter *pkt_filterp;
s32 buf_len;
s32 str_len;
u32 mask_size;
u32 pattern_size;
s8 buf[PKT_FILTER_BUF_SIZE] = {0};
s32 err = 0;
/* add a default packet filter pattern */
str = "pkt_filter_add";
str_len = strlen(str);
strlcpy(buf, str, sizeof(buf));
buf_len = str_len + 1;
pkt_filterp = (struct wl_pkt_filter *)(buf + str_len + 1);
/* Parse packet filter id. */
pkt_filter.id = htod32(100);
/* Parse filter polarity. */
pkt_filter.negate_match = htod32(0);
/* Parse filter type. */
pkt_filter.type = htod32(0);
/* Parse pattern filter offset. */
pkt_filter.u.pattern.offset = htod32(0);
/* Parse pattern filter mask. */
mask_size = htod32(wl_pattern_atoh("0xff",
(char *)pkt_filterp->u.pattern.
mask_and_pattern));
if (mask_size == (typeof(mask_size))-1 ||
(mask_size > (PKT_FILTER_BUF_SIZE - (buf_len) +
WL_PKT_FILTER_FIXED_LEN + WL_PKT_FILTER_PATTERN_FIXED_LEN))) {
/* mask_size has to be equal to pattern_size */
err = -EINVAL;
goto dongle_filter_out;
}
/* Parse pattern filter pattern. */
pattern_size = htod32(wl_pattern_atoh("0x00",
(char *)&pkt_filterp->u.pattern.mask_and_pattern[mask_size]));
if (mask_size != pattern_size) {
WL_ERR(("Mask and pattern not the same size\n"));
err = -EINVAL;
goto dongle_filter_out;
}
pkt_filter.u.pattern.size_bytes = mask_size;
buf_len += WL_PKT_FILTER_FIXED_LEN;
buf_len += (WL_PKT_FILTER_PATTERN_FIXED_LEN + 2 * mask_size);
/* Keep-alive attributes are set in local
* variable (keep_alive_pkt), and
* then memcpy'ed into buffer (keep_alive_pktp) since there is no
* guarantee that the buffer is properly aligned.
*/
memcpy((char *)pkt_filterp, &pkt_filter,
WL_PKT_FILTER_FIXED_LEN + WL_PKT_FILTER_PATTERN_FIXED_LEN);
err = wldev_ioctl_set(ndev, WLC_SET_VAR, buf, buf_len);
if (err) {
if (err == -EOPNOTSUPP) {
WL_INFORM(("filter not supported\n"));
} else {
WL_ERR(("filter (%d)\n", err));
}
goto dongle_filter_out;
}
/* set mode to allow pattern */
err = wldev_iovar_setint(ndev, "pkt_filter_mode", filter_mode);
if (err) {
if (err == -EOPNOTSUPP) {
WL_INFORM(("filter_mode not supported\n"));
} else {
WL_ERR(("filter_mode (%d)\n", err));
}
goto dongle_filter_out;
}
dongle_filter_out:
return err;
}
#endif /* !OEM_ANDROID */
s32 dhd_config_dongle(struct bcm_cfg80211 *cfg)
{
#ifndef DHD_SDALIGN
@@ -245,6 +493,10 @@ s32 dhd_config_dongle(struct bcm_cfg80211 *cfg)
struct net_device *ndev;
s32 err = 0;
dhd_pub_t *dhd = NULL;
#if !defined(OEM_ANDROID) && defined(BCMSDIO)
s32 glom = CUSTOM_GLOM_SETTING;
BCM_REFERENCE(glom);
#endif
WL_TRACE(("In\n"));
@@ -262,6 +514,29 @@ s32 dhd_config_dongle(struct bcm_cfg80211 *cfg)
return BCME_OK;
}
#ifndef OEM_ANDROID
err = wl_dongle_power(ndev, PM_FAST);
if (unlikely(err)) {
WL_ERR(("wl_dongle_power failed\n"));
goto default_conf_out;
}
#ifdef BCMSDIO
err = wl_dongle_glom(ndev, glom, DHD_SDALIGN);
if (unlikely(err)) {
WL_ERR(("wl_dongle_glom failed\n"));
goto default_conf_out;
}
#endif /* BCMSDIO */
err = wl_dongle_roam(ndev, (cfg->roam_on ? 0 : 1), 3);
if (unlikely(err)) {
WL_ERR(("wl_dongle_roam failed\n"));
goto default_conf_out;
}
wl_dongle_scantime(ndev, 40, 80);
wl_dongle_offload(ndev, 1, 0xf);
wl_dongle_filter(ndev, 1);
#endif /* OEM_ANDROID */
default_conf_out:
return err;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -67,12 +67,6 @@ typedef struct wl_chip_nv_path_list_ctrl {
struct wl_chip_nv_path *m_chip_nv_path_head;
} wl_chip_nv_path_list_ctrl_t;
#define MAX_CTRL_CHANSPECS 256
typedef struct wl_channel_list {
uint32 count;
uint32 channel[MAX_CTRL_CHANSPECS];
} wl_channel_list_t;
typedef struct wmes_param {
int aifsn[AC_COUNT];
int ecwmin[AC_COUNT];
@@ -101,6 +95,13 @@ typedef struct country_list {
wl_country_t cspec;
} country_list_t;
typedef struct wl_ccode_all {
wl_country_t cspec;
int32 ww_2g_chan_only;
int32 disable_5g_band;
int32 disable_6g_band;
} wl_ccode_all_t;
/* mchan_params */
#define MCHAN_MAX_NUM 4
#define MIRACAST_SOURCE 1
@@ -220,11 +221,12 @@ typedef struct dhd_conf {
#endif
wl_chip_nv_path_list_ctrl_t nv_by_chip;
country_list_t *country_head;
char *ccode_all_list;
wl_ccode_all_t ccode_all;
int ioctl_ver;
int band;
int bw_cap[2];
wl_country_t cspec;
wl_channel_list_t channels;
uint roam_off;
uint roam_off_suspend;
int roam_trigger[2];
@@ -243,6 +245,8 @@ typedef struct dhd_conf {
conf_pkt_filter_add_t pkt_filter_add;
conf_pkt_filter_del_t pkt_filter_del;
char *magic_pkt_filter_add;
int magic_pkt_hdr_len;
int pkt_filter_cnt_default;
#endif
int srl;
int lrl;
@@ -373,6 +377,9 @@ typedef struct dhd_conf {
#ifdef BCMSDIO
int32 doflow_tput_thresh;
#endif
#ifdef BCMPCIE
int32 napi_tput_thresh;
#endif
#endif
#ifdef SCAN_SUPPRESS
uint scan_intput;
@@ -418,12 +425,13 @@ void dhd_conf_set_path_params(dhd_pub_t *dhd, char *fw_path, char *nv_path);
int dhd_conf_set_intiovar(dhd_pub_t *dhd, int ifidx, uint cmd, char *name,
int val, int def, bool down);
int dhd_conf_get_band(dhd_pub_t *dhd);
bool dhd_conf_same_country(dhd_pub_t *dhd, char *buf);
int dhd_conf_country(dhd_pub_t *dhd, char *cmd, char *buf);
int dhd_conf_get_country(dhd_pub_t *dhd, wl_country_t *cspec);
#ifdef CCODE_LIST
int dhd_ccode_map_country_all(dhd_pub_t *dhd, wl_country_t *cspec);
int dhd_ccode_map_country_list(dhd_pub_t *dhd, wl_country_t *cspec);
#endif
bool dhd_conf_match_channel(dhd_pub_t *dhd, uint32 channel);
void dhd_conf_set_wme(dhd_pub_t *dhd, int ifidx, int mode);
void dhd_conf_set_mchan_bw(dhd_pub_t *dhd, int go, int source);
void dhd_conf_add_pkt_filter(dhd_pub_t *dhd);

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,8 @@
/*
* Broadcom Dongle Host Driver (DHD), CSI
* Broadcom Dongle Host Driver (DHD), Linux-specific network interface.
* Basically selected code segments from usb-cdc.c and usb-rndis.c
*
* Copyright (C) 1999-2018, Broadcom.
* Copyright (C) 2023, Broadcom.
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
@@ -17,27 +18,252 @@
* 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_csi.h 558438 2015-05-22 06:05:11Z $
* <<Broadcom-WL-IPTag/Open:>>
*
* $Id$
*/
#ifndef __DHD_CSI_H__
#define __DHD_CSI_H__
/* definition for structure and API between APPP and driver */
/* **** SYNA CSI header interface with driver **** */
enum syna_csi_data_mode_type {
SYNA_CSI_DATA_MODE_NONE = 0,
/* upper layer will fetch data by sysfs */
SYNA_CSI_DATA_MODE_SYSFS,
/* upper layer will fetch data by UDP socket */
SYNA_CSI_DATA_MODE_UDP_SOCKET,
SYNA_CSI_DATA_MODE_LAST
};
enum syna_csi_format_type {
SYNA_CSI_FORMAT_UNKNOWN = 0,
SYNA_CSI_FORMAT_Q8, /* (9,9,5) Q8 floating point
* BCM4358/4359
*/
SYNA_CSI_FORMAT_Q13, /* (14,14) Q13 fixed point
* BCM4339/43455/43456/43458
*/
SYNA_CSI_FORMAT_Q11, /* (12,12,6) Q11 floating point
* BCM4360/4366
*/
SYNA_CSI_FORMAT_LAST
};
/* (9,9,5) Q8 floating point data format */
#define _Q8_REAL_MA(t) (0x000ff &((t)>>14))
#define _Q8_REAL_SI(t) (0x00001 &((t)>>22))
#define _Q8_IMAGE_MA(t) (0x000ff &((t)>> 5))
#define _Q8_IMAGE_SI(t) (0x00001 &((t)>>13))
#define SYNA_CSI_DATA_Q8_REAL(t) \
(((0 < _Q8_REAL_SI(t)) \
? (-1) \
: (1)) \
* ((int32)_Q8_REAL_MA(t)) \
)
#define SYNA_CSI_DATA_Q8_IMAGE(t) \
(((0 < _Q8_IMAGE_SI(t)) \
? (-1) \
: (1)) \
* ((int32)_Q8_IMAGE_MA(t)) \
)
#define SYNA_CSI_DATA_Q8_EXP(t) \
(((int8)(0xf8 \
& ((t) << 3))) \
>> 3 \
)
/* (14,14) Q13 fixed point data format */
#define SYNA_CSI_DATA_Q13_REAL(t) \
(((int32)(0xfff30000 \
& ((t) << 4))) \
>> (14 + 4) \
)
#define SYNA_CSI_DATA_Q13_IMAGE(t) \
(((int32)(0xfff30000 \
& ((t) << 18))) \
>> (0 + 18) \
)
/* (12,12,6) Q11 floating point */
#define _Q11_REAL_MA(t) (0x007ff &((t)>>18))
#define _Q11_REAL_SI(t) (0x00001 &((t)>>29))
#define _Q11_IMAGE_MA(t) (0x007ff &((t)>> 6))
#define _Q11_IMAGE_SI(t) (0x00001 &((t)>>17))
#define SYNA_CSI_DATA_Q11_REAL(t) \
(((0 < _Q11_REAL_SI(t)) \
? (-1) \
: (1)) \
* ((int32)_Q11_REAL_MA(t)) \
)
#define SYNA_CSI_DATA_Q11_IMAGE(t) \
(((0 < _Q11_IMAGE_SI(t)) \
? (-1) \
: (1)) \
* ((int32)_Q11_IMAGE_MA(t)) \
)
#define SYNA_CSI_DATA_Q11_EXP(t) \
(((int8)(0xfc \
& ((t) << 2))) \
>> 2 \
)
enum syna_csi_error_status {
SYNA_CSI_ERROR_NONE,
SYNA_CSI_ERROR_GENERIC, /* generic error */
SYNA_CSI_ERROR_NO_ACK, /* peer doesn't ACK */
SYNA_CSI_ERROR_READ, /* read data error */
SYNA_CSI_ERROR_PS, /* peer device under powersaving */
SYNA_CSI_ERROR_LAST
};
enum syna_csi_flag {
/* bit 0 ~ bit 15 are for error information */
SYNA_CSI_FLAG_ERROR_MASK = 0x0FFFF,
SYNA_CSI_FLAG_ERROR_CHECKSUM = (1 << 0),
SYNA_CSI_FLAG_ERROR_GENERIC = (1 << SYNA_CSI_ERROR_GENERIC),
SYNA_CSI_FLAG_ERROR_NO_ACK = (1 << SYNA_CSI_ERROR_NO_ACK),
SYNA_CSI_FLAG_ERROR_READ = (1 << SYNA_CSI_ERROR_READ),
SYNA_CSI_FLAG_ERROR_PS = (1 << SYNA_CSI_ERROR_PS),
/* subcarrier real position along FFT index: (total N=2*M subcarries)
* -M, -(M-1), -(M-2), -(M-3),...,-1, 0, 1, 2,...M-1, M
*
* Data Output order with positive part first(*default*):
* 0, 1, 2,...M-1, M, -M, -(M-1), -(M-2), -(M-3),...,-1,
*
* Data Output order with negative part first:
* -M, -(M-1), -(M-2), -(M-3),...,-1, 0, 1, 2,...M-1, M
*/
SYNA_CSI_FLAG_FFT_NEGATIVE_FIRST = (1 << 16),
SYNA_CSI_FLAG_LAST
};
enum syna_csi_band_type {
SYNA_CSI_BAND_UNKNOWN = 0,
SYNA_CSI_BAND_2G,
SYNA_CSI_BAND_5G,
SYNA_CSI_BAND_6G,
SYNA_CSI_BAND_LAST
};
enum syna_csi_bandwidth_type {
SYNA_CSI_BW_UNKNOWN = 0x000,
SYNA_CSI_BW_5MHz = 0x001,
SYNA_CSI_BW_10MHz = 0x002,
SYNA_CSI_BW_20MHz = 0x004,
SYNA_CSI_BW_40MHz = 0x008,
SYNA_CSI_BW_80MHz = 0x010,
SYNA_CSI_BW_160MHz = 0x020,
SYNA_CSI_BW_320MHz = 0x040,
SYNA_CSI_BW_LAST
};
/* 'SYNA' -> 'A'53, 'N'59, 'Y'4e, 'S'41 */
#define CONST_SYNA_CSI_MAGIC_FLAG 0x414E5953
/* CSI API common header structure (8 bytes alignment for 64bit system) */
/* below is version 1 'syna_csi_header' */
#define CONST_SYNA_CSI_COMMON_HEADER_VERSION 0x01
struct syna_csi_header {
/* byte 0 ~ 3 */
uint32 magic_flag; /* flag for protecting and detecting header */
/* byte 4 ~ 7 */
uint8 version; /* header version of this structure */
uint8 format_type; /* data format type of current CSI packet,
* enumerated in 'syna_csi_format_type'
*/
uint8 fc; /* packet frame control type of current
* CSI data for further checking if it
* is correct expected result
*/
uint8 flags; /* flag may use for extra emendation
* which enumerated as 'syna_csi_flag'
*/
/* byte 8 ~ 19 */
uint8 client_ea[6]; /* client MAC address */
uint8 bsscfg_ea[6]; /* BSSCFG address of current interface */
/* byte 20 ~ 23 */
uint8 band; /* enumerated in 'syna_csi_band_type' */
uint8 bandwidth; /* enumerated in 'syna_csi_bandwidth_type' */
uint16 channel; /* channel number of corresponding band */
/* byte 24 ~ 31 */
uint64 report_tsf; /* current CSI DATA RX timestamp */
/* byte 32 ~ 35 */
uint8 num_txstream; /* peer side TX spatial steams */
uint8 num_rxchain; /* number of RX side chain/antenna */
uint16 num_subcarrier; /* Number of subcarrier */
/* byte 36 ~ 39 */
int8 rssi; /* average RSSI, and goto check the
* 'rssi_ant' if this 'rssi' is zero
*/
int8 noise; /* average noise */
int16 global_id; /* CSI frame global ID */
/* byte 40 ~ 47 */
int8 rssi_ant[8]; /* RSSI of each RX chain/antenna
* (Depends on solution, and some
* chipsets may only provide 'rssi'
* rather than 'rssi_ant')
*/
/* byte 48 ~ 55 */
uint64 padding_future; /* reserved */
/* byte 56 ~ 63 */
uint16 data_length; /* the bytes of 'data[]' */
uint16 remain_length; /* remain length of not received data */
uint16 copied_length; /* the length has been copied to user */
uint16 checksum; /* 'data[]' checksum, 0 - not used */
/* byte 64 ~ End */
uint32 data[0]; /* variable length according to the
* 'data_length', but the minimal
* valid data length will be
* decided by the 'num_txchains'
* 'num_rxchain' 'num_subcarrier'.
* For example, the index quantity
* of 'uint32' in the 11N 80MHz can
* be got via:
* 256 SubCarriers * 2 TXStream * 2 RXChain
* Note: 'data_length' is bytes quantity,
* and the 'data[]' array index range should
* be 0 ~ (data_length/4 - 1)
*/
};
#define SYNA_CSI_PKT_TOTAL_LEN(ptr) \
(sizeof(struct syna_csi_header) \
+ ((struct syna_csi_header *)(ptr))->data_length \
)
/* definition for structure and functions between driver and FW */
/* Maxinum csi file dump size */
#define MAX_CSI_FILESZ (32 * 1024)
/* Maxinum subcarrier number */
#define MAXINUM_CFR_DATA 256 * 4
#define MAXIMUM_CFR_DATA 2048
#define CSI_DUMP_PATH "/sys/bcm-dhd/csi"
#define MAX_EVENT_SIZE 1400
/* maximun csi number stored at dhd */
#define MAX_CSI_NUM 8
#define MAX_CSI_NUM 16
#define MAX_CSI_BUF_NUM 1024
typedef struct cfr_dump_header {
/* 0 - successful; 1 - Failed */
uint8 status;
/* CSI VERSION */
#define CSI_VERSION_V0 0 /* V0 */
#define CSI_VERSION_V1 1 /* V1 */
#define CSI_VERSION_V2 2 /* V2 */
struct dhd_cfr_header_v0 {
uint8 status:4; /* bit3-0 */
uint8 version:4; /* bit7-4 */
/* Peer MAC address */
uint8 peer_macaddr[6];
/* Number of Space Time Streams */
@@ -52,25 +278,189 @@ typedef struct cfr_dump_header {
uint32 remain_length;
/* RSSI */
int8 rssi;
} __attribute__((packed)) cfr_dump_header_t;
uint32 data[0];
} __attribute__ ((packed));
typedef struct cfr_dump_data {
cfr_dump_header_t header;
uint32 data[MAXINUM_CFR_DATA];
} cfr_dump_data_t;
struct dhd_cfr_header_v1 {
uint8 status:4; /* bit3-0 */
uint8 version:4; /* bit7-4 */
/* Peer MAC address */
uint8 peer_macaddr[6];
/* Number of Space Time Streams */
uint8 sts;
/* Number of RX chain */
uint8 num_rx;
/* Number of subcarrier */
uint16 num_carrier;
/* Length of the CSI dump */
uint32 cfr_dump_length;
/* remain unsend CSI data length */
uint32 remain_length;
/* RSSI */
int8 rssi;
typedef struct {
struct list_head list;
cfr_dump_data_t entry;
} cfr_dump_list_t;
/* Chip id. 1 for BCM43456/8 */
uint8 chip_id;
/* Frame control field */
uint8 fc;
/* Time stamp when CFR capture is taken,
* in microseconds since the epoch
*/
uint64 cfr_timestamp;
int dhd_csi_event_handler(dhd_pub_t *dhd, wl_event_msg_t *event, void *event_data);
uint32 data[0];
} __attribute__ ((packed));
int dhd_csi_init(dhd_pub_t *dhd);
struct dhd_cfr_header_v2 { /* 8 bytes aligment for x64 */
/* byte 0 ~ 7 */
uint8 status_compat:4; /* bit3-0, current CSI data status: 0->good */
uint8 version_compat:4; /* bit7-4, duplicate but compatible part */
uint8 padding_magic;
uint16 magic_flag; /* flag for protecting and detecting header */
int dhd_csi_deinit(dhd_pub_t *dhd);
uint8 version; /* header version of this structure */
uint8 format_type; /* data format type of current CSI packet,
* enumerated in 'syna_csi_format_type'
*/
uint8 fc; /* packet frame control type of current
* CSI data for further checking if it
* is correct expected result
*/
uint8 flags; /* flag may use for extra emendation
* which enumerated as 'syna_csi_flag'
*/
void dhd_csi_clean_list(dhd_pub_t *dhd);
/* byte 8 ~ 19 */
uint8 client_ea[6]; /* client MAC address */
uint8 bsscfg_ea[6]; /* BSSCFG address of current interface */
/* byte 20 ~ 23 */
uint8 band; /* enumerated in 'syna_csi_band_type' */
uint8 bandwidth; /* enumerated in 'syna_csi_bandwidth_type' */
uint16 channel; /* channel number of corresponding band */
/* byte 24 ~ 31 */
uint64 report_tsf; /* current CSI DATA RX timestamp */
/* byte 32 ~ 35 */
uint8 num_txstream; /* peer side TX spatial steams */
uint8 num_rxchain; /* number of RX side chain/antenna */
uint16 num_subcarrier; /* Number of subcarrier */
/* byte 36 ~ 39 */
int8 rssi; /* average RSSI, and goto check the
* 'rssi_ant' if this 'rssi' is zero
*/
int8 noise; /* average noise */
int16 global_id; /* CSI frame global ID */
/* byte 40 ~ 47 */
int8 rssi_ant[8]; /* RSSI of each RX chain/antenna
* (Depends on solution, and some
* chipsets may only provide 'rssi'
* rather than 'rssi_ant')
*/
/* byte 48 ~ 55 */
uint64 padding_future; /* reserved */
/* byte 56 ~ 63 */
uint16 data_length; /* the data length of 'data[]' */
uint16 remain_length; /* the remain unsent length of 'data[]' */
uint16 padding_length; /* reserved */
uint16 checksum; /* 'data[]' checksum, 0 - not used */
/* byte 64 ~ End */
uint32 data[0]; /* variable according to 'data_length', but
* the minial valid data length will be
* decided by 'num_txchains', 'num_rxchain'
* 'num_subcarrier'. For example, the
* quantity of uint32(4 bytes) in the
* 11N 80MHz can be got via:
* 256 SubCarriers * 2 TXStream * 2 RXChain
*/
};
union dhd_cfr_header {
struct dhd_cfr_header_v0 header_v0;
struct dhd_cfr_header_v1 header_v1;
struct dhd_cfr_header_v2 header_v2;
};
#define CSI_CFR_TOTAL_LENGTH(data_len) \
(sizeof(union dhd_cfr_header) + data_len)
/* BW80 2x2 => 4bytes*256subcarries*2txstream*2rxchain */
#define CONST_CSI_MAXIMUM_DATA_BYTES (CSI_CFR_TOTAL_LENGTH(256 *2 *2 *4))
struct csi_cfr_node {
struct list_head list;
void *pNode; /* recording current node pointer
* especially for UDP data manner
*/
uint32 total_size;
struct syna_csi_header entry;
};
#define SYNA_CSI_CFR_NODE_LEN sizeof(struct csi_cfr_node)
#define SYNA_CSI_CFR_NODE_TOTAL_LEN(ptr, data_length) \
(\
SYNA_CSI_CFR_NODE_LEN + data_length \
)
#define SYNA_CSI_CFR_NODE_FREE_LEN(ptr) \
(\
((struct csi_cfr_node *)(ptr))->total_size \
- SYNA_CSI_CFR_NODE_LEN \
)
extern int dhd_csi_config(dhd_pub_t *dhdp, char *buf, uint length, bool is_set);
/* Function: change the upper layer fetching data manner
* Input: uint is_set indicate it's set or get action
* uint type the expected fetch type(ignore when get)
* uint param extra param when set(UDP socket port)
* Output: < 0 error encounter
* == 0 successful
* > 0 corresponding 'fetch type' when get
*/
extern int dhd_csi_data_fetch_type_access(uint is_set, uint type, uint param);
/* Function: parse the CSI event and convert to 'dhd_csi_header' format,
* and queue the item into the common 'csi_cfr_queue'
* Input: dhd_pub_t *dhdp context for operation
* char *buf buffer for storing csi data
* uint count total bytes available in 'buf'
* Output: < 0 error encounter
* == 0 successful but no csi data in queue
* > 0 bytes write into 'buf'
*/
extern int dhd_csi_retrieve_queue_data(dhd_pub_t *dhdp, char *buf, uint count);
/* Function: parse the CSI event and convert to 'dhd_csi_header' format,
* and queue the item into the common 'csi_cfr_queue'
* Input: dhd_pub_t *dhdp context for operation
* wl_event_msg_t *event wl event message header
* void *event_data extra event data
* Output: < 0 error encounter
* == 0 successful
*/
extern int dhd_csi_event_handler(dhd_pub_t *dhdp,
const wl_event_msg_t *event, void *event_data);
/* Function: Initialize the CSI module
* Input: dhd_pub_t *dhdp context for operation
* Output: < 0 error encounter
* == 0 successful
*/
extern int dhd_csi_init(dhd_pub_t *dhdp);
/* Function: Deinitialize the CSI module
* Input: dhd_pub_t *dhdp context for operation
* Output: < 0 error encounter
* == 0 successful
*/
extern int dhd_csi_deinit(dhd_pub_t *dhdp);
int dhd_csi_dump_list(dhd_pub_t *dhd, char *buf);
#endif /* __DHD_CSI_H__ */

Some files were not shown because too many files have changed in this diff Show More