From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mw9Nr-0001DR-1U for qemu-devel@nongnu.org; Fri, 09 Oct 2009 02:55:23 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mw9Nm-0001C7-1y for qemu-devel@nongnu.org; Fri, 09 Oct 2009 02:55:22 -0400 Received: from [199.232.76.173] (port=47771 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mw9Nl-0001C0-Rt for qemu-devel@nongnu.org; Fri, 09 Oct 2009 02:55:17 -0400 Received: from mx20.gnu.org ([199.232.41.8]:7570) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Mw9Nl-0004IZ-9n for qemu-devel@nongnu.org; Fri, 09 Oct 2009 02:55:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mw9Nk-00086A-GQ for qemu-devel@nongnu.org; Fri, 09 Oct 2009 02:55:16 -0400 Date: Fri, 9 Oct 2009 08:53:10 +0200 From: "Michael S. Tsirkin" Message-ID: <20091009065310.GD9942@redhat.com> References: <1255069742-15724-1-git-send-email-yamahata@valinux.co.jp> <1255069742-15724-8-git-send-email-yamahata@valinux.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1255069742-15724-8-git-send-email-yamahata@valinux.co.jp> Subject: [Qemu-devel] Re: [PATCH V5 07/29] pci/bridge: clean up of pci_bridge_initfn() List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Isaku Yamahata Cc: qemu-devel@nongnu.org On Fri, Oct 09, 2009 at 03:28:40PM +0900, Isaku Yamahata wrote: > - use symbolic constant > - use helper function pci_set_xxx() > > Signed-off-by: Isaku Yamahata > --- > 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); BTW, I think this is a wrong reset value: should be disabled by default. Fixing this needs some testing though, so I am not suggesting we do it in this patch. Have some time to fix this? > + 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; I think we can remove these two: this is the default already. > + 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; > } > > -- > 1.6.0.2