From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Jones Subject: [kvm-unit-tests PATCH v2 01/10] asm-generic: add portio accessors to io.h Date: Fri, 15 Jan 2016 17:51:26 +0100 Message-ID: <1452876695-9240-2-git-send-email-drjones@redhat.com> References: <1452876695-9240-1-git-send-email-drjones@redhat.com> Cc: pbonzini@redhat.com, mst@redhat.com, agordeev@redhat.com, rkrcmar@redhat.com To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:50352 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754746AbcAOQvo (ORCPT ); Fri, 15 Jan 2016 11:51:44 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id EB7F13F3B9 for ; Fri, 15 Jan 2016 16:51:43 +0000 (UTC) In-Reply-To: <1452876695-9240-1-git-send-email-drjones@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Signed-off-by: Andrew Jones --- lib/asm-generic/io.h | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) 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) { -- 2.4.3