From patchwork Tue Dec 18 12:41:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasilis Liaskovitis X-Patchwork-Id: 207134 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 4B30C2C0084 for ; Wed, 19 Dec 2012 01:25:59 +1100 (EST) Received: from localhost ([::1]:56222 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkwVd-0000Gj-0V for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2012 07:42:57 -0500 Received: from eggs.gnu.org ([208.118.235.92]:45972) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkwUv-0007Df-TD for qemu-devel@nongnu.org; Tue, 18 Dec 2012 07:42:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TkwUr-0008MF-0Z for qemu-devel@nongnu.org; Tue, 18 Dec 2012 07:42:13 -0500 Received: from mail-bk0-f45.google.com ([209.85.214.45]:39349) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkwUq-0008Lp-Pu for qemu-devel@nongnu.org; Tue, 18 Dec 2012 07:42:08 -0500 Received: by mail-bk0-f45.google.com with SMTP id jk13so287283bkc.32 for ; Tue, 18 Dec 2012 04:42:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=HOaBXj7b9ySReQIp67LkYvqjQY5qp1CN0eehkqb2o9w=; b=iTuZ+zcy5hd2LnB5+kbSp6N1YnpHGrvSVnPSUh/Q98mZ3GWQ/bLm9TFxxzjn/qLj+N 91u6QUaq4ZYEyx8Gt7trlG0l5Ma7jso1N5vTyPDUfh/EpphfpdLhIlY803lnz30oE6nm dMz5pKjW3TGCxIXemOJ55IWDhSeSVjqgb+XiOSiKjuwaWGxuODRu6IImwvtD+7Quq4L3 90Ohx07bJYKk0dZiowE3ZpFEBdg2xg9kaSO+K6r8UXF+wL0ZBaDk8lUEofMbfKDVGEVE AdL/awI/+ryJ1QqG6YsG1cKc8wSrN20HW9rRbaVNB0rnXPwQ4arjnRqeQLLMJpPPNNmZ iskQ== X-Received: by 10.204.9.147 with SMTP id l19mr710884bkl.15.1355834527725; Tue, 18 Dec 2012 04:42:07 -0800 (PST) Received: from dhcp-192-168-178-175.ri.profitbricks.localdomain ([62.217.45.26]) by mx.google.com with ESMTPS id f24sm1169954bkv.7.2012.12.18.04.42.05 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 18 Dec 2012 04:42:06 -0800 (PST) From: Vasilis Liaskovitis To: qemu-devel@nongnu.org, seabios@seabios.org Date: Tue, 18 Dec 2012 13:41:29 +0100 Message-Id: <1355834518-17989-2-git-send-email-vasilis.liaskovitis@profitbricks.com> X-Mailer: git-send-email 1.7.9 In-Reply-To: <1355834518-17989-1-git-send-email-vasilis.liaskovitis@profitbricks.com> References: <1355834518-17989-1-git-send-email-vasilis.liaskovitis@profitbricks.com> X-Gm-Message-State: ALoCoQkO3GLFNH2354//KvHhermuca3CecXOPFOTfKy0aDbB65r7gZ6oLqm7CqCpOkrKkKLhdsHk X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.214.45 Cc: Vasilis Liaskovitis , pingfank@linux.vnet.ibm.com, gleb@redhat.com, stefanha@gmail.com, jbaron@redhat.com, blauwirbel@gmail.com, kevin@koconnor.net, kraxel@redhat.com, anthony@codemonkey.ws Subject: [Qemu-devel] [RFC PATCH v4 01/30] [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. --- 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 3295678..3191f53 100755 --- a/tools/acpi_extract.py +++ b/tools/acpi_extract.py @@ -217,6 +217,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 @@ -307,6 +329,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)