From patchwork Sat Feb 6 19:14:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 61381 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp646735lbl; Sat, 6 Feb 2016 11:29:49 -0800 (PST) X-Received: by 10.55.79.17 with SMTP id d17mr24788158qkb.56.1454786988824; Sat, 06 Feb 2016 11:29:48 -0800 (PST) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id k9si22594901qge.20.2016.02.06.11.29.48 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 06 Feb 2016 11:29:48 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org Received: from localhost ([::1]:56211 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aS8YG-0006Rg-BU for patch@linaro.org; Sat, 06 Feb 2016 14:29:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53739) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aS8Jv-0004vh-Tu for qemu-devel@nongnu.org; Sat, 06 Feb 2016 14:15:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aS8Ju-0002y1-Qi for qemu-devel@nongnu.org; Sat, 06 Feb 2016 14:14:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56700) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aS8Ju-0002xr-LQ for qemu-devel@nongnu.org; Sat, 06 Feb 2016 14:14:58 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 5C6CB368E3; Sat, 6 Feb 2016 19:14:58 +0000 (UTC) Received: from redhat.com (vpn1-5-159.ams2.redhat.com [10.36.5.159]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id u16JEsjq009187; Sat, 6 Feb 2016 14:14:55 -0500 Date: Sat, 6 Feb 2016 21:14:54 +0200 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <1454784308-21177-41-git-send-email-mst@redhat.com> References: <1454784308-21177-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1454784308-21177-1-git-send-email-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Aleksei Kovura , Eduardo Habkost , Peter Maydell , Steven Newbury , Michael Tokarev , "Richard W . M . Jones" , Igor Mammedov , Laszlo Ersek Subject: [Qemu-devel] [PULL v2 40/45] acpi: add function to extract oem_id and oem_table_id from the user's SLIC 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Laszlo Ersek The acpi_get_slic_oem() function stores pointers to these fields in the (first) SLIC table that the user passes in with the -acpitable switch. Cc: "Michael S. Tsirkin" (supporter:ACPI/SMBIOS) Cc: Igor Mammedov (supporter:ACPI/SMBIOS) Cc: Richard W.M. Jones Cc: Aleksei Kovura Cc: Michael Tokarev Cc: Steven Newbury RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1248758 LP: https://bugs.launchpad.net/qemu/+bug/1533848 Signed-off-by: Laszlo Ersek Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Steven Newbury --- include/hw/acpi/acpi.h | 7 +++++++ hw/acpi/core.c | 16 ++++++++++++++++ 2 files changed, 23 insertions(+) -- MST diff --git a/include/hw/acpi/acpi.h b/include/hw/acpi/acpi.h index b20bd55..2de3021 100644 --- a/include/hw/acpi/acpi.h +++ b/include/hw/acpi/acpi.h @@ -196,4 +196,11 @@ unsigned acpi_table_len(void *current); void acpi_table_add(const QemuOpts *opts, Error **errp); void acpi_table_add_builtin(const QemuOpts *opts, Error **errp); +typedef struct AcpiSlicOem AcpiSlicOem; +struct AcpiSlicOem { + char *id; + char *table_id; +}; +int acpi_get_slic_oem(AcpiSlicOem *oem); + #endif /* !QEMU_HW_ACPI_H */ diff --git a/hw/acpi/core.c b/hw/acpi/core.c index 397e6da..edf3f96 100644 --- a/hw/acpi/core.c +++ b/hw/acpi/core.c @@ -350,6 +350,22 @@ uint8_t *acpi_table_next(uint8_t *current) } } +int acpi_get_slic_oem(AcpiSlicOem *oem) +{ + uint8_t *u; + + for (u = acpi_table_first(); u; u = acpi_table_next(u)) { + struct acpi_table_header *hdr = (void *)(u - sizeof(hdr->_length)); + + if (memcmp(hdr->sig, "SLIC", 4) == 0) { + oem->id = hdr->oem_id; + oem->table_id = hdr->oem_table_id; + return 0; + } + } + return -1; +} + static void acpi_notify_wakeup(Notifier *notifier, void *data) { ACPIREGS *ar = container_of(notifier, ACPIREGS, wakeup);