All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code
@ 2011-05-25  1:57 Isaku Yamahata
  2011-05-25  1:57 ` [Qemu-devel] [PATCH v3 01/39] pci: move ids of config space into PCIDeviceInfo Isaku Yamahata
                   ` (39 more replies)
  0 siblings, 40 replies; 42+ messages in thread
From: Isaku Yamahata @ 2011-05-25  1:57 UTC (permalink / raw)
  To: qemu-devel; +Cc: yamahata, mst

Okay, here is the v3 as there seems no more comments on the series.

patch descriptions:
vender id/device id... in pci configuration space are read-only registers
which are commonly defined for all pci devices.
So initialize them in common code and it simplifies the initialization a bit.
Potentially in the future, qemu would be able to list supported devices
with device id and so on possibly with more updated description by linking
libpci.

 v2 -> v3:
- eliminated redandant comments
- converted virtio-pci

changes v1 -> v2:
- dropped header_type and prog_interface
- converted more

Isaku Yamahata (39):
  pci: move ids of config space into PCIDeviceInfo
  usb-uhci: convert to PCIDEviceInfo to initialize ids
  eepro100: convert to PCIDeviceInfo to initialize ids
  dec_pci: convert to PCIDeviceInfo to initialize ids
  apb_pci: convert to PCIDeviceInfo to initialize ids
  ide/piix: convert to PCIDeviceInfo to initialize ids
  vmware_vga.c: convert to PCIDeviceInfo to initialize ids
  hw/ac97.c: convert to PCIDeviceInfo to initialize ids
  hw/acpi_piix4.c: convert to PCIDeviceInfo to initialize ids
  hw/bonito.c: convert to PCIDeviceInfo to initialize ids
  hw/cirrus_vga.c: convert to PCIDeviceInfo to initialize ids
  hw/e1000.c: convert to PCIDeviceInfo to initialize ids
  hw/es1370.c: convert to PCIDeviceInfo to initialize ids
  hw/grackle_pci.c: convert to PCIDeviceInfo to initialize ids
  hw/gt64xxx.c: convert to PCIDeviceInfo to initialize ids
  hw/ide/cmd646.c: convert to PCIDeviceInfo to initialize ids
  hw/ide/ich.c: convert to PCIDeviceInfo to initialize ids
  hw/ide/via.c: convert to PCIDeviceInfo to initialize ids
  hw/intel-hda.c: convert to PCIDeviceInfo to initialize ids
  hw/ioh3420.c: convert to PCIDeviceInfo to initialize ids
  hw/ivshmem.c: convert to PCIDeviceInfo to initialize ids
  hw/lsi53c895a.c: convert to PCIDeviceInfo to initialize ids
  hw/ne2000.c: convert to PCIDeviceInfo to initialize ids
  hw/pcnet-pci.c: convert to PCIDeviceInfo to initialize ids
  hw/piix4.c: convert to PCIDeviceInfo to initialize ids
  hw/piix_pci.c: convert to PCIDeviceInfo to initialize ids
  hw/qxl.c: convert to PCIDeviceInfo to initialize ids
  hw/rtl8139.c: convert to PCIDeviceInfo to initialize ids
  hw/sh_pci.c: convert to PCIDeviceInfo to initialize ids
  hw/sun4u.c: convert to PCIDeviceInfo to initialize ids
  hw/unin_pci.c: convert to PCIDeviceInfo to initialize ids
  hw/usb-ohci.c: convert to PCIDeviceInfo to initialize ids
  hw/versatile_pci.c: convert to PCIDeviceInfo to initialize ids
  hw/vga-pci.c: convert to PCIDeviceInfo to initialize ids
  hw/vt82c686.c: convert to PCIDeviceInfo to initialize ids
  hw/wdt_i6300esb.c: convert to PCIDeviceInfo to initialize ids
  hw/xio3130_downstream.c: convert to PCIDeviceInfo to initialize ids
  hw/xio3130_upstream.c: convert to PCIDeviceInfo to initialize ids
  virtio-pci.c:  convert to PCIDEviceInfo to initialize ids

 hw/ac97.c               |    9 ++---
 hw/acpi_piix4.c         |    8 ++--
 hw/apb_pci.c            |   13 ++++----
 hw/bonito.c             |    9 +++--
 hw/cirrus_vga.c         |   10 +++---
 hw/dec_pci.c            |   26 ++++------------
 hw/e1000.c              |    8 ++--
 hw/eepro100.c           |   74 +++++++++++++++++++++--------------------------
 hw/es1370.c             |   24 +++++++--------
 hw/grackle_pci.c        |    8 ++--
 hw/gt64xxx.c            |    8 ++--
 hw/ide/cmd646.c         |   10 ++----
 hw/ide/ich.c            |    9 ++---
 hw/ide/piix.c           |   32 ++++++--------------
 hw/ide/via.c            |    8 ++--
 hw/intel-hda.c          |    8 ++--
 hw/ioh3420.c            |    7 ++--
 hw/ivshmem.c            |    8 ++---
 hw/lsi53c895a.c         |   13 ++------
 hw/ne2000.c             |    6 ++--
 hw/pci.c                |   46 ++++++++++++++++++++---------
 hw/pci.h                |    7 ++++
 hw/pcnet-pci.c          |    8 ++--
 hw/piix4.c              |   10 ++----
 hw/piix_pci.c           |   19 ++++-------
 hw/qxl.c                |    7 ++--
 hw/rtl8139.c            |    8 ++--
 hw/sh_pci.c             |    4 +-
 hw/sun4u.c              |    8 ++--
 hw/unin_pci.c           |   33 ++++++++++-----------
 hw/usb-ohci.c           |    7 ++--
 hw/usb-uhci.c           |   46 +++++++++++------------------
 hw/versatile_pci.c      |    8 ++--
 hw/vga-pci.c            |   11 +++----
 hw/virtio-pci.c         |   69 +++++++++++++++++++------------------------
 hw/vmware_vga.c         |   13 ++++----
 hw/vt82c686.c           |   35 ++++++++++------------
 hw/wdt_i6300esb.c       |    6 ++--
 hw/xio3130_downstream.c |    6 ++--
 hw/xio3130_upstream.c   |    6 ++--
 40 files changed, 300 insertions(+), 355 deletions(-)

^ permalink raw reply	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH v3 01/39] pci: move ids of config space into PCIDeviceInfo
  2011-05-25  1:57 [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
@ 2011-05-25  1:57 ` Isaku Yamahata
  2011-05-25  1:57 ` [Qemu-devel] [PATCH v3 02/39] usb-uhci: convert to PCIDEviceInfo to initialize ids Isaku Yamahata
                   ` (38 subsequent siblings)
  39 siblings, 0 replies; 42+ messages in thread
From: Isaku Yamahata @ 2011-05-25  1:57 UTC (permalink / raw)
  To: qemu-devel; +Cc: yamahata, mst

vender id/device id... in configuration space are read-only registers
which are commonly defined for all pci devices.
So move those initialization into common place.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>

---
changes v1 -> v2:
- dropped prog_interface, header_type
- added assert() for header type = 1
---
 hw/pci.c |   46 ++++++++++++++++++++++++++++++++--------------
 hw/pci.h |    7 +++++++
 2 files changed, 39 insertions(+), 14 deletions(-)

diff --git a/hw/pci.c b/hw/pci.c
index 0875654..0e97a02 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -726,10 +726,11 @@ static void pci_config_free(PCIDevice *pci_dev)
 /* -1 for devfn means auto assign */
 static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
                                          const char *name, int devfn,
-                                         PCIConfigReadFunc *config_read,
-                                         PCIConfigWriteFunc *config_write,
-                                         bool is_bridge)
+                                         const PCIDeviceInfo *info)
 {
+    PCIConfigReadFunc *config_read = info->config_read;
+    PCIConfigWriteFunc *config_write = info->config_write;
+
     if (devfn < 0) {
         for(devfn = bus->devfn_min ; devfn < ARRAY_SIZE(bus->devices);
             devfn += PCI_FUNC_MAX) {
@@ -750,13 +751,29 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
     pci_dev->irq_state = 0;
     pci_config_alloc(pci_dev);
 
-    if (!is_bridge) {
-        pci_set_default_subsystem_id(pci_dev);
+    pci_config_set_vendor_id(pci_dev->config, info->vendor_id);
+    pci_config_set_device_id(pci_dev->config, info->device_id);
+    pci_config_set_revision(pci_dev->config, info->revision);
+    pci_config_set_class(pci_dev->config, info->class_id);
+
+    if (!info->is_bridge) {
+        if (info->subsystem_vendor_id || info->subsystem_id) {
+            pci_set_word(pci_dev->config + PCI_SUBSYSTEM_VENDOR_ID,
+                         info->subsystem_vendor_id);
+            pci_set_word(pci_dev->config + PCI_SUBSYSTEM_ID,
+                         info->subsystem_id);
+        } else {
+            pci_set_default_subsystem_id(pci_dev);
+        }
+    } else {
+        /* subsystem_vendor_id/subsystem_id are only for header type 0 */
+        assert(!info->subsystem_vendor_id);
+        assert(!info->subsystem_id);
     }
     pci_init_cmask(pci_dev);
     pci_init_wmask(pci_dev);
     pci_init_w1cmask(pci_dev);
-    if (is_bridge) {
+    if (info->is_bridge) {
         pci_init_wmask_bridge(pci_dev);
     }
     if (pci_init_multifunction(bus, pci_dev)) {
@@ -783,17 +800,20 @@ static void do_pci_unregister_device(PCIDevice *pci_dev)
     pci_config_free(pci_dev);
 }
 
+/* TODO: obsolete. eliminate this once all pci devices are qdevifed. */
 PCIDevice *pci_register_device(PCIBus *bus, const char *name,
                                int instance_size, int devfn,
                                PCIConfigReadFunc *config_read,
                                PCIConfigWriteFunc *config_write)
 {
     PCIDevice *pci_dev;
+    PCIDeviceInfo info = {
+        .config_read = config_read,
+        .config_write = config_write,
+    };
 
     pci_dev = qemu_mallocz(instance_size);
-    pci_dev = do_pci_register_device(pci_dev, bus, name, devfn,
-                                     config_read, config_write,
-                                     PCI_HEADER_TYPE_NORMAL);
+    pci_dev = do_pci_register_device(pci_dev, bus, name, devfn, &info);
     if (pci_dev == NULL) {
         hw_error("PCI: can't register device\n");
     }
@@ -1643,7 +1663,7 @@ static int pci_qdev_init(DeviceState *qdev, DeviceInfo *base)
     PCIDevice *pci_dev = (PCIDevice *)qdev;
     PCIDeviceInfo *info = container_of(base, PCIDeviceInfo, qdev);
     PCIBus *bus;
-    int devfn, rc;
+    int rc;
     bool is_default_rom;
 
     /* initialize cap_present for pci_is_express() and pci_config_size() */
@@ -1652,10 +1672,8 @@ static int pci_qdev_init(DeviceState *qdev, DeviceInfo *base)
     }
 
     bus = FROM_QBUS(PCIBus, qdev_get_parent_bus(qdev));
-    devfn = pci_dev->devfn;
-    pci_dev = do_pci_register_device(pci_dev, bus, base->name, devfn,
-                                     info->config_read, info->config_write,
-                                     info->is_bridge);
+    pci_dev = do_pci_register_device(pci_dev, bus, base->name,
+                                     pci_dev->devfn, info);
     if (pci_dev == NULL)
         return -1;
     if (qdev->hotplugged && info->no_hotplug) {
diff --git a/hw/pci.h b/hw/pci.h
index c6a6eb6..ce214f4 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -433,6 +433,13 @@ typedef struct {
     PCIConfigReadFunc *config_read;
     PCIConfigWriteFunc *config_write;
 
+    uint16_t vendor_id;
+    uint16_t device_id;
+    uint8_t revision;
+    uint16_t class_id;
+    uint16_t subsystem_vendor_id;       /* only for header type = 0 */
+    uint16_t subsystem_id;              /* only for header type = 0 */
+
     /*
      * pci-to-pci bridge or normal device.
      * This doesn't mean pci host switch.
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH v3 02/39] usb-uhci: convert to PCIDEviceInfo to initialize ids
  2011-05-25  1:57 [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
  2011-05-25  1:57 ` [Qemu-devel] [PATCH v3 01/39] pci: move ids of config space into PCIDeviceInfo Isaku Yamahata
@ 2011-05-25  1:57 ` Isaku Yamahata
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 03/39] eepro100: convert to PCIDeviceInfo " Isaku Yamahata
                   ` (37 subsequent siblings)
  39 siblings, 0 replies; 42+ messages in thread
From: Isaku Yamahata @ 2011-05-25  1:57 UTC (permalink / raw)
  To: qemu-devel; +Cc: yamahata, mst

use PCIDeviceInfo to initialize ids.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/usb-uhci.c |   46 +++++++++++++++++-----------------------------
 1 files changed, 17 insertions(+), 29 deletions(-)

diff --git a/hw/usb-uhci.c b/hw/usb-uhci.c
index 346db3e..536c24c 100644
--- a/hw/usb-uhci.c
+++ b/hw/usb-uhci.c
@@ -1115,14 +1115,13 @@ static USBPortOps uhci_port_ops = {
     .wakeup = uhci_wakeup,
 };
 
-static int usb_uhci_common_initfn(UHCIState *s)
+static int usb_uhci_common_initfn(PCIDevice *dev)
 {
+    UHCIState *s = DO_UPCAST(UHCIState, dev, dev);
     uint8_t *pci_conf = s->dev.config;
     int i;
 
-    pci_conf[PCI_REVISION_ID] = 0x01; // revision number
     pci_conf[PCI_CLASS_PROG] = 0x00;
-    pci_config_set_class(pci_conf, PCI_CLASS_SERIAL_USB);
     /* TODO: reset value should be 0. */
     pci_conf[PCI_INTERRUPT_PIN] = 4; // interrupt pin 3
     pci_conf[0x60] = 0x10; // release number
@@ -1148,34 +1147,11 @@ static int usb_uhci_common_initfn(UHCIState *s)
     return 0;
 }
 
-static int usb_uhci_piix3_initfn(PCIDevice *dev)
-{
-    UHCIState *s = DO_UPCAST(UHCIState, dev, dev);
-    uint8_t *pci_conf = s->dev.config;
-
-    pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL);
-    pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_82371SB_2);
-    return usb_uhci_common_initfn(s);
-}
-
-static int usb_uhci_piix4_initfn(PCIDevice *dev)
-{
-    UHCIState *s = DO_UPCAST(UHCIState, dev, dev);
-    uint8_t *pci_conf = s->dev.config;
-
-    pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL);
-    pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_82371AB_2);
-    return usb_uhci_common_initfn(s);
-}
-
 static int usb_uhci_vt82c686b_initfn(PCIDevice *dev)
 {
     UHCIState *s = DO_UPCAST(UHCIState, dev, dev);
     uint8_t *pci_conf = s->dev.config;
 
-    pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_VIA);
-    pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_VIA_UHCI);
-
     /* USB misc control 1/2 */
     pci_set_long(pci_conf + 0x40,0x00001000);
     /* PM capability */
@@ -1183,7 +1159,7 @@ static int usb_uhci_vt82c686b_initfn(PCIDevice *dev)
     /* USB legacy support  */
     pci_set_long(pci_conf + 0xc0,0x00002000);
 
