From patchwork Fri Sep 21 11:17:17 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasilis Liaskovitis X-Patchwork-Id: 185724 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 7403F2C0085 for ; Fri, 21 Sep 2012 22:05:55 +1000 (EST) Received: from localhost ([::1]:48988 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TF1Fg-0001f4-EF for incoming@patchwork.ozlabs.org; Fri, 21 Sep 2012 07:18:32 -0400 Received: from eggs.gnu.org ([208.118.235.92]:57641) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TF1F1-0008G3-PD for qemu-devel@nongnu.org; Fri, 21 Sep 2012 07:17:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TF1Et-0003rO-40 for qemu-devel@nongnu.org; Fri, 21 Sep 2012 07:17:51 -0400 Received: from mail-bk0-f45.google.com ([209.85.214.45]:58755) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TF1Es-0003rI-To for qemu-devel@nongnu.org; Fri, 21 Sep 2012 07:17:43 -0400 Received: by bkcjg9 with SMTP id jg9so1317042bkc.4 for ; Fri, 21 Sep 2012 04:17:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=M4KN+E97abfanFTaBh5LQ0tkmnZF2Fi2RFg6U6kHsG8=; b=mw1Y03j93ev69mj1QBhwPR+NYguJTwsq4IXL8fiEf/psMlMjHCIP+DPPGX+7Do8Sbi A8K1lUOFIng8ZIRTywMcfIpvsg/FiuW/aWqkh6cszW/LzkABoAsH8z5JpD1fSF0ZjK3l 6tdNrY/OnIc2hH4rhYKwig7CgizWmi1P+BGaTq0nbbyN8QMkSmbdTAeQp9zOYK0AW/VN qxLhqX4TuKKq6x3RzsOxLMjBe1haqakl0zNjYg2vik44NlEM4rSLdpKogrjZk1nZdDZz sheDlUyMFkXqz+lw4X3db5S/afnzhk6ZzpJAw2otrq0RAUqHBey8wY/P2RqI8f4E2PDY AhGA== Received: by 10.204.15.199 with SMTP id l7mr2041834bka.51.1348226262031; Fri, 21 Sep 2012 04:17:42 -0700 (PDT) Received: from dhcp-192-168-178-175.ri.profitbricks.localdomain ([62.217.45.26]) by mx.google.com with ESMTPS id x13sm5271435bkv.16.2012.09.21.04.17.41 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 21 Sep 2012 04:17:41 -0700 (PDT) From: Vasilis Liaskovitis To: qemu-devel@nongnu.org, kvm@vger.kernel.org, seabios@seabios.org Date: Fri, 21 Sep 2012 13:17:17 +0200 Message-Id: <1348226255-4226-2-git-send-email-vasilis.liaskovitis@profitbricks.com> X-Mailer: git-send-email 1.7.9 In-Reply-To: <1348226255-4226-1-git-send-email-vasilis.liaskovitis@profitbricks.com> References: <1348226255-4226-1-git-send-email-vasilis.liaskovitis@profitbricks.com> X-Gm-Message-State: ALoCoQlI9mI/17/KheGHEsGBYPCXzuZT2KQBXGKicymHt4x5FHK4wr+IZNq/zhIVZTPeB8I0/Tuc X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.214.45 Cc: Vasilis Liaskovitis , gleb@redhat.com, blauwirbel@gmail.com, kevin@koconnor.net, avi@redhat.com, anthony@codemonkey.ws, imammedo@redhat.com, eblake@redhat.com, kraxel@redhat.com Subject: [Qemu-devel] [RFC PATCH v3 01/19][SeaBIOS] Add ACPI_EXTRACT_DEVICE* macros 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 This allows to extract the beginning, end and name of a Device object. Signed-off-by: Vasilis Liaskovitis --- tools/acpi_extract.py | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-) diff --git a/tools/acpi_extract.py b/tools/acpi_extract.py index 167a322..cb2540e 100755 --- a/tools/acpi_extract.py +++ b/tools/acpi_extract.py @@ -195,6 +195,28 @@ def aml_package_start(offset): offset += 1 return offset + aml_pkglen_bytes(offset) + 1 +def aml_device_start(offset): + #0x5B 0x82 DeviceOp PkgLength NameString ProcID + if ((aml[offset] != 0x5B) or (aml[offset + 1] != 0x82)): + die( "Name offset 0x%x: expected 0x5B 0x83 actual 0x%x 0x%x" % + (offset, aml[offset], aml[offset + 1])); + return offset + +def aml_device_string(offset): + #0x5B 0x82 DeviceOp PkgLength NameString ProcID + start = aml_device_start(offset) + offset += 2 + pkglenbytes = aml_pkglen_bytes(offset) + offset += pkglenbytes + return offset + +def aml_device_end(offset): + start = aml_device_start(offset) + offset += 2 + pkglenbytes = aml_pkglen_bytes(offset) + pkglen = aml_pkglen(offset) + return offset + pkglen + lineno = 0 for line in fileinput.input(): # Strip trailing newline @@ -279,6 +301,12 @@ for i in range(len(asl)): offset = aml_processor_end(offset) elif (directive == "ACPI_EXTRACT_PKG_START"): offset = aml_package_start(offset) + elif (directive == "ACPI_EXTRACT_DEVICE_START"): + offset = aml_device_start(offset) + elif (directive == "ACPI_EXTRACT_DEVICE_STRING"): + offset = aml_device_string(offset) + elif (directive == "ACPI_EXTRACT_DEVICE_END"): + offset = aml_device_end(offset) else: die("Unsupported directive %s" % directive)