📄 psargs.c
字号:
acpi_ps_init_op (arg, AML_INT_METHODCALL_OP); name_op->value.name = path; /* Point METHODCALL/NAME to the METHOD Node */ name_op->node = method_node; acpi_ps_append_arg (arg, name_op); if (!method_node->object) { return_VOID; } *arg_count = (method_node->object)->method.param_count; } return_VOID; } /* * Else this is normal named object reference. * Just init the NAMEPATH object with the pathname. * (See code below) */ } } /* * Either we didn't find the object in the namespace, or the object is * something other than a control method. Just initialize the Op with the * pathname. */ acpi_ps_init_op (arg, AML_INT_NAMEPATH_OP); arg->value.name = path; return_VOID;}#endif/******************************************************************************* * * FUNCTION: Acpi_ps_get_next_simple_arg * * PARAMETERS: Parser_state - Current parser state object * Arg_type - The argument type (AML_*_ARG) * Arg - Where the argument is returned * * RETURN: None * * DESCRIPTION: Get the next simple argument (constant, string, or namestring) * ******************************************************************************/voidacpi_ps_get_next_simple_arg ( acpi_parse_state *parser_state, u32 arg_type, acpi_parse_object *arg){ FUNCTION_TRACE_U32 ("Ps_get_next_simple_arg", arg_type); switch (arg_type) { case ARGP_BYTEDATA: acpi_ps_init_op (arg, AML_BYTE_OP); arg->value.integer = (u32) GET8 (parser_state->aml); parser_state->aml++; break; case ARGP_WORDDATA: acpi_ps_init_op (arg, AML_WORD_OP); /* Get 2 bytes from the AML stream */ MOVE_UNALIGNED16_TO_32 (&arg->value.integer, parser_state->aml); parser_state->aml += 2; break; case ARGP_DWORDDATA: acpi_ps_init_op (arg, AML_DWORD_OP); /* Get 4 bytes from the AML stream */ MOVE_UNALIGNED32_TO_32 (&arg->value.integer, parser_state->aml); parser_state->aml += 4; break; case ARGP_QWORDDATA: acpi_ps_init_op (arg, AML_QWORD_OP); /* Get 8 bytes from the AML stream */ MOVE_UNALIGNED64_TO_64 (&arg->value.integer, parser_state->aml); parser_state->aml += 8; break; case ARGP_CHARLIST: acpi_ps_init_op (arg, AML_STRING_OP); arg->value.string = (char*) parser_state->aml; while (GET8 (parser_state->aml) != '\0') { parser_state->aml++; } parser_state->aml++; break; case ARGP_NAME: case ARGP_NAMESTRING: acpi_ps_init_op (arg, AML_INT_NAMEPATH_OP); arg->value.name = acpi_ps_get_next_namestring (parser_state); break; } return_VOID;}/******************************************************************************* * * FUNCTION: Acpi_ps_get_next_field * * PARAMETERS: Parser_state - Current parser state object * * RETURN: A newly allocated FIELD op * * DESCRIPTION: Get next field (Named_field, Reserved_field, or Access_field) * ******************************************************************************/acpi_parse_object *acpi_ps_get_next_field ( acpi_parse_state *parser_state){ u32 aml_offset = parser_state->aml - parser_state->aml_start; acpi_parse_object *field; u16 opcode; u32 name; FUNCTION_TRACE ("Ps_get_next_field"); /* determine field type */ switch (GET8 (parser_state->aml)) { default: opcode = AML_INT_NAMEDFIELD_OP; break; case 0x00: opcode = AML_INT_RESERVEDFIELD_OP; parser_state->aml++; break; case 0x01: opcode = AML_INT_ACCESSFIELD_OP; parser_state->aml++; break; } /* Allocate a new field op */ field = acpi_ps_alloc_op (opcode); if (field) { field->aml_offset = aml_offset; /* Decode the field type */ switch (opcode) { case AML_INT_NAMEDFIELD_OP: /* Get the 4-character name */ MOVE_UNALIGNED32_TO_32 (&name, parser_state->aml); acpi_ps_set_name (field, name); parser_state->aml += 4; /* Get the length which is encoded as a package length */ field->value.size = acpi_ps_get_next_package_length (parser_state); break; case AML_INT_RESERVEDFIELD_OP: /* Get the length which is encoded as a package length */ field->value.size = acpi_ps_get_next_package_length (parser_state); break; case AML_INT_ACCESSFIELD_OP: /* Get Access_type and Access_atrib and merge into the field Op */ field->value.integer = ((GET8 (parser_state->aml) << 8) | GET8 (parser_state->aml)); parser_state->aml += 2; break; } } return_PTR (field);}/******************************************************************************* * * FUNCTION: Acpi_ps_get_next_arg * * PARAMETERS: Parser_state - Current parser state object * Arg_type - The argument type (AML_*_ARG) * Arg_count - If the argument points to a control method * the method's argument is returned here. * * RETURN: An op object containing the next argument. * * DESCRIPTION: Get next argument (including complex list arguments that require * pushing the parser stack) * ******************************************************************************/acpi_parse_object *acpi_ps_get_next_arg ( acpi_parse_state *parser_state, u32 arg_type, u32 *arg_count){ acpi_parse_object *arg = NULL; acpi_parse_object *prev = NULL; acpi_parse_object *field; u32 subop; FUNCTION_TRACE_PTR ("Ps_get_next_arg", parser_state); switch (arg_type) { case ARGP_BYTEDATA: case ARGP_WORDDATA: case ARGP_DWORDDATA: case ARGP_CHARLIST: case ARGP_NAME: case ARGP_NAMESTRING: /* constants, strings, and namestrings are all the same size */ arg = acpi_ps_alloc_op (AML_BYTE_OP); if (arg) { acpi_ps_get_next_simple_arg (parser_state, arg_type, arg); } break; case ARGP_PKGLENGTH: /* package length, nothing returned */ parser_state->pkg_end = acpi_ps_get_next_package_end (parser_state); break; case ARGP_FIELDLIST: if (parser_state->aml < parser_state->pkg_end) { /* non-empty list */ while (parser_state->aml < parser_state->pkg_end) { field = acpi_ps_get_next_field (parser_state); if (!field) { break; } if (prev) { prev->next = field; } else { arg = field; } prev = field; } /* skip to End of byte data */ parser_state->aml = parser_state->pkg_end; } break; case ARGP_BYTELIST: if (parser_state->aml < parser_state->pkg_end) { /* non-empty list */ arg = acpi_ps_alloc_op (AML_INT_BYTELIST_OP); if (arg) { /* fill in bytelist data */ arg->value.size = (parser_state->pkg_end - parser_state->aml); ((acpi_parse2_object *) arg)->data = parser_state->aml; } /* skip to End of byte data */ parser_state->aml = parser_state->pkg_end; } break; case ARGP_TARGET: case ARGP_SUPERNAME: { subop = acpi_ps_peek_opcode (parser_state); if (subop == 0 || acpi_ps_is_leading_char (subop) || acpi_ps_is_prefix_char (subop)) { /* Null_name or Name_string */ arg = acpi_ps_alloc_op (AML_INT_NAMEPATH_OP); if (arg) { acpi_ps_get_next_namepath (parser_state, arg, arg_count, 0); } } else { /* single complex argument, nothing returned */ *arg_count = 1; } } break; case ARGP_DATAOBJ: case ARGP_TERMARG: /* single complex argument, nothing returned */ *arg_count = 1; break; case ARGP_DATAOBJLIST: case ARGP_TERMLIST: case ARGP_OBJLIST: if (parser_state->aml < parser_state->pkg_end) { /* non-empty list of variable arguments, nothing returned */ *arg_count = ACPI_VAR_ARGS; } break; } return_PTR (arg);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -