Skip to content

Commit 7e772da

Browse files
linuswarndb
authored andcommitted
alpha: Use generic <asm-generic/io.h>
This enables the alpha to use <asm-generic/io.h> to fill in the missing (undefined) I/O accessor functions. This is needed if Alpha ever wants to uses CONFIG_REGMAP_MMIO which has been patches to use accelerated _noinc accessors such as readsq/writesq that Alpha, while being a 64bit platform, as of now not yet provide. readq/writeq is however provided so the machine can do 64bit I/O. 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. Some defines need to be piled right before the inclusion of <asm-generic/io.h> due to the fact that alpha is including <asm-generic/iomap.h> without selecting GENERIC_IOMAP. Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Cc: Mark Brown <broonie@kernel.org> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Richard Henderson <richard.henderson@linaro.org> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru> Cc: Matt Turner <mattst88@gmail.com> Cc: linux-arch@vger.kernel.org Cc: linux-alpha@vger.kernel.org Link: https://lore.kernel.org/linux-mm/202208181447.G9FLcMkI-lkp@intel.com/ Signed-off-by: Arnd Bergmann <arnd@arndb.de>
1 parent 7e18e42 commit 7e772da

File tree

1 file changed

+68
-10
lines changed
  • arch/alpha/include/asm

1 file changed

+68
-10
lines changed

arch/alpha/include/asm/io.h

Lines changed: 68 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ static inline void * phys_to_virt(unsigned long address)
9090
}
9191
#endif
9292

93+
#define virt_to_phys virt_to_phys
94+
#define phys_to_virt phys_to_virt
9395
#define page_to_phys(page) page_to_pa(page)
9496

9597
/* Maximum PIO space address supported? */
@@ -242,6 +244,12 @@ extern u32 inl(unsigned long port);
242244
extern void outb(u8 b, unsigned long port);
243245
extern void outw(u16 b, unsigned long port);
244246
extern void outl(u32 b, unsigned long port);
247+
#define inb inb
248+
#define inw inw
249+
#define inl inl
250+
#define outb outb
251+
#define outw outw
252+
#define outl outl
245253

246254
extern u8 readb(const volatile void __iomem *addr);
247255
extern u16 readw(const volatile void __iomem *addr);
@@ -251,6 +259,14 @@ extern void writeb(u8 b, volatile void __iomem *addr);
251259
extern void writew(u16 b, volatile void __iomem *addr);
252260
extern void writel(u32 b, volatile void __iomem *addr);
253261
extern void writeq(u64 b, volatile void __iomem *addr);
262+
#define readb readb
263+
#define readw readw
264+
#define readl readl
265+
#define readq readq
266+
#define writeb writeb
267+
#define writew writew
268+
#define writel writel
269+
#define writeq writeq
254270

255271
extern u8 __raw_readb(const volatile void __iomem *addr);
256272
extern u16 __raw_readw(const volatile void __iomem *addr);
@@ -260,6 +276,14 @@ extern void __raw_writeb(u8 b, volatile void __iomem *addr);
260276
extern void __raw_writew(u16 b, volatile void __iomem *addr);
261277
extern void __raw_writel(u32 b, volatile void __iomem *addr);
262278
extern void __raw_writeq(u64 b, volatile void __iomem *addr);
279+
#define __raw_readb __raw_readb
280+
#define __raw_readw __raw_readw
281+
#define __raw_readl __raw_readl
282+
#define __raw_readq __raw_readq
283+
#define __raw_writeb __raw_writeb
284+
#define __raw_writew __raw_writew
285+
#define __raw_writel __raw_writel
286+
#define __raw_writeq __raw_writeq
263287

