Skip to content

Commit 2c23043

Browse files
linuswarndb
authored andcommitted
sparc: Fix the generic IO helpers
This enables the Sparc to use <asm-generic/io.h> to fill in the missing (undefined) [read|write]sq I/O accessor functions. This is needed if Sparc[64] ever wants to uses CONFIG_REGMAP_MMIO which has been patches to use accelerated _noinc accessors such as readsq/writesq that Sparc64, 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 sparc32 and sparc64. Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Cc: David S. Miller <davem@davemloft.net> Cc: sparclinux@vger.kernel.org Cc: linux-arch@vger.kernel.org Cc: Mark Brown <broonie@kernel.org> Cc: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/linux-arm-kernel/202208201639.HXye3ke4-lkp@intel.com/ Signed-off-by: Arnd Bergmann <arnd@arndb.de>
1 parent 7e772da commit 2c23043

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

arch/sparc/include/asm/io.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,6 @@
1919
#define writel_be(__w, __addr) __raw_writel(__w, __addr)
2020
#define writew_be(__l, __addr) __raw_writew(__l, __addr)
2121

22+
#include <asm-generic/io.h>
23+
2224
#endif

arch/sparc/include/asm/io_64.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <asm/page.h> /* IO address mapping routines need this */
1010
#include <asm/asi.h>
1111
#include <asm-generic/pci_iomap.h>
12+
#define pci_iomap pci_iomap
1213

1314
/* BIO layer definitions. */
1415
extern unsigned long kern_base, kern_size;
@@ -239,38 +240,51 @@ static inline void outl(u32 l, unsigned long addr)
239240
void outsb(unsigned long, const void *, unsigned long);
240241
void outsw(unsigned long, const void *, unsigned long);
241242
void outsl(unsigned long, const void *, unsigned long);
243+
#define outsb outsb
244+
#define outsw outsw
245+
#define outsl outsl
242246
void insb(unsigned long, void *, unsigned long);
243247
void insw(unsigned long, void *, unsigned long);
244248
void insl(unsigned long, void *, unsigned long);
249+
#define insb insb
250+
#define insw insw
251+
#define insl insl
245252

246253
static inline void readsb(void __iomem *port, void *buf, unsigned long count)
247254
{
248255
insb((unsigned long __force)port, buf, count);
249256
}
257+
#define readsb readsb
258+
250259
static inline void readsw(void __iomem *port, void *buf, unsigned long count)
251260
{
252261
insw((unsigned long __force)port, buf, count);
253262
}
263+
#define readsw readsw
254264

255265
static inline void readsl(void __iomem *port, void *buf, unsigned long count)
256266
{
257267
insl((unsigned long __force)port, buf, count);
258268
}
269+
#define readsl readsl
259270

260271
static inline void writesb(void __iomem *port, const void *buf, unsigned long count)
261272
{
262273
outsb((unsigned long __force)port, buf, count);
263274
}
275+
#define writesb writesb
264276

265277
static inline void writesw(void __iomem *port, const void *buf, unsigned long count)
266278
{
267279
outsw((unsigned long __force)port, buf, count);
268280
}
281+
#define writesw writesw
269282

270283
static inline void writesl(void __iomem *port, const void *buf, unsigned long count)
271284
{
272285
outsl((unsigned long __force)port, buf, count);
273286
}
287+
#define writesl writesl
274288

275289
#define ioread8_rep(p,d,l) readsb(p,d,l)
276290
#define ioread16_rep(p,d,l) readsw(p,d,l)
@@ -344,6 +358,7 @@ static inline void memset_io(volatile void __iomem *dst, int c, __kernel_size_t
344358
d++;
345359
}
346360
}
361+
#define memset_io memset_io
347362

348363
static inline void sbus_memcpy_fromio(void *dst, const volatile void __iomem *src,
349364
__kernel_size_t n)
@@ -369,6 +384,7 @@ static inline void memcpy_fromio(void *dst, const volatile void __iomem *src,
369384
src++;
370385
}
371386
}
387+
#define memcpy_fromio memcpy_fromio
372388

373389
static inline void sbus_memcpy_toio(volatile void __iomem *dst, const void *src,
374390
__kernel_size_t n)
@@ -395,6 +411,7 @@ static inline void memcpy_toio(volatile void __iomem *dst, const void *src,
395411
d++;
396412
}
397413
}
414+
#define memcpy_toio memcpy_toio
398415

399416
#ifdef __KERNEL__
400417

@@ -412,7 +429,9 @@ static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
412429
static inline void __iomem *ioremap_np(unsigned long offset, unsigned long size)
413430
{
414431
return NULL;
432+
415433
}
434+
#define ioremap_np ioremap_np
416435

417436
static inline void iounmap(volatile void __iomem *addr)
418437
{
@@ -432,10 +451,13 @@ static inline void iounmap(volatile void __iomem *addr)
432451
/* Create a virtual mapping cookie for an IO port range */
433452
void __iomem *ioport_map(unsigned long port, unsigned int nr);
434453
void ioport_unmap(void __iomem *);
454+
#define ioport_map ioport_map
455+
#define ioport_unmap ioport_unmap
435456

436457
/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
437458
struct pci_dev;
438459
void pci_iounmap(struct pci_dev *dev, void __iomem *);
460+
#define pci_iounmap pci_iounmap
439461

440462
static inline int sbus_can_dma_64bit(void)
441463
{

0 commit comments

Comments
 (0)