void CmCleanupAndExit ( void) { BOOLEAN DeleteAmlFile = FALSE; ASL_GLOBAL_FILE_NODE *CurrentFileNode = AslGbl_FilesList; /* Check if any errors occurred during compile */ (void) AslCheckForErrorExit (); AePrintErrorLog (ASL_FILE_STDERR); if (AslGbl_DebugFlag) { /* Print error summary to stdout also */ AePrintErrorLog (ASL_FILE_STDOUT); } /* Emit compile times if enabled */ CmDumpAllEvents (); if (AslGbl_CompileTimesFlag) { printf ("\nMiscellaneous compile statistics\n\n"); printf ("%11u : %s\n", AslGbl_TotalParseNodes, "Parse nodes"); printf ("%11u : %s\n", AslGbl_NsLookupCount, "Namespace searches"); printf ("%11u : %s\n", AslGbl_TotalNamedObjects, "Named objects"); printf ("%11u : %s\n", AslGbl_TotalMethods, "Control methods"); printf ("%11u : %s\n", AslGbl_TotalAllocations, "Memory Allocations"); printf ("%11u : %s\n", AslGbl_TotalAllocated, "Total allocated memory"); printf ("%11u : %s\n", AslGbl_TotalFolds, "Constant subtrees folded"); printf ("\n"); } if (AslGbl_NsLookupCount) { DbgPrint (ASL_DEBUG_OUTPUT, "\n\nMiscellaneous compile statistics\n\n"); DbgPrint (ASL_DEBUG_OUTPUT, "%32s : %u\n", "Total Namespace searches", AslGbl_NsLookupCount); DbgPrint (ASL_DEBUG_OUTPUT, "%32s : %u usec\n", "Time per search", ((UINT32) (AslGbl_Events[AslGbl_NamespaceEvent].EndTime - AslGbl_Events[AslGbl_NamespaceEvent].StartTime) / 10) / AslGbl_NsLookupCount); } if (AslGbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT) { printf ("\nMaximum error count (%d) exceeded\n", ASL_MAX_ERROR_COUNT); } UtDisplaySummary (ASL_FILE_STDOUT); /* * We will delete the AML file if there are errors and the * force AML output option has not been used. */ if (AslGbl_ParserErrorDetected || ((AslGbl_ExceptionCount[ASL_ERROR] > 0) && (!AslGbl_IgnoreErrors) && AslGbl_Files[ASL_FILE_AML_OUTPUT].Handle)) { DeleteAmlFile = TRUE; } /* Close all open files */ while (CurrentFileNode) { switch (FlSwitchFileSet (CurrentFileNode->Files[ASL_FILE_INPUT].Filename)) { case SWITCH_TO_SAME_FILE: case SWITCH_TO_DIFFERENT_FILE: CmFinishFiles (DeleteAmlFile); CurrentFileNode = CurrentFileNode->Next; break; case FILE_NOT_FOUND: default: CurrentFileNode = NULL; break; } } /* Final cleanup after compiling one file */ if (!AslGbl_DoAslConversion) { UtDeleteLocalCaches (); } }
void CmCleanupAndExit ( void) { UINT32 i; BOOLEAN DeleteAmlFile = FALSE; AePrintErrorLog (ASL_FILE_STDERR); if (AslGbl_DebugFlag) { /* Print error summary to stdout also */ AePrintErrorLog (ASL_FILE_STDOUT); } /* Emit compile times if enabled */ CmDumpAllEvents (); if (AslGbl_CompileTimesFlag) { printf ("\nMiscellaneous compile statistics\n\n"); printf ("%11u : %s\n", AslGbl_TotalParseNodes, "Parse nodes"); printf ("%11u : %s\n", AslGbl_NsLookupCount, "Namespace searches"); printf ("%11u : %s\n", AslGbl_TotalNamedObjects, "Named objects"); printf ("%11u : %s\n", AslGbl_TotalMethods, "Control methods"); printf ("%11u : %s\n", AslGbl_TotalAllocations, "Memory Allocations"); printf ("%11u : %s\n", AslGbl_TotalAllocated, "Total allocated memory"); printf ("%11u : %s\n", AslGbl_TotalFolds, "Constant subtrees folded"); printf ("\n"); } if (AslGbl_NsLookupCount) { DbgPrint (ASL_DEBUG_OUTPUT, "\n\nMiscellaneous compile statistics\n\n"); DbgPrint (ASL_DEBUG_OUTPUT, "%32s : %u\n", "Total Namespace searches", AslGbl_NsLookupCount); DbgPrint (ASL_DEBUG_OUTPUT, "%32s : %u usec\n", "Time per search", ((UINT32) (AslGbl_Events[AslGbl_NamespaceEvent].EndTime - AslGbl_Events[AslGbl_NamespaceEvent].StartTime) / 10) / AslGbl_NsLookupCount); } if (AslGbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT) { printf ("\nMaximum error count (%d) exceeded\n", ASL_MAX_ERROR_COUNT); } UtDisplaySummary (ASL_FILE_STDOUT); /* * We will delete the AML file if there are errors and the * force AML output option has not been used. */ if ((AslGbl_ExceptionCount[ASL_ERROR] > 0) && (!AslGbl_IgnoreErrors) && AslGbl_Files[ASL_FILE_AML_OUTPUT].Handle) { DeleteAmlFile = TRUE; } /* Close all open files */ /* * Take care with the preprocessor file (.pre), it might be the same * as the "input" file, depending on where the compiler has terminated * or aborted. Prevent attempt to close the same file twice in * loop below. */ if (AslGbl_Files[ASL_FILE_PREPROCESSOR].Handle == AslGbl_Files[ASL_FILE_INPUT].Handle) { AslGbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; } /* Close the standard I/O files */ for (i = ASL_FILE_INPUT; i < ASL_MAX_FILE_TYPE; i++) { FlCloseFile (i); } /* Delete AML file if there are errors */ if (DeleteAmlFile) { FlDeleteFile (ASL_FILE_AML_OUTPUT); } /* Delete the preprocessor temp file unless full debug was specified */ if (AslGbl_PreprocessFlag && !AslGbl_KeepPreprocessorTempFile) { FlDeleteFile (ASL_FILE_PREPROCESSOR); } /* * Delete intermediate ("combined") source file (if -ls flag not set) * This file is created during normal ASL/AML compiles. It is not * created by the data table compiler. * * If the -ls flag is set, then the .SRC file should not be deleted. * In this case, Gbl_SourceOutputFlag is set to TRUE. * * Note: Handles are cleared by FlCloseFile above, so we look at the * filename instead, to determine if the .SRC file was actually * created. */ if (!AslGbl_SourceOutputFlag) { FlDeleteFile (ASL_FILE_SOURCE_OUTPUT); } /* Final cleanup after compiling one file */ if (!AslGbl_DoAslConversion) { UtDeleteLocalCaches (); } }
static ACPI_STATUS AslDoDisassembly ( void) { ACPI_STATUS Status; /* ACPICA subsystem initialization */ Status = AdInitialize (); if (ACPI_FAILURE (Status)) { return (Status); } Status = AcpiAllocateRootTable (4); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("Could not initialize ACPI Table Manager, %s\n", AcpiFormatException (Status)); return (Status); } /* Handle additional output files for disassembler */ AslGbl_FileType = ASL_INPUT_TYPE_BINARY_ACPI_TABLE; Status = FlOpenMiscOutputFiles (AslGbl_OutputFilenamePrefix); /* This is where the disassembly happens */ AcpiGbl_DmOpt_Disasm = TRUE; Status = AdAmlDisassemble (AslToFile, AslGbl_Files[ASL_FILE_INPUT].Filename, AslGbl_OutputFilenamePrefix, &AslGbl_Files[ASL_FILE_INPUT].Filename); if (ACPI_FAILURE (Status)) { return (Status); } /* Check if any control methods were unresolved */ AcpiDmUnresolvedWarning (0); /* Shutdown compiler and ACPICA subsystem */ AeClearErrorLog (); (void) AcpiTerminate (); /* * AslGbl_Files[ASL_FILE_INPUT].Filename was replaced with the * .DSL disassembly file, which can now be compiled if requested */ if (AslGbl_DoCompile) { AcpiOsPrintf ("\nCompiling \"%s\"\n", AslGbl_Files[ASL_FILE_INPUT].Filename); return (AE_CTRL_CONTINUE); } /* No need to free the filename string */ AslGbl_Files[ASL_FILE_INPUT].Filename = NULL; UtDeleteLocalCaches (); return (AE_OK); }
ACPI_STATUS DtCreateTemplates ( char **argv) { char *Signature; char *End; unsigned long TableCount; ACPI_STATUS Status = AE_OK; AslInitializeGlobals (); Status = AdInitialize (); if (ACPI_FAILURE (Status)) { return (Status); } /* * Special cases for DSDT, ALL, and '*' */ /* Default (no signature option) is DSDT */ if (AcpiGbl_Optind < 3) { Status = DtCreateOneTemplateFile (ACPI_SIG_DSDT, 0); goto Exit; } AcpiGbl_Optind--; Signature = argv[AcpiGbl_Optind]; AcpiUtStrupr (Signature); /* * Multiple SSDT support (-T <ssdt count>) */ TableCount = strtoul (Signature, &End, 0); if (Signature != End) { /* The count is used for table ID and method name - max is 254(+1) */ if (TableCount > 254) { fprintf (stderr, "%u SSDTs requested, maximum is 254\n", (unsigned int) TableCount); Status = AE_LIMIT; goto Exit; } Status = DtCreateOneTemplateFile (ACPI_SIG_DSDT, TableCount); goto Exit; } if (!strcmp (Signature, "ALL")) { /* Create all available/known templates */ Status = DtCreateAllTemplates (); goto Exit; } /* * Normal case: Create template for each signature */ while (argv[AcpiGbl_Optind]) { Signature = argv[AcpiGbl_Optind]; AcpiUtStrupr (Signature); Status = DtCreateOneTemplateFile (Signature, 0); if (ACPI_FAILURE (Status)) { goto Exit; } AcpiGbl_Optind++; } Exit: /* Shutdown ACPICA subsystem */ (void) AcpiTerminate (); UtDeleteLocalCaches (); return (Status); }