📄 dsutils.c
字号:
* Only error is underflow, and this indicates * a missing or null operand! */ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Missing or null operand, %s\n", acpi_format_exception (status))); return_ACPI_STATUS (status); } } else { /* Create an ACPI_INTERNAL_OBJECT for the argument */ obj_desc = acpi_ut_create_internal_object (data_type); if (!obj_desc) { return_ACPI_STATUS (AE_NO_MEMORY); } /* Initialize the new object */ status = acpi_ds_init_object_from_op (walk_state, arg, opcode, &obj_desc); if (ACPI_FAILURE (status)) { acpi_ut_delete_object_desc (obj_desc); return_ACPI_STATUS (status); } } /* Put the operand object on the object stack */ status = acpi_ds_obj_stack_push (obj_desc, walk_state); if (ACPI_FAILURE (status)) { return_ACPI_STATUS (status); } DEBUGGER_EXEC (acpi_db_display_argument_object (obj_desc, walk_state)); } return_ACPI_STATUS (AE_OK);}/******************************************************************************* * * FUNCTION: Acpi_ds_create_operands * * PARAMETERS: First_arg - First argument of a parser argument tree * * RETURN: Status * * DESCRIPTION: Convert an operator's arguments from a parse tree format to * namespace objects and place those argument object on the object * stack in preparation for evaluation by the interpreter. * ******************************************************************************/acpi_statusacpi_ds_create_operands ( acpi_walk_state *walk_state, acpi_parse_object *first_arg){ acpi_status status = AE_OK; acpi_parse_object *arg; u32 arg_count = 0; FUNCTION_TRACE_PTR ("Ds_create_operands", first_arg); /* For all arguments in the list... */ arg = first_arg; while (arg) { status = acpi_ds_create_operand (walk_state, arg, arg_count); if (ACPI_FAILURE (status)) { goto cleanup; } ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Arg #%d (%p) done, Arg1=%p\n", arg_count, arg, first_arg)); /* Move on to next argument, if any */ arg = arg->next; arg_count++; } return_ACPI_STATUS (status);cleanup: /* * We must undo everything done above; meaning that we must * pop everything off of the operand stack and delete those * objects */ acpi_ds_obj_stack_pop_and_delete (arg_count, walk_state); ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "While creating Arg %d - %s\n", (arg_count + 1), acpi_format_exception (status))); return_ACPI_STATUS (status);}/******************************************************************************* * * FUNCTION: Acpi_ds_resolve_operands * * PARAMETERS: Walk_state - Current walk state with operands on stack * * RETURN: Status * * DESCRIPTION: Resolve all operands to their values. Used to prepare * arguments to a control method invocation (a call from one * method to another.) * ******************************************************************************/acpi_statusacpi_ds_resolve_operands ( acpi_walk_state *walk_state){ u32 i; acpi_status status = AE_OK; FUNCTION_TRACE_PTR ("Ds_resolve_operands", walk_state); /* * Attempt to resolve each of the valid operands * Method arguments are passed by value, not by reference */ /* * TBD: [Investigate] Note from previous parser: * Ref_of problem with Acpi_ex_resolve_to_value() conversion. */ for (i = 0; i < walk_state->num_operands; i++) { status = acpi_ex_resolve_to_value (&walk_state->operands[i], walk_state); if (ACPI_FAILURE (status)) { break; } } return_ACPI_STATUS (status);}/******************************************************************************* * * FUNCTION: Acpi_ds_map_opcode_to_data_type * * PARAMETERS: Opcode - AML opcode to map * Out_flags - Additional info about the opcode * * RETURN: The ACPI type associated with the opcode * * DESCRIPTION: Convert a raw AML opcode to the associated ACPI data type, * if any. If the opcode returns a value as part of the * intepreter execution, a flag is returned in Out_flags. * ******************************************************************************/acpi_object_type8acpi_ds_map_opcode_to_data_type ( u16 opcode, u32 *out_flags){ acpi_object_type8 data_type = INTERNAL_TYPE_INVALID; const acpi_opcode_info *op_info; u32 flags = 0; PROC_NAME ("Ds_map_opcode_to_data_type"); op_info = acpi_ps_get_opcode_info (opcode); if (op_info->class == AML_CLASS_UNKNOWN) { /* Unknown opcode */ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown AML opcode: %x\n", opcode)); return (data_type); }/* * TBD: Use op class */ switch (op_info->type) { case AML_TYPE_LITERAL: switch (opcode) { case AML_BYTE_OP: case AML_WORD_OP: case AML_DWORD_OP: case AML_QWORD_OP: data_type = ACPI_TYPE_INTEGER; break; case AML_STRING_OP: data_type = ACPI_TYPE_STRING; break; case AML_INT_NAMEPATH_OP: data_type = INTERNAL_TYPE_REFERENCE; break; default: ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown (type LITERAL) AML opcode: %x\n", opcode)); break; } break; case AML_TYPE_DATA_TERM: switch (opcode) { case AML_BUFFER_OP: data_type = ACPI_TYPE_BUFFER; break; case AML_PACKAGE_OP: case AML_VAR_PACKAGE_OP: data_type = ACPI_TYPE_PACKAGE; break; default: ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown (type DATA_TERM) AML opcode: %x\n", opcode)); break; } break; case AML_TYPE_CONSTANT: case AML_TYPE_METHOD_ARGUMENT: case AML_TYPE_LOCAL_VARIABLE: data_type = INTERNAL_TYPE_REFERENCE; break; case AML_TYPE_EXEC_1A_0T_1R: case AML_TYPE_EXEC_1A_1T_1R: case AML_TYPE_EXEC_2A_0T_1R: case AML_TYPE_EXEC_2A_1T_1R: case AML_TYPE_EXEC_2A_2T_1R: case AML_TYPE_EXEC_3A_1T_1R: case AML_TYPE_EXEC_6A_0T_1R: case AML_TYPE_RETURN: flags = OP_HAS_RETURN_VALUE; data_type = ACPI_TYPE_ANY; break; case AML_TYPE_METHOD_CALL: flags = OP_HAS_RETURN_VALUE; data_type = ACPI_TYPE_METHOD; break; case AML_TYPE_NAMED_FIELD: case AML_TYPE_NAMED_SIMPLE: case AML_TYPE_NAMED_COMPLEX: case AML_TYPE_NAMED_NO_OBJ: data_type = acpi_ds_map_named_opcode_to_data_type (opcode); break; case AML_TYPE_EXEC_1A_0T_0R: case AML_TYPE_EXEC_2A_0T_0R: case AML_TYPE_EXEC_3A_0T_0R: case AML_TYPE_EXEC_1A_1T_0R: case AML_TYPE_CONTROL: /* No mapping needed at this time */ break; default: ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unimplemented data type opcode: %x\n", opcode)); break; } /* Return flags to caller if requested */ if (out_flags) { *out_flags = flags; } return (data_type);}/******************************************************************************* * * FUNCTION: Acpi_ds_map_named_opcode_to_data_type * * PARAMETERS: Opcode - The Named AML opcode to map * * RETURN: The ACPI type associated with the named opcode * * DESCRIPTION: Convert a raw Named AML opcode to the associated data type. * Named opcodes are a subsystem of the AML opcodes. * ******************************************************************************/acpi_object_type8acpi_ds_map_named_opcode_to_data_type ( u16 opcode){ acpi_object_type8 data_type; FUNCTION_ENTRY (); /* Decode Opcode */ switch (opcode) { case AML_SCOPE_OP: data_type = INTERNAL_TYPE_SCOPE; break; case AML_DEVICE_OP: data_type = ACPI_TYPE_DEVICE; break; case AML_THERMAL_ZONE_OP: data_type = ACPI_TYPE_THERMAL; break; case AML_METHOD_OP: data_type = ACPI_TYPE_METHOD; break; case AML_POWER_RES_OP: data_type = ACPI_TYPE_POWER; break; case AML_PROCESSOR_OP: data_type = ACPI_TYPE_PROCESSOR; break; case AML_FIELD_OP: /* Field_op */ data_type = INTERNAL_TYPE_FIELD_DEFN; break; case AML_INDEX_FIELD_OP: /* Index_field_op */ data_type = INTERNAL_TYPE_INDEX_FIELD_DEFN; break; case AML_BANK_FIELD_OP: /* Bank_field_op */ data_type = INTERNAL_TYPE_BANK_FIELD_DEFN; break; case AML_INT_NAMEDFIELD_OP: /* NO CASE IN ORIGINAL */ data_type = ACPI_TYPE_ANY; break; case AML_NAME_OP: /* Name_op - special code in original */ case AML_INT_NAMEPATH_OP: data_type = ACPI_TYPE_ANY; break; case AML_ALIAS_OP: data_type = INTERNAL_TYPE_ALIAS; break; case AML_MUTEX_OP: data_type = ACPI_TYPE_MUTEX; break; case AML_EVENT_OP: data_type = ACPI_TYPE_EVENT; break; case AML_DATA_REGION_OP: case AML_REGION_OP: data_type = ACPI_TYPE_REGION; break; default: data_type = ACPI_TYPE_ANY; break; } return (data_type);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -