diff options
author | Igor Mammedov <imammedo@redhat.com> | 2015-02-18 19:14:38 +0000 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2015-02-26 13:04:15 +0100 |
commit | cd61cb2e2c02c5c257a15a52b3d0616474e52997 (patch) | |
tree | 6d51077b45c20b5a9c3e11940e596607331a4df6 /hw/i386/acpi-build.c | |
parent | d5e5830f56452d857f9c26c06a886f09056482c1 (diff) | |
download | qemu-cd61cb2e2c02c5c257a15a52b3d0616474e52997.zip qemu-cd61cb2e2c02c5c257a15a52b3d0616474e52997.tar.gz qemu-cd61cb2e2c02c5c257a15a52b3d0616474e52997.tar.bz2 |
pc: acpi-build: generate pvpanic device description dynamically
Drops AML template patching and allows to
save some space in SSDT if pvpanic device doesn't
exist by not including disabled device description
into SSDT. It also makes device description
smaller by replacing _STA method with named value
and dropping _INI method.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/i386/acpi-build.c')
-rw-r--r-- | hw/i386/acpi-build.c | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 4536fba0a..2c581ef 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -924,7 +924,7 @@ build_ssdt(GArray *table_data, GArray *linker, uint32_t nr_mem = machine->ram_slots; unsigned acpi_cpus = guest_info->apic_id_limit; uint8_t *ssdt_ptr; - Aml *ssdt, *sb_scope, *scope, *pkg; + Aml *ssdt, *sb_scope, *scope, *pkg, *dev, *method, *crs, *field; int i; ssdt = init_aml_allocator(); @@ -940,9 +940,6 @@ build_ssdt(GArray *table_data, GArray *linker, patch_pci_windows(pci, ssdt_ptr, sizeof(ssdp_misc_aml)); ACPI_BUILD_SET_LE(ssdt_ptr, sizeof(ssdp_misc_aml), - ssdt_isa_pest[0], 16, misc->pvpanic_port); - - ACPI_BUILD_SET_LE(ssdt_ptr, sizeof(ssdp_misc_aml), ssdt_mctrl_nr_slots[0], 32, nr_mem); /* create S3_ / S4_ / S5_ packages if necessary */ @@ -974,6 +971,37 @@ build_ssdt(GArray *table_data, GArray *linker, aml_append(scope, aml_name_decl("_S5", pkg)); aml_append(ssdt, scope); + if (misc->pvpanic_port) { + scope = aml_scope("\\_SB.PCI0.ISA"); + + dev = aml_device("PEVR"); + aml_append(dev, aml_name_decl("_HID", aml_string("QEMU0002"))); + + crs = aml_resource_template(); + aml_append(crs, + aml_io(aml_decode16, misc->pvpanic_port, misc->pvpanic_port, 1, 1) + ); + aml_append(dev, aml_name_decl("_CRS", crs)); + + aml_append(dev, aml_operation_region("PEOR", aml_system_io, + misc->pvpanic_port, 1)); + field = aml_field("PEOR", aml_byte_acc); + aml_append(field, aml_named_field("PEPT", 8)); + aml_append(dev, field); + + method = aml_method("RDPT", 0); + aml_append(method, aml_store(aml_name("PEPT"), aml_local(0))); + aml_append(method, aml_return(aml_local(0))); + aml_append(dev, method); + + method = aml_method("WRPT", 1); + aml_append(method, aml_store(aml_arg(0), aml_name("PEPT"))); + aml_append(dev, method); + + aml_append(scope, dev); + aml_append(ssdt, scope); + } + sb_scope = aml_scope("_SB"); { /* build Processor object for each processor */ |