[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 22/29] pci_bridge_dev: add qom property for pci-brid
From: |
Michael Roth |
Subject: |
[Qemu-devel] [PATCH 22/29] pci_bridge_dev: add qom property for pci-bridge state |
Date: |
Thu, 1 Nov 2012 08:04:24 -0500 |
Signed-off-by: Michael Roth <address@hidden>
---
hw/pci.c | 1 +
hw/pci.h | 3 ++-
hw/pci_bridge_dev.c | 29 +++++++++++++++++++++++++++++
3 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/hw/pci.c b/hw/pci.c
index e0b3f4f..d27659c 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -35,6 +35,7 @@
#include "msix.h"
#include "exec-memory.h"
#include "qidl.h"
+#include "shpc.h"
QIDL_ENABLE()
diff --git a/hw/pci.h b/hw/pci.h
index e356fbd..9a08ebc 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -263,7 +263,8 @@ QIDL_DECLARE_PUBLIC(PCIDevice) {
PCIExpressDevice q_broken exp; /* TODO: qidl, is PCIEAERLog guest-visible?
*/
/* SHPC */
- SHPCDevice q_broken *shpc; /* TODO: qidl, needed for pci-bridge support */
+ bool has_shpc;
+ SHPCDevice *shpc q_optional;
/* Location of option rom */
char q_property("romfile") *romfile;
diff --git a/hw/pci_bridge_dev.c b/hw/pci_bridge_dev.c
index d793857..c89b04f 100644
--- a/hw/pci_bridge_dev.c
+++ b/hw/pci_bridge_dev.c
@@ -28,6 +28,8 @@
#include "pci_internals.h"
#include "qidl.h"
+QIDL_ENABLE()
+
#define REDHAT_PCI_VENDOR_ID 0x1b36
#define PCI_BRIDGE_DEV_VENDOR_ID REDHAT_PCI_VENDOR_ID
#define PCI_BRIDGE_DEV_DEVICE_ID 0x1
@@ -50,6 +52,28 @@ static int pci_bridge_dev_map_irq_fn(PCIDevice *dev, int
irq_num)
return (irq_num + PCI_SLOT(dev->devfn)) % PCI_NUM_PINS;
}
+static void pci_bridge_dev_get_state(Object *obj, Visitor *v, void *opaque,
+ const char *name, Error **errp)
+{
+ PCIDevice *pci = PCI_DEVICE(obj);
+ PCIBridge *br = DO_UPCAST(PCIBridge, dev, pci);
+ PCIBridgeDev *d = DO_UPCAST(PCIBridgeDev, bridge, br);
+
+ QIDL_VISIT_TYPE(PCIBridgeDev, v, &d, name, errp);
+}
+
+static void pci_bridge_dev_set_state(Object *obj, Visitor *v, void *opaque,
+ const char *name, Error **errp)
+{
+ PCIDevice *pci = PCI_DEVICE(obj);
+ PCIBridge *br = DO_UPCAST(PCIBridge, dev, pci);
+ PCIBridgeDev *d = DO_UPCAST(PCIBridgeDev, bridge, br);
+
+ QIDL_VISIT_TYPE(PCIBridgeDev, v, &d, name, errp);
+ shpc_post_load(pci);
+}
+
+
static int pci_bridge_dev_initfn(PCIDevice *dev)
{
PCIBridge *br = DO_UPCAST(PCIBridge, dev, dev);
@@ -66,6 +90,7 @@ static int pci_bridge_dev_initfn(PCIDevice *dev)
if (err) {
goto shpc_error;
}
+ dev->has_shpc = true;
err = slotid_cap_init(dev, 0, bridge_dev->chassis_nr, 0);
if (err) {
goto slotid_error;
@@ -82,6 +107,10 @@ static int pci_bridge_dev_initfn(PCIDevice *dev)
pci_register_bar(dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY |
PCI_BASE_ADDRESS_MEM_TYPE_64, &bridge_dev->bar);
dev->config[PCI_INTERRUPT_PIN] = 0x1;
+ object_property_add(OBJECT(dev), "state", "PCIBridgeDev",
+ pci_bridge_dev_get_state, pci_bridge_dev_set_state,
+ NULL, NULL, NULL);
+ QIDL_SCHEMA_ADD_LINK(PCIBridgeDev, OBJECT(dev), "state_schema", NULL);
return 0;
msi_error:
slotid_cap_cleanup(dev);
--
1.7.9.5
- [Qemu-devel] [PATCH 01/29] qemu-timer: add QEMUTimer visitor, (continued)
- [Qemu-devel] [PATCH 01/29] qemu-timer: add QEMUTimer visitor, Michael Roth, 2012/11/01
- [Qemu-devel] [PATCH 02/29] qidl: qidl.h, mark common immutable types as q_immutable by default, Michael Roth, 2012/11/01
- [Qemu-devel] [PATCH 04/29] rtc: qidl_declare RTCState, Michael Roth, 2012/11/01
- [Qemu-devel] [PATCH 06/29] rtc: add qom property for RTCState state, Michael Roth, 2012/11/01
- [Qemu-devel] [PATCH 10/29] vga: qidl_declare VGACommonState, Michael Roth, 2012/11/01
- [Qemu-devel] [PATCH 13/29] cirrus: qidl_declare ISACirrusVGAState, Michael Roth, 2012/11/01
- [Qemu-devel] [PATCH 15/29] i440fx: qidl_declare PCII440FXState, Michael Roth, 2012/11/01
- [Qemu-devel] [PATCH 14/29] cirrus: add qom property for isa-cirrus-vga, Michael Roth, 2012/11/01
- [Qemu-devel] [PATCH 29/29] hpet: add qom property for hpet state, Michael Roth, 2012/11/01
- [Qemu-devel] [PATCH 27/29] ide: add qom property for piix3/piix4-ide state, Michael Roth, 2012/11/01
- [Qemu-devel] [PATCH 22/29] pci_bridge_dev: add qom property for pci-bridge state,
Michael Roth <=
- [Qemu-devel] [PATCH 23/29] ide: qidl_declare IDEBus + IDEState + IDEDevice, Michael Roth, 2012/11/01
- [Qemu-devel] [PATCH 09/29] pci: add qom property for PCIBus instances, Michael Roth, 2012/11/01
- [Qemu-devel] [PATCH 07/29] pci: qidl_declare PCIDevice + PCIBus, Michael Roth, 2012/11/01
- [Qemu-devel] [PATCH 05/29] rtc: use qidl-generated properties, Michael Roth, 2012/11/01
- [Qemu-devel] [PATCH 21/29] pci_bridge_dev: qidl_declare PCIBridgeDev, Michael Roth, 2012/11/01
- [Qemu-devel] [PATCH 17/29] piix3: qidl_declare PIIX3State, Michael Roth, 2012/11/01
- [Qemu-devel] [PATCH 25/29] ide: add qom property for isa-ide state, Michael Roth, 2012/11/01
- [Qemu-devel] [PATCH 18/29] piix3: add qom property for PIIX3 state, Michael Roth, 2012/11/01
- [Qemu-devel] [PATCH 19/29] shpc: qidl_declare SHPCDevice, Michael Roth, 2012/11/01
- [Qemu-devel] [PATCH 26/29] ide: qidl_declare BMDMAState + PCIIDEState, Michael Roth, 2012/11/01