aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/include
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/include')
-rw-r--r--arch/x86/include/asm/dma-mapping.h26
-rw-r--r--arch/x86/include/asm/processor.h10
-rw-r--r--arch/x86/include/asm/word-at-a-time.h46
3 files changed, 62 insertions, 20 deletions
diff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h
index ed3065fd6314..4b4331d71935 100644
--- a/arch/x86/include/asm/dma-mapping.h
+++ b/arch/x86/include/asm/dma-mapping.h
@@ -59,7 +59,8 @@ extern int dma_supported(struct device *hwdev, u64 mask);
59extern int dma_set_mask(struct device *dev, u64 mask); 59extern int dma_set_mask(struct device *dev, u64 mask);
60 60
61extern void *dma_generic_alloc_coherent(struct device *dev, size_t size, 61extern void *dma_generic_alloc_coherent(struct device *dev, size_t size,
62 dma_addr_t *dma_addr, gfp_t flag); 62 dma_addr_t *dma_addr, gfp_t flag,
63 struct dma_attrs *attrs);
63 64
64static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) 65static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)
65{ 66{
@@ -111,9 +112,11 @@ static inline gfp_t dma_alloc_coherent_gfp_flags(struct device *dev, gfp_t gfp)
111 return gfp; 112 return gfp;
112} 113}
113 114
115#define dma_alloc_coherent(d,s,h,f) dma_alloc_attrs(d,s,h,f,NULL)
116
114static inline void * 117static inline void *
115dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, 118dma_alloc_attrs(struct device *dev, size_t size, dma_addr_t *dma_handle,
116 gfp_t gfp) 119 gfp_t gfp, struct dma_attrs *attrs)
117{ 120{
118 struct dma_map_ops *ops = get_dma_ops(dev); 121 struct dma_map_ops *ops = get_dma_ops(dev);
119 void *memory; 122 void *memory;
@@ -129,18 +132,21 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
129 if (!is_device_dma_capable(dev)) 132 if (!is_device_dma_capable(dev))
130 return NULL; 133 return NULL;
131 134
132 if (!ops->alloc_coherent) 135 if (!ops->alloc)
133 return NULL; 136 return NULL;
134 137
135 memory = ops->alloc_coherent(dev, size, dma_handle, 138 memory = ops->alloc(dev, size, dma_handle,
136 dma_alloc_coherent_gfp_flags(dev, gfp)); 139 dma_alloc_coherent_gfp_flags(dev, gfp), attrs);
137 debug_dma_alloc_coherent(dev, size, *dma_handle, memory); 140 debug_dma_alloc_coherent(dev, size, *dma_handle, memory);
138 141
139 return memory; 142 return memory;
140} 143}
141 144
142static inline void dma_free_coherent(struct device *dev, size_t size, 145#define dma_free_coherent(d,s,c,h) dma_free_attrs(d,s,c,h,NULL)
143 void *vaddr, dma_addr_t bus) 146
147static inline void dma_free_attrs(struct device *dev, size_t size,
148 void *vaddr, dma_addr_t bus,
149 struct dma_attrs *attrs)
144{ 150{
145 struct dma_map_ops *ops = get_dma_ops(dev); 151 struct dma_map_ops *ops = get_dma_ops(dev);
146 152
@@ -150,8 +156,8 @@ static inline void dma_free_coherent(struct device *dev, size_t size,
150 return; 156 return;
151 157
152 debug_dma_free_coherent(dev, size, vaddr, bus); 158 debug_dma_free_coherent(dev, size, vaddr, bus);
153 if (ops->free_coherent) 159 if (ops->free)
154 ops->free_coherent(dev, size, vaddr, bus); 160 ops->free(dev, size, vaddr, bus, attrs);
155} 161}
156 162
157#endif 163#endif
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 7284c9a6a0b5..4fa7dcceb6c0 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -974,16 +974,6 @@ extern bool cpu_has_amd_erratum(const int *);
974#define cpu_has_amd_erratum(x) (false) 974#define cpu_has_amd_erratum(x) (false)
975#endif /* CONFIG_CPU_SUP_AMD */ 975#endif /* CONFIG_CPU_SUP_AMD */
976 976
977#ifdef CONFIG_X86_32
978/*
979 * disable hlt during certain critical i/o operations
980 */
981#define HAVE_DISABLE_HLT
982#endif
983
984void disable_hlt(void);
985void enable_hlt(void);
986
987void cpu_idle_wait(void); 977void cpu_idle_wait(void);
988 978
989extern unsigned long arch_align_stack(unsigned long sp); 979extern unsigned long arch_align_stack(unsigned long sp);
diff --git a/arch/x86/include/asm/word-at-a-time.h b/arch/x86/include/asm/word-at-a-time.h
new file mode 100644
index 000000000000..6fe6767b7124
--- /dev/null
+++ b/arch/x86/include/asm/word-at-a-time.h
@@ -0,0 +1,46 @@
1#ifndef _ASM_WORD_AT_A_TIME_H
2#define _ASM_WORD_AT_A_TIME_H
3
4/*
5 * This is largely generic for little-endian machines, but the
6 * optimal byte mask counting is probably going to be something
7 * that is architecture-specific. If you have a reliably fast
8 * bit count instruction, that might be better than the multiply
9 * and shift, for example.
10 */
11
12#ifdef CONFIG_64BIT
13
14/*
15 * Jan Achrenius on G+: microoptimized version of
16 * the simpler "(mask & ONEBYTES) * ONEBYTES >> 56"
17 * that works for the bytemasks without having to
18 * mask them first.
19 */
20static inline long count_masked_bytes(unsigned long mask)
21{
22 return mask*0x0001020304050608ul >> 56;
23}
24
25#else /* 32-bit case */
26
27/* Carl Chatfield / Jan Achrenius G+ version for 32-bit */
28static inline long count_masked_bytes(long mask)
29{
30 /* (000000 0000ff 00ffff ffffff) -> ( 1 1 2 3 ) */
31 long a = (0x0ff0001+mask) >> 23;
32 /* Fix the 1 for 00 case */
33 return a & mask;
34}
35
36#endif
37
38#define REPEAT_BYTE(x) ((~0ul / 0xff) * (x))
39
40/* Return the high bit set in the first byte that is a zero */
41static inline unsigned long has_zero(unsigned long a)
42{
43 return ((a - REPEAT_BYTE(0x01)) & ~a) & REPEAT_BYTE(0x80);
44}
45
46#endif /* _ASM_WORD_AT_A_TIME_H */