1 /* SPDX-License-Identifier: GPL-2.0-only OR MIT */
3 * Apple SART device driver
4 * Copyright (C) The Asahi Linux Contributors
6 * Apple SART is a simple address filter for DMA transactions.
7 * Regions of physical memory must be added to the SART's allow
8 * list before any DMA can target these. Unlike a proper
9 * IOMMU no remapping can be done.
12 #ifndef _LINUX_SOC_APPLE_SART_H_
13 #define _LINUX_SOC_APPLE_SART_H_
15 #include <linux/device.h>
16 #include <linux/err.h>
17 #include <linux/types.h>
22 * Get a reference to the SART attached to dev.
24 * Looks for the phandle reference in apple,sart and returns a pointer
25 * to the corresponding apple_sart struct to be used with
26 * apple_sart_add_allowed_region and apple_sart_remove_allowed_region.
28 struct apple_sart *devm_apple_sart_get(struct device *dev);
31 * Adds the region [paddr, paddr+size] to the DMA allow list.
33 * @sart: SART reference
34 * @paddr: Start address of the region to be used for DMA
35 * @size: Size of the region to be used for DMA.
37 int apple_sart_add_allowed_region(struct apple_sart *sart, phys_addr_t paddr,
41 * Removes the region [paddr, paddr+size] from the DMA allow list.
43 * Note that exact same paddr and size used for apple_sart_add_allowed_region
46 * @sart: SART reference
47 * @paddr: Start address of the region no longer used for DMA
48 * @size: Size of the region no longer used for DMA.
50 int apple_sart_remove_allowed_region(struct apple_sart *sart, phys_addr_t paddr,
53 #endif /* _LINUX_SOC_APPLE_SART_H_ */