[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC 28/47] pc: acpi-build: generate pvpanic device descrip
From: |
Igor Mammedov |
Subject: |
[Qemu-devel] [RFC 28/47] pc: acpi-build: generate pvpanic device description dynamically |
Date: |
Fri, 19 Dec 2014 02:02:23 +0000 |
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>
---
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 48a72ad..b1495b6 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -754,7 +754,7 @@ build_ssdt(GArray *table_data, GArray *linker,
int ssdt_start = table_data->len;
AcpiAml table_aml = { .buf = table_data };
uint8_t *ssdt_ptr;
- AcpiAml pkg, scope;
+ AcpiAml pkg, scope, dev, method, crs, field;
int i;
/* The current AML generator can cover the APIC ID range [0..255],
@@ -769,9 +769,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 */
@@ -802,6 +799,37 @@ build_ssdt(GArray *table_data, GArray *linker,
aml_append(&scope, acpi_name_decl("_S5", pkg));
aml_append(&table_aml, scope);
+ if (misc->pvpanic_port) {
+ scope = acpi_scope("\\_SB.PCI0.ISA");
+
+ dev = acpi_device("PEVR");
+ aml_append(&dev, acpi_name_decl("_HID", acpi_string("QEMU0002")));
+
+ crs = acpi_resource_template();
+ aml_append(&crs,
+ acpi_io(acpi_decode16, misc->pvpanic_port, misc->pvpanic_port, 1,
1)
+ );
+ aml_append(&dev, acpi_name_decl("_CRS", crs));
+
+ aml_append(&dev, acpi_operation_region("PEOR", acpi_system_io,
+ misc->pvpanic_port, 1));
+ field = acpi_field("PEOR", acpi_byte_acc);
+ aml_append(&field, acpi_named_field("PEPT", 8));
+ aml_append(&dev, field);
+
+ method = acpi_method("RDPT", 0);
+ aml_append(&method, acpi_store(acpi_name("PEPT"), acpi_local0()));
+ aml_append(&method, acpi_return(acpi_local0()));
+ aml_append(&dev, method);
+
+ method = acpi_method("WRPT", 1);
+ aml_append(&method, acpi_store(acpi_arg0(), acpi_name("PEPT")));
+ aml_append(&dev, method);
+
+ aml_append(&scope, dev);
+ aml_append(&table_aml, scope);
+ }
+
{
AcpiAml sb_scope = acpi_scope("_SB");
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)
- }
- }
- }
}
--
1.8.3.1
- [Qemu-devel] [RFC 09/47] acpi: add acpi_int() term, (continued)
- [Qemu-devel] [RFC 09/47] acpi: add acpi_int() term, Igor Mammedov, 2014/12/18
- [Qemu-devel] [RFC 17/47] acpi: add acpi_package() term, Igor Mammedov, 2014/12/18
- [Qemu-devel] [RFC 18/47] pc: acpi-build: drop unsupported PM1b_CNT.SLP_TYP, Igor Mammedov, 2014/12/18
- [Qemu-devel] [RFC 19/47] pc: acpi-build: generate _S[345] packages dynamically, Igor Mammedov, 2014/12/18
- [Qemu-devel] [RFC 20/47] acpi: add acpi_buffer() term, Igor Mammedov, 2014/12/18
- [Qemu-devel] [RFC 21/47] acpi: add acpi_resource_template() helper, Igor Mammedov, 2014/12/18
- [Qemu-devel] [RFC 22/47] acpi: add acpi_io() helper, Igor Mammedov, 2014/12/18
- [Qemu-devel] [RFC 25/47] acpi: add acpi_field() & acpi_named_field() terms, Igor Mammedov, 2014/12/18
- [Qemu-devel] [RFC 24/47] acpi: add acpi_operation_region() term, Igor Mammedov, 2014/12/18
- [Qemu-devel] [RFC 26/47] acpi: add acpi_local0() term, Igor Mammedov, 2014/12/18
- [Qemu-devel] [RFC 28/47] pc: acpi-build: generate pvpanic device description dynamically,
Igor Mammedov <=
- [Qemu-devel] [RFC 23/47] acpi: include PkgLength size only when requested, Igor Mammedov, 2014/12/18
- [Qemu-devel] [RFC 30/47] acpi: add acpi_equal() term, Igor Mammedov, 2014/12/18
- [Qemu-devel] [RFC 29/47] acpi: add acpi_varpackage() term, Igor Mammedov, 2014/12/18
- [Qemu-devel] [RFC 33/47] pc: acpi-build: drop template patching and CPU hotplug objects dynamically, Igor Mammedov, 2014/12/18
- [Qemu-devel] [RFC 31/47] acpi: add acpi_processor() term, Igor Mammedov, 2014/12/18
- [Qemu-devel] [RFC 32/47] acpi: add acpi_eisaid() term, Igor Mammedov, 2014/12/18
- [Qemu-devel] [RFC 27/47] acpi: add acpi_string() term, Igor Mammedov, 2014/12/18
- [Qemu-devel] [RFC 36/47] pc: acpi-build: drop template patching and memory hotplug objects dynamically, Igor Mammedov, 2014/12/18
- [Qemu-devel] [RFC 35/47] acpi: add acpi_reserved_field() term, Igor Mammedov, 2014/12/18
- [Qemu-devel] [RFC 34/47] pc: acpi-build: create CPU hotplug IO region dynamically, Igor Mammedov, 2014/12/18