diff options
Diffstat (limited to 'sys/contrib/dev/acpica/compiler/asllisting.c')
-rw-r--r-- | sys/contrib/dev/acpica/compiler/asllisting.c | 158 |
1 files changed, 123 insertions, 35 deletions
diff --git a/sys/contrib/dev/acpica/compiler/asllisting.c b/sys/contrib/dev/acpica/compiler/asllisting.c index a8fe2de..45ab1e2 100644 --- a/sys/contrib/dev/acpica/compiler/asllisting.c +++ b/sys/contrib/dev/acpica/compiler/asllisting.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -163,16 +163,16 @@ LsGenerateListing ( LsDoOffsetTableHeader (FileId); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, LsAmlOffsetWalk, - NULL, (void *) ACPI_TO_POINTER (FileId)); + TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, + LsAmlOffsetWalk, NULL, (void *) ACPI_TO_POINTER (FileId)); LsDoOffsetTableFooter (FileId); return; } /* Process all parse nodes */ - TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, LsAmlListingWalk, - NULL, (void *) ACPI_TO_POINTER (FileId)); + TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, + LsAmlListingWalk, NULL, (void *) ACPI_TO_POINTER (FileId)); /* Final processing */ @@ -212,6 +212,12 @@ LsAmlListingWalk ( return (AE_OK); } + if ((FileId == ASL_FILE_ASM_INCLUDE_OUTPUT) || + (FileId == ASL_FILE_C_INCLUDE_OUTPUT)) + { + return (AE_OK); + } + /* Write the hex bytes to the listing file(s) (if requested) */ for (i = 0; i < Op->Asl.FinalAmlLength; i++) @@ -221,6 +227,7 @@ LsAmlListingWalk ( FlFileError (ASL_FILE_AML_OUTPUT, ASL_MSG_READ); AslAbort (); } + LsWriteListingHexBytes (&FileByte, 1, FileId); } @@ -251,8 +258,12 @@ LsDumpParseTree ( } DbgPrint (ASL_TREE_OUTPUT, "\nOriginal parse tree from parser:\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, + DbgPrint (ASL_TREE_OUTPUT, ASL_PARSE_TREE_HEADER1); + + TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, LsTreeWriteWalk, NULL, NULL); + + DbgPrint (ASL_TREE_OUTPUT, ASL_PARSE_TREE_HEADER1); } @@ -263,15 +274,69 @@ LsTreeWriteWalk ( void *Context) { - /* Debug output */ + /* Dump ParseOp name and possible value */ + + switch (Op->Asl.ParseOpcode) + { + case PARSEOP_NAMESEG: + case PARSEOP_NAMESTRING: + case PARSEOP_METHODCALL: + case PARSEOP_STRING_LITERAL: + + UtDumpStringOp (Op, Level); + break; + + case PARSEOP_BYTECONST: + + UtDumpIntegerOp (Op, Level, 2); + break; + + case PARSEOP_WORDCONST: + case PARSEOP_PACKAGE_LENGTH: + + UtDumpIntegerOp (Op, Level, 4); + break; + + case PARSEOP_DWORDCONST: + case PARSEOP_EISAID: + + UtDumpIntegerOp (Op, Level, 8); + break; + + case PARSEOP_QWORDCONST: + case PARSEOP_INTEGER: + case PARSEOP_ONE: + case PARSEOP_ZERO: + case PARSEOP_ONES: + + UtDumpIntegerOp (Op, Level, 16); + break; + + case PARSEOP_INCLUDE: + + DbgPrint (ASL_TREE_OUTPUT, + "Open: %s\n", Op->Asl.Value.String); + return (AE_OK); + + case PARSEOP_INCLUDE_END: + + DbgPrint (ASL_TREE_OUTPUT, + "Close: %s\n", Op->Asl.Filename); + return (AE_OK); + + default: + + UtDumpBasicOp (Op, Level); + break; + } - DbgPrint (ASL_TREE_OUTPUT, - "%5.5d [%2d]", Op->Asl.LogicalLineNumber, Level); + /* Dump the remaining data */ - UtPrintFormattedName (Op->Asl.ParseOpcode, Level); + DbgPrint (ASL_TREE_OUTPUT, ASL_PARSE_TREE_DEBUG1, + Op->Asl.ParseOpcode, Op->Asl.CompileFlags, + Op->Asl.LineNumber, Op->Asl.EndLine, + Op->Asl.LogicalLineNumber, Op->Asl.EndLogicalLine); - DbgPrint (ASL_TREE_OUTPUT, " (%.4X) Flags %8.8X", - Op->Asl.ParseOpcode, Op->Asl.CompileFlags); TrPrintNodeCompileFlags (Op->Asl.CompileFlags); DbgPrint (ASL_TREE_OUTPUT, "\n"); return (AE_OK); @@ -316,7 +381,7 @@ LsWriteNodeToListing ( { switch (Op->Asl.ParseOpcode) { - case PARSEOP_DEFINITIONBLOCK: + case PARSEOP_DEFINITION_BLOCK: case PARSEOP_METHODCALL: case PARSEOP_INCLUDE: case PARSEOP_INCLUDE_END: @@ -362,36 +427,49 @@ LsWriteNodeToListing ( switch (Op->Asl.ParseOpcode) { - case PARSEOP_DEFINITIONBLOCK: + case PARSEOP_DEFINITION_BLOCK: + + /* Always start a definition block at AML offset zero */ + Gbl_CurrentAmlOffset = 0; LsWriteSourceLines (Op->Asl.EndLine, Op->Asl.EndLogicalLine, FileId); /* Use the table Signature and TableId to build a unique name */ - if (FileId == ASL_FILE_ASM_SOURCE_OUTPUT) + switch (FileId) { + case ASL_FILE_ASM_SOURCE_OUTPUT: + FlPrintFile (FileId, "%s_%s_Header \\\n", Gbl_TableSignature, Gbl_TableId); - } - if (FileId == ASL_FILE_C_SOURCE_OUTPUT) - { + break; + + case ASL_FILE_C_SOURCE_OUTPUT: + FlPrintFile (FileId, " unsigned char %s_%s_Header [] =\n {\n", Gbl_TableSignature, Gbl_TableId); - } - if (FileId == ASL_FILE_ASM_INCLUDE_OUTPUT) - { + break; + + case ASL_FILE_ASM_INCLUDE_OUTPUT: + FlPrintFile (FileId, "extrn %s_%s_Header : byte\n", Gbl_TableSignature, Gbl_TableId); - } - if (FileId == ASL_FILE_C_INCLUDE_OUTPUT) - { + break; + + case ASL_FILE_C_INCLUDE_OUTPUT: + FlPrintFile (FileId, "extern unsigned char %s_%s_Header [];\n", Gbl_TableSignature, Gbl_TableId); + break; + + default: + break; } + return; @@ -411,7 +489,7 @@ LsWriteNodeToListing ( /* Create a new listing node and push it */ - LsPushNode (Op->Asl.Child->Asl.Value.String); + LsPushNode (Op->Asl.Value.String); return; @@ -540,31 +618,41 @@ LsWriteNodeToListing ( /* Create the appropriate symbol in the output file */ - if (FileId == ASL_FILE_ASM_SOURCE_OUTPUT) + switch (FileId) { + case ASL_FILE_ASM_SOURCE_OUTPUT: + FlPrintFile (FileId, "%s_%s_%s \\\n", Gbl_TableSignature, Gbl_TableId, &Pathname[1]); - } - if (FileId == ASL_FILE_C_SOURCE_OUTPUT) - { + break; + + case ASL_FILE_C_SOURCE_OUTPUT: + FlPrintFile (FileId, " unsigned char %s_%s_%s [] =\n {\n", Gbl_TableSignature, Gbl_TableId, &Pathname[1]); - } - if (FileId == ASL_FILE_ASM_INCLUDE_OUTPUT) - { + break; + + case ASL_FILE_ASM_INCLUDE_OUTPUT: + FlPrintFile (FileId, "extrn %s_%s_%s : byte\n", Gbl_TableSignature, Gbl_TableId, &Pathname[1]); - } - if (FileId == ASL_FILE_C_INCLUDE_OUTPUT) - { + break; + + case ASL_FILE_C_INCLUDE_OUTPUT: + FlPrintFile (FileId, "extern unsigned char %s_%s_%s [];\n", Gbl_TableSignature, Gbl_TableId, &Pathname[1]); + break; + + default: + break; } } + ACPI_FREE (Pathname); } break; |