2 * arch/ppc64/kernel/iomap.c
4 * ppc64 "iomap" interface implementation.
6 * (C) Copyright 2004 Linus Torvalds
8 #include <linux/init.h>
14 * Here comes the ppc64 implementation of the IOMAP
17 unsigned int fastcall ioread8(void __iomem *addr)
21 unsigned int fastcall ioread16(void __iomem *addr)
25 unsigned int fastcall ioread32(void __iomem *addr)
29 EXPORT_SYMBOL(ioread8);
30 EXPORT_SYMBOL(ioread16);
31 EXPORT_SYMBOL(ioread32);
33 void fastcall iowrite8(u8 val, void __iomem *addr)
37 void fastcall iowrite16(u16 val, void __iomem *addr)
41 void fastcall iowrite32(u32 val, void __iomem *addr)
45 EXPORT_SYMBOL(iowrite8);
46 EXPORT_SYMBOL(iowrite16);
47 EXPORT_SYMBOL(iowrite32);
50 * These are the "repeat read/write" functions. Note the
51 * non-CPU byte order. We do things in "IO byteorder"
54 * FIXME! We could make these do EEH handling if we really
55 * wanted. Not clear if we do.
57 void ioread8_rep(void __iomem *addr, void *dst, unsigned long count)
59 _insb((u8 __force *) addr, dst, count);
61 void ioread16_rep(void __iomem *addr, void *dst, unsigned long count)
63 _insw_ns((u16 __force *) addr, dst, count);
65 void ioread32_rep(void __iomem *addr, void *dst, unsigned long count)
67 _insl_ns((u32 __force *) addr, dst, count);
69 EXPORT_SYMBOL(ioread8_rep);
70 EXPORT_SYMBOL(ioread16_rep);
71 EXPORT_SYMBOL(ioread32_rep);
73 void iowrite8_rep(void __iomem *addr, const void *src, unsigned long count)
75 _outsb((u8 __force *) addr, src, count);
77 void iowrite16_rep(void __iomem *addr, const void *src, unsigned long count)
79 _outsw_ns((u16 __force *) addr, src, count);
81 void iowrite32_rep(void __iomem *addr, const void *src, unsigned long count)
83 _outsl_ns((u32 __force *) addr, src, count);
85 EXPORT_SYMBOL(iowrite8_rep);
86 EXPORT_SYMBOL(iowrite16_rep);
87 EXPORT_SYMBOL(iowrite32_rep);
89 void __iomem *ioport_map(unsigned long port, unsigned int len)
91 if (!_IO_IS_VALID(port))
93 return (void __iomem *) (port+pci_io_base);
96 void ioport_unmap(void __iomem *addr)
100 EXPORT_SYMBOL(ioport_map);
101 EXPORT_SYMBOL(ioport_unmap);
103 void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max)
105 unsigned long start = pci_resource_start(dev, bar);
106 unsigned long len = pci_resource_len(dev, bar);
107 unsigned long flags = pci_resource_flags(dev, bar);
111 if (max && len > max)
113 if (flags & IORESOURCE_IO)
114 return ioport_map(start, len);
115 if (flags & IORESOURCE_MEM)
116 return ioremap(start, len);
121 void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
125 EXPORT_SYMBOL(pci_iomap);
126 EXPORT_SYMBOL(pci_iounmap);