summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKomal Seelam <kseelam@codeaurora.org>2016-02-09 17:50:33 +0530
committerPrakash Dhavali <pdhavali@codeaurora.org>2016-03-23 13:45:07 -0700
commit48152e1a16d7241e65c4b31323df54e45147ead4 (patch)
treeb507c6d8b0dd68caa833325ba4e7ae4d571072d7
parent04d3d6a364a1a0281d2c7d42198214a17d059689 (diff)
qcacld-3.0: Make cdf_device_t as global device structure
aps_osdev/NIC_DEV is not needed in cld driver. Remove it's reference in BMI and pktlog code. Use global cdf_device context for memory allocations in BMI and pktlog files. Initialize cdf_device global structure in HDD. Change-Id: Idf257e196f86b8f0aae669ce05950a1212e5fd99 CRs-Fixed: 967765
-rw-r--r--core/bmi/src/bmi.c29
-rw-r--r--core/bmi/src/bmi_1.c11
-rw-r--r--core/bmi/src/bmi_2.c12
-rw-r--r--core/bmi/src/ol_fw.c9
-rw-r--r--core/hdd/src/wlan_hdd_driver_ops.c17
-rw-r--r--core/utils/pktlog/include/pktlog_ac.h1
-rw-r--r--core/utils/pktlog/pktlog_ac.c1
7 files changed, 63 insertions, 17 deletions
diff --git a/core/bmi/src/bmi.c b/core/bmi/src/bmi.c
index 9c0a519f0b65..c520057265bb 100644
--- a/core/bmi/src/bmi.c
+++ b/core/bmi/src/bmi.c
@@ -26,6 +26,7 @@
*/
#include "i_bmi.h"
+#include "cds_api.h"
/* APIs visible to the driver */
@@ -58,6 +59,7 @@ bmi_command_test(uint32_t command, uint32_t address, uint8_t *data,
CDF_STATUS bmi_init(struct ol_softc *scn)
{
struct bmi_info *info;
+ cdf_device_t cdf_dev = cds_get_context(CDF_MODULE_ID_CDF_DEVICE);
if (!scn) {
BMI_ERR("Invalid scn Context");
@@ -65,12 +67,18 @@ CDF_STATUS bmi_init(struct ol_softc *scn)
return CDF_STATUS_NOT_INITIALIZED;
}
+ if (!cdf_dev->dev) {
+ BMI_ERR("%s: Invalid Device Pointer", __func__);
+ return CDF_STATUS_NOT_INITIALIZED;
+ }
+
info = hif_get_bmi_ctx(scn);
info->bmi_done = false;
if (!info->bmi_cmd_buff) {
- info->bmi_cmd_buff = cdf_os_mem_alloc_consistent(scn->cdf_dev,
- MAX_BMI_CMDBUF_SZ, &info->bmi_cmd_da, 0);
+ info->bmi_cmd_buff =
+ cdf_os_mem_alloc_consistent(cdf_dev, MAX_BMI_CMDBUF_SZ,
+ &info->bmi_cmd_da, 0);
if (!info->bmi_cmd_buff) {
BMI_ERR("No Memory for BMI Command");
return CDF_STATUS_E_NOMEM;
@@ -78,8 +86,9 @@ CDF_STATUS bmi_init(struct ol_softc *scn)
}
if (!info->bmi_rsp_buff) {
- info->bmi_rsp_buff = cdf_os_mem_alloc_consistent(scn->cdf_dev,
- MAX_BMI_CMDBUF_SZ, &info->bmi_rsp_da, 0);
+ info->bmi_rsp_buff =
+ cdf_os_mem_alloc_consistent(cdf_dev, MAX_BMI_CMDBUF_SZ,
+ &info->bmi_rsp_da, 0);
if (!info->bmi_rsp_buff) {
BMI_ERR("No Memory for BMI Response");
goto end;
@@ -87,7 +96,7 @@ CDF_STATUS bmi_init(struct ol_softc *scn)
}
return CDF_STATUS_SUCCESS;
end:
- cdf_os_mem_free_consistent(scn->cdf_dev, MAX_BMI_CMDBUF_SZ,
+ cdf_os_mem_free_consistent(cdf_dev, MAX_BMI_CMDBUF_SZ,
info->bmi_cmd_buff, info->bmi_cmd_da, 0);
info->bmi_cmd_buff = NULL;
return CDF_STATUS_E_NOMEM;
@@ -96,16 +105,22 @@ end:
void bmi_cleanup(struct ol_softc *scn)
{
struct bmi_info *info = hif_get_bmi_ctx(scn);
+ cdf_device_t cdf_dev = cds_get_context(CDF_MODULE_ID_CDF_DEVICE);
+
+ if (!cdf_dev->dev) {
+ BMI_ERR("%s: Invalid Device Pointer", __func__);
+ return;
+ }
if (info->bmi_cmd_buff) {
- cdf_os_mem_free_consistent(scn->cdf_dev, MAX_BMI_CMDBUF_SZ,
+ cdf_os_mem_free_consistent(cdf_dev, MAX_BMI_CMDBUF_SZ,
info->bmi_cmd_buff, info->bmi_cmd_da, 0);
info->bmi_cmd_buff = NULL;
info->bmi_cmd_da = 0;
}
if (info->bmi_rsp_buff) {
- cdf_os_mem_free_consistent(scn->cdf_dev, MAX_BMI_CMDBUF_SZ,
+ cdf_os_mem_free_consistent(cdf_dev, MAX_BMI_CMDBUF_SZ,
info->bmi_rsp_buff, info->bmi_rsp_da, 0);
info->bmi_rsp_buff = NULL;
info->bmi_rsp_da = 0;
diff --git a/core/bmi/src/bmi_1.c b/core/bmi/src/bmi_1.c
index 239f9d356b3c..1936623c5d14 100644
--- a/core/bmi/src/bmi_1.c
+++ b/core/bmi/src/bmi_1.c
@@ -26,6 +26,7 @@
*/
#include "i_bmi.h"
+#include "cds_api.h"
/* APIs visible to the driver */
@@ -276,6 +277,7 @@ CDF_STATUS bmi_done_local(struct ol_softc *scn)
int status;
uint32_t cid;
struct bmi_info *info;
+ cdf_device_t cdf_dev = cds_get_context(CDF_MODULE_ID_CDF_DEVICE);
if (!scn) {
BMI_ERR("Invalid scn context");
@@ -283,6 +285,11 @@ CDF_STATUS bmi_done_local(struct ol_softc *scn)
return CDF_STATUS_NOT_INITIALIZED;
}
+ if (!cdf_dev->dev) {
+ BMI_ERR("%s: Invalid device pointer", __func__);
+ return CDF_STATUS_NOT_INITIALIZED;
+ }
+
info = hif_get_bmi_ctx(scn);
if (info->bmi_done) {
BMI_DBG("bmi_done_local skipped");
@@ -310,14 +317,14 @@ CDF_STATUS bmi_done_local(struct ol_softc *scn)
}
if (info->bmi_cmd_buff) {
- cdf_os_mem_free_consistent(scn->cdf_dev, MAX_BMI_CMDBUF_SZ,
+ cdf_os_mem_free_consistent(cdf_dev, MAX_BMI_CMDBUF_SZ,
info->bmi_cmd_buff, info->bmi_cmd_da, 0);
info->bmi_cmd_buff = NULL;
info->bmi_cmd_da = 0;
}
if (info->bmi_rsp_buff) {
- cdf_os_mem_free_consistent(scn->cdf_dev, MAX_BMI_CMDBUF_SZ,
+ cdf_os_mem_free_consistent(cdf_dev, MAX_BMI_CMDBUF_SZ,
info->bmi_rsp_buff, info->bmi_rsp_da, 0);
info->bmi_rsp_buff = NULL;
info->bmi_rsp_da = 0;
diff --git a/core/bmi/src/bmi_2.c b/core/bmi/src/bmi_2.c
index b37da7eb408a..16fdf7223cc5 100644
--- a/core/bmi/src/bmi_2.c
+++ b/core/bmi/src/bmi_2.c
@@ -25,6 +25,7 @@
* to the Linux Foundation.
*/
#include "i_bmi.h"
+#include "cds_api.h"
/* This need to defined in firmware interface files.
* Defining here to address compilation issues.
* Will be deleted once firmware interface files for
@@ -83,6 +84,7 @@ bmi_done_local(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_device_t cdf_dev = cds_get_context(CDF_MODULE_ID_CDF_DEVICE);
if (info->bmi_done) {
BMI_ERR("Command disallowed");
@@ -93,6 +95,12 @@ bmi_done_local(struct ol_softc *scn)
BMI_ERR("No Memory Allocated for BMI CMD/RSP Buffer");
return CDF_STATUS_NOT_INITIALIZED;
}
+
+ if (!cdf_dev->dev) {
+ BMI_ERR("%s Invalid Device pointer", __func__);
+ return CDF_STATUS_NOT_INITIALIZED;
+ }
+
cid = BMI_DONE;
cdf_mem_copy(bmi_cmd_buff, &cid, sizeof(cid));
@@ -113,14 +121,14 @@ bmi_done_local(struct ol_softc *scn)
}
if (info->bmi_cmd_buff) {
- cdf_os_mem_free_consistent(scn->cdf_dev, MAX_BMI_CMDBUF_SZ,
+ cdf_os_mem_free_consistent(cdf_dev, MAX_BMI_CMDBUF_SZ,
info->bmi_cmd_buff, info->bmi_cmd_da, 0);
info->bmi_cmd_buff = NULL;
info->bmi_cmd_da = 0;
}
if (info->bmi_rsp_buff) {
- cdf_os_mem_free_consistent(scn->cdf_dev, MAX_BMI_CMDBUF_SZ,
+ cdf_os_mem_free_consistent(cdf_dev, MAX_BMI_CMDBUF_SZ,
info->bmi_rsp_buff, info->bmi_rsp_da, 0);
info->bmi_rsp_buff = NULL;
info->bmi_rsp_da = 0;
diff --git a/core/bmi/src/ol_fw.c b/core/bmi/src/ol_fw.c
index 89f115680c8e..ab5edb355030 100644
--- a/core/bmi/src/ol_fw.c
+++ b/core/bmi/src/ol_fw.c
@@ -149,6 +149,7 @@ static int __ol_transfer_bin_file(struct ol_softc *scn, ATH_BIN_FILE file,
struct hif_target_info *tgt_info = hif_get_target_info_handle(scn);
uint32_t target_type = tgt_info->target_type;
struct bmi_info *bmi_ctx = hif_get_bmi_ctx(scn);
+ cdf_device_t cdf_dev = cds_get_context(CDF_MODULE_ID_CDF_DEVICE);
switch (file) {
default:
@@ -248,7 +249,7 @@ static int __ol_transfer_bin_file(struct ol_softc *scn, ATH_BIN_FILE file,
break;
}
- if (request_firmware(&fw_entry, filename, scn->aps_osdev.device) != 0) {
+ if (request_firmware(&fw_entry, filename, cdf_dev->dev) != 0) {
BMI_ERR("%s: Failed to get %s", __func__, filename);
if (file == ATH_OTP_FILE)
@@ -262,7 +263,7 @@ static int __ol_transfer_bin_file(struct ol_softc *scn, ATH_BIN_FILE file,
BMI_INFO("%s: Trying to load default %s",
__func__, filename);
if (request_firmware(&fw_entry, filename,
- scn->aps_osdev.device) != 0) {
+ cdf_dev->dev) != 0) {
BMI_ERR("%s: Failed to get %s",
__func__, filename);
return -1;
@@ -488,8 +489,8 @@ static struct ol_softc *ramdump_scn;
* Ramdump information.
*/
struct ramdump_info {
- void *base;
- unsigned long size;
+ void *base;
+ unsigned long size;
};
#if defined(CONFIG_CNSS) && !defined(QCA_WIFI_3_0)
diff --git a/core/hdd/src/wlan_hdd_driver_ops.c b/core/hdd/src/wlan_hdd_driver_ops.c
index b02d8dd1199d..729ed3f79794 100644
--- a/core/hdd/src/wlan_hdd_driver_ops.c
+++ b/core/hdd/src/wlan_hdd_driver_ops.c
@@ -186,6 +186,21 @@ static void hdd_hif_close(void *hif_ctx)
}
/**
+ * hdd_init_cdf_ctx() - API to initialize global CDF Device structure
+ * @dev: Device Pointer
+ * @bdev: Bus Device pointer
+ *
+ * Return: void
+ */
+void hdd_init_cdf_ctx(struct device *dev, void *bdev)
+{
+ cdf_device_t cdf_dev = cds_get_context(CDF_MODULE_ID_CDF_DEVICE);
+
+ cdf_dev->dev = dev;
+ cdf_dev->drv_hdl = bdev;
+}
+
+/**
* wlan_hdd_probe() - handles probe request
*
* This function is called to probe the wlan driver
@@ -234,6 +249,8 @@ static int wlan_hdd_probe(struct device *dev, void *bdev, const hif_bus_id *bid,
goto err_hdd_deinit;
}
+ hdd_init_cdf_ctx(dev, bdev);
+
ret = hdd_hif_open(dev, bdev, bid, bus_type, reinit);
if (ret)
diff --git a/core/utils/pktlog/include/pktlog_ac.h b/core/utils/pktlog/include/pktlog_ac.h
index 0a5a784fe574..ade410222b27 100644
--- a/core/utils/pktlog/include/pktlog_ac.h
+++ b/core/utils/pktlog/include/pktlog_ac.h
@@ -94,7 +94,6 @@ struct ol_pktlog_dev_t {
ol_ath_generic_softc_handle scn;
char *name;
bool tgt_pktlog_enabled;
- osdev_t sc_osdev;
};
#define PKTLOG_SYSCTL_SIZE 14
diff --git a/core/utils/pktlog/pktlog_ac.c b/core/utils/pktlog/pktlog_ac.c
index 7bc10efb8826..3025a7cd1017 100644
--- a/core/utils/pktlog/pktlog_ac.c
+++ b/core/utils/pktlog/pktlog_ac.c
@@ -353,7 +353,6 @@ int pktlog_enable(struct ol_softc *scn, int32_t log_state)
}
pl_info = pl_dev->pl_info;
- pl_dev->sc_osdev = &scn->aps_osdev;
if (!pl_info)
return 0;