qcacld-3.0: Replace soc level references of set hw request and response

Replace the obsolete WMI command WMI_SOC_SET_HW_MODE_CMDID with
WMI_PDEV_SET_HW_MODE_CMDID and event WMI_SOC_SET_HW_MODE_RESP_EVENTID
with WMI_PDEV_SET_HW_MODE_RESP_EVENTID respectively. These new WMI
commands and events additionally carry the pdev id and all mac id
references are replaced with pdev id.

Change-Id: If2a3f93dcd1947eedce8d4eac8ed936166f7e078
CRs-Fixed: 989502
diff --git a/core/cds/inc/cds_concurrency.h b/core/cds/inc/cds_concurrency.h
index 45e37f8..3dd9786 100644
--- a/core/cds/inc/cds_concurrency.h
+++ b/core/cds/inc/cds_concurrency.h
@@ -698,7 +698,7 @@
 
 enum cds_con_mode cds_convert_device_mode_to_qdf_type(
 				enum tQDF_ADAPTER_MODE device_mode);
-QDF_STATUS cds_soc_set_hw_mode(uint32_t session_id,
+QDF_STATUS cds_pdev_set_hw_mode(uint32_t session_id,
 		enum hw_mode_ss_config mac0_ss,
 		enum hw_mode_bandwidth mac0_bw,
 		enum hw_mode_ss_config mac1_ss,
diff --git a/core/cds/src/cds_concurrency.c b/core/cds/src/cds_concurrency.c
index f211ace..b905927 100644
--- a/core/cds/src/cds_concurrency.c
+++ b/core/cds/src/cds_concurrency.c
@@ -2379,7 +2379,7 @@
 }
 
 /**
- * cds_soc_set_hw_mode_cb() - Callback for set hw mode
+ * cds_pdev_set_hw_mode_cb() - Callback for set hw mode
  * @status: Status
  * @cfgd_hw_mode_index: Configured HW mode index
  * @num_vdev_mac_entries: Number of vdev-mac id mapping that follows
@@ -2391,7 +2391,7 @@
  *
  * Return: None
  */
-static void cds_soc_set_hw_mode_cb(uint32_t status,
+static void cds_pdev_set_hw_mode_cb(uint32_t status,
 				 uint32_t cfgd_hw_mode_index,
 				 uint32_t num_vdev_mac_entries,
 				 struct sir_vdev_mac_map *vdev_mac_map)
@@ -2498,7 +2498,7 @@
 }
 
 /**
- * cds_soc_set_hw_mode() - Set HW mode command to SME
+ * cds_pdev_set_hw_mode() - Set HW mode command to SME
  * @session_id: Session ID
  * @mac0_ss: MAC0 spatial stream configuration
  * @mac0_bw: MAC0 bandwidth configuration
@@ -2526,7 +2526,7 @@
  *
  * Return: Success if the message made it down to the next layer
  */
-QDF_STATUS cds_soc_set_hw_mode(uint32_t session_id,
+QDF_STATUS cds_pdev_set_hw_mode(uint32_t session_id,
 		enum hw_mode_ss_config mac0_ss,
 		enum hw_mode_bandwidth mac0_bw,
 		enum hw_mode_ss_config mac1_ss,
@@ -2554,14 +2554,14 @@
 	}
 
 	msg.hw_mode_index = hw_mode_index;
-	msg.set_hw_mode_cb = (void *)cds_soc_set_hw_mode_cb;
+	msg.set_hw_mode_cb = (void *)cds_pdev_set_hw_mode_cb;
 	msg.reason = reason;
 	msg.session_id = session_id;
 
 	cds_info("set hw mode to sme: hw_mode_index: %d session:%d reason:%d",
 		msg.hw_mode_index, msg.session_id, msg.reason);
 
-	status = sme_soc_set_hw_mode(hdd_ctx->hHal, msg);
+	status = sme_pdev_set_hw_mode(hdd_ctx->hHal, msg);
 	if (status != QDF_STATUS_SUCCESS) {
 		cds_err("Failed to set hw mode to SME");
 		return status;
@@ -6214,7 +6214,7 @@
 						session_id);
 		break;
 	case CDS_DBS:
-		status = cds_soc_set_hw_mode(session_id,
+		status = cds_pdev_set_hw_mode(session_id,
 						HW_MODE_SS_1x1,
 						HW_MODE_80_MHZ,
 						HW_MODE_SS_1x1, HW_MODE_40_MHZ,
@@ -6232,7 +6232,7 @@
 						session_id);
 		break;
 	case CDS_MCC:
-		status = cds_soc_set_hw_mode(session_id,
+		status = cds_pdev_set_hw_mode(session_id,
 						HW_MODE_SS_2x2,
 						HW_MODE_80_MHZ,
 						HW_MODE_SS_0x0, HW_MODE_BW_NONE,
diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c
index b88b01b..9e35718 100644
--- a/core/hdd/src/wlan_hdd_wext.c
+++ b/core/hdd/src/wlan_hdd_wext.c
@@ -8041,7 +8041,7 @@
 		if (apps_args[0] == 0) {
 			hddLog(LOGE,
 				FL("set hw mode for single mac\n"));
-			cds_soc_set_hw_mode(
+			cds_pdev_set_hw_mode(
 					pAdapter->sessionId,
 					HW_MODE_SS_2x2,
 					HW_MODE_80_MHZ,
@@ -8052,7 +8052,7 @@
 		} else if (apps_args[0] == 1) {
 			hddLog(LOGE,
 				FL("set hw mode for dual mac\n"));
-			cds_soc_set_hw_mode(
+			cds_pdev_set_hw_mode(
 					pAdapter->sessionId,
 					HW_MODE_SS_1x1,
 					HW_MODE_80_MHZ,
diff --git a/core/mac/src/include/sir_params.h b/core/mac/src/include/sir_params.h
index 75dc58b..cc433c1 100644
--- a/core/mac/src/include/sir_params.h
+++ b/core/mac/src/include/sir_params.h
@@ -587,8 +587,8 @@
 
 #define SIR_HAL_FW_MEM_DUMP_REQ            (SIR_HAL_ITC_MSG_TYPES_BEGIN + 327)
 #define SIR_HAL_START_STOP_LOGGING           (SIR_HAL_ITC_MSG_TYPES_BEGIN + 328)
-#define SIR_HAL_SOC_SET_HW_MODE              (SIR_HAL_ITC_MSG_TYPES_BEGIN + 329)
-#define SIR_HAL_SOC_SET_HW_MODE_RESP         (SIR_HAL_ITC_MSG_TYPES_BEGIN + 330)
+#define SIR_HAL_PDEV_SET_HW_MODE             (SIR_HAL_ITC_MSG_TYPES_BEGIN + 329)
+#define SIR_HAL_PDEV_SET_HW_MODE_RESP        (SIR_HAL_ITC_MSG_TYPES_BEGIN + 330)
 #define SIR_HAL_SOC_HW_MODE_TRANS_IND        (SIR_HAL_ITC_MSG_TYPES_BEGIN + 331)
 
 #define SIR_HAL_SET_RSSI_MONITOR_REQ        (SIR_HAL_ITC_MSG_TYPES_BEGIN + 333)
diff --git a/core/mac/src/pe/lim/lim_process_message_queue.c b/core/mac/src/pe/lim/lim_process_message_queue.c
index 27d6a41..0bd9562 100644
--- a/core/mac/src/pe/lim/lim_process_message_queue.c
+++ b/core/mac/src/pe/lim/lim_process_message_queue.c
@@ -2046,7 +2046,7 @@
 		msg->bodyptr = NULL;
 		break;
 #endif
-	case SIR_HAL_SOC_SET_HW_MODE_RESP:
+	case SIR_HAL_PDEV_SET_HW_MODE_RESP:
 		lim_process_set_hw_mode_resp(mac_ctx, msg->bodyptr);
 		qdf_mem_free((void *)msg->bodyptr);
 		msg->bodyptr = NULL;
diff --git a/core/mac/src/pe/lim/lim_process_sme_req_messages.c b/core/mac/src/pe/lim/lim_process_sme_req_messages.c
index 8de45fe..96a428d 100644
--- a/core/mac/src/pe/lim/lim_process_sme_req_messages.c
+++ b/core/mac/src/pe/lim/lim_process_sme_req_messages.c
@@ -165,7 +165,7 @@
 	/* Other parameters are not needed for WMA */
 
 	cds_message.bodyptr = req_msg;
-	cds_message.type    = SIR_HAL_SOC_SET_HW_MODE;
+	cds_message.type    = SIR_HAL_PDEV_SET_HW_MODE;
 
 	lim_log(mac, LOG1, FL("Posting SIR_HAL_SOC_SET_HW_MOD to WMA"));
 	status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message);
diff --git a/core/mac/src/sys/legacy/src/utils/src/mac_trace.c b/core/mac/src/sys/legacy/src/utils/src/mac_trace.c
index db836f0..1c1252e 100644
--- a/core/mac/src/sys/legacy/src/utils/src/mac_trace.c
+++ b/core/mac/src/sys/legacy/src/utils/src/mac_trace.c
@@ -527,7 +527,7 @@
 		CASE_RETURN_STRING(SIR_HAL_START_STOP_LOGGING);
 		CASE_RETURN_STRING(SIR_HAL_FLUSH_LOG_TO_FW);
 		CASE_RETURN_STRING(SIR_HAL_PDEV_SET_PCL_TO_FW);
-		CASE_RETURN_STRING(SIR_HAL_SOC_SET_HW_MODE);
+		CASE_RETURN_STRING(SIR_HAL_PDEV_SET_HW_MODE);
 		CASE_RETURN_STRING(SIR_HAL_SOC_DUAL_MAC_CFG_REQ);
 		CASE_RETURN_STRING(WMA_RADAR_DETECTED_IND);
 		CASE_RETURN_STRING(WMA_TIMER_TRAFFIC_STATS_IND);
diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h
index 0cc23cd..0906720 100644
--- a/core/sme/inc/sme_api.h
+++ b/core/sme/inc/sme_api.h
@@ -988,7 +988,7 @@
 
 QDF_STATUS sme_pdev_set_pcl(tHalHandle hal,
 		struct sir_pcl_list msg);
-QDF_STATUS sme_soc_set_hw_mode(tHalHandle hal,
+QDF_STATUS sme_pdev_set_hw_mode(tHalHandle hal,
 		struct sir_hw_mode msg);
 void sme_register_hw_mode_trans_cb(tHalHandle hal,
 		hw_mode_transition_cb callback);
diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c
index a4d636f..49c7d68 100644
--- a/core/sme/src/common/sme_api.c
+++ b/core/sme/src/common/sme_api.c
@@ -14918,14 +14918,14 @@
 }
 
 /*
- * sme_soc_set_hw_mode() - Send WMI_SOC_SET_HW_MODE_CMDID to the WMA
+ * sme_pdev_set_hw_mode() - Send WMI_PDEV_SET_HW_MODE_CMDID to the WMA
  * @hal: Handle returned by macOpen
  * @msg: HW mode structure containing hw mode and callback details
  *
- * Sends the command to CSR to send WMI_SOC_SET_HW_MODE_CMDID to FW
+ * Sends the command to CSR to send WMI_PDEV_SET_HW_MODE_CMDID to FW
  * Return: QDF_STATUS_SUCCESS on successful posting
  */
-QDF_STATUS sme_soc_set_hw_mode(tHalHandle hal,
+QDF_STATUS sme_pdev_set_hw_mode(tHalHandle hal,
 		struct sir_hw_mode msg)
 {
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
diff --git a/core/wma/inc/wma.h b/core/wma/inc/wma.h
index b525dd7..b503fd1 100644
--- a/core/wma/inc/wma.h
+++ b/core/wma/inc/wma.h
@@ -1981,7 +1981,7 @@
 QDF_STATUS wma_send_pdev_set_pcl_cmd(tp_wma_handle wma_handle,
 		struct wmi_pcl_chan_weights *msg);
 
-QDF_STATUS wma_send_soc_set_hw_mode_cmd(tp_wma_handle wma_handle,
+QDF_STATUS wma_send_pdev_set_hw_mode_cmd(tp_wma_handle wma_handle,
 		struct sir_hw_mode *msg);
 QDF_STATUS wma_get_scan_id(uint32_t *scan_id);
 
diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c
index 35ebdb7..6604254 100644
--- a/core/wma/src/wma_main.c
+++ b/core/wma/src/wma_main.c
@@ -2290,23 +2290,24 @@
 }
 
 /**
- * wma_soc_set_hw_mode_resp_evt_handler() - Set HW mode resp evt handler
+ * wma_pdev_set_hw_mode_resp_evt_handler() - Set HW mode resp evt handler
  * @handle: WMI handle
  * @event:  Event recevied from FW
  * @len:    Length of the event
  *
- * Event handler for WMI_SOC_SET_HW_MODE_RESP_EVENTID that is sent to host
- * driver in response to a WMI_SOC_SET_HW_MODE_CMDID being sent to WLAN firmware
+ * Event handler for WMI_PDEV_SET_HW_MODE_RESP_EVENTID that is sent to host
+ * driver in response to a WMI_PDEV_SET_HW_MODE_CMDID being sent to WLAN
+ * firmware
  *
  * Return: Success on receiving valid params from FW
  */
-static int wma_soc_set_hw_mode_resp_evt_handler(void *handle,
+static int wma_pdev_set_hw_mode_resp_evt_handler(void *handle,
 		uint8_t *event,
 		uint32_t len)
 {
-	WMI_SOC_SET_HW_MODE_RESP_EVENTID_param_tlvs *param_buf;
-	wmi_soc_set_hw_mode_response_event_fixed_param *wmi_event;
-	wmi_soc_set_hw_mode_response_vdev_mac_entry *vdev_mac_entry;
+	WMI_PDEV_SET_HW_MODE_RESP_EVENTID_param_tlvs *param_buf;
+	wmi_pdev_set_hw_mode_response_event_fixed_param *wmi_event;
+	wmi_pdev_set_hw_mode_response_vdev_mac_entry *vdev_mac_entry;
 	uint32_t i;
 	struct sir_set_hw_mode_resp *hw_mode_resp;
 	tp_wma_handle wma = (tp_wma_handle) handle;
@@ -2328,9 +2329,9 @@
 		return QDF_STATUS_E_NULL_VALUE;
 	}
 
-	param_buf = (WMI_SOC_SET_HW_MODE_RESP_EVENTID_param_tlvs *) event;
+	param_buf = (WMI_PDEV_SET_HW_MODE_RESP_EVENTID_param_tlvs *) event;
 	if (!param_buf) {
-		WMA_LOGE("Invalid WMI_SOC_SET_HW_MODE_RESP_EVENTID event");
+		WMA_LOGE("Invalid WMI_PDEV_SET_HW_MODE_RESP_EVENTID event");
 		/* Need to send response back to upper layer to free
 		 * active command list
 		 */
@@ -2347,13 +2348,20 @@
 			wmi_event->cfgd_hw_mode_index,
 			wmi_event->num_vdev_mac_entries);
 	vdev_mac_entry =
-		param_buf->wmi_soc_set_hw_mode_response_vdev_mac_mapping;
+		param_buf->wmi_pdev_set_hw_mode_response_vdev_mac_mapping;
 
 	/* Store the vdev-mac map in WMA and prepare to send to PE  */
 	for (i = 0; i < wmi_event->num_vdev_mac_entries; i++) {
-		uint32_t vdev_id, mac_id;
+		uint32_t vdev_id, mac_id, pdev_id;
 		vdev_id = vdev_mac_entry[i].vdev_id;
-		mac_id = vdev_mac_entry[i].mac_id;
+		pdev_id = vdev_mac_entry[i].pdev_id;
+		if (pdev_id == WMI_PDEV_ID_SOC) {
+			WMA_LOGE("%s: soc level id received for mac id)",
+				__func__);
+			QDF_BUG(0);
+			goto fail;
+		}
+		mac_id = WMA_PDEV_TO_MAC_MAP(vdev_mac_entry[i].pdev_id);
 
 		WMA_LOGI("%s: vdev_id:%d mac_id:%d",
 			__func__, vdev_id, mac_id);
@@ -2376,7 +2384,7 @@
 	WMA_LOGI("%s: Updated: old_hw_mode_index:%d new_hw_mode_index:%d",
 		__func__, wma->old_hw_mode_index, wma->new_hw_mode_index);
 
-	wma_send_msg(wma, SIR_HAL_SOC_SET_HW_MODE_RESP,
+	wma_send_msg(wma, SIR_HAL_PDEV_SET_HW_MODE_RESP,
 		     (void *) hw_mode_resp, 0);
 
 	return QDF_STATUS_SUCCESS;
@@ -2386,7 +2394,7 @@
 	hw_mode_resp->status = SET_HW_MODE_STATUS_ECANCELED;
 	hw_mode_resp->cfgd_hw_mode_index = 0;
 	hw_mode_resp->num_vdev_mac_entries = 0;
-	wma_send_msg(wma, SIR_HAL_SOC_SET_HW_MODE_RESP,
+	wma_send_msg(wma, SIR_HAL_PDEV_SET_HW_MODE_RESP,
 			(void *) hw_mode_resp, 0);
 
 	return QDF_STATUS_E_FAILURE;
@@ -2782,10 +2790,10 @@
 		goto end;
 	}
 
-	/* Initialize the WMI_SOC_SET_HW_MODE_RESP_EVENTID event handler */
+	/* Initialize the wma_pdev_set_hw_mode_resp_evt_handler event handler */
 	status = wmi_unified_register_event_handler(wma_handle->wmi_handle,
-			WMI_SOC_SET_HW_MODE_RESP_EVENTID,
-			wma_soc_set_hw_mode_resp_evt_handler,
+			WMI_PDEV_SET_HW_MODE_RESP_EVENTID,
+			wma_pdev_set_hw_mode_resp_evt_handler,
 			WMA_RX_SERIALIZER_CTX);
 	if (status != QDF_STATUS_SUCCESS) {
 		WMA_LOGE("Failed to register set hw mode resp event cb");
@@ -5205,8 +5213,8 @@
 				(struct wmi_pcl_chan_weights *)msg->bodyptr);
 		qdf_mem_free(msg->bodyptr);
 		break;
-	case SIR_HAL_SOC_SET_HW_MODE:
-		wma_send_soc_set_hw_mode_cmd(wma_handle,
+	case SIR_HAL_PDEV_SET_HW_MODE:
+		wma_send_pdev_set_hw_mode_cmd(wma_handle,
 				(struct sir_hw_mode *)msg->bodyptr);
 		qdf_mem_free(msg->bodyptr);
 		break;
@@ -5381,7 +5389,7 @@
 }
 
 /**
- * wma_send_soc_set_hw_mode_cmd() - Send WMI_SOC_SET_HW_MODE_CMDID to FW
+ * wma_send_pdev_set_hw_mode_cmd() - Send WMI_PDEV_SET_HW_MODE_CMDID to FW
  * @wma_handle: WMA handle
  * @msg: Structure containing the following parameters
  *
@@ -5394,7 +5402,7 @@
  *
  * Return: Success if the cmd is sent successfully to the firmware
  */
-QDF_STATUS wma_send_soc_set_hw_mode_cmd(tp_wma_handle wma_handle,
+QDF_STATUS wma_send_pdev_set_hw_mode_cmd(tp_wma_handle wma_handle,
 				struct sir_hw_mode *msg)
 {
 	struct sir_set_hw_mode_resp *param;
@@ -5429,7 +5437,7 @@
 	param->cfgd_hw_mode_index = 0;
 	param->num_vdev_mac_entries = 0;
 	WMA_LOGE("%s: Sending HW mode fail response to LIM", __func__);
-	wma_send_msg(wma_handle, SIR_HAL_SOC_SET_HW_MODE_RESP,
+	wma_send_msg(wma_handle, SIR_HAL_PDEV_SET_HW_MODE_RESP,
 			(void *) param, 0);
 	return QDF_STATUS_SUCCESS;
 }