[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 81/96] pc: acpi-build: generate pvpanic device descri
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 81/96] pc: acpi-build: generate pvpanic device description dynamically |
Date: |
Wed, 18 Feb 2015 22:51:42 +0100 |
From: Igor Mammedov <address@hidden>
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 <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
hw/i386/acpi-build.c | 36 ++++++++++++++++++++++++++++++++----
hw/i386/ssdt-misc.dsl | 47 -----------------------------------------------
2 files changed, 32 insertions(+), 51 deletions(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 4536fba..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 */
diff --git a/hw/i386/ssdt-misc.dsl b/hw/i386/ssdt-misc.dsl
index 26b9241..81be858 100644
--- a/hw/i386/ssdt-misc.dsl
+++ b/hw/i386/ssdt-misc.dsl
@@ -39,51 +39,4 @@ DefinitionBlock ("ssdt-misc.aml", "SSDT", 0x01, "BXPC",
"BXSSDTSUSP", 0x1)
ACPI_EXTRACT_NAME_DWORD_CONST ssdt_mctrl_nr_slots
Name(MEMORY_SLOTS_NUMBER, 0x12345678)
}
-
-
- External(\_SB.PCI0, DeviceObj)
- External(\_SB.PCI0.ISA, DeviceObj)
-
- Scope(\_SB.PCI0.ISA) {
- Device(PEVT) {
- Name(_HID, "QEMU0001")
- /* PEST will be patched to be Zero if no such device */
- ACPI_EXTRACT_NAME_WORD_CONST ssdt_isa_pest
- Name(PEST, 0xFFFF)
- OperationRegion(PEOR, SystemIO, PEST, 0x01)
- Field(PEOR, ByteAcc, NoLock, Preserve) {
- PEPT, 8,
- }
-
- Method(_STA, 0, NotSerialized) {
- Store(PEST, Local0)
- If (LEqual(Local0, Zero)) {
- Return (0x00)
- } Else {
- Return (0x0F)
- }
- }
-
- Method(RDPT, 0, NotSerialized) {
- Store(PEPT, Local0)
- Return (Local0)
- }
-
- Method(WRPT, 1, NotSerialized) {
- Store(Arg0, PEPT)
- }
-
- Name(_CRS, ResourceTemplate() {
- IO(Decode16, 0x00, 0x00, 0x01, 0x01, IO)
- })
-
- CreateWordField(_CRS, IO._MIN, IOMN)
- CreateWordField(_CRS, IO._MAX, IOMX)
-
- Method(_INI, 0, NotSerialized) {
- Store(PEST, IOMN)
- Store(PEST, IOMX)
- }
- }
- }
}
--
MST
- [Qemu-devel] [PULL 71/96] acpi: add aml_package() term, (continued)
- [Qemu-devel] [PULL 71/96] acpi: add aml_package() term, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 72/96] pc: acpi-build: generate _S[345] packages dynamically, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 73/96] acpi: add aml_buffer() term, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 74/96] acpi: add aml_resource_template() helper, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 75/96] acpi: add aml_io() helper, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 76/96] acpi: include PkgLength size only when requested, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 77/96] acpi: add aml_operation_region() term, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 78/96] acpi: add aml_field() & aml_named_field() terms, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 80/96] acpi: add aml_string() term, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 79/96] acpi: add aml_local() term, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 81/96] pc: acpi-build: generate pvpanic device description dynamically,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL 82/96] acpi: add aml_varpackage() term, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 83/96] acpi: add aml_equal() term, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 84/96] acpi: add aml_processor() term, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 85/96] acpi: add aml_eisaid() term, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 86/96] pc: acpi-build: drop template patching and CPU hotplug objects dynamically, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 87/96] pc: acpi-build: create CPU hotplug IO region dynamically, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 88/96] acpi: add aml_reserved_field() term, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 89/96] pc: acpi-build: drop template patching and memory hotplug objects dynamically, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 90/96] pc: acpi-build: create memory hotplug IO region dynamically, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 91/96] acpi: add aml_word_bus_number(), aml_word_io(), aml_dword_memory(), aml_qword_memory() terms, Michael S. Tsirkin, 2015/02/18