summaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpica/psobject.c
diff options
context:
space:
mode:
authorLv Zheng <lv.zheng@intel.com>2015-07-23 12:52:11 +0800
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-07-23 23:09:06 +0200
commit83482f758b0d2d6a20a10be88399da44aa186aed (patch)
tree36927081350d5eaa5a482d0aca7d05612d5b8b04 /drivers/acpi/acpica/psobject.c
parenteb87a05223293a915dc97e6966cbbb1baa43cd5f (diff)
downloadlinux-stable-83482f758b0d2d6a20a10be88399da44aa186aed.tar.gz
linux-stable-83482f758b0d2d6a20a10be88399da44aa186aed.tar.bz2
linux-stable-83482f758b0d2d6a20a10be88399da44aa186aed.zip
ACPICA: Parser: Cleanup aml_offset in struct acpi_walk_state
ACPICA commit d254405814495058276c0c2f9d96794d15a6c91c This patch converts aml_offset in struct acpi_walk_state to AML address. AML offset is actually only used by the debugger, using AML address is more direct and efficient during the parsing stage so that we don't need to calculate it during the parsing stage. On the other hand, we can see several issues in the current parser logic around the aml_offset: 1. union acpi_operand_object.Common.aml_offset is redundantly assigned in acpi_ps_parse_loop(). 2. aml_offset is not an indication of the offset from the table header but the offset from the entry of a list of objects. Sometimes, it indicates an entry for a Method/Package/Buffer, which makes it difficult to be reversely calculated to a table header offset. 3. When being used with method tracers (for example, Linux function trace), it's better to have AML address logged instead of the AML offset because the address is the only attribute that can uniquely identify the opcode. This patch is required to solve the above issues. Lv Zheng. Link: https://github.com/acpica/acpica/commit/d2544058 Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/acpica/psobject.c')
-rw-r--r--drivers/acpi/acpica/psobject.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/acpi/acpica/psobject.c b/drivers/acpi/acpica/psobject.c
index 2f5ddd806c58..6ba3bb7402a9 100644
--- a/drivers/acpi/acpica/psobject.c
+++ b/drivers/acpi/acpica/psobject.c
@@ -66,12 +66,11 @@ static acpi_status acpi_ps_get_aml_opcode(struct acpi_walk_state *walk_state);
static acpi_status acpi_ps_get_aml_opcode(struct acpi_walk_state *walk_state)
{
+ u32 aml_offset;
ACPI_FUNCTION_TRACE_PTR(ps_get_aml_opcode, walk_state);
- walk_state->aml_offset =
- (u32)ACPI_PTR_DIFF(walk_state->parser_state.aml,
- walk_state->parser_state.aml_start);
+ walk_state->aml = walk_state->parser_state.aml;
walk_state->opcode = acpi_ps_peek_opcode(&(walk_state->parser_state));
/*
@@ -98,10 +97,14 @@ static acpi_status acpi_ps_get_aml_opcode(struct acpi_walk_state *walk_state)
/* The opcode is unrecognized. Complain and skip unknown opcodes */
if (walk_state->pass_number == 2) {
+ aml_offset = (u32)ACPI_PTR_DIFF(walk_state->aml,
+ walk_state->
+ parser_state.aml_start);
+
ACPI_ERROR((AE_INFO,
"Unknown opcode 0x%.2X at table offset 0x%.4X, ignoring",
walk_state->opcode,
- (u32)(walk_state->aml_offset +
+ (u32)(aml_offset +
sizeof(struct acpi_table_header))));
ACPI_DUMP_BUFFER((walk_state->parser_state.aml - 16),
@@ -115,14 +118,14 @@ static acpi_status acpi_ps_get_aml_opcode(struct acpi_walk_state *walk_state)
acpi_os_printf
("/*\nError: Unknown opcode 0x%.2X at table offset 0x%.4X, context:\n",
walk_state->opcode,
- (u32)(walk_state->aml_offset +
+ (u32)(aml_offset +
sizeof(struct acpi_table_header)));
/* Dump the context surrounding the invalid opcode */
acpi_ut_dump_buffer(((u8 *)walk_state->parser_state.
aml - 16), 48, DB_BYTE_DISPLAY,
- (walk_state->aml_offset +
+ (aml_offset +
sizeof(struct acpi_table_header) -
16));
acpi_os_printf(" */\n");