Commit 950a429c authored by Lv Zheng's avatar Lv Zheng Committed by Rafael J. Wysocki

ACPICA: Parser: Cleanup aml_offset in union acpi_operand_object

ACPICA commit 61b360074fde2bb8282722579410f5d1fb12f84d

This patch converts aml_offset in union acpi_operand_object 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 the offset during the parsing stage and will not have
difficulities in converting it into other offset attributes.

Sometimes, aml_offset is not an indication of the offset from the table
header but the offset from the entry of a list of terms, which requires
additional efforts to convert it into an offset from the table header. By
using AML address directly, there is no such difficulty.
Thus this patch also deletes a logic in disassembler that is trying to
convert the aml_offset from
  "offset from the start address of Method/Package/Buffer"
into the
  "offset from the start address of the ACPI table"
(Sample code deletion can be seen in acpi_dm_deferred_parse(), but the
function is not in the Linux kernel). Lv Zheng.

Link: https://github.com/acpica/acpica/commit/61b36007Signed-off-by: default avatarLv Zheng <lv.zheng@intel.com>
Signed-off-by: default avatarBob Moore <robert.moore@intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 83482f75
...@@ -726,7 +726,7 @@ union acpi_parse_value { ...@@ -726,7 +726,7 @@ union acpi_parse_value {
u8 descriptor_type; /* To differentiate various internal objs */\ u8 descriptor_type; /* To differentiate various internal objs */\
u8 flags; /* Type of Op */\ u8 flags; /* Type of Op */\
u16 aml_opcode; /* AML opcode */\ u16 aml_opcode; /* AML opcode */\
u32 aml_offset; /* Offset of declaration in AML */\ u8 *aml; /* Address of declaration in AML */\
union acpi_parse_object *next; /* Next op */\ union acpi_parse_object *next; /* Next op */\
struct acpi_namespace_node *node; /* For use by interpreter */\ struct acpi_namespace_node *node; /* For use by interpreter */\
union acpi_parse_value value; /* Value or args associated with the opcode */\ union acpi_parse_value value; /* Value or args associated with the opcode */\
......
...@@ -484,7 +484,7 @@ acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state, ...@@ -484,7 +484,7 @@ acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state,
static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state
*parser_state) *parser_state)
{ {
u32 aml_offset; u8 *aml;
union acpi_parse_object *field; union acpi_parse_object *field;
union acpi_parse_object *arg = NULL; union acpi_parse_object *arg = NULL;
u16 opcode; u16 opcode;
...@@ -498,8 +498,7 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state ...@@ -498,8 +498,7 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state
ACPI_FUNCTION_TRACE(ps_get_next_field); ACPI_FUNCTION_TRACE(ps_get_next_field);
aml_offset = aml = parser_state->aml;
(u32)ACPI_PTR_DIFF(parser_state->aml, parser_state->aml_start);
/* Determine field type */ /* Determine field type */
...@@ -541,7 +540,7 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state ...@@ -541,7 +540,7 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state
return_PTR(NULL); return_PTR(NULL);
} }
field->common.aml_offset = aml_offset; field->common.aml = aml;
/* Decode the field type */ /* Decode the field type */
......
...@@ -137,10 +137,7 @@ acpi_ps_get_arguments(struct acpi_walk_state *walk_state, ...@@ -137,10 +137,7 @@ acpi_ps_get_arguments(struct acpi_walk_state *walk_state,
} }
if (arg) { if (arg) {
arg->common.aml_offset = arg->common.aml = walk_state->aml;
(u32)ACPI_PTR_DIFF(walk_state->aml,
walk_state->parser_state.
aml_start);
acpi_ps_append_arg(op, arg); acpi_ps_append_arg(op, arg);
} }
...@@ -494,18 +491,14 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) ...@@ -494,18 +491,14 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
continue; continue;
} }
op->common.aml_offset = op->common.aml = walk_state->aml;
(u32)ACPI_PTR_DIFF(walk_state->aml,
walk_state->parser_state.
aml_start);
if (walk_state->op_info) { if (walk_state->op_info) {
ACPI_DEBUG_PRINT((ACPI_DB_PARSE, ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
"Opcode %4.4X [%s] Op %p Aml %p AmlOffset %5.5X\n", "Opcode %4.4X [%s] Op %p Aml %p\n",
(u32)op->common.aml_opcode, (u32)op->common.aml_opcode,
walk_state->op_info->name, op, walk_state->op_info->name, op,
parser_state->aml, op->common.aml));
op->common.aml_offset));
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment