forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/drivers/acpi/acpica/nsinit.c
....@@ -3,7 +3,7 @@
33 *
44 * Module Name: nsinit - namespace initialization
55 *
6
- * Copyright (C) 2000 - 2018, Intel Corp.
6
+ * Copyright (C) 2000 - 2020, Intel Corp.
77 *
88 *****************************************************************************/
99
....@@ -55,14 +55,19 @@
5555 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
5656 "**** Starting initialization of namespace objects ****\n"));
5757 ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
58
- "Completing Region/Field/Buffer/Package initialization:\n"));
58
+ "Final data object initialization: "));
5959
60
- /* Set all init info to zero */
60
+ /* Clear the info block */
6161
6262 memset(&info, 0, sizeof(struct acpi_init_walk_info));
6363
6464 /* Walk entire namespace from the supplied root */
6565
66
+ /*
67
+ * TBD: will become ACPI_TYPE_PACKAGE as this type object
68
+ * is now the only one that supports deferred initialization
69
+ * (forward references).
70
+ */
6671 status = acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
6772 ACPI_UINT32_MAX, acpi_ns_init_one_object,
6873 NULL, &info, NULL);
....@@ -71,13 +76,8 @@
7176 }
7277
7378 ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
74
- " Initialized %u/%u Regions %u/%u Fields %u/%u "
75
- "Buffers %u/%u Packages (%u nodes)\n",
76
- info.op_region_init, info.op_region_count,
77
- info.field_init, info.field_count,
78
- info.buffer_init, info.buffer_count,
79
- info.package_init, info.package_count,
80
- info.object_count));
79
+ "Namespace contains %u (0x%X) objects\n",
80
+ info.object_count, info.object_count));
8181
8282 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
8383 "%u Control Methods found\n%u Op Regions found\n",
....@@ -382,32 +382,16 @@
382382 acpi_ex_enter_interpreter();
383383
384384 /*
385
- * Each of these types can contain executable AML code within the
386
- * declaration.
385
+ * Only initialization of Package objects can be deferred, in order
386
+ * to support forward references.
387387 */
388388 switch (type) {
389
- case ACPI_TYPE_REGION:
390
-
391
- info->op_region_init++;
392
- status = acpi_ds_get_region_arguments(obj_desc);
393
- break;
394
-
395
- case ACPI_TYPE_BUFFER_FIELD:
396
-
397
- info->field_init++;
398
- status = acpi_ds_get_buffer_field_arguments(obj_desc);
399
- break;
400
-
401389 case ACPI_TYPE_LOCAL_BANK_FIELD:
390
+
391
+ /* TBD: bank_fields do not require deferred init, remove this code */
402392
403393 info->field_init++;
404394 status = acpi_ds_get_bank_field_arguments(obj_desc);
405
- break;
406
-
407
- case ACPI_TYPE_BUFFER:
408
-
409
- info->buffer_init++;
410
- status = acpi_ds_get_buffer_arguments(obj_desc);
411395 break;
412396
413397 case ACPI_TYPE_PACKAGE:
....@@ -421,8 +405,13 @@
421405
422406 default:
423407
424
- /* No other types can get here */
408
+ /* No other types should get here */
425409
410
+ status = AE_TYPE;
411
+ ACPI_EXCEPTION((AE_INFO, status,
412
+ "Opcode is not deferred [%4.4s] (%s)",
413
+ acpi_ut_get_node_name(node),
414
+ acpi_ut_get_type_name(type)));
426415 break;
427416 }
428417
....@@ -478,7 +467,7 @@
478467
479468 /* We are only looking for methods named _INI */
480469
481
- if (!ACPI_COMPARE_NAME(node->name.ascii, METHOD_NAME__INI)) {
470
+ if (!ACPI_COMPARE_NAMESEG(node->name.ascii, METHOD_NAME__INI)) {
482471 return (AE_OK);
483472 }
484473
....@@ -641,7 +630,7 @@
641630 * Note: We know there is an _INI within this subtree, but it may not be
642631 * under this particular device, it may be lower in the branch.
643632 */
644
- if (!ACPI_COMPARE_NAME(device_node->name.ascii, "_SB_") ||
633
+ if (!ACPI_COMPARE_NAMESEG(device_node->name.ascii, "_SB_") ||
645634 device_node->parent != acpi_gbl_root_node) {
646635 ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname
647636 (ACPI_TYPE_METHOD, device_node,