xtensa: fix high memory/reserved memory collision
[cris-mirror.git] / arch / powerpc / kernel / iomap.c
blobaab456ed2a0061ceada12f33dd791cf56afc43fc
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 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)
58 writeb(val, addr);
60 void iowrite16(u16 val, void __iomem *addr)
62 writew(val, addr);
64 void iowrite16be(u16 val, void __iomem *addr)
66 writew_be(val, addr);
68 void iowrite32(u32 val, void __iomem *addr)
70 writel(val, addr);
72 void iowrite32be(u32 val, void __iomem *addr)
74 writel_be(val, addr);
76 EXPORT_SYMBOL(iowrite8);
77 EXPORT_SYMBOL(iowrite16);
78 EXPORT_SYMBOL(iowrite16be);
79 EXPORT_SYMBOL(iowrite32);
80 EXPORT_SYMBOL(iowrite32be);
81 #ifdef __powerpc64__
82 void iowrite64(u64 val, void __iomem *addr)
84 writeq(val, addr);
86 void iowrite64be(u64 val, void __iomem *addr)
88 writeq_be(val, 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"
97 * here.
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)
141 /* Nothing to do */
143 EXPORT_SYMBOL(ioport_map);
144 EXPORT_SYMBOL(ioport_unmap);
146 #ifdef CONFIG_PCI
147 void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
149 if (isa_vaddr_is_ioport(addr))
150 return;
151 if (pcibios_vaddr_is_ioport(addr))
152 return;
153 iounmap(addr);
156 EXPORT_SYMBOL(pci_iounmap);
157 #endif /* CONFIG_PCI */