-    return usb_uhci_common_initfn(s);
+    return usb_uhci_common_initfn(dev);
 }
 
 static PCIDeviceInfo uhci_info[] = {
@@ -1191,17 +1167,29 @@ static PCIDeviceInfo uhci_info[] = {
         .qdev.name    = "piix3-usb-uhci",
         .qdev.size    = sizeof(UHCIState),
         .qdev.vmsd    = &vmstate_uhci,
-        .init         = usb_uhci_piix3_initfn,
+        .init         = usb_uhci_common_initfn,
+        .vendor_id    = PCI_VENDOR_ID_INTEL,
+        .device_id    = PCI_DEVICE_ID_INTEL_82371SB_2,
+        .revision     = 0x01,
+        .class_id     = PCI_CLASS_SERIAL_USB,
     },{
         .qdev.name    = "piix4-usb-uhci",
         .qdev.size    = sizeof(UHCIState),
         .qdev.vmsd    = &vmstate_uhci,
-        .init         = usb_uhci_piix4_initfn,
+        .init         = usb_uhci_common_initfn,
+        .vendor_id    = PCI_VENDOR_ID_INTEL,
+        .device_id    = PCI_DEVICE_ID_INTEL_82371AB_2,
+        .revision     = 0x01,
+        .class_id     = PCI_CLASS_SERIAL_USB,
     },{
         .qdev.name    = "vt82c686b-usb-uhci",
         .qdev.size    = sizeof(UHCIState),
         .qdev.vmsd    = &vmstate_uhci,
         .init         = usb_uhci_vt82c686b_initfn,
+        .vendor_id    = PCI_VENDOR_ID_VIA,
+        .device_id    = PCI_DEVICE_ID_VIA_UHCI,
+        .revision     = 0x01,
+        .class_id     = PCI_CLASS_SERIAL_USB,
     },{
         /* end of list */
     }
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH v3 03/39] eepro100: convert to PCIDeviceInfo to initialize ids
  2011-05-25  1:57 [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
  2011-05-25  1:57 ` [Qemu-devel] [PATCH v3 01/39] pci: move ids of config space into PCIDeviceInfo Isaku Yamahata
  2011-05-25  1:57 ` [Qemu-devel] [PATCH v3 02/39] usb-uhci: convert to PCIDEviceInfo to initialize ids Isaku Yamahata
@ 2011-05-25  1:58 ` Isaku Yamahata
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 04/39] dec_pci: " Isaku Yamahata
                   ` (36 subsequent siblings)
  39 siblings, 0 replies; 42+ messages in thread
From: Isaku Yamahata @ 2011-05-25  1:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: yamahata, mst

use PCIDeviceInfo to initialize ids.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/eepro100.c |   74 +++++++++++++++++++++++++-------------------------------
 1 files changed, 33 insertions(+), 41 deletions(-)

diff --git a/hw/eepro100.c b/hw/eepro100.c
index 05450e8..84b98c0 100644
--- a/hw/eepro100.c
+++ b/hw/eepro100.c
@@ -129,8 +129,6 @@
 typedef struct {
     PCIDeviceInfo pci;
     uint32_t device;
-    uint16_t device_id;
-    uint8_t revision;
     uint8_t stats_size;
     bool has_extended_tcb_support;
     bool power_management;
@@ -526,16 +524,9 @@ static void e100_pci_reset(EEPRO100State * s, E100PCIDeviceInfo *e100_device)
 
     TRACE(OTHER, logout("%p\n", s));
 
-    /* PCI Vendor ID */
-    pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL);
-    /* PCI Device ID */
-    pci_config_set_device_id(pci_conf, e100_device->device_id);
     /* PCI Status */
     pci_set_word(pci_conf + PCI_STATUS, PCI_STATUS_DEVSEL_MEDIUM |
                                         PCI_STATUS_FAST_BACK);
-    /* PCI Revision ID */
-    pci_config_set_revision(pci_conf, e100_device->revision);
-    pci_config_set_class(pci_conf, PCI_CLASS_NETWORK_ETHERNET);
     /* PCI Latency Timer */
     pci_set_byte(pci_conf + PCI_LATENCY_TIMER, 0x20);   /* latency timer = 32 clocks */
     /* Capability Pointer is set by PCI framework. */
@@ -563,12 +554,7 @@ static void e100_pci_reset(EEPRO100State * s, E100PCIDeviceInfo *e100_device)
     case i82559ER:
     case i82562:
     case i82801:
-        break;
     case i82559C:
-#if EEPROM_SIZE > 0
-        pci_set_word(pci_conf + PCI_SUBSYSTEM_VENDOR_ID, PCI_VENDOR_ID_INTEL);
-        pci_set_word(pci_conf + PCI_SUBSYSTEM_ID, 0x0040);
-#endif
         break;
     default:
         logout("Device %X is undefined!\n", device);
@@ -2040,9 +2026,9 @@ static E100PCIDeviceInfo e100_devices[] = {
         .pci.qdev.desc = "Intel i82550 Ethernet",
         .device = i82550,
         /* TODO: check device id. */
-        .device_id = PCI_DEVICE_ID_INTEL_82551IT,
+        .pci.device_id = PCI_DEVICE_ID_INTEL_82551IT,
         /* Revision ID: 0x0c, 0x0d, 0x0e. */
-        .revision = 0x0e,
+        .pci.revision = 0x0e,
         /* TODO: check size of statistical counters. */
         .stats_size = 80,
         /* TODO: check extended tcb support. */
@@ -2052,9 +2038,9 @@ static E100PCIDeviceInfo e100_devices[] = {
         .pci.qdev.name = "i82551",
         .pci.qdev.desc = "Intel i82551 Ethernet",
         .device = i82551,
-        .device_id = PCI_DEVICE_ID_INTEL_82551IT,
+        .pci.device_id = PCI_DEVICE_ID_INTEL_82551IT,
         /* Revision ID: 0x0f, 0x10. */
-        .revision = 0x0f,
+        .pci.revision = 0x0f,
         /* TODO: check size of statistical counters. */
         .stats_size = 80,
         .has_extended_tcb_support = true,
@@ -2063,29 +2049,29 @@ static E100PCIDeviceInfo e100_devices[] = {
         .pci.qdev.name = "i82557a",
         .pci.qdev.desc = "Intel i82557A Ethernet",
         .device = i82557A,
-        .device_id = PCI_DEVICE_ID_INTEL_82557,
-        .revision = 0x01,
+        .pci.device_id = PCI_DEVICE_ID_INTEL_82557,
+        .pci.revision = 0x01,
         .power_management = false,
     },{
         .pci.qdev.name = "i82557b",
         .pci.qdev.desc = "Intel i82557B Ethernet",
         .device = i82557B,
-        .device_id = PCI_DEVICE_ID_INTEL_82557,
-        .revision = 0x02,
+        .pci.device_id = PCI_DEVICE_ID_INTEL_82557,
+        .pci.revision = 0x02,
         .power_management = false,
     },{
         .pci.qdev.name = "i82557c",
         .pci.qdev.desc = "Intel i82557C Ethernet",
         .device = i82557C,
-        .device_id = PCI_DEVICE_ID_INTEL_82557,
-        .revision = 0x03,
+        .pci.device_id = PCI_DEVICE_ID_INTEL_82557,
+        .pci.revision = 0x03,
         .power_management = false,
     },{
         .pci.qdev.name = "i82558a",
         .pci.qdev.desc = "Intel i82558A Ethernet",
         .device = i82558A,
-        .device_id = PCI_DEVICE_ID_INTEL_82557,
-        .revision = 0x04,
+        .pci.device_id = PCI_DEVICE_ID_INTEL_82557,
+        .pci.revision = 0x04,
         .stats_size = 76,
         .has_extended_tcb_support = true,
         .power_management = true,
@@ -2093,8 +2079,8 @@ static E100PCIDeviceInfo e100_devices[] = {
         .pci.qdev.name = "i82558b",
         .pci.qdev.desc = "Intel i82558B Ethernet",
         .device = i82558B,
-        .device_id = PCI_DEVICE_ID_INTEL_82557,
-        .revision = 0x05,
+        .pci.device_id = PCI_DEVICE_ID_INTEL_82557,
+        .pci.revision = 0x05,
         .stats_size = 76,
         .has_extended_tcb_support = true,
         .power_management = true,
@@ -2102,8 +2088,8 @@ static E100PCIDeviceInfo e100_devices[] = {
         .pci.qdev.name = "i82559a",
         .pci.qdev.desc = "Intel i82559A Ethernet",
         .device = i82559A,
-        .device_id = PCI_DEVICE_ID_INTEL_82557,
-        .revision = 0x06,
+        .pci.device_id = PCI_DEVICE_ID_INTEL_82557,
+        .pci.revision = 0x06,
         .stats_size = 80,
         .has_extended_tcb_support = true,
         .power_management = true,
@@ -2111,8 +2097,8 @@ static E100PCIDeviceInfo e100_devices[] = {
         .pci.qdev.name = "i82559b",
         .pci.qdev.desc = "Intel i82559B Ethernet",
         .device = i82559B,
-        .device_id = PCI_DEVICE_ID_INTEL_82557,
-        .revision = 0x07,
+        .pci.device_id = PCI_DEVICE_ID_INTEL_82557,
+        .pci.revision = 0x07,
         .stats_size = 80,
         .has_extended_tcb_support = true,
         .power_management = true,
@@ -2120,12 +2106,16 @@ static E100PCIDeviceInfo e100_devices[] = {
         .pci.qdev.name = "i82559c",
         .pci.qdev.desc = "Intel i82559C Ethernet",
         .device = i82559C,
-        .device_id = PCI_DEVICE_ID_INTEL_82557,
+        .pci.device_id = PCI_DEVICE_ID_INTEL_82557,
 #if 0
-        .revision = 0x08,
+        .pci.revision = 0x08,
 #endif
         /* TODO: Windows wants revision id 0x0c. */
-        .revision = 0x0c,
+        .pci.revision = 0x0c,
+#if EEPROM_SIZE > 0
+        .pci.subsystem_vendor_id = PCI_VENDOR_ID_INTEL,
+        .pci.subsystem_id = 0x0040,
+#endif
         .stats_size = 80,
         .has_extended_tcb_support = true,
         .power_management = true,
@@ -2133,8 +2123,8 @@ static E100PCIDeviceInfo e100_devices[] = {
         .pci.qdev.name = "i82559er",
         .pci.qdev.desc = "Intel i82559ER Ethernet",
         .device = i82559ER,
-        .device_id = PCI_DEVICE_ID_INTEL_82551IT,
-        .revision = 0x09,
+        .pci.device_id = PCI_DEVICE_ID_INTEL_82551IT,
+        .pci.revision = 0x09,
         .stats_size = 80,
         .has_extended_tcb_support = true,
         .power_management = true,
@@ -2143,9 +2133,9 @@ static E100PCIDeviceInfo e100_devices[] = {
         .pci.qdev.desc = "Intel i82562 Ethernet",
         .device = i82562,
         /* TODO: check device id. */
-        .device_id = PCI_DEVICE_ID_INTEL_82551IT,
+        .pci.device_id = PCI_DEVICE_ID_INTEL_82551IT,
         /* TODO: wrong revision id. */
-        .revision = 0x0e,
+        .pci.revision = 0x0e,
         .stats_size = 80,
         .has_extended_tcb_support = true,
         .power_management = true,
@@ -2154,8 +2144,8 @@ static E100PCIDeviceInfo e100_devices[] = {
         .pci.qdev.name = "i82801",
         .pci.qdev.desc = "Intel i82801 Ethernet",
         .device = i82801,
-        .device_id = 0x2449,
-        .revision = 0x03,
+        .pci.device_id = 0x2449,
+        .pci.revision = 0x03,
         .stats_size = 80,
         .has_extended_tcb_support = true,
         .power_management = true,
@@ -2174,6 +2164,8 @@ static void eepro100_register_devices(void)
         PCIDeviceInfo *pci_dev = &e100_devices[i].pci;
         /* We use the same rom file for all device ids.
            QEMU fixes the device id during rom load. */
+        pci_dev->vendor_id = PCI_VENDOR_ID_INTEL;
+        pci_dev->class_id = PCI_CLASS_NETWORK_ETHERNET;
         pci_dev->romfile = "pxe-eepro100.rom";
         pci_dev->init = e100_nic_init;
         pci_dev->exit = pci_nic_uninit;
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH v3 04/39] dec_pci: convert to PCIDeviceInfo to initialize ids
  2011-05-25  1:57 [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
                   ` (2 preceding siblings ...)
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 03/39] eepro100: convert to PCIDeviceInfo " Isaku Yamahata
@ 2011-05-25  1:58 ` Isaku Yamahata
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 05/39] apb_pci: " Isaku Yamahata
                   ` (35 subsequent siblings)
  39 siblings, 0 replies; 42+ messages in thread
From: Isaku Yamahata @ 2011-05-25  1:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: yamahata, mst

use PCIDeviceInfo to initialize ids.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/dec_pci.c |   26 +++++++-------------------
 1 files changed, 7 insertions(+), 19 deletions(-)

diff --git a/hw/dec_pci.c b/hw/dec_pci.c
index bf88f2a..a35f382 100644
--- a/hw/dec_pci.c
+++ b/hw/dec_pci.c
@@ -50,28 +50,16 @@ static int dec_map_irq(PCIDevice *pci_dev, int irq_num)
     return irq_num;
 }
 
-static int dec_21154_initfn(PCIDevice *dev)
-{
-    int rc;
-
-    rc = pci_bridge_initfn(dev);
-    if (rc < 0) {
-        return rc;
-    }
-
-    pci_config_set_vendor_id(dev->config, PCI_VENDOR_ID_DEC);
-    pci_config_set_device_id(dev->config, PCI_DEVICE_ID_DEC_21154);
-    return 0;
-}
-
 static PCIDeviceInfo dec_21154_pci_bridge_info = {
     .qdev.name = "dec-21154-p2p-bridge",
     .qdev.desc = "DEC 21154 PCI-PCI bridge",
     .qdev.size = sizeof(PCIBridge),
     .qdev.vmsd = &vmstate_pci_device,
     .qdev.reset = pci_bridge_reset,
-    .init = dec_21154_initfn,
+    .init = pci_bridge_initfn,
     .exit = pci_bridge_exitfn,
+    .vendor_id = PCI_VENDOR_ID_DEC,
+    .device_id = PCI_DEVICE_ID_DEC_21154,
     .config_write = pci_bridge_write_config,
     .is_bridge = 1,
 };
@@ -108,10 +96,6 @@ static int pci_dec_21154_init_device(SysBusDevice *dev)
 static int dec_21154_pci_host_init(PCIDevice *d)
 {
     /* PCI2PCI bridge same values as PearPC - check this */
-    pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_DEC);
-    pci_config_set_device_id(d->config, PCI_DEVICE_ID_DEC_21154);
-    pci_set_byte(d->config + PCI_REVISION_ID, 0x02);
-    pci_config_set_class(d->config, PCI_CLASS_BRIDGE_PCI);
     return 0;
 }
 
@@ -119,6 +103,10 @@ static PCIDeviceInfo dec_21154_pci_host_info = {
     .qdev.name = "dec-21154",
     .qdev.size = sizeof(PCIDevice),
     .init      = dec_21154_pci_host_init,
+    .vendor_id = PCI_VENDOR_ID_DEC,
+    .device_id = PCI_DEVICE_ID_DEC_21154,
+    .revision = 0x02,
+    .class_id = PCI_CLASS_BRIDGE_PCI,
     .is_bridge  = 1,
 };
 
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH v3 05/39] apb_pci: convert to PCIDeviceInfo to initialize ids
  2011-05-25  1:57 [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
                   ` (3 preceding siblings ...)
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 04/39] dec_pci: " Isaku Yamahata
@ 2011-05-25  1:58 ` Isaku Yamahata
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 06/39] ide/piix: " Isaku Yamahata
                   ` (34 subsequent siblings)
  39 siblings, 0 replies; 42+ messages in thread
From: Isaku Yamahata @ 2011-05-25  1:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: yamahata, mst

Use PCIDeviceInfo to initialize ids.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/apb_pci.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/hw/apb_pci.c b/hw/apb_pci.c
index 84e9af7..974c87a 100644
--- a/hw/apb_pci.c
+++ b/hw/apb_pci.c
@@ -304,9 +304,6 @@ static int apb_pci_bridge_initfn(PCIDevice *dev)
         return rc;
     }
 
-    pci_config_set_vendor_id(dev->config, PCI_VENDOR_ID_SUN);
-    pci_config_set_device_id(dev->config, PCI_DEVICE_ID_SUN_SIMBA);
-
     /*
      * command register:
      * According to PCI bridge spec, after reset
@@ -321,7 +318,6 @@ static int apb_pci_bridge_initfn(PCIDevice *dev)
     pci_set_word(dev->config + PCI_STATUS,
                  PCI_STATUS_FAST_BACK | PCI_STATUS_66MHZ |
                  PCI_STATUS_DEVSEL_MEDIUM);
-    pci_set_byte(dev->config + PCI_REVISION_ID, 0x11);
     return 0;
 }
 
@@ -436,14 +432,11 @@ static int pci_pbm_init_device(SysBusDevice *dev)
 
 static int pbm_pci_host_init(PCIDevice *d)
 {
-    pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_SUN);
-    pci_config_set_device_id(d->config, PCI_DEVICE_ID_SUN_SABRE);
     pci_set_word(d->config + PCI_COMMAND,
                  PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER);
     pci_set_word(d->config + PCI_STATUS,
                  PCI_STATUS_FAST_BACK | PCI_STATUS_66MHZ |
                  PCI_STATUS_DEVSEL_MEDIUM);
-    pci_config_set_class(d->config, PCI_CLASS_BRIDGE_HOST);
     return 0;
 }
 
@@ -451,6 +444,9 @@ static PCIDeviceInfo pbm_pci_host_info = {
     .qdev.name = "pbm",
     .qdev.size = sizeof(PCIDevice),
     .init      = pbm_pci_host_init,
+    .vendor_id = PCI_VENDOR_ID_SUN,
+    .device_id = PCI_DEVICE_ID_SUN_SABRE,
+    .class_id  = PCI_CLASS_BRIDGE_HOST,
     .is_bridge = 1,
 };
 
@@ -468,6 +464,9 @@ static PCIDeviceInfo pbm_pci_bridge_info = {
     .qdev.reset = pci_bridge_reset,
     .init = apb_pci_bridge_initfn,
     .exit = pci_bridge_exitfn,
+    .vendor_id = PCI_VENDOR_ID_SUN,
+    .device_id = PCI_DEVICE_ID_SUN_SIMBA,
+    .revision = 0x11,
     .config_write = pci_bridge_write_config,
     .is_bridge = 1,
 };
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH v3 06/39] ide/piix: convert to PCIDeviceInfo to initialize ids
  2011-05-25  1:57 [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
                   ` (4 preceding siblings ...)
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 05/39] apb_pci: " Isaku Yamahata
@ 2011-05-25  1:58 ` Isaku Yamahata
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 07/39] vmware_vga.c: " Isaku Yamahata
                   ` (33 subsequent siblings)
  39 siblings, 0 replies; 42+ messages in thread
From: Isaku Yamahata @ 2011-05-25  1:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: yamahata, mst

use PCIDeviceInfo to initialize ids.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/ide/piix.c |   32 ++++++++++----------------------
 1 files changed, 10 insertions(+), 22 deletions(-)

diff --git a/hw/ide/piix.c b/hw/ide/piix.c
index c349644..84f72b0 100644
--- a/hw/ide/piix.c
+++ b/hw/ide/piix.c
@@ -131,12 +131,12 @@ static void pci_piix_init_ports(PCIIDEState *d) {
     }
 }
 
-static int pci_piix_ide_initfn(PCIIDEState *d)
+static int pci_piix_ide_initfn(PCIDevice *dev)
 {
+    PCIIDEState *d = DO_UPCAST(PCIIDEState, dev, dev);
     uint8_t *pci_conf = d->dev.config;
 
     pci_conf[PCI_CLASS_PROG] = 0x80; // legacy ATA mode
-    pci_config_set_class(pci_conf, PCI_CLASS_STORAGE_IDE);
 
     qemu_register_reset(piix3_reset, d);
 
@@ -149,24 +149,6 @@ static int pci_piix_ide_initfn(PCIIDEState *d)
     return 0;
 }
 
-static int pci_piix3_ide_initfn(PCIDevice *dev)
-{
-    PCIIDEState *d = DO_UPCAST(PCIIDEState, dev, dev);
-
-    pci_config_set_vendor_id(d->dev.config, PCI_VENDOR_ID_INTEL);
-    pci_config_set_device_id(d->dev.config, PCI_DEVICE_ID_INTEL_82371SB_1);
-    return pci_piix_ide_initfn(d);
-}
-
-static int pci_piix4_ide_initfn(PCIDevice *dev)
-{
-    PCIIDEState *d = DO_UPCAST(PCIIDEState, dev, dev);
-
-    pci_config_set_vendor_id(d->dev.config, PCI_VENDOR_ID_INTEL);
-    pci_config_set_device_id(d->dev.config, PCI_DEVICE_ID_INTEL_82371AB);
-    return pci_piix_ide_initfn(d);
-}
-
 /* hd_table must contain 4 block drivers */
 /* NOTE: for the PIIX3, the IRQs and IOports are hardcoded */
 PCIDevice *pci_piix3_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn)
@@ -195,13 +177,19 @@ static PCIDeviceInfo piix_ide_info[] = {
         .qdev.size    = sizeof(PCIIDEState),
         .qdev.no_user = 1,
         .no_hotplug   = 1,
-        .init         = pci_piix3_ide_initfn,
+        .init         = pci_piix_ide_initfn,
+        .vendor_id    = PCI_VENDOR_ID_INTEL,
+        .device_id    = PCI_DEVICE_ID_INTEL_82371SB_1,
+        .class_id     = PCI_CLASS_STORAGE_IDE,
     },{
         .qdev.name    = "piix4-ide",
         .qdev.size    = sizeof(PCIIDEState),
         .qdev.no_user = 1,
         .no_hotplug   = 1,
-        .init         = pci_piix4_ide_initfn,
+        .init         = pci_piix_ide_initfn,
+        .vendor_id    = PCI_VENDOR_ID_INTEL,
+        .device_id    = PCI_DEVICE_ID_INTEL_82371AB,
+        .class_id     = PCI_CLASS_STORAGE_IDE,
     },{
         /* end of list */
     }
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH v3 07/39] vmware_vga.c: convert to PCIDeviceInfo to initialize ids
  2011-05-25  1:57 [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
                   ` (5 preceding siblings ...)
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 06/39] ide/piix: " Isaku Yamahata
@ 2011-05-25  1:58 ` Isaku Yamahata
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 08/39] hw/ac97.c: " Isaku Yamahata
                   ` (32 subsequent siblings)
  39 siblings, 0 replies; 42+ messages in thread
From: Isaku Yamahata @ 2011-05-25  1:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: yamahata, mst

use PCIDeviceInfo to initialize ids.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/vmware_vga.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/hw/vmware_vga.c b/hw/vmware_vga.c
index 4656767..354c221 100644
--- a/hw/vmware_vga.c
+++ b/hw/vmware_vga.c
@@ -1280,15 +1280,8 @@ static int pci_vmsvga_initfn(PCIDevice *dev)
     struct pci_vmsvga_state_s *s =
         DO_UPCAST(struct pci_vmsvga_state_s, card, dev);
 
-    pci_config_set_vendor_id(s->card.config, PCI_VENDOR_ID_VMWARE);
-    pci_config_set_device_id(s->card.config, SVGA_PCI_DEVICE_ID);
-    pci_config_set_class(s->card.config, PCI_CLASS_DISPLAY_VGA);
     s->card.config[PCI_CACHE_LINE_SIZE]	= 0x08;		/* Cache line size */
     s->card.config[PCI_LATENCY_TIMER] = 0x40;		/* Latency timer */
-    s->card.config[PCI_SUBSYSTEM_VENDOR_ID] = PCI_VENDOR_ID_VMWARE & 0xff;
-    s->card.config[PCI_SUBSYSTEM_VENDOR_ID + 1]	= PCI_VENDOR_ID_VMWARE >> 8;
-    s->card.config[PCI_SUBSYSTEM_ID] = SVGA_PCI_DEVICE_ID & 0xff;
-    s->card.config[PCI_SUBSYSTEM_ID + 1] = SVGA_PCI_DEVICE_ID >> 8;
     s->card.config[PCI_INTERRUPT_LINE] = 0xff;		/* End */
 
     pci_register_bar(&s->card, 0, 0x10,
@@ -1316,6 +1309,12 @@ static PCIDeviceInfo vmsvga_info = {
     .no_hotplug   = 1,
     .init         = pci_vmsvga_initfn,
     .romfile      = "vgabios-vmware.bin",
+
+    .vendor_id    =  PCI_VENDOR_ID_VMWARE,
+    .device_id    = SVGA_PCI_DEVICE_ID,
+    .class_id     = PCI_CLASS_DISPLAY_VGA,
+    .subsystem_vendor_id = PCI_VENDOR_ID_VMWARE,
+    .subsystem_id = SVGA_PCI_DEVICE_ID,
 };
 
 static void vmsvga_register(void)
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH v3 08/39] hw/ac97.c: convert to PCIDeviceInfo to initialize ids
  2011-05-25  1:57 [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
                   ` (6 preceding siblings ...)
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 07/39] vmware_vga.c: " Isaku Yamahata
@ 2011-05-25  1:58 ` Isaku Yamahata
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 09/39] hw/acpi_piix4.c: " Isaku Yamahata
                   ` (31 subsequent siblings)
  39 siblings, 0 replies; 42+ messages in thread
From: Isaku Yamahata @ 2011-05-25  1:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: yamahata, mst

use PCIDeviceInfo to initialize ids.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/ac97.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/hw/ac97.c b/hw/ac97.c
index d71072d..c26a86d 100644
--- a/hw/ac97.c
+++ b/hw/ac97.c
@@ -1281,9 +1281,6 @@ static int ac97_initfn (PCIDevice *dev)
     AC97LinkState *s = DO_UPCAST (AC97LinkState, dev, dev);
     uint8_t *c = s->dev.config;
 
-    pci_config_set_vendor_id (c, PCI_VENDOR_ID_INTEL); /* ro */
-    pci_config_set_device_id (c, PCI_DEVICE_ID_INTEL_82801AA_5); /* ro */
-
     /* TODO: no need to override */
     c[PCI_COMMAND] = 0x00;      /* pcicmd pci command rw, ro */
     c[PCI_COMMAND + 1] = 0x00;
@@ -1292,9 +1289,7 @@ static int ac97_initfn (PCIDevice *dev)
     c[PCI_STATUS] = PCI_STATUS_FAST_BACK;      /* pcists pci status rwc, ro */
     c[PCI_STATUS + 1] = PCI_STATUS_DEVSEL_MEDIUM >> 8;
 
-    c[PCI_REVISION_ID] = 0x01;      /* rid revision ro */
     c[PCI_CLASS_PROG] = 0x00;      /* pi programming interface ro */
-    pci_config_set_class (c, PCI_CLASS_MULTIMEDIA_AUDIO); /* ro */
 
     /* TODO set when bar is registered. no need to override. */
     /* nabmar native audio mixer base address rw */
@@ -1341,6 +1336,10 @@ static PCIDeviceInfo ac97_info = {
     .qdev.size    = sizeof (AC97LinkState),
     .qdev.vmsd    = &vmstate_ac97,
     .init         = ac97_initfn,
+    .vendor_id    = PCI_VENDOR_ID_INTEL,
+    .device_id    = PCI_DEVICE_ID_INTEL_82801AA_5,
+    .revision     = 0x01,
+    .class_id     = PCI_CLASS_MULTIMEDIA_AUDIO,
 };
 
 static void ac97_register (void)
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH v3 09/39] hw/acpi_piix4.c: convert to PCIDeviceInfo to initialize ids
  2011-05-25  1:57 [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
                   ` (7 preceding siblings ...)
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 08/39] hw/ac97.c: " Isaku Yamahata
@ 2011-05-25  1:58 ` Isaku Yamahata
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 10/39] hw/bonito.c: " Isaku Yamahata
                   ` (30 subsequent siblings)
  39 siblings, 0 replies; 42+ messages in thread
From: Isaku Yamahata @ 2011-05-25  1:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: yamahata, mst

use PCIDeviceInfo to initialize ids.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/acpi_piix4.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c
index 96f5222..232008d 100644
--- a/hw/acpi_piix4.c
+++ b/hw/acpi_piix4.c
@@ -317,13 +317,9 @@ static int piix4_pm_initfn(PCIDevice *dev)
     uint8_t *pci_conf;
 
     pci_conf = s->dev.config;
-    pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL);
-    pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_82371AB_3);
     pci_conf[0x06] = 0x80;
     pci_conf[0x07] = 0x02;
-    pci_conf[0x08] = 0x03; // revision number
     pci_conf[0x09] = 0x00;
-    pci_config_set_class(pci_conf, PCI_CLASS_BRIDGE_OTHER);
     pci_conf[0x3d] = 0x01; // interrupt pin 1
 
     pci_conf[0x40] = 0x01; /* PM io base read only bit */
@@ -394,6 +390,10 @@ static PCIDeviceInfo piix4_pm_info = {
     .no_hotplug         = 1,
     .init               = piix4_pm_initfn,
     .config_write       = pm_write_config,
+    .vendor_id          = PCI_VENDOR_ID_INTEL,
+    .device_id          = PCI_DEVICE_ID_INTEL_82371AB_3,
+    .revision           = 0x03,
+    .class_id           = PCI_CLASS_BRIDGE_OTHER,
     .qdev.props         = (Property[]) {
         DEFINE_PROP_UINT32("smb_io_base", PIIX4PMState, smb_io_base, 0),
         DEFINE_PROP_END_OF_LIST(),
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH v3 10/39] hw/bonito.c: convert to PCIDeviceInfo to initialize ids
  2011-05-25  1:57 [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
                   ` (8 preceding siblings ...)
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 09/39] hw/acpi_piix4.c: " Isaku Yamahata
@ 2011-05-25  1:58 ` Isaku Yamahata
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 11/39] hw/cirrus_vga.c: " Isaku Yamahata
                   ` (29 subsequent siblings)
  39 siblings, 0 replies; 42+ messages in thread
From: Isaku Yamahata @ 2011-05-25  1:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: yamahata, mst

use PCIDeviceInfo to initialize ids.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/bonito.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/hw/bonito.c b/hw/bonito.c
index 65a4a63..e8c57a3 100644
--- a/hw/bonito.c
+++ b/hw/bonito.c
@@ -691,11 +691,7 @@ static int bonito_initfn(PCIDevice *dev)
     PCIBonitoState *s = DO_UPCAST(PCIBonitoState, dev, dev);
 
     /* Bonito North Bridge, built on FPGA, VENDOR_ID/DEVICE_ID are "undefined" */
-    pci_config_set_vendor_id(dev->config, 0xdf53);
-    pci_config_set_device_id(dev->config, 0x00d5);
-    pci_config_set_class(dev->config, PCI_CLASS_BRIDGE_HOST);
     pci_config_set_prog_interface(dev->config, 0x00);
-    pci_config_set_revision(dev->config, 0x01);
 
     /* set the north bridge register mapping */
     s->bonito_reg_handle = cpu_register_io_memory(bonito_read, bonito_write, s,
@@ -796,6 +792,11 @@ static PCIDeviceInfo bonito_info = {
     .qdev.vmsd    = &vmstate_bonito,
     .qdev.no_user = 1,
     .init         = bonito_initfn,
+    /*Bonito North Bridge, built on FPGA, VENDOR_ID/DEVICE_ID are "undefined"*/
+    .vendor_id    = 0xdf53,
+    .device_id    = 0x00d5,
+    .revision     = 0x01,
+    .class_id     = PCI_CLASS_BRIDGE_HOST,
 };
 
 static SysBusDeviceInfo bonito_pcihost_info = {
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH v3 11/39] hw/cirrus_vga.c: convert to PCIDeviceInfo to initialize ids
  2011-05-25  1:57 [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
                   ` (9 preceding siblings ...)
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 10/39] hw/bonito.c: " Isaku Yamahata
@ 2011-05-25  1:58 ` Isaku Yamahata
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 12/39] hw/e1000.c: " Isaku Yamahata
                   ` (28 subsequent siblings)
  39 siblings, 0 replies; 42+ messages in thread
From: Isaku Yamahata @ 2011-05-25  1:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: yamahata, mst

use PCIDeviceInfo to initialize ids.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/cirrus_vga.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c
index 722cac7..79874b1 100644
--- a/hw/cirrus_vga.c
+++ b/hw/cirrus_vga.c
@@ -3097,8 +3097,8 @@ static int pci_cirrus_vga_initfn(PCIDevice *dev)
 {
      PCICirrusVGAState *d = DO_UPCAST(PCICirrusVGAState, dev, dev);
      CirrusVGAState *s = &d->cirrus_vga;
-     uint8_t *pci_conf = d->dev.config;
-     int device_id = CIRRUS_ID_CLGD5446;
+     PCIDeviceInfo *info = DO_UPCAST(PCIDeviceInfo, qdev, dev->qdev.info);
+     int16_t device_id = info->device_id;
 
      /* setup VGA */
      vga_common_init(&s->vga, VGA_RAM_SIZE);
@@ -3108,9 +3108,6 @@ static int pci_cirrus_vga_initfn(PCIDevice *dev)
                                       &s->vga);
 
      /* setup PCI */
-     pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_CIRRUS);
-     pci_config_set_device_id(pci_conf, device_id);
-     pci_config_set_class(pci_conf, PCI_CLASS_DISPLAY_VGA);
 
      /* setup memory space */
      /* memory #0 LFB */
@@ -3139,6 +3136,9 @@ static PCIDeviceInfo cirrus_vga_info = {
     .init         = pci_cirrus_vga_initfn,
     .romfile      = VGABIOS_CIRRUS_FILENAME,
     .config_write = pci_cirrus_write_config,
+    .vendor_id    = PCI_VENDOR_ID_CIRRUS,
+    .device_id    = CIRRUS_ID_CLGD5446,
+    .class_id     = PCI_CLASS_DISPLAY_VGA,
 };
 
 static void cirrus_vga_register(void)
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH v3 12/39] hw/e1000.c: convert to PCIDeviceInfo to initialize ids
  2011-05-25  1:57 [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
                   ` (10 preceding siblings ...)
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 11/39] hw/cirrus_vga.c: " Isaku Yamahata
@ 2011-05-25  1:58 ` Isaku Yamahata
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 13/39] hw/es1370.c: " Isaku Yamahata
                   ` (27 subsequent siblings)
  39 siblings, 0 replies; 42+ messages in thread
From: Isaku Yamahata @ 2011-05-25  1:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: yamahata, mst

use PCIDeviceInfo to initialize ids.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/e1000.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/e1000.c b/hw/e1000.c
index f160bfc..96d84f9 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -1164,12 +1164,8 @@ static int pci_e1000_init(PCIDevice *pci_dev)
 
     pci_conf = d->dev.config;
 
-    pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL);
-    pci_config_set_device_id(pci_conf, E1000_DEVID);
     /* TODO: we have no capabilities, so why is this bit set? */
     pci_set_word(pci_conf + PCI_STATUS, PCI_STATUS_CAP_LIST);
-    pci_conf[PCI_REVISION_ID] = 0x03;
-    pci_config_set_class(pci_conf, PCI_CLASS_NETWORK_ETHERNET);
     /* TODO: RST# value should be 0, PCI spec 6.2.4 */
     pci_conf[PCI_CACHE_LINE_SIZE] = 0x10;
 
@@ -1221,6 +1217,10 @@ static PCIDeviceInfo e1000_info = {
     .init       = pci_e1000_init,
     .exit       = pci_e1000_uninit,
     .romfile    = "pxe-e1000.rom",
+    .vendor_id  = PCI_VENDOR_ID_INTEL,
+    .device_id  = E1000_DEVID,
+    .revision   = 0x03,
+    .class_id   = PCI_CLASS_NETWORK_ETHERNET,
     .qdev.props = (Property[]) {
         DEFINE_NIC_PROPERTIES(E1000State, conf),
         DEFINE_PROP_END_OF_LIST(),
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH v3 13/39] hw/es1370.c: convert to PCIDeviceInfo to initialize ids
  2011-05-25  1:57 [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
                   ` (11 preceding siblings ...)
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 12/39] hw/e1000.c: " Isaku Yamahata
@ 2011-05-25  1:58 ` Isaku Yamahata
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 14/39] hw/grackle_pci.c: " Isaku Yamahata
                   ` (26 subsequent siblings)
  39 siblings, 0 replies; 42+ messages in thread
From: Isaku Yamahata @ 2011-05-25  1:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: yamahata, mst

use PCIDeviceInfo to initialize ids.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/es1370.c |   24 +++++++++++-------------
 1 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/hw/es1370.c b/hw/es1370.c
index 40cb48c..1ed62b7 100644
--- a/hw/es1370.c
+++ b/hw/es1370.c
@@ -998,21 +998,9 @@ static int es1370_initfn (PCIDevice *dev)
     ES1370State *s = DO_UPCAST (ES1370State, dev, dev);
     uint8_t *c = s->dev.config;
 
-    pci_config_set_vendor_id (c, PCI_VENDOR_ID_ENSONIQ);
-    pci_config_set_device_id (c, PCI_DEVICE_ID_ENSONIQ_ES1370);
     c[PCI_STATUS + 1] = PCI_STATUS_DEVSEL_SLOW >> 8;
-    pci_config_set_class (c, PCI_CLASS_MULTIMEDIA_AUDIO);
 
-#if 1
-    c[PCI_SUBSYSTEM_VENDOR_ID] = 0x42;
-    c[PCI_SUBSYSTEM_VENDOR_ID + 1] = 0x49;
-    c[PCI_SUBSYSTEM_ID] = 0x4c;
-    c[PCI_SUBSYSTEM_ID + 1] = 0x4c;
-#else
-    c[PCI_SUBSYSTEM_VENDOR_ID] = 0x74;
-    c[PCI_SUBSYSTEM_VENDOR_ID + 1] = 0x12;
-    c[PCI_SUBSYSTEM_ID] = 0x71;
-    c[PCI_SUBSYSTEM_ID + 1] = 0x13;
+#if 0
     c[PCI_CAPABILITY_LIST] = 0xdc;
     c[PCI_INTERRUPT_LINE] = 10;
     c[0xdc] = 0x00;
@@ -1043,6 +1031,16 @@ static PCIDeviceInfo es1370_info = {
     .qdev.size    = sizeof (ES1370State),
     .qdev.vmsd    = &vmstate_es1370,
     .init         = es1370_initfn,
+    .vendor_id    = PCI_VENDOR_ID_ENSONIQ,
+    .device_id    = PCI_DEVICE_ID_ENSONIQ_ES1370,
+    .class_id     = PCI_CLASS_MULTIMEDIA_AUDIO,
+#if 1
+    .subsystem_vendor_id = 0x4942,
+    .subsystem_id = 0x4c4c,
+#else
+    .subsystem_vendor_id = 0x1274,
+    .subsystem_id = 0x1371,
+#endif
 };
 
 static void es1370_register (void)
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH v3 14/39] hw/grackle_pci.c: convert to PCIDeviceInfo to initialize ids
  2011-05-25  1:57 [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
                   ` (12 preceding siblings ...)
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 13/39] hw/es1370.c: " Isaku Yamahata
@ 2011-05-25  1:58 ` Isaku Yamahata
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 15/39] hw/gt64xxx.c: " Isaku Yamahata
                   ` (25 subsequent siblings)
  39 siblings, 0 replies; 42+ messages in thread
From: Isaku Yamahata @ 2011-05-25  1:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: yamahata, mst

use PCIDeviceInfo to initialize ids.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/grackle_pci.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/grackle_pci.c b/hw/grackle_pci.c
index d35701f..cee07e0 100644
--- a/hw/grackle_pci.c
+++ b/hw/grackle_pci.c
@@ -104,11 +104,7 @@ static int pci_grackle_init_device(SysBusDevice *dev)
 
 static int grackle_pci_host_init(PCIDevice *d)
 {
-    pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_MOTOROLA);
-    pci_config_set_device_id(d->config, PCI_DEVICE_ID_MOTOROLA_MPC106);
-    d->config[0x08] = 0x00; // revision
     d->config[0x09] = 0x01;
-    pci_config_set_class(d->config, PCI_CLASS_BRIDGE_HOST);
     return 0;
 }
 
@@ -116,6 +112,10 @@ static PCIDeviceInfo grackle_pci_host_info = {
     .qdev.name = "grackle",
     .qdev.size = sizeof(PCIDevice),
     .init      = grackle_pci_host_init,
+    .vendor_id = PCI_VENDOR_ID_MOTOROLA,
+    .device_id = PCI_DEVICE_ID_MOTOROLA_MPC106,
+    .revision  = 0x00,
+    .class_id  = PCI_CLASS_BRIDGE_HOST,
 };
 
 static void grackle_register_devices(void)
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH v3 15/39] hw/gt64xxx.c: convert to PCIDeviceInfo to initialize ids
  2011-05-25  1:57 [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
                   ` (13 preceding siblings ...)
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 14/39] hw/grackle_pci.c: " Isaku Yamahata
@ 2011-05-25  1:58 ` Isaku Yamahata
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 16/39] hw/ide/cmd646.c: " Isaku Yamahata
                   ` (24 subsequent siblings)
  39 siblings, 0 replies; 42+ messages in thread
From: Isaku Yamahata @ 2011-05-25  1:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: yamahata, mst

use PCIDeviceInfo to initialize ids.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/gt64xxx.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/gt64xxx.c b/hw/gt64xxx.c
index c66188f..8e1f6a0 100644
--- a/hw/gt64xxx.c
+++ b/hw/gt64xxx.c
@@ -1118,14 +1118,10 @@ static int gt64120_init(SysBusDevice *dev)
 static int gt64120_pci_init(PCIDevice *d)
 {
     /* FIXME: Malta specific hw assumptions ahead */
-    pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_MARVELL);
-    pci_config_set_device_id(d->config, PCI_DEVICE_ID_MARVELL_GT6412X);
     pci_set_word(d->config + PCI_COMMAND, 0);
     pci_set_word(d->config + PCI_STATUS,
                  PCI_STATUS_FAST_BACK | PCI_STATUS_DEVSEL_MEDIUM);
-    pci_set_byte(d->config + PCI_CLASS_REVISION, 0x10);
     pci_config_set_prog_interface(d->config, 0);
-    pci_config_set_class(d->config, PCI_CLASS_BRIDGE_HOST);
     pci_set_long(d->config + PCI_BASE_ADDRESS_0, 0x00000008);
     pci_set_long(d->config + PCI_BASE_ADDRESS_1, 0x01000008);
     pci_set_long(d->config + PCI_BASE_ADDRESS_2, 0x1c000000);
@@ -1141,6 +1137,10 @@ static PCIDeviceInfo gt64120_pci_info = {
     .qdev.name = "gt64120_pci",
     .qdev.size = sizeof(PCIDevice),
     .init      = gt64120_pci_init,
+    .vendor_id = PCI_VENDOR_ID_MARVELL,
+    .device_id = PCI_DEVICE_ID_MARVELL_GT6412X,
+    .revision  = 0x10,
+    .class_id  = PCI_CLASS_BRIDGE_HOST,
 };
 
 static void gt64120_pci_register_devices(void)
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH v3 16/39] hw/ide/cmd646.c: convert to PCIDeviceInfo to initialize ids
  2011-05-25  1:57 [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
                   ` (14 preceding siblings ...)
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 15/39] hw/gt64xxx.c: " Isaku Yamahata
@ 2011-05-25  1:58 ` Isaku Yamahata
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 17/39] hw/ide/ich.c: " Isaku Yamahata
                   ` (23 subsequent siblings)
  39 siblings, 0 replies; 42+ messages in thread
