Skip to content

Commit df2def4

Browse files
committed
Merge tag 'acpi-4.19-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull more ACPI updates from Rafael Wysocki: "These update the ACPICA code in the kernel to the most recent upstream revision (which includes a regression fix and other improvements), make ACPICA clear the status of all ACPI events when entering sleep states (to restore the previous behavior) and update the ACPI operation region driver for the CrystalCove PMIC. Specifics: - Update the ACPICA code in the kernel to upstream revision 20180810 including: * Fix for AML parser regression causing it to mishandle opcodes that open a scope upon parse failures (Erik Schmauss) * Fix for a reference counting issue on large systems (Erik Schmauss) * Fix to discard values coming from register reads that have failed (Erik Schmauss) * Two acpiexec fixes (Bob Moore, Erik Schmauss) * Debugger cleanup (Bob Moore) * Cleanup of duplicate table error message (Bob Moore) * Cleanup of hex detection in the utilities (Erik Schmauss) - Make ACPICA clear the status of all ACPI events when entering sleep states again to avoid functional regressions (Rafael Wysocki) - Update the ACPI operation region driver for the CrystalCove PMIC to cover all of the known operation region fields (Hans de Goede)" * tag 'acpi-4.19-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: ACPI / PMIC: CrystalCove: Extend PMOP support to support all possible fields ACPICA: Clear status of all events when entering sleep states ACPICA: Update version to 20180810 ACPICA: acpiexec: fix a small memory leak regression ACPICA: Reference Counts: increase max to 0x4000 for large servers ACPICA: Reference count: add additional debugging details ACPICA: acpi_exec: fixing -fi option ACPICA: Debugger: Cleanup interface to the AML disassembler ACPICA: AML Parser: skip opcodes that open a scope upon parse failure ACPICA: Utilities: split hex detection into smaller functions ACPICA: Update an error message for a duplicate table ACPICA: ACPICA: add status check for acpi_hw_read before assigning return value ACPICA: AML Parser: ignore all exceptions resulting from incorrect AML during table load
2 parents dfec4a8 + d1f3ab5 commit df2def4

19 files changed

Lines changed: 260 additions & 56 deletions

