Skip to content

Commit d290ef9

Browse files
committed
Merge tag 'acpi-4.18-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull additional ACPI updates from Rafael Wysocki: "These update the ACPICA code in the kernel to upstream revision 20180531 including one important AML parser fix and updates related to the IORT table, make the kernel recognize the "Windows 2017.2" _OSI string and update the customized methods documentation. Specifics: - Update the ACPICA code in the kernel to upstream revision 20180531 including: * AML parser fix to continue loading tables after detecting an AML error (Erik Schmauss). * AML parser debug option to dump parse trees (Bob Moore). * Debugger updates (Bob Moore). * Initial bits of Unload () operator deprecation (Bob Moore). * Updates related to the IORT table (Robin Murphy). - Make Linux respond to the "Windows 2017.2" _OSI string which allows native Thunderbolt enumeration to be used on Dell systems and was unsafe before recent changes in the PCI subsystem (Mario Limonciello) - Update the ACPI method customization feature documentation (Erik Schmauss)" * tag 'acpi-4.18-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: ACPICA: Recognize the _OSI string "Windows 2017.2" ACPICA: Update version to 20180531 ACPICA: Interpreter: Begin deprecation of Unload operator ACPICA: AML parser: attempt to continue loading table after error ACPICA: Debugger: Reduce verbosity for module-level code errors. ACPICA: AML Parser: Add debug option to dump parse trees ACPICA: Debugger: Add count of namespace nodes after namespace dump ACPICA: IORT: Add PMCG node supprt ACPICA: IORT: Update for revision D ACPI / Documentation: update ACPI customize method feature docs
2 parents d09fcec + 6744553 commit d290ef9

File tree

15 files changed

+192
-26
lines changed

15 files changed

+192
-26
lines changed

Documentation/acpi/method-customizing.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ control method rather than override the entire DSDT, because kernel
1616
rebuild/reboot is not needed and test result can be got in minutes.
1717

1818
Note: Only ACPI METHOD can be overridden, any other object types like
19-
"Device", "OperationRegion", are not recognized.
19+
"Device", "OperationRegion", are not recognized. Methods
20+
declared inside scope operators are also not supported.
2021
Note: The same ACPI control method can be overridden for many times,
2122
and it's always the latest one that used by Linux/kernel.
2223
Note: To get the ACPI debug object output (Store (AAAA, Debug)),
@@ -32,8 +33,6 @@ Note: To get the ACPI debug object output (Store (AAAA, Debug)),
3233

3334
DefinitionBlock ("", "SSDT", 1, "", "", 0x20080715)
3435
{
35-
External (ACON)
36-
3736
Method (\_SB_.AC._PSR, 0, NotSerialized)
3837
{
3938
Store ("In AC _PSR", Debug)
@@ -42,9 +41,10 @@ Note: To get the ACPI debug object output (Store (AAAA, Debug)),
4241
}
4342
Note that the full pathname of the method in ACPI namespace
4443
should be used.
45-
And remember to use "External" to declare external objects.
4644
e) assemble the file to generate the AML code of the method.
47-
e.g. "iasl psr.asl" (psr.aml is generated as a result)
45+
e.g. "iasl -vw 6084 psr.asl" (psr.aml is generated as a result)
46+
If parameter "-vw 6084" is not supported by your iASL compiler,
47+
please try a newer version.
4848
f) mount debugfs by "mount -t debugfs none /sys/kernel/debug"
4949
g) override the old method via the debugfs by running
5050
"cat /tmp/psr.aml > /sys/kernel/debug/acpi/custom_method"

