1 // SPDX-License-Identifier: GPL-2.0
3 * ppc64 "iomap" interface implementation.
5 * (C) Copyright 2004 Linus Torvalds
9 #include <linux/export.h>
11 #include <asm/pci-bridge.h>
12 #include <asm/isa-bridge.h>
15 * Here comes the ppc64 implementation of the IOMAP
18 unsigned int ioread8(void __iomem
*addr
)
22 unsigned int ioread16(void __iomem
*addr
)
26 unsigned int ioread16be(void __iomem
*addr
)
28 return readw_be(addr
);
30 unsigned int ioread32(void __iomem
*addr
)
34 unsigned int ioread32be(void __iomem
*addr
)
36 return readl_be(addr
);
38 EXPORT_SYMBOL(ioread8
);
39 EXPORT_SYMBOL(ioread16
);
40 EXPORT_SYMBOL(ioread16be
);
41 EXPORT_SYMBOL(ioread32
);
42 EXPORT_SYMBOL(ioread32be
);
44 u64
ioread64(void __iomem
*addr
)
48 u64
ioread64be(void __iomem
*addr
)
50 return readq_be(addr
);
52 EXPORT_SYMBOL(ioread64
);
53 EXPORT_SYMBOL(ioread64be
);
54 #endif /* __powerpc64__ */
56 void iowrite8(u8 val
, void __iomem
*addr
)
60 void iowrite16(u16 val
, void __iomem
*addr
)
64 void iowrite16be(u16 val
, void __iomem
*addr
)
68 void iowrite32(u32 val
, void __iomem
*addr
)
72 void iowrite32be(u32 val
, void __iomem
*addr
)
76 EXPORT_SYMBOL(iowrite8
);
77 EXPORT_SYMBOL(iowrite16
);
78 EXPORT_SYMBOL(iowrite16be
);
79 EXPORT_SYMBOL(iowrite32
);
80 EXPORT_SYMBOL(iowrite32be
);
82 void iowrite64(u64 val
, void __iomem
*addr
)
86 void iowrite64be(u64 val
, void __iomem
*addr
)
90 EXPORT_SYMBOL(iowrite64
);
91 EXPORT_SYMBOL(iowrite64be
);
92 #endif /* __powerpc64__ */
95 * These are the "repeat read/write" functions. Note the
96 * non-CPU byte order. We do things in "IO byteorder"
99 * FIXME! We could make these do EEH handling if we really
100 * wanted. Not clear if we do.
102 void ioread8_rep(void __iomem
*addr
, void *dst
, unsigned long count
)
104 readsb(addr
, dst
, count
);
106 void ioread16_rep(void __iomem
*addr
, void *dst
, unsigned long count
)
108 readsw(addr
, dst
, count
);
110 void ioread32_rep(void __iomem
*addr
, void *dst
, unsigned long count
)
112 readsl(addr
, dst
, count
);
114 EXPORT_SYMBOL(ioread8_rep
);
115 EXPORT_SYMBOL(ioread16_rep
);
116 EXPORT_SYMBOL(ioread32_rep
);
118 void iowrite8_rep(void __iomem
*addr
, const void *src
, unsigned long count
)
120 writesb(addr
, src
, count
);
122 void iowrite16_rep(void __iomem
*addr
, const void *src
, unsigned long count
)
124 writesw(addr
, src
, count
);
126 void iowrite32_rep(void __iomem
*addr
, const void *src
, unsigned long count
)
128 writesl(addr
, src
, count
);
130 EXPORT_SYMBOL(iowrite8_rep
);
131 EXPORT_SYMBOL(iowrite16_rep
);
132 EXPORT_SYMBOL(iowrite32_rep
);
134 void __iomem
*ioport_map(unsigned long port
, unsigned int len
)
136 return (void __iomem
*) (port
+ _IO_BASE
);
139 void ioport_unmap(void __iomem
*addr
)
143 EXPORT_SYMBOL(ioport_map
);
144 EXPORT_SYMBOL(ioport_unmap
);
147 void pci_iounmap(struct pci_dev
*dev
, void __iomem
*addr
)
149 if (isa_vaddr_is_ioport(addr
))
151 if (pcibios_vaddr_is_ioport(addr
))
156 EXPORT_SYMBOL(pci_iounmap
);
157 #endif /* CONFIG_PCI */