| .. | .. |
|---|
| 20 | 20 | #include <linux/irqflags.h> |
|---|
| 21 | 21 | |
|---|
| 22 | 22 | #include <asm/addrspace.h> |
|---|
| 23 | +#include <asm/barrier.h> |
|---|
| 23 | 24 | #include <asm/bug.h> |
|---|
| 24 | 25 | #include <asm/byteorder.h> |
|---|
| 25 | 26 | #include <asm/cpu.h> |
|---|
| .. | .. |
|---|
| 29 | 30 | #include <asm/pgtable-bits.h> |
|---|
| 30 | 31 | #include <asm/processor.h> |
|---|
| 31 | 32 | #include <asm/string.h> |
|---|
| 32 | | - |
|---|
| 33 | | -#include <ioremap.h> |
|---|
| 34 | 33 | #include <mangle-port.h> |
|---|
| 35 | | - |
|---|
| 36 | | -/* |
|---|
| 37 | | - * Slowdown I/O port space accesses for antique hardware. |
|---|
| 38 | | - */ |
|---|
| 39 | | -#undef CONF_SLOWDOWN_IO |
|---|
| 40 | 34 | |
|---|
| 41 | 35 | /* |
|---|
| 42 | 36 | * Raw operations are never swapped in software. OTOH values that raw |
|---|
| .. | .. |
|---|
| 50 | 44 | # define __raw_ioswabq(a, x) (x) |
|---|
| 51 | 45 | # define ____raw_ioswabq(a, x) (x) |
|---|
| 52 | 46 | |
|---|
| 53 | | -/* ioswab[bwlq], __mem_ioswab[bwlq] are defined in mangle-port.h */ |
|---|
| 47 | +# define __relaxed_ioswabb ioswabb |
|---|
| 48 | +# define __relaxed_ioswabw ioswabw |
|---|
| 49 | +# define __relaxed_ioswabl ioswabl |
|---|
| 50 | +# define __relaxed_ioswabq ioswabq |
|---|
| 54 | 51 | |
|---|
| 55 | | -#define IO_SPACE_LIMIT 0xffff |
|---|
| 52 | +/* ioswab[bwlq], __mem_ioswab[bwlq] are defined in mangle-port.h */ |
|---|
| 56 | 53 | |
|---|
| 57 | 54 | /* |
|---|
| 58 | 55 | * On MIPS I/O ports are memory mapped, so we access them using normal |
|---|
| .. | .. |
|---|
| 60 | 57 | * which all ports are being mapped. For sake of efficiency some code |
|---|
| 61 | 58 | * assumes that this is an address that can be loaded with a single lui |
|---|
| 62 | 59 | * instruction, so the lower 16 bits must be zero. Should be true on |
|---|
| 63 | | - * on any sane architecture; generic code does not use this assumption. |
|---|
| 60 | + * any sane architecture; generic code does not use this assumption. |
|---|
| 64 | 61 | */ |
|---|
| 65 | 62 | extern unsigned long mips_io_port_base; |
|---|
| 66 | 63 | |
|---|
| .. | .. |
|---|
| 70 | 67 | } |
|---|
| 71 | 68 | |
|---|
| 72 | 69 | /* |
|---|
| 73 | | - * Thanks to James van Artsdalen for a better timing-fix than |
|---|
| 74 | | - * the two short jumps: using outb's to a nonexistent port seems |
|---|
| 75 | | - * to guarantee better timings even on fast machines. |
|---|
| 76 | | - * |
|---|
| 77 | | - * On the other hand, I'd like to be sure of a non-existent port: |
|---|
| 78 | | - * I feel a bit unsafe about using 0x80 (should be safe, though) |
|---|
| 79 | | - * |
|---|
| 80 | | - * Linus |
|---|
| 81 | | - * |
|---|
| 70 | + * Provide the necessary definitions for generic iomap. We make use of |
|---|
| 71 | + * mips_io_port_base for iomap(), but we don't reserve any low addresses for |
|---|
| 72 | + * use with I/O ports. |
|---|
| 82 | 73 | */ |
|---|
| 83 | 74 | |
|---|
| 84 | | -#define __SLOW_DOWN_IO \ |
|---|
| 85 | | - __asm__ __volatile__( \ |
|---|
| 86 | | - "sb\t$0,0x80(%0)" \ |
|---|
| 87 | | - : : "r" (mips_io_port_base)); |
|---|
| 75 | +#define HAVE_ARCH_PIO_SIZE |
|---|
| 76 | +#define PIO_OFFSET mips_io_port_base |
|---|
| 77 | +#define PIO_MASK IO_SPACE_LIMIT |
|---|
| 78 | +#define PIO_RESERVED 0x0UL |
|---|
| 88 | 79 | |
|---|
| 89 | | -#ifdef CONF_SLOWDOWN_IO |
|---|
| 90 | | -#ifdef REALLY_SLOW_IO |
|---|
| 91 | | -#define SLOW_DOWN_IO { __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; } |
|---|
| 92 | | -#else |
|---|
| 93 | | -#define SLOW_DOWN_IO __SLOW_DOWN_IO |
|---|
| 94 | | -#endif |
|---|
| 95 | | -#else |
|---|
| 96 | | -#define SLOW_DOWN_IO |
|---|
| 97 | | -#endif |
|---|
| 80 | +/* |
|---|
| 81 | + * Enforce in-order execution of data I/O. In the MIPS architecture |
|---|
| 82 | + * these are equivalent to corresponding platform-specific memory |
|---|
| 83 | + * barriers defined in <asm/barrier.h>. API pinched from PowerPC, |
|---|
| 84 | + * with sync additionally defined. |
|---|
| 85 | + */ |
|---|
| 86 | +#define iobarrier_rw() mb() |
|---|
| 87 | +#define iobarrier_r() rmb() |
|---|
| 88 | +#define iobarrier_w() wmb() |
|---|
| 89 | +#define iobarrier_sync() iob() |
|---|
| 98 | 90 | |
|---|
| 99 | 91 | /* |
|---|
| 100 | 92 | * virt_to_phys - map virtual addresses to physical |
|---|
| .. | .. |
|---|
| 143 | 135 | return phys_to_virt(address); |
|---|
| 144 | 136 | } |
|---|
| 145 | 137 | |
|---|
| 146 | | -#define isa_page_to_bus page_to_phys |
|---|
| 147 | | - |
|---|
| 148 | 138 | /* |
|---|
| 149 | 139 | * However PCI ones are not necessarily 1:1 and therefore these interfaces |
|---|
| 150 | 140 | * are forbidden in portable PCI drivers. |
|---|
| .. | .. |
|---|
| 159 | 149 | */ |
|---|
| 160 | 150 | #define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT) |
|---|
| 161 | 151 | |
|---|
| 162 | | -extern void __iomem * __ioremap(phys_addr_t offset, phys_addr_t size, unsigned long flags); |
|---|
| 163 | | -extern void __iounmap(const volatile void __iomem *addr); |
|---|
| 164 | | - |
|---|
| 165 | | -#ifndef CONFIG_PCI |
|---|
| 166 | | -struct pci_dev; |
|---|
| 167 | | -static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr) {} |
|---|
| 168 | | -#endif |
|---|
| 169 | | - |
|---|
| 170 | | -static inline void __iomem * __ioremap_mode(phys_addr_t offset, unsigned long size, |
|---|
| 171 | | - unsigned long flags) |
|---|
| 172 | | -{ |
|---|
| 173 | | - void __iomem *addr = plat_ioremap(offset, size, flags); |
|---|
| 174 | | - |
|---|
| 175 | | - if (addr) |
|---|
| 176 | | - return addr; |
|---|
| 177 | | - |
|---|
| 178 | | -#define __IS_LOW512(addr) (!((phys_addr_t)(addr) & (phys_addr_t) ~0x1fffffffULL)) |
|---|
| 179 | | - |
|---|
| 180 | | - if (cpu_has_64bit_addresses) { |
|---|
| 181 | | - u64 base = UNCAC_BASE; |
|---|
| 182 | | - |
|---|
| 183 | | - /* |
|---|
| 184 | | - * R10000 supports a 2 bit uncached attribute therefore |
|---|
| 185 | | - * UNCAC_BASE may not equal IO_BASE. |
|---|
| 186 | | - */ |
|---|
| 187 | | - if (flags == _CACHE_UNCACHED) |
|---|
| 188 | | - base = (u64) IO_BASE; |
|---|
| 189 | | - return (void __iomem *) (unsigned long) (base + offset); |
|---|
| 190 | | - } else if (__builtin_constant_p(offset) && |
|---|
| 191 | | - __builtin_constant_p(size) && __builtin_constant_p(flags)) { |
|---|
| 192 | | - phys_addr_t phys_addr, last_addr; |
|---|
| 193 | | - |
|---|
| 194 | | - phys_addr = fixup_bigphys_addr(offset, size); |
|---|
| 195 | | - |
|---|
| 196 | | - /* Don't allow wraparound or zero size. */ |
|---|
| 197 | | - last_addr = phys_addr + size - 1; |
|---|
| 198 | | - if (!size || last_addr < phys_addr) |
|---|
| 199 | | - return NULL; |
|---|
| 200 | | - |
|---|
| 201 | | - /* |
|---|
| 202 | | - * Map uncached objects in the low 512MB of address |
|---|
| 203 | | - * space using KSEG1. |
|---|
| 204 | | - */ |
|---|
| 205 | | - if (__IS_LOW512(phys_addr) && __IS_LOW512(last_addr) && |
|---|
| 206 | | - flags == _CACHE_UNCACHED) |
|---|
| 207 | | - return (void __iomem *) |
|---|
| 208 | | - (unsigned long)CKSEG1ADDR(phys_addr); |
|---|
| 209 | | - } |
|---|
| 210 | | - |
|---|
| 211 | | - return __ioremap(offset, size, flags); |
|---|
| 212 | | - |
|---|
| 213 | | -#undef __IS_LOW512 |
|---|
| 214 | | -} |
|---|
| 152 | +void __iomem *ioremap_prot(phys_addr_t offset, unsigned long size, |
|---|
| 153 | + unsigned long prot_val); |
|---|
| 154 | +void iounmap(const volatile void __iomem *addr); |
|---|
| 215 | 155 | |
|---|
| 216 | 156 | /* |
|---|
| 217 | 157 | * ioremap - map bus memory into CPU space |
|---|
| .. | .. |
|---|
| 225 | 165 | * address. |
|---|
| 226 | 166 | */ |
|---|
| 227 | 167 | #define ioremap(offset, size) \ |
|---|
| 228 | | - __ioremap_mode((offset), (size), _CACHE_UNCACHED) |
|---|
| 168 | + ioremap_prot((offset), (size), _CACHE_UNCACHED) |
|---|
| 169 | +#define ioremap_uc ioremap |
|---|
| 229 | 170 | |
|---|
| 230 | 171 | /* |
|---|
| 231 | | - * ioremap_nocache - map bus memory into CPU space |
|---|
| 232 | | - * @offset: bus address of the memory |
|---|
| 233 | | - * @size: size of the resource to map |
|---|
| 234 | | - * |
|---|
| 235 | | - * ioremap_nocache performs a platform specific sequence of operations to |
|---|
| 236 | | - * make bus memory CPU accessible via the readb/readw/readl/writeb/ |
|---|
| 237 | | - * writew/writel functions and the other mmio helpers. The returned |
|---|
| 238 | | - * address is not guaranteed to be usable directly as a virtual |
|---|
| 239 | | - * address. |
|---|
| 240 | | - * |
|---|
| 241 | | - * This version of ioremap ensures that the memory is marked uncachable |
|---|
| 242 | | - * on the CPU as well as honouring existing caching rules from things like |
|---|
| 243 | | - * the PCI bus. Note that there are other caches and buffers on many |
|---|
| 244 | | - * busses. In particular driver authors should read up on PCI writes |
|---|
| 245 | | - * |
|---|
| 246 | | - * It's useful if some control registers are in such an area and |
|---|
| 247 | | - * write combining or read caching is not desirable: |
|---|
| 248 | | - */ |
|---|
| 249 | | -#define ioremap_nocache(offset, size) \ |
|---|
| 250 | | - __ioremap_mode((offset), (size), _CACHE_UNCACHED) |
|---|
| 251 | | -#define ioremap_uc ioremap_nocache |
|---|
| 252 | | - |
|---|
| 253 | | -/* |
|---|
| 254 | | - * ioremap_cachable - map bus memory into CPU space |
|---|
| 172 | + * ioremap_cache - map bus memory into CPU space |
|---|
| 255 | 173 | * @offset: bus address of the memory |
|---|
| 256 | 174 | * @size: size of the resource to map |
|---|
| 257 | 175 | * |
|---|
| 258 | | - * ioremap_nocache performs a platform specific sequence of operations to |
|---|
| 176 | + * ioremap_cache performs a platform specific sequence of operations to |
|---|
| 259 | 177 | * make bus memory CPU accessible via the readb/readw/readl/writeb/ |
|---|
| 260 | 178 | * writew/writel functions and the other mmio helpers. The returned |
|---|
| 261 | 179 | * address is not guaranteed to be usable directly as a virtual |
|---|
| .. | .. |
|---|
| 265 | 183 | * the CPU. Also enables full write-combining. Useful for some |
|---|
| 266 | 184 | * memory-like regions on I/O busses. |
|---|
| 267 | 185 | */ |
|---|
| 268 | | -#define ioremap_cachable(offset, size) \ |
|---|
| 269 | | - __ioremap_mode((offset), (size), _page_cachable_default) |
|---|
| 270 | | -#define ioremap_cache ioremap_cachable |
|---|
| 186 | +#define ioremap_cache(offset, size) \ |
|---|
| 187 | + ioremap_prot((offset), (size), _page_cachable_default) |
|---|
| 271 | 188 | |
|---|
| 272 | 189 | /* |
|---|
| 273 | 190 | * ioremap_wc - map bus memory into CPU space |
|---|
| .. | .. |
|---|
| 288 | 205 | * _CACHE_UNCACHED option (see cpu_probe() method). |
|---|
| 289 | 206 | */ |
|---|
| 290 | 207 | #define ioremap_wc(offset, size) \ |
|---|
| 291 | | - __ioremap_mode((offset), (size), boot_cpu_data.writecombine) |
|---|
| 208 | + ioremap_prot((offset), (size), boot_cpu_data.writecombine) |
|---|
| 292 | 209 | |
|---|
| 293 | | -static inline void iounmap(const volatile void __iomem *addr) |
|---|
| 294 | | -{ |
|---|
| 295 | | - if (plat_iounmap(addr)) |
|---|
| 296 | | - return; |
|---|
| 297 | | - |
|---|
| 298 | | -#define __IS_KSEG1(addr) (((unsigned long)(addr) & ~0x1fffffffUL) == CKSEG1) |
|---|
| 299 | | - |
|---|
| 300 | | - if (cpu_has_64bit_addresses || |
|---|
| 301 | | - (__builtin_constant_p(addr) && __IS_KSEG1(addr))) |
|---|
| 302 | | - return; |
|---|
| 303 | | - |
|---|
| 304 | | - __iounmap(addr); |
|---|
| 305 | | - |
|---|
| 306 | | -#undef __IS_KSEG1 |
|---|
| 307 | | -} |
|---|
| 308 | | - |
|---|
| 309 | | -#if defined(CONFIG_CPU_CAVIUM_OCTEON) || defined(CONFIG_LOONGSON3_ENHANCEMENT) |
|---|
| 210 | +#if defined(CONFIG_CPU_CAVIUM_OCTEON) || defined(CONFIG_CPU_LOONGSON64) |
|---|
| 310 | 211 | #define war_io_reorder_wmb() wmb() |
|---|
| 311 | 212 | #else |
|---|
| 312 | 213 | #define war_io_reorder_wmb() barrier() |
|---|
| 313 | 214 | #endif |
|---|
| 314 | 215 | |
|---|
| 315 | | -#define __BUILD_MEMORY_SINGLE(pfx, bwlq, type, irq) \ |
|---|
| 216 | +#define __BUILD_MEMORY_SINGLE(pfx, bwlq, type, barrier, relax, irq) \ |
|---|
| 316 | 217 | \ |
|---|
| 317 | 218 | static inline void pfx##write##bwlq(type val, \ |
|---|
| 318 | 219 | volatile void __iomem *mem) \ |
|---|
| .. | .. |
|---|
| 320 | 221 | volatile type *__mem; \ |
|---|
| 321 | 222 | type __val; \ |
|---|
| 322 | 223 | \ |
|---|
| 323 | | - war_io_reorder_wmb(); \ |
|---|
| 224 | + if (barrier) \ |
|---|
| 225 | + iobarrier_rw(); \ |
|---|
| 226 | + else \ |
|---|
| 227 | + war_io_reorder_wmb(); \ |
|---|
| 324 | 228 | \ |
|---|
| 325 | 229 | __mem = (void *)__swizzle_addr_##bwlq((unsigned long)(mem)); \ |
|---|
| 326 | 230 | \ |
|---|
| .. | .. |
|---|
| 335 | 239 | if (irq) \ |
|---|
| 336 | 240 | local_irq_save(__flags); \ |
|---|
| 337 | 241 | __asm__ __volatile__( \ |
|---|
| 338 | | - ".set arch=r4000" "\t\t# __writeq""\n\t" \ |
|---|
| 242 | + ".set push" "\t\t# __writeq""\n\t" \ |
|---|
| 243 | + ".set arch=r4000" "\n\t" \ |
|---|
| 339 | 244 | "dsll32 %L0, %L0, 0" "\n\t" \ |
|---|
| 340 | 245 | "dsrl32 %L0, %L0, 0" "\n\t" \ |
|---|
| 341 | 246 | "dsll32 %M0, %M0, 0" "\n\t" \ |
|---|
| 342 | 247 | "or %L0, %L0, %M0" "\n\t" \ |
|---|
| 343 | 248 | "sd %L0, %2" "\n\t" \ |
|---|
| 344 | | - ".set mips0" "\n" \ |
|---|
| 249 | + ".set pop" "\n" \ |
|---|
| 345 | 250 | : "=r" (__tmp) \ |
|---|
| 346 | 251 | : "0" (__val), "m" (*__mem)); \ |
|---|
| 347 | 252 | if (irq) \ |
|---|
| .. | .. |
|---|
| 357 | 262 | \ |
|---|
| 358 | 263 | __mem = (void *)__swizzle_addr_##bwlq((unsigned long)(mem)); \ |
|---|
| 359 | 264 | \ |
|---|
| 265 | + if (barrier) \ |
|---|
| 266 | + iobarrier_rw(); \ |
|---|
| 267 | + \ |
|---|
| 360 | 268 | if (sizeof(type) != sizeof(u64) || sizeof(u64) == sizeof(long)) \ |
|---|
| 361 | 269 | __val = *__mem; \ |
|---|
| 362 | 270 | else if (cpu_has_64bits) { \ |
|---|
| .. | .. |
|---|
| 365 | 273 | if (irq) \ |
|---|
| 366 | 274 | local_irq_save(__flags); \ |
|---|
| 367 | 275 | __asm__ __volatile__( \ |
|---|
| 368 | | - ".set arch=r4000" "\t\t# __readq" "\n\t" \ |
|---|
| 276 | + ".set push" "\t\t# __readq" "\n\t" \ |
|---|
| 277 | + ".set arch=r4000" "\n\t" \ |
|---|
| 369 | 278 | "ld %L0, %1" "\n\t" \ |
|---|
| 370 | 279 | "dsra32 %M0, %L0, 0" "\n\t" \ |
|---|
| 371 | 280 | "sll %L0, %L0, 0" "\n\t" \ |
|---|
| 372 | | - ".set mips0" "\n" \ |
|---|
| 281 | + ".set pop" "\n" \ |
|---|
| 373 | 282 | : "=r" (__val) \ |
|---|
| 374 | 283 | : "m" (*__mem)); \ |
|---|
| 375 | 284 | if (irq) \ |
|---|
| .. | .. |
|---|
| 380 | 289 | } \ |
|---|
| 381 | 290 | \ |
|---|
| 382 | 291 | /* prevent prefetching of coherent DMA data prematurely */ \ |
|---|
| 383 | | - rmb(); \ |
|---|
| 292 | + if (!relax) \ |
|---|
| 293 | + rmb(); \ |
|---|
| 384 | 294 | return pfx##ioswab##bwlq(__mem, __val); \ |
|---|
| 385 | 295 | } |
|---|
| 386 | 296 | |
|---|
| 387 | | -#define __BUILD_IOPORT_SINGLE(pfx, bwlq, type, p, slow) \ |
|---|
| 297 | +#define __BUILD_IOPORT_SINGLE(pfx, bwlq, type, barrier, relax, p) \ |
|---|
| 388 | 298 | \ |
|---|
| 389 | 299 | static inline void pfx##out##bwlq##p(type val, unsigned long port) \ |
|---|
| 390 | 300 | { \ |
|---|
| 391 | 301 | volatile type *__addr; \ |
|---|
| 392 | 302 | type __val; \ |
|---|
| 393 | 303 | \ |
|---|
| 394 | | - war_io_reorder_wmb(); \ |
|---|
| 304 | + if (barrier) \ |
|---|
| 305 | + iobarrier_rw(); \ |
|---|
| 306 | + else \ |
|---|
| 307 | + war_io_reorder_wmb(); \ |
|---|
| 395 | 308 | \ |
|---|
| 396 | 309 | __addr = (void *)__swizzle_addr_##bwlq(mips_io_port_base + port); \ |
|---|
| 397 | 310 | \ |
|---|
| .. | .. |
|---|
| 401 | 314 | BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \ |
|---|
| 402 | 315 | \ |
|---|
| 403 | 316 | *__addr = __val; \ |
|---|
| 404 | | - slow; \ |
|---|
| 405 | 317 | } \ |
|---|
| 406 | 318 | \ |
|---|
| 407 | 319 | static inline type pfx##in##bwlq##p(unsigned long port) \ |
|---|
| .. | .. |
|---|
| 413 | 325 | \ |
|---|
| 414 | 326 | BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \ |
|---|
| 415 | 327 | \ |
|---|
| 328 | + if (barrier) \ |
|---|
| 329 | + iobarrier_rw(); \ |
|---|
| 330 | + \ |
|---|
| 416 | 331 | __val = *__addr; \ |
|---|
| 417 | | - slow; \ |
|---|
| 418 | 332 | \ |
|---|
| 419 | 333 | /* prevent prefetching of coherent DMA data prematurely */ \ |
|---|
| 420 | | - rmb(); \ |
|---|
| 334 | + if (!relax) \ |
|---|
| 335 | + rmb(); \ |
|---|
| 421 | 336 | return pfx##ioswab##bwlq(__addr, __val); \ |
|---|
| 422 | 337 | } |
|---|
| 423 | 338 | |
|---|
| 424 | | -#define __BUILD_MEMORY_PFX(bus, bwlq, type) \ |
|---|
| 339 | +#define __BUILD_MEMORY_PFX(bus, bwlq, type, relax) \ |
|---|
| 425 | 340 | \ |
|---|
| 426 | | -__BUILD_MEMORY_SINGLE(bus, bwlq, type, 1) |
|---|
| 341 | +__BUILD_MEMORY_SINGLE(bus, bwlq, type, 1, relax, 1) |
|---|
| 427 | 342 | |
|---|
| 428 | 343 | #define BUILDIO_MEM(bwlq, type) \ |
|---|
| 429 | 344 | \ |
|---|
| 430 | | -__BUILD_MEMORY_PFX(__raw_, bwlq, type) \ |
|---|
| 431 | | -__BUILD_MEMORY_PFX(, bwlq, type) \ |
|---|
| 432 | | -__BUILD_MEMORY_PFX(__mem_, bwlq, type) \ |
|---|
| 345 | +__BUILD_MEMORY_PFX(__raw_, bwlq, type, 0) \ |
|---|
| 346 | +__BUILD_MEMORY_PFX(__relaxed_, bwlq, type, 1) \ |
|---|
| 347 | +__BUILD_MEMORY_PFX(__mem_, bwlq, type, 0) \ |
|---|
| 348 | +__BUILD_MEMORY_PFX(, bwlq, type, 0) |
|---|
| 433 | 349 | |
|---|
| 434 | 350 | BUILDIO_MEM(b, u8) |
|---|
| 435 | 351 | BUILDIO_MEM(w, u16) |
|---|
| 436 | 352 | BUILDIO_MEM(l, u32) |
|---|
| 353 | +#ifdef CONFIG_64BIT |
|---|
| 437 | 354 | BUILDIO_MEM(q, u64) |
|---|
| 355 | +#else |
|---|
| 356 | +__BUILD_MEMORY_PFX(__raw_, q, u64, 0) |
|---|
| 357 | +__BUILD_MEMORY_PFX(__mem_, q, u64, 0) |
|---|
| 358 | +#endif |
|---|
| 438 | 359 | |
|---|
| 439 | 360 | #define __BUILD_IOPORT_PFX(bus, bwlq, type) \ |
|---|
| 440 | | - __BUILD_IOPORT_SINGLE(bus, bwlq, type, ,) \ |
|---|
| 441 | | - __BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO) |
|---|
| 361 | + __BUILD_IOPORT_SINGLE(bus, bwlq, type, 1, 0,) \ |
|---|
| 362 | + __BUILD_IOPORT_SINGLE(bus, bwlq, type, 1, 0, _p) |
|---|
| 442 | 363 | |
|---|
| 443 | 364 | #define BUILDIO_IOPORT(bwlq, type) \ |
|---|
| 444 | 365 | __BUILD_IOPORT_PFX(, bwlq, type) \ |
|---|
| .. | .. |
|---|
| 453 | 374 | |
|---|
| 454 | 375 | #define __BUILDIO(bwlq, type) \ |
|---|
| 455 | 376 | \ |
|---|
| 456 | | -__BUILD_MEMORY_SINGLE(____raw_, bwlq, type, 0) |
|---|
| 377 | +__BUILD_MEMORY_SINGLE(____raw_, bwlq, type, 1, 0, 0) |
|---|
| 457 | 378 | |
|---|
| 458 | 379 | __BUILDIO(q, u64) |
|---|
| 459 | 380 | |
|---|
| 460 | | -#define readb_relaxed readb |
|---|
| 461 | | -#define readw_relaxed readw |
|---|
| 462 | | -#define readl_relaxed readl |
|---|
| 463 | | -#define readq_relaxed readq |
|---|
| 381 | +#define readb_relaxed __relaxed_readb |
|---|
| 382 | +#define readw_relaxed __relaxed_readw |
|---|
| 383 | +#define readl_relaxed __relaxed_readl |
|---|
| 384 | +#ifdef CONFIG_64BIT |
|---|
| 385 | +#define readq_relaxed __relaxed_readq |
|---|
| 386 | +#endif |
|---|
| 464 | 387 | |
|---|
| 465 | | -#define writeb_relaxed writeb |
|---|
| 466 | | -#define writew_relaxed writew |
|---|
| 467 | | -#define writel_relaxed writel |
|---|
| 468 | | -#define writeq_relaxed writeq |
|---|
| 388 | +#define writeb_relaxed __relaxed_writeb |
|---|
| 389 | +#define writew_relaxed __relaxed_writew |
|---|
| 390 | +#define writel_relaxed __relaxed_writel |
|---|
| 391 | +#ifdef CONFIG_64BIT |
|---|
| 392 | +#define writeq_relaxed __relaxed_writeq |
|---|
| 393 | +#endif |
|---|
| 469 | 394 | |
|---|
| 470 | 395 | #define readb_be(addr) \ |
|---|
| 471 | 396 | __raw_readb((__force unsigned *)(addr)) |
|---|
| .. | .. |
|---|
| 488 | 413 | /* |
|---|
| 489 | 414 | * Some code tests for these symbols |
|---|
| 490 | 415 | */ |
|---|
| 416 | +#ifdef CONFIG_64BIT |
|---|
| 491 | 417 | #define readq readq |
|---|
| 492 | 418 | #define writeq writeq |
|---|
| 419 | +#endif |
|---|
| 493 | 420 | |
|---|
| 494 | 421 | #define __BUILD_MEMORY_STRING(bwlq, type) \ |
|---|
| 495 | 422 | \ |
|---|
| .. | .. |
|---|
| 549 | 476 | BUILDSTRING(l, u32) |
|---|
| 550 | 477 | #ifdef CONFIG_64BIT |
|---|
| 551 | 478 | BUILDSTRING(q, u64) |
|---|
| 552 | | -#endif |
|---|
| 553 | | - |
|---|
| 554 | | - |
|---|
| 555 | | -#ifdef CONFIG_CPU_CAVIUM_OCTEON |
|---|
| 556 | | -#define mmiowb() wmb() |
|---|
| 557 | | -#else |
|---|
| 558 | | -/* Depends on MIPS II instruction set */ |
|---|
| 559 | | -#define mmiowb() asm volatile ("sync" ::: "memory") |
|---|
| 560 | 479 | #endif |
|---|
| 561 | 480 | |
|---|
| 562 | 481 | static inline void memset_io(volatile void __iomem *addr, unsigned char val, int count) |
|---|