thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
9ae3a8
From 0decede8a51451da8f5913b0ad13c8e3bdcef582 Mon Sep 17 00:00:00 2001
9ae3a8
From: Laszlo Ersek <lersek@redhat.com>
9ae3a8
Date: Wed, 11 May 2016 12:33:45 +0200
9ae3a8
Subject: [PATCH 06/10] acpi: take oem_id in build_header(), optionally
9ae3a8
9ae3a8
RH-Author: Laszlo Ersek <lersek@redhat.com>
9ae3a8
Message-id: <1462970028-10959-5-git-send-email-lersek@redhat.com>
9ae3a8
Patchwork-id: 70381
9ae3a8
O-Subject: [RHEL-7.3 qemu-kvm PATCH v2 4/7] acpi: take oem_id in build_header(), optionally
9ae3a8
Bugzilla: 1330969
9ae3a8
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
9ae3a8
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
9ae3a8
RH-Acked-by: Thomas Huth <thuth@redhat.com>
9ae3a8
9ae3a8
This patch is the continuation of commit 8870ca0e94f2 ("acpi: support
9ae3a8
specified oem table id for build_header"). It will allow us to control the
9ae3a8
OEM ID field too in the SDT header.
9ae3a8
9ae3a8
Cc: "Michael S. Tsirkin" <mst@redhat.com> (supporter:ACPI/SMBIOS)
9ae3a8
Cc: Igor Mammedov <imammedo@redhat.com> (supporter:ACPI/SMBIOS)
9ae3a8
Cc: Xiao Guangrong <guangrong.xiao@linux.intel.com> (maintainer:NVDIMM)
9ae3a8
Cc: Shannon Zhao <zhaoshenglong@huawei.com> (maintainer:ARM ACPI Subsystem)
9ae3a8
Cc: Paolo Bonzini <pbonzini@redhat.com> (maintainer:X86)
9ae3a8
Cc: Richard W.M. Jones <rjones@redhat.com>
9ae3a8
Cc: Aleksei Kovura <alex3kov@zoho.com>
9ae3a8
Cc: Michael Tokarev <mjt@tls.msk.ru>
9ae3a8
Cc: Steven Newbury <steve@snewbury.org.uk>
9ae3a8
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1248758
9ae3a8
LP: https://bugs.launchpad.net/qemu/+bug/1533848
9ae3a8
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9ae3a8
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9ae3a8
Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org>
9ae3a8
(cherry picked from commit 37ad223c515da2fe9f1c679768cb5ccaa42e57e1)
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
9ae3a8
Conflicts:
9ae3a8
	hw/acpi/aml-build.c
9ae3a8
	hw/acpi/nvdimm.c
9ae3a8
	hw/arm/virt-acpi-build.c
9ae3a8
	hw/i386/acpi-build.c
9ae3a8
	include/hw/acpi/aml-build.h
9ae3a8
9ae3a8
RHEL-7 backport note: this is actually a manual reimplementation of the
9ae3a8
upstream patch, which is mostly mechanic. A clean cherry-pick would depend
9ae3a8
on a lot of reorganizatorial upstream patches (e.g., 658c27181bf3
9ae3a8
("hw/i386/acpi-build: move generic acpi building helpers into dedictated
9ae3a8
file")), and many new features that overlap with ACPI generation (e.g.,
9ae3a8
the "virt" machtype of the arm/aarch64 targets).
9ae3a8
9ae3a8
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
---
9ae3a8
 hw/i386/acpi-build.c | 25 +++++++++++++++----------
9ae3a8
 1 file changed, 15 insertions(+), 10 deletions(-)
9ae3a8
---
9ae3a8
 hw/i386/acpi-build.c | 25 +++++++++++++++----------
9ae3a8
 1 file changed, 15 insertions(+), 10 deletions(-)
9ae3a8
9ae3a8
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
9ae3a8
index a9d9f97..4839b0e 100644
9ae3a8
--- a/hw/i386/acpi-build.c
9ae3a8
+++ b/hw/i386/acpi-build.c
9ae3a8
@@ -244,12 +244,17 @@ static void acpi_get_pci_info(PcPciInfo *info)
9ae3a8
 static void
9ae3a8
 build_header(GArray *linker, GArray *table_data,
9ae3a8
              AcpiTableHeader *h, const char *sig, int len, uint8_t rev,
9ae3a8
-             const char *oem_table_id)
9ae3a8
+             const char *oem_id, const char *oem_table_id)
9ae3a8
 {
9ae3a8
     memcpy(&h->signature, sig, 4);
9ae3a8
     h->length = cpu_to_le32(len);
9ae3a8
     h->revision = rev;
9ae3a8
-    memcpy(h->oem_id, ACPI_BUILD_APPNAME6, 6);
9ae3a8
+
9ae3a8
+    if (oem_id) {
9ae3a8
+        strncpy((char *)h->oem_id, oem_id, sizeof h->oem_id);
9ae3a8
+    } else {
9ae3a8
+        memcpy(h->oem_id, ACPI_BUILD_APPNAME6, 6);
9ae3a8
+    }
9ae3a8
 
9ae3a8
     if (oem_table_id) {
9ae3a8
         strncpy((char *)h->oem_table_id, oem_table_id, sizeof(h->oem_table_id));
9ae3a8
@@ -527,7 +532,7 @@ build_fadt(GArray *table_data, GArray *linker, AcpiPmInfo *pm,
9ae3a8
     fadt_setup(fadt, pm);
9ae3a8
 
9ae3a8
     build_header(linker, table_data,
9ae3a8
-                 (void *)fadt, "FACP", sizeof(*fadt), 1, NULL);
9ae3a8
+                 (void *)fadt, "FACP", sizeof(*fadt), 1, NULL, NULL);
9ae3a8
 }
9ae3a8
 
9ae3a8
 static void
9ae3a8
@@ -597,7 +602,7 @@ build_madt(GArray *table_data, GArray *linker, AcpiCpuInfo *cpu,
9ae3a8
 
9ae3a8
     build_header(linker, table_data,
9ae3a8
                  (void *)(table_data->data + madt_start), "APIC",
9ae3a8
-                 table_data->len - madt_start, 1, NULL);
9ae3a8
+                 table_data->len - madt_start, 1, NULL, NULL);
9ae3a8
 }
9ae3a8
 
9ae3a8
 /* Encode a hex value */
9ae3a8
@@ -789,7 +794,7 @@ build_ssdt(GArray *table_data, GArray *linker,
9ae3a8
 
9ae3a8
     build_header(linker, table_data,
9ae3a8
                  (void *)(table_data->data + ssdt_start),
9ae3a8
-                 "SSDT", table_data->len - ssdt_start, 1, NULL);
9ae3a8
+                 "SSDT", table_data->len - ssdt_start, 1, NULL, NULL);
9ae3a8
 }
