From patchwork Sun May 20 09:03:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gleb Natapov X-Patchwork-Id: 160249 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 8A281B6FA4 for ; Sun, 20 May 2012 19:04:13 +1000 (EST) Received: from localhost ([::1]:49361 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SW23e-0008OX-Me for incoming@patchwork.ozlabs.org; Sun, 20 May 2012 05:04:10 -0400 Received: from eggs.gnu.org ([208.118.235.92]:50487) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SW23O-0008DU-Rz for qemu-devel@nongnu.org; Sun, 20 May 2012 05:03:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SW23N-0006ph-68 for qemu-devel@nongnu.org; Sun, 20 May 2012 05:03:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44948) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SW23N-0006pT-0o for qemu-devel@nongnu.org; Sun, 20 May 2012 05:03:53 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q4K93pEv007535 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 20 May 2012 05:03:51 -0400 Received: from dhcp-1-237.tlv.redhat.com (dhcp-4-26.tlv.redhat.com [10.35.4.26]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q4K93oMq022147; Sun, 20 May 2012 05:03:51 -0400 Received: by dhcp-1-237.tlv.redhat.com (Postfix, from userid 13519) id 1EAFA18D476; Sun, 20 May 2012 12:03:50 +0300 (IDT) From: Gleb Natapov To: seabios@seabios.org Date: Sun, 20 May 2012 12:03:39 +0300 Message-Id: <1337504620-20378-2-git-send-email-gleb@redhat.com> In-Reply-To: <1337504620-20378-1-git-send-email-gleb@redhat.com> References: <1337504620-20378-1-git-send-email-gleb@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 2/3] Add ACPI_EXTRACT_PKG_START macro parsing 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 It allows to extract the beginning of a Package object content. Signed-off-by: Gleb Natapov --- tools/acpi_extract.py | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/tools/acpi_extract.py b/tools/acpi_extract.py index 8038269..167a322 100755 --- a/tools/acpi_extract.py +++ b/tools/acpi_extract.py @@ -29,6 +29,7 @@ # ACPI_EXTRACT_PROCESSOR_START - start of Processor() block # ACPI_EXTRACT_PROCESSOR_STRING - extract a NameString from Processor() # ACPI_EXTRACT_PROCESSOR_END - offset at last byte of Processor() + 1 +# ACPI_EXTRACT_PKG_START - start of Package block # # ACPI_EXTRACT_ALL_CODE - create an array storing the generated AML bytecode # @@ -185,6 +186,15 @@ def aml_processor_end(offset): pkglen = aml_pkglen(offset) return offset + pkglen +def aml_package_start(offset): + offset = aml_name_string(offset) + 4 + # 0x12 PkgLength NumElements PackageElementList + if (aml[offset] != 0x12): + die( "Name offset 0x%x: expected 0x12 actual 0x%x" % + (offset, aml[offset])); + offset += 1 + return offset + aml_pkglen_bytes(offset) + 1 + lineno = 0 for line in fileinput.input(): # Strip trailing newline @@ -267,6 +277,8 @@ for i in range(len(asl)): offset = aml_processor_string(offset) elif (directive == "ACPI_EXTRACT_PROCESSOR_END"): offset = aml_processor_end(offset) + elif (directive == "ACPI_EXTRACT_PKG_START"): + offset = aml_package_start(offset) else: die("Unsupported directive %s" % directive)