diff options
author | Jung-uk Kim <jkim@FreeBSD.org> | 2009-09-04 01:21:44 +0000 |
---|---|---|
committer | Jung-uk Kim <jkim@FreeBSD.org> | 2009-09-04 01:21:44 +0000 |
commit | 7c48a2bb90aa31d333d6d4d78e28b7ee84234c15 (patch) | |
tree | a50eb3660e8fd2323b6c0170a60f1a403e04093c | |
parent | fe835a9c3e3364ae37583445610864e01ceb3fde (diff) |
Import ACPICA 20090903vendor/acpica/20090903
Notes
Notes:
svn path=/vendor-sys/acpica/dist/; revision=196804
svn path=/vendor-sys/acpica/20090903/; revision=196805; tag=vendor/acpica/20090903
-rw-r--r-- | changes.txt | 73 | ||||
-rw-r--r-- | common/dmtbdump.c | 34 | ||||
-rw-r--r-- | common/dmtbinfo.c | 20 | ||||
-rw-r--r-- | compiler/aslcompiler.h | 4 | ||||
-rw-r--r-- | compiler/aslfiles.c | 222 | ||||
-rw-r--r-- | compiler/aslglobal.h | 3 | ||||
-rw-r--r-- | compiler/aslload.c | 1 | ||||
-rw-r--r-- | compiler/aslmain.c | 244 | ||||
-rw-r--r-- | compiler/asltypes.h | 8 | ||||
-rw-r--r-- | dispatcher/dsmthdat.c | 7 | ||||
-rw-r--r-- | dispatcher/dsobject.c | 23 | ||||
-rw-r--r-- | executer/exstorob.c | 14 | ||||
-rw-r--r-- | include/acdisasm.h | 1 | ||||
-rw-r--r-- | include/aclocal.h | 3 | ||||
-rw-r--r-- | include/acpixf.h | 2 | ||||
-rw-r--r-- | namespace/nsinit.c | 16 | ||||
-rw-r--r-- | namespace/nspredef.c | 8 | ||||
-rw-r--r-- | parser/psloop.c | 7 | ||||
-rw-r--r-- | tools/acpiexec/aecommon.h | 11 | ||||
-rw-r--r-- | tools/acpiexec/aeexec.c | 1 | ||||
-rw-r--r-- | tools/acpiexec/aehandlers.c | 1 | ||||
-rw-r--r-- | tools/acpiexec/aemain.c | 280 | ||||
-rw-r--r-- | tools/acpiexec/aetables.c | 236 | ||||
-rw-r--r-- | utilities/uteval.c | 3 |
24 files changed, 1025 insertions, 197 deletions
diff --git a/changes.txt b/changes.txt index d3110e49154f..177ae98ee26a 100644 --- a/changes.txt +++ b/changes.txt @@ -1,4 +1,77 @@ ---------------------------------------- +03 September 2009. Summary of changes for version 20090903: + +This release is available at www.acpica.org/downloads + +1) ACPI CA Core Subsystem: + +For Windows Vista compatibility, added the automatic execution of an _INI +method located at the namespace root (\_INI). This method is executed at +table load time. This support is in addition to the automatic execution of +\_SB._INI. Lin Ming. + +Fixed a possible memory leak in the interpreter for AML package objects if +the package initializer list is longer than the defined size of the package. +This apparently can only happen if the BIOS changes the package size on the +fly (seen in a _PSS object), as ASL compilers do not allow this. The +interpreter will truncate the package to the defined size (and issue an error +message), but previously could leave the extra objects undeleted if they were +pre-created during the argument processing (such is the case if the package +consists of a number of sub-packages as in the _PSS.) ACPICA BZ 805. + +Fixed a problem seen when a Buffer or String is stored to itself via ASL. +This has been reported in the field. Previously, ACPICA would zero out the +buffer/string. Now, the operation is treated as a noop. Provides Windows +compatibility. ACPICA BZ 803. Lin Ming. + +Removed an extraneous error message for ASL constructs of the form +Store(LocalX,LocalX) when LocalX is uninitialized. These curious statements +are seen in many BIOSs and are once again treated as NOOPs and no error is +emitted when they are encountered. ACPICA BZ 785. + +Fixed an extraneous warning message if a _DSM reserved method returns a +Package object. _DSM can return any type of object, so validation on the +return type cannot be performed. ACPICA BZ 802. + +Example Code and Data Size: These are the sizes for the OS-independent +acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. The +debug version of the code includes the debug output trace mechanism and has a +much larger code and data size. + + Previous Release: + Non-Debug Version: 85.5K Code, 18.0K Data, 103.5K Total + Debug Version: 161.6K Code, 50.9K Data, 212.5K Total + Current Release: + Non-Debug Version: 85.6K Code, 18.0K Data, 103.6K Total + Debug Version: 161.7K Code, 50.9K Data, 212.6K Total + +2) iASL Compiler/Disassembler and Tools: + +iASL: Fixed a problem with the use of the Alias operator and Resource +Templates. The correct alias is now constructed and no error is emitted. +ACPICA BZ 738. + +iASL: Implemented the -I option to specify additional search directories for +include files. Allows multiple additional search paths for include files. +Directories are searched in the order specified on the command line (after +the local directory is searched.) ACPICA BZ 800. + +iASL: Fixed a problem where the full pathname for include files was not +emitted for warnings/errors. This caused the IDE support to not work +properly. ACPICA BZ 765. + +iASL: Implemented the -@ option to specify a Windows-style response file +containing additional command line options. ACPICA BZ 801. + +AcpiExec: Added support to load multiple AML files simultaneously (such as a +DSDT and multiple SSDTs). Also added support for wildcards within the AML +pathname. These features allow all machine tables to be easily loaded and +debugged together. ACPICA BZ 804. + +Disassembler: Added missing support for disassembly of HEST table Error Bank +subtables. + +---------------------------------------- 30 July 2009. Summary of changes for version 20090730: This release is available at www.acpica.org/downloads diff --git a/common/dmtbdump.c b/common/dmtbdump.c index e21e39810eeb..e2dd8090fa16 100644 --- a/common/dmtbdump.c +++ b/common/dmtbdump.c @@ -747,6 +747,8 @@ AcpiDmDumpHest ( UINT32 Offset = sizeof (ACPI_TABLE_HEST); ACPI_DMTABLE_INFO *InfoTable; UINT32 SubTableLength; + UINT32 BankCount; + ACPI_HEST_IA_ERROR_BANK *BankTable; /* Main table */ @@ -762,16 +764,21 @@ AcpiDmDumpHest ( SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Table, Offset); while (Offset < Table->Length) { + BankCount = 0; switch (SubTable->Type) { case ACPI_HEST_TYPE_IA32_CHECK: InfoTable = AcpiDmTableInfoHest0; SubTableLength = sizeof (ACPI_HEST_IA_MACHINE_CHECK); + BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_MACHINE_CHECK, + SubTable))->NumHardwareBanks; break; case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK: InfoTable = AcpiDmTableInfoHest1; SubTableLength = sizeof (ACPI_HEST_IA_CORRECTED); + BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_CORRECTED, + SubTable))->NumHardwareBanks; break; case ACPI_HEST_TYPE_IA32_NMI: @@ -814,9 +821,34 @@ AcpiDmDumpHest ( return; } - /* Point to next sub-table (each subtable is of fixed length) */ + /* Point to end of current subtable (each subtable above is of fixed length) */ Offset += SubTableLength; + + /* If there are any (fixed-length) Error Banks from above, dump them now */ + + if (BankCount) + { + BankTable = ACPI_ADD_PTR (ACPI_HEST_IA_ERROR_BANK, SubTable, SubTableLength); + SubTableLength += BankCount * sizeof (ACPI_HEST_IA_ERROR_BANK); + + while (BankCount) + { + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Length, Offset, BankTable, + sizeof (ACPI_HEST_IA_ERROR_BANK), AcpiDmTableInfoHestBank); + if (ACPI_FAILURE (Status)) + { + return; + } + Offset += sizeof (ACPI_HEST_IA_ERROR_BANK); + BankTable++; + BankCount--; + } + } + + /* Point to next sub-table */ + SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, SubTable, SubTableLength); } } diff --git a/common/dmtbinfo.c b/common/dmtbinfo.c index 7126107dea17..832914905d9f 100644 --- a/common/dmtbinfo.c +++ b/common/dmtbinfo.c @@ -178,6 +178,7 @@ #define ACPI_HEST8_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_AER_BRIDGE,f) #define ACPI_HEST9_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_GENERIC,f) #define ACPI_HESTN_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_NOTIFY,f) +#define ACPI_HESTB_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_IA_ERROR_BANK,f) #define ACPI_IVRSH_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_IVRS_HEADER,f) #define ACPI_IVRS0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_IVRS_HARDWARE,f) #define ACPI_IVRS1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_IVRS_MEMORY,f) @@ -905,6 +906,25 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoHestNotify[] = }; +/* + * IA32 Error Bank(s) - Follows the ACPI_HEST_IA_MACHINE_CHECK and + * ACPI_HEST_IA_CORRECTED structures. + */ +ACPI_DMTABLE_INFO AcpiDmTableInfoHestBank[] = +{ + {ACPI_DMT_UINT8, ACPI_HESTB_OFFSET (BankNumber), "Bank Number"}, + {ACPI_DMT_UINT8, ACPI_HESTB_OFFSET (ClearStatusOnInit), "Clear Status On Init"}, + {ACPI_DMT_UINT8, ACPI_HESTB_OFFSET (StatusFormat), "Status Format"}, + {ACPI_DMT_UINT8, ACPI_HESTB_OFFSET (Reserved), "Reserved"}, + {ACPI_DMT_UINT32, ACPI_HESTB_OFFSET (ControlRegister), "Control Register"}, + {ACPI_DMT_UINT64, ACPI_HESTB_OFFSET (ControlData), "Control Data"}, + {ACPI_DMT_UINT32, ACPI_HESTB_OFFSET (StatusRegister), "Status Register"}, + {ACPI_DMT_UINT32, ACPI_HESTB_OFFSET (AddressRegister), "Address Register"}, + {ACPI_DMT_UINT32, ACPI_HESTB_OFFSET (MiscRegister), "Misc Register"}, + {ACPI_DMT_EXIT, 0, NULL} +}; + + /******************************************************************************* * * HPET - High Precision Event Timer table diff --git a/compiler/aslcompiler.h b/compiler/aslcompiler.h index 54162a7c5e7d..2678c596a25f 100644 --- a/compiler/aslcompiler.h +++ b/compiler/aslcompiler.h @@ -556,6 +556,10 @@ AslAbort ( void); void +FlAddIncludeDirectory ( + char *Dir); + +void FlOpenIncludeFile ( ACPI_PARSE_OBJECT *Op); diff --git a/compiler/aslfiles.c b/compiler/aslfiles.c index cb38e900b0c9..3d24ab397088 100644 --- a/compiler/aslfiles.c +++ b/compiler/aslfiles.c @@ -128,10 +128,11 @@ FlOpenFile ( char *Filename, char *Mode); -static FILE * -FlOpenLocalFile ( - char *LocalName, - char *Mode); +FILE * +FlOpenIncludeWithPrefix ( + char *PrefixDir, + char *Filename); + #ifdef ACPI_OBSOLETE_FUNCTIONS ACPI_STATUS @@ -172,45 +173,6 @@ AslAbort ( /******************************************************************************* * - * FUNCTION: FlOpenLocalFile - * - * PARAMETERS: LocalName - Single filename (not a pathname) - * Mode - Open mode for fopen - * - * RETURN: File descriptor - * - * DESCRIPTION: Build a complete pathname for the input filename and open - * the file. - * - ******************************************************************************/ - -static FILE * -FlOpenLocalFile ( - char *LocalName, - char *Mode) -{ - - StringBuffer[0] = 0; - - /* Check for an absolute pathname */ - - if ((LocalName[0] != '/') && /* Forward slash */ - (LocalName[0] != '\\') && /* backslash (Win) */ - (LocalName[1] != ':')) /* Device name (Win) */ - { - /* The include file path is relative, prepend the directory path */ - - strcat (StringBuffer, Gbl_DirectoryPath); - } - strcat (StringBuffer, LocalName); - - DbgPrint (ASL_PARSE_OUTPUT, "FlOpenLocalFile: %s\n", StringBuffer); - return (fopen (StringBuffer, (const char *) Mode)); -} - - -/******************************************************************************* - * * FUNCTION: FlFileError * * PARAMETERS: FileId - Index into file info array @@ -481,6 +443,122 @@ FlSetLineNumber ( /******************************************************************************* * + * FUNCTION: FlAddIncludeDirectory + * + * PARAMETERS: Dir - Directory pathname string + * + * RETURN: None + * + * DESCRIPTION: Add a directory the list of include prefix directories. + * + ******************************************************************************/ + +void +FlAddIncludeDirectory ( + char *Dir) +{ + ASL_INCLUDE_DIR *NewDir; + ASL_INCLUDE_DIR *NextDir; + ASL_INCLUDE_DIR *PrevDir = NULL; + UINT32 NeedsSeparator = 0; + size_t DirLength; + + + DirLength = strlen (Dir); + if (!DirLength) + { + return; + } + + /* Make sure that the pathname ends with a path separator */ + + if ((Dir[DirLength-1] != '/') && + (Dir[DirLength-1] != '\\')) + { + NeedsSeparator = 1; + } + + NewDir = ACPI_ALLOCATE_ZEROED (sizeof (ASL_INCLUDE_DIR)); + NewDir->Dir = ACPI_ALLOCATE (DirLength + 1 + NeedsSeparator); + strcpy (NewDir->Dir, Dir); + if (NeedsSeparator) + { + strcat (NewDir->Dir, "/"); + } + + /* + * Preserve command line ordering of -I options by adding new elements + * at the end of the list + */ + NextDir = Gbl_IncludeDirList; + while (NextDir) + { + PrevDir = NextDir; + NextDir = NextDir->Next; + } + + if (PrevDir) + { + PrevDir->Next = NewDir; + } + else + { + Gbl_IncludeDirList = NewDir; + } +} + + +/******************************************************************************* + * + * FUNCTION: FlOpenIncludeWithPrefix + * + * PARAMETERS: PrefixDir - Prefix directory pathname. Can be a zero + * length string. + * Filename - The include filename from the source ASL. + * + * RETURN: Valid file descriptor if successful. Null otherwise. + * + * DESCRIPTION: Open an include file and push it on the input file stack. + * + ******************************************************************************/ + +FILE * +FlOpenIncludeWithPrefix ( + char *PrefixDir, + char *Filename) +{ + FILE *IncludeFile; + char *Pathname; + + + /* Build the full pathname to the file */ + + Pathname = ACPI_ALLOCATE (strlen (PrefixDir) + strlen (Filename) + 1); + + strcpy (Pathname, PrefixDir); + strcat (Pathname, Filename); + + DbgPrint (ASL_PARSE_OUTPUT, "\nAttempt to open include file: path %s\n\n", + Pathname); + + /* Attempt to open the file, push if successful */ + + IncludeFile = fopen (Pathname, "r"); + if (IncludeFile) + { + /* Push the include file on the open input file stack */ + + AslPushInputFileStack (IncludeFile, Pathname); + return (IncludeFile); + } + + ACPI_FREE (Pathname); + return (NULL); +} + + +/******************************************************************************* + * * FUNCTION: FlOpenIncludeFile * * PARAMETERS: Op - Parse node for the INCLUDE ASL statement @@ -495,7 +573,8 @@ void FlOpenIncludeFile ( ACPI_PARSE_OBJECT *Op) { - FILE *IncFile; + FILE *IncludeFile; + ASL_INCLUDE_DIR *NextDir; /* Op must be valid */ @@ -518,21 +597,58 @@ FlOpenIncludeFile ( FlPrintFile (ASL_FILE_SOURCE_OUTPUT, "\n"); Gbl_CurrentLineOffset++; - /* Prepend the directory pathname and open the include file */ - DbgPrint (ASL_PARSE_OUTPUT, "\nOpen include file: path %s\n\n", - Op->Asl.Value.String); - IncFile = FlOpenLocalFile (Op->Asl.Value.String, "r"); - if (!IncFile) + /* Attempt to open the include file */ + + /* If the file specifies an absolute path, just open it */ + + if ((Op->Asl.Value.String[0] == '/') || + (Op->Asl.Value.String[0] == '\\') || + (Op->Asl.Value.String[1] == ':')) { - sprintf (MsgBuffer, "%s (%s)", Op->Asl.Value.String, strerror (errno)); - AslError (ASL_ERROR, ASL_MSG_INCLUDE_FILE_OPEN, Op, MsgBuffer); + IncludeFile = FlOpenIncludeWithPrefix ("", Op->Asl.Value.String); + if (!IncludeFile) + { + goto ErrorExit; + } return; } - /* Push the include file on the open input file stack */ + /* + * The include filename is not an absolute path. + * + * First, search for the file within the "local" directory -- meaning + * the same directory that contains the source file. + * + * Construct the file pathname from the global directory name. + */ + IncludeFile = FlOpenIncludeWithPrefix (Gbl_DirectoryPath, Op->Asl.Value.String); + if (IncludeFile) + { + return; + } + + /* + * Second, search for the file within the (possibly multiple) directories + * specified by the -I option on the command line. + */ + NextDir = Gbl_IncludeDirList; + while (NextDir) + { + IncludeFile = FlOpenIncludeWithPrefix (NextDir->Dir, Op->Asl.Value.String); + if (IncludeFile) + { + return; + } + + NextDir = NextDir->Next; + } + + /* We could not open the include file after trying very hard */ - AslPushInputFileStack (IncFile, Op->Asl.Value.String); +ErrorExit: + sprintf (MsgBuffer, "%s, %s", Op->Asl.Value.String, strerror (errno)); + AslError (ASL_ERROR, ASL_MSG_INCLUDE_FILE_OPEN, Op, MsgBuffer); } diff --git a/compiler/aslglobal.h b/compiler/aslglobal.h index 4cb91216fbb8..6aecfb6fb4f5 100644 --- a/compiler/aslglobal.h +++ b/compiler/aslglobal.h @@ -148,7 +148,7 @@ extern char HexLookup[]; #define ASL_LINE_BUFFER_SIZE 512 #define ASL_MSG_BUFFER_SIZE 4096 #define HEX_TABLE_LINE_SIZE 8 -#define HEX_LISTING_LINE_SIZE 16 +#define HEX_LISTING_LINE_SIZE 8 /* Source code buffers and pointers for error reporting */ @@ -212,6 +212,7 @@ ASL_EXTERN char *Gbl_DirectoryPath; ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_ExternalFilename, NULL); ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_IncludeFilename, NULL); ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_OutputFilenamePrefix, NULL); +ASL_EXTERN ASL_INCLUDE_DIR ASL_INIT_GLOBAL (*Gbl_IncludeDirList, NULL); ASL_EXTERN char *Gbl_CurrentInputFilename; ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_HasIncludeFiles, FALSE); diff --git a/compiler/aslload.c b/compiler/aslload.c index e61e0622e475..8d06544e7d4d 100644 --- a/compiler/aslload.c +++ b/compiler/aslload.c @@ -353,6 +353,7 @@ LdLoadResourceElements ( Node->Value = (UINT32) Op->Asl.Value.Integer; Node->Op = Op; + Op->Asl.Node = Node; /* * Now enter the predefined fields, for easy lookup when referenced diff --git a/compiler/aslmain.c b/compiler/aslmain.c index d00695524377..aa29ab82f85b 100644 --- a/compiler/aslmain.c +++ b/compiler/aslmain.c @@ -150,6 +150,28 @@ AslCommandLine ( int argc, char **argv); +static int +AslDoOptions ( + int argc, + char **argv, + BOOLEAN IsResponseFile); + +static void +AslMergeOptionTokens ( + char *InBuffer, + char *OutBuffer); + +static int +AslDoResponseFile ( + char *Filename); + +extern int AcpiGbl_Opterr; +extern int AcpiGbl_Optind; + + +#define ASL_TOKEN_SEPARATORS " \t\n" +#define ASL_SUPPORTED_OPTIONS "@:2b:cd^e:fgh^i^I:l^o:p:r:s:t:v:w:x:" + /******************************************************************************* * @@ -168,8 +190,12 @@ Options ( void) { - printf ("General Output:\n"); - printf (" -p <prefix> Specify path/filename prefix for all output files\n"); + printf ("Global:\n"); + printf (" -@<file> Specify command file\n"); + printf (" -I<dir> Specify additional include directory\n"); + + printf ("\nGeneral Output:\n"); + printf (" -p<prefix> Specify path/filename prefix for all output files\n"); printf (" -va Disable all errors and warnings (summary only)\n"); printf (" -vi Less verbose errors and warnings for use with IDEs\n"); printf (" -vo Enable optimization comments\n"); @@ -310,39 +336,149 @@ AslInitialize ( /******************************************************************************* * - * FUNCTION: AslCommandLine + * FUNCTION: AslMergeOptionTokens * - * PARAMETERS: argc/argv + * PARAMETERS: InBuffer - Input containing an option string + * OutBuffer - Merged output buffer * * RETURN: None * - * DESCRIPTION: Command line processing + * DESCRIPTION: Remove all whitespace from an option string. + * + ******************************************************************************/ + +static void +AslMergeOptionTokens ( + char *InBuffer, + char *OutBuffer) +{ + char *Token; + + + *OutBuffer = 0; + + Token = strtok (InBuffer, ASL_TOKEN_SEPARATORS); + while (Token) + { + strcat (OutBuffer, Token); + Token = strtok (NULL, ASL_TOKEN_SEPARATORS); + } +} + + +/******************************************************************************* + * + * FUNCTION: AslDoResponseFile + * + * PARAMETERS: Filename - Name of the response file + * + * RETURN: Status + * + * DESCRIPTION: Open a response file and process all options within. * ******************************************************************************/ static int -AslCommandLine ( - int argc, - char **argv) +AslDoResponseFile ( + char *Filename) { - BOOLEAN BadCommandLine = FALSE; - int j; + char *argv = StringBuffer2; + FILE *ResponseFile; + int OptStatus = 0; + int Opterr; + int Optind; - /* Minimum command line contains at least one option or an input file */ + ResponseFile = fopen (Filename, "r"); + if (!ResponseFile) + { + printf ("Could not open command file %s, %s\n", + Filename, strerror (errno)); + return -1; + } - if (argc < 2) + /* Must save the current GetOpt globals */ + + Opterr = AcpiGbl_Opterr; + Optind = AcpiGbl_Optind; + + /* + * Process all lines in the response file. There must be one complete + * option per line + */ + while (fgets (StringBuffer, ASL_MSG_BUFFER_SIZE, ResponseFile)) { - AslCompilerSignon (ASL_FILE_STDOUT); - Usage (); - exit (1); + /* Compress all tokens, allowing us to use a single argv entry */ + + AslMergeOptionTokens (StringBuffer, StringBuffer2); + + /* Process the option */ + + AcpiGbl_Opterr = 0; + AcpiGbl_Optind = 0; + + OptStatus = AslDoOptions (1, &argv, TRUE); + if (OptStatus) + { + printf ("Invalid option in command file %s: %s\n", + Filename, StringBuffer); + break; + } } + /* Restore the GetOpt globals */ + + AcpiGbl_Opterr = Opterr; + AcpiGbl_Optind = Optind; + + fclose (ResponseFile); + return (OptStatus); +} + + +/******************************************************************************* + * + * FUNCTION: AslDoOptions + * + * PARAMETERS: argc/argv - Standard argc/argv + * IsResponseFile - TRUE if executing a response file. + * + * RETURN: Status + * + * DESCRIPTION: Command line option processing + * + ******************************************************************************/ + +static int +AslDoOptions ( + int argc, + char **argv, + BOOLEAN IsResponseFile) +{ + int j; + + /* Get the command line options */ - while ((j = AcpiGetopt (argc, argv, "2b:cd^e:fgh^i^l^o:p:r:s:t:v:w:x:")) != EOF) switch (j) + while ((j = AcpiGetopt (argc, argv, ASL_SUPPORTED_OPTIONS)) != EOF) switch (j) { + case '@': /* Begin a response file */ + + if (IsResponseFile) + { + printf ("Nested command files are not supported\n"); + return -1; + } + + if (AslDoResponseFile (AcpiGbl_Optarg)) + { + return -1; + } + break; + + case '2': + Gbl_Acpi2 = TRUE; break; @@ -364,8 +500,7 @@ AslCommandLine ( default: printf ("Unknown option: -b%s\n", AcpiGbl_Optarg); - BadCommandLine = TRUE; - break; + return (-1); } /* Produce debug output file */ @@ -394,8 +529,7 @@ AslCommandLine ( default: printf ("Unknown option: -d%s\n", AcpiGbl_Optarg); - BadCommandLine = TRUE; - break; + return (-1); } Gbl_DisasmFlag = TRUE; @@ -444,12 +578,17 @@ AslCommandLine ( default: printf ("Unknown option: -h%s\n", AcpiGbl_Optarg); - BadCommandLine = TRUE; - break; + return (-1); } break; + case 'I': /* Add an include file search directory */ + + FlAddIncludeDirectory (AcpiGbl_Optarg); + break; + + case 'i': switch (AcpiGbl_Optarg[0]) @@ -470,8 +609,7 @@ AslCommandLine ( default: printf ("Unknown option: -s%s\n", AcpiGbl_Optarg); - BadCommandLine = TRUE; - break; + return (-1); } break; @@ -500,8 +638,7 @@ AslCommandLine ( default: printf ("Unknown option: -l%s\n", AcpiGbl_Optarg); - BadCommandLine = TRUE; - break; + return (-1); } break; @@ -549,8 +686,7 @@ AslCommandLine ( default: printf ("Unknown option: -c%s\n", AcpiGbl_Optarg); - BadCommandLine = TRUE; - break; + return (-1); } break; @@ -589,8 +725,7 @@ AslCommandLine ( default: printf ("Unknown option: -s%s\n", AcpiGbl_Optarg); - BadCommandLine = TRUE; - break; + return (-1); } break; @@ -611,8 +746,7 @@ AslCommandLine ( default: printf ("Unknown option: -t%s\n", AcpiGbl_Optarg); - BadCommandLine = TRUE; - break; + return (-1); } break; @@ -647,8 +781,7 @@ AslCommandLine ( default: printf ("Unknown option: -v%s\n", AcpiGbl_Optarg); - BadCommandLine = TRUE; - break; + return (-1); } break; @@ -671,8 +804,7 @@ AslCommandLine ( default: printf ("Unknown option: -w%s\n", AcpiGbl_Optarg); - BadCommandLine = TRUE; - break; + return (-1); } break; @@ -685,10 +817,46 @@ AslCommandLine ( default: - BadCommandLine = TRUE; - break; + return (-1); + } + + return (0); +} + + +/******************************************************************************* + * + * FUNCTION: AslCommandLine + * + * PARAMETERS: argc/argv + * + * RETURN: Last argv index + * + * DESCRIPTION: Command line processing + * + ******************************************************************************/ + +static int +AslCommandLine ( + int argc, + char **argv) +{ + int BadCommandLine = 0; + + + /* Minimum command line contains at least the command and an input file */ + + if (argc < 2) + { + AslCompilerSignon (ASL_FILE_STDOUT); + Usage (); + exit (1); } + /* Process all command line options */ + + BadCommandLine = AslDoOptions (argc, argv, FALSE); + /* Next parameter must be the input filename */ if (!argv[AcpiGbl_Optind] && diff --git a/compiler/asltypes.h b/compiler/asltypes.h index 6b3c4243bb00..fb2396f4dde9 100644 --- a/compiler/asltypes.h +++ b/compiler/asltypes.h @@ -255,6 +255,14 @@ typedef enum #define ASL_NUM_FILES (ASL_MAX_FILE_TYPE + 1) +typedef struct asl_include_dir +{ + char *Dir; + struct asl_include_dir *Next; + +} ASL_INCLUDE_DIR; + + /* An entry in the exception list, one for each error/warning */ typedef struct asl_error_msg diff --git a/dispatcher/dsmthdat.c b/dispatcher/dsmthdat.c index 809ef1f0e80d..43777ab80f08 100644 --- a/dispatcher/dsmthdat.c +++ b/dispatcher/dsmthdat.c @@ -548,9 +548,10 @@ AcpiDsMethodDataGetValue ( case ACPI_REFCLASS_LOCAL: - ACPI_ERROR ((AE_INFO, - "Uninitialized Local[%d] at node %p", Index, Node)); - + /* + * No error message for this case, will be trapped again later to + * detect and ignore cases of Store(LocalX,LocalX) + */ return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL); default: diff --git a/dispatcher/dsobject.c b/dispatcher/dsobject.c index 647adb2b62bd..57e78c1b3394 100644 --- a/dispatcher/dsobject.c +++ b/dispatcher/dsobject.c @@ -570,15 +570,28 @@ AcpiDsBuildInternalPackageObj ( { /* * NumElements was exhausted, but there are remaining elements in the - * PackageList. + * PackageList. Truncate the package to NumElements. * * Note: technically, this is an error, from ACPI spec: "It is an error * for NumElements to be less than the number of elements in the - * PackageList". However, for now, we just print an error message and - * no exception is returned. + * PackageList". However, we just print an error message and + * no exception is returned. This provides Windows compatibility. Some + * BIOSs will alter the NumElements on the fly, creating this type + * of ill-formed package object. */ while (Arg) { + /* + * We must delete any package elements that were created earlier + * and are not going to be used because of the package truncation. + */ + if (Arg->Common.Node) + { + AcpiUtRemoveReference ( + ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Arg->Common.Node)); + Arg->Common.Node = NULL; + } + /* Find out how many elements there really are */ i++; @@ -586,7 +599,7 @@ AcpiDsBuildInternalPackageObj ( } ACPI_ERROR ((AE_INFO, - "Package List length (%X) larger than NumElements count (%X), truncated\n", + "Package List length (0x%X) larger than NumElements count (0x%X), truncated\n", i, ElementCount)); } else if (i < ElementCount) @@ -596,7 +609,7 @@ AcpiDsBuildInternalPackageObj ( * Note: this is not an error, the package is padded out with NULLs. */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Package List length (%X) smaller than NumElements count (%X), padded with null elements\n", + "Package List length (0x%X) smaller than NumElements count (0x%X), padded with null elements\n", i, ElementCount)); } diff --git a/executer/exstorob.c b/executer/exstorob.c index a1ad8d0aedc6..b2f125d01fba 100644 --- a/executer/exstorob.c +++ b/executer/exstorob.c @@ -150,6 +150,13 @@ AcpiExStoreBufferToBuffer ( ACPI_FUNCTION_TRACE_PTR (ExStoreBufferToBuffer, SourceDesc); + /* If Source and Target are the same, just return */ + + if (SourceDesc == TargetDesc) + { + return_ACPI_STATUS (AE_OK); + } + /* We know that SourceDesc is a buffer by now */ Buffer = ACPI_CAST_PTR (UINT8, SourceDesc->Buffer.Pointer); @@ -248,6 +255,13 @@ AcpiExStoreStringToString ( ACPI_FUNCTION_TRACE_PTR (ExStoreStringToString, SourceDesc); + /* If Source and Target are the same, just return */ + + if (SourceDesc == TargetDesc) + { + return_ACPI_STATUS (AE_OK); + } + /* We know that SourceDesc is a string by now */ Buffer = ACPI_CAST_PTR (UINT8, SourceDesc->String.Pointer); diff --git a/include/acdisasm.h b/include/acdisasm.h index 01def4548052..50c5f677c78f 100644 --- a/include/acdisasm.h +++ b/include/acdisasm.h @@ -273,6 +273,7 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest7[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest8[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest9[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHestNotify[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoHestBank[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHpet[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs0[]; diff --git a/include/aclocal.h b/include/aclocal.h index 2a0689244544..b8ea4f14325a 100644 --- a/include/aclocal.h +++ b/include/aclocal.h @@ -1127,6 +1127,9 @@ typedef struct acpi_bit_register_info #define ACPI_OSI_WIN_XP_SP2 0x05 #define ACPI_OSI_WINSRV_2003_SP1 0x06 #define ACPI_OSI_WIN_VISTA 0x07 +#define ACPI_OSI_WINSRV_2008 0x08 +#define ACPI_OSI_WIN_VISTA_SP1 0x09 +#define ACPI_OSI_WIN_7 0x0A #define ACPI_ALWAYS_ILLEGAL 0x00 diff --git a/include/acpixf.h b/include/acpixf.h index 1e1e47617e2c..14f9b4338113 100644 --- a/include/acpixf.h +++ b/include/acpixf.h @@ -120,7 +120,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20090730 +#define ACPI_CA_VERSION 0x20090903 #include "actypes.h" #include "actbl.h" diff --git a/namespace/nsinit.c b/namespace/nsinit.c index c4cd6a62edb4..fcea63e7acc9 100644 --- a/namespace/nsinit.c +++ b/namespace/nsinit.c @@ -264,6 +264,22 @@ AcpiNsInitializeDevices ( goto ErrorExit; } + /* + * Execute the "global" _INI method that may appear at the root. This + * support is provided for Windows compatibility (Vista+) and is not + * part of the ACPI specification. + */ + Info.EvaluateInfo->PrefixNode = AcpiGbl_RootNode; + Info.EvaluateInfo->Pathname = METHOD_NAME__INI; + Info.EvaluateInfo->Parameters = NULL; + Info.EvaluateInfo->Flags = ACPI_IGNORE_RETURN_VALUE; + + Status = AcpiNsEvaluate (Info.EvaluateInfo); + if (ACPI_SUCCESS (Status)) + { + Info.Num_INI++; + } + /* Walk namespace to execute all _INIs on present devices */ Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, diff --git a/namespace/nspredef.c b/namespace/nspredef.c index 77d23699b316..93bcbdef28d1 100644 --- a/namespace/nspredef.c +++ b/namespace/nspredef.c @@ -288,11 +288,15 @@ AcpiNsCheckPredefinedNames ( } /* - * We have a return value, but if one wasn't expected, just exit, this is + * 1) We have a return value, but if one wasn't expected, just exit, this is * not a problem. For example, if the "Implicit Return" feature is * enabled, methods will always return a value. + * + * 2) If the return value can be of any type, then we cannot perform any + * validation, exit. */ - if (!Predefined->Info.ExpectedBtypes) + if ((!Predefined->Info.ExpectedBtypes) || + (Predefined->Info.ExpectedBtypes == ACPI_RTYPE_ALL)) { goto Cleanup; } diff --git a/parser/psloop.c b/parser/psloop.c index 97a9376a3e0e..fe9b7311a27a 100644 --- a/parser/psloop.c +++ b/parser/psloop.c @@ -594,7 +594,7 @@ AcpiPsGetArguments ( if (WalkState->PassNumber == ACPI_IMODE_LOAD_PASS1) { AcpiPsLinkModuleCode (AmlOpStart, - WalkState->ParserState.PkgEnd - AmlOpStart, + (UINT32) (WalkState->ParserState.PkgEnd - AmlOpStart), WalkState->OwnerId); } @@ -625,8 +625,9 @@ AcpiPsGetArguments ( "Detected an unsupported executable opcode " "at module-level: [0x%.4X] at table offset 0x%.4X", Op->Common.AmlOpcode, - (AmlOpStart - WalkState->ParserState.AmlStart) + - sizeof (ACPI_TABLE_HEADER))); + (UINT32) (ACPI_PTR_DIFF (AmlOpStart, + WalkState->ParserState.AmlStart) + + sizeof (ACPI_TABLE_HEADER)))); } } break; diff --git a/tools/acpiexec/aecommon.h b/tools/acpiexec/aecommon.h index 3febf6f40c86..3ad0d0f4064a 100644 --- a/tools/acpiexec/aecommon.h +++ b/tools/acpiexec/aecommon.h @@ -138,6 +138,14 @@ extern FILE *AcpiGbl_DebugFile; extern BOOLEAN AcpiGbl_IgnoreErrors; + +typedef struct ae_table_desc +{ + ACPI_TABLE_HEADER *Table; + struct ae_table_desc *Next; + +} AE_TABLE_DESC; + /* * Debug Regions */ @@ -170,7 +178,8 @@ AeCtrlCHandler ( ACPI_STATUS AeBuildLocalTables ( - ACPI_TABLE_HEADER *UserTable); + UINT32 TableCount, + AE_TABLE_DESC *TableList); ACPI_STATUS AeInstallTables ( diff --git a/tools/acpiexec/aeexec.c b/tools/acpiexec/aeexec.c index d945cc359fa4..676bd9382bfa 100644 --- a/tools/acpiexec/aeexec.c +++ b/tools/acpiexec/aeexec.c @@ -490,7 +490,6 @@ AeHardwareInterfaces ( UINT32 Value; - Status = AcpiWriteBitRegister (ACPI_BITREG_WAKE_STATUS, 1); Status = AcpiWriteBitRegister (ACPI_BITREG_GLOBAL_LOCK_ENABLE, 1); Status = AcpiWriteBitRegister (ACPI_BITREG_SLEEP_ENABLE, 1); diff --git a/tools/acpiexec/aehandlers.c b/tools/acpiexec/aehandlers.c index a108fde02e06..9e00f5b30f5f 100644 --- a/tools/acpiexec/aehandlers.c +++ b/tools/acpiexec/aehandlers.c @@ -961,4 +961,3 @@ DoFunction: } - diff --git a/tools/acpiexec/aemain.c b/tools/acpiexec/aemain.c index 3aec0740fecf..1a2dd7cdb367 100644 --- a/tools/acpiexec/aemain.c +++ b/tools/acpiexec/aemain.c @@ -127,6 +127,15 @@ BOOLEAN AcpiGbl_IgnoreErrors = FALSE; BOOLEAN AcpiGbl_DbOpt_NoRegionSupport = FALSE; BOOLEAN AcpiGbl_DebugTimeout = FALSE; char BatchBuffer[128]; +AE_TABLE_DESC *AeTableListHead = NULL; + +#define ASL_MAX_FILES 256 +char *FileList[ASL_MAX_FILES]; +int FileCount; + + + +#define AE_SUPPORTED_OPTIONS "?ab:de^ghimo:rstvx:z" /****************************************************************************** @@ -144,7 +153,7 @@ char BatchBuffer[128]; static void usage (void) { - printf ("Usage: acpiexec [Options] [InputFile]\n\n"); + printf ("Usage: acpiexec [options] AMLfile1 AMLfile2 ...\n\n"); printf ("Where:\n"); printf (" -? Display this message\n"); @@ -218,6 +227,184 @@ AcpiDbRunBatchMode ( } +/******************************************************************************* + * + * 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); + } + + Substring = strrchr (DirectoryPath, '\\'); + if (!Substring) + { + Substring = strrchr (DirectoryPath, '/'); + if (!Substring) + { + Substring = strrchr (DirectoryPath, ':'); + } + } + + 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: 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; + + + 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 + /* + * 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: main @@ -238,7 +425,13 @@ main ( int j; ACPI_STATUS Status; UINT32 InitFlags; - ACPI_TABLE_HEADER *Table; + ACPI_TABLE_HEADER *Table = NULL; + UINT32 TableCount; + AE_TABLE_DESC *TableDesc; + char **FileList; + char *Filename; + char *Directory; + char *FullPathname; #ifdef _DEBUG @@ -269,7 +462,7 @@ main ( /* Get the command line options */ - while ((j = AcpiGetopt (argc, argv, "?ab:de^gimo:rstvx:z")) != EOF) switch(j) + while ((j = AcpiGetopt (argc, argv, AE_SUPPORTED_OPTIONS)) != EOF) switch(j) { case 'a': AcpiGbl_IgnoreErrors = TRUE; @@ -352,6 +545,7 @@ main ( break; case '?': + case 'h': default: usage(); return -1; @@ -364,21 +558,89 @@ main ( InitFlags |= (ACPI_NO_DEVICE_INIT | ACPI_NO_OBJECT_INIT); } - /* Standalone filename is the only argument */ + /* The remaining arguments are filenames for ACPI tables */ if (argv[AcpiGbl_Optind]) { AcpiGbl_DbOpt_tables = TRUE; - AcpiGbl_DbFilename = argv[AcpiGbl_Optind]; + TableCount = 0; + + /* Get each of the ACPI table files on the command line */ - Status = AcpiDbReadTableFromFile (AcpiGbl_DbFilename, &Table); + while (argv[AcpiGbl_Optind]) + { + /* Split incoming path into a directory/filename combo */ + + Status = FlSplitInputPathname (argv[AcpiGbl_Optind], &Directory, &Filename); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Expand wildcards (Windows only) */ + + FileList = AsDoWildcard (Directory, Filename); + if (!FileList) + { + return -1; + } + + while (*FileList) + { + FullPathname = AcpiOsAllocate ( + strlen (Directory) + strlen (*FileList) + 1); + + /* Construct a full path to the file */ + + strcpy (FullPathname, Directory); + strcat (FullPathname, *FileList); + + /* Get one table */ + + Status = AcpiDbReadTableFromFile (FullPathname, &Table); + if (ACPI_FAILURE (Status)) + { + printf ("**** Could not get input table %s, %s\n", FullPathname, + AcpiFormatException (Status)); + goto enterloop; + } + + AcpiOsFree (FullPathname); + AcpiOsFree (*FileList); + *FileList = NULL; + FileList++; + + /* + * Ignore an FACS or RSDT, we can't use them. + */ + if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS) || + ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_RSDT)) + { + 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); if (ACPI_FAILURE (Status)) { - printf ("**** Could not get input table, %s\n", AcpiFormatException (Status)); - goto enterloop; + return -1; } - AeBuildLocalTables (Table); Status = AeInstallTables (); if (ACPI_FAILURE (Status)) { diff --git a/tools/acpiexec/aetables.c b/tools/acpiexec/aetables.c index 1bf3b1e0d208..e29bf65b8f46 100644 --- a/tools/acpiexec/aetables.c +++ b/tools/acpiexec/aetables.c @@ -144,6 +144,15 @@ unsigned char DsdtCode[] = 0x04,0x12,0x08,0x20, }; +unsigned char LocalDsdtCode[] = +{ + 0x44,0x53,0x44,0x54,0x24,0x00,0x00,0x00, /* 00000000 "DSDT$..." */ + 0x02,0x2C,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 ".,Intel." */ + 0x4C,0x6F,0x63,0x61,0x6C,0x00,0x00,0x00, /* 00000010 "Local..." */ + 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ + 0x30,0x07,0x09,0x20, +}; + /* Several example SSDTs */ unsigned char Ssdt1Code[] = /* Has method _T98 */ @@ -229,15 +238,14 @@ ACPI_TABLE_HEADER *DsdtToInstallOverride; ACPI_TABLE_RSDP LocalRSDP; ACPI_TABLE_FADT LocalFADT; ACPI_TABLE_FACS LocalFACS; -ACPI_TABLE_HEADER LocalDSDT; ACPI_TABLE_HEADER LocalTEST; ACPI_TABLE_HEADER LocalBADTABLE; ACPI_TABLE_RSDT *LocalRSDT; -#define RSDT_TABLES 7 -#define RSDT_SIZE (sizeof (ACPI_TABLE_RSDT) + ((RSDT_TABLES -1) * sizeof (UINT32))) +#define BASE_RSDT_TABLES 6 +#define BASE_RSDT_SIZE (sizeof (ACPI_TABLE_RSDT) + ((BASE_RSDT_TABLES -1) * sizeof (UINT32))) -#define ACPI_MAX_INIT_TABLES (16) +#define ACPI_MAX_INIT_TABLES (32) static ACPI_TABLE_DESC Tables[ACPI_MAX_INIT_TABLES]; @@ -276,8 +284,8 @@ AeTableOverride ( * * FUNCTION: AeBuildLocalTables * - * PARAMETERS: UserTable - pointer to an input table to be loaded. - * a DSDT or SSDT + * PARAMETERS: TableCount - Number of tables on the command line + * TableList - List of actual tables from files * * RETURN: Status * @@ -288,129 +296,199 @@ AeTableOverride ( ACPI_STATUS AeBuildLocalTables ( - ACPI_TABLE_HEADER *UserTable) + UINT32 TableCount, + AE_TABLE_DESC *TableList) { - ACPI_PHYSICAL_ADDRESS DsdtAddress; + ACPI_PHYSICAL_ADDRESS DsdtAddress = 0; + UINT32 RsdtSize; + AE_TABLE_DESC *NextTable; + UINT32 NextIndex; + ACPI_TABLE_FADT *ExternalFadt = NULL; + /* + * Update the table count. For DSDT, it is not put into the RSDT. For + * FADT, this is already accounted for since we usually install a + * local FADT. + */ + NextTable = TableList; + while (NextTable) + { + if (ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_DSDT) || + ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_FADT)) + { + TableCount--; + } + NextTable = NextTable->Next; + } + + RsdtSize = BASE_RSDT_SIZE + (TableCount * sizeof (UINT32)); + /* Build an RSDT */ - LocalRSDT = AcpiOsAllocate (RSDT_SIZE); + LocalRSDT = AcpiOsAllocate (RsdtSize); if (!LocalRSDT) { return AE_NO_MEMORY; } - ACPI_MEMSET (LocalRSDT, 0, RSDT_SIZE); + ACPI_MEMSET (LocalRSDT, 0, RsdtSize); ACPI_STRNCPY (LocalRSDT->Header.Signature, ACPI_SIG_RSDT, 4); - LocalRSDT->Header.Length = RSDT_SIZE; + LocalRSDT->Header.Length = RsdtSize; LocalRSDT->TableOffsetEntry[0] = ACPI_PTR_TO_PHYSADDR (&LocalTEST); LocalRSDT->TableOffsetEntry[1] = ACPI_PTR_TO_PHYSADDR (&LocalBADTABLE); LocalRSDT->TableOffsetEntry[2] = ACPI_PTR_TO_PHYSADDR (&LocalFADT); - LocalRSDT->TableOffsetEntry[3] = ACPI_PTR_TO_PHYSADDR (&LocalTEST); /* Just a placeholder for a user SSDT */ /* Install two SSDTs to test multiple table support */ - LocalRSDT->TableOffsetEntry[4] = ACPI_PTR_TO_PHYSADDR (&Ssdt1Code); - LocalRSDT->TableOffsetEntry[5] = ACPI_PTR_TO_PHYSADDR (&Ssdt2Code); + LocalRSDT->TableOffsetEntry[3] = ACPI_PTR_TO_PHYSADDR (&Ssdt1Code); + LocalRSDT->TableOffsetEntry[4] = ACPI_PTR_TO_PHYSADDR (&Ssdt2Code); /* Install the OEM1 table to test LoadTable */ - LocalRSDT->TableOffsetEntry[6] = ACPI_PTR_TO_PHYSADDR (&Oem1Code); + LocalRSDT->TableOffsetEntry[5] = ACPI_PTR_TO_PHYSADDR (&Oem1Code); + + /* + * Install the user tables. The DSDT must be installed in the FADT. + * All other tables are installed directly into the RSDT. + */ + NextIndex = BASE_RSDT_TABLES; + NextTable = TableList; + while (NextTable) + { + /* + * Incoming DSDT or FADT are special cases. All other tables are + * just immediately installed into the RSDT. + */ + if (ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_DSDT)) + { + if (DsdtAddress) + { + printf ("Already found a DSDT, only one allowed\n"); + return AE_ALREADY_EXISTS; + } + + /* The incoming user table is a DSDT */ + + DsdtAddress = ACPI_PTR_TO_PHYSADDR (&DsdtCode); + DsdtToInstallOverride = NextTable->Table; + } + else if (ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_FADT)) + { + ExternalFadt = ACPI_CAST_PTR (ACPI_TABLE_FADT, NextTable->Table); + LocalRSDT->TableOffsetEntry[2] = ACPI_PTR_TO_PHYSADDR (NextTable->Table); + } + else + { + /* Install the table in the RSDT */ + + LocalRSDT->TableOffsetEntry[NextIndex] = ACPI_PTR_TO_PHYSADDR (NextTable->Table); + NextIndex++; + } + + NextTable = NextTable->Next; + } /* Build an RSDP */ ACPI_MEMSET (&LocalRSDP, 0, sizeof (ACPI_TABLE_RSDP)); ACPI_MEMCPY (LocalRSDP.Signature, ACPI_SIG_RSDP, 8); + ACPI_MEMCPY (LocalRSDP.OemId, "I_TEST", 6); LocalRSDP.Revision = 1; LocalRSDP.RsdtPhysicalAddress = ACPI_PTR_TO_PHYSADDR (LocalRSDT); LocalRSDP.Length = sizeof (ACPI_TABLE_RSDT); - ACPI_MEMCPY (LocalRSDP.OemId, "I_TEST", 6); - - /* - * Examine the incoming user table. At this point, it has been verified - * to be either a DSDT, SSDT, or a PSDT, but they must be handled differently - */ - if (ACPI_COMPARE_NAME (UserTable->Signature, ACPI_SIG_DSDT)) - { - /* The incoming user table is a DSDT */ - DsdtAddress = ACPI_PTR_TO_PHYSADDR (&DsdtCode); - DsdtToInstallOverride = UserTable; - } - else - { - /* Build a local DSDT because incoming table is an SSDT or PSDT */ + /* Set checksums for both RSDT and RSDP */ - ACPI_MEMSET (&LocalDSDT, 0, sizeof (ACPI_TABLE_HEADER)); - ACPI_STRNCPY (LocalDSDT.Signature, ACPI_SIG_DSDT, 4); - LocalDSDT.Revision = 1; - LocalDSDT.Length = sizeof (ACPI_TABLE_HEADER); - LocalDSDT.Checksum = (UINT8) -AcpiTbChecksum ((void *) &LocalDSDT, LocalDSDT.Length); + LocalRSDT->Header.Checksum = (UINT8) -AcpiTbChecksum ( + (void *) LocalRSDT, LocalRSDT->Header.Length); + LocalRSDP.Checksum = (UINT8) -AcpiTbChecksum ( + (void *) &LocalRSDP, ACPI_RSDP_CHECKSUM_LENGTH); - /* Install incoming table (SSDT or PSDT) directly into the RSDT */ + if (!DsdtAddress) + { + /* Use the local DSDT because incoming table(s) are all SSDT(s) */ - LocalRSDT->TableOffsetEntry[3] = ACPI_PTR_TO_PHYSADDR (UserTable); - DsdtAddress = ACPI_PTR_TO_PHYSADDR (&LocalDSDT); - DsdtToInstallOverride = &LocalDSDT; + DsdtAddress = ACPI_PTR_TO_PHYSADDR (LocalDsdtCode); + DsdtToInstallOverride = ACPI_CAST_PTR (ACPI_TABLE_HEADER, LocalDsdtCode); } - /* Set checksums for both RSDT and RSDP */ - - LocalRSDT->Header.Checksum = (UINT8) -AcpiTbChecksum ((void *) LocalRSDT, LocalRSDT->Header.Length); - LocalRSDP.Checksum = (UINT8) -AcpiTbChecksum ((void *) &LocalRSDP, ACPI_RSDP_CHECKSUM_LENGTH); - - /* - * Build a FADT so we can test the hardware/event init - */ - ACPI_MEMSET (&LocalFADT, 0, sizeof (ACPI_TABLE_FADT)); - ACPI_STRNCPY (LocalFADT.Header.Signature, ACPI_SIG_FADT, 4); + if (ExternalFadt) + { + /* + * Use the external FADT, but we must update the DSDT/FACS addresses + * as well as the checksum + */ + ExternalFadt->Dsdt = DsdtAddress; + ExternalFadt->Facs = ACPI_PTR_TO_PHYSADDR (&LocalFACS); + + if (ExternalFadt->Header.Length > ACPI_PTR_DIFF (&ExternalFadt->XDsdt, ExternalFadt)) + { + ExternalFadt->XDsdt = DsdtAddress; + ExternalFadt->XFacs = ACPI_PTR_TO_PHYSADDR (&LocalFACS); + } + /* Complete the FADT with the checksum */ + + ExternalFadt->Header.Checksum = 0; + ExternalFadt->Header.Checksum = (UINT8) -AcpiTbChecksum ( + (void *) ExternalFadt, ExternalFadt->Header.Length); + } + else + { + /* + * Build a local FADT so we can test the hardware/event init + */ + ACPI_MEMSET (&LocalFADT, 0, sizeof (ACPI_TABLE_FADT)); + ACPI_STRNCPY (LocalFADT.Header.Signature, ACPI_SIG_FADT, 4); - /* Setup FADT header and DSDT/FACS addresses */ + /* Setup FADT header and DSDT/FACS addresses */ - LocalFADT.Dsdt = DsdtAddress; - LocalFADT.Facs = ACPI_PTR_TO_PHYSADDR (&LocalFACS); + LocalFADT.Dsdt = DsdtAddress; + LocalFADT.Facs = ACPI_PTR_TO_PHYSADDR (&LocalFACS); - LocalFADT.XDsdt = DsdtAddress; - LocalFADT.XFacs = ACPI_PTR_TO_PHYSADDR (&LocalFACS); + LocalFADT.XDsdt = DsdtAddress; + LocalFADT.XFacs = ACPI_PTR_TO_PHYSADDR (&LocalFACS); - LocalFADT.Header.Revision = 3; - LocalFADT.Header.Length = sizeof (ACPI_TABLE_FADT); + LocalFADT.Header.Revision = 3; + LocalFADT.Header.Length = sizeof (ACPI_TABLE_FADT); - /* Miscellaneous FADT fields */ + /* Miscellaneous FADT fields */ - LocalFADT.Gpe0BlockLength = 16; - LocalFADT.Gpe1BlockLength = 6; - LocalFADT.Gpe1Base = 96; + LocalFADT.Gpe0BlockLength = 16; + LocalFADT.Gpe1BlockLength = 6; + LocalFADT.Gpe1Base = 96; - LocalFADT.Pm1EventLength = 4; - LocalFADT.Pm1ControlLength = 2; - LocalFADT.PmTimerLength = 4; + LocalFADT.Pm1EventLength = 4; + LocalFADT.Pm1ControlLength = 2; + LocalFADT.PmTimerLength = 4; - LocalFADT.Gpe0Block = 0x00001234; - LocalFADT.Gpe1Block = 0x00005678; + LocalFADT.Gpe0Block = 0x00001234; + LocalFADT.Gpe1Block = 0x00005678; - LocalFADT.Pm1aEventBlock = 0x00001aaa; - LocalFADT.Pm1bEventBlock = 0x00001bbb; - LocalFADT.PmTimerBlock = 0xA0; - LocalFADT.Pm1aControlBlock = 0xB0; + LocalFADT.Pm1aEventBlock = 0x00001aaa; + LocalFADT.Pm1bEventBlock = 0x00001bbb; + LocalFADT.PmTimerBlock = 0xA0; + LocalFADT.Pm1aControlBlock = 0xB0; - /* Setup one example X-64 field */ + /* Setup one example X-64 field */ - LocalFADT.XPm1bEventBlock.SpaceId = ACPI_ADR_SPACE_SYSTEM_IO; - LocalFADT.XPm1bEventBlock.Address = LocalFADT.Pm1bEventBlock; - LocalFADT.XPm1bEventBlock.BitWidth = (UINT8) ACPI_MUL_8 (LocalFADT.Pm1EventLength); + LocalFADT.XPm1bEventBlock.SpaceId = ACPI_ADR_SPACE_SYSTEM_IO; + LocalFADT.XPm1bEventBlock.Address = LocalFADT.Pm1bEventBlock; + LocalFADT.XPm1bEventBlock.BitWidth = (UINT8) ACPI_MUL_8 (LocalFADT.Pm1EventLength); - /* Complete the FADT with the checksum */ + /* Complete the FADT with the checksum */ - LocalFADT.Header.Checksum = 0; - LocalFADT.Header.Checksum = (UINT8) -AcpiTbChecksum ((void *) &LocalFADT, LocalFADT.Header.Length); + LocalFADT.Header.Checksum = 0; + LocalFADT.Header.Checksum = (UINT8) -AcpiTbChecksum ( + (void *) &LocalFADT, LocalFADT.Header.Length); + } /* Build a FACS */ ACPI_MEMSET (&LocalFACS, 0, sizeof (ACPI_TABLE_FACS)); ACPI_STRNCPY (LocalFACS.Signature, ACPI_SIG_FACS, 4); + LocalFACS.Length = sizeof (ACPI_TABLE_FACS); LocalFACS.GlobalLock = 0x11AA0011; @@ -421,7 +499,8 @@ AeBuildLocalTables ( LocalTEST.Revision = 1; LocalTEST.Length = sizeof (ACPI_TABLE_HEADER); - LocalTEST.Checksum = (UINT8) -AcpiTbChecksum ((void *) &LocalTEST, LocalTEST.Length); + LocalTEST.Checksum = (UINT8) -AcpiTbChecksum ( + (void *) &LocalTEST, LocalTEST.Length); /* Build a fake table with a bad signature [BAD!] so that we make sure that the CA core ignores it */ @@ -430,7 +509,8 @@ AeBuildLocalTables ( LocalBADTABLE.Revision = 1; LocalBADTABLE.Length = sizeof (ACPI_TABLE_HEADER); - LocalBADTABLE.Checksum = (UINT8) -AcpiTbChecksum ((void *) &LocalBADTABLE, LocalBADTABLE.Length); + LocalBADTABLE.Checksum = (UINT8) -AcpiTbChecksum ( + (void *) &LocalBADTABLE, LocalBADTABLE.Length); return (AE_OK); } diff --git a/utilities/uteval.c b/utilities/uteval.c index b25cfe12ac81..ecb0cf19a704 100644 --- a/utilities/uteval.c +++ b/utilities/uteval.c @@ -146,6 +146,9 @@ static const ACPI_INTERFACE_INFO AcpiInterfacesSupported[] = {"Windows 2001 SP2", ACPI_OSI_WIN_XP_SP2}, /* Windows XP SP2 */ {"Windows 2001.1 SP1", ACPI_OSI_WINSRV_2003_SP1}, /* Windows Server 2003 SP1 - Added 03/2006 */ {"Windows 2006", ACPI_OSI_WIN_VISTA}, /* Windows Vista - Added 03/2006 */ + {"Windows 2006.1", ACPI_OSI_WINSRV_2008}, /* Windows Server 2008 - Added 09/2009 */ + {"Windows 2006 SP1", ACPI_OSI_WIN_VISTA_SP1}, /* Windows Vista SP1 - Added 09/2009 */ + {"Windows 2009", ACPI_OSI_WIN_7}, /* Windows 7 and Server 2008 R2 - Added 09/2009 */ /* Feature Group Strings */ |