Skip to content

Commit 3e407c1

Browse files
committed
Merge back earlier ACPICA changes for 4.21.
2 parents ae6b3e5 + 0872865 commit 3e407c1

9 files changed

Lines changed: 133 additions & 55 deletions

File tree

‎drivers/acpi/acpica/acnamesp.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#define ACPI_NS_TEMPORARY 0x0040
3535
#define ACPI_NS_OVERRIDE_IF_FOUND 0x0080
3636
#define ACPI_NS_EARLY_INIT 0x0100
37+
#define ACPI_NS_PREFIX_MUST_EXIST 0x0200
3738

3839
/* Flags for acpi_ns_walk_namespace */
3940

‎drivers/acpi/acpica/dbxface.c‎

Lines changed: 74 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ acpi_db_start_command(struct acpi_walk_state *walk_state,
2424
void acpi_db_method_end(struct acpi_walk_state *walk_state);
2525
#endif
2626

27+
#ifdef ACPI_DISASSEMBLER
28+
static union acpi_parse_object *acpi_db_get_display_op(struct acpi_walk_state
29+
*walk_state,
30+
union acpi_parse_object
31+
*op);
32+
#endif
33+
2734
/*******************************************************************************
2835
*
2936
* FUNCTION: acpi_db_start_command
@@ -113,6 +120,70 @@ void acpi_db_signal_break_point(struct acpi_walk_state *walk_state)
113120
acpi_os_printf("**break** Executed AML BreakPoint opcode\n");
114121
}
115122

123+
#ifdef ACPI_DISASSEMBLER
124+
/*******************************************************************************
125+
*
126+
* FUNCTION: acpi_db_get_display_op
127+
*
128+
* PARAMETERS: walk_state - Current walk
129+
* op - Current executing op (from aml interpreter)
130+
*
131+
* RETURN: Opcode to display
132+
*
133+
* DESCRIPTION: Find the opcode to display during single stepping
134+
*
135+
******************************************************************************/
136+
137+
static union acpi_parse_object *acpi_db_get_display_op(struct acpi_walk_state
138+
*walk_state,
139+
union acpi_parse_object
140+
*op)
141+
{
142+
union acpi_parse_object *display_op;
143+
union acpi_parse_object *parent_op;
144+
145+
display_op = op;
146+
parent_op = op->common.parent;
147+
if (parent_op) {
148+
if ((walk_state->control_state) &&
149+
(walk_state->control_state->common.state ==
150+
ACPI_CONTROL_PREDICATE_EXECUTING)) {
151+
/*
152+
* We are executing the predicate of an IF or WHILE statement
153+
* Search upwards for the containing IF or WHILE so that the
154+
* entire predicate can be displayed.
155+
*/
156+
while (parent_op) {
157+
if ((parent_op->common.aml_opcode == AML_IF_OP)
158+
|| (parent_op->common.aml_opcode ==
159+
AML_WHILE_OP)) {
160+
display_op = parent_op;
161+
break;
162+
}
163+
parent_op = parent_op->common.parent;
164+
}
165+
} else {
166+
while (parent_op) {
167+
if ((parent_op->common.aml_opcode == AML_IF_OP)
168+
|| (parent_op->common.aml_opcode ==
169+
AML_ELSE_OP)
170+
|| (parent_op->common.aml_opcode ==
171+
AML_SCOPE_OP)
172+
|| (parent_op->common.aml_opcode ==
173+
AML_METHOD_OP)
174+
|| (parent_op->common.aml_opcode ==
175+
AML_WHILE_OP)) {
176+
break;
177+
}
178+
display_op = parent_op;
179+
parent_op = parent_op->common.parent;
180+
}
181+
}
182+
}
183+
return display_op;
184+
}
185+
#endif
186+
116187
/*******************************************************************************
117188
*
118189
* FUNCTION: acpi_db_single_step
@@ -134,8 +205,6 @@ acpi_db_single_step(struct acpi_walk_state *walk_state,
134205
union acpi_parse_object *next;
135206
acpi_status status = AE_OK;
136207
u32 original_debug_level;
137-
union acpi_parse_object *display_op;
138-
union acpi_parse_object *parent_op;
139208
u32 aml_offset;
140209

141210
ACPI_FUNCTION_ENTRY();
@@ -222,51 +291,12 @@ acpi_db_single_step(struct acpi_walk_state *walk_state,
222291
next = op->common.next;
223292
op->common.next = NULL;
224293

225-
display_op = op;
226-
parent_op = op->common.parent;
227-
if (parent_op) {
228-
if ((walk_state->control_state) &&
229-
(walk_state->control_state->common.state ==
230-
ACPI_CONTROL_PREDICATE_EXECUTING)) {
231-
/*
232-
* We are executing the predicate of an IF or WHILE statement
233-
* Search upwards for the containing IF or WHILE so that the
234-
* entire predicate can be displayed.
235-
*/
236-
while (parent_op) {
237-
if ((parent_op->common.aml_opcode ==
238-
AML_IF_OP)
239-
|| (parent_op->common.aml_opcode ==
240-
AML_WHILE_OP)) {
241-
display_op = parent_op;
242-
break;
243-
}
244-
parent_op = parent_op->common.parent;
245-
}
246-
} else {
247-
while (parent_op) {
248-
if ((parent_op->common.aml_opcode ==
249-
AML_IF_OP)
250-
|| (parent_op->common.aml_opcode ==
251-
AML_ELSE_OP)
252-
|| (parent_op->common.aml_opcode ==
253-
AML_SCOPE_OP)
254-
|| (parent_op->common.aml_opcode ==
255-
AML_METHOD_OP)
256-
|| (parent_op->common.aml_opcode ==
257-
AML_WHILE_OP)) {
258-
break;
259-
}
260-
display_op = parent_op;
261-
parent_op = parent_op->common.parent;
262-
}
263-
}
264-
}
265-
266294
/* Now we can disassemble and display it */
267295

