From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43939) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Urlpb-0006yD-9z for qemu-devel@nongnu.org; Wed, 26 Jun 2013 05:16:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Urlpa-0003Qh-0I for qemu-devel@nongnu.org; Wed, 26 Jun 2013 05:16:03 -0400 Received: from [222.73.24.84] (port=26102 helo=song.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UrlpZ-0003Pj-MI for qemu-devel@nongnu.org; Wed, 26 Jun 2013 05:16:01 -0400 From: Hu Tao Date: Wed, 26 Jun 2013 17:14:59 +0800 Message-Id: <3a2a77ca7f0be3587197c1980a4e80268824796b.1372237449.git.hutao@cn.fujitsu.com> In-Reply-To: References: Subject: [Qemu-devel] [PATCH v5 1/7] Add ACPI_EXTRACT_DEVICE* macros List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, seabios@seabios.org Cc: Vasilis Liaskovitis From: Vasilis Liaskovitis This allows to extract the beginning, end and name of a Device object. Signed-off-by: Vasilis Liaskovitis --- tools/acpi_extract.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tools/acpi_extract.py b/tools/acpi_extract.py index ab8ced6..8ad15d3 100755 --- a/tools/acpi_extract.py +++ b/tools/acpi_extract.py @@ -230,6 +230,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 @@ -322,6 +344,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) -- 1.8.3.1