Skip to contentSkip to conversation

ACPICA release 20200430

PATCH In review Erik Kaneda 2 participants 8 messages May 5, 2020 – May 9, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover ACPICA release 20200430

This series contains the linux-ized patches of the 20200430 ACPICA release. There are two patches to fix sparse warnings that are generated from global variables, and a fix to avoid null pointer dereferences in the dispatcher. Aside from that, there is a fix to correct the required parameters for the predefined ACPI methods _NIH and _NIG.

Bob Moore (1):
ACPICA: Update version to 20200430

Erik Kaneda (4):
ACPICA: Move acpi_gbl_next_cmd_num definition to acglobal.h
ACPICA: Disassembler: ignore AE_ALREADY_EXISTS status when parsing
create operators
ACPICA: Dispatcher: add status checks to avoid NULL pointer
dereference on field objects
ACPICA: Fix required parameters for _NIG and _NIH

Yue Haibing (1):
ACPICA: Make acpi_protocol_lengths static

 drivers/acpi/acpica/acglobal.h |  1 +
 drivers/acpi/acpica/acpredef.h |  4 ++--
 drivers/acpi/acpica/dbhistry.c |  1 -
 drivers/acpi/acpica/dsfield.c  | 22 ++++++++++++++++------
 drivers/acpi/acpica/exfield.c  |  2 +-
 include/acpi/acpixf.h          |  2 +-
 6 files changed, 21 insertions(+), 11 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/6 ACPICA: Make acpi_protocol_lengths static

From: Yue Haibing <[email protected]>

ACPICA commit 0ebacf12b8ca66ce6d3fce4d349b3f2448da18cb

A linux-based static analyzer (sparse) caught this as a warning. Making this variable static will result in better optimizations and ensure that this variable does not get used outside of this file.

[ek: commit message]
---
 drivers/acpi/acpica/exfield.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/acpica/exfield.c +1 -1
index e85eb31e5075..3323a2ba6a31 100644
@@ -22,7 +22,7 @@ ACPI_MODULE_NAME("exfield")
  */
 #define ACPI_INVALID_PROTOCOL_ID        0x80
 #define ACPI_MAX_PROTOCOL_ID            0x0F
-const u8 acpi_protocol_lengths[] = {
+static const u8 acpi_protocol_lengths[] = {
 	ACPI_INVALID_PROTOCOL_ID,	/* 0 - reserved */
 	ACPI_INVALID_PROTOCOL_ID,	/* 1 - reserved */
 	0x00,			/* 2 - ATTRIB_QUICK */
Signature · 1 line
2.25.1
#2 lore raw

PATCH 2/6 ACPICA: Move acpi_gbl_next_cmd_num definition to acglobal.h

In reply to Erik Kaneda

ACPICA commit 8296a24f33984c26a61103c590b049de3c9b61ff

This commit cleans up the code by moving the global definition out of dbhistry.c to acglobal.h.

---
 drivers/acpi/acpica/acglobal.h | 1 +
 drivers/acpi/acpica/dbhistry.c | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/acpica/acglobal.h +1 -0
index 38ffa2c0a496..1030a0ce1599 100644
@@ -290,6 +290,7 @@ ACPI_GLOBAL(struct acpi_external_file *, acpi_gbl_external_file_list);
 #ifdef ACPI_DEBUGGER
 ACPI_INIT_GLOBAL(u8, acpi_gbl_abort_method, FALSE);
 ACPI_INIT_GLOBAL(acpi_thread_id, acpi_gbl_db_thread_id, ACPI_INVALID_THREAD_ID);
+ACPI_INIT_GLOBAL(u32, acpi_gbl_next_cmd_num, 1);
 
 ACPI_GLOBAL(u8, acpi_gbl_db_opt_no_ini_methods);
 ACPI_GLOBAL(u8, acpi_gbl_db_opt_no_region_support);
drivers/acpi/acpica/dbhistry.c +0 -1
index bb9600b867ee..f5fba14461a6 100644
@@ -27,7 +27,6 @@ static HISTORY_INFO acpi_gbl_history_buffer[HISTORY_SIZE];
 static u16 acpi_gbl_lo_history = 0;
 static u16 acpi_gbl_num_history = 0;
 static u16 acpi_gbl_next_history_index = 0;
-u32 acpi_gbl_next_cmd_num = 1;
 
 /*******************************************************************************
  *
Signature · 1 line
2.25.1
#3 lore raw

PATCH 3/6 ACPICA: Disassembler: ignore AE_ALREADY_EXISTS status when parsing create operators

In reply to Erik Kaneda

ACPICA commit cd66d0a50fdc9cc4dcd998e08e7aa3c4154bea2d

Disassembler is intended to emit existing ASL code as-is. Therefore, error messages emitted during disassembly should be ignored or handled in a way such that the disassembler can continue to parse the AML. This change ignores AE_ALREADY_EXISTS errors during the deferred Op parsing for create operators in order to complete parsing ASL termlists.

---
 drivers/acpi/acpica/dsfield.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/acpi/acpica/dsfield.c +4 -1
index c901f5aec739..0189b5d4e3a3 100644
@@ -177,7 +177,10 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op,
 					arg->common.value.string, ACPI_TYPE_ANY,
 					ACPI_IMODE_LOAD_PASS1, flags,
 					walk_state, &node);
-		if (ACPI_FAILURE(status)) {
+		if ((walk_state->parse_flags & ACPI_PARSE_DISASSEMBLE)
+		    && status == AE_ALREADY_EXISTS) {
+			status = AE_OK;
+		} else if (ACPI_FAILURE(status)) {
 			ACPI_ERROR_NAMESPACE(walk_state->scope_info,
 					     arg->common.value.string, status);
 			return_ACPI_STATUS(status);
Signature · 1 line
2.25.1
#4 lore raw

PATCH 4/6 ACPICA: Dispatcher: add status checks

In reply to Erik Kaneda

The status chekcs are used to to avoid NULL pointer dereference on field objects

ACPICA commit 3244c1eeba9f9fb9ccedb875f7923a3d85e0c6aa

---
 drivers/acpi/acpica/dsfield.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/acpi/acpica/dsfield.c +12 -5
index 0189b5d4e3a3..fa768b3a989e 100644
@@ -517,13 +517,20 @@ acpi_ds_create_field(union acpi_parse_object *op,
 	info.region_node = region_node;
 
 	status = acpi_ds_get_field_names(&info, walk_state, arg->common.next);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
+	}
+
 	if (info.region_node->object->region.space_id ==
-	    ACPI_ADR_SPACE_PLATFORM_COMM
-	    && !(region_node->object->field.internal_pcc_buffer =
-		 ACPI_ALLOCATE_ZEROED(info.region_node->object->region.
-				      length))) {
-		return_ACPI_STATUS(AE_NO_MEMORY);
+	    ACPI_ADR_SPACE_PLATFORM_COMM) {
+		region_node->object->field.internal_pcc_buffer =
+		    ACPI_ALLOCATE_ZEROED(info.region_node->object->region.
+					 length);
+		if (!region_node->object->field.internal_pcc_buffer) {
+			return_ACPI_STATUS(AE_NO_MEMORY);
+		}
 	}
+
 	return_ACPI_STATUS(status);
 }
 
Signature · 1 line
2.25.1
#5 lore raw

PATCH 5/6 ACPICA: Fix required parameters for _NIG and _NIH

In reply to Erik Kaneda

ACPICA commit 4b0e043386c7e698bea9e862f60a388647f56622

Previously, there was a mixup where _NIG required one parameter and _NIH required zero parameters. This changes swaps these parameter requirements. Now this change requires _NIH to be called with one parameter and _NIG requires zero.

---
 drivers/acpi/acpica/acpredef.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/acpi/acpica/acpredef.h +2 -2
index cd0f5df0ea23..2cbb56652f1c 100644
@@ -640,10 +640,10 @@ const union acpi_predefined_info acpi_gbl_predefined_methods[] = {
 	{{"_NIC", METHOD_0ARGS,	/* ACPI 6.3 */
 	  METHOD_RETURNS(ACPI_RTYPE_BUFFER)}},
 
