Skip to content

Commit 548927e

Browse files
Sai Prakash Ranjanarndb
authored andcommitted
arm64: io: Use asm-generic high level MMIO accessors
Remove custom arm64 MMIO accessors read{b,w,l,q} and their relaxed versions in support to use asm-generic defined accessors. Also define one set of IO barriers (ar/bw version) used by asm-generic code to override the arm64 specific variants. Suggested-by: Arnd Bergmann <[email protected]> Signed-off-by: Sai Prakash Ranjan <[email protected]> Reviewed-by: Arnd Bergmann <[email protected]> Acked-by: Catalin Marinas <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]>
1 parent f2c5092 commit 548927e

File tree

1 file changed

+8
-33
lines changed
  • arch/arm64/include/asm

1 file changed

+8
-33
lines changed

arch/arm64/include/asm/io.h

Lines changed: 8 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ static inline u64 __raw_readq(const volatile void __iomem *addr)
9191
}
9292

9393
/* IO barriers */
94-
#define __iormb(v) \
94+
#define __io_ar(v) \
9595
({ \
9696
unsigned long tmp; \
9797
\
@@ -108,39 +108,14 @@ static inline u64 __raw_readq(const volatile void __iomem *addr)
108108
: "memory"); \
109109
})
110110

111-
#define __io_par(v) __iormb(v)
112-
#define __iowmb() dma_wmb()
113-
#define __iomb() dma_mb()
114-
115-
/*
116-
* Relaxed I/O memory access primitives. These follow the Device memory
117-
* ordering rules but do not guarantee any ordering relative to Normal memory
118-
* accesses.
119-
*/
120-
#define readb_relaxed(c) ({ u8 __r = __raw_readb(c); __r; })
121-
#define readw_relaxed(c) ({ u16 __r = le16_to_cpu((__force __le16)__raw_readw(c)); __r; })
122-
#define readl_relaxed(c) ({ u32 __r = le32_to_cpu((__force __le32)__raw_readl(c)); __r; })
123-
#define readq_relaxed(c) ({ u64 __r = le64_to_cpu((__force __le64)__raw_readq(c)); __r; })
111+
#define __io_bw() dma_wmb()
112+
#define __io_br(v)
113+
#define __io_aw(v)
124114

125-
#define writeb_relaxed(v,c) ((void)__raw_writeb((v),(c)))
126-
#define writew_relaxed(v,c) ((void)__raw_writew((__force u16)cpu_to_le16(v),(c)))
127-
#define writel_relaxed(v,c) ((void)__raw_writel((__force u32)cpu_to_le32(v),(c)))
128-
#define writeq_relaxed(v,c) ((void)__raw_writeq((__force u64)cpu_to_le64(v),(c)))
129-
130-
/*
131-
* I/O memory access primitives. Reads are ordered relative to any
132-
* following Normal memory access. Writes are ordered relative to any prior
133-
* Normal memory access.
134-
*/
135-
#define readb(c) ({ u8 __v = readb_relaxed(c); __iormb(__v); __v; })
136-
#define readw(c) ({ u16 __v = readw_relaxed(c); __iormb(__v); __v; })
137-
#define readl(c) ({ u32 __v = readl_relaxed(c); __iormb(__v); __v; })
138-
#define readq(c) ({ u64 __v = readq_relaxed(c); __iormb(__v); __v; })
139-
140-
#define writeb(v,c) ({ __iowmb(); writeb_relaxed((v),(c)); })
141-
#define writew(v,c) ({ __iowmb(); writew_relaxed((v),(c)); })
142-
#define writel(v,c) ({ __iowmb(); writel_relaxed((v),(c)); })
143-
#define writeq(v,c) ({ __iowmb(); writeq_relaxed((v),(c)); })
115+
/* arm64-specific, don't use in portable drivers */
116+
#define __iormb(v) __io_ar(v)
117+
#define __iowmb() __io_bw()
118+
#define __iomb() dma_mb()
144119

145120
/*
146121
* I/O port access primitives.

0 commit comments

Comments
 (0)