From patchwork Sun Aug 10 11:32:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gal Hammer X-Patchwork-Id: 378830 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 339ED140093 for ; Sun, 10 Aug 2014 21:34:22 +1000 (EST) Received: from localhost ([::1]:59455 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XGROG-0007XY-4K for incoming@patchwork.ozlabs.org; Sun, 10 Aug 2014 07:34:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49412) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XGRMv-0005Ro-Cl for qemu-devel@nongnu.org; Sun, 10 Aug 2014 07:33:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XGRMp-0003NK-Ub for qemu-devel@nongnu.org; Sun, 10 Aug 2014 07:32:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:13783) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XGRMp-0003NG-MA for qemu-devel@nongnu.org; Sun, 10 Aug 2014 07:32:51 -0400 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 (8.14.4/8.14.4) with ESMTP id s7ABWpR2008915 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 10 Aug 2014 07:32:51 -0400 Received: from wolverine.usersys.redhat.com (dhcp-4-103.tlv.redhat.com [10.35.4.103]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s7ABWhhN031631; Sun, 10 Aug 2014 07:32:50 -0400 From: Gal Hammer To: qemu-devel@nongnu.org Date: Sun, 10 Aug 2014 14:32:32 +0300 Message-Id: <1407670353-14971-2-git-send-email-ghammer@redhat.com> In-Reply-To: <1407670353-14971-1-git-send-email-ghammer@redhat.com> References: <1407670353-14971-1-git-send-email-ghammer@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: Gal Hammer Subject: [Qemu-devel] [PATCH 1/2] i386: Add an ACPI_EXTRACT_NAME_BUFFER16 directive. 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 Add a 16-bytes buffer to allow storing a 128-bit UUID value in an ACPI table. Signed-off-by: Gal Hammer --- scripts/acpi_extract.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/scripts/acpi_extract.py b/scripts/acpi_extract.py index 22ea468..88314fc 100755 --- a/scripts/acpi_extract.py +++ b/scripts/acpi_extract.py @@ -139,13 +139,16 @@ def aml_name_string(offset): offset += 1 return offset; -# Given data offset, find 8 byte buffer offset -def aml_data_buffer8(offset): - #0x08 NameOp NameString DataRef - expect = [0x11, 0x0B, 0x0A, 0x08] +# Given data offset, find variable length byte buffer offset +def aml_data_buffer(offset, length): + #0x11 PkgLength BufferSize ByteList + if (length > 63): + die( "Name offset 0x%x: expected an one byte PkgLength (length<=63)" % + (offset)); + expect = [0x11, length+3, 0x0A, length] if (aml[offset:offset+4] != expect): die( "Name offset 0x%x: expected %s actual %s" % - (offset, aml[offset:offset+4], expect)) + (offset, expect, aml[offset:offset+4])) return offset + len(expect) # Given data offset, find dword const offset @@ -172,9 +175,9 @@ def aml_data_byte_const(offset): (offset, aml[offset])); return offset + 1; -# Find name'd buffer8 -def aml_name_buffer8(offset): - return aml_data_buffer8(aml_name_string(offset) + 4) +# Find name'd buffer +def aml_name_buffer(offset, length): + return aml_data_buffer(aml_name_string(offset) + 4, length) # Given name offset, find dword const offset def aml_name_dword_const(offset): @@ -308,7 +311,9 @@ for i in range(len(asl)): output[array] = aml continue if (directive == "ACPI_EXTRACT_NAME_BUFFER8"): - offset = aml_name_buffer8(offset) + offset = aml_name_buffer(offset, 8) + elif (directive == "ACPI_EXTRACT_NAME_BUFFER16"): + offset = aml_name_buffer(offset, 16) elif (directive == "ACPI_EXTRACT_NAME_DWORD_CONST"): offset = aml_name_dword_const(offset) elif (directive == "ACPI_EXTRACT_NAME_WORD_CONST"):