-	{{"_NIG", METHOD_1ARGS(ACPI_TYPE_BUFFER),	/* ACPI 6.3 */
+	{{"_NIG", METHOD_0ARGS, /* ACPI 6.3 */
 	  METHOD_RETURNS(ACPI_RTYPE_BUFFER)}},
 
-	{{"_NIH", METHOD_0ARGS,	/* ACPI 6.3 */
+	{{"_NIH", METHOD_1ARGS(ACPI_TYPE_BUFFER), /* ACPI 6.3 */
 	  METHOD_RETURNS(ACPI_RTYPE_BUFFER)}},
 
 	{{"_NTT", METHOD_0ARGS,
Signature · 1 line
2.25.1
#6 lore raw

PATCH 6/6 ACPICA: Update version to 20200430

In reply to Erik Kaneda

From: Bob Moore <[email protected]>

ACPICA commit c00a5cd99fa3fe6cd053a2a1a557e54b4fea26f7

Version 20200430.

---
 include/acpi/acpixf.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/acpi/acpixf.h +1 -1
index 49b519f36b69..1dc8d262035b 100644
@@ -12,7 +12,7 @@
 
 /* Current ACPICA subsystem version in YYYYMMDD format */
 
-#define ACPI_CA_VERSION                 0x20200326
+#define ACPI_CA_VERSION                 0x20200430
 
 #include <acpi/acconfig.h>
 #include <acpi/actypes.h>
Signature · 1 line
2.25.1
#7 lore raw
In reply to Erik Kaneda
Quoted 21 lines · CEST Erik Kaneda

This series contains the linux-ized patches of the 20200430 ACPICA release. There are two patches to fix sparse warnings that are generated from global variables, and a fix to avoid null pointer dereferences in the dispatcher. Aside from that, there is a fix to correct the required parameters for the predefined ACPI methods _NIH and _NIG.

Bob Moore (1):
ACPICA: Update version to 20200430

Erik Kaneda (4):
ACPICA: Move acpi_gbl_next_cmd_num definition to acglobal.h
ACPICA: Disassembler: ignore AE_ALREADY_EXISTS status when parsing
create operators
ACPICA: Dispatcher: add status checks to avoid NULL pointer
dereference on field objects
ACPICA: Fix required parameters for _NIG and _NIH

Yue Haibing (1):
ACPICA: Make acpi_protocol_lengths static

Quoted 9 lines
 drivers/acpi/acpica/acglobal.h |  1 +
 drivers/acpi/acpica/acpredef.h |  4 ++--
 drivers/acpi/acpica/dbhistry.c |  1 -
 drivers/acpi/acpica/dsfield.c  | 22 ++++++++++++++++------
 drivers/acpi/acpica/exfield.c  |  2 +-
 include/acpi/acpixf.h          |  2 +-
 6 files changed, 21 insertions(+), 11 deletions(-)

All patches applied as 5.8 material, thanks!