From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LQ2xX-0004GF-ML for qemu-devel@nongnu.org; Thu, 22 Jan 2009 12:03:15 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LQ2xV-0004Fg-Ub for qemu-devel@nongnu.org; Thu, 22 Jan 2009 12:03:15 -0500 Received: from [199.232.76.173] (port=37805 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LQ2xV-0004Fb-KL for qemu-devel@nongnu.org; Thu, 22 Jan 2009 12:03:13 -0500 Received: from e5.ny.us.ibm.com ([32.97.182.145]:39554) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LQ2xU-0004Sn-S9 for qemu-devel@nongnu.org; Thu, 22 Jan 2009 12:03:13 -0500 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e5.ny.us.ibm.com (8.13.1/8.13.1) with ESMTP id n0MH1Eea003428 for ; Thu, 22 Jan 2009 12:01:15 -0500 Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id n0MH37UW179486 for ; Thu, 22 Jan 2009 12:03:07 -0500 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n0MH37b1004306 for ; Thu, 22 Jan 2009 12:03:07 -0500 Received: from squirrel.codemonkey.ws (sig-9-65-90-232.mts.ibm.com [9.65.90.232]) by d01av03.pok.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id n0MH36cv004180 for ; Thu, 22 Jan 2009 12:03:07 -0500 Message-ID: <4978A6BF.9030606@us.ibm.com> Date: Thu, 22 Jan 2009 11:02:55 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] Define PCI vendor and device ID in pci.h References: <20090118132548.GA17854@miranda.arrow> In-Reply-To: <20090118132548.GA17854@miranda.arrow> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 Stuart Brady wrote: > This patch defines PPC vendor and device IDs in pci.h, and uses those > definitions where appropriate. > > Signed-off-by: Stuart Brady > > Index: hw/cirrus_vga.c > =================================================================== > --- hw/cirrus_vga.c (revision 6364) > +++ hw/cirrus_vga.c (working copy) > @@ -173,8 +173,7 @@ > #define CIRRUS_MMIO_LINEDRAW_MODE 0x39 // byte > #define CIRRUS_MMIO_BLTSTATUS 0x40 // byte > > -// PCI 0x00: vendor, 0x02: device > -#define PCI_VENDOR_CIRRUS 0x1013 > +// PCI 0x02: device > #define PCI_DEVICE_CLGD5462 0x00d0 > #define PCI_DEVICE_CLGD5465 0x00d6 > > @@ -3354,10 +3353,8 @@ > sizeof(PCICirrusVGAState), > -1, NULL, NULL); > pci_conf = d->dev.config; > - pci_conf[0x00] = (uint8_t) (PCI_VENDOR_CIRRUS & 0xff); > - pci_conf[0x01] = (uint8_t) (PCI_VENDOR_CIRRUS >> 8); > - pci_conf[0x02] = (uint8_t) (device_id & 0xff); > - pci_conf[0x03] = (uint8_t) (device_id >> 8); > + *(uint16_t *)&pci_conf[0x00] = cpu_to_le16(PCI_VENDOR_ID_CIRRUS); > + *(uint16_t *)&pci_conf[0x02] = cpu_to_le16(device_id); > pci_conf[0x04] = PCI_COMMAND_IOACCESS | PCI_COMMAND_MEMACCESS; > pci_conf[0x0a] = PCI_CLASS_SUB_VGA; > pci_conf[0x0b] = PCI_CLASS_BASE_DISPLAY; > Index: hw/usb-uhci.c > =================================================================== > --- hw/usb-uhci.c (revision 6364) > +++ hw/usb-uhci.c (working copy) > @@ -1080,10 +1080,8 @@ > "USB-UHCI", sizeof(UHCIState), > devfn, NULL, NULL); > pci_conf = s->dev.config; > - pci_conf[0x00] = 0x86; > - pci_conf[0x01] = 0x80; > - pci_conf[0x02] = 0x20; > - pci_conf[0x03] = 0x70; > + *(uint16_t *)&pci_conf[0x00] = cpu_to_le16(PCI_VENDOR_ID_INTEL); > + *(uint16_t *)&pci_conf[0x02] = cpu_to_le16(PCI_DEVICE_ID_INTEL_82371SB_2); > You should use cpu_to_le16uw here. Even better yet, you should introduce some PCI space accessors to remove all of the open coded offset access. You could start with just pci_config_set_vendor_id()/pci_config_set_device_id(). Regards, Anthony Liguori