qcacmn: Refactor BMI members from ol_softc

Group BMI members and access bmi info from hif instead of
dereferencing hif context.

Change-Id: I082f648490be0078df7d90cc8ebbf745b64fd97a
CRs-Fixed: 967765
diff --git a/hif/inc/hif.h b/hif/inc/hif.h
index 1b5c13e..671bdd2 100644
--- a/hif/inc/hif.h
+++ b/hif/inc/hif.h
@@ -181,11 +181,24 @@
 	uint32_t soc_version;
 };
 
+struct bmi_info {
+	uint8_t *bmi_cmd_buff;
+	uint8_t *bmi_rsp_buff;
+	dma_addr_t bmi_cmd_da;
+	dma_addr_t bmi_rsp_da;
+	uint8_t *cal_in_flash;
+	bool bmi_done;
+#ifdef CONFIG_CNSS
+	struct cnss_fw_files fw_files;
+#endif
+};
+
 struct ol_softc {
 	void __iomem *mem;      /* IO mapped memory base address */
 	cdf_dma_addr_t mem_pa;
 	struct hif_config_info hif_config;
 	struct hif_target_info target_info;
+	struct bmi_info bmi_ctx;
 	/*
 	 * handle for code that uses the osdep.h version of OS
 	 * abstraction primitives
@@ -210,18 +223,6 @@
 	/* status of target init */
 	WLAN_INIT_STATUS wlan_init_status;
 
-	/* BMI info */
-	/* OS-dependent private info for BMI */
-	bool bmi_done;
-	uint8_t *bmi_cmd_buff;
-	dma_addr_t bmi_cmd_da;
-	OS_DMA_MEM_CONTEXT(bmicmd_dmacontext)
-
-	uint8_t *bmi_rsp_buff;
-	dma_addr_t bmi_rsp_da;
-	/* length of last response */
-	OS_DMA_MEM_CONTEXT(bmirsp_dmacontext)
-
 	/* Handles for Lower Layers : filled in at init time */
 	hif_handle_t hif_hdl;
 #ifdef HIF_PCI
@@ -236,9 +237,6 @@
 	void *htc_handle;
 
 	uint8_t vow_extstats;
-#ifdef CONFIG_CNSS
-	struct cnss_fw_files fw_files;
-#endif
 	struct targetdef_s *targetdef;
 	struct ce_reg_def *target_ce_def;
 	struct hostdef_s *hostdef;
@@ -657,6 +655,7 @@
 		     const char **target_name);
 struct hif_target_info *hif_get_target_info_handle(struct ol_softc *scn);
 struct hif_config_info *hif_get_ini_handle(struct ol_softc *scn);
+struct bmi_info *hif_get_bmi_ctx(void *hif_ctx);
 #ifdef __cplusplus
 }
 #endif
diff --git a/hif/src/ce/ce_bmi.c b/hif/src/ce/ce_bmi.c
index edf1d46..38b5991 100644
--- a/hif/src/ce/ce_bmi.c
+++ b/hif/src/ce/ce_bmi.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2015-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -156,6 +156,7 @@
 	unsigned int mux_id = 0;
 	unsigned int transaction_id = 0xffff;
 	unsigned int user_flags = 0;
+	struct bmi_info *info = hif_get_bmi_ctx(scn);
 #ifdef BMI_RSP_POLLING
 	cdf_dma_addr_t buf;
 	unsigned int completed_nbytes, id, flags;
@@ -190,7 +191,7 @@
 	 * CE_request = dma_map_single(dev,
 	 * (void *)bmi_request, request_length, DMA_TO_DEVICE);
 	 */
-	CE_request = scn->bmi_cmd_da;
+	CE_request = info->bmi_cmd_da;
 	transaction->bmi_request_CE = CE_request;
 
 	if (bmi_response) {
@@ -199,7 +200,7 @@
 		 * CE_response = dma_map_single(dev, bmi_response,
 		 * BMI_DATASZ_MAX, DMA_FROM_DEVICE);
 		 */
-		CE_response = scn->bmi_rsp_da;
+		CE_response = info->bmi_rsp_da;
 		transaction->bmi_response_host = bmi_response;
 		transaction->bmi_response_CE = CE_response;
 		/* dma_cache_sync(dev, bmi_response,
diff --git a/hif/src/pcie/if_pci.c b/hif/src/pcie/if_pci.c
index be6d4c0..cdf25b5 100644
--- a/hif/src/pcie/if_pci.c
+++ b/hif/src/pcie/if_pci.c
@@ -3329,3 +3329,15 @@
 }
 
 #endif /* FEATURE_RUNTIME_PM */
+
+/**
+ * hif_get_bmi_ctx() - API to get BMI context
+ * @hif_ctx: HIF Context
+ *
+ * Return: Pointer to BMI Context
+ */
+struct bmi_info *hif_get_bmi_ctx(void *hif_ctx)
+{
+	struct ol_softc *sc = hif_ctx;
+	return &sc->bmi_ctx;
+}