Эх сурвалжийг харах

qcacmn: Add support in host to receive ext2 ready event

Currently the host gets service_ready_event and service_ready_ext_event
during the init sequence as a part of handshake with firmware. As the
size of the service_ready_ext_event exceeds on adding further
parameters, new event is created.

Add support for WMI_SERVICE_READY_EXT2_EVENT to be processed after
WMI_SERVICE_READY_EXT_EVENT based on the service bit
WMI_SERVICE_EXT2_MSG.

Also add support to extract the reg db/bdf version information that
comes inside the ext2 event.

Change-Id: If0b57af362e7eb653f9189b912ec1dd3efb0f731
CRs-Fixed: 2501132
Sourav Mohapatra 5 жил өмнө
parent
commit
6561456601

+ 45 - 0
target_if/core/inc/target_if.h

@@ -140,6 +140,21 @@ struct target_supported_modes {
 	uint32_t hw_mode_ids[WMI_HOST_HW_MODE_MAX];
 };
 
+/**
+ * struct target_version_info - Target version information
+ *
+ * @reg_db_version_major: REG DB version major
+ * @reg_db_version_minor: REG DB version minor
+ * @bdf_reg_db_version_major: BDF REG DB version major
+ * @bdf_reg_db_version_minor: BDF REG DB version minor
+ */
+struct target_version_info {
+	uint8_t reg_db_version_major;
+	uint8_t reg_db_version_minor;
+	uint8_t bdf_reg_db_version_major;
+	uint8_t bdf_reg_db_version_minor;
+};
+
 /**
  * struct tgt_info - FW or lower layer related info(required by target_if),
  *                   it is a sub structure of taarget psoc information
@@ -158,6 +173,7 @@ struct target_supported_modes {
  * @event: qdf_event for target events
  * @service_bitmap: WMI service bitmap
  * @target_cap: target capabilities
+ * @service_ext2_param: service ready ext2 event params
  * @service_ext_param: ext service params
  * @mac_phy_cap: phy caps array
  * @reg_cap: regulatory caps array
@@ -183,6 +199,7 @@ struct tgt_info {
 	uint32_t service_bitmap[PSOC_SERVICE_BM_SIZE];
 	struct wlan_psoc_target_capability_info target_caps;
 	struct wlan_psoc_host_service_ext_param service_ext_param;
+	struct wlan_psoc_host_service_ext2_param service_ext2_param;
 	struct wlan_psoc_host_mac_phy_caps
 			mac_phy_cap[PSOC_MAX_MAC_PHY_CAP];
 	struct wlan_psoc_host_dbr_ring_caps *dbr_ring_cap;
@@ -2236,5 +2253,33 @@ static inline void target_if_set_twt_ap_pdev_count
 {
 }
 #endif /* WLAN_SUPPORT_TWT */
+
+/**
+ * target_psoc_get_version_info() - Get version info from tgt info
+ * @psoc_info: pointer to structure target_psoc_info
+ * @reg_major: reg db version major
+ * @reg_minor: reg db version minor
+ * @bdf_major: bdf reg db version major
+ * @bdf_minor: bdf reg db version minor
+ *
+ * API to get target version information.
+ *
+ * Return: void
+ */
+static inline void target_psoc_get_version_info(
+					struct target_psoc_info *psoc_info,
+					uint8_t *reg_major, uint8_t *reg_minor,
+					uint8_t *bdf_major, uint8_t *bdf_minor)
+{
+	if (!psoc_info)
+		return;
+
+	*reg_major = psoc_info->info.service_ext2_param.reg_db_version_major;
+	*reg_minor = psoc_info->info.service_ext2_param.reg_db_version_minor;
+	*bdf_major =
+		psoc_info->info.service_ext2_param.bdf_reg_db_version_major;
+	*bdf_minor =
+		psoc_info->info.service_ext2_param.bdf_reg_db_version_minor;
+}
 #endif
 

+ 15 - 0
target_if/init_deinit/inc/service_ready_param.h

@@ -348,4 +348,19 @@ struct wlan_psoc_host_service_ext_param {
 	uint32_t sar_version;
 };
 
+/**
+ * struct wlan_psoc_host_service_ext2_param - EXT service base params in event
+ * reg_db_version_major: REG DB version major number
+ * reg_db_version_minor: REG DB version minor number
+ * bdf_reg_db_version_major: BDF REG DB version major number
+ * bdf_reg_db_version_minor: BDF REG DB version minor number
+ */
+struct wlan_psoc_host_service_ext2_param {
+	uint8_t reg_db_version_major;
+	uint8_t reg_db_version_minor;
+	uint8_t bdf_reg_db_version_major;
+	uint8_t bdf_reg_db_version_minor;
+
+};
+
 #endif /* _SERVICE_READY_PARAM_H_*/

