aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-mips
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-mips')
-rw-r--r--include/asm-mips/io.h57
1 files changed, 32 insertions, 25 deletions
diff --git a/include/asm-mips/io.h b/include/asm-mips/io.h
index 42f80782acd2..3061870b7f6c 100644
--- a/include/asm-mips/io.h
+++ b/include/asm-mips/io.h
@@ -387,11 +387,11 @@ static inline void pfx##out##bwlq##p(type val, unsigned long port) \
387 \ 387 \
388 __val = pfx##ioswab##bwlq(val); \ 388 __val = pfx##ioswab##bwlq(val); \
389 \ 389 \
390 if (sizeof(type) != sizeof(u64)) { \ 390 /* Really, we want this to be atomic */ \
391 *__addr = __val; \ 391 BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \
392 slow; \ 392 \
393 } else \ 393 *__addr = __val; \
394 BUILD_BUG(); \ 394 slow; \
395} \ 395} \
396 \ 396 \
397static inline type pfx##in##bwlq##p(unsigned long port) \ 397static inline type pfx##in##bwlq##p(unsigned long port) \
@@ -402,13 +402,10 @@ static inline type pfx##in##bwlq##p(unsigned long port) \
402 port = __swizzle_addr_##bwlq(port); \ 402 port = __swizzle_addr_##bwlq(port); \
403 __addr = (void *)(mips_io_port_base + port); \ 403 __addr = (void *)(mips_io_port_base + port); \
404 \ 404 \
405 if (sizeof(type) != sizeof(u64)) { \ 405 BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \
406 __val = *__addr; \ 406 \
407 slow; \ 407 __val = *__addr; \
408 } else { \ 408 slow; \
409 __val = 0; \
410 BUILD_BUG(); \
411 } \
412 \ 409 \
413 return pfx##ioswab##bwlq(__val); \ 410 return pfx##ioswab##bwlq(__val); \
414} 411}
@@ -417,28 +414,36 @@ static inline type pfx##in##bwlq##p(unsigned long port) \
417 \ 414 \
418__BUILD_MEMORY_SINGLE(bus, bwlq, type, 1) 415__BUILD_MEMORY_SINGLE(bus, bwlq, type, 1)
419 416
420#define __BUILD_IOPORT_PFX(bus, bwlq, type) \ 417#define BUILDIO_MEM(bwlq, type) \
421 \
422__BUILD_IOPORT_SINGLE(bus, bwlq, type, ,) \
423__BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO)
424
425#define BUILDIO(bwlq, type) \
426 \ 418 \
427__BUILD_MEMORY_PFX(__raw_, bwlq, type) \ 419__BUILD_MEMORY_PFX(__raw_, bwlq, type) \
428__BUILD_MEMORY_PFX(, bwlq, type) \ 420__BUILD_MEMORY_PFX(, bwlq, type) \
429__BUILD_MEMORY_PFX(mem_, bwlq, type) \ 421__BUILD_MEMORY_PFX(mem_, bwlq, type) \
430__BUILD_IOPORT_PFX(, bwlq, type) \ 422
431__BUILD_IOPORT_PFX(mem_, bwlq, type) 423BUILDIO_MEM(b, u8)
424BUILDIO_MEM(w, u16)
425BUILDIO_MEM(l, u32)
426BUILDIO_MEM(q, u64)
427
428#define __BUILD_IOPORT_PFX(bus, bwlq, type) \
429 __BUILD_IOPORT_SINGLE(bus, bwlq, type, ,) \
430 __BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO)
431
432#define BUILDIO_IOPORT(bwlq, type) \
433 __BUILD_IOPORT_PFX(, bwlq, type) \
434 __BUILD_IOPORT_PFX(mem_, bwlq, type)
435
436BUILDIO_IOPORT(b, u8)
437BUILDIO_IOPORT(w, u16)
438BUILDIO_IOPORT(l, u32)
439#ifdef CONFIG_64BIT
440BUILDIO_IOPORT(q, u64)
441#endif
432 442
433#define __BUILDIO(bwlq, type) \ 443#define __BUILDIO(bwlq, type) \
434 \ 444 \
435__BUILD_MEMORY_SINGLE(____raw_, bwlq, type, 0) 445__BUILD_MEMORY_SINGLE(____raw_, bwlq, type, 0)
436 446
437BUILDIO(b, u8)
438BUILDIO(w, u16)
439BUILDIO(l, u32)
440BUILDIO(q, u64)
441
442__BUILDIO(q, u64) 447__BUILDIO(q, u64)
443 448
444#define readb_relaxed readb 449#define readb_relaxed readb
@@ -508,7 +513,9 @@ __BUILD_IOPORT_STRING(bwlq, type)
508BUILDSTRING(b, u8) 513BUILDSTRING(b, u8)
509BUILDSTRING(w, u16) 514BUILDSTRING(w, u16)
510BUILDSTRING(l, u32) 515BUILDSTRING(l, u32)
516#ifdef CONFIG_64BIT
511BUILDSTRING(q, u64) 517BUILDSTRING(q, u64)
518#endif
512 519
513 520
514/* Depends on MIPS II instruction set */ 521/* Depends on MIPS II instruction set */