268296
#ifdef ACPI_DISASSEMBLER
269-
acpi_dm_disassemble(walk_state, display_op, ACPI_UINT32_MAX);
297+
acpi_dm_disassemble(walk_state,
298+
acpi_db_get_display_op(walk_state, op),
299+
ACPI_UINT32_MAX);
270300
#else
271301
/*
272302
* The AML Disassembler is not configured - at least we can

‎drivers/acpi/acpica/dswload2.c‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,14 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
296296
}
297297
#endif
298298

299+
/*
300+
* For name creation opcodes, the full namepath prefix must
301+
* exist, except for the final (new) nameseg.
302+
*/
303+
if (walk_state->op_info->flags & AML_NAMED) {
304+
flags |= ACPI_NS_PREFIX_MUST_EXIST;
305+
}
306+
299307
/* Add new entry or lookup existing entry */
300308

301309
status =

‎drivers/acpi/acpica/nsaccess.c‎

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
267267
acpi_object_type this_search_type;
268268
u32 search_parent_flag = ACPI_NS_SEARCH_PARENT;
269269
u32 local_flags;
270+
acpi_interpreter_mode local_interpreter_mode;
270271

271272
ACPI_FUNCTION_TRACE(ns_lookup);
272273

@@ -506,6 +507,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
506507
*/
507508
this_search_type = ACPI_TYPE_ANY;
508509
current_node = this_node;
510+
509511
while (num_segments && current_node) {
510512
num_segments--;
511513
if (!num_segments) {
@@ -536,6 +538,16 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
536538
}
537539
}
538540

541+
/* Handle opcodes that create a new name_seg via a full name_path */
542+
543+
local_interpreter_mode = interpreter_mode;
544+
if ((flags & ACPI_NS_PREFIX_MUST_EXIST) && (num_segments > 0)) {
545+
546+
/* Every element of the path must exist (except for the final name_seg) */
547+
548+
local_interpreter_mode = ACPI_IMODE_EXECUTE;
549+
}
550+
539551
/* Extract one ACPI name from the front of the pathname */
540552

541553
ACPI_MOVE_32_TO_32(&simple_name, path);
@@ -544,12 +556,19 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
544556