From: Isaku Yamahata @ 2011-05-25  1:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: yamahata, mst

use PCIDeviceInfo to initialize ids.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/ide/cmd646.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/hw/ide/cmd646.c b/hw/ide/cmd646.c
index 5d5464a..56302b5 100644
--- a/hw/ide/cmd646.c
+++ b/hw/ide/cmd646.c
@@ -226,14 +226,8 @@ static int pci_cmd646_ide_initfn(PCIDevice *dev)
     qemu_irq *irq;
     int i;
 
-    pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_CMD);
-    pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_CMD_646);
-
-    pci_conf[PCI_REVISION_ID] = 0x07; // IDE controller revision
     pci_conf[PCI_CLASS_PROG] = 0x8f;
 
-    pci_config_set_class(pci_conf, PCI_CLASS_STORAGE_IDE);
-
     pci_conf[0x51] = 0x04; // enable IDE0
     if (d->secondary) {
         /* XXX: if not enabled, really disable the seconday IDE controller */
@@ -282,6 +276,10 @@ static PCIDeviceInfo cmd646_ide_info[] = {
         .qdev.name    = "cmd646-ide",
         .qdev.size    = sizeof(PCIIDEState),
         .init         = pci_cmd646_ide_initfn,
+        .vendor_id    = PCI_VENDOR_ID_CMD,
+        .device_id    = PCI_DEVICE_ID_CMD_646,
+        .revision     = 0x07, // IDE controller revision
+        .class_id     = PCI_CLASS_STORAGE_IDE,
         .qdev.props   = (Property[]) {
             DEFINE_PROP_UINT32("secondary", PCIIDEState, secondary, 0),
             DEFINE_PROP_END_OF_LIST(),
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH v3 17/39] hw/ide/ich.c: convert to PCIDeviceInfo to initialize ids
  2011-05-25  1:57 [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
                   ` (15 preceding siblings ...)
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 16/39] hw/ide/cmd646.c: " Isaku Yamahata
@ 2011-05-25  1:58 ` Isaku Yamahata
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 18/39] hw/ide/via.c: " Isaku Yamahata
                   ` (22 subsequent siblings)
  39 siblings, 0 replies; 42+ messages in thread
From: Isaku Yamahata @ 2011-05-25  1:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: yamahata, mst

use PCIDeviceInfo to initialize ids.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/ide/ich.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/hw/ide/ich.c b/hw/ide/ich.c
index e44339b..cb1c405 100644
--- a/hw/ide/ich.c
+++ b/hw/ide/ich.c
@@ -77,11 +77,6 @@ static int pci_ich9_ahci_init(PCIDevice *dev)
     struct AHCIPCIState *d;
     d = DO_UPCAST(struct AHCIPCIState, card, dev);
 
-    pci_config_set_vendor_id(d->card.config, PCI_VENDOR_ID_INTEL);
-    pci_config_set_device_id(d->card.config, PCI_DEVICE_ID_INTEL_82801IR);
-
-    pci_config_set_class(d->card.config, PCI_CLASS_STORAGE_SATA);
-    pci_config_set_revision(d->card.config, 0x02);
     pci_config_set_prog_interface(d->card.config, AHCI_PROGMODE_MAJOR_REV_1);
 
     d->card.config[PCI_CACHE_LINE_SIZE] = 0x08;  /* Cache line size */
@@ -131,6 +126,10 @@ static PCIDeviceInfo ich_ahci_info[] = {
         .init         = pci_ich9_ahci_init,
         .exit         = pci_ich9_uninit,
         .config_write = pci_ich9_write_config,
+        .vendor_id    = PCI_VENDOR_ID_INTEL,
+        .device_id    = PCI_DEVICE_ID_INTEL_82801IR,
+        .revision     = 0x02,
+        .class_id     = PCI_CLASS_STORAGE_SATA,
     },{
         /* end of list */
     }
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH v3 18/39] hw/ide/via.c: convert to PCIDeviceInfo to initialize ids
  2011-05-25  1:57 [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
                   ` (16 preceding siblings ...)
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 17/39] hw/ide/ich.c: " Isaku Yamahata
@ 2011-05-25  1:58 ` Isaku Yamahata
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 19/39] hw/intel-hda.c: " Isaku Yamahata
                   ` (21 subsequent siblings)
  39 siblings, 0 replies; 42+ messages in thread
From: Isaku Yamahata @ 2011-05-25  1:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: yamahata, mst

use PCIDeviceInfo to initialize ids.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/ide/via.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/ide/via.c b/hw/ide/via.c
index 04f3290..3474c37 100644
--- a/hw/ide/via.c
+++ b/hw/ide/via.c
@@ -160,11 +160,7 @@ static int vt82c686b_ide_initfn(PCIDevice *dev)
     PCIIDEState *d = DO_UPCAST(PCIIDEState, dev, dev);;
     uint8_t *pci_conf = d->dev.config;
 
-    pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_VIA);
-    pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_VIA_IDE);
-    pci_config_set_class(pci_conf, PCI_CLASS_STORAGE_IDE);
     pci_config_set_prog_interface(pci_conf, 0x8a); /* legacy ATA mode */
