kernel/acpica/compiler/cvparser.c
/*******************************************************************************
 *
 * FUNCTION:    CvCaptureCommentsOnly
 *
 * PARAMETERS:  ParserState         - A parser state object
 *
 * RETURN:      None
 *
 * DESCRIPTION: Look at the aml that the parser state is pointing to,
 *              capture any AML_COMMENT_OP and it's arguments and increment the
 *              aml pointer past the comment. Comments are transferred to parse
 *              nodes through CvTransferComments() as well as
 *              AcpiPsBuildNamedOp().
 *              This is referred as ASL_CV_CAPTURE_COMMENTS_ONLY.
 *
 ******************************************************************************/
CvCaptureCommentsOnly
PARAMETERS:  ParserState         - A parser state object

None

Look at the aml that the parser state is pointing to,
capture any AML_COMMENT_OP and it's arguments and increment the
aml pointer past the comment. Comments are transferred to parse
nodes through CvTransferComments() as well as
AcpiPsBuildNamedOp().
This is referred as ASL_CV_CAPTURE_COMMENTS_ONLY.
CvCaptureCommentsOnly PARAMETERS : ParserState - A parser state object None Look at the aml that the parser state is pointing to capture any AML_COMMENT_OP and it ' s arguments and increment the aml pointer past the comment . Comments are transferred to parse nodes through CvTransferComments () as well as AcpiPsBuildNamedOp () . This is referred as ASL_CV_CAPTURE_COMMENTS_ONLY .
void
CvCaptureCommentsOnly (
    ACPI_PARSE_STATE        *ParserState)
{
    UINT8                   *Aml = ParserState->Aml;
    UINT16                  Opcode = (UINT16) ACPI_GET8 (Aml);
    UINT32                  Length = 0;
    UINT8                   CommentOption = (UINT16) ACPI_GET8 (Aml+1);
    BOOLEAN                 StdDefBlockFlag = FALSE;
    ACPI_COMMENT_NODE       *CommentNode;
    ACPI_FILE_NODE          *FileNode;
    if (!Gbl_CaptureComments ||
        Opcode != AML_COMMENT_OP)
    {
       return;
    }
    while (Opcode == AML_COMMENT_OP)
    {
        CvDbgPrint ("comment aml address: %p\n", Aml);
        if (CvCommentExists(ParserState->Aml))
        {
            CvDbgPrint ("Avoiding capturing an existing comment.\n");
        }
        else
        {
            CommentOption = *(Aml +1);
            Aml += 2;
            switch (CommentOption)
            {
                case STD_DEFBLK_COMMENT:
                    StdDefBlockFlag = TRUE;
                    CommentNode = AcpiOsAcquireObject (
                        AcpiGbl_RegCommentCache);
                    CommentNode->Comment = ACPI_CAST_PTR (char, Aml);
                    CommentNode->Next = NULL;
                    if (!AcpiGbl_DefBlkCommentListHead)
                    {
                        AcpiGbl_DefBlkCommentListHead = CommentNode;
                        AcpiGbl_DefBlkCommentListTail = CommentNode;
                    }
                    else
                    {
                        AcpiGbl_DefBlkCommentListTail->Next = CommentNode;
                        AcpiGbl_DefBlkCommentListTail =
                            AcpiGbl_DefBlkCommentListTail->Next;
                    }
                    break;
                case STANDARD_COMMENT:
                    CvDbgPrint ("found regular comment.\n");
                    CommentNode = AcpiOsAcquireObject (
                        AcpiGbl_RegCommentCache);
                    CommentNode->Comment = ACPI_CAST_PTR (char, Aml);
                    CommentNode->Next    = NULL;
                    if (!AcpiGbl_RegCommentListHead)
                    {
                        AcpiGbl_RegCommentListHead = CommentNode;
                        AcpiGbl_RegCommentListTail = CommentNode;
                    }
                    else
                    {
                        AcpiGbl_RegCommentListTail->Next = CommentNode;
                        AcpiGbl_RegCommentListTail =
                            AcpiGbl_RegCommentListTail->Next;
                    }
                    break;
                case ENDBLK_COMMENT:
                    CvDbgPrint ("found endblk comment.\n");
                    CommentNode = AcpiOsAcquireObject (
                        AcpiGbl_RegCommentCache);
                    CommentNode->Comment = ACPI_CAST_PTR (char, Aml);
                    CommentNode->Next    = NULL;
                    if (!AcpiGbl_EndBlkCommentListHead)
                    {
                        AcpiGbl_EndBlkCommentListHead = CommentNode;
                        AcpiGbl_EndBlkCommentListTail = CommentNode;
                    }
                    else
                    {
                        AcpiGbl_EndBlkCommentListTail->Next = CommentNode;
                        AcpiGbl_EndBlkCommentListTail =
                            AcpiGbl_EndBlkCommentListTail->Next;
                    }
                    break;
                case INLINE_COMMENT:
                    CvDbgPrint ("found inline comment.\n");
                    AcpiGbl_CurrentInlineComment =
                        ACPI_CAST_PTR (char, Aml);
                    break;
                case ENDNODE_COMMENT:
                    CvDbgPrint ("found EndNode comment.\n");
                    AcpiGbl_CurrentEndNodeComment =
                        ACPI_CAST_PTR (char, Aml);
                    break;
                case CLOSE_BRACE_COMMENT:
                    CvDbgPrint ("found close brace comment.\n");
                    AcpiGbl_CurrentCloseBraceComment =
                        ACPI_CAST_PTR (char, Aml);
                    break;
                case END_DEFBLK_COMMENT:
                    CvDbgPrint ("Found comment that belongs after"
                        " the } for a definition block.\n");
                    AcpiGbl_CurrentScope->Common.CloseBraceComment =
                        ACPI_CAST_PTR (char, Aml);
                    break;
                case FILENAME_COMMENT:
                    CvDbgPrint ("Found a filename: %s\n",
                        ACPI_CAST_PTR (char, Aml));
                    FileNode = CvFilenameExists (
                        ACPI_CAST_PTR (char, Aml), AcpiGbl_FileTreeRoot);
                    if (FileNode && AcpiGbl_IncCommentListHead)
                    {
                        FileNode->IncludeComment = AcpiGbl_IncCommentListHead;
                        AcpiGbl_IncCommentListHead = NULL;
                        AcpiGbl_IncCommentListTail = NULL;
                    }
                    break;
                case PARENTFILENAME_COMMENT:
                    CvDbgPrint ("    Found a parent filename.\n");
                    break;
                case INCLUDE_COMMENT:
                    CommentNode = AcpiOsAcquireObject (
                        AcpiGbl_RegCommentCache);
                    CommentNode->Comment = ACPI_CAST_PTR (char, Aml);
                    CommentNode->Next = NULL;
                    if (!AcpiGbl_IncCommentListHead)
                    {
                        AcpiGbl_IncCommentListHead = CommentNode;
                        AcpiGbl_IncCommentListTail = CommentNode;
                    }
                    else
                    {
                        AcpiGbl_IncCommentListTail->Next = CommentNode;
                        AcpiGbl_IncCommentListTail =
                            AcpiGbl_IncCommentListTail->Next;
                    }
                    CvDbgPrint ("Found a include comment: %s\n",
                        CommentNode->Comment);
                    break;
                default:
                    Aml -= 2;
                    goto DefBlock;
            } 
        } 
        Length = 0;
        while (ParserState->Aml[Length])
        {
            Length++;
        }
        ParserState->Aml += Length + 1;
        Aml = ParserState->Aml;
        Opcode = (UINT16) ACPI_GET8 (Aml);
    }
DefBlock:
    if (StdDefBlockFlag)
    {
        AcpiGbl_CurrentScope->Common.CommentList
            = AcpiGbl_DefBlkCommentListHead;
        AcpiGbl_DefBlkCommentListHead = NULL;
        AcpiGbl_DefBlkCommentListTail = NULL;
    }
}
void CvCaptureCommentsOnly ( ACPI_PARSE_STATE * ParserState ) { UINT8 * Aml = ParserState -> Aml ; UINT16 Opcode = ( UINT16 ) ACPI_GET8 ( Aml ) ; UINT32 Length = 0 ; UINT8 CommentOption = ( UINT16 ) ACPI_GET8 ( Aml + 1 ) ; BOOLEAN StdDefBlockFlag = FALSE ; ACPI_COMMENT_NODE * CommentNode ; ACPI_FILE_NODE * FileNode ; if ( ! Gbl_CaptureComments || Opcode != AML_COMMENT_OP ) { return ; } while ( Opcode == AML_COMMENT_OP ) { CvDbgPrint ( " \n " , Aml ) ; if ( CvCommentExists ( ParserState -> Aml ) ) { CvDbgPrint ( " \n " ) ; } else { CommentOption = * ( Aml + 1 ) ; Aml += 2 ; switch ( CommentOption ) { case STD_DEFBLK_COMMENT : StdDefBlockFlag = TRUE ; CommentNode = AcpiOsAcquireObject ( AcpiGbl_RegCommentCache ) ; CommentNode -> Comment = ACPI_CAST_PTR ( char , Aml ) ; CommentNode -> Next = NULL ; if ( ! AcpiGbl_DefBlkCommentListHead ) { AcpiGbl_DefBlkCommentListHead = CommentNode ; AcpiGbl_DefBlkCommentListTail = CommentNode ; } else { AcpiGbl_DefBlkCommentListTail -> Next = CommentNode ; AcpiGbl_DefBlkCommentListTail = AcpiGbl_DefBlkCommentListTail -> Next ; } break ; case STANDARD_COMMENT : CvDbgPrint ( " \n " ) ; CommentNode = AcpiOsAcquireObject ( AcpiGbl_RegCommentCache ) ; CommentNode -> Comment = ACPI_CAST_PTR ( char , Aml ) ; CommentNode -> Next = NULL ; if ( ! AcpiGbl_RegCommentListHead ) { AcpiGbl_RegCommentListHead = CommentNode ; AcpiGbl_RegCommentListTail = CommentNode ; } else { AcpiGbl_RegCommentListTail -> Next = CommentNode ; AcpiGbl_RegCommentListTail = AcpiGbl_RegCommentListTail -> Next ; } break ; case ENDBLK_COMMENT : CvDbgPrint ( " \n " ) ; CommentNode = AcpiOsAcquireObject ( AcpiGbl_RegCommentCache ) ; CommentNode -> Comment = ACPI_CAST_PTR ( char , Aml ) ; CommentNode -> Next = NULL ; if ( ! AcpiGbl_EndBlkCommentListHead ) { AcpiGbl_EndBlkCommentListHead = CommentNode ; AcpiGbl_EndBlkCommentListTail = CommentNode ; } else { AcpiGbl_EndBlkCommentListTail -> Next = CommentNode ; AcpiGbl_EndBlkCommentListTail = AcpiGbl_EndBlkCommentListTail -> Next ; } break ; case INLINE_COMMENT : CvDbgPrint ( " \n " ) ; AcpiGbl_CurrentInlineComment = ACPI_CAST_PTR ( char , Aml ) ; break ; case ENDNODE_COMMENT : CvDbgPrint ( " \n " ) ; AcpiGbl_CurrentEndNodeComment = ACPI_CAST_PTR ( char , Aml ) ; break ; case CLOSE_BRACE_COMMENT : CvDbgPrint ( " \n " ) ; AcpiGbl_CurrentCloseBraceComment = ACPI_CAST_PTR ( char , Aml ) ; break ; case END_DEFBLK_COMMENT : CvDbgPrint ( " " " \n " ) ; AcpiGbl_CurrentScope -> Common . CloseBraceComment = ACPI_CAST_PTR ( char , Aml ) ; break ; case FILENAME_COMMENT : CvDbgPrint ( " \n " , ACPI_CAST_PTR ( char , Aml ) ) ; FileNode = CvFilenameExists ( ACPI_CAST_PTR ( char , Aml ) , AcpiGbl_FileTreeRoot ) ; if ( FileNode && AcpiGbl_IncCommentListHead ) { FileNode -> IncludeComment = AcpiGbl_IncCommentListHead ; AcpiGbl_IncCommentListHead = NULL ; AcpiGbl_IncCommentListTail = NULL ; } break ; case PARENTFILENAME_COMMENT : CvDbgPrint ( " \n " ) ; break ; case INCLUDE_COMMENT : CommentNode = AcpiOsAcquireObject ( AcpiGbl_RegCommentCache ) ; CommentNode -> Comment = ACPI_CAST_PTR ( char , Aml ) ; CommentNode -> Next = NULL ; if ( ! AcpiGbl_IncCommentListHead ) { AcpiGbl_IncCommentListHead = CommentNode ; AcpiGbl_IncCommentListTail = CommentNode ; } else { AcpiGbl_IncCommentListTail -> Next = CommentNode ; AcpiGbl_IncCommentListTail = AcpiGbl_IncCommentListTail -> Next ; } CvDbgPrint ( " \n " , CommentNode -> Comment ) ; break ; default : Aml -= 2 ; goto DefBlock ; } } Length = 0 ; while ( ParserState -> Aml [ Length ] ) { Length ++ ; } ParserState -> Aml += Length + 1 ; Aml = ParserState -> Aml ; Opcode = ( UINT16 ) ACPI_GET8 ( Aml ) ; } DefBlock : if ( StdDefBlockFlag ) { AcpiGbl_CurrentScope -> Common . CommentList = AcpiGbl_DefBlkCommentListHead ; AcpiGbl_DefBlkCommentListHead = NULL ; AcpiGbl_DefBlkCommentListTail = NULL ; } }
FUNCTION:    CvCaptureCommentsOnly
 PARAMETERS:  ParserState         - A parser state object
