qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [RFC PATCH 0/6] pci cleanup: remove pci_config_set_*
@ 2014-11-05  9:50 Hu Tao
  2014-11-05  9:50 ` [Qemu-devel] [PATCH 1/6] pci: remove pci_config_set_vendor_id Hu Tao
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Hu Tao @ 2014-11-05  9:50 UTC (permalink / raw)
  To: qemu-devel

Hi,

This series removes pci_config_set_*.  The main purpose is for API
consistency. Detailed reasons:

  - pci_config_set_* are not complete. 1) Only part of registers in
    predefined header portion of PCI Configuration Space are
    supported. 2) Lack of get_ counterparts.

  - pci_set_word() and friends are extensively used in qemu. They
    are used both for predefined registers and device specific
    registers.

  - another option is to complete the pci_config_set_* for all
    predefined registers (though they will co-exist with pci_set_*).
    Hence the RFC.

Hu Tao (6):
  pci: remove pci_config_set_vendor_id
  pci: remove pci_config_set_device_id
  pci: remove pci_config_set_revision
  pci: remove pci_config_set_class
  pci: remove pci_config_set_prog_interface
  pci: remove pci_config_set_interrupt_pin

 hw/audio/intel-hda.c       |  2 +-
 hw/block/nvme.c            |  4 ++--
 hw/i2c/smbus_ich9.c        |  2 +-
 hw/i386/xen/xen_platform.c |  2 +-
 hw/i386/xen/xen_pvdevice.c |  2 +-
 hw/ide/ich.c               |  4 ++--
 hw/ide/via.c               |  2 +-
 hw/isa/i82378.c            |  2 +-
 hw/isa/vt82c686.c          |  2 +-
 hw/mips/gt64xxx_pci.c      |  2 +-
 hw/misc/ivshmem.c          |  2 +-
 hw/misc/vfio.c             |  2 +-
 hw/pci-bridge/i82801b11.c  |  2 +-
 hw/pci-host/bonito.c       |  2 +-
 hw/pci-host/ppce500.c      |  2 +-
 hw/pci/pci.c               |  8 ++++----
 hw/pci/pci_bridge.c        |  2 +-
 hw/scsi/vmw_pvscsi.c       |  2 +-
 hw/usb/hcd-uhci.c          |  2 +-
 hw/virtio/virtio-pci.c     |  2 +-
 include/hw/pci/pci.h       | 36 ------------------------------------
 21 files changed, 25 insertions(+), 61 deletions(-)

-- 
1.9.3

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

* [Qemu-devel] [PATCH 1/6] pci: remove pci_config_set_vendor_id
  2014-11-05  9:50 [Qemu-devel] [RFC PATCH 0/6] pci cleanup: remove pci_config_set_* Hu Tao
@ 2014-11-05  9:50 ` Hu Tao
  2014-11-05  9:50 ` [Qemu-devel] [PATCH 2/6] pci: remove pci_config_set_device_id Hu Tao
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Hu Tao @ 2014-11-05  9:50 UTC (permalink / raw)
  To: qemu-devel

Use pci_set_word() instead. The main purpose is for API
consistency. Detailed reasons:

  - pci_config_set_* are not complete. 1) Only part of registers in
    predefined header portion of PCI Configuration Space are
    supported. 2) Lack of get_ counterparts.

  - pci_set_word() and friends are extensively used in qemu. They
    are used both for predefined registers and device specific
    registers.

  - another option is to complete the pci_config_set_* for all
    predefined registers (though they will co-exist with pci_set_*).
    Hence the RFC.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
---
 hw/pci/pci.c         | 2 +-
 include/hw/pci/pci.h | 6 ------
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 371699c..6c544ed 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -840,7 +840,7 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
     pci_dev->irq_state = 0;
     pci_config_alloc(pci_dev);
 
-    pci_config_set_vendor_id(pci_dev->config, pc->vendor_id);
+    pci_set_word(pci_dev->config + PCI_VENDOR_ID, pc->vendor_id);
     pci_config_set_device_id(pci_dev->config, pc->device_id);
     pci_config_set_revision(pci_dev->config, pc->revision);
     pci_config_set_class(pci_dev->config, pc->class_id);
diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index c352c7b..390aa83 100644
--- a/include/hw/pci/pci.h
+++ b/include/hw/pci/pci.h
@@ -462,12 +462,6 @@ pci_get_quad(const uint8_t *config)
 }
 
 static inline void
-pci_config_set_vendor_id(uint8_t *pci_config, uint16_t val)
-{
-    pci_set_word(&pci_config[PCI_VENDOR_ID], val);
-}
-
-static inline void
 pci_config_set_device_id(uint8_t *pci_config, uint16_t val)
 {
     pci_set_word(&pci_config[PCI_DEVICE_ID], val);
-- 
1.9.3

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

* [Qemu-devel] [PATCH 2/6] pci: remove pci_config_set_device_id
  2014-11-05  9:50 [Qemu-devel] [RFC PATCH 0/6] pci cleanup: remove pci_config_set_* Hu Tao
  2014-11-05  9:50 ` [Qemu-devel] [PATCH 1/6] pci: remove pci_config_set_vendor_id Hu Tao
