From patchwork Fri Oct 9 06:28:36 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isaku Yamahata X-Patchwork-Id: 35555 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5954EB7B8B for ; Fri, 9 Oct 2009 17:33:28 +1100 (EST) Received: from localhost ([127.0.0.1]:60789 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mw92b-00061s-7R for incoming@patchwork.ozlabs.org; Fri, 09 Oct 2009 02:33:25 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mw90B-00040d-77 for qemu-devel@nongnu.org; Fri, 09 Oct 2009 02:30:56 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mw904-0003qc-SQ for qemu-devel@nongnu.org; Fri, 09 Oct 2009 02:30:52 -0400 Received: from [199.232.76.173] (port=55750 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mw904-0003qO-Mw for qemu-devel@nongnu.org; Fri, 09 Oct 2009 02:30:48 -0400 Received: from mail.valinux.co.jp ([210.128.90.3]:36119) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mw901-0001OI-OS for qemu-devel@nongnu.org; Fri, 09 Oct 2009 02:30:46 -0400 Received: from nm.local.valinux.co.jp (vagw.valinux.co.jp [210.128.90.14]) by mail.valinux.co.jp (Postfix) with ESMTP id 87BA549E15; Fri, 9 Oct 2009 15:30:39 +0900 (JST) Received: from yamahata by nm.local.valinux.co.jp with local (Exim 4.69) (envelope-from ) id 1Mw8yM-000469-AH; Fri, 09 Oct 2009 15:29:02 +0900 From: Isaku Yamahata To: qemu-devel@nongnu.org, mst@redhat.com Date: Fri, 9 Oct 2009 15:28:36 +0900 Message-Id: <1255069742-15724-4-git-send-email-yamahata@valinux.co.jp> X-Mailer: git-send-email 1.6.0.2 In-Reply-To: <1255069742-15724-1-git-send-email-yamahata@valinux.co.jp> References: <1255069742-15724-1-git-send-email-yamahata@valinux.co.jp> X-Virus-Scanned: clamav-milter 0.95.2 at va-mail.local.valinux.co.jp X-Virus-Status: Clean X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: yamahata@valinux.co.jp Subject: [Qemu-devel] [PATCH V5 03/29] pci: use PCI_SLOT() and PCI_FUNC(). X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org use PCI_SLOT() and PCI_FUNC() where appropriate instead of direct use of bit operation. Signed-off-by: Isaku Yamahata Acked-by: Michael S. Tsirkin --- hw/apb_pci.c | 10 ++++++---- hw/pci.c | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/hw/apb_pci.c b/hw/apb_pci.c index 72f15af..920b647 100644 --- a/hw/apb_pci.c +++ b/hw/apb_pci.c @@ -252,11 +252,13 @@ PCIBus *pci_apb_init(target_phys_addr_t special_base, 0, 32); pci_create_simple(d->host_state.bus, 0, "pbm"); /* APB secondary busses */ - *bus2 = pci_bridge_init(d->host_state.bus, 8, PCI_VENDOR_ID_SUN, - PCI_DEVICE_ID_SUN_SIMBA, pci_apb_map_irq, + *bus2 = pci_bridge_init(d->host_state.bus, PCI_DEVFN(1, 0), + PCI_VENDOR_ID_SUN, PCI_DEVICE_ID_SUN_SIMBA, + pci_apb_map_irq, "Advanced PCI Bus secondary bridge 1"); - *bus3 = pci_bridge_init(d->host_state.bus, 9, PCI_VENDOR_ID_SUN, - PCI_DEVICE_ID_SUN_SIMBA, pci_apb_map_irq, + *bus3 = pci_bridge_init(d->host_state.bus, PCI_DEVFN(1, 1), + PCI_VENDOR_ID_SUN, PCI_DEVICE_ID_SUN_SIMBA, + pci_apb_map_irq, "Advanced PCI Bus secondary bridge 2"); return d->host_state.bus; diff --git a/hw/pci.c b/hw/pci.c index 9b145ee..5d1a68f 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -745,7 +745,7 @@ static void pci_info_device(PCIDevice *d) const pci_class_desc *desc; monitor_printf(mon, " Bus %2d, device %3d, function %d:\n", - d->bus->bus_num, d->devfn >> 3, d->devfn & 7); + d->bus->bus_num, PCI_SLOT(d->devfn), PCI_FUNC(d->devfn)); class = le16_to_cpu(*((uint16_t *)(d->config + PCI_CLASS_DEVICE))); monitor_printf(mon, " "); desc = pci_class_descriptions; @@ -1112,7 +1112,7 @@ static void pcibus_dev_print(Monitor *mon, DeviceState *dev, int indent) monitor_printf(mon, "%*sclass %s, addr %02x:%02x.%x, " "pci id %04x:%04x (sub %04x:%04x)\n", indent, "", ctxt, - d->bus->bus_num, d->devfn >> 3, d->devfn & 7, + d->bus->bus_num, PCI_SLOT(d->devfn), PCI_FUNC(d->devfn), le16_to_cpu(*((uint16_t *)(d->config + PCI_VENDOR_ID))), le16_to_cpu(*((uint16_t *)(d->config + PCI_DEVICE_ID))), le16_to_cpu(*((uint16_t *)(d->config + PCI_SUBSYSTEM_VENDOR_ID))),