Commit caf81329c39b5c48f6cc0d78fa159b5a587e37f9
Committed by
Paul Mackerras
1 parent
7da8a2e5c1
Exists in
master
and in
7 other branches
[POWERPC] Merge iSeries i/o operations with the rest
This patch changes the io operations so that they are out of line if CONFIG_PPC_ISERIES is set and includes a firmware feature check in that case. Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
Showing 4 changed files with 319 additions and 183 deletions Side-by-side Diff
arch/powerpc/kernel/io.c
... | ... | @@ -22,12 +22,16 @@ |
22 | 22 | #include <linux/module.h> |
23 | 23 | |
24 | 24 | #include <asm/io.h> |
25 | +#include <asm/firmware.h> | |
26 | +#include <asm/bug.h> | |
25 | 27 | |
26 | 28 | void _insb(volatile u8 __iomem *port, void *buf, long count) |
27 | 29 | { |
28 | 30 | u8 *tbuf = buf; |
29 | 31 | u8 tmp; |
30 | 32 | |
33 | + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | |
34 | + | |
31 | 35 | if (unlikely(count <= 0)) |
32 | 36 | return; |
33 | 37 | asm volatile("sync"); |
... | ... | @@ -44,6 +48,8 @@ |
44 | 48 | { |
45 | 49 | const u8 *tbuf = buf; |
46 | 50 | |
51 | + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | |
52 | + | |
47 | 53 | if (unlikely(count <= 0)) |
48 | 54 | return; |
49 | 55 | asm volatile("sync"); |
... | ... | @@ -59,6 +65,8 @@ |
59 | 65 | u16 *tbuf = buf; |
60 | 66 | u16 tmp; |
61 | 67 | |
68 | + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | |
69 | + | |
62 | 70 | if (unlikely(count <= 0)) |
63 | 71 | return; |
64 | 72 | asm volatile("sync"); |
... | ... | @@ -75,6 +83,8 @@ |
75 | 83 | { |
76 | 84 | const u16 *tbuf = buf; |
77 | 85 | |
86 | + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | |
87 | + | |
78 | 88 | if (unlikely(count <= 0)) |
79 | 89 | return; |
80 | 90 | asm volatile("sync"); |
... | ... | @@ -90,6 +100,8 @@ |
90 | 100 | u32 *tbuf = buf; |
91 | 101 | u32 tmp; |
92 | 102 | |
103 | + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | |
104 | + | |
93 | 105 | if (unlikely(count <= 0)) |
94 | 106 | return; |
95 | 107 | asm volatile("sync"); |
... | ... | @@ -105,6 +117,8 @@ |
105 | 117 | void _outsl_ns(volatile u32 __iomem *port, const void *buf, long count) |
106 | 118 | { |
107 | 119 | const u32 *tbuf = buf; |
120 | + | |
121 | + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | |
108 | 122 | |
109 | 123 | if (unlikely(count <= 0)) |
110 | 124 | return; |
arch/powerpc/platforms/iseries/pci.c
... | ... | @@ -34,6 +34,7 @@ |
34 | 34 | #include <asm/pci-bridge.h> |
35 | 35 | #include <asm/iommu.h> |
36 | 36 | #include <asm/abs_addr.h> |
37 | +#include <asm/firmware.h> | |
37 | 38 | |
38 | 39 | #include <asm/iseries/hv_call_xm.h> |
39 | 40 | #include <asm/iseries/mf.h> |
... | ... | @@ -270,46 +271,6 @@ |
270 | 271 | } |
271 | 272 | |
272 | 273 | /* |
273 | - * I/0 Memory copy MUST use mmio commands on iSeries | |
274 | - * To do; For performance, include the hv call directly | |
275 | - */ | |
276 | -void iSeries_memset_io(volatile void __iomem *dest, char c, size_t Count) | |
277 | -{ | |
278 | - u8 ByteValue = c; | |
279 | - long NumberOfBytes = Count; | |
280 | - | |
281 | - while (NumberOfBytes > 0) { | |
282 | - iSeries_Write_Byte(ByteValue, dest++); | |
283 | - -- NumberOfBytes; | |
284 | - } | |
285 | -} | |
286 | -EXPORT_SYMBOL(iSeries_memset_io); | |
287 | - | |
288 | -void iSeries_memcpy_toio(volatile void __iomem *dest, void *source, size_t count) | |
289 | -{ | |
290 | - char *src = source; | |
291 | - long NumberOfBytes = count; | |
292 | - | |
293 | - while (NumberOfBytes > 0) { | |
294 | - iSeries_Write_Byte(*src++, dest++); | |
295 | - -- NumberOfBytes; | |
296 | - } | |
297 | -} | |
298 | -EXPORT_SYMBOL(iSeries_memcpy_toio); | |
299 | - | |
300 | -void iSeries_memcpy_fromio(void *dest, const volatile void __iomem *src, size_t count) | |
301 | -{ | |
302 | - char *dst = dest; | |
303 | - long NumberOfBytes = count; | |
304 | - | |
305 | - while (NumberOfBytes > 0) { | |
306 | - *dst++ = iSeries_Read_Byte(src++); | |
307 | - -- NumberOfBytes; | |
308 | - } | |
309 | -} | |
310 | -EXPORT_SYMBOL(iSeries_memcpy_fromio); | |
311 | - | |
312 | -/* | |
313 | 274 | * Look down the chain to find the matching Device Device |
314 | 275 | */ |
315 | 276 | static struct device_node *find_Device_Node(int bus, int devfn) |
... | ... | @@ -491,7 +452,7 @@ |
491 | 452 | * iSeries_Read_Word = Read Word (16 bit) |
492 | 453 | * iSeries_Read_Long = Read Long (32 bit) |
493 | 454 | */ |
494 | -u8 iSeries_Read_Byte(const volatile void __iomem *IoAddress) | |
455 | +static u8 iSeries_Read_Byte(const volatile void __iomem *IoAddress) | |
495 | 456 | { |
496 | 457 | u64 BarOffset; |
497 | 458 | u64 dsa; |
498 | 459 | |
... | ... | @@ -518,9 +479,8 @@ |
518 | 479 | |
519 | 480 | return (u8)ret.value; |
520 | 481 | } |
521 | -EXPORT_SYMBOL(iSeries_Read_Byte); | |
522 | 482 | |
523 | -u16 iSeries_Read_Word(const volatile void __iomem *IoAddress) | |
483 | +static u16 iSeries_Read_Word(const volatile void __iomem *IoAddress) | |
524 | 484 | { |
525 | 485 | u64 BarOffset; |
526 | 486 | u64 dsa; |
527 | 487 | |
... | ... | @@ -548,9 +508,8 @@ |
548 | 508 | |
549 | 509 | return swab16((u16)ret.value); |
550 | 510 | } |
551 | -EXPORT_SYMBOL(iSeries_Read_Word); | |
552 | 511 | |
553 | -u32 iSeries_Read_Long(const volatile void __iomem *IoAddress) | |
512 | +static u32 iSeries_Read_Long(const volatile void __iomem *IoAddress) | |
554 | 513 | { |
555 | 514 | u64 BarOffset; |
556 | 515 | u64 dsa; |
... | ... | @@ -578,7 +537,6 @@ |
578 | 537 | |
579 | 538 | return swab32((u32)ret.value); |
580 | 539 | } |
581 | -EXPORT_SYMBOL(iSeries_Read_Long); | |
582 | 540 | |
583 | 541 | /* |
584 | 542 | * Write MM I/O Instructions for the iSeries |
... | ... | @@ -587,7 +545,7 @@ |
587 | 545 | * iSeries_Write_Word = Write Word(16 bit) |
588 | 546 | * iSeries_Write_Long = Write Long(32 bit) |
589 | 547 | */ |
590 | -void iSeries_Write_Byte(u8 data, volatile void __iomem *IoAddress) | |
548 | +static void iSeries_Write_Byte(u8 data, volatile void __iomem *IoAddress) | |
591 | 549 | { |
592 | 550 | u64 BarOffset; |
593 | 551 | u64 dsa; |
594 | 552 | |
... | ... | @@ -612,9 +570,8 @@ |
612 | 570 | rc = HvCall4(HvCallPciBarStore8, dsa, BarOffset, data, 0); |
613 | 571 | } while (CheckReturnCode("WWB", DevNode, &retry, rc) != 0); |
614 | 572 | } |
615 | -EXPORT_SYMBOL(iSeries_Write_Byte); | |
616 | 573 | |
617 | -void iSeries_Write_Word(u16 data, volatile void __iomem *IoAddress) | |
574 | +static void iSeries_Write_Word(u16 data, volatile void __iomem *IoAddress) | |
618 | 575 | { |
619 | 576 | u64 BarOffset; |
620 | 577 | u64 dsa; |
621 | 578 | |
... | ... | @@ -639,9 +596,8 @@ |
639 | 596 | rc = HvCall4(HvCallPciBarStore16, dsa, BarOffset, swab16(data), 0); |
640 | 597 | } while (CheckReturnCode("WWW", DevNode, &retry, rc) != 0); |
641 | 598 | } |
642 | -EXPORT_SYMBOL(iSeries_Write_Word); | |
643 | 599 | |
644 | -void iSeries_Write_Long(u32 data, volatile void __iomem *IoAddress) | |
600 | +static void iSeries_Write_Long(u32 data, volatile void __iomem *IoAddress) | |
645 | 601 | { |
646 | 602 | u64 BarOffset; |
647 | 603 | u64 dsa; |
... | ... | @@ -666,5 +622,225 @@ |
666 | 622 | rc = HvCall4(HvCallPciBarStore32, dsa, BarOffset, swab32(data), 0); |
667 | 623 | } while (CheckReturnCode("WWL", DevNode, &retry, rc) != 0); |
668 | 624 | } |
669 | -EXPORT_SYMBOL(iSeries_Write_Long); | |
625 | + | |
626 | +extern unsigned char __raw_readb(const volatile void __iomem *addr) | |
627 | +{ | |
628 | + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | |
629 | + | |
630 | + return *(volatile unsigned char __force *)addr; | |
631 | +} | |
632 | +EXPORT_SYMBOL(__raw_readb); | |
633 | + | |
634 | +extern unsigned short __raw_readw(const volatile void __iomem *addr) | |
635 | +{ | |
636 | + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | |
637 | + | |
638 | + return *(volatile unsigned short __force *)addr; | |
639 | +} | |
640 | +EXPORT_SYMBOL(__raw_readw); | |
641 | + | |
642 | +extern unsigned int __raw_readl(const volatile void __iomem *addr) | |
643 | +{ | |
644 | + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | |
645 | + | |
646 | + return *(volatile unsigned int __force *)addr; | |
647 | +} | |
648 | +EXPORT_SYMBOL(__raw_readl); | |
649 | + | |
650 | +extern unsigned long __raw_readq(const volatile void __iomem *addr) | |
651 | +{ | |
652 | + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | |
653 | + | |
654 | + return *(volatile unsigned long __force *)addr; | |
655 | +} | |
656 | +EXPORT_SYMBOL(__raw_readq); | |
657 | + | |
658 | +extern void __raw_writeb(unsigned char v, volatile void __iomem *addr) | |
659 | +{ | |
660 | + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | |
661 | + | |
662 | + *(volatile unsigned char __force *)addr = v; | |
663 | +} | |
664 | +EXPORT_SYMBOL(__raw_writeb); | |
665 | + | |
666 | +extern void __raw_writew(unsigned short v, volatile void __iomem *addr) | |
667 | +{ | |
668 | + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | |
669 | + | |
670 | + *(volatile unsigned short __force *)addr = v; | |
671 | +} | |
672 | +EXPORT_SYMBOL(__raw_writew); | |
673 | + | |
674 | +extern void __raw_writel(unsigned int v, volatile void __iomem *addr) | |
675 | +{ | |
676 | + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | |
677 | + | |
678 | + *(volatile unsigned int __force *)addr = v; | |
679 | +} | |
680 | +EXPORT_SYMBOL(__raw_writel); | |
681 | + | |
682 | +extern void __raw_writeq(unsigned long v, volatile void __iomem *addr) | |
683 | +{ | |
684 | + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | |
685 | + | |
686 | + *(volatile unsigned long __force *)addr = v; | |
687 | +} | |
688 | +EXPORT_SYMBOL(__raw_writeq); | |
689 | + | |
690 | +int in_8(const volatile unsigned char __iomem *addr) | |
691 | +{ | |
692 | + if (firmware_has_feature(FW_FEATURE_ISERIES)) | |
693 | + return iSeries_Read_Byte(addr); | |
694 | + return __in_8(addr); | |
695 | +} | |
696 | +EXPORT_SYMBOL(in_8); | |
697 | + | |
698 | +void out_8(volatile unsigned char __iomem *addr, int val) | |
699 | +{ | |
700 | + if (firmware_has_feature(FW_FEATURE_ISERIES)) | |
701 | + iSeries_Write_Byte(val, addr); | |
702 | + else | |
703 | + __out_8(addr, val); | |
704 | +} | |
705 | +EXPORT_SYMBOL(out_8); | |
706 | + | |
707 | +int in_le16(const volatile unsigned short __iomem *addr) | |
708 | +{ | |
709 | + if (firmware_has_feature(FW_FEATURE_ISERIES)) | |
710 | + return iSeries_Read_Word(addr); | |
711 | + return __in_le16(addr); | |
712 | +} | |
713 | +EXPORT_SYMBOL(in_le16); | |
714 | + | |
715 | +int in_be16(const volatile unsigned short __iomem *addr) | |
716 | +{ | |
717 | + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | |
718 | + | |
719 | + return __in_be16(addr); | |
720 | +} | |
721 | +EXPORT_SYMBOL(in_be16); | |
722 | + | |
723 | +void out_le16(volatile unsigned short __iomem *addr, int val) | |
724 | +{ | |
725 | + if (firmware_has_feature(FW_FEATURE_ISERIES)) | |
726 | + iSeries_Write_Word(val, addr); | |
727 | + else | |
728 | + __out_le16(addr, val); | |
729 | +} | |
730 | +EXPORT_SYMBOL(out_le16); | |
731 | + | |
732 | +void out_be16(volatile unsigned short __iomem *addr, int val) | |
733 | +{ | |
734 | + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | |
735 | + | |
736 | + __out_be16(addr, val); | |
737 | +} | |
738 | +EXPORT_SYMBOL(out_be16); | |
739 | + | |
740 | +unsigned in_le32(const volatile unsigned __iomem *addr) | |
741 | +{ | |
742 | + if (firmware_has_feature(FW_FEATURE_ISERIES)) | |
743 | + return iSeries_Read_Long(addr); | |
744 | + return __in_le32(addr); | |
745 | +} | |
746 | +EXPORT_SYMBOL(in_le32); | |
747 | + | |
748 | +unsigned in_be32(const volatile unsigned __iomem *addr) | |
749 | +{ | |
750 | + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | |
751 | + | |
752 | + return __in_be32(addr); | |
753 | +} | |
754 | +EXPORT_SYMBOL(in_be32); | |
755 | + | |
756 | +void out_le32(volatile unsigned __iomem *addr, int val) | |
757 | +{ | |
758 | + if (firmware_has_feature(FW_FEATURE_ISERIES)) | |
759 | + iSeries_Write_Long(val, addr); | |
760 | + else | |
761 | + __out_le32(addr, val); | |
762 | +} | |
763 | +EXPORT_SYMBOL(out_le32); | |
764 | + | |
765 | +void out_be32(volatile unsigned __iomem *addr, int val) | |
766 | +{ | |
767 | + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | |
768 | + | |
769 | + __out_be32(addr, val); | |
770 | +} | |
771 | +EXPORT_SYMBOL(out_be32); | |
772 | + | |
773 | +unsigned long in_le64(const volatile unsigned long __iomem *addr) | |
774 | +{ | |
775 | + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | |
776 | + | |
777 | + return __in_le64(addr); | |
778 | +} | |
779 | +EXPORT_SYMBOL(in_le64); | |
780 | + | |
781 | +unsigned long in_be64(const volatile unsigned long __iomem *addr) | |
782 | +{ | |
783 | + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | |
784 | + | |
785 | + return __in_be64(addr); | |
786 | +} | |
787 | +EXPORT_SYMBOL(in_be64); | |
788 | + | |
789 | +void out_le64(volatile unsigned long __iomem *addr, unsigned long val) | |
790 | +{ | |
791 | + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | |
792 | + | |
793 | + __out_le64(addr, val); | |
794 | +} | |
795 | +EXPORT_SYMBOL(out_le64); | |
796 | + | |
797 | +void out_be64(volatile unsigned long __iomem *addr, unsigned long val) | |
798 | +{ | |
799 | + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | |
800 | + | |
801 | + __out_be64(addr, val); | |
802 | +} | |
803 | +EXPORT_SYMBOL(out_be64); | |
804 | + | |
805 | +void memset_io(volatile void __iomem *addr, int c, unsigned long n) | |
806 | +{ | |
807 | + if (firmware_has_feature(FW_FEATURE_ISERIES)) { | |
808 | + volatile char __iomem *d = addr; | |
809 | + | |
810 | + while (n-- > 0) { | |
811 | + iSeries_Write_Byte(c, d++); | |
812 | + } | |
813 | + } else | |
814 | + eeh_memset_io(addr, c, n); | |
815 | +} | |
816 | +EXPORT_SYMBOL(memset_io); | |
817 | + | |
818 | +void memcpy_fromio(void *dest, const volatile void __iomem *src, | |
819 | + unsigned long n) | |
820 | +{ | |
821 | + if (firmware_has_feature(FW_FEATURE_ISERIES)) { | |
822 | + char *d = dest; | |
823 | + const volatile char __iomem *s = src; | |
824 | + | |
825 | + while (n-- > 0) { | |
826 | + *d++ = iSeries_Read_Byte(s++); | |
827 | + } | |
828 | + } else | |
829 | + eeh_memcpy_fromio(dest, src, n); | |
830 | +} | |
831 | +EXPORT_SYMBOL(memcpy_fromio); | |
832 | + | |
833 | +void memcpy_toio(volatile void __iomem *dest, const void *src, unsigned long n) | |
834 | +{ | |
835 | + if (firmware_has_feature(FW_FEATURE_ISERIES)) { | |
836 | + const char *s = src; | |
837 | + volatile char __iomem *d = dest; | |
838 | + | |
839 | + while (n-- > 0) { | |
840 | + iSeries_Write_Byte(*s++, d++); | |
841 | + } | |
842 | + } else | |
843 | + eeh_memcpy_toio(dest, src, n); | |
844 | +} | |
845 | +EXPORT_SYMBOL(memcpy_toio); |
include/asm-powerpc/io.h
... | ... | @@ -20,9 +20,6 @@ |
20 | 20 | #include <asm/page.h> |
21 | 21 | #include <asm/byteorder.h> |
22 | 22 | #include <asm/paca.h> |
23 | -#ifdef CONFIG_PPC_ISERIES | |
24 | -#include <asm/iseries/iseries_io.h> | |
25 | -#endif | |
26 | 23 | #include <asm/synch.h> |
27 | 24 | #include <asm/delay.h> |
28 | 25 | |
29 | 26 | |
30 | 27 | |
31 | 28 | |
... | ... | @@ -37,42 +34,54 @@ |
37 | 34 | extern unsigned long pci_io_base; |
38 | 35 | |
39 | 36 | #ifdef CONFIG_PPC_ISERIES |
40 | -/* __raw_* accessors aren't supported on iSeries */ | |
41 | -#define __raw_readb(addr) { BUG(); 0; } | |
42 | -#define __raw_readw(addr) { BUG(); 0; } | |
43 | -#define __raw_readl(addr) { BUG(); 0; } | |
44 | -#define __raw_readq(addr) { BUG(); 0; } | |
45 | -#define __raw_writeb(v, addr) { BUG(); 0; } | |
46 | -#define __raw_writew(v, addr) { BUG(); 0; } | |
47 | -#define __raw_writel(v, addr) { BUG(); 0; } | |
48 | -#define __raw_writeq(v, addr) { BUG(); 0; } | |
49 | -#define readb(addr) iSeries_Read_Byte(addr) | |
50 | -#define readw(addr) iSeries_Read_Word(addr) | |
51 | -#define readl(addr) iSeries_Read_Long(addr) | |
52 | -#define writeb(data, addr) iSeries_Write_Byte((data),(addr)) | |
53 | -#define writew(data, addr) iSeries_Write_Word((data),(addr)) | |
54 | -#define writel(data, addr) iSeries_Write_Long((data),(addr)) | |
55 | -#define memset_io(a,b,c) iSeries_memset_io((a),(b),(c)) | |
56 | -#define memcpy_fromio(a,b,c) iSeries_memcpy_fromio((a), (b), (c)) | |
57 | -#define memcpy_toio(a,b,c) iSeries_memcpy_toio((a), (b), (c)) | |
58 | 37 | |
59 | -#define inb(addr) readb(((void __iomem *)(long)(addr))) | |
60 | -#define inw(addr) readw(((void __iomem *)(long)(addr))) | |
61 | -#define inl(addr) readl(((void __iomem *)(long)(addr))) | |
62 | -#define outb(data,addr) writeb(data,((void __iomem *)(long)(addr))) | |
63 | -#define outw(data,addr) writew(data,((void __iomem *)(long)(addr))) | |
64 | -#define outl(data,addr) writel(data,((void __iomem *)(long)(addr))) | |
65 | -/* | |
66 | - * The *_ns versions below don't do byte-swapping. | |
67 | - * Neither do the standard versions now, these are just here | |
68 | - * for older code. | |
69 | - */ | |
70 | -#define insb(port, buf, ns) _insb((u8 __iomem *)((port)+pci_io_base), (buf), (ns)) | |
71 | -#define insw(port, buf, ns) _insw_ns((u16 __iomem *)((port)+pci_io_base), (buf), (ns)) | |
72 | -#define insl(port, buf, nl) _insl_ns((u32 __iomem *)((port)+pci_io_base), (buf), (nl)) | |
38 | +extern int in_8(const volatile unsigned char __iomem *addr); | |
39 | +extern void out_8(volatile unsigned char __iomem *addr, int val); | |
40 | +extern int in_le16(const volatile unsigned short __iomem *addr); | |
41 | +extern int in_be16(const volatile unsigned short __iomem *addr); | |
42 | +extern void out_le16(volatile unsigned short __iomem *addr, int val); | |
43 | +extern void out_be16(volatile unsigned short __iomem *addr, int val); | |
44 | +extern unsigned in_le32(const volatile unsigned __iomem *addr); | |
45 | +extern unsigned in_be32(const volatile unsigned __iomem *addr); | |
46 | +extern void out_le32(volatile unsigned __iomem *addr, int val); | |
47 | +extern void out_be32(volatile unsigned __iomem *addr, int val); | |
48 | +extern unsigned long in_le64(const volatile unsigned long __iomem *addr); | |
49 | +extern unsigned long in_be64(const volatile unsigned long __iomem *addr); | |
50 | +extern void out_le64(volatile unsigned long __iomem *addr, unsigned long val); | |
51 | +extern void out_be64(volatile unsigned long __iomem *addr, unsigned long val); | |
73 | 52 | |
74 | -#else | |
53 | +extern unsigned char __raw_readb(const volatile void __iomem *addr); | |
54 | +extern unsigned short __raw_readw(const volatile void __iomem *addr); | |
55 | +extern unsigned int __raw_readl(const volatile void __iomem *addr); | |
56 | +extern unsigned long __raw_readq(const volatile void __iomem *addr); | |
57 | +extern void __raw_writeb(unsigned char v, volatile void __iomem *addr); | |
58 | +extern void __raw_writew(unsigned short v, volatile void __iomem *addr); | |
59 | +extern void __raw_writel(unsigned int v, volatile void __iomem *addr); | |
60 | +extern void __raw_writeq(unsigned long v, volatile void __iomem *addr); | |
75 | 61 | |
62 | +extern void memset_io(volatile void __iomem *addr, int c, unsigned long n); | |
63 | +extern void memcpy_fromio(void *dest, const volatile void __iomem *src, | |
64 | + unsigned long n); | |
65 | +extern void memcpy_toio(volatile void __iomem *dest, const void *src, | |
66 | + unsigned long n); | |
67 | + | |
68 | +#else /* CONFIG_PPC_ISERIES */ | |
69 | + | |
70 | +#define in_8(addr) __in_8((addr)) | |
71 | +#define out_8(addr, val) __out_8((addr), (val)) | |
72 | +#define in_le16(addr) __in_le16((addr)) | |
73 | +#define in_be16(addr) __in_be16((addr)) | |
74 | +#define out_le16(addr, val) __out_le16((addr), (val)) | |
75 | +#define out_be16(addr, val) __out_be16((addr), (val)) | |
76 | +#define in_le32(addr) __in_le32((addr)) | |
77 | +#define in_be32(addr) __in_be32((addr)) | |
78 | +#define out_le32(addr, val) __out_le32((addr), (val)) | |
79 | +#define out_be32(addr, val) __out_be32((addr), (val)) | |
80 | +#define in_le64(addr) __in_le64((addr)) | |
81 | +#define in_be64(addr) __in_be64((addr)) | |
82 | +#define out_le64(addr, val) __out_le64((addr), (val)) | |
83 | +#define out_be64(addr, val) __out_be64((addr), (val)) | |
84 | + | |
76 | 85 | static inline unsigned char __raw_readb(const volatile void __iomem *addr) |
77 | 86 | { |
78 | 87 | return *(volatile unsigned char __force *)addr; |
79 | 88 | |
80 | 89 | |
... | ... | @@ -105,24 +114,12 @@ |
105 | 114 | { |
106 | 115 | *(volatile unsigned long __force *)addr = v; |
107 | 116 | } |
108 | -#define readb(addr) eeh_readb(addr) | |
109 | -#define readw(addr) eeh_readw(addr) | |
110 | -#define readl(addr) eeh_readl(addr) | |
111 | -#define readq(addr) eeh_readq(addr) | |
112 | -#define writeb(data, addr) eeh_writeb((data), (addr)) | |
113 | -#define writew(data, addr) eeh_writew((data), (addr)) | |
114 | -#define writel(data, addr) eeh_writel((data), (addr)) | |
115 | -#define writeq(data, addr) eeh_writeq((data), (addr)) | |
116 | 117 | #define memset_io(a,b,c) eeh_memset_io((a),(b),(c)) |
117 | 118 | #define memcpy_fromio(a,b,c) eeh_memcpy_fromio((a),(b),(c)) |
118 | 119 | #define memcpy_toio(a,b,c) eeh_memcpy_toio((a),(b),(c)) |
119 | -#define inb(port) eeh_inb((unsigned long)port) | |
120 | -#define outb(val, port) eeh_outb(val, (unsigned long)port) | |
121 | -#define inw(port) eeh_inw((unsigned long)port) | |
122 | -#define outw(val, port) eeh_outw(val, (unsigned long)port) | |
123 | -#define inl(port) eeh_inl((unsigned long)port) | |
124 | -#define outl(val, port) eeh_outl(val, (unsigned long)port) | |
125 | 120 | |
121 | +#endif /* CONFIG_PPC_ISERIES */ | |
122 | + | |
126 | 123 | /* |
127 | 124 | * The insw/outsw/insl/outsl macros don't do byte-swapping. |
128 | 125 | * They are only used in practice for transferring buffers which |
129 | 126 | |
... | ... | @@ -132,12 +129,25 @@ |
132 | 129 | #define insw(port, buf, ns) eeh_insw_ns((port), (buf), (ns)) |
133 | 130 | #define insl(port, buf, nl) eeh_insl_ns((port), (buf), (nl)) |
134 | 131 | |
135 | -#endif | |
136 | - | |
137 | 132 | #define outsb(port, buf, ns) _outsb((u8 __iomem *)((port)+pci_io_base), (buf), (ns)) |
138 | 133 | #define outsw(port, buf, ns) _outsw_ns((u16 __iomem *)((port)+pci_io_base), (buf), (ns)) |
139 | 134 | #define outsl(port, buf, nl) _outsl_ns((u32 __iomem *)((port)+pci_io_base), (buf), (nl)) |
140 | 135 | |
136 | +#define readb(addr) eeh_readb(addr) | |
137 | +#define readw(addr) eeh_readw(addr) | |
138 | +#define readl(addr) eeh_readl(addr) | |
139 | +#define readq(addr) eeh_readq(addr) | |
140 | +#define writeb(data, addr) eeh_writeb((data), (addr)) | |
141 | +#define writew(data, addr) eeh_writew((data), (addr)) | |
142 | +#define writel(data, addr) eeh_writel((data), (addr)) | |
143 | +#define writeq(data, addr) eeh_writeq((data), (addr)) | |
144 | +#define inb(port) eeh_inb((unsigned long)port) | |
145 | +#define outb(val, port) eeh_outb(val, (unsigned long)port) | |
146 | +#define inw(port) eeh_inw((unsigned long)port) | |
147 | +#define outw(val, port) eeh_outw(val, (unsigned long)port) | |
148 | +#define inl(port) eeh_inl((unsigned long)port) | |
149 | +#define outl(val, port) eeh_outl(val, (unsigned long)port) | |
150 | + | |
141 | 151 | #define readb_relaxed(addr) readb(addr) |
142 | 152 | #define readw_relaxed(addr) readw(addr) |
143 | 153 | #define readl_relaxed(addr) readl(addr) |
... | ... | @@ -258,7 +268,7 @@ |
258 | 268 | * and should not be used directly by device drivers. Use inb/readb |
259 | 269 | * instead. |
260 | 270 | */ |
261 | -static inline int in_8(const volatile unsigned char __iomem *addr) | |
271 | +static inline int __in_8(const volatile unsigned char __iomem *addr) | |
262 | 272 | { |
263 | 273 | int ret; |
264 | 274 | |
265 | 275 | |
... | ... | @@ -267,14 +277,14 @@ |
267 | 277 | return ret; |
268 | 278 | } |
269 | 279 | |
270 | -static inline void out_8(volatile unsigned char __iomem *addr, int val) | |
280 | +static inline void __out_8(volatile unsigned char __iomem *addr, int val) | |
271 | 281 | { |
272 | 282 | __asm__ __volatile__("sync; stb%U0%X0 %1,%0" |
273 | 283 | : "=m" (*addr) : "r" (val)); |
274 | 284 | get_paca()->io_sync = 1; |
275 | 285 | } |
276 | 286 | |
277 | -static inline int in_le16(const volatile unsigned short __iomem *addr) | |
287 | +static inline int __in_le16(const volatile unsigned short __iomem *addr) | |
278 | 288 | { |
279 | 289 | int ret; |
280 | 290 | |
... | ... | @@ -283,7 +293,7 @@ |
283 | 293 | return ret; |
284 | 294 | } |
285 | 295 | |
286 | -static inline int in_be16(const volatile unsigned short __iomem *addr) | |
296 | +static inline int __in_be16(const volatile unsigned short __iomem *addr) | |
287 | 297 | { |
288 | 298 | int ret; |
289 | 299 | |
290 | 300 | |
291 | 301 | |
... | ... | @@ -292,21 +302,21 @@ |
292 | 302 | return ret; |
293 | 303 | } |
294 | 304 | |
295 | -static inline void out_le16(volatile unsigned short __iomem *addr, int val) | |
305 | +static inline void __out_le16(volatile unsigned short __iomem *addr, int val) | |
296 | 306 | { |
297 | 307 | __asm__ __volatile__("sync; sthbrx %1,0,%2" |
298 | 308 | : "=m" (*addr) : "r" (val), "r" (addr)); |
299 | 309 | get_paca()->io_sync = 1; |
300 | 310 | } |
301 | 311 | |
302 | -static inline void out_be16(volatile unsigned short __iomem *addr, int val) | |
312 | +static inline void __out_be16(volatile unsigned short __iomem *addr, int val) | |
303 | 313 | { |
304 | 314 | __asm__ __volatile__("sync; sth%U0%X0 %1,%0" |
305 | 315 | : "=m" (*addr) : "r" (val)); |
306 | 316 | get_paca()->io_sync = 1; |
307 | 317 | } |
308 | 318 | |
309 | -static inline unsigned in_le32(const volatile unsigned __iomem *addr) | |
319 | +static inline unsigned __in_le32(const volatile unsigned __iomem *addr) | |
310 | 320 | { |
311 | 321 | unsigned ret; |
312 | 322 | |
... | ... | @@ -315,7 +325,7 @@ |
315 | 325 | return ret; |
316 | 326 | } |
317 | 327 | |
318 | -static inline unsigned in_be32(const volatile unsigned __iomem *addr) | |
328 | +static inline unsigned __in_be32(const volatile unsigned __iomem *addr) | |
319 | 329 | { |
320 | 330 | unsigned ret; |
321 | 331 | |
322 | 332 | |
323 | 333 | |
... | ... | @@ -324,21 +334,21 @@ |
324 | 334 | return ret; |
325 | 335 | } |
326 | 336 | |
327 | -static inline void out_le32(volatile unsigned __iomem *addr, int val) | |
337 | +static inline void __out_le32(volatile unsigned __iomem *addr, int val) | |
328 | 338 | { |
329 | 339 | __asm__ __volatile__("sync; stwbrx %1,0,%2" : "=m" (*addr) |
330 | 340 | : "r" (val), "r" (addr)); |
331 | 341 | get_paca()->io_sync = 1; |
332 | 342 | } |
333 | 343 | |
334 | -static inline void out_be32(volatile unsigned __iomem *addr, int val) | |
344 | +static inline void __out_be32(volatile unsigned __iomem *addr, int val) | |
335 | 345 | { |
336 | 346 | __asm__ __volatile__("sync; stw%U0%X0 %1,%0" |
337 | 347 | : "=m" (*addr) : "r" (val)); |
338 | 348 | get_paca()->io_sync = 1; |
339 | 349 | } |
340 | 350 | |
341 | -static inline unsigned long in_le64(const volatile unsigned long __iomem *addr) | |
351 | +static inline unsigned long __in_le64(const volatile unsigned long __iomem *addr) | |
342 | 352 | { |
343 | 353 | unsigned long tmp, ret; |
344 | 354 | |
... | ... | @@ -358,7 +368,7 @@ |
358 | 368 | return ret; |
359 | 369 | } |
360 | 370 | |
361 | -static inline unsigned long in_be64(const volatile unsigned long __iomem *addr) | |
371 | +static inline unsigned long __in_be64(const volatile unsigned long __iomem *addr) | |
362 | 372 | { |
363 | 373 | unsigned long ret; |
364 | 374 | |
... | ... | @@ -367,7 +377,7 @@ |
367 | 377 | return ret; |
368 | 378 | } |
369 | 379 | |
370 | -static inline void out_le64(volatile unsigned long __iomem *addr, unsigned long val) | |
380 | +static inline void __out_le64(volatile unsigned long __iomem *addr, unsigned long val) | |
371 | 381 | { |
372 | 382 | unsigned long tmp; |
373 | 383 | |
374 | 384 | |
375 | 385 | |
... | ... | @@ -385,15 +395,13 @@ |
385 | 395 | get_paca()->io_sync = 1; |
386 | 396 | } |
387 | 397 | |
388 | -static inline void out_be64(volatile unsigned long __iomem *addr, unsigned long val) | |
398 | +static inline void __out_be64(volatile unsigned long __iomem *addr, unsigned long val) | |
389 | 399 | { |
390 | 400 | __asm__ __volatile__("sync; std%U0%X0 %1,%0" : "=m" (*addr) : "r" (val)); |
391 | 401 | get_paca()->io_sync = 1; |
392 | 402 | } |
393 | 403 | |
394 | -#ifndef CONFIG_PPC_ISERIES | |
395 | 404 | #include <asm/eeh.h> |
396 | -#endif | |
397 | 405 | |
398 | 406 | /** |
399 | 407 | * check_signature - find BIOS signatures |
... | ... | @@ -409,7 +417,6 @@ |
409 | 417 | const unsigned char *signature, int length) |
410 | 418 | { |
411 | 419 | int retval = 0; |
412 | -#ifndef CONFIG_PPC_ISERIES | |
413 | 420 | do { |
414 | 421 | if (readb(io_addr) != *signature) |
415 | 422 | goto out; |
... | ... | @@ -419,7 +426,6 @@ |
419 | 426 | } while (length); |
420 | 427 | retval = 1; |
421 | 428 | out: |
422 | -#endif | |
423 | 429 | return retval; |
424 | 430 | } |
425 | 431 |
include/asm-powerpc/iseries/iseries_io.h
1 | -#ifndef _ASM_POWERPC_ISERIES_ISERIES_IO_H | |
2 | -#define _ASM_POWERPC_ISERIES_ISERIES_IO_H | |
3 | - | |
4 | - | |
5 | -#ifdef CONFIG_PPC_ISERIES | |
6 | -#include <linux/types.h> | |
7 | -/* | |
8 | - * Created by Allan Trautman on Thu Dec 28 2000. | |
9 | - * | |
10 | - * Remaps the io.h for the iSeries Io | |
11 | - * Copyright (C) 2000 Allan H Trautman, IBM Corporation | |
12 | - * | |
13 | - * This program is free software; you can redistribute it and/or modify | |
14 | - * it under the terms of the GNU General Public License as published by | |
15 | - * the Free Software Foundation; either version 2 of the License, or | |
16 | - * (at your option) any later version. | |
17 | - * | |
18 | - * This program is distributed in the hope that it will be useful, | |
19 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | - * GNU General Public License for more details. | |
22 | - * | |
23 | - * You should have received a copy of the GNU General Public License | |
24 | - * along with this program; if not, write to the: | |
25 | - * Free Software Foundation, Inc., | |
26 | - * 59 Temple Place, Suite 330, | |
27 | - * Boston, MA 02111-1307 USA | |
28 | - * | |
29 | - * Change Activity: | |
30 | - * Created December 28, 2000 | |
31 | - * End Change Activity | |
32 | - */ | |
33 | - | |
34 | -#ifdef CONFIG_PCI | |
35 | -extern u8 iSeries_Read_Byte(const volatile void __iomem * IoAddress); | |
36 | -extern u16 iSeries_Read_Word(const volatile void __iomem * IoAddress); | |
37 | -extern u32 iSeries_Read_Long(const volatile void __iomem * IoAddress); | |
38 | -extern void iSeries_Write_Byte(u8 IoData, volatile void __iomem * IoAddress); | |
39 | -extern void iSeries_Write_Word(u16 IoData, volatile void __iomem * IoAddress); | |
40 | -extern void iSeries_Write_Long(u32 IoData, volatile void __iomem * IoAddress); | |
41 | - | |
42 | -extern void iSeries_memset_io(volatile void __iomem *dest, char x, size_t n); | |
43 | -extern void iSeries_memcpy_toio(volatile void __iomem *dest, void *source, | |
44 | - size_t n); | |
45 | -extern void iSeries_memcpy_fromio(void *dest, | |
46 | - const volatile void __iomem *source, size_t n); | |
47 | -#else | |
48 | -static inline u8 iSeries_Read_Byte(const volatile void __iomem *IoAddress) | |
49 | -{ | |
50 | - return 0xff; | |
51 | -} | |
52 | - | |
53 | -static inline void iSeries_Write_Byte(u8 IoData, | |
54 | - volatile void __iomem *IoAddress) | |
55 | -{ | |
56 | -} | |
57 | -#endif /* CONFIG_PCI */ | |
58 | - | |
59 | -#endif /* CONFIG_PPC_ISERIES */ | |
60 | -#endif /* _ASM_POWERPC_ISERIES_ISERIES_IO_H */ |