kernel/acpica/compiler/aslcodegen.c
/*******************************************************************************
 *
 * FUNCTION:    CgUpdateHeader
 *
 * PARAMETERS:  Op                  - Op for the Definition Block
 *
 * RETURN:      None.
 *
 * DESCRIPTION: Complete the ACPI table by calculating the checksum and
 *              re-writing the header for the input definition block
 *
 ******************************************************************************/
CgUpdateHeader
PARAMETERS:  Op                  - Op for the Definition Block

None.

Complete the ACPI table by calculating the checksum and
re-writing the header for the input definition block
CgUpdateHeader PARAMETERS : Op - Op for the Definition Block None . Complete the ACPI table by calculating the checksum and re - writing the header for the input definition block
static void
CgUpdateHeader (
    ACPI_PARSE_OBJECT       *Op)
{
    signed char             Sum;
    UINT32                  i;
    UINT32                  Length;
    UINT8                   FileByte;
    UINT8                   Checksum;
    Sum = 0;
    Length = sizeof (ACPI_TABLE_HEADER) + Op->Asl.AmlSubtreeLength;
    FlSeekFile (ASL_FILE_AML_OUTPUT, Op->Asl.FinalAmlOffset);
    for (i = 0; i < Length; i++)
    {
        if (FlReadFile (ASL_FILE_AML_OUTPUT, &FileByte, 1) != AE_OK)
        {
            printf ("EOF while reading checksum bytes\n");
            return;
        }
        Sum = (signed char) (Sum + FileByte);
    }
    Checksum = (UINT8) (0 - Sum);
    FlSeekFile (ASL_FILE_AML_OUTPUT, Op->Asl.FinalAmlOffset +
        ACPI_OFFSET (ACPI_TABLE_HEADER, Checksum));
    FlWriteFile (ASL_FILE_AML_OUTPUT, &Checksum, 1);
}
static void CgUpdateHeader ( ACPI_PARSE_OBJECT * Op ) { signed char Sum ; UINT32 i ; UINT32 Length ; UINT8 FileByte ; UINT8 Checksum ; Sum = 0 ; Length = sizeof ( ACPI_TABLE_HEADER ) + Op -> Asl . AmlSubtreeLength ; FlSeekFile ( ASL_FILE_AML_OUTPUT , Op -> Asl . FinalAmlOffset ) ; for ( i = 0 ; i < Length ; i ++ ) { if ( FlReadFile ( ASL_FILE_AML_OUTPUT , & FileByte , 1 ) != AE_OK ) { printf ( " \n " ) ; return ; } Sum = ( signed char ) ( Sum + FileByte ) ; } Checksum = ( UINT8 ) ( 0 - Sum ) ; FlSeekFile ( ASL_FILE_AML_OUTPUT , Op -> Asl . FinalAmlOffset + ACPI_OFFSET ( ACPI_TABLE_HEADER , Checksum ) ) ; FlWriteFile ( ASL_FILE_AML_OUTPUT , & Checksum , 1 ) ; }
FUNCTION:    CgUpdateHeader
 PARAMETERS:  Op                  - Op for the Definition Block
FUNCTION : CgUpdateHeader PARAMETERS : Op - Op for the Definition Block
/* Calculate the checksum over the entire definition block */ /* Re-write the the checksum byte */