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