mirror of
https://github.com/raspberrypi/linux.git
synced 2026-01-04 01:57:21 +00:00
powerpc/io: Unhook MMIO accessors
Now that PPC_INDIRECT_MMIO is removed, it's not possible/necessary to hook any of the "memory" accessors, so turn them back into regular static inlines, and restrict the hooking mechanism to the "pio" accessors only. Move the #defines that signal each routine is implemented next to the implementation, and update the out-of-date comment. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com> Link: https://patch.msgid.link/20241218105523.416573-12-mpe@ellerman.id.au
This commit is contained in:
committed by
Madhavan Srinivasan
parent
de9cc05822
commit
15efd61fa7
@@ -1,61 +1,15 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/* This file is meant to be include multiple times by other headers */
|
||||
/* last 2 argments are used by platforms/cell/io-workarounds.[ch] */
|
||||
|
||||
DEF_PCI_AC_RET(readb, u8, (const PCI_IO_ADDR addr), (addr), mem, addr)
|
||||
DEF_PCI_AC_RET(readw, u16, (const PCI_IO_ADDR addr), (addr), mem, addr)
|
||||
DEF_PCI_AC_RET(readl, u32, (const PCI_IO_ADDR addr), (addr), mem, addr)
|
||||
DEF_PCI_AC_RET(readw_be, u16, (const PCI_IO_ADDR addr), (addr), mem, addr)
|
||||
DEF_PCI_AC_RET(readl_be, u32, (const PCI_IO_ADDR addr), (addr), mem, addr)
|
||||
DEF_PCI_AC_NORET(writeb, (u8 val, PCI_IO_ADDR addr), (val, addr), mem, addr)
|
||||
DEF_PCI_AC_NORET(writew, (u16 val, PCI_IO_ADDR addr), (val, addr), mem, addr)
|
||||
DEF_PCI_AC_NORET(writel, (u32 val, PCI_IO_ADDR addr), (val, addr), mem, addr)
|
||||
DEF_PCI_AC_NORET(writew_be, (u16 val, PCI_IO_ADDR addr), (val, addr), mem, addr)
|
||||
DEF_PCI_AC_NORET(writel_be, (u32 val, PCI_IO_ADDR addr), (val, addr), mem, addr)
|
||||
|
||||
#ifdef __powerpc64__
|
||||
DEF_PCI_AC_RET(readq, u64, (const PCI_IO_ADDR addr), (addr), mem, addr)
|
||||
DEF_PCI_AC_RET(readq_be, u64, (const PCI_IO_ADDR addr), (addr), mem, addr)
|
||||
DEF_PCI_AC_NORET(writeq, (u64 val, PCI_IO_ADDR addr), (val, addr), mem, addr)
|
||||
DEF_PCI_AC_NORET(writeq_be, (u64 val, PCI_IO_ADDR addr), (val, addr), mem, addr)
|
||||
#endif /* __powerpc64__ */
|
||||
|
||||
DEF_PCI_AC_RET(inb, u8, (unsigned long port), (port), pio, port)
|
||||
DEF_PCI_AC_RET(inw, u16, (unsigned long port), (port), pio, port)
|
||||
DEF_PCI_AC_RET(inl, u32, (unsigned long port), (port), pio, port)
|
||||
DEF_PCI_AC_NORET(outb, (u8 val, unsigned long port), (val, port), pio, port)
|
||||
DEF_PCI_AC_NORET(outw, (u16 val, unsigned long port), (val, port), pio, port)
|
||||
DEF_PCI_AC_NORET(outl, (u32 val, unsigned long port), (val, port), pio, port)
|
||||
|
||||
DEF_PCI_AC_NORET(readsb, (const PCI_IO_ADDR a, void *b, unsigned long c),
|
||||
(a, b, c), mem, a)
|
||||
DEF_PCI_AC_NORET(readsw, (const PCI_IO_ADDR a, void *b, unsigned long c),
|
||||
(a, b, c), mem, a)
|
||||
DEF_PCI_AC_NORET(readsl, (const PCI_IO_ADDR a, void *b, unsigned long c),
|
||||
(a, b, c), mem, a)
|
||||
DEF_PCI_AC_NORET(writesb, (PCI_IO_ADDR a, const void *b, unsigned long c),
|
||||
(a, b, c), mem, a)
|
||||
DEF_PCI_AC_NORET(writesw, (PCI_IO_ADDR a, const void *b, unsigned long c),
|
||||
(a, b, c), mem, a)
|
||||
DEF_PCI_AC_NORET(writesl, (PCI_IO_ADDR a, const void *b, unsigned long c),
|
||||
(a, b, c), mem, a)
|
||||
|
||||
DEF_PCI_AC_NORET(insb, (unsigned long p, void *b, unsigned long c),
|
||||
(p, b, c), pio, p)
|
||||
DEF_PCI_AC_NORET(insw, (unsigned long p, void *b, unsigned long c),
|
||||
(p, b, c), pio, p)
|
||||
DEF_PCI_AC_NORET(insl, (unsigned long p, void *b, unsigned long c),
|
||||
(p, b, c), pio, p)
|
||||
DEF_PCI_AC_NORET(outsb, (unsigned long p, const void *b, unsigned long c),
|
||||
(p, b, c), pio, p)
|
||||
DEF_PCI_AC_NORET(outsw, (unsigned long p, const void *b, unsigned long c),
|
||||
(p, b, c), pio, p)
|
||||
DEF_PCI_AC_NORET(outsl, (unsigned long p, const void *b, unsigned long c),
|
||||
(p, b, c), pio, p)
|
||||
|
||||
DEF_PCI_AC_NORET(memset_io, (PCI_IO_ADDR a, int c, unsigned long n),
|
||||
(a, c, n), mem, a)
|
||||
DEF_PCI_AC_NORET(memcpy_fromio, (void *d, const PCI_IO_ADDR s, unsigned long n),
|
||||
(d, s, n), mem, s)
|
||||
DEF_PCI_AC_NORET(memcpy_toio, (PCI_IO_ADDR d, const void *s, unsigned long n),
|
||||
(d, s, n), mem, d)
|
||||
DEF_PCI_AC_RET(inb, u8, (unsigned long port), (port))
|
||||
DEF_PCI_AC_RET(inw, u16, (unsigned long port), (port))
|
||||
DEF_PCI_AC_RET(inl, u32, (unsigned long port), (port))
|
||||
DEF_PCI_AC_NORET(outb, (u8 val, unsigned long port), (val, port))
|
||||
DEF_PCI_AC_NORET(outw, (u16 val, unsigned long port), (val, port))
|
||||
DEF_PCI_AC_NORET(outl, (u32 val, unsigned long port), (val, port))
|
||||
DEF_PCI_AC_NORET(insb, (unsigned long p, void *b, unsigned long c), (p, b, c))
|
||||
DEF_PCI_AC_NORET(insw, (unsigned long p, void *b, unsigned long c), (p, b, c))
|
||||
DEF_PCI_AC_NORET(insl, (unsigned long p, void *b, unsigned long c), (p, b, c))
|
||||
DEF_PCI_AC_NORET(outsb, (unsigned long p, const void *b, unsigned long c), (p, b, c))
|
||||
DEF_PCI_AC_NORET(outsw, (unsigned long p, const void *b, unsigned long c), (p, b, c))
|
||||
DEF_PCI_AC_NORET(outsl, (unsigned long p, const void *b, unsigned long c), (p, b, c))
|
||||
|
||||
@@ -580,19 +580,149 @@ __do_out_asm(_rec_outl, "stwbrx")
|
||||
_memcpy_fromio(dst, src, n)
|
||||
#endif /* !CONFIG_EEH */
|
||||
|
||||
#ifdef CONFIG_PPC_INDIRECT_PIO
|
||||
#define DEF_PCI_HOOK_pio(x) x
|
||||
#else
|
||||
#define DEF_PCI_HOOK_pio(x) NULL
|
||||
#endif
|
||||
static inline u8 readb(const PCI_IO_ADDR addr)
|
||||
{
|
||||
return __do_readb(addr);
|
||||
}
|
||||
#define readb readb
|
||||
|
||||
#define DEF_PCI_HOOK_mem(x) NULL
|
||||
static inline u16 readw(const PCI_IO_ADDR addr)
|
||||
{
|
||||
return __do_readw(addr);
|
||||
}
|
||||
#define readw readw
|
||||
|
||||
static inline u32 readl(const PCI_IO_ADDR addr)
|
||||
{
|
||||
return __do_readl(addr);
|
||||
}
|
||||
#define readl readl
|
||||
|
||||
static inline u16 readw_be(const PCI_IO_ADDR addr)
|
||||
{
|
||||
return __do_readw_be(addr);
|
||||
}
|
||||
|
||||
static inline u32 readl_be(const PCI_IO_ADDR addr)
|
||||
{
|
||||
return __do_readl_be(addr);
|
||||
}
|
||||
|
||||
static inline void writeb(u8 val, PCI_IO_ADDR addr)
|
||||
{
|
||||
__do_writeb(val, addr);
|
||||
}
|
||||
#define writeb writeb
|
||||
|
||||
static inline void writew(u16 val, PCI_IO_ADDR addr)
|
||||
{
|
||||
__do_writew(val, addr);
|
||||
}
|
||||
#define writew writew
|
||||
|
||||
static inline void writel(u32 val, PCI_IO_ADDR addr)
|
||||
{
|
||||
__do_writel(val, addr);
|
||||
}
|
||||
#define writel writel
|
||||
|
||||
static inline void writew_be(u16 val, PCI_IO_ADDR addr)
|
||||
{
|
||||
__do_writew_be(val, addr);
|
||||
}
|
||||
|
||||
static inline void writel_be(u32 val, PCI_IO_ADDR addr)
|
||||
{
|
||||
__do_writel_be(val, addr);
|
||||
}
|
||||
|
||||
static inline void readsb(const PCI_IO_ADDR a, void *b, unsigned long c)
|
||||
{
|
||||
__do_readsb(a, b, c);
|
||||
}
|
||||
#define readsb readsb
|
||||
|
||||
static inline void readsw(const PCI_IO_ADDR a, void *b, unsigned long c)
|
||||
{
|
||||
__do_readsw(a, b, c);
|
||||
}
|
||||
#define readsw readsw
|
||||
|
||||
static inline void readsl(const PCI_IO_ADDR a, void *b, unsigned long c)
|
||||
{
|
||||
__do_readsl(a, b, c);
|
||||
}
|
||||
#define readsl readsl
|
||||
|
||||
static inline void writesb(PCI_IO_ADDR a, const void *b, unsigned long c)
|
||||
{
|
||||
__do_writesb(a, b, c);
|
||||
}
|
||||
#define writesb writesb
|
||||
|
||||
static inline void writesw(PCI_IO_ADDR a, const void *b, unsigned long c)
|
||||
{
|
||||
__do_writesw(a, b, c);
|
||||
}
|
||||
#define writesw writesw
|
||||
|
||||
static inline void writesl(PCI_IO_ADDR a, const void *b, unsigned long c)
|
||||
{
|
||||
__do_writesl(a, b, c);
|
||||
}
|
||||
#define writesl writesl
|
||||
|
||||
static inline void memset_io(PCI_IO_ADDR a, int c, unsigned long n)
|
||||
{
|
||||
__do_memset_io(a, c, n);
|
||||
}
|
||||
#define memset_io memset_io
|
||||
|
||||
static inline void memcpy_fromio(void *d, const PCI_IO_ADDR s, unsigned long n)
|
||||
{
|
||||
__do_memcpy_fromio(d, s, n);
|
||||
}
|
||||
#define memcpy_fromio memcpy_fromio
|
||||
|
||||
static inline void memcpy_toio(PCI_IO_ADDR d, const void *s, unsigned long n)
|
||||
{
|
||||
__do_memcpy_toio(d, s, n);
|
||||
}
|
||||
#define memcpy_toio memcpy_toio
|
||||
|
||||
#ifdef __powerpc64__
|
||||
static inline u64 readq(const PCI_IO_ADDR addr)
|
||||
{
|
||||
return __do_readq(addr);
|
||||
}
|
||||
|
||||
static inline u64 readq_be(const PCI_IO_ADDR addr)
|
||||
{
|
||||
return __do_readq_be(addr);
|
||||
}
|
||||
|
||||
static inline void writeq(u64 val, PCI_IO_ADDR addr)
|
||||
{
|
||||
__do_writeq(val, addr);
|
||||
}
|
||||
|
||||
static inline void writeq_be(u64 val, PCI_IO_ADDR addr)
|
||||
{
|
||||
__do_writeq_be(val, addr);
|
||||
}
|
||||
#endif /* __powerpc64__ */
|
||||
|
||||
#ifdef CONFIG_PPC_INDIRECT_PIO
|
||||
#define DEF_PCI_HOOK(x) x
|
||||
#else
|
||||
#define DEF_PCI_HOOK(x) NULL
|
||||
#endif
|
||||
|
||||
/* Structure containing all the hooks */
|
||||
extern struct ppc_pci_io {
|
||||
|
||||
#define DEF_PCI_AC_RET(name, ret, at, al, space, aa) ret (*name) at;
|
||||
#define DEF_PCI_AC_NORET(name, at, al, space, aa) void (*name) at;
|
||||
#define DEF_PCI_AC_RET(name, ret, at, al) ret (*name) at;
|
||||
#define DEF_PCI_AC_NORET(name, at, al) void (*name) at;
|
||||
|
||||
#include <asm/io-defs.h>
|
||||
|
||||
@@ -602,18 +732,18 @@ extern struct ppc_pci_io {
|
||||
} ppc_pci_io;
|
||||
|
||||
/* The inline wrappers */
|
||||
#define DEF_PCI_AC_RET(name, ret, at, al, space, aa) \
|
||||
#define DEF_PCI_AC_RET(name, ret, at, al) \
|
||||
static inline ret name at \
|
||||
{ \
|
||||
if (DEF_PCI_HOOK_##space(ppc_pci_io.name) != NULL) \
|
||||
if (DEF_PCI_HOOK(ppc_pci_io.name) != NULL) \
|
||||
return ppc_pci_io.name al; \
|
||||
return __do_##name al; \
|
||||
}
|
||||
|
||||
#define DEF_PCI_AC_NORET(name, at, al, space, aa) \
|
||||
#define DEF_PCI_AC_NORET(name, at, al) \
|
||||
static inline void name at \
|
||||
{ \
|
||||
if (DEF_PCI_HOOK_##space(ppc_pci_io.name) != NULL) \
|
||||
if (DEF_PCI_HOOK(ppc_pci_io.name) != NULL) \
|
||||
ppc_pci_io.name al; \
|
||||
else \
|
||||
__do_##name al; \
|
||||
@@ -624,21 +754,7 @@ static inline void name at \
|
||||
#undef DEF_PCI_AC_RET
|
||||
#undef DEF_PCI_AC_NORET
|
||||
|
||||
/* Some drivers check for the presence of readq & writeq with
|
||||
* a #ifdef, so we make them happy here.
|
||||
*/
|
||||
#define readb readb
|
||||
#define readw readw
|
||||
#define readl readl
|
||||
#define writeb writeb
|
||||
#define writew writew
|
||||
#define writel writel
|
||||
#define readsb readsb
|
||||
#define readsw readsw
|
||||
#define readsl readsl
|
||||
#define writesb writesb
|
||||
#define writesw writesw
|
||||
#define writesl writesl
|
||||
// Signal to asm-generic/io.h that we have implemented these.
|
||||
#define inb inb
|
||||
#define inw inw
|
||||
#define inl inl
|
||||
@@ -655,9 +771,6 @@ static inline void name at \
|
||||
#define readq readq
|
||||
#define writeq writeq
|
||||
#endif
|
||||
#define memset_io memset_io
|
||||
#define memcpy_fromio memcpy_fromio
|
||||
#define memcpy_toio memcpy_toio
|
||||
|
||||
/*
|
||||
* We don't do relaxed operations yet, at least not with this semantic
|
||||
|
||||
Reference in New Issue
Block a user