|
|
0a122b |
From 3cb467f6950fee049415dfe54a5d0f498efaead8 Mon Sep 17 00:00:00 2001
|
|
|
0a122b |
Message-Id: <3cb467f6950fee049415dfe54a5d0f498efaead8.1387298827.git.minovotn@redhat.com>
|
|
|
0a122b |
In-Reply-To: <3ed0fb61a3dc912ef036d7ef450bed192090709e.1387298827.git.minovotn@redhat.com>
|
|
|
0a122b |
References: <3ed0fb61a3dc912ef036d7ef450bed192090709e.1387298827.git.minovotn@redhat.com>
|
|
|
0a122b |
From: "Michael S. Tsirkin" <mst@redhat.com>
|
|
|
0a122b |
Date: Tue, 17 Dec 2013 15:18:52 +0100
|
|
|
0a122b |
Subject: [PATCH 42/56] ich9: APIs for pc guest info
|
|
|
0a122b |
|
|
|
0a122b |
RH-Author: Michael S. Tsirkin <mst@redhat.com>
|
|
|
0a122b |
Message-id: <1387293161-4085-43-git-send-email-mst@redhat.com>
|
|
|
0a122b |
Patchwork-id: 56348
|
|
|
0a122b |
O-Subject: [PATCH qemu-kvm RHEL7.0 v2 42/57] ich9: APIs for pc guest info
|
|
|
0a122b |
Bugzilla: 1034876
|
|
|
0a122b |
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
|
|
|
0a122b |
RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com>
|
|
|
0a122b |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
0a122b |
|
|
|
0a122b |
This adds APIs that will be used to fill in
|
|
|
0a122b |
acpi tables, implemented using QOM,
|
|
|
0a122b |
to various ich9 components.
|
|
|
0a122b |
Some information is still missing in QOM,
|
|
|
0a122b |
so we fall back on lookups by type instead.
|
|
|
0a122b |
|
|
|
0a122b |
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
0a122b |
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
0a122b |
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
|
|
|
0a122b |
Tested-by: Igor Mammedov <imammedo@redhat.com>
|
|
|
0a122b |
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
0a122b |
(cherry picked from commit 6f1426ab0fad715bccbad60e976ebf420442006c)
|
|
|
0a122b |
|
|
|
0a122b |
include/hw/acpi/ich9.h | 2 ++
|
|
|
0a122b |
include/hw/i386/ich9.h | 2 ++
|
|
|
0a122b |
include/hw/pci-host/q35.h | 2 ++
|
|
|
0a122b |
hw/acpi/ich9.c | 24 ++++++++++++++++++++++++
|
|
|
0a122b |
hw/isa/lpc_ich9.c | 40 ++++++++++++++++++++++++++++++++++++++++
|
|
|
0a122b |
hw/pci-host/q35.c | 10 ++++++++++
|
|
|
0a122b |
6 files changed, 80 insertions(+)
|
|
|
0a122b |
|
|
|
0a122b |
Signed-off-by: Michal Novotny <minovotn@redhat.com>
|
|
|
0a122b |
|
|
|
0a122b |
hw/acpi/ich9.c | 24 ++++++++++++++++++++++++
|
|
|
0a122b |
hw/isa/lpc_ich9.c | 40 ++++++++++++++++++++++++++++++++++++++++
|
|
|
0a122b |
hw/pci-host/q35.c | 10 ++++++++++
|
|
|
0a122b |
include/hw/acpi/ich9.h | 2 ++
|
|
|
0a122b |
include/hw/i386/ich9.h | 2 ++
|
|
|
0a122b |
include/hw/pci-host/q35.h | 2 ++
|
|
|
0a122b |
6 files changed, 80 insertions(+)
|
|
|
0a122b |
|
|
|
0a122b |
diff
|
|
|
0a122b |
index 4a17f32..e747183 100644
|
|
|
0a122b |
|
|
|
0a122b |
|
|
|
0a122b |
@@ -24,6 +24,7 @@
|
|
|
0a122b |
* GNU GPL, version 2 or (at your option) any later version.
|
|
|
0a122b |
*/
|
|
|
0a122b |
#include "hw/hw.h"
|
|
|
0a122b |
+#include "qapi/visitor.h"
|
|
|
0a122b |
#include "hw/i386/pc.h"
|
|
|
0a122b |
#include "hw/pci/pci.h"
|
|
|
0a122b |
#include "qemu/timer.h"
|
|
|
0a122b |
@@ -228,3 +229,26 @@ void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm,
|
|
|
0a122b |
pm->powerdown_notifier.notify = pm_powerdown_req;
|
|
|
0a122b |
qemu_register_powerdown_notifier(&pm->powerdown_notifier);
|
|
|
0a122b |
}
|
|
|
0a122b |
+
|
|
|
0a122b |
+static void ich9_pm_get_gpe0_blk(Object *obj, Visitor *v,
|
|
|
0a122b |
+ void *opaque, const char *name,
|
|
|
0a122b |
+ Error **errp)
|
|
|
0a122b |
+{
|
|
|
0a122b |
+ ICH9LPCPMRegs *pm = opaque;
|
|
|
0a122b |
+ uint32_t value = pm->pm_io_base + ICH9_PMIO_GPE0_STS;
|
|
|
0a122b |
+
|
|
|
0a122b |
+ visit_type_uint32(v, &value, name, errp);
|
|
|
0a122b |
+}
|
|
|
0a122b |
+
|
|
|
0a122b |
+void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm, Error **errp)
|
|
|
0a122b |
+{
|
|
|
0a122b |
+ static const uint32_t gpe0_len = ICH9_PMIO_GPE0_LEN;
|
|
|
0a122b |
+
|
|
|
0a122b |
+ object_property_add_uint32_ptr(obj, ACPI_PM_PROP_PM_IO_BASE,
|
|
|
0a122b |
+ &pm->pm_io_base, errp);
|
|
|
0a122b |
+ object_property_add(obj, ACPI_PM_PROP_GPE0_BLK, "uint32",
|
|
|
0a122b |
+ ich9_pm_get_gpe0_blk,
|
|
|
0a122b |
+ NULL, NULL, pm, NULL);
|
|
|
0a122b |
+ object_property_add_uint32_ptr(obj, ACPI_PM_PROP_GPE0_BLK_LEN,
|
|
|
0a122b |
+ &gpe0_len, errp);
|
|
|
0a122b |
+}
|
|
|
0a122b |
diff
|
|
|
0a122b |
index 4f834b9..7a5a92f 100644
|
|
|
0a122b |
|
|
|
0a122b |
|
|
|
0a122b |
@@ -29,6 +29,7 @@
|
|
|
0a122b |
*/
|
|
|
0a122b |
#include "qemu-common.h"
|
|
|
0a122b |
#include "hw/hw.h"
|
|
|
0a122b |
+#include "qapi/visitor.h"
|
|
|
0a122b |
#include "qemu/range.h"
|
|
|
0a122b |
#include "hw/isa/isa.h"
|
|
|
0a122b |
#include "hw/sysbus.h"
|
|
|
0a122b |
@@ -524,6 +525,43 @@ static const MemoryRegionOps ich9_rst_cnt_ops = {
|
|
|
0a122b |
.endianness = DEVICE_LITTLE_ENDIAN
|
|
|
0a122b |
};
|
|
|
0a122b |
|
|
|
0a122b |
+Object *ich9_lpc_find(void)
|
|
|
0a122b |
+{
|
|
|
0a122b |
+ bool ambig;
|
|
|
0a122b |
+ Object *o = object_resolve_path_type("", TYPE_ICH9_LPC_DEVICE, &ambig);
|
|
|
0a122b |
+
|
|
|
0a122b |
+ if (ambig) {
|
|
|
0a122b |
+ return NULL;
|
|
|
0a122b |
+ }
|
|
|
0a122b |
+ return o;
|
|
|
0a122b |
+}
|
|
|
0a122b |
+
|
|
|
0a122b |
+static void ich9_lpc_get_sci_int(Object *obj, Visitor *v,
|
|
|
0a122b |
+ void *opaque, const char *name,
|
|
|
0a122b |
+ Error **errp)
|
|
|
0a122b |
+{
|
|
|
0a122b |
+ ICH9LPCState *lpc = ICH9_LPC_DEVICE(obj);
|
|
|
0a122b |
+ uint32_t value = ich9_lpc_sci_irq(lpc);
|
|
|
0a122b |
+
|
|
|
0a122b |
+ visit_type_uint32(v, &value, name, errp);
|
|
|
0a122b |
+}
|
|
|
0a122b |
+
|
|
|
0a122b |
+static void ich9_lpc_add_properties(ICH9LPCState *lpc)
|
|
|
0a122b |
+{
|
|
|
0a122b |
+ static const uint8_t acpi_enable_cmd = ICH9_APM_ACPI_ENABLE;
|
|
|
0a122b |
+ static const uint8_t acpi_disable_cmd = ICH9_APM_ACPI_DISABLE;
|
|
|
0a122b |
+
|
|
|
0a122b |
+ object_property_add(OBJECT(lpc), ACPI_PM_PROP_SCI_INT, "uint32",
|
|
|
0a122b |
+ ich9_lpc_get_sci_int,
|
|
|
0a122b |
+ NULL, NULL, NULL, NULL);
|
|
|
0a122b |
+ object_property_add_uint8_ptr(OBJECT(lpc), ACPI_PM_PROP_ACPI_ENABLE_CMD,
|
|
|
0a122b |
+ &acpi_enable_cmd, NULL);
|
|
|
0a122b |
+ object_property_add_uint8_ptr(OBJECT(lpc), ACPI_PM_PROP_ACPI_DISABLE_CMD,
|
|
|
0a122b |
+ &acpi_disable_cmd, NULL);
|
|
|
0a122b |
+
|
|
|
0a122b |
+ ich9_pm_add_properties(OBJECT(lpc), &lpc->pm, NULL);
|
|
|
0a122b |
+}
|
|
|
0a122b |
+
|
|
|
0a122b |
static int ich9_lpc_initfn(PCIDevice *d)
|
|
|
0a122b |
{
|
|
|
0a122b |
ICH9LPCState *lpc = ICH9_LPC_DEVICE(d);
|
|
|
0a122b |
@@ -551,6 +589,8 @@ static int ich9_lpc_initfn(PCIDevice *d)
|
|
|
0a122b |
ICH9_RST_CNT_IOPORT, &lpc->rst_cnt_mem,
|
|
|
0a122b |
1);
|
|
|
0a122b |
|
|
|
0a122b |
+ ich9_lpc_add_properties(lpc);
|
|
|
0a122b |
+
|
|
|
0a122b |
return 0;
|
|
|
0a122b |
}
|
|
|
0a122b |
|
|
|
0a122b |
diff
|
|
|
0a122b |
index 87691d1..befa9d4 100644
|
|
|
0a122b |
|
|
|
0a122b |
|
|
|
0a122b |
@@ -378,6 +378,16 @@ static int mch_init(PCIDevice *d)
|
|
|
0a122b |
return 0;
|
|
|
0a122b |
}
|
|
|
0a122b |
|
|
|
0a122b |
+uint64_t mch_mcfg_base(void)
|
|
|
0a122b |
+{
|
|
|
0a122b |
+ bool ambiguous;
|
|
|
0a122b |
+ Object *o = object_resolve_path_type("", TYPE_MCH_PCI_DEVICE, &ambiguous);
|
|
|
0a122b |
+ if (!o) {
|
|
|
0a122b |
+ return 0;
|
|
|
0a122b |
+ }
|
|
|
0a122b |
+ return MCH_HOST_BRIDGE_PCIEXBAR_DEFAULT;
|
|
|
0a122b |
+}
|
|
|
0a122b |
+
|
|
|
0a122b |
static void mch_class_init(ObjectClass *klass, void *data)
|
|
|
0a122b |
{
|
|
|
0a122b |
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
|
|
|
0a122b |
diff
|
|
|
0a122b |
index b1fe71f..82fcf9f 100644
|
|
|
0a122b |
|
|
|
0a122b |
+++ b/include/hw/acpi/ich9.h
|
|
|
0a122b |
@@ -49,4 +49,6 @@ void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm,
|
|
|
0a122b |
void ich9_pm_iospace_update(ICH9LPCPMRegs *pm, uint32_t pm_io_base);
|
|
|
0a122b |
extern const VMStateDescription vmstate_ich9_pm;
|
|
|
0a122b |
|
|
|
0a122b |
+void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm, Error **errp);
|
|
|
0a122b |
+
|
|
|
0a122b |
#endif
|
|
|
0a122b |
diff
|
|
|
0a122b |
index c5f637b..4a68b35 100644
|
|
|
0a122b |
|
|
|
0a122b |
+++ b/include/hw/i386/ich9.h
|
|
|
0a122b |
@@ -66,6 +66,8 @@ typedef struct ICH9LPCState {
|
|
|
0a122b |
qemu_irq *ioapic;
|
|
|
0a122b |
} ICH9LPCState;
|
|
|
0a122b |
|
|
|
0a122b |
+Object *ich9_lpc_find(void);
|
|
|
0a122b |
+
|
|
|
0a122b |
#define Q35_MASK(bit, ms_bit, ls_bit) \
|
|
|
0a122b |
((uint#
|
|
|
0a122b |
|
|
|
0a122b |
diff
|
|
|
0a122b |
index e660a40..856d39f 100644
|
|
|
0a122b |
|
|
|
0a122b |
+++ b/include/hw/pci-host/q35.h
|
|
|
0a122b |
@@ -150,4 +150,6 @@ typedef struct Q35PCIHost {
|
|
|
0a122b |
#define MCH_PCIE_DEV 1
|
|
|
0a122b |
#define MCH_PCIE_FUNC 0
|
|
|
0a122b |
|
|
|
0a122b |
+uint64_t mch_mcfg_base(void);
|
|
|
0a122b |
+
|
|
|
0a122b |
#endif
|
|
|
0a122b |
--
|
|
|
0a122b |
1.7.11.7
|
|
|
0a122b |
|