qcacmn: Assign DMA address correctly to all scatterlist elements
Assign DMA address correctly to all scatterlist elements of scatter
gather table in qdf_mem_shared_mem_alloc() func.
Change-Id: I07988d0bc35e3e0fcf7b9f6df02a9e56a0e8b083
CRS-Fixed: 2110715
diff --git a/qdf/inc/qdf_mem.h b/qdf/inc/qdf_mem.h
index 7273f01..2653491 100644
--- a/qdf/inc/qdf_mem.h
+++ b/qdf/inc/qdf_mem.h
@@ -458,7 +458,7 @@
}
/**
- * qdf_os_mem_dma_get_sgtable() - Returns DMA memory scatter gather table
+ * qdf_mem_dma_get_sgtable() - Returns DMA memory scatter gather table
* @dev: device instace
* @sgt: scatter gather table pointer
* @cpu_addr: HLOS virtual address
@@ -475,6 +475,18 @@
}
/**
+ * qdf_dma_get_sgtable_dma_addr() - Assigns DMA address to scatterlist elements
+ * @sgt: scatter gather table pointer
+ *
+ * @Return: None
+ */
+static inline void
+qdf_dma_get_sgtable_dma_addr(struct sg_table *sgt)
+{
+ __qdf_dma_get_sgtable_dma_addr(sgt);
+}
+
+/**
* qdf_mem_get_dma_addr() - Return dma address based on SMMU translation status.
* @osdev: Parent device instance
* @mem_info: Pointer to allocated memory information
@@ -616,8 +628,7 @@
qdf_mem_get_dma_size(osdev,
&shared_mem->mem_info));
- shared_mem->sgtable.sgl->dma_address =
- qdf_mem_get_dma_pa(osdev, &shared_mem->mem_info);
+ qdf_dma_get_sgtable_dma_addr(&shared_mem->sgtable);
return shared_mem;
}
diff --git a/qdf/linux/src/i_qdf_mem.h b/qdf/linux/src/i_qdf_mem.h
index c922fc6..9c4772c 100644
--- a/qdf/linux/src/i_qdf_mem.h
+++ b/qdf/linux/src/i_qdf_mem.h
@@ -267,6 +267,22 @@
}
/**
+ * __qdf_dma_get_sgtable_dma_addr()-Assigns DMA address to scatterlist elements
+ * @sgt: scatter gather table pointer
+ *
+ * @Return: None
+ */
+static inline void
+__qdf_dma_get_sgtable_dma_addr(struct sg_table *sgt)
+{
+ struct scatterlist *sg;
+ int i;
+
+ for_each_sg(sgt->sgl, sg, sgt->nents, i)
+ sg->dma_address = sg_phys(sg);
+}
+
+/**
* __qdf_mem_get_dma_addr() - Return dma addr based on SMMU translation status
* @osdev: parent device instance
* @mem_info: Pointer to allocated memory information