forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/drivers/acpi/acpica/dsopcode.c
....@@ -3,7 +3,7 @@
33 *
44 * Module Name: dsopcode - Dispatcher support for regions and fields
55 *
6
- * Copyright (C) 2000 - 2018, Intel Corp.
6
+ * Copyright (C) 2000 - 2020, Intel Corp.
77 *
88 *****************************************************************************/
99
....@@ -130,8 +130,8 @@
130130 /* Must have a valid (>0) bit count */
131131
132132 if (bit_count == 0) {
133
- ACPI_ERROR((AE_INFO,
134
- "Attempt to CreateField of length zero"));
133
+ ACPI_BIOS_ERROR((AE_INFO,
134
+ "Attempt to CreateField of length zero"));
135135 status = AE_AML_OPERAND_VALUE;
136136 goto cleanup;
137137 }
....@@ -194,12 +194,13 @@
194194 /* Entire field must fit within the current length of the buffer */
195195
196196 if ((bit_offset + bit_count) > (8 * (u32)buffer_desc->buffer.length)) {
197
- ACPI_ERROR((AE_INFO,
198
- "Field [%4.4s] at bit offset/length %u/%u "
199
- "exceeds size of target Buffer (%u bits)",
200
- acpi_ut_get_node_name(result_desc), bit_offset,
201
- bit_count, 8 * (u32)buffer_desc->buffer.length));
202197 status = AE_AML_BUFFER_LIMIT;
198
+ ACPI_BIOS_EXCEPTION((AE_INFO, status,
199
+ "Field [%4.4s] at bit offset/length %u/%u "
200
+ "exceeds size of target Buffer (%u bits)",
201
+ acpi_ut_get_node_name(result_desc),
202
+ bit_offset, bit_count,
203
+ 8 * (u32)buffer_desc->buffer.length));
203204 goto cleanup;
204205 }
205206
....@@ -216,6 +217,8 @@
216217 }
217218
218219 obj_desc->buffer_field.buffer_obj = buffer_desc;
220
+ obj_desc->buffer_field.is_create_field =
221
+ aml_opcode == AML_CREATE_FIELD_OP;
219222
220223 /* Reference count for buffer_desc inherits obj_desc count */
221224
....@@ -355,6 +358,7 @@
355358 union acpi_operand_object *operand_desc;
356359 struct acpi_namespace_node *node;
357360 union acpi_parse_object *next_op;
361
+ acpi_adr_space_type space_id;
358362
359363 ACPI_FUNCTION_TRACE_PTR(ds_eval_region_operands, op);
360364
....@@ -367,6 +371,7 @@
367371 /* next_op points to the op that holds the space_ID */
368372
369373 next_op = op->common.value.arg;
374
+ space_id = (acpi_adr_space_type)next_op->common.value.integer;
370375
371376 /* next_op points to address op */
372377
....@@ -401,6 +406,15 @@
401406
402407 obj_desc->region.length = (u32) operand_desc->integer.value;
403408 acpi_ut_remove_reference(operand_desc);
409
+
410
+ /* A zero-length operation region is unusable. Just warn */
411
+
412
+ if (!obj_desc->region.length
413
+ && (space_id < ACPI_NUM_PREDEFINED_REGIONS)) {
414
+ ACPI_WARNING((AE_INFO,
415
+ "Operation Region [%4.4s] has zero length (SpaceId %X)",
416
+ node->name.ascii, space_id));
417
+ }
404418
405419 /*
406420 * Get the address and save it
....@@ -522,10 +536,6 @@
522536 obj_desc,
523537 ACPI_FORMAT_UINT64(obj_desc->region.address),
524538 obj_desc->region.length));
525
-
526
- status = acpi_ut_add_address_range(obj_desc->region.space_id,
527
- obj_desc->region.address,
528
- obj_desc->region.length, node);
529539
530540 /* Now the address and length are valid for this opregion */
531541