[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 16/26] hw: fw-build: Add firmware build methods and
From: |
Samuel Ortiz |
Subject: |
[Qemu-devel] [PATCH 16/26] hw: fw-build: Add firmware build methods and state |
Date: |
Mon, 22 Oct 2018 20:36:46 +0200 |
In order to decouple ACPI APIs from specific machine types, we are
adding granular firmware build methods to the generic MachineClass
structure. This way, a new machine type can re-use the high level ACPI
APIs and define some custom table build methods, without having to
duplicate most of the existing implementation only to add small
variations to it.
Cc: Eduardo Habkost <address@hidden>
Cc: Marcel Apfelbaum <address@hidden>
Signed-off-by: Samuel Ortiz <address@hidden>
---
include/hw/boards.h | 5 ++++
include/hw/fw-build.h | 57 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 62 insertions(+)
create mode 100644 include/hw/fw-build.h
diff --git a/include/hw/boards.h b/include/hw/boards.h
index f82f28468b..a5c8fe6ed2 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -5,6 +5,7 @@
#include "sysemu/blockdev.h"
#include "sysemu/accel.h"
+#include "hw/fw-build.h"
#include "hw/qdev.h"
#include "qom/object.h"
#include "qom/cpu.h"
@@ -214,6 +215,8 @@ struct MachineClass {
unsigned cpu_index);
const CPUArchIdList *(*possible_cpu_arch_ids)(MachineState *machine);
int64_t (*get_default_cpu_node_id)(const MachineState *ms, int idx);
+
+ FirmwareBuildMethods firmware_build_methods;
};
/**
@@ -269,6 +272,8 @@ struct MachineState {
const char *cpu_type;
AccelState *accelerator;
CPUArchIdList *possible_cpus;
+
+ FirmwareBuildState firmware_build_state;
};
#define DEFINE_MACHINE(namestr, machine_initfn) \
diff --git a/include/hw/fw-build.h b/include/hw/fw-build.h
new file mode 100644
index 0000000000..c02434d513
--- /dev/null
+++ b/include/hw/fw-build.h
@@ -0,0 +1,57 @@
+/*
+ *
+ * Copyright (c) 2018 Intel Corporation
+ *
+ * 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/>.
+ */
+
+#ifndef FW_BUILD_H
+#define FW_BUILD_H
+
+#include "hw/acpi/bios-linker-loader.h"
+
+typedef struct AcpiConfiguration AcpiConfiguration;
+typedef struct AcpiBuildState AcpiBuildState;
+typedef struct AcpiMcfgInfo AcpiMcfgInfo;
+
+typedef struct FirmwareBuildMethods {
+ union {
+ /* ACPI methods */
+ struct {
+ GArray *(*rsdp)(GArray *table_data, BIOSLinker *linker,
+ unsigned rsdt_tbl_offset);
+ GArray *(*madt)(GArray *table_data, BIOSLinker *linker,
+ MachineState *ms, AcpiConfiguration *conf);
+ void (*mcfg)(GArray *table_data, BIOSLinker *linker,
+ AcpiMcfgInfo *info);
+ void (*srat)(GArray *table_data, BIOSLinker *linker,
+ MachineState *machine, AcpiConfiguration *conf);
+ void (*slit)(GArray *table_data, BIOSLinker *linker);
+
+ /* Overall ACPI table setup function */
+ void (*setup)(MachineState *ms, AcpiConfiguration *conf);
+ } acpi;
+ };
+} FirmwareBuildMethods;
+
+typedef struct FirmwareBuildState {
+ union {
+ /* ACPI state and configuration */
+ struct {
+ AcpiConfiguration *conf;
+ AcpiBuildState *state;
+ } acpi;
+ };
+} FirmwareBuildState;
+
+#endif
--
2.17.2
- [Qemu-devel] [PATCH 05/26] hw: acpi: Generalize AML build routines, (continued)
- [Qemu-devel] [PATCH 05/26] hw: acpi: Generalize AML build routines, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 07/26] hw: i386: Refactor PCI host getter, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 11/26] hw: i386: Make the hotpluggable memory size property more generic, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 13/26] hw: acpi: Fix memory hotplug AML generation error, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 10/26] hw: acpi: Do not create hotplug method when handler is not defined, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 12/26] hw: acpi: Export the SRAT AML build API, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 09/26] hw: acpi: Export the MCFG getter, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 08/26] hw: acpi: Export and generalize the PCI host AML API, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 14/26] hw: acpi: Export the PCI hotplug API, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 15/26] hw: acpi: Retrieve the PCI bus from AcpiPciHpState, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 16/26] hw: fw-build: Add firmware build methods and state,
Samuel Ortiz <=
- [Qemu-devel] [PATCH 17/26] hw: i386: Convert PC machine type to firmware build methods, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 19/26] hw: acpi: reduced: Add MCFG support, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 18/26] hw: acpi: Initial hardware-reduced support, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 20/26] hw: acpi: reduced: Generic Event Device support, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 21/26] hw: acpi: reduced: Add memory hotplug support, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 24/26] hw: acpi: reduced: Add SRAT table, Samuel Ortiz, 2018/10/22