diff mbox

[FYI,07/13] hw/acpi: introduce the AcpiQemuParamTable structure

Message ID 1442148227-17343-8-git-send-email-lersek@redhat.com
State New
Headers show

Commit Message

Laszlo Ersek Sept. 13, 2015, 12:43 p.m. UTC
This ACPI table is supposed to carry various parameters for OSPM. We
introduce it with a single parameter field, "vmgenid_addr_base_ptr", which
is described as ADBP / "ADDR base pointer" in "docs/vmgenid.txt" (along
with the general structure of the table).

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Gal Hammer <ghammer@redhat.com>
Cc: Igor Mammedov <imammedo@redhat.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 include/hw/acpi/vmgenid.h | 72 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 72 insertions(+)
 create mode 100644 include/hw/acpi/vmgenid.h
diff mbox

Patch

diff --git a/include/hw/acpi/vmgenid.h b/include/hw/acpi/vmgenid.h
new file mode 100644
index 0000000..07e813a
--- /dev/null
+++ b/include/hw/acpi/vmgenid.h
@@ -0,0 +1,72 @@ 
+/*
+ * ACPI definitions related to the VMGENID device (see "docs/vmgenid.txt").
+ *
+ * Copyright (C) 2015 Red Hat, Inc.
+ *
+ * Authors:
+ *   Laszlo Ersek <lersek@redhat.com>
+ *
+ * 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 HW_ACPI_VMGENID_H
+#define HW_ACPI_VMGENID_H
+
+#include "hw/acpi/acpi-defs.h"
+
+#define ACPI_UEFI_IDENT_SIZE 16
+
+struct AcpiQemuParamTable {
+    /* ACPI common table header */
+    ACPI_TABLE_HEADER_DEF
+
+    /*
+     * UEFI ACPI Data Table Sub-Header.
+     *
+     * The "UEFI" signature is reserved for this table header starting with
+     * ACPI 4.0. The header structure is described in the UEFI Specification,
+     * version 2.3 or later, in Appendix O.
+
+     * These fields are harmless for SeaBIOS, but ensure unicity in OVMF
+     * ("UEFI" is a multi-instance table type).
+     */
+    uint8_t identifier[ACPI_UEFI_IDENT_SIZE];
+    uint16_t data_offset;
+
+    /* QEMU-specific fields start here. */
+
+    /* Base pointer for the VMGENID device's ADDR control method. */
+    uint64_t vmgenid_addr_base_ptr;
+} QEMU_PACKED;
+typedef struct AcpiQemuParamTable AcpiQemuParamTable;
+
+/* Aggregate initializer for "AcpiQemuParamTable.identifier". */
+#define QEMU_PARAM_TABLE_GUID { 0xFF, 0x5D, 0x7A, 0x41, 0x4B, 0xBF, 0xBC, 0x4A, \
+                                0xA8, 0x39, 0x65, 0x93, 0xBB, 0x41, 0xF4, 0x52 }
+
+/*
+ * This offset points into the fw_cfg blob that contains both
+ * AcpiQemuParamTable and the "live" generation ID after it. The offset points
+ * at the generation ID field, skipping over the "OVMF SDT Header probe
+ * suppressor" and "VMGenID alignment padding" fields in the blob (which are
+ * located right after AcpiQemuParamTable).
+ *
+ * This is an integer constant expression.
+ */
+#define VM_GENERATION_ID_OFFSET \
+    ROUND_UP(sizeof(AcpiQemuParamTable) + sizeof(AcpiTableHeader), 8)
+
+#define VM_GENERATION_ID_SIZE 16
+
+#endif /* HW_ACPI_VMGENID_H */