diff options
Diffstat (limited to 'include/asm-sparc64')
28 files changed, 539 insertions, 662 deletions
diff --git a/include/asm-sparc64/a.out.h b/include/asm-sparc64/a.out.h index eb3b8e90b279..902e07f89a42 100644 --- a/include/asm-sparc64/a.out.h +++ b/include/asm-sparc64/a.out.h | |||
@@ -101,6 +101,8 @@ struct relocation_info /* used when header.a_machtype == M_SPARC */ | |||
101 | #define STACK_TOP (test_thread_flag(TIF_32BIT) ? \ | 101 | #define STACK_TOP (test_thread_flag(TIF_32BIT) ? \ |
102 | STACK_TOP32 : STACK_TOP64) | 102 | STACK_TOP32 : STACK_TOP64) |
103 | 103 | ||
104 | #define STACK_TOP_MAX STACK_TOP64 | ||
105 | |||
104 | #endif | 106 | #endif |
105 | 107 | ||
106 | #endif /* !(__ASSEMBLY__) */ | 108 | #endif /* !(__ASSEMBLY__) */ |
diff --git a/include/asm-sparc64/device.h b/include/asm-sparc64/device.h index d5a4559b9555..5111e8717be3 100644 --- a/include/asm-sparc64/device.h +++ b/include/asm-sparc64/device.h | |||
@@ -16,8 +16,6 @@ struct dev_archdata { | |||
16 | 16 | ||
17 | struct device_node *prom_node; | 17 | struct device_node *prom_node; |
18 | struct of_device *op; | 18 | struct of_device *op; |
19 | |||
20 | unsigned int msi_num; | ||
21 | }; | 19 | }; |
22 | 20 | ||
23 | #endif /* _ASM_SPARC64_DEVICE_H */ | 21 | #endif /* _ASM_SPARC64_DEVICE_H */ |
diff --git a/include/asm-sparc64/dma-mapping.h b/include/asm-sparc64/dma-mapping.h index c58ec1661df8..1fc655452b81 100644 --- a/include/asm-sparc64/dma-mapping.h +++ b/include/asm-sparc64/dma-mapping.h | |||
@@ -1,307 +1,160 @@ | |||
1 | #ifndef _ASM_SPARC64_DMA_MAPPING_H | 1 | #ifndef _ASM_SPARC64_DMA_MAPPING_H |
2 | #define _ASM_SPARC64_DMA_MAPPING_H | 2 | #define _ASM_SPARC64_DMA_MAPPING_H |
3 | 3 | ||
4 | 4 | #include <linux/scatterlist.h> | |
5 | #ifdef CONFIG_PCI | ||
6 | |||
7 | /* we implement the API below in terms of the existing PCI one, | ||
8 | * so include it */ | ||
9 | #include <linux/pci.h> | ||
10 | /* need struct page definitions */ | ||
11 | #include <linux/mm.h> | 5 | #include <linux/mm.h> |
12 | 6 | ||
13 | #include <asm/of_device.h> | 7 | #define DMA_ERROR_CODE (~(dma_addr_t)0x0) |
14 | 8 | ||
15 | static inline int | 9 | struct dma_ops { |
16 | dma_supported(struct device *dev, u64 mask) | 10 | void *(*alloc_coherent)(struct device *dev, size_t size, |
17 | { | 11 | dma_addr_t *dma_handle, gfp_t flag); |
18 | BUG_ON(dev->bus != &pci_bus_type); | 12 | void (*free_coherent)(struct device *dev, size_t size, |
19 | 13 | void *cpu_addr, dma_addr_t dma_handle); | |
20 | return pci_dma_supported(to_pci_dev(dev), mask); | 14 | dma_addr_t (*map_single)(struct device *dev, void *cpu_addr, |
21 | } | 15 | size_t size, |
22 | 16 | enum dma_data_direction direction); | |
23 | static inline int | 17 | void (*unmap_single)(struct device *dev, dma_addr_t dma_addr, |
24 | dma_set_mask(struct device *dev, u64 dma_mask) | 18 | size_t size, |
25 | { | 19 | enum dma_data_direction direction); |
26 | BUG_ON(dev->bus != &pci_bus_type); | 20 | int (*map_sg)(struct device *dev, struct scatterlist *sg, int nents, |
27 | 21 | enum dma_data_direction direction); | |
28 | return pci_set_dma_mask(to_pci_dev(dev), dma_mask); | 22 | void (*unmap_sg)(struct device *dev, struct scatterlist *sg, |
29 | } | 23 | int nhwentries, |
30 | 24 | enum dma_data_direction direction); | |
31 | static inline void * | 25 | void (*sync_single_for_cpu)(struct device *dev, |
32 | dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, | 26 | dma_addr_t dma_handle, size_t size, |
33 | gfp_t flag) | 27 | enum dma_data_direction direction); |
34 | { | 28 | void (*sync_single_for_device)(struct device *dev, |
35 | BUG_ON(dev->bus != &pci_bus_type); | 29 | dma_addr_t dma_handle, size_t size, |
36 | 30 | enum dma_data_direction direction); | |
37 | return pci_iommu_ops->alloc_consistent(to_pci_dev(dev), size, dma_handle, flag); | 31 | void (*sync_sg_for_cpu)(struct device *dev, struct scatterlist *sg, |
38 | } | 32 | int nelems, |
39 | 33 | enum dma_data_direction direction); | |
40 | static inline void | 34 | void (*sync_sg_for_device)(struct device *dev, struct scatterlist *sg, |
41 | dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, | 35 | int nelems, |
42 | dma_addr_t dma_handle) | 36 | enum dma_data_direction direction); |
43 | { | 37 | }; |
44 | BUG_ON(dev->bus != &pci_bus_type); | 38 | extern const struct dma_ops *dma_ops; |
45 | 39 | ||
46 | pci_free_consistent(to_pci_dev(dev), size, cpu_addr, dma_handle); | 40 | extern int dma_supported(struct device *dev, u64 mask); |
47 | } | 41 | extern int dma_set_mask(struct device *dev, u64 dma_mask); |
48 | |||
49 | static inline dma_addr_t | ||
50 | dma_map_single(struct device *dev, void *cpu_addr, size_t size, | ||
51 | enum dma_data_direction direction) | ||
52 | { | ||
53 | BUG_ON(dev->bus != &pci_bus_type); | ||
54 | |||
55 | return pci_map_single(to_pci_dev(dev), cpu_addr, size, (int)direction); | ||
56 | } | ||
57 | |||
58 | static inline void | ||
59 | dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, | ||
60 | enum dma_data_direction direction) | ||
61 | { | ||
62 | BUG_ON(dev->bus != &pci_bus_type); | ||
63 | |||
64 | pci_unmap_single(to_pci_dev(dev), dma_addr, size, (int)direction); | ||
65 | } | ||
66 | |||
67 | static inline dma_addr_t | ||
68 | dma_map_page(struct device *dev, struct page *page, | ||
69 | unsigned long offset, size_t size, | ||
70 | enum dma_data_direction direction) | ||
71 | { | ||
72 | BUG_ON(dev->bus != &pci_bus_type); | ||
73 | |||
74 | return pci_map_page(to_pci_dev(dev), page, offset, size, (int)direction); | ||
75 | } | ||
76 | |||
77 | static inline void | ||
78 | dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size, | ||
79 | enum dma_data_direction direction) | ||
80 | { | ||
81 | BUG_ON(dev->bus != &pci_bus_type); | ||
82 | |||
83 | pci_unmap_page(to_pci_dev(dev), dma_address, size, (int)direction); | ||
84 | } | ||
85 | |||
86 | static inline int | ||
87 | dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, | ||
88 | enum dma_data_direction direction) | ||
89 | { | ||
90 | BUG_ON(dev->bus != &pci_bus_type); | ||
91 | |||
92 | return pci_map_sg(to_pci_dev(dev), sg, nents, (int)direction); | ||
93 | } | ||
94 | |||
95 | static inline void | ||
96 | dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries, | ||
97 | enum dma_data_direction direction) | ||
98 | { | ||
99 | BUG_ON(dev->bus != &pci_bus_type); | ||
100 | |||
101 | pci_unmap_sg(to_pci_dev(dev), sg, nhwentries, (int)direction); | ||
102 | } | ||
103 | |||
104 | static inline void | ||
105 | dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size, | ||
106 | enum dma_data_direction direction) | ||
107 | { | ||
108 | BUG_ON(dev->bus != &pci_bus_type); | ||
109 | |||
110 | pci_dma_sync_single_for_cpu(to_pci_dev(dev), dma_handle, | ||
111 | size, (int)direction); | ||
112 | } | ||
113 | |||
114 | static inline void | ||
115 | dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size, | ||
116 | enum dma_data_direction direction) | ||
117 | { | ||
118 | BUG_ON(dev->bus != &pci_bus_type); | ||
119 | 42 | ||
120 | pci_dma_sync_single_for_device(to_pci_dev(dev), dma_handle, | 43 | static inline void *dma_alloc_coherent(struct device *dev, size_t size, |
121 | size, (int)direction); | 44 | dma_addr_t *dma_handle, gfp_t flag) |
122 | } | ||
123 | |||
124 | static inline void | ||
125 | dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems, | ||
126 | enum dma_data_direction direction) | ||
127 | { | ||
128 | BUG_ON(dev->bus != &pci_bus_type); | ||
129 | |||
130 | pci_dma_sync_sg_for_cpu(to_pci_dev(dev), sg, nelems, (int)direction); | ||
131 | } | ||
132 | |||
133 | static inline void | ||
134 | dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems, | ||
135 | enum dma_data_direction direction) | ||
136 | { | ||
137 | BUG_ON(dev->bus != &pci_bus_type); | ||
138 | |||
139 | pci_dma_sync_sg_for_device(to_pci_dev(dev), sg, nelems, (int)direction); | ||
140 | } | ||
141 | |||
142 | static inline int | ||
143 | dma_mapping_error(dma_addr_t dma_addr) | ||
144 | { | 45 | { |
145 | return pci_dma_mapping_error(dma_addr); | 46 | return dma_ops->alloc_coherent(dev, size, dma_handle, flag); |
146 | } | 47 | } |
147 | 48 | ||
148 | #else | 49 | static inline void dma_free_coherent(struct device *dev, size_t size, |
149 | 50 | void *cpu_addr, dma_addr_t dma_handle) | |
150 | struct device; | ||
151 | struct page; | ||
152 | struct scatterlist; | ||
153 | |||
154 | static inline int | ||
155 | dma_supported(struct device *dev, u64 mask) | ||
156 | { | 51 | { |
157 | BUG(); | 52 | dma_ops->free_coherent(dev, size, cpu_addr, dma_handle); |
158 | return 0; | ||
159 | } | 53 | } |
160 | 54 | ||
161 | static inline int | 55 | static inline dma_addr_t dma_map_single(struct device *dev, void *cpu_addr, |
162 | dma_set_mask(struct device *dev, u64 dma_mask) | 56 | size_t size, |
57 | enum dma_data_direction direction) | ||
163 | { | 58 | { |
164 | BUG(); | 59 | return dma_ops->map_single(dev, cpu_addr, size, direction); |
165 | return 0; | ||
166 | } | 60 | } |
167 | 61 | ||
168 | static inline void *dma_alloc_coherent(struct device *dev, size_t size, | 62 | static inline void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, |
169 | dma_addr_t *dma_handle, gfp_t flag) | 63 | size_t size, |
64 | enum dma_data_direction direction) | ||
170 | { | 65 | { |
171 | BUG(); | 66 | dma_ops->unmap_single(dev, dma_addr, size, direction); |
172 | return NULL; | ||
173 | } | 67 | } |
174 | 68 | ||
175 | static inline void dma_free_coherent(struct device *dev, size_t size, | 69 | static inline dma_addr_t dma_map_page(struct device *dev, struct page *page, |
176 | void *vaddr, dma_addr_t dma_handle) | 70 | unsigned long offset, size_t size, |
71 | enum dma_data_direction direction) | ||
177 | { | 72 | { |
178 | BUG(); | 73 | return dma_ops->map_single(dev, page_address(page) + offset, |
74 | size, direction); | ||
179 | } | 75 | } |
180 | 76 | ||
181 | static inline dma_addr_t | 77 | static inline void dma_unmap_page(struct device *dev, dma_addr_t dma_address, |
182 | dma_map_single(struct device *dev, void *cpu_addr, size_t size, | 78 | size_t size, |
183 | enum dma_data_direction direction) | 79 | enum dma_data_direction direction) |
184 | { | 80 | { |
185 | BUG(); | 81 | dma_ops->unmap_single(dev, dma_address, size, direction); |
186 | return 0; | ||
187 | } | 82 | } |
188 | 83 | ||
189 | static inline void | 84 | static inline int dma_map_sg(struct device *dev, struct scatterlist *sg, |
190 | dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, | 85 | int nents, enum dma_data_direction direction) |
191 | enum dma_data_direction direction) | ||
192 | { | 86 | { |
193 | BUG(); | 87 | return dma_ops->map_sg(dev, sg, nents, direction); |
194 | } | 88 | } |
195 | 89 | ||
196 | static inline dma_addr_t | 90 | static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg, |
197 | dma_map_page(struct device *dev, struct page *page, | 91 | int nents, enum dma_data_direction direction) |
198 | unsigned long offset, size_t size, | ||
199 | enum dma_data_direction direction) | ||
200 | { | 92 | { |
201 | BUG(); | 93 | dma_ops->unmap_sg(dev, sg, nents, direction); |
202 | return 0; | ||
203 | } | 94 | } |
204 | 95 | ||
205 | static inline void | 96 | static inline void dma_sync_single_for_cpu(struct device *dev, |
206 | dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size, | 97 | dma_addr_t dma_handle, size_t size, |
207 | enum dma_data_direction direction) | 98 | enum dma_data_direction direction) |
208 | { | 99 | { |
209 | BUG(); | 100 | dma_ops->sync_single_for_cpu(dev, dma_handle, size, direction); |
210 | } | 101 | } |
211 | 102 | ||
212 | static inline int | 103 | static inline void dma_sync_single_for_device(struct device *dev, |
213 | dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, | 104 | dma_addr_t dma_handle, |
214 | enum dma_data_direction direction) | 105 | size_t size, |
106 | enum dma_data_direction direction) | ||
215 | { | 107 | { |
216 | BUG(); | 108 | dma_ops->sync_single_for_device(dev, dma_handle, size, direction); |
217 | return 0; | ||
218 | } | 109 | } |
219 | 110 | ||
220 | static inline void | 111 | static inline void dma_sync_single_range_for_cpu(struct device *dev, |
221 | dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries, | 112 | dma_addr_t dma_handle, |
222 | enum dma_data_direction direction) | 113 | unsigned long offset, |
114 | size_t size, | ||
115 | enum dma_data_direction direction) | ||
223 | { | 116 | { |
224 | BUG(); | 117 | dma_sync_single_for_cpu(dev, dma_handle+offset, size, direction); |
225 | } | 118 | } |
226 | 119 | ||
227 | static inline void | 120 | static inline void dma_sync_single_range_for_device(struct device *dev, |
228 | dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size, | 121 | dma_addr_t dma_handle, |
229 | enum dma_data_direction direction) | 122 | unsigned long offset, |
123 | size_t size, | ||
124 | enum dma_data_direction direction) | ||
230 | { | 125 | { |
231 | BUG(); | 126 | dma_sync_single_for_device(dev, dma_handle+offset, size, direction); |
232 | } | 127 | } |
233 | 128 | ||
234 | static inline void | ||
235 | dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size, | ||
236 | enum dma_data_direction direction) | ||
237 | { | ||
238 | BUG(); | ||
239 | } | ||
240 | 129 | ||
241 | static inline void | 130 | static inline void dma_sync_sg_for_cpu(struct device *dev, |
242 | dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems, | 131 | struct scatterlist *sg, int nelems, |
243 | enum dma_data_direction direction) | 132 | enum dma_data_direction direction) |
244 | { | 133 | { |
245 | BUG(); | 134 | dma_ops->sync_sg_for_cpu(dev, sg, nelems, direction); |
246 | } | 135 | } |
247 | 136 | ||
248 | static inline void | 137 | static inline void dma_sync_sg_for_device(struct device *dev, |
249 | dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems, | 138 | struct scatterlist *sg, int nelems, |
250 | enum dma_data_direction direction) | 139 | enum dma_data_direction direction) |
251 | { | 140 | { |
252 | BUG(); | 141 | dma_ops->sync_sg_for_device(dev, sg, nelems, direction); |
253 | } | 142 | } |
254 | 143 | ||
255 | static inline int | 144 | static inline int dma_mapping_error(dma_addr_t dma_addr) |
256 | dma_mapping_error(dma_addr_t dma_addr) | ||
257 | { | 145 | { |
258 | BUG(); | 146 | return (dma_addr == DMA_ERROR_CODE); |
259 | return 0; | ||
260 | } | 147 | } |
261 | 148 | ||
262 | #endif /* PCI */ | 149 | static inline int dma_get_cache_alignment(void) |
263 | |||
264 | |||
265 | /* Now for the API extensions over the pci_ one */ | ||
266 | |||
267 | #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) | ||
268 | #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) | ||
269 | #define dma_is_consistent(d, h) (1) | ||
270 | |||
271 | static inline int | ||
272 | dma_get_cache_alignment(void) | ||
273 | { | 150 | { |
274 | /* no easy way to get cache size on all processors, so return | 151 | /* no easy way to get cache size on all processors, so return |
275 | * the maximum possible, to be safe */ | 152 | * the maximum possible, to be safe */ |
276 | return (1 << INTERNODE_CACHE_SHIFT); | 153 | return (1 << INTERNODE_CACHE_SHIFT); |
277 | } | 154 | } |
278 | 155 | ||
279 | static inline void | 156 | #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) |
280 | dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle, | 157 | #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) |
281 | unsigned long offset, size_t size, | 158 | #define dma_is_consistent(d, h) (1) |
282 | enum dma_data_direction direction) | ||
283 | { | ||
284 | /* just sync everything, that's all the pci API can do */ | ||
285 | dma_sync_single_for_cpu(dev, dma_handle, offset+size, direction); | ||
286 | } | ||
287 | |||
288 | static inline void | ||
289 | dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle, | ||
290 | unsigned long offset, size_t size, | ||
291 | enum dma_data_direction direction) | ||
292 | { | ||
293 | /* just sync everything, that's all the pci API can do */ | ||
294 | dma_sync_single_for_device(dev, dma_handle, offset+size, direction); | ||
295 | } | ||
296 | |||
297 | static inline void | ||
298 | dma_cache_sync(struct device *dev, void *vaddr, size_t size, | ||
299 | enum dma_data_direction direction) | ||
300 | { | ||
301 | /* could define this in terms of the dma_cache ... operations, | ||
302 | * but if you get this on a platform, you should convert the platform | ||
303 | * to using the generic device DMA API */ | ||
304 | BUG(); | ||
305 | } | ||
306 | 159 | ||
307 | #endif /* _ASM_SPARC64_DMA_MAPPING_H */ | 160 | #endif /* _ASM_SPARC64_DMA_MAPPING_H */ |
diff --git a/include/asm-sparc64/elf.h b/include/asm-sparc64/elf.h index 303d85e2f82e..8653e8665009 100644 --- a/include/asm-sparc64/elf.h +++ b/include/asm-sparc64/elf.h | |||
@@ -70,6 +70,7 @@ | |||
70 | #define HWCAP_SPARC_V9 16 | 70 | #define HWCAP_SPARC_V9 16 |
71 | #define HWCAP_SPARC_ULTRA3 32 | 71 | #define HWCAP_SPARC_ULTRA3 32 |
72 | #define HWCAP_SPARC_BLKINIT 64 | 72 | #define HWCAP_SPARC_BLKINIT 64 |
73 | #define HWCAP_SPARC_N2 128 | ||
73 | 74 | ||
74 | /* | 75 | /* |
75 | * These are used to set parameters in the core dumps. | 76 | * These are used to set parameters in the core dumps. |
@@ -155,8 +156,13 @@ static inline unsigned int sparc64_elf_hwcap(void) | |||
155 | 156 | ||
156 | if (tlb_type == cheetah || tlb_type == cheetah_plus) | 157 | if (tlb_type == cheetah || tlb_type == cheetah_plus) |
157 | cap |= HWCAP_SPARC_ULTRA3; | 158 | cap |= HWCAP_SPARC_ULTRA3; |
158 | else if (tlb_type == hypervisor) | 159 | else if (tlb_type == hypervisor) { |
159 | cap |= HWCAP_SPARC_BLKINIT; | 160 | if (sun4v_chip_type == SUN4V_CHIP_NIAGARA1 || |
161 | sun4v_chip_type == SUN4V_CHIP_NIAGARA2) | ||
162 | cap |= HWCAP_SPARC_BLKINIT; | ||
163 | if (sun4v_chip_type == SUN4V_CHIP_NIAGARA2) | ||
164 | cap |= HWCAP_SPARC_N2; | ||
165 | } | ||
160 | 166 | ||
161 | return cap; | 167 | return cap; |
162 | } | 168 | } |
diff --git a/include/asm-sparc64/fb.h b/include/asm-sparc64/fb.h index d6cd3a175fc3..389012e5fbad 100644 --- a/include/asm-sparc64/fb.h +++ b/include/asm-sparc64/fb.h | |||
@@ -3,6 +3,7 @@ | |||
3 | #include <linux/fb.h> | 3 | #include <linux/fb.h> |
4 | #include <linux/fs.h> | 4 | #include <linux/fs.h> |
5 | #include <asm/page.h> | 5 | #include <asm/page.h> |
6 | #include <asm/prom.h> | ||
6 | 7 | ||
7 | static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma, | 8 | static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma, |
8 | unsigned long off) | 9 | unsigned long off) |
@@ -12,6 +13,14 @@ static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma, | |||
12 | 13 | ||
13 | static inline int fb_is_primary_device(struct fb_info *info) | 14 | static inline int fb_is_primary_device(struct fb_info *info) |
14 | { | 15 | { |
16 | struct device *dev = info->device; | ||
17 | struct device_node *node; | ||
18 | |||
19 | node = dev->archdata.prom_node; | ||
20 | if (node && | ||
21 | node == of_console_device) | ||
22 | return 1; | ||
23 | |||
15 | return 0; | 24 | return 0; |
16 | } | 25 | } |
17 | 26 | ||
diff --git a/include/asm-sparc64/fbio.h b/include/asm-sparc64/fbio.h index 500026d9f6e1..b9215a0907d3 100644 --- a/include/asm-sparc64/fbio.h +++ b/include/asm-sparc64/fbio.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define __LINUX_FBIO_H | 2 | #define __LINUX_FBIO_H |
3 | 3 | ||
4 | #include <linux/compiler.h> | 4 | #include <linux/compiler.h> |
5 | #include <linux/types.h> | ||
5 | 6 | ||
6 | /* Constants used for fbio SunOS compatibility */ | 7 | /* Constants used for fbio SunOS compatibility */ |
7 | /* (C) 1996 Miguel de Icaza */ | 8 | /* (C) 1996 Miguel de Icaza */ |
@@ -299,4 +300,31 @@ struct fb_clut32 { | |||
299 | #define LEO_LD_GBL_MAP 0x01009000 | 300 | #define LEO_LD_GBL_MAP 0x01009000 |
300 | #define LEO_UNK2_MAP 0x0100a000 | 301 | #define LEO_UNK2_MAP 0x0100a000 |
301 | 302 | ||
303 | #ifdef __KERNEL__ | ||
304 | struct fbcmap32 { | ||
305 | int index; /* first element (0 origin) */ | ||
306 | int count; | ||
307 | u32 red; | ||
308 | u32 green; | ||
309 | u32 blue; | ||
310 | }; | ||
311 | |||
312 | #define FBIOPUTCMAP32 _IOW('F', 3, struct fbcmap32) | ||
313 | #define FBIOGETCMAP32 _IOW('F', 4, struct fbcmap32) | ||
314 | |||
315 | struct fbcursor32 { | ||
316 | short set; /* what to set, choose from the list above */ | ||
317 | short enable; /* cursor on/off */ | ||
318 | struct fbcurpos pos; /* cursor position */ | ||
319 | struct fbcurpos hot; /* cursor hot spot */ | ||
320 | struct fbcmap32 cmap; /* color map info */ | ||
321 | struct fbcurpos size; /* cursor bit map size */ | ||
322 | u32 image; /* cursor image bits */ | ||
323 | u32 mask; /* cursor mask bits */ | ||
324 | }; | ||
325 | |||
326 | #define FBIOSCURSOR32 _IOW('F', 24, struct fbcursor32) | ||
327 | #define FBIOGCURSOR32 _IOW('F', 25, struct fbcursor32) | ||
328 | #endif | ||
329 | |||
302 | #endif /* __LINUX_FBIO_H */ | 330 | #endif /* __LINUX_FBIO_H */ |
diff --git a/include/asm-sparc64/fcntl.h b/include/asm-sparc64/fcntl.h index b2aecf0054bd..111f6b3b8925 100644 --- a/include/asm-sparc64/fcntl.h +++ b/include/asm-sparc64/fcntl.h | |||
@@ -16,7 +16,7 @@ | |||
16 | #define O_LARGEFILE 0x40000 | 16 | #define O_LARGEFILE 0x40000 |
17 | #define O_DIRECT 0x100000 /* direct disk access hint */ | 17 | #define O_DIRECT 0x100000 /* direct disk access hint */ |
18 | #define O_NOATIME 0x200000 | 18 | #define O_NOATIME 0x200000 |
19 | 19 | #define O_CLOEXEC 0x400000 | |
20 | 20 | ||
21 | #define F_GETOWN 5 /* for sockets. */ | 21 | #define F_GETOWN 5 /* for sockets. */ |
22 | #define F_SETOWN 6 /* for sockets. */ | 22 | #define F_SETOWN 6 /* for sockets. */ |
diff --git a/include/asm-sparc64/floppy.h b/include/asm-sparc64/floppy.h index 4aa0925e1b1b..1783239c7b40 100644 --- a/include/asm-sparc64/floppy.h +++ b/include/asm-sparc64/floppy.h | |||
@@ -1,7 +1,6 @@ | |||
1 | /* $Id: floppy.h,v 1.32 2001/10/26 17:59:36 davem Exp $ | 1 | /* floppy.h: Sparc specific parts of the Floppy driver. |
2 | * asm-sparc64/floppy.h: Sparc specific parts of the Floppy driver. | ||
3 | * | 2 | * |
4 | * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) | 3 | * Copyright (C) 1996, 2007 David S. Miller (davem@davemloft.net) |
5 | * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) | 4 | * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) |
6 | * | 5 | * |
7 | * Ultra/PCI support added: Sep 1997 Eddie C. Dost (ecd@skynet.be) | 6 | * Ultra/PCI support added: Sep 1997 Eddie C. Dost (ecd@skynet.be) |
@@ -11,6 +10,7 @@ | |||
11 | #define __ASM_SPARC64_FLOPPY_H | 10 | #define __ASM_SPARC64_FLOPPY_H |
12 | 11 | ||
13 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/pci.h> | ||
14 | 14 | ||
15 | #include <asm/page.h> | 15 | #include <asm/page.h> |
16 | #include <asm/pgtable.h> | 16 | #include <asm/pgtable.h> |
diff --git a/include/asm-sparc64/io.h b/include/asm-sparc64/io.h index ad595b679842..9565a892801e 100644 --- a/include/asm-sparc64/io.h +++ b/include/asm-sparc64/io.h | |||
@@ -14,11 +14,6 @@ | |||
14 | #define __SLOW_DOWN_IO do { } while (0) | 14 | #define __SLOW_DOWN_IO do { } while (0) |
15 | #define SLOW_DOWN_IO do { } while (0) | 15 | #define SLOW_DOWN_IO do { } while (0) |
16 | 16 | ||
17 | extern unsigned long virt_to_bus_not_defined_use_pci_map(volatile void *addr); | ||
18 | #define virt_to_bus virt_to_bus_not_defined_use_pci_map | ||
19 | extern unsigned long bus_to_virt_not_defined_use_pci_map(volatile void *addr); | ||
20 | #define bus_to_virt bus_to_virt_not_defined_use_pci_map | ||
21 | |||
22 | /* BIO layer definitions. */ | 17 | /* BIO layer definitions. */ |
23 | extern unsigned long kern_base, kern_size; | 18 | extern unsigned long kern_base, kern_size; |
24 | #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) | 19 | #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) |
diff --git a/include/asm-sparc64/iommu.h b/include/asm-sparc64/iommu.h index 0b1813f41045..9eac6676caf1 100644 --- a/include/asm-sparc64/iommu.h +++ b/include/asm-sparc64/iommu.h | |||
@@ -1,7 +1,6 @@ | |||
1 | /* $Id: iommu.h,v 1.10 2001/03/08 09:55:56 davem Exp $ | 1 | /* iommu.h: Definitions for the sun5 IOMMU. |
2 | * iommu.h: Definitions for the sun5 IOMMU. | ||
3 | * | 2 | * |
4 | * Copyright (C) 1996, 1999 David S. Miller (davem@caip.rutgers.edu) | 3 | * Copyright (C) 1996, 1999, 2007 David S. Miller (davem@davemloft.net) |
5 | */ | 4 | */ |
6 | #ifndef _SPARC64_IOMMU_H | 5 | #ifndef _SPARC64_IOMMU_H |
7 | #define _SPARC64_IOMMU_H | 6 | #define _SPARC64_IOMMU_H |
@@ -33,6 +32,7 @@ struct iommu { | |||
33 | unsigned long iommu_tsbbase; | 32 | unsigned long iommu_tsbbase; |
34 | unsigned long iommu_flush; | 33 | unsigned long iommu_flush; |
35 | unsigned long iommu_flushinv; | 34 | unsigned long iommu_flushinv; |
35 | unsigned long iommu_tags; | ||
36 | unsigned long iommu_ctxflush; | 36 | unsigned long iommu_ctxflush; |
37 | unsigned long write_complete_reg; | 37 | unsigned long write_complete_reg; |
38 | unsigned long dummy_page; | 38 | unsigned long dummy_page; |
@@ -54,4 +54,7 @@ struct strbuf { | |||
54 | volatile unsigned long __flushflag_buf[(64+(64-1)) / sizeof(long)]; | 54 | volatile unsigned long __flushflag_buf[(64+(64-1)) / sizeof(long)]; |
55 | }; | 55 | }; |
56 | 56 | ||
57 | #endif /* !(_SPARC_IOMMU_H) */ | 57 | extern int iommu_table_init(struct iommu *iommu, int tsbsize, |
58 | u32 dma_offset, u32 dma_addr_mask); | ||
59 | |||
60 | #endif /* !(_SPARC64_IOMMU_H) */ | ||
diff --git a/include/asm-sparc64/irq.h b/include/asm-sparc64/irq.h index e6c436ef9356..c00ad152771b 100644 --- a/include/asm-sparc64/irq.h +++ b/include/asm-sparc64/irq.h | |||
@@ -16,21 +16,21 @@ | |||
16 | #include <asm/ptrace.h> | 16 | #include <asm/ptrace.h> |
17 | 17 | ||
18 | /* IMAP/ICLR register defines */ | 18 | /* IMAP/ICLR register defines */ |
19 | #define IMAP_VALID 0x80000000 /* IRQ Enabled */ | 19 | #define IMAP_VALID 0x80000000UL /* IRQ Enabled */ |
20 | #define IMAP_TID_UPA 0x7c000000 /* UPA TargetID */ | 20 | #define IMAP_TID_UPA 0x7c000000UL /* UPA TargetID */ |
21 | #define IMAP_TID_JBUS 0x7c000000 /* JBUS TargetID */ | 21 | #define IMAP_TID_JBUS 0x7c000000UL /* JBUS TargetID */ |
22 | #define IMAP_TID_SHIFT 26 | 22 | #define IMAP_TID_SHIFT 26 |
23 | #define IMAP_AID_SAFARI 0x7c000000 /* Safari AgentID */ | 23 | #define IMAP_AID_SAFARI 0x7c000000UL /* Safari AgentID */ |
24 | #define IMAP_AID_SHIFT 26 | 24 | #define IMAP_AID_SHIFT 26 |
25 | #define IMAP_NID_SAFARI 0x03e00000 /* Safari NodeID */ | 25 | #define IMAP_NID_SAFARI 0x03e00000UL /* Safari NodeID */ |
26 | #define IMAP_NID_SHIFT 21 | 26 | #define IMAP_NID_SHIFT 21 |
27 | #define IMAP_IGN 0x000007c0 /* IRQ Group Number */ | 27 | #define IMAP_IGN 0x000007c0UL /* IRQ Group Number */ |
28 | #define IMAP_INO 0x0000003f /* IRQ Number */ | 28 | #define IMAP_INO 0x0000003fUL /* IRQ Number */ |
29 | #define IMAP_INR 0x000007ff /* Full interrupt number*/ | 29 | #define IMAP_INR 0x000007ffUL /* Full interrupt number*/ |
30 | 30 | ||
31 | #define ICLR_IDLE 0x00000000 /* Idle state */ | 31 | #define ICLR_IDLE 0x00000000UL /* Idle state */ |
32 | #define ICLR_TRANSMIT 0x00000001 /* Transmit state */ | 32 | #define ICLR_TRANSMIT 0x00000001UL /* Transmit state */ |
33 | #define ICLR_PENDING 0x00000003 /* Pending state */ | 33 | #define ICLR_PENDING 0x00000003UL /* Pending state */ |
34 | 34 | ||
35 | /* The largest number of unique interrupt sources we support. | 35 | /* The largest number of unique interrupt sources we support. |
36 | * If this needs to ever be larger than 255, you need to change | 36 | * If this needs to ever be larger than 255, you need to change |
@@ -53,6 +53,9 @@ extern unsigned int sun4v_build_msi(u32 devhandle, unsigned int *virt_irq_p, | |||
53 | extern void sun4v_destroy_msi(unsigned int virt_irq); | 53 | extern void sun4v_destroy_msi(unsigned int virt_irq); |
54 | extern unsigned int sbus_build_irq(void *sbus, unsigned int ino); | 54 | extern unsigned int sbus_build_irq(void *sbus, unsigned int ino); |
55 | 55 | ||
56 | extern void sparc64_set_msi(unsigned int virt_irq, u32 msi); | ||
57 | extern u32 sparc64_get_msi(unsigned int virt_irq); | ||
58 | |||
56 | extern void fixup_irqs(void); | 59 | extern void fixup_irqs(void); |
57 | 60 | ||
58 | static __inline__ void set_softint(unsigned long bits) | 61 | static __inline__ void set_softint(unsigned long bits) |
diff --git a/include/asm-sparc64/kprobes.h b/include/asm-sparc64/kprobes.h index a331b7b0dff2..7f6774dca5f4 100644 --- a/include/asm-sparc64/kprobes.h +++ b/include/asm-sparc64/kprobes.h | |||
@@ -10,7 +10,6 @@ typedef u32 kprobe_opcode_t; | |||
10 | #define BREAKPOINT_INSTRUCTION_2 0x91d02071 /* ta 0x71 */ | 10 | #define BREAKPOINT_INSTRUCTION_2 0x91d02071 /* ta 0x71 */ |
11 | #define MAX_INSN_SIZE 2 | 11 | #define MAX_INSN_SIZE 2 |
12 | 12 | ||
13 | #define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry | ||
14 | #define arch_remove_kprobe(p) do {} while (0) | 13 | #define arch_remove_kprobe(p) do {} while (0) |
15 | #define ARCH_INACTIVE_KPROBE_COUNT 0 | 14 | #define ARCH_INACTIVE_KPROBE_COUNT 0 |
16 | 15 | ||
diff --git a/include/asm-sparc64/mdesc.h b/include/asm-sparc64/mdesc.h index e97c43133752..1acc7272e537 100644 --- a/include/asm-sparc64/mdesc.h +++ b/include/asm-sparc64/mdesc.h | |||
@@ -61,6 +61,16 @@ extern u64 mdesc_arc_target(struct mdesc_handle *hp, u64 arc); | |||
61 | 61 | ||
62 | extern void mdesc_update(void); | 62 | extern void mdesc_update(void); |
63 | 63 | ||
64 | struct mdesc_notifier_client { | ||
65 | void (*add)(struct mdesc_handle *handle, u64 node); | ||
66 | void (*remove)(struct mdesc_handle *handle, u64 node); | ||
67 | |||
68 | const char *node_name; | ||
69 | struct mdesc_notifier_client *next; | ||
70 | }; | ||
71 | |||
72 | extern void mdesc_register_notifier(struct mdesc_notifier_client *client); | ||
73 | |||
64 | extern void mdesc_fill_in_cpu_data(cpumask_t mask); | 74 | extern void mdesc_fill_in_cpu_data(cpumask_t mask); |
65 | 75 | ||
66 | extern void sun4v_mdesc_init(void); | 76 | extern void sun4v_mdesc_init(void); |
diff --git a/include/asm-sparc64/of_device.h b/include/asm-sparc64/of_device.h index 60e9173c9acb..46d69b3223c5 100644 --- a/include/asm-sparc64/of_device.h +++ b/include/asm-sparc64/of_device.h | |||
@@ -3,14 +3,9 @@ | |||
3 | #ifdef __KERNEL__ | 3 | #ifdef __KERNEL__ |
4 | 4 | ||
5 | #include <linux/device.h> | 5 | #include <linux/device.h> |
6 | #include <linux/of.h> | ||
6 | #include <linux/mod_devicetable.h> | 7 | #include <linux/mod_devicetable.h> |
7 | #include <asm/openprom.h> | 8 | #include <asm/openprom.h> |
8 | #include <asm/prom.h> | ||
9 | |||
10 | extern struct bus_type isa_bus_type; | ||
11 | extern struct bus_type ebus_bus_type; | ||
12 | extern struct bus_type sbus_bus_type; | ||
13 | extern struct bus_type of_bus_type; | ||
14 | 9 | ||
15 | /* | 10 | /* |
16 | * The of_device is a kind of "base class" that is a superset of | 11 | * The of_device is a kind of "base class" that is a superset of |
@@ -31,50 +26,13 @@ struct of_device | |||
31 | int portid; | 26 | int portid; |
32 | int clock_freq; | 27 | int clock_freq; |
33 | }; | 28 | }; |
34 | #define to_of_device(d) container_of(d, struct of_device, dev) | ||
35 | 29 | ||
36 | extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name); | 30 | extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name); |
37 | extern void of_iounmap(struct resource *res, void __iomem *base, unsigned long size); | 31 | extern void of_iounmap(struct resource *res, void __iomem *base, unsigned long size); |
38 | 32 | ||
39 | extern struct of_device *of_find_device_by_node(struct device_node *); | 33 | /* These are just here during the transition */ |
40 | 34 | #include <linux/of_device.h> | |
41 | extern const struct of_device_id *of_match_device( | 35 | #include <linux/of_platform.h> |
42 | const struct of_device_id *matches, const struct of_device *dev); | ||
43 | |||
44 | extern struct of_device *of_dev_get(struct of_device *dev); | ||
45 | extern void of_dev_put(struct of_device *dev); | ||
46 | |||
47 | /* | ||
48 | * An of_platform_driver driver is attached to a basic of_device on | ||
49 | * the ISA, EBUS, and SBUS busses on sparc64. | ||
50 | */ | ||
51 | struct of_platform_driver | ||
52 | { | ||
53 | char *name; | ||
54 | struct of_device_id *match_table; | ||
55 | struct module *owner; | ||
56 | |||
57 | int (*probe)(struct of_device* dev, const struct of_device_id *match); | ||
58 | int (*remove)(struct of_device* dev); | ||
59 | |||
60 | int (*suspend)(struct of_device* dev, pm_message_t state); | ||
61 | int (*resume)(struct of_device* dev); | ||
62 | int (*shutdown)(struct of_device* dev); | ||
63 | |||
64 | struct device_driver driver; | ||
65 | }; | ||
66 | #define to_of_platform_driver(drv) container_of(drv,struct of_platform_driver, driver) | ||
67 | |||
68 | extern int of_register_driver(struct of_platform_driver *drv, | ||
69 | struct bus_type *bus); | ||
70 | extern void of_unregister_driver(struct of_platform_driver *drv); | ||
71 | extern int of_device_register(struct of_device *ofdev); | ||
72 | extern void of_device_unregister(struct of_device *ofdev); | ||
73 | extern struct of_device *of_platform_device_create(struct device_node *np, | ||
74 | const char *bus_id, | ||
75 | struct device *parent, | ||
76 | struct bus_type *bus); | ||
77 | extern void of_release_dev(struct device *dev); | ||
78 | 36 | ||
79 | #endif /* __KERNEL__ */ | 37 | #endif /* __KERNEL__ */ |
80 | #endif /* _ASM_SPARC64_OF_DEVICE_H */ | 38 | #endif /* _ASM_SPARC64_OF_DEVICE_H */ |
diff --git a/include/asm-sparc64/of_platform.h b/include/asm-sparc64/of_platform.h new file mode 100644 index 000000000000..f7c1f17c7d52 --- /dev/null +++ b/include/asm-sparc64/of_platform.h | |||
@@ -0,0 +1,33 @@ | |||
1 | #ifndef _ASM_SPARC64_OF_PLATFORM_H | ||
2 | #define _ASM_SPARC64_OF_PLATFORM_H | ||
3 | /* | ||
4 | * Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp. | ||
5 | * <benh@kernel.crashing.org> | ||
6 | * Modified for Sparc by merging parts of asm-sparc/of_device.h | ||
7 | * by Stephen Rothwell | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | ||
10 | * modify it under the terms of the GNU General Public License | ||
11 | * as published by the Free Software Foundation; either version | ||
12 | * 2 of the License, or (at your option) any later version. | ||
13 | * | ||
14 | */ | ||
15 | |||
16 | /* This is just here during the transition */ | ||
17 | #include <linux/of_platform.h> | ||
18 | |||
19 | extern struct bus_type isa_bus_type; | ||
20 | extern struct bus_type ebus_bus_type; | ||
21 | extern struct bus_type sbus_bus_type; | ||
22 | extern struct bus_type of_platform_bus_type; | ||
23 | #define of_bus_type of_platform_bus_type /* for compatibility */ | ||
24 | |||
25 | extern int of_register_driver(struct of_platform_driver *drv, | ||
26 | struct bus_type *bus); | ||
27 | extern void of_unregister_driver(struct of_platform_driver *drv); | ||
28 | extern struct of_device *of_platform_device_create(struct device_node *np, | ||
29 | const char *bus_id, | ||
30 | struct device *parent, | ||
31 | struct bus_type *bus); | ||
32 | |||
33 | #endif /* _ASM_SPARC64_OF_PLATFORM_H */ | ||
diff --git a/include/asm-sparc64/oplib.h b/include/asm-sparc64/oplib.h index 992f9f7a476c..55c5bb27e4da 100644 --- a/include/asm-sparc64/oplib.h +++ b/include/asm-sparc64/oplib.h | |||
@@ -1,8 +1,7 @@ | |||
1 | /* $Id: oplib.h,v 1.14 2001/12/19 00:29:51 davem Exp $ | 1 | /* oplib.h: Describes the interface and available routines in the |
2 | * oplib.h: Describes the interface and available routines in the | ||
3 | * Linux Prom library. | 2 | * Linux Prom library. |
4 | * | 3 | * |
5 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | 4 | * Copyright (C) 1995, 2007 David S. Miller (davem@davemloft.net) |
6 | * Copyright (C) 1996 Jakub Jelinek (jj@sunsite.mff.cuni.cz) | 5 | * Copyright (C) 1996 Jakub Jelinek (jj@sunsite.mff.cuni.cz) |
7 | */ | 6 | */ |
8 | 7 | ||
@@ -31,8 +30,10 @@ extern int prom_chosen_node; | |||
31 | extern const char prom_peer_name[]; | 30 | extern const char prom_peer_name[]; |
32 | extern const char prom_compatible_name[]; | 31 | extern const char prom_compatible_name[]; |
33 | extern const char prom_root_compatible[]; | 32 | extern const char prom_root_compatible[]; |
33 | extern const char prom_cpu_compatible[]; | ||
34 | extern const char prom_finddev_name[]; | 34 | extern const char prom_finddev_name[]; |
35 | extern const char prom_chosen_path[]; | 35 | extern const char prom_chosen_path[]; |
36 | extern const char prom_cpu_path[]; | ||
36 | extern const char prom_getprop_name[]; | 37 | extern const char prom_getprop_name[]; |
37 | extern const char prom_mmu_name[]; | 38 | extern const char prom_mmu_name[]; |
38 | extern const char prom_callmethod_name[]; | 39 | extern const char prom_callmethod_name[]; |
@@ -140,32 +141,6 @@ extern void prom_putchar(char character); | |||
140 | extern void prom_printf(const char *fmt, ...); | 141 | extern void prom_printf(const char *fmt, ...); |
141 | extern void prom_write(const char *buf, unsigned int len); | 142 | extern void prom_write(const char *buf, unsigned int len); |
142 | 143 | ||
143 | /* Query for input device type */ | ||
144 | |||
145 | enum prom_input_device { | ||
146 | PROMDEV_IKBD, /* input from keyboard */ | ||
147 | PROMDEV_ITTYA, /* input from ttya */ | ||
148 | PROMDEV_ITTYB, /* input from ttyb */ | ||
149 | PROMDEV_IRSC, /* input from rsc */ | ||
150 | PROMDEV_IVCONS, /* input from virtual-console */ | ||
151 | PROMDEV_I_UNK, | ||
152 | }; | ||
153 | |||
154 | extern enum prom_input_device prom_query_input_device(void); | ||
155 | |||
156 | /* Query for output device type */ | ||
157 | |||
158 | enum prom_output_device { | ||
159 | PROMDEV_OSCREEN, /* to screen */ | ||
160 | PROMDEV_OTTYA, /* to ttya */ | ||
161 | PROMDEV_OTTYB, /* to ttyb */ | ||
162 | PROMDEV_ORSC, /* to rsc */ | ||
163 | PROMDEV_OVCONS, /* to virtual-console */ | ||
164 | PROMDEV_O_UNK, | ||
165 | }; | ||
166 | |||
167 | extern enum prom_output_device prom_query_output_device(void); | ||
168 | |||
169 | /* Multiprocessor operations... */ | 144 | /* Multiprocessor operations... */ |
170 | #ifdef CONFIG_SMP | 145 | #ifdef CONFIG_SMP |
171 | /* Start the CPU with the given device tree node at the passed program | 146 | /* Start the CPU with the given device tree node at the passed program |
@@ -319,12 +294,10 @@ extern int prom_inst2pkg(int); | |||
319 | extern int prom_service_exists(const char *service_name); | 294 | extern int prom_service_exists(const char *service_name); |
320 | extern void prom_sun4v_guest_soft_state(void); | 295 | extern void prom_sun4v_guest_soft_state(void); |
321 | 296 | ||
322 | /* Client interface level routines. */ | 297 | extern int prom_ihandle2path(int handle, char *buffer, int bufsize); |
323 | extern void prom_set_trap_table(unsigned long tba); | ||
324 | extern void prom_set_trap_table_sun4v(unsigned long tba, unsigned long mmfsa); | ||
325 | 298 | ||
299 | /* Client interface level routines. */ | ||
326 | extern long p1275_cmd(const char *, long, ...); | 300 | extern long p1275_cmd(const char *, long, ...); |
327 | |||
328 | 301 | ||
329 | #if 0 | 302 | #if 0 |
330 | #define P1275_SIZE(x) ((((long)((x) / 32)) << 32) | (x)) | 303 | #define P1275_SIZE(x) ((((long)((x) / 32)) << 32) | (x)) |
diff --git a/include/asm-sparc64/parport.h b/include/asm-sparc64/parport.h index 23cc63f049a8..8116e8f6062c 100644 --- a/include/asm-sparc64/parport.h +++ b/include/asm-sparc64/parport.h | |||
@@ -8,8 +8,9 @@ | |||
8 | #define _ASM_SPARC64_PARPORT_H 1 | 8 | #define _ASM_SPARC64_PARPORT_H 1 |
9 | 9 | ||
10 | #include <asm/ebus.h> | 10 | #include <asm/ebus.h> |
11 | #include <asm/isa.h> | ||
12 | #include <asm/ns87303.h> | 11 | #include <asm/ns87303.h> |
12 | #include <asm/of_device.h> | ||
13 | #include <asm/prom.h> | ||
13 | 14 | ||
14 | #define PARPORT_PC_MAX_PORTS PARPORT_MAX | 15 | #define PARPORT_PC_MAX_PORTS PARPORT_MAX |
15 | 16 | ||
@@ -35,8 +36,12 @@ static struct sparc_ebus_info { | |||
35 | unsigned int addr; | 36 | unsigned int addr; |
36 | unsigned int count; | 37 | unsigned int count; |
37 | int lock; | 38 | int lock; |
39 | |||
40 | struct parport *port; | ||
38 | } sparc_ebus_dmas[PARPORT_PC_MAX_PORTS]; | 41 | } sparc_ebus_dmas[PARPORT_PC_MAX_PORTS]; |
39 | 42 | ||
43 | static DECLARE_BITMAP(dma_slot_map, PARPORT_PC_MAX_PORTS); | ||
44 | |||
40 | static __inline__ int request_dma(unsigned int dmanr, const char *device_id) | 45 | static __inline__ int request_dma(unsigned int dmanr, const char *device_id) |
41 | { | 46 | { |
42 | if (dmanr >= PARPORT_PC_MAX_PORTS) | 47 | if (dmanr >= PARPORT_PC_MAX_PORTS) |
@@ -98,117 +103,145 @@ static __inline__ unsigned int get_dma_residue(unsigned int dmanr) | |||
98 | return ebus_dma_residue(&sparc_ebus_dmas[dmanr].info); | 103 | return ebus_dma_residue(&sparc_ebus_dmas[dmanr].info); |
99 | } | 104 | } |
100 | 105 | ||
101 | static int ebus_ecpp_p(struct linux_ebus_device *edev) | 106 | static int __devinit ecpp_probe(struct of_device *op, const struct of_device_id *match) |
102 | { | 107 | { |
103 | if (!strcmp(edev->prom_node->name, "ecpp")) | 108 | unsigned long base = op->resource[0].start; |
104 | return 1; | 109 | unsigned long config = op->resource[1].start; |
105 | if (!strcmp(edev->prom_node->name, "parallel")) { | 110 | unsigned long d_base = op->resource[2].start; |
106 | const char *compat; | 111 | unsigned long d_len; |
107 | 112 | struct device_node *parent; | |
108 | compat = of_get_property(edev->prom_node, | 113 | struct parport *p; |
109 | "compatible", NULL); | 114 | int slot, err; |
110 | if (compat && | 115 | |
111 | (!strcmp(compat, "ecpp") || | 116 | parent = op->node->parent; |
112 | !strcmp(compat, "ns87317-ecpp") || | 117 | if (!strcmp(parent->name, "dma")) { |
113 | !strcmp(compat + 13, "ecpp"))) | 118 | p = parport_pc_probe_port(base, base + 0x400, |
114 | return 1; | 119 | op->irqs[0], PARPORT_DMA_NOFIFO, |
120 | op->dev.parent->parent); | ||
121 | if (!p) | ||
122 | return -ENOMEM; | ||
123 | dev_set_drvdata(&op->dev, p); | ||
124 | return 0; | ||
115 | } | 125 | } |
126 | |||
127 | for (slot = 0; slot < PARPORT_PC_MAX_PORTS; slot++) { | ||
128 | if (!test_and_set_bit(slot, dma_slot_map)) | ||
129 | break; | ||
130 | } | ||
131 | err = -ENODEV; | ||
132 | if (slot >= PARPORT_PC_MAX_PORTS) | ||
133 | goto out_err; | ||
134 | |||
135 | spin_lock_init(&sparc_ebus_dmas[slot].info.lock); | ||
136 | |||
137 | d_len = (op->resource[2].end - d_base) + 1UL; | ||
138 | sparc_ebus_dmas[slot].info.regs = | ||
139 | of_ioremap(&op->resource[2], 0, d_len, "ECPP DMA"); | ||
140 | |||
141 | if (!sparc_ebus_dmas[slot].info.regs) | ||
142 | goto out_clear_map; | ||
143 | |||
144 | sparc_ebus_dmas[slot].info.flags = 0; | ||
145 | sparc_ebus_dmas[slot].info.callback = NULL; | ||
146 | sparc_ebus_dmas[slot].info.client_cookie = NULL; | ||
147 | sparc_ebus_dmas[slot].info.irq = 0xdeadbeef; | ||
148 | strcpy(sparc_ebus_dmas[slot].info.name, "parport"); | ||
149 | if (ebus_dma_register(&sparc_ebus_dmas[slot].info)) | ||
150 | goto out_unmap_regs; | ||
151 | |||
152 | ebus_dma_irq_enable(&sparc_ebus_dmas[slot].info, 1); | ||
153 | |||
154 | /* Configure IRQ to Push Pull, Level Low */ | ||
155 | /* Enable ECP, set bit 2 of the CTR first */ | ||
156 | outb(0x04, base + 0x02); | ||
157 | ns87303_modify(config, PCR, | ||
158 | PCR_EPP_ENABLE | | ||
159 | PCR_IRQ_ODRAIN, | ||
160 | PCR_ECP_ENABLE | | ||
161 | PCR_ECP_CLK_ENA | | ||
162 | PCR_IRQ_POLAR); | ||
163 | |||
164 | /* CTR bit 5 controls direction of port */ | ||
165 | ns87303_modify(config, PTR, | ||
166 | 0, PTR_LPT_REG_DIR); | ||
167 | |||
168 | p = parport_pc_probe_port(base, base + 0x400, | ||
169 | op->irqs[0], | ||
170 | slot, | ||
171 | op->dev.parent); | ||
172 | err = -ENOMEM; | ||
173 | if (!p) | ||
174 | goto out_disable_irq; | ||
175 | |||
176 | dev_set_drvdata(&op->dev, p); | ||
177 | |||
116 | return 0; | 178 | return 0; |
179 | |||
180 | out_disable_irq: | ||
181 | ebus_dma_irq_enable(&sparc_ebus_dmas[slot].info, 0); | ||
182 | ebus_dma_unregister(&sparc_ebus_dmas[slot].info); | ||
183 | |||
184 | out_unmap_regs: | ||
185 | of_iounmap(&op->resource[2], sparc_ebus_dmas[slot].info.regs, d_len); | ||
186 | |||
187 | out_clear_map: | ||
188 | clear_bit(slot, dma_slot_map); | ||
189 | |||
190 | out_err: | ||
191 | return err; | ||
117 | } | 192 | } |
118 | 193 | ||
119 | static int parport_isa_probe(int count) | 194 | static int __devexit ecpp_remove(struct of_device *op) |
120 | { | 195 | { |
121 | struct sparc_isa_bridge *isa_br; | 196 | struct parport *p = dev_get_drvdata(&op->dev); |
122 | struct sparc_isa_device *isa_dev; | 197 | int slot = p->dma; |
123 | 198 | ||
124 | for_each_isa(isa_br) { | 199 | parport_pc_unregister_port(p); |
125 | for_each_isadev(isa_dev, isa_br) { | 200 | |
126 | struct sparc_isa_device *child; | 201 | if (slot != PARPORT_DMA_NOFIFO) { |
127 | unsigned long base; | 202 | unsigned long d_base = op->resource[2].start; |
128 | 203 | unsigned long d_len; | |
129 | if (strcmp(isa_dev->prom_node->name, "dma")) | 204 | |
130 | continue; | 205 | d_len = (op->resource[2].end - d_base) + 1UL; |
131 | 206 | ||
132 | child = isa_dev->child; | 207 | ebus_dma_irq_enable(&sparc_ebus_dmas[slot].info, 0); |
133 | while (child) { | 208 | ebus_dma_unregister(&sparc_ebus_dmas[slot].info); |
134 | if (!strcmp(child->prom_node->name, "parallel")) | 209 | of_iounmap(&op->resource[2], |
135 | break; | 210 | sparc_ebus_dmas[slot].info.regs, |
136 | child = child->next; | 211 | d_len); |
137 | } | 212 | clear_bit(slot, dma_slot_map); |
138 | if (!child) | ||
139 | continue; | ||
140 | |||
141 | base = child->resource.start; | ||
142 | |||
143 | /* No DMA, see commentary in | ||
144 | * asm-sparc64/floppy.h:isa_floppy_init() | ||
145 | */ | ||
146 | if (parport_pc_probe_port(base, base + 0x400, | ||
147 | child->irq, PARPORT_DMA_NOFIFO, | ||
148 | &child->bus->self->dev)) | ||
149 | count++; | ||
150 | } | ||
151 | } | 213 | } |
152 | 214 | ||
153 | return count; | 215 | return 0; |
154 | } | 216 | } |
155 | 217 | ||
156 | static int parport_pc_find_nonpci_ports (int autoirq, int autodma) | 218 | static struct of_device_id ecpp_match[] = { |
219 | { | ||
220 | .name = "ecpp", | ||
221 | }, | ||
222 | { | ||
223 | .name = "parallel", | ||
224 | .compatible = "ecpp", | ||
225 | }, | ||
226 | { | ||
227 | .name = "parallel", | ||
228 | .compatible = "ns87317-ecpp", | ||
229 | }, | ||
230 | {}, | ||
231 | }; | ||
232 | |||
233 | static struct of_platform_driver ecpp_driver = { | ||
234 | .name = "ecpp", | ||
235 | .match_table = ecpp_match, | ||
236 | .probe = ecpp_probe, | ||
237 | .remove = __devexit_p(ecpp_remove), | ||
238 | }; | ||
239 | |||
240 | static int parport_pc_find_nonpci_ports(int autoirq, int autodma) | ||
157 | { | 241 | { |
158 | struct linux_ebus *ebus; | 242 | of_register_driver(&ecpp_driver, &of_bus_type); |
159 | struct linux_ebus_device *edev; | ||
160 | int count = 0; | ||
161 | |||
162 | for_each_ebus(ebus) { | ||
163 | for_each_ebusdev(edev, ebus) { | ||
164 | if (ebus_ecpp_p(edev)) { | ||
165 | unsigned long base = edev->resource[0].start; | ||
166 | unsigned long config = edev->resource[1].start; | ||
167 | unsigned long d_base = edev->resource[2].start; | ||
168 | unsigned long d_len; | ||
169 | |||
170 | spin_lock_init(&sparc_ebus_dmas[count].info.lock); | ||
171 | d_len = (edev->resource[2].end - | ||
172 | d_base) + 1; | ||
173 | sparc_ebus_dmas[count].info.regs = | ||
174 | ioremap(d_base, d_len); | ||
175 | if (!sparc_ebus_dmas[count].info.regs) | ||
176 | continue; | ||
177 | sparc_ebus_dmas[count].info.flags = 0; | ||
178 | sparc_ebus_dmas[count].info.callback = NULL; | ||
179 | sparc_ebus_dmas[count].info.client_cookie = NULL; | ||
180 | sparc_ebus_dmas[count].info.irq = 0xdeadbeef; | ||
181 | strcpy(sparc_ebus_dmas[count].info.name, "parport"); | ||
182 | if (ebus_dma_register(&sparc_ebus_dmas[count].info)) | ||
183 | continue; | ||
184 | ebus_dma_irq_enable(&sparc_ebus_dmas[count].info, 1); | ||
185 | |||
186 | /* Configure IRQ to Push Pull, Level Low */ | ||
187 | /* Enable ECP, set bit 2 of the CTR first */ | ||
188 | outb(0x04, base + 0x02); | ||
189 | ns87303_modify(config, PCR, | ||
190 | PCR_EPP_ENABLE | | ||
191 | PCR_IRQ_ODRAIN, | ||
192 | PCR_ECP_ENABLE | | ||
193 | PCR_ECP_CLK_ENA | | ||
194 | PCR_IRQ_POLAR); | ||
195 | |||
196 | /* CTR bit 5 controls direction of port */ | ||
197 | ns87303_modify(config, PTR, | ||
198 | 0, PTR_LPT_REG_DIR); | ||
199 | |||
200 | if (parport_pc_probe_port(base, base + 0x400, | ||
201 | edev->irqs[0], | ||
202 | count, | ||
203 | &ebus->self->dev)) | ||
204 | count++; | ||
205 | } | ||
206 | } | ||
207 | } | ||
208 | 243 | ||
209 | count = parport_isa_probe(count); | 244 | return 0; |
210 | |||
211 | return count; | ||
212 | } | 245 | } |
213 | 246 | ||
214 | #endif /* !(_ASM_SPARC64_PARPORT_H */ | 247 | #endif /* !(_ASM_SPARC64_PARPORT_H */ |
diff --git a/include/asm-sparc64/pci.h b/include/asm-sparc64/pci.h index e11ac100f043..1393e57d50fb 100644 --- a/include/asm-sparc64/pci.h +++ b/include/asm-sparc64/pci.h | |||
@@ -3,8 +3,7 @@ | |||
3 | 3 | ||
4 | #ifdef __KERNEL__ | 4 | #ifdef __KERNEL__ |
5 | 5 | ||
6 | #include <linux/fs.h> | 6 | #include <linux/dma-mapping.h> |
7 | #include <linux/mm.h> | ||
8 | 7 | ||
9 | /* Can be used to override the logic in pci_scan_bus for skipping | 8 | /* Can be used to override the logic in pci_scan_bus for skipping |
10 | * already-configured bus numbers - to be used for buggy BIOSes | 9 | * already-configured bus numbers - to be used for buggy BIOSes |
@@ -30,80 +29,42 @@ static inline void pcibios_penalize_isa_irq(int irq, int active) | |||
30 | /* We don't do dynamic PCI IRQ allocation */ | 29 | /* We don't do dynamic PCI IRQ allocation */ |
31 | } | 30 | } |
32 | 31 | ||
33 | /* Dynamic DMA mapping stuff. | ||
34 | */ | ||
35 | |||
36 | /* The PCI address space does not equal the physical memory | 32 | /* The PCI address space does not equal the physical memory |
37 | * address space. The networking and block device layers use | 33 | * address space. The networking and block device layers use |
38 | * this boolean for bounce buffer decisions. | 34 | * this boolean for bounce buffer decisions. |
39 | */ | 35 | */ |
40 | #define PCI_DMA_BUS_IS_PHYS (0) | 36 | #define PCI_DMA_BUS_IS_PHYS (0) |
41 | 37 | ||
42 | #include <asm/scatterlist.h> | 38 | static inline void *pci_alloc_consistent(struct pci_dev *pdev, size_t size, |
43 | 39 | dma_addr_t *dma_handle) | |
44 | struct pci_dev; | ||
45 | |||
46 | struct pci_iommu_ops { | ||
47 | void *(*alloc_consistent)(struct pci_dev *, size_t, dma_addr_t *, gfp_t); | ||
48 | void (*free_consistent)(struct pci_dev *, size_t, void *, dma_addr_t); | ||
49 | dma_addr_t (*map_single)(struct pci_dev *, void *, size_t, int); | ||
50 | void (*unmap_single)(struct pci_dev *, dma_addr_t, size_t, int); | ||
51 | int (*map_sg)(struct pci_dev *, struct scatterlist *, int, int); | ||
52 | void (*unmap_sg)(struct pci_dev *, struct scatterlist *, int, int); | ||
53 | void (*dma_sync_single_for_cpu)(struct pci_dev *, dma_addr_t, size_t, int); | ||
54 | void (*dma_sync_sg_for_cpu)(struct pci_dev *, struct scatterlist *, int, int); | ||
55 | }; | ||
56 | |||
57 | extern const struct pci_iommu_ops *pci_iommu_ops; | ||
58 | |||
59 | /* Allocate and map kernel buffer using consistent mode DMA for a device. | ||
60 | * hwdev should be valid struct pci_dev pointer for PCI devices. | ||
61 | */ | ||
62 | static inline void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size, dma_addr_t *dma_handle) | ||
63 | { | 40 | { |
64 | return pci_iommu_ops->alloc_consistent(hwdev, size, dma_handle, GFP_ATOMIC); | 41 | return dma_alloc_coherent(&pdev->dev, size, dma_handle, GFP_ATOMIC); |
65 | } | 42 | } |
66 | 43 | ||
67 | /* Free and unmap a consistent DMA buffer. | 44 | static inline void pci_free_consistent(struct pci_dev *pdev, size_t size, |
68 | * cpu_addr is what was returned from pci_alloc_consistent, | 45 | void *vaddr, dma_addr_t dma_handle) |
69 | * size must be the same as what as passed into pci_alloc_consistent, | ||
70 | * and likewise dma_addr must be the same as what *dma_addrp was set to. | ||
71 | * | ||
72 | * References to the memory and mappings associated with cpu_addr/dma_addr | ||
73 | * past this call are illegal. | ||
74 | */ | ||
75 | static inline void pci_free_consistent(struct pci_dev *hwdev, size_t size, void *vaddr, dma_addr_t dma_handle) | ||
76 | { | 46 | { |
77 | return pci_iommu_ops->free_consistent(hwdev, size, vaddr, dma_handle); | 47 | return dma_free_coherent(&pdev->dev, size, vaddr, dma_handle); |
78 | } | 48 | } |
79 | 49 | ||
80 | /* Map a single buffer of the indicated size for DMA in streaming mode. | 50 | static inline dma_addr_t pci_map_single(struct pci_dev *pdev, void *ptr, |
81 | * The 32-bit bus address to use is returned. | 51 | size_t size, int direction) |
82 | * | ||
83 | * Once the device is given the dma address, the device owns this memory | ||
84 | * until either pci_unmap_single or pci_dma_sync_single_for_cpu is performed. | ||
85 | */ | ||
86 | static inline dma_addr_t pci_map_single(struct pci_dev *hwdev, void *ptr, size_t size, int direction) | ||
87 | { | 52 | { |
88 | return pci_iommu_ops->map_single(hwdev, ptr, size, direction); | 53 | return dma_map_single(&pdev->dev, ptr, size, |
54 | (enum dma_data_direction) direction); | ||
89 | } | 55 | } |
90 | 56 | ||
91 | /* Unmap a single streaming mode DMA translation. The dma_addr and size | 57 | static inline void pci_unmap_single(struct pci_dev *pdev, dma_addr_t dma_addr, |
92 | * must match what was provided for in a previous pci_map_single call. All | 58 | size_t size, int direction) |
93 | * other usages are undefined. | ||
94 | * | ||
95 | * After this call, reads by the cpu to the buffer are guaranteed to see | ||
96 | * whatever the device wrote there. | ||
97 | */ | ||
98 | static inline void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr, size_t size, int direction) | ||
99 | { | 59 | { |
100 | pci_iommu_ops->unmap_single(hwdev, dma_addr, size, direction); | 60 | dma_unmap_single(&pdev->dev, dma_addr, size, |
61 | (enum dma_data_direction) direction); | ||
101 | } | 62 | } |
102 | 63 | ||
103 | /* No highmem on sparc64, plus we have an IOMMU, so mapping pages is easy. */ | ||
104 | #define pci_map_page(dev, page, off, size, dir) \ | 64 | #define pci_map_page(dev, page, off, size, dir) \ |
105 | pci_map_single(dev, (page_address(page) + (off)), size, dir) | 65 | pci_map_single(dev, (page_address(page) + (off)), size, dir) |
106 | #define pci_unmap_page(dev,addr,sz,dir) pci_unmap_single(dev,addr,sz,dir) | 66 | #define pci_unmap_page(dev,addr,sz,dir) \ |
67 | pci_unmap_single(dev,addr,sz,dir) | ||
107 | 68 | ||
108 | /* pci_unmap_{single,page} is not a nop, thus... */ | 69 | /* pci_unmap_{single,page} is not a nop, thus... */ |
109 | #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \ | 70 | #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \ |
@@ -119,75 +80,48 @@ static inline void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr, | |||
119 | #define pci_unmap_len_set(PTR, LEN_NAME, VAL) \ | 80 | #define pci_unmap_len_set(PTR, LEN_NAME, VAL) \ |
120 | (((PTR)->LEN_NAME) = (VAL)) | 81 | (((PTR)->LEN_NAME) = (VAL)) |
121 | 82 | ||
122 | /* Map a set of buffers described by scatterlist in streaming | 83 | static inline int pci_map_sg(struct pci_dev *pdev, struct scatterlist *sg, |
123 | * mode for DMA. This is the scatter-gather version of the | 84 | int nents, int direction) |
124 | * above pci_map_single interface. Here the scatter gather list | ||
125 | * elements are each tagged with the appropriate dma address | ||
126 | * and length. They are obtained via sg_dma_{address,length}(SG). | ||
127 | * | ||
128 | * NOTE: An implementation may be able to use a smaller number of | ||
129 | * DMA address/length pairs than there are SG table elements. | ||
130 | * (for example via virtual mapping capabilities) | ||
131 | * The routine returns the number of addr/length pairs actually | ||
132 | * used, at most nents. | ||
133 | * | ||
134 | * Device ownership issues as mentioned above for pci_map_single are | ||
135 | * the same here. | ||
136 | */ | ||
137 | static inline int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nents, int direction) | ||
138 | { | 85 | { |
139 | return pci_iommu_ops->map_sg(hwdev, sg, nents, direction); | 86 | return dma_map_sg(&pdev->dev, sg, nents, |
87 | (enum dma_data_direction) direction); | ||
140 | } | 88 | } |
141 | 89 | ||
142 | /* Unmap a set of streaming mode DMA translations. | 90 | static inline void pci_unmap_sg(struct pci_dev *pdev, struct scatterlist *sg, |
143 | * Again, cpu read rules concerning calls here are the same as for | 91 | int nents, int direction) |
144 | * pci_unmap_single() above. | ||
145 | */ | ||
146 | static inline void pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nhwents, int direction) | ||
147 | { | 92 | { |
148 | pci_iommu_ops->unmap_sg(hwdev, sg, nhwents, direction); | 93 | dma_unmap_sg(&pdev->dev, sg, nents, |
94 | (enum dma_data_direction) direction); | ||
149 | } | 95 | } |
150 | 96 | ||
151 | /* Make physical memory consistent for a single | 97 | static inline void pci_dma_sync_single_for_cpu(struct pci_dev *pdev, |
152 | * streaming mode DMA translation after a transfer. | 98 | dma_addr_t dma_handle, |
153 | * | 99 | size_t size, int direction) |
154 | * If you perform a pci_map_single() but wish to interrogate the | ||
155 | * buffer using the cpu, yet do not wish to teardown the PCI dma | ||
156 | * mapping, you must call this function before doing so. At the | ||
157 | * next point you give the PCI dma address back to the card, you | ||
158 | * must first perform a pci_dma_sync_for_device, and then the | ||
159 | * device again owns the buffer. | ||
160 | */ | ||
161 | static inline void pci_dma_sync_single_for_cpu(struct pci_dev *hwdev, dma_addr_t dma_handle, size_t size, int direction) | ||
162 | { | 100 | { |
163 | pci_iommu_ops->dma_sync_single_for_cpu(hwdev, dma_handle, size, direction); | 101 | dma_sync_single_for_cpu(&pdev->dev, dma_handle, size, |
102 | (enum dma_data_direction) direction); | ||
164 | } | 103 | } |
165 | 104 | ||
166 | static inline void | 105 | static inline void pci_dma_sync_single_for_device(struct pci_dev *pdev, |
167 | pci_dma_sync_single_for_device(struct pci_dev *hwdev, dma_addr_t dma_handle, | 106 | dma_addr_t dma_handle, |
168 | size_t size, int direction) | 107 | size_t size, int direction) |
169 | { | 108 | { |
170 | /* No flushing needed to sync cpu writes to the device. */ | 109 | /* No flushing needed to sync cpu writes to the device. */ |
171 | BUG_ON(direction == PCI_DMA_NONE); | ||
172 | } | 110 | } |
173 | 111 | ||
174 | /* Make physical memory consistent for a set of streaming | 112 | static inline void pci_dma_sync_sg_for_cpu(struct pci_dev *pdev, |
175 | * mode DMA translations after a transfer. | 113 | struct scatterlist *sg, |
176 | * | 114 | int nents, int direction) |
177 | * The same as pci_dma_sync_single_* but for a scatter-gather list, | ||
178 | * same rules and usage. | ||
179 | */ | ||
180 | static inline void pci_dma_sync_sg_for_cpu(struct pci_dev *hwdev, struct scatterlist *sg, int nelems, int direction) | ||
181 | { | 115 | { |
182 | pci_iommu_ops->dma_sync_sg_for_cpu(hwdev, sg, nelems, direction); | 116 | dma_sync_sg_for_cpu(&pdev->dev, sg, nents, |
117 | (enum dma_data_direction) direction); | ||
183 | } | 118 | } |
184 | 119 | ||
185 | static inline void | 120 | static inline void pci_dma_sync_sg_for_device(struct pci_dev *pdev, |
186 | pci_dma_sync_sg_for_device(struct pci_dev *hwdev, struct scatterlist *sg, | 121 | struct scatterlist *sg, |
187 | int nelems, int direction) | 122 | int nelems, int direction) |
188 | { | 123 | { |
189 | /* No flushing needed to sync cpu writes to the device. */ | 124 | /* No flushing needed to sync cpu writes to the device. */ |
190 | BUG_ON(direction == PCI_DMA_NONE); | ||
191 | } | 125 | } |
192 | 126 | ||
193 | /* Return whether the given PCI device DMA address mask can | 127 | /* Return whether the given PCI device DMA address mask can |
@@ -206,11 +140,9 @@ extern int pci_dma_supported(struct pci_dev *hwdev, u64 mask); | |||
206 | #define PCI64_REQUIRED_MASK (~(dma64_addr_t)0) | 140 | #define PCI64_REQUIRED_MASK (~(dma64_addr_t)0) |
207 | #define PCI64_ADDR_BASE 0xfffc000000000000UL | 141 | #define PCI64_ADDR_BASE 0xfffc000000000000UL |
208 | 142 | ||
209 | #define PCI_DMA_ERROR_CODE (~(dma_addr_t)0x0) | ||
210 | |||
211 | static inline int pci_dma_mapping_error(dma_addr_t dma_addr) | 143 | static inline int pci_dma_mapping_error(dma_addr_t dma_addr) |
212 | { | 144 | { |
213 | return (dma_addr == PCI_DMA_ERROR_CODE); | 145 | return dma_mapping_error(dma_addr); |
214 | } | 146 | } |
215 | 147 | ||
216 | #ifdef CONFIG_PCI | 148 | #ifdef CONFIG_PCI |
diff --git a/include/asm-sparc64/percpu.h b/include/asm-sparc64/percpu.h index 88db872ce2f8..a1f53a4da405 100644 --- a/include/asm-sparc64/percpu.h +++ b/include/asm-sparc64/percpu.h | |||
@@ -3,6 +3,8 @@ | |||
3 | 3 | ||
4 | #include <linux/compiler.h> | 4 | #include <linux/compiler.h> |
5 | 5 | ||
6 | register unsigned long __local_per_cpu_offset asm("g5"); | ||
7 | |||
6 | #ifdef CONFIG_SMP | 8 | #ifdef CONFIG_SMP |
7 | 9 | ||
8 | #define setup_per_cpu_areas() do { } while (0) | 10 | #define setup_per_cpu_areas() do { } while (0) |
@@ -18,7 +20,10 @@ extern unsigned long __per_cpu_shift; | |||
18 | #define DEFINE_PER_CPU(type, name) \ | 20 | #define DEFINE_PER_CPU(type, name) \ |
19 | __attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name | 21 | __attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name |
20 | 22 | ||
21 | register unsigned long __local_per_cpu_offset asm("g5"); | 23 | #define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \ |
24 | __attribute__((__section__(".data.percpu.shared_aligned"))) \ | ||
25 | __typeof__(type) per_cpu__##name \ | ||
26 | ____cacheline_aligned_in_smp | ||
22 | 27 | ||
23 | /* var is in discarded region: offset to particular copy we want */ | 28 | /* var is in discarded region: offset to particular copy we want */ |
24 | #define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu))) | 29 | #define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu))) |
@@ -38,6 +43,8 @@ do { \ | |||
38 | #define real_setup_per_cpu_areas() do { } while (0) | 43 | #define real_setup_per_cpu_areas() do { } while (0) |
39 | #define DEFINE_PER_CPU(type, name) \ | 44 | #define DEFINE_PER_CPU(type, name) \ |
40 | __typeof__(type) per_cpu__##name | 45 | __typeof__(type) per_cpu__##name |
46 | #define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \ | ||
47 | DEFINE_PER_CPU(type, name) | ||
41 | 48 | ||
42 | #define per_cpu(var, cpu) (*((void)cpu, &per_cpu__##var)) | 49 | #define per_cpu(var, cpu) (*((void)cpu, &per_cpu__##var)) |
43 | #define __get_cpu_var(var) per_cpu__##var | 50 | #define __get_cpu_var(var) per_cpu__##var |
diff --git a/include/asm-sparc64/power.h b/include/asm-sparc64/power.h deleted file mode 100644 index 94495c1ac4f6..000000000000 --- a/include/asm-sparc64/power.h +++ /dev/null | |||
@@ -1,7 +0,0 @@ | |||
1 | #ifndef _SPARC64_POWER_H | ||
2 | #define _SPARC64_POWER_H | ||
3 | |||
4 | extern void wake_up_powerd(void); | ||
5 | extern int start_powerd(void); | ||
6 | |||
7 | #endif /* !(_SPARC64_POWER_H) */ | ||
diff --git a/include/asm-sparc64/prom.h b/include/asm-sparc64/prom.h index b4df3042add0..07843f9f05df 100644 --- a/include/asm-sparc64/prom.h +++ b/include/asm-sparc64/prom.h | |||
@@ -2,7 +2,6 @@ | |||
2 | #define _SPARC64_PROM_H | 2 | #define _SPARC64_PROM_H |
3 | #ifdef __KERNEL__ | 3 | #ifdef __KERNEL__ |
4 | 4 | ||
5 | |||
6 | /* | 5 | /* |
7 | * Definitions for talking to the Open Firmware PROM on | 6 | * Definitions for talking to the Open Firmware PROM on |
8 | * Power Macintosh computers. | 7 | * Power Macintosh computers. |
@@ -17,11 +16,17 @@ | |||
17 | * as published by the Free Software Foundation; either version | 16 | * as published by the Free Software Foundation; either version |
18 | * 2 of the License, or (at your option) any later version. | 17 | * 2 of the License, or (at your option) any later version. |
19 | */ | 18 | */ |
20 | |||
21 | #include <linux/types.h> | 19 | #include <linux/types.h> |
22 | #include <linux/proc_fs.h> | 20 | #include <linux/proc_fs.h> |
23 | #include <asm/atomic.h> | 21 | #include <asm/atomic.h> |
24 | 22 | ||
23 | #define OF_ROOT_NODE_ADDR_CELLS_DEFAULT 2 | ||
24 | #define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1 | ||
25 | |||
26 | #define of_compat_cmp(s1, s2, l) strncmp((s1), (s2), (l)) | ||
27 | #define of_prop_cmp(s1, s2) strcasecmp((s1), (s2)) | ||
28 | #define of_node_cmp(s1, s2) strcmp((s1), (s2)) | ||
29 | |||
25 | typedef u32 phandle; | 30 | typedef u32 phandle; |
26 | typedef u32 ihandle; | 31 | typedef u32 ihandle; |
27 | 32 | ||
@@ -63,54 +68,36 @@ struct of_irq_controller { | |||
63 | void *data; | 68 | void *data; |
64 | }; | 69 | }; |
65 | 70 | ||
66 | /* flag descriptions */ | ||
67 | #define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */ | ||
68 | |||
69 | #define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags) | 71 | #define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags) |
70 | #define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags) | 72 | #define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags) |
71 | 73 | ||
72 | #define OF_BAD_ADDR ((u64)-1) | ||
73 | |||
74 | static inline void set_node_proc_entry(struct device_node *dn, struct proc_dir_entry *de) | ||
75 | { | ||
76 | dn->pde = de; | ||
77 | } | ||
78 | |||
79 | extern struct device_node *of_find_node_by_name(struct device_node *from, | ||
80 | const char *name); | ||
81 | #define for_each_node_by_name(dn, name) \ | ||
82 | for (dn = of_find_node_by_name(NULL, name); dn; \ | ||
83 | dn = of_find_node_by_name(dn, name)) | ||
84 | extern struct device_node *of_find_node_by_type(struct device_node *from, | ||
85 | const char *type); | ||
86 | #define for_each_node_by_type(dn, type) \ | ||
87 | for (dn = of_find_node_by_type(NULL, type); dn; \ | ||
88 | dn = of_find_node_by_type(dn, type)) | ||
89 | extern struct device_node *of_find_compatible_node(struct device_node *from, | ||
90 | const char *type, const char *compat); | ||
91 | extern struct device_node *of_find_node_by_path(const char *path); | ||
92 | extern struct device_node *of_find_node_by_phandle(phandle handle); | ||
93 | extern struct device_node *of_find_node_by_cpuid(int cpuid); | 74 | extern struct device_node *of_find_node_by_cpuid(int cpuid); |
94 | extern struct device_node *of_get_parent(const struct device_node *node); | ||
95 | extern struct device_node *of_get_next_child(const struct device_node *node, | ||
96 | struct device_node *prev); | ||
97 | extern struct property *of_find_property(const struct device_node *np, | ||
98 | const char *name, | ||
99 | int *lenp); | ||
100 | extern int of_device_is_compatible(const struct device_node *device, | ||
101 | const char *); | ||
102 | extern const void *of_get_property(const struct device_node *node, | ||
103 | const char *name, | ||
104 | int *lenp); | ||
105 | #define get_property(node,name,lenp) of_get_property(node,name,lenp) | ||
106 | extern int of_set_property(struct device_node *node, const char *name, void *val, int len); | 75 | extern int of_set_property(struct device_node *node, const char *name, void *val, int len); |
107 | extern int of_getintprop_default(struct device_node *np, | 76 | extern int of_getintprop_default(struct device_node *np, |
108 | const char *name, | 77 | const char *name, |
109 | int def); | 78 | int def); |
110 | extern int of_n_addr_cells(struct device_node *np); | 79 | extern int of_find_in_proplist(const char *list, const char *match, int len); |
111 | extern int of_n_size_cells(struct device_node *np); | ||
112 | 80 | ||
113 | extern void prom_build_devicetree(void); | 81 | extern void prom_build_devicetree(void); |
114 | 82 | ||
83 | /* Dummy ref counting routines - to be implemented later */ | ||
84 | static inline struct device_node *of_node_get(struct device_node *node) | ||
85 | { | ||
86 | return node; | ||
87 | } | ||
88 | static inline void of_node_put(struct device_node *node) | ||
89 | { | ||
90 | } | ||
91 | |||
92 | /* | ||
93 | * NB: This is here while we transition from using asm/prom.h | ||
94 | * to linux/of.h | ||
95 | */ | ||
96 | #include <linux/of.h> | ||
97 | |||
98 | extern struct device_node *of_console_device; | ||
99 | extern char *of_console_path; | ||
100 | extern char *of_console_options; | ||
101 | |||
115 | #endif /* __KERNEL__ */ | 102 | #endif /* __KERNEL__ */ |
116 | #endif /* _SPARC64_PROM_H */ | 103 | #endif /* _SPARC64_PROM_H */ |
diff --git a/include/asm-sparc64/sbus.h b/include/asm-sparc64/sbus.h index 7efd49d31bb8..0151cad486f3 100644 --- a/include/asm-sparc64/sbus.h +++ b/include/asm-sparc64/sbus.h | |||
@@ -1,7 +1,6 @@ | |||
1 | /* $Id: sbus.h,v 1.14 2000/02/18 13:50:55 davem Exp $ | 1 | /* sbus.h: Defines for the Sun SBus. |
2 | * sbus.h: Defines for the Sun SBus. | ||
3 | * | 2 | * |
4 | * Copyright (C) 1996, 1999 David S. Miller (davem@redhat.com) | 3 | * Copyright (C) 1996, 1999, 2007 David S. Miller (davem@davemloft.net) |
5 | */ | 4 | */ |
6 | 5 | ||
7 | #ifndef _SPARC64_SBUS_H | 6 | #ifndef _SPARC64_SBUS_H |
@@ -69,7 +68,6 @@ struct sbus_dev { | |||
69 | /* This struct describes the SBus(s) found on this machine. */ | 68 | /* This struct describes the SBus(s) found on this machine. */ |
70 | struct sbus_bus { | 69 | struct sbus_bus { |
71 | struct of_device ofdev; | 70 | struct of_device ofdev; |
72 | void *iommu; /* Opaque IOMMU cookie */ | ||
73 | struct sbus_dev *devices; /* Tree of SBUS devices */ | 71 | struct sbus_dev *devices; /* Tree of SBUS devices */ |
74 | struct sbus_bus *next; /* Next SBUS in system */ | 72 | struct sbus_bus *next; /* Next SBUS in system */ |
75 | int prom_node; /* OBP node of SBUS */ | 73 | int prom_node; /* OBP node of SBUS */ |
@@ -102,9 +100,18 @@ extern struct sbus_bus *sbus_root; | |||
102 | extern void sbus_set_sbus64(struct sbus_dev *, int); | 100 | extern void sbus_set_sbus64(struct sbus_dev *, int); |
103 | extern void sbus_fill_device_irq(struct sbus_dev *); | 101 | extern void sbus_fill_device_irq(struct sbus_dev *); |
104 | 102 | ||
105 | /* These yield IOMMU mappings in consistent mode. */ | 103 | static inline void *sbus_alloc_consistent(struct sbus_dev *sdev , size_t size, |
106 | extern void *sbus_alloc_consistent(struct sbus_dev *, size_t, dma_addr_t *dma_addrp); | 104 | dma_addr_t *dma_handle) |
107 | extern void sbus_free_consistent(struct sbus_dev *, size_t, void *, dma_addr_t); | 105 | { |
106 | return dma_alloc_coherent(&sdev->ofdev.dev, size, | ||
107 | dma_handle, GFP_ATOMIC); | ||
108 | } | ||
109 | |||
110 | static inline void sbus_free_consistent(struct sbus_dev *sdev, size_t size, | ||
111 | void *vaddr, dma_addr_t dma_handle) | ||
112 | { | ||
113 | return dma_free_coherent(&sdev->ofdev.dev, size, vaddr, dma_handle); | ||
114 | } | ||
108 | 115 | ||
109 | #define SBUS_DMA_BIDIRECTIONAL DMA_BIDIRECTIONAL | 116 | #define SBUS_DMA_BIDIRECTIONAL DMA_BIDIRECTIONAL |
110 | #define SBUS_DMA_TODEVICE DMA_TO_DEVICE | 117 | #define SBUS_DMA_TODEVICE DMA_TO_DEVICE |
@@ -112,18 +119,67 @@ extern void sbus_free_consistent(struct sbus_dev *, size_t, void *, dma_addr_t); | |||
112 | #define SBUS_DMA_NONE DMA_NONE | 119 | #define SBUS_DMA_NONE DMA_NONE |
113 | 120 | ||
114 | /* All the rest use streaming mode mappings. */ | 121 | /* All the rest use streaming mode mappings. */ |
115 | extern dma_addr_t sbus_map_single(struct sbus_dev *, void *, size_t, int); | 122 | static inline dma_addr_t sbus_map_single(struct sbus_dev *sdev, void *ptr, |
116 | extern void sbus_unmap_single(struct sbus_dev *, dma_addr_t, size_t, int); | 123 | size_t size, int direction) |
117 | extern int sbus_map_sg(struct sbus_dev *, struct scatterlist *, int, int); | 124 | { |
118 | extern void sbus_unmap_sg(struct sbus_dev *, struct scatterlist *, int, int); | 125 | return dma_map_single(&sdev->ofdev.dev, ptr, size, |
126 | (enum dma_data_direction) direction); | ||
127 | } | ||
128 | |||
129 | static inline void sbus_unmap_single(struct sbus_dev *sdev, | ||
130 | dma_addr_t dma_addr, size_t size, | ||
131 | int direction) | ||
132 | { | ||
133 | dma_unmap_single(&sdev->ofdev.dev, dma_addr, size, | ||
134 | (enum dma_data_direction) direction); | ||
135 | } | ||
136 | |||
137 | static inline int sbus_map_sg(struct sbus_dev *sdev, struct scatterlist *sg, | ||
138 | int nents, int direction) | ||
139 | { | ||
140 | return dma_map_sg(&sdev->ofdev.dev, sg, nents, | ||
141 | (enum dma_data_direction) direction); | ||
142 | } | ||
143 | |||
144 | static inline void sbus_unmap_sg(struct sbus_dev *sdev, struct scatterlist *sg, | ||
145 | int nents, int direction) | ||
146 | { | ||
147 | dma_unmap_sg(&sdev->ofdev.dev, sg, nents, | ||
148 | (enum dma_data_direction) direction); | ||
149 | } | ||
119 | 150 | ||
120 | /* Finally, allow explicit synchronization of streamable mappings. */ | 151 | /* Finally, allow explicit synchronization of streamable mappings. */ |
121 | extern void sbus_dma_sync_single_for_cpu(struct sbus_dev *, dma_addr_t, size_t, int); | 152 | static inline void sbus_dma_sync_single_for_cpu(struct sbus_dev *sdev, |
153 | dma_addr_t dma_handle, | ||
154 | size_t size, int direction) | ||
155 | { | ||
156 | dma_sync_single_for_cpu(&sdev->ofdev.dev, dma_handle, size, | ||
157 | (enum dma_data_direction) direction); | ||
158 | } | ||
122 | #define sbus_dma_sync_single sbus_dma_sync_single_for_cpu | 159 | #define sbus_dma_sync_single sbus_dma_sync_single_for_cpu |
123 | extern void sbus_dma_sync_single_for_device(struct sbus_dev *, dma_addr_t, size_t, int); | 160 | |
124 | extern void sbus_dma_sync_sg_for_cpu(struct sbus_dev *, struct scatterlist *, int, int); | 161 | static inline void sbus_dma_sync_single_for_device(struct sbus_dev *sdev, |
162 | dma_addr_t dma_handle, | ||
163 | size_t size, int direction) | ||
164 | { | ||
165 | /* No flushing needed to sync cpu writes to the device. */ | ||
166 | } | ||
167 | |||
168 | static inline void sbus_dma_sync_sg_for_cpu(struct sbus_dev *sdev, | ||
169 | struct scatterlist *sg, | ||
170 | int nents, int direction) | ||
171 | { | ||
172 | dma_sync_sg_for_cpu(&sdev->ofdev.dev, sg, nents, | ||
173 | (enum dma_data_direction) direction); | ||
174 | } | ||
125 | #define sbus_dma_sync_sg sbus_dma_sync_sg_for_cpu | 175 | #define sbus_dma_sync_sg sbus_dma_sync_sg_for_cpu |
126 | extern void sbus_dma_sync_sg_for_device(struct sbus_dev *, struct scatterlist *, int, int); | 176 | |
177 | static inline void sbus_dma_sync_sg_for_device(struct sbus_dev *sdev, | ||
178 | struct scatterlist *sg, | ||
179 | int nents, int direction) | ||
180 | { | ||
181 | /* No flushing needed to sync cpu writes to the device. */ | ||
182 | } | ||
127 | 183 | ||
128 | extern void sbus_arch_bus_ranges_init(struct device_node *, struct sbus_bus *); | 184 | extern void sbus_arch_bus_ranges_init(struct device_node *, struct sbus_bus *); |
129 | extern void sbus_setup_iommu(struct sbus_bus *, struct device_node *); | 185 | extern void sbus_setup_iommu(struct sbus_bus *, struct device_node *); |
diff --git a/include/asm-sparc64/sfp-machine.h b/include/asm-sparc64/sfp-machine.h index 89d42431efb5..c9331b02d9c8 100644 --- a/include/asm-sparc64/sfp-machine.h +++ b/include/asm-sparc64/sfp-machine.h | |||
@@ -88,4 +88,6 @@ | |||
88 | 88 | ||
89 | #define FP_INHIBIT_RESULTS ((current_thread_info()->xfsr[0] >> 23) & _fex) | 89 | #define FP_INHIBIT_RESULTS ((current_thread_info()->xfsr[0] >> 23) & _fex) |
90 | 90 | ||
91 | #define FP_TRAPPING_EXCEPTIONS ((current_thread_info()->xfsr[0] >> 23) & 0x1f) | ||
92 | |||
91 | #endif | 93 | #endif |
diff --git a/include/asm-sparc64/spitfire.h b/include/asm-sparc64/spitfire.h index 23ad8a7987ad..cf7807813e85 100644 --- a/include/asm-sparc64/spitfire.h +++ b/include/asm-sparc64/spitfire.h | |||
@@ -38,6 +38,11 @@ | |||
38 | 38 | ||
39 | #define L1DCACHE_SIZE 0x4000 | 39 | #define L1DCACHE_SIZE 0x4000 |
40 | 40 | ||
41 | #define SUN4V_CHIP_INVALID 0x00 | ||
42 | #define SUN4V_CHIP_NIAGARA1 0x01 | ||
43 | #define SUN4V_CHIP_NIAGARA2 0x02 | ||
44 | #define SUN4V_CHIP_UNKNOWN 0xff | ||
45 | |||
41 | #ifndef __ASSEMBLY__ | 46 | #ifndef __ASSEMBLY__ |
42 | 47 | ||
43 | enum ultra_tlb_layout { | 48 | enum ultra_tlb_layout { |
@@ -49,6 +54,8 @@ enum ultra_tlb_layout { | |||
49 | 54 | ||
50 | extern enum ultra_tlb_layout tlb_type; | 55 | extern enum ultra_tlb_layout tlb_type; |
51 | 56 | ||
57 | extern int sun4v_chip_type; | ||
58 | |||
52 | extern int cheetah_pcache_forced_on; | 59 | extern int cheetah_pcache_forced_on; |
53 | extern void cheetah_enable_pcache(void); | 60 | extern void cheetah_enable_pcache(void); |
54 | 61 | ||
diff --git a/include/asm-sparc64/system.h b/include/asm-sparc64/system.h index 8ba380ec6daa..3f175fa7e6d2 100644 --- a/include/asm-sparc64/system.h +++ b/include/asm-sparc64/system.h | |||
@@ -115,14 +115,8 @@ do { __asm__ __volatile__("ba,pt %%xcc, 1f\n\t" \ | |||
115 | #ifndef __ASSEMBLY__ | 115 | #ifndef __ASSEMBLY__ |
116 | 116 | ||
117 | extern void sun_do_break(void); | 117 | extern void sun_do_break(void); |
118 | extern int serial_console; | ||
119 | extern int stop_a_enabled; | 118 | extern int stop_a_enabled; |
120 | 119 | ||
121 | static __inline__ int con_is_present(void) | ||
122 | { | ||
123 | return serial_console ? 0 : 1; | ||
124 | } | ||
125 | |||
126 | extern void synchronize_user_stack(void); | 120 | extern void synchronize_user_stack(void); |
127 | 121 | ||
128 | extern void __flushw_user(void); | 122 | extern void __flushw_user(void); |
@@ -147,7 +141,6 @@ do { \ | |||
147 | * not preserve it's value. Hairy, but it lets us remove 2 loads | 141 | * not preserve it's value. Hairy, but it lets us remove 2 loads |
148 | * and 2 stores in this critical code path. -DaveM | 142 | * and 2 stores in this critical code path. -DaveM |
149 | */ | 143 | */ |
150 | #define EXTRA_CLOBBER ,"%l1" | ||
151 | #define switch_to(prev, next, last) \ | 144 | #define switch_to(prev, next, last) \ |
152 | do { if (test_thread_flag(TIF_PERFCTR)) { \ | 145 | do { if (test_thread_flag(TIF_PERFCTR)) { \ |
153 | unsigned long __tmp; \ | 146 | unsigned long __tmp; \ |
@@ -170,33 +163,34 @@ do { if (test_thread_flag(TIF_PERFCTR)) { \ | |||
170 | "stx %%i6, [%%sp + 2047 + 0x70]\n\t" \ | 163 | "stx %%i6, [%%sp + 2047 + 0x70]\n\t" \ |
171 | "stx %%i7, [%%sp + 2047 + 0x78]\n\t" \ | 164 | "stx %%i7, [%%sp + 2047 + 0x78]\n\t" \ |
172 | "rdpr %%wstate, %%o5\n\t" \ | 165 | "rdpr %%wstate, %%o5\n\t" \ |
173 | "stx %%o6, [%%g6 + %3]\n\t" \ | 166 | "stx %%o6, [%%g6 + %6]\n\t" \ |
174 | "stb %%o5, [%%g6 + %2]\n\t" \ | ||
175 | "rdpr %%cwp, %%o5\n\t" \ | ||
176 | "stb %%o5, [%%g6 + %5]\n\t" \ | 167 | "stb %%o5, [%%g6 + %5]\n\t" \ |
177 | "mov %1, %%g6\n\t" \ | 168 | "rdpr %%cwp, %%o5\n\t" \ |
178 | "ldub [%1 + %5], %%g1\n\t" \ | 169 | "stb %%o5, [%%g6 + %8]\n\t" \ |
170 | "mov %4, %%g6\n\t" \ | ||
171 | "ldub [%4 + %8], %%g1\n\t" \ | ||
179 | "wrpr %%g1, %%cwp\n\t" \ | 172 | "wrpr %%g1, %%cwp\n\t" \ |
180 | "ldx [%%g6 + %3], %%o6\n\t" \ | 173 | "ldx [%%g6 + %6], %%o6\n\t" \ |
181 | "ldub [%%g6 + %2], %%o5\n\t" \ | 174 | "ldub [%%g6 + %5], %%o5\n\t" \ |
182 | "ldub [%%g6 + %4], %%o7\n\t" \ | 175 | "ldub [%%g6 + %7], %%o7\n\t" \ |
183 | "wrpr %%o5, 0x0, %%wstate\n\t" \ | 176 | "wrpr %%o5, 0x0, %%wstate\n\t" \ |
184 | "ldx [%%sp + 2047 + 0x70], %%i6\n\t" \ | 177 | "ldx [%%sp + 2047 + 0x70], %%i6\n\t" \ |
185 | "ldx [%%sp + 2047 + 0x78], %%i7\n\t" \ | 178 | "ldx [%%sp + 2047 + 0x78], %%i7\n\t" \ |
186 | "ldx [%%g6 + %6], %%g4\n\t" \ | 179 | "ldx [%%g6 + %9], %%g4\n\t" \ |
187 | "brz,pt %%o7, 1f\n\t" \ | 180 | "brz,pt %%o7, 1f\n\t" \ |
188 | " mov %%g7, %0\n\t" \ | 181 | " mov %%g7, %0\n\t" \ |
189 | "b,a ret_from_syscall\n\t" \ | 182 | "b,a ret_from_syscall\n\t" \ |
190 | "1:\n\t" \ | 183 | "1:\n\t" \ |
191 | : "=&r" (last) \ | 184 | : "=&r" (last), "=r" (current), "=r" (current_thread_info_reg), \ |
185 | "=r" (__local_per_cpu_offset) \ | ||
192 | : "0" (task_thread_info(next)), \ | 186 | : "0" (task_thread_info(next)), \ |
193 | "i" (TI_WSTATE), "i" (TI_KSP), "i" (TI_NEW_CHILD), \ | 187 | "i" (TI_WSTATE), "i" (TI_KSP), "i" (TI_NEW_CHILD), \ |
194 | "i" (TI_CWP), "i" (TI_TASK) \ | 188 | "i" (TI_CWP), "i" (TI_TASK) \ |
195 | : "cc", \ | 189 | : "cc", \ |
196 | "g1", "g2", "g3", "g7", \ | 190 | "g1", "g2", "g3", "g7", \ |
197 | "l2", "l3", "l4", "l5", "l6", "l7", \ | 191 | "l1", "l2", "l3", "l4", "l5", "l6", "l7", \ |
198 | "i0", "i1", "i2", "i3", "i4", "i5", \ | 192 | "i0", "i1", "i2", "i3", "i4", "i5", \ |
199 | "o0", "o1", "o2", "o3", "o4", "o5", "o7" EXTRA_CLOBBER);\ | 193 | "o0", "o1", "o2", "o3", "o4", "o5", "o7"); \ |
200 | /* If you fuck with this, update ret_from_syscall code too. */ \ | 194 | /* If you fuck with this, update ret_from_syscall code too. */ \ |
201 | if (test_thread_flag(TIF_PERFCTR)) { \ | 195 | if (test_thread_flag(TIF_PERFCTR)) { \ |
202 | write_pcr(current_thread_info()->pcr_reg); \ | 196 | write_pcr(current_thread_info()->pcr_reg); \ |
@@ -204,16 +198,6 @@ do { if (test_thread_flag(TIF_PERFCTR)) { \ | |||
204 | } \ | 198 | } \ |
205 | } while(0) | 199 | } while(0) |
206 | 200 | ||
207 | /* | ||
208 | * On SMP systems, when the scheduler does migration-cost autodetection, | ||
209 | * it needs a way to flush as much of the CPU's caches as possible. | ||
210 | * | ||
211 | * TODO: fill this in! | ||
212 | */ | ||
213 | static inline void sched_cacheflush(void) | ||
214 | { | ||
215 | } | ||
216 | |||
217 | static inline unsigned long xchg32(__volatile__ unsigned int *m, unsigned int val) | 201 | static inline unsigned long xchg32(__volatile__ unsigned int *m, unsigned int val) |
218 | { | 202 | { |
219 | unsigned long tmp1, tmp2; | 203 | unsigned long tmp1, tmp2; |
diff --git a/include/asm-sparc64/unistd.h b/include/asm-sparc64/unistd.h index 53e96ed9c024..cb751b4d0f56 100644 --- a/include/asm-sparc64/unistd.h +++ b/include/asm-sparc64/unistd.h | |||
@@ -1,4 +1,3 @@ | |||
1 | /* $Id: unistd.h,v 1.50 2002/02/08 03:57:18 davem Exp $ */ | ||
2 | #ifndef _SPARC64_UNISTD_H | 1 | #ifndef _SPARC64_UNISTD_H |
3 | #define _SPARC64_UNISTD_H | 2 | #define _SPARC64_UNISTD_H |
4 | 3 | ||
@@ -9,7 +8,7 @@ | |||
9 | * think of right now to force the arguments into fixed registers | 8 | * think of right now to force the arguments into fixed registers |
10 | * before the trap into the system call with gcc 'asm' statements. | 9 | * before the trap into the system call with gcc 'asm' statements. |
11 | * | 10 | * |
12 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | 11 | * Copyright (C) 1995, 2007 David S. Miller (davem@davemloft.net) |
13 | * | 12 | * |
14 | * SunOS compatibility based upon preliminary work which is: | 13 | * SunOS compatibility based upon preliminary work which is: |
15 | * | 14 | * |
@@ -332,8 +331,9 @@ | |||
332 | #define __NR_signalfd 311 | 331 | #define __NR_signalfd 311 |
333 | #define __NR_timerfd 312 | 332 | #define __NR_timerfd 312 |
334 | #define __NR_eventfd 313 | 333 | #define __NR_eventfd 313 |
334 | #define __NR_fallocate 314 | ||
335 | 335 | ||
336 | #define NR_SYSCALLS 314 | 336 | #define NR_SYSCALLS 315 |
337 | 337 | ||
338 | #ifdef __KERNEL__ | 338 | #ifdef __KERNEL__ |
339 | /* sysconf options, for SunOS compatibility */ | 339 | /* sysconf options, for SunOS compatibility */ |
diff --git a/include/asm-sparc64/vio.h b/include/asm-sparc64/vio.h index 83c96422e9d6..f7417e91b170 100644 --- a/include/asm-sparc64/vio.h +++ b/include/asm-sparc64/vio.h | |||
@@ -264,7 +264,7 @@ static inline u32 vio_dring_avail(struct vio_dring_state *dr, | |||
264 | ((dr->prod - dr->cons) & (ring_size - 1))); | 264 | ((dr->prod - dr->cons) & (ring_size - 1))); |
265 | } | 265 | } |
266 | 266 | ||
267 | #define VIO_MAX_TYPE_LEN 64 | 267 | #define VIO_MAX_TYPE_LEN 32 |
268 | #define VIO_MAX_COMPAT_LEN 64 | 268 | #define VIO_MAX_COMPAT_LEN 64 |
269 | 269 | ||
270 | struct vio_dev { | 270 | struct vio_dev { |
@@ -275,6 +275,8 @@ struct vio_dev { | |||
275 | char compat[VIO_MAX_COMPAT_LEN]; | 275 | char compat[VIO_MAX_COMPAT_LEN]; |
276 | int compat_len; | 276 | int compat_len; |
277 | 277 | ||
278 | u64 dev_no; | ||
279 | |||
278 | unsigned long channel_id; | 280 | unsigned long channel_id; |
279 | 281 | ||
280 | unsigned int tx_irq; | 282 | unsigned int tx_irq; |
diff --git a/include/asm-sparc64/xor.h b/include/asm-sparc64/xor.h index 8ce3f1813e28..a0233884fc94 100644 --- a/include/asm-sparc64/xor.h +++ b/include/asm-sparc64/xor.h | |||
@@ -63,4 +63,8 @@ static struct xor_block_template xor_block_niagara = { | |||
63 | 63 | ||
64 | /* For VIS for everything except Niagara. */ | 64 | /* For VIS for everything except Niagara. */ |
65 | #define XOR_SELECT_TEMPLATE(FASTEST) \ | 65 | #define XOR_SELECT_TEMPLATE(FASTEST) \ |
66 | (tlb_type == hypervisor ? &xor_block_niagara : &xor_block_VIS) | 66 | ((tlb_type == hypervisor && \ |
67 | (sun4v_chip_type == SUN4V_CHIP_NIAGARA1 || \ | ||
68 | sun4v_chip_type == SUN4V_CHIP_NIAGARA2)) ? \ | ||
69 | &xor_block_niagara : \ | ||
70 | &xor_block_VIS) | ||