FUNCTION : CvCaptureCommentsOnly PARAMETERS : ParserState - A parser state object
/*
             * Increment past the comment option and point the
             * appropriate char pointers
             */ /* Found a comment. Now, set pointers to these comments. */ /*
                     * Add to a linked list of nodes. This list will be
                     * taken by the parse node created next.
                     */ /*
                     * Add to a linked list of nodes. This list will be
                     * taken by the parse node created next.
                     */ /* Add to a linked list of nodes. This will be
                     * taken by the next created parse node.
                     */ /*
                     * If there is an INCLUDE_COMMENT followed by a
                     * FILENAME_COMMENT, then the INCLUDE_COMMENT is a comment
                     * that is emitted before the #include for the file.
                     * We will save the IncludeComment within the FileNode
                     * associated with this FILENAME_COMMENT.
                     */ /*
                     * Add to a linked list. This list will be taken by the
                     * parse node created next. See the FILENAME_COMMENT case
                     * for more details
                     */ /* Not a valid comment option. Revert the AML */ /* End switch statement */ /* End else */ /* Determine the length and move forward that amount */ /* Peek at the next Opcode. */ /*
         * Give all of its comments to the current scope, which is known as
         * the definition block, since STD_DEFBLK_COMMENT only appears after
         * definition block headers.
         */