@ 2014-11-05  9:50 ` Hu Tao
  2014-11-05  9:50 ` [Qemu-devel] [PATCH 3/6] pci: remove pci_config_set_revision Hu Tao
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Hu Tao @ 2014-11-05  9:50 UTC (permalink / raw)
  To: qemu-devel

See also commit 'pci: remove pci_config_set_vendor_id'.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
---
 hw/pci/pci.c         | 2 +-
 include/hw/pci/pci.h | 6 ------
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 6c544ed..e5d192d 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -841,7 +841,7 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
     pci_config_alloc(pci_dev);
 
     pci_set_word(pci_dev->config + PCI_VENDOR_ID, pc->vendor_id);
-    pci_config_set_device_id(pci_dev->config, pc->device_id);
+    pci_set_word(pci_dev->config + PCI_DEVICE_ID, pc->device_id);
     pci_config_set_revision(pci_dev->config, pc->revision);
     pci_config_set_class(pci_dev->config, pc->class_id);
 
diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index 390aa83..b659192 100644
--- a/include/hw/pci/pci.h
+++ b/include/hw/pci/pci.h
@@ -462,12 +462,6 @@ pci_get_quad(const uint8_t *config)
 }
 
 static inline void
-pci_config_set_device_id(uint8_t *pci_config, uint16_t val)
-{
-    pci_set_word(&pci_config[PCI_DEVICE_ID], val);
-}
-
-static inline void
 pci_config_set_revision(uint8_t *pci_config, uint8_t val)
 {
     pci_set_byte(&pci_config[PCI_REVISION_ID], val);
-- 
1.9.3

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

* [Qemu-devel] [PATCH 3/6] pci: remove pci_config_set_revision
  2014-11-05  9:50 [Qemu-devel] [RFC PATCH 0/6] pci cleanup: remove pci_config_set_* Hu Tao
  2014-11-05  9:50 ` [Qemu-devel] [PATCH 1/6] pci: remove pci_config_set_vendor_id Hu Tao
  2014-11-05  9:50 ` [Qemu-devel] [PATCH 2/6] pci: remove pci_config_set_device_id Hu Tao
@ 2014-11-05  9:50 ` Hu Tao
  2014-11-05  9:50 ` [Qemu-devel] [PATCH 4/6] pci: remove pci_config_set_class Hu Tao
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Hu Tao @ 2014-11-05  9:50 UTC (permalink / raw)
  To: qemu-devel

See also commit 'pci: remove pci_config_set_vendor_id'.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
---
 hw/pci/pci.c         | 2 +-
 include/hw/pci/pci.h | 6 ------
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index e5d192d..fdab941 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -842,7 +842,7 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
 
     pci_set_word(pci_dev->config + PCI_VENDOR_ID, pc->vendor_id);
     pci_set_word(pci_dev->config + PCI_DEVICE_ID, pc->device_id);
-    pci_config_set_revision(pci_dev->config, pc->revision);
+    pci_set_byte(pci_dev->config + PCI_REVISION_ID, pc->revision);
     pci_config_set_class(pci_dev->config, pc->class_id);
 
     if (!pc->is_bridge) {
diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index b659192..5106b44 100644
--- a/include/hw/pci/pci.h
+++ b/include/hw/pci/pci.h
@@ -462,12 +462,6 @@ pci_get_quad(const uint8_t *config)
 }
 
 static inline void
-pci_config_set_revision(uint8_t *pci_config, uint8_t val)
-{
-    pci_set_byte(&pci_config[PCI_REVISION_ID], val);
-}
-
-static inline void
 pci_config_set_class(uint8_t *pci_config, uint16_t val)
 {
     pci_set_word(&pci_config[PCI_CLASS_DEVICE], val);
-- 
1.9.3

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

* [Qemu-devel] [PATCH 4/6] pci: remove pci_config_set_class
  2014-11-05  9:50 [Qemu-devel] [RFC PATCH 0/6] pci cleanup: remove pci_config_set_* Hu Tao
                   ` (2 preceding siblings ...)
  2014-11-05  9:50 ` [Qemu-devel] [PATCH 3/6] pci: remove pci_config_set_revision Hu Tao
@ 2014-11-05  9:50 ` Hu Tao
  2014-11-05  9:50 ` [Qemu-devel] [PATCH 5/6] pci: remove pci_config_set_prog_interface Hu Tao
  2014-11-05  9:50 ` [Qemu-devel] [PATCH 6/6] pci: remove pci_config_set_interrupt_pin Hu Tao
  5 siblings, 0 replies; 7+ messages in thread
From: Hu Tao @ 2014-11-05  9:50 UTC (permalink / raw)
  To: qemu-devel

See also commit 'pci: remove pci_config_set_vendor_id'.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
---
 hw/block/nvme.c        | 2 +-
 hw/pci-host/ppce500.c  | 2 +-
 hw/pci/pci.c           | 2 +-
 hw/pci/pci_bridge.c    | 2 +-
 hw/virtio/virtio-pci.c | 2 +-
 include/hw/pci/pci.h   | 6 ------
 6 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index b6263dc..8d7ed78 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -768,7 +768,7 @@ static int nvme_init(PCIDevice *pci_dev)
     pci_conf = pci_dev->config;
     pci_conf[PCI_INTERRUPT_PIN] = 1;
     pci_config_set_prog_interface(pci_dev->config, 0x2);
-    pci_config_set_class(pci_dev->config, PCI_CLASS_STORAGE_EXPRESS);
+    pci_set_word(pci_dev->config + PCI_CLASS_DEVICE, PCI_CLASS_STORAGE_EXPRESS);
     pcie_endpoint_cap_init(&n->parent_obj, 0x80);
 
     n->num_namespaces = 1;
diff --git a/hw/pci-host/ppce500.c b/hw/pci-host/ppce500.c
index 1b4c0f0..aa4ed76 100644
--- a/hw/pci-host/ppce500.c
+++ b/hw/pci-host/ppce500.c
@@ -337,7 +337,7 @@ static int e500_pcihost_bridge_initfn(PCIDevice *d)
     PPCE500CCSRState *ccsr = CCSR(container_get(qdev_get_machine(),
                                   "/e500-ccsr"));
 
-    pci_config_set_class(d->config, PCI_CLASS_BRIDGE_PCI);
+    pci_set_word(d->config + PCI_CLASS_DEVICE, PCI_CLASS_BRIDGE_PCI);
     d->config[PCI_HEADER_TYPE] =
         (d->config[PCI_HEADER_TYPE] & PCI_HEADER_TYPE_MULTI_FUNCTION) |
         PCI_HEADER_TYPE_BRIDGE;
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index fdab941..05f8c9e 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -843,7 +843,7 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
     pci_set_word(pci_dev->config + PCI_VENDOR_ID, pc->vendor_id);
     pci_set_word(pci_dev->config + PCI_DEVICE_ID, pc->device_id);
     pci_set_byte(pci_dev->config + PCI_REVISION_ID, pc->revision);
-    pci_config_set_class(pci_dev->config, pc->class_id);
+    pci_set_word(pci_dev->config + PCI_CLASS_DEVICE, pc->class_id);
 
     if (!pc->is_bridge) {
         if (pc->subsystem_vendor_id || pc->subsystem_id) {
diff --git a/hw/pci/pci_bridge.c b/hw/pci/pci_bridge.c
index 40c97b1..04a5c10 100644
--- a/hw/pci/pci_bridge.c
+++ b/hw/pci/pci_bridge.c
@@ -350,7 +350,7 @@ int pci_bridge_initfn(PCIDevice *dev, const char *typename)
      *                            PCI_COMMAND_VGA_PALETTE);
      */
 
-    pci_config_set_class(dev->config, PCI_CLASS_BRIDGE_PCI);
+    pci_set_word(dev->config + PCI_CLASS_DEVICE, PCI_CLASS_BRIDGE_PCI);
     dev->config[PCI_HEADER_TYPE] =
         (dev->config[PCI_HEADER_TYPE] & PCI_HEADER_TYPE_MULTI_FUNCTION) |
         PCI_HEADER_TYPE_BRIDGE;
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index dde1d73..c1bf96c 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -965,7 +965,7 @@ static void virtio_pci_device_plugged(DeviceState *d)
 
     config = proxy->pci_dev.config;
     if (proxy->class_code) {
-        pci_config_set_class(config, proxy->class_code);
+        pci_set_word(config + PCI_CLASS_DEVICE, proxy->class_code);
     }
     pci_set_word(config + PCI_SUBSYSTEM_VENDOR_ID,
                  pci_get_word(config + PCI_VENDOR_ID));
diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index 5106b44..eb9a2c3 100644
--- a/include/hw/pci/pci.h
+++ b/include/hw/pci/pci.h
@@ -462,12 +462,6 @@ pci_get_quad(const uint8_t *config)
 }
 
 static inline void
-pci_config_set_class(uint8_t *pci_config, uint16_t val)
-{
-    pci_set_word(&pci_config[PCI_CLASS_DEVICE], val);
-}
-
-static inline void
 pci_config_set_prog_interface(uint8_t *pci_config, uint8_t val)
 {
     pci_set_byte(&pci_config[PCI_CLASS_PROG], val);
-- 
1.9.3

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

* [Qemu-devel] [PATCH 5/6] pci: remove pci_config_set_prog_interface
  2014-11-05  9:50 [Qemu-devel] [RFC PATCH 0/6] pci cleanup: remove pci_config_set_* Hu Tao
                   ` (3 preceding siblings ...)
  2014-11-05  9:50 ` [Qemu-devel] [PATCH 4/6] pci: remove pci_config_set_class Hu Tao
@ 2014-11-05  9:50 ` Hu Tao
  2014-11-05  9:50 ` [Qemu-devel] [PATCH 6/6] pci: remove pci_config_set_interrupt_pin Hu Tao
  5 siblings, 0 replies; 7+ messages in thread
From: Hu Tao @ 2014-11-05  9:50 UTC (permalink / raw)
  To: qemu-devel

See also commit 'pci: remove pci_config_set_vendor_id'.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
---
 hw/block/nvme.c            | 2 +-
 hw/i386/xen/xen_platform.c | 2 +-
 hw/i386/xen/xen_pvdevice.c | 2 +-
 hw/ide/ich.c               | 2 +-
 hw/ide/via.c               | 2 +-
 hw/isa/vt82c686.c          | 2 +-
 hw/mips/gt64xxx_pci.c      | 2 +-
 hw/pci-bridge/i82801b11.c  | 2 +-
 hw/pci-host/bonito.c       | 2 +-
 include/hw/pci/pci.h       | 6 ------
 10 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index 8d7ed78..d9bc149 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -767,7 +767,7 @@ static int nvme_init(PCIDevice *pci_dev)
 
     pci_conf = pci_dev->config;
     pci_conf[PCI_INTERRUPT_PIN] = 1;
-    pci_config_set_prog_interface(pci_dev->config, 0x2);
+    pci_set_byte(pci_dev->config + PCI_CLASS_PROG, 0x2);
     pci_set_word(pci_dev->config + PCI_CLASS_DEVICE, PCI_CLASS_STORAGE_EXPRESS);
     pcie_endpoint_cap_init(&n->parent_obj, 0x80);
 
diff --git a/hw/i386/xen/xen_platform.c b/hw/i386/xen/xen_platform.c
index 28b324a..bcf7038 100644
--- a/hw/i386/xen/xen_platform.c
+++ b/hw/i386/xen/xen_platform.c
@@ -393,7 +393,7 @@ static int xen_platform_initfn(PCIDevice *dev)
 
     pci_set_word(pci_conf + PCI_COMMAND, PCI_COMMAND_IO | PCI_COMMAND_MEMORY);
 
-    pci_config_set_prog_interface(pci_conf, 0);
+    pci_set_byte(pci_conf + PCI_CLASS_PROG, 0);
 
     pci_conf[PCI_INTERRUPT_PIN] = 1;
 
diff --git a/hw/i386/xen/xen_pvdevice.c b/hw/i386/xen/xen_pvdevice.c
index c218947..7ebc919 100644
--- a/hw/i386/xen/xen_pvdevice.c
+++ b/hw/i386/xen/xen_pvdevice.c
@@ -88,7 +88,7 @@ static int xen_pv_init(PCIDevice *pci_dev)
 
     pci_set_word(pci_conf + PCI_COMMAND, PCI_COMMAND_MEMORY);
 
-    pci_config_set_prog_interface(pci_conf, 0);
+    pci_set_byte(pci_conf + PCI_CLASS_PROG, 0);
 
     pci_conf[PCI_INTERRUPT_PIN] = 1;
 
diff --git a/hw/ide/ich.c b/hw/ide/ich.c
index fb1d095..0263579 100644
--- a/hw/ide/ich.c
+++ b/hw/ide/ich.c
@@ -107,7 +107,7 @@ static int pci_ich9_ahci_init(PCIDevice *dev)
 
     ahci_init(&d->ahci, DEVICE(dev), pci_get_address_space(dev), 6);
 
-    pci_config_set_prog_interface(dev->config, AHCI_PROGMODE_MAJOR_REV_1);
+    pci_set_byte(dev->config + PCI_CLASS_PROG, AHCI_PROGMODE_MAJOR_REV_1);
 
     dev->config[PCI_CACHE_LINE_SIZE] = 0x08;  /* Cache line size */
     dev->config[PCI_LATENCY_TIMER]   = 0x00;  /* Latency timer */
diff --git a/hw/ide/via.c b/hw/ide/via.c
index 4d8089d..bd80821 100644
--- a/hw/ide/via.c
+++ b/hw/ide/via.c
@@ -177,7 +177,7 @@ static int vt82c686b_ide_initfn(PCIDevice *dev)
     PCIIDEState *d = PCI_IDE(dev);
     uint8_t *pci_conf = dev->config;
 
-    pci_config_set_prog_interface(pci_conf, 0x8a); /* legacy ATA mode */
+    pci_set_byte(pci_conf + PCI_CLASS_PROG, 0x8a); /* legacy ATA mode */
     pci_set_long(pci_conf + PCI_CAPABILITY_LIST, 0x000000c0);
 
     qemu_register_reset(via_reset, d);
diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c
index e0c235c..773d102 100644
--- a/hw/isa/vt82c686.c
+++ b/hw/isa/vt82c686.c
@@ -435,7 +435,7 @@ static int vt82c686b_initfn(PCIDevice *d)
     isa_bus = isa_bus_new(&d->qdev, pci_address_space_io(d));
 
     pci_conf = d->config;
-    pci_config_set_prog_interface(pci_conf, 0x0);
+    pci_set_byte(pci_conf + PCI_CLASS_PROG, 0x0);
 
     wmask = d->wmask;
     for (i = 0x00; i < 0xff; i++) {
diff --git a/hw/mips/gt64xxx_pci.c b/hw/mips/gt64xxx_pci.c
index 1f2fe5f..02488b0 100644
--- a/hw/mips/gt64xxx_pci.c
+++ b/hw/mips/gt64xxx_pci.c
@@ -1157,7 +1157,7 @@ static int gt64120_pci_init(PCIDevice *d)
     pci_set_word(d->config + PCI_COMMAND, 0);
     pci_set_word(d->config + PCI_STATUS,
                  PCI_STATUS_FAST_BACK | PCI_STATUS_DEVSEL_MEDIUM);
-    pci_config_set_prog_interface(d->config, 0);
+    pci_set_byte(d->config + PCI_CLASS_PROG, 0);
     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);
diff --git a/hw/pci-bridge/i82801b11.c b/hw/pci-bridge/i82801b11.c
index 14cd7fd..79e5445 100644
--- a/hw/pci-bridge/i82801b11.c
+++ b/hw/pci-bridge/i82801b11.c
@@ -71,7 +71,7 @@ static int i82801b11_bridge_initfn(PCIDevice *d)
     if (rc < 0) {
         goto err_bridge;
     }
-    pci_config_set_prog_interface(d->config, PCI_CLASS_BRIDGE_PCI_INF_SUB);
+    pci_set_byte(d->config + PCI_CLASS_PROG, PCI_CLASS_BRIDGE_PCI_INF_SUB);
     return 0;
 
 err_bridge:
diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c
index 56292ad..061fe8c 100644
--- a/hw/pci-host/bonito.c
+++ b/hw/pci-host/bonito.c
@@ -712,7 +712,7 @@ static int bonito_initfn(PCIDevice *dev)
     PCIHostState *phb = PCI_HOST_BRIDGE(s->pcihost);
 
     /* Bonito North Bridge, built on FPGA, VENDOR_ID/DEVICE_ID are "undefined" */
-    pci_config_set_prog_interface(dev->config, 0x00);
+    pci_set_byte(dev->config + PCI_CLASS_PROG, 0x00);
 
     /* set the north bridge register mapping */
     memory_region_init_io(&s->iomem, OBJECT(s), &bonito_ops, s,
diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index eb9a2c3..1294e23 100644
--- a/include/hw/pci/pci.h
+++ b/include/hw/pci/pci.h
@@ -462,12 +462,6 @@ pci_get_quad(const uint8_t *config)
 }
 
 static inline void
-pci_config_set_prog_interface(uint8_t *pci_config, uint8_t val)
-{
-    pci_set_byte(&pci_config[PCI_CLASS_PROG], val);
-}
-
-static inline void
 pci_config_set_interrupt_pin(uint8_t *pci_config, uint8_t val)
 {
     pci_set_byte(&pci_config[PCI_INTERRUPT_PIN], val);
-- 
1.9.3

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

* [Qemu-devel] [PATCH 6/6] pci: remove pci_config_set_interrupt_pin
  2014-11-05  9:50 [Qemu-devel] [RFC PATCH 0/6] pci cleanup: remove pci_config_set_* Hu Tao
                   ` (4 preceding siblings ...)
  2014-11-05  9:50 ` [Qemu-devel] [PATCH 5/6] pci: remove pci_config_set_prog_interface Hu Tao
@ 2014-11-05  9:50 ` Hu Tao
  5 siblings, 0 replies; 7+ messages in thread
From: Hu Tao @ 2014-11-05  9:50 UTC (permalink / raw)
  To: qemu-devel

See also commit 'pci: remove pci_config_set_vendor_id'.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
---
 hw/audio/intel-hda.c | 2 +-
 hw/i2c/smbus_ich9.c  | 2 +-
 hw/ide/ich.c         | 2 +-
 hw/isa/i82378.c      | 2 +-
 hw/misc/ivshmem.c    | 2 +-
 hw/misc/vfio.c       | 2 +-
 hw/scsi/vmw_pvscsi.c | 2 +-
 hw/usb/hcd-uhci.c    | 2 +-
 include/hw/pci/pci.h | 6 ------
 9 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c
index 2885231..50ff3dd 100644
--- a/hw/audio/intel-hda.c
+++ b/hw/audio/intel-hda.c
@@ -1133,7 +1133,7 @@ static int intel_hda_init(PCIDevice *pci)
 
     d->name = object_get_typename(OBJECT(d));
 
-    pci_config_set_interrupt_pin(conf, 1);
+    pci_set_byte(conf + PCI_INTERRUPT_PIN, 1);
 
     /* HDCTL off 0x40 bit 0 selects signaling mode (1-HDA, 0 - Ac97) 18.1.19 */
     conf[0x40] = 0x01;
diff --git a/hw/i2c/smbus_ich9.c b/hw/i2c/smbus_ich9.c
index 0803dc4..ce14450 100644
--- a/hw/i2c/smbus_ich9.c
+++ b/hw/i2c/smbus_ich9.c
@@ -76,7 +76,7 @@ static int ich9_smbus_initfn(PCIDevice *d)
     ICH9SMBState *s = ICH9_SMB_DEVICE(d);
 
     /* TODO? D31IP.SMIP in chipset configuration space */
-    pci_config_set_interrupt_pin(d->config, 0x01); /* interrupt pin 1 */
+    pci_set_byte(d->config + PCI_INTERRUPT_PIN, 0x01); /* interrupt pin 1 */
 
     pci_set_byte(d->config + ICH9_SMB_HOSTC, 0);
     /* TODO bar0, bar1: 64bit BAR support*/
diff --git a/hw/ide/ich.c b/hw/ide/ich.c
index 0263579..0be60f6 100644
--- a/hw/ide/ich.c
+++ b/hw/ide/ich.c
@@ -111,7 +111,7 @@ static int pci_ich9_ahci_init(PCIDevice *dev)
 
     dev->config[PCI_CACHE_LINE_SIZE] = 0x08;  /* Cache line size */
     dev->config[PCI_LATENCY_TIMER]   = 0x00;  /* Latency timer */
-    pci_config_set_interrupt_pin(dev->config, 1);
+    pci_set_byte(dev->config + PCI_INTERRUPT_PIN, 1);
 
     /* XXX Software should program this register */
     dev->config[0x90]   = 1 << 6; /* Address Map Register - AHCI mode */
diff --git a/hw/isa/i82378.c b/hw/isa/i82378.c
index a7d9aa6..7399121 100644
--- a/hw/isa/i82378.c
+++ b/hw/isa/i82378.c
@@ -73,7 +73,7 @@ static int i82378_initfn(PCIDevice *pci)
     pci_set_word(pci_conf + PCI_STATUS,
                  PCI_STATUS_DEVSEL_MEDIUM);
 
-    pci_config_set_interrupt_pin(pci_conf, 1); /* interrupt pin 0 */
+    pci_set_byte(pci_conf + PCI_INTERRUPT_PIN, 1); /* interrupt pin 0 */
 
     isabus = isa_bus_new(dev, pci_address_space_io(pci));
 
diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
index 5d272c8..06573ea 100644
--- a/hw/misc/ivshmem.c
+++ b/hw/misc/ivshmem.c
@@ -747,7 +747,7 @@ static int pci_ivshmem_init(PCIDevice *dev)
     pci_conf = dev->config;
     pci_conf[PCI_COMMAND] = PCI_COMMAND_IO | PCI_COMMAND_MEMORY;
 
-    pci_config_set_interrupt_pin(pci_conf, 1);
+    pci_set_byte(pci_conf + PCI_INTERRUPT_PIN, 1);
 
     s->shm_fd = 0;
 
diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c
index fd318a1..151d77e 100644
--- a/hw/misc/vfio.c
+++ b/hw/misc/vfio.c
@@ -561,7 +561,7 @@ static int vfio_enable_intx(VFIODevice *vdev)
     vfio_disable_interrupts(vdev);
 
     vdev->intx.pin = pin - 1; /* Pin A (1) -> irq[0] */
-    pci_config_set_interrupt_pin(vdev->pdev.config, pin);
+    pci_set_byte(vdev->pdev.config + PCI_INTERRUPT_PIN, pin);
 
 #ifdef CONFIG_KVM
     /*
diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c
index d3a92fb..6f3a48d 100644
--- a/hw/scsi/vmw_pvscsi.c
+++ b/hw/scsi/vmw_pvscsi.c
@@ -1077,7 +1077,7 @@ pvscsi_init(PCIDevice *pci_dev)
     pci_dev->config[PCI_LATENCY_TIMER] = 0xff;
 
     /* Interrupt pin A */
-    pci_config_set_interrupt_pin(pci_dev->config, 1);
+    pci_set_byte(pci_dev->config + PCI_INTERRUPT_PIN, 1);
 
     memory_region_init_io(&s->io_space, OBJECT(s), &pvscsi_ops, s,
                           "pvscsi-io", PVSCSI_MEM_SPACE_SIZE);
diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c
index 4a4215d..4e2efd9 100644
--- a/hw/usb/hcd-uhci.c
+++ b/hw/usb/hcd-uhci.c
@@ -1202,7 +1202,7 @@ static int usb_uhci_common_initfn(PCIDevice *dev)
     /* TODO: reset value should be 0. */
     pci_conf[USB_SBRN] = USB_RELEASE_1; // release number
 
-    pci_config_set_interrupt_pin(pci_conf, u->info.irq_pin + 1);
+    pci_set_byte(pci_conf + PCI_INTERRUPT_PIN, u->info.irq_pin + 1);
 
     if (s->masterbus) {
         USBPort *ports[NB_PORTS];
diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index 1294e23..1da4be7 100644
--- a/include/hw/pci/pci.h
+++ b/include/hw/pci/pci.h
@@ -461,12 +461,6 @@ pci_get_quad(const uint8_t *config)
     return le64_to_cpup((const uint64_t *)config);
 }
 
-static inline void
-pci_config_set_interrupt_pin(uint8_t *pci_config, uint8_t val)
-{
-    pci_set_byte(&pci_config[PCI_INTERRUPT_PIN], val);
-}
-
 /*
  * helper functions to do bit mask operation on configuration space.
  * Just to set bit, use test-and-set and discard returned value.
-- 
1.9.3

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

end of thread, other threads:[~2014-11-05  9:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-05  9:50 [Qemu-devel] [RFC PATCH 0/6] pci cleanup: remove pci_config_set_* Hu Tao
2014-11-05  9:50 ` [Qemu-devel] [PATCH 1/6] pci: remove pci_config_set_vendor_id Hu Tao
2014-11-05  9:50 ` [Qemu-devel] [PATCH 2/6] pci: remove pci_config_set_device_id Hu Tao
2014-11-05  9:50 ` [Qemu-devel] [PATCH 3/6] pci: remove pci_config_set_revision Hu Tao
2014-11-05  9:50 ` [Qemu-devel] [PATCH 4/6] pci: remove pci_config_set_class Hu Tao
2014-11-05  9:50 ` [Qemu-devel] [PATCH 5/6] pci: remove pci_config_set_prog_interface Hu Tao
2014-11-05  9:50 ` [Qemu-devel] [PATCH 6/6] pci: remove pci_config_set_interrupt_pin Hu Tao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).