aboutsummaryrefslogtreecommitdiffstats
path: root/arch/alpha
diff options
context:
space:
mode:
Diffstat (limited to 'arch/alpha')
-rw-r--r--arch/alpha/Kconfig4
-rw-r--r--arch/alpha/boot/bootp.c1
-rw-r--r--arch/alpha/boot/bootpz.c1
-rw-r--r--arch/alpha/boot/main.c1
-rw-r--r--arch/alpha/boot/misc.c1
-rw-r--r--arch/alpha/include/asm/atomic.h4
-rw-r--r--arch/alpha/include/asm/bitops.h18
-rw-r--r--arch/alpha/include/asm/core_marvel.h1
-rw-r--r--arch/alpha/include/asm/core_mcpcia.h1
-rw-r--r--arch/alpha/include/asm/core_titan.h1
-rw-r--r--arch/alpha/include/asm/core_tsunami.h1
-rw-r--r--arch/alpha/include/asm/dma-mapping.h80
-rw-r--r--arch/alpha/include/asm/pci.h139
-rw-r--r--arch/alpha/include/asm/ptrace.h1
-rw-r--r--arch/alpha/kernel/irq.c1
-rw-r--r--arch/alpha/kernel/osf_sys.c2
-rw-r--r--arch/alpha/kernel/pci-noop.c102
-rw-r--r--arch/alpha/kernel/pci-sysfs.c1
-rw-r--r--arch/alpha/kernel/pci_iommu.c203
-rw-r--r--arch/alpha/kernel/process.c2
-rw-r--r--arch/alpha/kernel/ptrace.c60
-rw-r--r--arch/alpha/kernel/smc37c669.c1
-rw-r--r--arch/alpha/kernel/smc37c93x.c1
-rw-r--r--arch/alpha/kernel/srm_env.c1
-rw-r--r--arch/alpha/kernel/sys_dp264.c2
-rw-r--r--arch/alpha/kernel/sys_titan.c2
-rw-r--r--arch/alpha/kernel/traps.c10
-rw-r--r--arch/alpha/mm/init.c1
28 files changed, 209 insertions, 434 deletions
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 75fff7e5a0db..b7193986cbf9 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -10,6 +10,7 @@ config ALPHA
10 select HAVE_OPROFILE 10 select HAVE_OPROFILE
11 select HAVE_SYSCALL_WRAPPERS 11 select HAVE_SYSCALL_WRAPPERS
12 select HAVE_PERF_EVENTS 12 select HAVE_PERF_EVENTS
13 select HAVE_DMA_ATTRS
13 help 14 help
14 The Alpha is a 64-bit general-purpose processor designed and 15 The Alpha is a 64-bit general-purpose processor designed and
15 marketed by the Digital Equipment Corporation of blessed memory, 16 marketed by the Digital Equipment Corporation of blessed memory,
@@ -61,6 +62,9 @@ config ZONE_DMA
61 bool 62 bool
62 default y 63 default y
63 64
65config NEED_DMA_MAP_STATE
66 def_bool y
67
64config GENERIC_ISA_DMA 68config GENERIC_ISA_DMA
65 bool 69 bool
66 default y 70 default y
diff --git a/arch/alpha/boot/bootp.c b/arch/alpha/boot/bootp.c
index 3c8d1b25c661..be61670d4096 100644
--- a/arch/alpha/boot/bootp.c
+++ b/arch/alpha/boot/bootp.c
@@ -8,6 +8,7 @@
8 * based significantly on the arch/alpha/boot/main.c of Linus Torvalds 8 * based significantly on the arch/alpha/boot/main.c of Linus Torvalds
9 */ 9 */
10#include <linux/kernel.h> 10#include <linux/kernel.h>
11#include <linux/slab.h>
11#include <linux/string.h> 12#include <linux/string.h>
12#include <generated/utsrelease.h> 13#include <generated/utsrelease.h>
13#include <linux/mm.h> 14#include <linux/mm.h>
diff --git a/arch/alpha/boot/bootpz.c b/arch/alpha/boot/bootpz.c
index ade3f129dc27..c98865f21423 100644
--- a/arch/alpha/boot/bootpz.c
+++ b/arch/alpha/boot/bootpz.c
@@ -10,6 +10,7 @@
10 * and the decompression code from MILO. 10 * and the decompression code from MILO.
11 */ 11 */
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/slab.h>
13#include <linux/string.h> 14#include <linux/string.h>
14#include <generated/utsrelease.h> 15#include <generated/utsrelease.h>
15#include <linux/mm.h> 16#include <linux/mm.h>
diff --git a/arch/alpha/boot/main.c b/arch/alpha/boot/main.c
index 644b7db55438..ded57d9a80e1 100644
--- a/arch/alpha/boot/main.c
+++ b/arch/alpha/boot/main.c
@@ -6,6 +6,7 @@
6 * This file is the bootloader for the Linux/AXP kernel 6 * This file is the bootloader for the Linux/AXP kernel
7 */ 7 */
8#include <linux/kernel.h> 8#include <linux/kernel.h>
9#include <linux/slab.h>
9#include <linux/string.h> 10#include <linux/string.h>
10#include <generated/utsrelease.h> 11#include <generated/utsrelease.h>
11#include <linux/mm.h> 12#include <linux/mm.h>
diff --git a/arch/alpha/boot/misc.c b/arch/alpha/boot/misc.c
index 3047a1b3a517..3ff9a957a25c 100644
--- a/arch/alpha/boot/misc.c
+++ b/arch/alpha/boot/misc.c
@@ -19,6 +19,7 @@
19 */ 19 */
20 20
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/slab.h>
22 23
23#include <asm/uaccess.h> 24#include <asm/uaccess.h>
24 25
diff --git a/arch/alpha/include/asm/atomic.h b/arch/alpha/include/asm/atomic.h
index 610dff44d94b..e756d04b6cd5 100644
--- a/arch/alpha/include/asm/atomic.h
+++ b/arch/alpha/include/asm/atomic.h
@@ -17,8 +17,8 @@
17#define ATOMIC_INIT(i) ( (atomic_t) { (i) } ) 17#define ATOMIC_INIT(i) ( (atomic_t) { (i) } )
18#define ATOMIC64_INIT(i) ( (atomic64_t) { (i) } ) 18#define ATOMIC64_INIT(i) ( (atomic64_t) { (i) } )
19 19
20#define atomic_read(v) ((v)->counter + 0) 20#define atomic_read(v) (*(volatile int *)&(v)->counter)
21#define atomic64_read(v) ((v)->counter + 0) 21#define atomic64_read(v) (*(volatile long *)&(v)->counter)
22 22
23#define atomic_set(v,i) ((v)->counter = (i)) 23#define atomic_set(v,i) ((v)->counter = (i))
24#define atomic64_set(v,i) ((v)->counter = (i)) 24#define atomic64_set(v,i) ((v)->counter = (i))
diff --git a/arch/alpha/include/asm/bitops.h b/arch/alpha/include/asm/bitops.h
index 15f3ae25c511..296da1d5ed57 100644
--- a/arch/alpha/include/asm/bitops.h
+++ b/arch/alpha/include/asm/bitops.h
@@ -405,29 +405,31 @@ static inline int fls(int x)
405 405
406#if defined(CONFIG_ALPHA_EV6) && defined(CONFIG_ALPHA_EV67) 406#if defined(CONFIG_ALPHA_EV6) && defined(CONFIG_ALPHA_EV67)
407/* Whee. EV67 can calculate it directly. */ 407/* Whee. EV67 can calculate it directly. */
408static inline unsigned long hweight64(unsigned long w) 408static inline unsigned long __arch_hweight64(unsigned long w)
409{ 409{
410 return __kernel_ctpop(w); 410 return __kernel_ctpop(w);
411} 411}
412 412
413static inline unsigned int hweight32(unsigned int w) 413static inline unsigned int __arch_weight32(unsigned int w)
414{ 414{
415 return hweight64(w); 415 return __arch_hweight64(w);
416} 416}
417 417
418static inline unsigned int hweight16(unsigned int w) 418static inline unsigned int __arch_hweight16(unsigned int w)
419{ 419{
420 return hweight64(w & 0xffff); 420 return __arch_hweight64(w & 0xffff);
421} 421}
422 422
423static inline unsigned int hweight8(unsigned int w) 423static inline unsigned int __arch_hweight8(unsigned int w)
424{ 424{
425 return hweight64(w & 0xff); 425 return __arch_hweight64(w & 0xff);
426} 426}
427#else 427#else
428#include <asm-generic/bitops/hweight.h> 428#include <asm-generic/bitops/arch_hweight.h>
429#endif 429#endif
430 430
431#include <asm-generic/bitops/const_hweight.h>
432
431#endif /* __KERNEL__ */ 433#endif /* __KERNEL__ */
432 434
433#include <asm-generic/bitops/find.h> 435#include <asm-generic/bitops/find.h>
diff --git a/arch/alpha/include/asm/core_marvel.h b/arch/alpha/include/asm/core_marvel.h
index 30d55fe7aaf6..dad300fa14ce 100644
--- a/arch/alpha/include/asm/core_marvel.h
+++ b/arch/alpha/include/asm/core_marvel.h
@@ -12,7 +12,6 @@
12#define __ALPHA_MARVEL__H__ 12#define __ALPHA_MARVEL__H__
13 13
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/pci.h>
16#include <linux/spinlock.h> 15#include <linux/spinlock.h>
17 16
18#include <asm/compiler.h> 17#include <asm/compiler.h>
diff --git a/arch/alpha/include/asm/core_mcpcia.h b/arch/alpha/include/asm/core_mcpcia.h
index acf55b483472..21ac53383b37 100644
--- a/arch/alpha/include/asm/core_mcpcia.h
+++ b/arch/alpha/include/asm/core_mcpcia.h
@@ -6,7 +6,6 @@
6#define MCPCIA_ONE_HAE_WINDOW 1 6#define MCPCIA_ONE_HAE_WINDOW 1
7 7
8#include <linux/types.h> 8#include <linux/types.h>
9#include <linux/pci.h>
10#include <asm/compiler.h> 9#include <asm/compiler.h>
11 10
12/* 11/*
diff --git a/arch/alpha/include/asm/core_titan.h b/arch/alpha/include/asm/core_titan.h
index a17f6f33b68e..8cf79d1219e1 100644
--- a/arch/alpha/include/asm/core_titan.h
+++ b/arch/alpha/include/asm/core_titan.h
@@ -2,7 +2,6 @@
2#define __ALPHA_TITAN__H__ 2#define __ALPHA_TITAN__H__
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/pci.h>
6#include <asm/compiler.h> 5#include <asm/compiler.h>
7 6
8/* 7/*
diff --git a/arch/alpha/include/asm/core_tsunami.h b/arch/alpha/include/asm/core_tsunami.h
index 58d4fe48742c..8e39ecf09419 100644
--- a/arch/alpha/include/asm/core_tsunami.h
+++ b/arch/alpha/include/asm/core_tsunami.h
@@ -2,7 +2,6 @@
2#define __ALPHA_TSUNAMI__H__ 2#define __ALPHA_TSUNAMI__H__
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/pci.h>
6#include <asm/compiler.h> 5#include <asm/compiler.h>
7 6
8/* 7/*
diff --git a/arch/alpha/include/asm/dma-mapping.h b/arch/alpha/include/asm/dma-mapping.h
index 04eb5681448c..1bce8169733c 100644
--- a/arch/alpha/include/asm/dma-mapping.h
+++ b/arch/alpha/include/asm/dma-mapping.h
@@ -1,71 +1,49 @@
1#ifndef _ALPHA_DMA_MAPPING_H 1#ifndef _ALPHA_DMA_MAPPING_H
2#define _ALPHA_DMA_MAPPING_H 2#define _ALPHA_DMA_MAPPING_H
3 3
4#include <linux/dma-attrs.h>
4 5
5#ifdef CONFIG_PCI 6extern struct dma_map_ops *dma_ops;
6 7
7#include <linux/pci.h> 8static inline struct dma_map_ops *get_dma_ops(struct device *dev)
9{
10 return dma_ops;
11}
8 12
9#define dma_map_single(dev, va, size, dir) \ 13#include <asm-generic/dma-mapping-common.h>
10 pci_map_single(alpha_gendev_to_pci(dev), va, size, dir)
11#define dma_unmap_single(dev, addr, size, dir) \
12 pci_unmap_single(alpha_gendev_to_pci(dev), addr, size, dir)
13#define dma_alloc_coherent(dev, size, addr, gfp) \
14 __pci_alloc_consistent(alpha_gendev_to_pci(dev), size, addr, gfp)
15#define dma_free_coherent(dev, size, va, addr) \
16 pci_free_consistent(alpha_gendev_to_pci(dev), size, va, addr)
17#define dma_map_page(dev, page, off, size, dir) \
18 pci_map_page(alpha_gendev_to_pci(dev), page, off, size, dir)
19#define dma_unmap_page(dev, addr, size, dir) \
20 pci_unmap_page(alpha_gendev_to_pci(dev), addr, size, dir)
21#define dma_map_sg(dev, sg, nents, dir) \
22 pci_map_sg(alpha_gendev_to_pci(dev), sg, nents, dir)
23#define dma_unmap_sg(dev, sg, nents, dir) \
24 pci_unmap_sg(alpha_gendev_to_pci(dev), sg, nents, dir)
25#define dma_supported(dev, mask) \
26 pci_dma_supported(alpha_gendev_to_pci(dev), mask)
27#define dma_mapping_error(dev, addr) \
28 pci_dma_mapping_error(alpha_gendev_to_pci(dev), addr)
29 14
30#else /* no PCI - no IOMMU. */ 15static inline void *dma_alloc_coherent(struct device *dev, size_t size,
16 dma_addr_t *dma_handle, gfp_t gfp)
17{
18 return get_dma_ops(dev)->alloc_coherent(dev, size, dma_handle, gfp);
19}
31 20
32#include <asm/io.h> /* for virt_to_phys() */ 21static inline void dma_free_coherent(struct device *dev, size_t size,
22 void *vaddr, dma_addr_t dma_handle)
23{
24 get_dma_ops(dev)->free_coherent(dev, size, vaddr, dma_handle);
25}
33 26
34struct scatterlist; 27static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
35void *dma_alloc_coherent(struct device *dev, size_t size, 28{
36 dma_addr_t *dma_handle, gfp_t gfp); 29 return get_dma_ops(dev)->mapping_error(dev, dma_addr);
37int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, 30}
38 enum dma_data_direction direction);
39 31
40#define dma_free_coherent(dev, size, va, addr) \ 32static inline int dma_supported(struct device *dev, u64 mask)
41 free_pages((unsigned long)va, get_order(size)) 33{
42#define dma_supported(dev, mask) (mask < 0x00ffffffUL ? 0 : 1) 34 return get_dma_ops(dev)->dma_supported(dev, mask);
43#define dma_map_single(dev, va, size, dir) virt_to_phys(va) 35}
44#define dma_map_page(dev, page, off, size, dir) (page_to_pa(page) + off)
45 36
46#define dma_unmap_single(dev, addr, size, dir) ((void)0) 37static inline int dma_set_mask(struct device *dev, u64 mask)
47#define dma_unmap_page(dev, addr, size, dir) ((void)0) 38{
48#define dma_unmap_sg(dev, sg, nents, dir) ((void)0) 39 return get_dma_ops(dev)->set_dma_mask(dev, mask);
49 40}
50#define dma_mapping_error(dev, addr) (0)
51
52#endif /* !CONFIG_PCI */
53 41
54#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) 42#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
55#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) 43#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
56#define dma_is_consistent(d, h) (1) 44#define dma_is_consistent(d, h) (1)
57 45
58int dma_set_mask(struct device *dev, u64 mask);
59
60#define dma_sync_single_for_cpu(dev, addr, size, dir) ((void)0)
61#define dma_sync_single_for_device(dev, addr, size, dir) ((void)0)
62#define dma_sync_single_range(dev, addr, off, size, dir) ((void)0)
63#define dma_sync_sg_for_cpu(dev, sg, nents, dir) ((void)0)
64#define dma_sync_sg_for_device(dev, sg, nents, dir) ((void)0)
65#define dma_cache_sync(dev, va, size, dir) ((void)0) 46#define dma_cache_sync(dev, va, size, dir) ((void)0)
66#define dma_sync_single_range_for_cpu(dev, addr, offset, size, dir) ((void)0)
67#define dma_sync_single_range_for_device(dev, addr, offset, size, dir) ((void)0)
68
69#define dma_get_cache_alignment() L1_CACHE_BYTES 47#define dma_get_cache_alignment() L1_CACHE_BYTES
70 48
71#endif /* _ALPHA_DMA_MAPPING_H */ 49#endif /* _ALPHA_DMA_MAPPING_H */
diff --git a/arch/alpha/include/asm/pci.h b/arch/alpha/include/asm/pci.h
index dd8dcabf160f..28d0497fd3c7 100644
--- a/arch/alpha/include/asm/pci.h
+++ b/arch/alpha/include/asm/pci.h
@@ -70,142 +70,11 @@ extern inline void pcibios_penalize_isa_irq(int irq, int active)
70 decisions. */ 70 decisions. */
71#define PCI_DMA_BUS_IS_PHYS 0 71#define PCI_DMA_BUS_IS_PHYS 0
72 72
73/* Allocate and map kernel buffer using consistent mode DMA for PCI 73#ifdef CONFIG_PCI
74 device. Returns non-NULL cpu-view pointer to the buffer if
75 successful and sets *DMA_ADDRP to the pci side dma address as well,
76 else DMA_ADDRP is undefined. */
77
78extern void *__pci_alloc_consistent(struct pci_dev *, size_t,
79 dma_addr_t *, gfp_t);
80static inline void *
81pci_alloc_consistent(struct pci_dev *dev, size_t size, dma_addr_t *dma)
82{
83 return __pci_alloc_consistent(dev, size, dma, GFP_ATOMIC);
84}
85
86/* Free and unmap a consistent DMA buffer. CPU_ADDR and DMA_ADDR must
87 be values that were returned from pci_alloc_consistent. SIZE must
88 be the same as what as passed into pci_alloc_consistent.
89 References to the memory and mappings associated with CPU_ADDR or
90 DMA_ADDR past this call are illegal. */
91
92extern void pci_free_consistent(struct pci_dev *, size_t, void *, dma_addr_t);
93
94/* Map a single buffer of the indicate size for PCI DMA in streaming mode.
95 The 32-bit PCI bus mastering address to use is returned. Once the device
96 is given the dma address, the device owns this memory until either
97 pci_unmap_single or pci_dma_sync_single_for_cpu is performed. */
98
99extern dma_addr_t pci_map_single(struct pci_dev *, void *, size_t, int);
100
101/* Likewise, but for a page instead of an address. */
102extern dma_addr_t pci_map_page(struct pci_dev *, struct page *,
103 unsigned long, size_t, int);
104
105/* Test for pci_map_single or pci_map_page having generated an error. */
106
107static inline int
108pci_dma_mapping_error(struct pci_dev *pdev, dma_addr_t dma_addr)
109{
110 return dma_addr == 0;
111}
112
113/* Unmap a single streaming mode DMA translation. The DMA_ADDR and
114 SIZE must match what was provided for in a previous pci_map_single
115 call. All other usages are undefined. After this call, reads by
116 the cpu to the buffer are guaranteed to see whatever the device
117 wrote there. */
118
119extern void pci_unmap_single(struct pci_dev *, dma_addr_t, size_t, int);
120extern void pci_unmap_page(struct pci_dev *, dma_addr_t, size_t, int);
121
122/* pci_unmap_{single,page} is not a nop, thus... */
123#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \
124 dma_addr_t ADDR_NAME;
125#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \
126 __u32 LEN_NAME;
127#define pci_unmap_addr(PTR, ADDR_NAME) \
128 ((PTR)->ADDR_NAME)
129#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) \
130 (((PTR)->ADDR_NAME) = (VAL))
131#define pci_unmap_len(PTR, LEN_NAME) \
132 ((PTR)->LEN_NAME)
133#define pci_unmap_len_set(PTR, LEN_NAME, VAL) \
134 (((PTR)->LEN_NAME) = (VAL))
135
136/* Map a set of buffers described by scatterlist in streaming mode for
137 PCI DMA. This is the scatter-gather version of the above
138 pci_map_single interface. Here the scatter gather list elements
139 are each tagged with the appropriate PCI dma address and length.
140 They are obtained via sg_dma_{address,length}(SG).
141
142 NOTE: An implementation may be able to use a smaller number of DMA
143 address/length pairs than there are SG table elements. (for
144 example via virtual mapping capabilities) The routine returns the
145 number of addr/length pairs actually used, at most nents.
146
147 Device ownership issues as mentioned above for pci_map_single are
148 the same here. */
149
150extern int pci_map_sg(struct pci_dev *, struct scatterlist *, int, int);
151
152/* Unmap a set of streaming mode DMA translations. Again, cpu read
153 rules concerning calls here are the same as for pci_unmap_single()
154 above. */
155
156extern void pci_unmap_sg(struct pci_dev *, struct scatterlist *, int, int);
157
158/* Make physical memory consistent for a single streaming mode DMA
159 translation after a transfer and device currently has ownership
160 of the buffer.
161
162 If you perform a pci_map_single() but wish to interrogate the
163 buffer using the cpu, yet do not wish to teardown the PCI dma
164 mapping, you must call this function before doing so. At the next
165 point you give the PCI dma address back to the card, you must first
166 perform a pci_dma_sync_for_device, and then the device again owns
167 the buffer. */
168
169static inline void
170pci_dma_sync_single_for_cpu(struct pci_dev *dev, dma_addr_t dma_addr,
171 long size, int direction)
172{
173 /* Nothing to do. */
174}
175
176static inline void
177pci_dma_sync_single_for_device(struct pci_dev *dev, dma_addr_t dma_addr,
178 size_t size, int direction)
179{
180 /* Nothing to do. */
181}
182
183/* Make physical memory consistent for a set of streaming mode DMA
184 translations after a transfer. The same as pci_dma_sync_single_*
185 but for a scatter-gather list, same rules and usage. */
186
187static inline void
188pci_dma_sync_sg_for_cpu(struct pci_dev *dev, struct scatterlist *sg,
189 int nents, int direction)
190{
191 /* Nothing to do. */
192}
193
194static inline void
195pci_dma_sync_sg_for_device(struct pci_dev *dev, struct scatterlist *sg,
196 int nents, int direction)
197{
198 /* Nothing to do. */
199}
200
201/* Return whether the given PCI device DMA address mask can
202 be supported properly. For example, if your device can
203 only drive the low 24-bits during PCI bus mastering, then
204 you would pass 0x00ffffff as the mask to this function. */
205 74
206extern int pci_dma_supported(struct pci_dev *hwdev, u64 mask); 75/* implement the pci_ DMA API in terms of the generic device dma_ one */
76#include <asm-generic/pci-dma-compat.h>
207 77
208#ifdef CONFIG_PCI
209static inline void pci_dma_burst_advice(struct pci_dev *pdev, 78static inline void pci_dma_burst_advice(struct pci_dev *pdev,
210 enum pci_dma_burst_strategy *strat, 79 enum pci_dma_burst_strategy *strat,
211 unsigned long *strategy_parameter) 80 unsigned long *strategy_parameter)
@@ -244,8 +113,6 @@ static inline int pci_proc_domain(struct pci_bus *bus)
244 return hose->need_domain_info; 113 return hose->need_domain_info;
245} 114}
246 115
247struct pci_dev *alpha_gendev_to_pci(struct device *dev);
248
249#endif /* __KERNEL__ */ 116#endif /* __KERNEL__ */
250 117
251/* Values for the `which' argument to sys_pciconfig_iobase. */ 118/* Values for the `which' argument to sys_pciconfig_iobase. */
diff --git a/arch/alpha/include/asm/ptrace.h b/arch/alpha/include/asm/ptrace.h
index 32c7a5cddd59..65cf3e28e2f4 100644
--- a/arch/alpha/include/asm/ptrace.h
+++ b/arch/alpha/include/asm/ptrace.h
@@ -68,6 +68,7 @@ struct switch_stack {
68 68
69#ifdef __KERNEL__ 69#ifdef __KERNEL__
70 70
71#define arch_has_single_step() (1)
71#define user_mode(regs) (((regs)->ps & 8) != 0) 72#define user_mode(regs) (((regs)->ps & 8) != 0)
72#define instruction_pointer(regs) ((regs)->pc) 73#define instruction_pointer(regs) ((regs)->pc)
73#define profile_pc(regs) instruction_pointer(regs) 74#define profile_pc(regs) instruction_pointer(regs)
diff --git a/arch/alpha/kernel/irq.c b/arch/alpha/kernel/irq.c
index 5f2cf23c4648..7f912ba3d9ad 100644
--- a/arch/alpha/kernel/irq.c
+++ b/arch/alpha/kernel/irq.c
@@ -18,7 +18,6 @@
18#include <linux/sched.h> 18#include <linux/sched.h>
19#include <linux/ptrace.h> 19#include <linux/ptrace.h>
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21#include <linux/slab.h>
22#include <linux/random.h> 21#include <linux/random.h>
23#include <linux/init.h> 22#include <linux/init.h>
24#include <linux/irq.h> 23#include <linux/irq.h>
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index 53c213f70fcb..de9d39717808 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -20,7 +20,6 @@
20#include <linux/syscalls.h> 20#include <linux/syscalls.h>
21#include <linux/unistd.h> 21#include <linux/unistd.h>
22#include <linux/ptrace.h> 22#include <linux/ptrace.h>
23#include <linux/slab.h>
24#include <linux/user.h> 23#include <linux/user.h>
25#include <linux/utsname.h> 24#include <linux/utsname.h>
26#include <linux/time.h> 25#include <linux/time.h>
@@ -37,6 +36,7 @@
37#include <linux/uio.h> 36#include <linux/uio.h>
38#include <linux/vfs.h> 37#include <linux/vfs.h>
39#include <linux/rcupdate.h> 38#include <linux/rcupdate.h>
39#include <linux/slab.h>
40 40
41#include <asm/fpu.h> 41#include <asm/fpu.h>
42#include <asm/io.h> 42#include <asm/io.h>
diff --git a/arch/alpha/kernel/pci-noop.c b/arch/alpha/kernel/pci-noop.c
index c19a376520f4..246100ef07c2 100644
--- a/arch/alpha/kernel/pci-noop.c
+++ b/arch/alpha/kernel/pci-noop.c
@@ -7,6 +7,7 @@
7#include <linux/pci.h> 7#include <linux/pci.h>
8#include <linux/init.h> 8#include <linux/init.h>
9#include <linux/bootmem.h> 9#include <linux/bootmem.h>
10#include <linux/gfp.h>
10#include <linux/capability.h> 11#include <linux/capability.h>
11#include <linux/mm.h> 12#include <linux/mm.h>
12#include <linux/errno.h> 13#include <linux/errno.h>
@@ -106,58 +107,8 @@ sys_pciconfig_write(unsigned long bus, unsigned long dfn,
106 return -ENODEV; 107 return -ENODEV;
107} 108}
108 109
109/* Stubs for the routines in pci_iommu.c: */ 110static void *alpha_noop_alloc_coherent(struct device *dev, size_t size,
110 111 dma_addr_t *dma_handle, gfp_t gfp)
111void *
112__pci_alloc_consistent(struct pci_dev *pdev, size_t size,
113 dma_addr_t *dma_addrp, gfp_t gfp)
114{
115 return NULL;
116}
117
118void
119pci_free_consistent(struct pci_dev *pdev, size_t size, void *cpu_addr,
120 dma_addr_t dma_addr)
121{
122}
123
124dma_addr_t
125pci_map_single(struct pci_dev *pdev, void *cpu_addr, size_t size,
126 int direction)
127{
128 return (dma_addr_t) 0;
129}
130
131void
132pci_unmap_single(struct pci_dev *pdev, dma_addr_t dma_addr, size_t size,
133 int direction)
134{
135}
136
137int
138pci_map_sg(struct pci_dev *pdev, struct scatterlist *sg, int nents,
139 int direction)
140{
141 return 0;
142}
143
144void
145pci_unmap_sg(struct pci_dev *pdev, struct scatterlist *sg, int nents,
146 int direction)
147{
148}
149
150int
151pci_dma_supported(struct pci_dev *hwdev, dma_addr_t mask)
152{
153 return 0;
154}
155
156/* Generic DMA mapping functions: */
157
158void *
159dma_alloc_coherent(struct device *dev, size_t size,
160 dma_addr_t *dma_handle, gfp_t gfp)
161{ 112{
162 void *ret; 113 void *ret;
163 114
@@ -171,11 +122,22 @@ dma_alloc_coherent(struct device *dev, size_t size,
171 return ret; 122 return ret;
172} 123}
173 124
174EXPORT_SYMBOL(dma_alloc_coherent); 125static void alpha_noop_free_coherent(struct device *dev, size_t size,
126 void *cpu_addr, dma_addr_t dma_addr)
127{
128 free_pages((unsigned long)cpu_addr, get_order(size));
129}
130
131static dma_addr_t alpha_noop_map_page(struct device *dev, struct page *page,
132 unsigned long offset, size_t size,
133 enum dma_data_direction dir,
134 struct dma_attrs *attrs)
135{
136 return page_to_pa(page) + offset;
137}
175 138
176int 139static int alpha_noop_map_sg(struct device *dev, struct scatterlist *sgl, int nents,
177dma_map_sg(struct device *dev, struct scatterlist *sgl, int nents, 140 enum dma_data_direction dir, struct dma_attrs *attrs)
178 enum dma_data_direction direction)
179{ 141{
180 int i; 142 int i;
181 struct scatterlist *sg; 143 struct scatterlist *sg;
@@ -192,19 +154,37 @@ dma_map_sg(struct device *dev, struct scatterlist *sgl, int nents,
192 return nents; 154 return nents;
193} 155}
194 156
195EXPORT_SYMBOL(dma_map_sg); 157static int alpha_noop_mapping_error(struct device *dev, dma_addr_t dma_addr)
158{
159 return 0;
160}
161
162static int alpha_noop_supported(struct device *dev, u64 mask)
163{
164 return mask < 0x00ffffffUL ? 0 : 1;
165}
196 166
197int 167static int alpha_noop_set_mask(struct device *dev, u64 mask)
198dma_set_mask(struct device *dev, u64 mask)
199{ 168{
200 if (!dev->dma_mask || !dma_supported(dev, mask)) 169 if (!dev->dma_mask || !dma_supported(dev, mask))
201 return -EIO; 170 return -EIO;
202 171
203 *dev->dma_mask = mask; 172 *dev->dma_mask = mask;
204
205 return 0; 173 return 0;
206} 174}
207EXPORT_SYMBOL(dma_set_mask); 175
176struct dma_map_ops alpha_noop_ops = {
177 .alloc_coherent = alpha_noop_alloc_coherent,
178 .free_coherent = alpha_noop_free_coherent,
179 .map_page = alpha_noop_map_page,
180 .map_sg = alpha_noop_map_sg,
181 .mapping_error = alpha_noop_mapping_error,
182 .dma_supported = alpha_noop_supported,
183 .set_dma_mask = alpha_noop_set_mask,
184};
185
186struct dma_map_ops *dma_ops = &alpha_noop_ops;
187EXPORT_SYMBOL(dma_ops);
208 188
209void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) 189void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
210{ 190{
diff --git a/arch/alpha/kernel/pci-sysfs.c b/arch/alpha/kernel/pci-sysfs.c
index 6ea822e7f724..d979e7c7bc4b 100644
--- a/arch/alpha/kernel/pci-sysfs.c
+++ b/arch/alpha/kernel/pci-sysfs.c
@@ -10,6 +10,7 @@
10 */ 10 */
11 11
12#include <linux/sched.h> 12#include <linux/sched.h>
13#include <linux/slab.h>
13#include <linux/pci.h> 14#include <linux/pci.h>
14 15
15static int hose_mmap_page_range(struct pci_controller *hose, 16static int hose_mmap_page_range(struct pci_controller *hose,
diff --git a/arch/alpha/kernel/pci_iommu.c b/arch/alpha/kernel/pci_iommu.c
index 8449504f5e0b..d1dbd9acd1df 100644
--- a/arch/alpha/kernel/pci_iommu.c
+++ b/arch/alpha/kernel/pci_iommu.c
@@ -5,7 +5,7 @@
5#include <linux/kernel.h> 5#include <linux/kernel.h>
6#include <linux/mm.h> 6#include <linux/mm.h>
7#include <linux/pci.h> 7#include <linux/pci.h>
8#include <linux/slab.h> 8#include <linux/gfp.h>
9#include <linux/bootmem.h> 9#include <linux/bootmem.h>
10#include <linux/scatterlist.h> 10#include <linux/scatterlist.h>
11#include <linux/log2.h> 11#include <linux/log2.h>
@@ -216,10 +216,30 @@ iommu_arena_free(struct pci_iommu_arena *arena, long ofs, long n)
216 for (i = 0; i < n; ++i) 216 for (i = 0; i < n; ++i)
217 p[i] = 0; 217 p[i] = 0;
218} 218}
219 219
220/* True if the machine supports DAC addressing, and DEV can 220/*
221 make use of it given MASK. */ 221 * True if the machine supports DAC addressing, and DEV can
222static int pci_dac_dma_supported(struct pci_dev *hwdev, u64 mask); 222 * make use of it given MASK.
223 */
224static int pci_dac_dma_supported(struct pci_dev *dev, u64 mask)
225{
226 dma64_addr_t dac_offset = alpha_mv.pci_dac_offset;
227 int ok = 1;
228
229 /* If this is not set, the machine doesn't support DAC at all. */
230 if (dac_offset == 0)
231 ok = 0;
232
233 /* The device has to be able to address our DAC bit. */
234 if ((dac_offset & dev->dma_mask) != dac_offset)
235 ok = 0;
236
237 /* If both conditions above are met, we are fine. */
238 DBGA("pci_dac_dma_supported %s from %p\n",
239 ok ? "yes" : "no", __builtin_return_address(0));
240
241 return ok;
242}
223 243
224/* Map a single buffer of the indicated size for PCI DMA in streaming 244/* Map a single buffer of the indicated size for PCI DMA in streaming
225 mode. The 32-bit PCI bus mastering address to use is returned. 245 mode. The 32-bit PCI bus mastering address to use is returned.
@@ -301,23 +321,36 @@ pci_map_single_1(struct pci_dev *pdev, void *cpu_addr, size_t size,
301 return ret; 321 return ret;
302} 322}
303 323
304dma_addr_t 324/* Helper for generic DMA-mapping functions. */
305pci_map_single(struct pci_dev *pdev, void *cpu_addr, size_t size, int dir) 325static struct pci_dev *alpha_gendev_to_pci(struct device *dev)
306{ 326{
307 int dac_allowed; 327 if (dev && dev->bus == &pci_bus_type)
328 return to_pci_dev(dev);
308 329
309 if (dir == PCI_DMA_NONE) 330 /* Assume that non-PCI devices asking for DMA are either ISA or EISA,
310 BUG(); 331 BUG() otherwise. */
332 BUG_ON(!isa_bridge);
311 333
312 dac_allowed = pdev ? pci_dac_dma_supported(pdev, pdev->dma_mask) : 0; 334 /* Assume non-busmaster ISA DMA when dma_mask is not set (the ISA
313 return pci_map_single_1(pdev, cpu_addr, size, dac_allowed); 335 bridge is bus master then). */
336 if (!dev || !dev->dma_mask || !*dev->dma_mask)
337 return isa_bridge;
338
339 /* For EISA bus masters, return isa_bridge (it might have smaller
340 dma_mask due to wiring limitations). */
341 if (*dev->dma_mask >= isa_bridge->dma_mask)
342 return isa_bridge;
343
344 /* This assumes ISA bus master with dma_mask 0xffffff. */
345 return NULL;
314} 346}
315EXPORT_SYMBOL(pci_map_single);
316 347
317dma_addr_t 348static dma_addr_t alpha_pci_map_page(struct device *dev, struct page *page,
318pci_map_page(struct pci_dev *pdev, struct page *page, unsigned long offset, 349 unsigned long offset, size_t size,
319 size_t size, int dir) 350 enum dma_data_direction dir,
351 struct dma_attrs *attrs)
320{ 352{
353 struct pci_dev *pdev = alpha_gendev_to_pci(dev);
321 int dac_allowed; 354 int dac_allowed;
322 355
323 if (dir == PCI_DMA_NONE) 356 if (dir == PCI_DMA_NONE)
@@ -327,7 +360,6 @@ pci_map_page(struct pci_dev *pdev, struct page *page, unsigned long offset,
327 return pci_map_single_1(pdev, (char *)page_address(page) + offset, 360 return pci_map_single_1(pdev, (char *)page_address(page) + offset,
328 size, dac_allowed); 361 size, dac_allowed);
329} 362}
330EXPORT_SYMBOL(pci_map_page);
331 363
332/* Unmap a single streaming mode DMA translation. The DMA_ADDR and 364/* Unmap a single streaming mode DMA translation. The DMA_ADDR and
333 SIZE must match what was provided for in a previous pci_map_single 365 SIZE must match what was provided for in a previous pci_map_single
@@ -335,16 +367,17 @@ EXPORT_SYMBOL(pci_map_page);
335 the cpu to the buffer are guaranteed to see whatever the device 367 the cpu to the buffer are guaranteed to see whatever the device
336 wrote there. */ 368 wrote there. */
337 369
338void 370static void alpha_pci_unmap_page(struct device *dev, dma_addr_t dma_addr,
339pci_unmap_single(struct pci_dev *pdev, dma_addr_t dma_addr, size_t size, 371 size_t size, enum dma_data_direction dir,
340 int direction) 372 struct dma_attrs *attrs)
341{ 373{
342 unsigned long flags; 374 unsigned long flags;
375 struct pci_dev *pdev = alpha_gendev_to_pci(dev);
343 struct pci_controller *hose = pdev ? pdev->sysdata : pci_isa_hose; 376 struct pci_controller *hose = pdev ? pdev->sysdata : pci_isa_hose;
344 struct pci_iommu_arena *arena; 377 struct pci_iommu_arena *arena;
345 long dma_ofs, npages; 378 long dma_ofs, npages;
346 379
347 if (direction == PCI_DMA_NONE) 380 if (dir == PCI_DMA_NONE)
348 BUG(); 381 BUG();
349 382
350 if (dma_addr >= __direct_map_base 383 if (dma_addr >= __direct_map_base
@@ -393,25 +426,16 @@ pci_unmap_single(struct pci_dev *pdev, dma_addr_t dma_addr, size_t size,
393 DBGA2("pci_unmap_single: sg [%llx,%zx] np %ld from %p\n", 426 DBGA2("pci_unmap_single: sg [%llx,%zx] np %ld from %p\n",
394 dma_addr, size, npages, __builtin_return_address(0)); 427 dma_addr, size, npages, __builtin_return_address(0));
395} 428}
396EXPORT_SYMBOL(pci_unmap_single);
397
398void
399pci_unmap_page(struct pci_dev *pdev, dma_addr_t dma_addr,
400 size_t size, int direction)
401{
402 pci_unmap_single(pdev, dma_addr, size, direction);
403}
404EXPORT_SYMBOL(pci_unmap_page);
405 429
406/* Allocate and map kernel buffer using consistent mode DMA for PCI 430/* Allocate and map kernel buffer using consistent mode DMA for PCI
407 device. Returns non-NULL cpu-view pointer to the buffer if 431 device. Returns non-NULL cpu-view pointer to the buffer if
408 successful and sets *DMA_ADDRP to the pci side dma address as well, 432 successful and sets *DMA_ADDRP to the pci side dma address as well,
409 else DMA_ADDRP is undefined. */ 433 else DMA_ADDRP is undefined. */
410 434
411void * 435static void *alpha_pci_alloc_coherent(struct device *dev, size_t size,
412__pci_alloc_consistent(struct pci_dev *pdev, size_t size, 436 dma_addr_t *dma_addrp, gfp_t gfp)
413 dma_addr_t *dma_addrp, gfp_t gfp)
414{ 437{
438 struct pci_dev *pdev = alpha_gendev_to_pci(dev);
415 void *cpu_addr; 439 void *cpu_addr;
416 long order = get_order(size); 440 long order = get_order(size);
417 441
@@ -439,13 +463,12 @@ try_again:
439 gfp |= GFP_DMA; 463 gfp |= GFP_DMA;
440 goto try_again; 464 goto try_again;
441 } 465 }
442 466
443 DBGA2("pci_alloc_consistent: %zx -> [%p,%llx] from %p\n", 467 DBGA2("pci_alloc_consistent: %zx -> [%p,%llx] from %p\n",
444 size, cpu_addr, *dma_addrp, __builtin_return_address(0)); 468 size, cpu_addr, *dma_addrp, __builtin_return_address(0));
445 469
446 return cpu_addr; 470 return cpu_addr;
447} 471}
448EXPORT_SYMBOL(__pci_alloc_consistent);
449 472
450/* Free and unmap a consistent DMA buffer. CPU_ADDR and DMA_ADDR must 473/* Free and unmap a consistent DMA buffer. CPU_ADDR and DMA_ADDR must
451 be values that were returned from pci_alloc_consistent. SIZE must 474 be values that were returned from pci_alloc_consistent. SIZE must
@@ -453,17 +476,16 @@ EXPORT_SYMBOL(__pci_alloc_consistent);
453 References to the memory and mappings associated with CPU_ADDR or 476 References to the memory and mappings associated with CPU_ADDR or
454 DMA_ADDR past this call are illegal. */ 477 DMA_ADDR past this call are illegal. */
455 478
456void 479static void alpha_pci_free_coherent(struct device *dev, size_t size,
457pci_free_consistent(struct pci_dev *pdev, size_t size, void *cpu_addr, 480 void *cpu_addr, dma_addr_t dma_addr)
458 dma_addr_t dma_addr)
459{ 481{
482 struct pci_dev *pdev = alpha_gendev_to_pci(dev);
460 pci_unmap_single(pdev, dma_addr, size, PCI_DMA_BIDIRECTIONAL); 483 pci_unmap_single(pdev, dma_addr, size, PCI_DMA_BIDIRECTIONAL);
461 free_pages((unsigned long)cpu_addr, get_order(size)); 484 free_pages((unsigned long)cpu_addr, get_order(size));
462 485
463 DBGA2("pci_free_consistent: [%llx,%zx] from %p\n", 486 DBGA2("pci_free_consistent: [%llx,%zx] from %p\n",
464 dma_addr, size, __builtin_return_address(0)); 487 dma_addr, size, __builtin_return_address(0));
465} 488}
466EXPORT_SYMBOL(pci_free_consistent);
467 489
468/* Classify the elements of the scatterlist. Write dma_address 490/* Classify the elements of the scatterlist. Write dma_address
469 of each element with: 491 of each element with:
@@ -626,23 +648,21 @@ sg_fill(struct device *dev, struct scatterlist *leader, struct scatterlist *end,
626 return 1; 648 return 1;
627} 649}
628 650
629int 651static int alpha_pci_map_sg(struct device *dev, struct scatterlist *sg,
630pci_map_sg(struct pci_dev *pdev, struct scatterlist *sg, int nents, 652 int nents, enum dma_data_direction dir,
631 int direction) 653 struct dma_attrs *attrs)
632{ 654{
655 struct pci_dev *pdev = alpha_gendev_to_pci(dev);
633 struct scatterlist *start, *end, *out; 656 struct scatterlist *start, *end, *out;
634 struct pci_controller *hose; 657 struct pci_controller *hose;
635 struct pci_iommu_arena *arena; 658 struct pci_iommu_arena *arena;
636 dma_addr_t max_dma; 659 dma_addr_t max_dma;
637 int dac_allowed; 660 int dac_allowed;
638 struct device *dev;
639 661
640 if (direction == PCI_DMA_NONE) 662 if (dir == PCI_DMA_NONE)
641 BUG(); 663 BUG();
642 664
643 dac_allowed = pdev ? pci_dac_dma_supported(pdev, pdev->dma_mask) : 0; 665 dac_allowed = dev ? pci_dac_dma_supported(pdev, pdev->dma_mask) : 0;
644
645 dev = pdev ? &pdev->dev : NULL;
646 666
647 /* Fast path single entry scatterlists. */ 667 /* Fast path single entry scatterlists. */
648 if (nents == 1) { 668 if (nents == 1) {
@@ -699,19 +719,19 @@ pci_map_sg(struct pci_dev *pdev, struct scatterlist *sg, int nents,
699 /* Some allocation failed while mapping the scatterlist 719 /* Some allocation failed while mapping the scatterlist
700 entries. Unmap them now. */ 720 entries. Unmap them now. */
701 if (out > start) 721 if (out > start)
702 pci_unmap_sg(pdev, start, out - start, direction); 722 pci_unmap_sg(pdev, start, out - start, dir);
703 return 0; 723 return 0;
704} 724}
705EXPORT_SYMBOL(pci_map_sg);
706 725
707/* Unmap a set of streaming mode DMA translations. Again, cpu read 726/* Unmap a set of streaming mode DMA translations. Again, cpu read
708 rules concerning calls here are the same as for pci_unmap_single() 727 rules concerning calls here are the same as for pci_unmap_single()
709 above. */ 728 above. */
710 729
711void 730static void alpha_pci_unmap_sg(struct device *dev, struct scatterlist *sg,
712pci_unmap_sg(struct pci_dev *pdev, struct scatterlist *sg, int nents, 731 int nents, enum dma_data_direction dir,
713 int direction) 732 struct dma_attrs *attrs)
714{ 733{
734 struct pci_dev *pdev = alpha_gendev_to_pci(dev);
715 unsigned long flags; 735 unsigned long flags;
716 struct pci_controller *hose; 736 struct pci_controller *hose;
717 struct pci_iommu_arena *arena; 737 struct pci_iommu_arena *arena;
@@ -719,7 +739,7 @@ pci_unmap_sg(struct pci_dev *pdev, struct scatterlist *sg, int nents,
719 dma_addr_t max_dma; 739 dma_addr_t max_dma;
720 dma_addr_t fbeg, fend; 740 dma_addr_t fbeg, fend;
721 741
722 if (direction == PCI_DMA_NONE) 742 if (dir == PCI_DMA_NONE)
723 BUG(); 743 BUG();
724 744
725 if (! alpha_mv.mv_pci_tbi) 745 if (! alpha_mv.mv_pci_tbi)
@@ -783,15 +803,13 @@ pci_unmap_sg(struct pci_dev *pdev, struct scatterlist *sg, int nents,
783 803
784 DBGA("pci_unmap_sg: %ld entries\n", nents - (end - sg)); 804 DBGA("pci_unmap_sg: %ld entries\n", nents - (end - sg));
785} 805}
786EXPORT_SYMBOL(pci_unmap_sg);
787
788 806
789/* Return whether the given PCI device DMA address mask can be 807/* Return whether the given PCI device DMA address mask can be
790 supported properly. */ 808 supported properly. */
791 809
792int 810static int alpha_pci_supported(struct device *dev, u64 mask)
793pci_dma_supported(struct pci_dev *pdev, u64 mask)
794{ 811{
812 struct pci_dev *pdev = alpha_gendev_to_pci(dev);
795 struct pci_controller *hose; 813 struct pci_controller *hose;
796 struct pci_iommu_arena *arena; 814 struct pci_iommu_arena *arena;
797 815
@@ -818,7 +836,6 @@ pci_dma_supported(struct pci_dev *pdev, u64 mask)
818 836
819 return 0; 837 return 0;
820} 838}
821EXPORT_SYMBOL(pci_dma_supported);
822 839
823 840
824/* 841/*
@@ -918,66 +935,32 @@ iommu_unbind(struct pci_iommu_arena *arena, long pg_start, long pg_count)
918 return 0; 935 return 0;
919} 936}
920 937
921/* True if the machine supports DAC addressing, and DEV can 938static int alpha_pci_mapping_error(struct device *dev, dma_addr_t dma_addr)
922 make use of it given MASK. */
923
924static int
925pci_dac_dma_supported(struct pci_dev *dev, u64 mask)
926{
927 dma64_addr_t dac_offset = alpha_mv.pci_dac_offset;
928 int ok = 1;
929
930 /* If this is not set, the machine doesn't support DAC at all. */
931 if (dac_offset == 0)
932 ok = 0;
933
934 /* The device has to be able to address our DAC bit. */
935 if ((dac_offset & dev->dma_mask) != dac_offset)
936 ok = 0;
937
938 /* If both conditions above are met, we are fine. */
939 DBGA("pci_dac_dma_supported %s from %p\n",
940 ok ? "yes" : "no", __builtin_return_address(0));
941
942 return ok;
943}
944
945/* Helper for generic DMA-mapping functions. */
946
947struct pci_dev *
948alpha_gendev_to_pci(struct device *dev)
949{ 939{
950 if (dev && dev->bus == &pci_bus_type) 940 return dma_addr == 0;
951 return to_pci_dev(dev);
952
953 /* Assume that non-PCI devices asking for DMA are either ISA or EISA,
954 BUG() otherwise. */
955 BUG_ON(!isa_bridge);
956
957 /* Assume non-busmaster ISA DMA when dma_mask is not set (the ISA
958 bridge is bus master then). */
959 if (!dev || !dev->dma_mask || !*dev->dma_mask)
960 return isa_bridge;
961
962 /* For EISA bus masters, return isa_bridge (it might have smaller
963 dma_mask due to wiring limitations). */
964 if (*dev->dma_mask >= isa_bridge->dma_mask)
965 return isa_bridge;
966
967 /* This assumes ISA bus master with dma_mask 0xffffff. */
968 return NULL;
969} 941}
970EXPORT_SYMBOL(alpha_gendev_to_pci);
971 942
972int 943static int alpha_pci_set_mask(struct device *dev, u64 mask)
973dma_set_mask(struct device *dev, u64 mask)
974{ 944{
975 if (!dev->dma_mask || 945 if (!dev->dma_mask ||
976 !pci_dma_supported(alpha_gendev_to_pci(dev), mask)) 946 !pci_dma_supported(alpha_gendev_to_pci(dev), mask))
977 return -EIO; 947 return -EIO;
978 948
979 *dev->dma_mask = mask; 949 *dev->dma_mask = mask;
980
981 return 0; 950 return 0;
982} 951}
983EXPORT_SYMBOL(dma_set_mask); 952
953struct dma_map_ops alpha_pci_ops = {
954 .alloc_coherent = alpha_pci_alloc_coherent,
955 .free_coherent = alpha_pci_free_coherent,
956 .map_page = alpha_pci_map_page,
957 .unmap_page = alpha_pci_unmap_page,
958 .map_sg = alpha_pci_map_sg,
959 .unmap_sg = alpha_pci_unmap_sg,
960 .mapping_error = alpha_pci_mapping_error,
961 .dma_supported = alpha_pci_supported,
962 .set_dma_mask = alpha_pci_set_mask,
963};
964
965struct dma_map_ops *dma_ops = &alpha_pci_ops;
966EXPORT_SYMBOL(dma_ops);
diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c
index 289039bb6bb2..395a464353b8 100644
--- a/arch/alpha/kernel/process.c
+++ b/arch/alpha/kernel/process.c
@@ -17,7 +17,6 @@
17#include <linux/stddef.h> 17#include <linux/stddef.h>
18#include <linux/unistd.h> 18#include <linux/unistd.h>
19#include <linux/ptrace.h> 19#include <linux/ptrace.h>
20#include <linux/slab.h>
21#include <linux/user.h> 20#include <linux/user.h>
22#include <linux/time.h> 21#include <linux/time.h>
23#include <linux/major.h> 22#include <linux/major.h>
@@ -28,6 +27,7 @@
28#include <linux/reboot.h> 27#include <linux/reboot.h>
29#include <linux/tty.h> 28#include <linux/tty.h>
30#include <linux/console.h> 29#include <linux/console.h>
30#include <linux/slab.h>
31 31
32#include <asm/reg.h> 32#include <asm/reg.h>
33#include <asm/uaccess.h> 33#include <asm/uaccess.h>
diff --git a/arch/alpha/kernel/ptrace.c b/arch/alpha/kernel/ptrace.c
index e072041d19f8..baa903602f6a 100644
--- a/arch/alpha/kernel/ptrace.c
+++ b/arch/alpha/kernel/ptrace.c
@@ -11,7 +11,6 @@
11#include <linux/errno.h> 11#include <linux/errno.h>
12#include <linux/ptrace.h> 12#include <linux/ptrace.h>
13#include <linux/user.h> 13#include <linux/user.h>
14#include <linux/slab.h>
15#include <linux/security.h> 14#include <linux/security.h>
16#include <linux/signal.h> 15#include <linux/signal.h>
17 16
@@ -249,6 +248,17 @@ ptrace_cancel_bpt(struct task_struct * child)
249 return (nsaved != 0); 248 return (nsaved != 0);
250} 249}
251 250
251void user_enable_single_step(struct task_struct *child)
252{
253 /* Mark single stepping. */
254 task_thread_info(child)->bpt_nsaved = -1;
255}
256
257void user_disable_single_step(struct task_struct *child)
258{
259 ptrace_cancel_bpt(child);
260}
261
252/* 262/*
253 * Called by kernel/ptrace.c when detaching.. 263 * Called by kernel/ptrace.c when detaching..
254 * 264 *
@@ -256,7 +266,7 @@ ptrace_cancel_bpt(struct task_struct * child)
256 */ 266 */
257void ptrace_disable(struct task_struct *child) 267void ptrace_disable(struct task_struct *child)
258{ 268{
259 ptrace_cancel_bpt(child); 269 user_disable_single_step(child);
260} 270}
261 271
262long arch_ptrace(struct task_struct *child, long request, long addr, long data) 272long arch_ptrace(struct task_struct *child, long request, long addr, long data)
@@ -295,52 +305,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
295 DBG(DBG_MEM, ("poke $%ld<-%#lx\n", addr, data)); 305 DBG(DBG_MEM, ("poke $%ld<-%#lx\n", addr, data));
296 ret = put_reg(child, addr, data); 306 ret = put_reg(child, addr, data);
297 break; 307 break;
298
299 case PTRACE_SYSCALL:
300 /* continue and stop at next (return from) syscall */
301 case PTRACE_CONT: /* restart after signal. */
302 ret = -EIO;
303 if (!valid_signal(data))
304 break;
305 if (request == PTRACE_SYSCALL)
306 set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
307 else
308 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
309 child->exit_code = data;
310 /* make sure single-step breakpoint is gone. */
311 ptrace_cancel_bpt(child);
312 wake_up_process(child);
313 ret = 0;
314 break;
315
316 /*
317 * Make the child exit. Best I can do is send it a sigkill.
318 * perhaps it should be put in the status that it wants to
319 * exit.
320 */
321 case PTRACE_KILL:
322 ret = 0;
323 if (child->exit_state == EXIT_ZOMBIE)
324 break;
325 child->exit_code = SIGKILL;
326 /* make sure single-step breakpoint is gone. */
327 ptrace_cancel_bpt(child);
328 wake_up_process(child);
329 break;
330
331 case PTRACE_SINGLESTEP: /* execute single instruction. */
332 ret = -EIO;
333 if (!valid_signal(data))
334 break;
335 /* Mark single stepping. */
336 task_thread_info(child)->bpt_nsaved = -1;
337 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
338 child->exit_code = data;
339 wake_up_process(child);
340 /* give it a chance to run. */
341 ret = 0;
342 break;
343
344 default: 308 default:
345 ret = ptrace_request(child, request, addr, data); 309 ret = ptrace_request(child, request, addr, data);
346 break; 310 break;
diff --git a/arch/alpha/kernel/smc37c669.c b/arch/alpha/kernel/smc37c669.c
index bca5bda90cde..0435921d41c6 100644
--- a/arch/alpha/kernel/smc37c669.c
+++ b/arch/alpha/kernel/smc37c669.c
@@ -3,7 +3,6 @@
3 */ 3 */
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5 5
6#include <linux/slab.h>
7#include <linux/mm.h> 6#include <linux/mm.h>
8#include <linux/init.h> 7#include <linux/init.h>
9#include <linux/delay.h> 8#include <linux/delay.h>
diff --git a/arch/alpha/kernel/smc37c93x.c b/arch/alpha/kernel/smc37c93x.c
index 2636cc028d06..3e6a2893af9f 100644
--- a/arch/alpha/kernel/smc37c93x.c
+++ b/arch/alpha/kernel/smc37c93x.c
@@ -4,7 +4,6 @@
4 4
5#include <linux/kernel.h> 5#include <linux/kernel.h>
6 6
7#include <linux/slab.h>
8#include <linux/mm.h> 7#include <linux/mm.h>
9#include <linux/init.h> 8#include <linux/init.h>
10#include <linux/delay.h> 9#include <linux/delay.h>
diff --git a/arch/alpha/kernel/srm_env.c b/arch/alpha/kernel/srm_env.c
index dbbf04f9230e..4afc1a1e2e5a 100644
--- a/arch/alpha/kernel/srm_env.c
+++ b/arch/alpha/kernel/srm_env.c
@@ -30,6 +30,7 @@
30 */ 30 */
31 31
32#include <linux/kernel.h> 32#include <linux/kernel.h>
33#include <linux/gfp.h>
33#include <linux/module.h> 34#include <linux/module.h>
34#include <linux/init.h> 35#include <linux/init.h>
35#include <linux/proc_fs.h> 36#include <linux/proc_fs.h>
diff --git a/arch/alpha/kernel/sys_dp264.c b/arch/alpha/kernel/sys_dp264.c
index d64e1e497e76..4026502ab707 100644
--- a/arch/alpha/kernel/sys_dp264.c
+++ b/arch/alpha/kernel/sys_dp264.c
@@ -224,7 +224,7 @@ static void
224dp264_device_interrupt(unsigned long vector) 224dp264_device_interrupt(unsigned long vector)
225{ 225{
226#if 1 226#if 1
227 printk("dp264_device_interrupt: NOT IMPLEMENTED YET!! \n"); 227 printk("dp264_device_interrupt: NOT IMPLEMENTED YET!!\n");
228#else 228#else
229 unsigned long pld; 229 unsigned long pld;
230 unsigned int i; 230 unsigned int i;
diff --git a/arch/alpha/kernel/sys_titan.c b/arch/alpha/kernel/sys_titan.c
index 288053342c83..9008d0f20c53 100644
--- a/arch/alpha/kernel/sys_titan.c
+++ b/arch/alpha/kernel/sys_titan.c
@@ -171,7 +171,7 @@ titan_set_irq_affinity(unsigned int irq, const struct cpumask *affinity)
171static void 171static void
172titan_device_interrupt(unsigned long vector) 172titan_device_interrupt(unsigned long vector)
173{ 173{
174 printk("titan_device_interrupt: NOT IMPLEMENTED YET!! \n"); 174 printk("titan_device_interrupt: NOT IMPLEMENTED YET!!\n");
175} 175}
176 176
177static void 177static void
diff --git a/arch/alpha/kernel/traps.c b/arch/alpha/kernel/traps.c
index 6ee7655b7568..b14f015008ad 100644
--- a/arch/alpha/kernel/traps.c
+++ b/arch/alpha/kernel/traps.c
@@ -17,6 +17,7 @@
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/kallsyms.h> 19#include <linux/kallsyms.h>
20#include <linux/ratelimit.h>
20 21
21#include <asm/gentrap.h> 22#include <asm/gentrap.h>
22#include <asm/uaccess.h> 23#include <asm/uaccess.h>
@@ -771,8 +772,7 @@ asmlinkage void
771do_entUnaUser(void __user * va, unsigned long opcode, 772do_entUnaUser(void __user * va, unsigned long opcode,
772 unsigned long reg, struct pt_regs *regs) 773 unsigned long reg, struct pt_regs *regs)
773{ 774{
774 static int cnt = 0; 775 static DEFINE_RATELIMIT_STATE(ratelimit, 5 * HZ, 5);
775 static unsigned long last_time;
776 776
777 unsigned long tmp1, tmp2, tmp3, tmp4; 777 unsigned long tmp1, tmp2, tmp3, tmp4;
778 unsigned long fake_reg, *reg_addr = &fake_reg; 778 unsigned long fake_reg, *reg_addr = &fake_reg;
@@ -783,15 +783,11 @@ do_entUnaUser(void __user * va, unsigned long opcode,
783 with the unaliged access. */ 783 with the unaliged access. */
784 784
785 if (!test_thread_flag (TIF_UAC_NOPRINT)) { 785 if (!test_thread_flag (TIF_UAC_NOPRINT)) {
786 if (cnt >= 5 && time_after(jiffies, last_time + 5 * HZ)) { 786 if (__ratelimit(&ratelimit)) {
787 cnt = 0;
788 }
789 if (++cnt < 5) {
790 printk("%s(%d): unaligned trap at %016lx: %p %lx %ld\n", 787 printk("%s(%d): unaligned trap at %016lx: %p %lx %ld\n",
791 current->comm, task_pid_nr(current), 788 current->comm, task_pid_nr(current),
792 regs->pc - 4, va, opcode, reg); 789 regs->pc - 4, va, opcode, reg);
793 } 790 }
794 last_time = jiffies;
795 } 791 }
796 if (test_thread_flag (TIF_UAC_SIGBUS)) 792 if (test_thread_flag (TIF_UAC_SIGBUS))
797 goto give_sigbus; 793 goto give_sigbus;
diff --git a/arch/alpha/mm/init.c b/arch/alpha/mm/init.c
index a0902c20d677..86425ab53bf5 100644
--- a/arch/alpha/mm/init.c
+++ b/arch/alpha/mm/init.c
@@ -20,6 +20,7 @@
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/bootmem.h> /* max_low_pfn */ 21#include <linux/bootmem.h> /* max_low_pfn */
22#include <linux/vmalloc.h> 22#include <linux/vmalloc.h>
23#include <linux/gfp.h>
23 24
24#include <asm/system.h> 25#include <asm/system.h>
25#include <asm/uaccess.h> 26#include <asm/uaccess.h>