545557
status =
546558
acpi_ns_search_and_enter(simple_name, walk_state,
547-
current_node, interpreter_mode,
559+
current_node,
560+
local_interpreter_mode,
548561
this_search_type, local_flags,
549562
&this_node);
550563
if (ACPI_FAILURE(status)) {
551564
if (status == AE_NOT_FOUND) {
552-
565+
#if !defined ACPI_ASL_COMPILER /* Note: iASL reports this error by itself, not needed here */
566+
if (flags & ACPI_NS_PREFIX_MUST_EXIST) {
567+
acpi_os_printf(ACPI_MSG_BIOS_ERROR
568+
"Object does not exist: %4.4s\n",
569+
&simple_name);
570+
}
571+
#endif
553572
/* Name not found in ACPI namespace */
554573

555574
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,

‎drivers/acpi/acpica/psloop.c‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,8 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
508508
*/
509509
if ((walk_state->
510510
parse_flags & ACPI_PARSE_MODULE_LEVEL)
511-
&& status == AE_ALREADY_EXISTS) {
511+
&& ((status == AE_ALREADY_EXISTS)
512+
|| (status == AE_NOT_FOUND))) {
512513
status = AE_OK;
513514
}
514515
if (status == AE_CTRL_PARSE_CONTINUE) {
@@ -537,10 +538,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
537538
* the scope op because the parse failure indicates that
538539
* the device may not exist.
539540
*/
540-
ACPI_ERROR((AE_INFO,
541-
"Skip parsing opcode %s",
542-
acpi_ps_get_opcode_name
543-
(walk_state->opcode)));
541+
ACPI_INFO(("Skipping parse of AML opcode: %s (0x%4.4X)", acpi_ps_get_opcode_name(walk_state->opcode), walk_state->opcode));
544542

545543
/*
546544
* Determine the opcode length before skipping the opcode.

‎drivers/acpi/acpica/psobject.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -600,8 +600,7 @@ acpi_ps_complete_op(struct acpi_walk_state *walk_state,
600600
* because there could be correct AML beyond the parts that caused
601601
* the runtime error.
602602
*/
603-
ACPI_ERROR((AE_INFO,
604-
"Ignore error and continue table load"));
603+
ACPI_INFO(("Ignoring error and continuing table load"));
605604
return_ACPI_STATUS(AE_OK);
606605
}
607606
return_ACPI_STATUS(status);

‎include/acpi/acpixf.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
/* Current ACPICA subsystem version in YYYYMMDD format */
1414

15-
#define ACPI_CA_VERSION 0x20181003
15+
#define ACPI_CA_VERSION 0x20181031
1616

1717
#include <acpi/acconfig.h>
1818
#include <acpi/actypes.h>

‎include/acpi/actbl3.h‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,29 @@ struct acpi_table_tcpa_server {
365365
*
366366
******************************************************************************/
367367

368+
/* Revision 3 */
369+
370+
struct acpi_table_tpm23 {
371+
struct acpi_table_header header; /* Common ACPI table header */
372+
u32 reserved;
373+
u64 control_address;
374+
u32 start_method;
375+
};
376+
377+
/* Value for start_method above */
378+
379+
#define ACPI_TPM23_ACPI_START_METHOD 2
380+
381+
/*
382+
* Optional trailer for revision 3. If start method is 2, there is a 4 byte
383+
* reserved area of all zeros.
384+
*/
385+
struct acpi_tmp23_trailer {
386+
u32 reserved;
387+
};
388+
389+
/* Revision 4 */
390+
368391
struct acpi_table_tpm2 {
369392
struct acpi_table_header header; /* Common ACPI table header */
370393
u16 platform_class;

‎tools/power/acpi/tools/acpidump/apmain.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ static int ap_insert_action(char *argument, u32 to_be_done)
106106

107107
current_action++;
108108
if (current_action > AP_MAX_ACTIONS) {
109-
fprintf(stderr, "Too many table options (max %u)\n",
109+
fprintf(stderr, "Too many table options (max %d)\n",
110110
AP_MAX_ACTIONS);
111111
return (-1);
112112
}

0 commit comments

Comments
 (0)