Thomas Gleixner | 55716d2 | 2019-06-01 10:08:42 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Benjamin Herrenschmidt | c6dbaef | 2006-11-11 17:18:39 +1100 | [diff] [blame] | 2 | /* |
| 3 | * Arch specific extensions to struct device |
Benjamin Herrenschmidt | c6dbaef | 2006-11-11 17:18:39 +1100 | [diff] [blame] | 4 | */ |
Benjamin Herrenschmidt | 12d04ee | 2006-11-11 17:25:02 +1100 | [diff] [blame] | 5 | #ifndef _ASM_POWERPC_DEVICE_H |
| 6 | #define _ASM_POWERPC_DEVICE_H |
Benjamin Herrenschmidt | c6dbaef | 2006-11-11 17:18:39 +1100 | [diff] [blame] | 7 | |
Benjamin Herrenschmidt | 12d04ee | 2006-11-11 17:25:02 +1100 | [diff] [blame] | 8 | struct device_node; |
Gavin Shan | cca87d3 | 2015-03-17 16:15:02 +1100 | [diff] [blame] | 9 | #ifdef CONFIG_PPC64 |
| 10 | struct pci_dn; |
Benjamin Herrenschmidt | 2db4928 | 2015-06-24 15:25:22 +1000 | [diff] [blame] | 11 | struct iommu_table; |
Gavin Shan | cca87d3 | 2015-03-17 16:15:02 +1100 | [diff] [blame] | 12 | #endif |
Benjamin Herrenschmidt | 12d04ee | 2006-11-11 17:25:02 +1100 | [diff] [blame] | 13 | |
Nishanth Aravamudan | f6aedd8 | 2010-10-26 17:35:11 +0000 | [diff] [blame] | 14 | /* |
| 15 | * Arch extensions to struct device. |
| 16 | * |
| 17 | * When adding fields, consider macio_add_one_device in |
| 18 | * drivers/macintosh/macio_asic.c |
| 19 | */ |
Benjamin Herrenschmidt | 12d04ee | 2006-11-11 17:25:02 +1100 | [diff] [blame] | 20 | struct dev_archdata { |
Becky Bruce | 738ef42 | 2009-09-21 08:26:35 +0000 | [diff] [blame] | 21 | /* |
Christoph Hellwig | 8617a5c | 2019-02-13 08:01:05 +0100 | [diff] [blame] | 22 | * Set to %true if the dma_iommu_ops are requested to use a direct |
| 23 | * window instead of dynamically mapping memory. |
| 24 | */ |
| 25 | bool iommu_bypass : 1; |
| 26 | /* |
Benjamin Herrenschmidt | 2db4928 | 2015-06-24 15:25:22 +1000 | [diff] [blame] | 27 | * These two used to be a union. However, with the hybrid ops we need |
| 28 | * both so here we store both a DMA offset for direct mappings and |
| 29 | * an iommu_table for remapped DMA. |
Becky Bruce | 738ef42 | 2009-09-21 08:26:35 +0000 | [diff] [blame] | 30 | */ |
Benjamin Herrenschmidt | 2db4928 | 2015-06-24 15:25:22 +1000 | [diff] [blame] | 31 | dma_addr_t dma_offset; |
| 32 | |
| 33 | #ifdef CONFIG_PPC64 |
| 34 | struct iommu_table *iommu_table_base; |
| 35 | #endif |
Becky Bruce | 738ef42 | 2009-09-21 08:26:35 +0000 | [diff] [blame] | 36 | |
Varun Sethi | bb91750 | 2013-07-15 10:20:55 +0530 | [diff] [blame] | 37 | #ifdef CONFIG_IOMMU_API |
| 38 | void *iommu_domain; |
| 39 | #endif |
Gavin Shan | cca87d3 | 2015-03-17 16:15:02 +1100 | [diff] [blame] | 40 | #ifdef CONFIG_PPC64 |
| 41 | struct pci_dn *pci_data; |
| 42 | #endif |
Gavin Shan | eb740b5 | 2012-02-27 20:04:04 +0000 | [diff] [blame] | 43 | #ifdef CONFIG_EEH |
| 44 | struct eeh_dev *edev; |
| 45 | #endif |
Anton Blanchard | d6b9a81 | 2012-06-24 18:26:17 +0000 | [diff] [blame] | 46 | #ifdef CONFIG_FAIL_IOMMU |
| 47 | int fail_iommu; |
| 48 | #endif |
Michael Neuling | f46580a | 2015-05-27 16:06:58 +1000 | [diff] [blame] | 49 | #ifdef CONFIG_CXL_BASE |
| 50 | struct cxl_context *cxl_ctx; |
| 51 | #endif |
Benjamin Herrenschmidt | 12d04ee | 2006-11-11 17:25:02 +1100 | [diff] [blame] | 52 | }; |
| 53 | |
Magnus Damm | d7aacad | 2009-07-08 13:21:31 +0200 | [diff] [blame] | 54 | struct pdev_archdata { |
Grant Likely | cb6dc51 | 2010-04-13 16:12:59 -0700 | [diff] [blame] | 55 | u64 dma_mask; |
Magnus Damm | d7aacad | 2009-07-08 13:21:31 +0200 | [diff] [blame] | 56 | }; |
| 57 | |
Benjamin Herrenschmidt | 12d04ee | 2006-11-11 17:25:02 +1100 | [diff] [blame] | 58 | #endif /* _ASM_POWERPC_DEVICE_H */ |