1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* Copyright (C) 2013--2024 Intel Corporation */
7 #include <linux/dma-map-ops.h>
8 #include <linux/dma-mapping.h>
9 #include <linux/iova.h>
10 #include <linux/iova.h>
11 #include <linux/scatterlist.h>
12 #include <linux/types.h>
18 struct ipu6_dma_mapping
{
19 struct ipu6_mmu_info
*mmu_info
;
20 struct iova_domain iovad
;
23 void ipu6_dma_sync_single(struct ipu6_bus_device
*sys
, dma_addr_t dma_handle
,
25 void ipu6_dma_sync_sg(struct ipu6_bus_device
*sys
, struct scatterlist
*sglist
,
27 void ipu6_dma_sync_sgtable(struct ipu6_bus_device
*sys
, struct sg_table
*sgt
);
28 void *ipu6_dma_alloc(struct ipu6_bus_device
*sys
, size_t size
,
29 dma_addr_t
*dma_handle
, gfp_t gfp
,
31 void ipu6_dma_free(struct ipu6_bus_device
*sys
, size_t size
, void *vaddr
,
32 dma_addr_t dma_handle
, unsigned long attrs
);
33 int ipu6_dma_mmap(struct ipu6_bus_device
*sys
, struct vm_area_struct
*vma
,
34 void *addr
, dma_addr_t iova
, size_t size
,
36 int ipu6_dma_map_sg(struct ipu6_bus_device
*sys
, struct scatterlist
*sglist
,
37 int nents
, enum dma_data_direction dir
,
39 void ipu6_dma_unmap_sg(struct ipu6_bus_device
*sys
, struct scatterlist
*sglist
,
40 int nents
, enum dma_data_direction dir
,
42 int ipu6_dma_map_sgtable(struct ipu6_bus_device
*sys
, struct sg_table
*sgt
,
43 enum dma_data_direction dir
, unsigned long attrs
);
44 void ipu6_dma_unmap_sgtable(struct ipu6_bus_device
*sys
, struct sg_table
*sgt
,
45 enum dma_data_direction dir
, unsigned long attrs
);
46 int ipu6_dma_get_sgtable(struct ipu6_bus_device
*sys
, struct sg_table
*sgt
,
47 void *cpu_addr
, dma_addr_t handle
, size_t size
,
49 #endif /* IPU6_DMA_H */