diff options
Diffstat (limited to 'source/compiler/aslcodegen.c')
-rw-r--r-- | source/compiler/aslcodegen.c | 52 |
1 files changed, 12 insertions, 40 deletions
diff --git a/source/compiler/aslcodegen.c b/source/compiler/aslcodegen.c index 8edcb668af4a..88e3482427b9 100644 --- a/source/compiler/aslcodegen.c +++ b/source/compiler/aslcodegen.c @@ -174,11 +174,11 @@ CgWriteTableHeader ( ACPI_PARSE_OBJECT *Op); static void -CgCloseTable ( - void); +CgWriteNode ( + ACPI_PARSE_OBJECT *Op); static void -CgWriteNode ( +CgUpdateHeader ( ACPI_PARSE_OBJECT *Op); @@ -202,15 +202,12 @@ CgGenerateAmlOutput ( /* Generate the AML output file */ - FlSeekFile (ASL_FILE_SOURCE_OUTPUT, 0); - AslGbl_SourceLine = 0; - AslGbl_NextError = AslGbl_ErrorLog; - - TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, + TrWalkParseTree (AslGbl_CurrentDB, + ASL_WALK_VISIT_DOWNWARD | ASL_WALK_VISIT_DB_SEPARATELY, CgAmlWriteWalk, NULL, NULL); DbgPrint (ASL_TREE_OUTPUT, ASL_PARSE_TREE_HEADER2); - CgCloseTable (); + CgUpdateHeader (AslGbl_CurrentDB); } @@ -708,38 +705,13 @@ CgUpdateHeader ( ACPI_OFFSET (ACPI_TABLE_HEADER, Checksum)); FlWriteFile (ASL_FILE_AML_OUTPUT, &Checksum, 1); -} - - -/******************************************************************************* - * - * FUNCTION: CgCloseTable - * - * PARAMETERS: None. - * - * RETURN: None. - * - * DESCRIPTION: Complete the ACPI table by calculating the checksum and - * re-writing each table header. This allows support for - * multiple definition blocks in a single source file. - * - ******************************************************************************/ - -static void -CgCloseTable ( - void) -{ - ACPI_PARSE_OBJECT *Op; - - /* Process all definition blocks */ - - Op = AslGbl_ParseTreeRoot->Asl.Child; - while (Op) - { - CgUpdateHeader (Op); - Op = Op->Asl.Next; - } + /* + * Seek to the end of the file. This is done to support multiple file + * compilation. Doing this simplifies other parts of the codebase because + * it eliminates the need to seek for a different starting place. + */ + FlSeekFile (ASL_FILE_AML_OUTPUT, Op->Asl.FinalAmlOffset + Length); } |