From patchwork Mon Jan 18 14:12:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laszlo Ersek X-Patchwork-Id: 569552 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 A7D1D140662 for ; Tue, 19 Jan 2016 01:14:20 +1100 (AEDT) Received: from localhost ([::1]:60008 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLAZW-0007iD-No for incoming@patchwork.ozlabs.org; Mon, 18 Jan 2016 09:14:18 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32878) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLAXk-0004XP-GM for qemu-devel@nongnu.org; Mon, 18 Jan 2016 09:12:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aLAXj-0002ql-BC for qemu-devel@nongnu.org; Mon, 18 Jan 2016 09:12:28 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60641) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLAXj-0002qe-5b for qemu-devel@nongnu.org; Mon, 18 Jan 2016 09:12:27 -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 DC21A8E235; Mon, 18 Jan 2016 14:12:26 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-113-77.phx2.redhat.com [10.3.113.77]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u0IECHdw021325; Mon, 18 Jan 2016 09:12:25 -0500 From: Laszlo Ersek To: qemu-devel@nongnu.org Date: Mon, 18 Jan 2016 15:12:12 +0100 Message-Id: <1453126333-19474-4-git-send-email-lersek@redhat.com> In-Reply-To: <1453126333-19474-1-git-send-email-lersek@redhat.com> References: <1453126333-19474-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 , Steven Newbury , "Michael S. Tsirkin" , Michael Tokarev , "Richard W.M. Jones" , Igor Mammedov Subject: [Qemu-devel] [PATCH v2 3/4] 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- Notes: v2: - introduce [MST] include/hw/acpi/acpi.h | 7 +++++++ hw/acpi/core.c | 16 ++++++++++++++++ 2 files changed, 23 insertions(+) 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 21e113d..a9d0f68 100644 --- a/hw/acpi/core.c +++ b/hw/acpi/core.c @@ -349,6 +349,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);