summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/bmi/inc/bmi.h14
-rw-r--r--core/bmi/src/bmi.c82
-rw-r--r--core/bmi/src/bmi_1.c24
-rw-r--r--core/bmi/src/bmi_2.c28
-rw-r--r--core/bmi/src/i_bmi.h12
-rw-r--r--core/cds/inc/cds_sched.h1
-rw-r--r--core/cds/src/cds_api.c24
-rw-r--r--core/hdd/src/wlan_hdd_driver_ops.c17
-rw-r--r--core/hdd/src/wlan_hdd_ftm.c6
-rw-r--r--core/utils/epping/src/epping_main.c6
10 files changed, 177 insertions, 37 deletions
diff --git a/core/bmi/inc/bmi.h b/core/bmi/inc/bmi.h
index 4548fd711160..d292cb3114ae 100644
--- a/core/bmi/inc/bmi.h
+++ b/core/bmi/inc/bmi.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -37,22 +37,26 @@
#include "ol_if_athvar.h"
#include "hif.h"
+struct ol_context;
+CDF_STATUS ol_cds_init(cdf_device_t cdf_dev, void *hif_ctx);
+void ol_cds_free(void);
+
#ifdef HIF_PCI
void bmi_cleanup(struct ol_softc *scn);
-CDF_STATUS bmi_done(struct ol_softc *scn);
-CDF_STATUS bmi_download_firmware(struct ol_softc *scn);
+CDF_STATUS bmi_done(struct ol_context *ol_ctx);
+CDF_STATUS bmi_download_firmware(struct ol_context *ol_ctx);
#else
static inline void bmi_cleanup(struct ol_softc *scn)
{
return;
}
-static inline CDF_STATUS bmi_done(struct ol_softc *scn)
+static inline CDF_STATUS bmi_done(struct ol_context *ol_ctx)
{
return CDF_STATUS_SUCCESS;
}
-static inline CDF_STATUS bmi_download_firmware(struct ol_softc *scn)
+static inline CDF_STATUS bmi_download_firmware(struct ol_context *ol_ctx)
{
return CDF_STATUS_SUCCESS;
}
diff --git a/core/bmi/src/bmi.c b/core/bmi/src/bmi.c
index c520057265bb..ad625a0cb661 100644
--- a/core/bmi/src/bmi.c
+++ b/core/bmi/src/bmi.c
@@ -128,9 +128,10 @@ void bmi_cleanup(struct ol_softc *scn)
}
-CDF_STATUS bmi_done(struct ol_softc *scn)
+CDF_STATUS bmi_done(struct ol_context *ol_ctx)
{
CDF_STATUS status = CDF_STATUS_SUCCESS;
+ struct ol_softc *scn = ol_ctx->scn;
if (NO_BMI)
return status;
@@ -151,6 +152,8 @@ bmi_get_target_info(struct bmi_target_info *targ_info,
uint8_t *bmi_cmd_buff = info->bmi_cmd_buff;
uint8_t *bmi_rsp_buff = info->bmi_rsp_buff;
uint32_t cid, length;
+ cdf_dma_addr_t cmd = info->bmi_cmd_da;
+ cdf_dma_addr_t rsp = info->bmi_rsp_da;
if (info->bmi_done) {
BMI_ERR("BMI Phase is Already Done");
@@ -166,7 +169,7 @@ bmi_get_target_info(struct bmi_target_info *targ_info,
cdf_mem_copy(bmi_cmd_buff, &cid, sizeof(cid));
length = sizeof(struct bmi_target_info);
- status = hif_exchange_bmi_msg(scn, bmi_cmd_buff, sizeof(cid),
+ status = hif_exchange_bmi_msg(scn, cmd, rsp, bmi_cmd_buff, sizeof(cid),
(uint8_t *)bmi_rsp_buff, &length,
BMI_EXCHANGE_TIMEOUT_MS);
if (status) {
@@ -190,11 +193,12 @@ static inline uint32_t bmi_get_test_addr(void)
}
#endif
-CDF_STATUS bmi_download_firmware(struct ol_softc *scn)
+CDF_STATUS bmi_download_firmware(struct ol_context *ol_ctx)
{
uint8_t data[10], out[10];
uint32_t address;
int32_t ret;
+ struct ol_softc *scn = ol_ctx->scn;
if (NO_BMI)
return CDF_STATUS_SUCCESS; /* no BMI for Q6 bring up */
@@ -233,6 +237,8 @@ bmi_read_soc_register(uint32_t address, uint32_t *param, struct ol_softc *scn)
struct bmi_info *info = hif_get_bmi_ctx(scn);
uint8_t *bmi_cmd_buff = info->bmi_cmd_buff;
uint8_t *bmi_rsp_buff = info->bmi_rsp_buff;
+ cdf_dma_addr_t cmd = info->bmi_cmd_da;
+ cdf_dma_addr_t rsp = info->bmi_rsp_da;
bmi_assert(BMI_COMMAND_FITS(sizeof(cid) + sizeof(address)));
cdf_mem_set(bmi_cmd_buff, 0, sizeof(cid) + sizeof(address));
@@ -254,7 +260,7 @@ bmi_read_soc_register(uint32_t address, uint32_t *param, struct ol_softc *scn)
cdf_mem_copy(&(bmi_cmd_buff[offset]), &address, sizeof(address));
offset += sizeof(address);
param_len = sizeof(*param);
- status = hif_exchange_bmi_msg(scn, bmi_cmd_buff, offset,
+ status = hif_exchange_bmi_msg(scn, cmd, rsp, bmi_cmd_buff, offset,
bmi_rsp_buff, &param_len, BMI_EXCHANGE_TIMEOUT_MS);
if (status) {
BMI_DBG("Unable to read from the device; status:%d", status);
@@ -275,6 +281,9 @@ bmi_write_soc_register(uint32_t address, uint32_t param, struct ol_softc *scn)
struct bmi_info *info = hif_get_bmi_ctx(scn);
uint8_t *bmi_cmd_buff = info->bmi_cmd_buff;
uint32_t size = sizeof(cid) + sizeof(address) + sizeof(param);
+ cdf_dma_addr_t cmd = info->bmi_cmd_da;
+ cdf_dma_addr_t rsp = info->bmi_rsp_da;
+
bmi_assert(BMI_COMMAND_FITS(size));
cdf_mem_set(bmi_cmd_buff, 0, size);
@@ -295,7 +304,7 @@ bmi_write_soc_register(uint32_t address, uint32_t param, struct ol_softc *scn)
offset += sizeof(address);
cdf_mem_copy(&(bmi_cmd_buff[offset]), &param, sizeof(param));
offset += sizeof(param);
- status = hif_exchange_bmi_msg(scn, bmi_cmd_buff, offset,
+ status = hif_exchange_bmi_msg(scn, cmd, rsp, bmi_cmd_buff, offset,
NULL, NULL, 0);
if (status) {
BMI_ERR("Unable to write to the device: status:%d", status);
@@ -316,6 +325,8 @@ bmilz_data(uint8_t *buffer, uint32_t length, struct ol_softc *scn)
const uint32_t header = sizeof(cid) + sizeof(length);
struct bmi_info *info = hif_get_bmi_ctx(scn);
uint8_t *bmi_cmd_buff = info->bmi_cmd_buff;
+ cdf_dma_addr_t cmd = info->bmi_cmd_da;
+ cdf_dma_addr_t rsp = info->bmi_rsp_da;
bmi_assert(BMI_COMMAND_FITS(BMI_DATASZ_MAX + header));
cdf_mem_set(bmi_cmd_buff, 0, BMI_DATASZ_MAX + header);
@@ -342,8 +353,9 @@ bmilz_data(uint8_t *buffer, uint32_t length, struct ol_softc *scn)
cdf_mem_copy(&(bmi_cmd_buff[offset]),
&buffer[length - remaining], txlen);
offset += txlen;
- status = hif_exchange_bmi_msg(scn, bmi_cmd_buff, offset,
- NULL, NULL, 0);
+ status = hif_exchange_bmi_msg(scn, cmd, rsp,
+ bmi_cmd_buff, offset,
+ NULL, NULL, 0);
if (status) {
BMI_ERR("Failed to write to the device: status:%d",
status);
@@ -370,6 +382,8 @@ bmi_sign_stream_start(uint32_t address,
struct bmi_info *info = hif_get_bmi_ctx(scn);
uint8_t *bmi_cmd_buff = info->bmi_cmd_buff;
uint32_t remaining, txlen;
+ cdf_dma_addr_t cmd = info->bmi_cmd_da;
+ cdf_dma_addr_t rsp = info->bmi_rsp_da;
bmi_assert(BMI_COMMAND_FITS(BMI_DATASZ_MAX + header));
cdf_mem_set(bmi_cmd_buff, 0, BMI_DATASZ_MAX + header);
@@ -407,9 +421,9 @@ bmi_sign_stream_start(uint32_t address,
offset += sizeof(txlen);
cdf_mem_copy(&(bmi_cmd_buff[offset]), src, txlen);
offset += txlen;
- status = hif_exchange_bmi_msg(scn,
- bmi_cmd_buff, offset,
- NULL, NULL, BMI_EXCHANGE_TIMEOUT_MS);
+ status = hif_exchange_bmi_msg(scn, cmd, rsp,
+ bmi_cmd_buff, offset, NULL,
+ NULL, BMI_EXCHANGE_TIMEOUT_MS);
if (status) {
BMI_ERR("Unable to write to the device: status:%d",
status);
@@ -430,6 +444,8 @@ bmilz_stream_start(uint32_t address, struct ol_softc *scn)
uint32_t offset;
struct bmi_info *info = hif_get_bmi_ctx(scn);
uint8_t *bmi_cmd_buff = info->bmi_cmd_buff;
+ cdf_dma_addr_t cmd = info->bmi_cmd_da;
+ cdf_dma_addr_t rsp = info->bmi_rsp_da;
bmi_assert(BMI_COMMAND_FITS(sizeof(cid) + sizeof(address)));
cdf_mem_set(bmi_cmd_buff, 0, sizeof(cid) + sizeof(address));
@@ -447,7 +463,7 @@ bmilz_stream_start(uint32_t address, struct ol_softc *scn)
offset += sizeof(cid);
cdf_mem_copy(&(bmi_cmd_buff[offset]), &address, sizeof(address));
offset += sizeof(address);
- status = hif_exchange_bmi_msg(scn, bmi_cmd_buff, offset,
+ status = hif_exchange_bmi_msg(scn, cmd, rsp, bmi_cmd_buff, offset,
NULL, NULL, 0);
if (status) {
BMI_ERR("Unable to Start LZ Stream to the device status:%d",
@@ -494,3 +510,47 @@ end:
return status;
}
+/**
+ * ol_cds_init() - API to initialize global CDS OL Context
+ * @cdf_dev: CDF Device
+ * @hif_ctx: HIF Context
+ *
+ * Return: Success/Failure
+ */
+CDF_STATUS ol_cds_init(cdf_device_t cdf_dev, void *hif_ctx)
+{
+ struct ol_context *ol_info;
+ CDF_STATUS status = CDF_STATUS_SUCCESS;
+
+ if (NO_BMI)
+ return CDF_STATUS_SUCCESS; /* no BMI for Q6 bring up */
+
+ status = cds_alloc_context(cds_get_global_context(), CDF_MODULE_ID_BMI,
+ (void **)&ol_info, sizeof(*ol_info));
+
+ if (status != CDF_STATUS_SUCCESS) {
+ BMI_ERR("%s: CDS Allocation failed for ol_bmi context",
+ __func__);
+ return status;
+ }
+
+ ol_info->cdf_dev = cdf_dev;
+ ol_info->scn = hif_ctx;
+
+ return status;
+}
+
+/**
+ * ol_cds_free() - API to free the global CDS OL Context
+ *
+ * Return: void
+ */
+void ol_cds_free(void)
+{
+ struct ol_context *ol_info = cds_get_context(CDF_MODULE_ID_BMI);
+
+ if (NO_BMI)
+ return;
+
+ cds_free_context(cds_get_global_context(), CDF_MODULE_ID_BMI, ol_info);
+}
diff --git a/core/bmi/src/bmi_1.c b/core/bmi/src/bmi_1.c
index 1936623c5d14..d2293338051d 100644
--- a/core/bmi/src/bmi_1.c
+++ b/core/bmi/src/bmi_1.c
@@ -42,6 +42,8 @@ bmi_read_memory(uint32_t address,
uint8_t *bmi_cmd_buff = info->bmi_cmd_buff;
uint8_t *bmi_rsp_buff = info->bmi_rsp_buff;
uint32_t align;
+ cdf_dma_addr_t cmd = info->bmi_cmd_da;
+ cdf_dma_addr_t rsp = info->bmi_rsp_da;
if (info->bmi_done) {
BMI_DBG("command disallowed");
@@ -80,8 +82,9 @@ bmi_read_memory(uint32_t address,
offset += sizeof(length);
/* note we reuse the same buffer to receive on */
- status = hif_exchange_bmi_msg(scn, bmi_cmd_buff, offset,
- bmi_rsp_buff, &rxlen, BMI_EXCHANGE_TIMEOUT_MS);
+ status = hif_exchange_bmi_msg(scn, cmd, rsp, bmi_cmd_buff,
+ offset, bmi_rsp_buff, &rxlen,
+ BMI_EXCHANGE_TIMEOUT_MS);
if (status) {
BMI_ERR("Unable to read from the device");
return CDF_STATUS_E_FAILURE;
@@ -115,6 +118,8 @@ bmi_write_memory(uint32_t address,
uint8_t *src;
struct bmi_info *info = hif_get_bmi_ctx(scn);
uint8_t *bmi_cmd_buff = info->bmi_cmd_buff;
+ cdf_dma_addr_t cmd = info->bmi_cmd_da;
+ cdf_dma_addr_t rsp = info->bmi_rsp_da;
if (info->bmi_done) {
BMI_ERR("Command disallowed");
@@ -158,8 +163,9 @@ bmi_write_memory(uint32_t address,
offset += sizeof(txlen);
cdf_mem_copy(&(bmi_cmd_buff[offset]), src, txlen);
offset += txlen;
- status = hif_exchange_bmi_msg(scn, bmi_cmd_buff, offset,
- NULL, NULL, BMI_EXCHANGE_TIMEOUT_MS);
+ status = hif_exchange_bmi_msg(scn, cmd, rsp, bmi_cmd_buff,
+ offset, NULL, NULL,
+ BMI_EXCHANGE_TIMEOUT_MS);
if (status) {
BMI_ERR("Unable to write to the device; status:%d",
status);
@@ -185,6 +191,8 @@ bmi_execute(uint32_t address, A_UINT32 *param, struct ol_softc *scn)
uint8_t *bmi_cmd_buff = info->bmi_cmd_buff;
uint8_t *bmi_rsp_buff = info->bmi_rsp_buff;
uint32_t size = sizeof(cid) + sizeof(address) + sizeof(param);
+ cdf_dma_addr_t cmd = info->bmi_cmd_da;
+ cdf_dma_addr_t rsp = info->bmi_rsp_da;
if (info->bmi_done) {
BMI_ERR("Command disallowed");
@@ -214,7 +222,7 @@ bmi_execute(uint32_t address, A_UINT32 *param, struct ol_softc *scn)
cdf_mem_copy(&(bmi_cmd_buff[offset]), param, sizeof(*param));
offset += sizeof(*param);
param_len = sizeof(*param);
- status = hif_exchange_bmi_msg(scn, bmi_cmd_buff, offset,
+ status = hif_exchange_bmi_msg(scn, cmd, rsp, bmi_cmd_buff, offset,
bmi_rsp_buff, &param_len, 0);
if (status) {
BMI_ERR("Unable to read from the device status:%d", status);
@@ -278,6 +286,7 @@ CDF_STATUS bmi_done_local(struct ol_softc *scn)
uint32_t cid;
struct bmi_info *info;
cdf_device_t cdf_dev = cds_get_context(CDF_MODULE_ID_CDF_DEVICE);
+ cdf_dma_addr_t cmd, rsp;
if (!scn) {
BMI_ERR("Invalid scn context");
@@ -296,6 +305,9 @@ CDF_STATUS bmi_done_local(struct ol_softc *scn)
return CDF_STATUS_E_PERM;
}
+ cmd = info->bmi_cmd_da;
+ rsp = info->bmi_rsp_da;
+
BMI_DBG("BMI Done: Enter (device: 0x%p)", scn);
info->bmi_done = true;
@@ -309,7 +321,7 @@ CDF_STATUS bmi_done_local(struct ol_softc *scn)
cdf_mem_copy(info->bmi_cmd_buff, &cid, sizeof(cid));
- status = hif_exchange_bmi_msg(scn, info->bmi_cmd_buff,
+ status = hif_exchange_bmi_msg(scn, cmd, rsp, info->bmi_cmd_buff,
sizeof(cid), NULL, NULL, 0);
if (status) {
BMI_ERR("Failed to write to the device; status:%d", status);
diff --git a/core/bmi/src/bmi_2.c b/core/bmi/src/bmi_2.c
index 16fdf7223cc5..a3a6d00d607c 100644
--- a/core/bmi/src/bmi_2.c
+++ b/core/bmi/src/bmi_2.c
@@ -43,6 +43,8 @@ bmi_no_command(struct ol_softc *scn)
struct bmi_info *info = hif_get_bmi_ctx(scn);
uint8_t *bmi_cmd_buff = info->bmi_cmd_buff;
uint8_t *bmi_rsp_buff = info->bmi_rsp_buff;
+ cdf_dma_addr_t cmd = info->bmi_cmd_da;
+ cdf_dma_addr_t rsp = info->bmi_rsp_da;
if (info->bmi_done) {
BMI_ERR("Command disallowed: BMI DONE ALREADY");
@@ -58,7 +60,7 @@ bmi_no_command(struct ol_softc *scn)
cdf_mem_copy(bmi_cmd_buff, &cid, sizeof(cid));
length = sizeof(ret);
- status = hif_exchange_bmi_msg(scn, bmi_cmd_buff, sizeof(cid),
+ status = hif_exchange_bmi_msg(scn, cmd, rsp, bmi_cmd_buff, sizeof(cid),
bmi_rsp_buff, &length, BMI_EXCHANGE_TIMEOUT_MS);
if (status) {
@@ -85,6 +87,8 @@ bmi_done_local(struct ol_softc *scn)
uint8_t *bmi_cmd_buff = info->bmi_cmd_buff;
uint8_t *bmi_rsp_buff = info->bmi_rsp_buff;
cdf_device_t cdf_dev = cds_get_context(CDF_MODULE_ID_CDF_DEVICE);
+ cdf_dma_addr_t cmd = info->bmi_cmd_da;
+ cdf_dma_addr_t rsp = info->bmi_rsp_da;
if (info->bmi_done) {
BMI_ERR("Command disallowed");
@@ -106,7 +110,7 @@ bmi_done_local(struct ol_softc *scn)
cdf_mem_copy(bmi_cmd_buff, &cid, sizeof(cid));
length = sizeof(ret);
- status = hif_exchange_bmi_msg(scn, bmi_cmd_buff, sizeof(cid),
+ status = hif_exchange_bmi_msg(scn, cmd, rsp, bmi_cmd_buff, sizeof(cid),
bmi_rsp_buff, &length, BMI_EXCHANGE_TIMEOUT_MS);
if (status) {
@@ -155,6 +159,8 @@ bmi_write_memory(uint32_t address,
struct bmi_info *info = hif_get_bmi_ctx(scn);
uint8_t *bmi_cmd_buff = info->bmi_cmd_buff;
uint8_t *bmi_rsp_buff = info->bmi_rsp_buff;
+ cdf_dma_addr_t cmd = info->bmi_cmd_da;
+ cdf_dma_addr_t rsp = info->bmi_rsp_da;
if (info->bmi_done) {
BMI_ERR("Command disallowed");
@@ -196,8 +202,9 @@ bmi_write_memory(uint32_t address,
offset += sizeof(txlen);
cdf_mem_copy(&(bmi_cmd_buff[offset]), src, txlen);
offset += txlen;
- status = hif_exchange_bmi_msg(scn, bmi_cmd_buff, offset,
- bmi_rsp_buff, &rsp_len, BMI_EXCHANGE_TIMEOUT_MS);
+ status = hif_exchange_bmi_msg(scn, cmd, rsp, bmi_cmd_buff,
+ offset, bmi_rsp_buff, &rsp_len,
+ BMI_EXCHANGE_TIMEOUT_MS);
if (status) {
BMI_ERR("BMI Write Memory Failed status:%d", status);
return CDF_STATUS_E_FAILURE;
@@ -227,6 +234,8 @@ bmi_read_memory(uint32_t address, uint8_t *buffer,
/* note we reuse the same buffer to receive on */
uint8_t *bmi_rsp_buff = info->bmi_rsp_buff;
uint32_t size = sizeof(cid) + sizeof(address) + sizeof(length);
+ cdf_dma_addr_t cmd = info->bmi_cmd_da;
+ cdf_dma_addr_t rsp = info->bmi_rsp_da;
if (info->bmi_done) {
BMI_ERR("Command disallowed");
@@ -259,7 +268,7 @@ bmi_read_memory(uint32_t address, uint8_t *buffer,
total_len = rxlen + rsp_len;
- status = hif_exchange_bmi_msg(scn,
+ status = hif_exchange_bmi_msg(scn, cmd, rsp,
bmi_cmd_buff,
offset,
bmi_rsp_buff,
@@ -297,6 +306,8 @@ bmi_execute(uint32_t address, uint32_t *param,
struct bmi_info *info = hif_get_bmi_ctx(scn);
uint8_t *bmi_cmd_buff = info->bmi_cmd_buff;
uint8_t *bmi_rsp_buff = info->bmi_rsp_buff;
+ cdf_dma_addr_t cmd = info->bmi_cmd_da;
+ cdf_dma_addr_t rsp = info->bmi_rsp_da;
if (info->bmi_done) {
BMI_ERR("Command disallowed");
@@ -313,7 +324,7 @@ bmi_execute(uint32_t address, uint32_t *param,
cdf_mem_copy(bmi_cmd_buff, &cid, sizeof(cid));
length = sizeof(ret);
- status = hif_exchange_bmi_msg(scn, bmi_cmd_buff, sizeof(cid),
+ status = hif_exchange_bmi_msg(scn, cmd, rsp, bmi_cmd_buff, sizeof(cid),
bmi_rsp_buff, &length, BMI_EXCHANGE_TIMEOUT_MS);
if (status) {
@@ -342,6 +353,9 @@ bmi_load_image(dma_addr_t address,
struct bmi_info *info = hif_get_bmi_ctx(scn);
uint8_t *bmi_cmd_buff = info->bmi_cmd_buff;
uint8_t *bmi_rsp_buff = info->bmi_rsp_buff;
+ cdf_dma_addr_t cmd = info->bmi_cmd_da;
+ cdf_dma_addr_t rsp = info->bmi_rsp_da;
+
uint32_t addr_h, addr_l;
if (info->bmi_done) {
@@ -375,7 +389,7 @@ bmi_load_image(dma_addr_t address,
offset += sizeof(size);
length = sizeof(ret);
- status = hif_exchange_bmi_msg(scn, bmi_cmd_buff, offset,
+ status = hif_exchange_bmi_msg(scn, cmd, rsp, bmi_cmd_buff, offset,
bmi_rsp_buff, &length, BMI_EXCHANGE_TIMEOUT_MS);
if (status) {
diff --git a/core/bmi/src/i_bmi.h b/core/bmi/src/i_bmi.h
index 7e9d984e33e8..d6f82352027b 100644
--- a/core/bmi/src/i_bmi.h
+++ b/core/bmi/src/i_bmi.h
@@ -121,6 +121,18 @@ typedef enum _ATH_BIN_FILE {
#define NO_BMI 0
#endif
+/**
+ * struct ol_context - Structure to hold OL context
+ * @cdf_dev: CDF Device
+ * @scn: HIF Context
+ *
+ * Structure to hold all ol BMI/Ramdump info
+ */
+struct ol_context {
+ cdf_device_t cdf_dev;
+ struct ol_softc *scn;
+};
+
CDF_STATUS bmi_execute(uint32_t address, uint32_t *param,
struct ol_softc *scn);
CDF_STATUS bmi_init(struct ol_softc *scn);
diff --git a/core/cds/inc/cds_sched.h b/core/cds/inc/cds_sched.h
index 3d8d367d3d5e..0d8d5003c81c 100644
--- a/core/cds/inc/cds_sched.h
+++ b/core/cds/inc/cds_sched.h
@@ -263,6 +263,7 @@ typedef struct _cds_context_type {
void *htc_ctx;
+ void *g_ol_context;
/*
* cdf_ctx will be used by cdf
* while allocating dma memory
diff --git a/core/cds/src/cds_api.c b/core/cds/src/cds_api.c
index f205d2a73bf0..3a89ab2ae12b 100644
--- a/core/cds/src/cds_api.c
+++ b/core/cds/src/cds_api.c
@@ -173,6 +173,7 @@ CDF_STATUS cds_open(void)
cdf_device_t cdf_ctx;
HTC_INIT_INFO htcInfo;
struct ol_softc *scn;
+ struct ol_context *ol_ctx;
void *HTCHandle;
hdd_context_t *pHddCtx;
@@ -256,8 +257,9 @@ CDF_STATUS cds_open(void)
hdd_update_hif_config(scn, pHddCtx);
+ ol_ctx = cds_get_context(CDF_MODULE_ID_BMI);
/* Initialize BMI and Download firmware */
- cdf_status = bmi_download_firmware(scn);
+ cdf_status = bmi_download_firmware(ol_ctx);
if (cdf_status != CDF_STATUS_SUCCESS) {
CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_FATAL,
"BMI FIALED status:%d", cdf_status);
@@ -278,7 +280,7 @@ CDF_STATUS cds_open(void)
goto err_bmi_close;
}
- if (bmi_done(scn)) {
+ if (bmi_done(ol_ctx)) {
CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_FATAL,
"%s: Failed to complete BMI phase", __func__);
goto err_htc_close;
@@ -902,6 +904,12 @@ void *cds_get_context(CDF_MODULE_ID moduleId)
break;
}
+ case CDF_MODULE_ID_BMI:
+ {
+ pModContext = gp_cds_context->g_ol_context;
+ break;
+ }
+
case CDF_MODULE_ID_TXRX:
{
pModContext = gp_cds_context->pdev_txrx_ctx;
@@ -1061,6 +1069,12 @@ CDF_STATUS cds_alloc_context(void *p_cds_context, CDF_MODULE_ID moduleID,
break;
}
+ case CDF_MODULE_ID_BMI:
+ {
+ pGpModContext = &(gp_cds_context->g_ol_context);
+ break;
+ }
+
case CDF_MODULE_ID_EPPING:
case CDF_MODULE_ID_SME:
case CDF_MODULE_ID_PE:
@@ -1150,6 +1164,12 @@ CDF_STATUS cds_free_context(void *p_cds_context, CDF_MODULE_ID moduleID,
break;
}
+ case CDF_MODULE_ID_BMI:
+ {
+ pGpModContext = &(gp_cds_context->g_ol_context);
+ break;
+ }
+
case CDF_MODULE_ID_EPPING:
case CDF_MODULE_ID_HDD:
case CDF_MODULE_ID_SME:
diff --git a/core/hdd/src/wlan_hdd_driver_ops.c b/core/hdd/src/wlan_hdd_driver_ops.c
index 729ed3f79794..c3d85e87c403 100644
--- a/core/hdd/src/wlan_hdd_driver_ops.c
+++ b/core/hdd/src/wlan_hdd_driver_ops.c
@@ -52,6 +52,7 @@
#include "wlan_hdd_napi.h"
#include "cds_concurrency.h"
#include "qwlan_version.h"
+#include "bmi.h"
#ifdef MODULE
#define WLAN_MODULE_NAME module_name(THIS_MODULE)
@@ -219,6 +220,7 @@ static int wlan_hdd_probe(struct device *dev, void *bdev, const hif_bus_id *bid,
void *hif_ctx;
CDF_STATUS status;
int ret = 0;
+ cdf_device_t cdf_dev;
pr_info("%s: %sprobing driver v%s\n", WLAN_MODULE_NAME,
reinit ? "re-" : "", QWLAN_VERSIONSTR);
@@ -257,6 +259,14 @@ static int wlan_hdd_probe(struct device *dev, void *bdev, const hif_bus_id *bid,
goto err_epping_close;
hif_ctx = cds_get_context(CDF_MODULE_ID_HIF);
+ cdf_dev = cds_get_context(CDF_MODULE_ID_CDF_DEVICE);
+
+ status = ol_cds_init(cdf_dev, hif_ctx);
+
+ if (status != CDF_STATUS_SUCCESS) {
+ pr_err("%s No Memory to Create BMI Context\n", __func__);
+ goto err_hif_close;
+ }
if (reinit)
ret = hdd_wlan_re_init(hif_ctx);
@@ -264,7 +274,7 @@ static int wlan_hdd_probe(struct device *dev, void *bdev, const hif_bus_id *bid,
ret = hdd_wlan_startup(dev, hif_ctx);
if (ret)
- goto err_hif_close;
+ goto err_bmi_close;
hif_enable_power_management(hif_ctx);
@@ -280,6 +290,8 @@ static int wlan_hdd_probe(struct device *dev, void *bdev, const hif_bus_id *bid,
return 0;
+err_bmi_close:
+ ol_cds_free();
err_hif_close:
hdd_hif_close(hif_ctx);
err_epping_close:
@@ -344,8 +356,8 @@ static void wlan_hdd_remove(void)
__hdd_wlan_exit();
}
+ ol_cds_free();
hdd_hif_close(hif_ctx);
-
hdd_deinit();
pr_info("%s: Driver Removed\n", WLAN_MODULE_NAME);
@@ -378,6 +390,7 @@ static void wlan_hdd_shutdown(void)
hdd_wlan_shutdown();
}
+ ol_cds_free();
hdd_hif_close(hif_ctx);
}
diff --git a/core/hdd/src/wlan_hdd_ftm.c b/core/hdd/src/wlan_hdd_ftm.c
index 8f5282c97edd..02d75e85aa8d 100644
--- a/core/hdd/src/wlan_hdd_ftm.c
+++ b/core/hdd/src/wlan_hdd_ftm.c
@@ -180,6 +180,7 @@ static CDF_STATUS wlan_ftm_cds_open(v_CONTEXT_t p_cds_context,
HTC_INIT_INFO htcInfo;
void *pHifContext = NULL;
void *pHtcContext = NULL;
+ struct ol_context *ol_ctx;
#endif
hdd_context_t *hdd_ctx;
@@ -251,7 +252,8 @@ static CDF_STATUS wlan_ftm_cds_open(v_CONTEXT_t p_cds_context,
goto err_sched_close;
}
- if (bmi_download_firmware(pHifContext)) {
+ ol_ctx = cds_get_context(CDF_MODULE_ID_BMI);
+ if (bmi_download_firmware(ol_ctx)) {
CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_FATAL,
"%s: BMI failed to download target", __func__);
goto err_bmi_close;
@@ -270,7 +272,7 @@ static CDF_STATUS wlan_ftm_cds_open(v_CONTEXT_t p_cds_context,
goto err_bmi_close;
}
- if (bmi_done(pHifContext)) {
+ if (bmi_done(ol_ctx)) {
CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_FATAL,
"%s: Failed to complete BMI phase", __func__);
goto err_htc_close;
diff --git a/core/utils/epping/src/epping_main.c b/core/utils/epping/src/epping_main.c
index 921746dc839f..59da7cb16478 100644
--- a/core/utils/epping/src/epping_main.c
+++ b/core/utils/epping/src/epping_main.c
@@ -183,6 +183,7 @@ int epping_enable(struct device *parent_dev)
tSirMacAddr adapter_macAddr;
struct hif_config_info *cfg;
struct hif_target_info *tgt_info;
+ struct ol_context *ol_ctx;
EPPING_LOG(CDF_TRACE_LEVEL_INFO_HIGH, "%s: Enter", __func__);
@@ -225,9 +226,10 @@ int epping_enable(struct device *parent_dev)
/* store target type and target version info in hdd ctx */
pEpping_ctx->target_type = tgt_info->target_type;
+ ol_ctx = cds_get_context(CDF_MODULE_ID_BMI);
#ifndef FEATURE_BMI_2
/* Initialize BMI and Download firmware */
- if (bmi_download_firmware(scn)) {
+ if (bmi_download_firmware(ol_ctx)) {
CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_FATAL,
"%s: BMI failed to download target", __func__);
bmi_cleanup(scn);
@@ -258,7 +260,7 @@ int epping_enable(struct device *parent_dev)
return -1;
}
- if (bmi_done(scn)) {
+ if (bmi_done(ol_ctx)) {
EPPING_LOG(CDF_TRACE_LEVEL_FATAL,
"%s: Failed to complete BMI phase", __func__);
goto error_end;