aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-powerpc/io-defs.h
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2006-11-11 01:25:10 -0500
committerPaul Mackerras <paulus@samba.org>2006-12-04 04:38:52 -0500
commit4cb3cee03d558fd457cb58f56c80a2a09a66110c (patch)
treefe903107d098871a7babc1e3432448758c542cde /include/asm-powerpc/io-defs.h
parentd03f387eb321189bc2ba278b6ca82f1a45cf19d6 (diff)
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
This patch reworks the way iSeries hooks on PCI IO operations (both MMIO and PIO) and provides a generic way for other platforms to do so (we have need to do that for various other platforms). While reworking the IO ops, I ended up doing some spring cleaning in io.h and eeh.h which I might want to split into 2 or 3 patches (among others, eeh.h had a lot of useless stuff in it). A side effect is that EEH for PIO should work now (it used to pass IO ports down to the eeh address check functions which is bogus). Also, new are MMIO "repeat" ops, which other archs like ARM already had, and that we have too now: readsb, readsw, readsl, writesb, writesw, writesl. In the long run, I might also make EEH use the hooks instead of wrapping at the toplevel, which would make things even cleaner and relegate EEH completely in platforms/iseries, but we have to measure the performance impact there (though it's really only on MMIO reads) Since I also need to hook on ioremap, I shuffled the functions a bit there. I introduced ioremap_flags() to use by drivers who want to pass explicit flags to ioremap (and it can be hooked). The old __ioremap() is still there as a low level and cannot be hooked, thus drivers who use it should migrate unless they know they want the low level version. The patch "arch provides generic iomap missing accessors" (should be number 4 in this series) is a pre-requisite to provide full iomap API support with this patch. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'include/asm-powerpc/io-defs.h')
-rw-r--r--include/asm-powerpc/io-defs.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/include/asm-powerpc/io-defs.h b/include/asm-powerpc/io-defs.h
new file mode 100644
index 000000000000..5a660f1130db
--- /dev/null
+++ b/include/asm-powerpc/io-defs.h
@@ -0,0 +1,56 @@
1/* This file is meant to be include multiple times by other headers */
2
3DEF_PCI_AC_RET(readb, u8, (const PCI_IO_ADDR addr), (addr))
4DEF_PCI_AC_RET(readw, u16, (const PCI_IO_ADDR addr), (addr))
5DEF_PCI_AC_RET(readl, u32, (const PCI_IO_ADDR addr), (addr))
6DEF_PCI_AC_RET(readq, u64, (const PCI_IO_ADDR addr), (addr))
7DEF_PCI_AC_RET(readw_be, u16, (const PCI_IO_ADDR addr), (addr))
8DEF_PCI_AC_RET(readl_be, u32, (const PCI_IO_ADDR addr), (addr))
9DEF_PCI_AC_RET(readq_be, u64, (const PCI_IO_ADDR addr), (addr))
10DEF_PCI_AC_NORET(writeb, (u8 val, PCI_IO_ADDR addr), (val, addr))
11DEF_PCI_AC_NORET(writew, (u16 val, PCI_IO_ADDR addr), (val, addr))
12DEF_PCI_AC_NORET(writel, (u32 val, PCI_IO_ADDR addr), (val, addr))
13DEF_PCI_AC_NORET(writeq, (u64 val, PCI_IO_ADDR addr), (val, addr))
14DEF_PCI_AC_NORET(writew_be, (u16 val, PCI_IO_ADDR addr), (val, addr))
15DEF_PCI_AC_NORET(writel_be, (u32 val, PCI_IO_ADDR addr), (val, addr))
16DEF_PCI_AC_NORET(writeq_be, (u64 val, PCI_IO_ADDR addr), (val, addr))
17
18DEF_PCI_AC_RET(inb, u8, (unsigned long port), (port))
19DEF_PCI_AC_RET(inw, u16, (unsigned long port), (port))
20DEF_PCI_AC_RET(inl, u32, (unsigned long port), (port))
21DEF_PCI_AC_NORET(outb, (u8 val, unsigned long port), (val, port))
22DEF_PCI_AC_NORET(outw, (u16 val, unsigned long port), (val, port))
23DEF_PCI_AC_NORET(outl, (u32 val, unsigned long port), (val, port))
24
25DEF_PCI_AC_NORET(readsb, (const PCI_IO_ADDR a, void *b, unsigned long c), \
26 (a, b, c))
27DEF_PCI_AC_NORET(readsw, (const PCI_IO_ADDR a, void *b, unsigned long c), \
28 (a, b, c))
29DEF_PCI_AC_NORET(readsl, (const PCI_IO_ADDR a, void *b, unsigned long c), \
30 (a, b, c))
31DEF_PCI_AC_NORET(writesb, (PCI_IO_ADDR a, const void *b, unsigned long c), \
32 (a, b, c))
33DEF_PCI_AC_NORET(writesw, (PCI_IO_ADDR a, const void *b, unsigned long c), \
34 (a, b, c))
35DEF_PCI_AC_NORET(writesl, (PCI_IO_ADDR a, const void *b, unsigned long c), \
36 (a, b, c))
37
38DEF_PCI_AC_NORET(insb, (unsigned long p, void *b, unsigned long c), \
39 (p, b, c))
40DEF_PCI_AC_NORET(insw, (unsigned long p, void *b, unsigned long c), \
41 (p, b, c))
42DEF_PCI_AC_NORET(insl, (unsigned long p, void *b, unsigned long c), \
43 (p, b, c))
44DEF_PCI_AC_NORET(outsb, (unsigned long p, const void *b, unsigned long c), \
45 (p, b, c))
46DEF_PCI_AC_NORET(outsw, (unsigned long p, const void *b, unsigned long c), \
47 (p, b, c))
48DEF_PCI_AC_NORET(outsl, (unsigned long p, const void *b, unsigned long c), \
49 (p, b, c))
50
51DEF_PCI_AC_NORET(memset_io, (PCI_IO_ADDR a, int c, unsigned long n), \
52 (a, c, n))
53DEF_PCI_AC_NORET(memcpy_fromio,(void *d,const PCI_IO_ADDR s,unsigned long n), \
54 (d, s, n))
55DEF_PCI_AC_NORET(memcpy_toio,(PCI_IO_ADDR d,const void *s,unsigned long n), \
56 (d, s, n))