+ 15 - 0
target_if/init_deinit/inc/service_ready_util.h

@@ -106,6 +106,21 @@ int init_deinit_populate_service_ready_ext_param(
 		wmi_unified_t handle, uint8_t *evt,
 		struct wlan_psoc_host_service_ext_param *param);
 
+/**
+ * init_deinit_populate_service_ready_ext2_param() - populate service ready ext2
+ *                                                   parameter
+ * @handle: WMI handle pointer
+ * @evt: event buffer received from FW
+ * @info: Target info handle
+ *
+ * API to populate service ready ext2 param
+ *
+ * Return: zero on successful parsing of service ready ext parameter or failure
+ */
+int init_deinit_populate_service_ready_ext2_param(
+		wmi_unified_t handle, uint8_t *evt,
+		struct tgt_info *info);
+
 /**
  * init_deinit_populate_chainmask_tables() - populate chainmaks tables
  * @handle: WMI handle pointer

+ 66 - 9
target_if/init_deinit/src/init_event_handler.c

@@ -33,6 +33,14 @@
 #include <init_cmd_api.h>
 #include <cdp_txrx_cmn.h>
 
+static void init_deinit_set_send_init_cmd(struct wlan_objmgr_psoc *psoc,
+					  struct target_psoc_info *tgt_hdl)
+{
+	tgt_hdl->info.wmi_service_ready = TRUE;
+	/* send init command */
+	init_deinit_prepare_send_init_cmd(psoc, tgt_hdl);
+}
+
 static int init_deinit_service_ready_event_handler(ol_scn_t scn_handle,
 							uint8_t *event,
 							uint32_t data_len)
@@ -178,16 +186,56 @@ static int init_deinit_service_ready_event_handler(ol_scn_t scn_handle,
 		goto exit;
 
 	target_if_reg_set_offloaded_info(psoc);
-	if (!wmi_service_enabled(wmi_handle, wmi_service_ext_msg)) {
+	if (wmi_service_enabled(wmi_handle, wmi_service_ext_msg)) {
+		target_if_debug("Wait for EXT message");
+	} else {
 		target_if_debug("No EXT message, send init command");
-		tgt_hdl->info.wmi_service_ready = TRUE;
 		target_psoc_set_num_radios(tgt_hdl, 1);
-		/* send init command */
-		init_deinit_prepare_send_init_cmd(psoc, tgt_hdl);
-	} else {
-		target_if_debug("Wait for EXT message");
+		init_deinit_set_send_init_cmd(psoc, tgt_hdl);
+	}
+
+exit:
+	return err_code;
+}
+
+static int init_deinit_service_ext2_ready_event_handler(ol_scn_t scn_handle,
+							uint8_t *event,
+							uint32_t data_len)
+{
+	int err_code = 0;
+	struct wlan_objmgr_psoc *psoc;
+	struct target_psoc_info *tgt_hdl;
+	struct wmi_unified *wmi_handle;
+	struct tgt_info *info;
+
+	if (!scn_handle) {
+		target_if_err("scn handle NULL in service ready handler");
+		return -EINVAL;
 	}
 
+	psoc = target_if_get_psoc_from_scn_hdl(scn_handle);
+	if (!psoc) {
+		target_if_err("psoc is null in service ready handler");
+		return -EINVAL;
+	}
+
+	tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc);
+	if (!tgt_hdl) {
+		target_if_err("target_psoc_info is null in service ready ev");
+		return -EINVAL;
+	}
+
+	wmi_handle = target_psoc_get_wmi_hdl(tgt_hdl);
+	info = (&tgt_hdl->info);
+
+	err_code = init_deinit_populate_service_ready_ext2_param(wmi_handle,
+								 event, info);
+	if (err_code)
+		goto exit;
+
+	/* send init command */
+	init_deinit_set_send_init_cmd(psoc, tgt_hdl);
+
 exit:
 	return err_code;
 }
