diff options
Diffstat (limited to 'arch/ia64/include')
-rw-r--r-- | arch/ia64/include/asm/cacheflush.h | 2 | ||||
-rw-r--r-- | arch/ia64/include/asm/device.h | 3 | ||||
-rw-r--r-- | arch/ia64/include/asm/dma-mapping.h | 50 | ||||
-rw-r--r-- | arch/ia64/include/asm/iommu.h | 16 | ||||
-rw-r--r-- | arch/ia64/include/asm/machvec.h | 2 | ||||
-rw-r--r-- | arch/ia64/include/asm/machvec_dig_vtd.h | 38 | ||||
-rw-r--r-- | arch/ia64/include/asm/machvec_init.h | 1 | ||||
-rw-r--r-- | arch/ia64/include/asm/pci.h | 3 | ||||
-rw-r--r-- | arch/ia64/include/asm/swiotlb.h | 56 |
9 files changed, 171 insertions, 0 deletions
diff --git a/arch/ia64/include/asm/cacheflush.h b/arch/ia64/include/asm/cacheflush.h index afcfbda76e20..c8ce2719fee8 100644 --- a/arch/ia64/include/asm/cacheflush.h +++ b/arch/ia64/include/asm/cacheflush.h | |||
@@ -34,6 +34,8 @@ do { \ | |||
34 | #define flush_dcache_mmap_unlock(mapping) do { } while (0) | 34 | #define flush_dcache_mmap_unlock(mapping) do { } while (0) |
35 | 35 | ||
36 | extern void flush_icache_range (unsigned long start, unsigned long end); | 36 | extern void flush_icache_range (unsigned long start, unsigned long end); |
37 | extern void clflush_cache_range(void *addr, int size); | ||
38 | |||
37 | 39 | ||
38 | #define flush_icache_user_range(vma, page, user_addr, len) \ | 40 | #define flush_icache_user_range(vma, page, user_addr, len) \ |
39 | do { \ | 41 | do { \ |
diff --git a/arch/ia64/include/asm/device.h b/arch/ia64/include/asm/device.h index 3db6daf7f251..41ab85d66f33 100644 --- a/arch/ia64/include/asm/device.h +++ b/arch/ia64/include/asm/device.h | |||
@@ -10,6 +10,9 @@ struct dev_archdata { | |||
10 | #ifdef CONFIG_ACPI | 10 | #ifdef CONFIG_ACPI |
11 | void *acpi_handle; | 11 | void *acpi_handle; |
12 | #endif | 12 | #endif |
13 | #ifdef CONFIG_DMAR | ||
14 | void *iommu; /* hook for IOMMU specific extension */ | ||
15 | #endif | ||
13 | }; | 16 | }; |
14 | 17 | ||
15 | #endif /* _ASM_IA64_DEVICE_H */ | 18 | #endif /* _ASM_IA64_DEVICE_H */ |
diff --git a/arch/ia64/include/asm/dma-mapping.h b/arch/ia64/include/asm/dma-mapping.h index 06ff1ba21465..bbab7e2b0fc9 100644 --- a/arch/ia64/include/asm/dma-mapping.h +++ b/arch/ia64/include/asm/dma-mapping.h | |||
@@ -7,6 +7,49 @@ | |||
7 | */ | 7 | */ |
8 | #include <asm/machvec.h> | 8 | #include <asm/machvec.h> |
9 | #include <linux/scatterlist.h> | 9 | #include <linux/scatterlist.h> |
10 | #include <asm/swiotlb.h> | ||
11 | |||
12 | struct dma_mapping_ops { | ||
13 | int (*mapping_error)(struct device *dev, | ||
14 | dma_addr_t dma_addr); | ||
15 | void* (*alloc_coherent)(struct device *dev, size_t size, | ||
16 | dma_addr_t *dma_handle, gfp_t gfp); | ||
17 | void (*free_coherent)(struct device *dev, size_t size, | ||
18 | void *vaddr, dma_addr_t dma_handle); | ||
19 | dma_addr_t (*map_single)(struct device *hwdev, unsigned long ptr, | ||
20 | size_t size, int direction); | ||
21 | void (*unmap_single)(struct device *dev, dma_addr_t addr, | ||
22 | size_t size, int direction); | ||
23 | void (*sync_single_for_cpu)(struct device *hwdev, | ||
24 | dma_addr_t dma_handle, size_t size, | ||
25 | int direction); | ||
26 | void (*sync_single_for_device)(struct device *hwdev, | ||
27 | dma_addr_t dma_handle, size_t size, | ||
28 | int direction); | ||
29 | void (*sync_single_range_for_cpu)(struct device *hwdev, | ||
30 | dma_addr_t dma_handle, unsigned long offset, | ||
31 | size_t size, int direction); | ||
32 | void (*sync_single_range_for_device)(struct device *hwdev, | ||
33 | dma_addr_t dma_handle, unsigned long offset, | ||
34 | size_t size, int direction); | ||
35 | void (*sync_sg_for_cpu)(struct device *hwdev, | ||
36 | struct scatterlist *sg, int nelems, | ||
37 | int direction); | ||
38 | void (*sync_sg_for_device)(struct device *hwdev, | ||
39 | struct scatterlist *sg, int nelems, | ||
40 | int direction); | ||
41 | int (*map_sg)(struct device *hwdev, struct scatterlist *sg, | ||
42 | int nents, int direction); | ||
43 | void (*unmap_sg)(struct device *hwdev, | ||
44 | struct scatterlist *sg, int nents, | ||
45 | int direction); | ||
46 | int (*dma_supported_op)(struct device *hwdev, u64 mask); | ||
47 | int is_phys; | ||
48 | }; | ||
49 | |||
50 | extern struct dma_mapping_ops *dma_ops; | ||
51 | extern struct ia64_machine_vector ia64_mv; | ||
52 | extern void set_iommu_machvec(void); | ||
10 | 53 | ||
11 | #define dma_alloc_coherent(dev, size, handle, gfp) \ | 54 | #define dma_alloc_coherent(dev, size, handle, gfp) \ |
12 | platform_dma_alloc_coherent(dev, size, handle, (gfp) | GFP_DMA) | 55 | platform_dma_alloc_coherent(dev, size, handle, (gfp) | GFP_DMA) |
@@ -96,4 +139,11 @@ dma_cache_sync (struct device *dev, void *vaddr, size_t size, | |||
96 | 139 | ||
97 | #define dma_is_consistent(d, h) (1) /* all we do is coherent memory... */ | 140 | #define dma_is_consistent(d, h) (1) /* all we do is coherent memory... */ |
98 | 141 | ||
142 | static inline struct dma_mapping_ops *get_dma_ops(struct device *dev) | ||
143 | { | ||
144 | return dma_ops; | ||
145 | } | ||
146 | |||
147 | |||
148 | |||
99 | #endif /* _ASM_IA64_DMA_MAPPING_H */ | 149 | #endif /* _ASM_IA64_DMA_MAPPING_H */ |
diff --git a/arch/ia64/include/asm/iommu.h b/arch/ia64/include/asm/iommu.h new file mode 100644 index 000000000000..5fb2bb93de3b --- /dev/null +++ b/arch/ia64/include/asm/iommu.h | |||
@@ -0,0 +1,16 @@ | |||
1 | #ifndef _ASM_IA64_IOMMU_H | ||
2 | #define _ASM_IA64_IOMMU_H 1 | ||
3 | |||
4 | #define cpu_has_x2apic 0 | ||
5 | /* 10 seconds */ | ||
6 | #define DMAR_OPERATION_TIMEOUT (((cycles_t) local_cpu_data->itc_freq)*10) | ||
7 | |||
8 | extern void pci_iommu_shutdown(void); | ||
9 | extern void no_iommu_init(void); | ||
10 | extern int force_iommu, no_iommu; | ||
11 | extern int iommu_detected; | ||
12 | extern void iommu_dma_init(void); | ||
13 | extern void machvec_init(const char *name); | ||
14 | extern int forbid_dac; | ||
15 | |||
16 | #endif | ||
diff --git a/arch/ia64/include/asm/machvec.h b/arch/ia64/include/asm/machvec.h index de99cb2799cf..1ea28bcee33b 100644 --- a/arch/ia64/include/asm/machvec.h +++ b/arch/ia64/include/asm/machvec.h | |||
@@ -120,6 +120,8 @@ extern void machvec_tlb_migrate_finish (struct mm_struct *); | |||
120 | # include <asm/machvec_hpsim.h> | 120 | # include <asm/machvec_hpsim.h> |
121 | # elif defined (CONFIG_IA64_DIG) | 121 | # elif defined (CONFIG_IA64_DIG) |
122 | # include <asm/machvec_dig.h> | 122 | # include <asm/machvec_dig.h> |
123 | # elif defined(CONFIG_IA64_DIG_VTD) | ||
124 | # include <asm/machvec_dig_vtd.h> | ||
123 | # elif defined (CONFIG_IA64_HP_ZX1) | 125 | # elif defined (CONFIG_IA64_HP_ZX1) |
124 | # include <asm/machvec_hpzx1.h> | 126 | # include <asm/machvec_hpzx1.h> |
125 | # elif defined (CONFIG_IA64_HP_ZX1_SWIOTLB) | 127 | # elif defined (CONFIG_IA64_HP_ZX1_SWIOTLB) |
diff --git a/arch/ia64/include/asm/machvec_dig_vtd.h b/arch/ia64/include/asm/machvec_dig_vtd.h new file mode 100644 index 000000000000..3400b561e711 --- /dev/null +++ b/arch/ia64/include/asm/machvec_dig_vtd.h | |||
@@ -0,0 +1,38 @@ | |||
1 | #ifndef _ASM_IA64_MACHVEC_DIG_VTD_h | ||
2 | #define _ASM_IA64_MACHVEC_DIG_VTD_h | ||
3 | |||
4 | extern ia64_mv_setup_t dig_setup; | ||
5 | extern ia64_mv_dma_alloc_coherent vtd_alloc_coherent; | ||
6 | extern ia64_mv_dma_free_coherent vtd_free_coherent; | ||
7 | extern ia64_mv_dma_map_single_attrs vtd_map_single_attrs; | ||
8 | extern ia64_mv_dma_unmap_single_attrs vtd_unmap_single_attrs; | ||
9 | extern ia64_mv_dma_map_sg_attrs vtd_map_sg_attrs; | ||
10 | extern ia64_mv_dma_unmap_sg_attrs vtd_unmap_sg_attrs; | ||
11 | extern ia64_mv_dma_supported iommu_dma_supported; | ||
12 | extern ia64_mv_dma_mapping_error vtd_dma_mapping_error; | ||
13 | extern ia64_mv_dma_init pci_iommu_alloc; | ||
14 | |||
15 | /* | ||
16 | * This stuff has dual use! | ||
17 | * | ||
18 | * For a generic kernel, the macros are used to initialize the | ||
19 | * platform's machvec structure. When compiling a non-generic kernel, | ||
20 | * the macros are used directly. | ||
21 | */ | ||
22 | #define platform_name "dig_vtd" | ||
23 | #define platform_setup dig_setup | ||
24 | #define platform_dma_init pci_iommu_alloc | ||
25 | #define platform_dma_alloc_coherent vtd_alloc_coherent | ||
26 | #define platform_dma_free_coherent vtd_free_coherent | ||
27 | #define platform_dma_map_single_attrs vtd_map_single_attrs | ||
28 | #define platform_dma_unmap_single_attrs vtd_unmap_single_attrs | ||
29 | #define platform_dma_map_sg_attrs vtd_map_sg_attrs | ||
30 | #define platform_dma_unmap_sg_attrs vtd_unmap_sg_attrs | ||
31 | #define platform_dma_sync_single_for_cpu machvec_dma_sync_single | ||
32 | #define platform_dma_sync_sg_for_cpu machvec_dma_sync_sg | ||
33 | #define platform_dma_sync_single_for_device machvec_dma_sync_single | ||
34 | #define platform_dma_sync_sg_for_device machvec_dma_sync_sg | ||
35 | #define platform_dma_supported iommu_dma_supported | ||
36 | #define platform_dma_mapping_error vtd_dma_mapping_error | ||
37 | |||
38 | #endif /* _ASM_IA64_MACHVEC_DIG_VTD_h */ | ||
diff --git a/arch/ia64/include/asm/machvec_init.h b/arch/ia64/include/asm/machvec_init.h index 7f21249fba3f..ef964b286842 100644 --- a/arch/ia64/include/asm/machvec_init.h +++ b/arch/ia64/include/asm/machvec_init.h | |||
@@ -1,3 +1,4 @@ | |||
1 | #include <asm/iommu.h> | ||
1 | #include <asm/machvec.h> | 2 | #include <asm/machvec.h> |
2 | 3 | ||
3 | extern ia64_mv_send_ipi_t ia64_send_ipi; | 4 | extern ia64_mv_send_ipi_t ia64_send_ipi; |
diff --git a/arch/ia64/include/asm/pci.h b/arch/ia64/include/asm/pci.h index 0149097b736d..645ef06ddaa4 100644 --- a/arch/ia64/include/asm/pci.h +++ b/arch/ia64/include/asm/pci.h | |||
@@ -164,4 +164,7 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) | |||
164 | return channel ? isa_irq_to_vector(15) : isa_irq_to_vector(14); | 164 | return channel ? isa_irq_to_vector(15) : isa_irq_to_vector(14); |
165 | } | 165 | } |
166 | 166 | ||
167 | #ifdef CONFIG_DMAR | ||
168 | extern void pci_iommu_alloc(void); | ||
169 | #endif | ||
167 | #endif /* _ASM_IA64_PCI_H */ | 170 | #endif /* _ASM_IA64_PCI_H */ |
diff --git a/arch/ia64/include/asm/swiotlb.h b/arch/ia64/include/asm/swiotlb.h new file mode 100644 index 000000000000..fb79423834d0 --- /dev/null +++ b/arch/ia64/include/asm/swiotlb.h | |||
@@ -0,0 +1,56 @@ | |||
1 | #ifndef ASM_IA64__SWIOTLB_H | ||
2 | #define ASM_IA64__SWIOTLB_H | ||
3 | |||
4 | #include <linux/dma-mapping.h> | ||
5 | |||
6 | /* SWIOTLB interface */ | ||
7 | |||
8 | extern dma_addr_t swiotlb_map_single(struct device *hwdev, void *ptr, | ||
9 | size_t size, int dir); | ||
10 | extern void *swiotlb_alloc_coherent(struct device *hwdev, size_t size, | ||
11 | dma_addr_t *dma_handle, gfp_t flags); | ||
12 | extern void swiotlb_unmap_single(struct device *hwdev, dma_addr_t dev_addr, | ||
13 | size_t size, int dir); | ||
14 | extern void swiotlb_sync_single_for_cpu(struct device *hwdev, | ||
15 | dma_addr_t dev_addr, | ||
16 | size_t size, int dir); | ||
17 | extern void swiotlb_sync_single_for_device(struct device *hwdev, | ||
18 | dma_addr_t dev_addr, | ||
19 | size_t size, int dir); | ||
20 | extern void swiotlb_sync_single_range_for_cpu(struct device *hwdev, | ||
21 | dma_addr_t dev_addr, | ||
22 | unsigned long offset, | ||
23 | size_t size, int dir); | ||
24 | extern void swiotlb_sync_single_range_for_device(struct device *hwdev, | ||
25 | dma_addr_t dev_addr, | ||
26 | unsigned long offset, | ||
27 | size_t size, int dir); | ||
28 | extern void swiotlb_sync_sg_for_cpu(struct device *hwdev, | ||
29 | struct scatterlist *sg, int nelems, | ||
30 | int dir); | ||
31 | extern void swiotlb_sync_sg_for_device(struct device *hwdev, | ||
32 | struct scatterlist *sg, int nelems, | ||
33 | int dir); | ||
34 | extern int swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg, | ||
35 | int nents, int direction); | ||
36 | extern void swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg, | ||
37 | int nents, int direction); | ||
38 | extern int swiotlb_dma_mapping_error(struct device *hwdev, dma_addr_t dma_addr); | ||
39 | extern void swiotlb_free_coherent(struct device *hwdev, size_t size, | ||
40 | void *vaddr, dma_addr_t dma_handle); | ||
41 | extern int swiotlb_dma_supported(struct device *hwdev, u64 mask); | ||
42 | extern void swiotlb_init(void); | ||
43 | |||
44 | extern int swiotlb_force; | ||
45 | |||
46 | #ifdef CONFIG_SWIOTLB | ||
47 | extern int swiotlb; | ||
48 | extern void pci_swiotlb_init(void); | ||
49 | #else | ||
50 | #define swiotlb 0 | ||
51 | static inline void pci_swiotlb_init(void) | ||
52 | { | ||
53 | } | ||
54 | #endif | ||
55 | |||
56 | #endif /* ASM_IA64__SWIOTLB_H */ | ||