From patchwork Fri Oct 9 06:28:40 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isaku Yamahata X-Patchwork-Id: 35570 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 040ECB7B8B for ; Fri, 9 Oct 2009 18:02:26 +1100 (EST) Received: from localhost ([127.0.0.1]:40835 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mw9Ud-0005iO-8s for incoming@patchwork.ozlabs.org; Fri, 09 Oct 2009 03:02:23 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mw90L-0004BB-5s for qemu-devel@nongnu.org; Fri, 09 Oct 2009 02:31:05 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mw90B-0003zb-6B for qemu-devel@nongnu.org; Fri, 09 Oct 2009 02:31:00 -0400 Received: from [199.232.76.173] (port=55769 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mw90A-0003xk-7W for qemu-devel@nongnu.org; Fri, 09 Oct 2009 02:30:54 -0400 Received: from mail.valinux.co.jp ([210.128.90.3]:36135) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mw907-0001Q9-7q for qemu-devel@nongnu.org; Fri, 09 Oct 2009 02:30:51 -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 B2ACC49E1B; 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-00046L-IW; 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:40 +0900 Message-Id: <1255069742-15724-8-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 07/29] pci/bridge: clean up of pci_bridge_initfn() 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 symbolic constant - use helper function pci_set_xxx() Signed-off-by: Isaku Yamahata Acked-by: Michael S. Tsirkin --- hw/pci.c | 23 ++++++++++++----------- 1 files changed, 12 insertions(+), 11 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index a66e3de..eaf471a 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -923,17 +923,18 @@ static int pci_bridge_initfn(PCIDevice *dev) pci_config_set_vendor_id(s->dev.config, s->vid); pci_config_set_device_id(s->dev.config, s->did); - s->dev.config[0x04] = 0x06; // command = bus master, pci mem - s->dev.config[0x05] = 0x00; - s->dev.config[0x06] = 0xa0; // status = fast back-to-back, 66MHz, no error - s->dev.config[0x07] = 0x00; // status = fast devsel - s->dev.config[0x08] = 0x00; // revision - s->dev.config[0x09] = 0x00; // programming i/f - pci_config_set_class(s->dev.config, PCI_CLASS_BRIDGE_PCI); - s->dev.config[0x0D] = 0x10; // latency_timer - s->dev.config[PCI_HEADER_TYPE] = - PCI_HEADER_TYPE_MULTI_FUNCTION | PCI_HEADER_TYPE_BRIDGE; // header_type - s->dev.config[0x1E] = 0xa0; // secondary status + pci_set_word(dev->config + PCI_COMMAND, + PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER); + pci_set_word(dev->config + PCI_STATUS, + PCI_STATUS_66MHZ | PCI_STATUS_FAST_BACK); + dev->config[PCI_REVISION_ID] = 0x00; + dev->config[PCI_CLASS_PROG] = 0x00; + pci_config_set_class(dev->config, PCI_CLASS_BRIDGE_PCI); + dev->config[PCI_LATENCY_TIMER] = 0x10; + dev->config[PCI_HEADER_TYPE] = + PCI_HEADER_TYPE_MULTI_FUNCTION | PCI_HEADER_TYPE_BRIDGE; + pci_set_word(dev->config + PCI_SEC_STATUS, + PCI_STATUS_66MHZ | PCI_STATUS_FAST_BACK); return 0; }