From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45067) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XkEFp-0006ow-0r for qemu-devel@nongnu.org; Fri, 31 Oct 2014 11:38:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XjtlZ-0003IQ-N0 for qemu-devel@nongnu.org; Thu, 30 Oct 2014 13:44:15 -0400 Received: from mail-ee0-f44.google.com ([74.125.83.44]:60475) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XjtlZ-0003HH-DT for qemu-devel@nongnu.org; Thu, 30 Oct 2014 13:44:09 -0400 Received: by mail-ee0-f44.google.com with SMTP id e49so7903eek.31 for ; Thu, 30 Oct 2014 10:44:08 -0700 (PDT) From: Alexander Spyridakis Date: Thu, 30 Oct 2014 18:44:00 +0100 Message-Id: <1414691045-4793-3-git-send-email-a.spyridakis@virtualopensystems.com> In-Reply-To: <1414691045-4793-1-git-send-email-a.spyridakis@virtualopensystems.com> References: <1414691045-4793-1-git-send-email-a.spyridakis@virtualopensystems.com> Subject: [Qemu-devel] [RFC PATCH 2/7] hw/arm/virt-acpi: Basic skeleton for dynamic generation of ACPI tables List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, peter.maydell@linaro.org Cc: tech@virtualopensystems.com, linaro-acpi@lists.linaro.org 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 Signed-off-by: Alvise Rigo --- 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 . + */ + +#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 . + */ +#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