diff mbox

[kvm-unit-tests,01/11] asm-generic: add portio accessors to io.h

Message ID 1452874216-3087-2-git-send-email-drjones@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andrew Jones Jan. 15, 2016, 4:10 p.m. UTC
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
 lib/asm-generic/io.h | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
diff mbox

Patch

diff --git a/lib/asm-generic/io.h b/lib/asm-generic/io.h
index a9939d3a5921f..d66af3b4d6825 100644
--- a/lib/asm-generic/io.h
+++ b/lib/asm-generic/io.h
@@ -152,6 +152,58 @@  static inline u64 __bswap64(u64 x)
 #define writeq(b, addr) \
 	({ wmb(); __raw_writeq(cpu_to_le64(b), addr); })
 
+#ifndef PCI_IOBASE
+#define PCI_IOBASE ((void *)0)
+#endif
+
+#ifndef inb
+#define inb inb
+static inline u8 inb(unsigned long addr)
+{
+	return readb(PCI_IOBASE + addr);
+}
+#endif
+
+#ifndef inw
+#define inw inw
+static inline u16 inw(unsigned long addr)
+{
+	return readw(PCI_IOBASE + addr);
+}
+#endif
+
+#ifndef inl
+#define inl inl
+static inline u32 inl(unsigned long addr)
+{
+	return readl(PCI_IOBASE + addr);
+}
+#endif
+
+#ifndef outb
+#define outb outb
+static inline void outb(u8 value, unsigned long addr)
+{
+	writeb(value, PCI_IOBASE + addr);
+}
+#endif
+
+#ifndef outw
+#define outw outw
+static inline void outw(u16 value, unsigned long addr)
+{
+	writew(value, PCI_IOBASE + addr);
+}
+#endif
+
+#ifndef outl
+#define outl outl
+static inline void outl(u32 value, unsigned long addr)
+{
+	writel(value, PCI_IOBASE + addr);
+}
+#endif
+
 #ifndef ioremap
 static inline void *ioremap(u64 phys_addr, size_t size __unused)
 {