‎drivers/acpi/acpica/aclocal.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ struct acpi_namespace_node {
164164
#define ANOBJ_SUBTREE_HAS_INI 0x10 /* Used to optimize device initialization */
165165
#define ANOBJ_EVALUATED 0x20 /* Set on first evaluation of node */
166166
#define ANOBJ_ALLOCATED_BUFFER 0x40 /* Method AML buffer is dynamic (install_method) */
167+
#define ANOBJ_NODE_EARLY_INIT 0x80 /* acpi_exec only: Node was create via init file (-fi) */
167168

168169
#define ANOBJ_IS_EXTERNAL 0x08 /* iASL only: This object created via External() */
169170
#define ANOBJ_METHOD_NO_RETVAL 0x10 /* iASL only: Method has no return value */

‎drivers/acpi/acpica/acnamesp.h‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,15 @@
2525
/* Flags for acpi_ns_lookup, acpi_ns_search_and_enter */
2626

2727
#define ACPI_NS_NO_UPSEARCH 0
28-
#define ACPI_NS_SEARCH_PARENT 0x01
29-
#define ACPI_NS_DONT_OPEN_SCOPE 0x02
30-
#define ACPI_NS_NO_PEER_SEARCH 0x04
31-
#define ACPI_NS_ERROR_IF_FOUND 0x08
32-
#define ACPI_NS_PREFIX_IS_SCOPE 0x10
33-
#define ACPI_NS_EXTERNAL 0x20
34-
#define ACPI_NS_TEMPORARY 0x40
35-
#define ACPI_NS_OVERRIDE_IF_FOUND 0x80
28+
#define ACPI_NS_SEARCH_PARENT 0x0001
29+
#define ACPI_NS_DONT_OPEN_SCOPE 0x0002
30+
#define ACPI_NS_NO_PEER_SEARCH 0x0004
31+
#define ACPI_NS_ERROR_IF_FOUND 0x0008
32+
#define ACPI_NS_PREFIX_IS_SCOPE 0x0010
33+
#define ACPI_NS_EXTERNAL 0x0020
34+
#define ACPI_NS_TEMPORARY 0x0040
35+
#define ACPI_NS_OVERRIDE_IF_FOUND 0x0080
36+
#define ACPI_NS_EARLY_INIT 0x0100
3637

3738
/* Flags for acpi_ns_walk_namespace */
3839

‎drivers/acpi/acpica/acutils.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ char acpi_ut_remove_leading_zeros(char **string);
180180

181181
u8 acpi_ut_detect_hex_prefix(char **string);
182182

183+
void acpi_ut_remove_hex_prefix(char **string);
184+
183185
u8 acpi_ut_detect_octal_prefix(char **string);
184186

185187
/*

‎drivers/acpi/acpica/dbinput.c‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,12 @@ acpi_db_command_dispatch(char *input_buffer,
763763
case CMD_DISASSEMBLE:
764764
case CMD_DISASM:
765765

766+
#ifdef ACPI_DISASSEMBLER
766767
(void)acpi_db_disassemble_method(acpi_gbl_db_args[1]);
768+
#else
769+
acpi_os_printf
770+
("The AML Disassembler is not configured/present\n");
771+
#endif
767772
break;
768773

769774
case CMD_DUMP:
@@ -872,7 +877,12 @@ acpi_db_command_dispatch(char *input_buffer,
872877

873878
case CMD_LIST:
874879

880+
#ifdef ACPI_DISASSEMBLER
875881
acpi_db_disassemble_aml(acpi_gbl_db_args[1], op);
882+
#else
883+
acpi_os_printf
884+
("The AML Disassembler is not configured/present\n");
885+
#endif
876886
break;
877887

878888
case CMD_LOCKS:

‎drivers/acpi/acpica/dbmethod.c‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ void acpi_db_set_method_data(char *type_arg, char *index_arg, char *value_arg)
216216
acpi_ut_remove_reference(obj_desc);
217217
}
218218

219+
#ifdef ACPI_DISASSEMBLER
219220
/*******************************************************************************
220221
*
221222
* FUNCTION: acpi_db_disassemble_aml
@@ -242,9 +243,8 @@ void acpi_db_disassemble_aml(char *statements, union acpi_parse_object *op)
242243
if (statements) {
243244
num_statements = strtoul(statements, NULL, 0);
244245
}
245-
#ifdef ACPI_DISASSEMBLER
246+
246247
acpi_dm_disassemble(NULL, op, num_statements);
247-
#endif
248248
}
249249

250250
/*******************************************************************************
@@ -317,16 +317,13 @@ acpi_status acpi_db_disassemble_method(char *name)
317317
walk_state->parse_flags |= ACPI_PARSE_DISASSEMBLE;
318318

319319
status = acpi_ps_parse_aml(walk_state);
320-
321-
#ifdef ACPI_DISASSEMBLER
322320
(void)acpi_dm_parse_deferred_ops(op);
323321

324322
/* Now we can disassemble the method */
325323

326324
acpi_gbl_dm_opt_verbose = FALSE;
327325
acpi_dm_disassemble(NULL, op, 0);
328326
acpi_gbl_dm_opt_verbose = TRUE;
329-
#endif
330327

331328
acpi_ps_delete_parse_tree(op);
332329

@@ -337,6 +334,7 @@ acpi_status acpi_db_disassemble_method(char *name)
337334
acpi_ut_release_owner_id(&obj_desc->method.owner_id);
338335
return (AE_OK);
339336
}
337+
#endif
340338

341339
/*******************************************************************************
342340
*

‎drivers/acpi/acpica/dbxface.c‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "amlcode.h"
1111
#include "acdebug.h"
1212
#include "acinterp.h"
13+
#include "acparser.h"
1314

1415
#define _COMPONENT ACPI_CA_DEBUGGER
1516
ACPI_MODULE_NAME("dbxface")
@@ -262,10 +263,17 @@ acpi_db_single_step(struct acpi_walk_state *walk_state,
262263
}
263264
}
264265

265-
/* Now we can display it */
266+
/* Now we can disassemble and display it */
266267

267268
#ifdef ACPI_DISASSEMBLER
268269
acpi_dm_disassemble(walk_state, display_op, ACPI_UINT32_MAX);
270+
#else
271+
/*
272+
* The AML Disassembler is not configured - at least we can
273+
* display the opcode value and name
274+
*/
275+
acpi_os_printf("AML Opcode: %4.4X %s\n", op->common.aml_opcode,
276+
acpi_ps_get_opcode_name(op->common.aml_opcode));
269277
#endif
270278

