From c8e6c93857885a19e959ec622d92a256d1cd98eb Mon Sep 17 00:00:00 2001 From: Haozhong Zhang Date: Fri, 25 Dec 2015 10:57:42 +0800 Subject: [PATCH 01/59] nvdimm: fix header pointer in nvdimm_build_nfit() In the current nvdimm_build_nfit(), the pointer 'header' initially equals to table_data->data + table_data->len. However, the following g_array_append_vals(table_data, structures->data, structures->len) may resize and relocate table_data->data[]. Therefore, the usage of 'header' afterwards may be illegal. This patch fixes this issue by storing an offset within table_data->data[] (rather than an address) in 'header'. Signed-off-by: Haozhong Zhang Reviewed-by: Xiao Guangrong Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/acpi/nvdimm.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c index 9534418824..df1b176b8f 100644 --- a/hw/acpi/nvdimm.c +++ b/hw/acpi/nvdimm.c @@ -353,16 +353,18 @@ static void nvdimm_build_nfit(GSList *device_list, GArray *table_offsets, GArray *table_data, GArray *linker) { GArray *structures = nvdimm_build_device_structure(device_list); - void *header; + unsigned int header; acpi_add_table(table_offsets, table_data); /* NFIT header. */ - header = acpi_data_push(table_data, sizeof(NvdimmNfitHeader)); + header = table_data->len; + acpi_data_push(table_data, sizeof(NvdimmNfitHeader)); /* NVDIMM device structures. */ g_array_append_vals(table_data, structures->data, structures->len); - build_header(linker, table_data, header, "NFIT", + build_header(linker, table_data, + (void *)(table_data->data + header), "NFIT", sizeof(NvdimmNfitHeader) + structures->len, 1, NULL); g_array_free(structures, true); } From 349a3b1cc9023f67f8fa336cb3c4a8f21a4aaaf3 Mon Sep 17 00:00:00 2001 From: Cao jin Date: Sat, 2 Jan 2016 16:02:20 +0800 Subject: [PATCH 02/59] igd-passthrough: fix use of host_pci_config_read Fix the bug introduced by 595a4f07: function host_pci_config_read() should be pass-by-reference, not value. This probably means this function never worked for anyone. Signed-off-by: Cao jin Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/pci-host/piix.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c index 715208b22a..924f0fa82b 100644 --- a/hw/pci-host/piix.c +++ b/hw/pci-host/piix.c @@ -761,7 +761,7 @@ static const IGDHostInfo igd_host_bridge_infos[] = { {0xa8, 4}, /* SNB: base of GTT stolen memory */ }; -static int host_pci_config_read(int pos, int len, uint32_t val) +static int host_pci_config_read(int pos, int len, uint32_t *val) { char path[PATH_MAX]; int config_fd; @@ -784,12 +784,14 @@ static int host_pci_config_read(int pos, int len, uint32_t val) ret = -errno; goto out; } + do { - rc = read(config_fd, (uint8_t *)&val, len); + rc = read(config_fd, (uint8_t *)val, len); } while (rc < 0 && (errno == EINTR || errno == EAGAIN)); if (rc != len) { ret = -errno; } + out: close(config_fd); return ret; @@ -805,7 +807,7 @@ static int igd_pt_i440fx_initfn(struct PCIDevice *pci_dev) for (i = 0; i < num; i++) { pos = igd_host_bridge_infos[i].offset; len = igd_host_bridge_infos[i].len; - rc = host_pci_config_read(pos, len, val); + rc = host_pci_config_read(pos, len, &val); if (rc) { return -ENODEV; } From f070efa8d9359c01e8ba64f53ff3c730a362027a Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Thu, 10 Dec 2015 18:25:34 +0100 Subject: [PATCH 03/59] hw/i386: fill in the CENTURY field of the FADT (FACP) ACPI table The ACPI specification (minimally versions 1.0b through 6.0) define the FADT.CENTURY field as: The RTC CMOS RAM index to the century of data value (hundred and thousand year decimals). If this field contains a zero, then the RTC centenary feature is not supported. If this field has a non-zero value, then this field contains an index into RTC RAM space that OSPM can use to program the centenary field. The x86 targets generate ACPI payload, emulate an RTC (CONFIG_MC146818RTC), and that RTC supports the "centenary feature" (see occurrences of RTC_CENTURY in cmos_ioport_write() and cmos_ioport_read() in "hw/timer/mc146818rtc.c".) However, FADT.CENTURY is left at zero currently: [06Ch 0108 1] RTC Century Index : 00 which -- according to analysis done by Ruiyu Ni at Intel -- should cause Linux and Windows 8+ to think the RTC centenary feature is unavailable, and cause Windows 7 to (incorrectly) assume that the offset to use is constant 0x32. (0x32 happens to be the right value on QEMU, but Windows 7 is wrong to assume anything at all). Exposing the right nonzero offset in FADT.CENTURY informs Linux and Windows 8+ about the right capabilities of the hardware, plus it retrofits our FADT to Windows 7's behavior. Regression tested with the following guests (all UEFI installs): - i386 Q35: Fedora 21 ("Fedlet" edition) - x86_64: - i440fx: - Fedora 21 - RHEL 6 and 7 - Windows 7 and 10 - Windows Server 2008 R2 and 2012 R2 - Q35: - Fedora 22 - Windows 8.1 Cc: "Michael S. Tsirkin" (supporter:ACPI/SMBIOS) Cc: Igor Mammedov (supporter:ACPI/SMBIOS) Cc: Paolo Bonzini (maintainer:X86) Cc: Richard Henderson (maintainer:X86) Cc: Eduardo Habkost (maintainer:X86) Cc: Ruiyu Ni Signed-off-by: Laszlo Ersek Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Igor Mammedov Reviewed-by: Paolo Bonzini --- hw/i386/acpi-build.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 4cc1440f77..a5a3e3cbd2 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -43,6 +43,7 @@ #include "sysemu/tpm.h" #include "hw/acpi/tpm.h" #include "sysemu/tpm_backend.h" +#include "hw/timer/mc146818rtc_regs.h" /* Supported chipsets: */ #include "hw/acpi/piix4.h" @@ -335,6 +336,7 @@ static void fadt_setup(AcpiFadtDescriptorRev1 *fadt, AcpiPmInfo *pm) if (max_cpus > 8) { fadt->flags |= cpu_to_le32(1 << ACPI_FADT_F_FORCE_APIC_CLUSTER_MODEL); } + fadt->century = RTC_CENTURY; } From 7cb08cb2d7e95e2417c93796662829fd88eb3b6e Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:08 +0100 Subject: [PATCH 04/59] tests: acpi: print ASL diff in verbose mode print ASL difference if there is any when executing 'make V=1 check'. Use 'DIFF' environment variable to determine which diff utility to use and if it's not set notify user by printing warning that DIFF is not set if run in verbose mode and there is difference in ASL. Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/bios-tables-test.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c index 6d37332a60..75ec330ceb 100644 --- a/tests/bios-tables-test.c +++ b/tests/bios-tables-test.c @@ -580,6 +580,22 @@ static void test_acpi_asl(test_data *data) (gchar *)&signature, sdt->asl_file, sdt->aml_file, exp_sdt->asl_file, exp_sdt->aml_file); + if (getenv("V")) { + const char *diff_cmd = getenv("DIFF"); + if (diff_cmd) { + int ret G_GNUC_UNUSED; + char *diff = g_strdup_printf("%s %s %s", diff_cmd, + exp_sdt->asl_file, sdt->asl_file); + ret = system(diff) ; + g_free(diff); + } else { + fprintf(stderr, "acpi-test: Warning. not showing " + "difference since no diff utility is specified. " + "Set 'DIFF' environment variable to a preferred " + "diff utility and run 'make V=1 check' again to " + "see ASL difference."); + } + } } } g_string_free(asl, true); From 30bd0cf465c9c66f22e82f2aa1f1fbca7dafe102 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:09 +0100 Subject: [PATCH 05/59] pc: acpi: memhp: prepare context in SSDT for moving memhp DSDT code Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/acpi/Makefile.objs | 2 +- hw/acpi/memory_hotplug_acpi_table.c | 30 +++++++++++++++++++++++++++++ hw/i386/acpi-build.c | 3 +++ include/hw/acpi/memory_hotplug.h | 4 ++++ 4 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 hw/acpi/memory_hotplug_acpi_table.c diff --git a/hw/acpi/Makefile.objs b/hw/acpi/Makefile.objs index 095597f791..052be627cc 100644 --- a/hw/acpi/Makefile.objs +++ b/hw/acpi/Makefile.objs @@ -1,7 +1,7 @@ common-obj-$(CONFIG_ACPI_X86) += core.o piix4.o pcihp.o common-obj-$(CONFIG_ACPI_X86_ICH) += ich9.o tco.o common-obj-$(CONFIG_ACPI_CPU_HOTPLUG) += cpu_hotplug.o -common-obj-$(CONFIG_ACPI_MEMORY_HOTPLUG) += memory_hotplug.o +common-obj-$(CONFIG_ACPI_MEMORY_HOTPLUG) += memory_hotplug.o memory_hotplug_acpi_table.o common-obj-$(CONFIG_ACPI_NVDIMM) += nvdimm.o common-obj-$(CONFIG_ACPI) += acpi_interface.o common-obj-$(CONFIG_ACPI) += bios-linker-loader.o diff --git a/hw/acpi/memory_hotplug_acpi_table.c b/hw/acpi/memory_hotplug_acpi_table.c new file mode 100644 index 0000000000..35fefbabe0 --- /dev/null +++ b/hw/acpi/memory_hotplug_acpi_table.c @@ -0,0 +1,30 @@ +/* + * Memory hotplug AML code of DSDT ACPI table + * + * Copyright (C) 2015 Red Hat Inc + * + * Author: Igor Mammedov + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#include +#include "hw/acpi/memory_hotplug.h" +#include "include/hw/acpi/pc-hotplug.h" +#include "hw/boards.h" + +void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem, + uint16_t io_base, uint16_t io_len) +{ + Aml *pci_scope; + Aml *mem_ctrl_dev; + + /* scope for memory hotplug controller device node */ + pci_scope = aml_scope("_SB.PCI0"); + mem_ctrl_dev = aml_scope(stringify(MEMORY_HOTPLUG_DEVICE)); + { + } + aml_append(pci_scope, mem_ctrl_dev); + aml_append(ctx, pci_scope); +} diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index a5a3e3cbd2..52e4a151fc 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -956,6 +956,9 @@ build_ssdt(GArray *table_data, GArray *linker, /* Reserve space for header */ acpi_data_push(ssdt->buf, sizeof(AcpiTableHeader)); + build_memory_hotplug_aml(ssdt, nr_mem, pm->mem_hp_io_base, + pm->mem_hp_io_len); + bus = PC_MACHINE(machine)->bus; if (bus) { QLIST_FOREACH(bus, &bus->child, sibling) { diff --git a/include/hw/acpi/memory_hotplug.h b/include/hw/acpi/memory_hotplug.h index 1342adb08f..b6e9f50963 100644 --- a/include/hw/acpi/memory_hotplug.h +++ b/include/hw/acpi/memory_hotplug.h @@ -4,6 +4,7 @@ #include "hw/qdev-core.h" #include "hw/acpi/acpi.h" #include "migration/vmstate.h" +#include "hw/acpi/aml-build.h" /** * MemStatus: @@ -45,4 +46,7 @@ extern const VMStateDescription vmstate_memory_hotplug; vmstate_memory_hotplug, MemHotplugState) void acpi_memory_ospm_status(MemHotplugState *mem_st, ACPIOSTInfoList ***list); + +void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem, + uint16_t io_base, uint16_t io_len); #endif From b2344f3e63d07c57449471d7ee4c2ae08b73a797 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:10 +0100 Subject: [PATCH 06/59] pc: acpi: memhp: move MHPD._STA method into SSDT Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/acpi/memory_hotplug_acpi_table.c | 14 ++++++++++++++ hw/i386/acpi-dsdt-mem-hotplug.dsl | 8 -------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/hw/acpi/memory_hotplug_acpi_table.c b/hw/acpi/memory_hotplug_acpi_table.c index 35fefbabe0..a21ef6fc1c 100644 --- a/hw/acpi/memory_hotplug_acpi_table.c +++ b/hw/acpi/memory_hotplug_acpi_table.c @@ -17,6 +17,8 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem, uint16_t io_base, uint16_t io_len) { + Aml *ifctx; + Aml *method; Aml *pci_scope; Aml *mem_ctrl_dev; @@ -24,6 +26,18 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem, pci_scope = aml_scope("_SB.PCI0"); mem_ctrl_dev = aml_scope(stringify(MEMORY_HOTPLUG_DEVICE)); { + Aml *zero = aml_int(0); + Aml *slots_nr = aml_name(stringify(MEMORY_SLOTS_NUMBER)); + + method = aml_method("_STA", 0, AML_NOTSERIALIZED); + ifctx = aml_if(aml_equal(slots_nr, zero)); + { + aml_append(ifctx, aml_return(zero)); + } + aml_append(method, ifctx); + /* present, functioning, decoding, not shown in UI */ + aml_append(method, aml_return(aml_int(0xB))); + aml_append(mem_ctrl_dev, method); } aml_append(pci_scope, mem_ctrl_dev); aml_append(ctx, pci_scope); diff --git a/hw/i386/acpi-dsdt-mem-hotplug.dsl b/hw/i386/acpi-dsdt-mem-hotplug.dsl index c2bb6a1602..b4eacc952b 100644 --- a/hw/i386/acpi-dsdt-mem-hotplug.dsl +++ b/hw/i386/acpi-dsdt-mem-hotplug.dsl @@ -35,14 +35,6 @@ External(MEMORY_SLOT_OST_EVENT, FieldUnitObj) // _OST event code, write only External(MEMORY_SLOT_OST_STATUS, FieldUnitObj) // _OST status code, write only - Method(_STA, 0) { - If (LEqual(MEMORY_SLOTS_NUMBER, Zero)) { - Return(0x0) - } - /* present, functioning, decoding, not shown in UI */ - Return(0xB) - } - Mutex (MEMORY_SLOT_LOCK, 0) Method(MEMORY_SLOT_SCAN_METHOD, 0) { From 12fdadb5747f0c627c39ceb7107be90e4678ec9b Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:11 +0100 Subject: [PATCH 07/59] pc: acpi: memhp: move MHPD.MLCK mutex into SSDT Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/acpi/memory_hotplug_acpi_table.c | 2 ++ hw/i386/acpi-dsdt-mem-hotplug.dsl | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/acpi/memory_hotplug_acpi_table.c b/hw/acpi/memory_hotplug_acpi_table.c index a21ef6fc1c..c2bd9283bd 100644 --- a/hw/acpi/memory_hotplug_acpi_table.c +++ b/hw/acpi/memory_hotplug_acpi_table.c @@ -38,6 +38,8 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem, /* present, functioning, decoding, not shown in UI */ aml_append(method, aml_return(aml_int(0xB))); aml_append(mem_ctrl_dev, method); + + aml_append(mem_ctrl_dev, aml_mutex(stringify(MEMORY_SLOT_LOCK), 0)); } aml_append(pci_scope, mem_ctrl_dev); aml_append(ctx, pci_scope); diff --git a/hw/i386/acpi-dsdt-mem-hotplug.dsl b/hw/i386/acpi-dsdt-mem-hotplug.dsl index b4eacc952b..a1e519b264 100644 --- a/hw/i386/acpi-dsdt-mem-hotplug.dsl +++ b/hw/i386/acpi-dsdt-mem-hotplug.dsl @@ -34,8 +34,7 @@ External(MEMORY_SLOT_SLECTOR, FieldUnitObj) // DIMM selector, write only External(MEMORY_SLOT_OST_EVENT, FieldUnitObj) // _OST event code, write only External(MEMORY_SLOT_OST_STATUS, FieldUnitObj) // _OST status code, write only - - Mutex (MEMORY_SLOT_LOCK, 0) + External(MEMORY_SLOT_LOCK, MutexObj) Method(MEMORY_SLOT_SCAN_METHOD, 0) { If (LEqual(MEMORY_SLOTS_NUMBER, Zero)) { From e8f9db491dcec1b24029df3cf9932e2eb6082787 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:12 +0100 Subject: [PATCH 08/59] pc: acpi: memhp: move MHPD.MSCN method into SSDT Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/acpi/memory_hotplug_acpi_table.c | 60 +++++++++++++++++++++++++++++ hw/i386/acpi-dsdt-mem-hotplug.dsl | 27 +------------ 2 files changed, 61 insertions(+), 26 deletions(-) diff --git a/hw/acpi/memory_hotplug_acpi_table.c b/hw/acpi/memory_hotplug_acpi_table.c index c2bd9283bd..86b8233309 100644 --- a/hw/acpi/memory_hotplug_acpi_table.c +++ b/hw/acpi/memory_hotplug_acpi_table.c @@ -26,8 +26,11 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem, pci_scope = aml_scope("_SB.PCI0"); mem_ctrl_dev = aml_scope(stringify(MEMORY_HOTPLUG_DEVICE)); { + Aml *one = aml_int(1); Aml *zero = aml_int(0); Aml *slots_nr = aml_name(stringify(MEMORY_SLOTS_NUMBER)); + Aml *ctrl_lock = aml_name(stringify(MEMORY_SLOT_LOCK)); + Aml *slot_selector = aml_name(stringify(MEMORY_SLOT_SLECTOR)); method = aml_method("_STA", 0, AML_NOTSERIALIZED); ifctx = aml_if(aml_equal(slots_nr, zero)); @@ -40,6 +43,63 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem, aml_append(mem_ctrl_dev, method); aml_append(mem_ctrl_dev, aml_mutex(stringify(MEMORY_SLOT_LOCK), 0)); + + method = aml_method(stringify(MEMORY_SLOT_SCAN_METHOD), 0, + AML_NOTSERIALIZED); + { + Aml *else_ctx; + Aml *while_ctx; + Aml *idx = aml_local(0); + Aml *eject_req = aml_int(3); + Aml *dev_chk = aml_int(1); + + ifctx = aml_if(aml_equal(slots_nr, zero)); + { + aml_append(ifctx, aml_return(zero)); + } + aml_append(method, ifctx); + + aml_append(method, aml_store(zero, idx)); + aml_append(method, aml_acquire(ctrl_lock, 0xFFFF)); + /* build AML that: + * loops over all slots and Notifies DIMMs with + * Device Check or Eject Request notifications if + * slot has corresponding status bit set and clears + * slot status. + */ + while_ctx = aml_while(aml_lless(idx, slots_nr)); + { + Aml *ins_evt = aml_name(stringify(MEMORY_SLOT_INSERT_EVENT)); + Aml *rm_evt = aml_name(stringify(MEMORY_SLOT_REMOVE_EVENT)); + + aml_append(while_ctx, aml_store(idx, slot_selector)); + ifctx = aml_if(aml_equal(ins_evt, one)); + { + aml_append(ifctx, + aml_call2(stringify(MEMORY_SLOT_NOTIFY_METHOD), + idx, dev_chk)); + aml_append(ifctx, aml_store(one, ins_evt)); + } + aml_append(while_ctx, ifctx); + + else_ctx = aml_else(); + ifctx = aml_if(aml_equal(rm_evt, one)); + { + aml_append(ifctx, + aml_call2(stringify(MEMORY_SLOT_NOTIFY_METHOD), + idx, eject_req)); + aml_append(ifctx, aml_store(one, rm_evt)); + } + aml_append(else_ctx, ifctx); + aml_append(while_ctx, else_ctx); + + aml_append(while_ctx, aml_add(idx, one, idx)); + } + aml_append(method, while_ctx); + aml_append(method, aml_release(ctrl_lock)); + aml_append(method, aml_return(one)); + } + aml_append(mem_ctrl_dev, method); } aml_append(pci_scope, mem_ctrl_dev); aml_append(ctx, pci_scope); diff --git a/hw/i386/acpi-dsdt-mem-hotplug.dsl b/hw/i386/acpi-dsdt-mem-hotplug.dsl index a1e519b264..92baf8775f 100644 --- a/hw/i386/acpi-dsdt-mem-hotplug.dsl +++ b/hw/i386/acpi-dsdt-mem-hotplug.dsl @@ -13,13 +13,12 @@ * with this program; if not, see . */ - External(MEMORY_SLOT_NOTIFY_METHOD, MethodObj) + External(\_SB.PCI0.MEMORY_HOTPLUG_DEVICE.MEMORY_SLOT_SCAN_METHOD, MethodObj) Scope(\_SB.PCI0) { Device(MEMORY_HOTPLUG_DEVICE) { Name(_HID, "PNP0A06") Name(_UID, "Memory hotplug resources") - External(MEMORY_SLOTS_NUMBER, IntObj) /* Memory hotplug IO registers */ External(MEMORY_SLOT_ADDR_LOW, FieldUnitObj) // read only @@ -28,36 +27,12 @@ External(MEMORY_SLOT_SIZE_HIGH, FieldUnitObj) // read only External(MEMORY_SLOT_PROXIMITY, FieldUnitObj) // read only External(MEMORY_SLOT_ENABLED, FieldUnitObj) // 1 if enabled, read only - External(MEMORY_SLOT_INSERT_EVENT, FieldUnitObj) // (read) 1 if has a insert event. (write) 1 to clear event - External(MEMORY_SLOT_REMOVE_EVENT, FieldUnitObj) // (read) 1 if has a remove event. (write) 1 to clear event External(MEMORY_SLOT_EJECT, FieldUnitObj) // initiates device eject, write only External(MEMORY_SLOT_SLECTOR, FieldUnitObj) // DIMM selector, write only External(MEMORY_SLOT_OST_EVENT, FieldUnitObj) // _OST event code, write only External(MEMORY_SLOT_OST_STATUS, FieldUnitObj) // _OST status code, write only External(MEMORY_SLOT_LOCK, MutexObj) - Method(MEMORY_SLOT_SCAN_METHOD, 0) { - If (LEqual(MEMORY_SLOTS_NUMBER, Zero)) { - Return(Zero) - } - - Store(Zero, Local0) // Mem devs iterrator - Acquire(MEMORY_SLOT_LOCK, 0xFFFF) - while (LLess(Local0, MEMORY_SLOTS_NUMBER)) { - Store(Local0, MEMORY_SLOT_SLECTOR) // select Local0 DIMM - If (LEqual(MEMORY_SLOT_INSERT_EVENT, One)) { // Memory device needs check - MEMORY_SLOT_NOTIFY_METHOD(Local0, 1) - Store(1, MEMORY_SLOT_INSERT_EVENT) - } Elseif (LEqual(MEMORY_SLOT_REMOVE_EVENT, One)) { // Ejection request - MEMORY_SLOT_NOTIFY_METHOD(Local0, 3) - Store(1, MEMORY_SLOT_REMOVE_EVENT) - } - Add(Local0, One, Local0) // goto next DIMM - } - Release(MEMORY_SLOT_LOCK) - Return(One) - } - Method(MEMORY_SLOT_STATUS_METHOD, 1) { Store(Zero, Local0) From b98401223de33a0754b2f2081f3c0962229d5674 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:13 +0100 Subject: [PATCH 09/59] pc: acpi: memhp: move MHPD.MRST method into SSDT Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/acpi/memory_hotplug_acpi_table.c | 23 +++++++++++++++++++++++ hw/i386/acpi-dsdt-mem-hotplug.dsl | 15 --------------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/hw/acpi/memory_hotplug_acpi_table.c b/hw/acpi/memory_hotplug_acpi_table.c index 86b8233309..07d78f05af 100644 --- a/hw/acpi/memory_hotplug_acpi_table.c +++ b/hw/acpi/memory_hotplug_acpi_table.c @@ -28,6 +28,8 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem, { Aml *one = aml_int(1); Aml *zero = aml_int(0); + Aml *ret_val = aml_local(0); + Aml *slot_arg0 = aml_arg(0); Aml *slots_nr = aml_name(stringify(MEMORY_SLOTS_NUMBER)); Aml *ctrl_lock = aml_name(stringify(MEMORY_SLOT_LOCK)); Aml *slot_selector = aml_name(stringify(MEMORY_SLOT_SLECTOR)); @@ -100,6 +102,27 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem, aml_append(method, aml_return(one)); } aml_append(mem_ctrl_dev, method); + + method = aml_method(stringify(MEMORY_SLOT_STATUS_METHOD), 1, + AML_NOTSERIALIZED); + { + Aml *slot_enabled = aml_name(stringify(MEMORY_SLOT_ENABLED)); + + aml_append(method, aml_store(zero, ret_val)); + aml_append(method, aml_acquire(ctrl_lock, 0xFFFF)); + aml_append(method, + aml_store(aml_to_integer(slot_arg0), slot_selector)); + + ifctx = aml_if(aml_equal(slot_enabled, one)); + { + aml_append(ifctx, aml_store(aml_int(0xF), ret_val)); + } + aml_append(method, ifctx); + + aml_append(method, aml_release(ctrl_lock)); + aml_append(method, aml_return(ret_val)); + } + aml_append(mem_ctrl_dev, method); } aml_append(pci_scope, mem_ctrl_dev); aml_append(ctx, pci_scope); diff --git a/hw/i386/acpi-dsdt-mem-hotplug.dsl b/hw/i386/acpi-dsdt-mem-hotplug.dsl index 92baf8775f..13e93dc6bd 100644 --- a/hw/i386/acpi-dsdt-mem-hotplug.dsl +++ b/hw/i386/acpi-dsdt-mem-hotplug.dsl @@ -26,27 +26,12 @@ External(MEMORY_SLOT_SIZE_LOW, FieldUnitObj) // read only External(MEMORY_SLOT_SIZE_HIGH, FieldUnitObj) // read only External(MEMORY_SLOT_PROXIMITY, FieldUnitObj) // read only - External(MEMORY_SLOT_ENABLED, FieldUnitObj) // 1 if enabled, read only External(MEMORY_SLOT_EJECT, FieldUnitObj) // initiates device eject, write only External(MEMORY_SLOT_SLECTOR, FieldUnitObj) // DIMM selector, write only External(MEMORY_SLOT_OST_EVENT, FieldUnitObj) // _OST event code, write only External(MEMORY_SLOT_OST_STATUS, FieldUnitObj) // _OST status code, write only External(MEMORY_SLOT_LOCK, MutexObj) - Method(MEMORY_SLOT_STATUS_METHOD, 1) { - Store(Zero, Local0) - - Acquire(MEMORY_SLOT_LOCK, 0xFFFF) - Store(ToInteger(Arg0), MEMORY_SLOT_SLECTOR) // select DIMM - - If (LEqual(MEMORY_SLOT_ENABLED, One)) { - Store(0xF, Local0) - } - - Release(MEMORY_SLOT_LOCK) - Return(Local0) - } - Method(MEMORY_SLOT_CRS_METHOD, 1, Serialized) { Acquire(MEMORY_SLOT_LOCK, 0xFFFF) Store(ToInteger(Arg0), MEMORY_SLOT_SLECTOR) // select DIMM From fb775d9074e2b6047f2ea82bb3652ae197eec394 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:14 +0100 Subject: [PATCH 10/59] pc: acpi: memhp: move MHPD.MPXM method into SSDT Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/acpi/memory_hotplug_acpi_table.c | 14 ++++++++++++++ hw/i386/acpi-dsdt-mem-hotplug.dsl | 9 --------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/hw/acpi/memory_hotplug_acpi_table.c b/hw/acpi/memory_hotplug_acpi_table.c index 07d78f05af..5289014612 100644 --- a/hw/acpi/memory_hotplug_acpi_table.c +++ b/hw/acpi/memory_hotplug_acpi_table.c @@ -123,6 +123,20 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem, aml_append(method, aml_return(ret_val)); } aml_append(mem_ctrl_dev, method); + + method = aml_method(stringify(MEMORY_SLOT_PROXIMITY_METHOD), 1, + AML_NOTSERIALIZED); + { + Aml *proximity = aml_name(stringify(MEMORY_SLOT_PROXIMITY)); + + aml_append(method, aml_acquire(ctrl_lock, 0xFFFF)); + aml_append(method, aml_store(aml_to_integer(slot_arg0), + slot_selector)); + aml_append(method, aml_store(proximity, ret_val)); + aml_append(method, aml_release(ctrl_lock)); + aml_append(method, aml_return(ret_val)); + } + aml_append(mem_ctrl_dev, method); } aml_append(pci_scope, mem_ctrl_dev); aml_append(ctx, pci_scope); diff --git a/hw/i386/acpi-dsdt-mem-hotplug.dsl b/hw/i386/acpi-dsdt-mem-hotplug.dsl index 13e93dc6bd..02fecf2350 100644 --- a/hw/i386/acpi-dsdt-mem-hotplug.dsl +++ b/hw/i386/acpi-dsdt-mem-hotplug.dsl @@ -25,7 +25,6 @@ External(MEMORY_SLOT_ADDR_HIGH, FieldUnitObj) // read only External(MEMORY_SLOT_SIZE_LOW, FieldUnitObj) // read only External(MEMORY_SLOT_SIZE_HIGH, FieldUnitObj) // read only - External(MEMORY_SLOT_PROXIMITY, FieldUnitObj) // read only External(MEMORY_SLOT_EJECT, FieldUnitObj) // initiates device eject, write only External(MEMORY_SLOT_SLECTOR, FieldUnitObj) // DIMM selector, write only External(MEMORY_SLOT_OST_EVENT, FieldUnitObj) // _OST event code, write only @@ -96,14 +95,6 @@ Return(MR64) } - Method(MEMORY_SLOT_PROXIMITY_METHOD, 1) { - Acquire(MEMORY_SLOT_LOCK, 0xFFFF) - Store(ToInteger(Arg0), MEMORY_SLOT_SLECTOR) // select DIMM - Store(MEMORY_SLOT_PROXIMITY, Local0) - Release(MEMORY_SLOT_LOCK) - Return(Local0) - } - Method(MEMORY_SLOT_OST_METHOD, 4) { Acquire(MEMORY_SLOT_LOCK, 0xFFFF) Store(ToInteger(Arg0), MEMORY_SLOT_SLECTOR) // select DIMM From 2fbd884372668a077ecaa9a7f878dff96ccdf286 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:15 +0100 Subject: [PATCH 11/59] pc: acpi: memhp: move MHPD.MOST method into SSDT Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/acpi/memory_hotplug_acpi_table.c | 15 +++++++++++++++ hw/i386/acpi-dsdt-mem-hotplug.dsl | 10 ---------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/hw/acpi/memory_hotplug_acpi_table.c b/hw/acpi/memory_hotplug_acpi_table.c index 5289014612..4edf68009c 100644 --- a/hw/acpi/memory_hotplug_acpi_table.c +++ b/hw/acpi/memory_hotplug_acpi_table.c @@ -137,6 +137,21 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem, aml_append(method, aml_return(ret_val)); } aml_append(mem_ctrl_dev, method); + + method = aml_method(stringify(MEMORY_SLOT_OST_METHOD), 4, + AML_NOTSERIALIZED); + { + Aml *ost_evt = aml_name(stringify(MEMORY_SLOT_OST_EVENT)); + Aml *ost_status = aml_name(stringify(MEMORY_SLOT_OST_STATUS)); + + aml_append(method, aml_acquire(ctrl_lock, 0xFFFF)); + aml_append(method, aml_store(aml_to_integer(slot_arg0), + slot_selector)); + aml_append(method, aml_store(aml_arg(1), ost_evt)); + aml_append(method, aml_store(aml_arg(2), ost_status)); + aml_append(method, aml_release(ctrl_lock)); + } + aml_append(mem_ctrl_dev, method); } aml_append(pci_scope, mem_ctrl_dev); aml_append(ctx, pci_scope); diff --git a/hw/i386/acpi-dsdt-mem-hotplug.dsl b/hw/i386/acpi-dsdt-mem-hotplug.dsl index 02fecf2350..8889eca5ed 100644 --- a/hw/i386/acpi-dsdt-mem-hotplug.dsl +++ b/hw/i386/acpi-dsdt-mem-hotplug.dsl @@ -27,8 +27,6 @@ External(MEMORY_SLOT_SIZE_HIGH, FieldUnitObj) // read only External(MEMORY_SLOT_EJECT, FieldUnitObj) // initiates device eject, write only External(MEMORY_SLOT_SLECTOR, FieldUnitObj) // DIMM selector, write only - External(MEMORY_SLOT_OST_EVENT, FieldUnitObj) // _OST event code, write only - External(MEMORY_SLOT_OST_STATUS, FieldUnitObj) // _OST status code, write only External(MEMORY_SLOT_LOCK, MutexObj) Method(MEMORY_SLOT_CRS_METHOD, 1, Serialized) { @@ -95,14 +93,6 @@ Return(MR64) } - Method(MEMORY_SLOT_OST_METHOD, 4) { - Acquire(MEMORY_SLOT_LOCK, 0xFFFF) - Store(ToInteger(Arg0), MEMORY_SLOT_SLECTOR) // select DIMM - Store(Arg1, MEMORY_SLOT_OST_EVENT) - Store(Arg2, MEMORY_SLOT_OST_STATUS) - Release(MEMORY_SLOT_LOCK) - } - Method(MEMORY_SLOT_EJECT_METHOD, 2) { Acquire(MEMORY_SLOT_LOCK, 0xFFFF) Store(ToInteger(Arg0), MEMORY_SLOT_SLECTOR) // select DIMM From e328e316608d696519d8248319ec323868db5dee Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:16 +0100 Subject: [PATCH 12/59] pc: acpi: memhp: move MHPD.MEJ0 method into SSDT Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/acpi/memory_hotplug_acpi_table.c | 13 +++++++++++++ hw/i386/acpi-dsdt-mem-hotplug.dsl | 8 -------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/hw/acpi/memory_hotplug_acpi_table.c b/hw/acpi/memory_hotplug_acpi_table.c index 4edf68009c..c2bfcd6b8a 100644 --- a/hw/acpi/memory_hotplug_acpi_table.c +++ b/hw/acpi/memory_hotplug_acpi_table.c @@ -152,6 +152,19 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem, aml_append(method, aml_release(ctrl_lock)); } aml_append(mem_ctrl_dev, method); + + method = aml_method(stringify(MEMORY_SLOT_EJECT_METHOD), 2, + AML_NOTSERIALIZED); + { + Aml *eject = aml_name(stringify(MEMORY_SLOT_EJECT)); + + aml_append(method, aml_acquire(ctrl_lock, 0xFFFF)); + aml_append(method, aml_store(aml_to_integer(slot_arg0), + slot_selector)); + aml_append(method, aml_store(one, eject)); + aml_append(method, aml_release(ctrl_lock)); + } + aml_append(mem_ctrl_dev, method); } aml_append(pci_scope, mem_ctrl_dev); aml_append(ctx, pci_scope); diff --git a/hw/i386/acpi-dsdt-mem-hotplug.dsl b/hw/i386/acpi-dsdt-mem-hotplug.dsl index 8889eca5ed..87d8d66bde 100644 --- a/hw/i386/acpi-dsdt-mem-hotplug.dsl +++ b/hw/i386/acpi-dsdt-mem-hotplug.dsl @@ -25,7 +25,6 @@ External(MEMORY_SLOT_ADDR_HIGH, FieldUnitObj) // read only External(MEMORY_SLOT_SIZE_LOW, FieldUnitObj) // read only External(MEMORY_SLOT_SIZE_HIGH, FieldUnitObj) // read only - External(MEMORY_SLOT_EJECT, FieldUnitObj) // initiates device eject, write only External(MEMORY_SLOT_SLECTOR, FieldUnitObj) // DIMM selector, write only External(MEMORY_SLOT_LOCK, MutexObj) @@ -92,12 +91,5 @@ Release(MEMORY_SLOT_LOCK) Return(MR64) } - - Method(MEMORY_SLOT_EJECT_METHOD, 2) { - Acquire(MEMORY_SLOT_LOCK, 0xFFFF) - Store(ToInteger(Arg0), MEMORY_SLOT_SLECTOR) // select DIMM - Store(1, MEMORY_SLOT_EJECT) - Release(MEMORY_SLOT_LOCK) - } } // Device() } // Scope() From c943764596fe9d507b926e64381cb0ba3d3aec20 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:17 +0100 Subject: [PATCH 13/59] pc: acpi: memhp: move MHPD.MCRS method into SSDT Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/acpi/memory_hotplug_acpi_table.c | 92 +++++++++++++++++++++++++++++ hw/i386/acpi-dsdt-mem-hotplug.dsl | 72 ---------------------- 2 files changed, 92 insertions(+), 72 deletions(-) diff --git a/hw/acpi/memory_hotplug_acpi_table.c b/hw/acpi/memory_hotplug_acpi_table.c index c2bfcd6b8a..c76a7d82a0 100644 --- a/hw/acpi/memory_hotplug_acpi_table.c +++ b/hw/acpi/memory_hotplug_acpi_table.c @@ -124,6 +124,98 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem, } aml_append(mem_ctrl_dev, method); + method = aml_method(stringify(MEMORY_SLOT_CRS_METHOD), 1, + AML_SERIALIZED); + { + Aml *mr64 = aml_name("MR64"); + Aml *mr32 = aml_name("MR32"); + Aml *crs_tmpl = aml_resource_template(); + Aml *minl = aml_name("MINL"); + Aml *minh = aml_name("MINH"); + Aml *maxl = aml_name("MAXL"); + Aml *maxh = aml_name("MAXH"); + Aml *lenl = aml_name("LENL"); + Aml *lenh = aml_name("LENH"); + + aml_append(method, aml_acquire(ctrl_lock, 0xFFFF)); + aml_append(method, aml_store(aml_to_integer(slot_arg0), + slot_selector)); + + aml_append(crs_tmpl, + aml_qword_memory(AML_POS_DECODE, AML_MIN_FIXED, AML_MAX_FIXED, + AML_CACHEABLE, AML_READ_WRITE, + 0, 0x0, 0xFFFFFFFFFFFFFFFEULL, 0, + 0xFFFFFFFFFFFFFFFFULL)); + aml_append(method, aml_name_decl("MR64", crs_tmpl)); + aml_append(method, + aml_create_dword_field(mr64, aml_int(14), "MINL")); + aml_append(method, + aml_create_dword_field(mr64, aml_int(18), "MINH")); + aml_append(method, + aml_create_dword_field(mr64, aml_int(38), "LENL")); + aml_append(method, + aml_create_dword_field(mr64, aml_int(42), "LENH")); + aml_append(method, + aml_create_dword_field(mr64, aml_int(22), "MAXL")); + aml_append(method, + aml_create_dword_field(mr64, aml_int(26), "MAXH")); + + aml_append(method, + aml_store(aml_name(stringify(MEMORY_SLOT_ADDR_HIGH)), minh)); + aml_append(method, + aml_store(aml_name(stringify(MEMORY_SLOT_ADDR_LOW)), minl)); + aml_append(method, + aml_store(aml_name(stringify(MEMORY_SLOT_SIZE_HIGH)), lenh)); + aml_append(method, + aml_store(aml_name(stringify(MEMORY_SLOT_SIZE_LOW)), lenl)); + + /* 64-bit math: MAX = MIN + LEN - 1 */ + aml_append(method, aml_add(minl, lenl, maxl)); + aml_append(method, aml_add(minh, lenh, maxh)); + ifctx = aml_if(aml_lless(maxl, minl)); + { + aml_append(ifctx, aml_add(maxh, one, maxh)); + } + aml_append(method, ifctx); + ifctx = aml_if(aml_lless(maxl, one)); + { + aml_append(ifctx, aml_subtract(maxh, one, maxh)); + } + aml_append(method, ifctx); + aml_append(method, aml_subtract(maxl, one, maxl)); + + /* return 32-bit _CRS if addr/size is in low mem */ + /* TODO: remove it since all hotplugged DIMMs are in high mem */ + ifctx = aml_if(aml_equal(maxh, zero)); + { + crs_tmpl = aml_resource_template(); + aml_append(crs_tmpl, + aml_dword_memory(AML_POS_DECODE, AML_MIN_FIXED, + AML_MAX_FIXED, AML_CACHEABLE, + AML_READ_WRITE, + 0, 0x0, 0xFFFFFFFE, 0, + 0xFFFFFFFF)); + aml_append(ifctx, aml_name_decl("MR32", crs_tmpl)); + aml_append(ifctx, + aml_create_dword_field(mr32, aml_int(10), "MIN")); + aml_append(ifctx, + aml_create_dword_field(mr32, aml_int(14), "MAX")); + aml_append(ifctx, + aml_create_dword_field(mr32, aml_int(22), "LEN")); + aml_append(ifctx, aml_store(minl, aml_name("MIN"))); + aml_append(ifctx, aml_store(maxl, aml_name("MAX"))); + aml_append(ifctx, aml_store(lenl, aml_name("LEN"))); + + aml_append(ifctx, aml_release(ctrl_lock)); + aml_append(ifctx, aml_return(mr32)); + } + aml_append(method, ifctx); + + aml_append(method, aml_release(ctrl_lock)); + aml_append(method, aml_return(mr64)); + } + aml_append(mem_ctrl_dev, method); + method = aml_method(stringify(MEMORY_SLOT_PROXIMITY_METHOD), 1, AML_NOTSERIALIZED); { diff --git a/hw/i386/acpi-dsdt-mem-hotplug.dsl b/hw/i386/acpi-dsdt-mem-hotplug.dsl index 87d8d66bde..50b7541372 100644 --- a/hw/i386/acpi-dsdt-mem-hotplug.dsl +++ b/hw/i386/acpi-dsdt-mem-hotplug.dsl @@ -19,77 +19,5 @@ Device(MEMORY_HOTPLUG_DEVICE) { Name(_HID, "PNP0A06") Name(_UID, "Memory hotplug resources") - - /* Memory hotplug IO registers */ - External(MEMORY_SLOT_ADDR_LOW, FieldUnitObj) // read only - External(MEMORY_SLOT_ADDR_HIGH, FieldUnitObj) // read only - External(MEMORY_SLOT_SIZE_LOW, FieldUnitObj) // read only - External(MEMORY_SLOT_SIZE_HIGH, FieldUnitObj) // read only - External(MEMORY_SLOT_SLECTOR, FieldUnitObj) // DIMM selector, write only - External(MEMORY_SLOT_LOCK, MutexObj) - - Method(MEMORY_SLOT_CRS_METHOD, 1, Serialized) { - Acquire(MEMORY_SLOT_LOCK, 0xFFFF) - Store(ToInteger(Arg0), MEMORY_SLOT_SLECTOR) // select DIMM - - Name(MR64, ResourceTemplate() { - QWordMemory(ResourceProducer, PosDecode, MinFixed, MaxFixed, - Cacheable, ReadWrite, - 0x0000000000000000, // Address Space Granularity - 0x0000000000000000, // Address Range Minimum - 0xFFFFFFFFFFFFFFFE, // Address Range Maximum - 0x0000000000000000, // Address Translation Offset - 0xFFFFFFFFFFFFFFFF, // Address Length - ,, MW64, AddressRangeMemory, TypeStatic) - }) - - CreateDWordField(MR64, 14, MINL) - CreateDWordField(MR64, 18, MINH) - CreateDWordField(MR64, 38, LENL) - CreateDWordField(MR64, 42, LENH) - CreateDWordField(MR64, 22, MAXL) - CreateDWordField(MR64, 26, MAXH) - - Store(MEMORY_SLOT_ADDR_HIGH, MINH) - Store(MEMORY_SLOT_ADDR_LOW, MINL) - Store(MEMORY_SLOT_SIZE_HIGH, LENH) - Store(MEMORY_SLOT_SIZE_LOW, LENL) - - // 64-bit math: MAX = MIN + LEN - 1 - Add(MINL, LENL, MAXL) - Add(MINH, LENH, MAXH) - If (LLess(MAXL, MINL)) { - Add(MAXH, One, MAXH) - } - If (LLess(MAXL, One)) { - Subtract(MAXH, One, MAXH) - } - Subtract(MAXL, One, MAXL) - - If (LEqual(MAXH, Zero)){ - Name(MR32, ResourceTemplate() { - DWordMemory(ResourceProducer, PosDecode, MinFixed, MaxFixed, - Cacheable, ReadWrite, - 0x00000000, // Address Space Granularity - 0x00000000, // Address Range Minimum - 0xFFFFFFFE, // Address Range Maximum - 0x00000000, // Address Translation Offset - 0xFFFFFFFF, // Address Length - ,, MW32, AddressRangeMemory, TypeStatic) - }) - CreateDWordField(MR32, MW32._MIN, MIN) - CreateDWordField(MR32, MW32._MAX, MAX) - CreateDWordField(MR32, MW32._LEN, LEN) - Store(MINL, MIN) - Store(MAXL, MAX) - Store(LENL, LEN) - - Release(MEMORY_SLOT_LOCK) - Return(MR32) - } - - Release(MEMORY_SLOT_LOCK) - Return(MR64) - } } // Device() } // Scope() From 2ca66546ce5da9c652caa1a90336ea7347662051 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:18 +0100 Subject: [PATCH 14/59] pc: acpi: memhp: move MHPD Device into SSDT move remnants of MHPD device from DSDT into SSDT. i.e. Device(MHPD), _UID, _HID Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/acpi/memory_hotplug_acpi_table.c | 6 +++++- hw/i386/acpi-dsdt-mem-hotplug.dsl | 7 ------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/hw/acpi/memory_hotplug_acpi_table.c b/hw/acpi/memory_hotplug_acpi_table.c index c76a7d82a0..b5b79e6841 100644 --- a/hw/acpi/memory_hotplug_acpi_table.c +++ b/hw/acpi/memory_hotplug_acpi_table.c @@ -24,7 +24,7 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem, /* scope for memory hotplug controller device node */ pci_scope = aml_scope("_SB.PCI0"); - mem_ctrl_dev = aml_scope(stringify(MEMORY_HOTPLUG_DEVICE)); + mem_ctrl_dev = aml_device(stringify(MEMORY_HOTPLUG_DEVICE)); { Aml *one = aml_int(1); Aml *zero = aml_int(0); @@ -34,6 +34,10 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem, Aml *ctrl_lock = aml_name(stringify(MEMORY_SLOT_LOCK)); Aml *slot_selector = aml_name(stringify(MEMORY_SLOT_SLECTOR)); + aml_append(mem_ctrl_dev, aml_name_decl("_HID", aml_string("PNP0A06"))); + aml_append(mem_ctrl_dev, + aml_name_decl("_UID", aml_string("Memory hotplug resources"))); + method = aml_method("_STA", 0, AML_NOTSERIALIZED); ifctx = aml_if(aml_equal(slots_nr, zero)); { diff --git a/hw/i386/acpi-dsdt-mem-hotplug.dsl b/hw/i386/acpi-dsdt-mem-hotplug.dsl index 50b7541372..20c5ec170e 100644 --- a/hw/i386/acpi-dsdt-mem-hotplug.dsl +++ b/hw/i386/acpi-dsdt-mem-hotplug.dsl @@ -14,10 +14,3 @@ */ External(\_SB.PCI0.MEMORY_HOTPLUG_DEVICE.MEMORY_SLOT_SCAN_METHOD, MethodObj) - - Scope(\_SB.PCI0) { - Device(MEMORY_HOTPLUG_DEVICE) { - Name(_HID, "PNP0A06") - Name(_UID, "Memory hotplug resources") - } // Device() - } // Scope() From f177d40ae2efebb6955ce3ef2b40f467cf1dfff0 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:19 +0100 Subject: [PATCH 15/59] pc: acpi: factor out memhp code from build_ssdt() into separate function before consolidating memhp code in memory_hotplug_acpi_table.c and for simplifying review, first factor out memhp code into new function build_memory_devices() in i386/acpi-build.c Signed-off-by: Igor Mammedov ---- PS: no functional change, only code movement. Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 239 +++++++++++++++++++++++-------------------- 1 file changed, 126 insertions(+), 113 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 52e4a151fc..4446d384bf 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -931,6 +931,130 @@ static Aml *build_crs(PCIHostState *host, return crs; } +static void build_memory_devices(Aml *sb_scope, int nr_mem, + uint16_t io_base, uint16_t io_len) +{ + int i; + Aml *scope; + Aml *crs; + Aml *field; + Aml *dev; + Aml *method; + Aml *ifctx; + + /* build memory devices */ + assert(nr_mem <= ACPI_MAX_RAM_SLOTS); + scope = aml_scope("\\_SB.PCI0." stringify(MEMORY_HOTPLUG_DEVICE)); + aml_append(scope, + aml_name_decl(stringify(MEMORY_SLOTS_NUMBER), aml_int(nr_mem)) + ); + + crs = aml_resource_template(); + aml_append(crs, + aml_io(AML_DECODE16, io_base, io_base, 0, io_len) + ); + aml_append(scope, aml_name_decl("_CRS", crs)); + + aml_append(scope, aml_operation_region( + stringify(MEMORY_HOTPLUG_IO_REGION), AML_SYSTEM_IO, + io_base, io_len) + ); + + field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), AML_DWORD_ACC, + AML_NOLOCK, AML_PRESERVE); + aml_append(field, /* read only */ + aml_named_field(stringify(MEMORY_SLOT_ADDR_LOW), 32)); + aml_append(field, /* read only */ + aml_named_field(stringify(MEMORY_SLOT_ADDR_HIGH), 32)); + aml_append(field, /* read only */ + aml_named_field(stringify(MEMORY_SLOT_SIZE_LOW), 32)); + aml_append(field, /* read only */ + aml_named_field(stringify(MEMORY_SLOT_SIZE_HIGH), 32)); + aml_append(field, /* read only */ + aml_named_field(stringify(MEMORY_SLOT_PROXIMITY), 32)); + aml_append(scope, field); + + field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), AML_BYTE_ACC, + AML_NOLOCK, AML_WRITE_AS_ZEROS); + aml_append(field, aml_reserved_field(160 /* bits, Offset(20) */)); + aml_append(field, /* 1 if enabled, read only */ + aml_named_field(stringify(MEMORY_SLOT_ENABLED), 1)); + aml_append(field, + /*(read) 1 if has a insert event. (write) 1 to clear event */ + aml_named_field(stringify(MEMORY_SLOT_INSERT_EVENT), 1)); + aml_append(field, + /* (read) 1 if has a remove event. (write) 1 to clear event */ + aml_named_field(stringify(MEMORY_SLOT_REMOVE_EVENT), 1)); + aml_append(field, + /* initiates device eject, write only */ + aml_named_field(stringify(MEMORY_SLOT_EJECT), 1)); + aml_append(scope, field); + + field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), AML_DWORD_ACC, + AML_NOLOCK, AML_PRESERVE); + aml_append(field, /* DIMM selector, write only */ + aml_named_field(stringify(MEMORY_SLOT_SLECTOR), 32)); + aml_append(field, /* _OST event code, write only */ + aml_named_field(stringify(MEMORY_SLOT_OST_EVENT), 32)); + aml_append(field, /* _OST status code, write only */ + aml_named_field(stringify(MEMORY_SLOT_OST_STATUS), 32)); + aml_append(scope, field); + aml_append(sb_scope, scope); + + for (i = 0; i < nr_mem; i++) { + #define BASEPATH "\\_SB.PCI0." stringify(MEMORY_HOTPLUG_DEVICE) "." + const char *s; + + dev = aml_device("MP%02X", i); + aml_append(dev, aml_name_decl("_UID", aml_string("0x%02X", i))); + aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C80"))); + + method = aml_method("_CRS", 0, AML_NOTSERIALIZED); + s = BASEPATH stringify(MEMORY_SLOT_CRS_METHOD); + aml_append(method, aml_return(aml_call1(s, aml_name("_UID")))); + aml_append(dev, method); + + method = aml_method("_STA", 0, AML_NOTSERIALIZED); + s = BASEPATH stringify(MEMORY_SLOT_STATUS_METHOD); + aml_append(method, aml_return(aml_call1(s, aml_name("_UID")))); + aml_append(dev, method); + + method = aml_method("_PXM", 0, AML_NOTSERIALIZED); + s = BASEPATH stringify(MEMORY_SLOT_PROXIMITY_METHOD); + aml_append(method, aml_return(aml_call1(s, aml_name("_UID")))); + aml_append(dev, method); + + method = aml_method("_OST", 3, AML_NOTSERIALIZED); + s = BASEPATH stringify(MEMORY_SLOT_OST_METHOD); + aml_append(method, aml_return(aml_call4( + s, aml_name("_UID"), aml_arg(0), aml_arg(1), aml_arg(2) + ))); + aml_append(dev, method); + + method = aml_method("_EJ0", 1, AML_NOTSERIALIZED); + s = BASEPATH stringify(MEMORY_SLOT_EJECT_METHOD); + aml_append(method, aml_return(aml_call2( + s, aml_name("_UID"), aml_arg(0)))); + aml_append(dev, method); + + aml_append(sb_scope, dev); + } + + /* build Method(MEMORY_SLOT_NOTIFY_METHOD, 2) { + * If (LEqual(Arg0, 0x00)) {Notify(MP00, Arg1)} ... } + */ + method = aml_method(stringify(MEMORY_SLOT_NOTIFY_METHOD), 2, + AML_NOTSERIALIZED); + for (i = 0; i < nr_mem; i++) { + ifctx = aml_if(aml_equal(aml_arg(0), aml_int(i))); + aml_append(ifctx, + aml_notify(aml_name("MP%.02X", i), aml_arg(1)) + ); + aml_append(method, ifctx); + } + aml_append(sb_scope, method); +} + static void build_ssdt(GArray *table_data, GArray *linker, AcpiCpuInfo *cpu, AcpiPmInfo *pm, AcpiMiscInfo *misc, @@ -1233,119 +1357,8 @@ build_ssdt(GArray *table_data, GArray *linker, } aml_append(sb_scope, aml_name_decl("CPON", pkg)); - /* build memory devices */ - assert(nr_mem <= ACPI_MAX_RAM_SLOTS); - scope = aml_scope("\\_SB.PCI0." stringify(MEMORY_HOTPLUG_DEVICE)); - aml_append(scope, - aml_name_decl(stringify(MEMORY_SLOTS_NUMBER), aml_int(nr_mem)) - ); - - crs = aml_resource_template(); - aml_append(crs, - aml_io(AML_DECODE16, pm->mem_hp_io_base, pm->mem_hp_io_base, 0, - pm->mem_hp_io_len) - ); - aml_append(scope, aml_name_decl("_CRS", crs)); - - aml_append(scope, aml_operation_region( - stringify(MEMORY_HOTPLUG_IO_REGION), AML_SYSTEM_IO, - pm->mem_hp_io_base, pm->mem_hp_io_len) - ); - - field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), AML_DWORD_ACC, - AML_NOLOCK, AML_PRESERVE); - aml_append(field, /* read only */ - aml_named_field(stringify(MEMORY_SLOT_ADDR_LOW), 32)); - aml_append(field, /* read only */ - aml_named_field(stringify(MEMORY_SLOT_ADDR_HIGH), 32)); - aml_append(field, /* read only */ - aml_named_field(stringify(MEMORY_SLOT_SIZE_LOW), 32)); - aml_append(field, /* read only */ - aml_named_field(stringify(MEMORY_SLOT_SIZE_HIGH), 32)); - aml_append(field, /* read only */ - aml_named_field(stringify(MEMORY_SLOT_PROXIMITY), 32)); - aml_append(scope, field); - - field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), AML_BYTE_ACC, - AML_NOLOCK, AML_WRITE_AS_ZEROS); - aml_append(field, aml_reserved_field(160 /* bits, Offset(20) */)); - aml_append(field, /* 1 if enabled, read only */ - aml_named_field(stringify(MEMORY_SLOT_ENABLED), 1)); - aml_append(field, - /*(read) 1 if has a insert event. (write) 1 to clear event */ - aml_named_field(stringify(MEMORY_SLOT_INSERT_EVENT), 1)); - aml_append(field, - /* (read) 1 if has a remove event. (write) 1 to clear event */ - aml_named_field(stringify(MEMORY_SLOT_REMOVE_EVENT), 1)); - aml_append(field, - /* initiates device eject, write only */ - aml_named_field(stringify(MEMORY_SLOT_EJECT), 1)); - aml_append(scope, field); - - field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), AML_DWORD_ACC, - AML_NOLOCK, AML_PRESERVE); - aml_append(field, /* DIMM selector, write only */ - aml_named_field(stringify(MEMORY_SLOT_SLECTOR), 32)); - aml_append(field, /* _OST event code, write only */ - aml_named_field(stringify(MEMORY_SLOT_OST_EVENT), 32)); - aml_append(field, /* _OST status code, write only */ - aml_named_field(stringify(MEMORY_SLOT_OST_STATUS), 32)); - aml_append(scope, field); - - aml_append(sb_scope, scope); - - for (i = 0; i < nr_mem; i++) { - #define BASEPATH "\\_SB.PCI0." stringify(MEMORY_HOTPLUG_DEVICE) "." - const char *s; - - dev = aml_device("MP%02X", i); - aml_append(dev, aml_name_decl("_UID", aml_string("0x%02X", i))); - aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C80"))); - - method = aml_method("_CRS", 0, AML_NOTSERIALIZED); - s = BASEPATH stringify(MEMORY_SLOT_CRS_METHOD); - aml_append(method, aml_return(aml_call1(s, aml_name("_UID")))); - aml_append(dev, method); - - method = aml_method("_STA", 0, AML_NOTSERIALIZED); - s = BASEPATH stringify(MEMORY_SLOT_STATUS_METHOD); - aml_append(method, aml_return(aml_call1(s, aml_name("_UID")))); - aml_append(dev, method); - - method = aml_method("_PXM", 0, AML_NOTSERIALIZED); - s = BASEPATH stringify(MEMORY_SLOT_PROXIMITY_METHOD); - aml_append(method, aml_return(aml_call1(s, aml_name("_UID")))); - aml_append(dev, method); - - method = aml_method("_OST", 3, AML_NOTSERIALIZED); - s = BASEPATH stringify(MEMORY_SLOT_OST_METHOD); - aml_append(method, aml_return(aml_call4( - s, aml_name("_UID"), aml_arg(0), aml_arg(1), aml_arg(2) - ))); - aml_append(dev, method); - - method = aml_method("_EJ0", 1, AML_NOTSERIALIZED); - s = BASEPATH stringify(MEMORY_SLOT_EJECT_METHOD); - aml_append(method, aml_return(aml_call2( - s, aml_name("_UID"), aml_arg(0)))); - aml_append(dev, method); - - aml_append(sb_scope, dev); - } - - /* build Method(MEMORY_SLOT_NOTIFY_METHOD, 2) { - * If (LEqual(Arg0, 0x00)) {Notify(MP00, Arg1)} ... } - */ - method = aml_method(stringify(MEMORY_SLOT_NOTIFY_METHOD), 2, - AML_NOTSERIALIZED); - for (i = 0; i < nr_mem; i++) { - ifctx = aml_if(aml_equal(aml_arg(0), aml_int(i))); - aml_append(ifctx, - aml_notify(aml_name("MP%.02X", i), aml_arg(1)) - ); - aml_append(method, ifctx); - } - aml_append(sb_scope, method); + build_memory_devices(sb_scope, nr_mem, pm->mem_hp_io_base, + pm->mem_hp_io_len); { Object *pci_host; From 7f4495e1c152852614753a83bc4e2850fbfd036e Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:20 +0100 Subject: [PATCH 16/59] pc: acpi: memhp: move \_GPE._E03 into SSDT in addition remove no longer needed acpi-dsdt-mem-hotplug.dsl. Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 6 ++++++ hw/i386/acpi-dsdt-mem-hotplug.dsl | 16 ---------------- hw/i386/acpi-dsdt.dsl | 5 ----- hw/i386/q35-acpi-dsdt.dsl | 5 ----- include/hw/acpi/memory_hotplug.h | 5 +++++ include/hw/acpi/pc-hotplug.h | 2 -- 6 files changed, 11 insertions(+), 28 deletions(-) delete mode 100644 hw/i386/acpi-dsdt-mem-hotplug.dsl diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 4446d384bf..3c2b889c6d 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1083,6 +1083,12 @@ build_ssdt(GArray *table_data, GArray *linker, build_memory_hotplug_aml(ssdt, nr_mem, pm->mem_hp_io_base, pm->mem_hp_io_len); + scope = aml_scope("\\_GPE"); + method = aml_method("_E03", 0, AML_NOTSERIALIZED); + aml_append(method, aml_call0(MEMORY_HOTPLUG_HANDLER_PATH)); + aml_append(scope, method); + aml_append(ssdt, scope); + bus = PC_MACHINE(machine)->bus; if (bus) { QLIST_FOREACH(bus, &bus->child, sibling) { diff --git a/hw/i386/acpi-dsdt-mem-hotplug.dsl b/hw/i386/acpi-dsdt-mem-hotplug.dsl deleted file mode 100644 index 20c5ec170e..0000000000 --- a/hw/i386/acpi-dsdt-mem-hotplug.dsl +++ /dev/null @@ -1,16 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License along - * with this program; if not, see . - */ - - External(\_SB.PCI0.MEMORY_HOTPLUG_DEVICE.MEMORY_SLOT_SCAN_METHOD, MethodObj) diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl index 8dba096dd8..9cf1b88528 100644 --- a/hw/i386/acpi-dsdt.dsl +++ b/hw/i386/acpi-dsdt.dsl @@ -250,7 +250,6 @@ DefinitionBlock ( #include "hw/acpi/pc-hotplug.h" #define CPU_STATUS_BASE PIIX4_CPU_HOTPLUG_IO_BASE #include "acpi-dsdt-cpu-hotplug.dsl" -#include "acpi-dsdt-mem-hotplug.dsl" /**************************************************************** @@ -271,10 +270,6 @@ DefinitionBlock ( // CPU hotplug event \_SB.PRSC() } - Method(_E03) { - // Memory hotplug event - \_SB.PCI0.MEMORY_HOTPLUG_DEVICE.MEMORY_SLOT_SCAN_METHOD() - } Method(_L04) { } Method(_L05) { diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl index 7be7b37b87..f950f39f2d 100644 --- a/hw/i386/q35-acpi-dsdt.dsl +++ b/hw/i386/q35-acpi-dsdt.dsl @@ -387,7 +387,6 @@ DefinitionBlock ( #include "hw/acpi/pc-hotplug.h" #define CPU_STATUS_BASE ICH9_CPU_HOTPLUG_IO_BASE #include "acpi-dsdt-cpu-hotplug.dsl" -#include "acpi-dsdt-mem-hotplug.dsl" /**************************************************************** @@ -404,10 +403,6 @@ DefinitionBlock ( // CPU hotplug event \_SB.PRSC() } - Method(_E03) { - // Memory hotplug event - \_SB.PCI0.MEMORY_HOTPLUG_DEVICE.MEMORY_SLOT_SCAN_METHOD() - } Method(_L04) { } Method(_L05) { diff --git a/include/hw/acpi/memory_hotplug.h b/include/hw/acpi/memory_hotplug.h index b6e9f50963..de164f2d3e 100644 --- a/include/hw/acpi/memory_hotplug.h +++ b/include/hw/acpi/memory_hotplug.h @@ -47,6 +47,11 @@ extern const VMStateDescription vmstate_memory_hotplug; void acpi_memory_ospm_status(MemHotplugState *mem_st, ACPIOSTInfoList ***list); +#define MEMORY_HOTPLUG_DEVICE MHPD +#define MEMORY_SLOT_SCAN_METHOD MSCN +#define MEMORY_HOTPLUG_HANDLER_PATH "\\_SB.PCI0." \ + stringify(MEMORY_HOTPLUG_DEVICE) "." stringify(MEMORY_SLOT_SCAN_METHOD) + void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem, uint16_t io_base, uint16_t io_len); #endif diff --git a/include/hw/acpi/pc-hotplug.h b/include/hw/acpi/pc-hotplug.h index 77b1569007..e5bb3217c3 100644 --- a/include/hw/acpi/pc-hotplug.h +++ b/include/hw/acpi/pc-hotplug.h @@ -32,7 +32,6 @@ #define ACPI_MEMORY_HOTPLUG_IO_LEN 24 #define ACPI_MEMORY_HOTPLUG_BASE 0x0a00 -#define MEMORY_HOTPLUG_DEVICE MHPD #define MEMORY_SLOTS_NUMBER MDNR #define MEMORY_HOTPLUG_IO_REGION HPMR #define MEMORY_SLOT_ADDR_LOW MRBL @@ -54,6 +53,5 @@ #define MEMORY_SLOT_PROXIMITY_METHOD MPXM #define MEMORY_SLOT_EJECT_METHOD MEJ0 #define MEMORY_SLOT_NOTIFY_METHOD MTFY -#define MEMORY_SLOT_SCAN_METHOD MSCN #endif From f84548dda458bc4da89ecee7f812fcd4ce2eb651 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:21 +0100 Subject: [PATCH 17/59] pc: acpi: memhp: drop not needed stringify(MEMORY_foo) usage most of MEMORY_foo defines are not shared with ASL anymore and are used only inside of memory_hotplug_acpi_table.c, so move them there and make them strings. As result we can replace stringify(MEMORY_foo) with just MEMORY_foo, which makes code a bit cleaner. No AML change introduced by this patch. Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/acpi/memory_hotplug_acpi_table.c | 53 +++++++++++++---------------- hw/i386/acpi-build.c | 52 ++++++++++++++-------------- include/hw/acpi/memory_hotplug.h | 6 ++-- include/hw/acpi/pc-hotplug.h | 42 +++++++++++------------ 4 files changed, 74 insertions(+), 79 deletions(-) diff --git a/hw/acpi/memory_hotplug_acpi_table.c b/hw/acpi/memory_hotplug_acpi_table.c index b5b79e6841..080d9add5b 100644 --- a/hw/acpi/memory_hotplug_acpi_table.c +++ b/hw/acpi/memory_hotplug_acpi_table.c @@ -24,15 +24,15 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem, /* scope for memory hotplug controller device node */ pci_scope = aml_scope("_SB.PCI0"); - mem_ctrl_dev = aml_device(stringify(MEMORY_HOTPLUG_DEVICE)); + mem_ctrl_dev = aml_device(MEMORY_HOTPLUG_DEVICE); { Aml *one = aml_int(1); Aml *zero = aml_int(0); Aml *ret_val = aml_local(0); Aml *slot_arg0 = aml_arg(0); - Aml *slots_nr = aml_name(stringify(MEMORY_SLOTS_NUMBER)); - Aml *ctrl_lock = aml_name(stringify(MEMORY_SLOT_LOCK)); - Aml *slot_selector = aml_name(stringify(MEMORY_SLOT_SLECTOR)); + Aml *slots_nr = aml_name(MEMORY_SLOTS_NUMBER); + Aml *ctrl_lock = aml_name(MEMORY_SLOT_LOCK); + Aml *slot_selector = aml_name(MEMORY_SLOT_SLECTOR); aml_append(mem_ctrl_dev, aml_name_decl("_HID", aml_string("PNP0A06"))); aml_append(mem_ctrl_dev, @@ -48,10 +48,9 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem, aml_append(method, aml_return(aml_int(0xB))); aml_append(mem_ctrl_dev, method); - aml_append(mem_ctrl_dev, aml_mutex(stringify(MEMORY_SLOT_LOCK), 0)); + aml_append(mem_ctrl_dev, aml_mutex(MEMORY_SLOT_LOCK, 0)); - method = aml_method(stringify(MEMORY_SLOT_SCAN_METHOD), 0, - AML_NOTSERIALIZED); + method = aml_method(MEMORY_SLOT_SCAN_METHOD, 0, AML_NOTSERIALIZED); { Aml *else_ctx; Aml *while_ctx; @@ -75,14 +74,14 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem, */ while_ctx = aml_while(aml_lless(idx, slots_nr)); { - Aml *ins_evt = aml_name(stringify(MEMORY_SLOT_INSERT_EVENT)); - Aml *rm_evt = aml_name(stringify(MEMORY_SLOT_REMOVE_EVENT)); + Aml *ins_evt = aml_name(MEMORY_SLOT_INSERT_EVENT); + Aml *rm_evt = aml_name(MEMORY_SLOT_REMOVE_EVENT); aml_append(while_ctx, aml_store(idx, slot_selector)); ifctx = aml_if(aml_equal(ins_evt, one)); { aml_append(ifctx, - aml_call2(stringify(MEMORY_SLOT_NOTIFY_METHOD), + aml_call2(MEMORY_SLOT_NOTIFY_METHOD, idx, dev_chk)); aml_append(ifctx, aml_store(one, ins_evt)); } @@ -92,7 +91,7 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem, ifctx = aml_if(aml_equal(rm_evt, one)); { aml_append(ifctx, - aml_call2(stringify(MEMORY_SLOT_NOTIFY_METHOD), + aml_call2(MEMORY_SLOT_NOTIFY_METHOD, idx, eject_req)); aml_append(ifctx, aml_store(one, rm_evt)); } @@ -107,10 +106,9 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem, } aml_append(mem_ctrl_dev, method); - method = aml_method(stringify(MEMORY_SLOT_STATUS_METHOD), 1, - AML_NOTSERIALIZED); + method = aml_method(MEMORY_SLOT_STATUS_METHOD, 1, AML_NOTSERIALIZED); { - Aml *slot_enabled = aml_name(stringify(MEMORY_SLOT_ENABLED)); + Aml *slot_enabled = aml_name(MEMORY_SLOT_ENABLED); aml_append(method, aml_store(zero, ret_val)); aml_append(method, aml_acquire(ctrl_lock, 0xFFFF)); @@ -128,8 +126,7 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem, } aml_append(mem_ctrl_dev, method); - method = aml_method(stringify(MEMORY_SLOT_CRS_METHOD), 1, - AML_SERIALIZED); + method = aml_method(MEMORY_SLOT_CRS_METHOD, 1, AML_SERIALIZED); { Aml *mr64 = aml_name("MR64"); Aml *mr32 = aml_name("MR32"); @@ -165,13 +162,13 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem, aml_create_dword_field(mr64, aml_int(26), "MAXH")); aml_append(method, - aml_store(aml_name(stringify(MEMORY_SLOT_ADDR_HIGH)), minh)); + aml_store(aml_name(MEMORY_SLOT_ADDR_HIGH), minh)); aml_append(method, - aml_store(aml_name(stringify(MEMORY_SLOT_ADDR_LOW)), minl)); + aml_store(aml_name(MEMORY_SLOT_ADDR_LOW), minl)); aml_append(method, - aml_store(aml_name(stringify(MEMORY_SLOT_SIZE_HIGH)), lenh)); + aml_store(aml_name(MEMORY_SLOT_SIZE_HIGH), lenh)); aml_append(method, - aml_store(aml_name(stringify(MEMORY_SLOT_SIZE_LOW)), lenl)); + aml_store(aml_name(MEMORY_SLOT_SIZE_LOW), lenl)); /* 64-bit math: MAX = MIN + LEN - 1 */ aml_append(method, aml_add(minl, lenl, maxl)); @@ -220,10 +217,10 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem, } aml_append(mem_ctrl_dev, method); - method = aml_method(stringify(MEMORY_SLOT_PROXIMITY_METHOD), 1, + method = aml_method(MEMORY_SLOT_PROXIMITY_METHOD, 1, AML_NOTSERIALIZED); { - Aml *proximity = aml_name(stringify(MEMORY_SLOT_PROXIMITY)); + Aml *proximity = aml_name(MEMORY_SLOT_PROXIMITY); aml_append(method, aml_acquire(ctrl_lock, 0xFFFF)); aml_append(method, aml_store(aml_to_integer(slot_arg0), @@ -234,11 +231,10 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem, } aml_append(mem_ctrl_dev, method); - method = aml_method(stringify(MEMORY_SLOT_OST_METHOD), 4, - AML_NOTSERIALIZED); + method = aml_method(MEMORY_SLOT_OST_METHOD, 4, AML_NOTSERIALIZED); { - Aml *ost_evt = aml_name(stringify(MEMORY_SLOT_OST_EVENT)); - Aml *ost_status = aml_name(stringify(MEMORY_SLOT_OST_STATUS)); + Aml *ost_evt = aml_name(MEMORY_SLOT_OST_EVENT); + Aml *ost_status = aml_name(MEMORY_SLOT_OST_STATUS); aml_append(method, aml_acquire(ctrl_lock, 0xFFFF)); aml_append(method, aml_store(aml_to_integer(slot_arg0), @@ -249,10 +245,9 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem, } aml_append(mem_ctrl_dev, method); - method = aml_method(stringify(MEMORY_SLOT_EJECT_METHOD), 2, - AML_NOTSERIALIZED); + method = aml_method(MEMORY_SLOT_EJECT_METHOD, 2, AML_NOTSERIALIZED); { - Aml *eject = aml_name(stringify(MEMORY_SLOT_EJECT)); + Aml *eject = aml_name(MEMORY_SLOT_EJECT); aml_append(method, aml_acquire(ctrl_lock, 0xFFFF)); aml_append(method, aml_store(aml_to_integer(slot_arg0), diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 3c2b889c6d..42e60c1d3a 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -944,9 +944,9 @@ static void build_memory_devices(Aml *sb_scope, int nr_mem, /* build memory devices */ assert(nr_mem <= ACPI_MAX_RAM_SLOTS); - scope = aml_scope("\\_SB.PCI0." stringify(MEMORY_HOTPLUG_DEVICE)); + scope = aml_scope("\\_SB.PCI0." MEMORY_HOTPLUG_DEVICE); aml_append(scope, - aml_name_decl(stringify(MEMORY_SLOTS_NUMBER), aml_int(nr_mem)) + aml_name_decl(MEMORY_SLOTS_NUMBER, aml_int(nr_mem)) ); crs = aml_resource_template(); @@ -956,53 +956,53 @@ static void build_memory_devices(Aml *sb_scope, int nr_mem, aml_append(scope, aml_name_decl("_CRS", crs)); aml_append(scope, aml_operation_region( - stringify(MEMORY_HOTPLUG_IO_REGION), AML_SYSTEM_IO, + MEMORY_HOTPLUG_IO_REGION, AML_SYSTEM_IO, io_base, io_len) ); - field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), AML_DWORD_ACC, + field = aml_field(MEMORY_HOTPLUG_IO_REGION, AML_DWORD_ACC, AML_NOLOCK, AML_PRESERVE); aml_append(field, /* read only */ - aml_named_field(stringify(MEMORY_SLOT_ADDR_LOW), 32)); + aml_named_field(MEMORY_SLOT_ADDR_LOW, 32)); aml_append(field, /* read only */ - aml_named_field(stringify(MEMORY_SLOT_ADDR_HIGH), 32)); + aml_named_field(MEMORY_SLOT_ADDR_HIGH, 32)); aml_append(field, /* read only */ - aml_named_field(stringify(MEMORY_SLOT_SIZE_LOW), 32)); + aml_named_field(MEMORY_SLOT_SIZE_LOW, 32)); aml_append(field, /* read only */ - aml_named_field(stringify(MEMORY_SLOT_SIZE_HIGH), 32)); + aml_named_field(MEMORY_SLOT_SIZE_HIGH, 32)); aml_append(field, /* read only */ - aml_named_field(stringify(MEMORY_SLOT_PROXIMITY), 32)); + aml_named_field(MEMORY_SLOT_PROXIMITY, 32)); aml_append(scope, field); - field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), AML_BYTE_ACC, + field = aml_field(MEMORY_HOTPLUG_IO_REGION, AML_BYTE_ACC, AML_NOLOCK, AML_WRITE_AS_ZEROS); aml_append(field, aml_reserved_field(160 /* bits, Offset(20) */)); aml_append(field, /* 1 if enabled, read only */ - aml_named_field(stringify(MEMORY_SLOT_ENABLED), 1)); + aml_named_field(MEMORY_SLOT_ENABLED, 1)); aml_append(field, /*(read) 1 if has a insert event. (write) 1 to clear event */ - aml_named_field(stringify(MEMORY_SLOT_INSERT_EVENT), 1)); + aml_named_field(MEMORY_SLOT_INSERT_EVENT, 1)); aml_append(field, /* (read) 1 if has a remove event. (write) 1 to clear event */ - aml_named_field(stringify(MEMORY_SLOT_REMOVE_EVENT), 1)); + aml_named_field(MEMORY_SLOT_REMOVE_EVENT, 1)); aml_append(field, /* initiates device eject, write only */ - aml_named_field(stringify(MEMORY_SLOT_EJECT), 1)); + aml_named_field(MEMORY_SLOT_EJECT, 1)); aml_append(scope, field); - field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), AML_DWORD_ACC, + field = aml_field(MEMORY_HOTPLUG_IO_REGION, AML_DWORD_ACC, AML_NOLOCK, AML_PRESERVE); aml_append(field, /* DIMM selector, write only */ - aml_named_field(stringify(MEMORY_SLOT_SLECTOR), 32)); + aml_named_field(MEMORY_SLOT_SLECTOR, 32)); aml_append(field, /* _OST event code, write only */ - aml_named_field(stringify(MEMORY_SLOT_OST_EVENT), 32)); + aml_named_field(MEMORY_SLOT_OST_EVENT, 32)); aml_append(field, /* _OST status code, write only */ - aml_named_field(stringify(MEMORY_SLOT_OST_STATUS), 32)); + aml_named_field(MEMORY_SLOT_OST_STATUS, 32)); aml_append(scope, field); aml_append(sb_scope, scope); for (i = 0; i < nr_mem; i++) { - #define BASEPATH "\\_SB.PCI0." stringify(MEMORY_HOTPLUG_DEVICE) "." + #define BASEPATH "\\_SB.PCI0." MEMORY_HOTPLUG_DEVICE "." const char *s; dev = aml_device("MP%02X", i); @@ -1010,29 +1010,30 @@ static void build_memory_devices(Aml *sb_scope, int nr_mem, aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C80"))); method = aml_method("_CRS", 0, AML_NOTSERIALIZED); - s = BASEPATH stringify(MEMORY_SLOT_CRS_METHOD); + s = BASEPATH MEMORY_SLOT_CRS_METHOD; aml_append(method, aml_return(aml_call1(s, aml_name("_UID")))); aml_append(dev, method); method = aml_method("_STA", 0, AML_NOTSERIALIZED); - s = BASEPATH stringify(MEMORY_SLOT_STATUS_METHOD); + s = BASEPATH MEMORY_SLOT_STATUS_METHOD; aml_append(method, aml_return(aml_call1(s, aml_name("_UID")))); aml_append(dev, method); method = aml_method("_PXM", 0, AML_NOTSERIALIZED); - s = BASEPATH stringify(MEMORY_SLOT_PROXIMITY_METHOD); + s = BASEPATH MEMORY_SLOT_PROXIMITY_METHOD; aml_append(method, aml_return(aml_call1(s, aml_name("_UID")))); aml_append(dev, method); method = aml_method("_OST", 3, AML_NOTSERIALIZED); - s = BASEPATH stringify(MEMORY_SLOT_OST_METHOD); + s = BASEPATH MEMORY_SLOT_OST_METHOD; + aml_append(method, aml_return(aml_call4( s, aml_name("_UID"), aml_arg(0), aml_arg(1), aml_arg(2) ))); aml_append(dev, method); method = aml_method("_EJ0", 1, AML_NOTSERIALIZED); - s = BASEPATH stringify(MEMORY_SLOT_EJECT_METHOD); + s = BASEPATH MEMORY_SLOT_EJECT_METHOD; aml_append(method, aml_return(aml_call2( s, aml_name("_UID"), aml_arg(0)))); aml_append(dev, method); @@ -1043,8 +1044,7 @@ static void build_memory_devices(Aml *sb_scope, int nr_mem, /* build Method(MEMORY_SLOT_NOTIFY_METHOD, 2) { * If (LEqual(Arg0, 0x00)) {Notify(MP00, Arg1)} ... } */ - method = aml_method(stringify(MEMORY_SLOT_NOTIFY_METHOD), 2, - AML_NOTSERIALIZED); + method = aml_method(MEMORY_SLOT_NOTIFY_METHOD, 2, AML_NOTSERIALIZED); for (i = 0; i < nr_mem; i++) { ifctx = aml_if(aml_equal(aml_arg(0), aml_int(i))); aml_append(ifctx, diff --git a/include/hw/acpi/memory_hotplug.h b/include/hw/acpi/memory_hotplug.h index de164f2d3e..3a646b12e0 100644 --- a/include/hw/acpi/memory_hotplug.h +++ b/include/hw/acpi/memory_hotplug.h @@ -47,10 +47,10 @@ extern const VMStateDescription vmstate_memory_hotplug; void acpi_memory_ospm_status(MemHotplugState *mem_st, ACPIOSTInfoList ***list); -#define MEMORY_HOTPLUG_DEVICE MHPD -#define MEMORY_SLOT_SCAN_METHOD MSCN +#define MEMORY_HOTPLUG_DEVICE "MHPD" +#define MEMORY_SLOT_SCAN_METHOD "MSCN" #define MEMORY_HOTPLUG_HANDLER_PATH "\\_SB.PCI0." \ - stringify(MEMORY_HOTPLUG_DEVICE) "." stringify(MEMORY_SLOT_SCAN_METHOD) + MEMORY_HOTPLUG_DEVICE "." MEMORY_SLOT_SCAN_METHOD void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem, uint16_t io_base, uint16_t io_len); diff --git a/include/hw/acpi/pc-hotplug.h b/include/hw/acpi/pc-hotplug.h index e5bb3217c3..6a8d268f84 100644 --- a/include/hw/acpi/pc-hotplug.h +++ b/include/hw/acpi/pc-hotplug.h @@ -32,26 +32,26 @@ #define ACPI_MEMORY_HOTPLUG_IO_LEN 24 #define ACPI_MEMORY_HOTPLUG_BASE 0x0a00 -#define MEMORY_SLOTS_NUMBER MDNR -#define MEMORY_HOTPLUG_IO_REGION HPMR -#define MEMORY_SLOT_ADDR_LOW MRBL -#define MEMORY_SLOT_ADDR_HIGH MRBH -#define MEMORY_SLOT_SIZE_LOW MRLL -#define MEMORY_SLOT_SIZE_HIGH MRLH -#define MEMORY_SLOT_PROXIMITY MPX -#define MEMORY_SLOT_ENABLED MES -#define MEMORY_SLOT_INSERT_EVENT MINS -#define MEMORY_SLOT_REMOVE_EVENT MRMV -#define MEMORY_SLOT_EJECT MEJ -#define MEMORY_SLOT_SLECTOR MSEL -#define MEMORY_SLOT_OST_EVENT MOEV -#define MEMORY_SLOT_OST_STATUS MOSC -#define MEMORY_SLOT_LOCK MLCK -#define MEMORY_SLOT_STATUS_METHOD MRST -#define MEMORY_SLOT_CRS_METHOD MCRS -#define MEMORY_SLOT_OST_METHOD MOST -#define MEMORY_SLOT_PROXIMITY_METHOD MPXM -#define MEMORY_SLOT_EJECT_METHOD MEJ0 -#define MEMORY_SLOT_NOTIFY_METHOD MTFY +#define MEMORY_SLOTS_NUMBER "MDNR" +#define MEMORY_HOTPLUG_IO_REGION "HPMR" +#define MEMORY_SLOT_ADDR_LOW "MRBL" +#define MEMORY_SLOT_ADDR_HIGH "MRBH" +#define MEMORY_SLOT_SIZE_LOW "MRLL" +#define MEMORY_SLOT_SIZE_HIGH "MRLH" +#define MEMORY_SLOT_PROXIMITY "MPX" +#define MEMORY_SLOT_ENABLED "MES" +#define MEMORY_SLOT_INSERT_EVENT "MINS" +#define MEMORY_SLOT_REMOVE_EVENT "MRMV" +#define MEMORY_SLOT_EJECT "MEJ" +#define MEMORY_SLOT_SLECTOR "MSEL" +#define MEMORY_SLOT_OST_EVENT "MOEV" +#define MEMORY_SLOT_OST_STATUS "MOSC" +#define MEMORY_SLOT_LOCK "MLCK" +#define MEMORY_SLOT_STATUS_METHOD "MRST" +#define MEMORY_SLOT_CRS_METHOD "MCRS" +#define MEMORY_SLOT_OST_METHOD "MOST" +#define MEMORY_SLOT_PROXIMITY_METHOD "MPXM" +#define MEMORY_SLOT_EJECT_METHOD "MEJ0" +#define MEMORY_SLOT_NOTIFY_METHOD "MTFY" #endif From 1295e21a17083a2babfcf12511c1b2ebfdcc978d Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:22 +0100 Subject: [PATCH 18/59] pc: acpi: drop unused CPU_STATUS_LEN from DSDT Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-dsdt-cpu-hotplug.dsl | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/i386/acpi-dsdt-cpu-hotplug.dsl b/hw/i386/acpi-dsdt-cpu-hotplug.dsl index 1aff74627f..53e1389183 100644 --- a/hw/i386/acpi-dsdt-cpu-hotplug.dsl +++ b/hw/i386/acpi-dsdt-cpu-hotplug.dsl @@ -53,7 +53,6 @@ Scope(\_SB) { Sleep(200) } -#define CPU_STATUS_LEN ACPI_GPE_PROC_LEN Method(PRSC, 0) { // Local5 = active cpu bitmap Store(PRS, Local5) From fbd7a6b8e2f68970370665187893a3c80c69d555 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:23 +0100 Subject: [PATCH 19/59] pc: acpi: cpuhp: move CPEJ() method to SSDT Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/acpi/Makefile.objs | 2 +- hw/acpi/cpu_hotplug_acpi_table.c | 28 ++++++++++++++++++++++++++++ hw/i386/acpi-build.c | 3 ++- hw/i386/acpi-dsdt-cpu-hotplug.dsl | 4 ---- include/hw/acpi/cpu_hotplug.h | 5 +++++ 5 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 hw/acpi/cpu_hotplug_acpi_table.c diff --git a/hw/acpi/Makefile.objs b/hw/acpi/Makefile.objs index 052be627cc..f3ade9a28e 100644 --- a/hw/acpi/Makefile.objs +++ b/hw/acpi/Makefile.objs @@ -1,6 +1,6 @@ common-obj-$(CONFIG_ACPI_X86) += core.o piix4.o pcihp.o common-obj-$(CONFIG_ACPI_X86_ICH) += ich9.o tco.o -common-obj-$(CONFIG_ACPI_CPU_HOTPLUG) += cpu_hotplug.o +common-obj-$(CONFIG_ACPI_CPU_HOTPLUG) += cpu_hotplug.o cpu_hotplug_acpi_table.o common-obj-$(CONFIG_ACPI_MEMORY_HOTPLUG) += memory_hotplug.o memory_hotplug_acpi_table.o common-obj-$(CONFIG_ACPI_NVDIMM) += nvdimm.o common-obj-$(CONFIG_ACPI) += acpi_interface.o diff --git a/hw/acpi/cpu_hotplug_acpi_table.c b/hw/acpi/cpu_hotplug_acpi_table.c new file mode 100644 index 0000000000..422e57b5b3 --- /dev/null +++ b/hw/acpi/cpu_hotplug_acpi_table.c @@ -0,0 +1,28 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License along + * with this program; if not, see . + */ + +#include "hw/acpi/cpu_hotplug.h" + +void build_cpu_hotplug_aml(Aml *ctx) +{ + Aml *method; + Aml *sb_scope = aml_scope("_SB"); + + method = aml_method(CPU_EJECT_METHOD, 2, AML_NOTSERIALIZED); + aml_append(method, aml_sleep(200)); + aml_append(sb_scope, method); + + aml_append(ctx, sb_scope); +} diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 42e60c1d3a..53b29163a2 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1080,6 +1080,7 @@ build_ssdt(GArray *table_data, GArray *linker, /* Reserve space for header */ acpi_data_push(ssdt->buf, sizeof(AcpiTableHeader)); + build_cpu_hotplug_aml(ssdt); build_memory_hotplug_aml(ssdt, nr_mem, pm->mem_hp_io_base, pm->mem_hp_io_len); @@ -1326,7 +1327,7 @@ build_ssdt(GArray *table_data, GArray *linker, method = aml_method("_EJ0", 1, AML_NOTSERIALIZED); aml_append(method, - aml_return(aml_call2("CPEJ", aml_int(i), aml_arg(0))) + aml_return(aml_call2(CPU_EJECT_METHOD, aml_int(i), aml_arg(0))) ); aml_append(dev, method); diff --git a/hw/i386/acpi-dsdt-cpu-hotplug.dsl b/hw/i386/acpi-dsdt-cpu-hotplug.dsl index 53e1389183..18331be220 100644 --- a/hw/i386/acpi-dsdt-cpu-hotplug.dsl +++ b/hw/i386/acpi-dsdt-cpu-hotplug.dsl @@ -48,10 +48,6 @@ Scope(\_SB) { Return (0x0) } } - Method(CPEJ, 2, NotSerialized) { - // _EJ0 method - eject callback - Sleep(200) - } Method(PRSC, 0) { // Local5 = active cpu bitmap diff --git a/include/hw/acpi/cpu_hotplug.h b/include/hw/acpi/cpu_hotplug.h index f6d358def1..87504beccd 100644 --- a/include/hw/acpi/cpu_hotplug.h +++ b/include/hw/acpi/cpu_hotplug.h @@ -14,6 +14,7 @@ #include "hw/acpi/acpi.h" #include "hw/acpi/pc-hotplug.h" +#include "hw/acpi/aml-build.h" typedef struct AcpiCpuHotplug { MemoryRegion io; @@ -25,4 +26,8 @@ void acpi_cpu_plug_cb(ACPIREGS *ar, qemu_irq irq, void acpi_cpu_hotplug_init(MemoryRegion *parent, Object *owner, AcpiCpuHotplug *gpe_cpu, uint16_t base); + +#define CPU_EJECT_METHOD "CPEJ" + +void build_cpu_hotplug_aml(Aml *ctx); #endif From 1d608d13eb9819812034dd4e5ea615c571b4a57d Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:24 +0100 Subject: [PATCH 20/59] pc: acpi: cpuhp: move CPMA() method into SSDT Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/acpi/cpu_hotplug_acpi_table.c | 23 +++++++++++++++++++++++ hw/i386/acpi-build.c | 5 +++-- hw/i386/acpi-dsdt-cpu-hotplug.dsl | 13 ------------- include/hw/acpi/cpu_hotplug.h | 2 ++ 4 files changed, 28 insertions(+), 15 deletions(-) diff --git a/hw/acpi/cpu_hotplug_acpi_table.c b/hw/acpi/cpu_hotplug_acpi_table.c index 422e57b5b3..69c37fad71 100644 --- a/hw/acpi/cpu_hotplug_acpi_table.c +++ b/hw/acpi/cpu_hotplug_acpi_table.c @@ -19,6 +19,29 @@ void build_cpu_hotplug_aml(Aml *ctx) { Aml *method; Aml *sb_scope = aml_scope("_SB"); + uint8_t madt_tmpl[8] = {0x00, 0x08, 0x00, 0x00, 0x00, 0, 0, 0}; + Aml *cpu_id = aml_arg(0); + Aml *cpu_on = aml_local(0); + Aml *madt = aml_local(1); + Aml *cpus_map = aml_name(CPU_ON_BITMAP); + + /* + * _MAT method - creates an madt apic buffer + * cpu_id = Arg0 = Processor ID = Local APIC ID + * cpu_on = Local0 = CPON flag for this cpu + * madt = Local1 = Buffer (in madt apic form) to return + */ + method = aml_method(CPU_MAT_METHOD, 1, AML_NOTSERIALIZED); + aml_append(method, + aml_store(aml_derefof(aml_index(cpus_map, cpu_id)), cpu_on)); + aml_append(method, + aml_store(aml_buffer(sizeof(madt_tmpl), madt_tmpl), madt)); + /* Update the processor id, lapic id, and enable/disable status */ + aml_append(method, aml_store(cpu_id, aml_index(madt, aml_int(2)))); + aml_append(method, aml_store(cpu_id, aml_index(madt, aml_int(3)))); + aml_append(method, aml_store(cpu_on, aml_index(madt, aml_int(4)))); + aml_append(method, aml_return(madt)); + aml_append(sb_scope, method); method = aml_method(CPU_EJECT_METHOD, 2, AML_NOTSERIALIZED); aml_append(method, aml_sleep(200)); diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 53b29163a2..88299fa285 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1318,7 +1318,8 @@ build_ssdt(GArray *table_data, GArray *linker, dev = aml_processor(i, 0, 0, "CP%.02X", i); method = aml_method("_MAT", 0, AML_NOTSERIALIZED); - aml_append(method, aml_return(aml_call1("CPMA", aml_int(i)))); + aml_append(method, + aml_return(aml_call1(CPU_MAT_METHOD, aml_int(i)))); aml_append(dev, method); method = aml_method("_STA", 0, AML_NOTSERIALIZED); @@ -1362,7 +1363,7 @@ build_ssdt(GArray *table_data, GArray *linker, uint8_t b = test_bit(i, cpu->found_cpus) ? 0x01 : 0x00; aml_append(pkg, aml_int(b)); } - aml_append(sb_scope, aml_name_decl("CPON", pkg)); + aml_append(sb_scope, aml_name_decl(CPU_ON_BITMAP, pkg)); build_memory_devices(sb_scope, nr_mem, pm->mem_hp_io_base, pm->mem_hp_io_len); diff --git a/hw/i386/acpi-dsdt-cpu-hotplug.dsl b/hw/i386/acpi-dsdt-cpu-hotplug.dsl index 18331be220..9739191417 100644 --- a/hw/i386/acpi-dsdt-cpu-hotplug.dsl +++ b/hw/i386/acpi-dsdt-cpu-hotplug.dsl @@ -24,19 +24,6 @@ Scope(\_SB) { External(PRS, FieldUnitObj) /* Methods called by run-time generated SSDT Processor objects */ - Method(CPMA, 1, NotSerialized) { - // _MAT method - create an madt apic buffer - // Arg0 = Processor ID = Local APIC ID - // Local0 = CPON flag for this cpu - Store(DerefOf(Index(CPON, Arg0)), Local0) - // Local1 = Buffer (in madt apic form) to return - Store(Buffer(8) {0x00, 0x08, 0x00, 0x00, 0x00, 0, 0, 0}, Local1) - // Update the processor id, lapic id, and enable/disable status - Store(Arg0, Index(Local1, 2)) - Store(Arg0, Index(Local1, 3)) - Store(Local0, Index(Local1, 4)) - Return (Local1) - } Method(CPST, 1, NotSerialized) { // _STA method - return ON status of cpu // Arg0 = Processor ID = Local APIC ID diff --git a/include/hw/acpi/cpu_hotplug.h b/include/hw/acpi/cpu_hotplug.h index 87504beccd..40b9316cb8 100644 --- a/include/hw/acpi/cpu_hotplug.h +++ b/include/hw/acpi/cpu_hotplug.h @@ -28,6 +28,8 @@ void acpi_cpu_hotplug_init(MemoryRegion *parent, Object *owner, AcpiCpuHotplug *gpe_cpu, uint16_t base); #define CPU_EJECT_METHOD "CPEJ" +#define CPU_MAT_METHOD "CPMA" +#define CPU_ON_BITMAP "CPON" void build_cpu_hotplug_aml(Aml *ctx); #endif From 40f981a02d082fba4efc2b6fcabd390648335fa8 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:25 +0100 Subject: [PATCH 21/59] pc: acpi: cpuhp: move CPST() method into SSDT Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/acpi/cpu_hotplug_acpi_table.c | 22 ++++++++++++++++++++++ hw/i386/acpi-build.c | 3 ++- hw/i386/acpi-dsdt-cpu-hotplug.dsl | 12 ------------ include/hw/acpi/cpu_hotplug.h | 1 + 4 files changed, 25 insertions(+), 13 deletions(-) diff --git a/hw/acpi/cpu_hotplug_acpi_table.c b/hw/acpi/cpu_hotplug_acpi_table.c index 69c37fad71..90c4043f4d 100644 --- a/hw/acpi/cpu_hotplug_acpi_table.c +++ b/hw/acpi/cpu_hotplug_acpi_table.c @@ -18,6 +18,8 @@ void build_cpu_hotplug_aml(Aml *ctx) { Aml *method; + Aml *if_ctx; + Aml *else_ctx; Aml *sb_scope = aml_scope("_SB"); uint8_t madt_tmpl[8] = {0x00, 0x08, 0x00, 0x00, 0x00, 0, 0, 0}; Aml *cpu_id = aml_arg(0); @@ -43,6 +45,26 @@ void build_cpu_hotplug_aml(Aml *ctx) aml_append(method, aml_return(madt)); aml_append(sb_scope, method); + /* + * _STA method - return ON status of cpu + * cpu_id = Arg0 = Processor ID = Local APIC ID + * cpu_on = Local0 = CPON flag for this cpu + */ + method = aml_method(CPU_STATUS_METHOD, 1, AML_NOTSERIALIZED); + aml_append(method, + aml_store(aml_derefof(aml_index(cpus_map, cpu_id)), cpu_on)); + if_ctx = aml_if(cpu_on); + { + aml_append(if_ctx, aml_return(aml_int(0xF))); + } + aml_append(method, if_ctx); + else_ctx = aml_else(); + { + aml_append(else_ctx, aml_return(aml_int(0x0))); + } + aml_append(method, else_ctx); + aml_append(sb_scope, method); + method = aml_method(CPU_EJECT_METHOD, 2, AML_NOTSERIALIZED); aml_append(method, aml_sleep(200)); aml_append(sb_scope, method); diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 88299fa285..69b7160189 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1323,7 +1323,8 @@ build_ssdt(GArray *table_data, GArray *linker, aml_append(dev, method); method = aml_method("_STA", 0, AML_NOTSERIALIZED); - aml_append(method, aml_return(aml_call1("CPST", aml_int(i)))); + aml_append(method, + aml_return(aml_call1(CPU_STATUS_METHOD, aml_int(i)))); aml_append(dev, method); method = aml_method("_EJ0", 1, AML_NOTSERIALIZED); diff --git a/hw/i386/acpi-dsdt-cpu-hotplug.dsl b/hw/i386/acpi-dsdt-cpu-hotplug.dsl index 9739191417..fb75edaefe 100644 --- a/hw/i386/acpi-dsdt-cpu-hotplug.dsl +++ b/hw/i386/acpi-dsdt-cpu-hotplug.dsl @@ -24,18 +24,6 @@ Scope(\_SB) { External(PRS, FieldUnitObj) /* Methods called by run-time generated SSDT Processor objects */ - Method(CPST, 1, NotSerialized) { - // _STA method - return ON status of cpu - // Arg0 = Processor ID = Local APIC ID - // Local0 = CPON flag for this cpu - Store(DerefOf(Index(CPON, Arg0)), Local0) - If (Local0) { - Return (0xF) - } Else { - Return (0x0) - } - } - Method(PRSC, 0) { // Local5 = active cpu bitmap Store(PRS, Local5) diff --git a/include/hw/acpi/cpu_hotplug.h b/include/hw/acpi/cpu_hotplug.h index 40b9316cb8..0755dd3347 100644 --- a/include/hw/acpi/cpu_hotplug.h +++ b/include/hw/acpi/cpu_hotplug.h @@ -30,6 +30,7 @@ void acpi_cpu_hotplug_init(MemoryRegion *parent, Object *owner, #define CPU_EJECT_METHOD "CPEJ" #define CPU_MAT_METHOD "CPMA" #define CPU_ON_BITMAP "CPON" +#define CPU_STATUS_METHOD "CPST" void build_cpu_hotplug_aml(Aml *ctx); #endif From f294ecbc13e08eeac474df3492e4c8eff14e419f Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:26 +0100 Subject: [PATCH 22/59] pc: acpi: cpuhp: move PRSC() method into SSDT Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/acpi/cpu_hotplug_acpi_table.c | 64 ++++++++++++++++++++++++++++++- hw/i386/acpi-build.c | 2 +- hw/i386/acpi-dsdt-cpu-hotplug.dsl | 39 +------------------ hw/i386/acpi-dsdt.dsl | 2 +- hw/i386/q35-acpi-dsdt.dsl | 2 +- include/hw/acpi/aml-build.h | 2 + include/hw/acpi/cpu_hotplug.h | 1 + include/hw/acpi/pc-hotplug.h | 1 + 8 files changed, 71 insertions(+), 42 deletions(-) diff --git a/hw/acpi/cpu_hotplug_acpi_table.c b/hw/acpi/cpu_hotplug_acpi_table.c index 90c4043f4d..8dda4f423f 100644 --- a/hw/acpi/cpu_hotplug_acpi_table.c +++ b/hw/acpi/cpu_hotplug_acpi_table.c @@ -26,6 +26,8 @@ void build_cpu_hotplug_aml(Aml *ctx) Aml *cpu_on = aml_local(0); Aml *madt = aml_local(1); Aml *cpus_map = aml_name(CPU_ON_BITMAP); + Aml *zero = aml_int(0); + Aml *one = aml_int(1); /* * _MAT method - creates an madt apic buffer @@ -60,7 +62,7 @@ void build_cpu_hotplug_aml(Aml *ctx) aml_append(method, if_ctx); else_ctx = aml_else(); { - aml_append(else_ctx, aml_return(aml_int(0x0))); + aml_append(else_ctx, aml_return(zero)); } aml_append(method, else_ctx); aml_append(sb_scope, method); @@ -69,5 +71,65 @@ void build_cpu_hotplug_aml(Aml *ctx) aml_append(method, aml_sleep(200)); aml_append(sb_scope, method); + method = aml_method(stringify(CPU_SCAN_METHOD), 0, AML_NOTSERIALIZED); + { + Aml *while_ctx, *if_ctx2, *else_ctx2; + Aml *bus_check_evt = aml_int(1); + Aml *remove_evt = aml_int(3); + Aml *status_map = aml_local(5); /* Local5 = active cpu bitmap */ + Aml *byte = aml_local(2); /* Local2 = last read byte from bitmap */ + Aml *idx = aml_local(0); /* Processor ID / APIC ID iterator */ + Aml *is_cpu_on = aml_local(1); /* Local1 = CPON flag for cpu */ + Aml *status = aml_local(3); /* Local3 = active state for cpu */ + + aml_append(method, aml_store(aml_name(CPU_STATUS_MAP), status_map)); + aml_append(method, aml_store(zero, byte)); + aml_append(method, aml_store(zero, idx)); + + /* While (idx < SizeOf(CPON)) */ + while_ctx = aml_while(aml_lless(idx, aml_sizeof(cpus_map))); + aml_append(while_ctx, + aml_store(aml_derefof(aml_index(cpus_map, idx)), is_cpu_on)); + + if_ctx = aml_if(aml_and(idx, aml_int(0x07), NULL)); + { + /* Shift down previously read bitmap byte */ + aml_append(if_ctx, aml_shiftright(byte, one, byte)); + } + aml_append(while_ctx, if_ctx); + + else_ctx = aml_else(); + { + /* Read next byte from cpu bitmap */ + aml_append(else_ctx, aml_store(aml_derefof(aml_index(status_map, + aml_shiftright(idx, aml_int(3), NULL))), byte)); + } + aml_append(while_ctx, else_ctx); + + aml_append(while_ctx, aml_store(aml_and(byte, one, NULL), status)); + if_ctx = aml_if(aml_lnot(aml_equal(is_cpu_on, status))); + { + /* State change - update CPON with new state */ + aml_append(if_ctx, aml_store(status, aml_index(cpus_map, idx))); + if_ctx2 = aml_if(aml_equal(status, one)); + { + aml_append(if_ctx2, + aml_call2(AML_NOTIFY_METHOD, idx, bus_check_evt)); + } + aml_append(if_ctx, if_ctx2); + else_ctx2 = aml_else(); + { + aml_append(else_ctx2, + aml_call2(AML_NOTIFY_METHOD, idx, remove_evt)); + } + } + aml_append(if_ctx, else_ctx2); + aml_append(while_ctx, if_ctx); + + aml_append(while_ctx, aml_increment(idx)); /* go to next cpu */ + aml_append(method, while_ctx); + } + aml_append(sb_scope, method); + aml_append(ctx, sb_scope); } diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 69b7160189..6c5d09a26d 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1340,7 +1340,7 @@ build_ssdt(GArray *table_data, GArray *linker, * Method(NTFY, 2) {If (LEqual(Arg0, 0x00)) {Notify(CP00, Arg1)} ...} */ /* Arg0 = Processor ID = APIC ID */ - method = aml_method("NTFY", 2, AML_NOTSERIALIZED); + method = aml_method(AML_NOTIFY_METHOD, 2, AML_NOTSERIALIZED); for (i = 0; i < acpi_cpus; i++) { ifctx = aml_if(aml_equal(aml_arg(0), aml_int(i))); aml_append(ifctx, diff --git a/hw/i386/acpi-dsdt-cpu-hotplug.dsl b/hw/i386/acpi-dsdt-cpu-hotplug.dsl index fb75edaefe..88c472b8ce 100644 --- a/hw/i386/acpi-dsdt-cpu-hotplug.dsl +++ b/hw/i386/acpi-dsdt-cpu-hotplug.dsl @@ -19,42 +19,5 @@ Scope(\_SB) { /* Objects filled in by run-time generated SSDT */ - External(NTFY, MethodObj) - External(CPON, PkgObj) - External(PRS, FieldUnitObj) - - /* Methods called by run-time generated SSDT Processor objects */ - Method(PRSC, 0) { - // Local5 = active cpu bitmap - Store(PRS, Local5) - // Local2 = last read byte from bitmap - Store(Zero, Local2) - // Local0 = Processor ID / APIC ID iterator - Store(Zero, Local0) - While (LLess(Local0, SizeOf(CPON))) { - // Local1 = CPON flag for this cpu - Store(DerefOf(Index(CPON, Local0)), Local1) - If (And(Local0, 0x07)) { - // Shift down previously read bitmap byte - ShiftRight(Local2, 1, Local2) - } Else { - // Read next byte from cpu bitmap - Store(DerefOf(Index(Local5, ShiftRight(Local0, 3))), Local2) - } - // Local3 = active state for this cpu - Store(And(Local2, 1), Local3) - - If (LNotEqual(Local1, Local3)) { - // State change - update CPON with new state - Store(Local3, Index(CPON, Local0)) - // Do CPU notify - If (LEqual(Local3, 1)) { - NTFY(Local0, 1) - } Else { - NTFY(Local0, 3) - } - } - Increment(Local0) - } - } + External(CPU_SCAN_METHOD, MethodObj) } diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl index 9cf1b88528..6a0c656b1d 100644 --- a/hw/i386/acpi-dsdt.dsl +++ b/hw/i386/acpi-dsdt.dsl @@ -268,7 +268,7 @@ DefinitionBlock ( } Method(_E02) { // CPU hotplug event - \_SB.PRSC() + \_SB.CPU_SCAN_METHOD() } Method(_L04) { } diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl index f950f39f2d..7211665a50 100644 --- a/hw/i386/q35-acpi-dsdt.dsl +++ b/hw/i386/q35-acpi-dsdt.dsl @@ -401,7 +401,7 @@ DefinitionBlock ( } Method(_E02) { // CPU hotplug event - \_SB.PRSC() + \_SB.CPU_SCAN_METHOD() } Method(_L04) { } diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h index ef44d02285..83c0102f84 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -16,6 +16,8 @@ #define ACPI_BUILD_RSDP_FILE "etc/acpi/rsdp" #define ACPI_BUILD_TPMLOG_FILE "etc/tpm/log" +#define AML_NOTIFY_METHOD "NTFY" + typedef enum { AML_NO_OPCODE = 0,/* has only data */ AML_OPCODE, /* has opcode optionally followed by data */ diff --git a/include/hw/acpi/cpu_hotplug.h b/include/hw/acpi/cpu_hotplug.h index 0755dd3347..255e70c2b7 100644 --- a/include/hw/acpi/cpu_hotplug.h +++ b/include/hw/acpi/cpu_hotplug.h @@ -31,6 +31,7 @@ void acpi_cpu_hotplug_init(MemoryRegion *parent, Object *owner, #define CPU_MAT_METHOD "CPMA" #define CPU_ON_BITMAP "CPON" #define CPU_STATUS_METHOD "CPST" +#define CPU_STATUS_MAP "PRS" void build_cpu_hotplug_aml(Aml *ctx); #endif diff --git a/include/hw/acpi/pc-hotplug.h b/include/hw/acpi/pc-hotplug.h index 6a8d268f84..6522745c22 100644 --- a/include/hw/acpi/pc-hotplug.h +++ b/include/hw/acpi/pc-hotplug.h @@ -28,6 +28,7 @@ #define ICH9_CPU_HOTPLUG_IO_BASE 0x0CD8 #define PIIX4_CPU_HOTPLUG_IO_BASE 0xaf00 #define CPU_HOTPLUG_RESOURCE_DEVICE PRES +#define CPU_SCAN_METHOD PRSC #define ACPI_MEMORY_HOTPLUG_IO_LEN 24 #define ACPI_MEMORY_HOTPLUG_BASE 0x0a00 From 6b30608774cf7efddd1893fe9187d7f0bcdde979 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:27 +0100 Subject: [PATCH 23/59] pc: acpi: cpuhp: move \_GPE._E02() into SSDT Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/acpi/cpu_hotplug_acpi_table.c | 2 +- hw/i386/acpi-build.c | 12 +++++++++--- hw/i386/acpi-dsdt-cpu-hotplug.dsl | 23 ----------------------- hw/i386/acpi-dsdt.dsl | 9 --------- hw/i386/q35-acpi-dsdt.dsl | 9 --------- include/hw/acpi/cpu_hotplug.h | 1 + include/hw/acpi/pc-hotplug.h | 1 - 7 files changed, 11 insertions(+), 46 deletions(-) delete mode 100644 hw/i386/acpi-dsdt-cpu-hotplug.dsl diff --git a/hw/acpi/cpu_hotplug_acpi_table.c b/hw/acpi/cpu_hotplug_acpi_table.c index 8dda4f423f..13b210ea89 100644 --- a/hw/acpi/cpu_hotplug_acpi_table.c +++ b/hw/acpi/cpu_hotplug_acpi_table.c @@ -71,7 +71,7 @@ void build_cpu_hotplug_aml(Aml *ctx) aml_append(method, aml_sleep(200)); aml_append(sb_scope, method); - method = aml_method(stringify(CPU_SCAN_METHOD), 0, AML_NOTSERIALIZED); + method = aml_method(CPU_SCAN_METHOD, 0, AML_NOTSERIALIZED); { Aml *while_ctx, *if_ctx2, *else_ctx2; Aml *bus_check_evt = aml_int(1); diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 6c5d09a26d..9f1ead3f29 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1085,9 +1085,15 @@ build_ssdt(GArray *table_data, GArray *linker, pm->mem_hp_io_len); scope = aml_scope("\\_GPE"); - method = aml_method("_E03", 0, AML_NOTSERIALIZED); - aml_append(method, aml_call0(MEMORY_HOTPLUG_HANDLER_PATH)); - aml_append(scope, method); + { + method = aml_method("_E02", 0, AML_NOTSERIALIZED); + aml_append(method, aml_call0("\\_SB." CPU_SCAN_METHOD)); + aml_append(scope, method); + + method = aml_method("_E03", 0, AML_NOTSERIALIZED); + aml_append(method, aml_call0(MEMORY_HOTPLUG_HANDLER_PATH)); + aml_append(scope, method); + } aml_append(ssdt, scope); bus = PC_MACHINE(machine)->bus; diff --git a/hw/i386/acpi-dsdt-cpu-hotplug.dsl b/hw/i386/acpi-dsdt-cpu-hotplug.dsl deleted file mode 100644 index 88c472b8ce..0000000000 --- a/hw/i386/acpi-dsdt-cpu-hotplug.dsl +++ /dev/null @@ -1,23 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License along - * with this program; if not, see . - */ - -/**************************************************************** - * CPU hotplug - ****************************************************************/ - -Scope(\_SB) { - /* Objects filled in by run-time generated SSDT */ - External(CPU_SCAN_METHOD, MethodObj) -} diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl index 6a0c656b1d..007d3c9593 100644 --- a/hw/i386/acpi-dsdt.dsl +++ b/hw/i386/acpi-dsdt.dsl @@ -247,11 +247,6 @@ DefinitionBlock ( } } -#include "hw/acpi/pc-hotplug.h" -#define CPU_STATUS_BASE PIIX4_CPU_HOTPLUG_IO_BASE -#include "acpi-dsdt-cpu-hotplug.dsl" - - /**************************************************************** * General purpose events ****************************************************************/ @@ -266,10 +261,6 @@ DefinitionBlock ( \_SB.PCI0.PCNT() Release(\_SB.PCI0.BLCK) } - Method(_E02) { - // CPU hotplug event - \_SB.CPU_SCAN_METHOD() - } Method(_L04) { } Method(_L05) { diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl index 7211665a50..0511e26b59 100644 --- a/hw/i386/q35-acpi-dsdt.dsl +++ b/hw/i386/q35-acpi-dsdt.dsl @@ -384,11 +384,6 @@ DefinitionBlock ( define_gsi_link(GSIH, 0, 0x17) } -#include "hw/acpi/pc-hotplug.h" -#define CPU_STATUS_BASE ICH9_CPU_HOTPLUG_IO_BASE -#include "acpi-dsdt-cpu-hotplug.dsl" - - /**************************************************************** * General purpose events ****************************************************************/ @@ -399,10 +394,6 @@ DefinitionBlock ( } Method(_L01) { } - Method(_E02) { - // CPU hotplug event - \_SB.CPU_SCAN_METHOD() - } Method(_L04) { } Method(_L05) { diff --git a/include/hw/acpi/cpu_hotplug.h b/include/hw/acpi/cpu_hotplug.h index 255e70c2b7..f22640e389 100644 --- a/include/hw/acpi/cpu_hotplug.h +++ b/include/hw/acpi/cpu_hotplug.h @@ -32,6 +32,7 @@ void acpi_cpu_hotplug_init(MemoryRegion *parent, Object *owner, #define CPU_ON_BITMAP "CPON" #define CPU_STATUS_METHOD "CPST" #define CPU_STATUS_MAP "PRS" +#define CPU_SCAN_METHOD "PRSC" void build_cpu_hotplug_aml(Aml *ctx); #endif diff --git a/include/hw/acpi/pc-hotplug.h b/include/hw/acpi/pc-hotplug.h index 6522745c22..6a8d268f84 100644 --- a/include/hw/acpi/pc-hotplug.h +++ b/include/hw/acpi/pc-hotplug.h @@ -28,7 +28,6 @@ #define ICH9_CPU_HOTPLUG_IO_BASE 0x0CD8 #define PIIX4_CPU_HOTPLUG_IO_BASE 0xaf00 #define CPU_HOTPLUG_RESOURCE_DEVICE PRES -#define CPU_SCAN_METHOD PRSC #define ACPI_MEMORY_HOTPLUG_IO_LEN 24 #define ACPI_MEMORY_HOTPLUG_BASE 0x0a00 From 5ca5efa4a69e1f2bbefa3fa41a01b69066c73acc Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:28 +0100 Subject: [PATCH 24/59] pc: acpi: factor out cpu hotplug code from build_ssdt() into separate function Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 174 +++++++++++++++++++++++-------------------- 1 file changed, 94 insertions(+), 80 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 9f1ead3f29..c52718f207 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -931,6 +931,98 @@ static Aml *build_crs(PCIHostState *host, return crs; } +static void build_processor_devices(Aml *sb_scope, unsigned acpi_cpus, + AcpiCpuInfo *cpu, AcpiPmInfo *pm) +{ + int i; + Aml *dev; + Aml *crs; + Aml *pkg; + Aml *field; + Aml *ifctx; + Aml *method; + + /* The current AML generator can cover the APIC ID range [0..255], + * inclusive, for VCPU hotplug. */ + QEMU_BUILD_BUG_ON(ACPI_CPU_HOTPLUG_ID_LIMIT > 256); + g_assert(acpi_cpus <= ACPI_CPU_HOTPLUG_ID_LIMIT); + + /* create PCI0.PRES device and its _CRS to reserve CPU hotplug MMIO */ + dev = aml_device("PCI0." stringify(CPU_HOTPLUG_RESOURCE_DEVICE)); + aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A06"))); + aml_append(dev, + aml_name_decl("_UID", aml_string("CPU Hotplug resources")) + ); + /* device present, functioning, decoding, not shown in UI */ + aml_append(dev, aml_name_decl("_STA", aml_int(0xB))); + crs = aml_resource_template(); + aml_append(crs, + aml_io(AML_DECODE16, pm->cpu_hp_io_base, pm->cpu_hp_io_base, 1, + pm->cpu_hp_io_len) + ); + aml_append(dev, aml_name_decl("_CRS", crs)); + aml_append(sb_scope, dev); + /* declare CPU hotplug MMIO region and PRS field to access it */ + aml_append(sb_scope, aml_operation_region( + "PRST", AML_SYSTEM_IO, pm->cpu_hp_io_base, pm->cpu_hp_io_len)); + field = aml_field("PRST", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE); + aml_append(field, aml_named_field("PRS", 256)); + aml_append(sb_scope, field); + + /* build Processor object for each processor */ + for (i = 0; i < acpi_cpus; i++) { + dev = aml_processor(i, 0, 0, "CP%.02X", i); + + method = aml_method("_MAT", 0, AML_NOTSERIALIZED); + aml_append(method, + aml_return(aml_call1(CPU_MAT_METHOD, aml_int(i)))); + aml_append(dev, method); + + method = aml_method("_STA", 0, AML_NOTSERIALIZED); + aml_append(method, + aml_return(aml_call1(CPU_STATUS_METHOD, aml_int(i)))); + aml_append(dev, method); + + method = aml_method("_EJ0", 1, AML_NOTSERIALIZED); + aml_append(method, + aml_return(aml_call2(CPU_EJECT_METHOD, aml_int(i), aml_arg(0))) + ); + aml_append(dev, method); + + aml_append(sb_scope, dev); + } + + /* build this code: + * Method(NTFY, 2) {If (LEqual(Arg0, 0x00)) {Notify(CP00, Arg1)} ...} + */ + /* Arg0 = Processor ID = APIC ID */ + method = aml_method(AML_NOTIFY_METHOD, 2, AML_NOTSERIALIZED); + for (i = 0; i < acpi_cpus; i++) { + ifctx = aml_if(aml_equal(aml_arg(0), aml_int(i))); + aml_append(ifctx, + aml_notify(aml_name("CP%.02X", i), aml_arg(1)) + ); + aml_append(method, ifctx); + } + aml_append(sb_scope, method); + + /* build "Name(CPON, Package() { One, One, ..., Zero, Zero, ... })" + * + * Note: The ability to create variable-sized packages was first + * introduced in ACPI 2.0. ACPI 1.0 only allowed fixed-size packages + * ith up to 255 elements. Windows guests up to win2k8 fail when + * VarPackageOp is used. + */ + pkg = acpi_cpus <= 255 ? aml_package(acpi_cpus) : + aml_varpackage(acpi_cpus); + + for (i = 0; i < acpi_cpus; i++) { + uint8_t b = test_bit(i, cpu->found_cpus) ? 0x01 : 0x00; + aml_append(pkg, aml_int(b)); + } + aml_append(sb_scope, aml_name_decl(CPU_ON_BITMAP, pkg)); +} + static void build_memory_devices(Aml *sb_scope, int nr_mem, uint16_t io_base, uint16_t io_len) { @@ -1062,8 +1154,7 @@ build_ssdt(GArray *table_data, GArray *linker, { MachineState *machine = MACHINE(qdev_get_machine()); uint32_t nr_mem = machine->ram_slots; - unsigned acpi_cpus = guest_info->apic_id_limit; - Aml *ssdt, *sb_scope, *scope, *pkg, *dev, *method, *crs, *field, *ifctx; + Aml *ssdt, *sb_scope, *scope, *pkg, *dev, *method, *crs, *field; PCIBus *bus = NULL; GPtrArray *io_ranges = g_ptr_array_new_with_free_func(crs_range_free); GPtrArray *mem_ranges = g_ptr_array_new_with_free_func(crs_range_free); @@ -1072,10 +1163,6 @@ build_ssdt(GArray *table_data, GArray *linker, int i; ssdt = init_aml_allocator(); - /* The current AML generator can cover the APIC ID range [0..255], - * inclusive, for VCPU hotplug. */ - QEMU_BUILD_BUG_ON(ACPI_CPU_HOTPLUG_ID_LIMIT > 256); - g_assert(acpi_cpus <= ACPI_CPU_HOTPLUG_ID_LIMIT); /* Reserve space for header */ acpi_data_push(ssdt->buf, sizeof(AcpiTableHeader)); @@ -1297,80 +1384,7 @@ build_ssdt(GArray *table_data, GArray *linker, sb_scope = aml_scope("\\_SB"); { - /* create PCI0.PRES device and its _CRS to reserve CPU hotplug MMIO */ - dev = aml_device("PCI0." stringify(CPU_HOTPLUG_RESOURCE_DEVICE)); - aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A06"))); - aml_append(dev, - aml_name_decl("_UID", aml_string("CPU Hotplug resources")) - ); - /* device present, functioning, decoding, not shown in UI */ - aml_append(dev, aml_name_decl("_STA", aml_int(0xB))); - crs = aml_resource_template(); - aml_append(crs, - aml_io(AML_DECODE16, pm->cpu_hp_io_base, pm->cpu_hp_io_base, 1, - pm->cpu_hp_io_len) - ); - aml_append(dev, aml_name_decl("_CRS", crs)); - aml_append(sb_scope, dev); - /* declare CPU hotplug MMIO region and PRS field to access it */ - aml_append(sb_scope, aml_operation_region( - "PRST", AML_SYSTEM_IO, pm->cpu_hp_io_base, pm->cpu_hp_io_len)); - field = aml_field("PRST", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE); - aml_append(field, aml_named_field("PRS", 256)); - aml_append(sb_scope, field); - - /* build Processor object for each processor */ - for (i = 0; i < acpi_cpus; i++) { - dev = aml_processor(i, 0, 0, "CP%.02X", i); - - method = aml_method("_MAT", 0, AML_NOTSERIALIZED); - aml_append(method, - aml_return(aml_call1(CPU_MAT_METHOD, aml_int(i)))); - aml_append(dev, method); - - method = aml_method("_STA", 0, AML_NOTSERIALIZED); - aml_append(method, - aml_return(aml_call1(CPU_STATUS_METHOD, aml_int(i)))); - aml_append(dev, method); - - method = aml_method("_EJ0", 1, AML_NOTSERIALIZED); - aml_append(method, - aml_return(aml_call2(CPU_EJECT_METHOD, aml_int(i), aml_arg(0))) - ); - aml_append(dev, method); - - aml_append(sb_scope, dev); - } - - /* build this code: - * Method(NTFY, 2) {If (LEqual(Arg0, 0x00)) {Notify(CP00, Arg1)} ...} - */ - /* Arg0 = Processor ID = APIC ID */ - method = aml_method(AML_NOTIFY_METHOD, 2, AML_NOTSERIALIZED); - for (i = 0; i < acpi_cpus; i++) { - ifctx = aml_if(aml_equal(aml_arg(0), aml_int(i))); - aml_append(ifctx, - aml_notify(aml_name("CP%.02X", i), aml_arg(1)) - ); - aml_append(method, ifctx); - } - aml_append(sb_scope, method); - - /* build "Name(CPON, Package() { One, One, ..., Zero, Zero, ... })" - * - * Note: The ability to create variable-sized packages was first - * introduced in ACPI 2.0. ACPI 1.0 only allowed fixed-size packages - * ith up to 255 elements. Windows guests up to win2k8 fail when - * VarPackageOp is used. - */ - pkg = acpi_cpus <= 255 ? aml_package(acpi_cpus) : - aml_varpackage(acpi_cpus); - - for (i = 0; i < acpi_cpus; i++) { - uint8_t b = test_bit(i, cpu->found_cpus) ? 0x01 : 0x00; - aml_append(pkg, aml_int(b)); - } - aml_append(sb_scope, aml_name_decl(CPU_ON_BITMAP, pkg)); + build_processor_devices(sb_scope, guest_info->apic_id_limit, cpu, pm); build_memory_devices(sb_scope, nr_mem, pm->mem_hp_io_base, pm->mem_hp_io_len); From a57d708d1797ac84a9531402661487c46210057f Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:29 +0100 Subject: [PATCH 25/59] pc: acpi: move HPET from DSDT to SSDT Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 53 ++++++++++++++++++++++++++++++++++++++ hw/i386/acpi-dsdt-hpet.dsl | 48 ---------------------------------- hw/i386/acpi-dsdt.dsl | 2 -- hw/i386/q35-acpi-dsdt.dsl | 3 --- hw/timer/hpet.c | 2 +- include/hw/timer/hpet.h | 1 + 6 files changed, 55 insertions(+), 54 deletions(-) delete mode 100644 hw/i386/acpi-dsdt-hpet.dsl diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index c52718f207..07d13ae4c0 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -52,6 +52,7 @@ #include "hw/pci/pci_bus.h" #include "hw/pci-host/q35.h" #include "hw/i386/intel_iommu.h" +#include "hw/timer/hpet.h" #include "hw/i386/q35-acpi-dsdt.hex" #include "hw/i386/acpi-dsdt.hex" @@ -1147,6 +1148,57 @@ static void build_memory_devices(Aml *sb_scope, int nr_mem, aml_append(sb_scope, method); } +static void build_hpet_aml(Aml *table) +{ + Aml *crs; + Aml *field; + Aml *method; + Aml *if_ctx; + Aml *scope = aml_scope("_SB"); + Aml *dev = aml_device("HPET"); + Aml *zero = aml_int(0); + Aml *id = aml_local(0); + Aml *period = aml_local(1); + + aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0103"))); + aml_append(dev, aml_name_decl("_UID", zero)); + + aml_append(dev, + aml_operation_region("HPTM", AML_SYSTEM_MEMORY, HPET_BASE, HPET_LEN)); + field = aml_field("HPTM", AML_DWORD_ACC, AML_LOCK, AML_PRESERVE); + aml_append(field, aml_named_field("VEND", 32)); + aml_append(field, aml_named_field("PRD", 32)); + aml_append(dev, field); + + method = aml_method("_STA", 0, AML_NOTSERIALIZED); + aml_append(method, aml_store(aml_name("VEND"), id)); + aml_append(method, aml_store(aml_name("PRD"), period)); + aml_append(method, aml_shiftright(id, aml_int(16), id)); + if_ctx = aml_if(aml_lor(aml_equal(id, zero), + aml_equal(id, aml_int(0xffff)))); + { + aml_append(if_ctx, aml_return(zero)); + } + aml_append(method, if_ctx); + + if_ctx = aml_if(aml_lor(aml_equal(period, zero), + aml_lgreater(period, aml_int(100000000)))); + { + aml_append(if_ctx, aml_return(zero)); + } + aml_append(method, if_ctx); + + aml_append(method, aml_return(aml_int(0x0F))); + aml_append(dev, method); + + crs = aml_resource_template(); + aml_append(crs, aml_memory32_fixed(HPET_BASE, HPET_LEN, AML_READ_ONLY)); + aml_append(dev, aml_name_decl("_CRS", crs)); + + aml_append(scope, dev); + aml_append(table, scope); +} + static void build_ssdt(GArray *table_data, GArray *linker, AcpiCpuInfo *cpu, AcpiPmInfo *pm, AcpiMiscInfo *misc, @@ -1167,6 +1219,7 @@ build_ssdt(GArray *table_data, GArray *linker, /* Reserve space for header */ acpi_data_push(ssdt->buf, sizeof(AcpiTableHeader)); + build_hpet_aml(ssdt); build_cpu_hotplug_aml(ssdt); build_memory_hotplug_aml(ssdt, nr_mem, pm->mem_hp_io_base, pm->mem_hp_io_len); diff --git a/hw/i386/acpi-dsdt-hpet.dsl b/hw/i386/acpi-dsdt-hpet.dsl deleted file mode 100644 index 44961b87a1..0000000000 --- a/hw/i386/acpi-dsdt-hpet.dsl +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License along - * with this program; if not, see . - */ - -/**************************************************************** - * HPET - ****************************************************************/ - -Scope(\_SB) { - Device(HPET) { - Name(_HID, EISAID("PNP0103")) - Name(_UID, 0) - OperationRegion(HPTM, SystemMemory, 0xFED00000, 0x400) - Field(HPTM, DWordAcc, Lock, Preserve) { - VEND, 32, - PRD, 32, - } - Method(_STA, 0, NotSerialized) { - Store(VEND, Local0) - Store(PRD, Local1) - ShiftRight(Local0, 16, Local0) - If (LOr(LEqual(Local0, 0), LEqual(Local0, 0xffff))) { - Return (0x0) - } - If (LOr(LEqual(Local1, 0), LGreater(Local1, 100000000))) { - Return (0x0) - } - Return (0x0F) - } - Name(_CRS, ResourceTemplate() { - Memory32Fixed(ReadOnly, - 0xFED00000, // Address Base - 0x00000400, // Address Length - ) - }) - } -} diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl index 007d3c9593..aa7f549144 100644 --- a/hw/i386/acpi-dsdt.dsl +++ b/hw/i386/acpi-dsdt.dsl @@ -41,8 +41,6 @@ DefinitionBlock ( } } -#include "acpi-dsdt-hpet.dsl" - /**************************************************************** * PIIX4 PM ****************************************************************/ diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl index 0511e26b59..e57adb8ef2 100644 --- a/hw/i386/q35-acpi-dsdt.dsl +++ b/hw/i386/q35-acpi-dsdt.dsl @@ -115,9 +115,6 @@ DefinitionBlock ( } } -#include "acpi-dsdt-hpet.dsl" - - /**************************************************************** * LPC ISA bridge ****************************************************************/ diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c index 7f0391c786..d9d039b4ed 100644 --- a/hw/timer/hpet.c +++ b/hw/timer/hpet.c @@ -713,7 +713,7 @@ static void hpet_init(Object *obj) HPETState *s = HPET(obj); /* HPET Area */ - memory_region_init_io(&s->iomem, obj, &hpet_ram_ops, s, "hpet", 0x400); + memory_region_init_io(&s->iomem, obj, &hpet_ram_ops, s, "hpet", HPET_LEN); sysbus_init_mmio(sbd, &s->iomem); } diff --git a/include/hw/timer/hpet.h b/include/hw/timer/hpet.h index d872909ce1..f38bcfecd6 100644 --- a/include/hw/timer/hpet.h +++ b/include/hw/timer/hpet.h @@ -16,6 +16,7 @@ #include "qom/object.h" #define HPET_BASE 0xfed00000 +#define HPET_LEN 0x400 #define HPET_CLK_PERIOD 10 /* 10 ns*/ #define FS_PER_NS 1000000 /* 1000000 femtoseconds == 1 ns */ From 3892a2b7418149020a5c3bdda241a14f8ef8c21a Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:30 +0100 Subject: [PATCH 26/59] pc: acpi: move DBUG() from DSDT to SSDT Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 36 +++++++++++++++++++++++++++++++++ hw/i386/acpi-dsdt-dbug.dsl | 41 -------------------------------------- hw/i386/acpi-dsdt.dsl | 2 -- hw/i386/q35-acpi-dsdt.dsl | 2 -- 4 files changed, 36 insertions(+), 45 deletions(-) delete mode 100644 hw/i386/acpi-dsdt-dbug.dsl diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 07d13ae4c0..b0968c1e63 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1199,6 +1199,41 @@ static void build_hpet_aml(Aml *table) aml_append(table, scope); } +static void build_dbg_aml(Aml *table) +{ + Aml *field; + Aml *method; + Aml *while_ctx; + Aml *scope = aml_scope("\\"); + Aml *buf = aml_local(0); + Aml *len = aml_local(1); + Aml *idx = aml_local(2); + + aml_append(scope, + aml_operation_region("DBG", AML_SYSTEM_IO, 0x0402, 0x01)); + field = aml_field("DBG", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE); + aml_append(field, aml_named_field("DBGB", 8)); + aml_append(scope, field); + + method = aml_method("DBUG", 1, AML_NOTSERIALIZED); + + aml_append(method, aml_to_hexstring(aml_arg(0), buf)); + aml_append(method, aml_to_buffer(buf, buf)); + aml_append(method, aml_subtract(aml_sizeof(buf), aml_int(1), len)); + aml_append(method, aml_store(aml_int(0), idx)); + + while_ctx = aml_while(aml_lless(idx, len)); + aml_append(while_ctx, + aml_store(aml_derefof(aml_index(buf, idx)), aml_name("DBGB"))); + aml_append(while_ctx, aml_increment(idx)); + aml_append(method, while_ctx); + + aml_append(method, aml_store(aml_int(0x0A), aml_name("DBGB"))); + aml_append(scope, method); + + aml_append(table, scope); +} + static void build_ssdt(GArray *table_data, GArray *linker, AcpiCpuInfo *cpu, AcpiPmInfo *pm, AcpiMiscInfo *misc, @@ -1219,6 +1254,7 @@ build_ssdt(GArray *table_data, GArray *linker, /* Reserve space for header */ acpi_data_push(ssdt->buf, sizeof(AcpiTableHeader)); + build_dbg_aml(ssdt); build_hpet_aml(ssdt); build_cpu_hotplug_aml(ssdt); build_memory_hotplug_aml(ssdt, nr_mem, pm->mem_hp_io_base, diff --git a/hw/i386/acpi-dsdt-dbug.dsl b/hw/i386/acpi-dsdt-dbug.dsl deleted file mode 100644 index 86230f75a0..0000000000 --- a/hw/i386/acpi-dsdt-dbug.dsl +++ /dev/null @@ -1,41 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License along - * with this program; if not, see . - */ - -/**************************************************************** - * Debugging - ****************************************************************/ - -Scope(\) { - /* Debug Output */ - OperationRegion(DBG, SystemIO, 0x0402, 0x01) - Field(DBG, ByteAcc, NoLock, Preserve) { - DBGB, 8, - } - - /* Debug method - use this method to send output to the QEMU - * BIOS debug port. This method handles strings, integers, - * and buffers. For example: DBUG("abc") DBUG(0x123) */ - Method(DBUG, 1) { - ToHexString(Arg0, Local0) - ToBuffer(Local0, Local0) - Subtract(SizeOf(Local0), 1, Local1) - Store(Zero, Local2) - While (LLess(Local2, Local1)) { - Store(DerefOf(Index(Local0, Local2)), DBGB) - Increment(Local2) - } - Store(0x0A, DBGB) - } -} diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl index aa7f549144..55c2220f19 100644 --- a/hw/i386/acpi-dsdt.dsl +++ b/hw/i386/acpi-dsdt.dsl @@ -29,8 +29,6 @@ DefinitionBlock ( ) { -#include "acpi-dsdt-dbug.dsl" - Scope(\_SB) { Device(PCI0) { Name(_HID, EisaId("PNP0A03")) diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl index e57adb8ef2..bf3f97444d 100644 --- a/hw/i386/q35-acpi-dsdt.dsl +++ b/hw/i386/q35-acpi-dsdt.dsl @@ -35,8 +35,6 @@ DefinitionBlock ( ) { -#include "acpi-dsdt-dbug.dsl" - Scope(\_SB) { OperationRegion(PCST, SystemIO, 0xae00, 0x0c) OperationRegion(PCSB, SystemIO, 0xae0c, 0x01) From ee135849961524cc51e794cb696595873d956722 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:31 +0100 Subject: [PATCH 27/59] pc: acpi: move RTC device from DSDT to SSDT Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 26 ++++++++++++++++++++++++++ hw/i386/acpi-dsdt-isa.dsl | 9 --------- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index b0968c1e63..33513e6f1b 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1199,6 +1199,31 @@ static void build_hpet_aml(Aml *table) aml_append(table, scope); } +static Aml *build_rtc_device_aml(void) +{ + Aml *dev; + Aml *crs; + + dev = aml_device("RTC"); + aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0B00"))); + crs = aml_resource_template(); + aml_append(crs, aml_io(AML_DECODE16, 0x0070, 0x0070, 0x10, 0x02)); + aml_append(crs, aml_irq_no_flags(8)); + aml_append(crs, aml_io(AML_DECODE16, 0x0072, 0x0072, 0x02, 0x06)); + aml_append(dev, aml_name_decl("_CRS", crs)); + + return dev; +} + +static void build_isa_devices_aml(Aml *table) +{ + Aml *scope = aml_scope("_SB.PCI0.ISA"); + + aml_append(scope, build_rtc_device_aml()); + + aml_append(table, scope); +} + static void build_dbg_aml(Aml *table) { Aml *field; @@ -1256,6 +1281,7 @@ build_ssdt(GArray *table_data, GArray *linker, build_dbg_aml(ssdt); build_hpet_aml(ssdt); + build_isa_devices_aml(ssdt); build_cpu_hotplug_aml(ssdt); build_memory_hotplug_aml(ssdt, nr_mem, pm->mem_hp_io_base, pm->mem_hp_io_len); diff --git a/hw/i386/acpi-dsdt-isa.dsl b/hw/i386/acpi-dsdt-isa.dsl index 89caa1649d..f2cbbead6f 100644 --- a/hw/i386/acpi-dsdt-isa.dsl +++ b/hw/i386/acpi-dsdt-isa.dsl @@ -16,15 +16,6 @@ /* Common legacy ISA style devices. */ Scope(\_SB.PCI0.ISA) { - Device(RTC) { - Name(_HID, EisaId("PNP0B00")) - Name(_CRS, ResourceTemplate() { - IO(Decode16, 0x0070, 0x0070, 0x10, 0x02) - IRQNoFlags() { 8 } - IO(Decode16, 0x0072, 0x0072, 0x02, 0x06) - }) - } - Device(KBD) { Name(_HID, EisaId("PNP0303")) Method(_STA, 0, NotSerialized) { From f58190e2c23640e19c6f5c051c6076cbb9e8c0d7 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:32 +0100 Subject: [PATCH 28/59] pc: acpi: move KBD device from DSDT to SSDT Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 22 ++++++++++++++++++++++ hw/i386/acpi-dsdt-isa.dsl | 12 ------------ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 33513e6f1b..f5148bcd53 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1210,6 +1210,27 @@ static Aml *build_rtc_device_aml(void) aml_append(crs, aml_io(AML_DECODE16, 0x0070, 0x0070, 0x10, 0x02)); aml_append(crs, aml_irq_no_flags(8)); aml_append(crs, aml_io(AML_DECODE16, 0x0072, 0x0072, 0x02, 0x06)); + + return dev; +} + +static Aml *build_kbd_device_aml(void) +{ + Aml *dev; + Aml *crs; + Aml *method; + + dev = aml_device("KBD"); + aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0303"))); + + method = aml_method("_STA", 0, AML_NOTSERIALIZED); + aml_append(method, aml_return(aml_int(0x0f))); + aml_append(dev, method); + + crs = aml_resource_template(); + aml_append(crs, aml_io(AML_DECODE16, 0x0060, 0x0060, 0x01, 0x01)); + aml_append(crs, aml_io(AML_DECODE16, 0x0064, 0x0064, 0x01, 0x01)); + aml_append(crs, aml_irq_no_flags(1)); aml_append(dev, aml_name_decl("_CRS", crs)); return dev; @@ -1220,6 +1241,7 @@ static void build_isa_devices_aml(Aml *table) Aml *scope = aml_scope("_SB.PCI0.ISA"); aml_append(scope, build_rtc_device_aml()); + aml_append(scope, build_kbd_device_aml()); aml_append(table, scope); } diff --git a/hw/i386/acpi-dsdt-isa.dsl b/hw/i386/acpi-dsdt-isa.dsl index f2cbbead6f..f7a3c0abcf 100644 --- a/hw/i386/acpi-dsdt-isa.dsl +++ b/hw/i386/acpi-dsdt-isa.dsl @@ -16,18 +16,6 @@ /* Common legacy ISA style devices. */ Scope(\_SB.PCI0.ISA) { - Device(KBD) { - Name(_HID, EisaId("PNP0303")) - Method(_STA, 0, NotSerialized) { - Return (0x0f) - } - Name(_CRS, ResourceTemplate() { - IO(Decode16, 0x0060, 0x0060, 0x01, 0x01) - IO(Decode16, 0x0064, 0x0064, 0x01, 0x01) - IRQNoFlags() { 1 } - }) - } - Device(MOU) { Name(_HID, EisaId("PNP0F13")) Method(_STA, 0, NotSerialized) { From c355cb2c0fd4e74cff382fd47f1eff6050943f28 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:33 +0100 Subject: [PATCH 29/59] pc: acpi: move MOU device from DSDT to SSDT Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 21 +++++++++++++++++++++ hw/i386/acpi-dsdt-isa.dsl | 10 ---------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index f5148bcd53..72c3f67dac 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1236,12 +1236,33 @@ static Aml *build_kbd_device_aml(void) return dev; } +static Aml *build_mouse_device_aml(void) +{ + Aml *dev; + Aml *crs; + Aml *method; + + dev = aml_device("MOU"); + aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0F13"))); + + method = aml_method("_STA", 0, AML_NOTSERIALIZED); + aml_append(method, aml_return(aml_int(0x0f))); + aml_append(dev, method); + + crs = aml_resource_template(); + aml_append(crs, aml_irq_no_flags(12)); + aml_append(dev, aml_name_decl("_CRS", crs)); + + return dev; +} + static void build_isa_devices_aml(Aml *table) { Aml *scope = aml_scope("_SB.PCI0.ISA"); aml_append(scope, build_rtc_device_aml()); aml_append(scope, build_kbd_device_aml()); + aml_append(scope, build_mouse_device_aml()); aml_append(table, scope); } diff --git a/hw/i386/acpi-dsdt-isa.dsl b/hw/i386/acpi-dsdt-isa.dsl index f7a3c0abcf..8936271e5a 100644 --- a/hw/i386/acpi-dsdt-isa.dsl +++ b/hw/i386/acpi-dsdt-isa.dsl @@ -16,16 +16,6 @@ /* Common legacy ISA style devices. */ Scope(\_SB.PCI0.ISA) { - Device(MOU) { - Name(_HID, EisaId("PNP0F13")) - Method(_STA, 0, NotSerialized) { - Return (0x0f) - } - Name(_CRS, ResourceTemplate() { - IRQNoFlags() { 12 } - }) - } - Device(FDC0) { Name(_HID, EisaId("PNP0700")) Method(_STA, 0, NotSerialized) { From 95ed7e97e45186aa0689110470844f6c40557f65 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:34 +0100 Subject: [PATCH 30/59] pc: acpi: move FDC0 device from DSDT to SSDT Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 40 +++++++++++++++++++++++++++++++++++++++ hw/i386/acpi-dsdt-isa.dsl | 18 ------------------ 2 files changed, 40 insertions(+), 18 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 72c3f67dac..c2912d45ce 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1199,6 +1199,44 @@ static void build_hpet_aml(Aml *table) aml_append(table, scope); } +static Aml *build_fdc_device_aml(void) +{ + Aml *dev; + Aml *crs; + Aml *method; + Aml *if_ctx; + Aml *else_ctx; + Aml *zero = aml_int(0); + Aml *is_present = aml_local(0); + + dev = aml_device("FDC0"); + aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0700"))); + + method = aml_method("_STA", 0, AML_NOTSERIALIZED); + aml_append(method, aml_store(aml_name("FDEN"), is_present)); + if_ctx = aml_if(aml_equal(is_present, zero)); + { + aml_append(if_ctx, aml_return(aml_int(0x00))); + } + aml_append(method, if_ctx); + else_ctx = aml_else(); + { + aml_append(else_ctx, aml_return(aml_int(0x0f))); + } + aml_append(method, else_ctx); + aml_append(dev, method); + + crs = aml_resource_template(); + aml_append(crs, aml_io(AML_DECODE16, 0x03F2, 0x03F2, 0x00, 0x04)); + aml_append(crs, aml_io(AML_DECODE16, 0x03F7, 0x03F7, 0x00, 0x01)); + aml_append(crs, aml_irq_no_flags(6)); + aml_append(crs, + aml_dma(AML_COMPATIBILITY, AML_NOTBUSMASTER, AML_TRANSFER8, 2)); + aml_append(dev, aml_name_decl("_CRS", crs)); + + return dev; +} + static Aml *build_rtc_device_aml(void) { Aml *dev; @@ -1210,6 +1248,7 @@ static Aml *build_rtc_device_aml(void) aml_append(crs, aml_io(AML_DECODE16, 0x0070, 0x0070, 0x10, 0x02)); aml_append(crs, aml_irq_no_flags(8)); aml_append(crs, aml_io(AML_DECODE16, 0x0072, 0x0072, 0x02, 0x06)); + aml_append(dev, aml_name_decl("_CRS", crs)); return dev; } @@ -1263,6 +1302,7 @@ static void build_isa_devices_aml(Aml *table) aml_append(scope, build_rtc_device_aml()); aml_append(scope, build_kbd_device_aml()); aml_append(scope, build_mouse_device_aml()); + aml_append(scope, build_fdc_device_aml()); aml_append(table, scope); } diff --git a/hw/i386/acpi-dsdt-isa.dsl b/hw/i386/acpi-dsdt-isa.dsl index 8936271e5a..64dd4ac0df 100644 --- a/hw/i386/acpi-dsdt-isa.dsl +++ b/hw/i386/acpi-dsdt-isa.dsl @@ -16,24 +16,6 @@ /* Common legacy ISA style devices. */ Scope(\_SB.PCI0.ISA) { - Device(FDC0) { - Name(_HID, EisaId("PNP0700")) - Method(_STA, 0, NotSerialized) { - Store(FDEN, Local0) - If (LEqual(Local0, 0)) { - Return (0x00) - } Else { - Return (0x0F) - } - } - Name(_CRS, ResourceTemplate() { - IO(Decode16, 0x03F2, 0x03F2, 0x00, 0x04) - IO(Decode16, 0x03F7, 0x03F7, 0x00, 0x01) - IRQNoFlags() { 6 } - DMA(Compatibility, NotBusMaster, Transfer8) { 2 } - }) - } - Device(LPT) { Name(_HID, EisaId("PNP0400")) Method(_STA, 0, NotSerialized) { From 8b1da5f8fdfb5e72e627f6fecbe8cd83bc7bda47 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:35 +0100 Subject: [PATCH 31/59] pc: acpi: move LPT device from DSDT to SSDT Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 36 ++++++++++++++++++++++++++++++++++++ hw/i386/acpi-dsdt-isa.dsl | 16 ---------------- 2 files changed, 36 insertions(+), 16 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index c2912d45ce..2e5b1a6c0c 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1295,6 +1295,41 @@ static Aml *build_mouse_device_aml(void) return dev; } +static Aml *build_lpt_device_aml(void) +{ + Aml *dev; + Aml *crs; + Aml *method; + Aml *if_ctx; + Aml *else_ctx; + Aml *zero = aml_int(0); + Aml *is_present = aml_local(0); + + dev = aml_device("LPT"); + aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0400"))); + + method = aml_method("_STA", 0, AML_NOTSERIALIZED); + aml_append(method, aml_store(aml_name("LPEN"), is_present)); + if_ctx = aml_if(aml_equal(is_present, zero)); + { + aml_append(if_ctx, aml_return(aml_int(0x00))); + } + aml_append(method, if_ctx); + else_ctx = aml_else(); + { + aml_append(else_ctx, aml_return(aml_int(0x0f))); + } + aml_append(method, else_ctx); + aml_append(dev, method); + + crs = aml_resource_template(); + aml_append(crs, aml_io(AML_DECODE16, 0x0378, 0x0378, 0x08, 0x08)); + aml_append(crs, aml_irq_no_flags(7)); + aml_append(dev, aml_name_decl("_CRS", crs)); + + return dev; +} + static void build_isa_devices_aml(Aml *table) { Aml *scope = aml_scope("_SB.PCI0.ISA"); @@ -1303,6 +1338,7 @@ static void build_isa_devices_aml(Aml *table) aml_append(scope, build_kbd_device_aml()); aml_append(scope, build_mouse_device_aml()); aml_append(scope, build_fdc_device_aml()); + aml_append(scope, build_lpt_device_aml()); aml_append(table, scope); } diff --git a/hw/i386/acpi-dsdt-isa.dsl b/hw/i386/acpi-dsdt-isa.dsl index 64dd4ac0df..cc5e8f9be1 100644 --- a/hw/i386/acpi-dsdt-isa.dsl +++ b/hw/i386/acpi-dsdt-isa.dsl @@ -16,22 +16,6 @@ /* Common legacy ISA style devices. */ Scope(\_SB.PCI0.ISA) { - Device(LPT) { - Name(_HID, EisaId("PNP0400")) - Method(_STA, 0, NotSerialized) { - Store(LPEN, Local0) - If (LEqual(Local0, 0)) { - Return (0x00) - } Else { - Return (0x0F) - } - } - Name(_CRS, ResourceTemplate() { - IO(Decode16, 0x0378, 0x0378, 0x08, 0x08) - IRQNoFlags() { 7 } - }) - } - Device(COM1) { Name(_HID, EisaId("PNP0501")) Name(_UID, 0x01) From 28f1f0e929dafb58fd725bcf559b28049fd2161d Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:36 +0100 Subject: [PATCH 32/59] pc: acpi: move COM devices from DSDT to SSDT Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 48 ++++++++++++++++++++++++++++++++++++ hw/i386/acpi-dsdt-isa.dsl | 52 --------------------------------------- hw/i386/acpi-dsdt.dsl | 3 --- hw/i386/q35-acpi-dsdt.dsl | 3 --- 4 files changed, 48 insertions(+), 58 deletions(-) delete mode 100644 hw/i386/acpi-dsdt-isa.dsl diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 2e5b1a6c0c..b0c82b6fe9 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1330,6 +1330,52 @@ static Aml *build_lpt_device_aml(void) return dev; } +static Aml *build_com_device_aml(uint8_t uid) +{ + Aml *dev; + Aml *crs; + Aml *method; + Aml *if_ctx; + Aml *else_ctx; + Aml *zero = aml_int(0); + Aml *is_present = aml_local(0); + const char *enabled_field = "CAEN"; + uint8_t irq = 4; + uint16_t io_port = 0x03F8; + + assert(uid == 1 || uid == 2); + if (uid == 2) { + enabled_field = "CBEN"; + irq = 3; + io_port = 0x02F8; + } + + dev = aml_device("COM%d", uid); + aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0501"))); + aml_append(dev, aml_name_decl("_UID", aml_int(uid))); + + method = aml_method("_STA", 0, AML_NOTSERIALIZED); + aml_append(method, aml_store(aml_name("%s", enabled_field), is_present)); + if_ctx = aml_if(aml_equal(is_present, zero)); + { + aml_append(if_ctx, aml_return(aml_int(0x00))); + } + aml_append(method, if_ctx); + else_ctx = aml_else(); + { + aml_append(else_ctx, aml_return(aml_int(0x0f))); + } + aml_append(method, else_ctx); + aml_append(dev, method); + + crs = aml_resource_template(); + aml_append(crs, aml_io(AML_DECODE16, io_port, io_port, 0x00, 0x08)); + aml_append(crs, aml_irq_no_flags(irq)); + aml_append(dev, aml_name_decl("_CRS", crs)); + + return dev; +} + static void build_isa_devices_aml(Aml *table) { Aml *scope = aml_scope("_SB.PCI0.ISA"); @@ -1339,6 +1385,8 @@ static void build_isa_devices_aml(Aml *table) aml_append(scope, build_mouse_device_aml()); aml_append(scope, build_fdc_device_aml()); aml_append(scope, build_lpt_device_aml()); + aml_append(scope, build_com_device_aml(1)); + aml_append(scope, build_com_device_aml(2)); aml_append(table, scope); } diff --git a/hw/i386/acpi-dsdt-isa.dsl b/hw/i386/acpi-dsdt-isa.dsl deleted file mode 100644 index cc5e8f9be1..0000000000 --- a/hw/i386/acpi-dsdt-isa.dsl +++ /dev/null @@ -1,52 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License along - * with this program; if not, see . - */ - -/* Common legacy ISA style devices. */ -Scope(\_SB.PCI0.ISA) { - - Device(COM1) { - Name(_HID, EisaId("PNP0501")) - Name(_UID, 0x01) - Method(_STA, 0, NotSerialized) { - Store(CAEN, Local0) - If (LEqual(Local0, 0)) { - Return (0x00) - } Else { - Return (0x0F) - } - } - Name(_CRS, ResourceTemplate() { - IO(Decode16, 0x03F8, 0x03F8, 0x00, 0x08) - IRQNoFlags() { 4 } - }) - } - - Device(COM2) { - Name(_HID, EisaId("PNP0501")) - Name(_UID, 0x02) - Method(_STA, 0, NotSerialized) { - Store(CBEN, Local0) - If (LEqual(Local0, 0)) { - Return (0x00) - } Else { - Return (0x0F) - } - } - Name(_CRS, ResourceTemplate() { - IO(Decode16, 0x02F8, 0x02F8, 0x00, 0x08) - IRQNoFlags() { 3 } - }) - } -} diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl index 55c2220f19..6048cc7057 100644 --- a/hw/i386/acpi-dsdt.dsl +++ b/hw/i386/acpi-dsdt.dsl @@ -80,9 +80,6 @@ DefinitionBlock ( } } -#include "acpi-dsdt-isa.dsl" - - /**************************************************************** * PCI hotplug ****************************************************************/ diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl index bf3f97444d..4862dedfe7 100644 --- a/hw/i386/q35-acpi-dsdt.dsl +++ b/hw/i386/q35-acpi-dsdt.dsl @@ -146,9 +146,6 @@ DefinitionBlock ( } } -#include "acpi-dsdt-isa.dsl" - - /**************************************************************** * PCI IRQs ****************************************************************/ From e4db279804f24b06d3a377dd3211bcf4b778f20b Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:37 +0100 Subject: [PATCH 33/59] pc: acpi: move PIIX4 isa-bridge and pm devices into SSDT and also move PRQx fields declaration as it can't be split out into separate patch since fields use PCI0.ISA.P40C operation region and OperationRegion must be declared in the same table as a Field that uses it. If this condition is not statisfied Windows will BSOD ans IASL (make check) will error out as well. For the same reason pm is moved together with isa-bridge as the later refernces P13C OperationRegion from pm device. Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 77 ++++++++++++++++++++++++++++++++++++- hw/i386/acpi-dsdt.dsl | 52 +++---------------------- include/hw/acpi/aml-build.h | 1 + 3 files changed, 81 insertions(+), 49 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index b0c82b6fe9..0190dd9d2c 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -109,6 +109,7 @@ typedef struct AcpiPmInfo { } AcpiPmInfo; typedef struct AcpiMiscInfo { + bool is_piix4; bool has_hpet; TPMVersion tpm_version; const unsigned char *dsdt_code; @@ -131,10 +132,12 @@ static void acpi_get_dsdt(AcpiMiscInfo *info) assert(!!piix != !!lpc); if (piix) { + info->is_piix4 = true; info->dsdt_code = AcpiDsdtAmlCode; info->dsdt_size = sizeof AcpiDsdtAmlCode; } if (lpc) { + info->is_piix4 = false; info->dsdt_code = Q35AcpiDsdtAmlCode; info->dsdt_size = sizeof Q35AcpiDsdtAmlCode; } @@ -1426,6 +1429,68 @@ static void build_dbg_aml(Aml *table) aml_append(table, scope); } +static void build_piix4_pci0_int(Aml *table) +{ + Aml *field; + Aml *sb_scope = aml_scope("_SB"); + + field = aml_field("PCI0.ISA.P40C", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE); + aml_append(field, aml_named_field("PRQ0", 8)); + aml_append(field, aml_named_field("PRQ1", 8)); + aml_append(field, aml_named_field("PRQ2", 8)); + aml_append(field, aml_named_field("PRQ3", 8)); + aml_append(sb_scope, field); + + aml_append(table, sb_scope); +} + +static void build_piix4_pm(Aml *table) +{ + Aml *dev; + Aml *scope; + + scope = aml_scope("_SB.PCI0"); + dev = aml_device("PX13"); + aml_append(dev, aml_name_decl("_ADR", aml_int(0x00010003))); + + aml_append(dev, aml_operation_region("P13C", AML_PCI_CONFIG, + 0x00, 0xff)); + aml_append(scope, dev); + aml_append(table, scope); +} + +static void build_piix4_isa_bridge(Aml *table) +{ + Aml *dev; + Aml *scope; + Aml *field; + + scope = aml_scope("_SB.PCI0"); + dev = aml_device("ISA"); + aml_append(dev, aml_name_decl("_ADR", aml_int(0x00010000))); + + /* PIIX PCI to ISA irq remapping */ + aml_append(dev, aml_operation_region("P40C", AML_PCI_CONFIG, + 0x60, 0x04)); + /* enable bits */ + field = aml_field("^PX13.P13C", AML_ANY_ACC, AML_NOLOCK, AML_PRESERVE); + /* Offset(0x5f),, 7, */ + aml_append(field, aml_reserved_field(0x2f8)); + aml_append(field, aml_reserved_field(7)); + aml_append(field, aml_named_field("LPEN", 1)); + /* Offset(0x67),, 3, */ + aml_append(field, aml_reserved_field(0x38)); + aml_append(field, aml_reserved_field(3)); + aml_append(field, aml_named_field("CAEN", 1)); + aml_append(field, aml_reserved_field(3)); + aml_append(field, aml_named_field("CBEN", 1)); + aml_append(dev, field); + aml_append(dev, aml_name_decl("FDEN", aml_int(1))); + + aml_append(scope, dev); + aml_append(table, scope); +} + static void build_ssdt(GArray *table_data, GArray *linker, AcpiCpuInfo *cpu, AcpiPmInfo *pm, AcpiMiscInfo *misc, @@ -1447,8 +1512,16 @@ build_ssdt(GArray *table_data, GArray *linker, acpi_data_push(ssdt->buf, sizeof(AcpiTableHeader)); build_dbg_aml(ssdt); - build_hpet_aml(ssdt); - build_isa_devices_aml(ssdt); + if (misc->is_piix4) { + build_hpet_aml(ssdt); + build_piix4_pm(ssdt); + build_piix4_isa_bridge(ssdt); + build_isa_devices_aml(ssdt); + build_piix4_pci0_int(ssdt); + } else { + build_hpet_aml(ssdt); + build_isa_devices_aml(ssdt); + } build_cpu_hotplug_aml(ssdt); build_memory_hotplug_aml(ssdt, nr_mem, pm->mem_hp_io_base, pm->mem_hp_io_len); diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl index 6048cc7057..11e2e61af3 100644 --- a/hw/i386/acpi-dsdt.dsl +++ b/hw/i386/acpi-dsdt.dsl @@ -39,47 +39,6 @@ DefinitionBlock ( } } -/**************************************************************** - * PIIX4 PM - ****************************************************************/ - - Scope(\_SB.PCI0) { - Device(PX13) { - Name(_ADR, 0x00010003) - OperationRegion(P13C, PCI_Config, 0x00, 0xff) - } - } - - -/**************************************************************** - * PIIX3 ISA bridge - ****************************************************************/ - - Scope(\_SB.PCI0) { - - External(ISA, DeviceObj) - - Device(ISA) { - Name(_ADR, 0x00010000) - - /* PIIX PCI to ISA irq remapping */ - OperationRegion(P40C, PCI_Config, 0x60, 0x04) - - /* enable bits */ - Field(\_SB.PCI0.PX13.P13C, AnyAcc, NoLock, Preserve) { - Offset(0x5f), - , 7, - LPEN, 1, // LPT - Offset(0x67), - , 3, - CAEN, 1, // COM1 - , 3, - CBEN, 1, // COM2 - } - Name(FDEN, 1) - } - } - /**************************************************************** * PCI hotplug ****************************************************************/ @@ -168,12 +127,11 @@ DefinitionBlock ( } } - Field(PCI0.ISA.P40C, ByteAcc, NoLock, Preserve) { - PRQ0, 8, - PRQ1, 8, - PRQ2, 8, - PRQ3, 8 - } + + External(PRQ0, FieldUnitObj) + External(PRQ1, FieldUnitObj) + External(PRQ2, FieldUnitObj) + External(PRQ3, FieldUnitObj) Method(IQST, 1, NotSerialized) { // _STA method - get status diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h index 83c0102f84..6d6f705b0c 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -82,6 +82,7 @@ typedef enum { typedef enum { AML_SYSTEM_MEMORY = 0X00, AML_SYSTEM_IO = 0X01, + AML_PCI_CONFIG = 0X02, } AmlRegionSpace; typedef enum { From 4c5eebc1fa325ea50ced39e2c6c97045ceb45fa9 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:38 +0100 Subject: [PATCH 34/59] pc: acpi: move remaining GPE handlers into SSDT Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 30 ++++++++++++++++++++++++++++- hw/i386/acpi-dsdt.dsl | 40 --------------------------------------- hw/i386/q35-acpi-dsdt.dsl | 36 ----------------------------------- 3 files changed, 29 insertions(+), 77 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 0190dd9d2c..c0f3c82f93 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1526,8 +1526,23 @@ build_ssdt(GArray *table_data, GArray *linker, build_memory_hotplug_aml(ssdt, nr_mem, pm->mem_hp_io_base, pm->mem_hp_io_len); - scope = aml_scope("\\_GPE"); + scope = aml_scope("_GPE"); { + aml_append(scope, aml_name_decl("_HID", aml_string("ACPI0006"))); + + aml_append(scope, aml_method("_L00", 0, AML_NOTSERIALIZED)); + + if (misc->is_piix4) { + method = aml_method("_E01", 0, AML_NOTSERIALIZED); + aml_append(method, + aml_acquire(aml_name("\\_SB.PCI0.BLCK"), 0xFFFF)); + aml_append(method, aml_call0("\\_SB.PCI0.PCNT")); + aml_append(method, aml_release(aml_name("\\_SB.PCI0.BLCK"))); + aml_append(scope, method); + } else { + aml_append(scope, aml_method("_L01", 0, AML_NOTSERIALIZED)); + } + method = aml_method("_E02", 0, AML_NOTSERIALIZED); aml_append(method, aml_call0("\\_SB." CPU_SCAN_METHOD)); aml_append(scope, method); @@ -1535,6 +1550,19 @@ build_ssdt(GArray *table_data, GArray *linker, method = aml_method("_E03", 0, AML_NOTSERIALIZED); aml_append(method, aml_call0(MEMORY_HOTPLUG_HANDLER_PATH)); aml_append(scope, method); + + aml_append(scope, aml_method("_L04", 0, AML_NOTSERIALIZED)); + aml_append(scope, aml_method("_L05", 0, AML_NOTSERIALIZED)); + aml_append(scope, aml_method("_L06", 0, AML_NOTSERIALIZED)); + aml_append(scope, aml_method("_L07", 0, AML_NOTSERIALIZED)); + aml_append(scope, aml_method("_L08", 0, AML_NOTSERIALIZED)); + aml_append(scope, aml_method("_L09", 0, AML_NOTSERIALIZED)); + aml_append(scope, aml_method("_L0A", 0, AML_NOTSERIALIZED)); + aml_append(scope, aml_method("_L0B", 0, AML_NOTSERIALIZED)); + aml_append(scope, aml_method("_L0C", 0, AML_NOTSERIALIZED)); + aml_append(scope, aml_method("_L0D", 0, AML_NOTSERIALIZED)); + aml_append(scope, aml_method("_L0E", 0, AML_NOTSERIALIZED)); + aml_append(scope, aml_method("_L0F", 0, AML_NOTSERIALIZED)); } aml_append(ssdt, scope); diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl index 11e2e61af3..c9b27258c9 100644 --- a/hw/i386/acpi-dsdt.dsl +++ b/hw/i386/acpi-dsdt.dsl @@ -197,44 +197,4 @@ DefinitionBlock ( Method(_SRS, 1, NotSerialized) { } } } - -/**************************************************************** - * General purpose events - ****************************************************************/ - Scope(\_GPE) { - Name(_HID, "ACPI0006") - - Method(_L00) { - } - Method(_E01) { - // PCI hotplug event - Acquire(\_SB.PCI0.BLCK, 0xFFFF) - \_SB.PCI0.PCNT() - Release(\_SB.PCI0.BLCK) - } - Method(_L04) { - } - Method(_L05) { - } - Method(_L06) { - } - Method(_L07) { - } - Method(_L08) { - } - Method(_L09) { - } - Method(_L0A) { - } - Method(_L0B) { - } - Method(_L0C) { - } - Method(_L0D) { - } - Method(_L0E) { - } - Method(_L0F) { - } - } } diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl index 4862dedfe7..e15761591b 100644 --- a/hw/i386/q35-acpi-dsdt.dsl +++ b/hw/i386/q35-acpi-dsdt.dsl @@ -375,40 +375,4 @@ DefinitionBlock ( define_gsi_link(GSIG, 0, 0x16) define_gsi_link(GSIH, 0, 0x17) } - -/**************************************************************** - * General purpose events - ****************************************************************/ - Scope(\_GPE) { - Name(_HID, "ACPI0006") - - Method(_L00) { - } - Method(_L01) { - } - Method(_L04) { - } - Method(_L05) { - } - Method(_L06) { - } - Method(_L07) { - } - Method(_L08) { - } - Method(_L09) { - } - Method(_L0A) { - } - Method(_L0B) { - } - Method(_L0C) { - } - Method(_L0D) { - } - Method(_L0E) { - } - Method(_L0F) { - } - } } From c35b6e8032105a4f457508d0a9e4bcd6e0392fc1 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:39 +0100 Subject: [PATCH 35/59] pc: acpi: pci: move link devices into SSDT Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 77 +++++++++++++++++++++++++++++++++++++++++++ hw/i386/acpi-dsdt.dsl | 49 +++------------------------ 2 files changed, 82 insertions(+), 44 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index c0f3c82f93..799efe50cd 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1429,9 +1429,49 @@ static void build_dbg_aml(Aml *table) aml_append(table, scope); } +static Aml *build_link_dev(const char *name, uint8_t uid, Aml *reg) +{ + Aml *dev; + Aml *crs; + Aml *method; + uint32_t irqs[] = {5, 10, 11}; + + dev = aml_device("%s", name); + aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C0F"))); + aml_append(dev, aml_name_decl("_UID", aml_int(uid))); + + crs = aml_resource_template(); + aml_append(crs, aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH, + AML_SHARED, irqs, ARRAY_SIZE(irqs))); + aml_append(dev, aml_name_decl("_PRS", crs)); + + method = aml_method("_STA", 0, AML_NOTSERIALIZED); + aml_append(method, aml_return(aml_call1("IQST", reg))); + aml_append(dev, method); + + method = aml_method("_DIS", 0, AML_NOTSERIALIZED); + aml_append(method, aml_or(reg, aml_int(0x80), reg)); + aml_append(dev, method); + + method = aml_method("_CRS", 0, AML_NOTSERIALIZED); + aml_append(method, aml_return(aml_call1("IQCR", reg))); + aml_append(dev, method); + + method = aml_method("_SRS", 1, AML_NOTSERIALIZED); + aml_append(method, aml_create_dword_field(aml_arg(0), aml_int(5), "PRRI")); + aml_append(method, aml_store(aml_name("PRRI"), reg)); + aml_append(dev, method); + + return dev; + } + static void build_piix4_pci0_int(Aml *table) { + Aml *dev; + Aml *crs; Aml *field; + Aml *method; + uint32_t irqs; Aml *sb_scope = aml_scope("_SB"); field = aml_field("PCI0.ISA.P40C", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE); @@ -1441,6 +1481,43 @@ static void build_piix4_pci0_int(Aml *table) aml_append(field, aml_named_field("PRQ3", 8)); aml_append(sb_scope, field); + aml_append(sb_scope, build_link_dev("LNKA", 0, aml_name("PRQ0"))); + aml_append(sb_scope, build_link_dev("LNKB", 1, aml_name("PRQ1"))); + aml_append(sb_scope, build_link_dev("LNKC", 2, aml_name("PRQ2"))); + aml_append(sb_scope, build_link_dev("LNKD", 3, aml_name("PRQ3"))); + + dev = aml_device("LNKS"); + { + aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C0F"))); + aml_append(dev, aml_name_decl("_UID", aml_int(4))); + + crs = aml_resource_template(); + irqs = 9; + aml_append(crs, aml_interrupt(AML_CONSUMER, AML_LEVEL, + AML_ACTIVE_HIGH, AML_SHARED, + &irqs, 1)); + aml_append(dev, aml_name_decl("_PRS", crs)); + + /* The SCI cannot be disabled and is always attached to GSI 9, + * so these are no-ops. We only need this link to override the + * polarity to active high and match the content of the MADT. + */ + method = aml_method("_STA", 0, AML_NOTSERIALIZED); + aml_append(method, aml_return(aml_int(0x0b))); + aml_append(dev, method); + + method = aml_method("_DIS", 0, AML_NOTSERIALIZED); + aml_append(dev, method); + + method = aml_method("_CRS", 0, AML_NOTSERIALIZED); + aml_append(method, aml_return(aml_name("_PRS"))); + aml_append(dev, method); + + method = aml_method("_SRS", 1, AML_NOTSERIALIZED); + aml_append(dev, method); + } + aml_append(sb_scope, dev); + aml_append(table, sb_scope); } diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl index c9b27258c9..b74cffd060 100644 --- a/hw/i386/acpi-dsdt.dsl +++ b/hw/i386/acpi-dsdt.dsl @@ -152,49 +152,10 @@ DefinitionBlock ( Return (PRR0) } -#define define_link(link, uid, reg) \ - Device(link) { \ - Name(_HID, EISAID("PNP0C0F")) \ - Name(_UID, uid) \ - Name(_PRS, ResourceTemplate() { \ - Interrupt(, Level, ActiveHigh, Shared) { \ - 5, 10, 11 \ - } \ - }) \ - Method(_STA, 0, NotSerialized) { \ - Return (IQST(reg)) \ - } \ - Method(_DIS, 0, NotSerialized) { \ - Or(reg, 0x80, reg) \ - } \ - Method(_CRS, 0, NotSerialized) { \ - Return (IQCR(reg)) \ - } \ - Method(_SRS, 1, NotSerialized) { \ - CreateDWordField(Arg0, 0x05, PRRI) \ - Store(PRRI, reg) \ - } \ - } - - define_link(LNKA, 0, PRQ0) - define_link(LNKB, 1, PRQ1) - define_link(LNKC, 2, PRQ2) - define_link(LNKD, 3, PRQ3) - - Device(LNKS) { - Name(_HID, EISAID("PNP0C0F")) - Name(_UID, 4) - Name(_PRS, ResourceTemplate() { - Interrupt(, Level, ActiveHigh, Shared) { 9 } - }) - - // The SCI cannot be disabled and is always attached to GSI 9, - // so these are no-ops. We only need this link to override the - // polarity to active high and match the content of the MADT. - Method(_STA, 0, NotSerialized) { Return (0x0b) } - Method(_DIS, 0, NotSerialized) { } - Method(_CRS, 0, NotSerialized) { Return (_PRS) } - Method(_SRS, 1, NotSerialized) { } - } + External(LNKA, DeviceObj) + External(LNKB, DeviceObj) + External(LNKC, DeviceObj) + External(LNKD, DeviceObj) + External(LNKS, DeviceObj) } } From 100681ccf1f97d220fbc620c9226701773cc7eaf Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:40 +0100 Subject: [PATCH 36/59] pc: acpi: piix4: move IQCR() into SSDT Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 20 ++++++++++++++++++++ hw/i386/acpi-dsdt.dsl | 11 ----------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 799efe50cd..2f2ff67ea4 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1470,6 +1470,7 @@ static void build_piix4_pci0_int(Aml *table) Aml *dev; Aml *crs; Aml *field; + Aml *if_ctx; Aml *method; uint32_t irqs; Aml *sb_scope = aml_scope("_SB"); @@ -1481,6 +1482,25 @@ static void build_piix4_pci0_int(Aml *table) aml_append(field, aml_named_field("PRQ3", 8)); aml_append(sb_scope, field); + /* _CRS method - get current settings */ + method = aml_method("IQCR", 1, AML_SERIALIZED); + { + crs = aml_resource_template(); + irqs = 0; + aml_append(crs, aml_interrupt(AML_CONSUMER, AML_LEVEL, + AML_ACTIVE_HIGH, AML_SHARED, &irqs, 1)); + aml_append(method, aml_name_decl("PRR0", crs)); + + aml_append(method, + aml_create_dword_field(aml_name("PRR0"), aml_int(5), "PRRI")); + + if_ctx = aml_if(aml_lless(aml_arg(0), aml_int(0x80))); + aml_append(if_ctx, aml_store(aml_arg(0), aml_name("PRRI"))); + aml_append(method, if_ctx); + aml_append(method, aml_return(aml_name("PRR0"))); + } + aml_append(sb_scope, method); + aml_append(sb_scope, build_link_dev("LNKA", 0, aml_name("PRQ0"))); aml_append(sb_scope, build_link_dev("LNKB", 1, aml_name("PRQ1"))); aml_append(sb_scope, build_link_dev("LNKC", 2, aml_name("PRQ2"))); diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl index b74cffd060..1f58ec4e44 100644 --- a/hw/i386/acpi-dsdt.dsl +++ b/hw/i386/acpi-dsdt.dsl @@ -140,17 +140,6 @@ DefinitionBlock ( } Return (0x0B) } - Method(IQCR, 1, Serialized) { - // _CRS method - get current settings - Name(PRR0, ResourceTemplate() { - Interrupt(, Level, ActiveHigh, Shared) { 0 } - }) - CreateDWordField(PRR0, 0x05, PRRI) - If (LLess(Arg0, 0x80)) { - Store(Arg0, PRRI) - } - Return (PRR0) - } External(LNKA, DeviceObj) External(LNKB, DeviceObj) From 06989b886185129a62be5e2ca9dae4375bb132ec Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:41 +0100 Subject: [PATCH 37/59] pc: acpi: piix4: move IQST() into SSDT Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 10 ++++++++++ hw/i386/acpi-dsdt.dsl | 9 --------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 2f2ff67ea4..9ae34df194 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1482,6 +1482,16 @@ static void build_piix4_pci0_int(Aml *table) aml_append(field, aml_named_field("PRQ3", 8)); aml_append(sb_scope, field); + /* _STA method - get status */ + method = aml_method("IQST", 1, AML_NOTSERIALIZED); + { + if_ctx = aml_if(aml_and(aml_int(0x80), aml_arg(0), NULL)); + aml_append(if_ctx, aml_return(aml_int(0x09))); + aml_append(method, if_ctx); + aml_append(method, aml_return(aml_int(0x0B))); + } + aml_append(sb_scope, method); + /* _CRS method - get current settings */ method = aml_method("IQCR", 1, AML_SERIALIZED); { diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl index 1f58ec4e44..bc6bd452c4 100644 --- a/hw/i386/acpi-dsdt.dsl +++ b/hw/i386/acpi-dsdt.dsl @@ -132,15 +132,6 @@ DefinitionBlock ( External(PRQ1, FieldUnitObj) External(PRQ2, FieldUnitObj) External(PRQ3, FieldUnitObj) - - Method(IQST, 1, NotSerialized) { - // _STA method - get status - If (And(0x80, Arg0)) { - Return (0x09) - } - Return (0x0B) - } - External(LNKA, DeviceObj) External(LNKB, DeviceObj) External(LNKC, DeviceObj) From 196e2137831b58e1267313400b5947258d5db0ff Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:42 +0100 Subject: [PATCH 38/59] pc: acpi: piix4: move PCI0._PRT() into SSDT PCI routing table for expander buses is build with help of build_prt() using AML API. And it's almost the same as PRT for PCI0 bus except of power-management device. So make existing build_prt() build PRT table for PCI0 bus as well. Signed-off-by: Igor Mammedov Reviewed-by: Marcel Apfelbaum Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 55 +++++++++++++++++++++++++++++++++------ hw/i386/acpi-dsdt.dsl | 60 ------------------------------------------- 2 files changed, 47 insertions(+), 68 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 9ae34df194..5dd25e118b 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -623,6 +623,23 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus, qobject_decref(bsel); } +/** + * build_prt_entry: + * @link_name: link name for PCI route entry + * + * build AML package containing a PCI route entry for @link_name + */ +static Aml *build_prt_entry(const char *link_name) +{ + Aml *a_zero = aml_int(0); + Aml *pkg = aml_package(4); + aml_append(pkg, a_zero); + aml_append(pkg, a_zero); + aml_append(pkg, aml_name("%s", link_name)); + aml_append(pkg, a_zero); + return pkg; +} + /* * initialize_route - Initialize the interrupt routing rule * through a specific LINK: @@ -633,12 +650,8 @@ static Aml *initialize_route(Aml *route, const char *link_name, Aml *lnk_idx, int idx) { Aml *if_ctx = aml_if(aml_equal(lnk_idx, aml_int(idx))); - Aml *pkg = aml_package(4); + Aml *pkg = build_prt_entry(link_name); - aml_append(pkg, aml_int(0)); - aml_append(pkg, aml_int(0)); - aml_append(pkg, aml_name("%s", link_name)); - aml_append(pkg, aml_int(0)); aml_append(if_ctx, aml_store(pkg, route)); return if_ctx; @@ -654,7 +667,7 @@ static Aml *initialize_route(Aml *route, const char *link_name, * The hash function is (slot + pin) & 3 -> "LNK[D|A|B|C]". * */ -static Aml *build_prt(void) +static Aml *build_prt(bool is_pci0_prt) { Aml *method, *while_ctx, *pin, *res; @@ -681,7 +694,29 @@ static Aml *build_prt(void) /* route[2] = "LNK[D|A|B|C]", selection based on pin % 3 */ aml_append(while_ctx, initialize_route(route, "LNKD", lnk_idx, 0)); - aml_append(while_ctx, initialize_route(route, "LNKA", lnk_idx, 1)); + if (is_pci0_prt) { + Aml *if_device_1, *if_pin_4, *else_pin_4; + + /* device 1 is the power-management device, needs SCI */ + if_device_1 = aml_if(aml_equal(lnk_idx, aml_int(1))); + { + if_pin_4 = aml_if(aml_equal(pin, aml_int(4))); + { + aml_append(if_pin_4, + aml_store(build_prt_entry("LNKS"), route)); + } + aml_append(if_device_1, if_pin_4); + else_pin_4 = aml_else(); + { + aml_append(else_pin_4, + aml_store(build_prt_entry("LNKA"), route)); + } + aml_append(if_device_1, else_pin_4); + } + aml_append(while_ctx, if_device_1); + } else { + aml_append(while_ctx, initialize_route(route, "LNKA", lnk_idx, 1)); + } aml_append(while_ctx, initialize_route(route, "LNKB", lnk_idx, 2)); aml_append(while_ctx, initialize_route(route, "LNKC", lnk_idx, 3)); @@ -1474,6 +1509,10 @@ static void build_piix4_pci0_int(Aml *table) Aml *method; uint32_t irqs; Aml *sb_scope = aml_scope("_SB"); + Aml *pci0_scope = aml_scope("PCI0"); + + aml_append(pci0_scope, build_prt(true)); + aml_append(sb_scope, pci0_scope); field = aml_field("PCI0.ISA.P40C", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE); aml_append(field, aml_named_field("PRQ0", 8)); @@ -1698,7 +1737,7 @@ build_ssdt(GArray *table_data, GArray *linker, aml_append(dev, aml_name_decl("_PXM", aml_int(numa_node))); } - aml_append(dev, build_prt()); + aml_append(dev, build_prt(false)); crs = build_crs(PCI_HOST_BRIDGE(BUS(bus)->parent), io_ranges, mem_ranges); aml_append(dev, aml_name_decl("_CRS", crs)); diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl index bc6bd452c4..5d741dd536 100644 --- a/hw/i386/acpi-dsdt.dsl +++ b/hw/i386/acpi-dsdt.dsl @@ -78,64 +78,4 @@ DefinitionBlock ( /* Hotplug notification method supplied by SSDT */ External(\_SB.PCI0.PCNT, MethodObj) } - - -/**************************************************************** - * PCI IRQs - ****************************************************************/ - - Scope(\_SB) { - Scope(PCI0) { - Method (_PRT, 0) { - Store(Package(128) {}, Local0) - Store(Zero, Local1) - While(LLess(Local1, 128)) { - // slot = pin >> 2 - Store(ShiftRight(Local1, 2), Local2) - - // lnk = (slot + pin) & 3 - Store(And(Add(Local1, Local2), 3), Local3) - If (LEqual(Local3, 0)) { - Store(Package(4) { Zero, Zero, LNKD, Zero }, Local4) - } - If (LEqual(Local3, 1)) { - // device 1 is the power-management device, needs SCI - If (LEqual(Local1, 4)) { - Store(Package(4) { Zero, Zero, LNKS, Zero }, Local4) - } Else { - Store(Package(4) { Zero, Zero, LNKA, Zero }, Local4) - } - } - If (LEqual(Local3, 2)) { - Store(Package(4) { Zero, Zero, LNKB, Zero }, Local4) - } - If (LEqual(Local3, 3)) { - Store(Package(4) { Zero, Zero, LNKC, Zero }, Local4) - } - - // Complete the interrupt routing entry: - // Package(4) { 0x[slot]FFFF, [pin], [link], 0) } - - Store(Or(ShiftLeft(Local2, 16), 0xFFFF), Index(Local4, 0)) - Store(And(Local1, 3), Index(Local4, 1)) - Store(Local4, Index(Local0, Local1)) - - Increment(Local1) - } - - Return(Local0) - } - } - - - External(PRQ0, FieldUnitObj) - External(PRQ1, FieldUnitObj) - External(PRQ2, FieldUnitObj) - External(PRQ3, FieldUnitObj) - External(LNKA, DeviceObj) - External(LNKB, DeviceObj) - External(LNKC, DeviceObj) - External(LNKD, DeviceObj) - External(LNKS, DeviceObj) - } } From b616ec4d6f4816671dd712d002aa21bf12442fc5 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:43 +0100 Subject: [PATCH 39/59] pc: acpi: piix4: move remaining PCI hotplug bits into SSDT Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 43 +++++++++++++++++++++++++++++++++++++++++++ hw/i386/acpi-dsdt.dsl | 40 ---------------------------------------- 2 files changed, 43 insertions(+), 40 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 5dd25e118b..f929bb8278 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1637,6 +1637,48 @@ static void build_piix4_isa_bridge(Aml *table) aml_append(table, scope); } +static void build_piix4_pci_hotplug(Aml *table) +{ + Aml *scope; + Aml *field; + Aml *method; + + scope = aml_scope("_SB.PCI0"); + + aml_append(scope, + aml_operation_region("PCST", AML_SYSTEM_IO, 0xae00, 0x08)); + field = aml_field("PCST", AML_DWORD_ACC, AML_NOLOCK, AML_WRITE_AS_ZEROS); + aml_append(field, aml_named_field("PCIU", 32)); + aml_append(field, aml_named_field("PCID", 32)); + aml_append(scope, field); + + aml_append(scope, + aml_operation_region("SEJ", AML_SYSTEM_IO, 0xae08, 0x04)); + field = aml_field("SEJ", AML_DWORD_ACC, AML_NOLOCK, AML_WRITE_AS_ZEROS); + aml_append(field, aml_named_field("B0EJ", 32)); + aml_append(scope, field); + + aml_append(scope, + aml_operation_region("BNMR", AML_SYSTEM_IO, 0xae10, 0x04)); + field = aml_field("BNMR", AML_DWORD_ACC, AML_NOLOCK, AML_WRITE_AS_ZEROS); + aml_append(field, aml_named_field("BNUM", 32)); + aml_append(scope, field); + + aml_append(scope, aml_mutex("BLCK", 0)); + + method = aml_method("PCEJ", 2, AML_NOTSERIALIZED); + aml_append(method, aml_acquire(aml_name("BLCK"), 0xFFFF)); + aml_append(method, aml_store(aml_arg(0), aml_name("BNUM"))); + aml_append(method, + aml_store(aml_shiftleft(aml_int(1), aml_arg(1)), aml_name("B0EJ"))); + aml_append(method, aml_release(aml_name("BLCK"))); + aml_append(method, aml_return(aml_int(0))); + aml_append(scope, method); + + aml_append(table, scope); +} + + static void build_ssdt(GArray *table_data, GArray *linker, AcpiCpuInfo *cpu, AcpiPmInfo *pm, AcpiMiscInfo *misc, @@ -1663,6 +1705,7 @@ build_ssdt(GArray *table_data, GArray *linker, build_piix4_pm(ssdt); build_piix4_isa_bridge(ssdt); build_isa_devices_aml(ssdt); + build_piix4_pci_hotplug(ssdt); build_piix4_pci0_int(ssdt); } else { build_hpet_aml(ssdt); diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl index 5d741dd536..a7769fcc55 100644 --- a/hw/i386/acpi-dsdt.dsl +++ b/hw/i386/acpi-dsdt.dsl @@ -38,44 +38,4 @@ DefinitionBlock ( // External(PX13, DeviceObj) } } - -/**************************************************************** - * PCI hotplug - ****************************************************************/ - - Scope(\_SB.PCI0) { - OperationRegion(PCST, SystemIO, 0xae00, 0x08) - Field(PCST, DWordAcc, NoLock, WriteAsZeros) { - PCIU, 32, - PCID, 32, - } - - OperationRegion(SEJ, SystemIO, 0xae08, 0x04) - Field(SEJ, DWordAcc, NoLock, WriteAsZeros) { - B0EJ, 32, - } - - OperationRegion(BNMR, SystemIO, 0xae10, 0x04) - Field(BNMR, DWordAcc, NoLock, WriteAsZeros) { - BNUM, 32, - } - - /* Lock to protect access to fields above. */ - Mutex(BLCK, 0) - - /* Methods called by bulk generated PCI devices below */ - - /* Methods called by hotplug devices */ - Method(PCEJ, 2, NotSerialized) { - // _EJ0 method - eject callback - Acquire(BLCK, 0xFFFF) - Store(Arg0, BNUM) - Store(ShiftLeft(1, Arg1), B0EJ) - Release(BLCK) - Return (0x0) - } - - /* Hotplug notification method supplied by SSDT */ - External(\_SB.PCI0.PCNT, MethodObj) - } } From 32b9741f50426d97f9f98a1c955875483773c9d2 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:44 +0100 Subject: [PATCH 40/59] pc: acpi: piix4: acpi move PCI0 device to SSDT leave Scope(\_SB) definition in DSDT so that iasl would be able to compile DSDT since we are still need definition block for table. After Q35 ASL is converted, DSDT templates will be completly replaced by AML API generated tables. Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 8 ++++++++ hw/i386/acpi-dsdt.dsl | 8 -------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index f929bb8278..eaabe0059d 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1701,6 +1701,14 @@ build_ssdt(GArray *table_data, GArray *linker, build_dbg_aml(ssdt); if (misc->is_piix4) { + sb_scope = aml_scope("_SB"); + dev = aml_device("PCI0"); + aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A03"))); + aml_append(dev, aml_name_decl("_ADR", aml_int(0))); + aml_append(dev, aml_name_decl("_UID", aml_int(1))); + aml_append(sb_scope, dev); + aml_append(ssdt, sb_scope); + build_hpet_aml(ssdt); build_piix4_pm(ssdt); build_piix4_isa_bridge(ssdt); diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl index a7769fcc55..82e4470de3 100644 --- a/hw/i386/acpi-dsdt.dsl +++ b/hw/i386/acpi-dsdt.dsl @@ -28,14 +28,6 @@ DefinitionBlock ( 0x1 // OEM Revision ) { - Scope(\_SB) { - Device(PCI0) { - Name(_HID, EisaId("PNP0A03")) - Name(_ADR, 0x00) - Name(_UID, 1) -//#define PX13 S0B_ -// External(PX13, DeviceObj) - } } } From 80b32df5290c7779c239abf79dfda03982aa4e0e Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:45 +0100 Subject: [PATCH 41/59] pc: acpi: q35: move GSI links to SSDT Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 47 +++++++++++++++++++++++++++++++++++++++ hw/i386/q35-acpi-dsdt.dsl | 34 +++++++--------------------- 2 files changed, 55 insertions(+), 26 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index eaabe0059d..222be8ab49 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1500,6 +1500,31 @@ static Aml *build_link_dev(const char *name, uint8_t uid, Aml *reg) return dev; } +static Aml *build_gsi_link_dev(const char *name, uint8_t uid, uint8_t gsi) +{ + Aml *dev; + Aml *crs; + Aml *method; + uint32_t irqs; + + dev = aml_device("%s", name); + aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C0F"))); + aml_append(dev, aml_name_decl("_UID", aml_int(uid))); + + crs = aml_resource_template(); + irqs = gsi; + aml_append(crs, aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH, + AML_SHARED, &irqs, 1)); + aml_append(dev, aml_name_decl("_PRS", crs)); + + aml_append(dev, aml_name_decl("_CRS", crs)); + + method = aml_method("_SRS", 1, AML_NOTSERIALIZED); + aml_append(dev, method); + + return dev; +} + static void build_piix4_pci0_int(Aml *table) { Aml *dev; @@ -1590,6 +1615,26 @@ static void build_piix4_pci0_int(Aml *table) aml_append(table, sb_scope); } +static void build_q35_pci0_int(Aml *table) +{ + Aml *sb_scope = aml_scope("_SB"); + + /* + * TODO: UID probably shouldn't be the same for GSIx devices + * but that's how it was in original ASL so keep it for now + */ + aml_append(sb_scope, build_gsi_link_dev("GSIA", 0, 0x10)); + aml_append(sb_scope, build_gsi_link_dev("GSIB", 0, 0x11)); + aml_append(sb_scope, build_gsi_link_dev("GSIC", 0, 0x12)); + aml_append(sb_scope, build_gsi_link_dev("GSID", 0, 0x13)); + aml_append(sb_scope, build_gsi_link_dev("GSIE", 0, 0x14)); + aml_append(sb_scope, build_gsi_link_dev("GSIF", 0, 0x15)); + aml_append(sb_scope, build_gsi_link_dev("GSIG", 0, 0x16)); + aml_append(sb_scope, build_gsi_link_dev("GSIH", 0, 0x17)); + + aml_append(table, sb_scope); +} + static void build_piix4_pm(Aml *table) { Aml *dev; @@ -1718,7 +1763,9 @@ build_ssdt(GArray *table_data, GArray *linker, } else { build_hpet_aml(ssdt); build_isa_devices_aml(ssdt); + build_q35_pci0_int(ssdt); } + build_cpu_hotplug_aml(ssdt); build_memory_hotplug_aml(ssdt, nr_mem, pm->mem_hp_io_base, pm->mem_hp_io_len); diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl index e15761591b..f2c154a9f0 100644 --- a/hw/i386/q35-acpi-dsdt.dsl +++ b/hw/i386/q35-acpi-dsdt.dsl @@ -348,31 +348,13 @@ DefinitionBlock ( define_link(LNKG, 6, PRQG) define_link(LNKH, 7, PRQH) -#define define_gsi_link(link, uid, gsi) \ - Device(link) { \ - Name(_HID, EISAID("PNP0C0F")) \ - Name(_UID, uid) \ - Name(_PRS, ResourceTemplate() { \ - Interrupt(, Level, ActiveHigh, Shared) { \ - gsi \ - } \ - }) \ - Name(_CRS, ResourceTemplate() { \ - Interrupt(, Level, ActiveHigh, Shared) { \ - gsi \ - } \ - }) \ - Method(_SRS, 1, NotSerialized) { \ - } \ - } - - define_gsi_link(GSIA, 0, 0x10) - define_gsi_link(GSIB, 0, 0x11) - define_gsi_link(GSIC, 0, 0x12) - define_gsi_link(GSID, 0, 0x13) - define_gsi_link(GSIE, 0, 0x14) - define_gsi_link(GSIF, 0, 0x15) - define_gsi_link(GSIG, 0, 0x16) - define_gsi_link(GSIH, 0, 0x17) + External(GSIA, DeviceObj) + External(GSIB, DeviceObj) + External(GSIC, DeviceObj) + External(GSID, DeviceObj) + External(GSIE, DeviceObj) + External(GSIF, DeviceObj) + External(GSIG, DeviceObj) + External(GSIH, DeviceObj) } } From 12e3b1f75089b7691ae333837aa026514e4aadeb Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:46 +0100 Subject: [PATCH 42/59] pc: acpi: q35: move link devices to SSDT Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 9 +++++++++ hw/i386/q35-acpi-dsdt.dsl | 40 ++++++++------------------------------- 2 files changed, 17 insertions(+), 32 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 222be8ab49..f0283f9a78 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1619,6 +1619,15 @@ static void build_q35_pci0_int(Aml *table) { Aml *sb_scope = aml_scope("_SB"); + aml_append(sb_scope, build_link_dev("LNKA", 0, aml_name("PRQA"))); + aml_append(sb_scope, build_link_dev("LNKB", 1, aml_name("PRQB"))); + aml_append(sb_scope, build_link_dev("LNKC", 2, aml_name("PRQC"))); + aml_append(sb_scope, build_link_dev("LNKD", 3, aml_name("PRQD"))); + aml_append(sb_scope, build_link_dev("LNKE", 4, aml_name("PRQE"))); + aml_append(sb_scope, build_link_dev("LNKF", 5, aml_name("PRQF"))); + aml_append(sb_scope, build_link_dev("LNKG", 6, aml_name("PRQG"))); + aml_append(sb_scope, build_link_dev("LNKH", 7, aml_name("PRQH"))); + /* * TODO: UID probably shouldn't be the same for GSIx devices * but that's how it was in original ASL so keep it for now diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl index f2c154a9f0..2da3515df2 100644 --- a/hw/i386/q35-acpi-dsdt.dsl +++ b/hw/i386/q35-acpi-dsdt.dsl @@ -315,38 +315,14 @@ DefinitionBlock ( Return (PRR0) } -#define define_link(link, uid, reg) \ - Device(link) { \ - Name(_HID, EISAID("PNP0C0F")) \ - Name(_UID, uid) \ - Name(_PRS, ResourceTemplate() { \ - Interrupt(, Level, ActiveHigh, Shared) { \ - 5, 10, 11 \ - } \ - }) \ - Method(_STA, 0, NotSerialized) { \ - Return (IQST(reg)) \ - } \ - Method(_DIS, 0, NotSerialized) { \ - Or(reg, 0x80, reg) \ - } \ - Method(_CRS, 0, NotSerialized) { \ - Return (IQCR(reg)) \ - } \ - Method(_SRS, 1, NotSerialized) { \ - CreateDWordField(Arg0, 0x05, PRRI) \ - Store(PRRI, reg) \ - } \ - } - - define_link(LNKA, 0, PRQA) - define_link(LNKB, 1, PRQB) - define_link(LNKC, 2, PRQC) - define_link(LNKD, 3, PRQD) - define_link(LNKE, 4, PRQE) - define_link(LNKF, 5, PRQF) - define_link(LNKG, 6, PRQG) - define_link(LNKH, 7, PRQH) + External(LNKA, DeviceObj) + External(LNKB, DeviceObj) + External(LNKC, DeviceObj) + External(LNKD, DeviceObj) + External(LNKE, DeviceObj) + External(LNKF, DeviceObj) + External(LNKG, DeviceObj) + External(LNKH, DeviceObj) External(GSIA, DeviceObj) External(GSIB, DeviceObj) From 16682a9d865d00968a35e02bf2b666399e7ceea5 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:47 +0100 Subject: [PATCH 43/59] pc: acpi: q35: move IQCR() into SSDT Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 51 +++++++++++++++++++++++++-------------- hw/i386/q35-acpi-dsdt.dsl | 9 ------- 2 files changed, 33 insertions(+), 27 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index f0283f9a78..5bb544ba52 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1525,6 +1525,36 @@ static Aml *build_gsi_link_dev(const char *name, uint8_t uid, uint8_t gsi) return dev; } +/* _CRS method - get current settings */ +static Aml *build_iqcr_method(bool is_piix4) +{ + Aml *if_ctx; + uint32_t irqs; + Aml *method = aml_method("IQCR", 1, AML_SERIALIZED); + Aml *crs = aml_resource_template(); + + irqs = 0; + aml_append(crs, aml_interrupt(AML_CONSUMER, AML_LEVEL, + AML_ACTIVE_HIGH, AML_SHARED, &irqs, 1)); + aml_append(method, aml_name_decl("PRR0", crs)); + + aml_append(method, + aml_create_dword_field(aml_name("PRR0"), aml_int(5), "PRRI")); + + if (is_piix4) { + if_ctx = aml_if(aml_lless(aml_arg(0), aml_int(0x80))); + aml_append(if_ctx, aml_store(aml_arg(0), aml_name("PRRI"))); + aml_append(method, if_ctx); + } else { + aml_append(method, + aml_store(aml_and(aml_arg(0), aml_int(0xF), NULL), + aml_name("PRRI"))); + } + + aml_append(method, aml_return(aml_name("PRR0"))); + return method; +} + static void build_piix4_pci0_int(Aml *table) { Aml *dev; @@ -1556,24 +1586,7 @@ static void build_piix4_pci0_int(Aml *table) } aml_append(sb_scope, method); - /* _CRS method - get current settings */ - method = aml_method("IQCR", 1, AML_SERIALIZED); - { - crs = aml_resource_template(); - irqs = 0; - aml_append(crs, aml_interrupt(AML_CONSUMER, AML_LEVEL, - AML_ACTIVE_HIGH, AML_SHARED, &irqs, 1)); - aml_append(method, aml_name_decl("PRR0", crs)); - - aml_append(method, - aml_create_dword_field(aml_name("PRR0"), aml_int(5), "PRRI")); - - if_ctx = aml_if(aml_lless(aml_arg(0), aml_int(0x80))); - aml_append(if_ctx, aml_store(aml_arg(0), aml_name("PRRI"))); - aml_append(method, if_ctx); - aml_append(method, aml_return(aml_name("PRR0"))); - } - aml_append(sb_scope, method); + aml_append(sb_scope, build_iqcr_method(true)); aml_append(sb_scope, build_link_dev("LNKA", 0, aml_name("PRQ0"))); aml_append(sb_scope, build_link_dev("LNKB", 1, aml_name("PRQ1"))); @@ -1619,6 +1632,8 @@ static void build_q35_pci0_int(Aml *table) { Aml *sb_scope = aml_scope("_SB"); + aml_append(sb_scope, build_iqcr_method(false)); + aml_append(sb_scope, build_link_dev("LNKA", 0, aml_name("PRQA"))); aml_append(sb_scope, build_link_dev("LNKB", 1, aml_name("PRQB"))); aml_append(sb_scope, build_link_dev("LNKC", 2, aml_name("PRQC"))); diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl index 2da3515df2..85b0a2c6f6 100644 --- a/hw/i386/q35-acpi-dsdt.dsl +++ b/hw/i386/q35-acpi-dsdt.dsl @@ -305,15 +305,6 @@ DefinitionBlock ( } Return (0x0B) } - Method(IQCR, 1, Serialized) { - // _CRS method - get current settings - Name(PRR0, ResourceTemplate() { - Interrupt(, Level, ActiveHigh, Shared) { 0 } - }) - CreateDWordField(PRR0, 0x05, PRRI) - Store(And(Arg0, 0x0F), PRRI) - Return (PRR0) - } External(LNKA, DeviceObj) External(LNKB, DeviceObj) From 78e1ad05097a351fe1657713619c8457dfa714da Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:48 +0100 Subject: [PATCH 44/59] pc: acpi: q35: move IQST() into SSDT Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 26 +++++++++++++++----------- hw/i386/q35-acpi-dsdt.dsl | 8 -------- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 5bb544ba52..f454ac50e1 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1555,12 +1555,24 @@ static Aml *build_iqcr_method(bool is_piix4) return method; } +/* _STA method - get status */ +static Aml *build_irq_status_method(void) +{ + Aml *if_ctx; + Aml *method = aml_method("IQST", 1, AML_NOTSERIALIZED); + + if_ctx = aml_if(aml_and(aml_int(0x80), aml_arg(0), NULL)); + aml_append(if_ctx, aml_return(aml_int(0x09))); + aml_append(method, if_ctx); + aml_append(method, aml_return(aml_int(0x0B))); + return method; +} + static void build_piix4_pci0_int(Aml *table) { Aml *dev; Aml *crs; Aml *field; - Aml *if_ctx; Aml *method; uint32_t irqs; Aml *sb_scope = aml_scope("_SB"); @@ -1576,16 +1588,7 @@ static void build_piix4_pci0_int(Aml *table) aml_append(field, aml_named_field("PRQ3", 8)); aml_append(sb_scope, field); - /* _STA method - get status */ - method = aml_method("IQST", 1, AML_NOTSERIALIZED); - { - if_ctx = aml_if(aml_and(aml_int(0x80), aml_arg(0), NULL)); - aml_append(if_ctx, aml_return(aml_int(0x09))); - aml_append(method, if_ctx); - aml_append(method, aml_return(aml_int(0x0B))); - } - aml_append(sb_scope, method); - + aml_append(sb_scope, build_irq_status_method()); aml_append(sb_scope, build_iqcr_method(true)); aml_append(sb_scope, build_link_dev("LNKA", 0, aml_name("PRQ0"))); @@ -1632,6 +1635,7 @@ static void build_q35_pci0_int(Aml *table) { Aml *sb_scope = aml_scope("_SB"); + aml_append(sb_scope, build_irq_status_method()); aml_append(sb_scope, build_iqcr_method(false)); aml_append(sb_scope, build_link_dev("LNKA", 0, aml_name("PRQA"))); diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl index 85b0a2c6f6..ec8a48c394 100644 --- a/hw/i386/q35-acpi-dsdt.dsl +++ b/hw/i386/q35-acpi-dsdt.dsl @@ -298,14 +298,6 @@ DefinitionBlock ( PRQH, 8 } - Method(IQST, 1, NotSerialized) { - // _STA method - get status - If (And(0x80, Arg0)) { - Return (0x09) - } - Return (0x0B) - } - External(LNKA, DeviceObj) External(LNKB, DeviceObj) External(LNKC, DeviceObj) From 41f95a52004fb5df6b39e0d6322e4a20c4be9e51 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:49 +0100 Subject: [PATCH 45/59] pc: acpi: q35: move ISA bridge into SSDT Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 54 +++++++++++++++++++++++++++++++++++++++ hw/i386/q35-acpi-dsdt.dsl | 46 --------------------------------- 2 files changed, 54 insertions(+), 46 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index f454ac50e1..103a08f3bd 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1633,8 +1633,21 @@ static void build_piix4_pci0_int(Aml *table) static void build_q35_pci0_int(Aml *table) { + Aml *field; Aml *sb_scope = aml_scope("_SB"); + field = aml_field("PCI0.ISA.PIRQ", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE); + aml_append(field, aml_named_field("PRQA", 8)); + aml_append(field, aml_named_field("PRQB", 8)); + aml_append(field, aml_named_field("PRQC", 8)); + aml_append(field, aml_named_field("PRQD", 8)); + aml_append(field, aml_reserved_field(0x20)); + aml_append(field, aml_named_field("PRQE", 8)); + aml_append(field, aml_named_field("PRQF", 8)); + aml_append(field, aml_named_field("PRQG", 8)); + aml_append(field, aml_named_field("PRQH", 8)); + aml_append(sb_scope, field); + aml_append(sb_scope, build_irq_status_method()); aml_append(sb_scope, build_iqcr_method(false)); @@ -1663,6 +1676,46 @@ static void build_q35_pci0_int(Aml *table) aml_append(table, sb_scope); } +static void build_q35_isa_bridge(Aml *table) +{ + Aml *dev; + Aml *scope; + Aml *field; + + scope = aml_scope("_SB.PCI0"); + dev = aml_device("ISA"); + aml_append(dev, aml_name_decl("_ADR", aml_int(0x001F0000))); + + /* ICH9 PCI to ISA irq remapping */ + aml_append(dev, aml_operation_region("PIRQ", AML_PCI_CONFIG, + 0x60, 0x0C)); + + aml_append(dev, aml_operation_region("LPCD", AML_PCI_CONFIG, + 0x80, 0x02)); + field = aml_field("LPCD", AML_ANY_ACC, AML_NOLOCK, AML_PRESERVE); + aml_append(field, aml_named_field("COMA", 3)); + aml_append(field, aml_reserved_field(1)); + aml_append(field, aml_named_field("COMB", 3)); + aml_append(field, aml_reserved_field(1)); + aml_append(field, aml_named_field("LPTD", 2)); + aml_append(field, aml_reserved_field(2)); + aml_append(field, aml_named_field("FDCD", 2)); + aml_append(dev, field); + + aml_append(dev, aml_operation_region("LPCE", AML_PCI_CONFIG, + 0x82, 0x02)); + /* enable bits */ + field = aml_field("LPCE", AML_ANY_ACC, AML_NOLOCK, AML_PRESERVE); + aml_append(field, aml_named_field("CAEN", 1)); + aml_append(field, aml_named_field("CBEN", 1)); + aml_append(field, aml_named_field("LPEN", 1)); + aml_append(field, aml_named_field("FDEN", 1)); + aml_append(dev, field); + + aml_append(scope, dev); + aml_append(table, scope); +} + static void build_piix4_pm(Aml *table) { Aml *dev; @@ -1790,6 +1843,7 @@ build_ssdt(GArray *table_data, GArray *linker, build_piix4_pci0_int(ssdt); } else { build_hpet_aml(ssdt); + build_q35_isa_bridge(ssdt); build_isa_devices_aml(ssdt); build_q35_pci0_int(ssdt); } diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl index ec8a48c394..b01d4de6cf 100644 --- a/hw/i386/q35-acpi-dsdt.dsl +++ b/hw/i386/q35-acpi-dsdt.dsl @@ -113,39 +113,6 @@ DefinitionBlock ( } } -/**************************************************************** - * LPC ISA bridge - ****************************************************************/ - - Scope(\_SB.PCI0) { - /* PCI D31:f0 LPC ISA bridge */ - Device(ISA) { - Name (_ADR, 0x001F0000) // _ADR: Address - - /* ICH9 PCI to ISA irq remapping */ - OperationRegion(PIRQ, PCI_Config, 0x60, 0x0C) - - OperationRegion(LPCD, PCI_Config, 0x80, 0x2) - Field(LPCD, AnyAcc, NoLock, Preserve) { - COMA, 3, - , 1, - COMB, 3, - - Offset(0x01), - LPTD, 2, - , 2, - FDCD, 2 - } - OperationRegion(LPCE, PCI_Config, 0x82, 0x2) - Field(LPCE, AnyAcc, NoLock, Preserve) { - CAEN, 1, - CBEN, 1, - LPEN, 1, - FDEN, 1 - } - } - } - /**************************************************************** * PCI IRQs ****************************************************************/ @@ -285,19 +252,6 @@ DefinitionBlock ( } } - Field(PCI0.ISA.PIRQ, ByteAcc, NoLock, Preserve) { - PRQA, 8, - PRQB, 8, - PRQC, 8, - PRQD, 8, - - Offset(0x08), - PRQE, 8, - PRQF, 8, - PRQG, 8, - PRQH, 8 - } - External(LNKA, DeviceObj) External(LNKB, DeviceObj) External(LNKC, DeviceObj) From 0dafe3b33603dd64d1385f8943dd056d4058cbf5 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:50 +0100 Subject: [PATCH 46/59] pc: acpi: q35: move _PRT() into SSDT Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 21 +++++++++++++++++++++ hw/i386/q35-acpi-dsdt.dsl | 12 ------------ 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 103a08f3bd..0c23c22ff2 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1634,7 +1634,28 @@ static void build_piix4_pci0_int(Aml *table) static void build_q35_pci0_int(Aml *table) { Aml *field; + Aml *method; Aml *sb_scope = aml_scope("_SB"); + Aml *pci0_scope = aml_scope("PCI0"); + + method = aml_method("_PRT", 0, AML_NOTSERIALIZED); + { + Aml *if_ctx; + Aml *else_ctx; + + /* PCI IRQ routing table, example from ACPI 2.0a specification, + section 6.2.8.1 */ + /* Note: we provide the same info as the PCI routing + table of the Bochs BIOS */ + if_ctx = aml_if(aml_equal(aml_name("PICF"), aml_int(0))); + aml_append(if_ctx, aml_return(aml_name("PRTP"))); + aml_append(method, if_ctx); + else_ctx = aml_else(); + aml_append(else_ctx, aml_return(aml_name("PRTA"))); + aml_append(method, else_ctx); + } + aml_append(pci0_scope, method); + aml_append(sb_scope, pci0_scope); field = aml_field("PCI0.ISA.PIRQ", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE); aml_append(field, aml_named_field("PRQA", 8)); diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl index b01d4de6cf..f265583a62 100644 --- a/hw/i386/q35-acpi-dsdt.dsl +++ b/hw/i386/q35-acpi-dsdt.dsl @@ -238,18 +238,6 @@ DefinitionBlock ( prt_slot_gsiA(0x001f) }) - - Method(_PRT, 0, NotSerialized) { - /* PCI IRQ routing table, example from ACPI 2.0a specification, - section 6.2.8.1 */ - /* Note: we provide the same info as the PCI routing - table of the Bochs BIOS */ - If (LEqual(\PICF, Zero)) { - Return (PRTP) - } Else { - Return (PRTA) - } - } } External(LNKA, DeviceObj) From 22b5b8bf313fa7fa60d4201a882fd82e4bb5ba8a Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:51 +0100 Subject: [PATCH 47/59] pc: acpi: q35: move PRTA routing table into SSDT Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 61 +++++++++++++++++++++++++++++++++++++++ hw/i386/q35-acpi-dsdt.dsl | 57 ------------------------------------ 2 files changed, 61 insertions(+), 57 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 0c23c22ff2..e64c662a73 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1631,6 +1631,64 @@ static void build_piix4_pci0_int(Aml *table) aml_append(table, sb_scope); } +static void append_q35_prt_entry(Aml *ctx, uint32_t nr, const char *name) +{ + int i; + int head; + Aml *pkg; + char base = name[3] < 'E' ? 'A' : 'E'; + char *s = g_strdup(name); + Aml *a_nr = aml_int((nr << 16) | 0xffff); + + assert(strlen(s) == 4); + + head = name[3] - base; + for (i = 0; i < 4; i++) { + if (head + i > 3) { + head = i * -1; + } + s[3] = base + head + i; + pkg = aml_package(4); + aml_append(pkg, a_nr); + aml_append(pkg, aml_int(i)); + aml_append(pkg, aml_name("%s", s)); + aml_append(pkg, aml_int(0)); + aml_append(ctx, pkg); + } + g_free(s); +} + +static Aml *build_q35_routing_table(const char *str) +{ + int i; + Aml *pkg; + char *name = g_strdup_printf("%s ", str); + + pkg = aml_package(128); + for (i = 0; i < 0x18; i++) { + name[3] = 'E' + (i & 0x3); + append_q35_prt_entry(pkg, i, name); + } + + name[3] = 'E'; + append_q35_prt_entry(pkg, 0x18, name); + + /* INTA -> PIRQA for slot 25 - 31, see the default value of DIR */ + for (i = 0x0019; i < 0x1e; i++) { + name[3] = 'A'; + append_q35_prt_entry(pkg, i, name); + } + + /* PCIe->PCI bridge. use PIRQ[E-H] */ + name[3] = 'E'; + append_q35_prt_entry(pkg, 0x1e, name); + name[3] = 'A'; + append_q35_prt_entry(pkg, 0x1f, name); + + g_free(name); + return pkg; +} + static void build_q35_pci0_int(Aml *table) { Aml *field; @@ -1638,6 +1696,9 @@ static void build_q35_pci0_int(Aml *table) Aml *sb_scope = aml_scope("_SB"); Aml *pci0_scope = aml_scope("PCI0"); + aml_append(pci0_scope, + aml_name_decl("PRTA", build_q35_routing_table("GSI"))); + method = aml_method("_PRT", 0, AML_NOTSERIALIZED); { Aml *if_ctx; diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl index f265583a62..a3073ad44c 100644 --- a/hw/i386/q35-acpi-dsdt.dsl +++ b/hw/i386/q35-acpi-dsdt.dsl @@ -181,63 +181,6 @@ DefinitionBlock ( prt_slot_lnkA(0x001f) }) - -#define prt_slot_gsi(nr, gsi0, gsi1, gsi2, gsi3) \ - Package() { nr##ffff, 0, gsi0, 0 }, \ - Package() { nr##ffff, 1, gsi1, 0 }, \ - Package() { nr##ffff, 2, gsi2, 0 }, \ - Package() { nr##ffff, 3, gsi3, 0 } - -#define prt_slot_gsiA(nr) prt_slot_gsi(nr, GSIA, GSIB, GSIC, GSID) -#define prt_slot_gsiB(nr) prt_slot_gsi(nr, GSIB, GSIC, GSID, GSIA) -#define prt_slot_gsiC(nr) prt_slot_gsi(nr, GSIC, GSID, GSIA, GSIB) -#define prt_slot_gsiD(nr) prt_slot_gsi(nr, GSID, GSIA, GSIB, GSIC) - -#define prt_slot_gsiE(nr) prt_slot_gsi(nr, GSIE, GSIF, GSIG, GSIH) -#define prt_slot_gsiF(nr) prt_slot_gsi(nr, GSIF, GSIG, GSIH, GSIE) -#define prt_slot_gsiG(nr) prt_slot_gsi(nr, GSIG, GSIH, GSIE, GSIF) -#define prt_slot_gsiH(nr) prt_slot_gsi(nr, GSIH, GSIE, GSIF, GSIG) - - Name(PRTA, package() { - prt_slot_gsiE(0x0000), - prt_slot_gsiF(0x0001), - prt_slot_gsiG(0x0002), - prt_slot_gsiH(0x0003), - prt_slot_gsiE(0x0004), - prt_slot_gsiF(0x0005), - prt_slot_gsiG(0x0006), - prt_slot_gsiH(0x0007), - prt_slot_gsiE(0x0008), - prt_slot_gsiF(0x0009), - prt_slot_gsiG(0x000a), - prt_slot_gsiH(0x000b), - prt_slot_gsiE(0x000c), - prt_slot_gsiF(0x000d), - prt_slot_gsiG(0x000e), - prt_slot_gsiH(0x000f), - prt_slot_gsiE(0x0010), - prt_slot_gsiF(0x0011), - prt_slot_gsiG(0x0012), - prt_slot_gsiH(0x0013), - prt_slot_gsiE(0x0014), - prt_slot_gsiF(0x0015), - prt_slot_gsiG(0x0016), - prt_slot_gsiH(0x0017), - prt_slot_gsiE(0x0018), - - /* INTA -> PIRQA for slot 25 - 31, but 30 - see the default value of DIR */ - prt_slot_gsiA(0x0019), - prt_slot_gsiA(0x001a), - prt_slot_gsiA(0x001b), - prt_slot_gsiA(0x001c), - prt_slot_gsiA(0x001d), - - /* PCIe->PCI bridge. use PIRQ[E-H] */ - prt_slot_gsiE(0x001e), - - prt_slot_gsiA(0x001f) - }) } External(LNKA, DeviceObj) From 65aef4de5e9db1ce5b05b99cdabd304b00a31d4e Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:52 +0100 Subject: [PATCH 48/59] pc: acpi: q35: move PRTP routing table into SSDT Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 2 + hw/i386/q35-acpi-dsdt.dsl | 79 --------------------------------------- 2 files changed, 2 insertions(+), 79 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index e64c662a73..6095e5932e 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1696,6 +1696,8 @@ static void build_q35_pci0_int(Aml *table) Aml *sb_scope = aml_scope("_SB"); Aml *pci0_scope = aml_scope("PCI0"); + aml_append(pci0_scope, + aml_name_decl("PRTP", build_q35_routing_table("LNK"))); aml_append(pci0_scope, aml_name_decl("PRTA", build_q35_routing_table("GSI"))); diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl index a3073ad44c..34485e79fc 100644 --- a/hw/i386/q35-acpi-dsdt.dsl +++ b/hw/i386/q35-acpi-dsdt.dsl @@ -122,83 +122,4 @@ DefinitionBlock ( Method(\_PIC, 1, NotSerialized) { Store(Arg0, \PICF) } - - Scope(\_SB) { - Scope(PCI0) { -#define prt_slot_lnk(nr, lnk0, lnk1, lnk2, lnk3) \ - Package() { nr##ffff, 0, lnk0, 0 }, \ - Package() { nr##ffff, 1, lnk1, 0 }, \ - Package() { nr##ffff, 2, lnk2, 0 }, \ - Package() { nr##ffff, 3, lnk3, 0 } - -#define prt_slot_lnkA(nr) prt_slot_lnk(nr, LNKA, LNKB, LNKC, LNKD) -#define prt_slot_lnkB(nr) prt_slot_lnk(nr, LNKB, LNKC, LNKD, LNKA) -#define prt_slot_lnkC(nr) prt_slot_lnk(nr, LNKC, LNKD, LNKA, LNKB) -#define prt_slot_lnkD(nr) prt_slot_lnk(nr, LNKD, LNKA, LNKB, LNKC) - -#define prt_slot_lnkE(nr) prt_slot_lnk(nr, LNKE, LNKF, LNKG, LNKH) -#define prt_slot_lnkF(nr) prt_slot_lnk(nr, LNKF, LNKG, LNKH, LNKE) -#define prt_slot_lnkG(nr) prt_slot_lnk(nr, LNKG, LNKH, LNKE, LNKF) -#define prt_slot_lnkH(nr) prt_slot_lnk(nr, LNKH, LNKE, LNKF, LNKG) - - Name(PRTP, package() { - prt_slot_lnkE(0x0000), - prt_slot_lnkF(0x0001), - prt_slot_lnkG(0x0002), - prt_slot_lnkH(0x0003), - prt_slot_lnkE(0x0004), - prt_slot_lnkF(0x0005), - prt_slot_lnkG(0x0006), - prt_slot_lnkH(0x0007), - prt_slot_lnkE(0x0008), - prt_slot_lnkF(0x0009), - prt_slot_lnkG(0x000a), - prt_slot_lnkH(0x000b), - prt_slot_lnkE(0x000c), - prt_slot_lnkF(0x000d), - prt_slot_lnkG(0x000e), - prt_slot_lnkH(0x000f), - prt_slot_lnkE(0x0010), - prt_slot_lnkF(0x0011), - prt_slot_lnkG(0x0012), - prt_slot_lnkH(0x0013), - prt_slot_lnkE(0x0014), - prt_slot_lnkF(0x0015), - prt_slot_lnkG(0x0016), - prt_slot_lnkH(0x0017), - prt_slot_lnkE(0x0018), - - /* INTA -> PIRQA for slot 25 - 31 - see the default value of DIR */ - prt_slot_lnkA(0x0019), - prt_slot_lnkA(0x001a), - prt_slot_lnkA(0x001b), - prt_slot_lnkA(0x001c), - prt_slot_lnkA(0x001d), - - /* PCIe->PCI bridge. use PIRQ[E-H] */ - prt_slot_lnkE(0x001e), - - prt_slot_lnkA(0x001f) - }) - } - - External(LNKA, DeviceObj) - External(LNKB, DeviceObj) - External(LNKC, DeviceObj) - External(LNKD, DeviceObj) - External(LNKE, DeviceObj) - External(LNKF, DeviceObj) - External(LNKG, DeviceObj) - External(LNKH, DeviceObj) - - External(GSIA, DeviceObj) - External(GSIB, DeviceObj) - External(GSIC, DeviceObj) - External(GSID, DeviceObj) - External(GSIE, DeviceObj) - External(GSIF, DeviceObj) - External(GSIG, DeviceObj) - External(GSIH, DeviceObj) - } } From e9fce798615b37c661df9bff405d74c69874ceb4 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:53 +0100 Subject: [PATCH 49/59] pc: acpi: q35: move _PIC() method into SSDT Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 8 ++++++++ hw/i386/q35-acpi-dsdt.dsl | 10 ---------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 6095e5932e..55ea84d43b 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1696,6 +1696,14 @@ static void build_q35_pci0_int(Aml *table) Aml *sb_scope = aml_scope("_SB"); Aml *pci0_scope = aml_scope("PCI0"); + /* Zero => PIC mode, One => APIC Mode */ + aml_append(table, aml_name_decl("PICF", aml_int(0))); + method = aml_method("_PIC", 1, AML_NOTSERIALIZED); + { + aml_append(method, aml_store(aml_arg(0), aml_name("PICF"))); + } + aml_append(table, method); + aml_append(pci0_scope, aml_name_decl("PRTP", build_q35_routing_table("LNK"))); aml_append(pci0_scope, diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl index 34485e79fc..7c7aef7e5d 100644 --- a/hw/i386/q35-acpi-dsdt.dsl +++ b/hw/i386/q35-acpi-dsdt.dsl @@ -112,14 +112,4 @@ DefinitionBlock ( } } } - -/**************************************************************** - * PCI IRQs - ****************************************************************/ - - /* Zero => PIC mode, One => APIC Mode */ - Name(\PICF, Zero) - Method(\_PIC, 1, NotSerialized) { - Store(Arg0, \PICF) - } } From f97a88a85ecfd83852c8b7ea961756b62ba35fa5 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:54 +0100 Subject: [PATCH 50/59] pc: acpi: q35: move PCI0._OSC() method into SSDT Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 56 ++++++++++++++++++++++++++++++++++++++ hw/i386/q35-acpi-dsdt.dsl | 57 --------------------------------------- 2 files changed, 56 insertions(+), 57 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 55ea84d43b..29abb9939f 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1896,6 +1896,54 @@ static void build_piix4_pci_hotplug(Aml *table) aml_append(table, scope); } +static Aml *build_q35_osc_method(void) +{ + Aml *if_ctx; + Aml *if_ctx2; + Aml *else_ctx; + Aml *method; + Aml *a_cwd1 = aml_name("CDW1"); + Aml *a_ctrl = aml_name("CTRL"); + + method = aml_method("_OSC", 4, AML_NOTSERIALIZED); + aml_append(method, aml_create_dword_field(aml_arg(3), aml_int(0), "CDW1")); + + if_ctx = aml_if(aml_equal( + aml_arg(0), aml_touuid("33DB4D5B-1FF7-401C-9657-7441C03DD766"))); + aml_append(if_ctx, aml_create_dword_field(aml_arg(3), aml_int(4), "CDW2")); + aml_append(if_ctx, aml_create_dword_field(aml_arg(3), aml_int(8), "CDW3")); + + aml_append(if_ctx, aml_store(aml_name("CDW2"), aml_name("SUPP"))); + aml_append(if_ctx, aml_store(aml_name("CDW3"), a_ctrl)); + + /* + * Always allow native PME, AER (no dependencies) + * Never allow SHPC (no SHPC controller in this system) + */ + aml_append(if_ctx, aml_and(a_ctrl, aml_int(0x1D), a_ctrl)); + + if_ctx2 = aml_if(aml_lnot(aml_equal(aml_arg(1), aml_int(1)))); + /* Unknown revision */ + aml_append(if_ctx2, aml_or(a_cwd1, aml_int(0x08), a_cwd1)); + aml_append(if_ctx, if_ctx2); + + if_ctx2 = aml_if(aml_lnot(aml_equal(aml_name("CDW3"), a_ctrl))); + /* Capabilities bits were masked */ + aml_append(if_ctx2, aml_or(a_cwd1, aml_int(0x10), a_cwd1)); + aml_append(if_ctx, if_ctx2); + + /* Update DWORD3 in the buffer */ + aml_append(if_ctx, aml_store(a_ctrl, aml_name("CDW3"))); + aml_append(method, if_ctx); + + else_ctx = aml_else(); + /* Unrecognized UUID */ + aml_append(else_ctx, aml_or(a_cwd1, aml_int(4), a_cwd1)); + aml_append(method, else_ctx); + + aml_append(method, aml_return(aml_arg(3))); + return method; +} static void build_ssdt(GArray *table_data, GArray *linker, @@ -1934,6 +1982,14 @@ build_ssdt(GArray *table_data, GArray *linker, build_piix4_pci_hotplug(ssdt); build_piix4_pci0_int(ssdt); } else { + sb_scope = aml_scope("_SB"); + scope = aml_scope("PCI0"); + aml_append(scope, aml_name_decl("SUPP", aml_int(0))); + aml_append(scope, aml_name_decl("CTRL", aml_int(0))); + aml_append(scope, build_q35_osc_method()); + aml_append(sb_scope, scope); + aml_append(ssdt, sb_scope); + build_hpet_aml(ssdt); build_q35_isa_bridge(ssdt); build_isa_devices_aml(ssdt); diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl index 7c7aef7e5d..b53663c039 100644 --- a/hw/i386/q35-acpi-dsdt.dsl +++ b/hw/i386/q35-acpi-dsdt.dsl @@ -53,63 +53,6 @@ DefinitionBlock ( Name(_CID, EisaId("PNP0A03")) Name(_ADR, 0x00) Name(_UID, 1) - - External(ISA, DeviceObj) - - // _OSC: based on sample of ACPI3.0b spec - Name(SUPP, 0) // PCI _OSC Support Field value - Name(CTRL, 0) // PCI _OSC Control Field value - Method(_OSC, 4) { - // Create DWORD-addressable fields from the Capabilities Buffer - CreateDWordField(Arg3, 0, CDW1) - - // Check for proper UUID - If (LEqual(Arg0, ToUUID("33DB4D5B-1FF7-401C-9657-7441C03DD766"))) { - // Create DWORD-addressable fields from the Capabilities Buffer - CreateDWordField(Arg3, 4, CDW2) - CreateDWordField(Arg3, 8, CDW3) - - // Save Capabilities DWORD2 & 3 - Store(CDW2, SUPP) - Store(CDW3, CTRL) - - // Always allow native PME, AER (no dependencies) - // Never allow SHPC (no SHPC controller in this system) - And(CTRL, 0x1D, CTRL) - -#if 0 // For now, nothing to do - If (Not(And(CDW1, 1))) { // Query flag clear? - // Disable GPEs for features granted native control. - If (And(CTRL, 0x01)) { // Hot plug control granted? - Store(0, HPCE) // clear the hot plug SCI enable bit - Store(1, HPCS) // clear the hot plug SCI status bit - } - If (And(CTRL, 0x04)) { // PME control granted? - Store(0, PMCE) // clear the PME SCI enable bit - Store(1, PMCS) // clear the PME SCI status bit - } - If (And(CTRL, 0x10)) { // OS restoring PCI Express cap structure? - // Set status to not restore PCI Express cap structure - // upon resume from S3 - Store(1, S3CR) - } - } -#endif - If (LNotEqual(Arg1, One)) { - // Unknown revision - Or(CDW1, 0x08, CDW1) - } - If (LNotEqual(CDW3, CTRL)) { - // Capabilities bits were masked - Or(CDW1, 0x10, CDW1) - } - // Update DWORD3 in the buffer - Store(CTRL, CDW3) - } Else { - Or(CDW1, 4, CDW1) // Unrecognized UUID - } - Return (Arg3) - } } } } From afa06e1828a78c127182dbddfd9ec205ef8f059e Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:55 +0100 Subject: [PATCH 51/59] pc: acpi: q35: move PCI0 device definition into SSDT Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 14 +++++++++----- hw/i386/q35-acpi-dsdt.dsl | 13 ------------- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 29abb9939f..609baf4cec 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1983,11 +1983,15 @@ build_ssdt(GArray *table_data, GArray *linker, build_piix4_pci0_int(ssdt); } else { sb_scope = aml_scope("_SB"); - scope = aml_scope("PCI0"); - aml_append(scope, aml_name_decl("SUPP", aml_int(0))); - aml_append(scope, aml_name_decl("CTRL", aml_int(0))); - aml_append(scope, build_q35_osc_method()); - aml_append(sb_scope, scope); + dev = aml_device("PCI0"); + aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A08"))); + aml_append(dev, aml_name_decl("_CID", aml_eisaid("PNP0A03"))); + aml_append(dev, aml_name_decl("_ADR", aml_int(0))); + aml_append(dev, aml_name_decl("_UID", aml_int(1))); + aml_append(dev, aml_name_decl("SUPP", aml_int(0))); + aml_append(dev, aml_name_decl("CTRL", aml_int(0))); + aml_append(dev, build_q35_osc_method()); + aml_append(sb_scope, dev); aml_append(ssdt, sb_scope); build_hpet_aml(ssdt); diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl index b53663c039..f234f5c03a 100644 --- a/hw/i386/q35-acpi-dsdt.dsl +++ b/hw/i386/q35-acpi-dsdt.dsl @@ -42,17 +42,4 @@ DefinitionBlock ( PCIB, 8, } } - - -/**************************************************************** - * PCI Bus definition - ****************************************************************/ - Scope(\_SB) { - Device(PCI0) { - Name(_HID, EisaId("PNP0A08")) - Name(_CID, EisaId("PNP0A03")) - Name(_ADR, 0x00) - Name(_UID, 1) - } - } } From 9e4afc0995d1dc6cba55b103cc4e1f7e7516482a Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:56 +0100 Subject: [PATCH 52/59] pc: acpi: q35: PCST, PCSB opregions and PCIB field into SSDT Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 10 ++++++++++ hw/i386/q35-acpi-dsdt.dsl | 5 ----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 609baf4cec..68e40d938f 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1982,6 +1982,16 @@ build_ssdt(GArray *table_data, GArray *linker, build_piix4_pci_hotplug(ssdt); build_piix4_pci0_int(ssdt); } else { + sb_scope = aml_scope("_SB"); + aml_append(sb_scope, + aml_operation_region("PCST", AML_SYSTEM_IO, 0xae00, 0x0c)); + aml_append(sb_scope, + aml_operation_region("PCSB", AML_SYSTEM_IO, 0xae0c, 0x01)); + field = aml_field("PCSB", AML_ANY_ACC, AML_NOLOCK, AML_WRITE_AS_ZEROS); + aml_append(field, aml_named_field("PCIB", 8)); + aml_append(sb_scope, field); + aml_append(ssdt, sb_scope); + sb_scope = aml_scope("_SB"); dev = aml_device("PCI0"); aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A08"))); diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl index f234f5c03a..3ecdb5096e 100644 --- a/hw/i386/q35-acpi-dsdt.dsl +++ b/hw/i386/q35-acpi-dsdt.dsl @@ -36,10 +36,5 @@ DefinitionBlock ( { Scope(\_SB) { - OperationRegion(PCST, SystemIO, 0xae00, 0x0c) - OperationRegion(PCSB, SystemIO, 0xae0c, 0x01) - Field(PCSB, AnyAcc, NoLock, WriteAsZeros) { - PCIB, 8, - } } } From 3db119da79155788908416d9b5f0e6f32cfcc748 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:57 +0100 Subject: [PATCH 53/59] pc: acpi: switch to AML API composed DSDT Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 235 +++++++++++++++++++++---------------------- 1 file changed, 115 insertions(+), 120 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 68e40d938f..78758e24aa 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -54,9 +54,6 @@ #include "hw/i386/intel_iommu.h" #include "hw/timer/hpet.h" -#include "hw/i386/q35-acpi-dsdt.hex" -#include "hw/i386/acpi-dsdt.hex" - #include "hw/acpi/aml-build.h" #include "qapi/qmp/qint.h" @@ -125,24 +122,6 @@ typedef struct AcpiBuildPciBusHotplugState { bool pcihp_bridge_en; } AcpiBuildPciBusHotplugState; -static void acpi_get_dsdt(AcpiMiscInfo *info) -{ - Object *piix = piix4_pm_find(); - Object *lpc = ich9_lpc_find(); - assert(!!piix != !!lpc); - - if (piix) { - info->is_piix4 = true; - info->dsdt_code = AcpiDsdtAmlCode; - info->dsdt_size = sizeof AcpiDsdtAmlCode; - } - if (lpc) { - info->is_piix4 = false; - info->dsdt_code = Q35AcpiDsdtAmlCode; - info->dsdt_size = sizeof Q35AcpiDsdtAmlCode; - } -} - static int acpi_add_cpu_info(Object *o, void *opaque) { @@ -241,6 +220,17 @@ static void acpi_get_pm_info(AcpiPmInfo *pm) static void acpi_get_misc_info(AcpiMiscInfo *info) { + Object *piix = piix4_pm_find(); + Object *lpc = ich9_lpc_find(); + assert(!!piix != !!lpc); + + if (piix) { + info->is_piix4 = true; + } + if (lpc) { + info->is_piix4 = false; + } + info->has_hpet = hpet_find(); info->tpm_version = tpm_get_version(); info->pvpanic_port = pvpanic_port(); @@ -1965,95 +1955,6 @@ build_ssdt(GArray *table_data, GArray *linker, /* Reserve space for header */ acpi_data_push(ssdt->buf, sizeof(AcpiTableHeader)); - build_dbg_aml(ssdt); - if (misc->is_piix4) { - sb_scope = aml_scope("_SB"); - dev = aml_device("PCI0"); - aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A03"))); - aml_append(dev, aml_name_decl("_ADR", aml_int(0))); - aml_append(dev, aml_name_decl("_UID", aml_int(1))); - aml_append(sb_scope, dev); - aml_append(ssdt, sb_scope); - - build_hpet_aml(ssdt); - build_piix4_pm(ssdt); - build_piix4_isa_bridge(ssdt); - build_isa_devices_aml(ssdt); - build_piix4_pci_hotplug(ssdt); - build_piix4_pci0_int(ssdt); - } else { - sb_scope = aml_scope("_SB"); - aml_append(sb_scope, - aml_operation_region("PCST", AML_SYSTEM_IO, 0xae00, 0x0c)); - aml_append(sb_scope, - aml_operation_region("PCSB", AML_SYSTEM_IO, 0xae0c, 0x01)); - field = aml_field("PCSB", AML_ANY_ACC, AML_NOLOCK, AML_WRITE_AS_ZEROS); - aml_append(field, aml_named_field("PCIB", 8)); - aml_append(sb_scope, field); - aml_append(ssdt, sb_scope); - - sb_scope = aml_scope("_SB"); - dev = aml_device("PCI0"); - aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A08"))); - aml_append(dev, aml_name_decl("_CID", aml_eisaid("PNP0A03"))); - aml_append(dev, aml_name_decl("_ADR", aml_int(0))); - aml_append(dev, aml_name_decl("_UID", aml_int(1))); - aml_append(dev, aml_name_decl("SUPP", aml_int(0))); - aml_append(dev, aml_name_decl("CTRL", aml_int(0))); - aml_append(dev, build_q35_osc_method()); - aml_append(sb_scope, dev); - aml_append(ssdt, sb_scope); - - build_hpet_aml(ssdt); - build_q35_isa_bridge(ssdt); - build_isa_devices_aml(ssdt); - build_q35_pci0_int(ssdt); - } - - build_cpu_hotplug_aml(ssdt); - build_memory_hotplug_aml(ssdt, nr_mem, pm->mem_hp_io_base, - pm->mem_hp_io_len); - - scope = aml_scope("_GPE"); - { - aml_append(scope, aml_name_decl("_HID", aml_string("ACPI0006"))); - - aml_append(scope, aml_method("_L00", 0, AML_NOTSERIALIZED)); - - if (misc->is_piix4) { - method = aml_method("_E01", 0, AML_NOTSERIALIZED); - aml_append(method, - aml_acquire(aml_name("\\_SB.PCI0.BLCK"), 0xFFFF)); - aml_append(method, aml_call0("\\_SB.PCI0.PCNT")); - aml_append(method, aml_release(aml_name("\\_SB.PCI0.BLCK"))); - aml_append(scope, method); - } else { - aml_append(scope, aml_method("_L01", 0, AML_NOTSERIALIZED)); - } - - method = aml_method("_E02", 0, AML_NOTSERIALIZED); - aml_append(method, aml_call0("\\_SB." CPU_SCAN_METHOD)); - aml_append(scope, method); - - method = aml_method("_E03", 0, AML_NOTSERIALIZED); - aml_append(method, aml_call0(MEMORY_HOTPLUG_HANDLER_PATH)); - aml_append(scope, method); - - aml_append(scope, aml_method("_L04", 0, AML_NOTSERIALIZED)); - aml_append(scope, aml_method("_L05", 0, AML_NOTSERIALIZED)); - aml_append(scope, aml_method("_L06", 0, AML_NOTSERIALIZED)); - aml_append(scope, aml_method("_L07", 0, AML_NOTSERIALIZED)); - aml_append(scope, aml_method("_L08", 0, AML_NOTSERIALIZED)); - aml_append(scope, aml_method("_L09", 0, AML_NOTSERIALIZED)); - aml_append(scope, aml_method("_L0A", 0, AML_NOTSERIALIZED)); - aml_append(scope, aml_method("_L0B", 0, AML_NOTSERIALIZED)); - aml_append(scope, aml_method("_L0C", 0, AML_NOTSERIALIZED)); - aml_append(scope, aml_method("_L0D", 0, AML_NOTSERIALIZED)); - aml_append(scope, aml_method("_L0E", 0, AML_NOTSERIALIZED)); - aml_append(scope, aml_method("_L0F", 0, AML_NOTSERIALIZED)); - } - aml_append(ssdt, scope); - bus = PC_MACHINE(machine)->bus; if (bus) { QLIST_FOREACH(bus, &bus->child, sibling) { @@ -2523,18 +2424,113 @@ build_dmar_q35(GArray *table_data, GArray *linker) } static void -build_dsdt(GArray *table_data, GArray *linker, AcpiMiscInfo *misc) +build_dsdt(GArray *table_data, GArray *linker, + AcpiPmInfo *pm, AcpiMiscInfo *misc) { - AcpiTableHeader *dsdt; + Aml *dsdt, *sb_scope, *scope, *dev, *method, *field; + MachineState *machine = MACHINE(qdev_get_machine()); + uint32_t nr_mem = machine->ram_slots; - assert(misc->dsdt_code && misc->dsdt_size); + dsdt = init_aml_allocator(); - dsdt = acpi_data_push(table_data, misc->dsdt_size); - memcpy(dsdt, misc->dsdt_code, misc->dsdt_size); + /* Reserve space for header */ + acpi_data_push(dsdt->buf, sizeof(AcpiTableHeader)); - memset(dsdt, 0, sizeof *dsdt); - build_header(linker, table_data, dsdt, "DSDT", - misc->dsdt_size, 1, NULL); + build_dbg_aml(dsdt); + if (misc->is_piix4) { + sb_scope = aml_scope("_SB"); + dev = aml_device("PCI0"); + aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A03"))); + aml_append(dev, aml_name_decl("_ADR", aml_int(0))); + aml_append(dev, aml_name_decl("_UID", aml_int(1))); + aml_append(sb_scope, dev); + aml_append(dsdt, sb_scope); + + build_hpet_aml(dsdt); + build_piix4_pm(dsdt); + build_piix4_isa_bridge(dsdt); + build_isa_devices_aml(dsdt); + build_piix4_pci_hotplug(dsdt); + build_piix4_pci0_int(dsdt); + } else { + sb_scope = aml_scope("_SB"); + aml_append(sb_scope, + aml_operation_region("PCST", AML_SYSTEM_IO, 0xae00, 0x0c)); + aml_append(sb_scope, + aml_operation_region("PCSB", AML_SYSTEM_IO, 0xae0c, 0x01)); + field = aml_field("PCSB", AML_ANY_ACC, AML_NOLOCK, AML_WRITE_AS_ZEROS); + aml_append(field, aml_named_field("PCIB", 8)); + aml_append(sb_scope, field); + aml_append(dsdt, sb_scope); + + sb_scope = aml_scope("_SB"); + dev = aml_device("PCI0"); + aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A08"))); + aml_append(dev, aml_name_decl("_CID", aml_eisaid("PNP0A03"))); + aml_append(dev, aml_name_decl("_ADR", aml_int(0))); + aml_append(dev, aml_name_decl("_UID", aml_int(1))); + aml_append(dev, aml_name_decl("SUPP", aml_int(0))); + aml_append(dev, aml_name_decl("CTRL", aml_int(0))); + aml_append(dev, build_q35_osc_method()); + aml_append(sb_scope, dev); + aml_append(dsdt, sb_scope); + + build_hpet_aml(dsdt); + build_q35_isa_bridge(dsdt); + build_isa_devices_aml(dsdt); + build_q35_pci0_int(dsdt); + } + + build_cpu_hotplug_aml(dsdt); + build_memory_hotplug_aml(dsdt, nr_mem, pm->mem_hp_io_base, + pm->mem_hp_io_len); + + scope = aml_scope("_GPE"); + { + aml_append(scope, aml_name_decl("_HID", aml_string("ACPI0006"))); + + aml_append(scope, aml_method("_L00", 0, AML_NOTSERIALIZED)); + + if (misc->is_piix4) { + method = aml_method("_E01", 0, AML_NOTSERIALIZED); + aml_append(method, + aml_acquire(aml_name("\\_SB.PCI0.BLCK"), 0xFFFF)); + aml_append(method, aml_call0("\\_SB.PCI0.PCNT")); + aml_append(method, aml_release(aml_name("\\_SB.PCI0.BLCK"))); + aml_append(scope, method); + } else { + aml_append(scope, aml_method("_L01", 0, AML_NOTSERIALIZED)); + } + + method = aml_method("_E02", 0, AML_NOTSERIALIZED); + aml_append(method, aml_call0("\\_SB." CPU_SCAN_METHOD)); + aml_append(scope, method); + + method = aml_method("_E03", 0, AML_NOTSERIALIZED); + aml_append(method, aml_call0(MEMORY_HOTPLUG_HANDLER_PATH)); + aml_append(scope, method); + + aml_append(scope, aml_method("_L04", 0, AML_NOTSERIALIZED)); + aml_append(scope, aml_method("_L05", 0, AML_NOTSERIALIZED)); + aml_append(scope, aml_method("_L06", 0, AML_NOTSERIALIZED)); + aml_append(scope, aml_method("_L07", 0, AML_NOTSERIALIZED)); + aml_append(scope, aml_method("_L08", 0, AML_NOTSERIALIZED)); + aml_append(scope, aml_method("_L09", 0, AML_NOTSERIALIZED)); + aml_append(scope, aml_method("_L0A", 0, AML_NOTSERIALIZED)); + aml_append(scope, aml_method("_L0B", 0, AML_NOTSERIALIZED)); + aml_append(scope, aml_method("_L0C", 0, AML_NOTSERIALIZED)); + aml_append(scope, aml_method("_L0D", 0, AML_NOTSERIALIZED)); + aml_append(scope, aml_method("_L0E", 0, AML_NOTSERIALIZED)); + aml_append(scope, aml_method("_L0F", 0, AML_NOTSERIALIZED)); + } + aml_append(dsdt, scope); + + /* copy AML table into ACPI tables blob and patch header there */ + g_array_append_vals(table_data, dsdt->buf->data, dsdt->buf->len); + build_header(linker, table_data, + (void *)(table_data->data + table_data->len - dsdt->buf->len), + "DSDT", dsdt->buf->len, 1, NULL); + free_aml_allocator(); } static GArray * @@ -2628,7 +2624,6 @@ void acpi_build(PcGuestInfo *guest_info, AcpiBuildTables *tables) acpi_get_cpu_info(&cpu); acpi_get_pm_info(&pm); - acpi_get_dsdt(&misc); acpi_get_misc_info(&misc); acpi_get_pci_info(&pci); @@ -2650,7 +2645,7 @@ void acpi_build(PcGuestInfo *guest_info, AcpiBuildTables *tables) /* DSDT is pointed to by FADT */ dsdt = tables_blob->len; - build_dsdt(tables_blob, tables->linker, &misc); + build_dsdt(tables_blob, tables->linker, &pm, &misc); /* Count the size of the DSDT and SSDT, we will need it for legacy * sizing of ACPI tables. From 9fc6502606864811aaa96282411e83af63bf80fd Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 28 Dec 2015 18:02:58 +0100 Subject: [PATCH 54/59] pc: acpi: remove unused ASL templates and related blobs/utils QEMU now uses internally composed DSDT so drop now empty *.dsl templates and related *.generated binary blobs. Also since templates are not used anymore/obolete remove utility scripts used for extracting/patching AML blobs compiled by IASL and for updating them in git tree. Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/Makefile.objs | 30 - hw/i386/acpi-dsdt.dsl | 33 - hw/i386/acpi-dsdt.hex.generated | 2972 ----------- hw/i386/q35-acpi-dsdt.dsl | 40 - hw/i386/q35-acpi-dsdt.hex.generated | 7610 --------------------------- scripts/acpi_extract.py | 367 -- scripts/acpi_extract_preprocess.py | 51 - scripts/update-acpi.sh | 4 - 8 files changed, 11107 deletions(-) delete mode 100644 hw/i386/acpi-dsdt.dsl delete mode 100644 hw/i386/acpi-dsdt.hex.generated delete mode 100644 hw/i386/q35-acpi-dsdt.dsl delete mode 100644 hw/i386/q35-acpi-dsdt.hex.generated delete mode 100755 scripts/acpi_extract.py delete mode 100755 scripts/acpi_extract_preprocess.py delete mode 100644 scripts/update-acpi.sh diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs index c250deb848..b52d5b8756 100644 --- a/hw/i386/Makefile.objs +++ b/hw/i386/Makefile.objs @@ -8,33 +8,3 @@ obj-$(CONFIG_XEN) += ../xenpv/ xen/ obj-y += kvmvapic.o obj-y += acpi-build.o obj-y += pci-assign-load-rom.o - -gen-hex-y += hw/i386/acpi-dsdt.hex -gen-hex-y += hw/i386/q35-acpi-dsdt.hex - -hw/i386/acpi-build.o: hw/i386/acpi-build.c \ - $(gen-hex-y) - --include $(gen-hex-y:.hex=.d) - -iasl-option=$(shell if test -z "`$(1) $(2) 2>&1 > /dev/null`" \ - ; then echo "$(2)"; else echo "$(3)"; fi ;) - -ifdef IASL -#IASL Present. Generate hex files from .dsl -hw/i386/%.hex: $(SRC_PATH)/hw/i386/%.dsl $(SRC_PATH)/scripts/acpi_extract_preprocess.py $(SRC_PATH)/scripts/acpi_extract.py - $(call quiet-command, $(CPP) -x c -P $(QEMU_DGFLAGS) $(QEMU_INCLUDES) $< -o $*.dsl.i.orig, " CPP $(TARGET_DIR)$*.dsl.i.orig") - $(call quiet-command, $(PYTHON) $(SRC_PATH)/scripts/acpi_extract_preprocess.py $*.dsl.i.orig > $*.dsl.i, " ACPI_PREPROCESS $(TARGET_DIR)$*.dsl.i") - $(call quiet-command, $(IASL) $(call iasl-option,$(IASL),-Pn,) -vs -l -tc -p $* $*.dsl.i $(if $(V), , > /dev/null) 2>&1 ," IASL $(TARGET_DIR)$*.dsl.i") - $(call quiet-command, $(PYTHON) $(SRC_PATH)/scripts/acpi_extract.py $*.lst > $*.off, " ACPI_EXTRACT $(TARGET_DIR)$*.off") - $(call quiet-command, cat $*.off > $@, " CAT $(TARGET_DIR)$@") -else -#IASL Not present. Restore pre-generated hex files. -hw/i386/%.hex: $(SRC_PATH)/hw/i386/%.hex.generated - $(call quiet-command, cp -f $< $@, " CP $(TARGET_DIR)$@") -endif - -.PHONY: cleanhex -cleanhex: - rm -f hw/i386/*hex -clean: cleanhex diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl deleted file mode 100644 index 82e4470de3..0000000000 --- a/hw/i386/acpi-dsdt.dsl +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bochs/QEMU ACPI DSDT ASL definition - * - * Copyright (c) 2006 Fabrice Bellard - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2 as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -ACPI_EXTRACT_ALL_CODE AcpiDsdtAmlCode - -DefinitionBlock ( - "acpi-dsdt.aml", // Output Filename - "DSDT", // Signature - 0x01, // DSDT Compliance Revision - "BXPC", // OEMID - "BXDSDT", // TABLE ID - 0x1 // OEM Revision - ) -{ - Scope(\_SB) { - } -} diff --git a/hw/i386/acpi-dsdt.hex.generated b/hw/i386/acpi-dsdt.hex.generated deleted file mode 100644 index ecaa4a5480..0000000000 --- a/hw/i386/acpi-dsdt.hex.generated +++ /dev/null @@ -1,2972 +0,0 @@ -static unsigned char AcpiDsdtAmlCode[] = { -0x44, -0x53, -0x44, -0x54, -0x9a, -0xb, -0x0, -0x0, -0x1, -0xf8, -0x42, -0x58, -0x50, -0x43, -0x0, -0x0, -0x42, -0x58, -0x44, -0x53, -0x44, -0x54, -0x0, -0x0, -0x1, -0x0, -0x0, -0x0, -0x49, -0x4e, -0x54, -0x4c, -0x7, -0x11, -0x14, -0x20, -0x10, -0x49, -0x4, -0x5c, -0x0, -0x5b, -0x80, -0x44, -0x42, -0x47, -0x5f, -0x1, -0xb, -0x2, -0x4, -0x1, -0x5b, -0x81, -0xb, -0x44, -0x42, -0x47, -0x5f, -0x1, -0x44, -0x42, -0x47, -0x42, -0x8, -0x14, -0x2c, -0x44, -0x42, -0x55, -0x47, -0x1, -0x98, -0x68, -0x60, -0x96, -0x60, -0x60, -0x74, -0x87, -0x60, -0x1, -0x61, -0x70, -0x0, -0x62, -0xa2, -0x10, -0x95, -0x62, -0x61, -0x70, -0x83, -0x88, -0x60, -0x62, -0x0, -0x44, -0x42, -0x47, -0x42, -0x75, -0x62, -0x70, -0xa, -0xa, -0x44, -0x42, -0x47, -0x42, -0x10, -0x22, -0x5f, -0x53, -0x42, -0x5f, -0x5b, -0x82, -0x1b, -0x50, -0x43, -0x49, -0x30, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xc, -0x41, -0xd0, -0xa, -0x3, -0x8, -0x5f, -0x41, -0x44, -0x52, -0x0, -0x8, -0x5f, -0x55, -0x49, -0x44, -0x1, -0x10, -0x4d, -0x8, -0x5f, -0x53, -0x42, -0x5f, -0x5b, -0x82, -0x45, -0x8, -0x48, -0x50, -0x45, -0x54, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xc, -0x41, -0xd0, -0x1, -0x3, -0x8, -0x5f, -0x55, -0x49, -0x44, -0x0, -0x5b, -0x80, -0x48, -0x50, -0x54, -0x4d, -0x0, -0xc, -0x0, -0x0, -0xd0, -0xfe, -0xb, -0x0, -0x4, -0x5b, -0x81, -0x10, -0x48, -0x50, -0x54, -0x4d, -0x13, -0x56, -0x45, -0x4e, -0x44, -0x20, -0x50, -0x52, -0x44, -0x5f, -0x20, -0x14, -0x36, -0x5f, -0x53, -0x54, -0x41, -0x0, -0x70, -0x56, -0x45, -0x4e, -0x44, -0x60, -0x70, -0x50, -0x52, -0x44, -0x5f, -0x61, -0x7a, -0x60, -0xa, -0x10, -0x60, -0xa0, -0xc, -0x91, -0x93, -0x60, -0x0, -0x93, -0x60, -0xb, -0xff, -0xff, -0xa4, -0x0, -0xa0, -0xe, -0x91, -0x93, -0x61, -0x0, -0x94, -0x61, -0xc, -0x0, -0xe1, -0xf5, -0x5, -0xa4, -0x0, -0xa4, -0xa, -0xf, -0x8, -0x5f, -0x43, -0x52, -0x53, -0x11, -0x11, -0xa, -0xe, -0x86, -0x9, -0x0, -0x0, -0x0, -0x0, -0xd0, -0xfe, -0x0, -0x4, -0x0, -0x0, -0x79, -0x0, -0x10, -0x25, -0x2e, -0x5f, -0x53, -0x42, -0x5f, -0x50, -0x43, -0x49, -0x30, -0x5b, -0x82, -0x19, -0x50, -0x58, -0x31, -0x33, -0x8, -0x5f, -0x41, -0x44, -0x52, -0xc, -0x3, -0x0, -0x1, -0x0, -0x5b, -0x80, -0x50, -0x31, -0x33, -0x43, -0x2, -0x0, -0xa, -0xff, -0x10, -0x46, -0x5, -0x2e, -0x5f, -0x53, -0x42, -0x5f, -0x50, -0x43, -0x49, -0x30, -0x5b, -0x82, -0x49, -0x4, -0x49, -0x53, -0x41, -0x5f, -0x8, -0x5f, -0x41, -0x44, -0x52, -0xc, -0x0, -0x0, -0x1, -0x0, -0x5b, -0x80, -0x50, -0x34, -0x30, -0x43, -0x2, -0xa, -0x60, -0xa, -0x4, -0x5b, -0x81, -0x26, -0x5e, -0x2e, -0x50, -0x58, -0x31, -0x33, -0x50, -0x31, -0x33, -0x43, -0x0, -0x0, -0x48, -0x2f, -0x0, -0x7, -0x4c, -0x50, -0x45, -0x4e, -0x1, -0x0, -0x38, -0x0, -0x3, -0x43, -0x41, -0x45, -0x4e, -0x1, -0x0, -0x3, -0x43, -0x42, -0x45, -0x4e, -0x1, -0x8, -0x46, -0x44, -0x45, -0x4e, -0x1, -0x10, -0x4c, -0x1b, -0x2f, -0x3, -0x5f, -0x53, -0x42, -0x5f, -0x50, -0x43, -0x49, -0x30, -0x49, -0x53, -0x41, -0x5f, -0x5b, -0x82, -0x2d, -0x52, -0x54, -0x43, -0x5f, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xc, -0x41, -0xd0, -0xb, -0x0, -0x8, -0x5f, -0x43, -0x52, -0x53, -0x11, -0x18, -0xa, -0x15, -0x47, -0x1, -0x70, -0x0, -0x70, -0x0, -0x10, -0x2, -0x22, -0x0, -0x1, -0x47, -0x1, -0x72, -0x0, -0x72, -0x0, -0x2, -0x6, -0x79, -0x0, -0x5b, -0x82, -0x37, -0x4b, -0x42, -0x44, -0x5f, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xc, -0x41, -0xd0, -0x3, -0x3, -0x14, -0x9, -0x5f, -0x53, -0x54, -0x41, -0x0, -0xa4, -0xa, -0xf, -0x8, -0x5f, -0x43, -0x52, -0x53, -0x11, -0x18, -0xa, -0x15, -0x47, -0x1, -0x60, -0x0, -0x60, -0x0, -0x1, -0x1, -0x47, -0x1, -0x64, -0x0, -0x64, -0x0, -0x1, -0x1, -0x22, -0x2, -0x0, -0x79, -0x0, -0x5b, -0x82, -0x27, -0x4d, -0x4f, -0x55, -0x5f, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xc, -0x41, -0xd0, -0xf, -0x13, -0x14, -0x9, -0x5f, -0x53, -0x54, -0x41, -0x0, -0xa4, -0xa, -0xf, -0x8, -0x5f, -0x43, -0x52, -0x53, -0x11, -0x8, -0xa, -0x5, -0x22, -0x0, -0x10, -0x79, -0x0, -0x5b, -0x82, -0x4a, -0x4, -0x46, -0x44, -0x43, -0x30, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xc, -0x41, -0xd0, -0x7, -0x0, -0x14, -0x18, -0x5f, -0x53, -0x54, -0x41, -0x0, -0x70, -0x46, -0x44, -0x45, -0x4e, -0x60, -0xa0, -0x6, -0x93, -0x60, -0x0, -0xa4, -0x0, -0xa1, -0x4, -0xa4, -0xa, -0xf, -0x8, -0x5f, -0x43, -0x52, -0x53, -0x11, -0x1b, -0xa, -0x18, -0x47, -0x1, -0xf2, -0x3, -0xf2, -0x3, -0x0, -0x4, -0x47, -0x1, -0xf7, -0x3, -0xf7, -0x3, -0x0, -0x1, -0x22, -0x40, -0x0, -0x2a, -0x4, -0x0, -0x79, -0x0, -0x5b, -0x82, -0x3e, -0x4c, -0x50, -0x54, -0x5f, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xc, -0x41, -0xd0, -0x4, -0x0, -0x14, -0x18, -0x5f, -0x53, -0x54, -0x41, -0x0, -0x70, -0x4c, -0x50, -0x45, -0x4e, -0x60, -0xa0, -0x6, -0x93, -0x60, -0x0, -0xa4, -0x0, -0xa1, -0x4, -0xa4, -0xa, -0xf, -0x8, -0x5f, -0x43, -0x52, -0x53, -0x11, -0x10, -0xa, -0xd, -0x47, -0x1, -0x78, -0x3, -0x78, -0x3, -0x8, -0x8, -0x22, -0x80, -0x0, -0x79, -0x0, -0x5b, -0x82, -0x45, -0x4, -0x43, -0x4f, -0x4d, -0x31, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xc, -0x41, -0xd0, -0x5, -0x1, -0x8, -0x5f, -0x55, -0x49, -0x44, -0x1, -0x14, -0x18, -0x5f, -0x53, -0x54, -0x41, -0x0, -0x70, -0x43, -0x41, -0x45, -0x4e, -0x60, -0xa0, -0x6, -0x93, -0x60, -0x0, -0xa4, -0x0, -0xa1, -0x4, -0xa4, -0xa, -0xf, -0x8, -0x5f, -0x43, -0x52, -0x53, -0x11, -0x10, -0xa, -0xd, -0x47, -0x1, -0xf8, -0x3, -0xf8, -0x3, -0x0, -0x8, -0x22, -0x10, -0x0, -0x79, -0x0, -0x5b, -0x82, -0x46, -0x4, -0x43, -0x4f, -0x4d, -0x32, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xc, -0x41, -0xd0, -0x5, -0x1, -0x8, -0x5f, -0x55, -0x49, -0x44, -0xa, -0x2, -0x14, -0x18, -0x5f, -0x53, -0x54, -0x41, -0x0, -0x70, -0x43, -0x42, -0x45, -0x4e, -0x60, -0xa0, -0x6, -0x93, -0x60, -0x0, -0xa4, -0x0, -0xa1, -0x4, -0xa4, -0xa, -0xf, -0x8, -0x5f, -0x43, -0x52, -0x53, -0x11, -0x10, -0xa, -0xd, -0x47, -0x1, -0xf8, -0x2, -0xf8, -0x2, -0x0, -0x8, -0x22, -0x8, -0x0, -0x79, -0x0, -0x10, -0x48, -0x8, -0x2e, -0x5f, -0x53, -0x42, -0x5f, -0x50, -0x43, -0x49, -0x30, -0x5b, -0x80, -0x50, -0x43, -0x53, -0x54, -0x1, -0xb, -0x0, -0xae, -0xa, -0x8, -0x5b, -0x81, -0x10, -0x50, -0x43, -0x53, -0x54, -0x43, -0x50, -0x43, -0x49, -0x55, -0x20, -0x50, -0x43, -0x49, -0x44, -0x20, -0x5b, -0x80, -0x53, -0x45, -0x4a, -0x5f, -0x1, -0xb, -0x8, -0xae, -0xa, -0x4, -0x5b, -0x81, -0xb, -0x53, -0x45, -0x4a, -0x5f, -0x43, -0x42, -0x30, -0x45, -0x4a, -0x20, -0x5b, -0x80, -0x42, -0x4e, -0x4d, -0x52, -0x1, -0xb, -0x10, -0xae, -0xa, -0x4, -0x5b, -0x81, -0xb, -0x42, -0x4e, -0x4d, -0x52, -0x43, -0x42, -0x4e, -0x55, -0x4d, -0x20, -0x5b, -0x1, -0x42, -0x4c, -0x43, -0x4b, -0x0, -0x14, -0x25, -0x50, -0x43, -0x45, -0x4a, -0x2, -0x5b, -0x23, -0x42, -0x4c, -0x43, -0x4b, -0xff, -0xff, -0x70, -0x68, -0x42, -0x4e, -0x55, -0x4d, -0x70, -0x79, -0x1, -0x69, -0x0, -0x42, -0x30, -0x45, -0x4a, -0x5b, -0x27, -0x42, -0x4c, -0x43, -0x4b, -0xa4, -0x0, -0x10, -0x4e, -0x36, -0x5f, -0x53, -0x42, -0x5f, -0x10, -0x4b, -0xa, -0x50, -0x43, -0x49, -0x30, -0x14, -0x44, -0xa, -0x5f, -0x50, -0x52, -0x54, -0x0, -0x70, -0x12, -0x2, -0x80, -0x60, -0x70, -0x0, -0x61, -0xa2, -0x42, -0x9, -0x95, -0x61, -0xa, -0x80, -0x70, -0x7a, -0x61, -0xa, -0x2, -0x0, -0x62, -0x70, -0x7b, -0x72, -0x61, -0x62, -0x0, -0xa, -0x3, -0x0, -0x63, -0xa0, -0x10, -0x93, -0x63, -0x0, -0x70, -0x12, -0x9, -0x4, -0x0, -0x0, -0x4c, -0x4e, -0x4b, -0x44, -0x0, -0x64, -0xa0, -0x24, -0x93, -0x63, -0x1, -0xa0, -0x11, -0x93, -0x61, -0xa, -0x4, -0x70, -0x12, -0x9, -0x4, -0x0, -0x0, -0x4c, -0x4e, -0x4b, -0x53, -0x0, -0x64, -0xa1, -0xd, -0x70, -0x12, -0x9, -0x4, -0x0, -0x0, -0x4c, -0x4e, -0x4b, -0x41, -0x0, -0x64, -0xa0, -0x11, -0x93, -0x63, -0xa, -0x2, -0x70, -0x12, -0x9, -0x4, -0x0, -0x0, -0x4c, -0x4e, -0x4b, -0x42, -0x0, -0x64, -0xa0, -0x11, -0x93, -0x63, -0xa, -0x3, -0x70, -0x12, -0x9, -0x4, -0x0, -0x0, -0x4c, -0x4e, -0x4b, -0x43, -0x0, -0x64, -0x70, -0x7d, -0x79, -0x62, -0xa, -0x10, -0x0, -0xb, -0xff, -0xff, -0x0, -0x88, -0x64, -0x0, -0x0, -0x70, -0x7b, -0x61, -0xa, -0x3, -0x0, -0x88, -0x64, -0x1, -0x0, -0x70, -0x64, -0x88, -0x60, -0x61, -0x0, -0x75, -0x61, -0xa4, -0x60, -0x5b, -0x81, -0x24, -0x2f, -0x3, -0x50, -0x43, -0x49, -0x30, -0x49, -0x53, -0x41, -0x5f, -0x50, -0x34, -0x30, -0x43, -0x1, -0x50, -0x52, -0x51, -0x30, -0x8, -0x50, -0x52, -0x51, -0x31, -0x8, -0x50, -0x52, -0x51, -0x32, -0x8, -0x50, -0x52, -0x51, -0x33, -0x8, -0x14, -0x13, -0x49, -0x51, -0x53, -0x54, -0x1, -0xa0, -0x9, -0x7b, -0xa, -0x80, -0x68, -0x0, -0xa4, -0xa, -0x9, -0xa4, -0xa, -0xb, -0x14, -0x36, -0x49, -0x51, -0x43, -0x52, -0x9, -0x8, -0x50, -0x52, -0x52, -0x30, -0x11, -0xe, -0xa, -0xb, -0x89, -0x6, -0x0, -0x9, -0x1, -0x0, -0x0, -0x0, -0x0, -0x79, -0x0, -0x8a, -0x50, -0x52, -0x52, -0x30, -0xa, -0x5, -0x50, -0x52, -0x52, -0x49, -0xa0, -0xb, -0x95, -0x68, -0xa, -0x80, -0x70, -0x68, -0x50, -0x52, -0x52, -0x49, -0xa4, -0x50, -0x52, -0x52, -0x30, -0x5b, -0x82, -0x4c, -0x7, -0x4c, -0x4e, -0x4b, -0x41, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xc, -0x41, -0xd0, -0xc, -0xf, -0x8, -0x5f, -0x55, -0x49, -0x44, -0x0, -0x8, -0x5f, -0x50, -0x52, -0x53, -0x11, -0x16, -0xa, -0x13, -0x89, -0xe, -0x0, -0x9, -0x3, -0x5, -0x0, -0x0, -0x0, -0xa, -0x0, -0x0, -0x0, -0xb, -0x0, -0x0, -0x0, -0x79, -0x0, -0x14, -0xf, -0x5f, -0x53, -0x54, -0x41, -0x0, -0xa4, -0x49, -0x51, -0x53, -0x54, -0x50, -0x52, -0x51, -0x30, -0x14, -0x11, -0x5f, -0x44, -0x49, -0x53, -0x0, -0x7d, -0x50, -0x52, -0x51, -0x30, -0xa, -0x80, -0x50, -0x52, -0x51, -0x30, -0x14, -0xf, -0x5f, -0x43, -0x52, -0x53, -0x0, -0xa4, -0x49, -0x51, -0x43, -0x52, -0x50, -0x52, -0x51, -0x30, -0x14, -0x17, -0x5f, -0x53, -0x52, -0x53, -0x1, -0x8a, -0x68, -0xa, -0x5, -0x50, -0x52, -0x52, -0x49, -0x70, -0x50, -0x52, -0x52, -0x49, -0x50, -0x52, -0x51, -0x30, -0x5b, -0x82, -0x4c, -0x7, -0x4c, -0x4e, -0x4b, -0x42, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xc, -0x41, -0xd0, -0xc, -0xf, -0x8, -0x5f, -0x55, -0x49, -0x44, -0x1, -0x8, -0x5f, -0x50, -0x52, -0x53, -0x11, -0x16, -0xa, -0x13, -0x89, -0xe, -0x0, -0x9, -0x3, -0x5, -0x0, -0x0, -0x0, -0xa, -0x0, -0x0, -0x0, -0xb, -0x0, -0x0, -0x0, -0x79, -0x0, -0x14, -0xf, -0x5f, -0x53, -0x54, -0x41, -0x0, -0xa4, -0x49, -0x51, -0x53, -0x54, -0x50, -0x52, -0x51, -0x31, -0x14, -0x11, -0x5f, -0x44, -0x49, -0x53, -0x0, -0x7d, -0x50, -0x52, -0x51, -0x31, -0xa, -0x80, -0x50, -0x52, -0x51, -0x31, -0x14, -0xf, -0x5f, -0x43, -0x52, -0x53, -0x0, -0xa4, -0x49, -0x51, -0x43, -0x52, -0x50, -0x52, -0x51, -0x31, -0x14, -0x17, -0x5f, -0x53, -0x52, -0x53, -0x1, -0x8a, -0x68, -0xa, -0x5, -0x50, -0x52, -0x52, -0x49, -0x70, -0x50, -0x52, -0x52, -0x49, -0x50, -0x52, -0x51, -0x31, -0x5b, -0x82, -0x4d, -0x7, -0x4c, -0x4e, -0x4b, -0x43, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xc, -0x41, -0xd0, -0xc, -0xf, -0x8, -0x5f, -0x55, -0x49, -0x44, -0xa, -0x2, -0x8, -0x5f, -0x50, -0x52, -0x53, -0x11, -0x16, -0xa, -0x13, -0x89, -0xe, -0x0, -0x9, -0x3, -0x5, -0x0, -0x0, -0x0, -0xa, -0x0, -0x0, -0x0, -0xb, -0x0, -0x0, -0x0, -0x79, -0x0, -0x14, -0xf, -0x5f, -0x53, -0x54, -0x41, -0x0, -0xa4, -0x49, -0x51, -0x53, -0x54, -0x50, -0x52, -0x51, -0x32, -0x14, -0x11, -0x5f, -0x44, -0x49, -0x53, -0x0, -0x7d, -0x50, -0x52, -0x51, -0x32, -0xa, -0x80, -0x50, -0x52, -0x51, -0x32, -0x14, -0xf, -0x5f, -0x43, -0x52, -0x53, -0x0, -0xa4, -0x49, -0x51, -0x43, -0x52, -0x50, -0x52, -0x51, -0x32, -0x14, -0x17, -0x5f, -0x53, -0x52, -0x53, -0x1, -0x8a, -0x68, -0xa, -0x5, -0x50, -0x52, -0x52, -0x49, -0x70, -0x50, -0x52, -0x52, -0x49, -0x50, -0x52, -0x51, -0x32, -0x5b, -0x82, -0x4d, -0x7, -0x4c, -0x4e, -0x4b, -0x44, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xc, -0x41, -0xd0, -0xc, -0xf, -0x8, -0x5f, -0x55, -0x49, -0x44, -0xa, -0x3, -0x8, -0x5f, -0x50, -0x52, -0x53, -0x11, -0x16, -0xa, -0x13, -0x89, -0xe, -0x0, -0x9, -0x3, -0x5, -0x0, -0x0, -0x0, -0xa, -0x0, -0x0, -0x0, -0xb, -0x0, -0x0, -0x0, -0x79, -0x0, -0x14, -0xf, -0x5f, -0x53, -0x54, -0x41, -0x0, -0xa4, -0x49, -0x51, -0x53, -0x54, -0x50, -0x52, -0x51, -0x33, -0x14, -0x11, -0x5f, -0x44, -0x49, -0x53, -0x0, -0x7d, -0x50, -0x52, -0x51, -0x33, -0xa, -0x80, -0x50, -0x52, -0x51, -0x33, -0x14, -0xf, -0x5f, -0x43, -0x52, -0x53, -0x0, -0xa4, -0x49, -0x51, -0x43, -0x52, -0x50, -0x52, -0x51, -0x33, -0x14, -0x17, -0x5f, -0x53, -0x52, -0x53, -0x1, -0x8a, -0x68, -0xa, -0x5, -0x50, -0x52, -0x52, -0x49, -0x70, -0x50, -0x52, -0x52, -0x49, -0x50, -0x52, -0x51, -0x33, -0x5b, -0x82, -0x4f, -0x4, -0x4c, -0x4e, -0x4b, -0x53, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xc, -0x41, -0xd0, -0xc, -0xf, -0x8, -0x5f, -0x55, -0x49, -0x44, -0xa, -0x4, -0x8, -0x5f, -0x50, -0x52, -0x53, -0x11, -0xe, -0xa, -0xb, -0x89, -0x6, -0x0, -0x9, -0x1, -0x9, -0x0, -0x0, -0x0, -0x79, -0x0, -0x14, -0x9, -0x5f, -0x53, -0x54, -0x41, -0x0, -0xa4, -0xa, -0xb, -0x14, -0x6, -0x5f, -0x44, -0x49, -0x53, -0x0, -0x14, -0xb, -0x5f, -0x43, -0x52, -0x53, -0x0, -0xa4, -0x5f, -0x50, -0x52, -0x53, -0x14, -0x6, -0x5f, -0x53, -0x52, -0x53, -0x1, -0x10, -0x4d, -0xc, -0x5f, -0x53, -0x42, -0x5f, -0x14, -0x35, -0x43, -0x50, -0x4d, -0x41, -0x1, -0x70, -0x83, -0x88, -0x43, -0x50, -0x4f, -0x4e, -0x68, -0x0, -0x60, -0x70, -0x11, -0xb, -0xa, -0x8, -0x0, -0x8, -0x0, -0x0, -0x0, -0x0, -0x0, -0x0, -0x61, -0x70, -0x68, -0x88, -0x61, -0xa, -0x2, -0x0, -0x70, -0x68, -0x88, -0x61, -0xa, -0x3, -0x0, -0x70, -0x60, -0x88, -0x61, -0xa, -0x4, -0x0, -0xa4, -0x61, -0x14, -0x1a, -0x43, -0x50, -0x53, -0x54, -0x1, -0x70, -0x83, -0x88, -0x43, -0x50, -0x4f, -0x4e, -0x68, -0x0, -0x60, -0xa0, -0x5, -0x60, -0xa4, -0xa, -0xf, -0xa1, -0x3, -0xa4, -0x0, -0x14, -0xa, -0x43, -0x50, -0x45, -0x4a, -0x2, -0x5b, -0x22, -0xa, -0xc8, -0x14, -0x4a, -0x6, -0x50, -0x52, -0x53, -0x43, -0x0, -0x70, -0x50, -0x52, -0x53, -0x5f, -0x65, -0x70, -0x0, -0x62, -0x70, -0x0, -0x60, -0xa2, -0x46, -0x5, -0x95, -0x60, -0x87, -0x43, -0x50, -0x4f, -0x4e, -0x70, -0x83, -0x88, -0x43, -0x50, -0x4f, -0x4e, -0x60, -0x0, -0x61, -0xa0, -0xa, -0x7b, -0x60, -0xa, -0x7, -0x0, -0x7a, -0x62, -0x1, -0x62, -0xa1, -0xc, -0x70, -0x83, -0x88, -0x65, -0x7a, -0x60, -0xa, -0x3, -0x0, -0x0, -0x62, -0x70, -0x7b, -0x62, -0x1, -0x0, -0x63, -0xa0, -0x22, -0x92, -0x93, -0x61, -0x63, -0x70, -0x63, -0x88, -0x43, -0x50, -0x4f, -0x4e, -0x60, -0x0, -0xa0, -0xa, -0x93, -0x63, -0x1, -0x4e, -0x54, -0x46, -0x59, -0x60, -0x1, -0xa1, -0x8, -0x4e, -0x54, -0x46, -0x59, -0x60, -0xa, -0x3, -0x75, -0x60, -0x10, -0x44, -0x2a, -0x2e, -0x5f, -0x53, -0x42, -0x5f, -0x50, -0x43, -0x49, -0x30, -0x5b, -0x82, -0x47, -0x29, -0x4d, -0x48, -0x50, -0x44, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xd, -0x50, -0x4e, -0x50, -0x30, -0x41, -0x30, -0x36, -0x0, -0x8, -0x5f, -0x55, -0x49, -0x44, -0xd, -0x4d, -0x65, -0x6d, -0x6f, -0x72, -0x79, -0x20, -0x68, -0x6f, -0x74, -0x70, -0x6c, -0x75, -0x67, -0x20, -0x72, -0x65, -0x73, -0x6f, -0x75, -0x72, -0x63, -0x65, -0x73, -0x0, -0x14, -0x13, -0x5f, -0x53, -0x54, -0x41, -0x0, -0xa0, -0x9, -0x93, -0x4d, -0x44, -0x4e, -0x52, -0x0, -0xa4, -0x0, -0xa4, -0xa, -0xb, -0x5b, -0x1, -0x4d, -0x4c, -0x43, -0x4b, -0x0, -0x14, -0x4a, -0x4, -0x4d, -0x53, -0x43, -0x4e, -0x0, -0xa0, -0x9, -0x93, -0x4d, -0x44, -0x4e, -0x52, -0x0, -0xa4, -0x0, -0x70, -0x0, -0x60, -0x5b, -0x23, -0x4d, -0x4c, -0x43, -0x4b, -0xff, -0xff, -0xa2, -0x25, -0x95, -0x60, -0x4d, -0x44, -0x4e, -0x52, -0x70, -0x60, -0x4d, -0x53, -0x45, -0x4c, -0xa0, -0x13, -0x93, -0x4d, -0x49, -0x4e, -0x53, -0x1, -0x4d, -0x54, -0x46, -0x59, -0x60, -0x1, -0x70, -0x1, -0x4d, -0x49, -0x4e, -0x53, -0x72, -0x60, -0x1, -0x60, -0x5b, -0x27, -0x4d, -0x4c, -0x43, -0x4b, -0xa4, -0x1, -0x14, -0x2d, -0x4d, -0x52, -0x53, -0x54, -0x1, -0x70, -0x0, -0x60, -0x5b, -0x23, -0x4d, -0x4c, -0x43, -0x4b, -0xff, -0xff, -0x70, -0x99, -0x68, -0x0, -0x4d, -0x53, -0x45, -0x4c, -0xa0, -0xb, -0x93, -0x4d, -0x45, -0x53, -0x5f, -0x1, -0x70, -0xa, -0xf, -0x60, -0x5b, -0x27, -0x4d, -0x4c, -0x43, -0x4b, -0xa4, -0x60, -0x14, -0x41, -0x18, -0x4d, -0x43, -0x52, -0x53, -0x9, -0x5b, -0x23, -0x4d, -0x4c, -0x43, -0x4b, -0xff, -0xff, -0x70, -0x99, -0x68, -0x0, -0x4d, -0x53, -0x45, -0x4c, -0x8, -0x4d, -0x52, -0x36, -0x34, -0x11, -0x33, -0xa, -0x30, -0x8a, -0x2b, -0x0, -0x0, -0xc, -0x3, -0x0, -0x0, -0x0, -0x0, -0x0, -0x0, -0x0, -0x0, -0x0, -0x0, -0x0, -0x0, -0x0, -0x0, -0x0, -0x0, -0xfe, -0xff, -0xff, -0xff, -0xff, -0xff, -0xff, -0xff, -0x0, -0x0, -0x0, -0x0, -0x0, -0x0, -0x0, -0x0, -0xff, -0xff, -0xff, -0xff, -0xff, -0xff, -0xff, -0xff, -0x79, -0x0, -0x8a, -0x4d, -0x52, -0x36, -0x34, -0xa, -0xe, -0x4d, -0x49, -0x4e, -0x4c, -0x8a, -0x4d, -0x52, -0x36, -0x34, -0xa, -0x12, -0x4d, -0x49, -0x4e, -0x48, -0x8a, -0x4d, -0x52, -0x36, -0x34, -0xa, -0x26, -0x4c, -0x45, -0x4e, -0x4c, -0x8a, -0x4d, -0x52, -0x36, -0x34, -0xa, -0x2a, -0x4c, -0x45, -0x4e, -0x48, -0x8a, -0x4d, -0x52, -0x36, -0x34, -0xa, -0x16, -0x4d, -0x41, -0x58, -0x4c, -0x8a, -0x4d, -0x52, -0x36, -0x34, -0xa, -0x1a, -0x4d, -0x41, -0x58, -0x48, -0x70, -0x4d, -0x52, -0x42, -0x48, -0x4d, -0x49, -0x4e, -0x48, -0x70, -0x4d, -0x52, -0x42, -0x4c, -0x4d, -0x49, -0x4e, -0x4c, -0x70, -0x4d, -0x52, -0x4c, -0x48, -0x4c, -0x45, -0x4e, -0x48, -0x70, -0x4d, -0x52, -0x4c, -0x4c, -0x4c, -0x45, -0x4e, -0x4c, -0x72, -0x4d, -0x49, -0x4e, -0x4c, -0x4c, -0x45, -0x4e, -0x4c, -0x4d, -0x41, -0x58, -0x4c, -0x72, -0x4d, -0x49, -0x4e, -0x48, -0x4c, -0x45, -0x4e, -0x48, -0x4d, -0x41, -0x58, -0x48, -0xa0, -0x14, -0x95, -0x4d, -0x41, -0x58, -0x4c, -0x4d, -0x49, -0x4e, -0x4c, -0x72, -0x4d, -0x41, -0x58, -0x48, -0x1, -0x4d, -0x41, -0x58, -0x48, -0xa0, -0x11, -0x95, -0x4d, -0x41, -0x58, -0x4c, -0x1, -0x74, -0x4d, -0x41, -0x58, -0x48, -0x1, -0x4d, -0x41, -0x58, -0x48, -0x74, -0x4d, -0x41, -0x58, -0x4c, -0x1, -0x4d, -0x41, -0x58, -0x4c, -0xa0, -0x44, -0x7, -0x93, -0x4d, -0x41, -0x58, -0x48, -0x0, -0x8, -0x4d, -0x52, -0x33, -0x32, -0x11, -0x1f, -0xa, -0x1c, -0x87, -0x17, -0x0, -0x0, -0xc, -0x3, -0x0, -0x0, -0x0, -0x0, -0x0, -0x0, -0x0, -0x0, -0xfe, -0xff, -0xff, -0xff, -0x0, -0x0, -0x0, -0x0, -0xff, -0xff, -0xff, -0xff, -0x79, -0x0, -0x8a, -0x4d, -0x52, -0x33, -0x32, -0xa, -0xa, -0x4d, -0x49, -0x4e, -0x5f, -0x8a, -0x4d, -0x52, -0x33, -0x32, -0xa, -0xe, -0x4d, -0x41, -0x58, -0x5f, -0x8a, -0x4d, -0x52, -0x33, -0x32, -0xa, -0x16, -0x4c, -0x45, -0x4e, -0x5f, -0x70, -0x4d, -0x49, -0x4e, -0x4c, -0x4d, -0x49, -0x4e, -0x5f, -0x70, -0x4d, -0x41, -0x58, -0x4c, -0x4d, -0x41, -0x58, -0x5f, -0x70, -0x4c, -0x45, -0x4e, -0x4c, -0x4c, -0x45, -0x4e, -0x5f, -0x5b, -0x27, -0x4d, -0x4c, -0x43, -0x4b, -0xa4, -0x4d, -0x52, -0x33, -0x32, -0x5b, -0x27, -0x4d, -0x4c, -0x43, -0x4b, -0xa4, -0x4d, -0x52, -0x36, -0x34, -0x14, -0x24, -0x4d, -0x50, -0x58, -0x4d, -0x1, -0x5b, -0x23, -0x4d, -0x4c, -0x43, -0x4b, -0xff, -0xff, -0x70, -0x99, -0x68, -0x0, -0x4d, -0x53, -0x45, -0x4c, -0x70, -0x4d, -0x50, -0x58, -0x5f, -0x60, -0x5b, -0x27, -0x4d, -0x4c, -0x43, -0x4b, -0xa4, -0x60, -0x14, -0x28, -0x4d, -0x4f, -0x53, -0x54, -0x4, -0x5b, -0x23, -0x4d, -0x4c, -0x43, -0x4b, -0xff, -0xff, -0x70, -0x99, -0x68, -0x0, -0x4d, -0x53, -0x45, -0x4c, -0x70, -0x69, -0x4d, -0x4f, -0x45, -0x56, -0x70, -0x6a, -0x4d, -0x4f, -0x53, -0x43, -0x5b, -0x27, -0x4d, -0x4c, -0x43, -0x4b, -0x10, -0x45, -0xd, -0x5f, -0x47, -0x50, -0x45, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xd, -0x41, -0x43, -0x50, -0x49, -0x30, -0x30, -0x30, -0x36, -0x0, -0x14, -0x6, -0x5f, -0x4c, -0x30, -0x30, -0x0, -0x14, -0x39, -0x5f, -0x45, -0x30, -0x31, -0x0, -0x5b, -0x23, -0x5c, -0x2f, -0x3, -0x5f, -0x53, -0x42, -0x5f, -0x50, -0x43, -0x49, -0x30, -0x42, -0x4c, -0x43, -0x4b, -0xff, -0xff, -0x5c, -0x2f, -0x3, -0x5f, -0x53, -0x42, -0x5f, -0x50, -0x43, -0x49, -0x30, -0x50, -0x43, -0x4e, -0x54, -0x5b, -0x27, -0x5c, -0x2f, -0x3, -0x5f, -0x53, -0x42, -0x5f, -0x50, -0x43, -0x49, -0x30, -0x42, -0x4c, -0x43, -0x4b, -0x14, -0x10, -0x5f, -0x45, -0x30, -0x32, -0x0, -0x5c, -0x2e, -0x5f, -0x53, -0x42, -0x5f, -0x50, -0x52, -0x53, -0x43, -0x14, -0x19, -0x5f, -0x45, -0x30, -0x33, -0x0, -0x5c, -0x2f, -0x4, -0x5f, -0x53, -0x42, -0x5f, -0x50, -0x43, -0x49, -0x30, -0x4d, -0x48, -0x50, -0x44, -0x4d, -0x53, -0x43, -0x4e, -0x14, -0x6, -0x5f, -0x4c, -0x30, -0x34, -0x0, -0x14, -0x6, -0x5f, -0x4c, -0x30, -0x35, -0x0, -0x14, -0x6, -0x5f, -0x4c, -0x30, -0x36, -0x0, -0x14, -0x6, -0x5f, -0x4c, -0x30, -0x37, -0x0, -0x14, -0x6, -0x5f, -0x4c, -0x30, -0x38, -0x0, -0x14, -0x6, -0x5f, -0x4c, -0x30, -0x39, -0x0, -0x14, -0x6, -0x5f, -0x4c, -0x30, -0x41, -0x0, -0x14, -0x6, -0x5f, -0x4c, -0x30, -0x42, -0x0, -0x14, -0x6, -0x5f, -0x4c, -0x30, -0x43, -0x0, -0x14, -0x6, -0x5f, -0x4c, -0x30, -0x44, -0x0, -0x14, -0x6, -0x5f, -0x4c, -0x30, -0x45, -0x0, -0x14, -0x6, -0x5f, -0x4c, -0x30, -0x46, -0x0 -}; diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl deleted file mode 100644 index 3ecdb5096e..0000000000 --- a/hw/i386/q35-acpi-dsdt.dsl +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Bochs/QEMU ACPI DSDT ASL definition - * - * Copyright (c) 2006 Fabrice Bellard - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2 as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -/* - * Copyright (c) 2010 Isaku Yamahata - * yamahata at valinux co jp - * Based on acpi-dsdt.dsl, but heavily modified for q35 chipset. - */ - - -ACPI_EXTRACT_ALL_CODE Q35AcpiDsdtAmlCode - -DefinitionBlock ( - "q35-acpi-dsdt.aml",// Output Filename - "DSDT", // Signature - 0x01, // DSDT Compliance Revision - "BXPC", // OEMID - "BXDSDT", // TABLE ID - 0x2 // OEM Revision - ) -{ - - Scope(\_SB) { - } -} diff --git a/hw/i386/q35-acpi-dsdt.hex.generated b/hw/i386/q35-acpi-dsdt.hex.generated deleted file mode 100644 index ed9a2cc8e0..0000000000 --- a/hw/i386/q35-acpi-dsdt.hex.generated +++ /dev/null @@ -1,7610 +0,0 @@ -static unsigned char Q35AcpiDsdtAmlCode[] = { -0x44, -0x53, -0x44, -0x54, -0xb8, -0x1d, -0x0, -0x0, -0x1, -0x35, -0x42, -0x58, -0x50, -0x43, -0x0, -0x0, -0x42, -0x58, -0x44, -0x53, -0x44, -0x54, -0x0, -0x0, -0x2, -0x0, -0x0, -0x0, -0x49, -0x4e, -0x54, -0x4c, -0x7, -0x11, -0x14, -0x20, -0x10, -0x49, -0x4, -0x5c, -0x0, -0x5b, -0x80, -0x44, -0x42, -0x47, -0x5f, -0x1, -0xb, -0x2, -0x4, -0x1, -0x5b, -0x81, -0xb, -0x44, -0x42, -0x47, -0x5f, -0x1, -0x44, -0x42, -0x47, -0x42, -0x8, -0x14, -0x2c, -0x44, -0x42, -0x55, -0x47, -0x1, -0x98, -0x68, -0x60, -0x96, -0x60, -0x60, -0x74, -0x87, -0x60, -0x1, -0x61, -0x70, -0x0, -0x62, -0xa2, -0x10, -0x95, -0x62, -0x61, -0x70, -0x83, -0x88, -0x60, -0x62, -0x0, -0x44, -0x42, -0x47, -0x42, -0x75, -0x62, -0x70, -0xa, -0xa, -0x44, -0x42, -0x47, -0x42, -0x10, -0x29, -0x5f, -0x53, -0x42, -0x5f, -0x5b, -0x80, -0x50, -0x43, -0x53, -0x54, -0x1, -0xb, -0x0, -0xae, -0xa, -0xc, -0x5b, -0x80, -0x50, -0x43, -0x53, -0x42, -0x1, -0xb, -0xc, -0xae, -0x1, -0x5b, -0x81, -0xb, -0x50, -0x43, -0x53, -0x42, -0x40, -0x50, -0x43, -0x49, -0x42, -0x8, -0x10, -0x4f, -0xc, -0x5f, -0x53, -0x42, -0x5f, -0x5b, -0x82, -0x47, -0xc, -0x50, -0x43, -0x49, -0x30, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xc, -0x41, -0xd0, -0xa, -0x8, -0x8, -0x5f, -0x43, -0x49, -0x44, -0xc, -0x41, -0xd0, -0xa, -0x3, -0x8, -0x5f, -0x41, -0x44, -0x52, -0x0, -0x8, -0x5f, -0x55, -0x49, -0x44, -0x1, -0x8, -0x53, -0x55, -0x50, -0x50, -0x0, -0x8, -0x43, -0x54, -0x52, -0x4c, -0x0, -0x14, -0x44, -0x9, -0x5f, -0x4f, -0x53, -0x43, -0x4, -0x8a, -0x6b, -0x0, -0x43, -0x44, -0x57, -0x31, -0xa0, -0x46, -0x7, -0x93, -0x68, -0x11, -0x13, -0xa, -0x10, -0x5b, -0x4d, -0xdb, -0x33, -0xf7, -0x1f, -0x1c, -0x40, -0x96, -0x57, -0x74, -0x41, -0xc0, -0x3d, -0xd7, -0x66, -0x8a, -0x6b, -0xa, -0x4, -0x43, -0x44, -0x57, -0x32, -0x8a, -0x6b, -0xa, -0x8, -0x43, -0x44, -0x57, -0x33, -0x70, -0x43, -0x44, -0x57, -0x32, -0x53, -0x55, -0x50, -0x50, -0x70, -0x43, -0x44, -0x57, -0x33, -0x43, -0x54, -0x52, -0x4c, -0x7b, -0x43, -0x54, -0x52, -0x4c, -0xa, -0x1d, -0x43, -0x54, -0x52, -0x4c, -0xa0, -0x10, -0x92, -0x93, -0x69, -0x1, -0x7d, -0x43, -0x44, -0x57, -0x31, -0xa, -0x8, -0x43, -0x44, -0x57, -0x31, -0xa0, -0x16, -0x92, -0x93, -0x43, -0x44, -0x57, -0x33, -0x43, -0x54, -0x52, -0x4c, -0x7d, -0x43, -0x44, -0x57, -0x31, -0xa, -0x10, -0x43, -0x44, -0x57, -0x31, -0x70, -0x43, -0x54, -0x52, -0x4c, -0x43, -0x44, -0x57, -0x33, -0xa1, -0xc, -0x7d, -0x43, -0x44, -0x57, -0x31, -0xa, -0x4, -0x43, -0x44, -0x57, -0x31, -0xa4, -0x6b, -0x10, -0x4d, -0x8, -0x5f, -0x53, -0x42, -0x5f, -0x5b, -0x82, -0x45, -0x8, -0x48, -0x50, -0x45, -0x54, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xc, -0x41, -0xd0, -0x1, -0x3, -0x8, -0x5f, -0x55, -0x49, -0x44, -0x0, -0x5b, -0x80, -0x48, -0x50, -0x54, -0x4d, -0x0, -0xc, -0x0, -0x0, -0xd0, -0xfe, -0xb, -0x0, -0x4, -0x5b, -0x81, -0x10, -0x48, -0x50, -0x54, -0x4d, -0x13, -0x56, -0x45, -0x4e, -0x44, -0x20, -0x50, -0x52, -0x44, -0x5f, -0x20, -0x14, -0x36, -0x5f, -0x53, -0x54, -0x41, -0x0, -0x70, -0x56, -0x45, -0x4e, -0x44, -0x60, -0x70, -0x50, -0x52, -0x44, -0x5f, -0x61, -0x7a, -0x60, -0xa, -0x10, -0x60, -0xa0, -0xc, -0x91, -0x93, -0x60, -0x0, -0x93, -0x60, -0xb, -0xff, -0xff, -0xa4, -0x0, -0xa0, -0xe, -0x91, -0x93, -0x61, -0x0, -0x94, -0x61, -0xc, -0x0, -0xe1, -0xf5, -0x5, -0xa4, -0x0, -0xa4, -0xa, -0xf, -0x8, -0x5f, -0x43, -0x52, -0x53, -0x11, -0x11, -0xa, -0xe, -0x86, -0x9, -0x0, -0x0, -0x0, -0x0, -0xd0, -0xfe, -0x0, -0x4, -0x0, -0x0, -0x79, -0x0, -0x10, -0x4c, -0x7, -0x2e, -0x5f, -0x53, -0x42, -0x5f, -0x50, -0x43, -0x49, -0x30, -0x5b, -0x82, -0x4f, -0x6, -0x49, -0x53, -0x41, -0x5f, -0x8, -0x5f, -0x41, -0x44, -0x52, -0xc, -0x0, -0x0, -0x1f, -0x0, -0x5b, -0x80, -0x50, -0x49, -0x52, -0x51, -0x2, -0xa, -0x60, -0xa, -0xc, -0x5b, -0x80, -0x4c, -0x50, -0x43, -0x44, -0x2, -0xa, -0x80, -0xa, -0x2, -0x5b, -0x81, -0x20, -0x4c, -0x50, -0x43, -0x44, -0x0, -0x43, -0x4f, -0x4d, -0x41, -0x3, -0x0, -0x1, -0x43, -0x4f, -0x4d, -0x42, -0x3, -0x0, -0x1, -0x4c, -0x50, -0x54, -0x44, -0x2, -0x0, -0x2, -0x46, -0x44, -0x43, -0x44, -0x2, -0x5b, -0x80, -0x4c, -0x50, -0x43, -0x45, -0x2, -0xa, -0x82, -0xa, -0x2, -0x5b, -0x81, -0x1a, -0x4c, -0x50, -0x43, -0x45, -0x0, -0x43, -0x41, -0x45, -0x4e, -0x1, -0x43, -0x42, -0x45, -0x4e, -0x1, -0x4c, -0x50, -0x45, -0x4e, -0x1, -0x46, -0x44, -0x45, -0x4e, -0x1, -0x10, -0x4c, -0x1b, -0x2f, -0x3, -0x5f, -0x53, -0x42, -0x5f, -0x50, -0x43, -0x49, -0x30, -0x49, -0x53, -0x41, -0x5f, -0x5b, -0x82, -0x2d, -0x52, -0x54, -0x43, -0x5f, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xc, -0x41, -0xd0, -0xb, -0x0, -0x8, -0x5f, -0x43, -0x52, -0x53, -0x11, -0x18, -0xa, -0x15, -0x47, -0x1, -0x70, -0x0, -0x70, -0x0, -0x10, -0x2, -0x22, -0x0, -0x1, -0x47, -0x1, -0x72, -0x0, -0x72, -0x0, -0x2, -0x6, -0x79, -0x0, -0x5b, -0x82, -0x37, -0x4b, -0x42, -0x44, -0x5f, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xc, -0x41, -0xd0, -0x3, -0x3, -0x14, -0x9, -0x5f, -0x53, -0x54, -0x41, -0x0, -0xa4, -0xa, -0xf, -0x8, -0x5f, -0x43, -0x52, -0x53, -0x11, -0x18, -0xa, -0x15, -0x47, -0x1, -0x60, -0x0, -0x60, -0x0, -0x1, -0x1, -0x47, -0x1, -0x64, -0x0, -0x64, -0x0, -0x1, -0x1, -0x22, -0x2, -0x0, -0x79, -0x0, -0x5b, -0x82, -0x27, -0x4d, -0x4f, -0x55, -0x5f, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xc, -0x41, -0xd0, -0xf, -0x13, -0x14, -0x9, -0x5f, -0x53, -0x54, -0x41, -0x0, -0xa4, -0xa, -0xf, -0x8, -0x5f, -0x43, -0x52, -0x53, -0x11, -0x8, -0xa, -0x5, -0x22, -0x0, -0x10, -0x79, -0x0, -0x5b, -0x82, -0x4a, -0x4, -0x46, -0x44, -0x43, -0x30, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xc, -0x41, -0xd0, -0x7, -0x0, -0x14, -0x18, -0x5f, -0x53, -0x54, -0x41, -0x0, -0x70, -0x46, -0x44, -0x45, -0x4e, -0x60, -0xa0, -0x6, -0x93, -0x60, -0x0, -0xa4, -0x0, -0xa1, -0x4, -0xa4, -0xa, -0xf, -0x8, -0x5f, -0x43, -0x52, -0x53, -0x11, -0x1b, -0xa, -0x18, -0x47, -0x1, -0xf2, -0x3, -0xf2, -0x3, -0x0, -0x4, -0x47, -0x1, -0xf7, -0x3, -0xf7, -0x3, -0x0, -0x1, -0x22, -0x40, -0x0, -0x2a, -0x4, -0x0, -0x79, -0x0, -0x5b, -0x82, -0x3e, -0x4c, -0x50, -0x54, -0x5f, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xc, -0x41, -0xd0, -0x4, -0x0, -0x14, -0x18, -0x5f, -0x53, -0x54, -0x41, -0x0, -0x70, -0x4c, -0x50, -0x45, -0x4e, -0x60, -0xa0, -0x6, -0x93, -0x60, -0x0, -0xa4, -0x0, -0xa1, -0x4, -0xa4, -0xa, -0xf, -0x8, -0x5f, -0x43, -0x52, -0x53, -0x11, -0x10, -0xa, -0xd, -0x47, -0x1, -0x78, -0x3, -0x78, -0x3, -0x8, -0x8, -0x22, -0x80, -0x0, -0x79, -0x0, -0x5b, -0x82, -0x45, -0x4, -0x43, -0x4f, -0x4d, -0x31, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xc, -0x41, -0xd0, -0x5, -0x1, -0x8, -0x5f, -0x55, -0x49, -0x44, -0x1, -0x14, -0x18, -0x5f, -0x53, -0x54, -0x41, -0x0, -0x70, -0x43, -0x41, -0x45, -0x4e, -0x60, -0xa0, -0x6, -0x93, -0x60, -0x0, -0xa4, -0x0, -0xa1, -0x4, -0xa4, -0xa, -0xf, -0x8, -0x5f, -0x43, -0x52, -0x53, -0x11, -0x10, -0xa, -0xd, -0x47, -0x1, -0xf8, -0x3, -0xf8, -0x3, -0x0, -0x8, -0x22, -0x10, -0x0, -0x79, -0x0, -0x5b, -0x82, -0x46, -0x4, -0x43, -0x4f, -0x4d, -0x32, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xc, -0x41, -0xd0, -0x5, -0x1, -0x8, -0x5f, -0x55, -0x49, -0x44, -0xa, -0x2, -0x14, -0x18, -0x5f, -0x53, -0x54, -0x41, -0x0, -0x70, -0x43, -0x42, -0x45, -0x4e, -0x60, -0xa0, -0x6, -0x93, -0x60, -0x0, -0xa4, -0x0, -0xa1, -0x4, -0xa4, -0xa, -0xf, -0x8, -0x5f, -0x43, -0x52, -0x53, -0x11, -0x10, -0xa, -0xd, -0x47, -0x1, -0xf8, -0x2, -0xf8, -0x2, -0x0, -0x8, -0x22, -0x8, -0x0, -0x79, -0x0, -0x8, -0x50, -0x49, -0x43, -0x46, -0x0, -0x14, -0xc, -0x5f, -0x50, -0x49, -0x43, -0x1, -0x70, -0x68, -0x50, -0x49, -0x43, -0x46, -0x10, -0x8e, -0x55, -0x1, -0x5f, -0x53, -0x42, -0x5f, -0x10, -0x43, -0xea, -0x50, -0x43, -0x49, -0x30, -0x8, -0x50, -0x52, -0x54, -0x50, -0x12, -0x4b, -0x73, -0x80, -0x12, -0xb, -0x4, -0xb, -0xff, -0xff, -0x0, -0x4c, -0x4e, -0x4b, -0x45, -0x0, -0x12, -0xb, -0x4, -0xb, -0xff, -0xff, -0x1, -0x4c, -0x4e, -0x4b, -0x46, -0x0, -0x12, -0xc, -0x4, -0xb, -0xff, -0xff, -0xa, -0x2, -0x4c, -0x4e, -0x4b, -0x47, -0x0, -0x12, -0xc, -0x4, -0xb, -0xff, -0xff, -0xa, -0x3, -0x4c, -0x4e, -0x4b, -0x48, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x1, -0x0, -0x0, -0x4c, -0x4e, -0x4b, -0x46, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x1, -0x0, -0x1, -0x4c, -0x4e, -0x4b, -0x47, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x1, -0x0, -0xa, -0x2, -0x4c, -0x4e, -0x4b, -0x48, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x1, -0x0, -0xa, -0x3, -0x4c, -0x4e, -0x4b, -0x45, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x2, -0x0, -0x0, -0x4c, -0x4e, -0x4b, -0x47, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x2, -0x0, -0x1, -0x4c, -0x4e, -0x4b, -0x48, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x2, -0x0, -0xa, -0x2, -0x4c, -0x4e, -0x4b, -0x45, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x2, -0x0, -0xa, -0x3, -0x4c, -0x4e, -0x4b, -0x46, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x3, -0x0, -0x0, -0x4c, -0x4e, -0x4b, -0x48, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x3, -0x0, -0x1, -0x4c, -0x4e, -0x4b, -0x45, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x3, -0x0, -0xa, -0x2, -0x4c, -0x4e, -0x4b, -0x46, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x3, -0x0, -0xa, -0x3, -0x4c, -0x4e, -0x4b, -0x47, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x4, -0x0, -0x0, -0x4c, -0x4e, -0x4b, -0x45, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x4, -0x0, -0x1, -0x4c, -0x4e, -0x4b, -0x46, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x4, -0x0, -0xa, -0x2, -0x4c, -0x4e, -0x4b, -0x47, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x4, -0x0, -0xa, -0x3, -0x4c, -0x4e, -0x4b, -0x48, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x5, -0x0, -0x0, -0x4c, -0x4e, -0x4b, -0x46, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x5, -0x0, -0x1, -0x4c, -0x4e, -0x4b, -0x47, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x5, -0x0, -0xa, -0x2, -0x4c, -0x4e, -0x4b, -0x48, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x5, -0x0, -0xa, -0x3, -0x4c, -0x4e, -0x4b, -0x45, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x6, -0x0, -0x0, -0x4c, -0x4e, -0x4b, -0x47, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x6, -0x0, -0x1, -0x4c, -0x4e, -0x4b, -0x48, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x6, -0x0, -0xa, -0x2, -0x4c, -0x4e, -0x4b, -0x45, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x6, -0x0, -0xa, -0x3, -0x4c, -0x4e, -0x4b, -0x46, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x7, -0x0, -0x0, -0x4c, -0x4e, -0x4b, -0x48, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x7, -0x0, -0x1, -0x4c, -0x4e, -0x4b, -0x45, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x7, -0x0, -0xa, -0x2, -0x4c, -0x4e, -0x4b, -0x46, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x7, -0x0, -0xa, -0x3, -0x4c, -0x4e, -0x4b, -0x47, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x8, -0x0, -0x0, -0x4c, -0x4e, -0x4b, -0x45, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x8, -0x0, -0x1, -0x4c, -0x4e, -0x4b, -0x46, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x8, -0x0, -0xa, -0x2, -0x4c, -0x4e, -0x4b, -0x47, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x8, -0x0, -0xa, -0x3, -0x4c, -0x4e, -0x4b, -0x48, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x9, -0x0, -0x0, -0x4c, -0x4e, -0x4b, -0x46, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x9, -0x0, -0x1, -0x4c, -0x4e, -0x4b, -0x47, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x9, -0x0, -0xa, -0x2, -0x4c, -0x4e, -0x4b, -0x48, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x9, -0x0, -0xa, -0x3, -0x4c, -0x4e, -0x4b, -0x45, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0xa, -0x0, -0x0, -0x4c, -0x4e, -0x4b, -0x47, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0xa, -0x0, -0x1, -0x4c, -0x4e, -0x4b, -0x48, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0xa, -0x0, -0xa, -0x2, -0x4c, -0x4e, -0x4b, -0x45, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0xa, -0x0, -0xa, -0x3, -0x4c, -0x4e, -0x4b, -0x46, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0xb, -0x0, -0x0, -0x4c, -0x4e, -0x4b, -0x48, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0xb, -0x0, -0x1, -0x4c, -0x4e, -0x4b, -0x45, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0xb, -0x0, -0xa, -0x2, -0x4c, -0x4e, -0x4b, -0x46, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0xb, -0x0, -0xa, -0x3, -0x4c, -0x4e, -0x4b, -0x47, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0xc, -0x0, -0x0, -0x4c, -0x4e, -0x4b, -0x45, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0xc, -0x0, -0x1, -0x4c, -0x4e, -0x4b, -0x46, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0xc, -0x0, -0xa, -0x2, -0x4c, -0x4e, -0x4b, -0x47, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0xc, -0x0, -0xa, -0x3, -0x4c, -0x4e, -0x4b, -0x48, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0xd, -0x0, -0x0, -0x4c, -0x4e, -0x4b, -0x46, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0xd, -0x0, -0x1, -0x4c, -0x4e, -0x4b, -0x47, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0xd, -0x0, -0xa, -0x2, -0x4c, -0x4e, -0x4b, -0x48, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0xd, -0x0, -0xa, -0x3, -0x4c, -0x4e, -0x4b, -0x45, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0xe, -0x0, -0x0, -0x4c, -0x4e, -0x4b, -0x47, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0xe, -0x0, -0x1, -0x4c, -0x4e, -0x4b, -0x48, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0xe, -0x0, -0xa, -0x2, -0x4c, -0x4e, -0x4b, -0x45, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0xe, -0x0, -0xa, -0x3, -0x4c, -0x4e, -0x4b, -0x46, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0xf, -0x0, -0x0, -0x4c, -0x4e, -0x4b, -0x48, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0xf, -0x0, -0x1, -0x4c, -0x4e, -0x4b, -0x45, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0xf, -0x0, -0xa, -0x2, -0x4c, -0x4e, -0x4b, -0x46, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0xf, -0x0, -0xa, -0x3, -0x4c, -0x4e, -0x4b, -0x47, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x10, -0x0, -0x0, -0x4c, -0x4e, -0x4b, -0x45, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x10, -0x0, -0x1, -0x4c, -0x4e, -0x4b, -0x46, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x10, -0x0, -0xa, -0x2, -0x4c, -0x4e, -0x4b, -0x47, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x10, -0x0, -0xa, -0x3, -0x4c, -0x4e, -0x4b, -0x48, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x11, -0x0, -0x0, -0x4c, -0x4e, -0x4b, -0x46, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x11, -0x0, -0x1, -0x4c, -0x4e, -0x4b, -0x47, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x11, -0x0, -0xa, -0x2, -0x4c, -0x4e, -0x4b, -0x48, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x11, -0x0, -0xa, -0x3, -0x4c, -0x4e, -0x4b, -0x45, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x12, -0x0, -0x0, -0x4c, -0x4e, -0x4b, -0x47, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x12, -0x0, -0x1, -0x4c, -0x4e, -0x4b, -0x48, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x12, -0x0, -0xa, -0x2, -0x4c, -0x4e, -0x4b, -0x45, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x12, -0x0, -0xa, -0x3, -0x4c, -0x4e, -0x4b, -0x46, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x13, -0x0, -0x0, -0x4c, -0x4e, -0x4b, -0x48, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x13, -0x0, -0x1, -0x4c, -0x4e, -0x4b, -0x45, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x13, -0x0, -0xa, -0x2, -0x4c, -0x4e, -0x4b, -0x46, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x13, -0x0, -0xa, -0x3, -0x4c, -0x4e, -0x4b, -0x47, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x14, -0x0, -0x0, -0x4c, -0x4e, -0x4b, -0x45, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x14, -0x0, -0x1, -0x4c, -0x4e, -0x4b, -0x46, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x14, -0x0, -0xa, -0x2, -0x4c, -0x4e, -0x4b, -0x47, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x14, -0x0, -0xa, -0x3, -0x4c, -0x4e, -0x4b, -0x48, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x15, -0x0, -0x0, -0x4c, -0x4e, -0x4b, -0x46, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x15, -0x0, -0x1, -0x4c, -0x4e, -0x4b, -0x47, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x15, -0x0, -0xa, -0x2, -0x4c, -0x4e, -0x4b, -0x48, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x15, -0x0, -0xa, -0x3, -0x4c, -0x4e, -0x4b, -0x45, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x16, -0x0, -0x0, -0x4c, -0x4e, -0x4b, -0x47, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x16, -0x0, -0x1, -0x4c, -0x4e, -0x4b, -0x48, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x16, -0x0, -0xa, -0x2, -0x4c, -0x4e, -0x4b, -0x45, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x16, -0x0, -0xa, -0x3, -0x4c, -0x4e, -0x4b, -0x46, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x17, -0x0, -0x0, -0x4c, -0x4e, -0x4b, -0x48, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x17, -0x0, -0x1, -0x4c, -0x4e, -0x4b, -0x45, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x17, -0x0, -0xa, -0x2, -0x4c, -0x4e, -0x4b, -0x46, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x17, -0x0, -0xa, -0x3, -0x4c, -0x4e, -0x4b, -0x47, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x18, -0x0, -0x0, -0x4c, -0x4e, -0x4b, -0x45, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x18, -0x0, -0x1, -0x4c, -0x4e, -0x4b, -0x46, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x18, -0x0, -0xa, -0x2, -0x4c, -0x4e, -0x4b, -0x47, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x18, -0x0, -0xa, -0x3, -0x4c, -0x4e, -0x4b, -0x48, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x19, -0x0, -0x0, -0x4c, -0x4e, -0x4b, -0x41, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x19, -0x0, -0x1, -0x4c, -0x4e, -0x4b, -0x42, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x19, -0x0, -0xa, -0x2, -0x4c, -0x4e, -0x4b, -0x43, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x19, -0x0, -0xa, -0x3, -0x4c, -0x4e, -0x4b, -0x44, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x1a, -0x0, -0x0, -0x4c, -0x4e, -0x4b, -0x41, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x1a, -0x0, -0x1, -0x4c, -0x4e, -0x4b, -0x42, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x1a, -0x0, -0xa, -0x2, -0x4c, -0x4e, -0x4b, -0x43, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x1a, -0x0, -0xa, -0x3, -0x4c, -0x4e, -0x4b, -0x44, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x1b, -0x0, -0x0, -0x4c, -0x4e, -0x4b, -0x41, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x1b, -0x0, -0x1, -0x4c, -0x4e, -0x4b, -0x42, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x1b, -0x0, -0xa, -0x2, -0x4c, -0x4e, -0x4b, -0x43, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x1b, -0x0, -0xa, -0x3, -0x4c, -0x4e, -0x4b, -0x44, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x1c, -0x0, -0x0, -0x4c, -0x4e, -0x4b, -0x41, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x1c, -0x0, -0x1, -0x4c, -0x4e, -0x4b, -0x42, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x1c, -0x0, -0xa, -0x2, -0x4c, -0x4e, -0x4b, -0x43, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x1c, -0x0, -0xa, -0x3, -0x4c, -0x4e, -0x4b, -0x44, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x1d, -0x0, -0x0, -0x4c, -0x4e, -0x4b, -0x41, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x1d, -0x0, -0x1, -0x4c, -0x4e, -0x4b, -0x42, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x1d, -0x0, -0xa, -0x2, -0x4c, -0x4e, -0x4b, -0x43, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x1d, -0x0, -0xa, -0x3, -0x4c, -0x4e, -0x4b, -0x44, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x1e, -0x0, -0x0, -0x4c, -0x4e, -0x4b, -0x45, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x1e, -0x0, -0x1, -0x4c, -0x4e, -0x4b, -0x46, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x1e, -0x0, -0xa, -0x2, -0x4c, -0x4e, -0x4b, -0x47, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x1e, -0x0, -0xa, -0x3, -0x4c, -0x4e, -0x4b, -0x48, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x1f, -0x0, -0x0, -0x4c, -0x4e, -0x4b, -0x41, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x1f, -0x0, -0x1, -0x4c, -0x4e, -0x4b, -0x42, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x1f, -0x0, -0xa, -0x2, -0x4c, -0x4e, -0x4b, -0x43, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x1f, -0x0, -0xa, -0x3, -0x4c, -0x4e, -0x4b, -0x44, -0x0, -0x8, -0x50, -0x52, -0x54, -0x41, -0x12, -0x4b, -0x73, -0x80, -0x12, -0xb, -0x4, -0xb, -0xff, -0xff, -0x0, -0x47, -0x53, -0x49, -0x45, -0x0, -0x12, -0xb, -0x4, -0xb, -0xff, -0xff, -0x1, -0x47, -0x53, -0x49, -0x46, -0x0, -0x12, -0xc, -0x4, -0xb, -0xff, -0xff, -0xa, -0x2, -0x47, -0x53, -0x49, -0x47, -0x0, -0x12, -0xc, -0x4, -0xb, -0xff, -0xff, -0xa, -0x3, -0x47, -0x53, -0x49, -0x48, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x1, -0x0, -0x0, -0x47, -0x53, -0x49, -0x46, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x1, -0x0, -0x1, -0x47, -0x53, -0x49, -0x47, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x1, -0x0, -0xa, -0x2, -0x47, -0x53, -0x49, -0x48, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x1, -0x0, -0xa, -0x3, -0x47, -0x53, -0x49, -0x45, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x2, -0x0, -0x0, -0x47, -0x53, -0x49, -0x47, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x2, -0x0, -0x1, -0x47, -0x53, -0x49, -0x48, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x2, -0x0, -0xa, -0x2, -0x47, -0x53, -0x49, -0x45, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x2, -0x0, -0xa, -0x3, -0x47, -0x53, -0x49, -0x46, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x3, -0x0, -0x0, -0x47, -0x53, -0x49, -0x48, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x3, -0x0, -0x1, -0x47, -0x53, -0x49, -0x45, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x3, -0x0, -0xa, -0x2, -0x47, -0x53, -0x49, -0x46, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x3, -0x0, -0xa, -0x3, -0x47, -0x53, -0x49, -0x47, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x4, -0x0, -0x0, -0x47, -0x53, -0x49, -0x45, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x4, -0x0, -0x1, -0x47, -0x53, -0x49, -0x46, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x4, -0x0, -0xa, -0x2, -0x47, -0x53, -0x49, -0x47, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x4, -0x0, -0xa, -0x3, -0x47, -0x53, -0x49, -0x48, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x5, -0x0, -0x0, -0x47, -0x53, -0x49, -0x46, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x5, -0x0, -0x1, -0x47, -0x53, -0x49, -0x47, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x5, -0x0, -0xa, -0x2, -0x47, -0x53, -0x49, -0x48, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x5, -0x0, -0xa, -0x3, -0x47, -0x53, -0x49, -0x45, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x6, -0x0, -0x0, -0x47, -0x53, -0x49, -0x47, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x6, -0x0, -0x1, -0x47, -0x53, -0x49, -0x48, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x6, -0x0, -0xa, -0x2, -0x47, -0x53, -0x49, -0x45, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x6, -0x0, -0xa, -0x3, -0x47, -0x53, -0x49, -0x46, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x7, -0x0, -0x0, -0x47, -0x53, -0x49, -0x48, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x7, -0x0, -0x1, -0x47, -0x53, -0x49, -0x45, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x7, -0x0, -0xa, -0x2, -0x47, -0x53, -0x49, -0x46, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x7, -0x0, -0xa, -0x3, -0x47, -0x53, -0x49, -0x47, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x8, -0x0, -0x0, -0x47, -0x53, -0x49, -0x45, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x8, -0x0, -0x1, -0x47, -0x53, -0x49, -0x46, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x8, -0x0, -0xa, -0x2, -0x47, -0x53, -0x49, -0x47, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x8, -0x0, -0xa, -0x3, -0x47, -0x53, -0x49, -0x48, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x9, -0x0, -0x0, -0x47, -0x53, -0x49, -0x46, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x9, -0x0, -0x1, -0x47, -0x53, -0x49, -0x47, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x9, -0x0, -0xa, -0x2, -0x47, -0x53, -0x49, -0x48, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x9, -0x0, -0xa, -0x3, -0x47, -0x53, -0x49, -0x45, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0xa, -0x0, -0x0, -0x47, -0x53, -0x49, -0x47, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0xa, -0x0, -0x1, -0x47, -0x53, -0x49, -0x48, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0xa, -0x0, -0xa, -0x2, -0x47, -0x53, -0x49, -0x45, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0xa, -0x0, -0xa, -0x3, -0x47, -0x53, -0x49, -0x46, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0xb, -0x0, -0x0, -0x47, -0x53, -0x49, -0x48, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0xb, -0x0, -0x1, -0x47, -0x53, -0x49, -0x45, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0xb, -0x0, -0xa, -0x2, -0x47, -0x53, -0x49, -0x46, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0xb, -0x0, -0xa, -0x3, -0x47, -0x53, -0x49, -0x47, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0xc, -0x0, -0x0, -0x47, -0x53, -0x49, -0x45, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0xc, -0x0, -0x1, -0x47, -0x53, -0x49, -0x46, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0xc, -0x0, -0xa, -0x2, -0x47, -0x53, -0x49, -0x47, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0xc, -0x0, -0xa, -0x3, -0x47, -0x53, -0x49, -0x48, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0xd, -0x0, -0x0, -0x47, -0x53, -0x49, -0x46, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0xd, -0x0, -0x1, -0x47, -0x53, -0x49, -0x47, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0xd, -0x0, -0xa, -0x2, -0x47, -0x53, -0x49, -0x48, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0xd, -0x0, -0xa, -0x3, -0x47, -0x53, -0x49, -0x45, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0xe, -0x0, -0x0, -0x47, -0x53, -0x49, -0x47, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0xe, -0x0, -0x1, -0x47, -0x53, -0x49, -0x48, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0xe, -0x0, -0xa, -0x2, -0x47, -0x53, -0x49, -0x45, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0xe, -0x0, -0xa, -0x3, -0x47, -0x53, -0x49, -0x46, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0xf, -0x0, -0x0, -0x47, -0x53, -0x49, -0x48, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0xf, -0x0, -0x1, -0x47, -0x53, -0x49, -0x45, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0xf, -0x0, -0xa, -0x2, -0x47, -0x53, -0x49, -0x46, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0xf, -0x0, -0xa, -0x3, -0x47, -0x53, -0x49, -0x47, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x10, -0x0, -0x0, -0x47, -0x53, -0x49, -0x45, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x10, -0x0, -0x1, -0x47, -0x53, -0x49, -0x46, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x10, -0x0, -0xa, -0x2, -0x47, -0x53, -0x49, -0x47, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x10, -0x0, -0xa, -0x3, -0x47, -0x53, -0x49, -0x48, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x11, -0x0, -0x0, -0x47, -0x53, -0x49, -0x46, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x11, -0x0, -0x1, -0x47, -0x53, -0x49, -0x47, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x11, -0x0, -0xa, -0x2, -0x47, -0x53, -0x49, -0x48, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x11, -0x0, -0xa, -0x3, -0x47, -0x53, -0x49, -0x45, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x12, -0x0, -0x0, -0x47, -0x53, -0x49, -0x47, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x12, -0x0, -0x1, -0x47, -0x53, -0x49, -0x48, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x12, -0x0, -0xa, -0x2, -0x47, -0x53, -0x49, -0x45, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x12, -0x0, -0xa, -0x3, -0x47, -0x53, -0x49, -0x46, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x13, -0x0, -0x0, -0x47, -0x53, -0x49, -0x48, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x13, -0x0, -0x1, -0x47, -0x53, -0x49, -0x45, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x13, -0x0, -0xa, -0x2, -0x47, -0x53, -0x49, -0x46, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x13, -0x0, -0xa, -0x3, -0x47, -0x53, -0x49, -0x47, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x14, -0x0, -0x0, -0x47, -0x53, -0x49, -0x45, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x14, -0x0, -0x1, -0x47, -0x53, -0x49, -0x46, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x14, -0x0, -0xa, -0x2, -0x47, -0x53, -0x49, -0x47, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x14, -0x0, -0xa, -0x3, -0x47, -0x53, -0x49, -0x48, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x15, -0x0, -0x0, -0x47, -0x53, -0x49, -0x46, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x15, -0x0, -0x1, -0x47, -0x53, -0x49, -0x47, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x15, -0x0, -0xa, -0x2, -0x47, -0x53, -0x49, -0x48, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x15, -0x0, -0xa, -0x3, -0x47, -0x53, -0x49, -0x45, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x16, -0x0, -0x0, -0x47, -0x53, -0x49, -0x47, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x16, -0x0, -0x1, -0x47, -0x53, -0x49, -0x48, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x16, -0x0, -0xa, -0x2, -0x47, -0x53, -0x49, -0x45, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x16, -0x0, -0xa, -0x3, -0x47, -0x53, -0x49, -0x46, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x17, -0x0, -0x0, -0x47, -0x53, -0x49, -0x48, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x17, -0x0, -0x1, -0x47, -0x53, -0x49, -0x45, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x17, -0x0, -0xa, -0x2, -0x47, -0x53, -0x49, -0x46, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x17, -0x0, -0xa, -0x3, -0x47, -0x53, -0x49, -0x47, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x18, -0x0, -0x0, -0x47, -0x53, -0x49, -0x45, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x18, -0x0, -0x1, -0x47, -0x53, -0x49, -0x46, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x18, -0x0, -0xa, -0x2, -0x47, -0x53, -0x49, -0x47, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x18, -0x0, -0xa, -0x3, -0x47, -0x53, -0x49, -0x48, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x19, -0x0, -0x0, -0x47, -0x53, -0x49, -0x41, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x19, -0x0, -0x1, -0x47, -0x53, -0x49, -0x42, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x19, -0x0, -0xa, -0x2, -0x47, -0x53, -0x49, -0x43, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x19, -0x0, -0xa, -0x3, -0x47, -0x53, -0x49, -0x44, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x1a, -0x0, -0x0, -0x47, -0x53, -0x49, -0x41, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x1a, -0x0, -0x1, -0x47, -0x53, -0x49, -0x42, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x1a, -0x0, -0xa, -0x2, -0x47, -0x53, -0x49, -0x43, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x1a, -0x0, -0xa, -0x3, -0x47, -0x53, -0x49, -0x44, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x1b, -0x0, -0x0, -0x47, -0x53, -0x49, -0x41, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x1b, -0x0, -0x1, -0x47, -0x53, -0x49, -0x42, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x1b, -0x0, -0xa, -0x2, -0x47, -0x53, -0x49, -0x43, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x1b, -0x0, -0xa, -0x3, -0x47, -0x53, -0x49, -0x44, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x1c, -0x0, -0x0, -0x47, -0x53, -0x49, -0x41, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x1c, -0x0, -0x1, -0x47, -0x53, -0x49, -0x42, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x1c, -0x0, -0xa, -0x2, -0x47, -0x53, -0x49, -0x43, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x1c, -0x0, -0xa, -0x3, -0x47, -0x53, -0x49, -0x44, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x1d, -0x0, -0x0, -0x47, -0x53, -0x49, -0x41, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x1d, -0x0, -0x1, -0x47, -0x53, -0x49, -0x42, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x1d, -0x0, -0xa, -0x2, -0x47, -0x53, -0x49, -0x43, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x1d, -0x0, -0xa, -0x3, -0x47, -0x53, -0x49, -0x44, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x1e, -0x0, -0x0, -0x47, -0x53, -0x49, -0x45, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x1e, -0x0, -0x1, -0x47, -0x53, -0x49, -0x46, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x1e, -0x0, -0xa, -0x2, -0x47, -0x53, -0x49, -0x47, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x1e, -0x0, -0xa, -0x3, -0x47, -0x53, -0x49, -0x48, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x1f, -0x0, -0x0, -0x47, -0x53, -0x49, -0x41, -0x0, -0x12, -0xd, -0x4, -0xc, -0xff, -0xff, -0x1f, -0x0, -0x1, -0x47, -0x53, -0x49, -0x42, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x1f, -0x0, -0xa, -0x2, -0x47, -0x53, -0x49, -0x43, -0x0, -0x12, -0xe, -0x4, -0xc, -0xff, -0xff, -0x1f, -0x0, -0xa, -0x3, -0x47, -0x53, -0x49, -0x44, -0x0, -0x14, -0x1a, -0x5f, -0x50, -0x52, -0x54, -0x0, -0xa0, -0xc, -0x93, -0x50, -0x49, -0x43, -0x46, -0x0, -0xa4, -0x50, -0x52, -0x54, -0x50, -0xa1, -0x6, -0xa4, -0x50, -0x52, -0x54, -0x41, -0x5b, -0x81, -0x3a, -0x2f, -0x3, -0x50, -0x43, -0x49, -0x30, -0x49, -0x53, -0x41, -0x5f, -0x50, -0x49, -0x52, -0x51, -0x1, -0x50, -0x52, -0x51, -0x41, -0x8, -0x50, -0x52, -0x51, -0x42, -0x8, -0x50, -0x52, -0x51, -0x43, -0x8, -0x50, -0x52, -0x51, -0x44, -0x8, -0x0, -0x20, -0x50, -0x52, -0x51, -0x45, -0x8, -0x50, -0x52, -0x51, -0x46, -0x8, -0x50, -0x52, -0x51, -0x47, -0x8, -0x50, -0x52, -0x51, -0x48, -0x8, -0x14, -0x13, -0x49, -0x51, -0x53, -0x54, -0x1, -0xa0, -0x9, -0x7b, -0xa, -0x80, -0x68, -0x0, -0xa4, -0xa, -0x9, -0xa4, -0xa, -0xb, -0x14, -0x34, -0x49, -0x51, -0x43, -0x52, -0x9, -0x8, -0x50, -0x52, -0x52, -0x30, -0x11, -0xe, -0xa, -0xb, -0x89, -0x6, -0x0, -0x9, -0x1, -0x0, -0x0, -0x0, -0x0, -0x79, -0x0, -0x8a, -0x50, -0x52, -0x52, -0x30, -0xa, -0x5, -0x50, -0x52, -0x52, -0x49, -0x70, -0x7b, -0x68, -0xa, -0xf, -0x0, -0x50, -0x52, -0x52, -0x49, -0xa4, -0x50, -0x52, -0x52, -0x30, -0x5b, -0x82, -0x4c, -0x7, -0x4c, -0x4e, -0x4b, -0x41, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xc, -0x41, -0xd0, -0xc, -0xf, -0x8, -0x5f, -0x55, -0x49, -0x44, -0x0, -0x8, -0x5f, -0x50, -0x52, -0x53, -0x11, -0x16, -0xa, -0x13, -0x89, -0xe, -0x0, -0x9, -0x3, -0x5, -0x0, -0x0, -0x0, -0xa, -0x0, -0x0, -0x0, -0xb, -0x0, -0x0, -0x0, -0x79, -0x0, -0x14, -0xf, -0x5f, -0x53, -0x54, -0x41, -0x0, -0xa4, -0x49, -0x51, -0x53, -0x54, -0x50, -0x52, -0x51, -0x41, -0x14, -0x11, -0x5f, -0x44, -0x49, -0x53, -0x0, -0x7d, -0x50, -0x52, -0x51, -0x41, -0xa, -0x80, -0x50, -0x52, -0x51, -0x41, -0x14, -0xf, -0x5f, -0x43, -0x52, -0x53, -0x0, -0xa4, -0x49, -0x51, -0x43, -0x52, -0x50, -0x52, -0x51, -0x41, -0x14, -0x17, -0x5f, -0x53, -0x52, -0x53, -0x1, -0x8a, -0x68, -0xa, -0x5, -0x50, -0x52, -0x52, -0x49, -0x70, -0x50, -0x52, -0x52, -0x49, -0x50, -0x52, -0x51, -0x41, -0x5b, -0x82, -0x4c, -0x7, -0x4c, -0x4e, -0x4b, -0x42, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xc, -0x41, -0xd0, -0xc, -0xf, -0x8, -0x5f, -0x55, -0x49, -0x44, -0x1, -0x8, -0x5f, -0x50, -0x52, -0x53, -0x11, -0x16, -0xa, -0x13, -0x89, -0xe, -0x0, -0x9, -0x3, -0x5, -0x0, -0x0, -0x0, -0xa, -0x0, -0x0, -0x0, -0xb, -0x0, -0x0, -0x0, -0x79, -0x0, -0x14, -0xf, -0x5f, -0x53, -0x54, -0x41, -0x0, -0xa4, -0x49, -0x51, -0x53, -0x54, -0x50, -0x52, -0x51, -0x42, -0x14, -0x11, -0x5f, -0x44, -0x49, -0x53, -0x0, -0x7d, -0x50, -0x52, -0x51, -0x42, -0xa, -0x80, -0x50, -0x52, -0x51, -0x42, -0x14, -0xf, -0x5f, -0x43, -0x52, -0x53, -0x0, -0xa4, -0x49, -0x51, -0x43, -0x52, -0x50, -0x52, -0x51, -0x42, -0x14, -0x17, -0x5f, -0x53, -0x52, -0x53, -0x1, -0x8a, -0x68, -0xa, -0x5, -0x50, -0x52, -0x52, -0x49, -0x70, -0x50, -0x52, -0x52, -0x49, -0x50, -0x52, -0x51, -0x42, -0x5b, -0x82, -0x4d, -0x7, -0x4c, -0x4e, -0x4b, -0x43, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xc, -0x41, -0xd0, -0xc, -0xf, -0x8, -0x5f, -0x55, -0x49, -0x44, -0xa, -0x2, -0x8, -0x5f, -0x50, -0x52, -0x53, -0x11, -0x16, -0xa, -0x13, -0x89, -0xe, -0x0, -0x9, -0x3, -0x5, -0x0, -0x0, -0x0, -0xa, -0x0, -0x0, -0x0, -0xb, -0x0, -0x0, -0x0, -0x79, -0x0, -0x14, -0xf, -0x5f, -0x53, -0x54, -0x41, -0x0, -0xa4, -0x49, -0x51, -0x53, -0x54, -0x50, -0x52, -0x51, -0x43, -0x14, -0x11, -0x5f, -0x44, -0x49, -0x53, -0x0, -0x7d, -0x50, -0x52, -0x51, -0x43, -0xa, -0x80, -0x50, -0x52, -0x51, -0x43, -0x14, -0xf, -0x5f, -0x43, -0x52, -0x53, -0x0, -0xa4, -0x49, -0x51, -0x43, -0x52, -0x50, -0x52, -0x51, -0x43, -0x14, -0x17, -0x5f, -0x53, -0x52, -0x53, -0x1, -0x8a, -0x68, -0xa, -0x5, -0x50, -0x52, -0x52, -0x49, -0x70, -0x50, -0x52, -0x52, -0x49, -0x50, -0x52, -0x51, -0x43, -0x5b, -0x82, -0x4d, -0x7, -0x4c, -0x4e, -0x4b, -0x44, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xc, -0x41, -0xd0, -0xc, -0xf, -0x8, -0x5f, -0x55, -0x49, -0x44, -0xa, -0x3, -0x8, -0x5f, -0x50, -0x52, -0x53, -0x11, -0x16, -0xa, -0x13, -0x89, -0xe, -0x0, -0x9, -0x3, -0x5, -0x0, -0x0, -0x0, -0xa, -0x0, -0x0, -0x0, -0xb, -0x0, -0x0, -0x0, -0x79, -0x0, -0x14, -0xf, -0x5f, -0x53, -0x54, -0x41, -0x0, -0xa4, -0x49, -0x51, -0x53, -0x54, -0x50, -0x52, -0x51, -0x44, -0x14, -0x11, -0x5f, -0x44, -0x49, -0x53, -0x0, -0x7d, -0x50, -0x52, -0x51, -0x44, -0xa, -0x80, -0x50, -0x52, -0x51, -0x44, -0x14, -0xf, -0x5f, -0x43, -0x52, -0x53, -0x0, -0xa4, -0x49, -0x51, -0x43, -0x52, -0x50, -0x52, -0x51, -0x44, -0x14, -0x17, -0x5f, -0x53, -0x52, -0x53, -0x1, -0x8a, -0x68, -0xa, -0x5, -0x50, -0x52, -0x52, -0x49, -0x70, -0x50, -0x52, -0x52, -0x49, -0x50, -0x52, -0x51, -0x44, -0x5b, -0x82, -0x4d, -0x7, -0x4c, -0x4e, -0x4b, -0x45, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xc, -0x41, -0xd0, -0xc, -0xf, -0x8, -0x5f, -0x55, -0x49, -0x44, -0xa, -0x4, -0x8, -0x5f, -0x50, -0x52, -0x53, -0x11, -0x16, -0xa, -0x13, -0x89, -0xe, -0x0, -0x9, -0x3, -0x5, -0x0, -0x0, -0x0, -0xa, -0x0, -0x0, -0x0, -0xb, -0x0, -0x0, -0x0, -0x79, -0x0, -0x14, -0xf, -0x5f, -0x53, -0x54, -0x41, -0x0, -0xa4, -0x49, -0x51, -0x53, -0x54, -0x50, -0x52, -0x51, -0x45, -0x14, -0x11, -0x5f, -0x44, -0x49, -0x53, -0x0, -0x7d, -0x50, -0x52, -0x51, -0x45, -0xa, -0x80, -0x50, -0x52, -0x51, -0x45, -0x14, -0xf, -0x5f, -0x43, -0x52, -0x53, -0x0, -0xa4, -0x49, -0x51, -0x43, -0x52, -0x50, -0x52, -0x51, -0x45, -0x14, -0x17, -0x5f, -0x53, -0x52, -0x53, -0x1, -0x8a, -0x68, -0xa, -0x5, -0x50, -0x52, -0x52, -0x49, -0x70, -0x50, -0x52, -0x52, -0x49, -0x50, -0x52, -0x51, -0x45, -0x5b, -0x82, -0x4d, -0x7, -0x4c, -0x4e, -0x4b, -0x46, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xc, -0x41, -0xd0, -0xc, -0xf, -0x8, -0x5f, -0x55, -0x49, -0x44, -0xa, -0x5, -0x8, -0x5f, -0x50, -0x52, -0x53, -0x11, -0x16, -0xa, -0x13, -0x89, -0xe, -0x0, -0x9, -0x3, -0x5, -0x0, -0x0, -0x0, -0xa, -0x0, -0x0, -0x0, -0xb, -0x0, -0x0, -0x0, -0x79, -0x0, -0x14, -0xf, -0x5f, -0x53, -0x54, -0x41, -0x0, -0xa4, -0x49, -0x51, -0x53, -0x54, -0x50, -0x52, -0x51, -0x46, -0x14, -0x11, -0x5f, -0x44, -0x49, -0x53, -0x0, -0x7d, -0x50, -0x52, -0x51, -0x46, -0xa, -0x80, -0x50, -0x52, -0x51, -0x46, -0x14, -0xf, -0x5f, -0x43, -0x52, -0x53, -0x0, -0xa4, -0x49, -0x51, -0x43, -0x52, -0x50, -0x52, -0x51, -0x46, -0x14, -0x17, -0x5f, -0x53, -0x52, -0x53, -0x1, -0x8a, -0x68, -0xa, -0x5, -0x50, -0x52, -0x52, -0x49, -0x70, -0x50, -0x52, -0x52, -0x49, -0x50, -0x52, -0x51, -0x46, -0x5b, -0x82, -0x4d, -0x7, -0x4c, -0x4e, -0x4b, -0x47, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xc, -0x41, -0xd0, -0xc, -0xf, -0x8, -0x5f, -0x55, -0x49, -0x44, -0xa, -0x6, -0x8, -0x5f, -0x50, -0x52, -0x53, -0x11, -0x16, -0xa, -0x13, -0x89, -0xe, -0x0, -0x9, -0x3, -0x5, -0x0, -0x0, -0x0, -0xa, -0x0, -0x0, -0x0, -0xb, -0x0, -0x0, -0x0, -0x79, -0x0, -0x14, -0xf, -0x5f, -0x53, -0x54, -0x41, -0x0, -0xa4, -0x49, -0x51, -0x53, -0x54, -0x50, -0x52, -0x51, -0x47, -0x14, -0x11, -0x5f, -0x44, -0x49, -0x53, -0x0, -0x7d, -0x50, -0x52, -0x51, -0x47, -0xa, -0x80, -0x50, -0x52, -0x51, -0x47, -0x14, -0xf, -0x5f, -0x43, -0x52, -0x53, -0x0, -0xa4, -0x49, -0x51, -0x43, -0x52, -0x50, -0x52, -0x51, -0x47, -0x14, -0x17, -0x5f, -0x53, -0x52, -0x53, -0x1, -0x8a, -0x68, -0xa, -0x5, -0x50, -0x52, -0x52, -0x49, -0x70, -0x50, -0x52, -0x52, -0x49, -0x50, -0x52, -0x51, -0x47, -0x5b, -0x82, -0x4d, -0x7, -0x4c, -0x4e, -0x4b, -0x48, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xc, -0x41, -0xd0, -0xc, -0xf, -0x8, -0x5f, -0x55, -0x49, -0x44, -0xa, -0x7, -0x8, -0x5f, -0x50, -0x52, -0x53, -0x11, -0x16, -0xa, -0x13, -0x89, -0xe, -0x0, -0x9, -0x3, -0x5, -0x0, -0x0, -0x0, -0xa, -0x0, -0x0, -0x0, -0xb, -0x0, -0x0, -0x0, -0x79, -0x0, -0x14, -0xf, -0x5f, -0x53, -0x54, -0x41, -0x0, -0xa4, -0x49, -0x51, -0x53, -0x54, -0x50, -0x52, -0x51, -0x48, -0x14, -0x11, -0x5f, -0x44, -0x49, -0x53, -0x0, -0x7d, -0x50, -0x52, -0x51, -0x48, -0xa, -0x80, -0x50, -0x52, -0x51, -0x48, -0x14, -0xf, -0x5f, -0x43, -0x52, -0x53, -0x0, -0xa4, -0x49, -0x51, -0x43, -0x52, -0x50, -0x52, -0x51, -0x48, -0x14, -0x17, -0x5f, -0x53, -0x52, -0x53, -0x1, -0x8a, -0x68, -0xa, -0x5, -0x50, -0x52, -0x52, -0x49, -0x70, -0x50, -0x52, -0x52, -0x49, -0x50, -0x52, -0x51, -0x48, -0x5b, -0x82, -0x45, -0x4, -0x47, -0x53, -0x49, -0x41, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xc, -0x41, -0xd0, -0xc, -0xf, -0x8, -0x5f, -0x55, -0x49, -0x44, -0x0, -0x8, -0x5f, -0x50, -0x52, -0x53, -0x11, -0xe, -0xa, -0xb, -0x89, -0x6, -0x0, -0x9, -0x1, -0x10, -0x0, -0x0, -0x0, -0x79, -0x0, -0x8, -0x5f, -0x43, -0x52, -0x53, -0x11, -0xe, -0xa, -0xb, -0x89, -0x6, -0x0, -0x9, -0x1, -0x10, -0x0, -0x0, -0x0, -0x79, -0x0, -0x14, -0x6, -0x5f, -0x53, -0x52, -0x53, -0x1, -0x5b, -0x82, -0x45, -0x4, -0x47, -0x53, -0x49, -0x42, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xc, -0x41, -0xd0, -0xc, -0xf, -0x8, -0x5f, -0x55, -0x49, -0x44, -0x0, -0x8, -0x5f, -0x50, -0x52, -0x53, -0x11, -0xe, -0xa, -0xb, -0x89, -0x6, -0x0, -0x9, -0x1, -0x11, -0x0, -0x0, -0x0, -0x79, -0x0, -0x8, -0x5f, -0x43, -0x52, -0x53, -0x11, -0xe, -0xa, -0xb, -0x89, -0x6, -0x0, -0x9, -0x1, -0x11, -0x0, -0x0, -0x0, -0x79, -0x0, -0x14, -0x6, -0x5f, -0x53, -0x52, -0x53, -0x1, -0x5b, -0x82, -0x45, -0x4, -0x47, -0x53, -0x49, -0x43, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xc, -0x41, -0xd0, -0xc, -0xf, -0x8, -0x5f, -0x55, -0x49, -0x44, -0x0, -0x8, -0x5f, -0x50, -0x52, -0x53, -0x11, -0xe, -0xa, -0xb, -0x89, -0x6, -0x0, -0x9, -0x1, -0x12, -0x0, -0x0, -0x0, -0x79, -0x0, -0x8, -0x5f, -0x43, -0x52, -0x53, -0x11, -0xe, -0xa, -0xb, -0x89, -0x6, -0x0, -0x9, -0x1, -0x12, -0x0, -0x0, -0x0, -0x79, -0x0, -0x14, -0x6, -0x5f, -0x53, -0x52, -0x53, -0x1, -0x5b, -0x82, -0x45, -0x4, -0x47, -0x53, -0x49, -0x44, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xc, -0x41, -0xd0, -0xc, -0xf, -0x8, -0x5f, -0x55, -0x49, -0x44, -0x0, -0x8, -0x5f, -0x50, -0x52, -0x53, -0x11, -0xe, -0xa, -0xb, -0x89, -0x6, -0x0, -0x9, -0x1, -0x13, -0x0, -0x0, -0x0, -0x79, -0x0, -0x8, -0x5f, -0x43, -0x52, -0x53, -0x11, -0xe, -0xa, -0xb, -0x89, -0x6, -0x0, -0x9, -0x1, -0x13, -0x0, -0x0, -0x0, -0x79, -0x0, -0x14, -0x6, -0x5f, -0x53, -0x52, -0x53, -0x1, -0x5b, -0x82, -0x45, -0x4, -0x47, -0x53, -0x49, -0x45, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xc, -0x41, -0xd0, -0xc, -0xf, -0x8, -0x5f, -0x55, -0x49, -0x44, -0x0, -0x8, -0x5f, -0x50, -0x52, -0x53, -0x11, -0xe, -0xa, -0xb, -0x89, -0x6, -0x0, -0x9, -0x1, -0x14, -0x0, -0x0, -0x0, -0x79, -0x0, -0x8, -0x5f, -0x43, -0x52, -0x53, -0x11, -0xe, -0xa, -0xb, -0x89, -0x6, -0x0, -0x9, -0x1, -0x14, -0x0, -0x0, -0x0, -0x79, -0x0, -0x14, -0x6, -0x5f, -0x53, -0x52, -0x53, -0x1, -0x5b, -0x82, -0x45, -0x4, -0x47, -0x53, -0x49, -0x46, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xc, -0x41, -0xd0, -0xc, -0xf, -0x8, -0x5f, -0x55, -0x49, -0x44, -0x0, -0x8, -0x5f, -0x50, -0x52, -0x53, -0x11, -0xe, -0xa, -0xb, -0x89, -0x6, -0x0, -0x9, -0x1, -0x15, -0x0, -0x0, -0x0, -0x79, -0x0, -0x8, -0x5f, -0x43, -0x52, -0x53, -0x11, -0xe, -0xa, -0xb, -0x89, -0x6, -0x0, -0x9, -0x1, -0x15, -0x0, -0x0, -0x0, -0x79, -0x0, -0x14, -0x6, -0x5f, -0x53, -0x52, -0x53, -0x1, -0x5b, -0x82, -0x45, -0x4, -0x47, -0x53, -0x49, -0x47, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xc, -0x41, -0xd0, -0xc, -0xf, -0x8, -0x5f, -0x55, -0x49, -0x44, -0x0, -0x8, -0x5f, -0x50, -0x52, -0x53, -0x11, -0xe, -0xa, -0xb, -0x89, -0x6, -0x0, -0x9, -0x1, -0x16, -0x0, -0x0, -0x0, -0x79, -0x0, -0x8, -0x5f, -0x43, -0x52, -0x53, -0x11, -0xe, -0xa, -0xb, -0x89, -0x6, -0x0, -0x9, -0x1, -0x16, -0x0, -0x0, -0x0, -0x79, -0x0, -0x14, -0x6, -0x5f, -0x53, -0x52, -0x53, -0x1, -0x5b, -0x82, -0x45, -0x4, -0x47, -0x53, -0x49, -0x48, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xc, -0x41, -0xd0, -0xc, -0xf, -0x8, -0x5f, -0x55, -0x49, -0x44, -0x0, -0x8, -0x5f, -0x50, -0x52, -0x53, -0x11, -0xe, -0xa, -0xb, -0x89, -0x6, -0x0, -0x9, -0x1, -0x17, -0x0, -0x0, -0x0, -0x79, -0x0, -0x8, -0x5f, -0x43, -0x52, -0x53, -0x11, -0xe, -0xa, -0xb, -0x89, -0x6, -0x0, -0x9, -0x1, -0x17, -0x0, -0x0, -0x0, -0x79, -0x0, -0x14, -0x6, -0x5f, -0x53, -0x52, -0x53, -0x1, -0x10, -0x4d, -0xc, -0x5f, -0x53, -0x42, -0x5f, -0x14, -0x35, -0x43, -0x50, -0x4d, -0x41, -0x1, -0x70, -0x83, -0x88, -0x43, -0x50, -0x4f, -0x4e, -0x68, -0x0, -0x60, -0x70, -0x11, -0xb, -0xa, -0x8, -0x0, -0x8, -0x0, -0x0, -0x0, -0x0, -0x0, -0x0, -0x61, -0x70, -0x68, -0x88, -0x61, -0xa, -0x2, -0x0, -0x70, -0x68, -0x88, -0x61, -0xa, -0x3, -0x0, -0x70, -0x60, -0x88, -0x61, -0xa, -0x4, -0x0, -0xa4, -0x61, -0x14, -0x1a, -0x43, -0x50, -0x53, -0x54, -0x1, -0x70, -0x83, -0x88, -0x43, -0x50, -0x4f, -0x4e, -0x68, -0x0, -0x60, -0xa0, -0x5, -0x60, -0xa4, -0xa, -0xf, -0xa1, -0x3, -0xa4, -0x0, -0x14, -0xa, -0x43, -0x50, -0x45, -0x4a, -0x2, -0x5b, -0x22, -0xa, -0xc8, -0x14, -0x4a, -0x6, -0x50, -0x52, -0x53, -0x43, -0x0, -0x70, -0x50, -0x52, -0x53, -0x5f, -0x65, -0x70, -0x0, -0x62, -0x70, -0x0, -0x60, -0xa2, -0x46, -0x5, -0x95, -0x60, -0x87, -0x43, -0x50, -0x4f, -0x4e, -0x70, -0x83, -0x88, -0x43, -0x50, -0x4f, -0x4e, -0x60, -0x0, -0x61, -0xa0, -0xa, -0x7b, -0x60, -0xa, -0x7, -0x0, -0x7a, -0x62, -0x1, -0x62, -0xa1, -0xc, -0x70, -0x83, -0x88, -0x65, -0x7a, -0x60, -0xa, -0x3, -0x0, -0x0, -0x62, -0x70, -0x7b, -0x62, -0x1, -0x0, -0x63, -0xa0, -0x22, -0x92, -0x93, -0x61, -0x63, -0x70, -0x63, -0x88, -0x43, -0x50, -0x4f, -0x4e, -0x60, -0x0, -0xa0, -0xa, -0x93, -0x63, -0x1, -0x4e, -0x54, -0x46, -0x59, -0x60, -0x1, -0xa1, -0x8, -0x4e, -0x54, -0x46, -0x59, -0x60, -0xa, -0x3, -0x75, -0x60, -0x10, -0x44, -0x2a, -0x2e, -0x5f, -0x53, -0x42, -0x5f, -0x50, -0x43, -0x49, -0x30, -0x5b, -0x82, -0x47, -0x29, -0x4d, -0x48, -0x50, -0x44, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xd, -0x50, -0x4e, -0x50, -0x30, -0x41, -0x30, -0x36, -0x0, -0x8, -0x5f, -0x55, -0x49, -0x44, -0xd, -0x4d, -0x65, -0x6d, -0x6f, -0x72, -0x79, -0x20, -0x68, -0x6f, -0x74, -0x70, -0x6c, -0x75, -0x67, -0x20, -0x72, -0x65, -0x73, -0x6f, -0x75, -0x72, -0x63, -0x65, -0x73, -0x0, -0x14, -0x13, -0x5f, -0x53, -0x54, -0x41, -0x0, -0xa0, -0x9, -0x93, -0x4d, -0x44, -0x4e, -0x52, -0x0, -0xa4, -0x0, -0xa4, -0xa, -0xb, -0x5b, -0x1, -0x4d, -0x4c, -0x43, -0x4b, -0x0, -0x14, -0x4a, -0x4, -0x4d, -0x53, -0x43, -0x4e, -0x0, -0xa0, -0x9, -0x93, -0x4d, -0x44, -0x4e, -0x52, -0x0, -0xa4, -0x0, -0x70, -0x0, -0x60, -0x5b, -0x23, -0x4d, -0x4c, -0x43, -0x4b, -0xff, -0xff, -0xa2, -0x25, -0x95, -0x60, -0x4d, -0x44, -0x4e, -0x52, -0x70, -0x60, -0x4d, -0x53, -0x45, -0x4c, -0xa0, -0x13, -0x93, -0x4d, -0x49, -0x4e, -0x53, -0x1, -0x4d, -0x54, -0x46, -0x59, -0x60, -0x1, -0x70, -0x1, -0x4d, -0x49, -0x4e, -0x53, -0x72, -0x60, -0x1, -0x60, -0x5b, -0x27, -0x4d, -0x4c, -0x43, -0x4b, -0xa4, -0x1, -0x14, -0x2d, -0x4d, -0x52, -0x53, -0x54, -0x1, -0x70, -0x0, -0x60, -0x5b, -0x23, -0x4d, -0x4c, -0x43, -0x4b, -0xff, -0xff, -0x70, -0x99, -0x68, -0x0, -0x4d, -0x53, -0x45, -0x4c, -0xa0, -0xb, -0x93, -0x4d, -0x45, -0x53, -0x5f, -0x1, -0x70, -0xa, -0xf, -0x60, -0x5b, -0x27, -0x4d, -0x4c, -0x43, -0x4b, -0xa4, -0x60, -0x14, -0x41, -0x18, -0x4d, -0x43, -0x52, -0x53, -0x9, -0x5b, -0x23, -0x4d, -0x4c, -0x43, -0x4b, -0xff, -0xff, -0x70, -0x99, -0x68, -0x0, -0x4d, -0x53, -0x45, -0x4c, -0x8, -0x4d, -0x52, -0x36, -0x34, -0x11, -0x33, -0xa, -0x30, -0x8a, -0x2b, -0x0, -0x0, -0xc, -0x3, -0x0, -0x0, -0x0, -0x0, -0x0, -0x0, -0x0, -0x0, -0x0, -0x0, -0x0, -0x0, -0x0, -0x0, -0x0, -0x0, -0xfe, -0xff, -0xff, -0xff, -0xff, -0xff, -0xff, -0xff, -0x0, -0x0, -0x0, -0x0, -0x0, -0x0, -0x0, -0x0, -0xff, -0xff, -0xff, -0xff, -0xff, -0xff, -0xff, -0xff, -0x79, -0x0, -0x8a, -0x4d, -0x52, -0x36, -0x34, -0xa, -0xe, -0x4d, -0x49, -0x4e, -0x4c, -0x8a, -0x4d, -0x52, -0x36, -0x34, -0xa, -0x12, -0x4d, -0x49, -0x4e, -0x48, -0x8a, -0x4d, -0x52, -0x36, -0x34, -0xa, -0x26, -0x4c, -0x45, -0x4e, -0x4c, -0x8a, -0x4d, -0x52, -0x36, -0x34, -0xa, -0x2a, -0x4c, -0x45, -0x4e, -0x48, -0x8a, -0x4d, -0x52, -0x36, -0x34, -0xa, -0x16, -0x4d, -0x41, -0x58, -0x4c, -0x8a, -0x4d, -0x52, -0x36, -0x34, -0xa, -0x1a, -0x4d, -0x41, -0x58, -0x48, -0x70, -0x4d, -0x52, -0x42, -0x48, -0x4d, -0x49, -0x4e, -0x48, -0x70, -0x4d, -0x52, -0x42, -0x4c, -0x4d, -0x49, -0x4e, -0x4c, -0x70, -0x4d, -0x52, -0x4c, -0x48, -0x4c, -0x45, -0x4e, -0x48, -0x70, -0x4d, -0x52, -0x4c, -0x4c, -0x4c, -0x45, -0x4e, -0x4c, -0x72, -0x4d, -0x49, -0x4e, -0x4c, -0x4c, -0x45, -0x4e, -0x4c, -0x4d, -0x41, -0x58, -0x4c, -0x72, -0x4d, -0x49, -0x4e, -0x48, -0x4c, -0x45, -0x4e, -0x48, -0x4d, -0x41, -0x58, -0x48, -0xa0, -0x14, -0x95, -0x4d, -0x41, -0x58, -0x4c, -0x4d, -0x49, -0x4e, -0x4c, -0x72, -0x4d, -0x41, -0x58, -0x48, -0x1, -0x4d, -0x41, -0x58, -0x48, -0xa0, -0x11, -0x95, -0x4d, -0x41, -0x58, -0x4c, -0x1, -0x74, -0x4d, -0x41, -0x58, -0x48, -0x1, -0x4d, -0x41, -0x58, -0x48, -0x74, -0x4d, -0x41, -0x58, -0x4c, -0x1, -0x4d, -0x41, -0x58, -0x4c, -0xa0, -0x44, -0x7, -0x93, -0x4d, -0x41, -0x58, -0x48, -0x0, -0x8, -0x4d, -0x52, -0x33, -0x32, -0x11, -0x1f, -0xa, -0x1c, -0x87, -0x17, -0x0, -0x0, -0xc, -0x3, -0x0, -0x0, -0x0, -0x0, -0x0, -0x0, -0x0, -0x0, -0xfe, -0xff, -0xff, -0xff, -0x0, -0x0, -0x0, -0x0, -0xff, -0xff, -0xff, -0xff, -0x79, -0x0, -0x8a, -0x4d, -0x52, -0x33, -0x32, -0xa, -0xa, -0x4d, -0x49, -0x4e, -0x5f, -0x8a, -0x4d, -0x52, -0x33, -0x32, -0xa, -0xe, -0x4d, -0x41, -0x58, -0x5f, -0x8a, -0x4d, -0x52, -0x33, -0x32, -0xa, -0x16, -0x4c, -0x45, -0x4e, -0x5f, -0x70, -0x4d, -0x49, -0x4e, -0x4c, -0x4d, -0x49, -0x4e, -0x5f, -0x70, -0x4d, -0x41, -0x58, -0x4c, -0x4d, -0x41, -0x58, -0x5f, -0x70, -0x4c, -0x45, -0x4e, -0x4c, -0x4c, -0x45, -0x4e, -0x5f, -0x5b, -0x27, -0x4d, -0x4c, -0x43, -0x4b, -0xa4, -0x4d, -0x52, -0x33, -0x32, -0x5b, -0x27, -0x4d, -0x4c, -0x43, -0x4b, -0xa4, -0x4d, -0x52, -0x36, -0x34, -0x14, -0x24, -0x4d, -0x50, -0x58, -0x4d, -0x1, -0x5b, -0x23, -0x4d, -0x4c, -0x43, -0x4b, -0xff, -0xff, -0x70, -0x99, -0x68, -0x0, -0x4d, -0x53, -0x45, -0x4c, -0x70, -0x4d, -0x50, -0x58, -0x5f, -0x60, -0x5b, -0x27, -0x4d, -0x4c, -0x43, -0x4b, -0xa4, -0x60, -0x14, -0x28, -0x4d, -0x4f, -0x53, -0x54, -0x4, -0x5b, -0x23, -0x4d, -0x4c, -0x43, -0x4b, -0xff, -0xff, -0x70, -0x99, -0x68, -0x0, -0x4d, -0x53, -0x45, -0x4c, -0x70, -0x69, -0x4d, -0x4f, -0x45, -0x56, -0x70, -0x6a, -0x4d, -0x4f, -0x53, -0x43, -0x5b, -0x27, -0x4d, -0x4c, -0x43, -0x4b, -0x10, -0x42, -0xa, -0x5f, -0x47, -0x50, -0x45, -0x8, -0x5f, -0x48, -0x49, -0x44, -0xd, -0x41, -0x43, -0x50, -0x49, -0x30, -0x30, -0x30, -0x36, -0x0, -0x14, -0x6, -0x5f, -0x4c, -0x30, -0x30, -0x0, -0x14, -0x6, -0x5f, -0x4c, -0x30, -0x31, -0x0, -0x14, -0x10, -0x5f, -0x45, -0x30, -0x32, -0x0, -0x5c, -0x2e, -0x5f, -0x53, -0x42, -0x5f, -0x50, -0x52, -0x53, -0x43, -0x14, -0x19, -0x5f, -0x45, -0x30, -0x33, -0x0, -0x5c, -0x2f, -0x4, -0x5f, -0x53, -0x42, -0x5f, -0x50, -0x43, -0x49, -0x30, -0x4d, -0x48, -0x50, -0x44, -0x4d, -0x53, -0x43, -0x4e, -0x14, -0x6, -0x5f, -0x4c, -0x30, -0x34, -0x0, -0x14, -0x6, -0x5f, -0x4c, -0x30, -0x35, -0x0, -0x14, -0x6, -0x5f, -0x4c, -0x30, -0x36, -0x0, -0x14, -0x6, -0x5f, -0x4c, -0x30, -0x37, -0x0, -0x14, -0x6, -0x5f, -0x4c, -0x30, -0x38, -0x0, -0x14, -0x6, -0x5f, -0x4c, -0x30, -0x39, -0x0, -0x14, -0x6, -0x5f, -0x4c, -0x30, -0x41, -0x0, -0x14, -0x6, -0x5f, -0x4c, -0x30, -0x42, -0x0, -0x14, -0x6, -0x5f, -0x4c, -0x30, -0x43, -0x0, -0x14, -0x6, -0x5f, -0x4c, -0x30, -0x44, -0x0, -0x14, -0x6, -0x5f, -0x4c, -0x30, -0x45, -0x0, -0x14, -0x6, -0x5f, -0x4c, -0x30, -0x46, -0x0 -}; diff --git a/scripts/acpi_extract.py b/scripts/acpi_extract.py deleted file mode 100755 index 10c1ffb368..0000000000 --- a/scripts/acpi_extract.py +++ /dev/null @@ -1,367 +0,0 @@ -#!/usr/bin/python -# Copyright (C) 2011 Red Hat, Inc., Michael S. Tsirkin -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, see . - -# Process mixed ASL/AML listing (.lst file) produced by iasl -l -# Locate and execute ACPI_EXTRACT directives, output offset info -# -# Documentation of ACPI_EXTRACT_* directive tags: -# -# These directive tags output offset information from AML for BIOS runtime -# table generation. -# Each directive is of the form: -# ACPI_EXTRACT_ (...) -# and causes the extractor to create an array -# named with offset, in the generated AML, -# of an object of a given type in the following . -# -# A directive must fit on a single code line. -# -# Object type in AML is verified, a mismatch causes a build failure. -# -# Directives and operators currently supported are: -# ACPI_EXTRACT_NAME_DWORD_CONST - extract a Dword Const object from Name() -# ACPI_EXTRACT_NAME_WORD_CONST - extract a Word Const object from Name() -# ACPI_EXTRACT_NAME_BYTE_CONST - extract a Byte Const object from Name() -# ACPI_EXTRACT_METHOD_STRING - extract a NameString from Method() -# ACPI_EXTRACT_NAME_STRING - extract a NameString from Name() -# ACPI_EXTRACT_PROCESSOR_START - start of Processor() block -# ACPI_EXTRACT_PROCESSOR_STRING - extract a NameString from Processor() -# ACPI_EXTRACT_PROCESSOR_END - offset at last byte of Processor() + 1 -# ACPI_EXTRACT_PKG_START - start of Package block -# -# ACPI_EXTRACT_ALL_CODE - create an array storing the generated AML bytecode -# -# ACPI_EXTRACT is not allowed anywhere else in code, except in comments. - -import re; -import sys; -import fileinput; - -aml = [] -asl = [] -output = {} -debug = "" - -class asl_line: - line = None - lineno = None - aml_offset = None - -def die(diag): - sys.stderr.write("Error: %s; %s\n" % (diag, debug)) - sys.exit(1) - -#Store an ASL command, matching AML offset, and input line (for debugging) -def add_asl(lineno, line): - l = asl_line() - l.line = line - l.lineno = lineno - l.aml_offset = len(aml) - asl.append(l) - -#Store an AML byte sequence -#Verify that offset output by iasl matches # of bytes so far -def add_aml(offset, line): - o = int(offset, 16); - # Sanity check: offset must match size of code so far - if (o != len(aml)): - die("Offset 0x%x != 0x%x" % (o, len(aml))) - # Strip any trailing dots and ASCII dump after " - line = re.sub(r'\s*\.*\s*".*$',"", line) - # Strip traling whitespace - line = re.sub(r'\s+$',"", line) - # Strip leading whitespace - line = re.sub(r'^\s+',"", line) - # Split on whitespace - code = re.split(r'\s+', line) - for c in code: - # Require a legal hex number, two digits - if (not(re.search(r'^[0-9A-Fa-f][0-9A-Fa-f]$', c))): - die("Unexpected octet %s" % c); - aml.append(int(c, 16)); - -# Process aml bytecode array, decoding AML -def aml_pkglen_bytes(offset): - # PkgLength can be multibyte. Bits 8-7 give the # of extra bytes. - pkglenbytes = aml[offset] >> 6; - return pkglenbytes + 1 - -def aml_pkglen(offset): - pkgstart = offset - pkglenbytes = aml_pkglen_bytes(offset) - pkglen = aml[offset] & 0x3F - # If multibyte, first nibble only uses bits 0-3 - if ((pkglenbytes > 1) and (pkglen & 0x30)): - die("PkgLen bytes 0x%x but first nibble 0x%x expected 0x0X" % - (pkglen, pkglen)) - offset += 1 - pkglenbytes -= 1 - for i in range(pkglenbytes): - pkglen |= aml[offset + i] << (i * 8 + 4) - if (len(aml) < pkgstart + pkglen): - die("PckgLen 0x%x at offset 0x%x exceeds AML size 0x%x" % - (pkglen, offset, len(aml))) - return pkglen - -# Given method offset, find its NameString offset -def aml_method_string(offset): - #0x14 MethodOp PkgLength NameString MethodFlags TermList - if (aml[offset] != 0x14): - die( "Method offset 0x%x: expected 0x14 actual 0x%x" % - (offset, aml[offset])); - offset += 1; - pkglenbytes = aml_pkglen_bytes(offset) - offset += pkglenbytes; - return offset; - -# Given name offset, find its NameString offset -def aml_name_string(offset): - #0x08 NameOp NameString DataRef - if (aml[offset] != 0x08): - die( "Name offset 0x%x: expected 0x08 actual 0x%x" % - (offset, aml[offset])); - offset += 1 - # Block Name Modifier. Skip it. - if (aml[offset] == 0x5c or aml[offset] == 0x5e): - offset += 1 - return offset; - -# Given data offset, find variable length byte buffer offset -def aml_data_buffer(offset, length): - #0x11 PkgLength BufferSize ByteList - if (length > 63): - die( "Name offset 0x%x: expected a one byte PkgLength (length<=63)" % - (offset)); - expect = [0x11, length+3, 0x0A, length] - if (aml[offset:offset+4] != expect): - die( "Name offset 0x%x: expected %s actual %s" % - (offset, expect, aml[offset:offset+4])) - return offset + len(expect) - -# Given data offset, find dword const offset -def aml_data_dword_const(offset): - #0x08 NameOp NameString DataRef - if (aml[offset] != 0x0C): - die( "Name offset 0x%x: expected 0x0C actual 0x%x" % - (offset, aml[offset])); - return offset + 1; - -# Given data offset, find word const offset -def aml_data_word_const(offset): - #0x08 NameOp NameString DataRef - if (aml[offset] != 0x0B): - die( "Name offset 0x%x: expected 0x0B actual 0x%x" % - (offset, aml[offset])); - return offset + 1; - -# Given data offset, find byte const offset -def aml_data_byte_const(offset): - #0x08 NameOp NameString DataRef - if (aml[offset] != 0x0A): - die( "Name offset 0x%x: expected 0x0A actual 0x%x" % - (offset, aml[offset])); - return offset + 1; - -# Find name'd buffer -def aml_name_buffer(offset, length): - return aml_data_buffer(aml_name_string(offset) + 4, length) - -# Given name offset, find dword const offset -def aml_name_dword_const(offset): - return aml_data_dword_const(aml_name_string(offset) + 4) - -# Given name offset, find word const offset -def aml_name_word_const(offset): - return aml_data_word_const(aml_name_string(offset) + 4) - -# Given name offset, find byte const offset -def aml_name_byte_const(offset): - return aml_data_byte_const(aml_name_string(offset) + 4) - -def aml_device_start(offset): - #0x5B 0x82 DeviceOp PkgLength NameString - if ((aml[offset] != 0x5B) or (aml[offset + 1] != 0x82)): - die( "Name offset 0x%x: expected 0x5B 0x82 actual 0x%x 0x%x" % - (offset, aml[offset], aml[offset + 1])); - return offset - -def aml_device_string(offset): - #0x5B 0x82 DeviceOp PkgLength NameString - start = aml_device_start(offset) - offset += 2 - pkglenbytes = aml_pkglen_bytes(offset) - offset += pkglenbytes - return offset - -def aml_device_end(offset): - start = aml_device_start(offset) - offset += 2 - pkglenbytes = aml_pkglen_bytes(offset) - pkglen = aml_pkglen(offset) - return offset + pkglen - -def aml_processor_start(offset): - #0x5B 0x83 ProcessorOp PkgLength NameString ProcID - if ((aml[offset] != 0x5B) or (aml[offset + 1] != 0x83)): - die( "Name offset 0x%x: expected 0x5B 0x83 actual 0x%x 0x%x" % - (offset, aml[offset], aml[offset + 1])); - return offset - -def aml_processor_string(offset): - #0x5B 0x83 ProcessorOp PkgLength NameString ProcID - start = aml_processor_start(offset) - offset += 2 - pkglenbytes = aml_pkglen_bytes(offset) - offset += pkglenbytes - return offset - -def aml_processor_end(offset): - start = aml_processor_start(offset) - offset += 2 - pkglenbytes = aml_pkglen_bytes(offset) - pkglen = aml_pkglen(offset) - return offset + pkglen - -def aml_package_start(offset): - offset = aml_name_string(offset) + 4 - # 0x12 PkgLength NumElements PackageElementList - if (aml[offset] != 0x12): - die( "Name offset 0x%x: expected 0x12 actual 0x%x" % - (offset, aml[offset])); - offset += 1 - return offset + aml_pkglen_bytes(offset) + 1 - -lineno = 0 -for line in fileinput.input(): - # Strip trailing newline - line = line.rstrip(); - # line number and debug string to output in case of errors - lineno = lineno + 1 - debug = "input line %d: %s" % (lineno, line) - #ASL listing: space, then line#, then ...., then code - pasl = re.compile('^\s+([0-9]+)(:\s\s|\.\.\.\.)\s*') - m = pasl.search(line) - if (m): - add_asl(lineno, pasl.sub("", line)); - # AML listing: offset in hex, then ...., then code - paml = re.compile('^([0-9A-Fa-f]+)(:\s\s|\.\.\.\.)\s*') - m = paml.search(line) - if (m): - add_aml(m.group(1), paml.sub("", line)) - -# Now go over code -# Track AML offset of a previous non-empty ASL command -prev_aml_offset = -1 -for i in range(len(asl)): - debug = "input line %d: %s" % (asl[i].lineno, asl[i].line) - - l = asl[i].line - - # skip if not an extract directive - a = len(re.findall(r'ACPI_EXTRACT', l)) - if (not a): - # If not empty, store AML offset. Will be used for sanity checks - # IASL seems to put {}. at random places in the listing. - # Ignore any non-words for the purpose of this test. - m = re.search(r'\w+', l) - if (m): - prev_aml_offset = asl[i].aml_offset - continue - - if (a > 1): - die("Expected at most one ACPI_EXTRACT per line, actual %d" % a) - - mext = re.search(r''' - ^\s* # leading whitespace - /\*\s* # start C comment - (ACPI_EXTRACT_\w+) # directive: group(1) - \s+ # whitspace separates directive from array name - (\w+) # array name: group(2) - \s*\*/ # end of C comment - \s*$ # trailing whitespace - ''', l, re.VERBOSE) - if (not mext): - die("Stray ACPI_EXTRACT in input") - - # previous command must have produced some AML, - # otherwise we are in a middle of a block - if (prev_aml_offset == asl[i].aml_offset): - die("ACPI_EXTRACT directive in the middle of a block") - - directive = mext.group(1) - array = mext.group(2) - offset = asl[i].aml_offset - - if (directive == "ACPI_EXTRACT_ALL_CODE"): - if array in output: - die("%s directive used more than once" % directive) - output[array] = aml - continue - if (directive == "ACPI_EXTRACT_NAME_BUFFER8"): - offset = aml_name_buffer(offset, 8) - elif (directive == "ACPI_EXTRACT_NAME_BUFFER16"): - offset = aml_name_buffer(offset, 16) - elif (directive == "ACPI_EXTRACT_NAME_DWORD_CONST"): - offset = aml_name_dword_const(offset) - elif (directive == "ACPI_EXTRACT_NAME_WORD_CONST"): - offset = aml_name_word_const(offset) - elif (directive == "ACPI_EXTRACT_NAME_BYTE_CONST"): - offset = aml_name_byte_const(offset) - elif (directive == "ACPI_EXTRACT_NAME_STRING"): - offset = aml_name_string(offset) - elif (directive == "ACPI_EXTRACT_METHOD_STRING"): - offset = aml_method_string(offset) - elif (directive == "ACPI_EXTRACT_DEVICE_START"): - offset = aml_device_start(offset) - elif (directive == "ACPI_EXTRACT_DEVICE_STRING"): - offset = aml_device_string(offset) - elif (directive == "ACPI_EXTRACT_DEVICE_END"): - offset = aml_device_end(offset) - elif (directive == "ACPI_EXTRACT_PROCESSOR_START"): - offset = aml_processor_start(offset) - elif (directive == "ACPI_EXTRACT_PROCESSOR_STRING"): - offset = aml_processor_string(offset) - elif (directive == "ACPI_EXTRACT_PROCESSOR_END"): - offset = aml_processor_end(offset) - elif (directive == "ACPI_EXTRACT_PKG_START"): - offset = aml_package_start(offset) - else: - die("Unsupported directive %s" % directive) - - if array not in output: - output[array] = [] - output[array].append(offset) - -debug = "at end of file" - -def get_value_type(maxvalue): - #Use type large enough to fit the table - if (maxvalue >= 0x10000): - return "int" - elif (maxvalue >= 0x100): - return "short" - else: - return "char" - -# Pretty print output -for array in output.keys(): - otype = get_value_type(max(output[array])) - odata = [] - for value in output[array]: - odata.append("0x%x" % value) - sys.stdout.write("static unsigned %s %s[] = {\n" % (otype, array)) - sys.stdout.write(",\n".join(odata)) - sys.stdout.write('\n};\n'); diff --git a/scripts/acpi_extract_preprocess.py b/scripts/acpi_extract_preprocess.py deleted file mode 100755 index 69d10d621c..0000000000 --- a/scripts/acpi_extract_preprocess.py +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/python -# Copyright (C) 2011 Red Hat, Inc., Michael S. Tsirkin -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, see . - -# Read a preprocessed ASL listing and put each ACPI_EXTRACT -# directive in a comment, to make iasl skip it. -# We also put each directive on a new line, the machinery -# in tools/acpi_extract.py requires this. - -import re; -import sys; -import fileinput; - -def die(diag): - sys.stderr.write("Error: %s\n" % (diag)) - sys.exit(1) - -# Note: () around pattern make split return matched string as part of list -psplit = re.compile(r''' ( - \b # At word boundary - ACPI_EXTRACT_\w+ # directive - \s+ # some whitespace - \w+ # array name - )''', re.VERBOSE); - -lineno = 0 -for line in fileinput.input(): - # line number and debug string to output in case of errors - lineno = lineno + 1 - debug = "input line %d: %s" % (lineno, line.rstrip()) - - s = psplit.split(line); - # The way split works, each odd item is the matching ACPI_EXTRACT directive. - # Put each in a comment, and on a line by itself. - for i in range(len(s)): - if (i % 2): - sys.stdout.write("\n/* %s */\n" % s[i]) - else: - sys.stdout.write(s[i]) diff --git a/scripts/update-acpi.sh b/scripts/update-acpi.sh deleted file mode 100644 index b5f05ff3cf..0000000000 --- a/scripts/update-acpi.sh +++ /dev/null @@ -1,4 +0,0 @@ -cd x86_64-softmmu -for file in hw/i386/*.hex; do - cp -f $file ../$file.generated -done From 424e4a87d20027acf52e65f322a2100460162a49 Mon Sep 17 00:00:00 2001 From: Roman Kagan Date: Wed, 30 Dec 2015 23:11:51 +0300 Subject: [PATCH 55/59] i386/pc: expose identifying the floppy controller Factor out and expose the function to locate the floppy controller in the system. It will allow to dynamically populate the relevant objects in the ACPI tables. Signed-off-by: Roman Kagan Cc: "Michael S. Tsirkin" Cc: Eduardo Habkost Cc: Igor Mammedov Cc: John Snow Cc: Kevin Wolf Cc: Paolo Bonzini Cc: Richard Henderson Cc: qemu-block@nongnu.org Cc: qemu-stable@nongnu.org Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/pc.c | 44 ++++++++++++++++++++++++++------------------ include/hw/i386/pc.h | 2 ++ 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 459260b4af..c36b8cf45a 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -360,6 +360,31 @@ static const char * const fdc_container_path[] = { "/unattached", "/peripheral", "/peripheral-anon" }; +/* + * Locate the FDC at IO address 0x3f0, in order to configure the CMOS registers + * and ACPI objects. + */ +ISADevice *pc_find_fdc0(void) +{ + int i; + Object *container; + CheckFdcState state = { 0 }; + + for (i = 0; i < ARRAY_SIZE(fdc_container_path); i++) { + container = container_get(qdev_get_machine(), fdc_container_path[i]); + object_child_foreach(container, check_fdc, &state); + } + + if (state.multiple) { + error_report("warning: multiple floppy disk controllers with " + "iobase=0x3f0 have been found;\n" + "the one being picked for CMOS setup might not reflect " + "your intent"); + } + + return state.floppy; +} + static void pc_cmos_init_late(void *opaque) { pc_cmos_init_late_arg *arg = opaque; @@ -368,8 +393,6 @@ static void pc_cmos_init_late(void *opaque) int8_t heads, sectors; int val; int i, trans; - Object *container; - CheckFdcState state = { 0 }; val = 0; if (ide_get_geometry(arg->idebus[0], 0, @@ -399,22 +422,7 @@ static void pc_cmos_init_late(void *opaque) } rtc_set_memory(s, 0x39, val); - /* - * Locate the FDC at IO address 0x3f0, and configure the CMOS registers - * accordingly. - */ - for (i = 0; i < ARRAY_SIZE(fdc_container_path); i++) { - container = container_get(qdev_get_machine(), fdc_container_path[i]); - object_child_foreach(container, check_fdc, &state); - } - - if (state.multiple) { - error_report("warning: multiple floppy disk controllers with " - "iobase=0x3f0 have been found;\n" - "the one being picked for CMOS setup might not reflect " - "your intent"); - } - pc_cmos_init_floppy(s, state.floppy); + pc_cmos_init_floppy(s, pc_find_fdc0()); qemu_unregister_reset(pc_cmos_init_late, opaque); } diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index b0d6283b25..8122229477 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -267,6 +267,8 @@ typedef void (*cpu_set_smm_t)(int smm, void *arg); void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name); +ISADevice *pc_find_fdc0(void); + /* acpi_piix.c */ I2CBus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base, From 2cf0148674430b6693c60d42b7eef721bfa9509f Mon Sep 17 00:00:00 2001 From: "Dr. David Alan Gilbert" Date: Wed, 6 Jan 2016 12:23:38 +0000 Subject: [PATCH 56/59] Add VMSTATE_STRUCT_VARRAY_KNOWN At the moment we have VMSTATE_STRUCT_ARRAY that requires the field is declared as an array of fixed size. We also have VMSTATE_STRUCT_VARRAY_UINT* that allows a field declared as a pointer, but requires that the length is a field member in the structure being loaded/saved. VMSTATE_STRUCT_VARRAY_KNOWN is for arrays defined as pointers yet we somehow know the length of. Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Amit Shah --- include/migration/vmstate.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index 7267e38c1f..97d44d3953 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -374,6 +374,19 @@ extern const VMStateInfo vmstate_info_bitmap; .offset = vmstate_offset_array(_state, _field, _type, _num),\ } +/* a variable length array (i.e. _type *_field) but we know the + * length + */ +#define VMSTATE_STRUCT_VARRAY_KNOWN(_field, _state, _num, _version, _vmsd, _type) { \ + .name = (stringify(_field)), \ + .num = (_num), \ + .version_id = (_version), \ + .vmsd = &(_vmsd), \ + .size = sizeof(_type), \ + .flags = VMS_STRUCT|VMS_ARRAY, \ + .offset = offsetof(_state, _field), \ +} + #define VMSTATE_STRUCT_VARRAY_UINT8(_field, _state, _field_num, _version, _vmsd, _type) { \ .name = (stringify(_field)), \ .num_offset = vmstate_offset_value(_state, _field_num, uint8_t), \ From 50e5ae4dc3e4f21e874512f9e87b93b5472d26e0 Mon Sep 17 00:00:00 2001 From: "Dr. David Alan Gilbert" Date: Wed, 6 Jan 2016 12:23:39 +0000 Subject: [PATCH 57/59] migration/virtio: Remove simple .get/.put use The 'virtqueue_state' and 'ringsize' can be saved using VMSTATE macros rather than hand coded .get/.put Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Amit Shah --- hw/virtio/virtio.c | 87 ++++++++++------------------------------------ 1 file changed, 19 insertions(+), 68 deletions(-) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 1edef5945d..28300cdba6 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -1126,33 +1126,15 @@ static bool virtio_extra_state_needed(void *opaque) k->has_extra_state(qbus->parent); } -static void put_virtqueue_state(QEMUFile *f, void *pv, size_t size) -{ - VirtIODevice *vdev = pv; - int i; - - for (i = 0; i < VIRTIO_QUEUE_MAX; i++) { - qemu_put_be64(f, vdev->vq[i].vring.avail); - qemu_put_be64(f, vdev->vq[i].vring.used); - } -} - -static int get_virtqueue_state(QEMUFile *f, void *pv, size_t size) -{ - VirtIODevice *vdev = pv; - int i; - - for (i = 0; i < VIRTIO_QUEUE_MAX; i++) { - vdev->vq[i].vring.avail = qemu_get_be64(f); - vdev->vq[i].vring.used = qemu_get_be64(f); - } - return 0; -} - -static VMStateInfo vmstate_info_virtqueue = { +static const VMStateDescription vmstate_virtqueue = { .name = "virtqueue_state", - .get = get_virtqueue_state, - .put = put_virtqueue_state, + .version_id = 1, + .minimum_version_id = 1, + .fields = (VMStateField[]) { + VMSTATE_UINT64(vring.avail, struct VirtQueue), + VMSTATE_UINT64(vring.used, struct VirtQueue), + VMSTATE_END_OF_LIST() + } }; static const VMStateDescription vmstate_virtio_virtqueues = { @@ -1161,44 +1143,20 @@ static const VMStateDescription vmstate_virtio_virtqueues = { .minimum_version_id = 1, .needed = &virtio_virtqueue_needed, .fields = (VMStateField[]) { - { - .name = "virtqueues", - .version_id = 0, - .field_exists = NULL, - .size = 0, - .info = &vmstate_info_virtqueue, - .flags = VMS_SINGLE, - .offset = 0, - }, + VMSTATE_STRUCT_VARRAY_KNOWN(vq, struct VirtIODevice, VIRTIO_QUEUE_MAX, + 0, vmstate_virtqueue, VirtQueue), VMSTATE_END_OF_LIST() } }; -static void put_ringsize_state(QEMUFile *f, void *pv, size_t size) -{ - VirtIODevice *vdev = pv; - int i; - - for (i = 0; i < VIRTIO_QUEUE_MAX; i++) { - qemu_put_be32(f, vdev->vq[i].vring.num_default); - } -} - -static int get_ringsize_state(QEMUFile *f, void *pv, size_t size) -{ - VirtIODevice *vdev = pv; - int i; - - for (i = 0; i < VIRTIO_QUEUE_MAX; i++) { - vdev->vq[i].vring.num_default = qemu_get_be32(f); - } - return 0; -} - -static VMStateInfo vmstate_info_ringsize = { +static const VMStateDescription vmstate_ringsize = { .name = "ringsize_state", - .get = get_ringsize_state, - .put = put_ringsize_state, + .version_id = 1, + .minimum_version_id = 1, + .fields = (VMStateField[]) { + VMSTATE_UINT32(vring.num_default, struct VirtQueue), + VMSTATE_END_OF_LIST() + } }; static const VMStateDescription vmstate_virtio_ringsize = { @@ -1207,15 +1165,8 @@ static const VMStateDescription vmstate_virtio_ringsize = { .minimum_version_id = 1, .needed = &virtio_ringsize_needed, .fields = (VMStateField[]) { - { - .name = "ringsize", - .version_id = 0, - .field_exists = NULL, - .size = 0, - .info = &vmstate_info_ringsize, - .flags = VMS_SINGLE, - .offset = 0, - }, + VMSTATE_STRUCT_VARRAY_KNOWN(vq, struct VirtIODevice, VIRTIO_QUEUE_MAX, + 0, vmstate_ringsize, VirtQueue), VMSTATE_END_OF_LIST() } }; From 56a571d9c803b7a2348373ca3feb44ca4e0d9131 Mon Sep 17 00:00:00 2001 From: Tetsuya Mukawa Date: Mon, 21 Dec 2015 12:47:34 +0900 Subject: [PATCH 58/59] ivshmem: Store file descriptor for vhost-user negotiation If virtio-net driver allocates memory in ivshmem shared memory, vhost-net will work correctly, but vhost-user will not work because a fd of shared memory will not be sent to vhost-user backend. This patch fixes ivshmem to store file descriptor of shared memory. It will be used when vhost-user negotiates vhost-user backend. Signed-off-by: Tetsuya Mukawa Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- exec.c | 10 ++++++++++ hw/misc/ivshmem.c | 9 +++++++-- include/exec/ram_addr.h | 1 + 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/exec.c b/exec.c index 8718a75b64..7f0ce42af0 100644 --- a/exec.c +++ b/exec.c @@ -1757,6 +1757,16 @@ int qemu_get_ram_fd(ram_addr_t addr) return fd; } +void qemu_set_ram_fd(ram_addr_t addr, int fd) +{ + RAMBlock *block; + + rcu_read_lock(); + block = qemu_get_ram_block(addr); + block->fd = fd; + rcu_read_unlock(); +} + void *qemu_get_ram_block_host_ptr(ram_addr_t addr) { RAMBlock *block; diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index f73f0c2b17..df585de10f 100644 --- a/hw/misc/ivshmem.c +++ b/hw/misc/ivshmem.c @@ -29,6 +29,7 @@ #include "sysemu/char.h" #include "sysemu/hostmem.h" #include "qapi/visitor.h" +#include "exec/ram_addr.h" #include "hw/misc/ivshmem.h" @@ -422,6 +423,7 @@ static int create_shared_memory_BAR(IVShmemState *s, int fd, uint8_t attr, memory_region_init_ram_ptr(&s->ivshmem, OBJECT(s), "ivshmem.bar2", s->ivshmem_size, ptr); + qemu_set_ram_fd(s->ivshmem.ram_addr, fd); vmstate_register_ram(&s->ivshmem, DEVICE(s)); memory_region_add_subregion(&s->bar, 0, &s->ivshmem); @@ -682,6 +684,7 @@ static void ivshmem_read(void *opaque, const uint8_t *buf, int size) } memory_region_init_ram_ptr(&s->ivshmem, OBJECT(s), "ivshmem.bar2", s->ivshmem_size, map_ptr); + qemu_set_ram_fd(s->ivshmem.ram_addr, incoming_fd); vmstate_register_ram(&s->ivshmem, DEVICE(s)); IVSHMEM_DPRINTF("guest h/w addr = %p, size = %" PRIu64 "\n", @@ -689,7 +692,6 @@ static void ivshmem_read(void *opaque, const uint8_t *buf, int size) memory_region_add_subregion(&s->bar, 0, &s->ivshmem); - close(incoming_fd); return; } @@ -991,7 +993,6 @@ static void pci_ivshmem_realize(PCIDevice *dev, Error **errp) } create_shared_memory_BAR(s, fd, attr, errp); - close(fd); } } @@ -1010,11 +1011,15 @@ static void pci_ivshmem_exit(PCIDevice *dev) if (memory_region_is_mapped(&s->ivshmem)) { if (!s->hostmem) { void *addr = memory_region_get_ram_ptr(&s->ivshmem); + int fd; if (munmap(addr, s->ivshmem_size) == -1) { error_report("Failed to munmap shared memory %s", strerror(errno)); } + + if ((fd = qemu_get_ram_fd(s->ivshmem.ram_addr)) != -1) + close(fd); } vmstate_unregister_ram(&s->ivshmem, DEVICE(dev)); diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h index ba4c04d202..ef1489da77 100644 --- a/include/exec/ram_addr.h +++ b/include/exec/ram_addr.h @@ -72,6 +72,7 @@ ram_addr_t qemu_ram_alloc_resizeable(ram_addr_t size, ram_addr_t max_size, void *host), MemoryRegion *mr, Error **errp); int qemu_get_ram_fd(ram_addr_t addr); +void qemu_set_ram_fd(ram_addr_t addr, int fd); void *qemu_get_ram_block_host_ptr(ram_addr_t addr); void qemu_ram_free(ram_addr_t addr); From 8a1be662a69e3f14741f7c44e971a727126d1532 Mon Sep 17 00:00:00 2001 From: Cornelia Huck Date: Fri, 8 Jan 2016 11:00:00 +0100 Subject: [PATCH 59/59] virtio: fix error message for number of queues There's no such thing as "PCI queues" in the virtio core. Signed-off-by: Cornelia Huck Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 28300cdba6..bd6b4df9ae 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -1380,7 +1380,7 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id) num = qemu_get_be32(f); if (num > VIRTIO_QUEUE_MAX) { - error_report("Invalid number of PCI queues: 0x%x", num); + error_report("Invalid number of virtqueues: 0x%x", num); return -1; }