Skip to contentSkip to conversation

x86: Add 64-bit memory-mapped I/O functions

PATCH Superseded Ivan Gorinov 3 participants 4 messages Apr 6, 2018 – Apr 9, 2018 x86

lore
Share & tools
lore
#0 lore raw

PATCH v6 1/1 x86: Add 64-bit memory-mapped I/O functions

Add readq() and writeq() definitions for x86.

Please note: in 32-bit code readq/writeq will generate two 32-bit memory access instructions instead of one atomic 64-bit operation.

---
 arch/x86/include/asm/io.h | 4 ++++
 1 file changed, 4 insertions(+)
arch/x86/include/asm/io.h +4 -0
index 263dd8f..4ab0080 100644
@@ -61,16 +61,20 @@
 #define readb(addr) (*(volatile unsigned char *) (addr))
 #define readw(addr) (*(volatile unsigned short *) (addr))
 #define readl(addr) (*(volatile unsigned int *) (addr))
+#define readq(addr) (*(volatile unsigned long long *) (addr))
 #define __raw_readb readb
 #define __raw_readw readw
 #define __raw_readl readl
+#define __raw_readq readq
 
 #define writeb(b,addr) (*(volatile unsigned char *) (addr) = (b))
 #define writew(b,addr) (*(volatile unsigned short *) (addr) = (b))
 #define writel(b,addr) (*(volatile unsigned int *) (addr) = (b))
+#define writeq(b,addr) (*(volatile unsigned long long *) (addr) = (b))
 #define __raw_writeb writeb
 #define __raw_writew writew
 #define __raw_writel writel
+#define __raw_writeq writeq
 
 #define memset_io(a,b,c)	memset((a),(b),(c))
 #define memcpy_fromio(a,b,c)	memcpy((a),(b),(c))
Signature · 1 line
2.7.4
#1 lore raw

PATCH v6 1/1 x86: Add 64-bit memory-mapped I/O functions

Quoted 5 lines · Ivan Gorinov

Add readq() and writeq() definitions for x86.

Please note: in 32-bit code readq/writeq will generate two 32-bit memory access instructions instead of one atomic 64-bit operation.

Thanks!

FWIW,

Quoted 31 lines
---
 arch/x86/include/asm/io.h | 4 ++++
 1 file changed, 4 insertions(+)
arch/x86/include/asm/io.h +4 -0
index 263dd8f..4ab0080 100644
@@ -61,16 +61,20 @@
 #define readb(addr) (*(volatile unsigned char *) (addr))
 #define readw(addr) (*(volatile unsigned short *) (addr))
 #define readl(addr) (*(volatile unsigned int *) (addr))
+#define readq(addr) (*(volatile unsigned long long *) (addr))
 #define __raw_readb readb
 #define __raw_readw readw
 #define __raw_readl readl
+#define __raw_readq readq
 
 #define writeb(b,addr) (*(volatile unsigned char *) (addr) = (b))
 #define writew(b,addr) (*(volatile unsigned short *) (addr) = (b))
 #define writel(b,addr) (*(volatile unsigned int *) (addr) = (b))
+#define writeq(b,addr) (*(volatile unsigned long long *) (addr) =
 (b))
 #define __raw_writeb writeb
 #define __raw_writew writew
 #define __raw_writel writel
+#define __raw_writeq writeq
 
 #define memset_io(a,b,c)	memset((a),(b),(c))

#define memcpy_fromio(a,b,c) memcpy((a),(b),(c))

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#3 lore raw

PATCH v6 1/1 x86: Add 64-bit memory-mapped I/O functions

Quoted 6 lines · Bin Meng
Quoted 5 lines · Ivan Gorinov

Add readq() and writeq() definitions for x86.

Please note: in 32-bit code readq/writeq will generate two 32-bit memory access instructions instead of one atomic 64-bit operation.

Quoted 7 lines
Quoted 5 lines
---
 arch/x86/include/asm/io.h | 4 ++++
 1 file changed, 4 insertions(+)

applied to u-boot-x86, thanks!