aboutsummaryrefslogtreecommitdiffstats
path: root/hw/pci_bridge.c
diff options
context:
space:
mode:
authorIsaku Yamahata <yamahata@valinux.co.jp>2010-09-06 16:46:17 +0900
committerMichael S. Tsirkin <mst@redhat.com>2010-09-07 20:10:04 +0300
commitf4c817e000e50e9a0db8f95ce6496628bd70733d (patch)
tree3747b5a010f23a7ee352561a574eab7e7a4ef0d3 /hw/pci_bridge.c
parentca77089d2d8e73283bfc73f03d954504561e1ce8 (diff)
pci bridge: add helper function for ssvid capability.
helper function to add ssvid capability. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/pci_bridge.c')
-rw-r--r--hw/pci_bridge.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/hw/pci_bridge.c b/hw/pci_bridge.c
index 198c3c790..638e3b35e 100644
--- a/hw/pci_bridge.c
+++ b/hw/pci_bridge.c
@@ -32,6 +32,25 @@
#include "pci_bridge.h"
#include "pci_internals.h"
+/* PCI bridge subsystem vendor ID helper functions */
+#define PCI_SSVID_SIZEOF 8
+#define PCI_SSVID_SVID 4
+#define PCI_SSVID_SSID 6
+
+int pci_bridge_ssvid_init(PCIDevice *dev, uint8_t offset,
+ uint16_t svid, uint16_t ssid)
+{
+ int pos;
+ pos = pci_add_capability(dev, PCI_CAP_ID_SSVID, offset, PCI_SSVID_SIZEOF);
+ if (pos < 0) {
+ return pos;
+ }
+
+ pci_set_word(dev->config + pos + PCI_SSVID_SVID, svid);
+ pci_set_word(dev->config + pos + PCI_SSVID_SSID, ssid);
+ return pos;
+}
+
/* Accessor function to get parent bridge device from pci bus. */
PCIDevice *pci_bridge_get_device(PCIBus *bus)
{