Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ACPICA: iasl: add ASL conversion tool

ACPICA commit c04d310039d3e0ed1cb62876fe7e596fbc75ab01
ACPICA commit a65c1df7e6b4bad8e37df822018c40c6c446add9

The key feature of this utility is that the original comments within
the input ASL files are preserved during the conversion process, and
included within the converted ASL+ file -- thus creating a transparent
conversion of existing ASL files to ASL+ (ASL 2.0)

This patch is an automatic generation of the ASL converter commit,
Linux kernel isn't affected by the functionality provided in this
commit, but requires the linuxized changes to support future ACPICA
release automation.

Link: https://github.com/acpica/acpica/commit/c04d3100
Link: https://github.com/acpica/acpica/commit/a65c1df7
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Jung-uk Kim <jkim@FreeBSD.org>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Bob Moore and committed by
Rafael J. Wysocki
9cf7adec c8e8ab1e

+490 -18
+144
drivers/acpi/acpica/acconvert.h
··· 1 + /****************************************************************************** 2 + * 3 + * Module Name: acapps - common include for ACPI applications/tools 4 + * 5 + *****************************************************************************/ 6 + 7 + /* 8 + * Copyright (C) 2000 - 2017, Intel Corp. 9 + * All rights reserved. 10 + * 11 + * Redistribution and use in source and binary forms, with or without 12 + * modification, are permitted provided that the following conditions 13 + * are met: 14 + * 1. Redistributions of source code must retain the above copyright 15 + * notice, this list of conditions, and the following disclaimer, 16 + * without modification. 17 + * 2. Redistributions in binary form must reproduce at minimum a disclaimer 18 + * substantially similar to the "NO WARRANTY" disclaimer below 19 + * ("Disclaimer") and any redistribution must be conditioned upon 20 + * including a substantially similar Disclaimer requirement for further 21 + * binary redistribution. 22 + * 3. Neither the names of the above-listed copyright holders nor the names 23 + * of any contributors may be used to endorse or promote products derived 24 + * from this software without specific prior written permission. 25 + * 26 + * Alternatively, this software may be distributed under the terms of the 27 + * GNU General Public License ("GPL") version 2 as published by the Free 28 + * Software Foundation. 29 + * 30 + * NO WARRANTY 31 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32 + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33 + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 34 + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 35 + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 39 + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 40 + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 41 + * POSSIBILITY OF SUCH DAMAGES. 42 + */ 43 + 44 + #ifndef _ACCONVERT 45 + #define _ACCONVERT 46 + 47 + /* Definitions for comment state */ 48 + 49 + #define ASL_COMMENT_STANDARD 1 50 + #define ASLCOMMENT_INLINE 2 51 + #define ASL_COMMENT_OPEN_PAREN 3 52 + #define ASL_COMMENT_CLOSE_PAREN 4 53 + #define ASL_COMMENT_CLOSE_BRACE 5 54 + 55 + /* Definitions for comment print function*/ 56 + 57 + #define AML_COMMENT_STANDARD 1 58 + #define AMLCOMMENT_INLINE 2 59 + #define AML_COMMENT_END_NODE 3 60 + #define AML_NAMECOMMENT 4 61 + #define AML_COMMENT_CLOSE_BRACE 5 62 + #define AML_COMMENT_ENDBLK 6 63 + #define AML_COMMENT_INCLUDE 7 64 + 65 + #ifdef ACPI_ASL_COMPILER 66 + /* 67 + * cvcompiler 68 + */ 69 + void 70 + cv_process_comment(struct asl_comment_state current_state, 71 + char *string_buffer, int c1); 72 + 73 + void 74 + cv_process_comment_type2(struct asl_comment_state current_state, 75 + char *string_buffer); 76 + 77 + u32 cv_calculate_comment_lengths(union acpi_parse_object *op); 78 + 79 + void cv_process_comment_state(char input); 80 + 81 + char *cv_append_inline_comment(char *inline_comment, char *to_add); 82 + 83 + void cv_add_to_comment_list(char *to_add); 84 + 85 + void cv_place_comment(u8 type, char *comment_string); 86 + 87 + u32 cv_parse_op_block_type(union acpi_parse_object *op); 88 + 89 + struct acpi_comment_node *cv_comment_node_calloc(void); 90 + 91 + void cg_write_aml_def_block_comment(union acpi_parse_object *op); 92 + 93 + void 94 + cg_write_one_aml_comment(union acpi_parse_object *op, 95 + char *comment_to_print, u8 input_option); 96 + 97 + void cg_write_aml_comment(union acpi_parse_object *op); 98 + 99 + /* 100 + * cvparser 101 + */ 102 + void 103 + cv_init_file_tree(struct acpi_table_header *table, 104 + u8 *aml_start, u32 aml_length); 105 + 106 + void cv_clear_op_comments(union acpi_parse_object *op); 107 + 108 + struct acpi_file_node *cv_filename_exists(char *filename, 109 + struct acpi_file_node *head); 110 + 111 + void cv_label_file_node(union acpi_parse_object *op); 112 + 113 + void 114 + cv_capture_list_comments(struct acpi_parse_state *parser_state, 115 + struct acpi_comment_node *list_head, 116 + struct acpi_comment_node *list_tail); 117 + 118 + void cv_capture_comments_only(struct acpi_parse_state *parser_state); 119 + 120 + void cv_capture_comments(struct acpi_walk_state *walk_state); 121 + 122 + void cv_transfer_comments(union acpi_parse_object *op); 123 + 124 + /* 125 + * cvdisasm 126 + */ 127 + void cv_switch_files(u32 level, union acpi_parse_object *op); 128 + 129 + u8 cv_file_has_switched(union acpi_parse_object *op); 130 + 131 + void cv_close_paren_write_comment(union acpi_parse_object *op, u32 level); 132 + 133 + void cv_close_brace_write_comment(union acpi_parse_object *op, u32 level); 134 + 135 + void 136 + cv_print_one_comment_list(struct acpi_comment_node *comment_list, u32 level); 137 + 138 + void 139 + cv_print_one_comment_type(union acpi_parse_object *op, 140 + u8 comment_type, char *end_str, u32 level); 141 + 142 + #endif 143 + 144 + #endif /* _ACCONVERT */
+53
drivers/acpi/acpica/acglobal.h
··· 370 370 371 371 #endif 372 372 373 + /* 374 + * Meant for the -ca option. 375 + */ 376 + ACPI_INIT_GLOBAL(char *, acpi_gbl_current_inline_comment, NULL); 377 + ACPI_INIT_GLOBAL(char *, acpi_gbl_current_end_node_comment, NULL); 378 + ACPI_INIT_GLOBAL(char *, acpi_gbl_current_open_brace_comment, NULL); 379 + ACPI_INIT_GLOBAL(char *, acpi_gbl_current_close_brace_comment, NULL); 380 + 381 + ACPI_INIT_GLOBAL(char *, acpi_gbl_root_filename, NULL); 382 + ACPI_INIT_GLOBAL(char *, acpi_gbl_current_filename, NULL); 383 + ACPI_INIT_GLOBAL(char *, acpi_gbl_current_parent_filename, NULL); 384 + ACPI_INIT_GLOBAL(char *, acpi_gbl_current_include_filename, NULL); 385 + 386 + ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_last_list_head, NULL); 387 + 388 + ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_def_blk_comment_list_head, 389 + NULL); 390 + ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_def_blk_comment_list_tail, 391 + NULL); 392 + 393 + ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_reg_comment_list_head, 394 + NULL); 395 + ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_reg_comment_list_tail, 396 + NULL); 397 + 398 + ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_inc_comment_list_head, 399 + NULL); 400 + ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_inc_comment_list_tail, 401 + NULL); 402 + 403 + ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_end_blk_comment_list_head, 404 + NULL); 405 + ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_end_blk_comment_list_tail, 406 + NULL); 407 + 408 + ACPI_INIT_GLOBAL(struct acpi_comment_addr_node, 409 + *acpi_gbl_comment_addr_list_head, NULL); 410 + 411 + ACPI_INIT_GLOBAL(union acpi_parse_object, *acpi_gbl_current_scope, NULL); 412 + 413 + ACPI_INIT_GLOBAL(struct acpi_file_node, *acpi_gbl_file_tree_root, NULL); 414 + 415 + ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_reg_comment_cache); 416 + ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_comment_addr_cache); 417 + ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_file_cache); 418 + 419 + ACPI_INIT_GLOBAL(u8, gbl_capture_comments, FALSE); 420 + 421 + ACPI_INIT_GLOBAL(u8, acpi_gbl_debug_asl_conversion, FALSE); 422 + ACPI_INIT_GLOBAL(ACPI_FILE, acpi_gbl_conv_debug_file, NULL); 423 + 424 + ACPI_GLOBAL(char, acpi_gbl_table_sig[4]); 425 + 373 426 /***************************************************************************** 374 427 * 375 428 * Application globals
+84 -15
drivers/acpi/acpica/aclocal.h
··· 53 53 54 54 /* Total number of aml opcodes defined */ 55 55 56 - #define AML_NUM_OPCODES 0x82 56 + #define AML_NUM_OPCODES 0x83 57 57 58 58 /* Forward declarations */ 59 59 ··· 754 754 #define ACPI_DISASM_ONLY_MEMBERS(a) 755 755 #endif 756 756 757 + #if defined(ACPI_ASL_COMPILER) 758 + #define ACPI_CONVERTER_ONLY_MEMBERS(a) a; 759 + #else 760 + #define ACPI_CONVERTER_ONLY_MEMBERS(a) 761 + #endif 762 + 757 763 #define ACPI_PARSE_COMMON \ 758 - union acpi_parse_object *parent; /* Parent op */\ 759 - u8 descriptor_type; /* To differentiate various internal objs */\ 760 - u8 flags; /* Type of Op */\ 761 - u16 aml_opcode; /* AML opcode */\ 762 - u8 *aml; /* Address of declaration in AML */\ 763 - union acpi_parse_object *next; /* Next op */\ 764 - struct acpi_namespace_node *node; /* For use by interpreter */\ 765 - union acpi_parse_value value; /* Value or args associated with the opcode */\ 766 - u8 arg_list_length; /* Number of elements in the arg list */\ 767 - ACPI_DISASM_ONLY_MEMBERS (\ 768 - u16 disasm_flags; /* Used during AML disassembly */\ 769 - u8 disasm_opcode; /* Subtype used for disassembly */\ 770 - char *operator_symbol;/* Used for C-style operator name strings */\ 771 - char aml_op_name[16]) /* Op name (debug only) */ 764 + union acpi_parse_object *parent; /* Parent op */\ 765 + u8 descriptor_type; /* To differentiate various internal objs */\ 766 + u8 flags; /* Type of Op */\ 767 + u16 aml_opcode; /* AML opcode */\ 768 + u8 *aml; /* Address of declaration in AML */\ 769 + union acpi_parse_object *next; /* Next op */\ 770 + struct acpi_namespace_node *node; /* For use by interpreter */\ 771 + union acpi_parse_value value; /* Value or args associated with the opcode */\ 772 + u8 arg_list_length; /* Number of elements in the arg list */\ 773 + ACPI_DISASM_ONLY_MEMBERS (\ 774 + u16 disasm_flags; /* Used during AML disassembly */\ 775 + u8 disasm_opcode; /* Subtype used for disassembly */\ 776 + char *operator_symbol; /* Used for C-style operator name strings */\ 777 + char aml_op_name[16]) /* Op name (debug only) */\ 778 + ACPI_CONVERTER_ONLY_MEMBERS (\ 779 + char *inline_comment; /* Inline comment */\ 780 + char *end_node_comment; /* End of node comment */\ 781 + char *name_comment; /* Comment associated with the first parameter of the name node */\ 782 + char *close_brace_comment; /* Comments that come after } on the same as } */\ 783 + struct acpi_comment_node *comment_list; /* comments that appears before this node */\ 784 + struct acpi_comment_node *end_blk_comment; /* comments that at the end of a block but before ) or } */\ 785 + char *cv_filename; /* Filename associated with this node. Used for ASL/ASL+ converter */\ 786 + char *cv_parent_filename) /* Parent filename associated with this node. Used for ASL/ASL+ converter */ 787 + 788 + /* categories of comments */ 789 + 790 + typedef enum { 791 + STANDARD_COMMENT = 1, 792 + INLINE_COMMENT, 793 + ENDNODE_COMMENT, 794 + OPENBRACE_COMMENT, 795 + CLOSE_BRACE_COMMENT, 796 + STD_DEFBLK_COMMENT, 797 + END_DEFBLK_COMMENT, 798 + FILENAME_COMMENT, 799 + PARENTFILENAME_COMMENT, 800 + ENDBLK_COMMENT, 801 + INCLUDE_COMMENT 802 + } asl_comment_types; 772 803 773 804 /* Internal opcodes for disasm_opcode field above */ 774 805 ··· 819 788 #define ACPI_DASM_SWITCH_PREDICATE 0x0D /* Object is a predicate for a Switch or Case block */ 820 789 #define ACPI_DASM_CASE 0x0E /* If/Else is a Case in a Switch/Case block */ 821 790 #define ACPI_DASM_DEFAULT 0x0F /* Else is a Default in a Switch/Case block */ 791 + 792 + /* 793 + * List struct used in the -ca option 794 + */ 795 + struct acpi_comment_node { 796 + char *comment; 797 + struct acpi_comment_node *next; 798 + }; 799 + 800 + struct acpi_comment_addr_node { 801 + u8 *addr; 802 + struct acpi_comment_addr_node *next; 803 + }; 804 + 805 + /* 806 + * File node - used for "Include" operator file stack and 807 + * depdendency tree for the -ca option 808 + */ 809 + struct acpi_file_node { 810 + void *file; 811 + char *filename; 812 + char *file_start; /* Points to AML and indicates when the AML for this particular file starts. */ 813 + char *file_end; /* Points to AML and indicates when the AML for this particular file ends. */ 814 + struct acpi_file_node *next; 815 + struct acpi_file_node *parent; 816 + u8 include_written; 817 + struct acpi_comment_node *include_comment; 818 + }; 822 819 823 820 /* 824 821 * Generic operation (for example: If, While, Store) ··· 873 814 ACPI_PARSE_COMMON union acpi_parse_object *child; 874 815 union acpi_parse_object *parent_method; 875 816 char *filename; 817 + u8 file_changed; 818 + char *parent_filename; 876 819 char *external_name; 877 820 char *namepath; 878 821 char name_seg[4]; ··· 902 841 struct acpi_parse_obj_common common; 903 842 struct acpi_parse_obj_named named; 904 843 struct acpi_parse_obj_asl asl; 844 + }; 845 + 846 + struct asl_comment_state { 847 + u8 comment_type; 848 + u32 spaces_before; 849 + union acpi_parse_object *latest_parse_node; 850 + union acpi_parse_object *parsing_paren_brace_node; 851 + u8 capture_comments; 905 852 }; 906 853 907 854 /*
+35
drivers/acpi/acpica/acmacros.h
··· 493 493 494 494 #define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7')) 495 495 496 + /* 497 + * Macors used for the ASL-/ASL+ converter utility 498 + */ 499 + #ifdef ACPI_ASL_COMPILER 500 + 501 + #define ASL_CV_LABEL_FILENODE(a) cv_label_file_node(a); 502 + #define ASL_CV_CAPTURE_COMMENTS_ONLY(a) cv_capture_comments_only (a); 503 + #define ASL_CV_CAPTURE_COMMENTS(a) cv_capture_comments (a); 504 + #define ASL_CV_TRANSFER_COMMENTS(a) cv_transfer_comments (a); 505 + #define ASL_CV_CLOSE_PAREN(a,b) cv_close_paren_write_comment(a,b); 506 + #define ASL_CV_CLOSE_BRACE(a,b) cv_close_brace_write_comment(a,b); 507 + #define ASL_CV_SWITCH_FILES(a,b) cv_switch_files(a,b); 508 + #define ASL_CV_CLEAR_OP_COMMENTS(a) cv_clear_op_comments(a); 509 + #define ASL_CV_PRINT_ONE_COMMENT(a,b,c,d) cv_print_one_comment_type (a,b,c,d); 510 + #define ASL_CV_PRINT_ONE_COMMENT_LIST(a,b) cv_print_one_comment_list (a,b); 511 + #define ASL_CV_FILE_HAS_SWITCHED(a) cv_file_has_switched(a) 512 + #define ASL_CV_INIT_FILETREE(a,b,c) cv_init_file_tree(a,b,c); 513 + 514 + #else 515 + 516 + #define ASL_CV_LABEL_FILENODE(a) 517 + #define ASL_CV_CAPTURE_COMMENTS_ONLY(a) 518 + #define ASL_CV_CAPTURE_COMMENTS(a) 519 + #define ASL_CV_TRANSFER_COMMENTS(a) 520 + #define ASL_CV_CLOSE_PAREN(a,b) acpi_os_printf (")"); 521 + #define ASL_CV_CLOSE_BRACE(a,b) acpi_os_printf ("}"); 522 + #define ASL_CV_SWITCH_FILES(a,b) 523 + #define ASL_CV_CLEAR_OP_COMMENTS(a) 524 + #define ASL_CV_PRINT_ONE_COMMENT(a,b,c,d) 525 + #define ASL_CV_PRINT_ONE_COMMENT_LIST(a,b) 526 + #define ASL_CV_FILE_HAS_SWITCHED(a) 0 527 + #define ASL_CV_INIT_FILETREE(a,b,c) 528 + 529 + #endif 530 + 496 531 #endif /* ACMACROS_H */
+2
drivers/acpi/acpica/acopcode.h
··· 90 90 #define ARGP_BUFFER_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_BYTELIST) 91 91 #define ARGP_BYTE_OP ARGP_LIST1 (ARGP_BYTEDATA) 92 92 #define ARGP_BYTELIST_OP ARGP_LIST1 (ARGP_NAMESTRING) 93 + #define ARGP_COMMENT_OP ARGP_LIST2 (ARGP_BYTEDATA, ARGP_COMMENT) 93 94 #define ARGP_CONCAT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) 94 95 #define ARGP_CONCAT_RES_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) 95 96 #define ARGP_COND_REF_OF_OP ARGP_LIST2 (ARGP_SIMPLENAME, ARGP_TARGET) ··· 224 223 #define ARGI_BUFFER_OP ARGI_LIST1 (ARGI_INTEGER) 225 224 #define ARGI_BYTE_OP ARGI_INVALID_OPCODE 226 225 #define ARGI_BYTELIST_OP ARGI_INVALID_OPCODE 226 + #define ARGI_COMMENT_OP ARGI_INVALID_OPCODE 227 227 #define ARGI_CONCAT_OP ARGI_LIST3 (ARGI_ANYTYPE, ARGI_ANYTYPE, ARGI_TARGETREF) 228 228 #define ARGI_CONCAT_RES_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_BUFFER, ARGI_TARGETREF) 229 229 #define ARGI_COND_REF_OF_OP ARGI_LIST2 (ARGI_OBJECT_REF, ARGI_TARGETREF)
+3 -1
drivers/acpi/acpica/amlcode.h
··· 137 137 #define AML_NOOP_OP (u16) 0xa3 138 138 #define AML_RETURN_OP (u16) 0xa4 139 139 #define AML_BREAK_OP (u16) 0xa5 140 - #define AML_BREAKPOINT_OP (u16) 0xcc 140 + #define AML_COMMENT_OP (u16) 0xa9 141 + #define AML_BREAKPOINT_OP (u16) 0xcc 141 142 #define AML_ONES_OP (u16) 0xff 142 143 143 144 /* ··· 237 236 #define ARGP_SIMPLENAME 0x12 /* name_string | local_term | arg_term */ 238 237 #define ARGP_NAME_OR_REF 0x13 /* For object_type only */ 239 238 #define ARGP_MAX 0x13 239 + #define ARGP_COMMENT 0x14 240 240 241 241 /* 242 242 * Resolved argument types for the AML Interpreter
+23
drivers/acpi/acpica/psargs.c
··· 47 47 #include "amlcode.h" 48 48 #include "acnamesp.h" 49 49 #include "acdispat.h" 50 + #include "acconvert.h" 50 51 51 52 #define _COMPONENT ACPI_PARSER 52 53 ACPI_MODULE_NAME("psargs") ··· 503 502 504 503 ACPI_FUNCTION_TRACE(ps_get_next_field); 505 504 505 + ASL_CV_CAPTURE_COMMENTS_ONLY(parser_state); 506 506 aml = parser_state->aml; 507 507 508 508 /* Determine field type */ ··· 548 546 549 547 /* Decode the field type */ 550 548 549 + ASL_CV_CAPTURE_COMMENTS_ONLY(parser_state); 551 550 switch (opcode) { 552 551 case AML_INT_NAMEDFIELD_OP: 553 552 ··· 557 554 ACPI_MOVE_32_TO_32(&name, parser_state->aml); 558 555 acpi_ps_set_name(field, name); 559 556 parser_state->aml += ACPI_NAME_SIZE; 557 + 558 + ASL_CV_CAPTURE_COMMENTS_ONLY(parser_state); 559 + 560 + #ifdef ACPI_ASL_COMPILER 561 + /* 562 + * Because the package length isn't represented as a parse tree object, 563 + * take comments surrounding this and add to the previously created 564 + * parse node. 565 + */ 566 + if (field->common.inline_comment) { 567 + field->common.name_comment = 568 + field->common.inline_comment; 569 + } 570 + field->common.inline_comment = acpi_gbl_current_inline_comment; 571 + acpi_gbl_current_inline_comment = NULL; 572 + #endif 560 573 561 574 /* Get the length which is encoded as a package length */ 562 575 ··· 628 609 if (ACPI_GET8(parser_state->aml) == AML_BUFFER_OP) { 629 610 parser_state->aml++; 630 611 612 + ASL_CV_CAPTURE_COMMENTS_ONLY(parser_state); 631 613 pkg_end = parser_state->aml; 632 614 pkg_length = 633 615 acpi_ps_get_next_package_length(parser_state); 634 616 pkg_end += pkg_length; 635 617 618 + ASL_CV_CAPTURE_COMMENTS_ONLY(parser_state); 636 619 if (parser_state->aml < pkg_end) { 637 620 638 621 /* Non-empty list */ ··· 651 630 opcode = ACPI_GET8(parser_state->aml); 652 631 parser_state->aml++; 653 632 633 + ASL_CV_CAPTURE_COMMENTS_ONLY(parser_state); 654 634 switch (opcode) { 655 635 case AML_BYTE_OP: /* AML_BYTEDATA_ARG */ 656 636 ··· 682 660 683 661 /* Fill in bytelist data */ 684 662 663 + ASL_CV_CAPTURE_COMMENTS_ONLY(parser_state); 685 664 arg->named.value.size = buffer_length; 686 665 arg->named.data = parser_state->aml; 687 666 }
+32
drivers/acpi/acpica/psloop.c
··· 55 55 #include "acparser.h" 56 56 #include "acdispat.h" 57 57 #include "amlcode.h" 58 + #include "acconvert.h" 58 59 59 60 #define _COMPONENT ACPI_PARSER 60 61 ACPI_MODULE_NAME("psloop") ··· 132 131 while (GET_CURRENT_ARG_TYPE(walk_state->arg_types) && 133 132 !walk_state->arg_count) { 134 133 walk_state->aml = walk_state->parser_state.aml; 134 + 135 + switch (op->common.aml_opcode) { 136 + case AML_METHOD_OP: 137 + case AML_BUFFER_OP: 138 + case AML_PACKAGE_OP: 139 + case AML_VARIABLE_PACKAGE_OP: 140 + case AML_WHILE_OP: 141 + 142 + break; 143 + 144 + default: 145 + 146 + ASL_CV_CAPTURE_COMMENTS(walk_state); 147 + break; 148 + } 135 149 136 150 status = 137 151 acpi_ps_get_next_arg(walk_state, ··· 496 480 /* Iterative parsing loop, while there is more AML to process: */ 497 481 498 482 while ((parser_state->aml < parser_state->aml_end) || (op)) { 483 + ASL_CV_CAPTURE_COMMENTS(walk_state); 484 + 499 485 aml_op_start = parser_state->aml; 500 486 if (!op) { 501 487 status = ··· 533 515 * any args yet 534 516 */ 535 517 walk_state->arg_count = 0; 518 + 519 + switch (op->common.aml_opcode) { 520 + case AML_BYTE_OP: 521 + case AML_WORD_OP: 522 + case AML_DWORD_OP: 523 + case AML_QWORD_OP: 524 + 525 + break; 526 + 527 + default: 528 + 529 + ASL_CV_CAPTURE_COMMENTS(walk_state); 530 + break; 531 + } 536 532 537 533 /* Are there any arguments that must be processed? */ 538 534
+38
drivers/acpi/acpica/psobject.c
··· 45 45 #include "accommon.h" 46 46 #include "acparser.h" 47 47 #include "amlcode.h" 48 + #include "acconvert.h" 48 49 49 50 #define _COMPONENT ACPI_PARSER 50 51 ACPI_MODULE_NAME("psobject") ··· 191 190 */ 192 191 while (GET_CURRENT_ARG_TYPE(walk_state->arg_types) && 193 192 (GET_CURRENT_ARG_TYPE(walk_state->arg_types) != ARGP_NAME)) { 193 + ASL_CV_CAPTURE_COMMENTS(walk_state); 194 194 status = 195 195 acpi_ps_get_next_arg(walk_state, 196 196 &(walk_state->parser_state), ··· 204 202 acpi_ps_append_arg(unnamed_op, arg); 205 203 INCREMENT_ARG_LIST(walk_state->arg_types); 206 204 } 205 + 206 + /* are there any inline comments associated with the name_seg?? If so, save this. */ 207 + 208 + ASL_CV_CAPTURE_COMMENTS(walk_state); 209 + 210 + #ifdef ACPI_ASL_COMPILER 211 + if (acpi_gbl_current_inline_comment != NULL) { 212 + unnamed_op->common.name_comment = 213 + acpi_gbl_current_inline_comment; 214 + acpi_gbl_current_inline_comment = NULL; 215 + } 216 + #endif 207 217 208 218 /* 209 219 * Make sure that we found a NAME and didn't run out of arguments ··· 256 242 } 257 243 258 244 acpi_ps_append_arg(*op, unnamed_op->common.value.arg); 245 + 246 + #ifdef ACPI_ASL_COMPILER 247 + 248 + /* save any comments that might be associated with unnamed_op. */ 249 + 250 + (*op)->common.inline_comment = unnamed_op->common.inline_comment; 251 + (*op)->common.end_node_comment = unnamed_op->common.end_node_comment; 252 + (*op)->common.close_brace_comment = 253 + unnamed_op->common.close_brace_comment; 254 + (*op)->common.name_comment = unnamed_op->common.name_comment; 255 + (*op)->common.comment_list = unnamed_op->common.comment_list; 256 + (*op)->common.end_blk_comment = unnamed_op->common.end_blk_comment; 257 + (*op)->common.cv_filename = unnamed_op->common.cv_filename; 258 + (*op)->common.cv_parent_filename = 259 + unnamed_op->common.cv_parent_filename; 260 + (*op)->named.aml = unnamed_op->common.aml; 261 + 262 + unnamed_op->common.inline_comment = NULL; 263 + unnamed_op->common.end_node_comment = NULL; 264 + unnamed_op->common.close_brace_comment = NULL; 265 + unnamed_op->common.name_comment = NULL; 266 + unnamed_op->common.comment_list = NULL; 267 + unnamed_op->common.end_blk_comment = NULL; 268 + #endif 259 269 260 270 if ((*op)->common.aml_opcode == AML_REGION_OP || 261 271 (*op)->common.aml_opcode == AML_DATA_REGION_OP) {
+4 -1
drivers/acpi/acpica/psopcode.c
··· 652 652 653 653 /* 81 */ ACPI_OP("External", ARGP_EXTERNAL_OP, ARGI_EXTERNAL_OP, 654 654 ACPI_TYPE_ANY, AML_CLASS_EXECUTE, /* ? */ 655 - AML_TYPE_EXEC_3A_0T_0R, AML_FLAGS_EXEC_3A_0T_0R) 655 + AML_TYPE_EXEC_3A_0T_0R, AML_FLAGS_EXEC_3A_0T_0R), 656 + /* 82 */ ACPI_OP("Comment", ARGP_COMMENT_OP, ARGI_COMMENT_OP, 657 + ACPI_TYPE_STRING, AML_CLASS_ARGUMENT, 658 + AML_TYPE_LITERAL, AML_CONSTANT) 656 659 657 660 /*! [End] no source code translation !*/ 658 661 };
+1 -1
drivers/acpi/acpica/psopinfo.c
··· 226 226 /* 0x90 */ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x73, 0x74, 227 227 /* 0x98 */ 0x75, 0x76, _UNK, _UNK, 0x77, 0x78, 0x79, 0x7A, 228 228 /* 0xA0 */ 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x60, 0x61, 229 - /* 0xA8 */ 0x62, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 229 + /* 0xA8 */ 0x62, 0x82, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 230 230 /* 0xB0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 231 231 /* 0xB8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 232 232 /* 0xC0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+7
drivers/acpi/acpica/pstree.c
··· 45 45 #include "accommon.h" 46 46 #include "acparser.h" 47 47 #include "amlcode.h" 48 + #include "acconvert.h" 48 49 49 50 #define _COMPONENT ACPI_PARSER 50 51 ACPI_MODULE_NAME("pstree") ··· 217 216 218 217 next = acpi_ps_get_arg(op, 0); 219 218 if (next) { 219 + ASL_CV_LABEL_FILENODE(next); 220 220 return (next); 221 221 } 222 222 ··· 225 223 226 224 next = op->common.next; 227 225 if (next) { 226 + ASL_CV_LABEL_FILENODE(next); 228 227 return (next); 229 228 } 230 229 ··· 236 233 while (parent) { 237 234 arg = acpi_ps_get_arg(parent, 0); 238 235 while (arg && (arg != origin) && (arg != op)) { 236 + 237 + ASL_CV_LABEL_FILENODE(arg); 239 238 arg = arg->common.next; 240 239 } 241 240 ··· 252 247 253 248 /* Found sibling of parent */ 254 249 250 + ASL_CV_LABEL_FILENODE(parent->common.next); 255 251 return (parent->common.next); 256 252 } 257 253 ··· 260 254 parent = parent->common.parent; 261 255 } 262 256 257 + ASL_CV_LABEL_FILENODE(next); 263 258 return (next); 264 259 } 265 260
+11
drivers/acpi/acpica/psutils.c
··· 45 45 #include "accommon.h" 46 46 #include "acparser.h" 47 47 #include "amlcode.h" 48 + #include "acconvert.h" 48 49 49 50 #define _COMPONENT ACPI_PARSER 50 51 ACPI_MODULE_NAME("psutils") ··· 153 152 acpi_ps_init_op(op, opcode); 154 153 op->common.aml = aml; 155 154 op->common.flags = flags; 155 + ASL_CV_CLEAR_OP_COMMENTS(op); 156 + 157 + if (opcode == AML_SCOPE_OP) { 158 + acpi_gbl_current_scope = op; 159 + } 160 + } 161 + 162 + if (gbl_capture_comments) { 163 + ASL_CV_TRANSFER_COMMENTS(op); 156 164 } 157 165 158 166 return (op); ··· 184 174 { 185 175 ACPI_FUNCTION_NAME(ps_free_op); 186 176 177 + ASL_CV_CLEAR_OP_COMMENTS(op); 187 178 if (op->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { 188 179 ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, 189 180 "Free retval op: %p\n", op));
+50
drivers/acpi/acpica/utalloc.c
··· 142 142 if (ACPI_FAILURE(status)) { 143 143 return (status); 144 144 } 145 + #ifdef ACPI_ASL_COMPILER 146 + /* 147 + * For use with the ASL-/ASL+ option. This cache keeps track of regular 148 + * 0xA9 0x01 comments. 149 + */ 150 + status = 151 + acpi_os_create_cache("Acpi-Comment", 152 + sizeof(struct acpi_comment_node), 153 + ACPI_MAX_COMMENT_CACHE_DEPTH, 154 + &acpi_gbl_reg_comment_cache); 155 + if (ACPI_FAILURE(status)) { 156 + return (status); 157 + } 158 + 159 + /* 160 + * This cache keeps track of the starting addresses of where the comments 161 + * lie. This helps prevent duplication of comments. 162 + */ 163 + status = 164 + acpi_os_create_cache("Acpi-Comment-Addr", 165 + sizeof(struct acpi_comment_addr_node), 166 + ACPI_MAX_COMMENT_CACHE_DEPTH, 167 + &acpi_gbl_comment_addr_cache); 168 + if (ACPI_FAILURE(status)) { 169 + return (status); 170 + } 171 + 172 + /* 173 + * This cache will be used for nodes that represent files. 174 + */ 175 + status = 176 + acpi_os_create_cache("Acpi-File", sizeof(struct acpi_file_node), 177 + ACPI_MAX_COMMENT_CACHE_DEPTH, 178 + &acpi_gbl_file_cache); 179 + if (ACPI_FAILURE(status)) { 180 + return (status); 181 + } 182 + #endif 183 + 145 184 #ifdef ACPI_DBG_TRACK_ALLOCATIONS 146 185 147 186 /* Memory allocation lists */ ··· 239 200 240 201 (void)acpi_os_delete_cache(acpi_gbl_ps_node_ext_cache); 241 202 acpi_gbl_ps_node_ext_cache = NULL; 203 + 204 + #ifdef ACPI_ASL_COMPILER 205 + (void)acpi_os_delete_cache(acpi_gbl_reg_comment_cache); 206 + acpi_gbl_reg_comment_cache = NULL; 207 + 208 + (void)acpi_os_delete_cache(acpi_gbl_comment_addr_cache); 209 + acpi_gbl_comment_addr_cache = NULL; 210 + 211 + (void)acpi_os_delete_cache(acpi_gbl_file_cache); 212 + acpi_gbl_file_cache = NULL; 213 + #endif 242 214 243 215 #ifdef ACPI_DBG_TRACK_ALLOCATIONS 244 216
+1
drivers/acpi/acpica/utdebug.c
··· 627 627 } 628 628 629 629 ACPI_EXPORT_SYMBOL(acpi_trace_point) 630 + 630 631 #endif
+1
include/acpi/acconfig.h
··· 78 78 #define ACPI_MAX_EXTPARSE_CACHE_DEPTH 96 /* Parse tree objects */ 79 79 #define ACPI_MAX_OBJECT_CACHE_DEPTH 96 /* Interpreter operand objects */ 80 80 #define ACPI_MAX_NAMESPACE_CACHE_DEPTH 96 /* Namespace objects */ 81 + #define ACPI_MAX_COMMENT_CACHE_DEPTH 96 /* Comments for the -ca option */ 81 82 82 83 /* 83 84 * Should the subsystem abort the loading of an ACPI table if the
+1
include/acpi/actbl2.h
··· 87 87 #define ACPI_SIG_WDAT "WDAT" /* Watchdog Action Table */ 88 88 #define ACPI_SIG_WDDT "WDDT" /* Watchdog Timer Description Table */ 89 89 #define ACPI_SIG_WDRT "WDRT" /* Watchdog Resource Table */ 90 + #define ACPI_SIG_XXXX "XXXX" /* Intermediate AML header for ASL/ASL+ converter */ 90 91 91 92 #ifdef ACPI_UNDEFINED_TABLES 92 93 /*