From patchwork Mon Jun 21 06:04:01 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isaku Yamahata X-Patchwork-Id: 56287 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 56025B7D82 for ; Mon, 21 Jun 2010 16:09:24 +1000 (EST) Received: from localhost ([127.0.0.1]:43771 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OQaC8-0002Pc-Dk for incoming@patchwork.ozlabs.org; Mon, 21 Jun 2010 02:09:20 -0400 Received: from [140.186.70.92] (port=33920 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OQaAh-0002Ma-Gd for qemu-devel@nongnu.org; Mon, 21 Jun 2010 02:07:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OQaAf-0000n9-NU for qemu-devel@nongnu.org; Mon, 21 Jun 2010 02:07:51 -0400 Received: from mail.valinux.co.jp ([210.128.90.3]:46842) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OQaAf-0000mV-6H for qemu-devel@nongnu.org; Mon, 21 Jun 2010 02:07:49 -0400 Received: from ps.local.valinux.co.jp (vagw.valinux.co.jp [210.128.90.14]) by mail.valinux.co.jp (Postfix) with SMTP id 29725107400; Mon, 21 Jun 2010 15:07:45 +0900 (JST) Received: (nullmailer pid 18101 invoked by uid 1000); Mon, 21 Jun 2010 06:04:01 -0000 From: Isaku Yamahata To: qemu-devel@nongnu.org Date: Mon, 21 Jun 2010 15:04:01 +0900 Message-Id: <3eedcec1b57f29df8b92f1a2e9b34ee5959a66a7.1277100005.git.yamahata@valinux.co.jp> X-Mailer: git-send-email 1.6.6.1 In-Reply-To: References: In-Reply-To: References: X-Virus-Scanned: clamav-milter 0.95.2 at va-mail.local.valinux.co.jp X-Virus-Status: Clean X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: yu.liu@freescale.com, mst@redhat.com, blauwirbel@gmail.com, yamahata@valinux.co.jp, paul@codesourcery.com, aurelien@aurel32.net Subject: [Qemu-devel] [PATCH v4 6/6] pci_bridge: make pci bridge aware of pci multi function bit. 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 make pci bridge aware of pci multi function property and let pci generic code to set the bit. Cc: Blue Swirl Signed-off-by: Isaku Yamahata --- hw/apb_pci.c | 7 ++----- hw/dec_pci.c | 2 +- hw/pci.c | 5 +++-- hw/pci.h | 3 ++- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/hw/apb_pci.c b/hw/apb_pci.c index 69a774d..4b78704 100644 --- a/hw/apb_pci.c +++ b/hw/apb_pci.c @@ -312,9 +312,6 @@ static void apb_pci_bridge_init(PCIBus *b) PCI_STATUS_FAST_BACK | PCI_STATUS_66MHZ | PCI_STATUS_DEVSEL_MEDIUM); pci_set_byte(dev->config + PCI_REVISION_ID, 0x11); - pci_set_byte(dev->config + PCI_HEADER_TYPE, - pci_get_byte(dev->config + PCI_HEADER_TYPE) | - PCI_HEADER_TYPE_MULTI_FUNCTION); } PCIBus *pci_apb_init(target_phys_addr_t special_base, @@ -350,13 +347,13 @@ PCIBus *pci_apb_init(target_phys_addr_t special_base, pci_create_simple(d->bus, 0, "pbm"); /* APB secondary busses */ - *bus2 = pci_bridge_init(d->bus, PCI_DEVFN(1, 0), + *bus2 = pci_bridge_init(d->bus, PCI_DEVFN(1, 0), 1, PCI_VENDOR_ID_SUN, PCI_DEVICE_ID_SUN_SIMBA, pci_apb_map_irq, "Advanced PCI Bus secondary bridge 1"); apb_pci_bridge_init(*bus2); - *bus3 = pci_bridge_init(d->bus, PCI_DEVFN(1, 1), + *bus3 = pci_bridge_init(d->bus, PCI_DEVFN(1, 1), 1, PCI_VENDOR_ID_SUN, PCI_DEVICE_ID_SUN_SIMBA, pci_apb_map_irq, "Advanced PCI Bus secondary bridge 2"); diff --git a/hw/dec_pci.c b/hw/dec_pci.c index 83ce4cd..f042f80 100644 --- a/hw/dec_pci.c +++ b/hw/dec_pci.c @@ -55,7 +55,7 @@ PCIBus *pci_dec_21154_init(PCIBus *parent_bus, int devfn) dev = qdev_create(NULL, "dec-21154"); qdev_init_nofail(dev); - ret = pci_bridge_init(parent_bus, devfn, + ret = pci_bridge_init(parent_bus, devfn, 0, PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_21154, dec_map_irq, "DEC 21154 PCI-PCI bridge"); diff --git a/hw/pci.c b/hw/pci.c index abc3c1d..7e4fbae 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -1613,13 +1613,14 @@ static int pci_bridge_exitfn(PCIDevice *pci_dev) return 0; } -PCIBus *pci_bridge_init(PCIBus *bus, int devfn, uint16_t vid, uint16_t did, +PCIBus *pci_bridge_init(PCIBus *bus, int devfn, uint8_t mf, + uint16_t vid, uint16_t did, pci_map_irq_fn map_irq, const char *name) { PCIDevice *dev; PCIBridge *s; - dev = pci_create(bus, devfn, "pci-bridge"); + dev = pci_create_mf(bus, devfn, mf, "pci-bridge"); qdev_prop_set_uint32(&dev->qdev, "vendorid", vid); qdev_prop_set_uint32(&dev->qdev, "deviceid", did); qdev_init_nofail(&dev->qdev); diff --git a/hw/pci.h b/hw/pci.h index 685fd44..889bbea 100644 --- a/hw/pci.h +++ b/hw/pci.h @@ -231,7 +231,8 @@ int pci_read_devaddr(Monitor *mon, const char *addr, int *domp, int *busp, void do_pci_info_print(Monitor *mon, const QObject *data); void do_pci_info(Monitor *mon, QObject **ret_data); -PCIBus *pci_bridge_init(PCIBus *bus, int devfn, uint16_t vid, uint16_t did, +PCIBus *pci_bridge_init(PCIBus *bus, int devfn, uint8_t mf, + uint16_t vid, uint16_t did, pci_map_irq_fn map_irq, const char *name); PCIDevice *pci_bridge_get_device(PCIBus *bus);