[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 44/47] pc: acpi-build: drop remaining ssdt_misc t
From: |
Igor Mammedov |
Subject: |
[Qemu-devel] [PATCH v2 44/47] pc: acpi-build: drop remaining ssdt_misc template and use acpi_def_block() |
Date: |
Thu, 22 Jan 2015 14:50:28 +0000 |
It completes dynamic SSDT generation and makes it
independed of IASL binary blobs. It also hides
from user all pointer arithmetic when building
SSDT which makes resulting code a bit cleaner
and concentrating only on composing ASL construct
/i.e. a task build_ssdt() should be doing/.
Also it makes one binary blob less stored in QEMU
source tree by removing need to keep and update
hw/i386/ssdt-misc.hex.generated file here in total
saving us ~430LOC.
Signed-off-by: Igor Mammedov <address@hidden>
---
hw/i386/Makefile.objs | 2 +-
hw/i386/acpi-build.c | 32 ++--
hw/i386/ssdt-misc.dsl | 21 ---
hw/i386/ssdt-misc.hex.generated | 399 ----------------------------------------
4 files changed, 12 insertions(+), 442 deletions(-)
delete mode 100644 hw/i386/ssdt-misc.dsl
delete mode 100644 hw/i386/ssdt-misc.hex.generated
diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs
index 6c8705d..dc8c38a 100644
--- a/hw/i386/Makefile.objs
+++ b/hw/i386/Makefile.objs
@@ -8,7 +8,7 @@ obj-$(CONFIG_XEN) += ../xenpv/ xen/
obj-y += kvmvapic.o
obj-y += acpi-build.o
hw/i386/acpi-build.o: hw/i386/acpi-build.c hw/i386/acpi-dsdt.hex \
- hw/i386/ssdt-misc.hex hw/i386/q35-acpi-dsdt.hex \
+ hw/i386/q35-acpi-dsdt.hex \
hw/i386/ssdt-tpm.hex
iasl-option=$(shell if test -z "`$(1) $(2) 2>&1 > /dev/null`" \
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 5821528..5831450 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -268,7 +268,6 @@ static void acpi_get_pci_info(PcPciInfo *info)
#define ACPI_BUILD_APPNAME "Bochs"
#define ACPI_BUILD_APPNAME6 "BOCHS "
-#define ACPI_BUILD_APPNAME4 "BXPC"
#define ACPI_BUILD_RSDP_FILE "etc/acpi/rsdp"
#define ACPI_BUILD_TPMLOG_FILE "etc/tpm/log"
@@ -465,10 +464,6 @@ build_madt(GArray *table_data, GArray *linker, AcpiCpuInfo
*cpu,
table_data->len - madt_start, 1);
}
-#define ACPI_SSDT_SIGNATURE 0x54445353 /* SSDT */
-#define ACPI_SSDT_HEADER_LENGTH 36
-
-#include "hw/i386/ssdt-misc.hex"
#include "hw/i386/ssdt-tpm.hex"
/* Assign BSEL property to all buses. In the future, this can be changed
@@ -647,17 +642,14 @@ static void build_append_pci_bus_devices(AcpiAml
*parent_scope, PCIBus *bus,
}
static void
-build_ssdt(GArray *table_data, GArray *linker,
+build_ssdt(AcpiAml *table_aml, GArray *linker,
AcpiCpuInfo *cpu, AcpiPmInfo *pm, AcpiMiscInfo *misc,
PcPciInfo *pci, PcGuestInfo *guest_info)
{
MachineState *machine = MACHINE(qdev_get_machine());
uint32_t nr_mem = machine->ram_slots;
unsigned acpi_cpus = guest_info->apic_id_limit;
- int ssdt_start = table_data->len;
- AcpiAml table_aml = { .buf = table_data };
- uint8_t *ssdt_ptr;
- AcpiAml pkg, scope, dev, method, crs, field, ifctx;
+ AcpiAml pkg, scope, dev, method, crs, field, ifctx, ssdt;
int i;
/* The current AML generator can cover the APIC ID range [0..255],
@@ -665,9 +657,9 @@ build_ssdt(GArray *table_data, GArray *linker,
QEMU_BUILD_BUG_ON(ACPI_CPU_HOTPLUG_ID_LIMIT > 256);
g_assert(acpi_cpus <= ACPI_CPU_HOTPLUG_ID_LIMIT);
- /* Copy SSDT header */
- ssdt_ptr = acpi_data_push(table_data, sizeof(ssdp_misc_aml));
- memcpy(ssdt_ptr, ssdp_misc_aml, sizeof(ssdp_misc_aml));
+ /* Init SSDT Definition Block */
+ ssdt =
+ acpi_def_block("SSDT", 1, ACPI_BUILD_APPNAME6, ACPI_BUILD_APPNAME4, 1);
scope = acpi_scope("\\_SB.PCI0");
/* build PCI0._CRS */
@@ -719,7 +711,7 @@ build_ssdt(GArray *table_data, GArray *linker,
aml_append(&dev, acpi_name_decl("_CRS", crs));
aml_append(&scope, dev);
}
- aml_append(&table_aml, scope);
+ aml_append(&ssdt, scope);
/* create S3_ / S4_ / S5_ packages if necessary */
scope = acpi_scope("\\");
@@ -747,7 +739,7 @@ build_ssdt(GArray *table_data, GArray *linker,
aml_append(&pkg, acpi_int(0)); /* reserved */
aml_append(&pkg, acpi_int(0)); /* reserved */
aml_append(&scope, acpi_name_decl("_S5", pkg));
- aml_append(&table_aml, scope);
+ aml_append(&ssdt, scope);
if (misc->pvpanic_port) {
scope = acpi_scope("\\_SB.PCI0.ISA");
@@ -777,7 +769,7 @@ build_ssdt(GArray *table_data, GArray *linker,
aml_append(&dev, method);
aml_append(&scope, dev);
- aml_append(&table_aml, scope);
+ aml_append(&ssdt, scope);
}
{
@@ -972,12 +964,10 @@ build_ssdt(GArray *table_data, GArray *linker,
aml_append(&sb_scope, scope);
}
}
- aml_append(&table_aml, sb_scope);
+ aml_append(&ssdt, sb_scope);
}
- build_header(linker, table_data,
- (void *)(table_data->data + ssdt_start),
- "SSDT", table_data->len - ssdt_start, 1);
+ aml_append(table_aml, ssdt);
}
static void
@@ -1379,7 +1369,7 @@ void acpi_build(PcGuestInfo *guest_info, AcpiBuildTables
*tables)
ssdt = tables->table_data.buf->len;
acpi_add_table(table_offsets, tables->table_data.buf);
- build_ssdt(tables->table_data.buf, tables->linker, &cpu, &pm, &misc, &pci,
+ build_ssdt(&tables->table_data, tables->linker, &cpu, &pm, &misc, &pci,
guest_info);
aml_len += tables->table_data.buf->len - ssdt;
diff --git a/hw/i386/ssdt-misc.dsl b/hw/i386/ssdt-misc.dsl
deleted file mode 100644
index 8d61f21..0000000
--- a/hw/i386/ssdt-misc.dsl
+++ /dev/null
@@ -1,21 +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 <http://www.gnu.org/licenses/>.
- */
-#include "hw/acpi/pc-hotplug.h"
-
-ACPI_EXTRACT_ALL_CODE ssdp_misc_aml
-
-DefinitionBlock ("ssdt-misc.aml", "SSDT", 0x01, "BXPC", "BXSSDTSUSP", 0x1)
-{
-}
diff --git a/hw/i386/ssdt-misc.hex.generated b/hw/i386/ssdt-misc.hex.generated
deleted file mode 100644
index cbcf61d..0000000
--- a/hw/i386/ssdt-misc.hex.generated
+++ /dev/null
@@ -1,399 +0,0 @@
-static unsigned char acpi_pci64_length[] = {
-0x6f
-};
-static unsigned char acpi_s4_pkg[] = {
-0x99
-};
-static unsigned char ssdt_mctrl_nr_slots[] = {
-0x7d
-};
-static unsigned char acpi_s3_name[] = {
-0x86
-};
-static unsigned char acpi_pci32_start[] = {
-0x2f
-};
-static unsigned char acpi_pci64_valid[] = {
-0x43
-};
-static unsigned char ssdp_misc_aml[] = {
-0x53,
-0x53,
-0x44,
-0x54,
-0x6c,
-0x1,
-0x0,
-0x0,
-0x1,
-0x3,
-0x42,
-0x58,
-0x50,
-0x43,
-0x0,
-0x0,
-0x42,
-0x58,
-0x53,
-0x53,
-0x44,
-0x54,
-0x53,
-0x55,
-0x1,
-0x0,
-0x0,
-0x0,
-0x49,
-0x4e,
-0x54,
-0x4c,
-0x28,
-0x8,
-0x14,
-0x20,
-0x10,
-0x4c,
-0x5,
-0x5c,
-0x0,
-0x8,
-0x50,
-0x30,
-0x53,
-0x5f,
-0xc,
-0x78,
-0x56,
-0x34,
-0x12,
-0x8,
-0x50,
-0x30,
-0x45,
-0x5f,
-0xc,
-0x78,
-0x56,
-0x34,
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1,
-0x50,
-0x45,
-0x53,
-0x54,
-0x1,
-0x5b,
-0x81,
-0xb,
-0x50,
-0x45,
-0x4f,
-0x52,
-0x1,
-0x50,
-0x45,
-0x50,
-0x54,
-0x8,
-0x14,
-0x18,
-0x5f,
-0x53,
-0x54,
-0x41,
-0x0,
-0x70,
-0x50,
-0x45,
-0x53,
-0x54,
-0x60,
-0xa0,
-0x6,
-0x93,
-0x60,
-0x0,
-0xa4,
-0x0,
-0xa1,
-0x4,
-0xa4,
-0xa,
-0xf,
-0x14,
-0xe,
-0x52,
-0x44,
-0x50,
-0x54,
-0x0,
-0x70,
-0x50,
-0x45,
-0x50,
-0x54,
-0x60,
-0xa4,
-0x60,
-0x14,
-0xc,
-0x57,
-0x52,
-0x50,
-0x54,
-0x1,
-0x70,
-0x68,
-0x50,
-0x45,
-0x50,
-0x54,
-0x8,
-0x5f,
-0x43,
-0x52,
-0x53,
-0x11,
-0xd,
-0xa,
-0xa,
-0x47,
-0x1,
-0x0,
-0x0,
-0x0,
-0x0,
-0x1,
-0x1,
-0x79,
-0x0,
-0x8b,
-0x5f,
-0x43,
-0x52,
-0x53,
-0xa,
-0x2,
-0x49,
-0x4f,
-0x4d,
-0x4e,
-0x8b,
-0x5f,
-0x43,
-0x52,
-0x53,
-0xa,
-0x4,
-0x49,
-0x4f,
-0x4d,
-0x58,
-0x14,
-0x18,
-0x5f,
-0x49,
-0x4e,
-0x49,
-0x0,
-0x70,
-0x50,
-0x45,
-0x53,
-0x54,
-0x49,
-0x4f,
-0x4d,
-0x4e,
-0x70,
-0x50,
-0x45,
-0x53,
-0x54,
-0x49,
-0x4f,
-0x4d,
-0x58
-};
-static unsigned char ssdt_isa_pest[] = {
-0xda
-};
-static unsigned char acpi_s4_name[] = {
-0x92
-};
-static unsigned char acpi_pci64_start[] = {
-0x4d
-};
-static unsigned char acpi_pci64_end[] = {
-0x5e
-};
-static unsigned char acpi_pci32_end[] = {
-0x39
-};
--
1.8.3.1
- [Qemu-devel] [PATCH v2 36/47] pc: acpi-build: drop template patching and memory hotplug objects dynamically, (continued)
- [Qemu-devel] [PATCH v2 36/47] pc: acpi-build: drop template patching and memory hotplug objects dynamically, Igor Mammedov, 2015/01/22
- [Qemu-devel] [PATCH v2 32/47] acpi: add acpi_eisaid() term, Igor Mammedov, 2015/01/22
- [Qemu-devel] [PATCH v2 34/47] pc: acpi-build: create CPU hotplug IO region dynamically, Igor Mammedov, 2015/01/22
- [Qemu-devel] [PATCH v2 37/47] pc: acpi-build: create memory hotplug IO region dynamically, Igor Mammedov, 2015/01/22
- [Qemu-devel] [PATCH v2 30/47] acpi: add acpi_equal() term, Igor Mammedov, 2015/01/22
- [Qemu-devel] [PATCH v2 38/47] acpi: add acpi_word_bus_number(), acpi_word_io(), acpi_dword_memory(), acpi_qword_memory() terms, Igor Mammedov, 2015/01/22
- [Qemu-devel] [PATCH v2 39/47] pc: pcihp: expose MMIO base and len as properties, Igor Mammedov, 2015/01/22
- [Qemu-devel] [PATCH v2 42/47] acpi: add acpi_def_block() term, Igor Mammedov, 2015/01/22
- [Qemu-devel] [PATCH v2 40/47] pc: acpi-build: reserve PCIHP MMIO resources, Igor Mammedov, 2015/01/22
- [Qemu-devel] [PATCH v2 41/47] pc: acpi-build: create PCI0._CRS dynamically, Igor Mammedov, 2015/01/22
- [Qemu-devel] [PATCH v2 44/47] pc: acpi-build: drop remaining ssdt_misc template and use acpi_def_block(),
Igor Mammedov <=
- [Qemu-devel] [PATCH v2 45/47] acpi: add acpi_iqr_no_flags() term, Igor Mammedov, 2015/01/22
- [Qemu-devel] [PATCH v2 46/47] pc: export applesmc IO port/len, Igor Mammedov, 2015/01/22
- [Qemu-devel] [PATCH v2 43/47] pc: acpi-build: prepare to make ACPI tables blob opaque for table building functions, Igor Mammedov, 2015/01/22
- [Qemu-devel] [PATCH v2 47/47] pc: acpi-build: drop template patching and create Device(SMC) dynamically, Igor Mammedov, 2015/01/22
- [Qemu-devel] [PATCH v2 17/47] acpi: add acpi_package() term, Igor Mammedov, 2015/01/22
- [Qemu-devel] [PATCH v2 06/47] acpi: add acpi_name() & acpi_name_decl() term, Igor Mammedov, 2015/01/22