lkml.org 
[lkml]   [2018]   [Jan]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v1 3/6] x86/boot: Add MMIO byte accessors
Date
readb() and writeb() would help to access serial device
via MMIO address space.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
arch/x86/boot/boot.h | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/arch/x86/boot/boot.h b/arch/x86/boot/boot.h
index 7e6ac187275c..09f6829f2778 100644
--- a/arch/x86/boot/boot.h
+++ b/arch/x86/boot/boot.h
@@ -79,6 +79,18 @@ static inline void io_delay(void)
asm volatile("outb %%al,%0" : : "dN" (DELAY_PORT));
}

+static inline u8 readb(const volatile void __iomem *addr)
+{
+ u8 v;
+ asm volatile("movb %1,%0" : "=q" (v) : "m" (*(volatile u8 __force *)addr));
+ return v;
+}
+
+static inline void writeb(u8 v, volatile void __iomem *addr)
+{
+ asm volatile("movb %0,%1" : : "q" (v), "m" (*(volatile u8 __force *)addr));
+}
+
/* These functions are used to reference data in other segments. */

static inline u16 ds(void)
--
2.15.1
\
 
 \ /
  Last update: 2018-01-14 23:27    [W:0.114 / U:0.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site