kernel/acpica/compiler/aslcodegen.c
/*******************************************************************************
 *
 * FUNCTION:    CgWriteTableHeader
 *
 * PARAMETERS:  Op        - The DEFINITIONBLOCK node
 *
 * RETURN:      None
 *
 * DESCRIPTION: Write a table header corresponding to the DEFINITIONBLOCK
 *
 ******************************************************************************/
CgWriteTableHeader
PARAMETERS:  Op        - The DEFINITIONBLOCK node

None

Write a table header corresponding to the DEFINITIONBLOCK
CgWriteTableHeader PARAMETERS : Op - The DEFINITIONBLOCK node None Write a table header corresponding to the DEFINITIONBLOCK
static void
CgWriteTableHeader (
    ACPI_PARSE_OBJECT       *Op)
{
    ACPI_PARSE_OBJECT       *Child;
    UINT32                  CommentLength;
    ACPI_COMMENT_NODE       *Current;
    Child = Op->Asl.Child;
    Child = Child->Asl.Next;
    if (Gbl_CaptureComments)
    {
        strncpy(AcpiGbl_TableSig, Child->Asl.Value.String, 4);
        Child->Asl.Value.String = ACPI_SIG_XXXX;
    }
    strncpy (TableHeader.Signature, Child->Asl.Value.String, 4);
    Child = Child->Asl.Next;
    TableHeader.Revision = (UINT8) Child->Asl.Value.Integer;
    if (Gbl_RevisionOverride)
    {
        TableHeader.Revision = Gbl_RevisionOverride;
    }
    Child = Child->Asl.Next;
    strncpy (TableHeader.OemId, Child->Asl.Value.String, 6);
    Child = Child->Asl.Next;
    strncpy (TableHeader.OemTableId, Child->Asl.Value.String, 8);
    Child = Child->Asl.Next;
    TableHeader.OemRevision = (UINT32) Child->Asl.Value.Integer;
    ACPI_MOVE_NAME (TableHeader.AslCompilerId, ASL_CREATOR_ID);
    TableHeader.AslCompilerRevision = ACPI_CA_VERSION;
    TableHeader.Length = sizeof (ACPI_TABLE_HEADER) +
        Op->Asl.AmlSubtreeLength;
    if (Gbl_CaptureComments)
    {
        CvDbgPrint ("Calculating comment lengths for %s in write header\n",
            Op->Asl.ParseOpName);
        TableHeader.Length += strrchr (Gbl_ParseTreeRoot->Asl.Filename, '.')
            - Gbl_ParseTreeRoot->Asl.Filename + 1 + 3 + 3;
        Op->Asl.AmlSubtreeLength +=
            strlen (Gbl_ParseTreeRoot->Asl.Filename) + 3;
    CvDbgPrint ("     Length: %lu\n",
            strlen (Gbl_ParseTreeRoot->Asl.Filename) + 3);
        if (Op->Asl.CommentList)
        {
            Current = Op->Asl.CommentList;
            while (Current)
            {
                CommentLength = strlen (Current->Comment)+3;
                CvDbgPrint ("Length of standard comment): %d\n", CommentLength);
                CvDbgPrint ("    Comment string: %s\n\n", Current->Comment);
                TableHeader.Length += CommentLength;
                Op->Asl.AmlSubtreeLength += CommentLength;
                Current = Current->Next;
            CvDbgPrint ("    Length: %u\n", CommentLength);
            }
        }
        if (Op->Asl.CloseBraceComment)
        {
            CommentLength = strlen (Op->Asl.CloseBraceComment)+3;
            CvDbgPrint ("Length of inline comment +3: %d\n", CommentLength);
            CvDbgPrint ("    Comment string: %s\n\n", Op->Asl.CloseBraceComment);
            TableHeader.Length += CommentLength;
            Op->Asl.AmlSubtreeLength += CommentLength;
        CvDbgPrint ("    Length: %u\n", CommentLength);
        }
    }
    TableHeader.Checksum = 0;
    Op->Asl.FinalAmlOffset = ftell (Gbl_Files[ASL_FILE_AML_OUTPUT].Handle);
    CgLocalWriteAmlData (Op, &TableHeader, sizeof (ACPI_TABLE_HEADER));
    memset (&TableHeader, 0, sizeof (ACPI_TABLE_HEADER));
}
static void CgWriteTableHeader ( ACPI_PARSE_OBJECT * Op ) { ACPI_PARSE_OBJECT * Child ; UINT32 CommentLength ; ACPI_COMMENT_NODE * Current ; Child = Op -> Asl . Child ; Child = Child -> Asl . Next ; if ( Gbl_CaptureComments ) { strncpy ( AcpiGbl_TableSig , Child -> Asl . Value . String , 4 ) ; Child -> Asl . Value . String = ACPI_SIG_XXXX ; } strncpy ( TableHeader . Signature , Child -> Asl . Value . String , 4 ) ; Child = Child -> Asl . Next ; TableHeader . Revision = ( UINT8 ) Child -> Asl . Value . Integer ; if ( Gbl_RevisionOverride ) { TableHeader . Revision = Gbl_RevisionOverride ; } Child = Child -> Asl . Next ; strncpy ( TableHeader . OemId , Child -> Asl . Value . String , 6 ) ; Child = Child -> Asl . Next ; strncpy ( TableHeader . OemTableId , Child -> Asl . Value . String , 8 ) ; Child = Child -> Asl . Next ; TableHeader . OemRevision = ( UINT32 ) Child -> Asl . Value . Integer ; ACPI_MOVE_NAME ( TableHeader . AslCompilerId , ASL_CREATOR_ID ) ; TableHeader . AslCompilerRevision = ACPI_CA_VERSION ; TableHeader . Length = sizeof ( ACPI_TABLE_HEADER ) + Op -> Asl . AmlSubtreeLength ; if ( Gbl_CaptureComments ) { CvDbgPrint ( " \n " , Op -> Asl . ParseOpName ) ; TableHeader . Length += strrchr ( Gbl_ParseTreeRoot -> Asl . Filename , ' ' ) - Gbl_ParseTreeRoot -> Asl . Filename + 1 + 3 + 3 ; Op -> Asl . AmlSubtreeLength += strlen ( Gbl_ParseTreeRoot -> Asl . Filename ) + 3 ; CvDbgPrint ( " \n " , strlen ( Gbl_ParseTreeRoot -> Asl . Filename ) + 3 ) ; if ( Op -> Asl . CommentList ) { Current = Op -> Asl . CommentList ; while ( Current ) { CommentLength = strlen ( Current -> Comment ) + 3 ; CvDbgPrint ( " \n " , CommentLength ) ; CvDbgPrint ( " \n \n " , Current -> Comment ) ; TableHeader . Length += CommentLength ; Op -> Asl . AmlSubtreeLength += CommentLength ; Current = Current -> Next ; CvDbgPrint ( " \n " , CommentLength ) ; } } if ( Op -> Asl . CloseBraceComment ) { CommentLength = strlen ( Op -> Asl . CloseBraceComment ) + 3 ; CvDbgPrint ( " \n " , CommentLength ) ; CvDbgPrint ( " \n \n " , Op -> Asl . CloseBraceComment ) ; TableHeader . Length += CommentLength ; Op -> Asl . AmlSubtreeLength += CommentLength ; CvDbgPrint ( " \n " , CommentLength ) ; } } TableHeader . Checksum = 0 ; Op -> Asl . FinalAmlOffset = ftell ( Gbl_Files [ ASL_FILE_AML_OUTPUT ] . Handle ) ; CgLocalWriteAmlData ( Op , & TableHeader , sizeof ( ACPI_TABLE_HEADER ) ) ; memset ( & TableHeader , 0 , sizeof ( ACPI_TABLE_HEADER ) ) ; }
FUNCTION:    CgWriteTableHeader
 PARAMETERS:  Op        - The DEFINITIONBLOCK node
FUNCTION : CgWriteTableHeader PARAMETERS : Op - The DEFINITIONBLOCK node
/* AML filename */ /* Signature */ /*
     * For ASL-/ASL+ converter: replace the table signature with
     * "XXXX" and save the original table signature. This results in an AML
     * file with the signature "XXXX". The converter should remove this AML
     * file. In the event where this AML file does not get deleted, the
     * "XXXX" table signature prevents this AML file from running on the AML
     * interpreter.
     */ /* Revision */ /* Command-line Revision override */ /* OEMID */ /* OEM TableID */ /* OEM Revision */ /* Compiler ID */ /* Compiler version */ /* Table length. Checksum zero for now, will rewrite later */ /* Calculate the comment lengths for this definition block parseOp */ /*
         * Take the filename without extensions, add 3 for the new extension
         * and another 3 for the a908 bytecode and null terminator.
         */ /* Write entire header and clear the table header global */