Browse Source

Merge "qcacmn: Support for IPQ8074 2G PHYB mode 3/3"

Linux Build Service Account 5 năm trước cách đây
mục cha
commit
5c958b9eea

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

@@ -209,6 +209,8 @@ struct tgt_info {
 	struct wmi_host_mem_chunk mem_chunks[MAX_MEM_CHUNKS];
 	struct wlan_psoc_host_hw_mode_caps hw_mode_cap;
 	struct target_supported_modes hw_modes;
+	uint8_t pdev_id_to_phy_id_map[WLAN_UMAC_MAX_PDEVS];
+	bool is_pdevid_to_phyid_map;
 };
 
 /**
@@ -819,6 +821,28 @@ static inline void target_psoc_set_num_radios(
 	psoc_info->info.num_radios = num_radios;
 }
 
+/**
+ * target_psoc_set_pdev_id_to_phy_id_map() - set pdev to phy id mapping
+ * @psoc_info:  pointer to structure target_psoc_info
+ * @pdev_id: pdev id
+ * @phy_id: phy_id
+ *
+ * API to set pdev id to phy id mapping
+ *
+ * Return: void
+ */
+static inline void target_psoc_set_pdev_id_to_phy_id_map(
+		struct target_psoc_info *psoc_info,
+		uint8_t *phy_id_map)
+{
+	if (!psoc_info)
+		return;
+
+	psoc_info->info.is_pdevid_to_phyid_map = true;
+	qdf_mem_copy(psoc_info->info.pdev_id_to_phy_id_map, phy_id_map,
+		     PSOC_MAX_PHY_REG_CAP);
+}
+
 /**
  * target_psoc_get_num_radios() - get number of radios
  * @psoc_info:  pointer to structure target_psoc_info

+ 85 - 0
target_if/regulatory/src/target_if_reg.c

@@ -378,6 +378,85 @@ tgt_if_regulatory_send_ctl_info(struct wlan_objmgr_psoc *psoc,
 }
 #endif
 
+/**
+ * tgt_if_regulatory_get_phy_id_from_pdev_id() - Get phy_id from pdev_id
+ * @psoc: Pointer to psoc
+ * @pdev_id: Pdev id
+ * @phy_id: phy_id
+ *
+ * Return: QDF_STATUS
+ */
+static QDF_STATUS tgt_if_regulatory_get_phy_id_from_pdev_id(
+	struct wlan_objmgr_psoc *psoc, uint8_t pdev_id, uint8_t *phy_id)
+{
+	struct target_psoc_info *tgt_if_handle = psoc->tgt_if_handle;
+	uint8_t ret;
+
+	if (pdev_id >= WLAN_UMAC_MAX_PDEVS) {
+		target_if_err("pdev_id is greater than WLAN_UMAC_MAX_PDEVS");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	/* By default pdev_id and phy_id have one to one mapping */
+	*phy_id = pdev_id;
+
+	if (!(tgt_if_handle &&
+	      tgt_if_handle->info.is_pdevid_to_phyid_map))
+		return QDF_STATUS_SUCCESS;
+
+	ret = tgt_if_handle->info.pdev_id_to_phy_id_map[pdev_id];
+
+	if (ret < PSOC_MAX_PHY_REG_CAP) {
+		*phy_id = ret;
+	} else {
+		target_if_err("phy_id is greater than PSOC_MAX_PHY_REG_CAP");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * tgt_if_regulatory_get_pdev_id_from_phy_id() - Get pdev_id for phy_id
+ * @psoc: Pointer to psoc
+ * @phy_id: Phy id
+ * @pdev_id: Pdev id
+ *
+ * Return: QDF_STATUS
+ */
+static QDF_STATUS tgt_if_regulatory_get_pdev_id_from_phy_id(
+	struct wlan_objmgr_psoc *psoc, uint8_t phy_id, uint8_t *pdev_id)
+{
+	struct target_psoc_info *tgt_if_handle = psoc->tgt_if_handle;
+	uint8_t i;
+
+	if (phy_id >= PSOC_MAX_PHY_REG_CAP) {
+		target_if_err("phy_id is greater than PSOC_MAX_PHY_REG_CAP");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	/* By default pdev_id and phy_id have one to one mapping */
+	*pdev_id = phy_id;
+
+	if (!(tgt_if_handle &&
+	      tgt_if_handle->info.is_pdevid_to_phyid_map))
+		return QDF_STATUS_SUCCESS;
+
+	for (i = 0; i < WLAN_UMAC_MAX_PDEVS; i++) {
+		if (tgt_if_handle->info.pdev_id_to_phy_id_map[i] == phy_id)
+			break;
+	}
+
+	if (i < WLAN_UMAC_MAX_PDEVS) {
+		*pdev_id = i;
+	} else {
+		target_if_err("pdev_id is greater than WLAN_UMAC_MAX_PDEVS");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
+
 QDF_STATUS target_if_register_regulatory_tx_ops(
 		struct wlan_lmac_if_tx_ops *tx_ops)
 {
@@ -419,5 +498,11 @@ QDF_STATUS target_if_register_regulatory_tx_ops(
 
 	reg_ops->send_ctl_info = tgt_if_regulatory_send_ctl_info;
 
+	reg_ops->get_phy_id_from_pdev_id =
+			tgt_if_regulatory_get_phy_id_from_pdev_id;
+
+	reg_ops->get_pdev_id_from_phy_id =
+			tgt_if_regulatory_get_pdev_id_from_phy_id;
+
 	return QDF_STATUS_SUCCESS;
 }

+ 4 - 0
umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h

@@ -806,6 +806,10 @@ struct wlan_lmac_if_reg_tx_ops {
 			struct wlan_objmgr_psoc *psoc, void *arg);
 	QDF_STATUS (*send_ctl_info)(struct wlan_objmgr_psoc *psoc,
 				    struct reg_ctl_params *params);
+	QDF_STATUS (*get_phy_id_from_pdev_id)(struct wlan_objmgr_psoc *psoc,
+					      uint8_t pdev_id, uint8_t *phy_id);
+	QDF_STATUS (*get_pdev_id_from_phy_id)(struct wlan_objmgr_psoc *psoc,
+					      uint8_t phy_id, uint8_t *pdev_id);
 };
 
 /**

+ 19 - 6
umac/regulatory/core/src/reg_build_chan_list.c

@@ -820,7 +820,8 @@ void reg_propagate_mas_chan_list_to_pdev(struct wlan_objmgr_psoc *psoc,
 	struct wlan_regulatory_psoc_priv_obj *psoc_priv_obj;
 	struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
 	enum direction *dir = arg;
-	uint32_t pdev_id;
+	uint8_t pdev_id;
+	uint8_t phy_id;
 	struct wlan_lmac_if_reg_tx_ops *reg_tx_ops;
 	struct reg_rule_info *psoc_reg_rules;
 
@@ -841,17 +842,23 @@ void reg_propagate_mas_chan_list_to_pdev(struct wlan_objmgr_psoc *psoc,
 	}
 
 	pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev);
+
+	reg_tx_ops = reg_get_psoc_tx_ops(psoc);
+	if (reg_tx_ops->get_phy_id_from_pdev_id)
+		reg_tx_ops->get_phy_id_from_pdev_id(psoc, pdev_id, &phy_id);
+	else
+		phy_id = pdev_id;
+
 	reg_init_pdev_mas_chan_list(
 			pdev_priv_obj,
-			&psoc_priv_obj->mas_chan_params[pdev_id]);
-	psoc_reg_rules = &psoc_priv_obj->mas_chan_params[pdev_id].reg_rules;
+			&psoc_priv_obj->mas_chan_params[phy_id]);
+	psoc_reg_rules = &psoc_priv_obj->mas_chan_params[phy_id].reg_rules;
 	reg_save_reg_rules_to_pdev(psoc_reg_rules, pdev_priv_obj);
 	reg_modify_chan_list_for_japan(pdev);
 	pdev_priv_obj->chan_list_recvd =
-		psoc_priv_obj->chan_list_recvd[pdev_id];
+		psoc_priv_obj->chan_list_recvd[phy_id];
 	reg_compute_pdev_current_chan_list(pdev_priv_obj);
 
-	reg_tx_ops = reg_get_psoc_tx_ops(psoc);
 	if (reg_tx_ops->fill_umac_legacy_chanlist) {
 		reg_tx_ops->fill_umac_legacy_chanlist(
 				pdev, pdev_priv_obj->cur_chan_list);
@@ -981,6 +988,7 @@ QDF_STATUS reg_process_master_chan_list(
 	wlan_objmgr_ref_dbgid dbg_id;
 	enum direction dir;
 	uint8_t phy_id;
+	uint8_t pdev_id;
 	struct wlan_objmgr_pdev *pdev;
 	struct wlan_lmac_if_reg_tx_ops *tx_ops;
 	struct reg_rule_info *reg_rules;
@@ -997,6 +1005,11 @@ QDF_STATUS reg_process_master_chan_list(
 	tx_ops = reg_get_psoc_tx_ops(psoc);
 	phy_id = regulat_info->phy_id;
 
+	if (tx_ops->get_pdev_id_from_phy_id)
+		tx_ops->get_pdev_id_from_phy_id(psoc, phy_id, &pdev_id);
+	else
+		pdev_id = phy_id;
+
 	if (reg_ignore_default_country(soc_reg, regulat_info)) {
 		status = reg_set_curr_country(soc_reg, regulat_info, tx_ops);
 		if (QDF_IS_STATUS_SUCCESS(status)) {
@@ -1186,7 +1199,7 @@ QDF_STATUS reg_process_master_chan_list(
 		}
 	}
 
-	pdev = wlan_objmgr_get_pdev_by_id(psoc, phy_id, dbg_id);
+	pdev = wlan_objmgr_get_pdev_by_id(psoc, pdev_id, dbg_id);
 	if (pdev) {
 		reg_propagate_mas_chan_list_to_pdev(psoc, pdev, &dir);
 		wlan_objmgr_pdev_release_ref(pdev, dbg_id);

+ 9 - 2
umac/regulatory/core/src/reg_offload_11d_scan.c

@@ -43,6 +43,7 @@ QDF_STATUS reg_set_11d_country(struct wlan_objmgr_pdev *pdev,
 	QDF_STATUS status;
 	struct wlan_lmac_if_reg_tx_ops *tx_ops;
 	uint8_t pdev_id;
+	uint8_t phy_id;
 
 	if (!country) {
 		reg_err("Null country code");
@@ -71,7 +72,13 @@ QDF_STATUS reg_set_11d_country(struct wlan_objmgr_pdev *pdev,
 	qdf_mem_copy(country_code.country, country, REG_ALPHA2_LEN + 1);
 	country_code.pdev_id = pdev_id;
 
-	psoc_priv_obj->new_11d_ctry_pending[pdev_id] = true;
+	tx_ops = reg_get_psoc_tx_ops(psoc);
+	if (tx_ops->get_phy_id_from_pdev_id)
+		tx_ops->get_phy_id_from_pdev_id(psoc, pdev_id, &phy_id);
+	else
+		phy_id = pdev_id;
+
+	psoc_priv_obj->new_11d_ctry_pending[phy_id] = true;
 
 	if (psoc_priv_obj->offload_enabled) {
 		tx_ops = reg_get_psoc_tx_ops(psoc);
@@ -79,7 +86,7 @@ QDF_STATUS reg_set_11d_country(struct wlan_objmgr_pdev *pdev,
 			tx_ops->set_country_code(psoc, &country_code);
 		} else {
 			reg_err("country set fw handler not present");
-			psoc_priv_obj->new_11d_ctry_pending[pdev_id] = false;
+			psoc_priv_obj->new_11d_ctry_pending[phy_id] = false;
 			return QDF_STATUS_E_FAULT;
 		}
 		status = QDF_STATUS_SUCCESS;

+ 17 - 9
umac/regulatory/core/src/reg_priv_objs.c

@@ -73,7 +73,7 @@ QDF_STATUS wlan_regulatory_psoc_obj_created_notification(
 	enum channel_enum chan_enum;
 	QDF_STATUS status;
 	uint8_t i;
-	uint8_t pdev_cnt;
+	uint8_t phy_cnt;
 
 	soc_reg_obj = qdf_mem_malloc(sizeof(*soc_reg_obj));
 	if (!soc_reg_obj)
@@ -98,10 +98,10 @@ QDF_STATUS wlan_regulatory_psoc_obj_created_notification(
 
 	qdf_spinlock_create(&soc_reg_obj->cbk_list_lock);
 
-	for (pdev_cnt = 0; pdev_cnt < PSOC_MAX_PHY_REG_CAP; pdev_cnt++) {
+	for (phy_cnt = 0; phy_cnt < PSOC_MAX_PHY_REG_CAP; phy_cnt++) {
 		mas_chan_list =
-			soc_reg_obj->mas_chan_params[pdev_cnt].mas_chan_list;
-		soc_reg_obj->chan_list_recvd[pdev_cnt] = false;
+			soc_reg_obj->mas_chan_params[phy_cnt].mas_chan_list;
+		soc_reg_obj->chan_list_recvd[phy_cnt] = false;
 
 		for (chan_enum = 0; chan_enum < NUM_CHANNELS; chan_enum++) {
 			mas_chan_list[chan_enum].chan_flags |=
@@ -180,12 +180,14 @@ QDF_STATUS wlan_regulatory_pdev_obj_created_notification(
 	struct wlan_regulatory_psoc_priv_obj *psoc_priv_obj;
 	struct wlan_psoc_host_hal_reg_capabilities_ext *reg_cap_ptr;
 	struct wlan_objmgr_psoc *parent_psoc;
-	uint32_t pdev_id;
+	uint8_t pdev_id;
+	uint8_t phy_id;
 	uint32_t cnt;
 	uint32_t range_2g_low, range_2g_high;
 	uint32_t range_5g_low, range_5g_high;
 	QDF_STATUS status;
 	struct reg_rule_info *psoc_reg_rules;
+	struct wlan_lmac_if_reg_tx_ops *tx_ops;
 
 	pdev_priv_obj = qdf_mem_malloc(sizeof(*pdev_priv_obj));
 	if (!pdev_priv_obj)
@@ -193,6 +195,12 @@ QDF_STATUS wlan_regulatory_pdev_obj_created_notification(
 
 	parent_psoc = wlan_pdev_get_psoc(pdev);
 	pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev);
+	tx_ops = reg_get_psoc_tx_ops(parent_psoc);
+
+	if (tx_ops->get_phy_id_from_pdev_id)
+		tx_ops->get_phy_id_from_pdev_id(parent_psoc, pdev_id, &phy_id);
+	else
+		phy_id = pdev_id;
 
 	psoc_priv_obj = reg_get_psoc_obj(parent_psoc);
 	if (!psoc_priv_obj) {
@@ -223,7 +231,7 @@ QDF_STATUS wlan_regulatory_pdev_obj_created_notification(
 			return QDF_STATUS_E_FAULT;
 		}
 
-		if (reg_cap_ptr->phy_id == pdev_id)
+		if (reg_cap_ptr->phy_id == phy_id)
 			break;
 		reg_cap_ptr++;
 	}
@@ -246,12 +254,12 @@ QDF_STATUS wlan_regulatory_pdev_obj_created_notification(
 	pdev_priv_obj->wireless_modes = reg_cap_ptr->wireless_modes;
 
 	reg_init_pdev_mas_chan_list(pdev_priv_obj,
-				    &psoc_priv_obj->mas_chan_params[pdev_id]);
+				    &psoc_priv_obj->mas_chan_params[phy_id]);
 
-	psoc_reg_rules = &psoc_priv_obj->mas_chan_params[pdev_id].reg_rules;
+	psoc_reg_rules = &psoc_priv_obj->mas_chan_params[phy_id].reg_rules;
 	reg_save_reg_rules_to_pdev(psoc_reg_rules, pdev_priv_obj);
 	pdev_priv_obj->chan_list_recvd =
-		psoc_priv_obj->chan_list_recvd[pdev_id];
+		psoc_priv_obj->chan_list_recvd[phy_id];
 
 	status = wlan_objmgr_pdev_component_obj_attach(
 			pdev, WLAN_UMAC_COMP_REGULATORY, pdev_priv_obj,

+ 18 - 2
umac/regulatory/core/src/reg_services_common.c

@@ -1940,6 +1940,7 @@ QDF_STATUS reg_program_chan_list(struct wlan_objmgr_pdev *pdev,
 	struct wlan_lmac_if_reg_tx_ops *tx_ops;
 	struct wlan_regulatory_psoc_priv_obj *psoc_priv_obj;
 	uint8_t pdev_id;
+	uint8_t phy_id;
 	QDF_STATUS err;
 
 	pdev_priv_obj = reg_get_pdev_obj(pdev);
@@ -1968,8 +1969,14 @@ QDF_STATUS reg_program_chan_list(struct wlan_objmgr_pdev *pdev,
 
 		pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev);
 		tx_ops = reg_get_psoc_tx_ops(psoc);
+
+		if (tx_ops->get_phy_id_from_pdev_id)
+			tx_ops->get_phy_id_from_pdev_id(psoc, pdev_id, &phy_id);
+		else
+			phy_id = pdev_id;
+
 		if (tx_ops->set_user_country_code) {
-			psoc_priv_obj->new_init_ctry_pending[pdev_id] = true;
+			psoc_priv_obj->new_init_ctry_pending[phy_id] = true;
 			return tx_ops->set_user_country_code(psoc, pdev_id, rd);
 		}
 
@@ -2063,6 +2070,8 @@ QDF_STATUS reg_get_curr_regdomain(struct wlan_objmgr_pdev *pdev,
 	uint16_t index;
 	int num_reg_dmn;
 	uint8_t phy_id;
+	uint8_t pdev_id;
+	struct wlan_lmac_if_reg_tx_ops *tx_ops;
 
 	psoc = wlan_pdev_get_psoc(pdev);
 	psoc_priv_obj = reg_get_psoc_obj(psoc);
@@ -2071,7 +2080,14 @@ QDF_STATUS reg_get_curr_regdomain(struct wlan_objmgr_pdev *pdev,
 		return QDF_STATUS_E_INVAL;
 	}
 
-	phy_id = wlan_objmgr_pdev_get_pdev_id(pdev);
+	pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev);
+
+	tx_ops = reg_get_psoc_tx_ops(psoc);
+	if (tx_ops->get_phy_id_from_pdev_id)
+		tx_ops->get_phy_id_from_pdev_id(psoc, pdev_id, &phy_id);
+	else
+		phy_id = pdev_id;
+
 	cur_regdmn->regdmn_pair_id =
 		psoc_priv_obj->mas_chan_params[phy_id].reg_dmn_pair;
 

+ 15 - 8
umac/regulatory/core/src/reg_utils.c

@@ -179,6 +179,7 @@ QDF_STATUS reg_set_country(struct wlan_objmgr_pdev *pdev,
 	struct wlan_objmgr_psoc *psoc;
 	struct cc_regdmn_s rd;
 	uint8_t pdev_id;
+	uint8_t phy_id;
 
 	if (!pdev) {
 		reg_err("pdev is NULL");
@@ -194,6 +195,12 @@ QDF_STATUS reg_set_country(struct wlan_objmgr_pdev *pdev,
 
 	psoc = wlan_pdev_get_psoc(pdev);
 
+	tx_ops = reg_get_psoc_tx_ops(psoc);
+	if (tx_ops->get_phy_id_from_pdev_id)
+		tx_ops->get_phy_id_from_pdev_id(psoc, pdev_id, &phy_id);
+	else
+		phy_id = pdev_id;
+
 	psoc_reg = reg_get_psoc_obj(psoc);
 	if (!IS_VALID_PSOC_REG_OBJ(psoc_reg)) {
 		reg_err("psoc reg component is NULL");
@@ -227,9 +234,9 @@ QDF_STATUS reg_set_country(struct wlan_objmgr_pdev *pdev,
 
 
 	if (reg_is_world_alpha2(cc.country))
-		psoc_reg->world_country_pending[pdev_id] = true;
+		psoc_reg->world_country_pending[phy_id] = true;
 	else
-		psoc_reg->new_user_ctry_pending[pdev_id] = true;
+		psoc_reg->new_user_ctry_pending[phy_id] = true;
 
 	if (psoc_reg->offload_enabled) {
 		tx_ops = reg_get_psoc_tx_ops(psoc);
@@ -237,7 +244,7 @@ QDF_STATUS reg_set_country(struct wlan_objmgr_pdev *pdev,
 			tx_ops->set_country_code(psoc, &cc);
 		} else {
 			reg_err("country set fw handler not present");
-			psoc_reg->new_user_ctry_pending[pdev_id] = false;
+			psoc_reg->new_user_ctry_pending[phy_id] = false;
 			return QDF_STATUS_E_FAULT;
 		}
 	} else {
@@ -245,7 +252,7 @@ QDF_STATUS reg_set_country(struct wlan_objmgr_pdev *pdev,
 			pdev_priv_obj = reg_get_pdev_obj(pdev);
 			if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) {
 				reg_err("reg component pdev priv is NULL");
-				psoc_reg->world_country_pending[pdev_id] =
+				psoc_reg->world_country_pending[phy_id] =
 									false;
 				return QDF_STATUS_E_INVAL;
 			}
@@ -860,7 +867,7 @@ void reg_program_mas_chan_list(struct wlan_objmgr_psoc *psoc,
 	QDF_STATUS status;
 	uint32_t count;
 	enum direction dir;
-	uint32_t pdev_cnt;
+	uint32_t phy_cnt;
 
 	psoc_priv_obj = reg_get_psoc_obj(psoc);
 	if (!psoc_priv_obj) {
@@ -878,12 +885,12 @@ void reg_program_mas_chan_list(struct wlan_objmgr_psoc *psoc,
 		reg_channels[count].nol_chan = false;
 	}
 
-	for (pdev_cnt = 0; pdev_cnt < PSOC_MAX_PHY_REG_CAP; pdev_cnt++) {
-		qdf_mem_copy(psoc_priv_obj->mas_chan_params[pdev_cnt].
+	for (phy_cnt = 0; phy_cnt < PSOC_MAX_PHY_REG_CAP; phy_cnt++) {
+		qdf_mem_copy(psoc_priv_obj->mas_chan_params[phy_cnt].
 			     mas_chan_list, reg_channels,
 			     NUM_CHANNELS * sizeof(struct regulatory_channel));
 
-		psoc_priv_obj->mas_chan_params[pdev_cnt].dfs_region =
+		psoc_priv_obj->mas_chan_params[phy_cnt].dfs_region =
 			dfs_region;
 	}