264288
/*
265289
* Mapping from port numbers to __iomem space is pretty easy.
@@ -277,6 +301,9 @@ extern inline void ioport_unmap(void __iomem *addr)
277301
{
278302
}
279303

304+
#define ioport_map ioport_map
305+
#define ioport_unmap ioport_unmap
306+
280307
static inline void __iomem *ioremap(unsigned long port, unsigned long size)
281308
{
282309
return IO_CONCAT(__IO_PREFIX,ioremap) (port, size);
@@ -358,6 +385,11 @@ extern inline void outw(u16 b, unsigned long port)
358385
}
359386
#endif
360387

388+
#define ioread8 ioread8
389+
#define ioread16 ioread16
390+
#define iowrite8 iowrite8
391+
#define iowrite16 iowrite16
392+
361393
#if IO_CONCAT(__IO_PREFIX,trivial_io_lq)
362394
extern inline unsigned int ioread32(const void __iomem *addr)
363395
{
@@ -385,6 +417,9 @@ extern inline void outl(u32 b, unsigned long port)
385417
}
386418
#endif
387419

420+
#define ioread32 ioread32
421+
#define iowrite32 iowrite32
422+
388423
#if IO_CONCAT(__IO_PREFIX,trivial_rw_bw) == 1
389424
extern inline u8 __raw_readb(const volatile void __iomem *addr)
390425
{
@@ -505,6 +540,10 @@ extern u8 readb_relaxed(const volatile void __iomem *addr);
505540
extern u16 readw_relaxed(const volatile void __iomem *addr);
506541
extern u32 readl_relaxed(const volatile void __iomem *addr);
507542
extern u64 readq_relaxed(const volatile void __iomem *addr);
543+
#define readb_relaxed readb_relaxed
544+
#define readw_relaxed readw_relaxed
545+
#define readl_relaxed readl_relaxed
546+
#define readq_relaxed readq_relaxed
508547

509548
#if IO_CONCAT(__IO_PREFIX,trivial_io_bw)
510549
extern inline u8 readb_relaxed(const volatile void __iomem *addr)
@@ -557,6 +596,10 @@ static inline void memsetw_io(volatile void __iomem *addr, u16 c, long len)
557596
_memset_c_io(addr, 0x0001000100010001UL * c, len);
558597
}
559598

599+
#define memset_io memset_io
600+
#define memcpy_fromio memcpy_fromio
601+
#define memcpy_toio memcpy_toio
602+
560603
/*
561604
* String versions of in/out ops:
562605
*/
@@ -567,6 +610,13 @@ extern void outsb (unsigned long port, const void *src, unsigned long count);
567610
extern void outsw (unsigned long port, const void *src, unsigned long count);
568611
extern void outsl (unsigned long port, const void *src, unsigned long count);
569612

613+
#define insb insb
614+
#define insw insw
615+
#define insl insl
616+
#define outsb outsb
617+
#define outsw outsw
618+
#define outsl outsl
619+
570620
/*
571621
* The Alpha Jensen hardware for some rather strange reason puts
572622
* the RTC clock at 0x170 instead of 0x70. Probably due to some
@@ -586,22 +636,30 @@ extern void outsl (unsigned long port, const void *src, unsigned long count);
586636
#endif
587637
#define RTC_ALWAYS_BCD 0
588638

589-
/*
590-
* Some mucking forons use if[n]def writeq to check if platform has it.
591-
* It's a bloody bad idea and we probably want ARCH_HAS_WRITEQ for them
592-
* to play with; for now just use cpp anti-recursion logics and make sure
593-
* that damn thing is defined and expands to itself.
594-
*/
595-
596-
#define writeq writeq
597-
#define readq readq
598-
599639
/*
600640
* Convert a physical pointer to a virtual kernel pointer for /dev/mem
601641
* access
602642
*/
603643
#define xlate_dev_mem_ptr(p) __va(p)
604644

645+
/*
646+
* These get provided from <asm-generic/iomap.h> since alpha does not
647+
* select GENERIC_IOMAP.
648+
*/
649+
#define ioread64 ioread64
650+
#define iowrite64 iowrite64
651+
#define ioread64be ioread64be
652+
#define iowrite64be iowrite64be
653+
#define ioread8_rep ioread8_rep
654+
#define ioread16_rep ioread16_rep
655+
#define ioread32_rep ioread32_rep
656+
#define iowrite8_rep iowrite8_rep
657+
#define iowrite16_rep iowrite16_rep
658+
#define iowrite32_rep iowrite32_rep
659+
#define pci_iounmap pci_iounmap
660+
661+
#include <asm-generic/io.h>
662+
605663
#endif /* __KERNEL__ */
606664

607665
#endif /* __ALPHA_IO_H */

0 commit comments

Comments
 (0)