| 1 |
/* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 |
/* Copyright (C) 2013--2025 Intel Corporation */ |
| 3 |
|
| 4 |
#ifndef IPU7_DMA_H |
| 5 |
#define IPU7_DMA_H |
| 6 |
|
| 7 |
#include <linux/dma-map-ops.h> |
| 8 |
#include <linux/dma-mapping.h> |
| 9 |
#include <linux/iova.h> |
| 10 |
#include <linux/scatterlist.h> |
| 11 |
#include <linux/types.h> |
| 12 |
|
| 13 |
#include "ipu7-bus.h" |
| 14 |
|
| 15 |
#define DMA_ATTR_RESERVE_REGION BIT(31) |
| 16 |
struct ipu7_mmu_info; |
| 17 |
|
| 18 |
struct ipu7_dma_mapping { |
| 19 |
struct ipu7_mmu_info *mmu_info; |
| 20 |
struct iova_domain iovad; |
| 21 |
}; |
| 22 |
|
| 23 |
void ipu7_dma_sync_single(struct ipu7_bus_device *sys, dma_addr_t dma_handle, |
| 24 |
size_t size); |
| 25 |
void ipu7_dma_sync_sg(struct ipu7_bus_device *sys, struct scatterlist *sglist, |
| 26 |
unsigned int nents); |
| 27 |
void ipu7_dma_sync_sgtable(struct ipu7_bus_device *sys, struct sg_table *sgt); |
| 28 |
void *ipu7_dma_alloc(struct ipu7_bus_device *sys, size_t size, |
| 29 |
dma_addr_t *dma_handle, gfp_t gfp, |
| 30 |
unsigned long attrs); |
| 31 |
void ipu7_dma_free(struct ipu7_bus_device *sys, size_t size, void *vaddr, |
| 32 |
dma_addr_t dma_handle, unsigned long attrs); |
| 33 |
int ipu7_dma_mmap(struct ipu7_bus_device *sys, struct vm_area_struct *vma, |
| 34 |
void *addr, dma_addr_t iova, size_t size, |
| 35 |
unsigned long attrs); |
| 36 |
int ipu7_dma_map_sg(struct ipu7_bus_device *sys, struct scatterlist *sglist, |
| 37 |
int nents, enum dma_data_direction dir, |
| 38 |
unsigned long attrs); |
| 39 |
void ipu7_dma_unmap_sg(struct ipu7_bus_device *sys, struct scatterlist *sglist, |
| 40 |
int nents, enum dma_data_direction dir, |
| 41 |
unsigned long attrs); |
| 42 |
int ipu7_dma_map_sgtable(struct ipu7_bus_device *sys, struct sg_table *sgt, |
| 43 |
enum dma_data_direction dir, unsigned long attrs); |
| 44 |
void ipu7_dma_unmap_sgtable(struct ipu7_bus_device *sys, struct sg_table *sgt, |
| 45 |
enum dma_data_direction dir, unsigned long attrs); |
| 46 |
#endif /* IPU7_DMA_H */ |