-    pci_config_set_revision(pci_conf,0x06); /* Revision 0.6 */
     pci_set_long(pci_conf + PCI_CAPABILITY_LIST, 0x000000c0);
 
     qemu_register_reset(via_reset, d);
@@ -191,6 +187,10 @@ static PCIDeviceInfo via_ide_info = {
     .qdev.size    = sizeof(PCIIDEState),
     .qdev.no_user = 1,
     .init         = vt82c686b_ide_initfn,
+    .vendor_id    = PCI_VENDOR_ID_VIA,
+    .device_id    = PCI_DEVICE_ID_VIA_IDE,
+    .revision     = 0x06,
+    .class_id     = PCI_CLASS_STORAGE_IDE,
 };
 
 static void via_ide_register(void)
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH v3 19/39] hw/intel-hda.c: convert to PCIDeviceInfo to initialize ids
  2011-05-25  1:57 [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
                   ` (17 preceding siblings ...)
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 18/39] hw/ide/via.c: " Isaku Yamahata
@ 2011-05-25  1:58 ` Isaku Yamahata
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 20/39] hw/ioh3420.c: " Isaku Yamahata
                   ` (20 subsequent siblings)
  39 siblings, 0 replies; 42+ messages in thread
From: Isaku Yamahata @ 2011-05-25  1:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: yamahata, mst

use PCIDeviceInfo to initialize ids.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/intel-hda.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/intel-hda.c b/hw/intel-hda.c
index 5485745..0ffffce 100644
--- a/hw/intel-hda.c
+++ b/hw/intel-hda.c
@@ -1138,10 +1138,6 @@ static int intel_hda_init(PCIDevice *pci)
 
     d->name = d->pci.qdev.info->name;
 
-    pci_config_set_vendor_id(conf, PCI_VENDOR_ID_INTEL);
-    pci_config_set_device_id(conf, 0x2668);
-    pci_config_set_revision(conf, 1);
-    pci_config_set_class(conf, PCI_CLASS_MULTIMEDIA_HD_AUDIO);
     pci_config_set_interrupt_pin(conf, 1);
 
     /* HDCTL off 0x40 bit 0 selects signaling mode (1-HDA, 0 - Ac97) 18.1.19 */
@@ -1265,6 +1261,10 @@ static PCIDeviceInfo intel_hda_info = {
     .init         = intel_hda_init,
     .exit         = intel_hda_exit,
     .config_write = intel_hda_write_config,
+    .vendor_id    = PCI_VENDOR_ID_INTEL,
+    .device_id    = 0x2668,
+    .revision     = 1,
+    .class_id     = PCI_CLASS_MULTIMEDIA_HD_AUDIO,
     .qdev.props   = (Property[]) {
         DEFINE_PROP_UINT32("debug", IntelHDAState, debug, 0),
         DEFINE_PROP_UINT32("msi", IntelHDAState, msi, 1),
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH v3 20/39] hw/ioh3420.c: convert to PCIDeviceInfo to initialize ids
  2011-05-25  1:57 [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
                   ` (18 preceding siblings ...)
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 19/39] hw/intel-hda.c: " Isaku Yamahata
@ 2011-05-25  1:58 ` Isaku Yamahata
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 21/39] hw/ivshmem.c: " Isaku Yamahata
                   ` (19 subsequent siblings)
  39 siblings, 0 replies; 42+ messages in thread
