From patchwork Wed Jul 11 10:31:46 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasilis Liaskovitis X-Patchwork-Id: 170421 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 BD6CF2C00E7 for ; Wed, 11 Jul 2012 20:32:31 +1000 (EST) Received: from localhost ([::1]:38314 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SouDd-0003Kd-FM for incoming@patchwork.ozlabs.org; Wed, 11 Jul 2012 06:32:29 -0400 Received: from eggs.gnu.org ([208.118.235.92]:44187) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SouDT-0003KD-FG for qemu-devel@nongnu.org; Wed, 11 Jul 2012 06:32:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SouDO-0005p4-Ar for qemu-devel@nongnu.org; Wed, 11 Jul 2012 06:32:19 -0400 Received: from mail-bk0-f45.google.com ([209.85.214.45]:52569) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SouDO-0005nz-3f for qemu-devel@nongnu.org; Wed, 11 Jul 2012 06:32:14 -0400 Received: by bkcji1 with SMTP id ji1so712845bkc.4 for ; Wed, 11 Jul 2012 03:32:11 -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=ahSYtqGYN7VdmUfttWmMdoq1Jhabqgx3j/VvOmVmQP5UgNYLWfWTO8s0wfjxmMplfV 7k1UQk2oUFtWi4iREjx1NfI8GhUHARNNNVlL2kLT/jLuyNJh++VlrHdWp8GUs3ASrXAL mtPYtps+MqRwIxUdPWiSUgPkabNifFvZIiknW56ldWf+gC7tD/h7ZFLbzslYNsPE20Ol y0dxt4eTUvAyX0WiM06nwMq3LV2t/STnmUVgox3fWOChgkSgySRSmPPwig9Dxkw1/lif v6S6Ss5qG50OVmNZx+xtlw/Zqx+CWDWGWIv31D6HZ7ztCr5rl336tXTx0/kJ/tqPRMjq wDeg== Received: by 10.204.151.211 with SMTP id d19mr24049945bkw.63.1342002731356; Wed, 11 Jul 2012 03:32:11 -0700 (PDT) Received: from dhcp-192-168-178-175.ri.profitbricks.localdomain ([62.217.45.26]) by mx.google.com with ESMTPS id e20sm794740bkv.10.2012.07.11.03.32.10 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 11 Jul 2012 03:32:11 -0700 (PDT) From: Vasilis Liaskovitis To: qemu-devel@nongnu.org, kvm@vger.kernel.org, seabios@seabios.org Date: Wed, 11 Jul 2012 12:31:46 +0200 Message-Id: <1342002726-18258-2-git-send-email-vasilis.liaskovitis@profitbricks.com> X-Mailer: git-send-email 1.7.9 In-Reply-To: <1342002726-18258-1-git-send-email-vasilis.liaskovitis@profitbricks.com> References: <1342002726-18258-1-git-send-email-vasilis.liaskovitis@profitbricks.com> X-Gm-Message-State: ALoCoQnyAXG0t6hlOiBfb557U9MlGj/tLBKvJ1taDP+lx3fLxg/HcIQDKlFCj78olResQr+hNIhP X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.214.45 Cc: gleb@redhat.com, Vasilis Liaskovitis , kevin@koconnor.net, avi@redhat.com, anthony@codemonkey.ws, imammedo@redhat.com Subject: [Qemu-devel] [RFC PATCH v2 01/21][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)