diff options
author | Jung-uk Kim <jkim@FreeBSD.org> | 2013-10-17 00:06:42 +0000 |
---|---|---|
committer | Jung-uk Kim <jkim@FreeBSD.org> | 2013-10-17 00:06:42 +0000 |
commit | a6028f7332dbf61541a4482e402bf346dad53118 (patch) | |
tree | 3908357b831dbb78c746f73c443b4d7ba5e966f9 /source/compiler | |
parent | 59ce063597ddbda74269a45aba8187dece2fe00a (diff) |
Notes
Diffstat (limited to 'source/compiler')
-rw-r--r-- | source/compiler/aslcompiler.h | 5 | ||||
-rw-r--r-- | source/compiler/aslerror.c | 4 | ||||
-rw-r--r-- | source/compiler/aslmain.c | 32 | ||||
-rw-r--r-- | source/compiler/asloptions.c | 18 | ||||
-rw-r--r-- | source/compiler/aslstartup.c | 173 |
5 files changed, 57 insertions, 175 deletions
diff --git a/source/compiler/aslcompiler.h b/source/compiler/aslcompiler.h index 1ffbf924ea76..b8648a628fa5 100644 --- a/source/compiler/aslcompiler.h +++ b/source/compiler/aslcompiler.h @@ -123,11 +123,6 @@ ACPI_STATUS (*ASL_PATHNAME_CALLBACK) ( char *); ACPI_STATUS -AslDoOnePathname ( - char *Pathname, - ASL_PATHNAME_CALLBACK Callback); - -ACPI_STATUS AslDoOneFile ( char *Filename); diff --git a/source/compiler/aslerror.c b/source/compiler/aslerror.c index 06160401303c..d0e8e03bc060 100644 --- a/source/compiler/aslerror.c +++ b/source/compiler/aslerror.c @@ -611,7 +611,6 @@ AslCommonError ( char *Filename, char *ExtraMessage) { - UINT32 MessageSize; char *MessageBuffer = NULL; ASL_ERROR_MSG *Enode; @@ -622,8 +621,7 @@ AslCommonError ( { /* Allocate a buffer for the message and a new error node */ - MessageSize = strlen (ExtraMessage) + 1; - MessageBuffer = UtLocalCalloc (MessageSize); + MessageBuffer = UtLocalCalloc (strlen (ExtraMessage) + 1); /* Keep a copy of the extra message */ diff --git a/source/compiler/aslmain.c b/source/compiler/aslmain.c index 2e62c8705a84..81e102f303e2 100644 --- a/source/compiler/aslmain.c +++ b/source/compiler/aslmain.c @@ -51,6 +51,17 @@ #define _COMPONENT ACPI_COMPILER ACPI_MODULE_NAME ("aslmain") +/* + * Main routine for the iASL compiler. + * + * Portability note: The compiler depends upon the host for command-line + * wildcard support - it is not implemented locally. For example: + * + * Linux/Unix systems: Shell expands wildcards automatically. + * + * Windows: The setargv.obj module must be linked in to automatically + * expand wildcards. + */ /* Local prototypes */ @@ -131,13 +142,13 @@ Usage ( ACPI_OPTION ("-vt", "Create verbose template files (full disassembly)"); printf ("\nAML Disassembler:\n"); - ACPI_OPTION ("-d <f1,f2>", "Disassemble or decode binary ACPI tables to file (*.dsl)"); + ACPI_OPTION ("-d <f1 f2 ...>", "Disassemble or decode binary ACPI tables to file (*.dsl)"); ACPI_OPTION ("", " (Optional, file type is automatically detected)"); - ACPI_OPTION ("-da <f1,f2>", "Disassemble multiple tables from single namespace"); + ACPI_OPTION ("-da <f1 f2 ...>", "Disassemble multiple tables from single namespace"); ACPI_OPTION ("-db", "Do not translate Buffers to Resource Templates"); - ACPI_OPTION ("-dc <f1,f2>", "Disassemble AML and immediately compile it"); + ACPI_OPTION ("-dc <f1 f2 ...>", "Disassemble AML and immediately compile it"); ACPI_OPTION ("", " (Obtain DSDT from current system if no input file)"); - ACPI_OPTION ("-e <f1,f2>", "Include ACPI table(s) for external symbol resolution"); + ACPI_OPTION ("-e <f1 f2 ...>", "Include ACPI table(s) for external symbol resolution"); ACPI_OPTION ("-fe <file>", "Specify external symbol declaration file"); ACPI_OPTION ("-g", "Get ACPI tables and write to files (*.dat)"); ACPI_OPTION ("-in", "Ignore NoOp opcodes"); @@ -321,7 +332,7 @@ main ( { while (argv[Index1]) { - Status = AslDoOnePathname (argv[Index1], AcpiDmAddToExternalFileList); + Status = AcpiDmAddToExternalFileList (argv[Index1]); if (ACPI_FAILURE (Status)) { return (-1); @@ -335,7 +346,16 @@ main ( while (argv[Index2]) { - Status = AslDoOnePathname (argv[Index2], AslDoOneFile); + /* + * If -p not specified, we will use the input filename as the + * output filename prefix + */ + if (Gbl_UseDefaultAmlFilename) + { + Gbl_OutputFilenamePrefix = argv[Index2]; + } + + Status = AslDoOneFile (argv[Index2]); if (ACPI_FAILURE (Status)) { return (-1); diff --git a/source/compiler/asloptions.c b/source/compiler/asloptions.c index 5fbd43eeb613..00e30004e921 100644 --- a/source/compiler/asloptions.c +++ b/source/compiler/asloptions.c @@ -267,11 +267,21 @@ AslDoOptions ( case 'e': /* External files for disassembler */ - Status = AcpiDmAddToExternalFileList (AcpiGbl_Optarg); - if (ACPI_FAILURE (Status)) + /* Get entire list of external files */ + + AcpiGbl_Optind--; + + while (argv[AcpiGbl_Optind] && + (argv[AcpiGbl_Optind][0] != '-')) { - printf ("Could not add %s to external list\n", AcpiGbl_Optarg); - return (-1); + Status = AcpiDmAddToExternalFileList (argv[AcpiGbl_Optind]); + if (ACPI_FAILURE (Status)) + { + printf ("Could not add %s to external list\n", argv[AcpiGbl_Optind]); + return (-1); + } + + AcpiGbl_Optind++; } break; diff --git a/source/compiler/aslstartup.c b/source/compiler/aslstartup.c index 0168fd020b47..b57b3b0b95f4 100644 --- a/source/compiler/aslstartup.c +++ b/source/compiler/aslstartup.c @@ -51,18 +51,8 @@ ACPI_MODULE_NAME ("aslstartup") -#define ASL_MAX_FILES 256 -static char *FileList[ASL_MAX_FILES]; -static BOOLEAN AslToFile = TRUE; - - /* Local prototypes */ -static char ** -AsDoWildcard ( - char *DirectoryPathname, - char *FileSpecifier); - static UINT8 AslDetectSourceFileType ( ASL_FILE_INFO *Info); @@ -72,6 +62,11 @@ AslDoDisassembly ( void); +/* Globals */ + +static BOOLEAN AslToFile = TRUE; + + /******************************************************************************* * * FUNCTION: AslInitializeGlobals @@ -131,82 +126,6 @@ AslInitializeGlobals ( } -/****************************************************************************** - * - * FUNCTION: AsDoWildcard - * - * PARAMETERS: None - * - * RETURN: None - * - * 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 of file does not exist */ - - Gbl_Files[ASL_FILE_INPUT].Filename = FileSpecifier; - FlFileError (ASL_FILE_INPUT, ASL_MSG_OPEN); - AslAbort (); - } - - /* 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 - /* - * 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 -} - - /******************************************************************************* * * FUNCTION: AslDetectSourceFileType @@ -395,6 +314,17 @@ AslDoOneFile ( AslInitializeGlobals (); PrInitializeGlobals (); + /* + * Extract the directory path. This path is used for possible include + * files and the optional AML filename embedded in the input file + * DefinitionBlock declaration. + */ + Status = FlSplitInputPathname (Filename, &Gbl_DirectoryPath, NULL); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + Gbl_Files[ASL_FILE_INPUT].Filename = Filename; /* @@ -543,77 +473,6 @@ AslDoOneFile ( /******************************************************************************* * - * FUNCTION: AslDoOnePathname - * - * PARAMETERS: Pathname - Full pathname, possibly with wildcards - * - * RETURN: Status - * - * DESCRIPTION: Process one pathname, possible terminated with a wildcard - * specification. If a wildcard, it is expanded and the multiple - * files are processed. - * - ******************************************************************************/ - -ACPI_STATUS -AslDoOnePathname ( - char *Pathname, - ASL_PATHNAME_CALLBACK PathCallback) -{ - ACPI_STATUS Status = AE_OK; - char **WildcardList; - char *Filename; - char *FullPathname; - - - /* Split incoming path into a directory/filename combo */ - - Status = FlSplitInputPathname (Pathname, &Gbl_DirectoryPath, &Filename); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Expand possible wildcard into a file list (Windows/DOS only) */ - - WildcardList = AsDoWildcard (Gbl_DirectoryPath, Filename); - while (*WildcardList) - { - FullPathname = ACPI_ALLOCATE ( - strlen (Gbl_DirectoryPath) + strlen (*WildcardList) + 1); - - /* Construct a full path to the file */ - - strcpy (FullPathname, Gbl_DirectoryPath); - strcat (FullPathname, *WildcardList); - - /* - * If -p not specified, we will use the input filename as the - * output filename prefix - */ - if (Gbl_UseDefaultAmlFilename) - { - Gbl_OutputFilenamePrefix = FullPathname; - } - - /* Save status from all compiles */ - - Status |= (*PathCallback) (FullPathname); - - ACPI_FREE (FullPathname); - ACPI_FREE (*WildcardList); - *WildcardList = NULL; - WildcardList++; - } - - ACPI_FREE (Gbl_DirectoryPath); - ACPI_FREE (Filename); - return (Status); -} - - -/******************************************************************************* - * * FUNCTION: AslCheckForErrorExit * * PARAMETERS: None. Examines global exception count array |