All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] ACPICA version 20191213 patches
@ 2019-12-17 19:35 Erik Kaneda
  2019-12-17 19:35 ` [PATCH 1/5] ACPICA: debugger: fix spelling mistake "adress" -> "address" Erik Kaneda
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Erik Kaneda @ 2019-12-17 19:35 UTC (permalink / raw)
  To: Rafael J . Wysocki, linux-acpi; +Cc: 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/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(-)

-- 
2.21.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/5] ACPICA: debugger: fix spelling mistake "adress" -> "address"
  2019-12-17 19:35 [PATCH 0/5] ACPICA version 20191213 patches Erik Kaneda
@ 2019-12-17 19:35 ` Erik Kaneda
  2019-12-17 19:35 ` [PATCH 2/5] ACPICA: Disassembler: create buffer fields in ACPI_PARSE_LOAD_PASS1 Erik Kaneda
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Erik Kaneda @ 2019-12-17 19:35 UTC (permalink / raw)
  To: Rafael J . Wysocki, linux-acpi; +Cc: Colin Ian King, Bob Moore, Erik Kaneda

From: Colin Ian King <colin.king@canonical.com>

ACPICA commit 7aa72c5fdf75c5b80adf758980e06bcafb7f8670

There is a spelling mistake in an error message. Fix it.

Link: https://github.com/acpica/acpica/commit/7aa72c5f
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
---
 drivers/acpi/acpica/dbinput.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/acpica/dbinput.c b/drivers/acpi/acpica/dbinput.c
index e1632b340182..aa71f65395d2 100644
--- a/drivers/acpi/acpica/dbinput.c
+++ b/drivers/acpi/acpica/dbinput.c
@@ -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);
 		}
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/5] ACPICA: Disassembler: create buffer fields in ACPI_PARSE_LOAD_PASS1
  2019-12-17 19:35 [PATCH 0/5] ACPICA version 20191213 patches Erik Kaneda
  2019-12-17 19:35 ` [PATCH 1/5] ACPICA: debugger: fix spelling mistake "adress" -> "address" Erik Kaneda
@ 2019-12-17 19:35 ` Erik Kaneda
  2019-12-17 19:35 ` [PATCH 3/5] ACPICA: acpisrc: add unix line ending support for non-windows build Erik Kaneda
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Erik Kaneda @ 2019-12-17 19:35 UTC (permalink / raw)
  To: Rafael J . Wysocki, linux-acpi; +Cc: Erik Kaneda, Elia Geretto, Bob Moore

ACPICA 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.

Link: https://github.com/acpica/acpica/commit/29cc8dbc
Reported-by: Elia Geretto <elia.f.geretto@gmail.com>
Tested-by: Elia Geretto <elia.f.geretto@gmail.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
---
 drivers/acpi/acpica/dsfield.c |  2 +-
 drivers/acpi/acpica/dswload.c | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/acpica/dsfield.c b/drivers/acpi/acpica/dsfield.c
index faa38a22263a..ae713d746c8b 100644
--- a/drivers/acpi/acpica/dsfield.c
+++ b/drivers/acpi/acpica/dsfield.c
@@ -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
diff --git a/drivers/acpi/acpica/dswload.c b/drivers/acpi/acpica/dswload.c
index c88fd31208a5..4bcf15bf03de 100644
--- a/drivers/acpi/acpica/dswload.c
+++ b/drivers/acpi/acpica/dswload.c
@@ -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))) {
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/5] ACPICA: acpisrc: add unix line ending support for non-windows build
  2019-12-17 19:35 [PATCH 0/5] ACPICA version 20191213 patches Erik Kaneda
  2019-12-17 19:35 ` [PATCH 1/5] ACPICA: debugger: fix spelling mistake "adress" -> "address" Erik Kaneda
  2019-12-17 19:35 ` [PATCH 2/5] ACPICA: Disassembler: create buffer fields in ACPI_PARSE_LOAD_PASS1 Erik Kaneda
@ 2019-12-17 19:35 ` Erik Kaneda
  2019-12-17 19:35 ` [PATCH 4/5] ACPICA: Dispatcher: always generate buffer objects for ASL create_field() operator Erik Kaneda
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Erik Kaneda @ 2019-12-17 19:35 UTC (permalink / raw)
  To: Rafael J . Wysocki, linux-acpi; +Cc: Erik Kaneda, Bob Moore

ACPICA commit 48ef9f7456f0a73d1d6023ea8e79442cdcff757f

Link: https://github.com/acpica/acpica/commit/48ef9f74
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
---
 include/acpi/platform/acenv.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h
