qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@us.ibm.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] Define PCI vendor and device ID in pci.h
Date: Thu, 22 Jan 2009 11:02:55 -0600	[thread overview]
Message-ID: <4978A6BF.9030606@us.ibm.com> (raw)
In-Reply-To: <20090118132548.GA17854@miranda.arrow>

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 <stuart.brady@gmail.com>
>
> 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

  reply	other threads:[~2009-01-22 17:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-18 13:25 [Qemu-devel] [PATCH] Define PCI vendor and device ID in pci.h Stuart Brady
2009-01-22 17:02 ` Anthony Liguori [this message]
2009-01-24 15:57   ` Stuart Brady

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4978A6BF.9030606@us.ibm.com \
    --to=aliguori@us.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).