drivers/acpi/acpica/dbnames.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ acpi_db_walk_and_match_name(acpi_handle obj_handle,
322322
acpi_os_printf("Could Not get pathname for object %p\n",
323323
obj_handle);
324324
} else {
325+
info.count = 0;
325326
info.owner_id = ACPI_OWNER_ID_MAX;
326327
info.debug_level = ACPI_UINT32_MAX;
327328
info.display_type = ACPI_DISPLAY_SUMMARY | ACPI_DISPLAY_SHORT;

drivers/acpi/acpica/dbobject.c

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ void
3535
acpi_db_dump_method_info(acpi_status status, struct acpi_walk_state *walk_state)
3636
{
3737
struct acpi_thread_state *thread;
38+
struct acpi_namespace_node *node;
39+
40+
node = walk_state->method_node;
41+
42+
/* There are no locals or arguments for the module-level code case */
43+
44+
if (node == acpi_gbl_root_node) {
45+
return;
46+
}
3847

3948
/* Ignore control codes, they are not errors */
4049

@@ -384,8 +393,14 @@ void acpi_db_decode_locals(struct acpi_walk_state *walk_state)
384393
struct acpi_namespace_node *node;
385394
u8 display_locals = FALSE;
386395

387-
obj_desc = walk_state->method_desc;
388396
node = walk_state->method_node;
397+
obj_desc = walk_state->method_desc;
398+
399+
/* There are no locals for the module-level code case */
400+
401+
if (node == acpi_gbl_root_node) {
402+
return;
403+
}
389404

390405
if (!node) {
391406
acpi_os_printf
@@ -452,6 +467,12 @@ void acpi_db_decode_arguments(struct acpi_walk_state *walk_state)
452467
node = walk_state->method_node;
453468
obj_desc = walk_state->method_desc;
454469

470+
/* There are no arguments for the module-level code case */
471+
472+
if (node == acpi_gbl_root_node) {
473+
return;
474+
}
475+
455476
if (!node) {
456477
acpi_os_printf
457478
("No method node (Executing subtree for buffer or opregion)\n");

drivers/acpi/acpica/dsdebug.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,15 @@ acpi_ds_dump_method_stack(acpi_status status,
162162
op->common.next = NULL;
163163

164164
#ifdef ACPI_DISASSEMBLER
165-
acpi_os_printf("Failed at ");
166-
acpi_dm_disassemble(next_walk_state, op,
167-
ACPI_UINT32_MAX);
165+
if (walk_state->method_node !=
166+
acpi_gbl_root_node) {
167+
168+
/* More verbose if not module-level code */
169+
170+
acpi_os_printf("Failed at ");
171+
acpi_dm_disassemble(next_walk_state, op,
172+
ACPI_UINT32_MAX);
173+
}
168174
#endif
169175
op->common.next = next;
170176
}

drivers/acpi/acpica/exconfig.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,17 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle)
489489
*/
490490
ACPI_WARNING((AE_INFO, "Received request to unload an ACPI table"));
491491

492+
/*
493+
* May 2018: Unload is no longer supported for the following reasons:
494+
* 1) A correct implementation on some hosts may not be possible.
495+
* 2) Other ACPI implementations do not correctly/fully support it.
496+
* 3) It requires host device driver support which does not exist.
497+
* (To properly support namespace unload out from underneath.)
498+
* 4) This AML operator has never been seen in the field.
499+
*/
500+
ACPI_EXCEPTION((AE_INFO, AE_NOT_IMPLEMENTED,
501+
"AML Unload operator is not supported"));
502+
492503
/*
493504
* Validate the handle
494505
* Although the handle is partially validated in acpi_ex_reconfiguration()

drivers/acpi/acpica/nsdump.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
170170
}
171171

172172
type = this_node->type;
173+
info->count++;
173174

174175
/* Check if the owner matches */
175176

@@ -639,6 +640,7 @@ acpi_ns_dump_objects(acpi_object_type type,
639640
return;
640641
}
641642

643+
info.count = 0;
642644
info.debug_level = ACPI_LV_TABLES;
643645
info.owner_id = owner_id;
644646
info.display_type = display_type;
@@ -649,6 +651,7 @@ acpi_ns_dump_objects(acpi_object_type type,
649651
acpi_ns_dump_one_object, NULL,
650652
(void *)&info, NULL);
651653

654+
acpi_os_printf("\nNamespace node count: %u\n\n", info.count);
652655
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
653656
}
654657

drivers/acpi/acpica/psloop.c

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,22 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
515515
if (ACPI_FAILURE(status)) {
516516
return_ACPI_STATUS(status);
517517
}
518+
if (walk_state->opcode == AML_SCOPE_OP) {
519+
/*
520+
* If the scope op fails to parse, skip the body of the
521+
* scope op because the parse failure indicates that the
522+
* device may not exist.
523+
*/
524+
walk_state->parser_state.aml =
525+
walk_state->aml + 1;
526+
walk_state->parser_state.aml =
527+
acpi_ps_get_next_package_end
528+
(&walk_state->parser_state);
529+
walk_state->aml =
530+
walk_state->parser_state.aml;
531+
ACPI_ERROR((AE_INFO,
532+
"Skipping Scope block"));
533+
}
518534

519535
continue;
520536
}
@@ -557,7 +573,40 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
557573
if (ACPI_FAILURE(status)) {
558574
return_ACPI_STATUS(status);
559575
}
560-
576+
if ((walk_state->control_state) &&
577+
((walk_state->control_state->control.
578+
opcode == AML_IF_OP)
579+
|| (walk_state->control_state->control.
580+
opcode == AML_WHILE_OP))) {
581+
/*
582+
* If the if/while op fails to parse, we will skip parsing
583+
* the body of the op.
584+
*/
585+
parser_state->aml =
586+
walk_state->control_state->control.
587+
aml_predicate_start + 1;
588+
parser_state->aml =
589+
acpi_ps_get_next_package_end
590+
(parser_state);
591+
walk_state->aml = parser_state->aml;
592+
593+
ACPI_ERROR((AE_INFO,
594+
"Skipping While/If block"));
595+
if (*walk_state->aml == AML_ELSE_OP) {
596+
ACPI_ERROR((AE_INFO,
597+
"Skipping Else block"));
598+
walk_state->parser_state.aml =
599+
walk_state->aml + 1;
600+
walk_state->parser_state.aml =
601+
acpi_ps_get_next_package_end
602+
(parser_state);
603+
walk_state->aml =
604+
parser_state->aml;
605+
}
606+
ACPI_FREE(acpi_ut_pop_generic_state
607+
(&walk_state->control_state));
608+
}
609+
op = NULL;
561610
continue;
562611
}
563612
}

