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: 1491261 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 5C6AD3FCFC for ; Fri, 21 Sep 2012 11:17:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932990Ab2IULRq (ORCPT ); Fri, 21 Sep 2012 07:17:46 -0400 Received: from mail-bk0-f46.google.com ([209.85.214.46]:61022 "EHLO mail-bk0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756312Ab2IULRn (ORCPT ); Fri, 21 Sep 2012 07:17:43 -0400 Received: by bkuw11 with SMTP id w11so743840bku.19 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=fvve7IjgGz93uCpYZwLNoq6JdhfEIXBWxjLFBuMHGTDAa8eb74AS/ZO0JXUqmv0G80 xYiT0s0efeJPj65DTfNax9szu7SSXp7nD9LiazqJQNJ7Dw4R2XiQmvFQsAcxh9tKsRBi yJFbi0sV5ymzhmBptR3bl+7fT+uzuTJXdIQ5///QpUNzGXdzEGbURT9wmM0X2CxTlxJR Nwn+Y7Yy5eCI0XjBUJSGaHZ7GAe9qLnBVS2amoNltimgob1eGTfXNF38GMfpbNQhdRbW zgIrNy/WIopzGFDQdVGtK+BQdWbZwUjl8B17YMT7VSJ+EWaE2nVZEvpL3kNpOJKgf9Mm 9C6Q== 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 Cc: avi@redhat.com, anthony@codemonkey.ws, kevin@koconnor.net, wency@cn.fujitsu.com, kraxel@redhat.com, eblake@redhat.com, blauwirbel@gmail.com, gleb@redhat.com, imammedo@redhat.com, Vasilis Liaskovitis Subject: [RFC PATCH v3 01/19][SeaBIOS] Add ACPI_EXTRACT_DEVICE* macros 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: ALoCoQmgbVFQD690rXDfkNuLS/xnQ3x49BWRWg+yocTku5HVjkXSlB2QI6yGzmCUlsnO98+aKihI Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.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)