From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54317) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XT5Ue-0000k0-6F for qemu-devel@nongnu.org; Sun, 14 Sep 2014 04:49:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XT5UX-0007J4-6R for qemu-devel@nongnu.org; Sun, 14 Sep 2014 04:49:12 -0400 Received: from mail-wg0-x229.google.com ([2a00:1450:400c:c00::229]:40562) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XT5UW-0007Io-W6 for qemu-devel@nongnu.org; Sun, 14 Sep 2014 04:49:05 -0400 Received: by mail-wg0-f41.google.com with SMTP id k14so2587541wgh.12 for ; Sun, 14 Sep 2014 01:49:04 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <5415567B.80200@redhat.com> Date: Sun, 14 Sep 2014 10:48:59 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1410675949-1437-1-git-send-email-ghammer@redhat.com> <1410675949-1437-2-git-send-email-ghammer@redhat.com> In-Reply-To: <1410675949-1437-2-git-send-email-ghammer@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/2] i386: Add an ACPI_EXTRACT_NAME_BUFFER16 directive. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gal Hammer , qemu-devel@nongnu.org Cc: armbru@redhat.com Il 14/09/2014 08:25, Gal Hammer ha scritto: > 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)" % s/an/a/ > + (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"): > Apart from the above grammatical nit, Reviewed-by: Paolo Bonzini Paolo