From: Isaku Yamahata @ 2011-05-25  1:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: yamahata, mst

use PCIDeviceInfo to initialize ids.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/ioh3420.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/hw/ioh3420.c b/hw/ioh3420.c
index 95adf09..a6bfbb9 100644
--- a/hw/ioh3420.c
+++ b/hw/ioh3420.c
@@ -104,12 +104,8 @@ static int ioh3420_initfn(PCIDevice *d)
         return rc;
     }
 
-    d->config[PCI_REVISION_ID] = PCI_DEVICE_ID_IOH_REV;
     pcie_port_init_reg(d);
 
-    pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_INTEL);
-    pci_config_set_device_id(d->config, PCI_DEVICE_ID_IOH_EPORT);
-
     rc = pci_bridge_ssvid_init(d, IOH_EP_SSVID_OFFSET,
                                IOH_EP_SSVID_SVID, IOH_EP_SSVID_SSID);
     if (rc < 0) {
@@ -217,6 +213,9 @@ static PCIDeviceInfo ioh3420_info = {
     .config_write = ioh3420_write_config,
     .init = ioh3420_initfn,
     .exit = ioh3420_exitfn,
+    .vendor_id = PCI_VENDOR_ID_INTEL,
+    .device_id = PCI_DEVICE_ID_IOH_EPORT,
+    .revision = PCI_DEVICE_ID_IOH_REV,
 
     .qdev.props = (Property[]) {
         DEFINE_PROP_UINT8("port", PCIESlot, port.port, 0),
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH v3 21/39] hw/ivshmem.c: convert to PCIDeviceInfo to initialize ids
  2011-05-25  1:57 [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
                   ` (19 preceding siblings ...)
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 20/39] hw/ioh3420.c: " Isaku Yamahata
@ 2011-05-25  1:58 ` Isaku Yamahata
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 22/39] hw/lsi53c895a.c: " Isaku Yamahata
                   ` (18 subsequent siblings)
  39 siblings, 0 replies; 42+ messages in thread
From: Isaku Yamahata @ 2011-05-25  1:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: yamahata, mst

use PCIDeviceInfo to initialize ids.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/ivshmem.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/hw/ivshmem.c b/hw/ivshmem.c
index 7b19a81..3055dd2 100644
--- a/hw/ivshmem.c
+++ b/hw/ivshmem.c
@@ -706,12 +706,7 @@ static int pci_ivshmem_init(PCIDevice *dev)
     }
 
     pci_conf = s->dev.config;
-    pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_REDHAT_QUMRANET);
-    pci_conf[0x02] = 0x10;
-    pci_conf[0x03] = 0x11;
     pci_conf[PCI_COMMAND] = PCI_COMMAND_IO | PCI_COMMAND_MEMORY;
-    pci_config_set_class(pci_conf, PCI_CLASS_MEMORY_RAM);
-    pci_conf[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL;
 
     pci_config_set_interrupt_pin(pci_conf, 1);
 
@@ -809,6 +804,9 @@ static PCIDeviceInfo ivshmem_info = {
     .qdev.reset = ivshmem_reset,
     .init       = pci_ivshmem_init,
     .exit       = pci_ivshmem_uninit,
+    .vendor_id  = PCI_VENDOR_ID_REDHAT_QUMRANET,
+    .device_id  = 0x1110,
+    .class_id   = PCI_CLASS_MEMORY_RAM,
     .qdev.props = (Property[]) {
         DEFINE_PROP_CHR("chardev", IVShmemState, server_chr),
         DEFINE_PROP_STRING("size", IVShmemState, sizearg),
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH v3 22/39] hw/lsi53c895a.c: convert to PCIDeviceInfo to initialize ids
  2011-05-25  1:57 [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
                   ` (20 preceding siblings ...)
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 21/39] hw/ivshmem.c: " Isaku Yamahata
@ 2011-05-25  1:58 ` Isaku Yamahata
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 23/39] hw/ne2000.c: " Isaku Yamahata
                   ` (17 subsequent siblings)
  39 siblings, 0 replies; 42+ messages in thread
From: Isaku Yamahata @ 2011-05-25  1:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: yamahata, mst

use PCIDeviceInfo to initialize ids.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/lsi53c895a.c |   13 ++++---------
 1 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c
index be4df58..6b9c904 100644
--- a/hw/lsi53c895a.c
+++ b/hw/lsi53c895a.c
@@ -2212,15 +2212,6 @@ static int lsi_scsi_init(PCIDevice *dev)
 
     pci_conf = s->dev.config;
 
-    /* PCI Vendor ID (word) */
-    pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_LSI_LOGIC);
-    /* PCI device ID (word) */
-    pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_LSI_53C895A);
-    /* PCI base class code */
-    pci_config_set_class(pci_conf, PCI_CLASS_STORAGE_SCSI);
-    /* PCI subsystem ID */
-    pci_conf[PCI_SUBSYSTEM_ID] = 0x00;
-    pci_conf[PCI_SUBSYSTEM_ID + 1] = 0x10;
     /* PCI latency timer = 255 */
     pci_conf[PCI_LATENCY_TIMER] = 0xff;
     /* TODO: RST# value should be 0 */
@@ -2256,6 +2247,10 @@ static PCIDeviceInfo lsi_info = {
     .qdev.vmsd  = &vmstate_lsi_scsi,
     .init       = lsi_scsi_init,
     .exit       = lsi_scsi_uninit,
+    .vendor_id  = PCI_VENDOR_ID_LSI_LOGIC,
+    .device_id  = PCI_DEVICE_ID_LSI_53C895A,
+    .class_id   = PCI_CLASS_STORAGE_SCSI,
+    .subsystem_id = 0x1000,
 };
 
 static void lsi53c895a_register_devices(void)
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH v3 23/39] hw/ne2000.c: convert to PCIDeviceInfo to initialize ids
  2011-05-25  1:57 [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
                   ` (21 preceding siblings ...)
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 22/39] hw/lsi53c895a.c: " Isaku Yamahata
@ 2011-05-25  1:58 ` Isaku Yamahata
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 24/39] hw/pcnet-pci.c: " Isaku Yamahata
                   ` (16 subsequent siblings)
  39 siblings, 0 replies; 42+ messages in thread
From: Isaku Yamahata @ 2011-05-25  1:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: yamahata, mst

use PCIDeviceInfo to initialize ids.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/ne2000.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/ne2000.c b/hw/ne2000.c
index b668ad1..f8acaae 100644
--- a/hw/ne2000.c
+++ b/hw/ne2000.c
@@ -721,9 +721,6 @@ static int pci_ne2000_init(PCIDevice *pci_dev)
     uint8_t *pci_conf;
 
     pci_conf = d->dev.config;
-    pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_REALTEK);
-    pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_REALTEK_8029);
-    pci_config_set_class(pci_conf, PCI_CLASS_NETWORK_ETHERNET);
     /* TODO: RST# value should be 0. PCI spec 6.2.4 */
     pci_conf[PCI_INTERRUPT_PIN] = 1; // interrupt pin 0
 
@@ -767,6 +764,9 @@ static PCIDeviceInfo ne2000_info = {
     .qdev.vmsd  = &vmstate_pci_ne2000,
     .init       = pci_ne2000_init,
     .exit       = pci_ne2000_exit,
+    .vendor_id  = PCI_VENDOR_ID_REALTEK,
+    .device_id  = PCI_DEVICE_ID_REALTEK_8029,
+    .class_id   = PCI_CLASS_NETWORK_ETHERNET,
     .qdev.props = (Property[]) {
         DEFINE_NIC_PROPERTIES(PCINE2000State, ne2000.c),
         DEFINE_PROP_END_OF_LIST(),
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH v3 24/39] hw/pcnet-pci.c: convert to PCIDeviceInfo to initialize ids
  2011-05-25  1:57 [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
                   ` (22 preceding siblings ...)
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 23/39] hw/ne2000.c: " Isaku Yamahata
@ 2011-05-25  1:58 ` Isaku Yamahata
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 25/39] hw/piix4.c: " Isaku Yamahata
                   ` (15 subsequent siblings)
  39 siblings, 0 replies; 42+ messages in thread
From: Isaku Yamahata @ 2011-05-25  1:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: yamahata, mst

use PCIDeviceInfo to initialize ids.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/pcnet-pci.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/pcnet-pci.c b/hw/pcnet-pci.c
index 9415a1e..216cf81 100644
--- a/hw/pcnet-pci.c
+++ b/hw/pcnet-pci.c
@@ -265,12 +265,8 @@ static int pci_pcnet_init(PCIDevice *pci_dev)
 
     pci_conf = pci_dev->config;
 
-    pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_AMD);
-    pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_AMD_LANCE);
     pci_set_word(pci_conf + PCI_STATUS,
                  PCI_STATUS_FAST_BACK | PCI_STATUS_DEVSEL_MEDIUM);
-    pci_conf[PCI_REVISION_ID] = 0x10;
-    pci_config_set_class(pci_conf, PCI_CLASS_NETWORK_ETHERNET);
 
     pci_set_word(pci_conf + PCI_SUBSYSTEM_VENDOR_ID, 0x0);
     pci_set_word(pci_conf + PCI_SUBSYSTEM_ID, 0x0);
@@ -318,6 +314,10 @@ static PCIDeviceInfo pcnet_info = {
     .qdev.vmsd  = &vmstate_pci_pcnet,
     .init       = pci_pcnet_init,
     .exit       = pci_pcnet_uninit,
+    .vendor_id  = PCI_VENDOR_ID_AMD,
+    .device_id  = PCI_DEVICE_ID_AMD_LANCE,
+    .revision   = 0x10,
+    .class_id   = PCI_CLASS_NETWORK_ETHERNET,
     .qdev.props = (Property[]) {
         DEFINE_NIC_PROPERTIES(PCIPCNetState, state.conf),
         DEFINE_PROP_END_OF_LIST(),
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH v3 25/39] hw/piix4.c: convert to PCIDeviceInfo to initialize ids
  2011-05-25  1:57 [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
                   ` (23 preceding siblings ...)
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 24/39] hw/pcnet-pci.c: " Isaku Yamahata
@ 2011-05-25  1:58 ` Isaku Yamahata
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 26/39] hw/piix_pci.c: " Isaku Yamahata
                   ` (14 subsequent siblings)
  39 siblings, 0 replies; 42+ messages in thread
From: Isaku Yamahata @ 2011-05-25  1:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: yamahata, mst

use PCIDeviceInfo to initialize ids.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/piix4.c |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/hw/piix4.c b/hw/piix4.c
index 71f1f84..9590e7b 100644
--- a/hw/piix4.c
+++ b/hw/piix4.c
@@ -86,15 +86,8 @@ static const VMStateDescription vmstate_piix4 = {
 static int piix4_initfn(PCIDevice *dev)
 {
     PIIX4State *d = DO_UPCAST(PIIX4State, dev, dev);
-    uint8_t *pci_conf;
 
     isa_bus_new(&d->dev.qdev);
-
-    pci_conf = d->dev.config;
-    pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL);
-    pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_82371AB_0); // 82371AB/EB/MB PIIX4 PCI-to-ISA bridge
-    pci_config_set_class(pci_conf, PCI_CLASS_BRIDGE_ISA);
-
     piix4_dev = &d->dev;
     qemu_register_reset(piix4_reset, d);
     return 0;
@@ -117,6 +110,9 @@ static PCIDeviceInfo piix4_info[] = {
         .qdev.no_user = 1,
         .no_hotplug   = 1,
         .init         = piix4_initfn,
+        .vendor_id    = PCI_VENDOR_ID_INTEL,
+        .device_id    = PCI_DEVICE_ID_INTEL_82371AB_0, // 82371AB/EB/MB PIIX4 PCI-to-ISA bridge
+        .class_id     = PCI_CLASS_BRIDGE_ISA,
     },{
         /* end of list */
     }
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH v3 26/39] hw/piix_pci.c: convert to PCIDeviceInfo to initialize ids
  2011-05-25  1:57 [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
                   ` (24 preceding siblings ...)
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 25/39] hw/piix4.c: " Isaku Yamahata
@ 2011-05-25  1:58 ` Isaku Yamahata
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 27/39] hw/qxl.c: " Isaku Yamahata
                   ` (13 subsequent siblings)
  39 siblings, 0 replies; 42+ messages in thread
From: Isaku Yamahata @ 2011-05-25  1:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: yamahata, mst

use PCIDeviceInfo to initialize ids.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/piix_pci.c |   19 +++++++------------
 1 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/hw/piix_pci.c b/hw/piix_pci.c
index 5f0d92f..b927f01 100644
--- a/hw/piix_pci.c
+++ b/hw/piix_pci.c
@@ -228,11 +228,6 @@ static int i440fx_initfn(PCIDevice *dev)
 {
     PCII440FXState *d = DO_UPCAST(PCII440FXState, dev, dev);
 
-    pci_config_set_vendor_id(d->dev.config, PCI_VENDOR_ID_INTEL);
-    pci_config_set_device_id(d->dev.config, PCI_DEVICE_ID_INTEL_82441);
-    d->dev.config[0x08] = 0x02; // revision
-    pci_config_set_class(d->dev.config, PCI_CLASS_BRIDGE_HOST);
-
     d->dev.config[I440FX_SMRAM] = 0x02;
 
     cpu_smm_register(&i440fx_set_smm, d);
@@ -406,15 +401,8 @@ static const VMStateDescription vmstate_piix3 = {
 static int piix3_initfn(PCIDevice *dev)
 {
     PIIX3State *d = DO_UPCAST(PIIX3State, dev, dev);
-    uint8_t *pci_conf;
 
     isa_bus_new(&d->dev.qdev);
-
-    pci_conf = d->dev.config;
-    pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL);
-    pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_82371SB_0); // 82371SB PIIX3 PCI-to-ISA bridge (Step A1)
-    pci_config_set_class(pci_conf, PCI_CLASS_BRIDGE_ISA);
-
     qemu_register_reset(piix3_reset, d);
     return 0;
 }
@@ -429,6 +417,10 @@ static PCIDeviceInfo i440fx_info[] = {
         .no_hotplug   = 1,
         .init         = i440fx_initfn,
         .config_write = i440fx_write_config,
+        .vendor_id    = PCI_VENDOR_ID_INTEL,
+        .device_id    = PCI_DEVICE_ID_INTEL_82441,
+        .revision     = 0x02,
+        .class_id     = PCI_CLASS_BRIDGE_HOST,
     },{
         .qdev.name    = "PIIX3",
         .qdev.desc    = "ISA bridge",
@@ -438,6 +430,9 @@ static PCIDeviceInfo i440fx_info[] = {
         .no_hotplug   = 1,
         .init         = piix3_initfn,
         .config_write = piix3_write_config,
+        .vendor_id    = PCI_VENDOR_ID_INTEL,
+        .device_id    = PCI_DEVICE_ID_INTEL_82371SB_0, // 82371SB PIIX3 PCI-to-ISA bridge (Step A1)
+        .class_id     = PCI_CLASS_BRIDGE_ISA,
     },{
         /* end of list */
     }
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH v3 27/39] hw/qxl.c: convert to PCIDeviceInfo to initialize ids
  2011-05-25  1:57 [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
                   ` (25 preceding siblings ...)
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 26/39] hw/piix_pci.c: " Isaku Yamahata
@ 2011-05-25  1:58 ` Isaku Yamahata
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 28/39] hw/rtl8139.c: " Isaku Yamahata
                   ` (12 subsequent siblings)
  39 siblings, 0 replies; 42+ messages in thread
From: Isaku Yamahata @ 2011-05-25  1:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: yamahata, mst

use PCIDeviceInfo to initialize ids.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/qxl.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/hw/qxl.c b/hw/qxl.c
index fe4212b..63cffc3 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -1233,7 +1233,6 @@ static int qxl_init_common(PCIQXLDevice *qxl)
         break;
     }
 
-    pci_config_set_vendor_id(config, REDHAT_PCI_VENDOR_ID);
     pci_config_set_device_id(config, pci_device_id);
     pci_set_byte(&config[PCI_REVISION_ID], pci_device_rev);
     pci_set_byte(&config[PCI_INTERRUPT_PIN], 1);
@@ -1310,7 +1309,6 @@ static int qxl_init_primary(PCIDevice *dev)
     qxl0 = qxl;
     register_displaychangelistener(vga->ds, &display_listener);
 
-    pci_config_set_class(dev->config, PCI_CLASS_DISPLAY_VGA);
     return qxl_init_common(qxl);
 }
 
@@ -1330,7 +1328,6 @@ static int qxl_init_secondary(PCIDevice *dev)
                                           qxl->vga.vram_size);
     qxl->vga.vram_ptr = qemu_get_ram_ptr(qxl->vga.vram_offset);
 
-    pci_config_set_class(dev->config, PCI_CLASS_DISPLAY_OTHER);
     return qxl_init_common(qxl);
 }
 
@@ -1493,6 +1490,8 @@ static PCIDeviceInfo qxl_info_primary = {
     .init         = qxl_init_primary,
     .config_write = qxl_write_config,
     .romfile      = "vgabios-qxl.bin",
+    .vendor_id    = REDHAT_PCI_VENDOR_ID,
+    .class_id     = PCI_CLASS_DISPLAY_VGA,
     .qdev.props = (Property[]) {
         DEFINE_PROP_UINT32("ram_size", PCIQXLDevice, vga.vram_size, 64 * 1024 * 1024),
         DEFINE_PROP_UINT32("vram_size", PCIQXLDevice, vram_size, 64 * 1024 * 1024),
@@ -1511,6 +1510,8 @@ static PCIDeviceInfo qxl_info_secondary = {
     .qdev.reset   = qxl_reset_handler,
     .qdev.vmsd    = &qxl_vmstate,
     .init         = qxl_init_secondary,
+    .vendor_id    = REDHAT_PCI_VENDOR_ID,
+    .class_id     = PCI_CLASS_DISPLAY_OTHER,
     .qdev.props = (Property[]) {
         DEFINE_PROP_UINT32("ram_size", PCIQXLDevice, vga.vram_size, 64 * 1024 * 1024),
         DEFINE_PROP_UINT32("vram_size", PCIQXLDevice, vram_size, 64 * 1024 * 1024),
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH v3 28/39] hw/rtl8139.c: convert to PCIDeviceInfo to initialize ids
  2011-05-25  1:57 [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
                   ` (26 preceding siblings ...)
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 27/39] hw/qxl.c: " Isaku Yamahata
@ 2011-05-25  1:58 ` Isaku Yamahata
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 29/39] hw/sh_pci.c: " Isaku Yamahata
                   ` (11 subsequent siblings)
  39 siblings, 0 replies; 42+ messages in thread
