]> git.ipfire.org Git - thirdparty/u-boot.git/blame - include/iommu.h
phycore_imx8mp: Move environment from include/config to board
[thirdparty/u-boot.git] / include / iommu.h
CommitLineData
40dbf03d
MK
1#ifndef _IOMMU_H
2#define _IOMMU_H
3
4struct udevice;
5
dd6b68ed 6struct iommu_ops {
76c53dad
CC
7 /**
8 * init() - Connect a device to it's IOMMU, called before probe()
9 * The iommu device can be fetched through dev->iommu
10 *
11 * @iommu_dev: IOMMU device
12 * @dev: Device to connect
13 * @return 0 if OK, -errno on error
14 */
15 int (*connect)(struct udevice *dev);
dd6b68ed
MK
16 /**
17 * map() - map DMA memory
18 *
19 * @dev: device for which to map DMA memory
20 * @addr: CPU address of the memory
21 * @size: size of the memory
22 * @return DMA address for the device
23 */
24 dma_addr_t (*map)(struct udevice *dev, void *addr, size_t size);
25
26 /**
27 * unmap() - unmap DMA memory
28 *
29 * @dev: device for which to unmap DMA memory
30 * @addr: DMA address of the memory
31 * @size: size of the memory
32 */
33 void (*unmap)(struct udevice *dev, dma_addr_t addr, size_t size);
34};
35
40dbf03d
MK
36#if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) && \
37 CONFIG_IS_ENABLED(IOMMU)
38int dev_iommu_enable(struct udevice *dev);
39#else
40static inline int dev_iommu_enable(struct udevice *dev)
41{
42 return 0;
43}
44#endif
45
dd6b68ed
MK
46dma_addr_t dev_iommu_dma_map(struct udevice *dev, void *addr, size_t size);
47void dev_iommu_dma_unmap(struct udevice *dev, dma_addr_t addr, size_t size);
48
40dbf03d 49#endif