arm64: dts: Revert "specify console via command line"
[linux/fpc-iii.git] / arch / powerpc / kernel / iomap.c
blob5ac84efc6ede8f893d701c0f03d2e735bf27ddf9
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * ppc64 "iomap" interface implementation.
5 * (C) Copyright 2004 Linus Torvalds
6 */
7 #include <linux/pci.h>
8 #include <linux/mm.h>
9 #include <linux/export.h>
10 #include <asm/io.h>
11 #include <asm/pci-bridge.h>
12 #include <asm/isa-bridge.h>
15 * Here comes the ppc64 implementation of the IOMAP
16 * interfaces.
18 unsigned int ioread8(void __iomem *addr)
20 return readb(addr);
22 unsigned int ioread16(void __iomem *addr)
24 return readw(addr);
26 unsigned int ioread16be(void __iomem *addr)
28 return readw_be(addr);
30 unsigned int ioread32(void __iomem *addr)
32 return readl(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);
43 #ifdef __powerpc64__
44 u64 ioread64(void __iomem *addr)
46 return readq(addr);
48 u64 ioread64_lo_hi(void __iomem *addr)
50 return readq(addr);
52 u64 ioread64_hi_lo(void __iomem *addr)
54 return readq(addr);
56 u64 ioread64be(void __iomem *addr)
58 return readq_be(addr);
60 u64 ioread64be_lo_hi(void __iomem *addr)
62 return readq_be(addr);
64 u64 ioread64be_hi_lo(void __iomem *addr)
66 return readq_be(addr);
68 EXPORT_SYMBOL(ioread64);
69 EXPORT_SYMBOL(ioread64_lo_hi);
70 EXPORT_SYMBOL(ioread64_hi_lo);
71 EXPORT_SYMBOL(ioread64be);
72 EXPORT_SYMBOL(ioread64be_lo_hi);
73 EXPORT_SYMBOL(ioread64be_hi_lo);
74 #endif /* __powerpc64__ */
76 void iowrite8(u8 val, void __iomem *addr)
78 writeb(val, addr);
80 void iowrite16(u16 val, void __iomem *addr)
82 writew(val, addr);
84 void iowrite16be(u16 val, void __iomem *addr)
86 writew_be(val, addr);
88 void iowrite32(u32 val, void __iomem *addr)
90 writel(val, addr);
92 void iowrite32be(u32 val, void __iomem *addr)
94 writel_be(val, addr);
96 EXPORT_SYMBOL(iowrite8);
97 EXPORT_SYMBOL(iowrite16);
98 EXPORT_SYMBOL(iowrite16be);
99 EXPORT_SYMBOL(iowrite32);
100 EXPORT_SYMBOL(iowrite32be);
101 #ifdef __powerpc64__
102 void iowrite64(u64 val, void __iomem *addr)
104 writeq(val, addr);
106 void iowrite64_lo_hi(u64 val, void __iomem *addr)
108 writeq(val, addr);
110 void iowrite64_hi_lo(u64 val, void __iomem *addr)
112 writeq(val, addr);
114 void iowrite64be(u64 val, void __iomem *addr)
116 writeq_be(val, addr);
118 void iowrite64be_lo_hi(u64 val, void __iomem *addr)
120 writeq_be(val, addr);
122 void iowrite64be_hi_lo(u64 val, void __iomem *addr)
124 writeq_be(val, addr);
126 EXPORT_SYMBOL(iowrite64);
127 EXPORT_SYMBOL(iowrite64_lo_hi);
128 EXPORT_SYMBOL(iowrite64_hi_lo);
129 EXPORT_SYMBOL(iowrite64be);
130 EXPORT_SYMBOL(iowrite64be_lo_hi);
131 EXPORT_SYMBOL(iowrite64be_hi_lo);
132 #endif /* __powerpc64__ */
135 * These are the "repeat read/write" functions. Note the
136 * non-CPU byte order. We do things in "IO byteorder"
137 * here.
139 * FIXME! We could make these do EEH handling if we really
140 * wanted. Not clear if we do.
142 void ioread8_rep(void __iomem *addr, void *dst, unsigned long count)
144 readsb(addr, dst, count);
146 void ioread16_rep(void __iomem *addr, void *dst, unsigned long count)
148 readsw(addr, dst, count);
150 void ioread32_rep(void __iomem *addr, void *dst, unsigned long count)
152 readsl(addr, dst, count);
154 EXPORT_SYMBOL(ioread8_rep);
155 EXPORT_SYMBOL(ioread16_rep);
156 EXPORT_SYMBOL(ioread32_rep);
158 void iowrite8_rep(void __iomem *addr, const void *src, unsigned long count)
160 writesb(addr, src, count);
162 void iowrite16_rep(void __iomem *addr, const void *src, unsigned long count)
164 writesw(addr, src, count);
166 void iowrite32_rep(void __iomem *addr, const void *src, unsigned long count)
168 writesl(addr, src, count);
170 EXPORT_SYMBOL(iowrite8_rep);
171 EXPORT_SYMBOL(iowrite16_rep);
172 EXPORT_SYMBOL(iowrite32_rep);
174 void __iomem *ioport_map(unsigned long port, unsigned int len)
176 return (void __iomem *) (port + _IO_BASE);
179 void ioport_unmap(void __iomem *addr)
181 /* Nothing to do */
183 EXPORT_SYMBOL(ioport_map);
184 EXPORT_SYMBOL(ioport_unmap);
186 #ifdef CONFIG_PCI
187 void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
189 if (isa_vaddr_is_ioport(addr))
190 return;
191 if (pcibios_vaddr_is_ioport(addr))
192 return;
193 iounmap(addr);
196 EXPORT_SYMBOL(pci_iounmap);
197 #endif /* CONFIG_PCI */