index 35ab3f87cc29..94e89ad478f5 100644
--- a/include/acpi/platform/acenv.h
+++ b/include/acpi/platform/acenv.h
@@ -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 */
 
 /******************************************************************************
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/5] ACPICA: Dispatcher: always generate buffer objects for ASL create_field() operator
  2019-12-17 19:35 [PATCH 0/5] ACPICA version 20191213 patches Erik Kaneda
                   ` (2 preceding siblings ...)
  2019-12-17 19:35 ` [PATCH 3/5] ACPICA: acpisrc: add unix line ending support for non-windows build Erik Kaneda
@ 2019-12-17 19:35 ` Erik Kaneda
  2019-12-17 19:35 ` [PATCH 5/5] ACPICA: Update version to 20191213 Erik Kaneda
  2019-12-19 22:06 ` [PATCH 0/5] ACPICA version 20191213 patches Rafael J. Wysocki
  5 siblings, 0 replies; 7+ messages in thread
From: Erik Kaneda @ 2019-12-17 19:35 UTC (permalink / raw)
  To: Rafael J . Wysocki, linux-acpi; +Cc: Maximilian Luz, Bob Moore, Erik Kaneda

From: Maximilian Luz <luzmaximilian@gmail.com>

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.

Link: https://github.com/acpica/acpica/commit/79a466b6
Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
---
 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(-)

diff --git a/drivers/acpi/acpica/acobject.h b/drivers/acpi/acpica/acobject.h
index 8def0e3d690f..10154a8157ec 100644
--- a/drivers/acpi/acpica/acobject.h
+++ b/drivers/acpi/acpica/acobject.h
@@ -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 */
 };
 
 /******************************************************************************
diff --git a/drivers/acpi/acpica/dsopcode.c b/drivers/acpi/acpica/dsopcode.c
index 10f32b62608e..2488218f8562 100644
--- a/drivers/acpi/acpica/dsopcode.c
+++ b/drivers/acpi/acpica/dsopcode.c
@@ -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 */
 
diff --git a/drivers/acpi/acpica/exfield.c b/drivers/acpi/acpica/exfield.c
index d3d2dbfba680..633417650f3d 100644
--- a/drivers/acpi/acpica/exfield.c
+++ b/drivers/acpi/acpica/exfield.c
@@ -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 */
 
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 5/5] ACPICA: Update version to 20191213
  2019-12-17 19:35 [PATCH 0/5] ACPICA version 20191213 patches Erik Kaneda
                   ` (3 preceding siblings ...)
  2019-12-17 19:35 ` [PATCH 4/5] ACPICA: Dispatcher: always generate buffer objects for ASL create_field() operator Erik Kaneda
@ 2019-12-17 19:35 ` Erik Kaneda
  2019-12-19 22:06 ` [PATCH 0/5] ACPICA version 20191213 patches Rafael J. Wysocki
  5 siblings, 0 replies; 7+ messages in thread
From: Erik Kaneda @ 2019-12-17 19:35 UTC (permalink / raw)
  To: Rafael J . Wysocki, linux-acpi; +Cc: Bob Moore, Erik Kaneda

From: Bob Moore <robert.moore@intel.com>

ACPICA commit 0b61217c5c706b39070bb6b4b154435e9ef36c3e

Version 20191213.

Link: https://github.com/acpica/acpica/commit/0b61217c
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
---
 include/acpi/acpixf.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 18790b9e16b5..c558d3677a4a 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -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>
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/5] ACPICA version 20191213 patches
  2019-12-17 19:35 [PATCH 0/5] ACPICA version 20191213 patches Erik Kaneda
                   ` (4 preceding siblings ...)
  2019-12-17 19:35 ` [PATCH 5/5] ACPICA: Update version to 20191213 Erik Kaneda
@ 2019-12-19 22:06 ` Rafael J. Wysocki
  5 siblings, 0 replies; 7+ messages in thread
From: Rafael J. Wysocki @ 2019-12-19 22:06 UTC (permalink / raw)
  To: Erik Kaneda; +Cc: Rafael J . Wysocki, ACPI Devel Maling List

On Tue, Dec 17, 2019 at 8:55 PM Erik Kaneda <erik.kaneda@intel.com> wrote:
>
> 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

Applying the whole series as 5.6 material, thanks!

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-12-19 22:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-17 19:35 [PATCH 0/5] ACPICA version 20191213 patches Erik Kaneda
2019-12-17 19:35 ` [PATCH 1/5] ACPICA: debugger: fix spelling mistake "adress" -> "address" Erik Kaneda
2019-12-17 19:35 ` [PATCH 2/5] ACPICA: Disassembler: create buffer fields in ACPI_PARSE_LOAD_PASS1 Erik Kaneda
2019-12-17 19:35 ` [PATCH 3/5] ACPICA: acpisrc: add unix line ending support for non-windows build Erik Kaneda
2019-12-17 19:35 ` [PATCH 4/5] ACPICA: Dispatcher: always generate buffer objects for ASL create_field() operator Erik Kaneda
2019-12-17 19:35 ` [PATCH 5/5] ACPICA: Update version to 20191213 Erik Kaneda
2019-12-19 22:06 ` [PATCH 0/5] ACPICA version 20191213 patches Rafael J. Wysocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.