[TG3]: Set minimal hw interrupt mitigation.
[linux-2.6/verdex.git] / arch / ppc64 / kernel / iomap.c
blob153cc8b0f13611be8471a87dba6d1765d1e4bee5
1 /*
2 * arch/ppc64/kernel/iomap.c
4 * ppc64 "iomap" interface implementation.
6 * (C) Copyright 2004 Linus Torvalds
7 */
8 #include <linux/init.h>
9 #include <linux/pci.h>
10 #include <linux/mm.h>
11 #include <asm/io.h>
14 * Here comes the ppc64 implementation of the IOMAP
15 * interfaces.
17 unsigned int fastcall ioread8(void __iomem *addr)
19 return readb(addr);
21 unsigned int fastcall ioread16(void __iomem *addr)
23 return readw(addr);
25 unsigned int fastcall ioread32(void __iomem *addr)
27 return readl(addr);
29 EXPORT_SYMBOL(ioread8);
30 EXPORT_SYMBOL(ioread16);
31 EXPORT_SYMBOL(ioread32);
33 void fastcall iowrite8(u8 val, void __iomem *addr)
35 writeb(val, addr);
37 void fastcall iowrite16(u16 val, void __iomem *addr)
39 writew(val, addr);
41 void fastcall iowrite32(u32 val, void __iomem *addr)
43 writel(val, 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"
52 * here.
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))
92 return NULL;
93 return (void __iomem *) (port+pci_io_base);
96 void ioport_unmap(void __iomem *addr)
98 /* Nothing to do */
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);
109 if (!len)
110 return NULL;
111 if (max && len > max)
112 len = max;
113 if (flags & IORESOURCE_IO)
114 return ioport_map(start, len);
115 if (flags & IORESOURCE_MEM)
116 return ioremap(start, len);
117 /* What? */
118 return NULL;
121 void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
123 /* Nothing to do */
125 EXPORT_SYMBOL(pci_iomap);
126 EXPORT_SYMBOL(pci_iounmap);