diff options
Diffstat (limited to 'include/asm-mips')
-rw-r--r-- | include/asm-mips/io.h | 57 |
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 | \ |
397 | static inline type pfx##in##bwlq##p(unsigned long port) \ | 397 | static 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) | 423 | BUILDIO_MEM(b, u8) |
424 | BUILDIO_MEM(w, u16) | ||
425 | BUILDIO_MEM(l, u32) | ||
426 | BUILDIO_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 | |||
436 | BUILDIO_IOPORT(b, u8) | ||
437 | BUILDIO_IOPORT(w, u16) | ||
438 | BUILDIO_IOPORT(l, u32) | ||
439 | #ifdef CONFIG_64BIT | ||
440 | BUILDIO_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 | ||
437 | BUILDIO(b, u8) | ||
438 | BUILDIO(w, u16) | ||
439 | BUILDIO(l, u32) | ||
440 | BUILDIO(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) | |||
508 | BUILDSTRING(b, u8) | 513 | BUILDSTRING(b, u8) |
509 | BUILDSTRING(w, u16) | 514 | BUILDSTRING(w, u16) |
510 | BUILDSTRING(l, u32) | 515 | BUILDSTRING(l, u32) |
516 | #ifdef CONFIG_64BIT | ||
511 | BUILDSTRING(q, u64) | 517 | BUILDSTRING(q, u64) |
518 | #endif | ||
512 | 519 | ||
513 | 520 | ||
514 | /* Depends on MIPS II instruction set */ | 521 | /* Depends on MIPS II instruction set */ |