diff options
Diffstat (limited to 'arch/ia64/hp')
-rw-r--r-- | arch/ia64/hp/common/hwsw_iommu.c | 165 | ||||
-rw-r--r-- | arch/ia64/hp/common/sba_iommu.c | 79 | ||||
-rw-r--r-- | arch/ia64/hp/sim/simserial.c | 49 |
3 files changed, 94 insertions, 199 deletions
diff --git a/arch/ia64/hp/common/hwsw_iommu.c b/arch/ia64/hp/common/hwsw_iommu.c index 2769dbfd03bf..e4a80d82e3d8 100644 --- a/arch/ia64/hp/common/hwsw_iommu.c +++ b/arch/ia64/hp/common/hwsw_iommu.c | |||
@@ -13,49 +13,34 @@ | |||
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/device.h> | 15 | #include <linux/device.h> |
16 | #include <linux/dma-mapping.h> | ||
16 | #include <linux/swiotlb.h> | 17 | #include <linux/swiotlb.h> |
17 | |||
18 | #include <asm/machvec.h> | 18 | #include <asm/machvec.h> |
19 | 19 | ||
20 | extern struct dma_map_ops sba_dma_ops, swiotlb_dma_ops; | ||
21 | |||
20 | /* swiotlb declarations & definitions: */ | 22 | /* swiotlb declarations & definitions: */ |
21 | extern int swiotlb_late_init_with_default_size (size_t size); | 23 | extern int swiotlb_late_init_with_default_size (size_t size); |
22 | 24 | ||
23 | /* hwiommu declarations & definitions: */ | ||
24 | |||
25 | extern ia64_mv_dma_alloc_coherent sba_alloc_coherent; | ||
26 | extern ia64_mv_dma_free_coherent sba_free_coherent; | ||
27 | extern ia64_mv_dma_map_single_attrs sba_map_single_attrs; | ||
28 | extern ia64_mv_dma_unmap_single_attrs sba_unmap_single_attrs; | ||
29 | extern ia64_mv_dma_map_sg_attrs sba_map_sg_attrs; | ||
30 | extern ia64_mv_dma_unmap_sg_attrs sba_unmap_sg_attrs; | ||
31 | extern ia64_mv_dma_supported sba_dma_supported; | ||
32 | extern ia64_mv_dma_mapping_error sba_dma_mapping_error; | ||
33 | |||
34 | #define hwiommu_alloc_coherent sba_alloc_coherent | ||
35 | #define hwiommu_free_coherent sba_free_coherent | ||
36 | #define hwiommu_map_single_attrs sba_map_single_attrs | ||
37 | #define hwiommu_unmap_single_attrs sba_unmap_single_attrs | ||
38 | #define hwiommu_map_sg_attrs sba_map_sg_attrs | ||
39 | #define hwiommu_unmap_sg_attrs sba_unmap_sg_attrs | ||
40 | #define hwiommu_dma_supported sba_dma_supported | ||
41 | #define hwiommu_dma_mapping_error sba_dma_mapping_error | ||
42 | #define hwiommu_sync_single_for_cpu machvec_dma_sync_single | ||
43 | #define hwiommu_sync_sg_for_cpu machvec_dma_sync_sg | ||
44 | #define hwiommu_sync_single_for_device machvec_dma_sync_single | ||
45 | #define hwiommu_sync_sg_for_device machvec_dma_sync_sg | ||
46 | |||
47 | |||
48 | /* | 25 | /* |
49 | * Note: we need to make the determination of whether or not to use | 26 | * Note: we need to make the determination of whether or not to use |
50 | * the sw I/O TLB based purely on the device structure. Anything else | 27 | * the sw I/O TLB based purely on the device structure. Anything else |
51 | * would be unreliable or would be too intrusive. | 28 | * would be unreliable or would be too intrusive. |
52 | */ | 29 | */ |
53 | static inline int | 30 | static inline int use_swiotlb(struct device *dev) |
54 | use_swiotlb (struct device *dev) | ||
55 | { | 31 | { |
56 | return dev && dev->dma_mask && !hwiommu_dma_supported(dev, *dev->dma_mask); | 32 | return dev && dev->dma_mask && |
33 | !sba_dma_ops.dma_supported(dev, *dev->dma_mask); | ||
57 | } | 34 | } |
58 | 35 | ||
36 | struct dma_map_ops *hwsw_dma_get_ops(struct device *dev) | ||
37 | { | ||
38 | if (use_swiotlb(dev)) | ||
39 | return &swiotlb_dma_ops; | ||
40 | return &sba_dma_ops; | ||
41 | } | ||
42 | EXPORT_SYMBOL(hwsw_dma_get_ops); | ||
43 | |||
59 | void __init | 44 | void __init |
60 | hwsw_init (void) | 45 | hwsw_init (void) |
61 | { | 46 | { |
@@ -71,125 +56,3 @@ hwsw_init (void) | |||
71 | #endif | 56 | #endif |
72 | } | 57 | } |
73 | } | 58 | } |
74 | |||
75 | void * | ||
76 | hwsw_alloc_coherent (struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flags) | ||
77 | { | ||
78 | if (use_swiotlb(dev)) | ||
79 | return swiotlb_alloc_coherent(dev, size, dma_handle, flags); | ||
80 | else | ||
81 | return hwiommu_alloc_coherent(dev, size, dma_handle, flags); | ||
82 | } | ||
83 | |||
84 | void | ||
85 | hwsw_free_coherent (struct device *dev, size_t size, void *vaddr, dma_addr_t dma_handle) | ||
86 | { | ||
87 | if (use_swiotlb(dev)) | ||
88 | swiotlb_free_coherent(dev, size, vaddr, dma_handle); | ||
89 | else | ||
90 | hwiommu_free_coherent(dev, size, vaddr, dma_handle); | ||
91 | } | ||
92 | |||
93 | dma_addr_t | ||
94 | hwsw_map_single_attrs(struct device *dev, void *addr, size_t size, int dir, | ||
95 | struct dma_attrs *attrs) | ||
96 | { | ||
97 | if (use_swiotlb(dev)) | ||
98 | return swiotlb_map_single_attrs(dev, addr, size, dir, attrs); | ||
99 | else | ||
100 | return hwiommu_map_single_attrs(dev, addr, size, dir, attrs); | ||
101 | } | ||
102 | EXPORT_SYMBOL(hwsw_map_single_attrs); | ||
103 | |||
104 | void | ||
105 | hwsw_unmap_single_attrs(struct device *dev, dma_addr_t iova, size_t size, | ||
106 | int dir, struct dma_attrs *attrs) | ||
107 | { | ||
108 | if (use_swiotlb(dev)) | ||
109 | return swiotlb_unmap_single_attrs(dev, iova, size, dir, attrs); | ||
110 | else | ||
111 | return hwiommu_unmap_single_attrs(dev, iova, size, dir, attrs); | ||
112 | } | ||
113 | EXPORT_SYMBOL(hwsw_unmap_single_attrs); | ||
114 | |||
115 | int | ||
116 | hwsw_map_sg_attrs(struct device *dev, struct scatterlist *sglist, int nents, | ||
117 | int dir, struct dma_attrs *attrs) | ||
118 | { | ||
119 | if (use_swiotlb(dev)) | ||
120 | return swiotlb_map_sg_attrs(dev, sglist, nents, dir, attrs); | ||
121 | else | ||
122 | return hwiommu_map_sg_attrs(dev, sglist, nents, dir, attrs); | ||
123 | } | ||
124 | EXPORT_SYMBOL(hwsw_map_sg_attrs); | ||
125 | |||
126 | void | ||
127 | hwsw_unmap_sg_attrs(struct device *dev, struct scatterlist *sglist, int nents, | ||
128 | int dir, struct dma_attrs *attrs) | ||
129 | { | ||
130 | if (use_swiotlb(dev)) | ||
131 | return swiotlb_unmap_sg_attrs(dev, sglist, nents, dir, attrs); | ||
132 | else | ||
133 | return hwiommu_unmap_sg_attrs(dev, sglist, nents, dir, attrs); | ||
134 | } | ||
135 | EXPORT_SYMBOL(hwsw_unmap_sg_attrs); | ||
136 | |||
137 | void | ||
138 | hwsw_sync_single_for_cpu (struct device *dev, dma_addr_t addr, size_t size, int dir) | ||
139 | { | ||
140 | if (use_swiotlb(dev)) | ||
141 | swiotlb_sync_single_for_cpu(dev, addr, size, dir); | ||
142 | else | ||
143 | hwiommu_sync_single_for_cpu(dev, addr, size, dir); | ||
144 | } | ||
145 | |||
146 | void | ||
147 | hwsw_sync_sg_for_cpu (struct device *dev, struct scatterlist *sg, int nelems, int dir) | ||
148 | { | ||
149 | if (use_swiotlb(dev)) | ||
150 | swiotlb_sync_sg_for_cpu(dev, sg, nelems, dir); | ||
151 | else | ||
152 | hwiommu_sync_sg_for_cpu(dev, sg, nelems, dir); | ||
153 | } | ||
154 | |||
155 | void | ||
156 | hwsw_sync_single_for_device (struct device *dev, dma_addr_t addr, size_t size, int dir) | ||
157 | { | ||
158 | if (use_swiotlb(dev)) | ||
159 | swiotlb_sync_single_for_device(dev, addr, size, dir); | ||
160 | else | ||
161 | hwiommu_sync_single_for_device(dev, addr, size, dir); | ||
162 | } | ||
163 | |||
164 | void | ||
165 | hwsw_sync_sg_for_device (struct device *dev, struct scatterlist *sg, int nelems, int dir) | ||
166 | { | ||
167 | if (use_swiotlb(dev)) | ||
168 | swiotlb_sync_sg_for_device(dev, sg, nelems, dir); | ||
169 | else | ||
170 | hwiommu_sync_sg_for_device(dev, sg, nelems, dir); | ||
171 | } | ||
172 | |||
173 | int | ||
174 | hwsw_dma_supported (struct device *dev, u64 mask) | ||
175 | { | ||
176 | if (hwiommu_dma_supported(dev, mask)) | ||
177 | return 1; | ||
178 | return swiotlb_dma_supported(dev, mask); | ||
179 | } | ||
180 | |||
181 | int | ||
182 | hwsw_dma_mapping_error(struct device *dev, dma_addr_t dma_addr) | ||
183 | { | ||
184 | return hwiommu_dma_mapping_error(dev, dma_addr) || | ||
185 | swiotlb_dma_mapping_error(dev, dma_addr); | ||
186 | } | ||
187 | |||
188 | EXPORT_SYMBOL(hwsw_dma_mapping_error); | ||
189 | EXPORT_SYMBOL(hwsw_dma_supported); | ||
190 | EXPORT_SYMBOL(hwsw_alloc_coherent); | ||
191 | EXPORT_SYMBOL(hwsw_free_coherent); | ||
192 | EXPORT_SYMBOL(hwsw_sync_single_for_cpu); | ||
193 | EXPORT_SYMBOL(hwsw_sync_single_for_device); | ||
194 | EXPORT_SYMBOL(hwsw_sync_sg_for_cpu); | ||
195 | EXPORT_SYMBOL(hwsw_sync_sg_for_device); | ||
diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c index 6d5e6c5630e3..56ceb68eb99d 100644 --- a/arch/ia64/hp/common/sba_iommu.c +++ b/arch/ia64/hp/common/sba_iommu.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/bitops.h> /* hweight64() */ | 36 | #include <linux/bitops.h> /* hweight64() */ |
37 | #include <linux/crash_dump.h> | 37 | #include <linux/crash_dump.h> |
38 | #include <linux/iommu-helper.h> | 38 | #include <linux/iommu-helper.h> |
39 | #include <linux/dma-mapping.h> | ||
39 | 40 | ||
40 | #include <asm/delay.h> /* ia64_get_itc() */ | 41 | #include <asm/delay.h> /* ia64_get_itc() */ |
41 | #include <asm/io.h> | 42 | #include <asm/io.h> |
@@ -908,11 +909,13 @@ sba_mark_invalid(struct ioc *ioc, dma_addr_t iova, size_t byte_cnt) | |||
908 | * | 909 | * |
909 | * See Documentation/PCI/PCI-DMA-mapping.txt | 910 | * See Documentation/PCI/PCI-DMA-mapping.txt |
910 | */ | 911 | */ |
911 | dma_addr_t | 912 | static dma_addr_t sba_map_page(struct device *dev, struct page *page, |
912 | sba_map_single_attrs(struct device *dev, void *addr, size_t size, int dir, | 913 | unsigned long poff, size_t size, |
913 | struct dma_attrs *attrs) | 914 | enum dma_data_direction dir, |
915 | struct dma_attrs *attrs) | ||
914 | { | 916 | { |
915 | struct ioc *ioc; | 917 | struct ioc *ioc; |
918 | void *addr = page_address(page) + poff; | ||
916 | dma_addr_t iovp; | 919 | dma_addr_t iovp; |
917 | dma_addr_t offset; | 920 | dma_addr_t offset; |
918 | u64 *pdir_start; | 921 | u64 *pdir_start; |
@@ -990,7 +993,14 @@ sba_map_single_attrs(struct device *dev, void *addr, size_t size, int dir, | |||
990 | #endif | 993 | #endif |
991 | return SBA_IOVA(ioc, iovp, offset); | 994 | return SBA_IOVA(ioc, iovp, offset); |
992 | } | 995 | } |
993 | EXPORT_SYMBOL(sba_map_single_attrs); | 996 | |
997 | static dma_addr_t sba_map_single_attrs(struct device *dev, void *addr, | ||
998 | size_t size, enum dma_data_direction dir, | ||
999 | struct dma_attrs *attrs) | ||
1000 | { | ||
1001 | return sba_map_page(dev, virt_to_page(addr), | ||
1002 | (unsigned long)addr & ~PAGE_MASK, size, dir, attrs); | ||
1003 | } | ||
994 | 1004 | ||
995 | #ifdef ENABLE_MARK_CLEAN | 1005 | #ifdef ENABLE_MARK_CLEAN |
996 | static SBA_INLINE void | 1006 | static SBA_INLINE void |
@@ -1026,8 +1036,8 @@ sba_mark_clean(struct ioc *ioc, dma_addr_t iova, size_t size) | |||
1026 | * | 1036 | * |
1027 | * See Documentation/PCI/PCI-DMA-mapping.txt | 1037 | * See Documentation/PCI/PCI-DMA-mapping.txt |
1028 | */ | 1038 | */ |
1029 | void sba_unmap_single_attrs(struct device *dev, dma_addr_t iova, size_t size, | 1039 | static void sba_unmap_page(struct device *dev, dma_addr_t iova, size_t size, |
1030 | int dir, struct dma_attrs *attrs) | 1040 | enum dma_data_direction dir, struct dma_attrs *attrs) |
1031 | { | 1041 | { |
1032 | struct ioc *ioc; | 1042 | struct ioc *ioc; |
1033 | #if DELAYED_RESOURCE_CNT > 0 | 1043 | #if DELAYED_RESOURCE_CNT > 0 |
@@ -1094,7 +1104,12 @@ void sba_unmap_single_attrs(struct device *dev, dma_addr_t iova, size_t size, | |||
1094 | spin_unlock_irqrestore(&ioc->res_lock, flags); | 1104 | spin_unlock_irqrestore(&ioc->res_lock, flags); |
1095 | #endif /* DELAYED_RESOURCE_CNT == 0 */ | 1105 | #endif /* DELAYED_RESOURCE_CNT == 0 */ |
1096 | } | 1106 | } |
1097 | EXPORT_SYMBOL(sba_unmap_single_attrs); | 1107 | |
1108 | void sba_unmap_single_attrs(struct device *dev, dma_addr_t iova, size_t size, | ||
1109 | enum dma_data_direction dir, struct dma_attrs *attrs) | ||
1110 | { | ||
1111 | sba_unmap_page(dev, iova, size, dir, attrs); | ||
1112 | } | ||
1098 | 1113 | ||
1099 | /** | 1114 | /** |
1100 | * sba_alloc_coherent - allocate/map shared mem for DMA | 1115 | * sba_alloc_coherent - allocate/map shared mem for DMA |
@@ -1104,7 +1119,7 @@ EXPORT_SYMBOL(sba_unmap_single_attrs); | |||
1104 | * | 1119 | * |
1105 | * See Documentation/PCI/PCI-DMA-mapping.txt | 1120 | * See Documentation/PCI/PCI-DMA-mapping.txt |
1106 | */ | 1121 | */ |
1107 | void * | 1122 | static void * |
1108 | sba_alloc_coherent (struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flags) | 1123 | sba_alloc_coherent (struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flags) |
1109 | { | 1124 | { |
1110 | struct ioc *ioc; | 1125 | struct ioc *ioc; |
@@ -1167,7 +1182,8 @@ sba_alloc_coherent (struct device *dev, size_t size, dma_addr_t *dma_handle, gfp | |||
1167 | * | 1182 | * |
1168 | * See Documentation/PCI/PCI-DMA-mapping.txt | 1183 | * See Documentation/PCI/PCI-DMA-mapping.txt |
1169 | */ | 1184 | */ |
1170 | void sba_free_coherent (struct device *dev, size_t size, void *vaddr, dma_addr_t dma_handle) | 1185 | static void sba_free_coherent (struct device *dev, size_t size, void *vaddr, |
1186 | dma_addr_t dma_handle) | ||
1171 | { | 1187 | { |
1172 | sba_unmap_single_attrs(dev, dma_handle, size, 0, NULL); | 1188 | sba_unmap_single_attrs(dev, dma_handle, size, 0, NULL); |
1173 | free_pages((unsigned long) vaddr, get_order(size)); | 1189 | free_pages((unsigned long) vaddr, get_order(size)); |
@@ -1422,8 +1438,9 @@ sba_coalesce_chunks(struct ioc *ioc, struct device *dev, | |||
1422 | * | 1438 | * |
1423 | * See Documentation/PCI/PCI-DMA-mapping.txt | 1439 | * See Documentation/PCI/PCI-DMA-mapping.txt |
1424 | */ | 1440 | */ |
1425 | int sba_map_sg_attrs(struct device *dev, struct scatterlist *sglist, int nents, | 1441 | static int sba_map_sg_attrs(struct device *dev, struct scatterlist *sglist, |
1426 | int dir, struct dma_attrs *attrs) | 1442 | int nents, enum dma_data_direction dir, |
1443 | struct dma_attrs *attrs) | ||
1427 | { | 1444 | { |
1428 | struct ioc *ioc; | 1445 | struct ioc *ioc; |
1429 | int coalesced, filled = 0; | 1446 | int coalesced, filled = 0; |
@@ -1502,7 +1519,6 @@ int sba_map_sg_attrs(struct device *dev, struct scatterlist *sglist, int nents, | |||
1502 | 1519 | ||
1503 | return filled; | 1520 | return filled; |
1504 | } | 1521 | } |
1505 | EXPORT_SYMBOL(sba_map_sg_attrs); | ||
1506 | 1522 | ||
1507 | /** | 1523 | /** |
1508 | * sba_unmap_sg_attrs - unmap Scatter/Gather list | 1524 | * sba_unmap_sg_attrs - unmap Scatter/Gather list |
@@ -1514,8 +1530,9 @@ EXPORT_SYMBOL(sba_map_sg_attrs); | |||
1514 | * | 1530 | * |
1515 | * See Documentation/PCI/PCI-DMA-mapping.txt | 1531 | * See Documentation/PCI/PCI-DMA-mapping.txt |
1516 | */ | 1532 | */ |
1517 | void sba_unmap_sg_attrs(struct device *dev, struct scatterlist *sglist, | 1533 | static void sba_unmap_sg_attrs(struct device *dev, struct scatterlist *sglist, |
1518 | int nents, int dir, struct dma_attrs *attrs) | 1534 | int nents, enum dma_data_direction dir, |
1535 | struct dma_attrs *attrs) | ||
1519 | { | 1536 | { |
1520 | #ifdef ASSERT_PDIR_SANITY | 1537 | #ifdef ASSERT_PDIR_SANITY |
1521 | struct ioc *ioc; | 1538 | struct ioc *ioc; |
@@ -1551,7 +1568,6 @@ void sba_unmap_sg_attrs(struct device *dev, struct scatterlist *sglist, | |||
1551 | #endif | 1568 | #endif |
1552 | 1569 | ||
1553 | } | 1570 | } |
1554 | EXPORT_SYMBOL(sba_unmap_sg_attrs); | ||
1555 | 1571 | ||
1556 | /************************************************************** | 1572 | /************************************************************** |
1557 | * | 1573 | * |
@@ -2064,6 +2080,8 @@ static struct acpi_driver acpi_sba_ioc_driver = { | |||
2064 | }, | 2080 | }, |
2065 | }; | 2081 | }; |
2066 | 2082 | ||
2083 | extern struct dma_map_ops swiotlb_dma_ops; | ||
2084 | |||
2067 | static int __init | 2085 | static int __init |
2068 | sba_init(void) | 2086 | sba_init(void) |
2069 | { | 2087 | { |
@@ -2077,6 +2095,7 @@ sba_init(void) | |||
2077 | * a successful kdump kernel boot is to use the swiotlb. | 2095 | * a successful kdump kernel boot is to use the swiotlb. |
2078 | */ | 2096 | */ |
2079 | if (is_kdump_kernel()) { | 2097 | if (is_kdump_kernel()) { |
2098 | dma_ops = &swiotlb_dma_ops; | ||
2080 | if (swiotlb_late_init_with_default_size(64 * (1<<20)) != 0) | 2099 | if (swiotlb_late_init_with_default_size(64 * (1<<20)) != 0) |
2081 | panic("Unable to initialize software I/O TLB:" | 2100 | panic("Unable to initialize software I/O TLB:" |
2082 | " Try machvec=dig boot option"); | 2101 | " Try machvec=dig boot option"); |
@@ -2092,6 +2111,7 @@ sba_init(void) | |||
2092 | * If we didn't find something sba_iommu can claim, we | 2111 | * If we didn't find something sba_iommu can claim, we |
2093 | * need to setup the swiotlb and switch to the dig machvec. | 2112 | * need to setup the swiotlb and switch to the dig machvec. |
2094 | */ | 2113 | */ |
2114 | dma_ops = &swiotlb_dma_ops; | ||
2095 | if (swiotlb_late_init_with_default_size(64 * (1<<20)) != 0) | 2115 | if (swiotlb_late_init_with_default_size(64 * (1<<20)) != 0) |
2096 | panic("Unable to find SBA IOMMU or initialize " | 2116 | panic("Unable to find SBA IOMMU or initialize " |
2097 | "software I/O TLB: Try machvec=dig boot option"); | 2117 | "software I/O TLB: Try machvec=dig boot option"); |
@@ -2138,15 +2158,13 @@ nosbagart(char *str) | |||
2138 | return 1; | 2158 | return 1; |
2139 | } | 2159 | } |
2140 | 2160 | ||
2141 | int | 2161 | static int sba_dma_supported (struct device *dev, u64 mask) |
2142 | sba_dma_supported (struct device *dev, u64 mask) | ||
2143 | { | 2162 | { |
2144 | /* make sure it's at least 32bit capable */ | 2163 | /* make sure it's at least 32bit capable */ |
2145 | return ((mask & 0xFFFFFFFFUL) == 0xFFFFFFFFUL); | 2164 | return ((mask & 0xFFFFFFFFUL) == 0xFFFFFFFFUL); |
2146 | } | 2165 | } |
2147 | 2166 | ||
2148 | int | 2167 | static int sba_dma_mapping_error(struct device *dev, dma_addr_t dma_addr) |
2149 | sba_dma_mapping_error(struct device *dev, dma_addr_t dma_addr) | ||
2150 | { | 2168 | { |
2151 | return 0; | 2169 | return 0; |
2152 | } | 2170 | } |
@@ -2176,7 +2194,22 @@ sba_page_override(char *str) | |||
2176 | 2194 | ||
2177 | __setup("sbapagesize=",sba_page_override); | 2195 | __setup("sbapagesize=",sba_page_override); |
2178 | 2196 | ||
2179 | EXPORT_SYMBOL(sba_dma_mapping_error); | 2197 | struct dma_map_ops sba_dma_ops = { |
2180 | EXPORT_SYMBOL(sba_dma_supported); | 2198 | .alloc_coherent = sba_alloc_coherent, |
2181 | EXPORT_SYMBOL(sba_alloc_coherent); | 2199 | .free_coherent = sba_free_coherent, |
2182 | EXPORT_SYMBOL(sba_free_coherent); | 2200 | .map_page = sba_map_page, |
2201 | .unmap_page = sba_unmap_page, | ||
2202 | .map_sg = sba_map_sg_attrs, | ||
2203 | .unmap_sg = sba_unmap_sg_attrs, | ||
2204 | .sync_single_for_cpu = machvec_dma_sync_single, | ||
2205 | .sync_sg_for_cpu = machvec_dma_sync_sg, | ||
2206 | .sync_single_for_device = machvec_dma_sync_single, | ||
2207 | .sync_sg_for_device = machvec_dma_sync_sg, | ||
2208 | .dma_supported = sba_dma_supported, | ||
2209 | .mapping_error = sba_dma_mapping_error, | ||
2210 | }; | ||
2211 | |||
2212 | void sba_dma_init(void) | ||
2213 | { | ||
2214 | dma_ops = &sba_dma_ops; | ||
2215 | } | ||
diff --git a/arch/ia64/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c index 24b1ad5334cb..2bef5261d96d 100644 --- a/arch/ia64/hp/sim/simserial.c +++ b/arch/ia64/hp/sim/simserial.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/major.h> | 24 | #include <linux/major.h> |
25 | #include <linux/fcntl.h> | 25 | #include <linux/fcntl.h> |
26 | #include <linux/mm.h> | 26 | #include <linux/mm.h> |
27 | #include <linux/seq_file.h> | ||
27 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
28 | #include <linux/capability.h> | 29 | #include <linux/capability.h> |
29 | #include <linux/console.h> | 30 | #include <linux/console.h> |
@@ -848,38 +849,36 @@ static int rs_open(struct tty_struct *tty, struct file * filp) | |||
848 | * /proc fs routines.... | 849 | * /proc fs routines.... |
849 | */ | 850 | */ |
850 | 851 | ||
851 | static inline int line_info(char *buf, struct serial_state *state) | 852 | static inline void line_info(struct seq_file *m, struct serial_state *state) |
852 | { | 853 | { |
853 | return sprintf(buf, "%d: uart:%s port:%lX irq:%d\n", | 854 | seq_printf(m, "%d: uart:%s port:%lX irq:%d\n", |
854 | state->line, uart_config[state->type].name, | 855 | state->line, uart_config[state->type].name, |
855 | state->port, state->irq); | 856 | state->port, state->irq); |
856 | } | 857 | } |
857 | 858 | ||
858 | static int rs_read_proc(char *page, char **start, off_t off, int count, | 859 | static int rs_proc_show(struct seq_file *m, void *v) |
859 | int *eof, void *data) | ||
860 | { | 860 | { |
861 | int i, len = 0, l; | 861 | int i; |
862 | off_t begin = 0; | 862 | |
863 | 863 | seq_printf(m, "simserinfo:1.0 driver:%s\n", serial_version); | |
864 | len += sprintf(page, "simserinfo:1.0 driver:%s\n", serial_version); | 864 | for (i = 0; i < NR_PORTS; i++) |
865 | for (i = 0; i < NR_PORTS && len < 4000; i++) { | 865 | line_info(m, &rs_table[i]); |
866 | l = line_info(page + len, &rs_table[i]); | 866 | return 0; |
867 | len += l; | ||
868 | if (len+begin > off+count) | ||
869 | goto done; | ||
870 | if (len+begin < off) { | ||
871 | begin += len; | ||
872 | len = 0; | ||
873 | } | ||
874 | } | ||
875 | *eof = 1; | ||
876 | done: | ||
877 | if (off >= len+begin) | ||
878 | return 0; | ||
879 | *start = page + (begin-off); | ||
880 | return ((count < begin+len-off) ? count : begin+len-off); | ||
881 | } | 867 | } |
882 | 868 | ||
869 | static int rs_proc_open(struct inode *inode, struct file *file) | ||
870 | { | ||
871 | return single_open(file, rs_proc_show, NULL); | ||
872 | } | ||
873 | |||
874 | static const struct file_operations rs_proc_fops = { | ||
875 | .owner = THIS_MODULE, | ||
876 | .open = rs_proc_open, | ||
877 | .read = seq_read, | ||
878 | .llseek = seq_lseek, | ||
879 | .release = single_release, | ||
880 | }; | ||
881 | |||
883 | /* | 882 | /* |
884 | * --------------------------------------------------------------------- | 883 | * --------------------------------------------------------------------- |
885 | * rs_init() and friends | 884 | * rs_init() and friends |
@@ -917,7 +916,7 @@ static const struct tty_operations hp_ops = { | |||
917 | .start = rs_start, | 916 | .start = rs_start, |
918 | .hangup = rs_hangup, | 917 | .hangup = rs_hangup, |
919 | .wait_until_sent = rs_wait_until_sent, | 918 | .wait_until_sent = rs_wait_until_sent, |
920 | .read_proc = rs_read_proc, | 919 | .proc_fops = &rs_proc_fops, |
921 | }; | 920 | }; |
922 | 921 | ||
923 | /* | 922 | /* |