Skip to content

Commit 437b6b3

Browse files
linuswarndb
authored andcommitted
parisc: Use the generic IO helpers
This enables the parisc to use <asm-generic/io.h> to fill in the missing (undefined) [read|write]sq I/O accessor functions. This is needed if parisc[64] ever wants to uses CONFIG_REGMAP_MMIO which has been patches to use accelerated _noinc accessors such as readsq/writesq that parisc64, while being a 64bit platform, as of now not yet provide. This comes with the requirement that everything the architecture already provides needs to be defined, rather than just being, say, static inline functions. Bite the bullet and just provide the definitions and make it work. Compile-tested on parisc32 and parisc64. Drop some of the __raw functions that now get implemented in <asm-generic/io.h>. Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Cc: James E.J. Bottomley <James.Bottomley@HansenPartnership.com> Cc: Helge Deller <deller@gmx.de> Cc: linux-parisc@vger.kernel.org Cc: linux-arch@vger.kernel.org Cc: Mark Brown <broonie@kernel.org> Cc: John David Anglin <dave.anglin@bell.net> Link: https://lore.kernel.org/linux-arm-kernel/62fcc351.hAyADB%2FY8JTxz+kh%25lkp@intel.com/ Signed-off-by: Arnd Bergmann <arnd@arndb.de>
1 parent 77bfc8b commit 437b6b3

File tree

1 file changed

+43
-89
lines changed
  • arch/parisc/include/asm

1 file changed

+43
-89
lines changed

arch/parisc/include/asm/io.h

Lines changed: 43 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -128,98 +128,16 @@ static inline void gsc_writeq(unsigned long long val, unsigned long addr)
128128
void __iomem *ioremap(unsigned long offset, unsigned long size);
129129
#define ioremap_wc ioremap
130130
#define ioremap_uc ioremap
131+
#define pci_iounmap pci_iounmap
131132

132133
extern void iounmap(const volatile void __iomem *addr);
133134

134-
static inline unsigned char __raw_readb(const volatile void __iomem *addr)
135-
{
136-
return (*(volatile unsigned char __force *) (addr));
137-
}
138-
static inline unsigned short __raw_readw(const volatile void __iomem *addr)
139-
{
140-
return *(volatile unsigned short __force *) addr;
141-
}
142-
static inline unsigned int __raw_readl(const volatile void __iomem *addr)
143-
{
144-
return *(volatile unsigned int __force *) addr;
145-
}
146-
static inline unsigned long long __raw_readq(const volatile void __iomem *addr)
147-
{
148-
return *(volatile unsigned long long __force *) addr;
149-
}
150-
151-
static inline void __raw_writeb(unsigned char b, volatile void __iomem *addr)
152-
{
153-
*(volatile unsigned char __force *) addr = b;
154-
}
155-
static inline void __raw_writew(unsigned short b, volatile void __iomem *addr)
156-
{
157-
*(volatile unsigned short __force *) addr = b;
158-
}
159-
static inline void __raw_writel(unsigned int b, volatile void __iomem *addr)
160-
{
161-
*(volatile unsigned int __force *) addr = b;
162-
}
163-
static inline void __raw_writeq(unsigned long long b, volatile void __iomem *addr)
164-
{
165-
*(volatile unsigned long long __force *) addr = b;
166-
}
167-
168-
static inline unsigned char readb(const volatile void __iomem *addr)
169-
{
170-
return __raw_readb(addr);
171-
}
172-
static inline unsigned short readw(const volatile void __iomem *addr)
173-
{
174-
return le16_to_cpu((__le16 __force) __raw_readw(addr));
175-
}
176-
static inline unsigned int readl(const volatile void __iomem *addr)
177-
{
178-
return le32_to_cpu((__le32 __force) __raw_readl(addr));
179-
}
180-
static inline unsigned long long readq(const volatile void __iomem *addr)
181-
{
182-
return le64_to_cpu((__le64 __force) __raw_readq(addr));
183-
}
184-
185-
static inline void writeb(unsigned char b, volatile void __iomem *addr)
186-
{
187-
__raw_writeb(b, addr);
188-
}
189-
static inline void writew(unsigned short w, volatile void __iomem *addr)
190-
{
191-
__raw_writew((__u16 __force) cpu_to_le16(w), addr);
192-
}
193-
static inline void writel(unsigned int l, volatile void __iomem *addr)
194-
{
195-
__raw_writel((__u32 __force) cpu_to_le32(l), addr);
196-
}
197-
static inline void writeq(unsigned long long q, volatile void __iomem *addr)
198-
{
199-
__raw_writeq((__u64 __force) cpu_to_le64(q), addr);
200-
}
201-
202-
#define readb readb
203-
#define readw readw
204-
#define readl readl
205-
#define readq readq
206-
#define writeb writeb
207-
#define writew writew
208-
#define writel writel
209-
#define writeq writeq
210-
211-
#define readb_relaxed(addr) readb(addr)
212-
#define readw_relaxed(addr) readw(addr)
213-
#define readl_relaxed(addr) readl(addr)
214-
#define readq_relaxed(addr) readq(addr)
215-
#define writeb_relaxed(b, addr) writeb(b, addr)
216-
#define writew_relaxed(w, addr) writew(w, addr)
217-
#define writel_relaxed(l, addr) writel(l, addr)
218-
#define writeq_relaxed(q, addr) writeq(q, addr)
219-
220135
void memset_io(volatile void __iomem *addr, unsigned char val, int count);
221136
void memcpy_fromio(void *dst, const volatile void __iomem *src, int count);
222137
void memcpy_toio(volatile void __iomem *dst, const void *src, int count);
138+
#define memset_io memset_io
139+
#define memcpy_fromio memcpy_fromio
140+
#define memcpy_toio memcpy_toio
223141

