From patchwork Thu Jan 14 01:36:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laszlo Ersek X-Patchwork-Id: 567233 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 8745D140BA3 for ; Thu, 14 Jan 2016 12:39:13 +1100 (AEDT) Received: from localhost ([::1]:39908 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJWsZ-00087b-Ci for incoming@patchwork.ozlabs.org; Wed, 13 Jan 2016 20:39:11 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35623) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJWqk-0005JF-ST for qemu-devel@nongnu.org; Wed, 13 Jan 2016 20:37:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aJWqj-0006D4-BJ for qemu-devel@nongnu.org; Wed, 13 Jan 2016 20:37:18 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54074) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJWqj-0006Cz-5n for qemu-devel@nongnu.org; Wed, 13 Jan 2016 20:37:17 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id C9C091836; Thu, 14 Jan 2016 01:37:16 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com ([10.3.113.3]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u0E1b19F024824; Wed, 13 Jan 2016 20:37:15 -0500 From: Laszlo Ersek To: qemu-devel@nongnu.org Date: Thu, 14 Jan 2016 02:36:56 +0100 Message-Id: <1452735417-5461-4-git-send-email-lersek@redhat.com> In-Reply-To: <1452735417-5461-1-git-send-email-lersek@redhat.com> References: <1452735417-5461-1-git-send-email-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Aleksei Kovura , Igor Mammedov , Michael Tokarev , "Richard W.M. Jones" , "Michael S. Tsirkin" Subject: [Qemu-devel] [PATCH 3/4] acpi: stash the OEM ID and OEM Table ID fields from an external SLIC table X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The SLIC table is not generated by QEMU. If the user specifies an external one however, then board-specific code might want to adapt other, auto-generated tables to it. This patch saves the OEM ID and OEM Table ID fields from the SLIC, and leaves the actual utilization to board code (the next patch). Cc: "Michael S. Tsirkin" (supporter:ACPI/SMBIOS) Cc: Igor Mammedov (supporter:ACPI/SMBIOS) Cc: Richard W.M. Jones Cc: Aleksei Kovura Cc: Michael Tokarev RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1248758 Signed-off-by: Laszlo Ersek --- include/hw/acpi/acpi.h | 2 ++ hw/acpi/core.c | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/include/hw/acpi/acpi.h b/include/hw/acpi/acpi.h index b20bd55..407197a 100644 --- a/include/hw/acpi/acpi.h +++ b/include/hw/acpi/acpi.h @@ -189,6 +189,8 @@ void acpi_update_sci(ACPIREGS *acpi_regs, qemu_irq irq); extern int acpi_enabled; extern char unsigned *acpi_tables; extern size_t acpi_tables_len; +extern char *acpi_slic_oem_id; +extern char *acpi_slic_oem_table_id; uint8_t *acpi_table_first(void); uint8_t *acpi_table_next(uint8_t *current); diff --git a/hw/acpi/core.c b/hw/acpi/core.c index 21e113d..7046035 100644 --- a/hw/acpi/core.c +++ b/hw/acpi/core.c @@ -54,6 +54,8 @@ static const char unsigned dfl_hdr[ACPI_TABLE_HDR_SIZE - ACPI_TABLE_PFX_SIZE] = char unsigned *acpi_tables; size_t acpi_tables_len; +char *acpi_slic_oem_id; +char *acpi_slic_oem_table_id; static QemuOptsList qemu_acpi_opts = { .name = "acpi", @@ -227,6 +229,22 @@ static void acpi_table_install(const char unsigned *blob, size_t bloblen, /* recalculate checksum */ ext_hdr->checksum = acpi_checksum((const char unsigned *)ext_hdr + ACPI_TABLE_PFX_SIZE, acpi_payload_size); + + /* If the table signature is SLIC, stash the OEM ID and OEM Table ID + * fields, so we can later adapt the RSDT and the FADT. + */ + if (memcmp(ext_hdr->sig, "SLIC", 4) == 0) { + g_free(acpi_slic_oem_id); + acpi_slic_oem_id = g_malloc(sizeof ext_hdr->oem_id + 1); + memcpy(acpi_slic_oem_id, ext_hdr->oem_id, sizeof ext_hdr->oem_id); + acpi_slic_oem_id[sizeof ext_hdr->oem_id] = '\0'; + + g_free(acpi_slic_oem_table_id); + acpi_slic_oem_table_id = g_malloc(sizeof ext_hdr->oem_table_id + 1); + memcpy(acpi_slic_oem_table_id, ext_hdr->oem_table_id, + sizeof ext_hdr->oem_table_id); + acpi_slic_oem_table_id[sizeof ext_hdr->oem_table_id] = '\0'; + } } void acpi_table_add(const QemuOpts *opts, Error **errp)