From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LXdva-0002VJ-3Q for qemu-devel@nongnu.org; Thu, 12 Feb 2009 10:56:38 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LXdvY-0002RR-6q for qemu-devel@nongnu.org; Thu, 12 Feb 2009 10:56:37 -0500 Received: from [199.232.76.173] (port=40829 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LXdvY-0002RI-3u for qemu-devel@nongnu.org; Thu, 12 Feb 2009 10:56:36 -0500 Received: from mx2.redhat.com ([66.187.237.31]:42498) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LXdvX-0005DX-Jl for qemu-devel@nongnu.org; Thu, 12 Feb 2009 10:56:35 -0500 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n1CFuYcB015526 for ; Thu, 12 Feb 2009 10:56:34 -0500 Date: Thu, 12 Feb 2009 13:56:05 -0200 From: Marcelo Tosatti Subject: Re: [Qemu-devel] [6609] Parse full PCI device addresses (Markus Armbruster) Message-ID: <20090212155605.GA18654@amt.cnet> References: <200902121539.26892.paul@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200902121539.26892.paul@codesourcery.com> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Markus Armbruster On Thu, Feb 12, 2009 at 03:39:26PM +0000, Paul Brook wrote: > > This code parses full PCI device addresses. It then rejects domains > > other than zero, because these are not supported in QEMU. > >... > > + * Parse [[:]:], return -1 on error > > + */ > > +static int pci_parse_devaddr(const char *addr, int *domp, int *busp, > > unsigned *slotp) +{ > > If we're rejecting nonzero domains then having the parse routine return a > domain value seems wrong. It's just going to make it harder to verify correct > operation when domains are implemented. + /* Note: QEMU doesn't implement domains other than 0 */ + if (dom != 0 || pci_find_bus(bus) == NULL) { + fprintf(stderr, "PCI device address %s not supported", addr); + return -1; + } + if (!strcmp(devaddr, "auto")) { + *domp = *busp = 0; + *slotp = -1; + /* want to support dom/bus auto-assign at some point */ + return 0; + } We return domain 0. I considered domain 0 as implicit at the moment, is that wrong? I can't see where you're getting at.