diff options
author | Tom Rini <trini@konsulko.com> | 2023-01-27 14:48:22 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-01-27 14:48:22 -0500 |
commit | f147aa80f52989c7455022ca1ab959e8545feccc (patch) | |
tree | 5e513d166bf3859bf649601099110312406c4c34 /include/iommu.h | |
parent | aa7c61f62923a1c9e9ec7f588ad37016d8c7323c (diff) | |
parent | e330c8b83e8784d23614f80ca3f12b11ceb515d8 (diff) |
Merge branch '2023-01-27-apple-soc-updates'
First, to quote the author:
This series adds support for the PCIe controller found on Apple M1 and
M2 machines and enables support for PCIe XHCI controllers. This makes
the type-A USB ports on the M1 Mac mini work. Since the use of Apples
DART IOMMU is mandatory (these PCIe DARTs don't support bypass mode),
this adds DMA mapping operations to the IOMMU uclass and implements
them for the Apple DART. It modifies the XHCI driver code to go map
DMA buffers through the IOMMU if there is one. Since the M1 Mac mini
now has two types of XHCI controllers with different number of ports
(2 for the DWC3 controllers, 8 for the Fresco Logic PCIe controller)
this uncovered an issue in with the way the hub descriptor is
implemented in the XHCI driver.
Second, Mark also fixes some Apple-specific instances of
CONFIG_IS_ENABLED that should be IS_ENABLED.
Diffstat (limited to 'include/iommu.h')
-rw-r--r-- | include/iommu.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/iommu.h b/include/iommu.h index 6c46adf449e..cf9719c5e91 100644 --- a/include/iommu.h +++ b/include/iommu.h @@ -3,6 +3,27 @@ struct udevice; +struct iommu_ops { + /** + * map() - map DMA memory + * + * @dev: device for which to map DMA memory + * @addr: CPU address of the memory + * @size: size of the memory + * @return DMA address for the device + */ + dma_addr_t (*map)(struct udevice *dev, void *addr, size_t size); + + /** + * unmap() - unmap DMA memory + * + * @dev: device for which to unmap DMA memory + * @addr: DMA address of the memory + * @size: size of the memory + */ + void (*unmap)(struct udevice *dev, dma_addr_t addr, size_t size); +}; + #if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) && \ CONFIG_IS_ENABLED(IOMMU) int dev_iommu_enable(struct udevice *dev); @@ -13,4 +34,7 @@ static inline int dev_iommu_enable(struct udevice *dev) } #endif +dma_addr_t dev_iommu_dma_map(struct udevice *dev, void *addr, size_t size); +void dev_iommu_dma_unmap(struct udevice *dev, dma_addr_t addr, size_t size); + #endif |