[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH 2/7] hw/arm/virt-acpi: Basic skeleton for dynami
From: |
Alexander Spyridakis |
Subject: |
[Qemu-devel] [RFC PATCH 2/7] hw/arm/virt-acpi: Basic skeleton for dynamic generation of ACPI tables |
Date: |
Thu, 30 Oct 2014 18:44:00 +0100 |
Introduce a preliminary skeleton in virt-acpi.c with the main
ACPI build functions. The virt machine model is meant to call
'acpi_build_tables' after platform devices are created and pass
all needed information. From that point each table will be
created in a separate memory buffer and finally be copied
to the guest memory as a single binary blob.
The minimum required ACPI v5.1 tables for ARM are:
- RSDP: Initial table that points to XSDT
- XSDT: Points to all other tables (except FACS & DSDT)
- FADT: Generic information about the machine
- DSDT: Holds all information about system devices/peripherals
- FACS: Needs to be pointed from FADT
Signed-off-by: Alexander Spyridakis <address@hidden>
Signed-off-by: Alvise Rigo <address@hidden>
---
hw/arm/Makefile.objs | 2 +-
hw/arm/virt-acpi.c | 84 ++++++++++++++++++++++++++++++++++++++++++++++
include/hw/arm/virt-acpi.h | 52 ++++++++++++++++++++++++++++
3 files changed, 137 insertions(+), 1 deletion(-)
create mode 100644 hw/arm/virt-acpi.c
create mode 100644 include/hw/arm/virt-acpi.h
diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs
index 6088e53..7cffb25 100644
--- a/hw/arm/Makefile.objs
+++ b/hw/arm/Makefile.objs
@@ -2,7 +2,7 @@ obj-y += boot.o collie.o exynos4_boards.o gumstix.o highbank.o
obj-$(CONFIG_DIGIC) += digic_boards.o
obj-y += integratorcp.o kzm.o mainstone.o musicpal.o nseries.o
obj-y += omap_sx1.o palm.o realview.o spitz.o stellaris.o
-obj-y += tosa.o versatilepb.o vexpress.o virt.o xilinx_zynq.o z2.o
+obj-y += tosa.o versatilepb.o vexpress.o virt.o virt-acpi.o xilinx_zynq.o z2.o
obj-y += armv7m.o exynos4210.o pxa2xx.o pxa2xx_gpio.o pxa2xx_pic.o
obj-$(CONFIG_DIGIC) += digic.o
diff --git a/hw/arm/virt-acpi.c b/hw/arm/virt-acpi.c
new file mode 100644
index 0000000..5c8df45
--- /dev/null
+++ b/hw/arm/virt-acpi.c
@@ -0,0 +1,84 @@
+/*
+ * ARM virt ACPI generation
+ *
+ * Copyright (c) 2014 Virtual Open Systems
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2 or later, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope 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/arm/virt-acpi.h"
+
+static void *acpi_table[NUM_ACPI_TABLES];
+static int acpi_size[NUM_ACPI_TABLES];
+
+static void acpi_create_rsdp(void)
+{
+ acpi_table[RSDP] = NULL;
+ acpi_size[RSDP] = 0;
+}
+
+static void acpi_create_xsdt(void)
+{
+ acpi_table[XSDT] = NULL;
+ acpi_size[XSDT] = 0;
+}
+
+static void acpi_create_madt(uint32_t smp_cpus,
+ const struct acpi_madt_info *info)
+{
+ acpi_table[MADT] = NULL;
+ acpi_size[MADT] = 0;
+}
+
+static void acpi_create_gtdt(const struct acpi_gtdt_info *irqs)
+{
+ acpi_table[GTDT] = NULL;
+ acpi_size[GTDT] = 0;
+}
+
+static void acpi_create_fadt(void)
+{
+ acpi_table[FADT] = NULL;
+ acpi_size[FADT] = 0;
+}
+
+static void acpi_create_facs(void)
+{
+ acpi_table[FACS] = NULL;
+ acpi_size[FACS] = 0;
+}
+
+static void acpi_create_dsdt(int smp_cpus, const struct acpi_dsdt_info *info)
+{
+ acpi_table[DSDT] = NULL;
+ acpi_size[DSDT] = 0;
+}
+
+void acpi_build_tables(int smp_cpus,
+ const struct acpi_gtdt_info *gtdt_info,
+ const struct acpi_madt_info *madt_info,
+ const struct acpi_dsdt_info *dsdt_info)
+{
+ acpi_create_madt(smp_cpus, madt_info);
+ acpi_create_gtdt(gtdt_info);
+ acpi_create_rsdp();
+ acpi_create_facs();
+ acpi_create_xsdt();
+ acpi_create_fadt();
+ acpi_create_dsdt(smp_cpus, dsdt_info);
+}
+
+uint32_t acpi_make_blob(void **blob_ptr)
+{
+ return 0;
+}
diff --git a/include/hw/arm/virt-acpi.h b/include/hw/arm/virt-acpi.h
new file mode 100644
index 0000000..5098118
--- /dev/null
+++ b/include/hw/arm/virt-acpi.h
@@ -0,0 +1,52 @@
+/*
+ *
+ * Copyright (c) 2014 Virtual Open Systems
+ *
+ * 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/>.
+ */
+#ifndef QEMU_VIRT_ACPI_BUILD_H
+#define QEMU_VIRT_ACPI_BUILD_H
+
+#include "qemu-common.h"
+#include "hw/acpi/acpi-defs.h"
+
+#define NUM_ACPI_TABLES 7
+
+enum {
+ RSDP,
+ XSDT,
+ MADT,
+ GTDT,
+ /* New tables should be added before FADT */
+ FADT,
+ FACS,
+ DSDT,
+};
+
+struct acpi_gtdt_info {
+};
+
+struct acpi_madt_info {
+};
+
+struct acpi_dsdt_info {
+};
+
+void acpi_build_tables(int smp_cpus,
+ const struct acpi_gtdt_info *gtdt_info,
+ const struct acpi_madt_info *madt_info,
+ const struct acpi_dsdt_info *dsdt_info);
+uint32_t acpi_make_blob(void **blob_ptr);
+
+#endif
--
1.9.1