ACPICA: 20160831 Release
Subsystems (2)
cover ACPICA: 20160831 Release
The 20160831 ACPICA kernel-resident subsystem updates are linuxized based on the linux-pm/linux-next branch.
The patchset has passed the following build/boot tests. Build tests are performed as follows:
1. i386 + allyes
2. i386 + allno
3. i386 + default + ACPI_DEBUGGER=y
4. i386 + default + ACPI_DEBUGGER=n + ACPI_DEBUG=y
5. i386 + default + ACPI_DEBUG=n + ACPI=y
6. i386 + default + ACPI=n
7. x86_64 + allyes
8. x86_64 + allno
9. x86_64 + default + ACPI_DEBUGGER=y
10.x86_64 + default + ACPI_DEBUGGER=n + ACPI_DEBUG=y 11.x86_64 + default + ACPI_DEBUG=n + ACPI=y
12.x86_64 + default + ACPI=n
Boot tests are performed as follows:
1. i386 + default + ACPI_DEBUGGER=y
2. x86_64 + default + ACPI_DEBUGGER=y
Where:
1. i386: machine named as "Dell Inspiron Mini 1010"
2. x86_64: machine named as "HP Compaq 8200 Elite SFF PC"
3. default: kernel configuration with following items enabled:
All hardware drivers related to the machines of i386/x86_64 All "drivers/acpi" configurations
All "drivers/platform" drivers
All other drivers that link the APIs provided by ACPICA subsystem
The divergences checking result:
Before applying (20160629 Release):
508 lines
After applying (20160831 Release):
508 lines
Bob Moore (5):
ACPICA: Debugger: Add subcommand for predefined name execution
ACPICA: Cleanup for all string-to-integer conversions
ACPICA: Add a couple of casts to uthex.c
ACPICA: Update return value for intenal _OSI method
ACPICA: Update version to 20160831
Lv Zheng (9):
ACPICA: Tables: Remove acpi_tb_install_fixed_table()
ACPICA: Tables: Remove wrong table event macros
ACPICA: Tables: Add new table events indicating table
installation/uninstallation
ACPICA: Tables: Override all 64-bit GAS fields when
acpi_gbl_use32_bit_fadt_addresses is TRUE
ACPICA: Interpreter: Fix MLC issues by switching to new term_list
grammar for table loading
ACPICA: Namespace: Add acpi_ns_get_node_unlocked()
ACPICA: Namespace: Fix dynamic table loading issues by tuning
namespace/interpreter locks
ACPICA: Dispatcher: Fix a mutex issue for method auto serialization
ACPICA: Tables: Tune table mutex to be a leaf lock
drivers/acpi/acpica/Makefile | 1 + drivers/acpi/acpica/acdebug.h | 2 +- drivers/acpi/acpica/acnamesp.h | 8 + drivers/acpi/acpica/acparser.h | 2 + drivers/acpi/acpica/actables.h | 15 +- drivers/acpi/acpica/acutils.h | 17 +- drivers/acpi/acpica/dbconvert.c | 7 +- drivers/acpi/acpica/dbexec.c | 62 +++--- drivers/acpi/acpica/dbinput.c | 2 + drivers/acpi/acpica/dbmethod.c | 132 +++++++++++ drivers/acpi/acpica/dsmethod.c | 14 +- drivers/acpi/acpica/dswexec.c | 3 +- drivers/acpi/acpica/dswload2.c | 7 +- drivers/acpi/acpica/evgpeinit.c | 7 +- drivers/acpi/acpica/evrgnini.c | 3 +- drivers/acpi/acpica/exconcat.c | 2 +- drivers/acpi/acpica/exconfig.c | 118 +++------- drivers/acpi/acpica/exconvrt.c | 8 +- drivers/acpi/acpica/exmisc.c | 4 +- drivers/acpi/acpica/exoparg1.c | 23 +- drivers/acpi/acpica/exresop.c | 11 +- drivers/acpi/acpica/extrace.c | 25 --- drivers/acpi/acpica/exutils.c | 8 + drivers/acpi/acpica/nsconvert.c | 1 - drivers/acpi/acpica/nsload.c | 30 +-- drivers/acpi/acpica/nsparse.c | 165 +++++++++++--- drivers/acpi/acpica/nsutils.c | 66 ++++-- drivers/acpi/acpica/psparse.c | 6 +- drivers/acpi/acpica/psxface.c | 73 ++++++ drivers/acpi/acpica/tbdata.c | 140 ++++++++++++ drivers/acpi/acpica/tbfadt.c | 126 +++++------ drivers/acpi/acpica/tbfind.c | 10 +- drivers/acpi/acpica/tbinstal.c | 73 +----- drivers/acpi/acpica/tbxfload.c | 53 +---- drivers/acpi/acpica/utaddress.c | 8 - drivers/acpi/acpica/uthex.c | 46 +++- drivers/acpi/acpica/utnonansi.c | 357 +----------------------------- drivers/acpi/acpica/utosi.c | 22 +- drivers/acpi/acpica/utstrtoul64.c | 348 +++++++++++++++++++++++++++++ drivers/acpi/acpica/utxfinit.c | 3 +- include/acpi/acpixf.h | 9 +- include/acpi/actypes.h | 16 +- tools/power/acpi/tools/acpidump/Makefile | 2 + tools/power/acpi/tools/acpidump/apdump.c | 4 +- tools/power/acpi/tools/acpidump/apmain.c | 4 +- 45 files changed, 1222 insertions(+), 821 deletions(-) create mode 100644 drivers/acpi/acpica/utstrtoul64.c
Signature · 1 line
1.7.10
PATCH 1/14 ACPICA: Debugger: Add subcommand for predefined name execution
From: Bob Moore <[email protected]>
ACPICA commit be5808f0e642ff9963d86f362521b4af2340e2f5
"Execute Predefined" will execute all predefined (public) names within the namespace.
--- drivers/acpi/acpica/acdebug.h | 2 +- drivers/acpi/acpica/dbexec.c | 62 ++++++++++--------- drivers/acpi/acpica/dbinput.c | 2 + drivers/acpi/acpica/dbmethod.c | 132 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 169 insertions(+), 29 deletions(-)
drivers/acpi/acpica/acdebug.h +1 -1
@@ -155,7 +155,7 @@ acpi_status acpi_db_disassemble_method(char *name);void acpi_db_disassemble_aml (char *statements,union acpi_parse_object *op); -void acpi_db_batch_execute (char *count_arg); +void acpi_db_evaluate_predefined_names (void );/* * dbnames - namespace commands
drivers/acpi/acpica/dbexec.c +34 -28
76 lines not on this page · raw message
drivers/acpi/acpica/dbinput.c +2 -0
@@ -286,6 +286,8 @@ static const struct acpi_db_command_help acpi_gbl_db_command_help[] = { {1, " \"Ascii String\"", "String method argument\n"}, {1, " (Hex Byte List)", "Buffer method argument\n"}, {1, " [Package Element List]", "Package method argument\n"}, + {5, " Execute predefined", + "Execute all predefined (public) methods\n"}, {1, " Go", "Allow method to run to completion\n"}, {1, " Information", "Display info about the current method\n"}, {1, " Into", "Step into (not over) a method call\n"},
drivers/acpi/acpica/dbmethod.c +132 -0
147 lines not on this page · raw message
Signature · 1 line
1.7.10
=?y?q?=5BPATCH=2002/14=5D=20ACPICA=3A=20Cleanup=20for=20all=20string-to-integer=20conversions?=
In reply to Lv ZhengFrom: Bob Moore <[email protected]>
ACPICA commit e2e72a351201fd58e4694418859ae2c247dafca0
Consolidate multiple versions of strtoul64 to one common version. limit possible bases to either 10 or 16.
Handles both implicit and explicit conversions.
Added a 2-character ascii-to-hex function for GPEs and buffers. Adds a new file, utstrtoul64.c
--- drivers/acpi/acpica/Makefile | 1 + drivers/acpi/acpica/acutils.h | 17 +- drivers/acpi/acpica/dbconvert.c | 7 +- drivers/acpi/acpica/dswexec.c | 3 +- drivers/acpi/acpica/evgpeinit.c | 7 +- drivers/acpi/acpica/exconcat.c | 2 +- drivers/acpi/acpica/exconvrt.c | 8 +- drivers/acpi/acpica/exmisc.c | 4 +- drivers/acpi/acpica/exoparg1.c | 5 +- drivers/acpi/acpica/exresop.c | 11 +- drivers/acpi/acpica/nsconvert.c | 1 - drivers/acpi/acpica/uthex.c | 45 +++- drivers/acpi/acpica/utnonansi.c | 357 +----------------------------- drivers/acpi/acpica/utstrtoul64.c | 348 +++++++++++++++++++++++++++++ tools/power/acpi/tools/acpidump/Makefile | 2 + tools/power/acpi/tools/acpidump/apdump.c | 4 +- tools/power/acpi/tools/acpidump/apmain.c | 4 +- 17 files changed, 435 insertions(+), 391 deletions(-) create mode 100644 drivers/acpi/acpica/utstrtoul64.c
drivers/acpi/acpica/Makefile +1 -0
@@ -175,6 +175,7 @@ acpi-y += \ utresrc.o \ utstate.o \ utstring.o \ + utstrtoul64.o \ utxface.o \ utxfinit.o \ utxferror.o \
drivers/acpi/acpica/acutils.h +10 -7
@@ -196,14 +196,15 @@ void acpi_ut_strlwr(char *src_string);int acpi_ut_stricmp (char *string1,char *string2); -acpi_status -acpi_ut_strtoul64 (char *string, -u32 base,u32 max_integer_byte_width,u64 *ret_integer); - -/* Values for max_integer_byte_width above */ +acpi_status acpi_ut_strtoul64 (char *string,u32 flags,u64 *ret_integer); -#define ACPI_MAX32_BYTE_WIDTH 4 -#define ACPI_MAX64_BYTE_WIDTH 8 +/* +* Values for Flags above +* Note: LIMIT values correspond to acpi_gbl_integer_byte_width values (4/8) +*/ +#define ACPI_STRTOUL_32BIT 0x04/* 4 bytes */ +#define ACPI_STRTOUL_64BIT 0x08/* 8 bytes */ +#define ACPI_STRTOUL_BASE16 0x10/* Default: Base10/16 */ /* * utglobal - Global data structures and procedures
@@ -233,6 +234,8 @@ const char *acpi_ut_get_event_name(u32 event_id);char acpi_ut_hex_to_ascii_char (u64 integer,u32 position); +acpi_status acpi_ut_ascii_to_hex_byte (char *two_ascii_chars,u8 *return_byte); +u8 acpi_ut_ascii_char_to_hex (int hex_char);u8 acpi_ut_valid_object_type (acpi_object_type type);
drivers/acpi/acpica/dbconvert.c +4 -3
@@ -277,9 +277,10 @@ acpi_db_convert_to_object(acpi_object_type type,default : object->type =ACPI_TYPE_INTEGER ; - status = -acpi_ut_strtoul64 (string,16 , acpi_gbl_integer_byte_width, - &object->integer.value); + status =acpi_ut_strtoul64 (string, + (acpi_gbl_integer_byte_width | +ACPI_STRTOUL_BASE16 ), + &object->integer.value);break ; }
drivers/acpi/acpica/dswexec.c +2 -1
@@ -133,7 +133,8 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state,* Result of predicate evaluation must be an Integer * object. Implicitly convert the argument if necessary. */ - status =acpi_ex_convert_to_integer (obj_desc, &local_obj_desc,16 ); + status =acpi_ex_convert_to_integer (obj_desc, &local_obj_desc, +ACPI_STRTOUL_BASE16 );if (ACPI_FAILURE (status)) { goto cleanup; }
drivers/acpi/acpica/evgpeinit.c +5 -2
@@ -323,7 +323,9 @@ acpi_ev_match_gpe_method(acpi_handle obj_handle,struct acpi_gpe_walk_info *walk_info = ACPI_CAST_PTR(struct acpi_gpe_walk_info, context);struct acpi_gpe_event_info *gpe_event_info; +acpi_status status;u32 gpe_number; +u8 temp_gpe_number;char name[ACPI_NAME_SIZE +1 ];u8 type;
@@ -377,8 +379,8 @@ acpi_ev_match_gpe_method(acpi_handle obj_handle,/* 4) The last two characters of the name are the hex GPE Number */ - gpe_number =strtoul (&name[2 ],NULL ,16 ); -if (gpe_number ==ACPI_UINT32_MAX ) { + status =acpi_ut_ascii_to_hex_byte (&name[2 ], &temp_gpe_number); +if (ACPI_FAILURE (status)) {/* Conversion failed; invalid method, just ignore it */
@@ -390,6 +392,7 @@ acpi_ev_match_gpe_method(acpi_handle obj_handle,/* Ensure that we have a valid GPE number for this GPE block */ + gpe_number = (u32 )temp_gpe_number; gpe_event_info =acpi_ev_low_get_gpe_info (gpe_number, walk_info->gpe_block);if (!gpe_event_info) {
drivers/acpi/acpica/exconcat.c +1 -1
@@ -156,7 +156,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, status =acpi_ex_convert_to_integer (local_operand1, &temp_operand1, -16 ); +ACPI_STRTOUL_BASE16 );break ;case ACPI_TYPE_BUFFER :
drivers/acpi/acpica/exconvrt.c +4 -4
@@ -124,9 +124,9 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,* of ACPI 3.0) is that the to_integer() operator allows both decimal * and hexadecimal strings (hex prefixed with "0x"). */ - status =acpi_ut_strtoul64 ((char *)pointer, flags, - acpi_gbl_integer_byte_width, - &result); + status =acpi_ut_strtoul64 (ACPI_CAST_PTR (char, pointer), + (acpi_gbl_integer_byte_width | + flags), &result);if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status); }
@@ -632,7 +632,7 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type,*/ status =acpi_ex_convert_to_integer (source_desc, result_desc, -16 ); +ACPI_STRTOUL_BASE16 );break ;case ACPI_TYPE_STRING :
drivers/acpi/acpica/exmisc.c +2 -2
@@ -327,8 +327,8 @@ acpi_ex_do_logical_op(u16 opcode,switch (operand0->common.type) {case ACPI_TYPE_INTEGER : - status = -acpi_ex_convert_to_integer (operand1, &local_operand1,16 ); + status =acpi_ex_convert_to_integer (operand1, &local_operand1, +ACPI_STRTOUL_BASE16 );break ;case ACPI_TYPE_STRING :
drivers/acpi/acpica/exoparg1.c +3 -2
@@ -521,9 +521,10 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)case AML_TO_INTEGER_OP :/* to_integer (Data, Result) */ +/* Perform "explicit" conversion */ + status = -acpi_ex_convert_to_integer (operand[0 ], &return_desc, -ACPI_ANY_BASE ); +acpi_ex_convert_to_integer (operand[0 ], &return_desc,0 );if (return_desc == operand[0 ]) {/* No conversion performed, add ref to handle return value */
drivers/acpi/acpica/exresop.c +6 -5
@@ -410,12 +410,13 @@ acpi_ex_resolve_operands(u16 opcode,case ARGI_INTEGER :/* -* Need an operand of type ACPI_TYPE_INTEGER, -* But we can implicitly convert from a STRING or BUFFER -* aka - "Implicit Source Operand Conversion" +* Need an operand of type ACPI_TYPE_INTEGER, but we can +* implicitly convert from a STRING or BUFFER. +* +* Known as "Implicit Source Operand Conversion" */ - status = -acpi_ex_convert_to_integer (obj_desc, stack_ptr,16 ); + status =acpi_ex_convert_to_integer (obj_desc, stack_ptr, +ACPI_STRTOUL_BASE16 );if (ACPI_FAILURE (status)) {if (status ==AE_TYPE ) { ACPI_ERROR((AE_INFO,
drivers/acpi/acpica/nsconvert.c +0 -1
@@ -79,7 +79,6 @@ acpi_ns_convert_to_integer(union acpi_operand_object *original_object,/* String-to-Integer conversion */ status =acpi_ut_strtoul64 (original_object->string.pointer, -ACPI_ANY_BASE , acpi_gbl_integer_byte_width, &value);if (ACPI_FAILURE (status)) {return (status);
drivers/acpi/acpica/uthex.c +41 -4
63 lines not on this page · raw message
drivers/acpi/acpica/utnonansi.c +2 -355
366 lines not on this page · raw message
drivers/acpi/acpica/utstrtoul64.c new file +348 -0
348 lines not on this page · raw message
tools/power/acpi/tools/acpidump/Makefile +2 -0
@@ -36,10 +36,12 @@ TOOL_OBJS = \ utdebug.o\ utexcep.o\ utglobal.o\ + uthex.o\ utmath.o\ utnonansi.o\ utprint.o\ utstring.o\ + utstrtoul64.o\ utxferror.o\ oslinuxtbl.o\ cmfsize.o\
tools/power/acpi/tools/acpidump/apdump.c +2 -2
@@ -287,8 +287,8 @@ int ap_dump_table_by_address(char *ascii_address)/* Convert argument to an integer physical address */ - status =acpi_ut_strtoul64 (ascii_address,ACPI_ANY_BASE , -ACPI_MAX64_BYTE_WIDTH , &long_address); + status =acpi_ut_strtoul64 (ascii_address,ACPI_STRTOUL_64BIT , + &long_address);if (ACPI_FAILURE (status)) {fprintf (stderr,"%s: Could not convert to a physical address\n" , ascii_address);
tools/power/acpi/tools/acpidump/apmain.c +2 -2
@@ -208,8 +208,8 @@ static int ap_do_options(int argc, char **argv)case 'r' :/* Dump tables from specified RSDP */ status = -acpi_ut_strtoul64 (acpi_gbl_optarg,ACPI_ANY_BASE , -ACPI_MAX64_BYTE_WIDTH , +acpi_ut_strtoul64 (acpi_gbl_optarg, +ACPI_STRTOUL_64BIT , &gbl_rsdp_base);if (ACPI_FAILURE (status)) { fprintf(stderr,
Signature · 1 line
1.7.10
PATCH 3/14 ACPICA: Add a couple of casts to uthex.c
In reply to Lv ZhengFrom: Bob Moore <[email protected]>
ACPICA commit 2ba5d3fdaa24d66d67694cbae6ec66971a7a67c1
Required in some environments.
--- drivers/acpi/acpica/uthex.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/acpi/acpica/uthex.c +2 -1
@@ -92,7 +92,8 @@ acpi_status acpi_ut_ascii_to_hex_byte(char *two_ascii_chars, u8 *return_byte)/* Both ASCII characters must be valid hex digits */ -if (!isxdigit (two_ascii_chars[0 ]) || !isxdigit (two_ascii_chars[1 ])) { +if (!isxdigit ((int )two_ascii_chars[0 ]) || + !isxdigit ((int )two_ascii_chars[1 ])) {return (AE_BAD_HEX_CONSTANT ); }
Signature · 1 line
1.7.10
PATCH 4/14 ACPICA: Tables: Remove acpi_tb_install_fixed_table()
In reply to Lv ZhengACPICA commit 42c7b848d2faa02c7691ef2c53ea741c23cd4665
acpi_tb_install_fixed_table() is now redundant as we've removed the fixed table indexing mechanism:
Commit: 8ec3f459073e67e5c6d78507dec693064b3040a2
Subject: ACPICA: Tables: Fix global table list issues by removing
fixed table indexes
This patch cleans up the code accordingly.
No functional change. Lv Zheng.
--- drivers/acpi/acpica/actables.h | 7 +---- drivers/acpi/acpica/tbfadt.c | 24 ++++++++------- drivers/acpi/acpica/tbinstal.c | 65 +--------------------------------------- 3 files changed, 16 insertions(+), 80 deletions(-)
drivers/acpi/acpica/actables.h +1 -6
@@ -155,12 +155,7 @@ void acpi_tb_install_table_with_override(struct acpi_table_desc *new_table_desc, u8 override, u32 *table_index); -acpi_status -acpi_tb_install_fixed_table (acpi_physical_address address, -char *signature,u32 *table_index); - -acpi_status ACPI_INIT_FUNCTION -acpi_tb_parse_root_table (acpi_physical_address rsdp_address); +acpi_status acpi_tb_parse_root_table (acpi_physical_address rsdp_address);/* * tbxfload
drivers/acpi/acpica/tbfadt.c +14 -10
@@ -344,23 +344,27 @@ void acpi_tb_parse_fadt(void)/* Obtain the DSDT and FACS tables via their addresses within the FADT */ -acpi_tb_install_fixed_table ((acpi_physical_address )acpi_gbl_FADT.Xdsdt, -ACPI_SIG_DSDT , &acpi_gbl_dsdt_index); +acpi_tb_install_standard_table ((acpi_physical_address )acpi_gbl_FADT. + Xdsdt, +ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL , + FALSE, TRUE, &acpi_gbl_dsdt_index);/* If Hardware Reduced flag is set, there is no FACS */ if (!acpi_gbl_reduced_hardware) {if (acpi_gbl_FADT.facs) { -acpi_tb_install_fixed_table ((acpi_physical_address ) - acpi_gbl_FADT.facs, -ACPI_SIG_FACS , - &acpi_gbl_facs_index); +acpi_tb_install_standard_table ((acpi_physical_address ) + acpi_gbl_FADT.facs, +ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL , + FALSE, TRUE, + &acpi_gbl_facs_index); }if (acpi_gbl_FADT.Xfacs) { -acpi_tb_install_fixed_table ((acpi_physical_address ) - acpi_gbl_FADT.Xfacs, -ACPI_SIG_FACS , - &acpi_gbl_xfacs_index); +acpi_tb_install_standard_table ((acpi_physical_address ) + acpi_gbl_FADT.Xfacs, +ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL , + FALSE, TRUE, + &acpi_gbl_xfacs_index); } } }
drivers/acpi/acpica/tbinstal.c +1 -64
77 lines not on this page · raw message
Signature · 1 line
1.7.10
PATCH 5/14 ACPICA: Tables: Remove wrong table event macros
In reply to Lv ZhengACPICA commit fcc129d04f865161f308d3b8743496cc3f4d233e
There are wrong table event macros, this patch cleans them up.
--- include/acpi/actypes.h | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
include/acpi/actypes.h +5 -9
@@ -1034,12 +1034,6 @@ struct acpi_statistics {u32 method_count; }; -/* Table Event Types */ - -#define ACPI_TABLE_EVENT_LOAD 0x0 -#define ACPI_TABLE_EVENT_UNLOAD 0x1 -#define ACPI_NUM_TABLE_EVENTS 2 -/* * Types specific to the OS service interfaces */
@@ -1091,9 +1085,11 @@ acpi_status (*acpi_exception_handler) (acpi_status aml_status,typedef acpi_status (*acpi_table_handler ) (u32 event,void *table,void *context); -#define ACPI_TABLE_LOAD 0x0 -#define ACPI_TABLE_UNLOAD 0x1 -#define ACPI_NUM_TABLE_EVENTS 2 +/* Table Event Types */ + +#define ACPI_TABLE_EVENT_LOAD 0x0 +#define ACPI_TABLE_EVENT_UNLOAD 0x1 +#define ACPI_NUM_TABLE_EVENTS 2/* Address Spaces (For Operation Regions) */
Signature · 1 line
1.7.10
PATCH 6/14 ACPICA: Tables: Add new table events indicating table installation/uninstallation
In reply to Lv ZhengACPICA commit ed6a5fbc694f3a27d93014391aa9a6f6fe490461
This patch adds 2 new table events to indicate table installation/uninstallation.
Currently, as ACPICA never uninstalls tables, this patch thus only adds table handler invocation for the table installation event. Lv Zheng.
The 2 events are to be used to fix a sysfs table handling issue related to LoadTable opcode (see Link # [1] below). The actual sysfs fixing code is not included, the sysfs fixes will be sent as separate patches.
--- drivers/acpi/acpica/tbinstal.c | 8 ++++++++ include/acpi/actypes.h | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-)
drivers/acpi/acpica/tbinstal.c +8 -0
@@ -301,6 +301,14 @@ acpi_tb_install_standard_table(acpi_physical_address address,acpi_tb_install_table_with_override (&new_table_desc, override, table_index); +/* Invoke table handler if present */ + +if (acpi_gbl_table_handler) { + (void )acpi_gbl_table_handler (ACPI_TABLE_EVENT_INSTALL , + new_table_desc.pointer, + acpi_gbl_table_handler_context); + } + release_and_exit:/* Release the temporary table descriptor */
include/acpi/actypes.h +3 -1
@@ -1089,7 +1089,9 @@ acpi_status (*acpi_table_handler) (u32 event, void *table, void *context);#define ACPI_TABLE_EVENT_LOAD 0x0#define ACPI_TABLE_EVENT_UNLOAD 0x1 -#define ACPI_NUM_TABLE_EVENTS 2 +#define ACPI_TABLE_EVENT_INSTALL 0x2 +#define ACPI_TABLE_EVENT_UNINSTALL 0x3 +#define ACPI_NUM_TABLE_EVENTS 4/* Address Spaces (For Operation Regions) */
Signature · 1 line
1.7.10
PATCH 7/14 ACPICA: Tables: Override all 64-bit GAS fields when acpi_gbl_use32_bit_fadt_addresses is TRUE
In reply to Lv ZhengACPICA commit aaace77db4c3b267a65b75c33f84ace6f65bbcf7
Originally, when acpi_gbl_use32_bit_fadt_addresses is TRUE, GAS override can only happen when the Address field mismatches.
According to the investigation result, Windows may favor 32-bit FADT addresses in some cases. So we need this quirk working after enabling full GAS support. This requires us to override GAS access_size/bit_width/bit_offset fields as long as acpi_gbl_use32_bit_fadt_addresses is TRUE.
This patch enhances this quirk mechanism to make it working with full GAS support. Lv Zheng.
--- drivers/acpi/acpica/tbfadt.c | 102 ++++++++++++++++++++---------------------- 1 file changed, 49 insertions(+), 53 deletions(-)
drivers/acpi/acpica/tbfadt.c +49 -53
@@ -558,78 +558,74 @@ static void acpi_tb_convert_fadt(void)* * Address32 zero, Address64 [don't care] - Use Address64 * +* No override: if acpi_gbl_use32_bit_fadt_addresses is FALSE, and: * Address32 non-zero, Address64 zero - Copy/use Address32 * Address32 non-zero == Address64 non-zero - Use Address64 * Address32 non-zero != Address64 non-zero - Warning, use Address64 * * Override: if acpi_gbl_use32_bit_fadt_addresses is TRUE, and: +* Address32 non-zero, Address64 zero - Copy/use Address32 +* Address32 non-zero == Address64 non-zero - Copy/use Address32 * Address32 non-zero != Address64 non-zero - Warning, copy/use Address32 * * Note: space_id is always I/O for 32-bit legacy address fields */ if (address32) { -if (!address64->address) { +if (address64->address) { +if (address64->address != (u64 )address32) { + +/* Address mismatch */ + +ACPI_BIOS_WARNING ((AE_INFO , +"32/64X address mismatch in FADT/%s: " +"0x%8.8X/0x%8.8X%8.8X, using %u-bit address" , + name, address32, +ACPI_FORMAT_UINT64 + (address64->address), + acpi_gbl_use32_bit_fadt_addresses + ?32 :64 )); + } -/* 64-bit address is zero, use 32-bit address */ +/* +* For each extended field, check for length mismatch +* between the legacy length field and the corresponding +* 64-bit X length field. +* Note: If the legacy length field is > 0xFF bits, ignore +* this check. (GPE registers can be larger than the +* 64-bit GAS structure can accomodate, 0xFF bits). +*/ +if ((ACPI_MUL_8 (length) <=ACPI_UINT8_MAX ) && + (address64->bit_width != +ACPI_MUL_8 (length))) { +ACPI_BIOS_WARNING ((AE_INFO , +"32/64X length mismatch in FADT/%s: %u/%u" , + name, +ACPI_MUL_8 (length), + address64-> + bit_width)); + } + } +/* +* Hardware register access code always uses the 64-bit fields. +* So if the 64-bit field is zero or is to be overridden, +* initialize it with the 32-bit fields. +* Note that when the 32-bit address favor is specified, the +* 64-bit fields are always re-initialized so that +* access_size/bit_width/bit_offset fields can be correctly +* configured to the values to trigger a 32-bit compatible +* access mode in the hardware register access code. +*/ +if (!address64->address + || acpi_gbl_use32_bit_fadt_addresses) {acpi_tb_init_generic_address (address64,ACPI_ADR_SPACE_SYSTEM_IO , - *ACPI_ADD_PTR (u8, - &acpi_gbl_FADT, - fadt_info_table - [i]. - length), + length, (u64 )address32, name, flags); - }else if (address64->address != (u64 )address32) { - -/* Address mismatch */ - -ACPI_BIOS_WARNING ((AE_INFO , -"32/64X address mismatch in FADT/%s: " -"0x%8.8X/0x%8.8X%8.8X, using %u-bit address" , - name, address32, -ACPI_FORMAT_UINT64 - (address64->address), - acpi_gbl_use32_bit_fadt_addresses - ?32 :64 )); - -if (acpi_gbl_use32_bit_fadt_addresses) { - -/* 32-bit address override */ - -acpi_tb_init_generic_address (address64, -ACPI_ADR_SPACE_SYSTEM_IO , - *ACPI_ADD_PTR - (u8, - &acpi_gbl_FADT, - fadt_info_table - [i]. - length), - (u64 ) - address32, - name, - flags); - } } } -/* -* For each extended field, check for length mismatch between the -* legacy length field and the corresponding 64-bit X length field. -* Note: If the legacy length field is > 0xFF bits, ignore this -* check. (GPE registers can be larger than the 64-bit GAS structure -* can accomodate, 0xFF bits). -*/ -if (address64->address && - (ACPI_MUL_8 (length) <=ACPI_UINT8_MAX ) && - (address64->bit_width !=ACPI_MUL_8 (length))) { -ACPI_BIOS_WARNING ((AE_INFO , -"32/64X length mismatch in FADT/%s: %u/%u" , - name,ACPI_MUL_8 (length), - address64->bit_width)); - } -if (fadt_info_table[i].flags &ACPI_FADT_REQUIRED ) {/* * Field is required (Pm1a_event, Pm1a_control).
Signature · 1 line
1.7.10
PATCH 8/14 ACPICA: Update return value for intenal _OSI method
In reply to Lv ZhengFrom: Bob Moore <[email protected]>
ACPICA commit 82101009c7c04845edb3495e66a274a613758bca
Instead of 0xFFFFFFFF, _OSI is now defined to return "Ones". This is for compatibility with Windows. The ACPI spec will be updated to reflect this.
--- drivers/acpi/acpica/utosi.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-)
drivers/acpi/acpica/utosi.c +17 -5
@@ -390,11 +390,22 @@ struct acpi_interface_info *acpi_ut_get_interface(acpi_string interface_name)* PARAMETERS: walk_state - Current walk state * * RETURN: Status +* Integer: TRUE (0) if input string is matched +* FALSE (-1) if string is not matched * * DESCRIPTION: Implementation of the _OSI predefined control method. When * an invocation of _OSI is encountered in the system AML, * control is transferred to this function. * +* (August 2016) +* Note: _OSI is now defined to return "Ones" to indicate a match, for +* compatibility with other ACPI implementations. On a 32-bit DSDT, Ones +* is 0xFFFFFFFF. On a 64-bit DSDT, Ones is 0xFFFFFFFFFFFFFFFF +* (ACPI_UINT64_MAX). +* +* This function always returns ACPI_UINT64_MAX for TRUE, and later code +* will truncate this to 32 bits if necessary. +* ******************************************************************************/ acpi_status acpi_ut_osi_implementation (struct acpi_walk_state *walk_state)
@@ -404,7 +415,7 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state)struct acpi_interface_info *interface_info;acpi_interface_handler interface_handler;acpi_status status; -u32 return_value; +u64 return_value;ACPI_FUNCTION_TRACE (ut_osi_implementation);
@@ -444,7 +455,7 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) acpi_gbl_osi_data = interface_info->value; } - return_value =ACPI_UINT32_MAX ; + return_value =ACPI_UINT64_MAX ; }acpi_os_release_mutex (acpi_gbl_osi_mutex);
@@ -456,9 +467,10 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state)*/ interface_handler = acpi_gbl_interface_handler;if (interface_handler) { - return_value = -interface_handler (string_desc->string.pointer, - return_value); +if (interface_handler + (string_desc->string.pointer, (u32 )return_value)) { + return_value =ACPI_UINT64_MAX ; + } } ACPI_DEBUG_PRINT_RAW((ACPI_DB_INFO,
Signature · 1 line
1.7.10
PATCH 9/14 ACPICA: Interpreter: Fix MLC issues by switching to new term_list grammar for table loading
In reply to Lv ZhengACPICA commit 0e24fb67cde08d7df7671d7d7b183490dc79707e
The MLC (Module Level Code) is an ACPICA terminology describing the AML code out of any control method, its support is an indication of the interpreter behavior during the table loading.
The original implementation of MLC in ACPICA had several issues:
1. Out of any control method, besides of the object creating opcodes, only the code blocks wrapped by "If/Else/While" opcodes were supported.
2. The supported MLC code blocks were executed after loading the table rather than being executed right in place.
============================================================
The demo of this order issue is as follows:
Name (OBJ1, 1)
If (CND1 == 1)
{
Name (OBJ2, 2)
}
Name (OBJ3, 3) The original MLC support created OBJ2 after OBJ3's creation.
============================================================
Other than these limitations, MLC support in ACPICA looks correct. And supporting this should be easy/natural for ACPICA, but enabling of this was blocked by some ACPICA internal and OSPM specific initialization order issues we've fixed recently. The wrong support started from the following false bug fixing commit:
Commit: 7f0c826a437157d2b19662977e9cf3b472cf24a6
Subject: ACPICA: Add support for module-level executable AML code
Commit: 9a884ab64a4d092b4c3bf24fd9a30f7fbd4591e7
Subject: ACPICA: Add additional module-level code support
...
We can confirm Windows interpreter behavior via reverse engineering means. It can be proven that not only If/Else/While wrapped code blocks, all opcodes can be executed at the module level, including operation region accesses. And it can be proven that the MLC should be executed right in place, not in such a deferred way executed after loading the table.
And the above facts indeed reflect the spec words around ACPI definition block tables (DSDT/SSDT/...), the entire table and the Scope object is defined by the AML specification in BNF style as:
AMLCode := def_block_header term_list
def_scope := scope_op pkg_length name_string term_list
The bodies of the scope opening terms (AMLCode/Scope) are all term_list, thus the table loading should be no difference than the control method evaluations as the body of the Method is also defined by the AML specification as term_list:
def_method := method_op pkg_length name_string method_flags term_list
The only difference is: after evaluating control method, created named objects may be freed due to no reference, while named objects created by the table loading should only be freed after unloading the table.
So this patch follows the spec and the de-facto standard behavior, enables the new grammar (term_list) for the table loading.
By doing so, beyond the fixes to the above issues, we can see additional differences comparing to the old grammar based table loading:
1. Originally, beyond the scope opening terms (AMLCode/Scope), If/Else/While wrapped code blocks under the scope creating terms (Device/power_resource/Processor/thermal_zone) are also supported as deferred MLC, which violates the spec defined grammar where object_list is enforced. With MLC support improved as non-deferred, the interpreter parses such scope creating terms as term_list rather object_list like the scope opening terms.
After probing the Windows behavior and proving that it also parses these terms as term_list, we submitted an ECR (Engineering Change Request) to the ASWG (ACPI Specification Working Group) to clarify this. The ECR is titled as "ASL Grammar Clarification for Executable AML Opcodes" and has been accepted by the ASWG. The new grammar will appear in ACPI specification 6.2.
2. Originally, Buffer/Package/operation_region/create_XXXField/bank_field arguments are evaluated in a deferred way after loading the table. With MLC support improved, they are also parsed right in place during the table loading.
This is also Windows compliant and the only difference is the removal of the debugging messages implemented before acpi_ds_execute_arguments(), see Link # [1] for the details. A previous commit should have ensured that acpi_check_address_range() won't regress.
Note that enabling this feature may cause regressions due to long term Linux ACPI support on top of the wrong grammar. So this patch also prepares a global option to be used to roll back to the old grammar during the period between a regression is reported and the regression is root-cause-fixed. Lv Zheng.
--- drivers/acpi/acpica/acnamesp.h | 3 + drivers/acpi/acpica/acparser.h | 2 + drivers/acpi/acpica/evrgnini.c | 3 +- drivers/acpi/acpica/exconfig.c | 3 +- drivers/acpi/acpica/nsload.c | 3 +- drivers/acpi/acpica/nsparse.c | 162 ++++++++++++++++++++++++++++++++-------- drivers/acpi/acpica/psparse.c | 4 +- drivers/acpi/acpica/psxface.c | 71 ++++++++++++++++++ drivers/acpi/acpica/tbxfload.c | 3 +- drivers/acpi/acpica/utxfinit.c | 3 +- include/acpi/acpixf.h | 7 ++ 11 files changed, 227 insertions(+), 37 deletions(-)
drivers/acpi/acpica/acnamesp.h +3 -0
@@ -130,6 +130,9 @@ acpi_status acpi_ns_parse_table(u32 table_index, struct acpi_namespace_node *start_node);acpi_status +acpi_ns_execute_table (u32 table_index,struct acpi_namespace_node *start_node); + +acpi_status acpi_ns_one_complete_parse (u32 pass_number,u32 table_index,struct acpi_namespace_node *start_node);
drivers/acpi/acpica/acparser.h +2 -0
@@ -78,6 +78,8 @@ extern const u8 acpi_gbl_long_op_index[];*/ acpi_status acpi_ps_execute_method (struct acpi_evaluate_info *info); +acpi_status acpi_ps_execute_table (struct acpi_evaluate_info *info); +/* * psargs - Parse AML opcode arguments */
drivers/acpi/acpica/evrgnini.c +2 -1
@@ -553,7 +553,8 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,* * See acpi_ns_exec_module_code */ -if (obj_desc->method. +if (!acpi_gbl_parse_table_as_term_list && + obj_desc->method. info_flags &ACPI_METHOD_MODULE_LEVEL ) { handler_obj = obj_desc->method.dispatch.handler;
drivers/acpi/acpica/exconfig.c +2 -1
@@ -118,7 +118,8 @@ acpi_ex_add_table(u32 table_index,/* Execute any module-level code that was found in the table */ acpi_ex_exit_interpreter (); -if (acpi_gbl_group_module_level_code) { +if (!acpi_gbl_parse_table_as_term_list + && acpi_gbl_group_module_level_code) {acpi_ns_exec_module_code_list (); }acpi_ex_enter_interpreter ();
drivers/acpi/acpica/nsload.c +2 -1
@@ -162,7 +162,8 @@ unlock:* other ACPI implementations. Optionally, the execution can be deferred * until later, see acpi_initialize_objects. */ -if (!acpi_gbl_group_module_level_code) { +if (!acpi_gbl_parse_table_as_term_list + && !acpi_gbl_group_module_level_code) {acpi_ns_exec_module_code_list (); }
drivers/acpi/acpica/nsparse.c +131 -31
181 lines not on this page · raw message
drivers/acpi/acpica/psparse.c +3 -1
@@ -571,7 +571,9 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)* cleanup to do */ if (((walk_state->parse_flags &ACPI_PARSE_MODE_MASK ) == -ACPI_PARSE_EXECUTE ) || (ACPI_FAILURE (status))) { +ACPI_PARSE_EXECUTE && + !(walk_state->parse_flags &ACPI_PARSE_MODULE_LEVEL )) || + (ACPI_FAILURE (status))) {acpi_ds_terminate_control_method (walk_state-> method_desc, walk_state);
drivers/acpi/acpica/psxface.c +71 -0
77 lines not on this page · raw message
drivers/acpi/acpica/tbxfload.c +2 -1
@@ -103,7 +103,8 @@ acpi_status ACPI_INIT_FUNCTION acpi_load_tables(void) "While loading namespace from ACPI tables")); } -if (!acpi_gbl_group_module_level_code) { +if (acpi_gbl_parse_table_as_term_list + || !acpi_gbl_group_module_level_code) {/* * Initialize the objects that remain uninitialized. This * runs the executable AML that may be part of the
drivers/acpi/acpica/utxfinit.c +2 -1
@@ -265,7 +265,8 @@ acpi_status ACPI_INIT_FUNCTION acpi_initialize_objects(u32 flags)* all of the tables have been loaded. It is a legacy option and is * not compatible with other ACPI implementations. See acpi_ns_load_table. */ -if (acpi_gbl_group_module_level_code) { +if (!acpi_gbl_parse_table_as_term_list + && acpi_gbl_group_module_level_code) {acpi_ns_exec_module_code_list ();/*
include/acpi/acpixf.h +7 -0
@@ -195,6 +195,13 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_do_not_use_xsdt, FALSE);ACPI_INIT_GLOBAL (u8, acpi_gbl_group_module_level_code, TRUE);/* +* Optionally support module level code by parsing the entire table as +* a term_list. Default is FALSE, do not execute entire table until some +* lock order issues are fixed. +*/ +ACPI_INIT_GLOBAL (u8, acpi_gbl_parse_table_as_term_list, FALSE); + +/* * Optionally use 32-bit FADT addresses if and when there is a conflict * (address mismatch) between the 32-bit and 64-bit versions of the * address. Although ACPICA adheres to the ACPI specification which
Signature · 1 line
1.7.10
PATCH 10/14 ACPICA: Namespace: Add acpi_ns_get_node_unlocked()
In reply to Lv ZhengACPICA commit 3ef1a1bf5612fe1a629424c09eaaeb6f299d313c
Add acpi_ns_get_node_unlocked() to be used when ACPI_MTX_NAMESPACE is locked. Lv Zheng.
--- drivers/acpi/acpica/acnamesp.h | 5 +++ drivers/acpi/acpica/nsutils.c | 66 ++++++++++++++++++++++++++++++---------- 2 files changed, 55 insertions(+), 16 deletions(-)
drivers/acpi/acpica/acnamesp.h +5 -0
@@ -299,6 +299,11 @@ u8 acpi_ns_pattern_match(struct acpi_namespace_node *obj_node, char *search_for);acpi_status +acpi_ns_get_node_unlocked (struct acpi_namespace_node *prefix_node, +const char *external_pathname, +u32 flags,struct acpi_namespace_node **out_node); + +acpi_status acpi_ns_get_node (struct acpi_namespace_node *prefix_node,const char *external_pathname,u32 flags,struct acpi_namespace_node **out_node);
drivers/acpi/acpica/nsutils.c +50 -16
99 lines not on this page · raw message
Signature · 1 line
1.7.10
PATCH 11/14 ACPICA: Namespace: Fix dynamic table loading issues by tuning namespace/interpreter locks
In reply to Lv ZhengACPICA commit 767ee53354e0c4b7e8e7c57c6dd7bf569f0d52bb
There are issues related to the namespace/interpreter locks, which causes several ACPI functionalities not specification compliant. The lock issues were detectec when we were trying to fix the functionalities (please see Link # [1] for the details).
What's the lock issues? Let's first look into the namespace/interpreter lock usages inside of the object evaluation and the table loading which are the key AML interpretion code paths:
Table loading:acpi_ns_load_table
L(Namespace)
acpi_ns_parse_table
acpi_ns_one_complete_parse(LOAD_PASS1/LOAD_PASS2)
acpi_ds_load1_begion_op acpi_ds_load1_end_op acpi_ds_load2_begion_op acpi_ds_load2_end_op
U(Namespace)
Object evaluation:acpi_ns_evaluate
L(Interpreter)
acpi_ps_execute_method
acpi_ds_exec_begin_op
acpi_ds_exec_end_op
U(Interpreter)
acpi_ns_load_table
L(Namespace)
U(Namespace)
acpi_ev_initialize_region
L(Namespace)
U(Namespace)
address_space.Setup address_space.Handler acpi_os_wait_semaphore acpi_os_acquire_mutex
acpi_os_sleep
L(Interpreter)
U(Interpreter)
L(Interpreter)
acpi_ex_resolve_node_to_value
U(Interpreter)
acpi_ns_check_return_value
Where:
1. L(Interpreter) means acquire(MTX_INTERPRETER);
2. U(Interpreter) means release(MTX_INTERPRETER);
3. L(Namespace) means acquire(MTX_NAMESPACE);
4. U(Namespace) means release(MTX_NAMESPACE);
We can see that acpi_ns_exec_module_code() (which invokes acpi_ns_evaluate) is implemented in a deferred way just in order to avoid to reacquire the namespace lock. This is in fact the root cause of many other ACPICA issues:
1. We now know for sure that the module code should be executed right in place by the Windows AML interpreter. So in the current design, if the region initializations/accesses or the table loadings (where the namespace surely should be locked again) happening during the table loading period, dead lock could happen because ACPICA never unlocks the namespace during the AML interpretion.
2. ACPICA interpreter just ensures that all static namespace nodes (named objects created during the acpi_load_tables()) are created (acpi_ns_lookup()) with the correct lock held, but doesn't ensure that the named objects created by the control method are created with the same correct lock held. It requires the control methods to be executed in a serial way after "loading a table", that's why ACPICA requires method auto serialization.
This patch fixes these software design issues by extending interpreter enter/exit APIs to hold both interpreter/namespace locks to ensure the lock order correctness, so that we can get these code paths:
Table loading:acpi_ns_load_table
E(Interpreter)
acpi_ns_parse_table
acpi_ns_one_complete_parse acpi_ns_execute_table
X(Interpreter) acpi_ns_load_table acpi_ev_initialize_region address_space.Setup address_space.Handler acpi_os_wait_semaphore acpi_os_acquire_mutex acpi_os_sleep
E(Interpreter)
X(Interpreter)
Object evaluation:acpi_ns_evaluate
E(Interpreter)
acpi_ps_execute_method
X(Interpreter)
acpi_ns_load_table
acpi_ev_initialize_region
address_space.Setup
address_space.Handler
acpi_os_wait_semaphore
acpi_os_acquire_mutex
acpi_os_sleep
E(Interpreter)
X(Interpreter)
Where:
1. E(Interpreter) means acquire(MTX_INTERPRETER, MTX_NAMESPACE);
2. X(Interpreter) means release(MTX_NAMESPACE, MTX_INTERPRETER);
After this change, we can see:
1. All namespace nodes creations are locked by the namespace lock.
2. All namespace nodes referencing are locked with the same lock.
3. But we also can notice a defact that, all namespace nodes deletions could be affected by this change. As a consequence, acpi_ns_delete_namespace_subtree() may delete a static namespace node that is still referenced by the interpreter (for example, the parser scopes).
Currently, we needn't worry about the last defact because in ACPICA, table unloading is not fully functioning, its design strictly relies on the fact that when the namespace deletion happens, either the AML table or the OSPMs should have been notified and thus either the AML table or the OSPMs shouldn't reference deletion-related namespace nodes during the namespace deletion. And this change still works with the above restrictions applied. While making this a-step-forward helps us to correct the wrong grammar to pull many things back to the correct rail. And pulling things back to the correct rail in return makes it possible for us to support fully functioning table unloading after doing many cleanups.
While this patch is generated, all namespace locks are examined to ensure that they can meet either of the following pattens:
1. L(Namespace)
U(Namespace)
2. E(Interpreter)
X(Interpreter)
3. E(Interpreter)
X(Interpreter)
L(Namespace)
U(Namespace)
E(Interpreter)
X(Interpreter)
We ensure this by adding X(Interpreter)/E(Interpreter) or removing U(Namespace)/L(Namespace) for those currently are executed in the following order:
E(Interpreter)
L(Namespace)
U(Namespace)
X(Interpreter)
And adding E(Interpreter)/X(Interpreter) for those currently are executed in the following order:
X(Interpreter)
E(Interpreter)
Originally, the interpreter lock is held for the execution AML opcodes, the namespace lock is held for the named object creation AML opcodes. Since they are actually same in MS interpreter (can all be executed during the table loading), we can combine the 2 locks and tune the locking code better in this way. Lv Zheng.
--- drivers/acpi/acpica/dsmethod.c | 4 ++++ drivers/acpi/acpica/dswload2.c | 7 ++----- drivers/acpi/acpica/exconfig.c | 14 ++++++++------ drivers/acpi/acpica/exoparg1.c | 18 ++++++++++-------- drivers/acpi/acpica/extrace.c | 25 ------------------------- drivers/acpi/acpica/exutils.c | 8 ++++++++ drivers/acpi/acpica/nsload.c | 27 ++++++++++----------------- drivers/acpi/acpica/nsparse.c | 3 +++ drivers/acpi/acpica/psxface.c | 2 ++ drivers/acpi/acpica/utaddress.c | 8 -------- 10 files changed, 47 insertions(+), 69 deletions(-)
drivers/acpi/acpica/dsmethod.c +4 -0
@@ -757,8 +757,10 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc,/* Delete any direct children of (created by) this method */ + (void )acpi_ex_exit_interpreter ();acpi_ns_delete_namespace_subtree (walk_state-> method_node); + (void )acpi_ex_enter_interpreter ();/* * Delete any objects that were created by this method
@@ -769,9 +771,11 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc,*/ if (method_desc->method. info_flags &ACPI_METHOD_MODIFIED_NAMESPACE ) { + (void )acpi_ex_exit_interpreter ();acpi_ns_delete_namespace_by_owner (method_desc-> method. owner_id); + (void )acpi_ex_enter_interpreter (); method_desc->method.info_flags &= ~ACPI_METHOD_MODIFIED_NAMESPACE ; }
drivers/acpi/acpica/dswload2.c +2 -5
@@ -605,16 +605,13 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status); } - -acpi_ex_exit_interpreter (); } +acpi_ex_exit_interpreter (); status =acpi_ev_initialize_region (acpi_ns_get_attached_object (node), FALSE); -if (walk_state->method_node) { -acpi_ex_enter_interpreter (); - } +acpi_ex_enter_interpreter ();if (ACPI_FAILURE (status)) {/*
drivers/acpi/acpica/exconfig.c +8 -6
@@ -198,9 +198,10 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state,* Find the node referenced by the root_path_string. This is the * location within the namespace where the table will be loaded. */ - status = -acpi_ns_get_node (start_node, operand[3 ]->string.pointer, -ACPI_NS_SEARCH_PARENT , &parent_node); + status =acpi_ns_get_node_unlocked (start_node, + operand[3 ]->string.pointer, +ACPI_NS_SEARCH_PARENT , + &parent_node);if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status); }
@@ -220,9 +221,10 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state,/* Find the node referenced by the parameter_path_string */ - status = -acpi_ns_get_node (start_node, operand[4 ]->string.pointer, -ACPI_NS_SEARCH_PARENT , ¶meter_node); + status =acpi_ns_get_node_unlocked (start_node, + operand[4 ]->string.pointer, +ACPI_NS_SEARCH_PARENT , + ¶meter_node);if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status); }
drivers/acpi/acpica/exoparg1.c +10 -8
@@ -891,14 +891,16 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)* Field, so we need to resolve the node to a value. */ status = -acpi_ns_get_node (walk_state->scope_info-> - scope.node, - operand[0 ]->string.pointer, -ACPI_NS_SEARCH_PARENT , -ACPI_CAST_INDIRECT_PTR - (struct - acpi_namespace_node, - &return_desc)); +acpi_ns_get_node_unlocked (walk_state-> + scope_info->scope. + node, + operand[0 ]-> + string.pointer, +ACPI_NS_SEARCH_PARENT , +ACPI_CAST_INDIRECT_PTR + (struct + acpi_namespace_node, + &return_desc));if (ACPI_FAILURE (status)) { goto cleanup; }
drivers/acpi/acpica/extrace.c +0 -25
@@ -201,7 +201,6 @@ acpi_ex_start_trace_method(struct acpi_namespace_node *method_node,union acpi_operand_object *obj_desc, struct acpi_walk_state *walk_state) { - acpi_status status; char *pathname = NULL;u8 enabled = FALSE;
@@ -211,11 +210,6 @@ acpi_ex_start_trace_method(struct acpi_namespace_node *method_node, pathname =acpi_ns_get_normalized_pathname (method_node, TRUE); } - status =acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE ); -if (ACPI_FAILURE (status)) { - goto exit; - } - enabled =acpi_ex_interpreter_trace_enabled (pathname);if (enabled && !acpi_gbl_trace_method_object) { acpi_gbl_trace_method_object = obj_desc;
@@ -233,9 +227,6 @@ acpi_ex_start_trace_method(struct acpi_namespace_node *method_node, } } - (void )acpi_ut_release_mutex (ACPI_MTX_NAMESPACE ); - -exit:if (enabled) { ACPI_TRACE_POINT(ACPI_TRACE_AML_METHOD, TRUE, obj_desc ? obj_desc->method.aml_start : NULL,
@@ -267,7 +258,6 @@ acpi_ex_stop_trace_method(struct acpi_namespace_node *method_node,union acpi_operand_object *obj_desc, struct acpi_walk_state *walk_state) { - acpi_status status; char *pathname = NULL;u8 enabled;
@@ -277,26 +267,14 @@ acpi_ex_stop_trace_method(struct acpi_namespace_node *method_node, pathname =acpi_ns_get_normalized_pathname (method_node, TRUE); } - status =acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE ); -if (ACPI_FAILURE (status)) { - goto exit_path; - } - enabled =acpi_ex_interpreter_trace_enabled (NULL ); - (void )acpi_ut_release_mutex (ACPI_MTX_NAMESPACE ); -if (enabled) {ACPI_TRACE_POINT (ACPI_TRACE_AML_METHOD , FALSE, obj_desc ? obj_desc->method.aml_start :NULL , pathname); } - status =acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE ); -if (ACPI_FAILURE (status)) { - goto exit_path; - } -/* Check whether the tracer should be stopped */ if (acpi_gbl_trace_method_object == obj_desc) {
@@ -312,9 +290,6 @@ acpi_ex_stop_trace_method(struct acpi_namespace_node *method_node, acpi_gbl_trace_method_object =NULL ; } - (void )acpi_ut_release_mutex (ACPI_MTX_NAMESPACE ); - -exit_path:if (pathname) {ACPI_FREE (pathname); }
drivers/acpi/acpica/exutils.c +8 -0
@@ -94,6 +94,10 @@ void acpi_ex_enter_interpreter(void)ACPI_ERROR ((AE_INFO ,"Could not acquire AML Interpreter mutex" )); } + status =acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE ); +if (ACPI_FAILURE (status)) { +ACPI_ERROR ((AE_INFO ,"Could not acquire AML Namespace mutex" )); + } return_VOID; }
@@ -127,6 +131,10 @@ void acpi_ex_exit_interpreter(void)ACPI_FUNCTION_TRACE (ex_exit_interpreter); + status =acpi_ut_release_mutex (ACPI_MTX_NAMESPACE ); +if (ACPI_FAILURE (status)) { +ACPI_ERROR ((AE_INFO ,"Could not release AML Namespace mutex" )); + } status =acpi_ut_release_mutex (ACPI_MTX_INTERPRETER );if (ACPI_FAILURE (status)) { ACPI_ERROR((AE_INFO,
drivers/acpi/acpica/nsload.c +10 -17
@@ -46,6 +46,7 @@#include "acnamesp.h" #include "acdispat.h" #include "actables.h" +#include "acinterp.h" #define _COMPONENT ACPI_NAMESPACEACPI_MODULE_NAME ("nsload" )
@@ -78,20 +79,6 @@ acpi_ns_load_table(u32 table_index, struct acpi_namespace_node *node)ACPI_FUNCTION_TRACE (ns_load_table); -/* -* Parse the table and load the namespace with all named -* objects found within. Control methods are NOT parsed -* at this time. In fact, the control methods cannot be -* parsed until the entire namespace is loaded, because -* if a control method makes a forward reference (call) -* to another control method, we can't continue parsing -* because we don't know how many arguments to parse next! -*/ - status =acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE ); -if (ACPI_FAILURE (status)) { -return_ACPI_STATUS (status); - } -/* If table already loaded into namespace, just return */ if (acpi_tb_is_table_loaded (table_index)) {
@@ -107,6 +94,15 @@ acpi_ns_load_table(u32 table_index, struct acpi_namespace_node *node) goto unlock; } +/* +* Parse the table and load the namespace with all named +* objects found within. Control methods are NOT parsed +* at this time. In fact, the control methods cannot be +* parsed until the entire namespace is loaded, because +* if a control method makes a forward reference (call) +* to another control method, we can't continue parsing +* because we don't know how many arguments to parse next! +*/ status =acpi_ns_parse_table (table_index, node);if (ACPI_SUCCESS (status)) {acpi_tb_set_table_loaded_flag (table_index, TRUE);
@@ -120,7 +116,6 @@ acpi_ns_load_table(u32 table_index, struct acpi_namespace_node *node)* exist. This target of Scope must already exist in the * namespace, as per the ACPI specification. */ - (void )acpi_ut_release_mutex (ACPI_MTX_NAMESPACE );acpi_ns_delete_namespace_by_owner (acpi_gbl_root_table_list. tables[table_index].owner_id);
@@ -129,8 +124,6 @@ acpi_ns_load_table(u32 table_index, struct acpi_namespace_node *node) } unlock: - (void )acpi_ut_release_mutex (ACPI_MTX_NAMESPACE ); -if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status); }
drivers/acpi/acpica/nsparse.c +3 -0
@@ -47,6 +47,7 @@#include "acparser.h" #include "acdispat.h" #include "actables.h" +#include "acinterp.h" #define _COMPONENT ACPI_NAMESPACEACPI_MODULE_NAME ("nsparse" )
@@ -234,7 +235,9 @@ acpi_ns_one_complete_parse(u32 pass_number,ACPI_DEBUG_PRINT ((ACPI_DB_PARSE ,"*PARSE* pass %u parse\n" , pass_number)); +acpi_ex_enter_interpreter (); status =acpi_ps_parse_aml (walk_state); +acpi_ex_exit_interpreter (); cleanup:acpi_ps_delete_parse_tree (parse_root);
drivers/acpi/acpica/psxface.c +2 -0
@@ -308,7 +308,9 @@ acpi_status acpi_ps_execute_table(struct acpi_evaluate_info *info)/* * Parse the AML, walk_state will be deleted by parse_aml */ +acpi_ex_enter_interpreter (); status =acpi_ps_parse_aml (walk_state); +acpi_ex_exit_interpreter (); walk_state =NULL ; cleanup:
drivers/acpi/acpica/utaddress.c +0 -8
@@ -77,7 +77,6 @@ acpi_ut_add_address_range(acpi_adr_space_type space_id, u32 length, struct acpi_namespace_node *region_node) { struct acpi_address_range *range_info; -acpi_status status;ACPI_FUNCTION_TRACE (ut_add_address_range);
@@ -97,12 +96,6 @@ acpi_ut_add_address_range(acpi_adr_space_type space_id, range_info->end_address = (address + length -1 ); range_info->region_node = region_node; - status =acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE ); -if (ACPI_FAILURE (status)) { -ACPI_FREE (range_info); -return_ACPI_STATUS (status); - } - range_info->next = acpi_gbl_address_range_list[space_id]; acpi_gbl_address_range_list[space_id] = range_info;
@@ -112,7 +105,6 @@ acpi_ut_add_address_range(acpi_adr_space_type space_id,ACPI_FORMAT_UINT64 (address), ACPI_FORMAT_UINT64(range_info->end_address))); - (void )acpi_ut_release_mutex (ACPI_MTX_NAMESPACE );return_ACPI_STATUS (AE_OK ); }
Signature · 1 line
1.7.10
PATCH 12/14 ACPICA: Dispatcher: Fix a mutex issue for method auto serialization
In reply to Lv ZhengACPICA commit fd305eda14f1a1e684edef4fac53f194bf00ed3f
This patch fixes an issue with acpi_ds_auto_serialized_method(). The parser will invoke acpi_ex_release_all_mutexes(), which in return cause mutexes held in ACPI_ERROR_METHOD() failed. Lv Zheng.
--- drivers/acpi/acpica/dsmethod.c | 10 ++++++++-- drivers/acpi/acpica/psparse.c | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-)
drivers/acpi/acpica/dsmethod.c +8 -2
@@ -99,11 +99,14 @@ acpi_ds_auto_serialize_method(struct acpi_namespace_node *node,"Method auto-serialization parse [%4.4s] %p\n" , acpi_ut_get_node_name(node), node)); +acpi_ex_enter_interpreter (); +/* Create/Init a root op for the method parse tree */ op =acpi_ps_alloc_op (AML_METHOD_OP , obj_desc->method.aml_start);if (!op) { -return_ACPI_STATUS (AE_NO_MEMORY ); + status =AE_NO_MEMORY ; + goto unlock; }acpi_ps_set_name (op, node->name.integer);
@@ -115,7 +118,8 @@ acpi_ds_auto_serialize_method(struct acpi_namespace_node *node,acpi_ds_create_walk_state (node->owner_id,NULL ,NULL ,NULL );if (!walk_state) {acpi_ps_free_op (op); -return_ACPI_STATUS (AE_NO_MEMORY ); + status =AE_NO_MEMORY ; + goto unlock; } status = acpi_ds_init_aml_walk(walk_state, op, node,
@@ -134,6 +138,8 @@ acpi_ds_auto_serialize_method(struct acpi_namespace_node *node, status =acpi_ps_parse_aml (walk_state);acpi_ps_delete_parse_tree (op); +unlock: +acpi_ex_exit_interpreter ();return_ACPI_STATUS (status); }
drivers/acpi/acpica/psparse.c +2 -0
@@ -537,9 +537,11 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)/* Either the method parse or actual execution failed */ +acpi_ex_exit_interpreter ();ACPI_ERROR_METHOD ("Method parse/execution failed" , walk_state->method_node,NULL , status); +acpi_ex_enter_interpreter ();/* Check for possible multi-thread reentrancy problem */
Signature · 1 line
1.7.10
PATCH 13/14 ACPICA: Tables: Tune table mutex to be a leaf lock
In reply to Lv ZhengACPICA commit f564d57c6501b97a2871f0b4c048e79910f71783
This patch tunes MTX_TABLES into a leaf lock by always ensuring it is released before holding other locks.
This patch also collects all table loading related functions into acpi_tb_load_table() (invoked by load_table opcode) and acpi_tb_install_and_load_table() (invoked by Load opcode and acpi_load_table()) so that we can have lock tuning code collected at the boundary of these 2 functions. Lv Zheng.
--- drivers/acpi/acpica/actables.h | 8 +++ drivers/acpi/acpica/exconfig.c | 105 ++++++------------------------ drivers/acpi/acpica/tbdata.c | 140 ++++++++++++++++++++++++++++++++++++++++ drivers/acpi/acpica/tbfind.c | 10 ++- drivers/acpi/acpica/tbxfload.c | 50 ++------------ 5 files changed, 182 insertions(+), 131 deletions(-)
drivers/acpi/acpica/actables.h +8 -0
@@ -123,6 +123,14 @@ acpi_tb_install_standard_table(acpi_physical_address address,void acpi_tb_uninstall_table (struct acpi_table_desc *table_desc); +acpi_status +acpi_tb_load_table (u32 table_index,struct acpi_namespace_node *parent_node); + +acpi_status +acpi_tb_install_and_load_table (struct acpi_table_header *table, +acpi_physical_address address, +u8 flags,u8 override,u32 *table_index); +void acpi_tb_terminate (void );acpi_status acpi_tb_delete_namespace_by_owner (u32 table_index);
drivers/acpi/acpica/exconfig.c +21 -84
177 lines not on this page · raw message
drivers/acpi/acpica/tbdata.c +140 -0
149 lines not on this page · raw message
drivers/acpi/acpica/tbfind.c +7 -3
@@ -68,7 +68,7 @@ acpi_statusacpi_tb_find_table (char *signature, char *oem_id, char *oem_table_id, u32 *table_index) { -acpi_status status; +acpi_status status =AE_OK ;struct acpi_table_header header;u32 i;
@@ -96,6 +96,7 @@ acpi_tb_find_table(char *signature,/* Search for the table */ + (void )acpi_ut_acquire_mutex (ACPI_MTX_TABLES );for (i =0 ; i < acpi_gbl_root_table_list.current_table_count; ++i) {if (memcmp (&(acpi_gbl_root_table_list.tables[i].signature), header.signature,ACPI_NAME_SIZE )) {
@@ -115,7 +116,7 @@ acpi_tb_find_table(char *signature,acpi_tb_validate_table (&acpi_gbl_root_table_list. tables[i]);if (ACPI_FAILURE (status)) { -return_ACPI_STATUS (status); + goto unlock_and_exit; }if (!acpi_gbl_root_table_list.tables[i].pointer) {
@@ -144,9 +145,12 @@ acpi_tb_find_table(char *signature,ACPI_DEBUG_PRINT ((ACPI_DB_TABLES ,"Found table [%4.4s]\n" , header.signature)); -return_ACPI_STATUS (AE_OK ); + goto unlock_and_exit; } } + status =AE_NOT_FOUND ; +unlock_and_exit: + (void )acpi_ut_release_mutex (ACPI_MTX_TABLES );return_ACPI_STATUS (AE_NOT_FOUND ); }
drivers/acpi/acpica/tbxfload.c +6 -44
87 lines not on this page · raw message
Signature · 1 line
1.7.10
PATCH 14/14 ACPICA: Update version to 20160831
In reply to Lv ZhengFrom: Bob Moore <[email protected]>
ACPICA commit 3c8c04c2e8a371018b3a29f5cfe27a241caea48d
Version 20160831
--- include/acpi/acpixf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/acpi/acpixf.h +1 -1
@@ -46,7 +46,7 @@/* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20160729 +#define ACPI_CA_VERSION 0x20160831#include <acpi/acconfig.h> #include <acpi/actypes.h>
Signature · 1 line
1.7.10
Quoted 42 lines · Lv Zheng
The 20160831 ACPICA kernel-resident subsystem updates are linuxized based on the linux-pm/linux-next branch.
The patchset has passed the following build/boot tests. Build tests are performed as follows:
1. i386 + allyes
2. i386 + allno
3. i386 + default + ACPI_DEBUGGER=y
4. i386 + default + ACPI_DEBUGGER=n + ACPI_DEBUG=y
5. i386 + default + ACPI_DEBUG=n + ACPI=y
6. i386 + default + ACPI=n
7.x86_64+ allyes
8.x86_64+ allno
9.x86_64+ default + ACPI_DEBUGGER=y
10.x86_64 + default + ACPI_DEBUGGER=n + ACPI_DEBUG=y 11.x86_64 + default + ACPI_DEBUG=n + ACPI=y
12.x86_64 + default + ACPI=n
Boot tests are performed as follows:
1. i386 + default + ACPI_DEBUGGER=y
2.x86_64+ default + ACPI_DEBUGGER=y
Where:
1. i386: machine named as "Dell Inspiron Mini 1010"
2.x86_64: machine named as "HP Compaq 8200 Elite SFF PC"
3. default: kernel configuration with following items enabled:
All hardware drivers related to the machines of i386/x86_64 All "drivers/acpi" configurations
All "drivers/platform" drivers
All other drivers that link the APIs provided by ACPICA subsystemThe divergences checking result:
Before applying (20160629 Release):
508 lines
After applying (20160831 Release):
508 linesBob Moore (5):
ACPICA: Debugger: Add subcommand for predefined name execution
ACPICA: Cleanup for all string-to-integer conversions
ACPICA: Add a couple of casts touthex.c
ACPICA: Update return value for intenal_OSImethod
ACPICA: Update version to 20160831
Quoted 14 lines
Lv Zheng (9):
ACPICA: Tables: Removeacpi_tb_install_fixed_table()
ACPICA: Tables: Remove wrong table event macros
ACPICA: Tables: Add new table events indicating table
installation/uninstallation
ACPICA: Tables: Override all 64-bit GAS fields when
acpi_gbl_use32_bit_fadt_addressesis TRUE
ACPICA: Interpreter: Fix MLC issues by switching to newterm_list
grammar for table loading
ACPICA: Namespace: Addacpi_ns_get_node_unlocked()
ACPICA: Namespace: Fix dynamic table loading issues by tuning
namespace/interpreter locks
ACPICA: Dispatcher: Fix a mutex issue for method auto serialization
ACPICA: Tables: Tune table mutex to be a leaf lock
All applied.
Thanks,
Rafael