From 1ce28e58d57b4ec39ce219f40913638882c50a56 Mon Sep 17 00:00:00 2001 From: Robert Moore Date: Fri, 30 Aug 2013 13:02:21 -0700 Subject: [PATCH] AcpiExec: Remove local wildcard support. This change affects windows version only; AcpiExec now is linked to the windows setargv.obj which implements wildcards. So, all code related to wildcards is now removed. --- generate/msvc9/AcpiExec.vcproj | 3 +- source/tools/acpiexec/aemain.c | 439 ++++++++------------------------- 2 files changed, 111 insertions(+), 331 deletions(-) diff --git a/generate/msvc9/AcpiExec.vcproj b/generate/msvc9/AcpiExec.vcproj index 3a49c666f..20130198c 100755 --- a/generate/msvc9/AcpiExec.vcproj +++ b/generate/msvc9/AcpiExec.vcproj @@ -82,7 +82,7 @@ Signature, ACPI_SIG_FADT) && - !AcpiUtIsAmlTable (Table)) - { - ACPI_WARNING ((AE_INFO, - "Table %4.4s is not an AML table, ignoring", - Table->Signature)); - AcpiOsFree (Table); - continue; - } - - /* Allocate and link a table descriptor */ - - TableDesc = AcpiOsAllocate (sizeof (AE_TABLE_DESC)); - TableDesc->Table = Table; - TableDesc->Next = AeTableListHead; - AeTableListHead = TableDesc; - - TableCount++; - } - - AcpiGbl_Optind++; - } - - /* Build a local RSDT with all tables and let ACPICA process the RSDT */ - - Status = AeBuildLocalTables (TableCount, AeTableListHead); + Status = AcpiDbReadTableFromFile (argv[AcpiGbl_Optind], &Table); if (ACPI_FAILURE (Status)) { + printf ("**** Could not get table from file %s, %s\n", + argv[AcpiGbl_Optind], AcpiFormatException (Status)); return (-1); } - Status = AeInstallTables (); - if (ACPI_FAILURE (Status)) + /* Ignore non-AML tables, we can't use them. Except for an FADT */ + + if (!ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FADT) && + !AcpiUtIsAmlTable (Table)) { - printf ("**** Could not load ACPI tables, %s\n", - AcpiFormatException (Status)); - goto EnterDebugger; + ACPI_INFO ((AE_INFO, + "Table [%4.4s] is not an AML table, ignoring", + Table->Signature)); + AcpiOsFree (Table); + } + else + { + /* Allocate and link a table descriptor */ + + TableDesc = AcpiOsAllocate (sizeof (AE_TABLE_DESC)); + TableDesc->Table = Table; + TableDesc->Next = AeTableListHead; + AeTableListHead = TableDesc; + + TableCount++; } - /* - * Install most of the handlers. - * Override some default region handlers, especially SystemMemory - */ - Status = AeInstallEarlyHandlers (); - if (ACPI_FAILURE (Status)) - { - goto EnterDebugger; - } - - /* Setup initialization flags for ACPICA */ - - InitFlags = (ACPI_NO_HANDLER_INIT | ACPI_NO_ACPI_ENABLE); - if (!AcpiGbl_DbOpt_ini_methods) - { - InitFlags |= (ACPI_NO_DEVICE_INIT | ACPI_NO_OBJECT_INIT); - } - - /* - * Main initialization for ACPICA subsystem - * TBD: Need a way to call this after the ACPI table "LOAD" command - */ - Status = AcpiEnableSubsystem (InitFlags); - if (ACPI_FAILURE (Status)) - { - printf ("**** Could not EnableSubsystem, %s\n", - AcpiFormatException (Status)); - goto EnterDebugger; - } - - /* - * Install handlers for "device driver" space IDs (EC,SMBus, etc.) - * and fixed event handlers - */ - AeInstallLateHandlers (); - - /* Finish the ACPICA initialization */ - - Status = AcpiInitializeObjects (InitFlags); - if (ACPI_FAILURE (Status)) - { - printf ("**** Could not InitializeObjects, %s\n", - AcpiFormatException (Status)); - goto EnterDebugger; - } - - AeMiscellaneousTests (); + AcpiGbl_Optind++; } + /* Build a local RSDT with all tables and let ACPICA process the RSDT */ + + Status = AeBuildLocalTables (TableCount, AeTableListHead); + if (ACPI_FAILURE (Status)) + { + return (-1); + } + + Status = AeInstallTables (); + if (ACPI_FAILURE (Status)) + { + printf ("**** Could not load ACPI tables, %s\n", + AcpiFormatException (Status)); + goto EnterDebugger; + } + + /* + * Install most of the handlers. + * Override some default region handlers, especially SystemMemory + */ + Status = AeInstallEarlyHandlers (); + if (ACPI_FAILURE (Status)) + { + goto EnterDebugger; + } + + /* Setup initialization flags for ACPICA */ + + InitFlags = (ACPI_NO_HANDLER_INIT | ACPI_NO_ACPI_ENABLE); + if (!AcpiGbl_DbOpt_ini_methods) + { + InitFlags |= (ACPI_NO_DEVICE_INIT | ACPI_NO_OBJECT_INIT); + } + + /* + * Main initialization for ACPICA subsystem + * TBD: Need a way to call this after the ACPI table "LOAD" command + */ + Status = AcpiEnableSubsystem (InitFlags); + if (ACPI_FAILURE (Status)) + { + printf ("**** Could not EnableSubsystem, %s\n", + AcpiFormatException (Status)); + goto EnterDebugger; + } + + /* + * Install handlers for "device driver" space IDs (EC,SMBus, etc.) + * and fixed event handlers + */ + AeInstallLateHandlers (); + + /* Finish the ACPICA initialization */ + + Status = AcpiInitializeObjects (InitFlags); + if (ACPI_FAILURE (Status)) + { + printf ("**** Could not InitializeObjects, %s\n", + AcpiFormatException (Status)); + goto EnterDebugger; + } + + AeMiscellaneousTests (); + + EnterDebugger: /* Exit if error above and we are in one of the batch modes */ @@ -705,193 +674,3 @@ AcpiDbRunBatchMode ( Status = AcpiTerminate (); return (Status); } - - -/****************************************************************************** - * - * FUNCTION: FlStrdup - * - * DESCRIPTION: Local strdup function - * - *****************************************************************************/ - -static char * -FlStrdup ( - char *String) -{ - char *NewString; - - - NewString = AcpiOsAllocate (strlen (String) + 1); - if (!NewString) - { - return (NULL); - } - - strcpy (NewString, String); - return (NewString); -} - - -/****************************************************************************** - * - * FUNCTION: FlSplitInputPathname - * - * PARAMETERS: InputFilename - The user-specified ASL source file to be - * compiled - * OutDirectoryPath - Where the directory path prefix is - * returned - * OutFilename - Where the filename part is returned - * - * RETURN: Status - * - * DESCRIPTION: Split the input path into a directory and filename part - * 1) Directory part used to open include files - * 2) Filename part used to generate output filenames - * - *****************************************************************************/ - -ACPI_STATUS -FlSplitInputPathname ( - char *InputPath, - char **OutDirectoryPath, - char **OutFilename) -{ - char *Substring; - char *DirectoryPath; - char *Filename; - - - *OutDirectoryPath = NULL; - *OutFilename = NULL; - - if (!InputPath) - { - return (AE_OK); - } - - /* Get the path to the input filename's directory */ - - DirectoryPath = FlStrdup (InputPath); - if (!DirectoryPath) - { - return (AE_NO_MEMORY); - } - - /* Convert backslashes to slashes in the entire path */ - - UtConvertBackslashes (DirectoryPath); - - /* Backup to last slash or colon */ - - Substring = strrchr (DirectoryPath, '/'); - if (!Substring) - { - Substring = strrchr (DirectoryPath, ':'); - } - - /* Extract the simple filename */ - - if (!Substring) - { - DirectoryPath[0] = 0; - Filename = FlStrdup (InputPath); - } - else - { - Filename = FlStrdup (Substring + 1); - *(Substring + 1) = 0; - } - - if (!Filename) - { - return (AE_NO_MEMORY); - } - - *OutDirectoryPath = DirectoryPath; - *OutFilename = Filename; - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: AsDoWildcard - * - * PARAMETERS: DirectoryPathname - Path to parent directory - * FileSpecifier - the wildcard specification (*.c, etc.) - * - * RETURN: Pointer to a list of filenames - * - * DESCRIPTION: Process files via wildcards. This function is for the Windows - * case only. - * - *****************************************************************************/ - -static char ** -AsDoWildcard ( - char *DirectoryPathname, - char *FileSpecifier) -{ -#ifdef WIN32 - void *DirInfo; - char *Filename; - int FileCount; - - - FileCount = 0; - - /* Open parent directory */ - - DirInfo = AcpiOsOpenDirectory (DirectoryPathname, FileSpecifier, - REQUEST_FILE_ONLY); - if (!DirInfo) - { - /* Either the directory or file does not exist */ - - printf ("File or directory \"%s%s\" does not exist\n", - DirectoryPathname, FileSpecifier); - return (NULL); - } - - /* Process each file that matches the wildcard specification */ - - while ((Filename = AcpiOsGetNextFilename (DirInfo))) - { - /* Add the filename to the file list */ - - FileList[FileCount] = AcpiOsAllocate (strlen (Filename) + 1); - strcpy (FileList[FileCount], Filename); - FileCount++; - - if (FileCount >= ASL_MAX_FILES) - { - printf ("Max files reached\n"); - FileList[0] = NULL; - return (FileList); - } - } - - /* Cleanup */ - - AcpiOsCloseDirectory (DirInfo); - FileList[FileCount] = NULL; - return (FileList); - -#else - if (!FileSpecifier) - { - return (NULL); - } - - /* - * Linux/Unix cases - Wildcards are expanded by the shell automatically. - * Just return the filename in a null terminated list - */ - FileList[0] = AcpiOsAllocate (strlen (FileSpecifier) + 1); - strcpy (FileList[0], FileSpecifier); - FileList[1] = NULL; - - return (FileList); -#endif -}