|
@@ -280,60 +280,89 @@ QDF_STATUS ol_txrx_ipa_disable_autonomy(struct cdp_soc_t *soc_hdl,
|
|
|
return QDF_STATUS_SUCCESS;
|
|
|
}
|
|
|
|
|
|
-static QDF_STATUS __ol_txrx_ipa_tx_buf_smmu_mapping(
|
|
|
- struct ol_txrx_soc_t *soc,
|
|
|
- struct ol_txrx_pdev_t *pdev,
|
|
|
- bool create)
|
|
|
+static QDF_STATUS __ol_txrx_ipa_tx_buf_smmu_mapping(struct ol_txrx_pdev_t *pdev,
|
|
|
+ bool create)
|
|
|
{
|
|
|
uint32_t index;
|
|
|
+ uint32_t unmap_cnt = 0;
|
|
|
+ uint32_t tx_buffer_cnt;
|
|
|
QDF_STATUS ret = QDF_STATUS_SUCCESS;
|
|
|
struct htt_pdev_t *htt_pdev = pdev->htt_pdev;
|
|
|
- uint32_t tx_buffer_cnt = htt_pdev->ipa_uc_tx_rsc.alloc_tx_buf_cnt;
|
|
|
qdf_mem_info_t *mem_map_table = NULL, *mem_info = NULL;
|
|
|
|
|
|
+ if (!htt_pdev) {
|
|
|
+ ol_txrx_err("htt_pdev is NULL");
|
|
|
+ return QDF_STATUS_E_FAILURE;
|
|
|
+ }
|
|
|
+
|
|
|
if (qdf_mem_smmu_s1_enabled(htt_pdev->osdev)) {
|
|
|
- mem_map_table = qdf_mem_map_table_alloc(tx_buffer_cnt);
|
|
|
- if (!mem_map_table) {
|
|
|
- QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
|
|
|
- "Failed to allocate memory");
|
|
|
- return QDF_STATUS_E_FAILURE;
|
|
|
- }
|
|
|
- mem_info = mem_map_table;
|
|
|
+ ol_txrx_info("SMMU-S1 mapping is disabled");
|
|
|
+ return QDF_STATUS_SUCCESS;
|
|
|
+ }
|
|
|
+
|
|
|
+ tx_buffer_cnt = htt_pdev->ipa_uc_tx_rsc.alloc_tx_buf_cnt;
|
|
|
+ mem_map_table = qdf_mem_map_table_alloc(tx_buffer_cnt);
|
|
|
+ if (!mem_map_table) {
|
|
|
+ ol_txrx_err("Failed to allocate memory");
|
|
|
+ return QDF_STATUS_E_FAILURE;
|
|
|
}
|
|
|
+ mem_info = mem_map_table;
|
|
|
|
|
|
for (index = 0; index < tx_buffer_cnt; index++) {
|
|
|
- *mem_info = htt_pdev->ipa_uc_tx_rsc.tx_buf_pool_strg[
|
|
|
- index]->mem_info;
|
|
|
- if (!mem_info)
|
|
|
- continue;
|
|
|
- ret = cds_smmu_map_unmap(true, 1, mem_info);
|
|
|
- mem_info++;
|
|
|
+ if (htt_pdev->ipa_uc_tx_rsc.tx_buf_pool_strg[index]) {
|
|
|
+ *mem_info = htt_pdev->ipa_uc_tx_rsc.
|
|
|
+ tx_buf_pool_strg[index]->mem_info;
|
|
|
+ mem_info++;
|
|
|
+ unmap_cnt++;
|
|
|
+ }
|
|
|
}
|
|
|
- if (qdf_mem_smmu_s1_enabled(htt_pdev->osdev))
|
|
|
- qdf_mem_free(mem_map_table);
|
|
|
+
|
|
|
+ ret = cds_smmu_map_unmap(create, unmap_cnt, mem_map_table);
|
|
|
+ qdf_assert_always(!ret);
|
|
|
+ qdf_mem_free(mem_map_table);
|
|
|
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
-QDF_STATUS ol_txrx_ipa_tx_buf_smmu_mapping(
|
|
|
- struct cdp_soc_t *soc_hdl, uint8_t pdev_id)
|
|
|
+QDF_STATUS ol_txrx_ipa_tx_buf_smmu_mapping(struct cdp_soc_t *soc_hdl,
|
|
|
+ uint8_t pdev_id)
|
|
|
{
|
|
|
QDF_STATUS ret;
|
|
|
struct ol_txrx_soc_t *soc = cdp_soc_t_to_ol_txrx_soc_t(soc_hdl);
|
|
|
ol_txrx_pdev_handle pdev = ol_txrx_get_pdev_from_pdev_id(soc, pdev_id);
|
|
|
|
|
|
if (!pdev) {
|
|
|
- QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
|
|
|
- "invalid instance");
|
|
|
+ ol_txrx_err("invalid instance");
|
|
|
return QDF_STATUS_E_FAILURE;
|
|
|
}
|
|
|
|
|
|
if (!qdf_mem_smmu_s1_enabled(pdev->htt_pdev->osdev)) {
|
|
|
- QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_DEBUG,
|
|
|
- "SMMU S1 disabled");
|
|
|
+ ol_txrx_err("SMMU S1 disabled");
|
|
|
return QDF_STATUS_SUCCESS;
|
|
|
}
|
|
|
- ret = __ol_txrx_ipa_tx_buf_smmu_mapping(soc, pdev, true);
|
|
|
+ ret = __ol_txrx_ipa_tx_buf_smmu_mapping(pdev, true);
|
|
|
+
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+
|
|
|
+QDF_STATUS ol_txrx_ipa_tx_buf_smmu_unmapping(struct cdp_soc_t *soc_hdl,
|
|
|
+ uint8_t pdev_id)
|
|
|
+{
|
|
|
+ QDF_STATUS ret;
|
|
|
+ struct ol_txrx_soc_t *soc = cdp_soc_t_to_ol_txrx_soc_t(soc_hdl);
|
|
|
+ ol_txrx_pdev_handle pdev = ol_txrx_get_pdev_from_pdev_id(soc, pdev_id);
|
|
|
+
|
|
|
+ if (!pdev) {
|
|
|
+ ol_txrx_err("invalid instance");
|
|
|
+ return QDF_STATUS_E_FAILURE;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!qdf_mem_smmu_s1_enabled(pdev->htt_pdev->osdev)) {
|
|
|
+ ol_txrx_err("SMMU S1 disabled");
|
|
|
+ return QDF_STATUS_SUCCESS;
|
|
|
+ }
|
|
|
+ ret = __ol_txrx_ipa_tx_buf_smmu_mapping(pdev, false);
|
|
|
+
|
|
|
return ret;
|
|
|
}
|
|
|
|