io: Provide _inX() and _outX()
Since commita7851aa54c
("io: change outX() to have their own IO barrier overrides") and commit87fe2d543f
("io: change inX() to have their own IO barrier overrides"), the outX and inX functions have memory barriers which can be overridden. However, the generic logic_pio lib has continued to use readl/writel et al for IO port accesses, which has weaker barriers on arm64. Provide generic _inX() and _outX(), which can be used by logic pio. For consistency, we check for !defined({in,out}X) && !defined(_{in,out}X), for defining _{in,out}X, while a check for just !defined({in,out}X) should suffice. Reviewed-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: John Garry <john.garry@huawei.com> Signed-off-by: Wei Xu <xuwei5@hisilicon.com>
This commit is contained in:
parent
8f3d9f3542
commit
f009c89df7
|
@ -448,17 +448,15 @@ static inline void writesq(volatile void __iomem *addr, const void *buffer,
|
||||||
#define IO_SPACE_LIMIT 0xffff
|
#define IO_SPACE_LIMIT 0xffff
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <linux/logic_pio.h>
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* {in,out}{b,w,l}() access little endian I/O. {in,out}{b,w,l}_p() can be
|
* {in,out}{b,w,l}() access little endian I/O. {in,out}{b,w,l}_p() can be
|
||||||
* implemented on hardware that needs an additional delay for I/O accesses to
|
* implemented on hardware that needs an additional delay for I/O accesses to
|
||||||
* take effect.
|
* take effect.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef inb
|
#if !defined(inb) && !defined(_inb)
|
||||||
#define inb inb
|
#define _inb _inb
|
||||||
static inline u8 inb(unsigned long addr)
|
static inline u16 _inb(unsigned long addr)
|
||||||
{
|
{
|
||||||
u8 val;
|
u8 val;
|
||||||
|
|
||||||
|
@ -469,9 +467,9 @@ static inline u8 inb(unsigned long addr)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef inw
|
#if !defined(inw) && !defined(_inw)
|
||||||
#define inw inw
|
#define _inw _inw
|
||||||
static inline u16 inw(unsigned long addr)
|
static inline u16 _inw(unsigned long addr)
|
||||||
{
|
{
|
||||||
u16 val;
|
u16 val;
|
||||||
|
|
||||||
|
@ -482,9 +480,9 @@ static inline u16 inw(unsigned long addr)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef inl
|
#if !defined(inl) && !defined(_inl)
|
||||||
#define inl inl
|
#define _inl _inl
|
||||||
static inline u32 inl(unsigned long addr)
|
static inline u16 _inl(unsigned long addr)
|
||||||
{
|
{
|
||||||
u32 val;
|
u32 val;
|
||||||
|
|
||||||
|
@ -495,9 +493,9 @@ static inline u32 inl(unsigned long addr)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef outb
|
#if !defined(outb) && !defined(_outb)
|
||||||
#define outb outb
|
#define _outb _outb
|
||||||
static inline void outb(u8 value, unsigned long addr)
|
static inline void _outb(u8 value, unsigned long addr)
|
||||||
{
|
{
|
||||||
__io_pbw();
|
__io_pbw();
|
||||||
__raw_writeb(value, PCI_IOBASE + addr);
|
__raw_writeb(value, PCI_IOBASE + addr);
|
||||||
|
@ -505,9 +503,9 @@ static inline void outb(u8 value, unsigned long addr)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef outw
|
#if !defined(outw) && !defined(_outw)
|
||||||
#define outw outw
|
#define _outw _outw
|
||||||
static inline void outw(u16 value, unsigned long addr)
|
static inline void _outw(u16 value, unsigned long addr)
|
||||||
{
|
{
|
||||||
__io_pbw();
|
__io_pbw();
|
||||||
__raw_writew(cpu_to_le16(value), PCI_IOBASE + addr);
|
__raw_writew(cpu_to_le16(value), PCI_IOBASE + addr);
|
||||||
|
@ -515,9 +513,9 @@ static inline void outw(u16 value, unsigned long addr)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef outl
|
#if !defined(outl) && !defined(_outl)
|
||||||
#define outl outl
|
#define _outl _outl
|
||||||
static inline void outl(u32 value, unsigned long addr)
|
static inline void _outl(u32 value, unsigned long addr)
|
||||||
{
|
{
|
||||||
__io_pbw();
|
__io_pbw();
|
||||||
__raw_writel(cpu_to_le32(value), PCI_IOBASE + addr);
|
__raw_writel(cpu_to_le32(value), PCI_IOBASE + addr);
|
||||||
|
@ -525,6 +523,32 @@ static inline void outl(u32 value, unsigned long addr)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <linux/logic_pio.h>
|
||||||
|
|
||||||
|
#ifndef inb
|
||||||
|
#define inb _inb
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef inw
|
||||||
|
#define inw _inw
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef inl
|
||||||
|
#define inl _inl
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef outb
|
||||||
|
#define outb _outb
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef outw
|
||||||
|
#define outw _outw
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef outl
|
||||||
|
#define outl _outl
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef inb_p
|
#ifndef inb_p
|
||||||
#define inb_p inb_p
|
#define inb_p inb_p
|
||||||
static inline u8 inb_p(unsigned long addr)
|
static inline u8 inb_p(unsigned long addr)
|
||||||
|
|
Loading…
Reference in New Issue