diff options
Diffstat (limited to 'drivers/acpi/parser/psargs.c')
| -rw-r--r-- | drivers/acpi/parser/psargs.c | 55 |
1 files changed, 32 insertions, 23 deletions
diff --git a/drivers/acpi/parser/psargs.c b/drivers/acpi/parser/psargs.c index b5d98895f6a8..b7ac68cc9e1c 100644 --- a/drivers/acpi/parser/psargs.c +++ b/drivers/acpi/parser/psargs.c | |||
| @@ -50,6 +50,16 @@ | |||
| 50 | #define _COMPONENT ACPI_PARSER | 50 | #define _COMPONENT ACPI_PARSER |
| 51 | ACPI_MODULE_NAME ("psargs") | 51 | ACPI_MODULE_NAME ("psargs") |
| 52 | 52 | ||
| 53 | /* Local prototypes */ | ||
| 54 | |||
| 55 | static u32 | ||
| 56 | acpi_ps_get_next_package_length ( | ||
| 57 | struct acpi_parse_state *parser_state); | ||
| 58 | |||
| 59 | static union acpi_parse_object * | ||
| 60 | acpi_ps_get_next_field ( | ||
| 61 | struct acpi_parse_state *parser_state); | ||
| 62 | |||
| 53 | 63 | ||
| 54 | /******************************************************************************* | 64 | /******************************************************************************* |
| 55 | * | 65 | * |
| @@ -64,7 +74,7 @@ | |||
| 64 | * | 74 | * |
| 65 | ******************************************************************************/ | 75 | ******************************************************************************/ |
| 66 | 76 | ||
| 67 | u32 | 77 | static u32 |
| 68 | acpi_ps_get_next_package_length ( | 78 | acpi_ps_get_next_package_length ( |
| 69 | struct acpi_parse_state *parser_state) | 79 | struct acpi_parse_state *parser_state) |
| 70 | { | 80 | { |
| @@ -78,7 +88,6 @@ acpi_ps_get_next_package_length ( | |||
| 78 | encoded_length = (u32) ACPI_GET8 (parser_state->aml); | 88 | encoded_length = (u32) ACPI_GET8 (parser_state->aml); |
| 79 | parser_state->aml++; | 89 | parser_state->aml++; |
| 80 | 90 | ||
| 81 | |||
| 82 | switch (encoded_length >> 6) /* bits 6-7 contain encoding scheme */ { | 91 | switch (encoded_length >> 6) /* bits 6-7 contain encoding scheme */ { |
| 83 | case 0: /* 1-byte encoding (bits 0-5) */ | 92 | case 0: /* 1-byte encoding (bits 0-5) */ |
| 84 | 93 | ||
| @@ -287,13 +296,14 @@ acpi_ps_get_next_namepath ( | |||
| 287 | * parent tree, but don't open a new scope -- we just want to lookup the | 296 | * parent tree, but don't open a new scope -- we just want to lookup the |
| 288 | * object (MUST BE mode EXECUTE to perform upsearch) | 297 | * object (MUST BE mode EXECUTE to perform upsearch) |
| 289 | */ | 298 | */ |
| 290 | status = acpi_ns_lookup (&scope_info, path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, | 299 | status = acpi_ns_lookup (&scope_info, path, ACPI_TYPE_ANY, |
| 291 | ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, &node); | 300 | ACPI_IMODE_EXECUTE, |
| 301 | ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, | ||
| 302 | NULL, &node); | ||
| 292 | if (ACPI_SUCCESS (status) && method_call) { | 303 | if (ACPI_SUCCESS (status) && method_call) { |
| 293 | if (node->type == ACPI_TYPE_METHOD) { | 304 | if (node->type == ACPI_TYPE_METHOD) { |
| 294 | /* | 305 | /* This name is actually a control method invocation */ |
| 295 | * This name is actually a control method invocation | 306 | |
| 296 | */ | ||
| 297 | method_desc = acpi_ns_get_attached_object (node); | 307 | method_desc = acpi_ns_get_attached_object (node); |
| 298 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, | 308 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, |
| 299 | "Control Method - %p Desc %p Path=%p\n", | 309 | "Control Method - %p Desc %p Path=%p\n", |
| @@ -360,7 +370,7 @@ acpi_ps_get_next_namepath ( | |||
| 360 | /* | 370 | /* |
| 361 | * We got a NOT_FOUND during table load or we encountered | 371 | * We got a NOT_FOUND during table load or we encountered |
| 362 | * a cond_ref_of(x) where the target does not exist. | 372 | * a cond_ref_of(x) where the target does not exist. |
| 363 | * -- either case is ok | 373 | * Either case is ok |
| 364 | */ | 374 | */ |
| 365 | status = AE_OK; | 375 | status = AE_OK; |
| 366 | } | 376 | } |
| @@ -486,12 +496,13 @@ acpi_ps_get_next_simple_arg ( | |||
| 486 | * | 496 | * |
| 487 | ******************************************************************************/ | 497 | ******************************************************************************/ |
| 488 | 498 | ||
| 489 | union acpi_parse_object * | 499 | static union acpi_parse_object * |
| 490 | acpi_ps_get_next_field ( | 500 | acpi_ps_get_next_field ( |
| 491 | struct acpi_parse_state *parser_state) | 501 | struct acpi_parse_state *parser_state) |
| 492 | { | 502 | { |
| 493 | u32 aml_offset = (u32) ACPI_PTR_DIFF (parser_state->aml, | 503 | u32 aml_offset = (u32) |
| 494 | parser_state->aml_start); | 504 | ACPI_PTR_DIFF (parser_state->aml, |
| 505 | parser_state->aml_start); | ||
| 495 | union acpi_parse_object *field; | 506 | union acpi_parse_object *field; |
| 496 | u16 opcode; | 507 | u16 opcode; |
| 497 | u32 name; | 508 | u32 name; |
| @@ -500,7 +511,7 @@ acpi_ps_get_next_field ( | |||
| 500 | ACPI_FUNCTION_TRACE ("ps_get_next_field"); | 511 | ACPI_FUNCTION_TRACE ("ps_get_next_field"); |
| 501 | 512 | ||
| 502 | 513 | ||
| 503 | /* determine field type */ | 514 | /* Determine field type */ |
| 504 | 515 | ||
| 505 | switch (ACPI_GET8 (parser_state->aml)) { | 516 | switch (ACPI_GET8 (parser_state->aml)) { |
| 506 | default: | 517 | default: |
| @@ -521,7 +532,6 @@ acpi_ps_get_next_field ( | |||
| 521 | break; | 532 | break; |
| 522 | } | 533 | } |
| 523 | 534 | ||
| 524 | |||
| 525 | /* Allocate a new field op */ | 535 | /* Allocate a new field op */ |
| 526 | 536 | ||
| 527 | field = acpi_ps_alloc_op (opcode); | 537 | field = acpi_ps_alloc_op (opcode); |
| @@ -582,10 +592,10 @@ acpi_ps_get_next_field ( | |||
| 582 | * | 592 | * |
| 583 | * FUNCTION: acpi_ps_get_next_arg | 593 | * FUNCTION: acpi_ps_get_next_arg |
| 584 | * | 594 | * |
| 585 | * PARAMETERS: parser_state - Current parser state object | 595 | * PARAMETERS: walk_state - Current state |
| 596 | * parser_state - Current parser state object | ||
| 586 | * arg_type - The argument type (AML_*_ARG) | 597 | * arg_type - The argument type (AML_*_ARG) |
| 587 | * arg_count - If the argument points to a control method | 598 | * return_arg - Where the next arg is returned |
| 588 | * the method's argument is returned here. | ||
| 589 | * | 599 | * |
| 590 | * RETURN: Status, and an op object containing the next argument. | 600 | * RETURN: Status, and an op object containing the next argument. |
| 591 | * | 601 | * |
| @@ -619,7 +629,7 @@ acpi_ps_get_next_arg ( | |||
| 619 | case ARGP_NAME: | 629 | case ARGP_NAME: |
| 620 | case ARGP_NAMESTRING: | 630 | case ARGP_NAMESTRING: |
| 621 | 631 | ||
| 622 | /* constants, strings, and namestrings are all the same size */ | 632 | /* Constants, strings, and namestrings are all the same size */ |
| 623 | 633 | ||
| 624 | arg = acpi_ps_alloc_op (AML_BYTE_OP); | 634 | arg = acpi_ps_alloc_op (AML_BYTE_OP); |
| 625 | if (!arg) { | 635 | if (!arg) { |
| @@ -654,7 +664,6 @@ acpi_ps_get_next_arg ( | |||
| 654 | else { | 664 | else { |
| 655 | arg = field; | 665 | arg = field; |
| 656 | } | 666 | } |
| 657 | |||
| 658 | prev = field; | 667 | prev = field; |
| 659 | } | 668 | } |
| 660 | 669 | ||
| @@ -677,8 +686,8 @@ acpi_ps_get_next_arg ( | |||
| 677 | 686 | ||
| 678 | /* Fill in bytelist data */ | 687 | /* Fill in bytelist data */ |
| 679 | 688 | ||
| 680 | arg->common.value.size = (u32) ACPI_PTR_DIFF (parser_state->pkg_end, | 689 | arg->common.value.size = (u32) |
| 681 | parser_state->aml); | 690 | ACPI_PTR_DIFF (parser_state->pkg_end, parser_state->aml); |
| 682 | arg->named.data = parser_state->aml; | 691 | arg->named.data = parser_state->aml; |
| 683 | 692 | ||
| 684 | /* Skip to End of byte data */ | 693 | /* Skip to End of byte data */ |
| @@ -706,7 +715,7 @@ acpi_ps_get_next_arg ( | |||
| 706 | status = acpi_ps_get_next_namepath (walk_state, parser_state, arg, 0); | 715 | status = acpi_ps_get_next_namepath (walk_state, parser_state, arg, 0); |
| 707 | } | 716 | } |
| 708 | else { | 717 | else { |
| 709 | /* single complex argument, nothing returned */ | 718 | /* Single complex argument, nothing returned */ |
| 710 | 719 | ||
| 711 | walk_state->arg_count = 1; | 720 | walk_state->arg_count = 1; |
| 712 | } | 721 | } |
| @@ -716,7 +725,7 @@ acpi_ps_get_next_arg ( | |||
| 716 | case ARGP_DATAOBJ: | 725 | case ARGP_DATAOBJ: |
| 717 | case ARGP_TERMARG: | 726 | case ARGP_TERMARG: |
| 718 | 727 | ||
| 719 | /* single complex argument, nothing returned */ | 728 | /* Single complex argument, nothing returned */ |
| 720 | 729 | ||
| 721 | walk_state->arg_count = 1; | 730 | walk_state->arg_count = 1; |
| 722 | break; | 731 | break; |
| @@ -727,7 +736,7 @@ acpi_ps_get_next_arg ( | |||
| 727 | case ARGP_OBJLIST: | 736 | case ARGP_OBJLIST: |
| 728 | 737 | ||
| 729 | if (parser_state->aml < parser_state->pkg_end) { | 738 | if (parser_state->aml < parser_state->pkg_end) { |
| 730 | /* non-empty list of variable arguments, nothing returned */ | 739 | /* Non-empty list of variable arguments, nothing returned */ |
| 731 | 740 | ||
| 732 | walk_state->arg_count = ACPI_VAR_ARGS; | 741 | walk_state->arg_count = ACPI_VAR_ARGS; |
| 733 | } | 742 | } |