271279
if ((op->common.aml_opcode == AML_IF_OP) ||

‎drivers/acpi/acpica/dsfield.c‎

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
#include "acnamesp.h"
1616
#include "acparser.h"
1717

18+
#ifdef ACPI_EXEC_APP
19+
#include "aecommon.h"
20+
#endif
21+
1822
#define _COMPONENT ACPI_DISPATCHER
1923
ACPI_MODULE_NAME("dsfield")
2024

@@ -259,6 +263,13 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
259263
u64 position;
260264
union acpi_parse_object *child;
261265

266+
#ifdef ACPI_EXEC_APP
267+
u64 value = 0;
268+
union acpi_operand_object *result_desc;
269+
union acpi_operand_object *obj_desc;
270+
char *name_path;
271+
#endif
272+
262273
ACPI_FUNCTION_TRACE_PTR(ds_get_field_names, info);
263274

264275
/* First field starts at bit zero */
@@ -391,6 +402,25 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
391402
if (ACPI_FAILURE(status)) {
392403
return_ACPI_STATUS(status);
393404
}
405+
#ifdef ACPI_EXEC_APP
406+
name_path =
407+
acpi_ns_get_external_pathname(info->
408+
field_node);
409+
obj_desc =
410+
acpi_ut_create_integer_object
411+
(value);
412+
if (ACPI_SUCCESS
413+
(ae_lookup_init_file_entry
414+
(name_path, &value))) {
415+
acpi_ex_write_data_to_field
416+
(obj_desc,
417+
acpi_ns_get_attached_object
418+
(info->field_node),
419+
&result_desc);
420+
}
421+
acpi_ut_remove_reference(obj_desc);
422+
ACPI_FREE(name_path);
423+
#endif
394424
}
395425
}
396426

@@ -573,7 +603,9 @@ acpi_ds_init_field_objects(union acpi_parse_object *op,
573603
!(walk_state->parse_flags & ACPI_PARSE_MODULE_LEVEL)) {
574604
flags |= ACPI_NS_TEMPORARY;
575605
}
576-
606+
#ifdef ACPI_EXEC_APP
607+
flags |= ACPI_NS_OVERRIDE_IF_FOUND;
608+
#endif
577609
/*
578610
* Walk the list of entries in the field_list
579611
* Note: field_list can be of zero length. In this case, Arg will be NULL.

‎drivers/acpi/acpica/hwregs.c‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -528,13 +528,18 @@ acpi_status acpi_hw_register_read(u32 register_id, u32 *return_value)
528528

529529
status =
530530
acpi_hw_read(&value64, &acpi_gbl_FADT.xpm2_control_block);
531-
value = (u32)value64;
531+
if (ACPI_SUCCESS(status)) {
532+
value = (u32)value64;
533+
}
532534
break;
533535

534536
case ACPI_REGISTER_PM_TIMER: /* 32-bit access */
535537

536538
status = acpi_hw_read(&value64, &acpi_gbl_FADT.xpm_timer_block);
537-
value = (u32)value64;
539+
if (ACPI_SUCCESS(status)) {
540+
value = (u32)value64;
541+
}
542+
538543
break;
539544

540545
case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */

‎drivers/acpi/acpica/hwsleep.c‎

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,9 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state)
5656
if (ACPI_FAILURE(status)) {
5757
return_ACPI_STATUS(status);
5858
}
59-
/*
60-
* If the target sleep state is S5, clear all GPEs and fixed events too
61-
*/
62-
if (sleep_state == ACPI_STATE_S5) {
63-
status = acpi_hw_clear_acpi_status();
64-
if (ACPI_FAILURE(status)) {
65-
return_ACPI_STATUS(status);
66-
}
59+
status = acpi_hw_clear_acpi_status();
60+
if (ACPI_FAILURE(status)) {
61+
return_ACPI_STATUS(status);
6762
}
6863
acpi_gbl_system_awake_and_running = FALSE;
6964

‎drivers/acpi/acpica/nsaccess.c‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,14 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
558558
(char *)&current_node->name,
559559
current_node));
560560
}
561+
#ifdef ACPI_EXEC_APP
562+
if ((status == AE_ALREADY_EXISTS) &&
563+
(this_node->flags & ANOBJ_NODE_EARLY_INIT)) {
564+
this_node->flags &= ~ANOBJ_NODE_EARLY_INIT;
565+
status = AE_OK;
566+
}
567+
#endif
568+
561569
#ifdef ACPI_ASL_COMPILER
562570
/*
563571
* If this ACPI name already exists within the namespace as an
@@ -676,6 +684,11 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
676684
}
677685
}
678686
}
687+
#ifdef ACPI_EXEC_APP
688+
if (flags & ACPI_NS_EARLY_INIT) {
689+
this_node->flags |= ANOBJ_NODE_EARLY_INIT;
690+
}
691+
#endif
679692

680693
*return_node = this_node;
681694
return_ACPI_STATUS(AE_OK);

0 commit comments

Comments
 (0)