📄 dsobject.c
字号:
switch (ACPI_GET_OP_CLASS (op_info)) { case OPTYPE_LOCAL_VARIABLE: /* Split the opcode into a base opcode + offset */ (*obj_desc)->reference.op_code = AML_LOCAL_OP; (*obj_desc)->reference.offset = opcode - AML_LOCAL_OP; break; case OPTYPE_METHOD_ARGUMENT: /* Split the opcode into a base opcode + offset */ (*obj_desc)->reference.op_code = AML_ARG_OP; (*obj_desc)->reference.offset = opcode - AML_ARG_OP; break; default: /* Constants, Literals, etc.. */ if (op->opcode == AML_NAMEPATH_OP) { /* Node was saved in Op */ (*obj_desc)->reference.node = op->node; } (*obj_desc)->reference.op_code = opcode; break; } break; default: break; } return (AE_OK);}/***************************************************************************** * * FUNCTION: Acpi_ds_build_internal_simple_obj * * PARAMETERS: Op - Parser object to be translated * Obj_desc_ptr - Where the ACPI internal object is returned * * RETURN: Status * * DESCRIPTION: Translate a parser Op object to the equivalent namespace object * Simple objects are any objects other than a package object! * ****************************************************************************/static ACPI_STATUSacpi_ds_build_internal_simple_obj ( ACPI_WALK_STATE *walk_state, ACPI_PARSE_OBJECT *op, ACPI_OPERAND_OBJECT **obj_desc_ptr){ ACPI_OPERAND_OBJECT *obj_desc; OBJECT_TYPE_INTERNAL type; ACPI_STATUS status; u32 length; char *name; if (op->opcode == AML_NAMEPATH_OP) { /* * This is an object reference. If The name was * previously looked up in the NS, it is stored in this op. * Otherwise, go ahead and look it up now */ if (!op->node) { status = acpi_ns_lookup (walk_state->scope_info, op->value.string, ACPI_TYPE_ANY, IMODE_EXECUTE, NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE, NULL, (ACPI_NAMESPACE_NODE **)&(op->node)); if (ACPI_FAILURE (status)) { if (status == AE_NOT_FOUND) { name = NULL; acpi_ns_externalize_name (ACPI_UINT32_MAX, op->value.string, &length, &name); if (name) { REPORT_WARNING (("Reference %s AML %X not found\n", name, op->aml_offset)); acpi_cm_free (name); } else { REPORT_WARNING (("Reference %s AML %X not found\n", op->value.string, op->aml_offset)); } *obj_desc_ptr = NULL; } return (status); } } /* * The reference will be a Reference * TBD: [Restructure] unless we really need a separate * type of INTERNAL_TYPE_REFERENCE change * Acpi_ds_map_opcode_to_data_type to handle this case */ type = INTERNAL_TYPE_REFERENCE; } else { type = acpi_ds_map_opcode_to_data_type (op->opcode, NULL); } /* Create and init the internal ACPI object */ obj_desc = acpi_cm_create_internal_object (type); if (!obj_desc) { return (AE_NO_MEMORY); } status = acpi_ds_init_object_from_op (walk_state, op, op->opcode, &obj_desc); if (ACPI_FAILURE (status)) { acpi_cm_remove_reference (obj_desc); return (status); } *obj_desc_ptr = obj_desc; return (AE_OK);}/***************************************************************************** * * FUNCTION: Acpi_ds_build_internal_package_obj * * PARAMETERS: Op - Parser object to be translated * Obj_desc_ptr - Where the ACPI internal object is returned * * RETURN: Status * * DESCRIPTION: Translate a parser Op package object to the equivalent * namespace object * ****************************************************************************/ACPI_STATUSacpi_ds_build_internal_package_obj ( ACPI_WALK_STATE *walk_state, ACPI_PARSE_OBJECT *op, ACPI_OPERAND_OBJECT **obj_desc_ptr){ ACPI_PARSE_OBJECT *arg; ACPI_OPERAND_OBJECT *obj_desc; ACPI_STATUS status = AE_OK; obj_desc = acpi_cm_create_internal_object (ACPI_TYPE_PACKAGE); if (!obj_desc) { return (AE_NO_MEMORY); } /* The first argument must be the package length */ arg = op->value.arg; obj_desc->package.count = arg->value.integer; /* * Allocate the array of pointers (ptrs to the * individual objects) Add an extra pointer slot so * that the list is always null terminated. */ obj_desc->package.elements = acpi_cm_callocate ((obj_desc->package.count + 1) * sizeof (void *)); if (!obj_desc->package.elements) { /* Package vector allocation failure */ REPORT_ERROR (("Ds_build_internal_package_obj: Package vector allocation failure\n")); acpi_cm_delete_object_desc (obj_desc); return (AE_NO_MEMORY); } obj_desc->package.next_element = obj_desc->package.elements; /* * Now init the elements of the package */ arg = arg->next; while (arg) { if (arg->opcode == AML_PACKAGE_OP) { status = acpi_ds_build_internal_package_obj (walk_state, arg, obj_desc->package.next_element); } else { status = acpi_ds_build_internal_simple_obj (walk_state, arg, obj_desc->package.next_element); } obj_desc->package.next_element++; arg = arg->next; } *obj_desc_ptr = obj_desc; return (status);}/***************************************************************************** * * FUNCTION: Acpi_ds_build_internal_object * * PARAMETERS: Op - Parser object to be translated * Obj_desc_ptr - Where the ACPI internal object is returned * * RETURN: Status * * DESCRIPTION: Translate a parser Op object to the equivalent namespace * object * ****************************************************************************/ACPI_STATUSacpi_ds_build_internal_object ( ACPI_WALK_STATE *walk_state, ACPI_PARSE_OBJECT *op, ACPI_OPERAND_OBJECT **obj_desc_ptr){ ACPI_STATUS status; if (op->opcode == AML_PACKAGE_OP) { status = acpi_ds_build_internal_package_obj (walk_state, op, obj_desc_ptr); } else { status = acpi_ds_build_internal_simple_obj (walk_state, op, obj_desc_ptr); } return (status);}/***************************************************************************** * * FUNCTION: Acpi_ds_create_node * * PARAMETERS: Op - Parser object to be translated * Obj_desc_ptr - Where the ACPI internal object is returned * * RETURN: Status * * DESCRIPTION: * ****************************************************************************/ACPI_STATUSacpi_ds_create_node ( ACPI_WALK_STATE *walk_state, ACPI_NAMESPACE_NODE *node, ACPI_PARSE_OBJECT *op){ ACPI_STATUS status; ACPI_OPERAND_OBJECT *obj_desc; if (!op->value.arg) { /* No arguments, there is nothing to do */ return (AE_OK); } /* Build an internal object for the argument(s) */ status = acpi_ds_build_internal_object (walk_state, op->value.arg, &obj_desc); if (ACPI_FAILURE (status)) { return (status); } /* Re-type the object according to it's argument */ node->type = obj_desc->common.type; /* Init obj */ status = acpi_ns_attach_object ((ACPI_HANDLE) node, obj_desc, (u8) node->type); if (ACPI_FAILURE (status)) { goto cleanup; } return (status);cleanup: acpi_cm_remove_reference (obj_desc); return (status);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -