From: Eduardo Habkost <ehabkost@redhat.com>
To: qemu-devel@nongnu.org
Cc: Igor Mammedov <imammedo@redhat.com>,
Marcel Apfelbaum <marcel.a@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: [Qemu-devel] [PATCH 04/13] acpi: Move DSDT info to PCMachineClass
Date: Wed, 2 Dec 2015 20:22:49 -0200 [thread overview]
Message-ID: <1449094978-22986-5-git-send-email-ehabkost@redhat.com> (raw)
In-Reply-To: <1449094978-22986-1-git-send-email-ehabkost@redhat.com>
Remove direct dependency on q35-acpi-dsdt.hex and acpi-dsdt.hex
from acpi-build.c.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
hw/i386/acpi-build.c | 35 +++++++----------------------------
hw/i386/pc_piix.c | 4 ++++
hw/i386/pc_q35.c | 4 ++++
include/hw/i386/pc.h | 2 ++
4 files changed, 17 insertions(+), 28 deletions(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index a595575..4677e97 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -51,9 +51,6 @@
#include "hw/pci-host/q35.h"
#include "hw/i386/intel_iommu.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"
@@ -108,8 +105,6 @@ typedef struct AcpiPmInfo {
typedef struct AcpiMiscInfo {
bool has_hpet;
TPMVersion tpm_version;
- const unsigned char *dsdt_code;
- unsigned dsdt_size;
uint16_t pvpanic_port;
uint16_t applesmc_io_base;
} AcpiMiscInfo;
@@ -121,22 +116,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->dsdt_code = AcpiDsdtAmlCode;
- info->dsdt_size = sizeof AcpiDsdtAmlCode;
- }
- if (lpc) {
- info->dsdt_code = Q35AcpiDsdtAmlCode;
- info->dsdt_size = sizeof Q35AcpiDsdtAmlCode;
- }
-}
-
static
int acpi_add_cpu_info(Object *o, void *opaque)
{
@@ -1570,18 +1549,19 @@ 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, PCMachineState *pcms)
{
+ PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms);
AcpiTableHeader *dsdt;
- assert(misc->dsdt_code && misc->dsdt_size);
+ assert(pcmc->dsdt_code && pcmc->dsdt_size);
- dsdt = acpi_data_push(table_data, misc->dsdt_size);
- memcpy(dsdt, misc->dsdt_code, misc->dsdt_size);
+ dsdt = acpi_data_push(table_data, pcmc->dsdt_size);
+ memcpy(dsdt, pcmc->dsdt_code, pcmc->dsdt_size);
memset(dsdt, 0, sizeof *dsdt);
build_header(linker, table_data, dsdt, "DSDT",
- misc->dsdt_size, 1);
+ pcmc->dsdt_size, 1);
}
static GArray *
@@ -1668,7 +1648,6 @@ void acpi_build(PCMachineState *pcms, 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, pcms);
@@ -1690,7 +1669,7 @@ void acpi_build(PCMachineState *pcms, 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, pcms);
/* Count the size of the DSDT and SSDT, we will need it for legacy
* sizing of ACPI tables.
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index f0c2dc8..f4e03b5 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -53,6 +53,7 @@
#include "hw/xen/xen_pt.h"
#endif
#include "migration/migration.h"
+#include "hw/i386/acpi-dsdt.hex"
#define MAX_IDE_BUS 2
@@ -402,11 +403,14 @@ static void pc_xen_hvm_init(MachineState *machine)
static void pc_i440fx_machine_options(MachineClass *m)
{
+ PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
m->family = "pc_piix";
m->desc = "Standard PC (i440FX + PIIX, 1996)";
m->hot_add_cpu = pc_hot_add_cpu;
m->default_machine_opts = "firmware=bios-256k.bin";
m->default_display = "std";
+ pcmc->dsdt_code = AcpiDsdtAmlCode;
+ pcmc->dsdt_size = sizeof AcpiDsdtAmlCode;
}
static void pc_i440fx_2_5_machine_options(MachineClass *m)
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 317d36a..37d4e8c 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -45,6 +45,7 @@
#include "hw/usb.h"
#include "qemu/error-report.h"
#include "migration/migration.h"
+#include "hw/i386/q35-acpi-dsdt.hex"
/* ICH9 AHCI has 6 ports */
#define MAX_SATA_PORTS 6
@@ -328,6 +329,7 @@ static void pc_compat_1_4(MachineState *machine)
static void pc_q35_machine_options(MachineClass *m)
{
+ PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
m->family = "pc_q35";
m->desc = "Standard PC (Q35 + ICH9, 2009)";
m->hot_add_cpu = pc_hot_add_cpu;
@@ -336,6 +338,8 @@ static void pc_q35_machine_options(MachineClass *m)
m->default_display = "std";
m->no_floppy = 1;
m->no_tco = 0;
+ pcmc->dsdt_code = Q35AcpiDsdtAmlCode;
+ pcmc->dsdt_size = sizeof Q35AcpiDsdtAmlCode;
}
static void pc_q35_2_5_machine_options(MachineClass *m)
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 8b184c1..e09fb98 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -89,6 +89,8 @@ struct PCMachineClass {
*/
unsigned acpi_data_size;
bool enforce_aligned_dimm;
+ const unsigned char *dsdt_code;
+ unsigned dsdt_size;
};
#define TYPE_PC_MACHINE "generic-pc-machine"
--
2.1.0
next prev parent reply other threads:[~2015-12-03 14:12 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-02 22:22 [Qemu-devel] [PATCH 00/13] acpi: Make piix-specific and q35-specific code generic Eduardo Habkost
2015-12-02 22:22 ` [Qemu-devel] [PATCH 01/13] pc: Add PCMachineState::pci_host field Eduardo Habkost
2015-12-03 15:35 ` Marcel Apfelbaum
2015-12-03 16:35 ` Eduardo Habkost
2015-12-02 22:22 ` [Qemu-devel] [PATCH 02/13] acpi: Remove unnecessary check for NULL pci_host Eduardo Habkost
2015-12-02 22:22 ` [Qemu-devel] [PATCH 03/13] acpi: Eliminate acpi_get_i386_pci_host() function Eduardo Habkost
2015-12-02 22:22 ` Eduardo Habkost [this message]
2015-12-02 22:22 ` [Qemu-devel] [PATCH 05/13] acpi: Simplify s3/s4 property querying Eduardo Habkost
2015-12-02 22:22 ` [Qemu-devel] [PATCH 06/13] acpi: Use &error_abort when getting PCI hotplug properties Eduardo Habkost
2015-12-02 22:22 ` [Qemu-devel] [PATCH 07/13] acpi: Use QOM property to get CPU hotplug I/O base Eduardo Habkost
2015-12-02 22:22 ` [Qemu-devel] [PATCH 08/13] acpi: Always try to init PCI " Eduardo Habkost
2015-12-02 22:22 ` [Qemu-devel] [PATCH 09/13] acpi: Use PCMachineState::acpi_dev to get ACPI dev Eduardo Habkost
2015-12-02 22:22 ` [Qemu-devel] [PATCH 10/13] acpi: Change acpi_pci_hotplug_enabled() argument to PCMachineState Eduardo Habkost
2015-12-02 22:22 ` [Qemu-devel] [PATCH 11/13] acpi: Don't use find_i440fx() when setting bsel properties Eduardo Habkost
2015-12-02 22:22 ` [Qemu-devel] [PATCH 12/13] intel_iommu.h: Missing sysbus.h include Eduardo Habkost
2015-12-02 22:22 ` [Qemu-devel] [PATCH 13/13] acpi: Don't include q35 and piix headers Eduardo Habkost
2015-12-03 15:19 ` [Qemu-devel] [PATCH 00/13] acpi: Make piix-specific and q35-specific code generic Igor Mammedov
2015-12-03 17:16 ` Eduardo Habkost
2015-12-04 13:24 ` Igor Mammedov
2015-12-04 14:08 ` Eduardo Habkost
2015-12-07 15:31 ` Marcel Apfelbaum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1449094978-22986-5-git-send-email-ehabkost@redhat.com \
--to=ehabkost@redhat.com \
--cc=imammedo@redhat.com \
--cc=marcel.a@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).