224142
/* Port-space IO */
225143

@@ -241,10 +159,15 @@ extern void eisa_out32(unsigned int data, unsigned short port);
241159
extern unsigned char inb(int addr);
242160
extern unsigned short inw(int addr);
243161
extern unsigned int inl(int addr);
244-
245162
extern void outb(unsigned char b, int addr);
246163
extern void outw(unsigned short b, int addr);
247164
extern void outl(unsigned int b, int addr);
165+
#define inb inb
166+
#define inw inw
167+
#define inl inl
168+
#define outb outb
169+
#define outw outw
170+
#define outl outl
248171
#elif defined(CONFIG_EISA)
249172
#define inb eisa_in8
250173
#define inw eisa_in16
@@ -270,7 +193,9 @@ static inline int inl(unsigned long addr)
270193
BUG();
271194
return -1;
272195
}
273-
196+
#define inb inb
197+
#define inw inw
198+
#define inl inl
274199
#define outb(x, y) ({(void)(x); (void)(y); BUG(); 0;})
275200
#define outw(x, y) ({(void)(x); (void)(y); BUG(); 0;})
276201
#define outl(x, y) ({(void)(x); (void)(y); BUG(); 0;})
@@ -285,7 +210,12 @@ extern void insl (unsigned long port, void *dst, unsigned long count);
285210
extern void outsb (unsigned long port, const void *src, unsigned long count);
286211
extern void outsw (unsigned long port, const void *src, unsigned long count);
287212
extern void outsl (unsigned long port, const void *src, unsigned long count);
288-
213+
#define insb insb
214+
#define insw insw
215+
#define insl insl
216+
#define outsb outsb
217+
#define outsw outsw
218+
#define outsl outsl
289219

290220
/* IO Port space is : BBiiii where BB is HBA number. */
291221
#define IO_SPACE_LIMIT 0x00ffffff
@@ -307,6 +237,28 @@ extern void iowrite64(u64 val, void __iomem *addr);
307237
extern void iowrite64be(u64 val, void __iomem *addr);
308238

309239
#include <asm-generic/iomap.h>
240+
/*
241+
* These get provided from <asm-generic/iomap.h> since parisc does not
242+
* select GENERIC_IOMAP.
243+
*/
244+
#define ioport_map ioport_map
245+
#define ioport_unmap ioport_unmap
246+
#define ioread8 ioread8
247+
#define ioread16 ioread16
248+
#define ioread32 ioread32
249+
#define ioread16be ioread16be
250+
#define ioread32be ioread32be
251+
#define iowrite8 iowrite8
252+
#define iowrite16 iowrite16
253+
#define iowrite32 iowrite32
254+
#define iowrite16be iowrite16be
255+
#define iowrite32be iowrite32be
256+
#define ioread8_rep ioread8_rep
257+
#define ioread16_rep ioread16_rep
258+
#define ioread32_rep ioread32_rep
259+
#define iowrite8_rep iowrite8_rep
260+
#define iowrite16_rep iowrite16_rep
261+
#define iowrite32_rep iowrite32_rep
310262

311263
/*
312264
* Convert a physical pointer to a virtual kernel pointer for /dev/mem
@@ -316,4 +268,6 @@ extern void iowrite64be(u64 val, void __iomem *addr);
316268

317269
extern int devmem_is_allowed(unsigned long pfn);
318270

271+
#include <asm-generic/io.h>
272+
319273
#endif

0 commit comments

Comments
 (0)