From: Isaku Yamahata @ 2011-05-25  1:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: yamahata, mst

use PCIDeviceInfo to initialize ids.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/rtl8139.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/rtl8139.c b/hw/rtl8139.c
index c7c7a3c..34e3a9e 100644
--- a/hw/rtl8139.c
+++ b/hw/rtl8139.c
@@ -3453,10 +3453,6 @@ static int pci_rtl8139_init(PCIDevice *dev)
     uint8_t *pci_conf;
 
     pci_conf = s->dev.config;
-    pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_REALTEK);
-    pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_REALTEK_8139);
-    pci_conf[PCI_REVISION_ID] = RTL8139_PCI_REVID; /* >=0x20 is for 8139C+ */
-    pci_config_set_class(pci_conf, PCI_CLASS_NETWORK_ETHERNET);
     pci_conf[PCI_INTERRUPT_PIN] = 1;    /* interrupt pin 0 */
     /* TODO: start of capability list, but no capability
      * list bit in status register, and offset 0xdc seems unused. */
@@ -3510,6 +3506,10 @@ static PCIDeviceInfo rtl8139_info = {
     .init       = pci_rtl8139_init,
     .exit       = pci_rtl8139_uninit,
     .romfile    = "pxe-rtl8139.rom",
+    .vendor_id  = PCI_VENDOR_ID_REALTEK,
+    .device_id  = PCI_DEVICE_ID_REALTEK_8139,
+    .revision   = RTL8139_PCI_REVID, /* >=0x20 is for 8139C+ */
+    .class_id   = PCI_CLASS_NETWORK_ETHERNET,
     .qdev.props = (Property[]) {
         DEFINE_NIC_PROPERTIES(RTL8139State, conf),
         DEFINE_PROP_END_OF_LIST(),
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH v3 29/39] hw/sh_pci.c: convert to PCIDeviceInfo to initialize ids
  2011-05-25  1:57 [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
                   ` (27 preceding siblings ...)
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 28/39] hw/rtl8139.c: " Isaku Yamahata
@ 2011-05-25  1:58 ` Isaku Yamahata
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 30/39] hw/sun4u.c: " Isaku Yamahata
                   ` (10 subsequent siblings)
  39 siblings, 0 replies; 42+ messages in thread
From: Isaku Yamahata @ 2011-05-25  1:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: yamahata, mst

use PCIDeviceInfo to initialize ids.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/sh_pci.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/sh_pci.c b/hw/sh_pci.c
index e99d8db..a076cf2 100644
--- a/hw/sh_pci.c
+++ b/hw/sh_pci.c
@@ -137,8 +137,6 @@ static int sh_pci_init_device(SysBusDevice *dev)
 
 static int sh_pci_host_init(PCIDevice *d)
 {
-    pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_HITACHI);
-    pci_config_set_device_id(d->config, PCI_DEVICE_ID_HITACHI_SH7751R);
     pci_set_word(d->config + PCI_COMMAND, PCI_COMMAND_WAIT);
     pci_set_word(d->config + PCI_STATUS, PCI_STATUS_CAP_LIST |
                  PCI_STATUS_FAST_BACK | PCI_STATUS_DEVSEL_MEDIUM);
@@ -149,6 +147,8 @@ static PCIDeviceInfo sh_pci_host_info = {
     .qdev.name = "sh_pci_host",
     .qdev.size = sizeof(PCIDevice),
     .init      = sh_pci_host_init,
+    .vendor_id = PCI_VENDOR_ID_HITACHI,
+    .device_id = PCI_DEVICE_ID_HITACHI_SH7751R,
 };
 
 static void sh_pci_register_devices(void)
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH v3 30/39] hw/sun4u.c: convert to PCIDeviceInfo to initialize ids
  2011-05-25  1:57 [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
                   ` (28 preceding siblings ...)
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 29/39] hw/sh_pci.c: " Isaku Yamahata
@ 2011-05-25  1:58 ` Isaku Yamahata
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 31/39] hw/unin_pci.c: " Isaku Yamahata
                   ` (9 subsequent siblings)
  39 siblings, 0 replies; 42+ messages in thread
From: Isaku Yamahata @ 2011-05-25  1:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: yamahata, mst

use PCIDeviceInfo to initialize ids.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/sun4u.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/sun4u.c b/hw/sun4u.c
index 5eb38cf..d7dcaf0 100644
--- a/hw/sun4u.c
+++ b/hw/sun4u.c
@@ -553,15 +553,11 @@ pci_ebus_init1(PCIDevice *s)
 {
     isa_bus_new(&s->qdev);
 
-    pci_config_set_vendor_id(s->config, PCI_VENDOR_ID_SUN);
-    pci_config_set_device_id(s->config, PCI_DEVICE_ID_SUN_EBUS);
     s->config[0x04] = 0x06; // command = bus master, pci mem
     s->config[0x05] = 0x00;
     s->config[0x06] = 0xa0; // status = fast back-to-back, 66MHz, no error
     s->config[0x07] = 0x03; // status = medium devsel
-    s->config[0x08] = 0x01; // revision
     s->config[0x09] = 0x00; // programming i/f
-    pci_config_set_class(s->config, PCI_CLASS_BRIDGE_OTHER);
     s->config[0x0D] = 0x0a; // latency_timer
 
     pci_register_bar(s, 0, 0x1000000, PCI_BASE_ADDRESS_SPACE_MEMORY,
@@ -575,6 +571,10 @@ static PCIDeviceInfo ebus_info = {
     .qdev.name = "ebus",
     .qdev.size = sizeof(PCIDevice),
     .init = pci_ebus_init1,
+    .vendor_id = PCI_VENDOR_ID_SUN,
+    .device_id = PCI_DEVICE_ID_SUN_EBUS,
+    .revision = 0x01,
+    .class_id = PCI_CLASS_BRIDGE_OTHER,
 };
 
 static void pci_ebus_register(void)
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH v3 31/39] hw/unin_pci.c: convert to PCIDeviceInfo to initialize ids
  2011-05-25  1:57 [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
                   ` (29 preceding siblings ...)
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 30/39] hw/sun4u.c: " Isaku Yamahata
@ 2011-05-25  1:58 ` Isaku Yamahata
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 32/39] hw/usb-ohci.c: " Isaku Yamahata
                   ` (8 subsequent siblings)
  39 siblings, 0 replies; 42+ messages in thread
From: Isaku Yamahata @ 2011-05-25  1:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: yamahata, mst

use PCIDeviceInfo to initialize ids.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/unin_pci.c |   33 ++++++++++++++++-----------------
 1 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/hw/unin_pci.c b/hw/unin_pci.c
index c57c0a1..d364daa 100644
--- a/hw/unin_pci.c
+++ b/hw/unin_pci.c
@@ -279,10 +279,6 @@ PCIBus *pci_pmac_u3_init(qemu_irq *pic)
 
 static int unin_main_pci_host_init(PCIDevice *d)
 {
-    pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_APPLE);
-    pci_config_set_device_id(d->config, PCI_DEVICE_ID_APPLE_UNI_N_PCI);
-    d->config[0x08] = 0x00; // revision
-    pci_config_set_class(d->config, PCI_CLASS_BRIDGE_HOST);
     d->config[0x0C] = 0x08; // cache_line_size
     d->config[0x0D] = 0x10; // latency_timer
     d->config[0x34] = 0x00; // capabilities_pointer
@@ -291,10 +287,6 @@ static int unin_main_pci_host_init(PCIDevice *d)
 
 static int unin_agp_pci_host_init(PCIDevice *d)
 {
-    pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_APPLE);
-    pci_config_set_device_id(d->config, PCI_DEVICE_ID_APPLE_UNI_N_AGP);
-    d->config[0x08] = 0x00; // revision
-    pci_config_set_class(d->config, PCI_CLASS_BRIDGE_HOST);
     d->config[0x0C] = 0x08; // cache_line_size
     d->config[0x0D] = 0x10; // latency_timer
     //    d->config[0x34] = 0x80; // capabilities_pointer
@@ -303,11 +295,6 @@ static int unin_agp_pci_host_init(PCIDevice *d)
 
 static int u3_agp_pci_host_init(PCIDevice *d)
 {
-    pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_APPLE);
-    pci_config_set_device_id(d->config, PCI_DEVICE_ID_APPLE_U3_AGP);
-    /* revision */
-    d->config[0x08] = 0x00;
-    pci_config_set_class(d->config, PCI_CLASS_BRIDGE_HOST);
     /* cache line size */
     d->config[0x0C] = 0x08;
     /* latency timer */
@@ -317,10 +304,6 @@ static int u3_agp_pci_host_init(PCIDevice *d)
 
 static int unin_internal_pci_host_init(PCIDevice *d)
 {
-    pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_APPLE);
-    pci_config_set_device_id(d->config, PCI_DEVICE_ID_APPLE_UNI_N_I_PCI);
-    d->config[0x08] = 0x00; // revision
-    pci_config_set_class(d->config, PCI_CLASS_BRIDGE_HOST);
     d->config[0x0C] = 0x08; // cache_line_size
     d->config[0x0D] = 0x10; // latency_timer
     d->config[0x34] = 0x00; // capabilities_pointer
@@ -331,24 +314,40 @@ static PCIDeviceInfo unin_main_pci_host_info = {
     .qdev.name = "uni-north",
     .qdev.size = sizeof(PCIDevice),
     .init      = unin_main_pci_host_init,
+    .vendor_id = PCI_VENDOR_ID_APPLE,
+    .device_id = PCI_DEVICE_ID_APPLE_UNI_N_PCI,
+    .revision  = 0x00,
+    .class_id  = PCI_CLASS_BRIDGE_HOST,
 };
 
 static PCIDeviceInfo u3_agp_pci_host_info = {
     .qdev.name = "u3-agp",
     .qdev.size = sizeof(PCIDevice),
     .init      = u3_agp_pci_host_init,
+    .vendor_id = PCI_VENDOR_ID_APPLE,
+    .device_id = PCI_DEVICE_ID_APPLE_U3_AGP,
+    .revision  = 0x00,
+    .class_id  = PCI_CLASS_BRIDGE_HOST,
 };
 
 static PCIDeviceInfo unin_agp_pci_host_info = {
     .qdev.name = "uni-north-agp",
     .qdev.size = sizeof(PCIDevice),
     .init      = unin_agp_pci_host_init,
+    .vendor_id = PCI_VENDOR_ID_APPLE,
+    .device_id = PCI_DEVICE_ID_APPLE_UNI_N_AGP,
+    .revision  = 0x00,
+    .class_id  = PCI_CLASS_BRIDGE_HOST,
 };
 
 static PCIDeviceInfo unin_internal_pci_host_info = {
     .qdev.name = "uni-north-pci",
     .qdev.size = sizeof(PCIDevice),
     .init      = unin_internal_pci_host_init,
+    .vendor_id = PCI_VENDOR_ID_APPLE,
+    .device_id = PCI_DEVICE_ID_APPLE_UNI_N_I_PCI,
+    .revision  = 0x00,
+    .class_id  = PCI_CLASS_BRIDGE_HOST,
 };
 
 static void unin_register_devices(void)
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH v3 32/39] hw/usb-ohci.c: convert to PCIDeviceInfo to initialize ids
  2011-05-25  1:57 [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
                   ` (30 preceding siblings ...)
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 31/39] hw/unin_pci.c: " Isaku Yamahata
@ 2011-05-25  1:58 ` Isaku Yamahata
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 33/39] hw/versatile_pci.c: " Isaku Yamahata
                   ` (7 subsequent siblings)
  39 siblings, 0 replies; 42+ messages in thread
From: Isaku Yamahata @ 2011-05-25  1:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: yamahata, mst

use PCIDeviceInfo to initialize ids.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/usb-ohci.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/hw/usb-ohci.c b/hw/usb-ohci.c
index d21c820..7ff2322 100644
--- a/hw/usb-ohci.c
+++ b/hw/usb-ohci.c
@@ -1716,11 +1716,7 @@ static int usb_ohci_initfn_pci(struct PCIDevice *dev)
     OHCIPCIState *ohci = DO_UPCAST(OHCIPCIState, pci_dev, dev);
     int num_ports = 3;
 
-    pci_config_set_vendor_id(ohci->pci_dev.config, PCI_VENDOR_ID_APPLE);
-    pci_config_set_device_id(ohci->pci_dev.config,
-                             PCI_DEVICE_ID_APPLE_IPID_USB);
     ohci->pci_dev.config[PCI_CLASS_PROG] = 0x10; /* OHCI */
-    pci_config_set_class(ohci->pci_dev.config, PCI_CLASS_SERIAL_USB);
     /* TODO: RST# value should be 0. */
     ohci->pci_dev.config[PCI_INTERRUPT_PIN] = 0x01; /* interrupt pin 1 */
 
@@ -1760,6 +1756,9 @@ static PCIDeviceInfo ohci_pci_info = {
     .qdev.desc    = "Apple USB Controller",
     .qdev.size    = sizeof(OHCIPCIState),
     .init         = usb_ohci_initfn_pci,
+    .vendor_id    = PCI_VENDOR_ID_APPLE,
+    .device_id    = PCI_DEVICE_ID_APPLE_IPID_USB,
+    .class_id     = PCI_CLASS_SERIAL_USB,
 };
 
 static SysBusDeviceInfo ohci_sysbus_info = {
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH v3 33/39] hw/versatile_pci.c: convert to PCIDeviceInfo to initialize ids
  2011-05-25  1:57 [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
                   ` (31 preceding siblings ...)
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 32/39] hw/usb-ohci.c: " Isaku Yamahata
@ 2011-05-25  1:58 ` Isaku Yamahata
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 34/39] hw/vga-pci.c: " Isaku Yamahata
                   ` (6 subsequent siblings)
  39 siblings, 0 replies; 42+ messages in thread
From: Isaku Yamahata @ 2011-05-25  1:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: yamahata, mst

use PCIDeviceInfo to initialize ids.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/versatile_pci.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/versatile_pci.c b/hw/versatile_pci.c
index 2fed8a0..8e75ffc 100644
--- a/hw/versatile_pci.c
+++ b/hw/versatile_pci.c
@@ -133,12 +133,8 @@ static int pci_realview_init(SysBusDevice *dev)
 
 static int versatile_pci_host_init(PCIDevice *d)
 {
-    pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_XILINX);
-    /* Both boards have the same device ID.  Oh well.  */
-    pci_config_set_device_id(d->config, PCI_DEVICE_ID_XILINX_XC2VP30);
     pci_set_word(d->config + PCI_STATUS,
 		 PCI_STATUS_66MHZ | PCI_STATUS_DEVSEL_MEDIUM);
-    pci_config_set_class(d->config, PCI_CLASS_PROCESSOR_CO);
     pci_set_byte(d->config + PCI_LATENCY_TIMER, 0x10);
     return 0;
 }
@@ -147,6 +143,10 @@ static PCIDeviceInfo versatile_pci_host_info = {
     .qdev.name = "versatile_pci_host",
     .qdev.size = sizeof(PCIDevice),
     .init      = versatile_pci_host_init,
+    .vendor_id = PCI_VENDOR_ID_XILINX,
+    /* Both boards have the same device ID.  Oh well.  */
+    .device_id = PCI_DEVICE_ID_XILINX_XC2VP30,
+    .class_id  = PCI_CLASS_PROCESSOR_CO,
 };
 
 static void versatile_pci_register_devices(void)
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH v3 34/39] hw/vga-pci.c: convert to PCIDeviceInfo to initialize ids
  2011-05-25  1:57 [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
                   ` (32 preceding siblings ...)
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 33/39] hw/versatile_pci.c: " Isaku Yamahata
@ 2011-05-25  1:58 ` Isaku Yamahata
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 35/39] hw/vt82c686.c: " Isaku Yamahata
                   ` (5 subsequent siblings)
  39 siblings, 0 replies; 42+ messages in thread
