diff options
author | jkim <jkim@FreeBSD.org> | 2011-04-15 18:34:27 +0000 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2011-04-15 18:34:27 +0000 |
commit | 11c809baa12ad68f12744b6dd5148d56b2555e72 (patch) | |
tree | e85ad1cacd03dfd5568f818085557ac68ceafdd8 /sys | |
parent | 5c6bf378652cfb00b5bdb569b2be605c2bab0ab3 (diff) | |
parent | 2b848536825a88fa2abd8e60fd768c4b337627de (diff) | |
download | FreeBSD-src-11c809baa12ad68f12744b6dd5148d56b2555e72.zip FreeBSD-src-11c809baa12ad68f12744b6dd5148d56b2555e72.tar.gz |
Merge ACPICA 20110413.
Diffstat (limited to 'sys')
47 files changed, 1949 insertions, 1167 deletions
diff --git a/sys/conf/files b/sys/conf/files index 5474399..b772c78 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -190,6 +190,7 @@ contrib/dev/acpica/dispatcher/dswload2.c optional acpi contrib/dev/acpica/dispatcher/dswscope.c optional acpi contrib/dev/acpica/dispatcher/dswstate.c optional acpi contrib/dev/acpica/events/evevent.c optional acpi +contrib/dev/acpica/events/evglock.c optional acpi contrib/dev/acpica/events/evgpe.c optional acpi contrib/dev/acpica/events/evgpeblk.c optional acpi contrib/dev/acpica/events/evgpeinit.c optional acpi diff --git a/sys/contrib/dev/acpica/acpica_prep.sh b/sys/contrib/dev/acpica/acpica_prep.sh index b12ed28..1ffdd84 100755 --- a/sys/contrib/dev/acpica/acpica_prep.sh +++ b/sys/contrib/dev/acpica/acpica_prep.sh @@ -67,7 +67,7 @@ find ${wrk} -type f -print | xargs -J % mv % ${dst} # canonify include paths for H in ${src_headers}; do - find ${dst} -name "*.[chy]" -type f -print | \ + find ${dst} -name "*.[chly]" -type f -print | \ xargs sed -i "" -e "s|[\"<]$H[\">]|\<contrib/dev/acpica/include/$H\>|g" done for H in ${comp_headers}; do diff --git a/sys/contrib/dev/acpica/changes.txt b/sys/contrib/dev/acpica/changes.txt index edac6cb..68dda91 100644 --- a/sys/contrib/dev/acpica/changes.txt +++ b/sys/contrib/dev/acpica/changes.txt @@ -1,7 +1,83 @@ ---------------------------------------- +13 April 2011. Summary of changes for version 20110413: + +1) ACPI CA Core Subsystem: + +Implemented support to execute a so-called "orphan" _REG method under the EC +device. This change will force the execution of a _REG method underneath the EC +device even if there is no corresponding operation region of type +EmbeddedControl. Fixes a problem seen on some machines and apparently is +compatible with Windows behavior. ACPICA BZ 875. + +Added more predefined methods that are eligible for automatic NULL package +element removal. This change adds another group of predefined names to the list +of names that can be repaired by having NULL package elements dynamically +removed. This group are those methods that return a single variable-length +package containing simple data types such as integers, buffers, strings. This +includes: _ALx, _BCL, _CID,_ DOD, _EDL, _FIX, _PCL, _PLD, _PMD, _PRx, _PSL, _Sx, +and _TZD. ACPICA BZ 914. + +Split and segregated all internal global lock functions to a new file, evglock.c. + +Updated internal address SpaceID for DataTable regions. Moved this internal space +id in preparation for ACPI 5.0 changes that will include some new space IDs. This +change should not affect user/host code. + +Example Code and Data Size: These are the sizes for the OS-independent acpica.lib +produced by the Microsoft Visual C++ 9.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 (VC 9.0): + Non-Debug Version: 89.8K Code, 23.8K Data, 113.6K Total + Debug Version: 164.2K Code, 67.9K Data, 232.1K Total + Current Release (VC 9.0): + Non-Debug Version: 90.0K Code, 23.8K Data, 113.8K Total + Debug Version: 164.5K Code, 68.0K Data, 232.5K Total + +2) iASL Compiler/Disassembler and Tools: + +iASL/DTC: Major update for new grammar features. Allow generic data types in +custom ACPI tables. Field names are now optional. Any line can be split to +multiple lines using the continuation char (\). Large buffers now use line- +continuation character(s) and no colon on the continuation lines. See the grammar +update in the iASL compiler reference. ACPI BZ 910,911. Lin Ming, Bob Moore. + +iASL: Mark ASL "Return()" and the simple "Return" as "Null" return statements. +Since the parser stuffs a "zero" as the return value for these statements (due to +the underlying AML grammar), they were seen as "return with value" by the iASL +semantic checking. They are now seen correctly as "null" return statements. + +iASL: Check if a_REG declaration has a corresponding Operation Region. Adds a +check for each _REG to ensure that there is in fact a corresponding operation +region declaration in the same scope. If not, the _REG method is not very useful +since it probably won't be executed. ACPICA BZ 915. + +iASL/DTC: Finish support for expression evaluation. Added a new expression parser +that implements c-style operator precedence and parenthesization. ACPICA bugzilla +908. + +Disassembler/DTC: Remove support for () and <> style comments in data tables. Now +that DTC has full expression support, we don't want to have comment strings that +start with a parentheses or a less-than symbol. Now, only the standard /* and // +comments are supported, as well as the bracket [] comments. + +AcpiXtract: Fix for RSDP and dynamic SSDT extraction. These tables have "unusual" +headers in the acpidump file. Update the header validation to support these +tables. Problem introduced in previous AcpiXtract version in the change to +support "wrong checksum" error messages emitted by acpidump utility. + +iASL: Add a * option to generate all template files (as a synonym for ALL) as in +"iasl -T *" or "iasl -T ALL". + +iASL/DTC: Do not abort compiler on fatal errors. We do not want to completely +abort the compiler on "fatal" errors, simply should abort the current compile. +This allows multiple compiles with a single (possibly wildcard) compiler +invocation. + +---------------------------------------- 16 March 2011. Summary of changes for version 20110316: -x 1) ACPI CA Core Subsystem: Fixed a problem caused by a _PRW method appearing at the namespace root scope @@ -126,7 +202,6 @@ no need to abort on simple errors within a field definition. Debugger: Simplified the output of the help command. All help output now in a single screen, instead of help subcommands. ACPICA Bugzilla 897. - ---------------------------------------- 12 January 2011. Summary of changes for version 20110112: @@ -134,16 +209,14 @@ a single screen, instead of help subcommands. ACPICA Bugzilla 897. Fixed a race condition between method execution and namespace walks that can possibly cause a fault. The problem was apparently introduced in version -20100528 as a result of a performance optimization that reduces the number -of +20100528 as a result of a performance optimization that reduces the number of namespace walks upon method exit by using the delete_namespace_subtree function instead of the delete_namespace_by_owner function used previously. Bug is a missing namespace lock in the delete_namespace_subtree function. dana.myers@oracle.com Fixed several issues and a possible fault with the automatic "serialized" -method support. History: This support changes a method to "serialized" on -the +method support. History: This support changes a method to "serialized" on the fly if the method generates an AE_ALREADY_EXISTS error, indicating the possibility that it cannot handle reentrancy. This fix repairs a couple of issues seen in the field, especially on machines with many cores: @@ -181,8 +254,7 @@ details. Example Code and Data Size: These are the sizes for the OS-independent acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The -debug version of the code includes the debug output trace mechanism and has -a +debug version of the code includes the debug output trace mechanism and has a much larger code and data size. Previous Release (VC 6.0): @@ -194,13 +266,11 @@ much larger code and data size. 2) iASL Compiler/Disassembler and Tools: -iASL: Added generic data types to the Data Table compiler. Add "generic" -data +iASL: Added generic data types to the Data Table compiler. Add "generic" data types such as UINT32, String, Unicode, etc., to simplify the generation of platform-defined tables such as UEFI. Lin Ming. -iASL: Added listing support for the Data Table Compiler. Adds listing -support +iASL: Added listing support for the Data Table Compiler. Adds listing support (-l) to display actual binary output for each line of input code. ---------------------------------------- @@ -232,15 +302,13 @@ when a Wake GPE is received if there is no corresponding GPE method or handler. ACPICA BZ 870. Fixed a problem with the Scope() operator during table parse and load phase. -During load phase (table load or method execution), the scope operator -should +During load phase (table load or method execution), the scope operator should not enter the target into the namespace. Instead, it should open a new scope at the target location. Linux BZ 19462, ACPICA BZ 882. 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 +debug version of the code includes the debug output trace mechanism and has a much larger code and data size. Previous Release: @@ -299,8 +367,7 @@ longer needed in Execute_HID, Execute_CID, and Execute_UID. ACPICA BZ 878. 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 +debug version of the code includes the debug output trace mechanism and has a much larger code and data size. Previous Release: @@ -313,16 +380,13 @@ much larger code and data size. 2) iASL Compiler/Disassembler and Tools: iASL: Implemented additional compile-time validation for _HID strings. The -non-hex prefix (such as "PNP" or "ACPI") must be uppercase, and the length -of +non-hex prefix (such as "PNP" or "ACPI") must be uppercase, and the length of the string must be exactly seven or eight characters. For both _HID and _CID strings, all characters must be alphanumeric. ACPICA BZ 874. iASL: Allow certain "null" resource descriptors. Some BIOS code creates -descriptors that are mostly or all zeros, with the expectation that they -will -be filled in at runtime. iASL now allows this as long as there is a -"resource +descriptors that are mostly or all zeros, with the expectation that they will +be filled in at runtime. iASL now allows this as long as there is a "resource tag" (name) associated with the descriptor, which gives the ASL a handle needed to modify the descriptor. ACPICA BZ 873. @@ -332,8 +396,7 @@ threaded ACPICA tools/applications - increasing performance. The _MULTI_THREADED option was replaced by the (reverse) ACPI_SINGLE_THREADED option. ACPICA BZ 879. -AcpiExec: several fixes for the 64-bit version. Adds XSDT support and -support +AcpiExec: several fixes for the 64-bit version. Adds XSDT support and support for 64-bit DSDT/FACS addresses in the FADT. Lin Ming. iASL: Moved all compiler messages to a new file, aslmessages.h. @@ -343,8 +406,7 @@ iASL: Moved all compiler messages to a new file, aslmessages.h. 1) ACPI CA Core Subsystem: -Removed the AcpiOsDerivePciId OSL interface. The various host -implementations +Removed the AcpiOsDerivePciId OSL interface. The various host implementations of this function were not OS-dependent and are now obsolete and can be removed from all host OSLs. This function has been replaced by AcpiHwDerivePciId, which is now part of the ACPICA core code. @@ -358,8 +420,7 @@ accordance with the ACPI specification and will simplify host driver code. ACPICA BZ 871. The ACPI_THREAD_ID type is no longer configurable, internally it is now -always UINT64. This simplifies the ACPICA code, especially any printf -output. +always UINT64. This simplifies the ACPICA code, especially any printf output. UINT64 is the only common data type for all thread_id types across all operating systems. It is now up to the host OSL to cast the native thread_id type to UINT64 before returning the value to ACPICA (via AcpiOsGetThreadId). @@ -381,8 +442,7 @@ is used. ACPICA BZ 829. Lin Ming, Bob Moore. 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 +debug version of the code includes the debug output trace mechanism and has a much larger code and data size. Previous Release: @@ -411,8 +471,7 @@ of size_t on 32-bit versus 64-bit generations. Lin Ming. Designed and implemented a new host interface to the _OSI support code. This will allow the host to dynamically add or remove multiple _OSI strings, as well as install an optional handler that is called for each _OSI invocation. -Also added a new AML debugger command, 'osi' to display and modify the -global +Also added a new AML debugger command, 'osi' to display and modify the global _OSI string table, and test support in the AcpiExec utility. See the ACPICA reference manual for full details. Lin Ming, Bob Moore. ACPICA BZ 836. New Functions: @@ -441,14 +500,12 @@ It should be a (UINT64 *). This may affect some host OSL code. Fixed a couple problems with the recently modified Linux makefiles for iASL and AcpiExec. These new makefiles place the generated object files in the -local directory so that there can be no collisions between the files that -are +local directory so that there can be no collisions between the files that are shared between them that are compiled with different options. 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 +debug version of the code includes the debug output trace mechanism and has a much larger code and data size. Previous Release: @@ -489,29 +546,25 @@ interface. This interface will set or clear individual GPEs for wakeup. 5) Remove GpeType argument from AcpiEnable and AcpiDisable. These interfaces are now used for "runtime" GPEs only. -Changed the behavior of the GPE install/remove handler interfaces. The GPE -is +Changed the behavior of the GPE install/remove handler interfaces. The GPE is no longer disabled during this process, as it was found to cause problems on some machines. Rafael J. Wysocki. Reverted a change introduced in version 20100528 to enable Embedded -Controller multi-byte transfers. This change was found to cause problems -with +Controller multi-byte transfers. This change was found to cause problems with Index Fields and possibly Bank Fields. It will be reintroduced when these problems have been resolved. Fixed a problem with references to Alias objects within Package Objects. A reference to an Alias within the definition of a Package was not always resolved properly. Aliases to objects like Processors, Thermal zones, etc. -were resolved to the actual object instead of a reference to the object as -it +were resolved to the actual object instead of a reference to the object as it should be. Package objects are only allowed to contain integer, string, buffer, package, and reference objects. Redhat bugzilla 608648. 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 +debug version of the code includes the debug output trace mechanism and has a much larger code and data size. Previous Release: @@ -561,8 +614,7 @@ ACPI tables that have been seen in the field: ATKG, IEIT, GSCI. Implemented support to enable multi-byte transfers for Embedded Controller (EC) operation regions. Previously, the maximum data size passed to the EC operation region handler was a single byte. There are often EC Fields larger -than one byte that need to be transferred, and it is useful for the EC -driver +than one byte that need to be transferred, and it is useful for the EC driver to lock these as a single transaction. This change enables single transfers larger than 8 bits. This effectively changes the access to the EC space from ByteAcc to AnyAcc, and will probably require changes to the host OS Embedded @@ -579,16 +631,12 @@ node and an ACPI operand object. However, this is the first growth of the namespace in ten years. ACPICA bugzilla 817. Alexey Starikovskiy. Implemented a performance optimization that reduces the number of namespace -walks. On control method exit, only walk the namespace if the method is -known -to have created namespace objects outside of its local scope. Previously, -the +walks. On control method exit, only walk the namespace if the method is known +to have created namespace objects outside of its local scope. Previously, the entire namespace was traversed on each control method exit. This change can -improve overall ACPI performance by up to 3X. Alexey Starikovskiy, Bob -Moore. +improve overall ACPI performance by up to 3X. Alexey Starikovskiy, Bob Moore. -Added support to truncate I/O addresses to 16 bits for Windows -compatibility. +Added support to truncate I/O addresses to 16 bits for Windows compatibility. Some ASL code has been seen in the field that inadvertently has bits set above bit 15. This feature is optional and is enabled if the BIOS requests any Windows OSI strings. It can also be enabled by the host OS. Matthew @@ -606,18 +654,15 @@ part of the ACPI spec. ACPICA BZ 860. Expanded all statistic counters used during namespace and device initialization from 16 to 32 bits in order to support very large namespaces. -Replaced all instances of %d in printf format specifiers with %u since -nearly +Replaced all instances of %d in printf format specifiers with %u since nearly all integers in ACPICA are unsigned. -Fixed the exception namestring for AE_WAKE_ONLY_GPE. Was incorrectly -returned +Fixed the exception namestring for AE_WAKE_ONLY_GPE. Was incorrectly returned as AE_NO_HANDLER. 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 +debug version of the code includes the debug output trace mechanism and has a much larger code and data size. Previous Release: @@ -651,8 +696,7 @@ new table, and process any _Lxx/_Exx GPE methods in the new table. Any runtime GPE that is referenced by an _Lxx/_Exx method in the new table is immediately enabled. Handles the FADT-defined GPEs as well as GPE Block Devices. Provides compatibility with other ACPI implementations. Two new -files added, evgpeinit.c and evgpeutil.c. ACPICA BZ 833. Lin Ming, Bob -Moore. +files added, evgpeinit.c and evgpeutil.c. ACPICA BZ 833. Lin Ming, Bob Moore. Fixed a regression introduced in version 20100331 within the table manager where initial table loading could fail. This was introduced in the fix for @@ -664,14 +708,12 @@ AcpiUtCopySimpleObject. The original code did not correctly handle the case where the object to be copied was a namespace node. Lin Ming. ACPICA BZ 847. Updated the allocation dump routine, AcpiUtDumpAllocation and fixed a -possible access beyond end-of-allocation. Also, now fully validate -descriptor +possible access beyond end-of-allocation. Also, now fully validate descriptor (size and type) before output. Lin Ming, Bob Moore. ACPICA BZ 847 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 +debug version of the code includes the debug output trace mechanism and has a much larger code and data size. Previous Release: @@ -688,8 +730,7 @@ descriptors. This change implements validation for the address fields that are common to all address-type resource descriptors. These checks are implemented: Checks for valid Min/Max, length within the Min/Max window, valid granularity, Min/Max a multiple of granularity, and _MIF/_MAF as per -table 6-40 in the ACPI 4.0a specification. Also split the large -aslrestype1.c +table 6-40 in the ACPI 4.0a specification. Also split the large aslrestype1.c and aslrestype2.c files into five new files. ACPICA BZ 840. iASL: Added support for the _Wxx predefined names. This support was missing @@ -733,10 +774,8 @@ New: AcpiSetGpe Implemented write support for DataTable operation regions. These regions are -defined via the DataTableRegion() operator. Previously, only read support -was -implemented. The ACPI specification allows DataTableRegions to be -read/write, +defined via the DataTableRegion() operator. Previously, only read support was +implemented. The ACPI specification allows DataTableRegions to be read/write, however. Implemented a new subsystem option to force a copy of the DSDT to local @@ -746,8 +785,7 @@ the original DSDT, creating the need for this option. Default is FALSE, do not copy the DSDT. Implemented detection of a corrupted or replaced DSDT. This change adds -support to detect a DSDT that has been corrupted and/or replaced from -outside +support to detect a DSDT that has been corrupted and/or replaced from outside the OS (by firmware). This is typically catastrophic for the system, but has been seen on some machines. Once this problem has been detected, the DSDT copy option can be enabled via system configuration. Lin Ming, Bob Moore. @@ -760,8 +798,7 @@ was not set correctly. Alexey Starikovskiy, Bob Moore. 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 +debug version of the code includes the debug output trace mechanism and has a much larger code and data size. Previous Release: @@ -777,8 +814,7 @@ iASL: Implement limited typechecking for values returned from predefined control methods. The type of any returned static (unnamed) object is now validated. For example, Return(1). ACPICA BZ 786. -iASL: Fixed a predefined name object verification regression. Fixes a -problem +iASL: Fixed a predefined name object verification regression. Fixes a problem introduced in version 20100304. An error is incorrectly generated if a predefined name is declared as a static named object with a value defined using the keywords "Zero", "One", or "Ones". Lin Ming. @@ -797,25 +833,21 @@ Introduced in commit ae7d6fd: Properly handle externals with parent-prefix Fixed a possible problem with the AML Mutex handling function AcpiExReleaseMutex where the function could fault under the very rare -condition when the interpreter has blocked, the interpreter lock is -released, +condition when the interpreter has blocked, the interpreter lock is released, the interpreter is then reentered via the same thread, and attempts to -acquire an AML mutex that was previously acquired. FreeBSD report 140979. -Lin +acquire an AML mutex that was previously acquired. FreeBSD report 140979. Lin Ming. Implemented additional configuration support for the AML "Debug Object". Output from the debug object can now be enabled via a global variable, -AcpiGbl_EnableAmlDebugObject. This will assist with remote machine -debugging. +AcpiGbl_EnableAmlDebugObject. This will assist with remote machine debugging. This debug output is now available in the release version of ACPICA instead of just the debug version. Also, the entire debug output module can now be configured out of the ACPICA build if desired. One new file added, executer/exdebug.c. Lin Ming, Bob Moore. Added header support for the ACPI MCHI table (Management Controller Host -Interface Table). This table was added in ACPI 4.0, but the defining -document +Interface Table). This table was added in ACPI 4.0, but the defining document has only recently become available. Standardized output of integer values for ACPICA warnings/errors. Always use @@ -826,8 +858,7 @@ ACPI_DEBUG_PRINT invocations and were not consistent. ACPICA BZ 835. 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 +debug version of the code includes the debug output trace mechanism and has a much larger code and data size. Previous Release: @@ -842,8 +873,7 @@ much larger code and data size. iASL: Implemented typechecking support for static (non-control method) predefined named objects that are declared with the Name() operator. For example, the type of this object is now validated to be of type Integer: -Name(_BBN, 1). This change migrates the compiler to using the core -predefined +Name(_BBN, 1). This change migrates the compiler to using the core predefined name table instead of maintaining a local version. Added a new file, aslpredef.c. ACPICA BZ 832. @@ -858,20 +888,15 @@ Added the 2010 copyright to all module headers and signons. This affects virtually every file in the ACPICA core subsystem, the iASL compiler, the tools/utilities, and the test suites. -Implemented a change to the AcpiGetDevices interface to eliminate -unnecessary +Implemented a change to the AcpiGetDevices interface to eliminate unnecessary invocations of the _STA method. In the case where a specific _HID is requested, do not run _STA until a _HID match is found. This eliminates -potentially dozens of _STA calls during a search for a particular -device/HID, +potentially dozens of _STA calls during a search for a particular device/HID, which in turn can improve boot times. ACPICA BZ 828. Lin Ming. -Implemented an additional repair for predefined method return values. -Attempt -to repair unexpected NULL elements within returned Package objects. Create -an -Integer of value zero, a NULL String, or a zero-length Buffer as -appropriate. +Implemented an additional repair for predefined method return values. Attempt +to repair unexpected NULL elements within returned Package objects. Create an +Integer of value zero, a NULL String, or a zero-length Buffer as appropriate. ACPICA BZ 818. Lin Ming, Bob Moore. Removed the obsolete ACPI_INTEGER data type. This type was introduced as the @@ -883,16 +908,14 @@ for now for compatibility with existing device driver code. ACPICA BZ 824. Removed the unused UINT32_STRUCT type, and the obsolete Integer64 field in the parse tree object. -Added additional warning options for the gcc-4 generation. Updated the -source +Added additional warning options for the gcc-4 generation. Updated the source accordingly. This includes some code restructuring to eliminate unreachable code, elimination of some gotos, elimination of unused return values, some additional casting, and removal of redundant declarations. 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 +debug version of the code includes the debug output trace mechanism and has a much larger code and data size. Previous Release: @@ -914,12 +937,10 @@ No functional changes for this release. Enhanced automatic data type conversions for predefined name repairs. This change expands the automatic repairs/conversions for predefined name return values to make Integers, Strings, and Buffers fully interchangeable. Also, a -Buffer can be converted to a Package of Integers if necessary. The -nsrepair.c +Buffer can be converted to a Package of Integers if necessary. The nsrepair.c module was completely restructured. Lin Ming, Bob Moore. -Implemented automatic removal of null package elements during predefined -name +Implemented automatic removal of null package elements during predefined name repairs. This change will automatically remove embedded and trailing NULL package elements from returned package objects that are defined to contain a variable number of sub-packages. The driver is then presented with a package @@ -928,8 +949,7 @@ with no null elements to deal with. ACPICA BZ 819. Implemented a repair for the predefined _FDE and _GTM names. The expected return value for both names is a Buffer of 5 DWORDs. This repair fixes two possible problems (both seen in the field), where a package of integers is -returned, or a buffer of BYTEs is returned. With assistance from Jung-uk -Kim. +returned, or a buffer of BYTEs is returned. With assistance from Jung-uk Kim. Implemented additional module-level code support. This change will properly execute module-level code that is not at the root of the namespace (under a @@ -944,8 +964,7 @@ not been seen before. ACPICA BZ 826. Lin Ming, Bob Moore. Fixed a possible memory leak during module-level code execution. An object could be leaked for each block of executed module-level code if the -interpreter slack mode is enabled This change deletes any implicitly -returned +interpreter slack mode is enabled This change deletes any implicitly returned object from the module-level code block. Lin Ming. Removed messages for successful predefined repair(s). The repair mechanism @@ -955,8 +974,7 @@ repairs were converted to ACPI_DEBUG_PRINT messages for now. ACPICA BZ 827. 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 +debug version of the code includes the debug output trace mechanism and has a much larger code and data size. Previous Release: @@ -968,8 +986,7 @@ much larger code and data size. 2) iASL Compiler/Disassembler and Tools: -iASL: Fixed a regression introduced in 20091112 where intermediate .SRC -files +iASL: Fixed a regression introduced in 20091112 where intermediate .SRC files were no longer automatically removed at the termination of the compile. acpiexec: Implemented the -f option to specify default region fill value. @@ -995,23 +1012,19 @@ attributes. Such regions are probably BIOS bugs, and this is the workaround. Linux BZ 14445. Lin Ming. Implemented an automatic repair for predefined methods that must return -sorted lists. This change will repair (by sorting) packages returned by -_ALR, -_PSS, and _TSS. Drivers can now assume that the packages are correctly -sorted +sorted lists. This change will repair (by sorting) packages returned by _ALR, +_PSS, and _TSS. Drivers can now assume that the packages are correctly sorted and do not contain NULL package elements. Adds one new file, namespace/nsrepair2.c. ACPICA BZ 784. Lin Ming, Bob Moore. Fixed a possible fault during predefined name validation if a return Package object contains NULL elements. Also adds a warning if a NULL element is -followed by any non-null elements. ACPICA BZ 813, 814. Future enhancement -may +followed by any non-null elements. ACPICA BZ 813, 814. Future enhancement may include repair or removal of all such NULL elements where possible. Implemented additional module-level executable AML code support. This change will execute module-level code that is not at the root of the namespace -(under a Device object, etc.) at table load time. Module-level executable -AML +(under a Device object, etc.) at table load time. Module-level executable AML code has been illegal since ACPI 2.0. ACPICA BZ 762. Lin Ming. Implemented a new internal function to create Integer objects. This function @@ -1019,14 +1032,12 @@ simplifies miscellaneous object creation code. ACPICA BZ 823. Reduced the severity of predefined repair messages, Warning to Info. Since the object was successfully repaired, a warning is too severe. Reduced to an -info message for now. These messages may eventually be changed to debug- -only. +info message for now. These messages may eventually be changed to debug-only. ACPICA BZ 812. 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 +debug version of the code includes the debug output trace mechanism and has a much larger code and data size. Previous Release: @@ -1048,12 +1059,10 @@ exists, but is shorter than the declared length of the package. Although technically legal, this is probably a coding error and it is seen in the field. ACPICA BZ 815. Lin Ming, Bob Moore. -iASL: Fixed a problem where the compiler could fault after the maximum -number +iASL: Fixed a problem where the compiler could fault after the maximum number of errors was reached (200). -acpixtract: Fixed a possible warning for pointer cast if the compiler -warning +acpixtract: Fixed a possible warning for pointer cast if the compiler warning level set very high. ---------------------------------------- @@ -1073,8 +1082,7 @@ operand object was leaked. Lin Ming. Implemented a run-time repair for the _MAT predefined method. If the _MAT return value is defined as a Field object in the AML, and the field -size is less than or equal to the default width of an integer (32 or -64),_MAT +size is less than or equal to the default width of an integer (32 or 64),_MAT can incorrectly return an Integer instead of a Buffer. ACPICA now automatically repairs this problem. ACPICA BZ 810. @@ -1087,8 +1095,7 @@ within the returned Package. ACPICA BZ 807. 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 +debug version of the code includes the debug output trace mechanism and has a much larger code and data size. Previous Release: @@ -1131,10 +1138,8 @@ 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 +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. @@ -1154,8 +1159,7 @@ 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 +debug version of the code includes the debug output trace mechanism and has a much larger code and data size. Previous Release: @@ -1205,17 +1209,13 @@ EINJ, ERST, and HEST. Other newly supported tables are: UEFI and WDAT. There have been some ACPI 4.0 changes to other existing tables. Split the large actbl1.h header into the existing actbl2.h header. ACPICA BZ 774. -ACPI 4.0: Implemented predefined name validation for all new names. There -are -31 new names in ACPI 4.0. The predefined validation module was split into -two +ACPI 4.0: Implemented predefined name validation for all new names. There are +31 new names in ACPI 4.0. The predefined validation module was split into two files. The new file is namespace/nsrepair.c. ACPICA BZ 770. Implemented support for so-called "module-level executable code". This is -executable AML code that exists outside of any control method and is -intended -to be executed at table load time. Although illegal since ACPI 2.0, this -type +executable AML code that exists outside of any control method and is intended +to be executed at table load time. Although illegal since ACPI 2.0, this type of code still exists and is apparently still being created. Blocks of this code are now detected and executed as intended. Currently, the code blocks must exist under either an If, Else, or While construct; these are the @@ -1231,8 +1231,7 @@ be repaired: _ALR, _CSD, _HPX, _MLS, _PRT, _PSS, _TRT, and _TSS. ACPICA BZ 790. Fixed a regression introduced in 20090625 for the AcpiGetDevices interface. -The _HID/_CID matching was broken and no longer matched IDs correctly. -ACPICA +The _HID/_CID matching was broken and no longer matched IDs correctly. ACPICA BZ 793. Fixed a problem with AcpiReset where the reset would silently fail if the @@ -1246,14 +1245,12 @@ does not exist during an attempt to write the Bus Master Arbitration bit. (However, some hosts already delete the code that writes this bit, and the code may in fact be obsolete at this date.) ACPICA BZ 799. -Fixed a problem where AcpiTerminate could fault if inadvertently called -twice +Fixed a problem where AcpiTerminate could fault if inadvertently called twice in succession. ACPICA BZ 795. 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 +debug version of the code includes the debug output trace mechanism and has a much larger code and data size. Previous Release: @@ -1298,8 +1295,7 @@ been added - utilities/utids.c. ACPICA BZ 368, 780. Updated the AcpiRead and AcpiWrite external interfaces to support 64-bit transfers. The Value parameter has been extended from 32 bits to 64 bits in -order to support new ACPI 4.0 tables. These changes will require an update -to +order to support new ACPI 4.0 tables. These changes will require an update to all callers of these interfaces. See the ACPICA Programmer Reference for details. ACPICA BZ 768. @@ -1327,8 +1323,7 @@ tree head. ACPICA BZ 776. 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 +debug version of the code includes the debug output trace mechanism and has a much larger code and data size. Previous Release: @@ -1352,8 +1347,7 @@ predefined names and control methods (31 total). ACPICA BZ 769. 1) ACPI CA Core Subsystem: Disabled the preservation of the SCI enable bit in the PM1 control register. -The SCI enable bit (bit 0, SCI_EN) is defined by the ACPI specification to -be +The SCI enable bit (bit 0, SCI_EN) is defined by the ACPI specification to be a "preserved" bit - "OSPM always preserves this bit position", section 4.7.3.2.1. However, some machines fail if this bit is in fact preserved because the bit needs to be explicitly set by the OS as a workaround. No @@ -1365,8 +1359,7 @@ incorrectly formed _PRT package could cause a fault. Added validation to ensure that each package element is actually a sub-package. Implemented a new interface to install or override a single control method, -AcpiInstallMethod. This interface is useful when debugging in order to -repair +AcpiInstallMethod. This interface is useful when debugging in order to repair an existing method or to install a missing method without having to override the entire ACPI table. See the ACPICA Programmer Reference for use and examples. Lin Ming, Bob Moore. @@ -1380,8 +1373,7 @@ caller. Lin Ming. Fixed a problem with Mutex Sync Levels. Fixed a problem where if multiple mutexes of the same sync level are acquired but then not released in strict -opposite order, the internally maintained Current Sync Level becomes -confused +opposite order, the internally maintained Current Sync Level becomes confused and can cause subsequent execution errors. ACPICA BZ 471. Changed the allowable release order for ASL mutex objects. The ACPI 4.0 @@ -1404,8 +1396,7 @@ and reduced code for this frequently used function. 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 +debug version of the code includes the debug output trace mechanism and has a much larger code and data size. Previous Release: @@ -1430,12 +1421,10 @@ Fixed a compatibility issue with the recently released I/O port protection mechanism. For windows compatibility, 1) On a port protection violation, simply ignore the request and do not return an exception (allow the control method to continue execution.) 2) If only part of the request overlaps a -protected port, read/write the individual ports that are not protected. -Linux +protected port, read/write the individual ports that are not protected. Linux BZ 13036. Lin Ming -Enhanced the execution of the ASL/AML BreakPoint operator so that it -actually +Enhanced the execution of the ASL/AML BreakPoint operator so that it actually breaks into the AML debugger if the debugger is present. This matches the ACPI-defined behavior. @@ -1448,14 +1437,12 @@ ACPICA BZ 766, 767. Fixed a number of possible warnings when compiling with gcc 4+ (depending on warning options.) Examples include printf formats, aliasing, unused globals, missing prototypes, missing switch default statements, use of non-ANSI -library functions, use of non-ANSI constructs. See generate/unix/Makefile -for +library functions, use of non-ANSI constructs. See generate/unix/Makefile for a list of warning options used with gcc 3 and 4. ACPICA BZ 735. 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 +debug version of the code includes the debug output trace mechanism and has a much larger code and data size. Previous Release: @@ -1467,12 +1454,10 @@ much larger code and data size. 2) iASL Compiler/Disassembler and Tools: -iASL: Fixed a generation warning from Bison 2.3 and fixed several warnings -on +iASL: Fixed a generation warning from Bison 2.3 and fixed several warnings on the 64-bit build. -iASL: Fixed a problem where the Unix/Linux versions of the compiler could -not +iASL: Fixed a problem where the Unix/Linux versions of the compiler could not correctly digest Windows/DOS formatted files (with CR/LF). iASL: Added a new option for "quiet mode" (-va) that produces only the @@ -1500,10 +1485,8 @@ execute fully on Cygwin. 1) ACPI CA Core Subsystem: Fixed a possible race condition between AcpiWalkNamespace and dynamic table -unloads. Added a reader/writer locking mechanism to allow multiple -concurrent -namespace walks (readers), but block a dynamic table unload until it can -gain +unloads. Added a reader/writer locking mechanism to allow multiple concurrent +namespace walks (readers), but block a dynamic table unload until it can gain exclusive write access to the namespace. This fixes a problem where a table unload could (possibly catastrophically) delete the portion of the namespace that is currently being examined by a walk. Adds a new file, utlock.c, that @@ -1537,8 +1520,7 @@ performed on a per-field basis instead of the entire region. Modified the handling of the PM1 Status Register ignored bit (bit 11.) Ignored bits must be "preserved" according to the ACPI spec. Usually, this means a read/modify/write when writing to the register. However, for status -registers, writing a one means clear the event. Writing a zero means -preserve +registers, writing a one means clear the event. Writing a zero means preserve the event (do not clear.) This behavior is clarified in the ACPI 4.0 spec, and the ACPICA code now simply always writes a zero to the ignored bit. @@ -1578,8 +1560,7 @@ AcpiGetRegisterUnlocked function is no longer needed and has been removed. This will improve performance for reads on these registers. ACPICA BZ 760. Fixed the parameter validation for AcpiRead/Write. Now return -AE_BAD_PARAMETER if the input register pointer is null, and AE_BAD_ADDRESS -if +AE_BAD_PARAMETER if the input register pointer is null, and AE_BAD_ADDRESS if the register has an address of zero. Previously, these cases simply returned AE_OK. For optional registers such as PM1B status/enable/control, the caller should check for a valid register address before calling. ACPICA BZ 748. @@ -1592,33 +1573,27 @@ and condensing duplicate code to reduce code size. Added new functions to transparently handle the possibly split PM1 A/B registers. AcpiHwReadMultiple and AcpiHwWriteMultiple. These two functions -now handle the split registers for PM1 Status, Enable, and Control. ACPICA -BZ +now handle the split registers for PM1 Status, Enable, and Control. ACPICA BZ 746. Added a function to handle the PM1 control registers, AcpiHwWritePm1Control. -This function writes both of the PM1 control registers (A/B). These -registers +This function writes both of the PM1 control registers (A/B). These registers are different than the PM1 A/B status and enable registers in that different values can be written to the A/B registers. Most notably, the SLP_TYP bits -can be different, as per the values returned from the _Sx predefined -methods. +can be different, as per the values returned from the _Sx predefined methods. Removed an extra register write within AcpiHwClearAcpiStatus. This function was writing an optional PM1B status register twice. The existing call to the low-level AcpiHwRegisterWrite automatically handles a possibly split PM1 A/B register. ACPICA BZ 751. -Split out the PM1 Status registers from the FADT. Added new globals for -these +Split out the PM1 Status registers from the FADT. Added new globals for these registers (A/B), similar to the way the PM1 Enable registers are handled. Instead of overloading the FADT Event Register blocks. This makes the code clearer and less prone to error. -Fixed the warning message for when the platform contains too many ACPI -tables -for the default size of the global root table data structure. The -calculation +Fixed the warning message for when the platform contains too many ACPI tables +for the default size of the global root table data structure. The calculation for the truncation value was incorrect. Removed the ACPI_GET_OBJECT_TYPE macro. Removed all instances of this @@ -1633,15 +1608,13 @@ Conditionally compile the AcpiSetFirmwareWakingVector64 function. This function is only needed on 64-bit host operating systems and is thus not included for 32-bit hosts. -Debug output: print the input and result for invocations of the _OSI -reserved +Debug output: print the input and result for invocations of the _OSI reserved control method via the ACPI_LV_INFO debug level. Also, reduced some of the verbosity of this debug level. Len Brown. 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 +debug version of the code includes the debug output trace mechanism and has a much larger code and data size. Previous Release: @@ -1666,8 +1639,7 @@ virtually every file in the ACPICA core subsystem, the iASL compiler, and the tools/utilities. Implemented a change to allow the host to override any ACPI table, including -dynamically loaded tables. Previously, only the DSDT could be replaced by -the +dynamically loaded tables. Previously, only the DSDT could be replaced by the host. With this change, the AcpiOsTableOverride interface is called for each table found in the RSDT/XSDT during ACPICA initialization, and also whenever a table is dynamically loaded via the AML Load operator. @@ -1680,8 +1652,7 @@ with the actual namespace entry which is itself padded with underscores. 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 +debug version of the code includes the debug output trace mechanism and has a much larger code and data size. Previous Release: @@ -1727,8 +1698,7 @@ file, components/hardware/hwxface.c Enhanced the FADT parsing and low-level ACPI register access: The ACPI register lengths within the FADT are now used, and the low level ACPI register access no longer hardcodes the ACPI register lengths. Given that -there may be some risk in actually trusting the FADT register lengths, a -run- +there may be some risk in actually trusting the FADT register lengths, a run- time option was added to fall back to the default hardcoded lengths if the FADT proves to contain incorrect values - UseDefaultRegisterWidths. This option is set to true for now, and a warning is issued if a suspicious FADT @@ -1741,14 +1711,12 @@ Packages. Lin Ming. Added semaphore support to the Linux/Unix application OS-services layer (OSL). ACPICA BZ 448. Lin Ming. -Added the ACPI_MUTEX_TYPE configuration option to select whether mutexes -will +Added the ACPI_MUTEX_TYPE configuration option to select whether mutexes will be implemented in the OSL, or will binary semaphores be used instead. 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 +debug version of the code includes the debug output trace mechanism and has a much larger code and data size. Previous Release: @@ -1760,8 +1728,7 @@ much larger code and data size. 2) iASL Compiler/Disassembler and Tools: -iASL: Completed the '-e' option to include additional ACPI tables in order -to +iASL: Completed the '-e' option to include additional ACPI tables in order to aid with disassembly and External statement generation. ACPICA BZ 742. Lin Ming. @@ -1778,8 +1745,7 @@ Disassembler: Updates for several ACPI data tables (HEST, EINJ, and MCFG). 1) ACPI CA Core Subsystem: -Restructured the ACPICA header files into public/private. acpi.h now -includes +Restructured the ACPICA header files into public/private. acpi.h now includes only the "public" acpica headers. All other acpica headers are "private" and should not be included by acpica users. One new file, accommon.h is used to include the commonly used private headers for acpica code generation. Future @@ -1796,8 +1762,7 @@ with a valid null-terminated string. Linux BZ 11822. Updated the FACS waking vector interfaces. Split AcpiSetFirmwareWakingVector into two: one for the 32-bit vector, another for the 64-bit vector. This is required because the host OS must setup the wake much differently for each -vector (real vs. protected mode, etc.) and the interface itself should not -be +vector (real vs. protected mode, etc.) and the interface itself should not be deciding which vector to use. Also, eliminated the GetFirmwareWakingVector interface, as it served no purpose (only the firmware reads the vector, OS only writes the vector.) ACPICA BZ 731. @@ -1838,15 +1803,13 @@ handler installation, and calling a control method. Available at source/tools/examples. Added a global pointer for FACS table to simplify internal FACS access. Use -the global pointer instead of using AcpiGetTableByIndex for each FACS -access. +the global pointer instead of using AcpiGetTableByIndex for each FACS access. This simplifies the code for the Global Lock and the Firmware Waking Vector(s). 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 +debug version of the code includes the debug output trace mechanism and has a much larger code and data size. Previous Release: @@ -1859,8 +1822,7 @@ much larger code and data size. 2) iASL Compiler/Disassembler and Tools: iASL: Improved disassembly of external method calls. Added the -e option to -allow the inclusion of additional ACPI tables to help with the disassembly -of +allow the inclusion of additional ACPI tables to help with the disassembly of method invocations and the generation of external declarations during the disassembly. Certain external method invocations cannot be disassembled properly without the actual declaration of the method. Use the -e option to @@ -1880,14 +1842,12 @@ references from the Alias operator itself. ACPICA BZ 738. 1) ACPI CA Core Subsystem: Designed and implemented a mechanism to validate predefined ACPI methods and -objects. This code validates the predefined ACPI objects (objects whose -names +objects. This code validates the predefined ACPI objects (objects whose names start with underscore) that appear in the namespace, at the time they are evaluated. The argument count and the type of the returned object are validated against the ACPI specification. The purpose of this validation is to detect problems with the BIOS-implemented predefined ACPI objects before -the results are returned to the ACPI-related drivers. Future enhancements -may +the results are returned to the ACPI-related drivers. Future enhancements may include actual repair of incorrect return objects where possible. Two new files are nspredef.c and acpredef.h. @@ -1909,8 +1869,7 @@ similar in that they use a stack of state objects in order to eliminate recursion. The stack must be fully unwound and deallocated if an error occurs. Lin Ming. ACPICA BZ 383. -Removed the unused ACPI_BITREG_WAKE_ENABLE definition and entry in the -global +Removed the unused ACPI_BITREG_WAKE_ENABLE definition and entry in the global ACPI register table. This bit does not exist and is unused. Lin Ming, Bob Moore ACPICA BZ 442. @@ -1921,8 +1880,7 @@ only incorrect, it could also be misleading. 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 +debug version of the code includes the debug output trace mechanism and has a much larger code and data size. Previous Release: @@ -1940,22 +1898,18 @@ much larger code and data size. Completed a major cleanup of the internal ACPI_OPERAND_OBJECT of type Reference. Changes include the elimination of cheating on the Object field for the DdbHandle subtype, addition of a reference class field to -differentiate the various reference types (instead of an AML opcode), and -the +differentiate the various reference types (instead of an AML opcode), and the cleanup of debug output for this object. Lin Ming, Bob Moore. BZ 723 Reduce an error to a warning for an incorrect method argument count. Previously aborted with an error if too few arguments were passed to a -control method via the external ACPICA interface. Now issue a warning -instead +control method via the external ACPICA interface. Now issue a warning instead and continue. Handles the case where the method inadvertently declares too many arguments, but does not actually use the extra ones. Applies mainly to the predefined methods. Lin Ming. Linux BZ 11032. -Disallow the evaluation of named object types with no intrinsic value. -Return -AE_TYPE for objects that have no value and therefore evaluation is -undefined: +Disallow the evaluation of named object types with no intrinsic value. Return +AE_TYPE for objects that have no value and therefore evaluation is undefined: Device, Event, Mutex, Region, Thermal, and Scope. Previously, evaluation of these types were allowed, but an exception would be generated at some point during the evaluation. Now, the error is generated up front. @@ -1963,10 +1917,8 @@ during the evaluation. Now, the error is generated up front. Fixed a possible memory leak in the AcpiNsGetExternalPathname function (nsnames.c). Fixes a leak in the error exit path. -Removed the obsolete debug levels ACPI_DB_WARN and ACPI_DB_ERROR. These -debug -levels were made obsolete by the ACPI_WARNING, ACPI_ERROR, and -ACPI_EXCEPTION +Removed the obsolete debug levels ACPI_DB_WARN and ACPI_DB_ERROR. These debug +levels were made obsolete by the ACPI_WARNING, ACPI_ERROR, and ACPI_EXCEPTION interfaces. Also added ACPI_DB_EVENTS to correspond with the existing ACPI_LV_EVENTS. @@ -1980,8 +1932,7 @@ compiler reference, and the changes.txt release logfile. 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 +debug version of the code includes the debug output trace mechanism and has a much larger code and data size. Previous Release: @@ -2014,14 +1965,12 @@ header. 1) ACPI CA Core Subsystem: Fix a possible deadlock in the GPE dispatch. Remove call to -AcpiHwDisableAllGpes during wake in AcpiEvGpeDispatch. This call will -attempt +AcpiHwDisableAllGpes during wake in AcpiEvGpeDispatch. This call will attempt to acquire the GPE lock but can deadlock since the GPE lock is already held at dispatch time. This code was introduced in version 20060831 as a response to Linux BZ 6881 and has since been removed from Linux. -Add a function to dereference returned reference objects. Examines the -return +Add a function to dereference returned reference objects. Examines the return object from a call to AcpiEvaluateObject. Any Index or RefOf references are automatically dereferenced in an attempt to return something useful (these reference types cannot be converted into an external ACPI_OBJECT.) Provides @@ -2044,16 +1993,13 @@ The function could possibly fail when the caches are initialized. Yang Yi. Add a function to decode reference object types to strings. Created for improved error messages. -Improve object conversion error messages. Better error messages during -object -conversion from internal to the external ACPI_OBJECT. Used for external -calls +Improve object conversion error messages. Better error messages during object +conversion from internal to the external ACPI_OBJECT. Used for external calls to AcpiEvaluateObject. 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 +debug version of the code includes the debug output trace mechanism and has a much larger code and data size. Previous Release: @@ -2075,19 +2021,16 @@ appear in a disassembled ASL file if they were emitted by the original compiler. Instead of issuing an error or warning and forcing the user to manually change these names, issue a remark instead. -iASL: error if named object created in while loop. Emit an error if any -named +iASL: error if named object created in while loop. Emit an error if any named object is created within a While loop. If allowed, this code will generate a -run-time error on the second iteration of the loop when an attempt is made -to +run-time error on the second iteration of the loop when an attempt is made to create the same named object twice. ACPICA bugzilla 730. iASL: Support absolute pathnames for include files. Add support for absolute pathnames within the Include operator. previously, only relative pathnames were supported. -iASL: Enforce minimum 1 interrupt in interrupt macro and Resource -Descriptor. +iASL: Enforce minimum 1 interrupt in interrupt macro and Resource Descriptor. The ACPI spec requires one interrupt minimum. BZ 423 iASL: Handle a missing ResourceSource arg, with a present SourceIndex. @@ -2099,11 +2042,9 @@ iASL: Prevent error message if CondRefOf target does not exist. Fixes cases where an error message is emitted if the target does not exist. BZ 516 iASL: Fix broken -g option (get Windows ACPI tables). Fixes the -g option -(get ACPI tables on Windows). This was apparently broken in version -20070919. +(get ACPI tables on Windows). This was apparently broken in version 20070919. -AcpiXtract: Handle EOF while extracting data. Correctly handle the case -where +AcpiXtract: Handle EOF while extracting data. Correctly handle the case where the EOF happens immediately after the last table in the input file. Print completion message. Previously, no message was displayed in this case. @@ -2120,8 +2061,7 @@ source tree. Implemented a "careful" GPE disable in AcpiEvDisableGpe, only modify one enable bit. Now performs a read-change-write of the enable register instead of simply writing out the cached enable mask. This will prevent inadvertent -enabling of GPEs if a rogue GPE is received during initialization (before -GPE +enabling of GPEs if a rogue GPE is received during initialization (before GPE handlers are installed.) Implemented a copy for dynamically loaded tables. Previously, dynamically @@ -2131,12 +2071,10 @@ OpRegion case, added checksum verify. Use the table length from the table header, not the region length. For the Buffer case, use the table length also. Dennis Noordsij, Bob Moore. BZ 10734 -Fixed a problem where the same ACPI table could not be dynamically loaded -and +Fixed a problem where the same ACPI table could not be dynamically loaded and unloaded more than once. Without this change, a table cannot be loaded again once it has been loaded/unloaded one time. The current mechanism does not -unregister a table upon an unload. During a load, if the same table is -found, +unregister a table upon an unload. During a load, if the same table is found, this no longer returns an exception. BZ 722 Fixed a problem where the wrong descriptor length was calculated for the @@ -2146,8 +2084,7 @@ descriptor is 16 because of the round-up to 8 on the 64-bit build. Reported by Linn Crosetto. BZ 728 Fixed a possible memory leak in the Unload operator. The DdbHandle returned -by Load() did not have its reference count decremented during unload, -leading +by Load() did not have its reference count decremented during unload, leading to a memory leak. Lin Ming. BZ 727 Fixed a possible memory leak when deleting thermal/processor objects. Any @@ -2155,8 +2092,7 @@ associated notify handlers (and objects) were not being deleted. Fiodor Suietov. BZ 506 Fixed the ordering of the ASCII names in the global mutex table to match the -actual mutex IDs. Used by AcpiUtGetMutexName, a function used for debug -only. +actual mutex IDs. Used by AcpiUtGetMutexName, a function used for debug only. Vegard Nossum. BZ 726 Enhanced the AcpiGetObjectInfo interface to return the number of required @@ -2171,8 +2107,7 @@ Fixed an extraneous warning from exconfig.c on the 64-bit build. 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 +debug version of the code includes the debug output trace mechanism and has a much larger code and data size. Previous Release: @@ -2187,8 +2122,7 @@ much larger code and data size. iASL: Added two missing ACPI reserved names. Added _MTP and _ASZ, both resource descriptor names. -iASL: Detect invalid ASCII characters in input (windows version). Removed -the +iASL: Detect invalid ASCII characters in input (windows version). Removed the "-CF" flag from the flex compile, enables correct detection of non-ASCII characters in the input. BZ 441 @@ -2196,12 +2130,9 @@ iASL: Eliminate warning when result of LoadTable is not used. Eliminate the "result of operation not used" warning when the DDB handle returned from LoadTable is not used. The warning is not needed. BZ 590 -AcpiExec: Add support for dynamic table load/unload. Now calls _CFG method -to -pass address of table to the AML. Added option to disable OpRegion -simulation -to allow creation of an OpRegion with a real address that was passed to -_CFG. +AcpiExec: Add support for dynamic table load/unload. Now calls _CFG method to +pass address of table to the AML. Added option to disable OpRegion simulation +to allow creation of an OpRegion with a real address that was passed to _CFG. All of this allows testing of the Load and Unload operators from AcpiExec. Debugger: update tables command for unloaded tables. Handle unloaded tables @@ -2221,12 +2152,10 @@ Simplified the internal ACPI hardware interfaces to eliminate the locking flag parameter from Register Read/Write. Added a new external interface, AcpiGetRegisterUnlocked. -Fixed a problem where the invocation of a GPE control method could hang. -This +Fixed a problem where the invocation of a GPE control method could hang. This was a regression introduced in 20080514. The new method argument count validation mechanism can enter an infinite loop when a GPE method is -dispatched. Problem fixed by removing the obsolete code that passed GPE -block +dispatched. Problem fixed by removing the obsolete code that passed GPE block information to the notify handler via the control method parameter pointer. Fixed a problem where the _SST execution status was incorrectly returned to @@ -2235,8 +2164,7 @@ the caller of AcpiEnterSleepStatePrep. This was a regression introduced in returned. BZ 716 Fixed a problem where a deleted object could be accessed from within the AML -parser. This was a regression introduced in version 20080123 as a fix for -the +parser. This was a regression introduced in version 20080123 as a fix for the Unload operator. Lin Ming. BZ 10669 Cleaned up the debug operand dump mechanism. Eliminated unnecessary operands @@ -2257,8 +2185,7 @@ one mutex. Linn Crosetto 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 +debug version of the code includes the debug output trace mechanism and has a much larger code and data size. Previous Release: @@ -2299,25 +2226,20 @@ the GPE, even if ACPICA thinks that that it is already disabled. It is possible that the AML or some other code has enabled the GPE unbeknownst to the ACPICA code. -Fixed a problem with the Field operator where zero-length fields would -return -an AE_AML_NO_OPERAND exception during table load. Fix enables zero-length -ASL +Fixed a problem with the Field operator where zero-length fields would return +an AE_AML_NO_OPERAND exception during table load. Fix enables zero-length ASL field declarations in Field(), BankField(), and IndexField(). BZ 10606. Implemented a fix for the Load operator, now load the table at the namespace root. This reverts a change introduced in version 20071019. The table is now loaded at the namespace root even though this goes against the ACPI specification. This provides compatibility with other ACPI implementations. -The ACPI specification will be updated to reflect this in ACPI 4.0. Lin -Ming. +The ACPI specification will be updated to reflect this in ACPI 4.0. Lin Ming. -Fixed a problem where ACPICA would not Load() tables with unusual -signatures. +Fixed a problem where ACPICA would not Load() tables with unusual signatures. Now ignore ACPI table signature for Load() operator. Only "SSDT" is acceptable to the ACPI spec, but tables are seen with OEMx and null sigs. -Therefore, signature validation is worthless. Apparently MS ACPI accepts -such +Therefore, signature validation is worthless. Apparently MS ACPI accepts such signatures, ACPICA must be compatible. BZ 10454. Fixed a possible negative array index in AcpiUtValidateException. Added NULL @@ -2334,10 +2256,8 @@ many. This applies only to extern programmatic control method execution, not method-to-method calls within the AML. Lin Ming. Eliminated the ACPI_NATIVE_UINT type across all ACPICA code. This type is no -longer needed, especially with the removal of 16-bit support. It was -replaced -mostly with UINT32, but also ACPI_SIZE where a type that changes 32/64 bit -on +longer needed, especially with the removal of 16-bit support. It was replaced +mostly with UINT32, but also ACPI_SIZE where a type that changes 32/64 bit on 32/64-bit platforms is required. Added the C const qualifier for appropriate string constants -- mostly @@ -2345,8 +2265,7 @@ MODULE_NAME and printf format strings. Jan Beulich. 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 +debug version of the code includes the debug output trace mechanism and has a much larger code and data size. Previous Release: @@ -2370,8 +2289,7 @@ means 32-bit and this is unusual. 2 or greater is 64-bit. Implemented an additional change to the GPE support in order to suppress spurious or stray GPEs. The AcpiEvDisableGpe function will now permanently disable incoming GPEs that are neither enabled nor disabled -- meaning that -the GPE is unknown to the system. This should prevent future interrupt -floods +the GPE is unknown to the system. This should prevent future interrupt floods from that GPE. BZ 6217 (Zhang Rui) Fixed a problem where NULL package elements were not returned to the @@ -2380,8 +2298,7 @@ instead of returning a NULL ACPI_OBJECT package element, potentially causing a buffer overflow and/or confusing the caller who expected a fixed number of elements. BZ 10132 (Lin Ming, Bob Moore) -Fixed a problem with the CreateField, CreateXXXField (Bit, Byte, Word, -Dword, +Fixed a problem with the CreateField, CreateXXXField (Bit, Byte, Word, Dword, Qword), Field, BankField, and IndexField operators when invoked from inside an executing control method. In this case, these operators created namespace nodes that were incorrectly left marked as permanent nodes instead of @@ -2393,23 +2310,20 @@ Fixed a problem where the CreateField and CreateXXXField operators would incorrectly allow duplicate names (the name of the field) with no exception generated. -Implemented several changes for Notify handling. Added support for new -Notify +Implemented several changes for Notify handling. Added support for new Notify values (ACPI 2.0+) and improved the Notify debug output. Notify on PowerResource objects is no longer allowed, as per the ACPI specification. (Bob Moore, Zhang Rui) All Reference Objects returned via the AcpiEvaluateObject interface are now -marked as type "REFERENCE" instead of "ANY". The type ANY is now reserved -for +marked as type "REFERENCE" instead of "ANY". The type ANY is now reserved for NULL objects - either NULL package elements or unresolved named references. Fixed a problem where an extraneous debug message was produced for package objects (when debugging enabled). The message "Package List length larger than NumElements count" is now produced in the correct case, and is now an error message rather than a debug message. Added a debug message for the -opposite case, where NumElements is larger than the Package List (the -package +opposite case, where NumElements is larger than the Package List (the package will be padded out with NULL elements as per the ACPI spec.) Implemented several improvements for the output of the ASL "Debug" object to @@ -2447,8 +2361,7 @@ uses Switch as Serialized, thus preventing multiple thread entries. BZ 469. Implemented another MS compatibility design change for GPE/Notify handling. GPEs are now cleared/enabled asynchronously to allow all pending notifies to complete first. It is expected that the OSL will queue the enable request -behind all pending notify requests (may require changes to the local host -OSL +behind all pending notify requests (may require changes to the local host OSL in AcpiOsExecute). Alexey Starikovskiy. Fixed a problem where buffer and package objects passed as arguments to a @@ -2463,10 +2376,8 @@ returned from _CRS. This change affects the following resource descriptors: IRQ / IRQNoFlags and StartDependendentFn / StartDependentFnNoPri. (BZ 9487) Fixed a problem where a CopyObject to RegionField, BankField, and IndexField -objects did not perform an implicit conversion as it should. These types -must -retain their initial type permanently as per the ACPI specification. -However, +objects did not perform an implicit conversion as it should. These types must +retain their initial type permanently as per the ACPI specification. However, a CopyObject to all other object types should not perform an implicit conversion, as per the ACPI specification. (Lin Ming, Bob Moore) BZ 388 @@ -2474,8 +2385,7 @@ Fixed a problem with the AcpiGetDevices interface where the mechanism to match device CIDs did not examine the entire list of available CIDs, but instead aborted on the first non-matching CID. Andrew Patterson. -Fixed a regression introduced in version 20071114. The ACPI_HIDWORD macro -was +Fixed a regression introduced in version 20071114. The ACPI_HIDWORD macro was inadvertently changed to return a 16-bit value instead of a 32-bit value, truncating the upper dword of a 64-bit value. This macro is only used to display debug output, so no incorrect calculations were made. Also, @@ -2515,24 +2425,19 @@ the tools/utilities. Fixed a problem with the SizeOf operator when used with Package and Buffer objects. These objects have deferred execution for some arguments, and the -execution is now completed before the SizeOf is executed. This problem -caused +execution is now completed before the SizeOf is executed. This problem caused unexpected AE_PACKAGE_LIMIT errors on some systems (Lin Ming, Bob Moore) BZ 9558 -Implemented an enhancement to the interpreter "slack mode". In the absence -of +Implemented an enhancement to the interpreter "slack mode". In the absence of an explicit return or an implicitly returned object from the last executed -opcode, a control method will now implicitly return an integer of value 0 -for +opcode, a control method will now implicitly return an integer of value 0 for Microsoft compatibility. (Lin Ming) BZ 392 -Fixed a problem with the Load operator where an exception was not returned -in +Fixed a problem with the Load operator where an exception was not returned in the case where the table is already loaded. (Lin Ming) BZ 463 -Implemented support for the use of DDBHandles as an Indexed Reference, as -per +Implemented support for the use of DDBHandles as an Indexed Reference, as per the ACPI spec. (Lin Ming) BZ 486 Implemented support for UserTerm (Method invocation) for the Unload operator @@ -2545,8 +2450,7 @@ maximum lengths allowed. (Lin Ming, Bob Moore) BZ 576 Implemented support for UserTerm (Method invocation) for the Unload operator as per the ACPI spec. (Lin Ming) BZ 580 -Implemented header file support for new ACPI tables - BERT, ERST, EINJ, -HEST, +Implemented header file support for new ACPI tables - BERT, ERST, EINJ, HEST, IBFT, UEFI, WDAT. Disassembler support is forthcoming. Example Code and Data Size: These are the sizes for the OS-independent @@ -2564,8 +2468,7 @@ a much larger code and data size. 2) iASL Compiler/Disassembler and Tools: Implemented support in the disassembler for checksum validation on incoming -binary DSDTs and SSDTs. If incorrect, a message is displayed within the -table +binary DSDTs and SSDTs. If incorrect, a message is displayed within the table header dump at the start of the disassembly. Implemented additional debugging information in the namespace listing file @@ -2592,8 +2495,7 @@ Ming) BZ 583,587 Implemented full support for deferred execution for the TermArg string arguments for DataTableRegion. This enables forward references and full -operand resolution for the three string arguments. Similar to -OperationRegion +operand resolution for the three string arguments. Similar to OperationRegion deferred argument execution.) Lin Ming. BZ 430 Implemented full argument resolution support for the BankValue argument to @@ -2608,8 +2510,7 @@ Zhao. Fixed a problem where "unknown" GPEs could be allowed to fire repeatedly if the underlying AML code changed the GPE enable registers. Now, any unknown -incoming GPE (no _Lxx/_Exx method and not the EC GPE) is immediately -disabled +incoming GPE (no _Lxx/_Exx method and not the EC GPE) is immediately disabled instead of simply ignored. Rui Zhang. Fixed a problem with Index Fields where the Index register was incorrectly diff --git a/sys/contrib/dev/acpica/common/dmtable.c b/sys/contrib/dev/acpica/common/dmtable.c index ba9ae64..a8c48a2 100644 --- a/sys/contrib/dev/acpica/common/dmtable.c +++ b/sys/contrib/dev/acpica/common/dmtable.c @@ -62,6 +62,13 @@ AcpiDmCheckAscii ( UINT32 Count); +/* Common format strings for commented values */ + +#define UINT8_FORMAT "%2.2X [%s]\n" +#define UINT16_FORMAT "%4.4X [%s]\n" +#define UINT32_FORMAT "%8.8X [%s]\n" +#define STRING_FORMAT "[%s]\n" + /* These tables map a subtable type to a description string */ static const char *AcpiDmAsfSubnames[] = @@ -497,7 +504,14 @@ AcpiDmLineHeader ( } else { - AcpiOsPrintf ("%41s : ", Name); + if (*Name) + { + AcpiOsPrintf ("%41s : ", Name); + } + else + { + AcpiOsPrintf ("%41s ", Name); + } } } else /* Normal disassembler or verbose template */ @@ -509,7 +523,14 @@ AcpiDmLineHeader ( } else { - AcpiOsPrintf ("%44s : ", Name); + if (*Name) + { + AcpiOsPrintf ("%44s : ", Name); + } + else + { + AcpiOsPrintf ("%44s ", Name); + } } } } @@ -526,7 +547,7 @@ AcpiDmLineHeader2 ( { if (ByteLength) { - AcpiOsPrintf ("[%.3d] %30s % 3d : ", + AcpiOsPrintf ("[%.4d] %30s %3d : ", ByteLength, Name, Value); } else @@ -539,12 +560,12 @@ AcpiDmLineHeader2 ( { if (ByteLength) { - AcpiOsPrintf ("[%3.3Xh %4.4d% 3d] %24s % 3d : ", + AcpiOsPrintf ("[%3.3Xh %4.4d %3d] %24s %3d : ", Offset, Offset, ByteLength, Name, Value); } else { - AcpiOsPrintf ("[%3.3Xh %4.4d ] %24s % 3d : ", + AcpiOsPrintf ("[%3.3Xh %4.4d ] %24s %3d : ", Offset, Offset, Name, Value); } } @@ -774,6 +795,7 @@ AcpiDmDumpTable ( /* * Buffer: Size depends on the opcode and was set above. * Each hex byte is separated with a space. + * Multiple lines are separated by line continuation char. */ for (Temp16 = 0; Temp16 < ByteLength; Temp16++) { @@ -782,7 +804,7 @@ AcpiDmDumpTable ( { if ((Temp16 > 0) && (!((Temp16+1) % 16))) { - AcpiOsPrintf ("\n"); + AcpiOsPrintf (" \\\n"); /* Line continuation */ AcpiDmLineHeader (0, 0, NULL); } else @@ -817,9 +839,12 @@ AcpiDmDumpTable ( TableData = AcpiDmGetTableData (ACPI_CAST_PTR (char, Target)); if (TableData) { - AcpiOsPrintf ("/* %s */", TableData->Name); + AcpiOsPrintf (STRING_FORMAT, TableData->Name); + } + else + { + AcpiOsPrintf ("\n"); } - AcpiOsPrintf ("\n"); break; case ACPI_DMT_NAME4: @@ -862,7 +887,7 @@ AcpiDmDumpTable ( /* Address Space ID */ - AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiUtGetRegionName (*Target)); + AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiUtGetRegionName (*Target)); break; case ACPI_DMT_ACCWIDTH: @@ -875,14 +900,14 @@ AcpiDmDumpTable ( Temp8 = ACPI_GAS_WIDTH_RESERVED; } - AcpiOsPrintf ("%2.2X (%s)\n", Temp8, AcpiDmGasAccessWidth[Temp8]); + AcpiOsPrintf (UINT8_FORMAT, Temp8, AcpiDmGasAccessWidth[Temp8]); break; case ACPI_DMT_GAS: /* Generic Address Structure */ - AcpiOsPrintf ("<Generic Address Structure>\n"); + AcpiOsPrintf (STRING_FORMAT, "Generic Address Structure"); AcpiDmDumpTable (TableLength, CurrentOffset, Target, sizeof (ACPI_GENERIC_ADDRESS), AcpiDmTableInfoGas); AcpiOsPrintf ("\n"); @@ -899,7 +924,7 @@ AcpiDmDumpTable ( Temp16 = ACPI_ASF_TYPE_RESERVED; } - AcpiOsPrintf ("%2.2X <%s>\n", *Target, AcpiDmAsfSubnames[Temp16]); + AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmAsfSubnames[Temp16]); break; case ACPI_DMT_DMAR: @@ -912,7 +937,7 @@ AcpiDmDumpTable ( Temp16 = ACPI_DMAR_TYPE_RESERVED; } - AcpiOsPrintf ("%4.4X <%s>\n", ACPI_GET16 (Target), AcpiDmDmarSubnames[Temp16]); + AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target), AcpiDmDmarSubnames[Temp16]); break; case ACPI_DMT_EINJACT: @@ -925,7 +950,7 @@ AcpiDmDumpTable ( Temp8 = ACPI_EINJ_ACTION_RESERVED; } - AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmEinjActions[Temp8]); + AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmEinjActions[Temp8]); break; case ACPI_DMT_EINJINST: @@ -938,7 +963,7 @@ AcpiDmDumpTable ( Temp8 = ACPI_EINJ_INSTRUCTION_RESERVED; } - AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmEinjInstructions[Temp8]); + AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmEinjInstructions[Temp8]); break; case ACPI_DMT_ERSTACT: @@ -951,7 +976,7 @@ AcpiDmDumpTable ( Temp8 = ACPI_ERST_ACTION_RESERVED; } - AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmErstActions[Temp8]); + AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmErstActions[Temp8]); break; case ACPI_DMT_ERSTINST: @@ -964,7 +989,7 @@ AcpiDmDumpTable ( Temp8 = ACPI_ERST_INSTRUCTION_RESERVED; } - AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmErstInstructions[Temp8]); + AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmErstInstructions[Temp8]); break; case ACPI_DMT_HEST: @@ -977,12 +1002,12 @@ AcpiDmDumpTable ( Temp16 = ACPI_HEST_TYPE_RESERVED; } - AcpiOsPrintf ("%4.4X (%s)\n", ACPI_GET16 (Target), AcpiDmHestSubnames[Temp16]); + AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target), AcpiDmHestSubnames[Temp16]); break; case ACPI_DMT_HESTNTFY: - AcpiOsPrintf ("<Hardware Error Notification Structure>\n"); + AcpiOsPrintf (STRING_FORMAT, "Hardware Error Notification Structure"); AcpiDmDumpTable (TableLength, CurrentOffset, Target, sizeof (ACPI_HEST_NOTIFY), AcpiDmTableInfoHestNotify); AcpiOsPrintf ("\n"); @@ -999,7 +1024,7 @@ AcpiDmDumpTable ( Temp8 = ACPI_HEST_NOTIFY_RESERVED; } - AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmHestNotifySubnames[Temp8]); + AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmHestNotifySubnames[Temp8]); break; case ACPI_DMT_MADT: @@ -1012,7 +1037,7 @@ AcpiDmDumpTable ( Temp8 = ACPI_MADT_TYPE_RESERVED; } - AcpiOsPrintf ("%2.2X <%s>\n", *Target, AcpiDmMadtSubnames[Temp8]); + AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmMadtSubnames[Temp8]); break; case ACPI_DMT_SLIC: @@ -1025,7 +1050,7 @@ AcpiDmDumpTable ( Temp8 = ACPI_SLIC_TYPE_RESERVED; } - AcpiOsPrintf ("%8.8X <%s>\n", *Target, AcpiDmSlicSubnames[Temp8]); + AcpiOsPrintf (UINT32_FORMAT, *Target, AcpiDmSlicSubnames[Temp8]); break; case ACPI_DMT_SRAT: @@ -1038,7 +1063,7 @@ AcpiDmDumpTable ( Temp8 = ACPI_SRAT_TYPE_RESERVED; } - AcpiOsPrintf ("%2.2X <%s>\n", *Target, AcpiDmSratSubnames[Temp8]); + AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmSratSubnames[Temp8]); break; case ACPI_DMT_FADTPM: @@ -1051,7 +1076,7 @@ AcpiDmDumpTable ( Temp8 = ACPI_FADT_PM_RESERVED; } - AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmFadtProfiles[Temp8]); + AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmFadtProfiles[Temp8]); break; case ACPI_DMT_IVRS: @@ -1076,7 +1101,7 @@ AcpiDmDumpTable ( break; } - AcpiOsPrintf ("%2.2X <%s>\n", *Target, Name); + AcpiOsPrintf (UINT8_FORMAT, *Target, Name); break; case ACPI_DMT_EXIT: diff --git a/sys/contrib/dev/acpica/common/dmtbdump.c b/sys/contrib/dev/acpica/common/dmtbdump.c index 747000b..a66d2105 100644 --- a/sys/contrib/dev/acpica/common/dmtbdump.c +++ b/sys/contrib/dev/acpica/common/dmtbdump.c @@ -1408,12 +1408,12 @@ AcpiDmDumpSlit ( if ((j+1) < Localities) { - AcpiOsPrintf (","); + AcpiOsPrintf (" "); if (j && (((j+1) % 16) == 0)) { - AcpiOsPrintf ("\n"); - AcpiDmLineHeader (Offset, 0, ""); + AcpiOsPrintf ("\\\n"); /* With line continuation char */ + AcpiDmLineHeader (Offset, 0, NULL); } } } diff --git a/sys/contrib/dev/acpica/compiler/aslanalyze.c b/sys/contrib/dev/acpica/compiler/aslanalyze.c index f563a3c..07f84c8 100644 --- a/sys/contrib/dev/acpica/compiler/aslanalyze.c +++ b/sys/contrib/dev/acpica/compiler/aslanalyze.c @@ -483,3 +483,56 @@ ApCheckForGpeNameConflict ( return; } + + +/******************************************************************************* + * + * FUNCTION: ApCheckRegMethod + * + * PARAMETERS: Op - Current parse op + * + * RETURN: None + * + * DESCRIPTION: Ensure that a _REG method has a corresponding Operation + * Region declaration within the same scope. Note: _REG is defined + * to have two arguments and must therefore be defined as a + * control method. + * + ******************************************************************************/ + +void +ApCheckRegMethod ( + ACPI_PARSE_OBJECT *Op) +{ + ACPI_PARSE_OBJECT *Next; + ACPI_PARSE_OBJECT *Parent; + + + /* We are only interested in _REG methods */ + + if (!ACPI_COMPARE_NAME (METHOD_NAME__REG, &Op->Asl.NameSeg)) + { + return; + } + + /* Get the start of the current scope */ + + Parent = Op->Asl.Parent; + Next = Parent->Asl.Child; + + /* Search entire scope for an operation region declaration */ + + while (Next) + { + if (Next->Asl.ParseOpcode == PARSEOP_OPERATIONREGION) + { + return; /* Found region, OK */ + } + + Next = Next->Asl.Next; + } + + /* No region found, issue warning */ + + AslError (ASL_WARNING, ASL_MSG_NO_REGION, Op, NULL); +} diff --git a/sys/contrib/dev/acpica/compiler/aslcompiler.h b/sys/contrib/dev/acpica/compiler/aslcompiler.h index e18546e..0588c96 100644 --- a/sys/contrib/dev/acpica/compiler/aslcompiler.h +++ b/sys/contrib/dev/acpica/compiler/aslcompiler.h @@ -265,6 +265,10 @@ void ApCheckForGpeNameConflict ( ACPI_PARSE_OBJECT *Op); +void +ApCheckRegMethod ( + ACPI_PARSE_OBJECT *Op); + /* * aslerror - error handling/reporting @@ -457,7 +461,7 @@ AslMapNamedOpcodeToDataType ( /* * aslpredef - ACPI predefined names support */ -void +BOOLEAN ApCheckForPredefinedMethod ( ACPI_PARSE_OBJECT *Op, ASL_METHOD_INFO *MethodInfo); @@ -763,6 +767,13 @@ UINT64 UtDoConstant ( char *String); +ACPI_STATUS +UtStrtoul64 ( + char *String, + UINT32 Base, + UINT64 *RetInteger); + + /* * asluuid - UUID support */ diff --git a/sys/contrib/dev/acpica/compiler/aslcompiler.y b/sys/contrib/dev/acpica/compiler/aslcompiler.y index cc57aaa..600ed98 100644 --- a/sys/contrib/dev/acpica/compiler/aslcompiler.y +++ b/sys/contrib/dev/acpica/compiler/aslcompiler.y @@ -1484,7 +1484,7 @@ ReturnTerm : PARSEOP_RETURN '(' {$<n>$ = TrCreateLeafNode (PARSEOP_RETURN);} OptionalReturnArg ')' {$$ = TrLinkChildren ($<n>3,1,$4);} - | PARSEOP_RETURN {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_RETURN),1,TrCreateLeafNode (PARSEOP_ZERO));} + | PARSEOP_RETURN {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_RETURN),1,TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO), NODE_IS_NULL_RETURN));} | PARSEOP_RETURN '(' error ')' {$$ = AslDoError(); yyclearin;} ; @@ -3061,7 +3061,7 @@ OptionalTermArg ; OptionalReturnArg - : {$$ = TrCreateLeafNode (PARSEOP_ZERO);} /* Placeholder is a ZeroOp object */ + : {$$ = TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO), NODE_IS_NULL_RETURN);} /* Placeholder is a ZeroOp object */ | TermArg {$$ = $1;} ; diff --git a/sys/contrib/dev/acpica/compiler/asldefine.h b/sys/contrib/dev/acpica/compiler/asldefine.h index 50382fc..cfde1e4 100644 --- a/sys/contrib/dev/acpica/compiler/asldefine.h +++ b/sys/contrib/dev/acpica/compiler/asldefine.h @@ -123,6 +123,7 @@ #define ASL_EXTERNAL_METHOD 255 #define ASL_ABORT TRUE #define ASL_NO_ABORT FALSE +#define ASL_EOF ACPI_UINT32_MAX /* Support for reserved method names */ diff --git a/sys/contrib/dev/acpica/compiler/aslglobal.h b/sys/contrib/dev/acpica/compiler/aslglobal.h index f61de6d..f80c89f 100644 --- a/sys/contrib/dev/acpica/compiler/aslglobal.h +++ b/sys/contrib/dev/acpica/compiler/aslglobal.h @@ -69,6 +69,7 @@ extern int yydebug; extern FILE *AslCompilerin; extern int AslCompilerdebug; +extern int DtParserdebug; extern const ASL_MAPPING_ENTRY AslKeywordMapping[]; extern char *AslCompilertext; diff --git a/sys/contrib/dev/acpica/compiler/asllookup.c b/sys/contrib/dev/acpica/compiler/asllookup.c index 82f49de..7112236 100644 --- a/sys/contrib/dev/acpica/compiler/asllookup.c +++ b/sys/contrib/dev/acpica/compiler/asllookup.c @@ -1251,8 +1251,8 @@ LkNamespaceLocateBegin ( SpaceIdOp = OwningOp->Asl.Child->Asl.Next; switch ((UINT32) SpaceIdOp->Asl.Value.Integer) { - case REGION_EC: - case REGION_CMOS: + case ACPI_ADR_SPACE_EC: + case ACPI_ADR_SPACE_CMOS: if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != AML_FIELD_ACCESS_BYTE) { @@ -1260,8 +1260,8 @@ LkNamespaceLocateBegin ( } break; - case REGION_SMBUS: - case REGION_IPMI: + case ACPI_ADR_SPACE_SMBUS: + case ACPI_ADR_SPACE_IPMI: if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != AML_FIELD_ACCESS_BUFFER) { diff --git a/sys/contrib/dev/acpica/compiler/aslmain.c b/sys/contrib/dev/acpica/compiler/aslmain.c index 79c505f..fbad685 100644 --- a/sys/contrib/dev/acpica/compiler/aslmain.c +++ b/sys/contrib/dev/acpica/compiler/aslmain.c @@ -148,7 +148,7 @@ Options ( printf (" -ls Create combined source file (expanded includes) (*.src)\n"); printf ("\nACPI Data Tables:\n"); - printf (" -T <Sig> Create table template file for <Sig> (or \"ALL\")\n"); + printf (" -T <Sig>|ALL|* Create table template file(s) for <Sig>\n"); printf (" -vt Create verbose templates (full disassembly)\n"); printf ("\nAML Disassembler:\n"); @@ -425,10 +425,12 @@ AslDoOptions ( { case 'b': AslCompilerdebug = 1; /* same as yydebug */ + DtParserdebug = 1; break; case 'p': AslCompilerdebug = 1; /* same as yydebug */ + DtParserdebug = 1; break; case 't': diff --git a/sys/contrib/dev/acpica/compiler/aslmap.c b/sys/contrib/dev/acpica/compiler/aslmap.c index 7cc1b7b..594f29a 100644 --- a/sys/contrib/dev/acpica/compiler/aslmap.c +++ b/sys/contrib/dev/acpica/compiler/aslmap.c @@ -141,7 +141,7 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] = /* ACCESSTYPE_WORD */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ACCESS_WORD, 0, 0), /* ACQUIRE */ OP_TABLE_ENTRY (AML_ACQUIRE_OP, 0, 0, ACPI_BTYPE_INTEGER), /* ADD */ OP_TABLE_ENTRY (AML_ADD_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* ADDRESSSPACE_FFIXEDHW */ OP_TABLE_ENTRY (AML_BYTE_OP, REGION_FIXED_HW, 0, 0), +/* ADDRESSSPACE_FFIXEDHW */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_ADR_SPACE_FIXED_HARDWARE, 0, 0), /* ADDRESSTYPE_ACPI */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0), /* ADDRESSTYPE_MEMORY */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), /* ADDRESSTYPE_NVS */ OP_TABLE_ENTRY (AML_BYTE_OP, 3, 0, 0), @@ -321,14 +321,14 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] = /* READWRITETYPE_BOTH */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), /* READWRITETYPE_READONLY */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), /* REFOF */ OP_TABLE_ENTRY (AML_REF_OF_OP, 0, 0, ACPI_BTYPE_REFERENCE), -/* REGIONSPACE_CMOS */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_CMOS, 0, 0), -/* REGIONSPACE_EC */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_EC, 0, 0), -/* REGIONSPACE_IO */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_IO, 0, 0), -/* REGIONSPACE_IPMI */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_IPMI, 0, 0), -/* REGIONSPACE_MEM */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_MEMORY, 0, 0), -/* REGIONSPACE_PCI */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_PCI_CONFIG, 0, 0), -/* REGIONSPACE_PCIBAR */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_PCI_BAR, 0, 0), -/* REGIONSPACE_SMBUS */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_SMBUS, 0, 0), +/* REGIONSPACE_CMOS */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_CMOS, 0, 0), +/* REGIONSPACE_EC */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_EC, 0, 0), +/* REGIONSPACE_IO */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_SYSTEM_IO, 0, 0), +/* REGIONSPACE_IPMI */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_IPMI, 0, 0), +/* REGIONSPACE_MEM */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_SYSTEM_MEMORY, 0, 0), +/* REGIONSPACE_PCI */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_PCI_CONFIG, 0, 0), +/* REGIONSPACE_PCIBAR */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_PCI_BAR_TARGET, 0, 0), +/* REGIONSPACE_SMBUS */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_SMBUS, 0, 0), /* REGISTER */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), /* RELEASE */ OP_TABLE_ENTRY (AML_RELEASE_OP, 0, 0, 0), /* RESERVED_BYTES */ OP_TABLE_ENTRY (AML_INT_RESERVEDFIELD_OP, 0, 0, 0), diff --git a/sys/contrib/dev/acpica/compiler/aslmessages.h b/sys/contrib/dev/acpica/compiler/aslmessages.h index 62c51e4..269c0a4 100644 --- a/sys/contrib/dev/acpica/compiler/aslmessages.h +++ b/sys/contrib/dev/acpica/compiler/aslmessages.h @@ -190,6 +190,7 @@ typedef enum ASL_MSG_LEADING_ASTERISK, ASL_MSG_RESERVED_NO_RETURN_VAL, ASL_MSG_GPE_NAME_CONFLICT, + ASL_MSG_NO_REGION, ASL_MSG_INVALID_FIELD_NAME, ASL_MSG_INTEGER_SIZE, @@ -343,6 +344,7 @@ char *AslMessages [] = { /* ASL_MSG_LEADING_ASTERISK */ "Invalid leading asterisk", /* ASL_MSG_RESERVED_NO_RETURN_VAL */ "Reserved method should not return a value", /* ASL_MSG_GPE_NAME_CONFLICT */ "Name conflicts with a previous GPE method", +/* ASL_MSG_NO_REGION */ "_REG has no corresponding Operation Region", /* These messages are used by the data table compiler only */ @@ -359,7 +361,6 @@ char *AslMessages [] = { /* ASL_MSG_UNKNOWN_LABEL */ "Label is undefined", /* ASL_MSG_INVALID_EXPRESSION */ "Invalid expression", /* ASL_MSG_DIVIDE_BY_ZERO */ "Expression contains divide-by-zero" - }; diff --git a/sys/contrib/dev/acpica/compiler/aslpredef.c b/sys/contrib/dev/acpica/compiler/aslpredef.c index e75723c..0743d91 100644 --- a/sys/contrib/dev/acpica/compiler/aslpredef.c +++ b/sys/contrib/dev/acpica/compiler/aslpredef.c @@ -150,7 +150,7 @@ static const ACPI_PREDEFINED_INFO ScopeNames[] = { * ******************************************************************************/ -void +BOOLEAN ApCheckForPredefinedMethod ( ACPI_PARSE_OBJECT *Op, ASL_METHOD_INFO *MethodInfo) @@ -171,7 +171,7 @@ ApCheckForPredefinedMethod ( case ACPI_COMPILER_RESERVED_NAME: /* A _Txx that was not emitted by compiler */ /* Just return, nothing to do */ - break; + return (FALSE); case ACPI_EVENT_RESERVED_NAME: /* _Lxx/_Exx/_Wxx/_Qxx methods */ @@ -238,6 +238,8 @@ ApCheckForPredefinedMethod ( } break; } + + return (TRUE); } diff --git a/sys/contrib/dev/acpica/compiler/asltypes.h b/sys/contrib/dev/acpica/compiler/asltypes.h index d9cb301..8d9b9ed 100644 --- a/sys/contrib/dev/acpica/compiler/asltypes.h +++ b/sys/contrib/dev/acpica/compiler/asltypes.h @@ -76,6 +76,7 @@ #define NODE_COMPILER_EMITTED 0x00020000 #define NODE_IS_DUPLICATE 0x00040000 #define NODE_IS_RESOURCE_DATA 0x00080000 +#define NODE_IS_NULL_RETURN 0x00100000 /* Keeps information about individual control methods */ diff --git a/sys/contrib/dev/acpica/compiler/aslutils.c b/sys/contrib/dev/acpica/compiler/aslutils.c index 3532714..da0e162 100644 --- a/sys/contrib/dev/acpica/compiler/aslutils.c +++ b/sys/contrib/dev/acpica/compiler/aslutils.c @@ -68,12 +68,6 @@ char AslHexLookup[] = /* Local prototypes */ -static ACPI_STATUS -UtStrtoul64 ( - char *String, - UINT32 Base, - UINT64 *RetInteger); - static void UtPadNameWithUnderscores ( char *NameSeg, @@ -884,7 +878,7 @@ UtDoConstant ( * ******************************************************************************/ -static ACPI_STATUS +ACPI_STATUS UtStrtoul64 ( char *String, UINT32 Base, diff --git a/sys/contrib/dev/acpica/compiler/aslwalks.c b/sys/contrib/dev/acpica/compiler/aslwalks.c index 71dfb43..b60572d 100644 --- a/sys/contrib/dev/acpica/compiler/aslwalks.c +++ b/sys/contrib/dev/acpica/compiler/aslwalks.c @@ -302,10 +302,17 @@ AnMethodAnalysisWalkBegin ( return (AE_ERROR); } - /* Child indicates a return value */ - + /* + * A child indicates a possible return value. A simple Return or + * Return() is marked with NODE_IS_NULL_RETURN by the parser so + * that it is not counted as a "real" return-with-value, although + * the AML code that is actually emitted is Return(0). The AML + * definition of Return has a required parameter, so we are + * forced to convert a null return to Return(0). + */ if ((Op->Asl.Child) && - (Op->Asl.Child->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)) + (Op->Asl.Child->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) && + (!(Op->Asl.Child->Asl.CompileFlags & NODE_IS_NULL_RETURN))) { MethodInfo->NumReturnWithValue++; } @@ -510,13 +517,22 @@ AnMethodAnalysisWalkEnd ( /* * Check predefined method names for correct return behavior - * and correct number of arguments + * and correct number of arguments. Also, some special checks + * For GPE and _REG methods. */ - ApCheckForPredefinedMethod (Op, MethodInfo); + if (ApCheckForPredefinedMethod (Op, MethodInfo)) + { + /* Special check for two names like _L01 and _E01 in same scope */ - /* Special check for two names like _L01 and _E01 in same scope */ + ApCheckForGpeNameConflict (Op); + + /* + * Special check for _REG: Must have an operation region definition + * within the same scope! + */ + ApCheckRegMethod (Op); + } - ApCheckForGpeNameConflict (Op); ACPI_FREE (MethodInfo); break; diff --git a/sys/contrib/dev/acpica/compiler/dtcompile.c b/sys/contrib/dev/acpica/compiler/dtcompile.c index 9d5682d..d119b8b 100644 --- a/sys/contrib/dev/acpica/compiler/dtcompile.c +++ b/sys/contrib/dev/acpica/compiler/dtcompile.c @@ -277,7 +277,7 @@ DtCompileDataTable ( /* Verify that we at least have a table signature and save it */ - Signature = DtGetFieldValue (*FieldList, "Signature"); + Signature = DtGetFieldValue (*FieldList); if (!Signature) { sprintf (MsgBuffer, "Expected \"%s\"", "Signature"); @@ -310,20 +310,6 @@ DtCompileDataTable ( Status = DtCompileRsdp (FieldList); return (Status); } - else if (!ACPI_STRNCMP (Signature, "OEM", 3)) - { - DtFatal (ASL_MSG_OEM_TABLE, *FieldList, Signature); - return (AE_ERROR); - } - - /* Validate the signature via the ACPI table list */ - - TableData = AcpiDmGetTableData (Signature); - if (!TableData) - { - DtFatal (ASL_MSG_UNKNOWN_TABLE, *FieldList, Signature); - return (AE_ERROR); - } /* * All other tables must use the common ACPI table header. Insert the @@ -340,6 +326,15 @@ DtCompileDataTable ( DtPushSubtable (Gbl_RootTable); + /* Validate the signature via the ACPI table list */ + + TableData = AcpiDmGetTableData (Signature); + if (!TableData) + { + DtCompileGeneric ((void **) FieldList); + goto Out; + } + /* Dispatch to per-table compile */ if (TableData->CmTableHandler) @@ -374,6 +369,7 @@ DtCompileDataTable ( return (AE_ERROR); } +Out: /* Set the final table length and then the checksum */ DtSetTableLength (); @@ -424,6 +420,11 @@ DtCompileTable ( } Length = DtGetSubtableLength (*Field, Info); + if (Length == ASL_EOF) + { + return (AE_ERROR); + } + Subtable = UtLocalCalloc (sizeof (DT_SUBTABLE)); if (Length > 0) @@ -450,29 +451,6 @@ DtCompileTable ( goto Error; } - /* Does input field name match what is expected? */ - - if (ACPI_STRCMP (LocalField->Name, Info->Name)) - { - /* - * If Required = TRUE, the subtable must exist. - * If Required = FALSE, the subtable is optional - * (For example, AcpiDmTableInfoDmarScope in DMAR table is - * optional) - */ - if (Required) - { - sprintf (MsgBuffer, "Expected \"%s\"", Info->Name); - DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME, - LocalField, MsgBuffer); - } - else - { - Status = AE_NOT_FOUND; - goto Error; - } - } - /* Maintain table offsets */ LocalField->TableOffset = Gbl_CurrentTableOffset; @@ -518,7 +496,6 @@ DtCompileTable ( * Recursion (one level max): compile GAS (Generic Address) * or Notify in-line subtable */ - LocalField = LocalField->Next; *Field = LocalField; if (Info->Opcode == ACPI_DMT_GAS) diff --git a/sys/contrib/dev/acpica/compiler/dtcompiler.h b/sys/contrib/dev/acpica/compiler/dtcompiler.h index db3be4c..8bbd737 100644 --- a/sys/contrib/dev/acpica/compiler/dtcompiler.h +++ b/sys/contrib/dev/acpica/compiler/dtcompiler.h @@ -220,9 +220,20 @@ DtGetParentSubtable ( /* dtexpress - Integer expressions and labels */ -UINT64 +ACPI_STATUS DtResolveIntegerExpression ( - DT_FIELD *Field); + DT_FIELD *Field, + UINT64 *ReturnValue); + +UINT64 +DtDoOperator ( + UINT64 LeftValue, + UINT32 Operator, + UINT64 RightValue); + +UINT64 +DtResolveLabel ( + char *LabelString); void DtDetectAllLabels ( @@ -260,6 +271,25 @@ DtCompileFlag ( ACPI_DMTABLE_INFO *Info); +/* dtparser - lex/yacc files */ + +UINT64 +DtEvaluateExpression ( + char *ExprString); + +int +DtInitLexer ( + char *String); + +void +DtTerminateLexer ( + void); + +char * +DtGetOpName ( + UINT32 ParseOpcode); + + /* dtutils - Miscellaneous utilities */ typedef @@ -306,8 +336,7 @@ DtGetFileSize ( char* DtGetFieldValue ( - DT_FIELD *Field, - char *Name); + DT_FIELD *Field); UINT8 DtGetFieldType ( @@ -417,6 +446,10 @@ ACPI_STATUS DtCompileXsdt ( void **PFieldList); +ACPI_STATUS +DtCompileGeneric ( + void **PFieldList); + ACPI_DMTABLE_INFO * DtGetGenericTableInfo ( char *Name); diff --git a/sys/contrib/dev/acpica/compiler/dtexpress.c b/sys/contrib/dev/acpica/compiler/dtexpress.c index aae83ee..7646e17 100644 --- a/sys/contrib/dev/acpica/compiler/dtexpress.c +++ b/sys/contrib/dev/acpica/compiler/dtexpress.c @@ -45,6 +45,7 @@ #include <contrib/dev/acpica/compiler/aslcompiler.h> #include <contrib/dev/acpica/compiler/dtcompiler.h> +#include "dtparser.y.h" #define _COMPONENT DT_COMPILER ACPI_MODULE_NAME ("dtexpress") @@ -52,11 +53,6 @@ /* Local prototypes */ -static UINT64 -DtResolveInteger ( - DT_FIELD *Field, - char *IntegerString); - static void DtInsertLabelField ( DT_FIELD *Field); @@ -65,204 +61,226 @@ static DT_FIELD * DtLookupLabel ( char *Name); +/* Global used for errors during parse and related functions */ + +DT_FIELD *Gbl_CurrentField; + /****************************************************************************** * * FUNCTION: DtResolveIntegerExpression * * PARAMETERS: Field - Field object with Integer expression + * ReturnValue - Where the integer is returned * - * RETURN: A 64-bit integer value + * RETURN: Status, and the resolved 64-bit integer value * * DESCRIPTION: Resolve an integer expression to a single value. Supports - * both integer constants and labels. Supported operators are: - * +,-,*,/,%,|,&,^ + * both integer constants and labels. * *****************************************************************************/ -UINT64 +ACPI_STATUS DtResolveIntegerExpression ( - DT_FIELD *Field) + DT_FIELD *Field, + UINT64 *ReturnValue) { - char *IntegerString; - char *Operator; - UINT64 Value; - UINT64 Value2; + UINT64 Result; DbgPrint (ASL_DEBUG_OUTPUT, "Full Integer expression: %s\n", Field->Value); - strcpy (MsgBuffer, Field->Value); /* Must take a copy for strtok() */ + Gbl_CurrentField = Field; - /* Obtain and resolve the first operand */ + Result = DtEvaluateExpression (Field->Value); + *ReturnValue = Result; + return (AE_OK); +} - IntegerString = strtok (MsgBuffer, " "); - if (!IntegerString) - { - DtError (ASL_ERROR, ASL_MSG_INVALID_EXPRESSION, Field, Field->Value); - return (0); - } - Value = DtResolveInteger (Field, IntegerString); - DbgPrint (ASL_DEBUG_OUTPUT, "Integer resolved to V1: %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (Value)); +/****************************************************************************** + * + * FUNCTION: DtDoOperator + * + * PARAMETERS: LeftValue - First 64-bit operand + * Operator - Parse token for the operator (EXPOP_*) + * RightValue - Second 64-bit operand + * + * RETURN: 64-bit result of the requested operation + * + * DESCRIPTION: Perform the various 64-bit integer math functions + * + *****************************************************************************/ - /* - * Consume the entire expression string. For the rest of the - * expression string, values are of the form: - * <operator> <integer> - */ - while (1) +UINT64 +DtDoOperator ( + UINT64 LeftValue, + UINT32 Operator, + UINT64 RightValue) +{ + UINT64 Result; + + + /* Perform the requested operation */ + + switch (Operator) { - Operator = strtok (NULL, " "); - if (!Operator) - { - /* Normal exit */ + case EXPOP_ONES_COMPLIMENT: + Result = ~RightValue; + break; - DbgPrint (ASL_DEBUG_OUTPUT, "Expression Resolved to: %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (Value)); + case EXPOP_LOGICAL_NOT: + Result = !RightValue; + break; - return (Value); - } + case EXPOP_MULTIPLY: + Result = LeftValue * RightValue; + break; - IntegerString = strtok (NULL, " "); - if (!IntegerString || - (strlen (Operator) > 1)) + case EXPOP_DIVIDE: + if (!RightValue) { - /* No corresponding operand for operator or invalid operator */ + DtError (ASL_ERROR, ASL_MSG_DIVIDE_BY_ZERO, + Gbl_CurrentField, Gbl_CurrentField->Value); + return (0); + } + Result = LeftValue / RightValue; + break; - DtError (ASL_ERROR, ASL_MSG_INVALID_EXPRESSION, Field, Field->Value); + case EXPOP_MODULO: + if (!RightValue) + { + DtError (ASL_ERROR, ASL_MSG_DIVIDE_BY_ZERO, + Gbl_CurrentField, Gbl_CurrentField->Value); return (0); } + Result = LeftValue % RightValue; + break; - Value2 = DtResolveInteger (Field, IntegerString); - DbgPrint (ASL_DEBUG_OUTPUT, "Integer resolved to V2: %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (Value2)); + case EXPOP_ADD: + Result = LeftValue + RightValue; + break; - /* Perform the requested operation */ + case EXPOP_SUBTRACT: + Result = LeftValue - RightValue; + break; - switch (*Operator) - { - case '-': - Value -= Value2; - break; + case EXPOP_SHIFT_RIGHT: + Result = LeftValue >> RightValue; + break; - case '+': - Value += Value2; - break; + case EXPOP_SHIFT_LEFT: + Result = LeftValue << RightValue; + break; - case '*': - Value *= Value2; - break; + case EXPOP_LESS: + Result = LeftValue < RightValue; + break; - case '|': - Value |= Value2; - break; + case EXPOP_GREATER: + Result = LeftValue > RightValue; + break; - case '&': - Value &= Value2; - break; + case EXPOP_LESS_EQUAL: + Result = LeftValue <= RightValue; + break; - case '^': - Value ^= Value2; - break; + case EXPOP_GREATER_EQUAL: + Result = LeftValue >= RightValue; + break; - case '/': - if (!Value2) - { - DtError (ASL_ERROR, ASL_MSG_DIVIDE_BY_ZERO, Field, Field->Value); - return (0); - } - Value /= Value2; - break; + case EXPOP_EQUAL: + Result = LeftValue = RightValue; + break; - case '%': - if (!Value2) - { - DtError (ASL_ERROR, ASL_MSG_DIVIDE_BY_ZERO, Field, Field->Value); - return (0); - } - Value %= Value2; - break; + case EXPOP_NOT_EQUAL: + Result = LeftValue != RightValue; + break; - default: + case EXPOP_AND: + Result = LeftValue & RightValue; + break; - /* Unknown operator */ + case EXPOP_XOR: + Result = LeftValue ^ RightValue; + break; - DtFatal (ASL_MSG_INVALID_EXPRESSION, Field, Field->Value); - break; - } + case EXPOP_OR: + Result = LeftValue | RightValue; + break; + + case EXPOP_LOGICAL_AND: + Result = LeftValue && RightValue; + break; + + case EXPOP_LOGICAL_OR: + Result = LeftValue || RightValue; + break; + + default: + + /* Unknown operator */ + + DtFatal (ASL_MSG_INVALID_EXPRESSION, + Gbl_CurrentField, Gbl_CurrentField->Value); + return (0); } - return (Value); + DbgPrint (ASL_DEBUG_OUTPUT, + "IntegerEval: %s (%8.8X%8.8X %s %8.8X%8.8X) = %8.8X%8.8X\n", + Gbl_CurrentField->Value, + ACPI_FORMAT_UINT64 (LeftValue), + DtGetOpName (Operator), + ACPI_FORMAT_UINT64 (RightValue), + ACPI_FORMAT_UINT64 (Result)); + + return (Result); } /****************************************************************************** * - * FUNCTION: DtResolveInteger + * FUNCTION: DtResolveLabel * - * PARAMETERS: Field - Field object with string to be resolved - * IntegerString - Integer to be resolved + * PARAMETERS: LabelString - Contains the label * - * RETURN: A 64-bit integer value + * RETURN: Table offset associated with the label * - * DESCRIPTION: Resolve a single integer string to a value. Supports both - * integer constants and labels. - * - * NOTE: References to labels must begin with a dollar sign ($) + * DESCRIPTION: Lookup a lable and return its value. * *****************************************************************************/ -static UINT64 -DtResolveInteger ( - DT_FIELD *Field, - char *IntegerString) +UINT64 +DtResolveLabel ( + char *LabelString) { DT_FIELD *LabelField; - UINT64 Value = 0; - char *Message = NULL; - ACPI_STATUS Status; - DbgPrint (ASL_DEBUG_OUTPUT, "Resolve Integer: %s\n", IntegerString); + DbgPrint (ASL_DEBUG_OUTPUT, "Resolve Label: %s\n", LabelString); /* Resolve a label reference to an integer (table offset) */ - if (*IntegerString == '$') + if (*LabelString != '$') { - LabelField = DtLookupLabel (IntegerString); - if (!LabelField) - { - DtError (ASL_ERROR, ASL_MSG_UNKNOWN_LABEL, Field, IntegerString); - return (0); - } - - /* All we need from the label is the offset in the table */ - - Value = LabelField->TableOffset; - return (Value); + return (0); } - /* Convert string to an actual integer */ - - Status = DtStrtoul64 (IntegerString, &Value); - if (ACPI_FAILURE (Status)) + LabelField = DtLookupLabel (LabelString); + if (!LabelField) { - if (Status == AE_LIMIT) - { - Message = "Constant larger than 64 bits"; - } - else if (Status == AE_BAD_CHARACTER) - { - Message = "Invalid character in constant"; - } - - DtError (ASL_ERROR, ASL_MSG_INVALID_HEX_INTEGER, Field, Message); + DtError (ASL_ERROR, ASL_MSG_UNKNOWN_LABEL, + Gbl_CurrentField, LabelString); + return (0); } - return (Value); + /* All we need from the label is the offset in the table */ + + DbgPrint (ASL_DEBUG_OUTPUT, "Resolved Label: 0x%8.8X\n", + LabelField->TableOffset); + + return (LabelField->TableOffset); } diff --git a/sys/contrib/dev/acpica/compiler/dtfield.c b/sys/contrib/dev/acpica/compiler/dtfield.c index 7039ae8..00d6043 100644 --- a/sys/contrib/dev/acpica/compiler/dtfield.c +++ b/sys/contrib/dev/acpica/compiler/dtfield.c @@ -284,6 +284,7 @@ DtCompileInteger ( { UINT64 Value; UINT64 MaxValue; + ACPI_STATUS Status; /* Output buffer byte length must be in range 1-8 */ @@ -297,7 +298,11 @@ DtCompileInteger ( /* Resolve integer expression to a single integer value */ - Value = DtResolveIntegerExpression (Field); + Status = DtResolveIntegerExpression (Field, &Value); + if (ACPI_FAILURE (Status)) + { + return; + } /* Ensure that reserved fields are set to zero */ /* TBD: should we set to zero, or just make this an ERROR? */ diff --git a/sys/contrib/dev/acpica/compiler/dtio.c b/sys/contrib/dev/acpica/compiler/dtio.c index c339277..ac853c0 100644 --- a/sys/contrib/dev/acpica/compiler/dtio.c +++ b/sys/contrib/dev/acpica/compiler/dtio.c @@ -60,10 +60,6 @@ static void DtLinkField ( DT_FIELD *Field); -static void -DtMergeField ( - char *Value); - static ACPI_STATUS DtParseLine ( char *LineBuffer, @@ -96,6 +92,7 @@ DtDumpBuffer ( #define DT_SLASH_ASTERISK_COMMENT 3 #define DT_SLASH_SLASH_COMMENT 4 #define DT_END_COMMENT 5 +#define DT_MERGE_LINES 6 static UINT32 Gbl_NextLineOffset; @@ -226,56 +223,6 @@ DtLinkField ( /****************************************************************************** * - * FUNCTION: DtMergeField - * - * PARAMETERS: Value - Merge this line into previous one - * - * RETURN: None - * - * DESCRIPTION: Merge a field value to the previous one, - * probably for a multi-line buffer definition. - * - *****************************************************************************/ - -static void -DtMergeField ( - char *Value) -{ - DT_FIELD *Prev; - DT_FIELD *Next; - char *NewValue; - UINT32 PrevLength; - UINT32 ThisLength; - - - Prev = Next = Gbl_FieldList; - - while (Next) - { - Prev = Next; - Next = Next->Next; - } - - if (Prev) - { - PrevLength = ACPI_STRLEN (Prev->Value); - ThisLength = ACPI_STRLEN (Value); - - /* Add two for: separator + NULL terminator */ - - NewValue = UtLocalCalloc (PrevLength + ThisLength + 2); - ACPI_STRNCPY (NewValue, Prev->Value, PrevLength); - NewValue[PrevLength] = ' '; - - ACPI_STRNCPY ((NewValue + PrevLength + 1), Value, ThisLength); - ACPI_FREE (Prev->Value); - Prev->Value = NewValue; - } -} - - -/****************************************************************************** - * * FUNCTION: DtParseLine * * PARAMETERS: LineBuffer - Current source code line @@ -305,6 +252,7 @@ DtParseLine ( DT_FIELD *Field; UINT32 Column; UINT32 NameColumn; + BOOLEAN IsNullString = FALSE; if (!LineBuffer) @@ -372,7 +320,6 @@ DtParseLine ( ACPI_FREE (TmpName); Start = End = (Colon + 1); - while (*End) { /* Found left quotation, go to the right quotation and break */ @@ -380,6 +327,13 @@ DtParseLine ( if (*End == '"') { End++; + + /* Check for an explicit null string */ + + if (*End == '"') + { + IsNullString = TRUE; + } while (*End && (*End != '"')) { End++; @@ -397,12 +351,11 @@ DtParseLine ( * TBD: Perhaps DtGetNextLine should parse the following type * of comments also. */ - if (*End == '(' || - *End == '<') + if (*End == '[') { + End--; break; } - End++; } @@ -413,7 +366,9 @@ DtParseLine ( Value = DtTrim (TmpValue); ACPI_FREE (TmpValue); - if (ACPI_STRLEN (Name) && Value) + /* Create a new field object only if we have a valid value field */ + + if ((Value && *Value) || IsNullString) { Field = UtLocalCalloc (sizeof (DT_FIELD)); Field->Name = Name; @@ -425,13 +380,7 @@ DtParseLine ( DtLinkField (Field); } - else if (!ACPI_STRLEN (Name)) - { - /* Handle multi-line buffers (length > 16) */ - - DtMergeField (Value); - } - else + else /* Ignore this field, it has no valid data */ { ACPI_FREE (Name); ACPI_FREE (Value); @@ -447,7 +396,7 @@ DtParseLine ( * * PARAMETERS: Handle - Open file handle for the source file * - * RETURN: Filled line buffer and offset of start-of-line (zero on EOF) + * RETURN: Filled line buffer and offset of start-of-line (ASL_EOF on EOF) * * DESCRIPTION: Get the next valid source line. Removes all comments. * Ignores empty lines. @@ -464,6 +413,7 @@ UINT32 DtGetNextLine ( FILE *Handle) { + BOOLEAN LineNotAllBlanks = FALSE; UINT32 State = DT_NORMAL_TEXT; UINT32 CurrentLineOffset; UINT32 i; @@ -488,7 +438,7 @@ DtGetNextLine ( break; } - return (0); + return (ASL_EOF); } switch (State) @@ -506,24 +456,45 @@ DtGetNextLine ( case '"': State = DT_START_QUOTED_STRING; + LineNotAllBlanks = TRUE; i++; break; + case '\\': + /* + * The continuation char MUST be last char on this line. + * Otherwise, it will be assumed to be a valid ASL char. + */ + State = DT_MERGE_LINES; + break; + case '\n': CurrentLineOffset = Gbl_NextLineOffset; Gbl_NextLineOffset = (UINT32) ftell (Handle); Gbl_CurrentLineNumber++; - /* Exit if line is complete. Ignore blank lines */ - - if (i != 0) + /* + * Exit if line is complete. Ignore empty lines (only \n) + * or lines that contain nothing but blanks. + */ + if ((i != 0) && LineNotAllBlanks) { - Gbl_CurrentLineBuffer[i+1] = 0; /* Terminate line */ + Gbl_CurrentLineBuffer[i+1] = 0; /* Terminate string */ return (CurrentLineOffset); } + + /* Toss this line and start a new one */ + + i = 0; + LineNotAllBlanks = FALSE; break; default: + if (c != ' ') + { + LineNotAllBlanks = TRUE; + } + i++; break; } @@ -624,14 +595,46 @@ DtGetNextLine ( } break; + case DT_MERGE_LINES: + + if (c != '\n') + { + /* + * This is not a continuation backslash, it is a normal + * normal ASL backslash - for example: Scope(\_SB_) + */ + i++; /* Keep the backslash that is already in the buffer */ + + ungetc (c, Handle); + State = DT_NORMAL_TEXT; + } + else + { + /* + * This is a continuation line -- a backlash followed + * immediately by a newline. Insert a space between the + * lines (overwrite the backslash) + */ + Gbl_CurrentLineBuffer[i] = ' '; + i++; + + /* Ignore newline, this will merge the lines */ + + CurrentLineOffset = Gbl_NextLineOffset; + Gbl_NextLineOffset = (UINT32) ftell (Handle); + Gbl_CurrentLineNumber++; + State = DT_NORMAL_TEXT; + } + break; + default: DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, "Unknown input state"); - return (0); + return (ASL_EOF); } } printf ("ERROR - Input line is too long (max %u)\n", ASL_LINE_BUFFER_SIZE); - return (0); + return (ASL_EOF); } @@ -654,6 +657,7 @@ DtScanFile ( { ACPI_STATUS Status; UINT32 Offset; + DT_FIELD *Next; ACPI_FUNCTION_NAME (DtScanFile); @@ -669,7 +673,7 @@ DtScanFile ( /* Scan line-by-line */ - while ((Offset = DtGetNextLine (Handle))) + while ((Offset = DtGetNextLine (Handle)) != ASL_EOF) { ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Line %2.2u/%4.4X - %s", Gbl_CurrentLineNumber, Offset, Gbl_CurrentLineBuffer)); @@ -681,6 +685,30 @@ DtScanFile ( } } + /* Dump the parse tree if debug enabled */ + + if (Gbl_DebugFlag) + { + Next = Gbl_FieldList; + DbgPrint (ASL_DEBUG_OUTPUT, "Tree: %32s %32s %8s %8s %8s %8s %8s %8s\n\n", + "Name", "Value", "Line", "ByteOff", "NameCol", "Column", "TableOff", "Flags"); + + while (Next) + { + DbgPrint (ASL_DEBUG_OUTPUT, "Field: %32.32s %32.32s %.8X %.8X %.8X %.8X %.8X %.8X\n", + Next->Name, + Next->Value, + Next->Line, + Next->ByteOffset, + Next->NameColumn, + Next->Column, + Next->TableOffset, + Next->Flags); + + Next = Next->Next; + } + } + return (Gbl_FieldList); } @@ -774,7 +802,7 @@ DtDumpBuffer ( UINT8 BufChar; - FlPrintFile (FileId, "Output: [%3.3Xh %4.4d% 3d] ", + FlPrintFile (FileId, "Output: [%3.3Xh %4.4d %3d] ", Offset, Offset, Length); i = 0; @@ -782,7 +810,7 @@ DtDumpBuffer ( { if (i >= 16) { - FlPrintFile (FileId, "%23s", ""); + FlPrintFile (FileId, "%24s", ""); } /* Print 16 hex chars */ @@ -876,9 +904,16 @@ DtWriteFieldToListing ( /* Dump the line as parsed and represented internally */ - FlPrintFile (ASL_FILE_LISTING_OUTPUT, "Parsed: %*s : %s\n", + FlPrintFile (ASL_FILE_LISTING_OUTPUT, "Parsed: %*s : %.64s", Field->Column-4, Field->Name, Field->Value); + if (strlen (Field->Value) > 64) + { + FlPrintFile (ASL_FILE_LISTING_OUTPUT, "...Additional data, length 0x%X\n", + strlen (Field->Value)); + } + FlPrintFile (ASL_FILE_LISTING_OUTPUT, "\n"); + /* Dump the hex data that will be output for this field */ DtDumpBuffer (ASL_FILE_LISTING_OUTPUT, Buffer, Field->TableOffset, Length); diff --git a/sys/contrib/dev/acpica/compiler/dtparser.l b/sys/contrib/dev/acpica/compiler/dtparser.l new file mode 100644 index 0000000..bcbcc15 --- /dev/null +++ b/sys/contrib/dev/acpica/compiler/dtparser.l @@ -0,0 +1,133 @@ +%{ +/****************************************************************************** + * + * Module Name: dtparser.l - Flex input file for table compiler lexer + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2011, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + +#include <contrib/dev/acpica/compiler/aslcompiler.h> +#include "dtparser.y.h" + +#define YY_NO_INPUT /* No file input, we use strings only */ + +#define _COMPONENT ACPI_COMPILER + ACPI_MODULE_NAME ("dtscanner") +%} + +%option noyywrap +%option nounput + +Number [0-9a-fA-F]+ +HexNumber 0[xX][0-9a-fA-F]+ +DecimalNumber 0[dD][0-9]+ +LabelRef $[a-zA-Z][0-9a-zA-Z]* +WhiteSpace [ \t\v\r]+ +NewLine [\n] + +%% + +\( return (EXPOP_PAREN_OPEN); +\) return (EXPOP_PAREN_CLOSE); +\~ return (EXPOP_ONES_COMPLIMENT); +\! return (EXPOP_LOGICAL_NOT); +\* return (EXPOP_MULTIPLY); +\/ return (EXPOP_DIVIDE); +\% return (EXPOP_MODULO); +\+ return (EXPOP_ADD); +\- return (EXPOP_SUBTRACT); +">>" return (EXPOP_SHIFT_RIGHT); +"<<" return (EXPOP_SHIFT_LEFT); +\< return (EXPOP_LESS); +\> return (EXPOP_GREATER); +"<=" return (EXPOP_LESS_EQUAL); +">=" return (EXPOP_GREATER_EQUAL); +"==" return (EXPOP_EQUAL); +"!=" return (EXPOP_NOT_EQUAL); +\& return (EXPOP_AND); +\^ return (EXPOP_XOR); +\| return (EXPOP_OR); +"&&" return (EXPOP_LOGICAL_AND); +"||" return (EXPOP_LOGICAL_OR); +<<EOF>> return (EXPOP_EOF); /* null end-of-string */ + +{LabelRef} return (EXPOP_LABEL); +{Number} return (EXPOP_NUMBER); +{HexNumber} return (EXPOP_HEX_NUMBER); +{NewLine} return (EXPOP_NEW_LINE); +{WhiteSpace} /* Ignore */ + +. return (EXPOP_EOF); + +%% + +/* + * Local support functions + */ +YY_BUFFER_STATE LexBuffer; + +/****************************************************************************** + * + * FUNCTION: DtInitLexer, DtTerminateLexer + * + * PARAMETERS: String - Input string to be parsed + * + * RETURN: None + * + * DESCRIPTION: Initialization and termination routines for lexer. Lexer needs + * a buffer to handle strings instead of a file. + * + *****************************************************************************/ + +int +DtInitLexer ( + char *String) +{ + + LexBuffer = yy_scan_string (String); + return (LexBuffer == NULL); +} + +void +DtTerminateLexer ( + void) +{ + + yy_delete_buffer (LexBuffer); +} diff --git a/sys/contrib/dev/acpica/compiler/dtparser.y b/sys/contrib/dev/acpica/compiler/dtparser.y new file mode 100644 index 0000000..46756fc --- /dev/null +++ b/sys/contrib/dev/acpica/compiler/dtparser.y @@ -0,0 +1,267 @@ +%{ +/****************************************************************************** + * + * Module Name: dtparser.y - Bison input file for table compiler parser + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2011, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + +#define YYDEBUG 1 +#define YYERROR_VERBOSE 1 + +#include <contrib/dev/acpica/compiler/aslcompiler.h> +#include <contrib/dev/acpica/compiler/dtcompiler.h> + +#define _COMPONENT ACPI_COMPILER + ACPI_MODULE_NAME ("dtparser") + +UINT64 DtParserResult; /* Global for expression return value */ + +int DtParserlex (void); +int DtParserparse (void); +extern char* DtParsertext; +extern void DtParsererror (char const * msg); +#define YYFLAG -32768 + +%} + +%union +{ + UINT64 value; + UINT32 op; +} + +%type <value> Expression + +%token <op> EXPOP_EOF +%token <op> EXPOP_NEW_LINE +%token <op> EXPOP_NUMBER +%token <op> EXPOP_HEX_NUMBER +%token <op> EXPOP_DECIMAL_NUMBER +%token <op> EXPOP_LABEL +%token <op> EXPOP_PAREN_OPEN +%token <op> EXPOP_PAREN_CLOSE + +%left <op> EXPOP_LOGICAL_OR +%left <op> EXPOP_LOGICAL_AND +%left <op> EXPOP_OR +%left <op> EXPOP_XOR +%left <op> EXPOP_AND +%left <op> EXPOP_EQUAL EXPOP_NOT_EQUAL +%left <op> EXPOP_GREATER EXPOP_LESS EXPOP_GREATER_EQUAL EXPOP_LESS_EQUAL +%left <op> EXPOP_SHIFT_RIGHT EXPOP_SHIFT_LEFT +%left <op> EXPOP_ADD EXPOP_SUBTRACT +%left <op> EXPOP_MULTIPLY EXPOP_DIVIDE EXPOP_MODULO +%right <op> EXPOP_ONES_COMPLIMENT EXPOP_LOGICAL_NOT + +%% + +/* + * Operator precedence rules (from K&R) + * + * 1) ( ) + * 2) ! ~ (unary operators that are supported here) + * 3) * / % + * 4) + - + * 5) >> << + * 6) < > <= >= + * 7) == != + * 8) & + * 9) ^ + * 10) | + * 11) && + * 12) || + */ +Value + : Expression EXPOP_NEW_LINE { DtParserResult=$1; return 0; } /* End of line (newline) */ + | Expression EXPOP_EOF { DtParserResult=$1; return 0; } /* End of string (0) */ + ; + +Expression + + /* Unary operators */ + + : EXPOP_LOGICAL_NOT Expression { $$ = DtDoOperator ($2, EXPOP_LOGICAL_NOT, $2);} + | EXPOP_ONES_COMPLIMENT Expression { $$ = DtDoOperator ($2, EXPOP_ONES_COMPLIMENT, $2);} + + /* Binary operators */ + + | Expression EXPOP_MULTIPLY Expression { $$ = DtDoOperator ($1, EXPOP_MULTIPLY, $3);} + | Expression EXPOP_DIVIDE Expression { $$ = DtDoOperator ($1, EXPOP_DIVIDE, $3);} + | Expression EXPOP_MODULO Expression { $$ = DtDoOperator ($1, EXPOP_MODULO, $3);} + | Expression EXPOP_ADD Expression { $$ = DtDoOperator ($1, EXPOP_ADD, $3);} + | Expression EXPOP_SUBTRACT Expression { $$ = DtDoOperator ($1, EXPOP_SUBTRACT, $3);} + | Expression EXPOP_SHIFT_RIGHT Expression { $$ = DtDoOperator ($1, EXPOP_SHIFT_RIGHT, $3);} + | Expression EXPOP_SHIFT_LEFT Expression { $$ = DtDoOperator ($1, EXPOP_SHIFT_LEFT, $3);} + | Expression EXPOP_GREATER Expression { $$ = DtDoOperator ($1, EXPOP_GREATER, $3);} + | Expression EXPOP_LESS Expression { $$ = DtDoOperator ($1, EXPOP_LESS, $3);} + | Expression EXPOP_GREATER_EQUAL Expression { $$ = DtDoOperator ($1, EXPOP_GREATER_EQUAL, $3);} + | Expression EXPOP_LESS_EQUAL Expression { $$ = DtDoOperator ($1, EXPOP_LESS_EQUAL, $3);} + | Expression EXPOP_EQUAL Expression { $$ = DtDoOperator ($1, EXPOP_EQUAL, $3);} + | Expression EXPOP_NOT_EQUAL Expression { $$ = DtDoOperator ($1, EXPOP_NOT_EQUAL, $3);} + | Expression EXPOP_AND Expression { $$ = DtDoOperator ($1, EXPOP_AND, $3);} + | Expression EXPOP_XOR Expression { $$ = DtDoOperator ($1, EXPOP_XOR, $3);} + | Expression EXPOP_OR Expression { $$ = DtDoOperator ($1, EXPOP_OR, $3);} + | Expression EXPOP_LOGICAL_AND Expression { $$ = DtDoOperator ($1, EXPOP_LOGICAL_AND, $3);} + | Expression EXPOP_LOGICAL_OR Expression { $$ = DtDoOperator ($1, EXPOP_LOGICAL_OR, $3);} + + /* Parentheses: '(' Expression ')' */ + + | EXPOP_PAREN_OPEN Expression + EXPOP_PAREN_CLOSE { $$ = $2;} + + /* Label references (prefixed with $) */ + + | EXPOP_LABEL { $$ = DtResolveLabel (DtParsertext);} + + /* Default base for a non-prefixed integer is 16 */ + + | EXPOP_NUMBER { UtStrtoul64 (DtParsertext, 16, &$$);} + + /* Standard hex number (0x1234) */ + + | EXPOP_HEX_NUMBER { UtStrtoul64 (DtParsertext, 16, &$$);} + + /* TBD: Decimal number with prefix (0d1234) - Not supported by UtStrtoul64 at this time */ + + | EXPOP_DECIMAL_NUMBER { UtStrtoul64 (DtParsertext, 10, &$$);} + ; +%% + +/* + * Local support functions, including parser entry point + */ +extern DT_FIELD *Gbl_CurrentField; +#define PR_FIRST_PARSE_OPCODE EXPOP_EOF +#define PR_YYTNAME_START 3 + +#ifdef _USE_BERKELEY_YACC +#define yytname DtParsername +#endif + + +/****************************************************************************** + * + * FUNCTION: DtParsererror + * + * PARAMETERS: Message - Parser-generated error message + * + * RETURN: None + * + * DESCRIPTION: Handler for parser errors + * + *****************************************************************************/ + +void +DtParsererror ( + char const *Message) +{ + DtError (ASL_ERROR, ASL_MSG_SYNTAX, + Gbl_CurrentField, (char *) Message); +} + + +/****************************************************************************** + * + * FUNCTION: DtGetOpName + * + * PARAMETERS: ParseOpcode - Parser token (EXPOP_*) + * + * RETURN: Pointer to the opcode name + * + * DESCRIPTION: Get the ascii name of the parse opcode for debug output + * + *****************************************************************************/ + +char * +DtGetOpName ( + UINT32 ParseOpcode) +{ + + /* + * First entries (PR_YYTNAME_START) in yytname are special reserved names. + * Ignore first 6 characters of name (EXPOP_) + */ + return ((char *) yytname + [(ParseOpcode - PR_FIRST_PARSE_OPCODE) + PR_YYTNAME_START] + 6); +} + + +/****************************************************************************** + * + * FUNCTION: DtEvaluateExpression + * + * PARAMETERS: ExprString - Expression to be evaluated. Must be + * terminated by either a newline or a NUL + * string terminator + * + * RETURN: 64-bit value for the expression + * + * DESCRIPTION: Main entry point for the DT expression parser + * + *****************************************************************************/ + +UINT64 +DtEvaluateExpression ( + char *ExprString) +{ + + DbgPrint (ASL_DEBUG_OUTPUT, + "**** Input expression: %s (Base 16)\n", ExprString); + + /* Point lexer to the input string */ + + if (DtInitLexer (ExprString)) + { + DtError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, + Gbl_CurrentField, "Could not initialize lexer"); + return (0); + } + + /* Parse/Evaluate the input string (value returned in DtParserResult) */ + + DtParserparse (); + DtTerminateLexer (); + + DbgPrint (ASL_DEBUG_OUTPUT, + "**** Parser returned value: %u (%8.8X%8.8X)\n", + (UINT32) DtParserResult, ACPI_FORMAT_UINT64 (DtParserResult)); + + return (DtParserResult); +} diff --git a/sys/contrib/dev/acpica/compiler/dtsubtable.c b/sys/contrib/dev/acpica/compiler/dtsubtable.c index 5841e0a..b3f24ab 100644 --- a/sys/contrib/dev/acpica/compiler/dtsubtable.c +++ b/sys/contrib/dev/acpica/compiler/dtsubtable.c @@ -288,16 +288,58 @@ DtGetSubtableLength ( ACPI_DMTABLE_INFO *Info) { UINT32 ByteLength = 0; + UINT8 Step; + UINT8 i; /* Walk entire Info table; Null name terminates */ for (; Info->Name; Info++) { + if (!Field) + { + goto Error; + } + ByteLength += DtGetFieldLength (Field, Info); + + switch (Info->Opcode) + { + case ACPI_DMT_GAS: + Step = 5; + break; + + case ACPI_DMT_HESTNTFY: + Step = 9; + break; + + default: + Step = 1; + break; + } + + for (i = 0; i < Step; i++) + { + if (!Field) + { + goto Error; + } + + Field = Field->Next; + } } return (ByteLength); + +Error: + if (!Field) + { + sprintf (MsgBuffer, "Found NULL field - Field name \"%s\" needed", + Info->Name); + DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, MsgBuffer); + } + + return (ASL_EOF); } diff --git a/sys/contrib/dev/acpica/compiler/dttable.c b/sys/contrib/dev/acpica/compiler/dttable.c index 8b5d205..393ac73 100644 --- a/sys/contrib/dev/acpica/compiler/dttable.c +++ b/sys/contrib/dev/acpica/compiler/dttable.c @@ -1224,7 +1224,6 @@ DtCompileSlit ( DT_FIELD *FieldList; UINT32 Localities; UINT8 *LocalityBuffer; - UINT32 RemainingData; Status = DtCompileTable (PFieldList, AcpiDmTableInfoSlit, @@ -1240,22 +1239,17 @@ DtCompileSlit ( Localities = *ACPI_CAST_PTR (UINT32, Subtable->Buffer); LocalityBuffer = UtLocalCalloc (Localities); + /* Compile each locality buffer */ + FieldList = *PFieldList; while (FieldList) { - /* Handle multiple-line buffer */ - - RemainingData = Localities; - while (RemainingData && FieldList) - { - RemainingData = DtCompileBuffer ( - LocalityBuffer + (Localities - RemainingData), - FieldList->Value, FieldList, RemainingData); - FieldList = FieldList->Next; - } + DtCompileBuffer (LocalityBuffer, + FieldList->Value, FieldList, Localities); DtCreateSubtable (LocalityBuffer, Localities, &Subtable); DtInsertSubtable (ParentTable, Subtable); + FieldList = FieldList->Next; } ACPI_FREE (LocalityBuffer); @@ -1411,7 +1405,6 @@ DtCompileUefi ( DT_SUBTABLE *Subtable; DT_SUBTABLE *ParentTable; DT_FIELD **PFieldList = (DT_FIELD **) List; - ACPI_DMTABLE_INFO *Info; UINT16 *DataOffset; @@ -1436,45 +1429,7 @@ DtCompileUefi ( * operators may be used. */ - /* Find any and all labels in the entire generic portion */ - - DtDetectAllLabels (*PFieldList); - - /* Now we can actually compile the parse tree */ - - while (*PFieldList) - { - Info = DtGetGenericTableInfo ((*PFieldList)->Name); - if (!Info) - { - sprintf (MsgBuffer, "Generic data type \"%s\" not found", - (*PFieldList)->Name); - DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME, - (*PFieldList), MsgBuffer); - - *PFieldList = (*PFieldList)->Next; - continue; - } - - Status = DtCompileTable (PFieldList, Info, - &Subtable, TRUE); - if (ACPI_SUCCESS (Status)) - { - DtInsertSubtable (ParentTable, Subtable); - } - else - { - *PFieldList = (*PFieldList)->Next; - - if (Status == AE_NOT_FOUND) - { - sprintf (MsgBuffer, "Generic data type \"%s\" not found", - (*PFieldList)->Name); - DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME, - (*PFieldList), MsgBuffer); - } - } - } + DtCompileGeneric ((void **) PFieldList); return (AE_OK); } @@ -1539,3 +1494,78 @@ DtCompileXsdt ( return (AE_OK); } + + +/****************************************************************************** + * + * FUNCTION: DtCompileGeneric + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile generic unknown table. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileGeneric ( + void **List) +{ + ACPI_STATUS Status; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + DT_FIELD **PFieldList = (DT_FIELD **) List; + ACPI_DMTABLE_INFO *Info; + + + ParentTable = DtPeekSubtable (); + + /* + * Compile the "generic" portion of the table. This + * part of the table is not predefined and any of the generic + * operators may be used. + */ + + /* Find any and all labels in the entire generic portion */ + + DtDetectAllLabels (*PFieldList); + + /* Now we can actually compile the parse tree */ + + while (*PFieldList) + { + Info = DtGetGenericTableInfo ((*PFieldList)->Name); + if (!Info) + { + sprintf (MsgBuffer, "Generic data type \"%s\" not found", + (*PFieldList)->Name); + DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME, + (*PFieldList), MsgBuffer); + + *PFieldList = (*PFieldList)->Next; + continue; + } + + Status = DtCompileTable (PFieldList, Info, + &Subtable, TRUE); + if (ACPI_SUCCESS (Status)) + { + DtInsertSubtable (ParentTable, Subtable); + } + else + { + *PFieldList = (*PFieldList)->Next; + + if (Status == AE_NOT_FOUND) + { + sprintf (MsgBuffer, "Generic data type \"%s\" not found", + (*PFieldList)->Name); + DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME, + (*PFieldList), MsgBuffer); + } + } + } + + return (AE_OK); +} diff --git a/sys/contrib/dev/acpica/compiler/dttemplate.c b/sys/contrib/dev/acpica/compiler/dttemplate.c index 23188d8..b752470 100644 --- a/sys/contrib/dev/acpica/compiler/dttemplate.c +++ b/sys/contrib/dev/acpica/compiler/dttemplate.c @@ -121,7 +121,8 @@ DtCreateTemplates ( /* Create all known templates if requested */ - if (!ACPI_STRNCMP (Signature, "ALL", 3)) + if (!ACPI_STRNCMP (Signature, "ALL", 3) || + !ACPI_STRCMP (Signature, "*")) { Status = DtCreateAllTemplates (); return (Status); diff --git a/sys/contrib/dev/acpica/compiler/dttemplate.h b/sys/contrib/dev/acpica/compiler/dttemplate.h index 79b3a61..1954591 100644 --- a/sys/contrib/dev/acpica/compiler/dttemplate.h +++ b/sys/contrib/dev/acpica/compiler/dttemplate.h @@ -587,14 +587,62 @@ const unsigned char TemplateSlic[] = const unsigned char TemplateSlit[] = { - 0x53,0x4C,0x49,0x54,0x3C,0x00,0x00,0x00, /* 00000000 "SLIT<..." */ - 0x01,0x1B,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */ + 0x53,0x4C,0x49,0x54,0xBC,0x01,0x00,0x00, /* 00000000 "SLIT...." */ + 0x01,0x00,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */ 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ - 0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ - 0x28,0x05,0x10,0x20,0x04,0x00,0x00,0x00, /* 00000020 "(.. ...." */ - 0x00,0x00,0x00,0x00,0x0A,0x0F,0x0F,0x0F, /* 00000028 "........" */ - 0x0F,0x0A,0x0F,0x0F,0x0F,0x0F,0x0A,0x0F, /* 00000030 "........" */ - 0x0F,0x0F,0x0F,0x0A /* 00000038 "...." */ + 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ + 0x16,0x03,0x11,0x20,0x14,0x00,0x00,0x00, /* 00000020 "... ...." */ + 0x00,0x00,0x00,0x00,0x0A,0x10,0x16,0x17, /* 00000028 "........" */ + 0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, /* 00000030 "........" */ + 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27, /* 00000038 " !"#$%&'" */ + 0x10,0x0A,0x15,0x16,0x17,0x18,0x19,0x1A, /* 00000040 "........" */ + 0x1B,0x1C,0x1D,0x1E,0x1F,0x20,0x21,0x22, /* 00000048 "..... !"" */ + 0x23,0x24,0x25,0x26,0x16,0x15,0x0A,0x10, /* 00000050 "#$%&...." */ + 0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D, /* 00000058 "........" */ + 0x1E,0x1F,0x20,0x21,0x22,0x23,0x24,0x25, /* 00000060 ".. !"#$%" */ + 0x17,0x16,0x10,0x0A,0x15,0x16,0x17,0x18, /* 00000068 "........" */ + 0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,0x20, /* 00000070 "....... " */ + 0x21,0x22,0x23,0x24,0x18,0x17,0x16,0x15, /* 00000078 "!"#$...." */ + 0x0A,0x10,0x16,0x17,0x18,0x19,0x1A,0x1B, /* 00000080 "........" */ + 0x1C,0x1D,0x1E,0x1F,0x20,0x21,0x22,0x23, /* 00000088 ".... !"#" */ + 0x19,0x18,0x17,0x16,0x10,0x0A,0x15,0x16, /* 00000090 "........" */ + 0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E, /* 00000098 "........" */ + 0x1F,0x20,0x21,0x22,0x1A,0x19,0x18,0x17, /* 000000A0 ". !"...." */ + 0x16,0x15,0x0A,0x10,0x16,0x17,0x18,0x19, /* 000000A8 "........" */ + 0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,0x20,0x21, /* 000000B0 "...... !" */ + 0x1B,0x1A,0x19,0x18,0x17,0x16,0x10,0x0A, /* 000000B8 "........" */ + 0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C, /* 000000C0 "........" */ + 0x1D,0x1E,0x1F,0x20,0x1C,0x1B,0x1A,0x19, /* 000000C8 "... ...." */ + 0x18,0x17,0x16,0x15,0x0A,0x10,0x16,0x17, /* 000000D0 "........" */ + 0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, /* 000000D8 "........" */ + 0x1D,0x1C,0x1B,0x1A,0x19,0x18,0x17,0x16, /* 000000E0 "........" */ + 0x10,0x0A,0x15,0x16,0x17,0x18,0x19,0x1A, /* 000000E8 "........" */ + 0x1B,0x1C,0x1D,0x1E,0x1E,0x1D,0x1C,0x1B, /* 000000F0 "........" */ + 0x1A,0x19,0x18,0x17,0x16,0x15,0x0A,0x10, /* 000000F8 "........" */ + 0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D, /* 00000100 "........" */ + 0x1F,0x1E,0x1D,0x1C,0x1B,0x1A,0x19,0x18, /* 00000108 "........" */ + 0x17,0x16,0x10,0x0A,0x15,0x16,0x17,0x18, /* 00000110 "........" */ + 0x19,0x1A,0x1B,0x1C,0x20,0x1F,0x1E,0x1D, /* 00000118 ".... ..." */ + 0x1C,0x1B,0x1A,0x19,0x18,0x17,0x16,0x15, /* 00000120 "........" */ + 0x0A,0x10,0x16,0x17,0x18,0x19,0x1A,0x1B, /* 00000128 "........" */ + 0x21,0x20,0x1F,0x1E,0x1D,0x1C,0x1B,0x1A, /* 00000130 "! ......" */ + 0x19,0x18,0x17,0x16,0x10,0x0A,0x15,0x16, /* 00000138 "........" */ + 0x17,0x18,0x19,0x1A,0x22,0x21,0x20,0x1F, /* 00000140 "...."! ." */ + 0x1E,0x1D,0x1C,0x1B,0x1A,0x19,0x18,0x17, /* 00000148 "........" */ + 0x16,0x15,0x0A,0x10,0x16,0x17,0x18,0x19, /* 00000150 "........" */ + 0x23,0x22,0x21,0x20,0x1F,0x1E,0x1D,0x1C, /* 00000158 "#"! ...." */ + 0x1B,0x1A,0x19,0x18,0x17,0x16,0x10,0x0A, /* 00000160 "........" */ + 0x15,0x16,0x17,0x18,0x24,0x23,0x22,0x21, /* 00000168 "....$#"!" */ + 0x20,0x1F,0x1E,0x1D,0x1C,0x1B,0x1A,0x19, /* 00000170 " ......." */ + 0x18,0x17,0x16,0x15,0x0A,0x10,0x16,0x17, /* 00000178 "........" */ + 0x25,0x24,0x23,0x22,0x21,0x20,0x1F,0x1E, /* 00000180 "%$#"! .." */ + 0x1D,0x1C,0x1B,0x1A,0x19,0x18,0x17,0x16, /* 00000188 "........" */ + 0x10,0x0A,0x15,0x16,0x26,0x25,0x24,0x23, /* 00000190 "....&%$#" */ + 0x22,0x21,0x20,0x1F,0x1E,0x1D,0x1C,0x1B, /* 00000198 ""! ....." */ + 0x1A,0x19,0x18,0x17,0x16,0x15,0x0A,0x10, /* 000001A0 "........" */ + 0x27,0x26,0x25,0x24,0x23,0x22,0x21,0x20, /* 000001A8 "'&%$#"! " */ + 0x1F,0x1E,0x1D,0x1C,0x1B,0x1A,0x19,0x18, /* 000001B0 "........" */ + 0x17,0x16,0x10,0x0A /* 000001B8 "...." */ }; const unsigned char TemplateSpcr[] = diff --git a/sys/contrib/dev/acpica/compiler/dtutils.c b/sys/contrib/dev/acpica/compiler/dtutils.c index bfe4138..da9b237 100644 --- a/sys/contrib/dev/acpica/compiler/dtutils.c +++ b/sys/contrib/dev/acpica/compiler/dtutils.c @@ -189,8 +189,16 @@ DtFatal ( DtError (ASL_ERROR, MessageId, FieldObject, ExtraMessage); +/* + * TBD: remove this entire function, DtFatal + * + * We cannot abort the compiler on error, because we may be compiling a + * list of files. We must move on to the next file. + */ +#ifdef __OBSOLETE CmCleanupAndExit (); exit (1); +#endif } @@ -316,7 +324,6 @@ DtGetFileSize ( * FUNCTION: DtGetFieldValue * * PARAMETERS: Field - Current field list pointer - * Name - Field name * * RETURN: Field value * @@ -326,23 +333,14 @@ DtGetFileSize ( char * DtGetFieldValue ( - DT_FIELD *Field, - char *Name) + DT_FIELD *Field) { - - /* Search the field list for the name */ - - while (Field) + if (!Field) { - if (!ACPI_STRCMP (Name, Field->Name)) - { - return (Field->Value); - } - - Field = Field->Next; + return (NULL); } - return (NULL); + return (Field->Value); } @@ -479,7 +477,7 @@ DtGetBufferLength ( * * FUNCTION: DtGetFieldLength * - * PARAMETERS: Field - Current field list pointer + * PARAMETERS: Field - Current field * Info - Data table info * * RETURN: Field length @@ -567,7 +565,7 @@ DtGetFieldLength ( break; case ACPI_DMT_STRING: - Value = DtGetFieldValue (Field, Info->Name); + Value = DtGetFieldValue (Field); if (Value) { ByteLength = ACPI_STRLEN (Value) + 1; @@ -577,6 +575,7 @@ DtGetFieldLength ( sprintf (MsgBuffer, "Expected \"%s\"", Info->Name); DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, MsgBuffer); + return (0); } break; @@ -589,7 +588,7 @@ DtGetFieldLength ( break; case ACPI_DMT_BUFFER: - Value = DtGetFieldValue (Field, Info->Name); + Value = DtGetFieldValue (Field); if (Value) { ByteLength = DtGetBufferLength (Value); @@ -599,6 +598,7 @@ DtGetFieldLength ( sprintf (MsgBuffer, "Expected \"%s\"", Info->Name); DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, MsgBuffer); + return (0); } break; @@ -612,7 +612,7 @@ DtGetFieldLength ( break; case ACPI_DMT_UNICODE: - Value = DtGetFieldValue (Field, Info->Name); + Value = DtGetFieldValue (Field); /* TBD: error if Value is NULL? (as below?) */ @@ -621,7 +621,7 @@ DtGetFieldLength ( default: DtFatal (ASL_MSG_COMPILER_INTERNAL, Field, "Invalid table opcode"); - break; + return (0); } return (ByteLength); diff --git a/sys/contrib/dev/acpica/debugger/dbdisply.c b/sys/contrib/dev/acpica/debugger/dbdisply.c index 2dae4f6..bcfca6e 100644 --- a/sys/contrib/dev/acpica/debugger/dbdisply.c +++ b/sys/contrib/dev/acpica/debugger/dbdisply.c @@ -69,6 +69,50 @@ AcpiDbGetPointer ( void *Target); +/* + * System handler information. + * Used for Handlers command, in AcpiDbDisplayHandlers. + */ +#define ACPI_PREDEFINED_PREFIX "%25s (%.2X) : " +#define ACPI_HANDLER_NAME_STRING "%30s : " +#define ACPI_HANDLER_PRESENT_STRING "%-9s (%p)\n" +#define ACPI_HANDLER_NOT_PRESENT_STRING "%-9s\n" + +/* All predefined Address Space IDs */ + +static ACPI_ADR_SPACE_TYPE AcpiGbl_SpaceIdList[] = +{ + ACPI_ADR_SPACE_SYSTEM_MEMORY, + ACPI_ADR_SPACE_SYSTEM_IO, + ACPI_ADR_SPACE_PCI_CONFIG, + ACPI_ADR_SPACE_EC, + ACPI_ADR_SPACE_SMBUS, + ACPI_ADR_SPACE_CMOS, + ACPI_ADR_SPACE_PCI_BAR_TARGET, + ACPI_ADR_SPACE_IPMI, + ACPI_ADR_SPACE_DATA_TABLE, + ACPI_ADR_SPACE_FIXED_HARDWARE +}; + +/* Global handler information */ + +typedef struct acpi_handler_info +{ + void *Handler; + char *Name; + +} ACPI_HANDLER_INFO; + +static ACPI_HANDLER_INFO AcpiGbl_HandlerList[] = +{ + {&AcpiGbl_SystemNotify.Handler, "System Notifications"}, + {&AcpiGbl_DeviceNotify.Handler, "Device Notifications"}, + {&AcpiGbl_TableHandler, "ACPI Table Events"}, + {&AcpiGbl_ExceptionHandler, "Control Method Exceptions"}, + {&AcpiGbl_InterfaceHandler, "OSI Invocations"} +}; + + /******************************************************************************* * * FUNCTION: AcpiDbGetPointer @@ -887,6 +931,7 @@ AcpiDbDisplayGpes ( } } + /******************************************************************************* * * FUNCTION: AcpiDbDisplayHandlers @@ -899,46 +944,6 @@ AcpiDbDisplayGpes ( * ******************************************************************************/ -#define ACPI_PREDEFINED_PREFIX "%25s (%.2X) : " -#define ACPI_HANDLER_NAME_STRING "%30s : " -#define ACPI_HANDLER_PRESENT_STRING "%-9s (%p)\n" -#define ACPI_HANDLER_NOT_PRESENT_STRING "%-9s\n" - -/* All predefined Space IDs */ - -static ACPI_ADR_SPACE_TYPE SpaceIdList[] = -{ - ACPI_ADR_SPACE_SYSTEM_MEMORY, - ACPI_ADR_SPACE_SYSTEM_IO, - ACPI_ADR_SPACE_PCI_CONFIG, - ACPI_ADR_SPACE_EC, - ACPI_ADR_SPACE_SMBUS, - ACPI_ADR_SPACE_CMOS, - ACPI_ADR_SPACE_PCI_BAR_TARGET, - ACPI_ADR_SPACE_IPMI, - ACPI_ADR_SPACE_DATA_TABLE, - ACPI_ADR_SPACE_FIXED_HARDWARE -}; - -/* Global handler information */ - -typedef struct acpi_handler_info -{ - void *Handler; - char *Name; - -} ACPI_HANDLER_INFO; - -ACPI_HANDLER_INFO HandlerList[] = -{ - {&AcpiGbl_SystemNotify.Handler, "System Notifications"}, - {&AcpiGbl_DeviceNotify.Handler, "Device Notifications"}, - {&AcpiGbl_TableHandler, "ACPI Table Events"}, - {&AcpiGbl_ExceptionHandler, "Control Method Exceptions"}, - {&AcpiGbl_InterfaceHandler, "OSI Invocations"} -}; - - void AcpiDbDisplayHandlers ( void) @@ -956,9 +961,9 @@ AcpiDbDisplayHandlers ( ObjDesc = AcpiNsGetAttachedObject (AcpiGbl_RootNode); if (ObjDesc) { - for (i = 0; i < ACPI_ARRAY_LENGTH (SpaceIdList); i++) + for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiGbl_SpaceIdList); i++) { - SpaceId = SpaceIdList[i]; + SpaceId = AcpiGbl_SpaceIdList[i]; HandlerObj = ObjDesc->Device.Handler; AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, @@ -1008,13 +1013,13 @@ AcpiDbDisplayHandlers ( AcpiOsPrintf ("\nMiscellaneous Global Handlers:\n"); - for (i = 0; i < ACPI_ARRAY_LENGTH (HandlerList); i++) + for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiGbl_HandlerList); i++) { - AcpiOsPrintf (ACPI_HANDLER_NAME_STRING, HandlerList[i].Name); - if (HandlerList[i].Handler) + AcpiOsPrintf (ACPI_HANDLER_NAME_STRING, AcpiGbl_HandlerList[i].Name); + if (AcpiGbl_HandlerList[i].Handler) { AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, "User", - HandlerList[i].Handler); + AcpiGbl_HandlerList[i].Handler); } else { diff --git a/sys/contrib/dev/acpica/dispatcher/dswload.c b/sys/contrib/dev/acpica/dispatcher/dswload.c index 5ecf30e..45c088b 100644 --- a/sys/contrib/dev/acpica/dispatcher/dswload.c +++ b/sys/contrib/dev/acpica/dispatcher/dswload.c @@ -466,7 +466,7 @@ AcpiDsLoad1EndOp ( else if (Op->Common.AmlOpcode == AML_DATA_REGION_OP) { Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length, - REGION_DATA_TABLE, WalkState); + ACPI_ADR_SPACE_DATA_TABLE, WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); diff --git a/sys/contrib/dev/acpica/dispatcher/dswload2.c b/sys/contrib/dev/acpica/dispatcher/dswload2.c index f79b7f7..fde57ca 100644 --- a/sys/contrib/dev/acpica/dispatcher/dswload2.c +++ b/sys/contrib/dev/acpica/dispatcher/dswload2.c @@ -586,7 +586,7 @@ AcpiDsLoad2EndOp ( } else { - RegionSpace = REGION_DATA_TABLE; + RegionSpace = ACPI_ADR_SPACE_DATA_TABLE; } /* diff --git a/sys/contrib/dev/acpica/events/evglock.c b/sys/contrib/dev/acpica/events/evglock.c new file mode 100644 index 0000000..cc19887 --- /dev/null +++ b/sys/contrib/dev/acpica/events/evglock.c @@ -0,0 +1,367 @@ +/****************************************************************************** + * + * Module Name: evglock - Global Lock support + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2011, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + +#include <contrib/dev/acpica/include/acpi.h> +#include <contrib/dev/acpica/include/accommon.h> +#include <contrib/dev/acpica/include/acevents.h> +#include <contrib/dev/acpica/include/acinterp.h> + +#define _COMPONENT ACPI_EVENTS + ACPI_MODULE_NAME ("evglock") + + +/* Local prototypes */ + +static UINT32 +AcpiEvGlobalLockHandler ( + void *Context); + + +/******************************************************************************* + * + * FUNCTION: AcpiEvInitGlobalLockHandler + * + * PARAMETERS: None + * + * RETURN: Status + * + * DESCRIPTION: Install a handler for the global lock release event + * + ******************************************************************************/ + +ACPI_STATUS +AcpiEvInitGlobalLockHandler ( + void) +{ + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (EvInitGlobalLockHandler); + + + /* Attempt installation of the global lock handler */ + + Status = AcpiInstallFixedEventHandler (ACPI_EVENT_GLOBAL, + AcpiEvGlobalLockHandler, NULL); + + /* + * If the global lock does not exist on this platform, the attempt to + * enable GBL_STATUS will fail (the GBL_ENABLE bit will not stick). + * Map to AE_OK, but mark global lock as not present. Any attempt to + * actually use the global lock will be flagged with an error. + */ + AcpiGbl_GlobalLockPresent = FALSE; + if (Status == AE_NO_HARDWARE_RESPONSE) + { + ACPI_ERROR ((AE_INFO, + "No response from Global Lock hardware, disabling lock")); + + return_ACPI_STATUS (AE_OK); + } + + Status = AcpiOsCreateLock (&AcpiGbl_GlobalLockPendingLock); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + AcpiGbl_GlobalLockPending = FALSE; + AcpiGbl_GlobalLockPresent = TRUE; + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiEvRemoveGlobalLockHandler + * + * PARAMETERS: None + * + * RETURN: Status + * + * DESCRIPTION: Remove the handler for the Global Lock + * + ******************************************************************************/ + +ACPI_STATUS +AcpiEvRemoveGlobalLockHandler ( + void) +{ + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (EvRemoveGlobalLockHandler); + + AcpiGbl_GlobalLockPresent = FALSE; + Status = AcpiRemoveFixedEventHandler (ACPI_EVENT_GLOBAL, + AcpiEvGlobalLockHandler); + + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiEvGlobalLockHandler + * + * PARAMETERS: Context - From thread interface, not used + * + * RETURN: ACPI_INTERRUPT_HANDLED + * + * DESCRIPTION: Invoked directly from the SCI handler when a global lock + * release interrupt occurs. If there is actually a pending + * request for the lock, signal the waiting thread. + * + ******************************************************************************/ + +static UINT32 +AcpiEvGlobalLockHandler ( + void *Context) +{ + ACPI_STATUS Status; + ACPI_CPU_FLAGS Flags; + + + Flags = AcpiOsAcquireLock (AcpiGbl_GlobalLockPendingLock); + + /* + * If a request for the global lock is not actually pending, + * we are done. This handles "spurious" global lock interrupts + * which are possible (and have been seen) with bad BIOSs. + */ + if (!AcpiGbl_GlobalLockPending) + { + goto CleanupAndExit; + } + + /* + * Send a unit to the global lock semaphore. The actual acquisition + * of the global lock will be performed by the waiting thread. + */ + Status = AcpiOsSignalSemaphore (AcpiGbl_GlobalLockSemaphore, 1); + if (ACPI_FAILURE (Status)) + { + ACPI_ERROR ((AE_INFO, "Could not signal Global Lock semaphore")); + } + + AcpiGbl_GlobalLockPending = FALSE; + + +CleanupAndExit: + + AcpiOsReleaseLock (AcpiGbl_GlobalLockPendingLock, Flags); + return (ACPI_INTERRUPT_HANDLED); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiEvAcquireGlobalLock + * + * PARAMETERS: Timeout - Max time to wait for the lock, in millisec. + * + * RETURN: Status + * + * DESCRIPTION: Attempt to gain ownership of the Global Lock. + * + * MUTEX: Interpreter must be locked + * + * Note: The original implementation allowed multiple threads to "acquire" the + * Global Lock, and the OS would hold the lock until the last thread had + * released it. However, this could potentially starve the BIOS out of the + * lock, especially in the case where there is a tight handshake between the + * Embedded Controller driver and the BIOS. Therefore, this implementation + * allows only one thread to acquire the HW Global Lock at a time, and makes + * the global lock appear as a standard mutex on the OS side. + * + *****************************************************************************/ + +ACPI_STATUS +AcpiEvAcquireGlobalLock ( + UINT16 Timeout) +{ + ACPI_CPU_FLAGS Flags; + ACPI_STATUS Status; + BOOLEAN Acquired = FALSE; + + + ACPI_FUNCTION_TRACE (EvAcquireGlobalLock); + + + /* + * Only one thread can acquire the GL at a time, the GlobalLockMutex + * enforces this. This interface releases the interpreter if we must wait. + */ + Status = AcpiExSystemWaitMutex (AcpiGbl_GlobalLockMutex->Mutex.OsMutex, + Timeout); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* + * Update the global lock handle and check for wraparound. The handle is + * only used for the external global lock interfaces, but it is updated + * here to properly handle the case where a single thread may acquire the + * lock via both the AML and the AcpiAcquireGlobalLock interfaces. The + * handle is therefore updated on the first acquire from a given thread + * regardless of where the acquisition request originated. + */ + AcpiGbl_GlobalLockHandle++; + if (AcpiGbl_GlobalLockHandle == 0) + { + AcpiGbl_GlobalLockHandle = 1; + } + + /* + * Make sure that a global lock actually exists. If not, just + * treat the lock as a standard mutex. + */ + if (!AcpiGbl_GlobalLockPresent) + { + AcpiGbl_GlobalLockAcquired = TRUE; + return_ACPI_STATUS (AE_OK); + } + + Flags = AcpiOsAcquireLock (AcpiGbl_GlobalLockPendingLock); + + do + { + /* Attempt to acquire the actual hardware lock */ + + ACPI_ACQUIRE_GLOBAL_LOCK (AcpiGbl_FACS, Acquired); + if (Acquired) + { + AcpiGbl_GlobalLockAcquired = TRUE; + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "Acquired hardware Global Lock\n")); + break; + } + + /* + * Did not get the lock. The pending bit was set above, and + * we must now wait until we receive the global lock + * released interrupt. + */ + AcpiGbl_GlobalLockPending = TRUE; + AcpiOsReleaseLock (AcpiGbl_GlobalLockPendingLock, Flags); + + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "Waiting for hardware Global Lock\n")); + + /* + * Wait for handshake with the global lock interrupt handler. + * This interface releases the interpreter if we must wait. + */ + Status = AcpiExSystemWaitSemaphore (AcpiGbl_GlobalLockSemaphore, + ACPI_WAIT_FOREVER); + + Flags = AcpiOsAcquireLock (AcpiGbl_GlobalLockPendingLock); + + } while (ACPI_SUCCESS (Status)); + + AcpiGbl_GlobalLockPending = FALSE; + AcpiOsReleaseLock (AcpiGbl_GlobalLockPendingLock, Flags); + + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiEvReleaseGlobalLock + * + * PARAMETERS: None + * + * RETURN: Status + * + * DESCRIPTION: Releases ownership of the Global Lock. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiEvReleaseGlobalLock ( + void) +{ + BOOLEAN Pending = FALSE; + ACPI_STATUS Status = AE_OK; + + + ACPI_FUNCTION_TRACE (EvReleaseGlobalLock); + + + /* Lock must be already acquired */ + + if (!AcpiGbl_GlobalLockAcquired) + { + ACPI_WARNING ((AE_INFO, + "Cannot release the ACPI Global Lock, it has not been acquired")); + return_ACPI_STATUS (AE_NOT_ACQUIRED); + } + + if (AcpiGbl_GlobalLockPresent) + { + /* Allow any thread to release the lock */ + + ACPI_RELEASE_GLOBAL_LOCK (AcpiGbl_FACS, Pending); + + /* + * If the pending bit was set, we must write GBL_RLS to the control + * register + */ + if (Pending) + { + Status = AcpiWriteBitRegister ( + ACPI_BITREG_GLOBAL_LOCK_RELEASE, ACPI_ENABLE_EVENT); + } + + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Released hardware Global Lock\n")); + } + + AcpiGbl_GlobalLockAcquired = FALSE; + + /* Release the local GL mutex */ + + AcpiOsReleaseMutex (AcpiGbl_GlobalLockMutex->Mutex.OsMutex); + return_ACPI_STATUS (Status); +} diff --git a/sys/contrib/dev/acpica/events/evmisc.c b/sys/contrib/dev/acpica/events/evmisc.c index 637140f..a537bf4 100644 --- a/sys/contrib/dev/acpica/events/evmisc.c +++ b/sys/contrib/dev/acpica/events/evmisc.c @@ -45,7 +45,6 @@ #include <contrib/dev/acpica/include/accommon.h> #include <contrib/dev/acpica/include/acevents.h> #include <contrib/dev/acpica/include/acnamesp.h> -#include <contrib/dev/acpica/include/acinterp.h> #define _COMPONENT ACPI_EVENTS ACPI_MODULE_NAME ("evmisc") @@ -57,14 +56,6 @@ static void ACPI_SYSTEM_XFACE AcpiEvNotifyDispatch ( void *Context); -static UINT32 -AcpiEvGlobalLockHandler ( - void *Context); - -static ACPI_STATUS -AcpiEvRemoveGlobalLockHandler ( - void); - /******************************************************************************* * @@ -300,316 +291,6 @@ AcpiEvNotifyDispatch ( } -/******************************************************************************* - * - * FUNCTION: AcpiEvGlobalLockHandler - * - * PARAMETERS: Context - From thread interface, not used - * - * RETURN: ACPI_INTERRUPT_HANDLED - * - * DESCRIPTION: Invoked directly from the SCI handler when a global lock - * release interrupt occurs. If there is actually a pending - * request for the lock, signal the waiting thread. - * - ******************************************************************************/ - -static UINT32 -AcpiEvGlobalLockHandler ( - void *Context) -{ - ACPI_STATUS Status; - ACPI_CPU_FLAGS Flags; - - - Flags = AcpiOsAcquireLock (AcpiGbl_GlobalLockPendingLock); - - /* - * If a request for the global lock is not actually pending, - * we are done. This handles "spurious" global lock interrupts - * which are possible (and have been seen) with bad BIOSs. - */ - if (!AcpiGbl_GlobalLockPending) - { - goto CleanupAndExit; - } - - /* - * Send a unit to the global lock semaphore. The actual acquisition - * of the global lock will be performed by the waiting thread. - */ - Status = AcpiOsSignalSemaphore (AcpiGbl_GlobalLockSemaphore, 1); - if (ACPI_FAILURE (Status)) - { - ACPI_ERROR ((AE_INFO, "Could not signal Global Lock semaphore")); - } - - AcpiGbl_GlobalLockPending = FALSE; - - -CleanupAndExit: - - AcpiOsReleaseLock (AcpiGbl_GlobalLockPendingLock, Flags); - return (ACPI_INTERRUPT_HANDLED); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvInitGlobalLockHandler - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Install a handler for the global lock release event - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvInitGlobalLockHandler ( - void) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (EvInitGlobalLockHandler); - - - /* Attempt installation of the global lock handler */ - - Status = AcpiInstallFixedEventHandler (ACPI_EVENT_GLOBAL, - AcpiEvGlobalLockHandler, NULL); - - /* - * If the global lock does not exist on this platform, the attempt to - * enable GBL_STATUS will fail (the GBL_ENABLE bit will not stick). - * Map to AE_OK, but mark global lock as not present. Any attempt to - * actually use the global lock will be flagged with an error. - */ - AcpiGbl_GlobalLockPresent = FALSE; - if (Status == AE_NO_HARDWARE_RESPONSE) - { - ACPI_ERROR ((AE_INFO, - "No response from Global Lock hardware, disabling lock")); - - return_ACPI_STATUS (AE_OK); - } - - Status = AcpiOsCreateLock (&AcpiGbl_GlobalLockPendingLock); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - AcpiGbl_GlobalLockPending = FALSE; - AcpiGbl_GlobalLockPresent = TRUE; - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvRemoveGlobalLockHandler - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Remove the handler for the Global Lock - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiEvRemoveGlobalLockHandler ( - void) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (EvRemoveGlobalLockHandler); - - AcpiGbl_GlobalLockPresent = FALSE; - Status = AcpiRemoveFixedEventHandler (ACPI_EVENT_GLOBAL, - AcpiEvGlobalLockHandler); - - return_ACPI_STATUS (Status); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiEvAcquireGlobalLock - * - * PARAMETERS: Timeout - Max time to wait for the lock, in millisec. - * - * RETURN: Status - * - * DESCRIPTION: Attempt to gain ownership of the Global Lock. - * - * MUTEX: Interpreter must be locked - * - * Note: The original implementation allowed multiple threads to "acquire" the - * Global Lock, and the OS would hold the lock until the last thread had - * released it. However, this could potentially starve the BIOS out of the - * lock, especially in the case where there is a tight handshake between the - * Embedded Controller driver and the BIOS. Therefore, this implementation - * allows only one thread to acquire the HW Global Lock at a time, and makes - * the global lock appear as a standard mutex on the OS side. - * - *****************************************************************************/ - -ACPI_STATUS -AcpiEvAcquireGlobalLock ( - UINT16 Timeout) -{ - ACPI_CPU_FLAGS Flags; - ACPI_STATUS Status; - BOOLEAN Acquired = FALSE; - - - ACPI_FUNCTION_TRACE (EvAcquireGlobalLock); - - - /* - * Only one thread can acquire the GL at a time, the GlobalLockMutex - * enforces this. This interface releases the interpreter if we must wait. - */ - Status = AcpiExSystemWaitMutex (AcpiGbl_GlobalLockMutex->Mutex.OsMutex, - Timeout); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* - * Update the global lock handle and check for wraparound. The handle is - * only used for the external global lock interfaces, but it is updated - * here to properly handle the case where a single thread may acquire the - * lock via both the AML and the AcpiAcquireGlobalLock interfaces. The - * handle is therefore updated on the first acquire from a given thread - * regardless of where the acquisition request originated. - */ - AcpiGbl_GlobalLockHandle++; - if (AcpiGbl_GlobalLockHandle == 0) - { - AcpiGbl_GlobalLockHandle = 1; - } - - /* - * Make sure that a global lock actually exists. If not, just - * treat the lock as a standard mutex. - */ - if (!AcpiGbl_GlobalLockPresent) - { - AcpiGbl_GlobalLockAcquired = TRUE; - return_ACPI_STATUS (AE_OK); - } - - Flags = AcpiOsAcquireLock (AcpiGbl_GlobalLockPendingLock); - - do - { - /* Attempt to acquire the actual hardware lock */ - - ACPI_ACQUIRE_GLOBAL_LOCK (AcpiGbl_FACS, Acquired); - if (Acquired) - { - AcpiGbl_GlobalLockAcquired = TRUE; - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Acquired hardware Global Lock\n")); - break; - } - - /* - * Did not get the lock. The pending bit was set above, and - * we must now wait until we receive the global lock - * released interrupt. - */ - AcpiGbl_GlobalLockPending = TRUE; - AcpiOsReleaseLock (AcpiGbl_GlobalLockPendingLock, Flags); - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Waiting for hardware Global Lock\n")); - - /* - * Wait for handshake with the global lock interrupt handler. - * This interface releases the interpreter if we must wait. - */ - Status = AcpiExSystemWaitSemaphore (AcpiGbl_GlobalLockSemaphore, - ACPI_WAIT_FOREVER); - - Flags = AcpiOsAcquireLock (AcpiGbl_GlobalLockPendingLock); - - } while (ACPI_SUCCESS (Status)); - - AcpiGbl_GlobalLockPending = FALSE; - AcpiOsReleaseLock (AcpiGbl_GlobalLockPendingLock, Flags); - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvReleaseGlobalLock - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Releases ownership of the Global Lock. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvReleaseGlobalLock ( - void) -{ - BOOLEAN Pending = FALSE; - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_TRACE (EvReleaseGlobalLock); - - - /* Lock must be already acquired */ - - if (!AcpiGbl_GlobalLockAcquired) - { - ACPI_WARNING ((AE_INFO, - "Cannot release the ACPI Global Lock, it has not been acquired")); - return_ACPI_STATUS (AE_NOT_ACQUIRED); - } - - if (AcpiGbl_GlobalLockPresent) - { - /* Allow any thread to release the lock */ - - ACPI_RELEASE_GLOBAL_LOCK (AcpiGbl_FACS, Pending); - - /* - * If the pending bit was set, we must write GBL_RLS to the control - * register - */ - if (Pending) - { - Status = AcpiWriteBitRegister ( - ACPI_BITREG_GLOBAL_LOCK_RELEASE, ACPI_ENABLE_EVENT); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Released hardware Global Lock\n")); - } - - AcpiGbl_GlobalLockAcquired = FALSE; - - /* Release the local GL mutex */ - - AcpiOsReleaseMutex (AcpiGbl_GlobalLockMutex->Mutex.OsMutex); - return_ACPI_STATUS (Status); -} - - /****************************************************************************** * * FUNCTION: AcpiEvTerminate @@ -689,4 +370,3 @@ AcpiEvTerminate ( } return_VOID; } - diff --git a/sys/contrib/dev/acpica/events/evregion.c b/sys/contrib/dev/acpica/events/evregion.c index 6d7f969..6b0d7f1 100644 --- a/sys/contrib/dev/acpica/events/evregion.c +++ b/sys/contrib/dev/acpica/events/evregion.c @@ -61,6 +61,10 @@ AcpiEvHasDefaultHandler ( ACPI_NAMESPACE_NODE *Node, ACPI_ADR_SPACE_TYPE SpaceId); +static void +AcpiEvOrphanEcRegMethod ( + void); + static ACPI_STATUS AcpiEvRegRun ( ACPI_HANDLE ObjHandle, @@ -611,7 +615,7 @@ AcpiEvDetachRegion( /* Now stop region accesses by executing the _REG method */ - Status = AcpiEvExecuteRegMethod (RegionObj, 0); + Status = AcpiEvExecuteRegMethod (RegionObj, ACPI_REG_DISCONNECT); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "from region _REG, [%s]", @@ -1142,6 +1146,13 @@ AcpiEvExecuteRegMethods ( ACPI_NS_WALK_UNLOCK, AcpiEvRegRun, NULL, &SpaceId, NULL); + /* Special case for EC: handle "orphan" _REG methods with no region */ + + if (SpaceId == ACPI_ADR_SPACE_EC) + { + AcpiEvOrphanEcRegMethod (); + } + return_ACPI_STATUS (Status); } @@ -1208,7 +1219,122 @@ AcpiEvRegRun ( return (AE_OK); } - Status = AcpiEvExecuteRegMethod (ObjDesc, 1); + Status = AcpiEvExecuteRegMethod (ObjDesc, ACPI_REG_CONNECT); return (Status); } + +/******************************************************************************* + * + * FUNCTION: AcpiEvOrphanEcRegMethod + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Execute an "orphan" _REG method that appears under the EC + * device. This is a _REG method that has no corresponding region + * within the EC device scope. The orphan _REG method appears to + * have been enabled by the description of the ECDT in the ACPI + * specification: "The availability of the region space can be + * detected by providing a _REG method object underneath the + * Embedded Controller device." + * + * To quickly access the EC device, we use the EC_ID that appears + * within the ECDT. Otherwise, we would need to perform a time- + * consuming namespace walk, executing _HID methods to find the + * EC device. + * + ******************************************************************************/ + +static void +AcpiEvOrphanEcRegMethod ( + void) +{ + ACPI_TABLE_ECDT *Table; + ACPI_STATUS Status; + ACPI_OBJECT_LIST Args; + ACPI_OBJECT Objects[2]; + ACPI_NAMESPACE_NODE *EcDeviceNode; + ACPI_NAMESPACE_NODE *RegMethod; + ACPI_NAMESPACE_NODE *NextNode; + + + ACPI_FUNCTION_TRACE (EvOrphanEcRegMethod); + + + /* Get the ECDT (if present in system) */ + + Status = AcpiGetTable (ACPI_SIG_ECDT, 0, + ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &Table)); + if (ACPI_FAILURE (Status)) + { + return_VOID; + } + + /* We need a valid EC_ID string */ + + if (!(*Table->Id)) + { + return_VOID; + } + + /* Namespace is currently locked, must release */ + + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + + /* Get a handle to the EC device referenced in the ECDT */ + + Status = AcpiGetHandle (NULL, + ACPI_CAST_PTR (char, Table->Id), + ACPI_CAST_PTR (ACPI_HANDLE, &EcDeviceNode)); + if (ACPI_FAILURE (Status)) + { + goto Exit; + } + + /* Get a handle to a _REG method immediately under the EC device */ + + Status = AcpiGetHandle (EcDeviceNode, + METHOD_NAME__REG, ACPI_CAST_PTR (ACPI_HANDLE, &RegMethod)); + if (ACPI_FAILURE (Status)) + { + goto Exit; + } + + /* + * Execute the _REG method only if there is no Operation Region in + * this scope with the Embedded Controller space ID. Otherwise, it + * will already have been executed. Note, this allows for Regions + * with other space IDs to be present; but the code below will then + * execute the _REG method with the EC space ID argument. + */ + NextNode = AcpiNsGetNextNode (EcDeviceNode, NULL); + while (NextNode) + { + if ((NextNode->Type == ACPI_TYPE_REGION) && + (NextNode->Object) && + (NextNode->Object->Region.SpaceId == ACPI_ADR_SPACE_EC)) + { + goto Exit; /* Do not execute _REG */ + } + NextNode = AcpiNsGetNextNode (EcDeviceNode, NextNode); + } + + /* Evaluate the _REG(EC,Connect) method */ + + Args.Count = 2; + Args.Pointer = Objects; + Objects[0].Type = ACPI_TYPE_INTEGER; + Objects[0].Integer.Value = ACPI_ADR_SPACE_EC; + Objects[1].Type = ACPI_TYPE_INTEGER; + Objects[1].Integer.Value = ACPI_REG_CONNECT; + + Status = AcpiEvaluateObject (RegMethod, NULL, &Args, NULL); + +Exit: + /* We ignore all errors from above, don't care */ + + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + return_VOID; +} diff --git a/sys/contrib/dev/acpica/events/evrgnini.c b/sys/contrib/dev/acpica/events/evrgnini.c index 802a40d..f707fa5 100644 --- a/sys/contrib/dev/acpica/events/evrgnini.c +++ b/sys/contrib/dev/acpica/events/evrgnini.c @@ -696,7 +696,7 @@ AcpiEvInitializeRegion ( } } - Status = AcpiEvExecuteRegMethod (RegionObj, 1); + Status = AcpiEvExecuteRegMethod (RegionObj, ACPI_REG_CONNECT); if (AcpiNsLocked) { diff --git a/sys/contrib/dev/acpica/events/evxfregn.c b/sys/contrib/dev/acpica/events/evxfregn.c index a53cb75..e9555c7 100644 --- a/sys/contrib/dev/acpica/events/evxfregn.c +++ b/sys/contrib/dev/acpica/events/evxfregn.c @@ -141,20 +141,21 @@ AcpiInstallAddressSpaceHandler ( case ACPI_ADR_SPACE_PCI_CONFIG: case ACPI_ADR_SPACE_DATA_TABLE: - if (AcpiGbl_RegMethodsExecuted) + if (!AcpiGbl_RegMethodsExecuted) { - /* Run all _REG methods for this address space */ - - Status = AcpiEvExecuteRegMethods (Node, SpaceId); + /* We will defer execution of the _REG methods for this space */ + goto UnlockAndExit; } break; default: - - Status = AcpiEvExecuteRegMethods (Node, SpaceId); break; } + /* Run all _REG methods for this address space */ + + Status = AcpiEvExecuteRegMethods (Node, SpaceId); + UnlockAndExit: (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); diff --git a/sys/contrib/dev/acpica/executer/excreate.c b/sys/contrib/dev/acpica/executer/excreate.c index fcd58a7..b7bc513 100644 --- a/sys/contrib/dev/acpica/executer/excreate.c +++ b/sys/contrib/dev/acpica/executer/excreate.c @@ -327,7 +327,8 @@ AcpiExCreateRegion ( * range */ if ((RegionSpace >= ACPI_NUM_PREDEFINED_REGIONS) && - (RegionSpace < ACPI_USER_REGION_BEGIN)) + (RegionSpace < ACPI_USER_REGION_BEGIN) && + (RegionSpace != ACPI_ADR_SPACE_DATA_TABLE)) { ACPI_ERROR ((AE_INFO, "Invalid AddressSpace type 0x%X", RegionSpace)); return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID); diff --git a/sys/contrib/dev/acpica/include/acconfig.h b/sys/contrib/dev/acpica/include/acconfig.h index 78eaf40..4b05ed3 100644 --- a/sys/contrib/dev/acpica/include/acconfig.h +++ b/sys/contrib/dev/acpica/include/acconfig.h @@ -168,7 +168,6 @@ /* Operation regions */ -#define ACPI_NUM_PREDEFINED_REGIONS 9 #define ACPI_USER_REGION_BEGIN 0x80 /* Maximum SpaceIds for Operation Regions */ diff --git a/sys/contrib/dev/acpica/include/acevents.h b/sys/contrib/dev/acpica/include/acevents.h index abcce0b..8681ed5 100644 --- a/sys/contrib/dev/acpica/include/acevents.h +++ b/sys/contrib/dev/acpica/include/acevents.h @@ -68,6 +68,23 @@ BOOLEAN AcpiEvIsNotifyObject ( ACPI_NAMESPACE_NODE *Node); +UINT32 +AcpiEvGetGpeNumberIndex ( + UINT32 GpeNumber); + +ACPI_STATUS +AcpiEvQueueNotifyRequest ( + ACPI_NAMESPACE_NODE *Node, + UINT32 NotifyValue); + + +/* + * evglock - Global Lock support + */ +ACPI_STATUS +AcpiEvInitGlobalLockHandler ( + void); + ACPI_STATUS AcpiEvAcquireGlobalLock( UINT16 Timeout); @@ -77,18 +94,9 @@ AcpiEvReleaseGlobalLock( void); ACPI_STATUS -AcpiEvInitGlobalLockHandler ( +AcpiEvRemoveGlobalLockHandler ( void); -UINT32 -AcpiEvGetGpeNumberIndex ( - UINT32 GpeNumber); - -ACPI_STATUS -AcpiEvQueueNotifyRequest ( - ACPI_NAMESPACE_NODE *Node, - UINT32 NotifyValue); - /* * evgpe - Low-level GPE support diff --git a/sys/contrib/dev/acpica/include/acpixf.h b/sys/contrib/dev/acpica/include/acpixf.h index 8a06213..891ccf3 100644 --- a/sys/contrib/dev/acpica/include/acpixf.h +++ b/sys/contrib/dev/acpica/include/acpixf.h @@ -48,7 +48,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20110316 +#define ACPI_CA_VERSION 0x20110413 #include <contrib/dev/acpica/include/actypes.h> #include <contrib/dev/acpica/include/actbl.h> diff --git a/sys/contrib/dev/acpica/include/actypes.h b/sys/contrib/dev/acpica/include/actypes.h index f0b4b81..095e589 100644 --- a/sys/contrib/dev/acpica/include/actypes.h +++ b/sys/contrib/dev/acpica/include/actypes.h @@ -716,9 +716,24 @@ typedef UINT8 ACPI_ADR_SPACE_TYPE; #define ACPI_ADR_SPACE_CMOS (ACPI_ADR_SPACE_TYPE) 5 #define ACPI_ADR_SPACE_PCI_BAR_TARGET (ACPI_ADR_SPACE_TYPE) 6 #define ACPI_ADR_SPACE_IPMI (ACPI_ADR_SPACE_TYPE) 7 -#define ACPI_ADR_SPACE_DATA_TABLE (ACPI_ADR_SPACE_TYPE) 8 -#define ACPI_ADR_SPACE_FIXED_HARDWARE (ACPI_ADR_SPACE_TYPE) 127 +#define ACPI_NUM_PREDEFINED_REGIONS 8 + +/* + * Special Address Spaces + * + * Note: A Data Table region is a special type of operation region + * that has its own AML opcode. However, internally, the AML + * interpreter simply creates an operation region with an an address + * space type of ACPI_ADR_SPACE_DATA_TABLE. + */ +#define ACPI_ADR_SPACE_DATA_TABLE (ACPI_ADR_SPACE_TYPE) 0x7E /* Internal to ACPICA only */ +#define ACPI_ADR_SPACE_FIXED_HARDWARE (ACPI_ADR_SPACE_TYPE) 0x7F + +/* Values for _REG connection code */ + +#define ACPI_REG_DISCONNECT 0 +#define ACPI_REG_CONNECT 1 /* * BitRegister IDs diff --git a/sys/contrib/dev/acpica/include/amlcode.h b/sys/contrib/dev/acpica/include/amlcode.h index 0a07bd5..f6e0de3 100644 --- a/sys/contrib/dev/acpica/include/amlcode.h +++ b/sys/contrib/dev/acpica/include/amlcode.h @@ -402,24 +402,6 @@ #define AML_CLASS_UNKNOWN 0x0A -/* Predefined Operation Region SpaceIDs */ - -typedef enum -{ - REGION_MEMORY = 0, - REGION_IO, - REGION_PCI_CONFIG, - REGION_EC, - REGION_SMBUS, - REGION_CMOS, - REGION_PCI_BAR, - REGION_IPMI, - REGION_DATA_TABLE, /* Internal use only */ - REGION_FIXED_HW = 0x7F - -} AML_REGION_TYPES; - - /* Comparison operation codes for MatchOp operator */ typedef enum diff --git a/sys/contrib/dev/acpica/namespace/nsrepair.c b/sys/contrib/dev/acpica/namespace/nsrepair.c index 629dd48..c34184c 100644 --- a/sys/contrib/dev/acpica/namespace/nsrepair.c +++ b/sys/contrib/dev/acpica/namespace/nsrepair.c @@ -77,7 +77,6 @@ * * Additional possible repairs: * - * Optional/unnecessary NULL package elements removed * Required package elements that are NULL replaced by Integer/String/Buffer * Incorrect standalone package wrapped with required outer package * @@ -684,17 +683,13 @@ AcpiNsRemoveNullElements ( /* - * PTYPE1 packages contain no subpackages. - * PTYPE2 packages contain a variable number of sub-packages. We can - * safely remove all NULL elements from the PTYPE2 packages. + * We can safely remove all NULL elements from these package types: + * PTYPE1_VAR packages contain a variable number of simple data types. + * PTYPE2 packages contain a variable number of sub-packages. */ switch (PackageType) { - case ACPI_PTYPE1_FIXED: case ACPI_PTYPE1_VAR: - case ACPI_PTYPE1_OPTION: - return; - case ACPI_PTYPE2: case ACPI_PTYPE2_COUNT: case ACPI_PTYPE2_PKG_COUNT: @@ -704,6 +699,8 @@ AcpiNsRemoveNullElements ( break; default: + case ACPI_PTYPE1_FIXED: + case ACPI_PTYPE1_OPTION: return; } diff --git a/sys/contrib/dev/acpica/utilities/utdecode.c b/sys/contrib/dev/acpica/utilities/utdecode.c index 0a2287b..ebe73cf 100644 --- a/sys/contrib/dev/acpica/utilities/utdecode.c +++ b/sys/contrib/dev/acpica/utilities/utdecode.c @@ -187,8 +187,7 @@ const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] = "SMBus", "SystemCMOS", "PCIBARTarget", - "IPMI", - "DataTable" + "IPMI" }; @@ -201,6 +200,10 @@ AcpiUtGetRegionName ( { return ("UserDefinedRegion"); } + else if (SpaceId == ACPI_ADR_SPACE_DATA_TABLE) + { + return ("DataTable"); + } else if (SpaceId == ACPI_ADR_SPACE_FIXED_HARDWARE) { return ("FunctionalFixedHW"); diff --git a/sys/modules/acpi/acpi/Makefile b/sys/modules/acpi/acpi/Makefile index 3e7e31c..1cbb9a6 100644 --- a/sys/modules/acpi/acpi/Makefile +++ b/sys/modules/acpi/acpi/Makefile @@ -39,7 +39,7 @@ SRCS+= dmresrcs.c dmutils.c dmwalk.c SRCS+= dsargs.c dscontrol.c dsfield.c dsinit.c dsmethod.c dsmthdat.c SRCS+= dsobject.c dsopcode.c dsutils.c dswexec.c dswload.c dswload2.c SRCS+= dswscope.c dswstate.c -SRCS+= evevent.c evgpe.c evgpeblk.c evgpeinit.c evgpeutil.c evmisc.c +SRCS+= evevent.c evglock.c evgpe.c evgpeblk.c evgpeinit.c evgpeutil.c evmisc.c SRCS+= evregion.c evrgnini.c evsci.c evxface.c evxfevnt.c evxfgpe.c evxfregn.c SRCS+= exconfig.c exconvrt.c excreate.c exdebug.c exdump.c exfield.c SRCS+= exfldio.c exmisc.c exmutex.c exnames.c exoparg1.c exoparg2.c |