From patchwork Fri Jan 15 16:10:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jones X-Patchwork-Id: 8042971 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 02B9E9F716 for ; Fri, 15 Jan 2016 16:10:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 452D42040F for ; Fri, 15 Jan 2016 16:10:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 69E042041A for ; Fri, 15 Jan 2016 16:10:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752582AbcAOQKZ (ORCPT ); Fri, 15 Jan 2016 11:10:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38335 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752538AbcAOQKZ (ORCPT ); Fri, 15 Jan 2016 11:10:25 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 0DDB43F3B9 for ; Fri, 15 Jan 2016 16:10:25 +0000 (UTC) Received: from hawk.localdomain.com (dhcp-1-158.brq.redhat.com [10.34.1.158]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u0FGALWj021524; Fri, 15 Jan 2016 11:10:23 -0500 From: Andrew Jones To: kvm@vger.kernel.org Cc: pbonzini@redhat.com, mst@redhat.com, agordeev@redhat.com, rkrcmar@redhat.com Subject: [kvm-unit-tests PATCH 01/11] asm-generic: add portio accessors to io.h Date: Fri, 15 Jan 2016 17:10:06 +0100 Message-Id: <1452874216-3087-2-git-send-email-drjones@redhat.com> In-Reply-To: <1452874216-3087-1-git-send-email-drjones@redhat.com> References: <1452874216-3087-1-git-send-email-drjones@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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) {