git: 5a82e33df4ce - stable/13 - linuxkpi: Add dma_{un,}map_sgtable

From: Emmanuel Vadot <manu_at_FreeBSD.org>
Date: Wed, 07 Sep 2022 15:10:29 UTC
The branch stable/13 has been updated by manu:

URL: https://cgit.FreeBSD.org/src/commit/?id=5a82e33df4ced5152097e8de141ac167284f8d8c

commit 5a82e33df4ced5152097e8de141ac167284f8d8c
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2022-08-09 09:55:02 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2022-09-07 15:09:05 +0000

    linuxkpi: Add dma_{un,}map_sgtable
    
    Variant of dma_{un,}map_sg_attrs for struct sg_table.
    
    Reviewed by:    bz
    Obtained from:  drm-kmod
    Sponsored by:   Beckhoff Automation GmbH & Co. KG
    Differential Revision:  https://reviews.freebsd.org/D36106
    
    (cherry picked from commit 9202c95f47c2c3be8972052dc31d540924db1447)
---
 .../linuxkpi/common/include/linux/dma-mapping.h      | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/dma-mapping.h b/sys/compat/linuxkpi/common/include/linux/dma-mapping.h
index dd3bbc094dfb..94adb0c64431 100644
--- a/sys/compat/linuxkpi/common/include/linux/dma-mapping.h
+++ b/sys/compat/linuxkpi/common/include/linux/dma-mapping.h
@@ -341,4 +341,24 @@ dma_max_mapping_size(struct device *dev)
 extern int uma_align_cache;
 #define	dma_get_cache_alignment()	uma_align_cache
 
+
+static inline int
+dma_map_sgtable(struct device *dev, struct sg_table *sgt,
+    enum dma_data_direction dir,
+    unsigned long attrs)
+{
+
+	return (dma_map_sg_attrs(dev, sgt->sgl, sgt->nents, dir, attrs));
+}
+
+static inline void
+dma_unmap_sgtable(struct device *dev, struct sg_table *sgt,
+    enum dma_data_direction dir,
+    unsigned long attrs)
+{
+
+	dma_unmap_sg_attrs(dev, sgt->sgl, sgt->nents, dir, attrs);
+}
+
+
 #endif	/* _LINUXKPI_LINUX_DMA_MAPPING_H_ */