ACPICA version 20191213 patches
Subsystems (2)
cover ACPICA version 20191213 patches
This patchset contains a linux-ized patchset of the 20191213 release of ACPICA. Notable patches include Maximilan Luz's change to the AML interpreter to always treat buffer fields created from the ASL CreateField() operator as buffers rather than treating it as an integer if the buffer field is small enough to fit an integer. Other than that, there is a disassembler change to properly disassemble references to buffer fields that share the same namesegment as a method.
This patchset is also available at the following link:
https://github.com/SchmErik/linux/tree/20191213
Bob Moore (1):
ACPICA: Update version to 20191213
Colin Ian King (1):
ACPICA: debugger: fix spelling mistake "adress" -> "address"
Erik Kaneda (2):
ACPICA: Disassembler: create buffer fields in ACPI_PARSE_LOAD_PASS1
ACPICA: acpisrc: add unix line ending support for non-windows build
Maximilian Luz (1):
ACPICA: Dispatcher: always generate buffer objects for ASL
create_field() operator
drivers/acpi/acpica/acobject.h | 3 ++- drivers/acpi/acpica/dbinput.c | 2 +- drivers/acpi/acpica/dsfield.c | 2 +- drivers/acpi/acpica/dsopcode.c | 2 ++ drivers/acpi/acpica/dswload.c | 21 +++++++++++++++++++++ drivers/acpi/acpica/exfield.c | 10 ++++++++-- include/acpi/acpixf.h | 2 +- include/acpi/platform/acenv.h | 11 +++++++++++ 8 files changed, 47 insertions(+), 6 deletions(-)
Signature · 1 line
2.21.0
PATCH 1/5 ACPICA: debugger: fix spelling mistake "adress" -> "address"
From: Colin Ian King <[email protected]>
ACPICA commit 7aa72c5fdf75c5b80adf758980e06bcafb7f8670
There is a spelling mistake in an error message. Fix it.
--- drivers/acpi/acpica/dbinput.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/acpica/dbinput.c +1 -1
@@ -816,7 +816,7 @@ acpi_db_command_dispatch(char *input_buffer,if (ACPI_FAILURE (status) || temp64 >=ACPI_NUM_PREDEFINED_REGIONS ) {acpi_os_printf - ("Invalid adress space ID: must be between 0 and %u inclusive\n" , + ("Invalid address space ID: must be between 0 and %u inclusive\n" ,ACPI_NUM_PREDEFINED_REGIONS -1 );return (AE_OK ); }
Signature · 1 line
2.21.0
PATCH 2/5 ACPICA: Disassembler: create buffer fields in ACPI_PARSE_LOAD_PASS1
In reply to Erik KanedaACPICA commit 29cc8dbc5463a93625bed87d7550a8bed8913bf4
create_buffer_field is a deferred op that is typically processed in load pass 2. However, disassembly of control method contents walk the parse tree with ACPI_PARSE_LOAD_PASS1 and AML_CREATE operators are processed in a later walk. This is a problem when there is a control method that has the same name as the AML_CREATE object. In this case, any use of the name segment will be detected as a method call rather than a reference to a buffer field. If this is detected as a method call, it can result in a mal-formed parse tree if the control methods have parameters.
This change in processing AML_CREATE ops earlier solves this issue by inserting the named object in the ACPI namespace so that references to this name would be detected as a name string rather than a method call.
--- drivers/acpi/acpica/dsfield.c | 2 +- drivers/acpi/acpica/dswload.c | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-)
drivers/acpi/acpica/dsfield.c +1 -1
@@ -243,7 +243,7 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op,* FUNCTION: acpi_ds_get_field_names * * PARAMETERS: info - create_field info structure -* ` walk_state - Current method state +* walk_state - Current method state * arg - First parser arg for the field name list * * RETURN: Status
drivers/acpi/acpica/dswload.c +21 -0
@@ -410,6 +410,27 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state)ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH ,"Op=%p State=%p\n" , op, walk_state)); +/* +* Disassembler: handle create field operators here. +* +* create_buffer_field is a deferred op that is typically processed in load +* pass 2. However, disassembly of control method contents walk the parse +* tree with ACPI_PARSE_LOAD_PASS1 and AML_CREATE operators are processed +* in a later walk. This is a problem when there is a control method that +* has the same name as the AML_CREATE object. In this case, any use of the +* name segment will be detected as a method call rather than a reference +* to a buffer field. +* +* This earlier creation during disassembly solves this issue by inserting +* the named object in the ACPI namespace so that references to this name +* would be a name string rather than a method call. +*/ +if ((walk_state->parse_flags &ACPI_PARSE_DISASSEMBLE ) && + (walk_state->op_info->flags &AML_CREATE )) { + status =acpi_ds_create_buffer_field (op, walk_state); +return_ACPI_STATUS (status); + } +/* We are only interested in opcodes that have an associated name */ if (!(walk_state->op_info->flags & (AML_NAMED |AML_FIELD ))) {
Signature · 1 line
2.21.0
PATCH 3/5 ACPICA: acpisrc: add unix line ending support for non-windows build
In reply to Erik KanedaACPICA commit 48ef9f7456f0a73d1d6023ea8e79442cdcff757f
--- include/acpi/platform/acenv.h | 11 +++++++++++ 1 file changed, 11 insertions(+)
include/acpi/platform/acenv.h +11 -0
@@ -128,6 +128,17 @@#endif +/* +* acpisrc CR\LF support +* Unix file line endings do not include the carriage return. +* If the acpisrc utility is being built using a microsoft compiler, it means +* that it will be running on a windows machine which means that the output is +* expected to have CR/LF newlines. If the acpisrc utility is built with +* anything else, it will likely run on a system with LF newlines. This flag +* tells the acpisrc utility that newlines will be in the LF format. +*/ +#define ACPI_SRC_OS_LF_ONLY 0 +/*! [Begin] no source code translation */ /******************************************************************************
Signature · 1 line
2.21.0
PATCH 4/5 ACPICA: Dispatcher: always generate buffer objects for ASL create_field() operator
In reply to Erik KanedaFrom: Maximilian Luz <[email protected]>
ACPICA commit 79a466b64e6af36cc83102f05915e56cb7dd89ab
According to table 19-419 of the ACPI 6.3 specification, buffer_fields created using the ASL create_field() Operator have been treated as integers if the buffer_field is small enough to fit inside of an ASL integer (32-bits or 64-bits depending on the definition block revision). If they are larger, buffer fields are treated as ASL Buffer objects. However, this is not true for other AML interpreter implementations.
It has been discovered that other AML interpreters always treat buffer fields created by create_field() as a buffer regardless of the length of the buffer field.
More specifically, the Microsoft AML interpreter always treats buffer fields created by the create_field() operator as buffer. ACPICA currently does this only when the field size is larger than the maximum integer width. This causes problems with AML code shipped in Microsoft Surface devices.
More details:
The control methods in these devices determine the success of an ASL control method execution by examining the type resulting from storing a buffer field created by a create_field() operator. On success, a Buffer object is expected, on failure an Integer containing an error code. This buffer object is created with a dynamic size via the create_field() operator. Due to the difference in behavior, Buffer values of small size are however converted to Integers and thus interpreted by the control method as having failed, whereas in reality it succeeded. Below is an example of a control method called TEST that illustrates this behavior.
Method (CBUF) // Create a Buffer field
{
/*
* Depending on the value of RAND, ACPICA interpreter will treat
* BF00 as an integer or buffer.
*/
create_field (BUFF, 0, RAND, BF00)
return (BF00)
}Method (TEST)
{
/*
* Storing the value returned by CBUF to local0 will result in
* implicit type conversion outlined in the ACPI specification.
*
* ACPICA will treat local0 like an ASL integer if RAND is less
* than or equal to 64 or 32 (depending on the definition_block
* revision). If RAND is greater, it will be treated like an ASL
* buffer. Other implementations treat local0 like an ASL buffer
* regardless of the value of RAND.
*/
local0 = CBUF()
/*
* object_type of 0x03 represents an ASL Buffer
*/
if (object_type (Local0) != 0x03)
{
// Error on ACPICA if RAND is small enough
}
else
{
/*
* Success on APICA if RAND is large enough
* Other implementations always take this path because local0
* is always treated as a buffer.
*/
}
}This change prohibits the previously mentioned integer conversion to match other AML interpreter implementations (Microsoft) that do not conform to the ACPI specification.
--- drivers/acpi/acpica/acobject.h | 3 ++- drivers/acpi/acpica/dsopcode.c | 2 ++ drivers/acpi/acpica/exfield.c | 10 ++++++++-- 3 files changed, 12 insertions(+), 3 deletions(-)
drivers/acpi/acpica/acobject.h +2 -1
@@ -260,7 +260,8 @@ struct acpi_object_index_field {/* The buffer_field is different in that it is part of a Buffer, not an op_region */ struct acpi_object_buffer_field { - ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *buffer_obj; /* Containing Buffer object */ + ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO u8 is_create_field; /* Special case for objects created by create_field() */ +union acpi_operand_object *buffer_obj;/* Containing Buffer object */ };/******************************************************************************
drivers/acpi/acpica/dsopcode.c +2 -0
@@ -217,6 +217,8 @@ acpi_ds_init_buffer_field(u16 aml_opcode, } obj_desc->buffer_field.buffer_obj = buffer_desc; + obj_desc->buffer_field.is_create_field = + aml_opcode ==AML_CREATE_FIELD_OP ;/* Reference count for buffer_desc inherits obj_desc count */
drivers/acpi/acpica/exfield.c +8 -2
@@ -96,7 +96,8 @@ acpi_ex_get_protocol_buffer_length(u32 protocol_id, u32 *return_length)* RETURN: Status * * DESCRIPTION: Read from a named field. Returns either an Integer or a -* Buffer, depending on the size of the field. +* Buffer, depending on the size of the field and whether if a +* field is created by the create_field() operator. * ******************************************************************************/
@@ -154,12 +155,17 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,* the use of arithmetic operators on the returned value if the * field size is equal or smaller than an Integer. * +* However, all buffer fields created by create_field operator needs to +* remain as a buffer to match other AML interpreter implementations. +* * Note: Field.length is in bits. */ buffer_length = (acpi_size )ACPI_ROUND_BITS_UP_TO_BYTES (obj_desc->field.bit_length); -if (buffer_length > acpi_gbl_integer_byte_width) { +if (buffer_length > acpi_gbl_integer_byte_width || + (obj_desc->common.type ==ACPI_TYPE_BUFFER_FIELD && + obj_desc->buffer_field.is_create_field)) {/* Field is too large for an Integer, create a Buffer instead */
Signature · 1 line
2.21.0
PATCH 5/5 ACPICA: Update version to 20191213
In reply to Erik KanedaFrom: Bob Moore <[email protected]>
ACPICA commit 0b61217c5c706b39070bb6b4b154435e9ef36c3e
Version 20191213.
--- include/acpi/acpixf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/acpi/acpixf.h +1 -1
@@ -12,7 +12,7 @@/* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20191018 +#define ACPI_CA_VERSION 0x20191213#include <acpi/acconfig.h> #include <acpi/actypes.h>
Signature · 1 line
2.21.0
Rafael J. Wysocki
maintainerQuoted 18 lines · Erik Kaneda
This patchset contains a linux-ized patchset of the 20191213 release of ACPICA. Notable patches include Maximilan Luz's change to the AML interpreter to always treat buffer fields created from the ASL
CreateField()operator as buffers rather than treating it as an integer if the buffer field is small enough to fit an integer. Other than that, there is a disassembler change to properly disassemble references to buffer fields that share the same namesegment as a method.This patchset is also available at the following link:
https://github.com/SchmErik/linux/tree/20191213Bob Moore (1):
ACPICA: Update version to 20191213Colin Ian King (1):
ACPICA: debugger: fix spelling mistake "adress" -> "address"
Quoted 7 lines
Erik Kaneda (2):
ACPICA: Disassembler: create buffer fields inACPI_PARSE_LOAD_PASS1
ACPICA: acpisrc: add unix line ending support for non-windows buildMaximilian Luz (1):
ACPICA: Dispatcher: always generate buffer objects for ASL
create_field()operator
Applying the whole series as 5.6 material, thanks!