[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190319184325.72807-6-andriy.shevchenko@linux.intel.com>
Date: Tue, 19 Mar 2019 21:43:23 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: "H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
linux-kernel@...r.kernel.org
Cc: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Subject: [PATCH v2 5/7] x86/boot: Add MMIO byte accessors
readb() and writeb() would help to access serial device
via MMIO address space.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.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 86641b2e83f8..b2a272d3f36b 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.20.1
Powered by blists - more mailing lists