[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 36/41] memhp: merge build_memory_devices() into build
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 36/41] memhp: merge build_memory_devices() into build_memory_hotplug_aml() |
Date: |
Tue, 10 Jan 2017 07:40:52 +0200 |
From: Igor Mammedov <address@hidden>
It consolidates memory hotplug AML in one place within DSDT
Signed-off-by: Igor Mammedov <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
include/hw/acpi/memory_hotplug.h | 2 --
hw/acpi/memory_hotplug.c | 14 ++++-----
hw/i386/acpi-build.c | 61 ++++++++++++++++++----------------------
3 files changed, 33 insertions(+), 44 deletions(-)
diff --git a/include/hw/acpi/memory_hotplug.h b/include/hw/acpi/memory_hotplug.h
index c70481e..6dc48d2 100644
--- a/include/hw/acpi/memory_hotplug.h
+++ b/include/hw/acpi/memory_hotplug.h
@@ -54,6 +54,4 @@ void acpi_memory_ospm_status(MemHotplugState *mem_st,
ACPIOSTInfoList ***list);
void build_memory_hotplug_aml(Aml *table, uint32_t nr_mem,
uint16_t io_base, uint16_t io_len);
-void build_memory_devices(Aml *sb_scope, int nr_mem,
- uint16_t io_base, uint16_t io_len);
#endif
diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c
index fb40a5e..18b95f2 100644
--- a/hw/acpi/memory_hotplug.c
+++ b/hw/acpi/memory_hotplug.c
@@ -310,9 +310,11 @@ const VMStateDescription vmstate_memory_hotplug = {
void build_memory_hotplug_aml(Aml *table, uint32_t nr_mem,
uint16_t io_base, uint16_t io_len)
{
+ int i;
Aml *ifctx;
Aml *method;
Aml *pci_scope;
+ Aml *sb_scope;
Aml *mem_ctrl_dev;
/* scope for memory hotplug controller device node */
@@ -610,19 +612,12 @@ void build_memory_hotplug_aml(Aml *table, uint32_t nr_mem,
}
aml_append(pci_scope, mem_ctrl_dev);
aml_append(table, pci_scope);
-}
-
-void build_memory_devices(Aml *sb_scope, int nr_mem,
- uint16_t io_base, uint16_t io_len)
-{
- int i;
- Aml *dev;
- Aml *method;
- Aml *ifctx;
+ sb_scope = aml_scope("_SB");
/* build memory devices */
for (i = 0; i < nr_mem; i++) {
#define BASEPATH "\\_SB.PCI0." MEMORY_HOTPLUG_DEVICE "."
+ Aml *dev;
const char *s;
dev = aml_device("MP%02X", i);
@@ -673,4 +668,5 @@ void build_memory_devices(Aml *sb_scope, int nr_mem,
aml_append(method, ifctx);
}
aml_append(sb_scope, method);
+ aml_append(table, sb_scope);
}
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index a3f9caa..ca4165e 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -2197,45 +2197,40 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
sb_scope = aml_scope("\\_SB");
{
- build_memory_devices(sb_scope, nr_mem, pm->mem_hp_io_base,
- pm->mem_hp_io_len);
+ Object *pci_host;
+ PCIBus *bus = NULL;
- {
- Object *pci_host;
- PCIBus *bus = NULL;
+ pci_host = acpi_get_i386_pci_host();
+ if (pci_host) {
+ bus = PCI_HOST_BRIDGE(pci_host)->bus;
+ }
- pci_host = acpi_get_i386_pci_host();
- if (pci_host) {
- bus = PCI_HOST_BRIDGE(pci_host)->bus;
+ if (bus) {
+ Aml *scope = aml_scope("PCI0");
+ /* Scan all PCI buses. Generate tables to support hotplug. */
+ build_append_pci_bus_devices(scope, bus, pm->pcihp_bridge_en);
+
+ if (misc->tpm_version != TPM_VERSION_UNSPEC) {
+ dev = aml_device("ISA.TPM");
+ aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C31")));
+ aml_append(dev, aml_name_decl("_STA", aml_int(0xF)));
+ crs = aml_resource_template();
+ aml_append(crs, aml_memory32_fixed(TPM_TIS_ADDR_BASE,
+ TPM_TIS_ADDR_SIZE, AML_READ_WRITE));
+ /*
+ FIXME: TPM_TIS_IRQ=5 conflicts with PNP0C0F irqs,
+ Rewrite to take IRQ from TPM device model and
+ fix default IRQ value there to use some unused IRQ
+ */
+ /* aml_append(crs, aml_irq_no_flags(TPM_TIS_IRQ)); */
+ aml_append(dev, aml_name_decl("_CRS", crs));
+ aml_append(scope, dev);
}
- if (bus) {
- Aml *scope = aml_scope("PCI0");
- /* Scan all PCI buses. Generate tables to support hotplug. */
- build_append_pci_bus_devices(scope, bus, pm->pcihp_bridge_en);
-
- if (misc->tpm_version != TPM_VERSION_UNSPEC) {
- dev = aml_device("ISA.TPM");
- aml_append(dev, aml_name_decl("_HID",
aml_eisaid("PNP0C31")));
- aml_append(dev, aml_name_decl("_STA", aml_int(0xF)));
- crs = aml_resource_template();
- aml_append(crs, aml_memory32_fixed(TPM_TIS_ADDR_BASE,
- TPM_TIS_ADDR_SIZE, AML_READ_WRITE));
- /*
- FIXME: TPM_TIS_IRQ=5 conflicts with PNP0C0F irqs,
- Rewrite to take IRQ from TPM device model and
- fix default IRQ value there to use some unused IRQ
- */
- /* aml_append(crs, aml_irq_no_flags(TPM_TIS_IRQ)); */
- aml_append(dev, aml_name_decl("_CRS", crs));
- aml_append(scope, dev);
- }
-
- aml_append(sb_scope, scope);
- }
+ aml_append(sb_scope, scope);
}
- aml_append(dsdt, sb_scope);
}
+ aml_append(dsdt, sb_scope);
/* copy AML table into ACPI tables blob and patch header there */
g_array_append_vals(table_data, dsdt->buf->data, dsdt->buf->len);
--
MST
- [Qemu-devel] [PULL 27/41] virtio: Introduce virtqueue_drop_all procedure, (continued)
- [Qemu-devel] [PULL 27/41] virtio: Introduce virtqueue_drop_all procedure, Michael S. Tsirkin, 2017/01/10
- [Qemu-devel] [PULL 26/41] net: vhost stop updates virtio queue state, Michael S. Tsirkin, 2017/01/10
- [Qemu-devel] [PULL 28/41] net: virtio-net discards TX data after link down, Michael S. Tsirkin, 2017/01/10
- [Qemu-devel] [PULL 29/41] vhost-user: Add MTU protocol feature and op, Michael S. Tsirkin, 2017/01/10
- [Qemu-devel] [PULL 30/41] vhost-net: Notify the backend about the host MTU, Michael S. Tsirkin, 2017/01/10
- [Qemu-devel] [PULL 31/41] virtio-net: Add MTU feature support, Michael S. Tsirkin, 2017/01/10
- [Qemu-devel] [PULL 32/41] tests: pc: add memory hotplug acpi tables tests, Michael S. Tsirkin, 2017/01/10
- [Qemu-devel] [PULL 34/41] memhp: move build_memory_devices() into memory_hotplug.c, Michael S. Tsirkin, 2017/01/10
- [Qemu-devel] [PULL 35/41] memhp: consolidate scattered MHPD device declaration, Michael S. Tsirkin, 2017/01/10
- [Qemu-devel] [PULL 33/41] memhp: move build_memory_hotplug_aml() into memory_hotplug.c, Michael S. Tsirkin, 2017/01/10
- [Qemu-devel] [PULL 36/41] memhp: merge build_memory_devices() into build_memory_hotplug_aml(),
Michael S. Tsirkin <=
- [Qemu-devel] [PULL 38/41] memhp: move memory hotplug only defines to memory_hotplug.c, Michael S. Tsirkin, 2017/01/10
- [Qemu-devel] [PULL 37/41] memhp: move GPE handler_E03 into build_memory_hotplug_aml(), Michael S. Tsirkin, 2017/01/10
- [Qemu-devel] [PULL 39/41] memhp: don't generate memory hotplug AML if it's not enabled/supported, Michael S. Tsirkin, 2017/01/10
- [Qemu-devel] [PULL 40/41] memhp: move DIMM devices into dedicated scope with related common methods, Michael S. Tsirkin, 2017/01/10
- [Qemu-devel] [PULL 41/41] acpi-test: update expected files, Michael S. Tsirkin, 2017/01/10
- Re: [Qemu-devel] [PULL 00/41] virtio, vhost, pc: fixes, features, Peter Maydell, 2017/01/10