ACPI_STATUS AcpiInitializeSubsystem ( void) { ACPI_STATUS Status; ACPI_FUNCTION_TRACE (AcpiInitializeSubsystem); AcpiGbl_StartupFlags = ACPI_SUBSYSTEM_INITIALIZE; ACPI_DEBUG_EXEC (AcpiUtInitStackPtrTrace ()); /* Initialize the OS-Dependent layer */ Status = AcpiOsInitialize (); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "During OSL initialization")); return_ACPI_STATUS (Status); } /* Initialize all globals used by the subsystem */ Status = AcpiUtInitGlobals (); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "During initialization of globals")); return_ACPI_STATUS (Status); } /* Create the default mutex objects */ Status = AcpiUtMutexInitialize (); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "During Global Mutex creation")); return_ACPI_STATUS (Status); } /* * Initialize the namespace manager and * the root of the namespace tree */ Status = AcpiNsRootInitialize (); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "During Namespace initialization")); return_ACPI_STATUS (Status); } /* Initialize the global OSI interfaces list with the static names */ Status = AcpiUtInitializeInterfaces (); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "During OSI interfaces initialization")); return_ACPI_STATUS (Status); } /* If configured, initialize the AML debugger */ #ifdef ACPI_DEBUGGER Status = AcpiDbInitialize (); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "During Debugger initialization")); return_ACPI_STATUS (Status); } #endif return_ACPI_STATUS (AE_OK); }
int ACPI_SYSTEM_XFACE main ( int argc, char *argv[]) { int j; ACPI_CONVERSION_TABLE *ConversionTable = NULL; char *SourcePath; char *TargetPath; UINT32 FileType; ACPI_DEBUG_INITIALIZE (); /* For debug version only */ AcpiOsInitialize (); printf (ACPI_COMMON_SIGNON (AS_UTILITY_NAME)); if (argc < 2) { AsDisplayUsage (); return (0); } /* Command line options */ while ((j = AcpiGetopt (argc, argv, AS_SUPPORTED_OPTIONS)) != ACPI_OPT_END) switch(j) { case 'l': /* Linux code generation */ printf ("Creating Linux source code\n"); ConversionTable = &LinuxConversionTable; Gbl_WidenDeclarations = TRUE; Gbl_IgnoreLoneLineFeeds = TRUE; break; case 'c': /* Cleanup code */ printf ("Code cleanup\n"); ConversionTable = &CleanupConversionTable; Gbl_Cleanup = TRUE; break; case 'h': /* Inject Dual-license header */ printf ("Inserting Dual-license header to all modules\n"); ConversionTable = &LicenseConversionTable; break; case 'i': /* Cleanup wrong indent result */ printf ("Cleaning up macro indentation\n"); ConversionTable = &IndentConversionTable; Gbl_IgnoreLoneLineFeeds = TRUE; Gbl_IgnoreTranslationEscapes = TRUE; break; case 's': /* Statistics only */ break; case 'u': /* custom conversion */ printf ("Custom source translation\n"); ConversionTable = &CustomConversionTable; break; case 'v': switch (AcpiGbl_Optarg[0]) { case '^': /* -v: (Version): signon already emitted, just exit */ exit (0); case 'b': /* Verbose mode */ Gbl_VerboseMode = TRUE; break; case 'd': printf (ACPI_COMMON_BUILD_TIME); return (0); default: printf ("Unknown option: -v%s\n", AcpiGbl_Optarg); return (-1); } break; case 'y': /* Batch mode */ Gbl_BatchMode = TRUE; break; case 'd': /* Leave debug statements in */ Gbl_DebugStatementsMode = TRUE; break; case 'q': /* Quiet mode */ Gbl_QuietMode = TRUE; break; case 'a': Gbl_CheckAscii = TRUE; break; default: AsDisplayUsage (); return (-1); } SourcePath = argv[AcpiGbl_Optind]; if (!SourcePath) { printf ("Missing source path\n"); AsDisplayUsage (); return (-1); } /* This option checks the entire file for printable ascii chars */ if (Gbl_CheckAscii) { AsProcessOneFile (NULL, NULL, NULL, 0, SourcePath, FILE_TYPE_SOURCE); return (0); } TargetPath = argv[AcpiGbl_Optind+1]; if (!ConversionTable) { /* Just generate statistics. Ignore target path */ TargetPath = SourcePath; printf ("Source code statistics only\n"); ConversionTable = &StatsConversionTable; } else if (!TargetPath) { TargetPath = SourcePath; } if (Gbl_DebugStatementsMode) { ConversionTable->SourceFunctions &= ~CVT_REMOVE_DEBUG_MACROS; } /* Check source and target paths and files */ if (AsExaminePaths (ConversionTable, SourcePath, TargetPath, &FileType)) { return (-1); } /* Source/target can be either directories or a files */ if (FileType == S_IFDIR) { /* Process the directory tree */ AsProcessTree (ConversionTable, SourcePath, TargetPath); } else { if (Gbl_CheckAscii) { AsProcessOneFile (NULL, NULL, NULL, 0, SourcePath, FILE_TYPE_SOURCE); return (0); } /* Process a single file */ /* Differentiate between source and header files */ if (strstr (SourcePath, ".h")) { AsProcessOneFile (ConversionTable, NULL, TargetPath, 0, SourcePath, FILE_TYPE_HEADER); } else if (strstr (SourcePath, ".c")) { AsProcessOneFile (ConversionTable, NULL, TargetPath, 0, SourcePath, FILE_TYPE_SOURCE); } else if (strstr (SourcePath, ".patch")) { AsProcessOneFile (ConversionTable, NULL, TargetPath, 0, SourcePath, FILE_TYPE_PATCH); } else { printf ("Unknown file type - %s\n", SourcePath); } } /* Always display final summary and stats */ AsDisplayStats (); return (0); }
int ACPI_SYSTEM_XFACE main ( int argc, char *argv[]) { int j; int Status = AE_OK; ACPI_DEBUG_INITIALIZE (); /* For debug version only */ AcpiGbl_DebugFile = NULL; AcpiGbl_DbOutputFlags = DB_CONSOLE_OUTPUT; AcpiOsInitialize (); printf (ACPI_COMMON_SIGNON (AB_UTILITY_NAME)); if (argc < 2) { AbDisplayUsage (0); return (0); } /* Command line options */ while ((j = AcpiGetopt (argc, argv, AB_SUPPORTED_OPTIONS)) != ACPI_OPT_END) switch(j) { case 'c': /* Compare Files */ if (argc < 4) { AbDisplayUsage (2); return (-1); } Status = AbCompareAmlFiles (AcpiGbl_Optarg, argv[AcpiGbl_Optind]); break; case 'd': /* Dump AML file */ if (argc < 4) { AbDisplayUsage (2); return (-1); } Status = AbDumpAmlFile (AcpiGbl_Optarg, argv[AcpiGbl_Optind]); break; case 'h': /* Display ACPI table header */ if (argc < 3) { AbDisplayUsage (1); return (-1); } AbDisplayHeader (AcpiGbl_Optarg); return (0); case 's': /* Compute/update checksum */ if (argc < 3) { AbDisplayUsage (1); return (-1); } AbComputeChecksum (AcpiGbl_Optarg); return (0); case 't': /* Enable terse mode */ Gbl_TerseMode = TRUE; break; case 'v': /* -v: (Version): signon already emitted, just exit */ return (0); default: AbDisplayUsage (0); return (-1); } return (Status); }