Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

m68k: group io mapping definitions and functions

Create a new header file, kmap.h, that groups all the definitions and
functions associated with the io mapping and remapping.

Currently the functions are spread across raw_io.h and io_mm.h. And in
the future we will want to use these in io_no.h as well. So it makes
sense to move them all together into a single header file.

It is named after the arch/m68k/mm/kmap.c file that actually implements
many of the exported functions.

Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
Tested-by: Angelo Dureghello <angelo@sysam.it>

+98 -57
+1
arch/m68k/include/asm/atarihw.h
··· 23 23 #include <linux/types.h> 24 24 #include <asm/bootinfo-atari.h> 25 25 #include <asm/raw_io.h> 26 + #include <asm/kmap.h> 26 27 27 28 extern u_long atari_mch_cookie; 28 29 extern u_long atari_mch_type;
+1 -42
arch/m68k/include/asm/io_mm.h
··· 26 26 #include <linux/compiler.h> 27 27 #include <asm/raw_io.h> 28 28 #include <asm/virtconvert.h> 29 + #include <asm/kmap.h> 29 30 30 31 #include <asm-generic/iomap.h> 31 32 ··· 462 461 463 462 #define mmiowb() 464 463 465 - static inline void __iomem *ioremap(unsigned long physaddr, unsigned long size) 466 - { 467 - return __ioremap(physaddr, size, IOMAP_NOCACHE_SER); 468 - } 469 - static inline void __iomem *ioremap_nocache(unsigned long physaddr, unsigned long size) 470 - { 471 - return __ioremap(physaddr, size, IOMAP_NOCACHE_SER); 472 - } 473 - #define ioremap_uc ioremap_nocache 474 - static inline void __iomem *ioremap_wt(unsigned long physaddr, 475 - unsigned long size) 476 - { 477 - return __ioremap(physaddr, size, IOMAP_WRITETHROUGH); 478 - } 479 - static inline void __iomem *ioremap_fullcache(unsigned long physaddr, 480 - unsigned long size) 481 - { 482 - return __ioremap(physaddr, size, IOMAP_FULL_CACHING); 483 - } 484 - 485 - static inline void memset_io(volatile void __iomem *addr, unsigned char val, int count) 486 - { 487 - __builtin_memset((void __force *) addr, val, count); 488 - } 489 - static inline void memcpy_fromio(void *dst, const volatile void __iomem *src, int count) 490 - { 491 - __builtin_memcpy(dst, (void __force *) src, count); 492 - } 493 - static inline void memcpy_toio(volatile void __iomem *dst, const void *src, int count) 494 - { 495 - __builtin_memcpy((void __force *) dst, src, count); 496 - } 497 - 498 464 #ifndef CONFIG_SUN3 499 465 #define IO_SPACE_LIMIT 0xffff 500 466 #else ··· 482 514 * Convert a virtual cached pointer to an uncached pointer 483 515 */ 484 516 #define xlate_dev_kmem_ptr(p) p 485 - 486 - static inline void __iomem *ioport_map(unsigned long port, unsigned int nr) 487 - { 488 - return (void __iomem *) port; 489 - } 490 - 491 - static inline void ioport_unmap(void __iomem *p) 492 - { 493 - } 494 517 495 518 #define readb_relaxed(addr) readb(addr) 496 519 #define readw_relaxed(addr) readw(addr)
+12
arch/m68k/include/asm/io_no.h
··· 25 25 #define writew __raw_writew 26 26 #define writel __raw_writel 27 27 28 + /* 29 + * These are defined in kmap.h as static inline functions. To maintain 30 + * previous behavior we put these define guards here so io_mm.h doesn't 31 + * see them. 32 + */ 33 + #ifdef CONFIG_MMU 34 + #define memset_io memset_io 35 + #define memcpy_fromio memcpy_fromio 36 + #define memcpy_toio memcpy_toio 37 + #endif 38 + 39 + #include <asm/kmap.h> 28 40 #include <asm/virtconvert.h> 29 41 #include <asm-generic/io.h> 30 42
+80
arch/m68k/include/asm/kmap.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + #ifndef _KMAP_H 3 + #define _KMAP_H 4 + 5 + #ifdef CONFIG_MMU 6 + 7 + /* Values for nocacheflag and cmode */ 8 + #define IOMAP_FULL_CACHING 0 9 + #define IOMAP_NOCACHE_SER 1 10 + #define IOMAP_NOCACHE_NONSER 2 11 + #define IOMAP_WRITETHROUGH 3 12 + 13 + /* 14 + * These functions exported by arch/m68k/mm/kmap.c. 15 + * Only needed on MMU enabled systems. 16 + */ 17 + extern void __iomem *__ioremap(unsigned long physaddr, unsigned long size, 18 + int cacheflag); 19 + extern void iounmap(void __iomem *addr); 20 + extern void __iounmap(void *addr, unsigned long size); 21 + 22 + #define ioremap ioremap 23 + static inline void __iomem *ioremap(unsigned long physaddr, unsigned long size) 24 + { 25 + return __ioremap(physaddr, size, IOMAP_NOCACHE_SER); 26 + } 27 + 28 + #define ioremap_nocache ioremap_nocache 29 + static inline void __iomem *ioremap_nocache(unsigned long physaddr, 30 + unsigned long size) 31 + { 32 + return __ioremap(physaddr, size, IOMAP_NOCACHE_SER); 33 + } 34 + 35 + #define ioremap_uc ioremap_nocache 36 + static inline void __iomem *ioremap_wt(unsigned long physaddr, 37 + unsigned long size) 38 + { 39 + return __ioremap(physaddr, size, IOMAP_WRITETHROUGH); 40 + } 41 + 42 + #define ioremap_fillcache ioremap_fullcache 43 + static inline void __iomem *ioremap_fullcache(unsigned long physaddr, 44 + unsigned long size) 45 + { 46 + return __ioremap(physaddr, size, IOMAP_FULL_CACHING); 47 + } 48 + 49 + static inline void memset_io(volatile void __iomem *addr, unsigned char val, 50 + int count) 51 + { 52 + __builtin_memset((void __force *) addr, val, count); 53 + } 54 + 55 + static inline void memcpy_fromio(void *dst, const volatile void __iomem *src, 56 + int count) 57 + { 58 + __builtin_memcpy(dst, (void __force *) src, count); 59 + } 60 + 61 + static inline void memcpy_toio(volatile void __iomem *dst, const void *src, 62 + int count) 63 + { 64 + __builtin_memcpy((void __force *) dst, src, count); 65 + } 66 + 67 + #endif /* CONFIG_MMU */ 68 + 69 + #define ioport_map ioport_map 70 + static inline void __iomem *ioport_map(unsigned long port, unsigned int nr) 71 + { 72 + return (void __iomem *) port; 73 + } 74 + 75 + #define ioport_unmap ioport_unmap 76 + static inline void ioport_unmap(void __iomem *p) 77 + { 78 + } 79 + 80 + #endif /* _KMAP_H */
+1
arch/m68k/include/asm/nubus.h
··· 3 3 #define _ASM_M68K_NUBUS_H 4 4 5 5 #include <asm/raw_io.h> 6 + #include <asm/kmap.h> 6 7 7 8 #define nubus_readb raw_inb 8 9 #define nubus_readw raw_inw
+1 -1
arch/m68k/include/asm/q40_master.h
··· 8 8 #define _Q40_MASTER_H 9 9 10 10 #include <asm/raw_io.h> 11 - 11 + #include <asm/kmap.h> 12 12 13 13 #define q40_master_addr 0xff000000 14 14
-14
arch/m68k/include/asm/raw_io.h
··· 13 13 14 14 #include <asm/byteorder.h> 15 15 16 - 17 - /* Values for nocacheflag and cmode */ 18 - #define IOMAP_FULL_CACHING 0 19 - #define IOMAP_NOCACHE_SER 1 20 - #define IOMAP_NOCACHE_NONSER 2 21 - #define IOMAP_WRITETHROUGH 3 22 - 23 - extern void iounmap(void __iomem *addr); 24 - 25 - extern void __iomem *__ioremap(unsigned long physaddr, unsigned long size, 26 - int cacheflag); 27 - extern void __iounmap(void *addr, unsigned long size); 28 - 29 - 30 16 /* ++roman: The assignments to temp. vars avoid that gcc sometimes generates 31 17 * two accesses to memory, which may be undesirable for some devices. 32 18 */
+1
arch/m68k/include/asm/vga.h
··· 3 3 #define _ASM_M68K_VGA_H 4 4 5 5 #include <asm/raw_io.h> 6 + #include <asm/kmap.h> 6 7 7 8 /* 8 9 * FIXME
+1
arch/m68k/include/asm/zorro.h
··· 3 3 #define _ASM_M68K_ZORRO_H 4 4 5 5 #include <asm/raw_io.h> 6 + #include <asm/kmap.h> 6 7 7 8 #define z_readb raw_inb 8 9 #define z_readw raw_inw