qcacmn: Implement run-time check for 8074 target for emulation

Target 8074 changes for emulation platform (VP/M2M/SOC) are under
compilation switch which does not allow single meta to run for
legacy platforms and Hawkeye emulation platform.
Change compile time switch to run time check for target.
Keep all emulation related changes under QCA8074_VP switch which
needs to be always enabled. It helps to identify emulation specific
changes. All emulation changes are enabled for target type 8074.

CRs-Fixed: 1082545
Change-Id: Id0bab52735154db086b56ecd751578dba75a311a
diff --git a/hif/src/hif_main.c b/hif/src/hif_main.c
index 728740a..766f910 100644
--- a/hif/src/hif_main.c
+++ b/hif/src/hif_main.c
@@ -745,7 +745,14 @@
 bool hif_needs_bmi(struct hif_opaque_softc *hif_ctx)
 {
 	struct hif_softc *hif_sc = HIF_GET_SOFTC(hif_ctx);
-	return hif_sc->bus_type != QDF_BUS_TYPE_SNOC;
+
+	if (hif_sc->bus_type == QDF_BUS_TYPE_SNOC)
+		return false;
+
+	if (hif_sc->target_info.target_type == TARGET_TYPE_QCA8074)
+		return false;
+
+	return true;
 }
 
 /**
diff --git a/hif/src/pcie/if_pci.c b/hif/src/pcie/if_pci.c
index 8e44418..bcb30f6 100644
--- a/hif/src/pcie/if_pci.c
+++ b/hif/src/pcie/if_pci.c
@@ -1956,7 +1956,7 @@
 {
 	int status = 0;
 	struct HIF_CE_state *hif_state = HIF_GET_CE_STATE(hif_sc);
-
+	struct hif_opaque_softc *hif_osc = GET_HIF_OPAQUE_HDL(hif_sc);
 	hif_ce_prepare_config(hif_sc);
 
 	/* initialize sleep state adjust variables */
@@ -2011,15 +2011,16 @@
 	if (status)
 		goto disable_wlan;
 
-#ifndef QCA_WIFI_QCA8074_VP
-	status = hif_set_hia(hif_sc);
-	if (status)
-		goto unconfig_ce;
+	/* QCA_WIFI_QCA8074_VP:Should not be executed on 8074 VP platform */
+	if (hif_needs_bmi(hif_osc)) {
+		status = hif_set_hia(hif_sc);
+		if (status)
+			goto unconfig_ce;
 
-	HIF_INFO_MED("%s: hif_set_hia done", __func__);
+		HIF_INFO_MED("%s: hif_set_hia done", __func__);
 
-	hif_register_bmi_callbacks(hif_sc);
-#endif
+		hif_register_bmi_callbacks(hif_sc);
+	}
 
 	status = hif_configure_irq(hif_sc);
 	if (status < 0)
diff --git a/hif/src/snoc/if_ahb.c b/hif/src/snoc/if_ahb.c
index fb380a3..e97647e 100644
--- a/hif/src/snoc/if_ahb.c
+++ b/hif/src/snoc/if_ahb.c
@@ -498,26 +498,28 @@
 	hif_register_tbl_attach(ol_sc, hif_type);
 	hif_target_register_tbl_attach(ol_sc, target_type);
 
-#ifndef QCA_WIFI_QCA8074_VP
-	if (hif_ahb_enable_radio(sc, pdev, id) != 0) {
-		HIF_INFO("error in enabling soc\n");
-		return -EIO;
-	}
+	/* QCA_WIFI_QCA8074_VP:Should not be executed on 8074 VP platform */
+	if (tgt_info->target_type != TARGET_TYPE_QCA8074) {
+		if (hif_ahb_enable_radio(sc, pdev, id) != 0) {
+			HIF_INFO("error in enabling soc\n");
+			return -EIO;
+		}
 
-	if (hif_target_sync_ahb(ol_sc) < 0) {
-		ret = -EIO;
-		goto err_target_sync;
+		if (hif_target_sync_ahb(ol_sc) < 0) {
+			ret = -EIO;
+			goto err_target_sync;
+		}
 	}
-#endif
 	HIF_TRACE("%s: X - hif_type = 0x%x, target_type = 0x%x",
 			__func__, hif_type, target_type);
 
 	return QDF_STATUS_SUCCESS;
-#ifndef QCA_WIFI_QCA8074_VP
 err_target_sync:
-	HIF_INFO("Error: Disabling target\n");
-	hif_ahb_disable_bus(ol_sc);
-#endif
+	/* QCA_WIFI_QCA8074_VP:Should not be executed on 8074 VP platform */
+	if (tgt_info->target_type != TARGET_TYPE_QCA8074) {
+		HIF_INFO("Error: Disabling target\n");
+		hif_ahb_disable_bus(ol_sc);
+	}
 err_cleanup1:
 	return ret;
 }