@@ -295,9 +343,12 @@ static int init_deinit_service_ext_ready_event_handler(ol_scn_t scn_handle,
 	info->wlan_res_cfg.max_bssid_indicator =
 				info->service_ext_param.max_bssid_indicator;
 
-	info->wmi_service_ready = TRUE;
-
-	init_deinit_prepare_send_init_cmd(psoc, tgt_hdl);
+	if (wmi_service_enabled(wmi_handle, wmi_service_ext2_msg)) {
+		target_if_debug("Wait for EXT2 message");
+	} else {
+		target_if_debug("No EXT2 message, send init command");
+		init_deinit_set_send_init_cmd(psoc, tgt_hdl);
+	}
 
 exit:
 	return err_code;
@@ -562,6 +613,12 @@ QDF_STATUS init_deinit_register_tgt_psoc_ev_handlers(
 				wmi_ready_event_id,
 				init_deinit_ready_event_handler,
 				WMI_RX_WORK_CTX);
+	retval = wmi_unified_register_event_handler(
+				wmi_handle,
+				wmi_service_ready_ext2_event_id,
+				init_deinit_service_ext2_ready_event_handler,
+				WMI_RX_WORK_CTX);
+
 
 	return retval;
 }

+ 16 - 0
target_if/init_deinit/src/service_ready_util.c

@@ -140,6 +140,22 @@ int init_deinit_populate_service_ready_ext_param(
 	return 0;
 }
 
+int init_deinit_populate_service_ready_ext2_param(
+		wmi_unified_t handle, uint8_t *evt,
+		struct tgt_info *info)
+{
+	QDF_STATUS status;
+
+	status = wmi_extract_service_ready_ext2(handle, evt,
+						&info->service_ext2_param);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		target_if_err("failed to parse wmi service ready ext param");
+		return qdf_status_to_os_return(status);
+	}
+
+	return 0;
+}
+
 int init_deinit_populate_chainmask_tables(
 		wmi_unified_t handle, uint8_t *evt,
 		struct wlan_psoc_host_chainmask_table *param)

+ 13 - 0
wmi/inc/wmi_unified_api.h

@@ -2883,6 +2883,19 @@ QDF_STATUS wmi_extract_service_ready_ext(
 		wmi_unified_t wmi_handle, uint8_t *evt_buf,
 		struct wlan_psoc_host_service_ext_param *param);
 