From: Isaku Yamahata @ 2011-05-25  1:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: yamahata, mst

use PCIDeviceInfo to initialize ids.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/vga-pci.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/hw/vga-pci.c b/hw/vga-pci.c
index ce9ec45..481f448 100644
--- a/hw/vga-pci.c
+++ b/hw/vga-pci.c
@@ -74,7 +74,6 @@ static int pci_vga_initfn(PCIDevice *dev)
 {
      PCIVGAState *d = DO_UPCAST(PCIVGAState, dev, dev);
      VGACommonState *s = &d->vga;
-     uint8_t *pci_conf = d->dev.config;
 
      // vga + console init
      vga_common_init(s, VGA_RAM_SIZE);
@@ -83,11 +82,6 @@ static int pci_vga_initfn(PCIDevice *dev)
      s->ds = graphic_console_init(s->update, s->invalidate,
                                   s->screen_dump, s->text_update, s);
 
-     // dummy VGA (same as Bochs ID)
-     pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_QEMU);
-     pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_QEMU_VGA);
-     pci_config_set_class(pci_conf, PCI_CLASS_DISPLAY_VGA);
-
      /* XXX: VGA_RAM_SIZE must be a power of two */
      pci_register_bar(&d->dev, 0, VGA_RAM_SIZE,
                       PCI_BASE_ADDRESS_MEM_PREFETCH, vga_map);
@@ -114,6 +108,11 @@ static PCIDeviceInfo vga_info = {
     .init         = pci_vga_initfn,
     .config_write = pci_vga_write_config,
     .romfile      = "vgabios-stdvga.bin",
+
+    /* dummy VGA (same as Bochs ID) */
+    .vendor_id    = PCI_VENDOR_ID_QEMU,
+    .device_id    = PCI_DEVICE_ID_QEMU_VGA,
+    .class_id     = PCI_CLASS_DISPLAY_VGA,
 };
 
 static void vga_register(void)
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH v3 35/39] hw/vt82c686.c: convert to PCIDeviceInfo to initialize ids
  2011-05-25  1:57 [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
                   ` (33 preceding siblings ...)
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 34/39] hw/vga-pci.c: " Isaku Yamahata
@ 2011-05-25  1:58 ` Isaku Yamahata
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 36/39] hw/wdt_i6300esb.c: " Isaku Yamahata
                   ` (4 subsequent siblings)
  39 siblings, 0 replies; 42+ messages in thread
From: Isaku Yamahata @ 2011-05-25  1:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: yamahata, mst

use PCIDeviceInfo to initialize ids.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/vt82c686.c |   35 ++++++++++++++++-------------------
 1 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/hw/vt82c686.c b/hw/vt82c686.c
index ca8f826..5c973ed 100644
--- a/hw/vt82c686.c
+++ b/hw/vt82c686.c
@@ -326,11 +326,6 @@ static int vt82c686b_ac97_initfn(PCIDevice *dev)
     VT686AC97State *s = DO_UPCAST(VT686AC97State, dev, dev);
     uint8_t *pci_conf = s->dev.config;
 
-    pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_VIA);
-    pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_VIA_AC97);
-    pci_config_set_class(pci_conf, PCI_CLASS_MULTIMEDIA_AUDIO);
-    pci_config_set_revision(pci_conf, 0x50);
-
     pci_set_word(pci_conf + PCI_COMMAND, PCI_COMMAND_INVALIDATE |
                  PCI_COMMAND_PARITY);
     pci_set_word(pci_conf + PCI_STATUS, PCI_STATUS_CAP_LIST |
@@ -353,6 +348,10 @@ static PCIDeviceInfo via_ac97_info = {
     .qdev.desc          = "AC97",
     .qdev.size          = sizeof(VT686AC97State),
     .init               = vt82c686b_ac97_initfn,
+    .vendor_id          = PCI_VENDOR_ID_VIA,
+    .device_id          = PCI_DEVICE_ID_VIA_AC97,
+    .revision           = 0x50,
+    .class_id           = PCI_CLASS_MULTIMEDIA_AUDIO,
 };
 
 static void vt82c686b_ac97_register(void)
@@ -367,11 +366,6 @@ static int vt82c686b_mc97_initfn(PCIDevice *dev)
     VT686MC97State *s = DO_UPCAST(VT686MC97State, dev, dev);
     uint8_t *pci_conf = s->dev.config;
 
-    pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_VIA);
-    pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_VIA_MC97);
-    pci_config_set_class(pci_conf, PCI_CLASS_COMMUNICATION_OTHER);
-    pci_config_set_revision(pci_conf, 0x30);
-
     pci_set_word(pci_conf + PCI_COMMAND, PCI_COMMAND_INVALIDATE |
                  PCI_COMMAND_VGA_PALETTE);
     pci_set_word(pci_conf + PCI_STATUS, PCI_STATUS_DEVSEL_MEDIUM);
@@ -393,6 +387,10 @@ static PCIDeviceInfo via_mc97_info = {
     .qdev.desc          = "MC97",
     .qdev.size          = sizeof(VT686MC97State),
     .init               = vt82c686b_mc97_initfn,
+    .vendor_id          = PCI_VENDOR_ID_VIA,
+    .device_id          = PCI_DEVICE_ID_VIA_MC97,
+    .class_id           = PCI_CLASS_COMMUNICATION_OTHER,
+    .revision           = 0x30,
 };
 
 static void vt82c686b_mc97_register(void)
@@ -409,11 +407,6 @@ static int vt82c686b_pm_initfn(PCIDevice *dev)
     uint8_t *pci_conf;
 
     pci_conf = s->dev.config;
-    pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_VIA);
-    pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_VIA_ACPI);
-    pci_config_set_class(pci_conf, PCI_CLASS_BRIDGE_OTHER);
-    pci_config_set_revision(pci_conf, 0x40);
-
     pci_set_word(pci_conf + PCI_COMMAND, 0);
     pci_set_word(pci_conf + PCI_STATUS, PCI_STATUS_FAST_BACK |
                  PCI_STATUS_DEVSEL_MEDIUM);
@@ -462,6 +455,10 @@ static PCIDeviceInfo via_pm_info = {
     .qdev.vmsd          = &vmstate_acpi,
     .init               = vt82c686b_pm_initfn,
     .config_write       = pm_write_config,
+    .vendor_id          = PCI_VENDOR_ID_VIA,
+    .device_id          = PCI_DEVICE_ID_VIA_ACPI,
+    .class_id           = PCI_CLASS_BRIDGE_OTHER,
+    .revision           = 0x40,
     .qdev.props         = (Property[]) {
         DEFINE_PROP_UINT32("smb_io_base", VT686PMState, smb_io_base, 0),
         DEFINE_PROP_END_OF_LIST(),
@@ -496,11 +493,7 @@ static int vt82c686b_initfn(PCIDevice *d)
     isa_bus_new(&d->qdev);
 
     pci_conf = d->config;
-    pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_VIA);
-    pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_VIA_ISA_BRIDGE);
-    pci_config_set_class(pci_conf, PCI_CLASS_BRIDGE_ISA);
     pci_config_set_prog_interface(pci_conf, 0x0);
-    pci_config_set_revision(pci_conf,0x40); /* Revision 4.0 */
 
     wmask = d->wmask;
     for (i = 0x00; i < 0xff; i++) {
@@ -531,6 +524,10 @@ static PCIDeviceInfo via_info = {
     .qdev.no_user = 1,
     .init         = vt82c686b_initfn,
     .config_write = vt82c686b_write_config,
+    .vendor_id    = PCI_VENDOR_ID_VIA,
+    .device_id    = PCI_DEVICE_ID_VIA_ISA_BRIDGE,
+    .class_id     = PCI_CLASS_BRIDGE_ISA,
+    .revision     = 0x40,
 };
 
 static void vt82c686b_register(void)
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH v3 36/39] hw/wdt_i6300esb.c: convert to PCIDeviceInfo to initialize ids
  2011-05-25  1:57 [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
                   ` (34 preceding siblings ...)
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 35/39] hw/vt82c686.c: " Isaku Yamahata
@ 2011-05-25  1:58 ` Isaku Yamahata
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 37/39] hw/xio3130_downstream.c: " Isaku Yamahata
                   ` (3 subsequent siblings)
  39 siblings, 0 replies; 42+ messages in thread
From: Isaku Yamahata @ 2011-05-25  1:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: yamahata, mst

use PCIDeviceInfo to initialize ids.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/wdt_i6300esb.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/wdt_i6300esb.c b/hw/wdt_i6300esb.c
index 0791721..bd57fd3 100644
--- a/hw/wdt_i6300esb.c
+++ b/hw/wdt_i6300esb.c
@@ -400,9 +400,6 @@ static int i6300esb_init(PCIDevice *dev)
     d->previous_reboot_flag = 0;
 
     pci_conf = d->dev.config;
-    pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL);
-    pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_ESB_9);
-    pci_config_set_class(pci_conf, PCI_CLASS_SYSTEM_OTHER);
 
     io_mem = cpu_register_io_memory(mem_read, mem_write, d,
                                     DEVICE_NATIVE_ENDIAN);
@@ -425,6 +422,9 @@ static PCIDeviceInfo i6300esb_info = {
     .config_read  = i6300esb_config_read,
     .config_write = i6300esb_config_write,
     .init         = i6300esb_init,
+    .vendor_id    = PCI_VENDOR_ID_INTEL,
+    .device_id    = PCI_DEVICE_ID_INTEL_ESB_9,
+    .class_id     = PCI_CLASS_SYSTEM_OTHER,
 };
 
 static void i6300esb_register_devices(void)
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH v3 37/39] hw/xio3130_downstream.c: convert to PCIDeviceInfo to initialize ids
  2011-05-25  1:57 [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
                   ` (35 preceding siblings ...)
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 36/39] hw/wdt_i6300esb.c: " Isaku Yamahata
@ 2011-05-25  1:58 ` Isaku Yamahata
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 38/39] hw/xio3130_upstream.c: " Isaku Yamahata
                   ` (2 subsequent siblings)
  39 siblings, 0 replies; 42+ messages in thread
From: Isaku Yamahata @ 2011-05-25  1:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: yamahata, mst

use PCIDeviceInfo to initialize ids.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/xio3130_downstream.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/xio3130_downstream.c b/hw/xio3130_downstream.c
index 5aa6a6b..d3c387d 100644
--- a/hw/xio3130_downstream.c
+++ b/hw/xio3130_downstream.c
@@ -69,9 +69,6 @@ static int xio3130_downstream_initfn(PCIDevice *d)
     }
 
     pcie_port_init_reg(d);
-    pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_TI);
-    pci_config_set_device_id(d->config, PCI_DEVICE_ID_TI_XIO3130D);
-    d->config[PCI_REVISION_ID] = XIO3130_REVISION;
 
     rc = msi_init(d, XIO3130_MSI_OFFSET, XIO3130_MSI_NR_VECTOR,
                   XIO3130_MSI_SUPPORTED_FLAGS & PCI_MSI_FLAGS_64BIT,
@@ -182,6 +179,9 @@ static PCIDeviceInfo xio3130_downstream_info = {
     .config_write = xio3130_downstream_write_config,
     .init = xio3130_downstream_initfn,
     .exit = xio3130_downstream_exitfn,
+    .vendor_id = PCI_VENDOR_ID_TI,
+    .device_id = PCI_DEVICE_ID_TI_XIO3130D,
+    .revision = XIO3130_REVISION,
 
     .qdev.props = (Property[]) {
         DEFINE_PROP_UINT8("port", PCIESlot, port.port, 0),
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH v3 38/39] hw/xio3130_upstream.c: convert to PCIDeviceInfo to initialize ids
  2011-05-25  1:57 [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
                   ` (36 preceding siblings ...)
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 37/39] hw/xio3130_downstream.c: " Isaku Yamahata
@ 2011-05-25  1:58 ` Isaku Yamahata
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 39/39] virtio-pci.c: convert to PCIDEviceInfo " Isaku Yamahata
  2011-06-09  1:56 ` [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
  39 siblings, 0 replies; 42+ messages in thread
From: Isaku Yamahata @ 2011-05-25  1:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: yamahata, mst

use PCIDeviceInfo to initialize ids.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/xio3130_upstream.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/xio3130_upstream.c b/hw/xio3130_upstream.c
index a7640f5..8283695 100644
--- a/hw/xio3130_upstream.c
+++ b/hw/xio3130_upstream.c
@@ -65,9 +65,6 @@ static int xio3130_upstream_initfn(PCIDevice *d)
     }
 
     pcie_port_init_reg(d);
