From patchwork Fri Jan 15 16:10:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jones X-Patchwork-Id: 8043011 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 23D2BBEEE5 for ; Fri, 15 Jan 2016 16:10:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4DCFC2041A for ; Fri, 15 Jan 2016 16:10:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5C5162045A for ; Fri, 15 Jan 2016 16:10:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752766AbcAOQKe (ORCPT ); Fri, 15 Jan 2016 11:10:34 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44295 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752746AbcAOQKc (ORCPT ); Fri, 15 Jan 2016 11:10:32 -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 5C6B8C07584A for ; Fri, 15 Jan 2016 16:10:32 +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 u0FGALWn021524; Fri, 15 Jan 2016 11:10:30 -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 05/11] x86: mov pci.h to asm Date: Fri, 15 Jan 2016 17:10:10 +0100 Message-Id: <1452874216-3087-6-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 Also move pci_config_read into pci.h from pci.c. Signed-off-by: Andrew Jones --- lib/x86/{ => asm}/pci.h | 8 ++++++++ lib/x86/pci.c | 10 +--------- x86/vmexit.c | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) rename lib/x86/{ => asm}/pci.h (65%) diff --git a/lib/x86/pci.h b/lib/x86/asm/pci.h similarity index 65% rename from lib/x86/pci.h rename to lib/x86/asm/pci.h index 046e68f9a65b6..8ad93a87966c6 100644 --- a/lib/x86/pci.h +++ b/lib/x86/asm/pci.h @@ -2,6 +2,7 @@ #define PCI_H #include "libcflat.h" +#include "asm/io.h" typedef uint16_t pcidevaddr_t; enum { @@ -12,4 +13,11 @@ unsigned long pci_bar_addr(pcidevaddr_t dev, int bar_num); bool pci_bar_is_memory(pcidevaddr_t dev, int bar_num); bool pci_bar_is_valid(pcidevaddr_t dev, int bar_num); +static inline uint32_t pci_config_read(pcidevaddr_t dev, uint8_t reg) +{ + uint32_t index = reg | (dev << 8) | (0x1 << 31); + outl(index, 0xCF8); + return inl(0xCFC); +} + #endif diff --git a/lib/x86/pci.c b/lib/x86/pci.c index 991345ce77858..7002d80836a4c 100644 --- a/lib/x86/pci.c +++ b/lib/x86/pci.c @@ -1,13 +1,5 @@ #include -#include "pci.h" -#include "asm/io.h" - -static uint32_t pci_config_read(pcidevaddr_t dev, uint8_t reg) -{ - uint32_t index = reg | (dev << 8) | (0x1 << 31); - outl(index, 0xCF8); - return inl(0xCFC); -} +#include "asm/pci.h" /* Scan bus look for a specific device. Only bus 0 scanned for now. */ pcidevaddr_t pci_find_dev(uint16_t vendor_id, uint16_t device_id) diff --git a/x86/vmexit.c b/x86/vmexit.c index 1d74a89567adc..61243a9d63c9a 100644 --- a/x86/vmexit.c +++ b/x86/vmexit.c @@ -4,7 +4,7 @@ #include "atomic.h" #include "x86/vm.h" #include "x86/desc.h" -#include "x86/pci.h" +#include "asm/pci.h" #include "x86/acpi.h" #include "asm/io.h"