From 4f7a3463c4a2e4c4b788d56151e885f00f51b25e Mon Sep 17 00:00:00 2001 From: Igor Prusov Date: Tue, 14 Nov 2023 14:02:45 +0300 Subject: sandbox: move asm-generic include to the end of file Generic version of io.h should be included at the end of architecture-specific ones to make sure that arch implementations are used and to avoid redefinitions. Signed-off-by: Igor Prusov Reviewed-by: Simon Glass --- arch/sandbox/include/asm/io.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'arch') diff --git a/arch/sandbox/include/asm/io.h b/arch/sandbox/include/asm/io.h index 31ab7289b4b..77a02e5f524 100644 --- a/arch/sandbox/include/asm/io.h +++ b/arch/sandbox/include/asm/io.h @@ -28,20 +28,6 @@ void *map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags); void unmap_physmem(const void *vaddr, unsigned long flags); #define unmap_physmem unmap_physmem -#include - -/* For sandbox, we want addresses to point into our RAM buffer */ -static inline void *map_sysmem(phys_addr_t paddr, unsigned long len) -{ - return map_physmem(paddr, len, MAP_WRBACK); -} - -/* Remove a previous mapping */ -static inline void unmap_sysmem(const void *vaddr) -{ - unmap_physmem(vaddr, MAP_WRBACK); -} - /* Map from a pointer to our RAM buffer */ phys_addr_t map_to_sysmem(const void *ptr); @@ -229,5 +215,19 @@ static inline void memcpy_toio(volatile void *dst, const void *src, int count) #include #include +#include + +/* For sandbox, we want addresses to point into our RAM buffer */ +static inline void *map_sysmem(phys_addr_t paddr, unsigned long len) +{ + return map_physmem(paddr, len, MAP_WRBACK); +} + +/* Remove a previous mapping */ +static inline void unmap_sysmem(const void *vaddr) +{ + unmap_physmem(vaddr, MAP_WRBACK); +} + #endif -- cgit v1.3.1 From 93e1552cb1cd80a348d1eb56a294585ed43a4c9d Mon Sep 17 00:00:00 2001 From: Igor Prusov Date: Tue, 14 Nov 2023 14:02:46 +0300 Subject: x86: Add defines for ins/outs functions Add defines for {in,out}s{b,w,l}() functions to make sure that they will be used by asm-generic/io.h Signed-off-by: Igor Prusov --- arch/x86/include/asm/io.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'arch') diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h index 83dc09757e0..5efb2e1b21e 100644 --- a/arch/x86/include/asm/io.h +++ b/arch/x86/include/asm/io.h @@ -202,10 +202,16 @@ __OUT(l,,int) __INS(b) __INS(w) __INS(l) +#define insb insb +#define insw insw +#define insl insl __OUTS(b) __OUTS(w) __OUTS(l) +#define outsb outsb +#define outsw outsw +#define outsl outsl /* IO space accessors */ #define clrio(type, addr, clear) \ -- cgit v1.3.1 From 953970221980c677e0755d515b9e6fb2fbf2543e Mon Sep 17 00:00:00 2001 From: Igor Prusov Date: Tue, 14 Nov 2023 14:02:47 +0300 Subject: mips: io.h: Add const to reads functions params Currently reads{b,w,l}() functions don't have const qualifier for their address parameter. Since asm-generic/io.h in Linux has const for all read functions, add it here as well to keep signatures in sync. Signed-off-by: Igor Prusov --- arch/mips/include/asm/io.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'arch') diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h index d3ad6693013..12595c43347 100644 --- a/arch/mips/include/asm/io.h +++ b/arch/mips/include/asm/io.h @@ -405,7 +405,8 @@ static inline void writes##bwlq(volatile void __iomem *mem, \ } \ } \ \ -static inline void reads##bwlq(volatile void __iomem *mem, void *addr, \ +static inline void reads##bwlq(const volatile void __iomem *mem, \ + void *addr, \ unsigned int count) \ { \ volatile type *__addr = addr; \ -- cgit v1.3.1 From 65778d1f3d6b132fc922aadd2f512976141ecfc1 Mon Sep 17 00:00:00 2001 From: Igor Prusov Date: Tue, 14 Nov 2023 14:02:48 +0300 Subject: mips: io.h: Add defines for read/write/in/out functions Add defines for {read,write}{b,w,l,q}(), {read,write}s{b,w,l,q}() and {in,out}s{b,w,l,q}() functions to make asm-generic/io.h aware of them. Signed-off-by: Igor Prusov --- arch/mips/include/asm/io.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'arch') diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h index 12595c43347..3774acaadc3 100644 --- a/arch/mips/include/asm/io.h +++ b/arch/mips/include/asm/io.h @@ -336,6 +336,22 @@ BUILDIO_MEM(b, u8) BUILDIO_MEM(w, u16) BUILDIO_MEM(l, u32) BUILDIO_MEM(q, u64) +#define __raw_readb __raw_readb +#define __raw_readw __raw_readw +#define __raw_readl __raw_readl +#define __raw_readq __raw_readq +#define __raw_writeb __raw_writeb +#define __raw_writew __raw_writew +#define __raw_writel __raw_writel +#define __raw_writeq __raw_writeq +#define readb readb +#define readw readw +#define readl readl +#define readq readq +#define writeb writeb +#define writew writew +#define writel writel +#define writeq writeq #define __BUILD_IOPORT_PFX(bus, bwlq, type) \ __BUILD_IOPORT_SINGLE(bus, bwlq, type, ) \ @@ -449,8 +465,24 @@ __BUILD_IOPORT_STRING(bwlq, type) BUILDSTRING(b, u8) BUILDSTRING(w, u16) BUILDSTRING(l, u32) +#define readsb readsb +#define readsw readsw +#define readsl readsl +#define writesb writesb +#define writesw writesw +#define writesl writesl +#define outsb outsb +#define outsw outsw +#define outsl outsl +#define insb insb +#define insw insw +#define insl insl #ifdef CONFIG_64BIT BUILDSTRING(q, u64) +#define readsq readsq +#define writesq writesq +#define insq insq +#define outsq outsq #endif -- cgit v1.3.1 From 7c107ef2053609cbacde12e5d80f14c44f7f68b7 Mon Sep 17 00:00:00 2001 From: Igor Prusov Date: Tue, 14 Nov 2023 14:02:49 +0300 Subject: riscv: io.h: Add defines for reads/writes functions Add defines for {read,write}s{b,w,l} functions to make asm-generic/io.h aware of them. Signed-off-by: Igor Prusov --- arch/riscv/include/asm/io.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'arch') diff --git a/arch/riscv/include/asm/io.h b/arch/riscv/include/asm/io.h index 4170877a1ae..cedd5375d66 100644 --- a/arch/riscv/include/asm/io.h +++ b/arch/riscv/include/asm/io.h @@ -307,6 +307,14 @@ static inline void writesl(unsigned int *addr, const void *data, int longlen) longlen--; } } + +#define readsb readsb +#define readsw readsw +#define readsl readsl +#define writesb writesb +#define writesw writesw +#define writesl writesl + #endif #define outb_p(val, port) outb((val), (port)) -- cgit v1.3.1 From 55baed4dbb92a04fd1eaf5b7b4b9657737000300 Mon Sep 17 00:00:00 2001 From: Igor Prusov Date: Tue, 14 Nov 2023 14:02:50 +0300 Subject: riscv: io.h: Fix signatures of reads/writes functions Change type of address parameter from int* to volatile void* for {read,write}s{b,w,l}() functions and add const qualifier for reads. This is done to keep function signatures in sync with asm-generic/io.h and other platforms. Signed-off-by: Igor Prusov --- arch/riscv/include/asm/io.h | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'arch') diff --git a/arch/riscv/include/asm/io.h b/arch/riscv/include/asm/io.h index cedd5375d66..da165858034 100644 --- a/arch/riscv/include/asm/io.h +++ b/arch/riscv/include/asm/io.h @@ -218,7 +218,8 @@ static inline u64 readq(const volatile void __iomem *addr) #define insw(p, d, l) readsw(__io(p), d, l) #define insl(p, d, l) readsl(__io(p), d, l) -static inline void readsb(unsigned int *addr, void *data, int bytelen) +static inline void readsb(const volatile void __iomem *addr, void *data, + unsigned int bytelen) { unsigned char *ptr; unsigned char *ptr2; @@ -233,7 +234,8 @@ static inline void readsb(unsigned int *addr, void *data, int bytelen) } } -static inline void readsw(unsigned int *addr, void *data, int wordlen) +static inline void readsw(const volatile void __iomem *addr, void *data, + unsigned int wordlen) { unsigned short *ptr; unsigned short *ptr2; @@ -248,7 +250,8 @@ static inline void readsw(unsigned int *addr, void *data, int wordlen) } } -static inline void readsl(unsigned int *addr, void *data, int longlen) +static inline void readsl(const volatile void __iomem *addr, void *data, + unsigned int longlen) { unsigned int *ptr; unsigned int *ptr2; @@ -263,7 +266,8 @@ static inline void readsl(unsigned int *addr, void *data, int longlen) } } -static inline void writesb(unsigned int *addr, const void *data, int bytelen) +static inline void writesb(volatile void __iomem *addr, const void *data, + unsigned int bytelen) { unsigned char *ptr; unsigned char *ptr2; @@ -278,7 +282,8 @@ static inline void writesb(unsigned int *addr, const void *data, int bytelen) } } -static inline void writesw(unsigned int *addr, const void *data, int wordlen) +static inline void writesw(volatile void __iomem *addr, const void *data, + unsigned int wordlen) { unsigned short *ptr; unsigned short *ptr2; @@ -293,7 +298,8 @@ static inline void writesw(unsigned int *addr, const void *data, int wordlen) } } -static inline void writesl(unsigned int *addr, const void *data, int longlen) +static inline void writesl(volatile void __iomem *addr, const void *data, + unsigned int longlen) { unsigned int *ptr; unsigned int *ptr2; -- cgit v1.3.1 From 4c6d92df074ff3cc3adbf1a78524cb5c78cae509 Mon Sep 17 00:00:00 2001 From: Igor Prusov Date: Tue, 14 Nov 2023 14:02:51 +0300 Subject: nios2: io.h: Add defines for ins/outs functions Add defines for {in,out}s{b,w,l} functions to make asm-generic/io.h aware of them. Signed-off-by: Igor Prusov --- arch/nios2/include/asm/io.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'arch') diff --git a/arch/nios2/include/asm/io.h b/arch/nios2/include/asm/io.h index 817cd72e00b..321e4fd1ca5 100644 --- a/arch/nios2/include/asm/io.h +++ b/arch/nios2/include/asm/io.h @@ -94,6 +94,9 @@ static inline void insl (unsigned long port, void *dst, unsigned long count) unsigned long *p = dst; while (count--) *p++ = inl (port); } +#define insb insb +#define insw insw +#define insl insl static inline void outsb (unsigned long port, const void *src, unsigned long count) { @@ -111,6 +114,9 @@ static inline void outsl (unsigned long port, const void *src, unsigned long cou const unsigned long *p = src; while (count--) outl (*p++, port); } +#define outsb outsb +#define outsw outsw +#define outsl outsl /* * Clear and set bits in one shot. These macros can be used to clear and -- cgit v1.3.1 From 0c39bbd8c9c024ed1e0682c7c3b0f5502c15cd4c Mon Sep 17 00:00:00 2001 From: Igor Prusov Date: Tue, 14 Nov 2023 14:02:52 +0300 Subject: powerpc: io.h: Add defines for __raw_{read, write} functions Add defines for __raw_{read,write}{b,w,l}() functions to make make asm-generic/io.h aware of them. Signed-off-by: Igor Prusov --- arch/powerpc/include/asm/io.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'arch') diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h index f63cae0bc80..2412bb9d7c1 100644 --- a/arch/powerpc/include/asm/io.h +++ b/arch/powerpc/include/asm/io.h @@ -138,26 +138,37 @@ static inline unsigned char __raw_readb(const volatile void __iomem *addr) { return *(volatile unsigned char *)PCI_FIX_ADDR(addr); } +#define __raw_readb __raw_readb + static inline unsigned short __raw_readw(const volatile void __iomem *addr) { return *(volatile unsigned short *)PCI_FIX_ADDR(addr); } +#define __raw_readw __raw_readw + static inline unsigned int __raw_readl(const volatile void __iomem *addr) { return *(volatile unsigned int *)PCI_FIX_ADDR(addr); } +#define __raw_readl __raw_readl + static inline void __raw_writeb(unsigned char v, volatile void __iomem *addr) { *(volatile unsigned char *)PCI_FIX_ADDR(addr) = v; } +#define __raw_writeb __raw_writeb + static inline void __raw_writew(unsigned short v, volatile void __iomem *addr) { *(volatile unsigned short *)PCI_FIX_ADDR(addr) = v; } +#define __raw_writew __raw_writew + static inline void __raw_writel(unsigned int v, volatile void __iomem *addr) { *(volatile unsigned int *)PCI_FIX_ADDR(addr) = v; } +#define __raw_writel __raw_writel /* * 8, 16 and 32 bit, big and little endian I/O operations, with barrier. -- cgit v1.3.1 From 02585ad9e56aca03c0250c18864d1da94394c42e Mon Sep 17 00:00:00 2001 From: Igor Prusov Date: Tue, 14 Nov 2023 14:02:53 +0300 Subject: xtensa: io.h: Add defines for ins/outs functions Add defines for {in,out}s{b,w,l}() functions to make asm-generic/io.h aware of them. Signed-off-by: Igor Prusov --- arch/xtensa/include/asm/io.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'arch') diff --git a/arch/xtensa/include/asm/io.h b/arch/xtensa/include/asm/io.h index 76a646e8825..87ad9faa299 100644 --- a/arch/xtensa/include/asm/io.h +++ b/arch/xtensa/include/asm/io.h @@ -76,6 +76,12 @@ void insl(unsigned long port, void *dst, unsigned long count); void outsb(unsigned long port, const void *src, unsigned long count); void outsw(unsigned long port, const void *src, unsigned long count); void outsl(unsigned long port, const void *src, unsigned long count); +#define insb insb +#define insw insw +#define insl insl +#define outsb outsb +#define outsw outsw +#define outsl outsl #define IO_SPACE_LIMIT ~0 -- cgit v1.3.1