drivers/acpi/acpica/psobject.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "acparser.h"
1313
#include "amlcode.h"
1414
#include "acconvert.h"
15+
#include "acnamesp.h"
1516

1617
#define _COMPONENT ACPI_PARSER
1718
ACPI_MODULE_NAME("psobject")
@@ -549,6 +550,21 @@ acpi_ps_complete_op(struct acpi_walk_state *walk_state,
549550

550551
do {
551552
if (*op) {
553+
/*
554+
* These Opcodes need to be removed from the namespace because they
555+
* get created even if these opcodes cannot be created due to
556+
* errors.
557+
*/
558+
if (((*op)->common.aml_opcode == AML_REGION_OP)
559+
|| ((*op)->common.aml_opcode ==
560+
AML_DATA_REGION_OP)) {
561+
acpi_ns_delete_children((*op)->common.
562+
node);
563+
acpi_ns_remove_node((*op)->common.node);
564+
(*op)->common.node = NULL;
565+
acpi_ps_delete_parse_tree(*op);
566+
}
567+
552568
status2 =
553569
acpi_ps_complete_this_op(walk_state, *op);
554570
if (ACPI_FAILURE(status2)) {
@@ -574,6 +590,20 @@ acpi_ps_complete_op(struct acpi_walk_state *walk_state,
574590
#endif
575591
walk_state->prev_op = NULL;
576592
walk_state->prev_arg_types = walk_state->arg_types;
593+
594+
if (walk_state->parse_flags & ACPI_PARSE_MODULE_LEVEL) {
595+
/*
596+
* There was something that went wrong while executing code at the
597+
* module-level. We need to skip parsing whatever caused the
598+
* error and keep going. One runtime error during the table load
599+
* should not cause the entire table to not be loaded. This is
600+
* because there could be correct AML beyond the parts that caused
601+
* the runtime error.
602+
*/
603+
ACPI_ERROR((AE_INFO,
604+
"Ignore error and continue table load"));
605+
return_ACPI_STATUS(AE_OK);
606+
}
577607
return_ACPI_STATUS(status);
578608
}
579609

drivers/acpi/acpica/pswalk.c

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,48 @@ ACPI_MODULE_NAME("pswalk")
2525
* DESCRIPTION: Delete a portion of or an entire parse tree.
2626
*
2727
******************************************************************************/
28+
#include "amlcode.h"
2829
void acpi_ps_delete_parse_tree(union acpi_parse_object *subtree_root)
2930
{
3031
union acpi_parse_object *op = subtree_root;
3132
union acpi_parse_object *next = NULL;
3233
union acpi_parse_object *parent = NULL;
34+
u32 level = 0;
3335

3436
ACPI_FUNCTION_TRACE_PTR(ps_delete_parse_tree, subtree_root);
3537

38+
ACPI_DEBUG_PRINT((ACPI_DB_PARSE_TREES, " root %p\n", subtree_root));
39+
3640
/* Visit all nodes in the subtree */
3741

3842
while (op) {
39-
40-
/* Check if we are not ascending */
41-
4243
if (op != parent) {
4344

45+
/* This is the descending case */
46+
47+
if (ACPI_IS_DEBUG_ENABLED
48+
(ACPI_LV_PARSE_TREES, _COMPONENT)) {
49+
50+
/* This debug option will print the entire parse tree */
51+
52+
acpi_os_printf(" %*.s%s %p", (level * 4),
53+
" ",
54+
acpi_ps_get_opcode_name(op->
55+
common.
56+
aml_opcode),
57+
op);
58+
59+
if (op->named.aml_opcode == AML_INT_NAMEPATH_OP) {
60+
acpi_os_printf(" %4.4s",
61+
op->common.value.string);
62+
}
63+
if (op->named.aml_opcode == AML_STRING_OP) {
64+
acpi_os_printf(" %s",
65+
op->common.value.string);
66+
}
67+
acpi_os_printf("\n");
68+
}
69+
4470
/* Look for an argument or child of the current op */
4571

4672
next = acpi_ps_get_arg(op, 0);
@@ -49,6 +75,7 @@ void acpi_ps_delete_parse_tree(union acpi_parse_object *subtree_root)
4975
/* Still going downward in tree (Op is not completed yet) */
5076

5177
op = next;
78+
level++;
5279
continue;
5380
}
5481
}
@@ -69,6 +96,7 @@ void acpi_ps_delete_parse_tree(union acpi_parse_object *subtree_root)
6996
if (next) {
7097
op = next;
7198
} else {
99+
level--;
72100
op = parent;
73101
}
74102
}

drivers/acpi/acpica/uterror.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,20 +182,20 @@ acpi_ut_prefixed_namespace_error(const char *module_name,
182182
switch (lookup_status) {
183183
case AE_ALREADY_EXISTS:
184184

185-
acpi_os_printf(ACPI_MSG_BIOS_ERROR);
185+
acpi_os_printf("\n" ACPI_MSG_BIOS_ERROR);
186186
message = "Failure creating";
187187
break;
188188

189189
case AE_NOT_FOUND:
190190

191-
acpi_os_printf(ACPI_MSG_BIOS_ERROR);
192-
message = "Failure looking up";
191+
acpi_os_printf("\n" ACPI_MSG_BIOS_ERROR);
192+
message = "Could not resolve";
193193
break;
194194

195195
default:
196196

197-
acpi_os_printf(ACPI_MSG_ERROR);
198-
message = "Failure looking up";
197+
acpi_os_printf("\n" ACPI_MSG_ERROR);
198+
message = "Failure resolving";
199199
break;
200200
}
201201

0 commit comments

Comments
 (0)