9ae3a8
 
9ae3a8
 static void
9ae3a8
@@ -804,7 +809,7 @@ build_hpet(GArray *table_data, GArray *linker)
9ae3a8
     hpet->timer_block_id = cpu_to_le32(0x8086a201);
9ae3a8
     hpet->addr.address = cpu_to_le64(HPET_BASE);
9ae3a8
     build_header(linker, table_data,
9ae3a8
-                 (void *)hpet, "HPET", sizeof(*hpet), 1, NULL);
9ae3a8
+                 (void *)hpet, "HPET", sizeof(*hpet), 1, NULL, NULL);
9ae3a8
 }
9ae3a8
 
9ae3a8
 static void
9ae3a8
@@ -897,7 +902,7 @@ build_srat(GArray *table_data, GArray *linker,
9ae3a8
     build_header(linker, table_data,
9ae3a8
                  (void *)(table_data->data + srat_start),
9ae3a8
                  "SRAT",
9ae3a8
-                 table_data->len - srat_start, 1, NULL);
9ae3a8
+                 table_data->len - srat_start, 1, NULL, NULL);
9ae3a8
 }
9ae3a8
 
9ae3a8
 static void
9ae3a8
@@ -926,7 +931,7 @@ build_mcfg_q35(GArray *table_data, GArray *linker, AcpiMcfgInfo *info)
9ae3a8
     } else {
9ae3a8
         sig = "MCFG";
9ae3a8
     }
9ae3a8
-    build_header(linker, table_data, (void *)mcfg, sig, len, 1, NULL);
9ae3a8
+    build_header(linker, table_data, (void *)mcfg, sig, len, 1, NULL, NULL);
9ae3a8
 }
9ae3a8
 
9ae3a8
 static void
9ae3a8
@@ -941,7 +946,7 @@ build_dsdt(GArray *table_data, GArray *linker, AcpiMiscInfo *misc)
9ae3a8
 
9ae3a8
     memset(dsdt, 0, sizeof *dsdt);
9ae3a8
     build_header(linker, table_data, dsdt, "DSDT",
9ae3a8
-                 misc->dsdt_size, 1, NULL);
9ae3a8
+                 misc->dsdt_size, 1, NULL, NULL);
9ae3a8
 }
9ae3a8
 
9ae3a8
 /* Build final rsdt table */
9ae3a8
@@ -965,7 +970,7 @@ build_rsdt(GArray *table_data, GArray *linker, GArray *table_offsets)
9ae3a8
                                        sizeof(uint32_t));
9ae3a8
     }
9ae3a8
     build_header(linker, table_data,
9ae3a8
-                 (void *)rsdt, "RSDT", rsdt_len, 1, NULL);
9ae3a8
+                 (void *)rsdt, "RSDT", rsdt_len, 1, NULL, NULL);
9ae3a8
 }
9ae3a8
 
9ae3a8
 static GArray *
9ae3a8
-- 
9ae3a8
1.8.3.1
9ae3a8