+/*
+ * wmi_extract_service_ready_ext2() - extract extended2 service ready
+ * @wmi_handle: wmi handle
+ * @evt_buff: pointer to event buffer
+ * @param: wmi ext2 base parameters
+ *
+ *
+ * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
+ */
+QDF_STATUS wmi_extract_service_ready_ext2(
+		struct wmi_unified *wmi_handle, uint8_t *evt_buf,
+		struct wlan_psoc_host_service_ext2_param *param);
+
 /**
  * wmi_extract_hw_mode_cap_service_ready_ext() -
  *       extract HW mode cap from service ready event

+ 2 - 0
wmi/inc/wmi_unified_param.h

@@ -4520,6 +4520,7 @@ typedef enum {
 	wmi_coex_report_antenna_isolation_event_id,
 	wmi_chan_rf_characterization_info_event_id,
 	wmi_roam_auth_offload_event_id,
+	wmi_service_ready_ext2_event_id,
 	wmi_events_max,
 } wmi_conv_event_id;
 
@@ -5015,6 +5016,7 @@ typedef enum {
 	wmi_service_dynamic_hw_mode,
 	wmi_service_sae_roam_support,
 	wmi_service_owe_roam_support,
+	wmi_service_ext2_msg,
 	wmi_services_max,
 } wmi_conv_service_ids;
 #define WMI_SERVICE_UNAVAILABLE 0xFFFF

+ 7 - 1
wmi/inc/wmi_unified_priv.h

@@ -1648,10 +1648,16 @@ QDF_STATUS (*send_peer_rx_reorder_queue_setup_cmd)(wmi_unified_t wmi_handle,
 QDF_STATUS (*send_peer_rx_reorder_queue_remove_cmd)(wmi_unified_t wmi_handle,
 		struct rx_reorder_queue_remove_params *param);
 
-QDF_STATUS (*extract_service_ready_ext)(wmi_unified_t wmi_handle,
+QDF_STATUS (*extract_service_ready_ext)(
+			wmi_unified_t wmi_handle,
 			uint8_t *evt_buf,
 			struct wlan_psoc_host_service_ext_param *param);
 
+QDF_STATUS (*extract_service_ready_ext2)(
+			wmi_unified_t wmi_handle,
+			uint8_t *evt_buf,
+			struct wlan_psoc_host_service_ext2_param *param);
+
 QDF_STATUS (*extract_hw_mode_cap_service_ready_ext)(
 			wmi_unified_t wmi_handle,
 			uint8_t *evt_buf, uint8_t hw_mode_idx,

+ 11 - 0
wmi/src/wmi_unified_api.c

@@ -2287,6 +2287,17 @@ QDF_STATUS wmi_extract_service_ready_ext(
 	return QDF_STATUS_E_FAILURE;
 }
 
+QDF_STATUS wmi_extract_service_ready_ext2(
+		struct wmi_unified *wmi_handle, uint8_t *evt_buf,
+		struct wlan_psoc_host_service_ext2_param *param)
+{
+	if (wmi_handle->ops->extract_service_ready_ext2)
+		return wmi_handle->ops->extract_service_ready_ext2(wmi_handle,
+				evt_buf, param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
 QDF_STATUS wmi_extract_sar_cap_service_ready_ext(
 			wmi_unified_t wmi_handle,
 			uint8_t *evt_buf,

+ 44 - 0
wmi/src/wmi_unified_tlv.c

@@ -9604,6 +9604,46 @@ static QDF_STATUS extract_service_ready_ext_tlv(wmi_unified_t wmi_handle,
 	return QDF_STATUS_SUCCESS;
 }
 
+/**
+ * extract_service_ready_ext2_tlv() - extract service ready ext2 params from
+ * event
+ * @wmi_handle: wmi handle
+ * @event: pointer to event buffer
+ * @param: Pointer to hold the params
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code
+ */
+static QDF_STATUS
+extract_service_ready_ext2_tlv(wmi_unified_t wmi_handle, uint8_t *event,
+			       struct wlan_psoc_host_service_ext2_param *param)
+{
+	WMI_SERVICE_READY_EXT2_EVENTID_param_tlvs *param_buf;
+	wmi_service_ready_ext2_event_fixed_param *ev;
+
+	param_buf = (WMI_SERVICE_READY_EXT2_EVENTID_param_tlvs *)event;
+	if (!param_buf)
+		return QDF_STATUS_E_INVAL;
+
+	ev = param_buf->fixed_param;
+	if (!ev)
+		return QDF_STATUS_E_INVAL;
+
+	param->reg_db_version_major =
+			WMI_REG_DB_VERSION_MAJOR_GET(
+				ev->reg_db_version);
+	param->reg_db_version_minor =
+			WMI_REG_DB_VERSION_MINOR_GET(
+				ev->reg_db_version);
+	param->bdf_reg_db_version_major =
+			WMI_BDF_REG_DB_VERSION_MAJOR_GET(
+				ev->reg_db_version);
+	param->bdf_reg_db_version_minor =
+			WMI_BDF_REG_DB_VERSION_MINOR_GET(
+				ev->reg_db_version);
+
+	return QDF_STATUS_SUCCESS;
+}
+
 /**
  * extract_sar_cap_service_ready_ext_tlv() -
  *       extract SAR cap from service ready event
@@ -11940,6 +11980,7 @@ struct wmi_ops tlv_ops =  {
 	.send_fw_test_cmd = send_fw_test_cmd_tlv,
 	.send_power_dbg_cmd = send_power_dbg_cmd_tlv,
 	.extract_service_ready_ext = extract_service_ready_ext_tlv,
+	.extract_service_ready_ext2 = extract_service_ready_ext2_tlv,
 	.extract_hw_mode_cap_service_ready_ext =
 				extract_hw_mode_cap_service_ready_ext_tlv,
 	.extract_mac_phy_cap_service_ready_ext =
@@ -12066,6 +12107,8 @@ static void populate_tlv_events_id(uint32_t *event_ids)
 	event_ids[wmi_pdev_temperature_event_id] = WMI_PDEV_TEMPERATURE_EVENTID;
 	event_ids[wmi_service_ready_ext_event_id] =
 						WMI_SERVICE_READY_EXT_EVENTID;
+	event_ids[wmi_service_ready_ext2_event_id] =
+						WMI_SERVICE_READY_EXT2_EVENTID;
 	event_ids[wmi_vdev_start_resp_event_id] = WMI_VDEV_START_RESP_EVENTID;
 	event_ids[wmi_vdev_stopped_event_id] = WMI_VDEV_STOPPED_EVENTID;
 	event_ids[wmi_vdev_install_key_complete_event_id] =
@@ -12493,6 +12536,7 @@ static void populate_tlv_service(uint32_t *wmi_service)
 	wmi_service[wmi_service_mgmt_tx_htt] = WMI_SERVICE_MGMT_TX_HTT;
 	wmi_service[wmi_service_mgmt_tx_wmi] = WMI_SERVICE_MGMT_TX_WMI;
 	wmi_service[wmi_service_ext_msg] = WMI_SERVICE_EXT_MSG;
+	wmi_service[wmi_service_ext2_msg] = WMI_SERVICE_EXT2_MSG;
 	wmi_service[wmi_service_mawc] = WMI_SERVICE_MAWC;
 	wmi_service[wmi_service_multiple_vdev_restart] =
 			WMI_SERVICE_MULTIPLE_VDEV_RESTART;