-    pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_TI);
-    pci_config_set_device_id(d->config, PCI_DEVICE_ID_TI_XIO3130U);
-    d->config[PCI_REVISION_ID] = XIO3130_REVISION;
 
     rc = msi_init(d, XIO3130_MSI_OFFSET, XIO3130_MSI_NR_VECTOR,
                   XIO3130_MSI_SUPPORTED_FLAGS & PCI_MSI_FLAGS_64BIT,
@@ -159,6 +156,9 @@ static PCIDeviceInfo xio3130_upstream_info = {
     .config_write = xio3130_upstream_write_config,
     .init = xio3130_upstream_initfn,
     .exit = xio3130_upstream_exitfn,
+    .vendor_id = PCI_VENDOR_ID_TI,
+    .device_id = PCI_DEVICE_ID_TI_XIO3130U,
+    .revision = XIO3130_REVISION,
 
     .qdev.props = (Property[]) {
         DEFINE_PROP_UINT8("port", PCIEPort, port, 0),
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH v3 39/39] virtio-pci.c: convert to PCIDEviceInfo to initialize ids
  2011-05-25  1:57 [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
                   ` (37 preceding siblings ...)
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 38/39] hw/xio3130_upstream.c: " Isaku Yamahata
@ 2011-05-25  1:58 ` Isaku Yamahata
  2011-06-09  1:56 ` [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
  39 siblings, 0 replies; 42+ messages in thread
From: Isaku Yamahata @ 2011-05-25  1:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: yamahata, mst

use PCIDeviceInfo to initialize ids.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/virtio-pci.c |   69 ++++++++++++++++++++++++------------------------------
 1 files changed, 31 insertions(+), 38 deletions(-)

diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index c19629d..270e2c7 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -669,9 +669,7 @@ static const VirtIOBindings virtio_pci_bindings = {
     .vmstate_change = virtio_pci_vmstate_change,
 };
 
-static void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice *vdev,
-                            uint16_t vendor, uint16_t device,
-                            uint16_t class_code, uint8_t pif)
+static void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice *vdev)
 {
     uint8_t *config;
     uint32_t size;
@@ -679,19 +677,12 @@ static void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice *vdev,
     proxy->vdev = vdev;
 
     config = proxy->pci_dev.config;
-    pci_config_set_vendor_id(config, vendor);
-    pci_config_set_device_id(config, device);
-
-    config[0x08] = VIRTIO_PCI_ABI_VERSION;
-
-    config[0x09] = pif;
-    pci_config_set_class(config, class_code);
-
-    config[0x2c] = vendor & 0xFF;
-    config[0x2d] = (vendor >> 8) & 0xFF;
-    config[0x2e] = vdev->device_id & 0xFF;
-    config[0x2f] = (vdev->device_id >> 8) & 0xFF;
 
+    if (proxy->class_code) {
+        pci_config_set_class(config, proxy->class_code);
+    }
+    pci_set_word(config + 0x2c, pci_get_word(config + PCI_VENDOR_ID));
+    pci_set_word(config + 0x2e, vdev->device_id);
     config[0x3d] = 1;
 
     if (vdev->nvectors && !msix_init(&proxy->pci_dev, vdev->nvectors, 1, 0)) {
@@ -735,10 +726,7 @@ static int virtio_blk_init_pci(PCIDevice *pci_dev)
         return -1;
     }
     vdev->nvectors = proxy->nvectors;
-    virtio_init_pci(proxy, vdev,
-                    PCI_VENDOR_ID_REDHAT_QUMRANET,
-                    PCI_DEVICE_ID_VIRTIO_BLOCK,
-                    proxy->class_code, 0x00);
+    virtio_init_pci(proxy, vdev);
     /* make the actual value visible */
     proxy->nvectors = vdev->nvectors;
     return 0;
@@ -776,10 +764,7 @@ static int virtio_serial_init_pci(PCIDevice *pci_dev)
     vdev->nvectors = proxy->nvectors == DEV_NVECTORS_UNSPECIFIED
                                         ? proxy->serial.max_virtserial_ports + 1
                                         : proxy->nvectors;
-    virtio_init_pci(proxy, vdev,
-                    PCI_VENDOR_ID_REDHAT_QUMRANET,
-                    PCI_DEVICE_ID_VIRTIO_CONSOLE,
-                    proxy->class_code, 0x00);
+    virtio_init_pci(proxy, vdev);
     proxy->nvectors = vdev->nvectors;
     return 0;
 }
@@ -801,11 +786,7 @@ static int virtio_net_init_pci(PCIDevice *pci_dev)
     vdev = virtio_net_init(&pci_dev->qdev, &proxy->nic, &proxy->net);
 
     vdev->nvectors = proxy->nvectors;
-    virtio_init_pci(proxy, vdev,
-                    PCI_VENDOR_ID_REDHAT_QUMRANET,
-                    PCI_DEVICE_ID_VIRTIO_NET,
-                    PCI_CLASS_NETWORK_ETHERNET,
-                    0x00);
+    virtio_init_pci(proxy, vdev);
 
     /* make the actual value visible */
     proxy->nvectors = vdev->nvectors;
@@ -827,11 +808,7 @@ static int virtio_balloon_init_pci(PCIDevice *pci_dev)
     VirtIODevice *vdev;
 
     vdev = virtio_balloon_init(&pci_dev->qdev);
-    virtio_init_pci(proxy, vdev,
-                    PCI_VENDOR_ID_REDHAT_QUMRANET,
-                    PCI_DEVICE_ID_VIRTIO_BALLOON,
-                    PCI_CLASS_MEMORY_RAM,
-                    0x00);
+    virtio_init_pci(proxy, vdev);
     return 0;
 }
 
@@ -843,11 +820,7 @@ static int virtio_9p_init_pci(PCIDevice *pci_dev)
 
     vdev = virtio_9p_init(&pci_dev->qdev, &proxy->fsconf);
     vdev->nvectors = proxy->nvectors;
-    virtio_init_pci(proxy, vdev,
-                    PCI_VENDOR_ID_REDHAT_QUMRANET,
-                    0x1009,
-                    0x2,
-                    0x00);
+    virtio_init_pci(proxy, vdev);
     /* make the actual value visible */
     proxy->nvectors = vdev->nvectors;
     return 0;
@@ -861,6 +834,10 @@ static PCIDeviceInfo virtio_info[] = {
         .qdev.size = sizeof(VirtIOPCIProxy),
         .init      = virtio_blk_init_pci,
         .exit      = virtio_blk_exit_pci,
+        .vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET,
+        .device_id = PCI_DEVICE_ID_VIRTIO_BLOCK,
+        .revision  = VIRTIO_PCI_ABI_VERSION,
+        .class_id  = PCI_CLASS_STORAGE_SCSI,
         .qdev.props = (Property[]) {
             DEFINE_PROP_HEX32("class", VirtIOPCIProxy, class_code, 0),
             DEFINE_BLOCK_PROPERTIES(VirtIOPCIProxy, block),
@@ -878,6 +855,10 @@ static PCIDeviceInfo virtio_info[] = {
         .init       = virtio_net_init_pci,
         .exit       = virtio_net_exit_pci,
         .romfile    = "pxe-virtio.rom",
+        .vendor_id  = PCI_VENDOR_ID_REDHAT_QUMRANET,
+        .device_id  = PCI_DEVICE_ID_VIRTIO_NET,
+        .revision   = VIRTIO_PCI_ABI_VERSION,
+        .class_id   = PCI_CLASS_NETWORK_ETHERNET,
         .qdev.props = (Property[]) {
             DEFINE_PROP_BIT("ioeventfd", VirtIOPCIProxy, flags,
                             VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, false),
@@ -898,6 +879,10 @@ static PCIDeviceInfo virtio_info[] = {
         .qdev.size = sizeof(VirtIOPCIProxy),
         .init      = virtio_serial_init_pci,
         .exit      = virtio_serial_exit_pci,
+        .vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET,
+        .device_id = PCI_DEVICE_ID_VIRTIO_CONSOLE,
+        .revision  = VIRTIO_PCI_ABI_VERSION,
+        .class_id  = PCI_CLASS_COMMUNICATION_OTHER,
         .qdev.props = (Property[]) {
             DEFINE_PROP_BIT("ioeventfd", VirtIOPCIProxy, flags,
                             VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, true),
@@ -916,6 +901,10 @@ static PCIDeviceInfo virtio_info[] = {
         .qdev.size = sizeof(VirtIOPCIProxy),
         .init      = virtio_balloon_init_pci,
         .exit      = virtio_exit_pci,
+        .vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET,
+        .device_id = PCI_DEVICE_ID_VIRTIO_BALLOON,
+        .revision  = VIRTIO_PCI_ABI_VERSION,
+        .class_id  = PCI_CLASS_MEMORY_RAM,
         .qdev.props = (Property[]) {
             DEFINE_VIRTIO_COMMON_FEATURES(VirtIOPCIProxy, host_features),
             DEFINE_PROP_END_OF_LIST(),
@@ -927,6 +916,10 @@ static PCIDeviceInfo virtio_info[] = {
         .qdev.alias = "virtio-9p",
         .qdev.size = sizeof(VirtIOPCIProxy),
         .init      = virtio_9p_init_pci,
+        .vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET,
+        .device_id = 0x1009,
+        .revision  = VIRTIO_PCI_ABI_VERSION,
+        .class_id  = 0x2,
         .qdev.props = (Property[]) {
             DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 2),
             DEFINE_VIRTIO_COMMON_FEATURES(VirtIOPCIProxy, host_features),
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* Re: [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code
  2011-05-25  1:57 [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
                   ` (38 preceding siblings ...)
  2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 39/39] virtio-pci.c: convert to PCIDEviceInfo " Isaku Yamahata
@ 2011-06-09  1:56 ` Isaku Yamahata
  2011-06-09 14:57   ` Michael S. Tsirkin
  39 siblings, 1 reply; 42+ messages in thread
From: Isaku Yamahata @ 2011-06-09  1:56 UTC (permalink / raw)
  To: qemu-devel; +Cc: mst

Ping?

On Wed, May 25, 2011 at 10:57:57AM +0900, Isaku Yamahata wrote:
> Okay, here is the v3 as there seems no more comments on the series.
> 
> patch descriptions:
> vender id/device id... in pci configuration space are read-only registers
> which are commonly defined for all pci devices.
> So initialize them in common code and it simplifies the initialization a bit.
> Potentially in the future, qemu would be able to list supported devices
> with device id and so on possibly with more updated description by linking
> libpci.
> 
>  v2 -> v3:
> - eliminated redandant comments
> - converted virtio-pci
> 
> changes v1 -> v2:
> - dropped header_type and prog_interface
> - converted more
> 
> Isaku Yamahata (39):
>   pci: move ids of config space into PCIDeviceInfo
>   usb-uhci: convert to PCIDEviceInfo to initialize ids
>   eepro100: convert to PCIDeviceInfo to initialize ids
>   dec_pci: convert to PCIDeviceInfo to initialize ids
>   apb_pci: convert to PCIDeviceInfo to initialize ids
>   ide/piix: convert to PCIDeviceInfo to initialize ids
>   vmware_vga.c: convert to PCIDeviceInfo to initialize ids
>   hw/ac97.c: convert to PCIDeviceInfo to initialize ids
>   hw/acpi_piix4.c: convert to PCIDeviceInfo to initialize ids
>   hw/bonito.c: convert to PCIDeviceInfo to initialize ids
>   hw/cirrus_vga.c: convert to PCIDeviceInfo to initialize ids
>   hw/e1000.c: convert to PCIDeviceInfo to initialize ids
>   hw/es1370.c: convert to PCIDeviceInfo to initialize ids
>   hw/grackle_pci.c: convert to PCIDeviceInfo to initialize ids
>   hw/gt64xxx.c: convert to PCIDeviceInfo to initialize ids
>   hw/ide/cmd646.c: convert to PCIDeviceInfo to initialize ids
>   hw/ide/ich.c: convert to PCIDeviceInfo to initialize ids
>   hw/ide/via.c: convert to PCIDeviceInfo to initialize ids
>   hw/intel-hda.c: convert to PCIDeviceInfo to initialize ids
>   hw/ioh3420.c: convert to PCIDeviceInfo to initialize ids
>   hw/ivshmem.c: convert to PCIDeviceInfo to initialize ids
>   hw/lsi53c895a.c: convert to PCIDeviceInfo to initialize ids
>   hw/ne2000.c: convert to PCIDeviceInfo to initialize ids
>   hw/pcnet-pci.c: convert to PCIDeviceInfo to initialize ids
>   hw/piix4.c: convert to PCIDeviceInfo to initialize ids
>   hw/piix_pci.c: convert to PCIDeviceInfo to initialize ids
>   hw/qxl.c: convert to PCIDeviceInfo to initialize ids
>   hw/rtl8139.c: convert to PCIDeviceInfo to initialize ids
>   hw/sh_pci.c: convert to PCIDeviceInfo to initialize ids
>   hw/sun4u.c: convert to PCIDeviceInfo to initialize ids
>   hw/unin_pci.c: convert to PCIDeviceInfo to initialize ids
>   hw/usb-ohci.c: convert to PCIDeviceInfo to initialize ids
>   hw/versatile_pci.c: convert to PCIDeviceInfo to initialize ids
>   hw/vga-pci.c: convert to PCIDeviceInfo to initialize ids
>   hw/vt82c686.c: convert to PCIDeviceInfo to initialize ids
>   hw/wdt_i6300esb.c: convert to PCIDeviceInfo to initialize ids
>   hw/xio3130_downstream.c: convert to PCIDeviceInfo to initialize ids
>   hw/xio3130_upstream.c: convert to PCIDeviceInfo to initialize ids
>   virtio-pci.c:  convert to PCIDEviceInfo to initialize ids
> 
>  hw/ac97.c               |    9 ++---
>  hw/acpi_piix4.c         |    8 ++--
>  hw/apb_pci.c            |   13 ++++----
>  hw/bonito.c             |    9 +++--
>  hw/cirrus_vga.c         |   10 +++---
>  hw/dec_pci.c            |   26 ++++------------
>  hw/e1000.c              |    8 ++--
>  hw/eepro100.c           |   74 +++++++++++++++++++++--------------------------
>  hw/es1370.c             |   24 +++++++--------
>  hw/grackle_pci.c        |    8 ++--
>  hw/gt64xxx.c            |    8 ++--
>  hw/ide/cmd646.c         |   10 ++----
>  hw/ide/ich.c            |    9 ++---
>  hw/ide/piix.c           |   32 ++++++--------------
>  hw/ide/via.c            |    8 ++--
>  hw/intel-hda.c          |    8 ++--
>  hw/ioh3420.c            |    7 ++--
>  hw/ivshmem.c            |    8 ++---
>  hw/lsi53c895a.c         |   13 ++------
>  hw/ne2000.c             |    6 ++--
>  hw/pci.c                |   46 ++++++++++++++++++++---------
>  hw/pci.h                |    7 ++++
>  hw/pcnet-pci.c          |    8 ++--
>  hw/piix4.c              |   10 ++----
>  hw/piix_pci.c           |   19 ++++-------
>  hw/qxl.c                |    7 ++--
>  hw/rtl8139.c            |    8 ++--
>  hw/sh_pci.c             |    4 +-
>  hw/sun4u.c              |    8 ++--
>  hw/unin_pci.c           |   33 ++++++++++-----------
>  hw/usb-ohci.c           |    7 ++--
>  hw/usb-uhci.c           |   46 +++++++++++------------------
>  hw/versatile_pci.c      |    8 ++--
>  hw/vga-pci.c            |   11 +++----
>  hw/virtio-pci.c         |   69 +++++++++++++++++++------------------------
>  hw/vmware_vga.c         |   13 ++++----
>  hw/vt82c686.c           |   35 ++++++++++------------
>  hw/wdt_i6300esb.c       |    6 ++--
>  hw/xio3130_downstream.c |    6 ++--
>  hw/xio3130_upstream.c   |    6 ++--
>  40 files changed, 300 insertions(+), 355 deletions(-)
> 
> 

-- 
yamahata

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code
  2011-06-09  1:56 ` [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
@ 2011-06-09 14:57   ` Michael S. Tsirkin
  0 siblings, 0 replies; 42+ messages in thread
From: Michael S. Tsirkin @ 2011-06-09 14:57 UTC (permalink / raw)
  To: Isaku Yamahata; +Cc: qemu-devel

On Thu, Jun 09, 2011 at 10:56:52AM +0900, Isaku Yamahata wrote:
> Ping?

I put this on my tree, it will get in with the next merge,
hope to send that next week.

-- 
MST

^ permalink raw reply	[flat|nested] 42+ messages in thread

end of thread, other threads:[~2011-06-09 14:57 UTC | newest]

Thread overview: 42+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-25  1:57 [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
2011-05-25  1:57 ` [Qemu-devel] [PATCH v3 01/39] pci: move ids of config space into PCIDeviceInfo Isaku Yamahata
2011-05-25  1:57 ` [Qemu-devel] [PATCH v3 02/39] usb-uhci: convert to PCIDEviceInfo to initialize ids Isaku Yamahata
2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 03/39] eepro100: convert to PCIDeviceInfo " Isaku Yamahata
2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 04/39] dec_pci: " Isaku Yamahata
2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 05/39] apb_pci: " Isaku Yamahata
2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 06/39] ide/piix: " Isaku Yamahata
2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 07/39] vmware_vga.c: " Isaku Yamahata
2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 08/39] hw/ac97.c: " Isaku Yamahata
2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 09/39] hw/acpi_piix4.c: " Isaku Yamahata
2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 10/39] hw/bonito.c: " Isaku Yamahata
2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 11/39] hw/cirrus_vga.c: " Isaku Yamahata
2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 12/39] hw/e1000.c: " Isaku Yamahata
2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 13/39] hw/es1370.c: " Isaku Yamahata
2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 14/39] hw/grackle_pci.c: " Isaku Yamahata
2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 15/39] hw/gt64xxx.c: " Isaku Yamahata
2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 16/39] hw/ide/cmd646.c: " Isaku Yamahata
2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 17/39] hw/ide/ich.c: " Isaku Yamahata
2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 18/39] hw/ide/via.c: " Isaku Yamahata
2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 19/39] hw/intel-hda.c: " Isaku Yamahata
2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 20/39] hw/ioh3420.c: " Isaku Yamahata
2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 21/39] hw/ivshmem.c: " Isaku Yamahata
2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 22/39] hw/lsi53c895a.c: " Isaku Yamahata
2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 23/39] hw/ne2000.c: " Isaku Yamahata
2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 24/39] hw/pcnet-pci.c: " Isaku Yamahata
2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 25/39] hw/piix4.c: " Isaku Yamahata
2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 26/39] hw/piix_pci.c: " Isaku Yamahata
2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 27/39] hw/qxl.c: " Isaku Yamahata
2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 28/39] hw/rtl8139.c: " Isaku Yamahata
2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 29/39] hw/sh_pci.c: " Isaku Yamahata
2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 30/39] hw/sun4u.c: " Isaku Yamahata
2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 31/39] hw/unin_pci.c: " Isaku Yamahata
2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 32/39] hw/usb-ohci.c: " Isaku Yamahata
2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 33/39] hw/versatile_pci.c: " Isaku Yamahata
2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 34/39] hw/vga-pci.c: " Isaku Yamahata
2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 35/39] hw/vt82c686.c: " Isaku Yamahata
2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 36/39] hw/wdt_i6300esb.c: " Isaku Yamahata
2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 37/39] hw/xio3130_downstream.c: " Isaku Yamahata
2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 38/39] hw/xio3130_upstream.c: " Isaku Yamahata
2011-05-25  1:58 ` [Qemu-devel] [PATCH v3 39/39] virtio-pci.c: convert to PCIDEviceInfo " Isaku Yamahata
2011-06-09  1:56 ` [Qemu-devel] [PATCH v3 00/39] pci: initialize ids in pci common code Isaku Yamahata
2011-06-09 14:57   ` Michael S. Tsirkin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.