diff -Nru acpica-unix-20100528/Makefile acpica-unix-20140114/Makefile --- acpica-unix-20100528/Makefile 1970-01-01 00:00:00.000000000 +0000 +++ acpica-unix-20140114/Makefile 2014-01-28 13:06:26.000000000 +0000 @@ -0,0 +1,16 @@ +# +# Common make for acpica tools and utilities +# + +# +# Note: This makefile is intended to be used from within the native +# ACPICA directory structure, from under top level acpica directory. +# It specifically places all the object files for each tool in separate +# generate/unix subdirectories, not within the various ACPICA source +# code directories. This prevents collisions between different +# compilations of the same source file with different compile options. +# +BUILD_DIRECTORY_PATH = "generate/unix" + +include generate/unix/Makefile.config +include generate/unix/Makefile.common diff -Nru acpica-unix-20100528/README acpica-unix-20140114/README --- acpica-unix-20100528/README 2010-05-28 17:14:43.000000000 +0000 +++ acpica-unix-20140114/README 1970-01-01 00:00:00.000000000 +0000 @@ -1,79 +0,0 @@ -acpica-unix ------------ - -This source release includes: - - -1) a cross-OS AML interpreter - -This is intended to allow commercial and open source operating systems -to be enabled for ACPI. OS specific code is still needed, but the -AML interpreter should greatly improve the development speed of ACPI -support. - -The AML interpreter source should be integrated into the kernel's -build process. We recommend establishing an automated method for -this, so later versions can also be incorporated easily. Please see -the documentation on the website for API and other implementation -information. - - -2) iasl, an ASL compiler/decompiler - -iasl compiles ASL (ACPI Source Language) into AML (ACPI Machine -Language). This AML is suitable for inclusion as a DSDT in system -firmware. It also can disassemble AML, for debugging purposes. - -To compile: - -cd compiler -make - -It has been compiled on Linux, but should easily port to other Unix -environments. - -Run 'iasl -h' for more information, or download the binary version for -documentation in PDF format. - - -3) acpisrc, a source code conversion tool - -acpisrc converts the standard form of the acpica source release (included -here) into a version that meets Linux coding guidelines. This consists -mainly of performing a series of string replacements and transformations -to the code. - -To compile: - -cd tools/acpisrc -make - -It has been compiled on Linux, but should easily port to other Unix -environments. - - -4) acpibin, an AML file tool - -acpibin compares AML files, dumps AML binary files to text files, -extracts binary AML from text files, and other AML file -manipulation. - -To compile: - -cd tools/acpibin -make - - -5) acpiexec, a user-space AML interpreter - -acpiexec allows the loading of ACPI tables and execution of control -methods from user space. Useful for debugging AML code and testing -the AML interpreter. - -To compile: - -cd tools/acpiexec -make - - -Thanks -- The ACPI CA Team diff -Nru acpica-unix-20100528/changes.txt acpica-unix-20140114/changes.txt --- acpica-unix-20100528/changes.txt 2010-05-28 17:14:20.000000000 +0000 +++ acpica-unix-20140114/changes.txt 2014-01-28 13:06:26.000000000 +0000 @@ -1,44 +1,3489 @@ ---------------------------------------- -28 May 2010. Summary of changes for version 20100528: +14 January 2014. Summary of changes for version 20140114: + +1) ACPICA kernel-resident subsystem: + +Updated all ACPICA copyrights and signons to 2014. Added the 2014 +copyright to all module headers and signons, including the standard Linux +header. This affects virtually every file in the ACPICA core subsystem, +iASL compiler, all ACPICA utilities, and the test suites. + +Improved parameter validation for AcpiInstallGpeBlock. Added the +following checks: +1) The incoming device handle refers to type ACPI_TYPE_DEVICE. +2) There is not already a GPE block attached to the device. +Likewise, with AcpiRemoveGpeBlock, ensure that the incoming object is a +device. + +Correctly support "references" in the ACPI_OBJECT. This change fixes the +support to allow references (namespace nodes) to be passed as arguments +to control methods via the evaluate object interface. This is probably +most useful for testing purposes, however. + +Improved support for 32/64 bit physical addresses in printf()-like +output. This change improves the support for physical addresses in printf +debug statements and other output on both 32-bit and 64-bit hosts. It +consistently outputs the appropriate number of bytes for each host. The +%p specifier is unsatisfactory since it does not emit uniform output on +all hosts/clib implementations (on some, leading zeros are not supported, +leading to difficult-to-read output). + +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. + + Current Release: + Non-Debug Version: 96.2K Code, 27.0K Data, 123.2K Total + Debug Version: 187.5K Code, 78.3K Data, 265.8K Total + Previous Release: + Non-Debug Version: 96.1K Code, 27.0K Data, 123.1K Total + Debug Version: 185.6K Code, 77.3K Data, 262.9K Total + + +2) iASL Compiler/Disassembler and Tools: + +iASL: Fix a possible fault when using the Connection() operator. Fixes a +problem if the parent Field definition for the Connection operator refers +to an operation region that does not exist. ACPICA BZ 1064. + +AcpiExec: Load of local test tables is now optional. The utility has the +capability to load some various tables to test features of ACPICA. +However, there are enough of them that the output of the utility became +confusing. With this change, only the required local tables are displayed +(RSDP, XSDT, etc.) along with the actual tables loaded via the command +line specification. This makes the default output simler and easier to +understand. The -el command line option restores the original behavior +for testing purposes. + +AcpiExec: Added support for overlapping operation regions. This change +expands the simulation of operation regions by supporting regions that +overlap within the given address space. Supports SystemMemory and +SystemIO. ASLTS test suite updated also. David Box. ACPICA BZ 1031. + +AcpiExec: Added region handler support for PCI_Config and EC spaces. This +allows AcpiExec to simulate these address spaces, similar to the current +support for SystemMemory and SystemIO. + +Debugger: Added new command to read/write/compare all namespace objects. +The command "test objects" will exercise the entire namespace by writing +new values to each data object, and ensuring that the write was +successful. The original value is then restored and verified. + +Debugger: Added the "test predefined" command. This change makes this +test public and puts it under the new "test" command. The test executes +each and every predefined name within the current namespace. + +---------------------------------------- +18 December 2013. Summary of changes for version 20131218: + +Global note: The ACPI 5.0A specification was released this month. There +are no changes needed for ACPICA since this release of ACPI is an +errata/clarification release. The specification is available at +acpi.info. + + +1) ACPICA kernel-resident subsystem: + +Added validation of the XSDT root table if it is present. Some older +platforms contain an XSDT that is ill-formed or otherwise invalid (such +as containing some or all entries that are NULL pointers). This change +adds a new function to validate the XSDT before actually using it. If the +XSDT is found to be invalid, ACPICA will now automatically fall back to +using the RSDT instead. Original implementation by Zhao Yakui. Ported to +ACPICA and enhanced by Lv Zheng and Bob Moore. + +Added a runtime option to ignore the XSDT and force the use of the RSDT. +This change adds a runtime option that will force ACPICA to use the RSDT +instead of the XSDT (AcpiGbl_DoNotUseXsdt). Although the ACPI spec +requires that an XSDT be used instead of the RSDT, the XSDT has been +found to be corrupt or ill-formed on some machines. Lv Zheng. + +Added a runtime option to favor 32-bit FADT register addresses over the +64-bit addresses. This change adds an option to favor 32-bit FADT +addresses when there is a conflict between the 32-bit and 64-bit versions +of the same register. The default behavior is to use the 64-bit version +in accordance with the ACPI specification. This can now be overridden via +the AcpiGbl_Use32BitFadtAddresses flag. ACPICA BZ 885. Lv Zheng. + +During the change above, the internal "Convert FADT" and "Verify FADT" +functions have been merged to simplify the code, making it easier to +understand and maintain. ACPICA BZ 933. + +Improve exception reporting and handling for GPE block installation. +Return an actual status from AcpiEvGetGpeXruptBlock and don't clobber the +status when exiting AcpiEvInstallGpeBlock. ACPICA BZ 1019. + +Added helper macros to extract bus/segment numbers from the HEST table. +This change adds two macros to extract the encoded bus and segment +numbers from the HEST Bus field - ACPI_HEST_BUS and ACPI_HEST_SEGMENT. +Betty Dall + +Removed the unused ACPI_FREE_BUFFER macro. This macro is no longer used +by ACPICA. It is not a public macro, so it should have no effect on +existing OSV code. Lv Zheng. + +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. + + Current Release: + Non-Debug Version: 96.1K Code, 27.0K Data, 123.1K Total + Debug Version: 185.6K Code, 77.3K Data, 262.9K Total + Previous Release: + Non-Debug Version: 95.9K Code, 27.0K Data, 122.9K Total + Debug Version: 185.1K Code, 77.2K Data, 262.3K Total + + +2) iASL Compiler/Disassembler and Tools: + +Disassembler: Improved pathname support for emitted External() +statements. This change adds full pathname support for external names +that have been resolved internally by the inclusion of additional ACPI +tables (via the iASL -e option). Without this change, the disassembler +can emit multiple externals for the same object, or it become confused +when the Scope() operator is used on an external object. Overall, greatly +improves the ability to actually recompile the emitted ASL code when +objects a referenced across multiple ACPI tables. Reported by Michael +Tsirkin (mst@redhat.com). + +Tests/ASLTS: Updated functional control suite to execute with no errors. +David Box. Fixed several errors related to the testing of the interpreter +slack mode. Lv Zheng. + +iASL: Added support to detect names that are declared within a control +method, but are unused (these are temporary names that are only valid +during the time the method is executing). A remark is issued for these +cases. ACPICA BZ 1022. + +iASL: Added full support for the DBG2 table. Adds full disassembler, +table compiler, and template generator support for the DBG2 table (Debug +Port 2 table). + +iASL: Added full support for the PCCT table, update the table definition. +Updates the PCCT table definition in the actbl3.h header and adds table +compiler and template generator support. + +iASL: Added an option to emit only error messages (no warnings/remarks). +The -ve option will enable only error messages, warnings and remarks are +suppressed. This can simplify debugging when only the errors are +important, such as when an ACPI table is disassembled and there are many +warnings and remarks -- but only the actual errors are of real interest. + +Example ACPICA code (source/tools/examples): Updated the example code so +that it builds to an actual working program, not just example code. Added +ACPI tables and execution of an example control method in the DSDT. Added +makefile support for Unix generation. + +---------------------------------------- +15 November 2013. Summary of changes for version 20131115: + +This release is available at https://acpica.org/downloads + + +1) ACPICA kernel-resident subsystem: + +Resource Manager: Fixed loop termination for the "get AML length" +function. The loop previously had an error termination on a NULL resource +pointer, which can never happen since the loop simply increments a valid +resource pointer. This fix changes the loop to terminate with an error on +an invalid end-of-buffer condition. The problem can be seen as an +infinite loop by callers to AcpiSetCurrentResources with an invalid or +corrupted resource descriptor, or a resource descriptor that is missing +an END_TAG descriptor. Reported by Dan Carpenter +. Lv Zheng, Bob Moore. + +Table unload and ACPICA termination: Delete all attached data objects +during namespace node deletion. This fix updates namespace node deletion +to delete the entire list of attached objects (attached via +AcpiAttachObject) instead of just one of the attached items. ACPICA BZ +1024. Tomasz Nowicki (tomasz.nowicki@linaro.org). + +ACPICA termination: Added support to delete all objects attached to the +root namespace node. This fix deletes any and all objects that have been +attached to the root node via AcpiAttachData. Previously, none of these +objects were deleted. Reported by Tomasz Nowicki. ACPICA BZ 1026. + +Debug output: Do not emit the function nesting level for the in-kernel +build. The nesting level is really only useful during a single-thread +execution. Therefore, only enable this output for the AcpiExec utility. +Also, only emit the thread ID when executing under AcpiExec (Context +switches are still always detected and a message is emitted). ACPICA BZ +972. + +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. + + Current Release: + Non-Debug Version: 95.9K Code, 27.0K Data, 122.9K Total + Debug Version: 185.1K Code, 77.2K Data, 262.3K Total + Previous Release: + Non-Debug Version: 95.8K Code, 27.0K Data, 122.8K Total + Debug Version: 185.2K Code, 77.2K Data, 262.4K Total + + +2) iASL Compiler/Disassembler and Tools: + +AcpiExec/Unix-OSL: Use instead of . This is the +correct portable POSIX header for terminal control functions. + +Disassembler: Fixed control method invocation issues related to the use +of the CondRefOf() operator. The problem is seen in the disassembly where +control method invocations may not be disassembled properly if the +control method name has been used previously as an argument to CondRefOf. +The solution is to not attempt to emit an external declaration for the +CondRefOf target (it is not necessary in the first place). This prevents +disassembler object type confusion. ACPICA BZ 988. + +Unix Makefiles: Added an option to disable compiler optimizations and the +_FORTIFY_SOURCE flag. Some older compilers have problems compiling ACPICA +with optimizations (reportedly, gcc 4.4 for example). This change adds a +command line option for make (NOOPT) that disables all compiler +optimizations and the _FORTIFY_SOURCE compiler flag. The default +optimization is -O2 with the _FORTIFY_SOURCE flag specified. ACPICA BZ +1034. Lv Zheng, Bob Moore. + +Tests/ASLTS: Added options to specify individual test cases and modes. +This allows testers running aslts.sh to optionally specify individual +test modes and test cases. Also added an option to disable the forced +generation of the ACPICA tools from source if desired. Lv Zheng. + +---------------------------------------- +27 September 2013. Summary of changes for version 20130927: + +This release is available at https://acpica.org/downloads + + +1) ACPICA kernel-resident subsystem: + +Fixed a problem with store operations to reference objects. This change +fixes a problem where a Store operation to an ArgX object that contained +a +reference to a field object did not complete the automatic dereference +and +then write to the actual field object. Instead, the object type of the +field object was inadvertently changed to match the type of the source +operand. The new behavior will actually write to the field object (buffer +field or field unit), thus matching the correct ACPI-defined behavior. + +Implemented support to allow the host to redefine individual OSL +prototypes. This change enables the host to redefine OSL prototypes found +in the acpiosxf.h file. This allows the host to implement OSL interfaces +with a macro or inlined function. Further, it allows the host to add any +additional required modifiers such as __iomem, __init, __exit, etc., as +necessary on a per-interface basis. Enables maximum flexibility for the +OSL interfaces. Lv Zheng. + +Hardcoded the access width for the FADT-defined reset register. The ACPI +specification requires the reset register width to be 8 bits. ACPICA now +hardcodes the width to 8 and ignores the FADT width value. This provides +compatibility with other ACPI implementations that have allowed BIOS code +with bad register width values to go unnoticed. Matthew Garett, Bob +Moore, +Lv Zheng. + +Changed the position/use of the ACPI_PRINTF_LIKE macro. This macro is +used +in the OSL header (acpiosxf). The change modifies the position of this +macro in each instance where it is used (AcpiDebugPrint, etc.) to avoid +build issues if the OSL defines the implementation of the interface to be +an inline stub function. Lv Zheng. + +Deployed a new macro ACPI_EXPORT_SYMBOL_INIT for the main ACPICA +initialization interfaces. This change adds a new macro for the main init +and terminate external interfaces in order to support hosts that require +additional or different processing for these functions. Changed from +ACPI_EXPORT_SYMBOL to ACPI_EXPORT_SYMBOL_INIT for these functions. Lv +Zheng, Bob Moore. + +Cleaned up the memory allocation macros for configurability. In the +common +case, the ACPI_ALLOCATE and related macros now resolve directly to their +respective AcpiOs* OSL interfaces. Two options: +1) The ACPI_ALLOCATE_ZEROED macro uses a simple local implementation by +default, unless overridden by the USE_NATIVE_ALLOCATE_ZEROED define. +2) For AcpiExec (and for debugging), the macros can optionally be +resolved +to the local ACPICA interfaces that track each allocation (local tracking +is used to immediately detect memory leaks). +Lv Zheng. + +Simplified the configuration for ACPI_REDUCED_HARDWARE. Allows the kernel +to predefine this macro to either TRUE or FALSE during the system build. + +Replaced __FUNCTION_ with __func__ in the gcc-specific header. + +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. + + Current Release: + Non-Debug Version: 95.8K Code, 27.0K Data, 122.8K Total + Debug Version: 185.2K Code, 77.2K Data, 262.4K Total + Previous Release: + Non-Debug Version: 96.7K Code, 27.1K Data, 123.9K Total + Debug Version: 184.4K Code, 76.8K Data, 261.2K Total + + +2) iASL Compiler/Disassembler and Tools: + +iASL: Implemented wildcard support for the -e option. This simplifies use +when there are many SSDTs that must be included to resolve external +method +declarations. ACPICA BZ 1041. Example: + iasl -e ssdt*.dat -d dsdt.dat + +AcpiExec: Add history/line-editing for Unix/Linux systems. This change +adds a portable module that implements full history and limited line +editing for Unix and Linux systems. It does not use readline() due to +portability issues. Instead it uses the POSIX termio interface to put the +terminal in raw input mode so that the various special keys can be +trapped +(such as up/down-arrow for history support and left/right-arrow for line +editing). Uses the existing debugger history mechanism. ACPICA BZ 1036. + +AcpiXtract: Add support to handle (ignore) "empty" lines containing only +one or more spaces. This provides compatible with early or different +versions of the AcpiDump utility. ACPICA BZ 1044. + +AcpiDump: Do not ignore tables that contain only an ACPI table header. +Apparently, some BIOSs create SSDTs that contain an ACPI table header but +no other data. This change adds support to dump these tables. Any tables +shorter than the length of an ACPI table header remain in error (an error +message is emitted). Reported by Yi Li. + +Debugger: Echo actual command along with the "unknown command" message. + +---------------------------------------- +23 August 2013. Summary of changes for version 20130823: + +1) ACPICA kernel-resident subsystem: + +Implemented support for host-installed System Control Interrupt (SCI) +handlers. Certain ACPI functionality requires the host to handle raw +SCIs. For example, the "SCI Doorbell" that is defined for memory power +state support requires the host device driver to handle SCIs to examine +if the doorbell has been activated. Multiple SCI handlers can be +installed to allow for future expansion. New external interfaces are +AcpiInstallSciHandler, AcpiRemoveSciHandler; see the ACPICA reference for +details. Lv Zheng, Bob Moore. ACPICA BZ 1032. + +Operation region support: Never locally free the handler "context" +pointer. This change removes some dangerous code that attempts to free +the handler context pointer in some (rare) circumstances. The owner of +the handler owns this pointer and the ACPICA code should never touch it. +Although not seen to be an issue in any kernel, it did show up as a +problem (fault) under AcpiExec. Also, set the internal storage field for +the context pointer to zero when the region is deactivated, simply for +sanity. David Box. ACPICA BZ 1039. + +AcpiRead: On error, do not modify the return value target location. If an +error happens in the middle of a split 32/32 64-bit I/O operation, do not +modify the target of the return value pointer. Makes the code consistent +with the rest of ACPICA. Bjorn Helgaas. + +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. + + Current Release: + Non-Debug Version: 96.7K Code, 27.1K Data, 123.9K Total + Debug Version: 184.4K Code, 76.8K Data, 261.2K Total + Previous Release: + Non-Debug Version: 96.2K Code, 27.1K Data, 123.3K Total + Debug Version: 185.4K Code, 77.1K Data, 262.5K Total + + +2) iASL Compiler/Disassembler and Tools: -This release is available at www.acpica.org/downloads +AcpiDump: Implemented several new features and fixed some problems: +1) Added support to dump the RSDP, RSDT, and XSDT tables. +2) Added support for multiple table instances (SSDT, UEFI). +3) Added option to dump "customized" (overridden) tables (-c). +4) Fixed a problem where some table filenames were improperly +constructed. +5) Improved some error messages, removed some unnecessary messages. + +iASL: Implemented additional support for disassembly of ACPI tables that +contain invocations of external control methods. The -fe option +allows the import of a file that specifies the external methods along +with the required number of arguments for each -- allowing for the +correct disassembly of the table. This is a workaround for a limitation +of AML code where the disassembler often cannot determine the number of +arguments required for an external control method and generates incorrect +ASL code. See the iASL reference for details. ACPICA BZ 1030. + +Debugger: Implemented a new command (paths) that displays the full +pathnames (namepaths) and object types of all objects in the namespace. +This is an alternative to the namespace command. + +Debugger: Implemented a new command (sci) that invokes the SCI dispatch +mechanism and any installed handlers. + +iASL: Fixed a possible segfault for "too many parent prefixes" condition. +This can occur if there are too many parent prefixes in a namepath (for +example, ^^^^^^PCI0.ECRD). ACPICA BZ 1035. + +Application OSLs: Set the return value for the PCI read functions. These +functions simply return AE_OK, but should set the return value to zero +also. This change implements this. ACPICA BZ 1038. + +Debugger: Prevent possible command line buffer overflow. Increase the +size of a couple of the debugger line buffers, and ensure that overflow +cannot happen. ACPICA BZ 1037. + +iASL: Changed to abort immediately on serious errors during the parsing +phase. Due to the nature of ASL, there is no point in attempting to +compile these types of errors, and they typically end up causing a +cascade of hundreds of errors which obscure the original problem. + +---------------------------------------- +25 July 2013. Summary of changes for version 20130725: + +1) ACPICA kernel-resident subsystem: + +Fixed a problem with the DerefOf operator where references to FieldUnits +and BufferFields incorrectly returned the parent object, not the actual +value of the object. After this change, a dereference of a FieldUnit +reference results in a read operation on the field to get the value, and +likewise, the appropriate BufferField value is extracted from the target +buffer. + +Fixed a problem where the _WAK method could cause a fault under these +circumstances: 1) Interpreter slack mode was not enabled, and 2) the _WAK +method returned no value. The problem is rarely seen because most kernels +run ACPICA in slack mode. + +For the DerefOf operator, a fatal error now results if an attempt is made +to dereference a reference (created by the Index operator) to a NULL +package element. Provides compatibility with other ACPI implementations, +and this behavior will be added to a future version of the ACPI +specification. + +The ACPI Power Management Timer (defined in the FADT) is now optional. +This provides compatibility with other ACPI implementations and will +appear in the next version of the ACPI specification. If there is no PM +Timer on the platform, AcpiGetTimer returns AE_SUPPORT. An address of +zero in the FADT indicates no PM timer. + +Implemented a new interface for _OSI support, AcpiUpdateInterfaces. This +allows the host to globally enable/disable all vendor strings, all +feature strings, or both. Intended to be primarily used for debugging +purposes only. Lv Zheng. + +Expose the collected _OSI data to the host via a global variable. This +data tracks the highest level vendor ID that has been invoked by the BIOS +so that the host (and potentially ACPICA itself) can change behaviors +based upon the age of the BIOS. + +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. + + Current Release: + Non-Debug Version: 96.2K Code, 27.1K Data, 123.3K Total + Debug Version: 184.4K Code, 76.8K Data, 261.2K Total + Previous Release: + Non-Debug Version: 95.9K Code, 26.9K Data, 122.8K Total + Debug Version: 184.1K Code, 76.7K Data, 260.8K Total + + +2) iASL Compiler/Disassembler and Tools: + +iASL: Created the following enhancements for the -so option (create +offset table): +1)Add offsets for the last nameseg in each namepath for every supported +object type +2)Add support for Processor, Device, Thermal Zone, and Scope objects +3)Add the actual AML opcode for the parent object of every supported +object type +4)Add support for the ZERO/ONE/ONES AML opcodes for integer objects + +Disassembler: Emit all unresolved external symbols in a single block. +These are external references to control methods that could not be +resolved, and thus, the disassembler had to make a guess at the number of +arguments to parse. + +iASL: The argument to the -T option (create table template) is now +optional. If not specified, the default table is a DSDT, typically the +most common case. + +---------------------------------------- +26 June 2013. Summary of changes for version 20130626: + +1) ACPICA kernel-resident subsystem: + +Fixed an issue with runtime repair of the _CST object. Null or invalid +elements were not always removed properly. Lv Zheng. + +Removed an arbitrary restriction of 256 GPEs per GPE block (such as the +FADT-defined GPE0 and GPE1). For GPE0, GPE1, and each GPE Block Device, +the maximum number of GPEs is 1016. Use of multiple GPE block devices +makes the system-wide number of GPEs essentially unlimited. + +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. + + Current Release: + Non-Debug Version: 95.9K Code, 26.9K Data, 122.8K Total + Debug Version: 184.1K Code, 76.7K Data, 260.8K Total + Previous Release: + Non-Debug Version: 96.0K Code, 27.0K Data, 123.0K Total + Debug Version: 184.1K Code, 76.8K Data, 260.9K Total + + +2) iASL Compiler/Disassembler and Tools: + +Portable AcpiDump: Implemented full support for the Linux and FreeBSD +hosts. Now supports Linux, FreeBSD, and Windows. + +Disassembler: Added some missing types for the HEST and EINJ tables: "Set +Error Type With Address", "CMCI", "MCE", and "Flush Cacheline". + +iASL/Preprocessor: Implemented full support for nested +#if/#else/#elif/#endif blocks. Allows arbitrary depth of nested blocks. + +Disassembler: Expanded maximum output string length to 64K. Was 256 bytes +max. The original purpose of this constraint was to limit the amount of +debug output. However, the string function in question (UtPrintString) is +now used for the disassembler also, where 256 bytes is insufficient. +Reported by RehabMan@GitHub. + +iASL/DataTables: Fixed some problems and issues with compilation of DMAR +tables. ACPICA BZ 999. Lv Zheng. + +iASL: Fixed a couple of error exit issues that could result in a "Could +not delete " message during ASL compilation. + +AcpiDump: Allow "FADT" and "MADT" as valid table signatures, even though +the actual signatures for these tables are "FACP" and "APIC", +respectively. + +AcpiDump: Added support for multiple UEFI tables. Only SSDT and UEFI +tables are allowed to have multiple instances. + +---------------------------------------- +17 May 2013. Summary of changes for version 20130517: + +1) ACPICA kernel-resident subsystem: + +Fixed a regression introduced in version 20130328 for _INI methods. This +change fixes a problem introduced in 20130328 where _INI methods are no +longer executed properly because of a memory block that was not +initialized correctly. ACPICA BZ 1016. Tomasz Nowicki +. + +Fixed a possible problem with the new extended sleep registers in the +ACPI +5.0 FADT. Do not use these registers (even if populated) unless the HW- +reduced bit is set in the FADT (as per the ACPI specification). ACPICA BZ +1020. Lv Zheng. + +Implemented return value repair code for _CST predefined objects: Sort +the +list and detect/remove invalid entries. ACPICA BZ 890. Lv Zheng. + +Implemented a debug-only option to disable loading of SSDTs from the +RSDT/XSDT during ACPICA initialization. This can be useful for debugging +ACPI problems on some machines. Set AcpiGbl_DisableSsdtTableLoad in +acglobal.h - ACPICA BZ 1005. Lv Zheng. + +Fixed some issues in the ACPICA initialization and termination code: +Tomasz Nowicki +1) Clear events initialized flag upon event component termination. ACPICA +BZ 1013. +2) Fixed a possible memory leak in GPE init error path. ACPICA BZ 1018. +3) Delete global lock pending lock during termination. ACPICA BZ 1012. +4) Clear debug buffer global on termination to prevent possible multiple +delete. ACPICA BZ 1010. + +Standardized all switch() blocks across the entire source base. After +many +years, different formatting for switch() had crept in. This change makes +the formatting of every switch block identical. ACPICA BZ 997. Chao Guan. + +Split some files to enhance ACPICA modularity and configurability: +1) Split buffer dump routines into utilities/utbuffer.c +2) Split internal error message routines into utilities/uterror.c +3) Split table print utilities into tables/tbprint.c +4) Split iASL command-line option processing into asloptions.c + +Makefile enhancements: +1) Support for all new files above. +2) Abort make on errors from any subcomponent. Chao Guan. +3) Add build support for Apple Mac OS X. Liang Qi. + +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. + + Current Release: + Non-Debug Version: 96.0K Code, 27.0K Data, 123.0K Total + Debug Version: 184.1K Code, 76.8K Data, 260.9K Total + Previous Release: + Non-Debug Version: 95.6K Code, 26.8K Data, 122.4K Total + Debug Version: 183.5K Code, 76.6K Data, 260.1K Total + + +2) iASL Compiler/Disassembler and Tools: + +New utility: Implemented an easily portable version of the acpidump +utility to extract ACPI tables from the system (or a file) in an ASCII +hex +dump format. The top-level code implements the various command line +options, file I/O, and table dump routines. To port to a new host, only +three functions need to be implemented to get tables -- since this +functionality is OS-dependent. See the tools/acpidump/apmain.c module and +the ACPICA reference for porting instructions. ACPICA BZ 859. Notes: +1) The Windows version obtains the ACPI tables from the Registry. +2) The Linux version is under development. +3) Other hosts - If an OS-dependent module is submitted, it will be +distributed with ACPICA. + +iASL: Fixed a regression for -D preprocessor option (define symbol). A +restructuring/change to the initialization sequence caused this option to +no longer work properly. + +iASL: Implemented a mechanism to disable specific warnings and remarks. +Adds a new command line option, "-vw as well as "#pragma +disable ". ACPICA BZ 989. Chao Guan, Bob Moore. + +iASL: Fix for too-strict package object validation. The package object +validation for return values from the predefined names is a bit too +strict, it does not allow names references within the package (which will +be resolved at runtime.) These types of references cannot be validated at +compile time. This change ignores named references within package objects +for names that return or define static packages. + +Debugger: Fixed the 80-character command line limitation for the History +command. Now allows lines of arbitrary length. ACPICA BZ 1000. Chao Guan. + +iASL: Added control method and package support for the -so option +(generates AML offset table for BIOS support.) + +iASL: issue a remark if a non-serialized method creates named objects. If +a thread blocks within the method for any reason, and another thread +enters the method, the method will fail because an attempt will be made +to +create the same (named) object twice. In this case, issue a remark that +the method should be marked serialized. NOTE: may become a warning later. +ACPICA BZ 909. + +---------------------------------------- +18 April 2013. Summary of changes for version 20130418: + +1) ACPICA kernel-resident subsystem: + +Fixed a possible buffer overrun during some rare but specific field unit +read operations. This overrun can only happen if the DSDT version is 1 -- +meaning that all AML integers are 32 bits -- and the field length is +between 33 and 55 bits long. During the read, an internal buffer object +is +created for the field unit because the field is larger than an integer +(32 +bits). However, in this case, the buffer will be incorrectly written +beyond the end because the buffer length is less than the internal +minimum +of 64 bits (8 bytes) long. The buffer will be either 5, 6, or 7 bytes +long, but a full 8 bytes will be written. + +Updated the Embedded Controller "orphan" _REG method support. This refers +to _REG methods under the EC device that have no corresponding operation +region. This is allowed by the ACPI specification. This update removes a +dependency on the existence an ECDT table. It will execute an orphan _REG +method as long as the operation region handler for the EC is installed at +the EC device node and not the namespace root. Rui Zhang (original +update), Bob Moore (update/integrate). + +Implemented run-time argument typechecking for all predefined ACPI names +(_STA, _BIF, etc.) This change performs object typechecking on all +incoming arguments for all predefined names executed via +AcpiEvaluateObject. This ensures that ACPI-related device drivers are +passing correct object types as well as the correct number of arguments +(therefore identifying any issues immediately). Also, the ASL/namespace +definition of the predefined name is checked against the ACPI +specification for the proper argument count. Adds one new file, +nsarguments.c + +Changed an exception code for the ASL UnLoad() operator. Changed the +exception code for the case where the input DdbHandle is invalid, from +AE_BAD_PARAMETER to the more appropriate AE_AML_OPERAND_TYPE. + +Unix/Linux makefiles: Removed the use of the -O2 optimization flag in the +global makefile. The use of this flag causes compiler errors on earlier +versions of GCC, so it has been removed for compatibility. + +Miscellaneous cleanup: +1) Removed some unused/obsolete macros +2) Fixed a possible memory leak in the _OSI support +3) Removed an unused variable in the predefined name support +4) Windows OSL: remove obsolete reference to a memory list field + +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. + + Current Release: + Non-Debug Version: 95.2K Code, 26.4K Data, 121.6K Total + Debug Version: 183.0K Code, 76.0K Data, 259.0K Total + Previous Release: + Non-Debug Version: 95.6K Code, 26.8K Data, 122.4K Total + Debug Version: 183.5K Code, 76.6K Data, 260.1K Total + + +2) iASL Compiler/Disassembler and Tools: + +AcpiExec: Added installation of a handler for the SystemCMOS address +space. This prevents control method abort if a method accesses this +space. + +AcpiExec: Added support for multiple EC devices, and now install EC +operation region handler(s) at the actual EC device instead of the +namespace root. This reflects the typical behavior of host operating +systems. + +AcpiExec: Updated to ensure that all operation region handlers are +installed before the _REG methods are executed. This prevents a _REG +method from aborting if it accesses an address space has no handler. +AcpiExec installs a handler for every possible address space. + +Debugger: Enhanced the "handlers" command to display non-root handlers. +This change enhances the handlers command to display handlers associated +with individual devices throughout the namespace, in addition to the +currently supported display of handlers associated with the root +namespace +node. + +ASL Test Suite: Several test suite errors have been identified and +resolved, reducing the total error count during execution. Chao Guan. + +---------------------------------------- +28 March 2013. Summary of changes for version 20130328: + +1) ACPICA kernel-resident subsystem: + +Fixed several possible race conditions with the internal object reference +counting mechanism. Some of the external ACPICA interfaces update object +reference counts without holding the interpreter or namespace lock. This +change adds a spinlock to protect reference count updates on the internal +ACPICA objects. Reported by and with assistance from Andriy Gapon +(avg@FreeBSD.org). + +FADT support: Removed an extraneous warning for very large GPE register +sets. This change removes a size mismatch warning if the legacy length +field for a GPE register set is larger than the 64-bit GAS structure can +accommodate. GPE register sets can be larger than the 255-bit width +limitation of the GAS structure. Linn Crosetto (linn@hp.com). + +_OSI Support: handle any errors from AcpiOsAcquireMutex. Check for error +return from this interface. Handles a possible timeout case if +ACPI_WAIT_FOREVER is modified by the host to be a value less than +"forever". Jung-uk Kim. + +Predefined name support: Add allowed/required argument type information +to +the master predefined info table. This change adds the infrastructure to +enable typechecking on incoming arguments for all predefined +methods/objects. It does not actually contain the code that will fully +utilize this information, this is still under development. Also condenses +some duplicate code for the predefined names into a new module, +utilities/utpredef.c + +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: + Non-Debug Version: 95.0K Code, 25.9K Data, 120.9K Total + Debug Version: 182.9K Code, 75.6K Data, 258.5K Total + Current Release: + Non-Debug Version: 95.2K Code, 26.4K Data, 121.6K Total + Debug Version: 183.0K Code, 76.0K Data, 259.0K Total + + +2) iASL Compiler/Disassembler and Tools: + +iASL: Implemented a new option to simplify the development of ACPI- +related +BIOS code. Adds support for a new "offset table" output file. The -so +option will create a C table containing the AML table offsets of various +named objects in the namespace so that BIOS code can modify them easily +at +boot time. This can simplify BIOS runtime code by eliminating expensive +searches for "magic values", enhancing boot times and adding greater +reliability. With assistance from Lee Hamel. + +iASL: Allow additional predefined names to return zero-length packages. +Now, all predefined names that are defined by the ACPI specification to +return a "variable-length package of packages" are allowed to return a +zero length top-level package. This allows the BIOS to tell the host that +the requested feature is not supported, and supports existing BIOS/ASL +code and practices. + +iASL: Changed the "result not used" warning to an error. This is the case +where an ASL operator is effectively a NOOP because the result of the +operation is not stored anywhere. For example: + Add (4, Local0) +There is no target (missing 3rd argument), nor is the function return +value used. This is potentially a very serious problem -- since the code +was probably intended to do something, but for whatever reason, the value +was not stored. Therefore, this issue has been upgraded from a warning to +an error. + +AcpiHelp: Added allowable/required argument types to the predefined names +info display. This feature utilizes the recent update to the predefined +names table (above). + +---------------------------------------- +14 February 2013. Summary of changes for version 20130214: + +1) ACPICA Kernel-resident Subsystem: + +Fixed a possible regression on some hosts: Reinstated the safe return +macros (return_ACPI_STATUS, etc.) that ensure that the argument is +evaluated only once. Although these macros are not needed for the ACPICA +code itself, they are often used by ACPI-related host device drivers +where +the safe feature may be necessary. + +Fixed several issues related to the ACPI 5.0 reduced hardware support +(SOC): Now ensure that if the platform declares itself as hardware- +reduced +via the FADT, the following functions become NOOPs (and always return +AE_OK) because ACPI is always enabled by definition on these machines: + AcpiEnable + AcpiDisable + AcpiHwGetMode + AcpiHwSetMode + +Dynamic Object Repair: Implemented additional runtime repairs for +predefined name return values. Both of these repairs can simplify code in +the related device drivers that invoke these methods: +1) For the _STR and _MLS names, automatically repair/convert an ASCII +string to a Unicode buffer. +2) For the _CRS, _PRS, and _DMA names, return a resource descriptor with +a +lone end tag descriptor in the following cases: A Return(0) was executed, +a null buffer was returned, or no object at all was returned (non-slack +mode only). Adds a new file, nsconvert.c +ACPICA BZ 998. Bob Moore, Lv Zheng. + +Resource Manager: Added additional code to prevent possible infinite +loops +while traversing corrupted or ill-formed resource template buffers. Check +for zero-length resource descriptors in all code that loops through +resource templates (the length field is used to index through the +template). This change also hardens the external AcpiWalkResources and +AcpiWalkResourceBuffer interfaces. + +Local Cache Manager: Enhanced the main data structure to eliminate an +unnecessary mechanism to access the next object in the list. Actually +provides a small performance enhancement for hosts that use the local +ACPICA cache manager. Jung-uk Kim. + +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: + Non-Debug Version: 94.5K Code, 25.4K Data, 119.9K Total + Debug Version: 182.3K Code, 75.0K Data, 257.3K Total + Current Release: + Non-Debug Version: 95.0K Code, 25.9K Data, 120.9K Total + Debug Version: 182.9K Code, 75.6K Data, 258.5K Total + + +2) iASL Compiler/Disassembler and Tools: + +iASL/Disassembler: Fixed several issues with the definition of the ACPI +5.0 RASF table (RAS Feature Table). This change incorporates late changes +that were made to the ACPI 5.0 specification. + +iASL/Disassembler: Added full support for the following new ACPI tables: + 1) The MTMR table (MID Timer Table) + 2) The VRTC table (Virtual Real Time Clock Table). +Includes header file, disassembler, table compiler, and template support +for both tables. + +iASL: Implemented compile-time validation of package objects returned by +predefined names. This new feature validates static package objects +returned by the various predefined names defined to return packages. Both +object types and package lengths are validated, for both parent packages +and sub-packages, if any. The code is similar in structure and behavior +to +the runtime repair mechanism within the AML interpreter and uses the +existing predefined name information table. Adds a new file, aslprepkg.c. +ACPICA BZ 938. + +iASL: Implemented auto-detection of binary ACPI tables for disassembly. +This feature detects a binary file with a valid ACPI table header and +invokes the disassembler automatically. Eliminates the need to +specifically invoke the disassembler with the -d option. ACPICA BZ 862. + +iASL/Disassembler: Added several warnings for the case where there are +unresolved control methods during the disassembly. This can potentially +cause errors when the output file is compiled, because the disassembler +assumes zero method arguments in these cases (it cannot determine the +actual number of arguments without resolution/definition of the method). + +Debugger: Added support to display all resources with a single command. +Invocation of the resources command with no arguments will now display +all +resources within the current namespace. + +AcpiHelp: Added descriptive text for each ACPICA exception code displayed +via the -e option. + +---------------------------------------- +17 January 2013. Summary of changes for version 20130117: + +1) ACPICA Kernel-resident Subsystem: + +Updated the AcpiGetSleepTypeData interface: Allow the \_Sx methods to +return either 1 or 2 integers. Although the ACPI spec defines the \_Sx +objects to return a package containing one integer, most BIOS code +returns +two integers and the previous code reflects that. However, we also need +to +support BIOS code that actually implements to the ACPI spec, and this +change reflects this. + +Fixed two issues with the ACPI_DEBUG_PRINT macros: +1) Added the ACPI_DO_WHILE macro to the main DEBUG_PRINT helper macro for +C compilers that require this support. +2) Renamed the internal ACPI_DEBUG macro to ACPI_DO_DEBUG_PRINT since +ACPI_DEBUG is already used by many of the various hosts. + +Updated all ACPICA copyrights and signons to 2013. Added the 2013 +copyright to all module headers and signons, including the standard Linux +header. This affects virtually every file in the ACPICA core subsystem, +iASL compiler, all ACPICA utilities, and the test suites. + +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: + Non-Debug Version: 94.5K Code, 25.5K Data, 120.0K Total + Debug Version: 182.2K Code, 74.9K Data, 257.1K Total + Current Release: + Non-Debug Version: 94.5K Code, 25.4K Data, 119.9K Total + Debug Version: 182.3K Code, 75.0K Data, 257.3K Total + + +2) iASL Compiler/Disassembler and Tools: + +Generic Unix OSL: Use a buffer to eliminate multiple vfprintf()s and +prevent a possible fault on some hosts. Some C libraries modify the arg +pointer parameter to vfprintf making it difficult to call it twice in the +AcpiOsVprintf function. Use a local buffer to workaround this issue. This +does not affect the Windows OSL since the Win C library does not modify +the arg pointer. Chao Guan, Bob Moore. + +iASL: Fixed a possible infinite loop when the maximum error count is +reached. If an output file other than the .AML file is specified (such as +a listing file), and the maximum number of errors is reached, do not +attempt to flush data to the output file(s) as the compiler is aborting. +This can cause an infinite loop as the max error count code essentially +keeps calling itself. + +iASL/Disassembler: Added an option (-in) to ignore NOOP +opcodes/operators. +Implemented for both the compiler and the disassembler. Often, the NOOP +opcode is used as padding for packages that are changed dynamically by +the +BIOS. When disassembled and recompiled, these NOOPs will cause syntax +errors. This option causes the disassembler to ignore all NOOP opcodes +(0xA3), and it also causes the compiler to ignore all ASL source code +NOOP +statements as well. + +Debugger: Enhanced the Sleep command to execute all sleep states. This +change allows Sleep to be invoked with no arguments and causes the +debugger to execute all of the sleep states, 0-5, automatically. + +---------------------------------------- +20 December 2012. Summary of changes for version 20121220: + +1) ACPICA Kernel-resident Subsystem: + +Implemented a new interface, AcpiWalkResourceBuffer. This interface is an +alternate entry point for AcpiWalkResources and improves the usability of +the resource manager by accepting as input a buffer containing the output +of either a _CRS, _PRS, or _AEI method. The key functionality is that the +input buffer is not deleted by this interface so that it can be used by +the host later. See the ACPICA reference for details. + +Interpreter: Add a warning if a 64-bit constant appears in a 32-bit table +(DSDT version < 2). The constant will be truncated and this warning +reflects that behavior. + +Resource Manager: Add support for the new ACPI 5.0 wake bit in the IRQ, +ExtendedInterrupt, and GpioInt descriptors. This change adds support to +both get and set the new wake bit in these descriptors, separately from +the existing share bit. Reported by Aaron Lu. + +Interpreter: Fix Store() when an implicit conversion is not possible. For +example, in the cases such as a store of a string to an existing package +object, implement the store as a CopyObject(). This is a small departure +from the ACPI specification which states that the control method should +be +aborted in this case. However, the ASLTS suite depends on this behavior. + +Performance improvement for the various FUNCTION_TRACE and DEBUG_PRINT +macros: check if debug output is currently enabled as soon as possible to +minimize performance impact if debug is in fact not enabled. + +Source code restructuring: Cleanup to improve modularity. The following +new files have been added: dbconvert.c, evhandler.c, nsprepkg.c, +psopinfo.c, psobject.c, rsdumpinfo.c, utstring.c, and utownerid.c. +Associated makefiles and project files have been updated. + +Changed an exception code for LoadTable operator. For the case where one +of the input strings is too long, change the returned exception code from +AE_BAD_PARAMETER to AE_AML_STRING_LIMIT. + +Fixed a possible memory leak in dispatcher error path. On error, delete +the mutex object created during method mutex creation. Reported by +tim.gardner@canonical.com. + +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: + Non-Debug Version: 94.3K Code, 25.3K Data, 119.6K Total + Debug Version: 175.5K Code, 74.5K Data, 250.0K Total + Current Release: + Non-Debug Version: 94.5K Code, 25.5K Data, 120.0K Total + Debug Version: 182.2K Code, 74.9K Data, 257.1K Total + + +2) iASL Compiler/Disassembler and Tools: + +iASL: Disallow a method call as argument to the ObjectType ASL operator. +This change tracks an errata to the ACPI 5.0 document. The AML grammar +will not allow the interpreter to differentiate between a method and a +method invocation when these are used as an argument to the ObjectType +operator. The ACPI specification change is to disallow a method +invocation +(UserTerm) for the ObjectType operator. + +Finish support for the TPM2 and CSRT tables in the headers, table +compiler, and disassembler. + +Unix user-space OSL: Fix a problem with WaitSemaphore where the timeout +always expires immediately if the semaphore is not available. The +original +code was using a relative-time timeout, but sem_timedwait requires the +use +of an absolute time. + +iASL: Added a remark if the Timer() operator is used within a 32-bit +table. This operator returns a 64-bit time value that will be truncated +within a 32-bit table. + +iASL Source code restructuring: Cleanup to improve modularity. The +following new files have been added: aslhex.c, aslxref.c, aslnamesp.c, +aslmethod.c, and aslfileio.c. Associated makefiles and project files have +been updated. + + +---------------------------------------- +14 November 2012. Summary of changes for version 20121114: + +1) ACPICA Kernel-resident Subsystem: + +Implemented a performance enhancement for ACPI/AML Package objects. This +change greatly increases the performance of Package objects within the +interpreter. It changes the processing of reference counts for packages +by +optimizing for the most common case where the package sub-objects are +either Integers, Strings, or Buffers. Increases the overall performance +of +the ASLTS test suite by 1.5X (Increases the Slack Mode performance by +2X.) +Chao Guan. ACPICA BZ 943. + +Implemented and deployed common macros to extract flag bits from resource +descriptors. Improves readability and maintainability of the code. Fixes +a +problem with the UART serial bus descriptor for the number of data bits +flags (was incorrectly 2 bits, should be 3). + +Enhanced the ACPI_GETx and ACPI_SETx macros. Improved the implementation +of the macros and changed the SETx macros to the style of (destination, +source). Also added ACPI_CASTx companion macros. Lv Zheng. + +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: + Non-Debug Version: 93.9K Code, 25.2K Data, 119.1K Total + Debug Version: 175.5K Code, 74.5K Data, 250.0K Total + Current Release: + Non-Debug Version: 94.3K Code, 25.3K Data, 119.6K Total + Debug Version: 175.5K Code, 74.5K Data, 250.0K Total + + +2) iASL Compiler/Disassembler and Tools: + +Disassembler: Added the new ACPI 5.0 interrupt sharing flags. This change +adds the ShareAndWake and ExclusiveAndWake flags which were added to the +Irq, Interrupt, and Gpio resource descriptors in ACPI 5.0. ACPICA BZ 986. + +Disassembler: Fixed a problem with external declaration generation. Fixes +a problem where an incorrect pathname could be generated for an external +declaration if the original reference to the object includes leading +carats (^). ACPICA BZ 984. + +Debugger: Completed a major update for the Disassemble command. +This command was out-of-date and did not properly disassemble control +methods that had any reasonable complexity. This fix brings the command +up +to the same level as the rest of the disassembler. Adds one new file, +dmdeferred.c, which is existing code that is now common with the main +disassembler and the debugger disassemble command. ACPICA MZ 978. + +iASL: Moved the parser entry prototype to avoid a duplicate declaration. +Newer versions of Bison emit this prototype, so moved the prototype out +of +the iASL header to where it is actually used in order to avoid a +duplicate +declaration. + +iASL/Tools: Standardized use of the stream I/O functions: + 1) Ensure check for I/O error after every fopen/fread/fwrite + 2) Ensure proper order of size/count arguments for fread/fwrite + 3) Use test of (Actual != Requested) after all fwrite, and most fread + 4) Standardize I/O error messages +Improves reliability and maintainability of the code. Bob Moore, Lv +Zheng. +ACPICA BZ 981. + +Disassembler: Prevent duplicate External() statements. During generation +of external statements, detect similar pathnames that are actually +duplicates such as these: + External (\ABCD) + External (ABCD) +Remove all leading '\' characters from pathnames during the external +statement generation so that duplicates will be detected and tossed. +ACPICA BZ 985. + +Tools: Replace low-level I/O with stream I/O functions. Replace +open/read/write/close with the stream I/O equivalents +fopen/fread/fwrite/fclose for portability and performance. Lv Zheng, Bob +Moore. + +AcpiBin: Fix for the dump-to-hex function. Now correctly output the table +name header so that AcpiXtract recognizes the output file/table. + +iASL: Remove obsolete -2 option flag. Originally intended to force the +compiler/disassembler into an ACPI 2.0 mode, this was never implemented +and the entire concept is now obsolete. + +---------------------------------------- +18 October 2012. Summary of changes for version 20121018: + + +1) ACPICA Kernel-resident Subsystem: + +Updated support for the ACPI 5.0 MPST table. Fixes some problems +introduced by late changes to the table as it was added to the ACPI 5.0 +specification. Includes header, disassembler, and data table compiler +support as well as a new version of the MPST template. + +AcpiGetObjectInfo: Enhanced the device object support to include the ACPI +5.0 _SUB method. Now calls _SUB in addition to the other PNP-related ID +methods: _HID, _CID, and _UID. + +Changed ACPI_DEVICE_ID to ACPI_PNP_DEVICE_ID. Also changed +ACPI_DEVICE_ID_LIST to ACPI_PNP_DEVICE_ID_LIST. These changes prevent +name collisions on hosts that reserve the *_DEVICE_ID (or *DeviceId) +names for their various drivers. Affects the AcpiGetObjectInfo external +interface, and other internal interfaces as well. + +Added and deployed a new macro for ACPI_NAME management: ACPI_MOVE_NAME. +This macro resolves to a simple 32-bit move of the 4-character ACPI_NAME +on machines that support non-aligned transfers. Optimizes for this case +rather than using a strncpy. With assistance from Zheng Lv. + +Resource Manager: Small fix for buffer size calculation. Fixed a one byte +error in the output buffer calculation. Feng Tang. ACPICA BZ 849. + +Added a new debug print message for AML mutex objects that are force- +released. At control method termination, any currently acquired mutex +objects are force-released. Adds a new debug-only message for each one +that is released. + +Audited/updated all ACPICA return macros and the function debug depth +counter: 1) Ensure that all functions that use the various TRACE macros +also use the appropriate ACPICA return macros. 2) Ensure that all normal +return statements surround the return expression (value) with parens to +ensure consistency across the ACPICA code base. Guan Chao, Tang Feng, +Zheng Lv, Bob Moore. ACPICA Bugzilla 972. + +Global source code changes/maintenance: All extra lines at the start and +end of each source file have been removed for consistency. Also, within +comments, all new sentences start with a single space instead of a double +space, again for consistency across the code base. + +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: + Non-Debug Version: 93.7K Code, 25.3K Data, 119.0K Total + Debug Version: 175.0K Code, 74.4K Data, 249.4K Total + Current Release: + Non-Debug Version: 93.9K Code, 25.2K Data, 119.1K Total + Debug Version: 175.5K Code, 74.5K Data, 250.0K Total + + +2) iASL Compiler/Disassembler and Tools: + +AcpiExec: Improved the algorithm used for memory leak/corruption +detection. Added some intelligence to the code that maintains the global +list of allocated memory. The list is now ordered by allocated memory +address, significantly improving performance. When running AcpiExec on +the ASLTS test suite, speed improvements of 3X to 5X are seen, depending +on the platform and/or the environment. Note, this performance +enhancement affects the AcpiExec utility only, not the kernel-resident +ACPICA code. + +Enhanced error reporting for invalid AML opcodes and bad ACPI_NAMEs. For +the disassembler, dump the 48 bytes surrounding the invalid opcode. Fix +incorrect table offset reported for invalid opcodes. Report the original +32-bit value for bad ACPI_NAMEs (as well as the repaired name.) + +Disassembler: Enhanced the -vt option to emit the binary table data in +hex format to assist with debugging. + +Fixed a potential filename buffer overflow in osunixdir.c. Increased the +size of file structure. Colin Ian King. + +---------------------------------------- +13 September 2012. Summary of changes for version 20120913: + + +1) ACPICA Kernel-resident Subsystem: + +ACPI 5.0: Added two new notify types for the Hardware Error Notification +Structure within the Hardware Error Source Table (HEST) table -- CMCI(5) +and +MCE(6). + +Table Manager: Merged/removed duplicate code in the root table resize +functions. One function is external, the other is internal. Lv Zheng, +ACPICA +BZ 846. + +Makefiles: Completely removed the obsolete "Linux" makefiles under +acpica/generate/linux. These makefiles are obsolete and have been +replaced +by +the generic unix makefiles under acpica/generate/unix. + +Makefiles: Ensure that binary files always copied properly. Minor rule +change +to ensure that the final binary output files are always copied up to the +appropriate binary directory (bin32 or bin64.) + +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: + Non-Debug Version: 93.8K Code, 25.3K Data, 119.1K Total + Debug Version: 175.7K Code, 74.8K Data, 250.5K Total + Current Release: + Non-Debug Version: 93.7K Code, 25.3K Data, 119.0K Total + Debug Version: 175.0K Code, 74.4K Data, 249.4K Total + + +2) iASL Compiler/Disassembler and Tools: + +Disassembler: Fixed a possible fault during the disassembly of resource +descriptors when a second parse is required because of the invocation of +external control methods within the table. With assistance from +adq@lidskialf.net. ACPICA BZ 976. + +iASL: Fixed a namepath optimization problem. An error can occur if the +parse +node that contains the namepath to be optimized does not have a parent +node +that is a named object. This change fixes the problem. + +iASL: Fixed a regression where the AML file is not deleted on errors. The +AML +output file should be deleted if there are any errors during the +compiler. +The +only exception is if the -f (force output) option is used. ACPICA BZ 974. + +iASL: Added a feature to automatically increase internal line buffer +sizes. +Via realloc(), automatically increase the internal line buffer sizes as +necessary to support very long source code lines. The current version of +the +preprocessor requires a buffer long enough to contain full source code +lines. +This change increases the line buffer(s) if the input lines go beyond the +current buffer size. This eliminates errors that occurred when a source +code +line was longer than the buffer. + +iASL: Fixed a problem with constant folding in method declarations. The +SyncLevel term is a ByteConstExpr, and incorrect code would be generated +if a +Type3 opcode was used. + +Debugger: Improved command help support. For incorrect argument count, +display +full help for the command. For help command itself, allow an argument to +specify a command. + +Test Suites: Several bug fixes for the ASLTS suite reduces the number of +errors during execution of the suite. Guan Chao. + +---------------------------------------- +16 August 2012. Summary of changes for version 20120816: + + +1) ACPICA Kernel-resident Subsystem: + +Removed all use of the deprecated _GTS and _BFS predefined methods. The +_GTS +(Going To Sleep) and _BFS (Back From Sleep) methods are essentially +deprecated and will probably be removed from the ACPI specification. +Windows +does not invoke them, and reportedly never will. The final nail in the +coffin +is that the ACPI specification states that these methods must be run with +interrupts off, which is not going to happen in a kernel interpreter. +Note: +Linux has removed all use of the methods also. It was discovered that +invoking these functions caused failures on some machines, probably +because +they were never tested since Windows does not call them. Affects two +external +interfaces, AcpiEnterSleepState and AcpiLeaveSleepStatePrep. Tang Feng. +ACPICA BZ 969. + +Implemented support for complex bit-packed buffers returned from the _PLD +(Physical Location of Device) predefined method. Adds a new external +interface, AcpiDecodePldBuffer that parses the buffer into a more usable +C +structure. Note: C Bitfields cannot be used for this type of predefined +structure since the memory layout of individual bitfields is not defined +by +the C language. In addition, there are endian concerns where a compiler +will +change the bitfield ordering based on the machine type. The new ACPICA +interface eliminates these issues, and should be called after _PLD is +executed. ACPICA BZ 954. + +Implemented a change to allow a scope change to root (via "Scope (\)") +during +execution of module-level ASL code (code that is executed at table load +time.) Lin Ming. + +Added the Windows8/Server2012 string for the _OSI method. This change +adds +a +new _OSI string, "Windows 2012" for both Windows 8 and Windows Server +2012. + +Added header support for the new ACPI tables DBG2 (Debug Port Table Type +2) +and CSRT (Core System Resource Table). + +Added struct header support for the _FDE, _GRT, _GTM, and _SRT predefined +names. This simplifies access to the buffers returned by these predefined +names. Adds a new file, include/acbuffer.h. ACPICA BZ 956. + +GPE support: Removed an extraneous parameter from the various low-level +internal GPE functions. Tang Feng. + +Removed the linux makefiles from the unix packages. The generate/linux +makefiles are obsolete and have been removed from the unix tarball +release +packages. The replacement makefiles are under generate/unix, and there is +a +top-level makefile under the main acpica directory. ACPICA BZ 967, 912. + +Updates for Unix makefiles: +1) Add -D_FORTIFY_SOURCE=2 for gcc generation. Arjan van de Ven. +2) Update linker flags (move to end of command line) for AcpiExec +utility. +Guan Chao. + +Split ACPICA initialization functions to new file, utxfinit.c. Split from +utxface.c to improve modularity and reduce file size. + +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: + Non-Debug Version: 93.5K Code, 25.3K Data, 118.8K Total + Debug Version: 173.7K Code, 74.0K Data, 247.7K Total + Current Release: + Non-Debug Version: 93.8K Code, 25.3K Data, 119.1K Total + Debug Version: 175.7K Code, 74.8K Data, 250.5K Total + + +2) iASL Compiler/Disassembler and Tools: + +iASL: Fixed a problem with constant folding for fixed-length constant +expressions. The constant-folding code was not being invoked for constant +expressions that allow the use of type 3/4/5 opcodes to generate +constants +for expressions such as ByteConstExpr, WordConstExpr, etc. This could +result +in the generation of invalid AML bytecode. ACPICA BZ 970. + +iASL: Fixed a generation issue on newer versions of Bison. Newer versions +apparently automatically emit some of the necessary externals. This +change +handles these versions in order to eliminate generation warnings. + +Disassembler: Added support to decode the DBG2 and CSRT ACPI tables. + +Disassembler: Add support to decode _PLD buffers. The decoded buffer +appears +within comments in the output file. + +Debugger: Fixed a regression with the "Threads" command where +AE_BAD_PARAMETER was always returned. + +---------------------------------------- +11 July 2012. Summary of changes for version 20120711: + +1) ACPICA Kernel-resident Subsystem: + +Fixed a possible fault in the return package object repair code. Fixes a +problem that can occur when a lone package object is wrapped with an +outer +package object in order to force conformance to the ACPI specification. +Can +affect these predefined names: _ALR, _MLS, _PSS, _TRT, _TSS, _PRT, _HPX, +_DLM, +_CSD, _PSD, _TSD. + +Removed code to disable/enable bus master arbitration (ARB_DIS bit in the +PM2_CNT register) in the ACPICA sleep/wake interfaces. Management of the +ARB_DIS bit must be implemented in the host-dependent C3 processor power +state +support. Note, ARB_DIS is obsolete and only applies to older chipsets, +both +Intel and other vendors. (for Intel: ICH4-M and earlier) + +This change removes the code to disable/enable bus master arbitration +during +suspend/resume. Use of the ARB_DIS bit in the optional PM2_CNT register +causes +resume problems on some machines. The change has been in use for over +seven +years within Linux. + +Implemented two new external interfaces to support host-directed dynamic +ACPI +table load and unload. They are intended to simplify the host +implementation +of hot-plug support: + AcpiLoadTable: Load an SSDT from a buffer into the namespace. + AcpiUnloadParentTable: Unload an SSDT via a named object owned by the +table. +See the ACPICA reference for additional details. Adds one new file, +components/tables/tbxfload.c + +Implemented and deployed two new interfaces for errors and warnings that +are +known to be caused by BIOS/firmware issues: + AcpiBiosError: Prints "ACPI Firmware Error" message. + AcpiBiosWarning: Prints "ACPI Firmware Warning" message. +Deployed these new interfaces in the ACPICA Table Manager code for ACPI +table +and FADT errors. Additional deployment to be completed as appropriate in +the +future. The associated conditional macros are ACPI_BIOS_ERROR and +ACPI_BIOS_WARNING. See the ACPICA reference for additional details. +ACPICA +BZ +843. + +Implicit notify support: ensure that no memory allocation occurs within a +critical region. This fix moves a memory allocation outside of the time +that a +spinlock is held. Fixes issues on systems that do not allow this +behavior. +Jung-uk Kim. + +Split exception code utilities and tables into a new file, +utilities/utexcep.c + +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: + Non-Debug Version: 93.1K Code, 25.1K Data, 118.2K Total + Debug Version: 172.9K Code, 73.6K Data, 246.5K Total + Current Release: + Non-Debug Version: 93.5K Code, 25.3K Data, 118.8K Total + Debug Version: 173.7K Code, 74.0K Data, 247.7K Total + + +2) iASL Compiler/Disassembler and Tools: + +iASL: Fixed a parser problem for hosts where EOF is defined as -1 instead +of +0. Jung-uk Kim. + +Debugger: Enhanced the "tables" command to emit additional information +about +the current set of ACPI tables, including the owner ID and flags decode. + +Debugger: Reimplemented the "unload" command to use the new +AcpiUnloadParentTable external interface. This command was disable +previously +due to need for an unload interface. + +AcpiHelp: Added a new option to decode ACPICA exception codes. The -e +option +will decode 16-bit hex status codes (ACPI_STATUS) to name strings. + +---------------------------------------- +20 June 2012. Summary of changes for version 20120620: + + +1) ACPICA Kernel-resident Subsystem: + +Implemented support to expand the "implicit notify" feature to allow +multiple +devices to be notified by a single GPE. This feature automatically +generates a +runtime device notification in the absence of a BIOS-provided GPE control +method (_Lxx/_Exx) or a host-installed handler for the GPE. Implicit +notify is +provided by ACPICA for Windows compatibility, and is a workaround for +BIOS +AML +code errors. See the description of the AcpiSetupGpeForWake interface in +the +APCICA reference. Bob Moore, Rafael Wysocki. ACPICA BZ 918. + +Changed some comments and internal function names to simplify and ensure +correctness of the Linux code translation. No functional changes. + +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: + Non-Debug Version: 93.0K Code, 25.1K Data, 118.1K Total + Debug Version: 172.7K Code, 73.6K Data, 246.3K Total + Current Release: + Non-Debug Version: 93.1K Code, 25.1K Data, 118.2K Total + Debug Version: 172.9K Code, 73.6K Data, 246.5K Total + + +2) iASL Compiler/Disassembler and Tools: + +Disassembler: Added support to emit short, commented descriptions for the +ACPI +predefined names in order to improve the readability of the disassembled +output. ACPICA BZ 959. Changes include: + 1) Emit descriptions for all standard predefined names (_INI, _STA, +_PRW, +etc.) + 2) Emit generic descriptions for the special names (_Exx, _Qxx, etc.) + 3) Emit descriptions for the resource descriptor names (_MIN, _LEN, +etc.) + +AcpiSrc: Fixed several long-standing Linux code translation issues. +Argument +descriptions in function headers are now translated properly to lower +case +and +underscores. ACPICA BZ 961. Also fixes translation problems such as +these: +(old -> new) + i_aSL -> iASL + 00-7_f -> 00-7F + 16_k -> 16K + local_fADT -> local_FADT + execute_oSI -> execute_OSI + +iASL: Fixed a problem where null bytes were inadvertently emitted into +some +listing files. + +iASL: Added the existing debug options to the standard help screen. There +are +no longer two different help screens. ACPICA BZ 957. + +AcpiHelp: Fixed some typos in the various predefined name descriptions. +Also +expand some of the descriptions where appropriate. + +iASL: Fixed the -ot option (display compile times/statistics). Was not +working +properly for standard output; only worked for the debug file case. + +---------------------------------------- +18 May 2012. Summary of changes for version 20120518: + + +1) ACPICA Core Subsystem: + +Added a new OSL interface, AcpiOsWaitEventsComplete. This interface is +defined +to block until asynchronous events such as notifies and GPEs have +completed. +Within ACPICA, it is only called before a notify or GPE handler is +removed/uninstalled. It also may be useful for the host OS within related +drivers such as the Embedded Controller driver. See the ACPICA reference +for +additional information. ACPICA BZ 868. + +ACPI Tables: Added a new error message for a possible overflow failure +during +the conversion of FADT 32-bit legacy register addresses to internal +common +64- +bit GAS structure representation. The GAS has a one-byte "bit length" +field, +thus limiting the register length to 255 bits. ACPICA BZ 953. + +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: + Non-Debug Version: 92.9K Code, 25.0K Data, 117.9K Total + Debug Version: 172.6K Code, 73.4K Data, 246.0K Total + Current Release: + Non-Debug Version: 93.0K Code, 25.1K Data, 118.1K Total + Debug Version: 172.7K Code, 73.6K Data, 246.3K Total + + +2) iASL Compiler/Disassembler and Tools: + +iASL: Added the ACPI 5.0 "PCC" keyword for use in the Register() ASL +macro. +This keyword was added late in the ACPI 5.0 release cycle and was not +implemented until now. + +Disassembler: Added support for Operation Region externals. Adds missing +support for operation regions that are defined in another table, and +referenced locally via a Field or BankField ASL operator. Now generates +the +correct External statement. + +Disassembler: Several additional fixes for the External() statement +generation +related to some ASL operators. Also, order the External() statements +alphabetically in the disassembler output. Fixes the External() +generation +for +the Create* field, Alias, and Scope operators: + 1) Create* buffer field operators - fix type mismatch warning on +disassembly + 2) Alias - implement missing External support + 3) Scope - fix to make sure all necessary externals are emitted. + +iASL: Improved pathname support. For include files, merge the prefix +pathname +with the file pathname and eliminate unnecessary components. Convert +backslashes in all pathnames to forward slashes, for readability. Include +file +pathname changes affect both #include and Include() type operators. + +iASL/DTC/Preprocessor: Gracefully handle early EOF. Handle an EOF at the +end +of a valid line by inserting a newline and then returning the EOF during +the +next call to GetNextLine. Prevents the line from being ignored due to EOF +condition. + +iASL: Implemented some changes to enhance the IDE support (-vi option.) +Error +and Warning messages are now correctly recognized for both the source +code +browser and the global error and warning counts. + +---------------------------------------- +20 April 2012. Summary of changes for version 20120420: + + +1) ACPICA Core Subsystem: + +Implemented support for multiple notify handlers. This change adds +support +to +allow multiple system and device notify handlers on Device, Thermal Zone, +and +Processor objects. This can simplify the host OS notification +implementation. +Also re-worked and restructured the entire notify support code to +simplify +handler installation, handler removal, notify event queuing, and notify +dispatch to handler(s). Note: there can still only be two global notify +handlers - one for system notifies and one for device notifies. There are +no +changes to the existing handler install/remove interfaces. Lin Ming, Bob +Moore, Rafael Wysocki. + +Fixed a regression in the package repair code where the object reference +count was calculated incorrectly. Regression was introduced in the commit +"Support to add Package wrappers". + +Fixed a couple possible memory leaks in the AML parser, in the error +recovery +path. Jesper Juhl, Lin Ming. + +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: + Non-Debug Version: 92.9K Code, 25.0K Data, 117.9K Total + Debug Version: 172.5K Code, 73.2K Data, 245.7K Total + Current Release: + Non-Debug Version: 92.9K Code, 25.0K Data, 117.9K Total + Debug Version: 172.6K Code, 73.4K Data, 246.0K Total + + +2) iASL Compiler/Disassembler and Tools: + +iASL: Fixed a problem with the resource descriptor support where the +length +of the StartDependentFn and StartDependentFnNoPrio descriptors were not +included in cumulative descriptor offset, resulting in incorrect values +for +resource tags within resource descriptors appearing after a +StartDependent* +descriptor. Reported by Petr Vandrovec. ACPICA BZ 949. + +iASL and Preprocessor: Implemented full support for the #line directive +to +correctly track original source file line numbers through the .i +preprocessor +output file - for error and warning messages. + +iASL: Expand the allowable byte constants for address space IDs. +Previously, +the allowable range was 0x80-0xFF (user-defined spaces), now the range is +0x0A-0xFF to allow for custom and new IDs without changing the compiler. + +iASL: Add option to treat all warnings as errors (-we). ACPICA BZ 948. + +iASL: Add option to completely disable the preprocessor (-Pn). + +iASL: Now emit all error/warning messages to standard error (stderr) by +default (instead of the previous stdout). + +ASL Test Suite (ASLTS): Reduce iASL warnings due to use of Switch(). +Update +for resource descriptor offset fix above. Update/cleanup error output +routines. Enable and send iASL errors/warnings to an error logfile +(error.txt). Send all other iASL output to a logfile (compiler.txt). +Fixed +several extraneous "unrecognized operator" messages. + +---------------------------------------- +20 March 2012. Summary of changes for version 20120320: + + +1) ACPICA Core Subsystem: + +Enhanced the sleep/wake interfaces to optionally execute the _GTS method +(Going To Sleep) and the _BFS method (Back From Sleep). Windows +apparently +does not execute these methods, and therefore these methods are often +untested. It has been seen on some systems where the execution of these +methods causes errors and also prevents the machine from entering S5. It +is +therefore suggested that host operating systems do not execute these +methods +by default. In the future, perhaps these methods can be optionally +executed +based on the age of the system and/or what is the newest version of +Windows +that the BIOS asks for via _OSI. Changed interfaces: AcpiEnterSleepState +and +AcpileaveSleepStatePrep. See the ACPICA reference and Linux BZ 13041. Lin +Ming. + +Fixed a problem where the length of the local/common FADT was set too +early. +The local FADT table length cannot be set to the common length until the +original length has been examined. There is code that checks the table +length +and sets various fields appropriately. This can affect older machines +with +early FADT versions. For example, this can cause inadvertent writes to +the +CST_CNT register. Julian Anastasov. + +Fixed a mapping issue related to a physical table override. Use the +deferred +mapping mechanism for tables loaded via the physical override OSL +interface. +This allows for early mapping before the virtual memory manager is +available. +Thomas Renninger, Bob Moore. + +Enhanced the automatic return-object repair code: Repair a common problem +with +predefined methods that are defined to return a variable-length Package +of +sub-objects. If there is only one sub-object, some BIOS ASL code +mistakenly +simply returns the single object instead of a Package with one sub- +object. +This new support will repair this error by wrapping a Package object +around +the original object, creating the correct and expected Package with one +sub- +object. Names that can be repaired in this manner include: _ALR, _CSD, +_HPX, +_MLS, _PLD, _PRT, _PSS, _TRT, _TSS, _BCL, _DOD, _FIX, and _Sx. ACPICA BZ +939. + +Changed the exception code returned for invalid ACPI paths passed as +parameters to external interfaces such as AcpiEvaluateObject. Was +AE_BAD_PARAMETER, now is the more sensible AE_BAD_PATHNAME. + +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: + Non-Debug Version: 93.0K Code, 25.0K Data, 118.0K Total + Debug Version: 172.5K Code, 73.2K Data, 245.7K Total + Current Release: + Non-Debug Version: 92.9K Code, 25.0K Data, 117.9K Total + Debug Version: 172.5K Code, 73.2K Data, 245.7K Total + + +2) iASL Compiler/Disassembler and Tools: + +iASL: Added the infrastructure and initial implementation of a integrated +C- +like preprocessor. This will simplify BIOS development process by +eliminating +the need for a separate preprocessing step during builds. On Windows, it +also +eliminates the need to install a separate C compiler. ACPICA BZ 761. Some +features including full #define() macro support are still under +development. +These preprocessor directives are supported: + #define + #elif + #else + #endif + #error + #if + #ifdef + #ifndef + #include + #pragma message + #undef + #warning +In addition, these new command line options are supported: + -D Define symbol for preprocessor use + -li Create preprocessed output file (*.i) + -P Preprocess only and create preprocessor output file (*.i) + +Table Compiler: Fixed a problem where the equals operator within an +expression +did not work properly. + +Updated iASL to use the current versions of Bison/Flex. Updated the +Windows +project file to invoke these tools from the standard location. ACPICA BZ +904. +Versions supported: + Flex for Windows: V2.5.4 + Bison for Windows: V2.4.1 + +---------------------------------------- +15 February 2012. Summary of changes for version 20120215: + + +1) ACPICA Core Subsystem: + +There have been some major changes to the sleep/wake support code, as +described below (a - e). + +a) The AcpiLeaveSleepState has been split into two interfaces, similar to +AcpiEnterSleepStatePrep and AcpiEnterSleepState. The new interface is +AcpiLeaveSleepStatePrep. This allows the host to perform actions between +the +time the _BFS method is called and the _WAK method is called. NOTE: all +hosts +must update their wake/resume code or else sleep/wake will not work +properly. +Rafael Wysocki. + +b) In AcpiLeaveSleepState, now enable all runtime GPEs before calling the +_WAK +method. Some machines require that the GPEs are enabled before the _WAK +method +is executed. Thomas Renninger. + +c) In AcpiLeaveSleepState, now always clear the WAK_STS (wake status) +bit. +Some BIOS code assumes that WAK_STS will be cleared on resume and use it +to +determine whether the system is rebooting or resuming. Matthew Garrett. + +d) Move the invocations of _GTS (Going To Sleep) and _BFS (Back From +Sleep) to +match the ACPI specification requirement. Rafael Wysocki. + +e) Implemented full support for the ACPI 5.0 SleepStatus and SleepControl +registers within the V5 FADT. This support adds two new files: +hardware/hwesleep.c implements the support for the new registers. Moved +all +sleep/wake external interfaces to hardware/hwxfsleep.c. + + +Added a new OSL interface for ACPI table overrides, +AcpiOsPhysicalTableOverride. This interface allows the host to override a +table via a physical address, instead of the logical address required by +AcpiOsTableOverride. This simplifies the host implementation. Initial +implementation by Thomas Renninger. The ACPICA implementation creates a +single +shared function for table overrides that attempts both a logical and a +physical override. + +Expanded the OSL memory read/write interfaces to 64-bit data +(AcpiOsReadMemory, AcpiOsWriteMemory.) This enables full 64-bit memory +transfer support for GAS register structures passed to AcpiRead and +AcpiWrite. + +Implemented the ACPI_REDUCED_HARDWARE option to allow the creation of a +custom +build of ACPICA that supports only the ACPI 5.0 reduced hardware (SoC) +model. +See the ACPICA reference for details. ACPICA BZ 942. This option removes +about +10% of the code and 5% of the static data, and the following hardware +ACPI +features become unavailable: + PM Event and Control registers + SCI interrupt (and handler) + Fixed Events + General Purpose Events (GPEs) + Global Lock + ACPI PM timer + FACS table (Waking vectors and Global Lock) + +Updated the unix tarball directory structure to match the ACPICA git +source +tree. This ensures that the generic unix makefiles work properly (in +generate/unix). Also updated the Linux makefiles to match. ACPICA BZ +867. + +Updated the return value of the _REV predefined method to integer value 5 +to +reflect ACPI 5.0 support. + +Moved the external ACPI PM timer interface prototypes to the public +acpixf.h +file where they belong. + +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: + Non-Debug Version: 92.8K Code, 24.9K Data, 117.7K Total + Debug Version: 171.7K Code, 72.9K Data, 244.5K Total + Current Release: + Non-Debug Version: 93.0K Code, 25.0K Data, 118.0K Total + Debug Version: 172.5K Code, 73.2K Data, 245.7K Total + + +2) iASL Compiler/Disassembler and Tools: + +Disassembler: Fixed a problem with the new ACPI 5.0 serial resource +descriptors (I2C, SPI, UART) where the resource produce/consumer bit was +incorrectly displayed. + +AcpiHelp: Add display of ACPI/PNP device IDs that are defined in the ACPI +specification. + +---------------------------------------- +11 January 2012. Summary of changes for version 20120111: + + +1) ACPICA Core Subsystem: + +Implemented a new mechanism to allow host device drivers to check for +address +range conflicts with ACPI Operation Regions. Both SystemMemory and +SystemIO +address spaces are supported. A new external interface, +AcpiCheckAddressRange, +allows drivers to check an address range against the ACPI namespace. See +the +ACPICA reference for additional details. Adds one new file, +utilities/utaddress.c. Lin Ming, Bob Moore. + +Fixed several issues with the ACPI 5.0 FADT support: Add the sleep +Control +and +Status registers, update the ACPI 5.0 flags, and update internal data +structures to handle an FADT larger than 256 bytes. The size of the ACPI +5.0 +FADT is 268 bytes. + +Updated all ACPICA copyrights and signons to 2012. Added the 2012 +copyright to +all module headers and signons, including the standard Linux header. This +affects virtually every file in the ACPICA core subsystem, iASL compiler, +and +all ACPICA utilities. + +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: + Non-Debug Version: 92.3K Code, 24.9K Data, 117.2K Total + Debug Version: 170.8K Code, 72.6K Data, 243.4K Total + Current Release: + Non-Debug Version: 92.8K Code, 24.9K Data, 117.7K Total + Debug Version: 171.7K Code, 72.9K Data, 244.5K Total + + +2) iASL Compiler/Disassembler and Tools: + +Disassembler: fixed a problem with the automatic resource tag generation +support. Fixes a problem where the resource tags are inadvertently not +constructed if the table being disassembled contains external references +to +control methods. Moved the actual construction of the tags to after the +final +namespace is constructed (after 2nd parse is invoked due to external +control +method references.) ACPICA BZ 941. + +Table Compiler: Make all "generic" operators caseless. These are the +operators +like UINT8, String, etc. Making these caseless improves ease-of-use. +ACPICA BZ +934. + +---------------------------------------- +23 November 2011. Summary of changes for version 20111123: + +0) ACPI 5.0 Support: + +This release contains full support for the ACPI 5.0 specification, as +summarized below. + +Reduced Hardware Support: +------------------------- + +This support allows for ACPI systems without the usual ACPI hardware. +This +support is enabled by a flag in the revision 5 FADT. If it is set, ACPICA +will +not attempt to initialize or use any of the usual ACPI hardware. Note, +when +this flag is set, all of the following ACPI hardware is assumed to be not +present and is not initialized or accessed: + + General Purpose Events (GPEs) + Fixed Events (PM1a/PM1b and PM Control) + Power Management Timer and Console Buttons (power/sleep) + Real-time Clock Alarm + Global Lock + System Control Interrupt (SCI) + The FACS is assumed to be non-existent + +ACPI Tables: +------------ + +All new tables and updates to existing tables are fully supported in the +ACPICA headers (for use by device drivers), the disassembler, and the +iASL +Data Table Compiler. ACPI 5.0 defines these new tables: + + BGRT /* Boot Graphics Resource Table */ + DRTM /* Dynamic Root of Trust for Measurement table */ + FPDT /* Firmware Performance Data Table */ + GTDT /* Generic Timer Description Table */ + MPST /* Memory Power State Table */ + PCCT /* Platform Communications Channel Table */ + PMTT /* Platform Memory Topology Table */ + RASF /* RAS Feature table */ + +Operation Regions/SpaceIDs: +--------------------------- + +All new operation regions are fully supported by the iASL compiler, the +disassembler, and the ACPICA runtime code (for dispatch to region +handlers.) +The new operation region Space IDs are: + + GeneralPurposeIo + GenericSerialBus + +Resource Descriptors: +--------------------- + +All new ASL resource descriptors are fully supported by the iASL +compiler, +the +ASL/AML disassembler, and the ACPICA runtime Resource Manager code +(including +all new predefined resource tags). New descriptors are: + + FixedDma + GpioIo + GpioInt + I2cSerialBus + SpiSerialBus + UartSerialBus + +ASL/AML Operators, New and Modified: +------------------------------------ + +One new operator is added, the Connection operator, which is used to +associate +a GeneralPurposeIo or GenericSerialBus resource descriptor with +individual +field objects within an operation region. Several new protocols are +associated +with the AccessAs operator. All are fully supported by the iASL compiler, +disassembler, and runtime ACPICA AML interpreter: + + Connection // Declare Field Connection +attributes + AccessAs: AttribBytes (n) // Read/Write N-Bytes Protocol + AccessAs: AttribRawBytes (n) // Raw Read/Write N-Bytes +Protocol + AccessAs: AttribRawProcessBytes (n) // Raw Process Call Protocol + RawDataBuffer // Data type for Vendor Data +fields + +Predefined ASL/AML Objects: +--------------------------- + +All new predefined objects/control-methods are supported by the iASL +compiler +and the ACPICA runtime validation/repair (arguments and return values.) +New +predefined names include the following: + +Standard Predefined Names (Objects or Control Methods): + _AEI, _CLS, _CPC, _CWS, _DEP, + _DLM, _EVT, _GCP, _CRT, _GWS, + _HRV, _PRE, _PSE, _SRT, _SUB. + +Resource Tags (Names used to access individual fields within resource +descriptors): + _DBT, _DPL, _DRS, _END, _FLC, + _IOR, _LIN, _MOD, _PAR, _PHA, + _PIN, _PPI, _POL, _RXL, _SLV, + _SPE, _STB, _TXL, _VEN. + +ACPICA External Interfaces: +--------------------------- + +Several new interfaces have been defined for use by ACPI-related device +drivers and other host OS services: + +AcpiAcquireMutex and AcpiReleaseMutex: These interfaces allow the host OS +to +acquire and release AML mutexes that are defined in the DSDT/SSDT tables +provided by the BIOS. They are intended to be used in conjunction with +the +ACPI 5.0 _DLM (Device Lock Method) in order to provide transaction-level +mutual exclusion with the AML code/interpreter. + +AcpiGetEventResources: Returns the (formatted) resource descriptors as +defined +by the ACPI 5.0 _AEI object (ACPI Event Information). This object +provides +resource descriptors associated with hardware-reduced platform events, +similar +to the AcpiGetCurrentResources interface. + +Operation Region Handlers: For General Purpose IO and Generic Serial Bus +operation regions, information about the Connection() object and any +optional +length information is passed to the region handler within the Context +parameter. + +AcpiBufferToResource: This interface converts a raw AML buffer containing +a +resource template or resource descriptor to the ACPI_RESOURCE internal +format +suitable for use by device drivers. Can be used by an operation region +handler +to convert the Connection() buffer object into a ACPI_RESOURCE. + +Miscellaneous/Tools/TestSuites: +------------------------------- + +Support for extended _HID names (Four alpha characters instead of three). +Support for ACPI 5.0 features in the AcpiExec and AcpiHelp utilities. +Support for ACPI 5.0 features in the ASLTS test suite. +Fully updated documentation (ACPICA and iASL reference documents.) + +ACPI Table Definition Language: +------------------------------- + +Support for this language was implemented and released as a subsystem of +the +iASL compiler in 2010. (See the iASL compiler User Guide.) + + +Non-ACPI 5.0 changes for this release: +-------------------------------------- + +1) ACPICA Core Subsystem: + +Fix a problem with operation region declarations where a failure can +occur +if +the region name and an argument that evaluates to an object (such as the +region address) are in different namespace scopes. Lin Ming, ACPICA BZ +937. + +Do not abort an ACPI table load if an invalid space ID is found within. +This +will be caught later if the offending method is executed. ACPICA BZ 925. + +Fixed an issue with the FFixedHW space ID where the ID was not always +recognized properly (Both ACPICA and iASL). ACPICA BZ 926. + +Fixed a problem with the 32-bit generation of the unix-specific OSL +(osunixxf.c). Lin Ming, ACPICA BZ 936. + +Several changes made to enable generation with the GCC 4.6 compiler. +ACPICA BZ +935. + +New error messages: Unsupported I/O requests (not 8/16/32 bit), and +Index/Bank +field registers out-of-range. + +2) iASL Compiler/Disassembler and Tools: + +iASL: Implemented the __PATH__ operator, which returns the full pathname +of +the current source file. + +AcpiHelp: Automatically display expanded keyword information for all ASL +operators. + +Debugger: Add "Template" command to disassemble/dump resource template +buffers. + +Added a new master script to generate and execute the ASLTS test suite. +Automatically handles 32- and 64-bit generation. See tests/aslts.sh + +iASL: Fix problem with listing generation during processing of the +Switch() +operator where AML listing was disabled until the entire Switch block was +completed. + +iASL: Improve support for semicolon statement terminators. Fix "invalid +character" message for some cases when the semicolon is used. Semicolons +are +now allowed after every grammar element. ACPICA BZ 927. + +iASL: Fixed some possible aliasing warnings during generation. ACPICA BZ +923. + +Disassembler: Fix problem with disassembly of the DataTableRegion +operator +where an inadvertent "Unhandled deferred opcode" message could be +generated. + +3) 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: + Non-Debug Version: 90.2K Code, 23.9K Data, 114.1K Total + Debug Version: 165.6K Code, 68.4K Data, 234.0K Total + Current Release: + Non-Debug Version: 92.3K Code, 24.9K Data, 117.2K Total + Debug Version: 170.8K Code, 72.6K Data, 243.4K Total + +---------------------------------------- +22 September 2011. Summary of changes for version 20110922: + +0) ACPI 5.0 News: + +Support for ACPI 5.0 in ACPICA has been underway for several months and +will +be released at the same time that ACPI 5.0 is officially released. + +The ACPI 5.0 specification is on track for release in the next few +months. + +1) ACPICA Core Subsystem: + +Fixed a problem where the maximum sleep time for the Sleep() operator was +intended to be limited to two seconds, but was inadvertently limited to +20 +seconds instead. + +Linux and Unix makefiles: Added header file dependencies to ensure +correct +generation of ACPICA core code and utilities. Also simplified the +makefiles +considerably through the use of the vpath variable to specify search +paths. +ACPICA BZ 924. + +2) iASL Compiler/Disassembler and Tools: + +iASL: Implemented support to check the access length for all fields +created to +access named Resource Descriptor fields. For example, if a resource field +is +defined to be two bits, a warning is issued if a CreateXxxxField() is +used +with an incorrect bit length. This is implemented for all current +resource +descriptor names. ACPICA BZ 930. + +Disassembler: Fixed a byte ordering problem with the output of 24-bit and +56- +bit integers. + +iASL: Fixed a couple of issues associated with variable-length package +objects. 1) properly handle constants like One, Ones, Zero -- do not make +a +VAR_PACKAGE when these are used as a package length. 2) Allow the +VAR_PACKAGE +opcode (in addition to PACKAGE) when validating object types for +predefined +names. + +iASL: Emit statistics for all output files (instead of just the ASL input +and +AML output). Includes listings, hex files, etc. + +iASL: Added -G option to the table compiler to allow the compilation of +custom +ACPI tables. The only part of a table that is required is the standard +36- +byte +ACPI header. + +AcpiXtract: Ported to the standard ACPICA environment (with ACPICA +headers), +which also adds correct 64-bit support. Also, now all output filenames +are +completely lower case. + +AcpiExec: Ignore any non-AML tables (tables other than DSDT or SSDT) when +loading table files. A warning is issued for any such tables. The only +exception is an FADT. This also fixes a possible fault when attempting to +load +non-AML tables. ACPICA BZ 932. + +AcpiHelp: Added the AccessAs and Offset operators. Fixed a problem where +a +missing table terminator could cause a fault when using the -p option. + +AcpiSrc: Fixed a possible divide-by-zero fault when generating file +statistics. + +3) 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: 90.2K Code, 23.9K Data, 114.1K Total + Debug Version: 165.6K Code, 68.4K Data, 234.0K Total + Current Release (VC 9.0): + Non-Debug Version: 90.2K Code, 23.9K Data, 114.1K Total + Debug Version: 165.6K Code, 68.4K Data, 234.0K Total + + +---------------------------------------- +23 June 2011. Summary of changes for version 20110623: + +1) ACPI CA Core Subsystem: + +Updated the predefined name repair mechanism to not attempt repair of a +_TSS +return object if a _PSS object is present. We can only sort the _TSS +return +package if there is no _PSS within the same scope. This is because if +_PSS +is +present, the ACPI specification dictates that the _TSS Power Dissipation +field +is to be ignored, and therefore some BIOSs leave garbage values in the +_TSS +Power field(s). In this case, it is best to just return the _TSS package +as- +is. Reported by, and fixed with assistance from Fenghua Yu. + +Added an option to globally disable the control method return value +validation +and repair. This runtime option can be used to disable return value +repair +if +this is causing a problem on a particular machine. Also added an option +to +AcpiExec (-dr) to set this disable flag. + +All makefiles and project files: Major changes to improve generation of +ACPICA +tools. ACPICA BZ 912: + Reduce default optimization levels to improve compatibility + For Linux, add strict-aliasing=0 for gcc 4 + Cleanup and simplify use of command line defines + Cleanup multithread library support + Improve usage messages + +Linux-specific header: update handling of THREAD_ID and pthread. For the +32- +bit case, improve casting to eliminate possible warnings, especially with +the +acpica tools. + +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: 90.1K Code, 23.9K Data, 114.0K Total + Debug Version: 165.6K Code, 68.4K Data, 234.0K Total + Current Release (VC 9.0): + Non-Debug Version: 90.2K Code, 23.9K Data, 114.1K Total + Debug Version: 165.6K Code, 68.4K Data, 234.0K Total + +2) iASL Compiler/Disassembler and Tools: + +With this release, a new utility named "acpihelp" has been added to the +ACPICA +package. This utility summarizes the ACPI specification chapters for the +ASL +and AML languages. It generates under Linux/Unix as well as Windows, and +provides the following functionality: + Find/display ASL operator(s) -- with description and syntax. + Find/display ASL keyword(s) -- with exact spelling and descriptions. + Find/display ACPI predefined name(s) -- with description, number + of arguments, and the return value data type. + Find/display AML opcode name(s) -- with opcode, arguments, and +grammar. + Decode/display AML opcode -- with opcode name, arguments, and +grammar. + +Service Layers: Make multi-thread support configurable. Conditionally +compile +the multi-thread support so that threading libraries will not be linked +if +not +necessary. The only tool that requires multi-thread support is AcpiExec. + +iASL: Update yyerrror/AslCompilerError for "const" errors. Newer versions +of +Bison appear to want the interface to yyerror to be a const char * (or at +least this is a problem when generating iASL on some systems.) ACPICA BZ +923 +Pierre Lejeune. + +Tools: Fix for systems where O_BINARY is not defined. Only used for +Windows +versions of the tools. + +---------------------------------------- +27 May 2011. Summary of changes for version 20110527: + +1) ACPI CA Core Subsystem: + +ASL Load() operator: Reinstate most restrictions on the incoming ACPI +table +signature. Now, only allow SSDT, OEMx, and a null signature. History: + 1) Originally, we checked the table signature for "SSDT" or "PSDT". + (PSDT is now obsolete.) + 2) We added support for OEMx tables, signature "OEM" plus a fourth + "don't care" character. + 3) Valid tables were encountered with a null signature, so we just + gave up on validating the signature, (05/2008). + 4) We encountered non-AML tables such as the MADT, which caused + interpreter errors and kernel faults. So now, we once again allow + only SSDT, OEMx, and now, also a null signature. (05/2011). + +Added the missing _TDL predefined name to the global name list in order +to +enable validation. Affects both the core ACPICA code and the iASL +compiler. + +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: 90.0K Code, 23.8K Data, 113.8K Total + Debug Version: 164.5K Code, 68.0K Data, 232.5K Total + Current Release (VC 9.0): + Non-Debug Version: 90.1K Code, 23.9K Data, 114.0K Total + Debug Version: 165.6K Code, 68.4K Data, 234.0K Total + +2) iASL Compiler/Disassembler and Tools: + +Debugger/AcpiExec: Implemented support for "complex" method arguments on +the +debugger command line. This adds support beyond simple integers -- +including +Strings, Buffers, and Packages. Includes support for nested packages. +Increased the default command line buffer size to accommodate these +arguments. +See the ACPICA reference for details and syntax. ACPICA BZ 917. + +Debugger/AcpiExec: Implemented support for "default" method arguments for +the +Execute/Debug command. Now, the debugger will always invoke a control +method +with the required number of arguments -- even if the command line +specifies +none or insufficient arguments. It uses default integer values for any +missing +arguments. Also fixes a bug where only six method arguments maximum were +supported instead of the required seven. + +Debugger/AcpiExec: Add a maximum buffer length parameter to AcpiOsGetLine +and +also return status in order to prevent buffer overruns. See the ACPICA +reference for details and syntax. ACPICA BZ 921 + +iASL: Cleaned up support for Berkeley yacc. A general cleanup of code and +makefiles to simplify support for the two different but similar parser +generators, bison and yacc. + +Updated the generic unix makefile for gcc 4. The default gcc version is +now +expected to be 4 or greater, since options specific to gcc 4 are used. + +---------------------------------------- +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: + +1) ACPI CA Core Subsystem: + +Fixed a problem caused by a _PRW method appearing at the namespace root +scope +during the setup of wake GPEs. A fault could occur if a _PRW directly +under +the +root object was passed to the AcpiSetupGpeForWake interface. Lin Ming. + +Implemented support for "spurious" Global Lock interrupts. On some +systems, a +global lock interrupt can occur without the pending flag being set. Upon +a +GL +interrupt, we now ensure that a thread is actually waiting for the lock +before +signaling GL availability. Rafael Wysocki, Bob Moore. + +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.7K Code, 23.7K Data, 113.4K Total + Debug Version: 163.9K Code, 67.5K Data, 231.4K Total + Current 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 + +2) iASL Compiler/Disassembler and Tools: + +Implemented full support for the "SLIC" ACPI table. Includes support in +the +header files, disassembler, table compiler, and template generator. Bob +Moore, +Lin Ming. + +AcpiXtract: Correctly handle embedded comments and messages from +AcpiDump. +Apparently some or all versions of acpidump will occasionally emit a +comment +like +"Wrong checksum", etc., into the dump file. This was causing problems for +AcpiXtract. ACPICA BZ 905. + +iASL: Fix the Linux makefile by removing an inadvertent double file +inclusion. +ACPICA BZ 913. + +AcpiExec: Update installation of operation region handlers. Install one +handler +for a user-defined address space. This is used by the ASL test suite +(ASLTS). + +---------------------------------------- +11 February 2011. Summary of changes for version 20110211: + +1) ACPI CA Core Subsystem: + +Added a mechanism to defer _REG methods for some early-installed +handlers. +Most user handlers should be installed before call to +AcpiEnableSubsystem. +However, Event handlers and region handlers should be installed after +AcpiInitializeObjects. Override handlers for the "default" regions should +be +installed early, however. This change executes all _REG methods for the +default regions (Memory/IO/PCI/DataTable) simultaneously to prevent any +chicken/egg issues between them. ACPICA BZ 848. + +Implemented an optimization for GPE detection. This optimization will +simply +ignore GPE registers that contain no enabled GPEs -- there is no need to +read the register since this information is available internally. This +becomes more important on machines with a large GPE space. ACPICA +bugzilla +884. Lin Ming. Suggestion from Joe Liu. + +Removed all use of the highly unreliable FADT revision field. The +revision +number in the FADT has been found to be completely unreliable and cannot +be +trusted. Only the actual table length can be used to infer the version. +This +change updates the ACPICA core and the disassembler so that both no +longer +even look at the FADT version and instead depend solely upon the FADT +length. + +Fix an unresolved name issue for the no-debug and no-error-message source +generation cases. The _AcpiModuleName was left undefined in these cases, +but +it is actually needed as a parameter to some interfaces. Define +_AcpiModuleName as a null string in these cases. ACPICA Bugzilla 888. + +Split several large files (makefiles and project files updated) + utglobal.c -> utdecode.c + dbcomds.c -> dbmethod.c dbnames.c + dsopcode.c -> dsargs.c dscontrol.c + dsload.c -> dsload2.c + aslanalyze.c -> aslbtypes.c aslwalks.c + +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.7K Code, 23.7K Data, 113.4K Total + Debug Version: 163.9K Code, 67.5K Data, 231.4K Total + Current Release (VC 9.0): + Non-Debug Version: 89.7K Code, 23.7K Data, 113.4K Total + Debug Version: 163.9K Code, 67.5K Data, 231.4K Total + +2) iASL Compiler/Disassembler and Tools: + +iASL: Implemented the predefined macros __LINE__, __FILE__, and __DATE__. +These are useful C-style macros with the standard definitions. ACPICA +bugzilla 898. + +iASL/DTC: Added support for integer expressions and labels. Support for +full +expressions for all integer fields in all ACPI tables. Support for labels +in +"generic" portions of tables such as UEFI. See the iASL reference manual. + +Debugger: Added a command to display the status of global handlers. The +"handlers" command will display op region, fixed event, and miscellaneous +global handlers. installation status -- and for op regions, whether +default +or user-installed handler will be used. + +iASL: Warn if reserved method incorrectly returns a value. Many +predefined +names are defined such that they do not return a value. If implemented as +a +method, issue a warning if such a name explicitly returns a value. ACPICA +Bugzilla 855. + +iASL: Added detection of GPE method name conflicts. Detects a conflict +where +there are two GPE methods of the form _Lxy and _Exy in the same scope. +(For +example, _L1D and _E1D in the same scope.) ACPICA bugzilla 848. + +iASL/DTC: Fixed a couple input scanner issues with comments and line +numbers. Comment remover could get confused and miss a comment ending. +Fixed +a problem with line counter maintenance. + +iASL/DTC: Reduced the severity of some errors from fatal to error. There +is +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: + +1) ACPI CA Core Subsystem: + +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 +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 +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: + + 1) Delete method children only upon the exit of the last thread, + so as to not delete objects out from under other running threads + (and possibly causing a fault.) + 2) Set the "serialized" bit for the method only upon the exit of the + Last thread, so as to not cause deadlock when running threads + attempt to exit. + 3) Cleanup the use of the AML "MethodFlags" and internal method flags + so that there is no longer any confusion between the two. + + Lin Ming, Bob Moore. Reported by dana.myers@oracle.com. + +Debugger: Now lock the namespace for duration of a namespace dump. +Prevents +issues if the namespace is changing dynamically underneath the debugger. +Especially affects temporary namespace nodes, since the debugger displays +these also. + +Updated the ordering of include files. The ACPICA headers should appear +before any compiler-specific headers (stdio.h, etc.) so that acenv.h can +set +any necessary compiler-specific defines, etc. Affects the ACPI-related +tools +and utilities. + +Updated all ACPICA copyrights and signons to 2011. Added the 2011 +copyright +to all module headers and signons, including the Linux header. This +affects +virtually every file in the ACPICA core subsystem, iASL compiler, and all +utilities. + +Added project files for MS Visual Studio 2008 (VC++ 9.0). The original +project files for VC++ 6.0 are now obsolete. New project files can be +found +under acpica/generate/msvc9. See acpica/generate/msvc9/readme.txt for +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 +much larger code and data size. + + Previous Release (VC 6.0): + Non-Debug Version: 89.8K Code, 18.9K Data, 108.7K Total + Debug Version: 166.6K Code, 52.1K Data, 218.7K Total + Current Release (VC 9.0): + Non-Debug Version: 89.7K Code, 23.7K Data, 113.4K Total + Debug Version: 163.9K Code, 67.5K Data, 231.4K Total + +2) iASL Compiler/Disassembler and Tools: + +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 +(-l) to display actual binary output for each line of input code. + +---------------------------------------- +09 December 2010. Summary of changes for version 20101209: + +1) ACPI CA Core Subsystem: + +Completed the major overhaul of the GPE support code that was begun in +July +2010. Major features include: removal of _PRW execution in ACPICA (host +executes _PRWs anyway), cleanup of "wake" GPE interfaces and processing, +changes to existing interfaces, simplification of GPE handler operation, +and +a handful of new interfaces: + + AcpiUpdateAllGpes + AcpiFinishGpe + AcpiSetupGpeForWake + AcpiSetGpeWakeMask + One new file, evxfgpe.c to consolidate all external GPE interfaces. + +See the ACPICA Programmer Reference for full details and programming +information. See the new section 4.4 "General Purpose Event (GPE) +Support" +for a full overview, and section 8.7 "ACPI General Purpose Event +Management" +for programming details. ACPICA BZ 858,870,877. Matthew Garrett, Lin +Ming, +Bob Moore, Rafael Wysocki. + +Implemented a new GPE feature for Windows compatibility, the "Implicit +Wake +GPE Notify". This feature will automatically issue a Notify(2) on a +device +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 +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 +much larger code and data size. + + Previous Release: + Non-Debug Version: 89.8K Code, 18.9K Data, 108.7K Total + Debug Version: 166.6K Code, 52.1K Data, 218.7K Total + Current Release: + Non-Debug Version: 89.9K Code, 19.0K Data, 108.9K Total + Debug Version: 166.3K Code, 52.1K Data, 218.4K Total + +2) iASL Compiler/Disassembler and Tools: + +iASL: Relax the alphanumeric restriction on _CID strings. These strings +are +"bus-specific" per the ACPI specification, and therefore any characters +are +acceptable. The only checks that can be performed are for a null string +and +perhaps for a leading asterisk. ACPICA BZ 886. + +iASL: Fixed a problem where a syntax error that caused a premature EOF +condition on the source file emitted a very confusing error message. The +premature EOF is now detected correctly. ACPICA BZ 891. + +Disassembler: Decode the AccessSize within a Generic Address Structure +(byte +access, word access, etc.) Note, this field does not allow arbitrary bit +access, the size is encoded as 1=byte, 2=word, 3=dword, and 4=qword. + +New: AcpiNames utility - Example namespace dump utility. Shows an example +of +ACPICA configuration for a minimal namespace dump utility. Uses table and +namespace managers, but no AML interpreter. Does not add any +functionality +over AcpiExec, it is a subset of AcpiExec. The purpose is to show how to +partition and configure ACPICA. ACPICA BZ 883. + +AML Debugger: Increased the debugger buffer size for method return +objects. +Was 4K, increased to 16K. Also enhanced error messages for debugger +method +execution, including the buffer overflow case. + +---------------------------------------- +13 October 2010. Summary of changes for version 20101013: + +1) ACPI CA Core Subsystem: + +Added support to clear the PCIEXP_WAKE event. When clearing ACPI events, +now +clear the PCIEXP_WAKE_STS bit in the ACPI PM1 Status Register, via +HwClearAcpiStatus. Original change from Colin King. ACPICA BZ 880. + +Changed the type of the predefined namespace object _TZ from ThermalZone +to +Device. This was found to be confusing to the host software that +processes +the various thermal zones, since _TZ is not really a ThermalZone. +However, +a +Notify() can still be performed on it. ACPICA BZ 876. Suggestion from Rui +Zhang. + +Added Windows Vista SP2 to the list of supported _OSI strings. The actual +string is "Windows 2006 SP2". + +Eliminated duplicate code in AcpiUtExecute* functions. Now that the +nsrepair +code automatically repairs _HID-related strings, this type of code is no +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 +much larger code and data size. + + Previous Release: + Non-Debug Version: 89.9K Code, 19.0K Data, 108.9K Total + Debug Version: 166.3K Code, 52.1K Data, 218.4K Total + Current Release: + Non-Debug Version: 89.9K Code, 19.0K Data, 108.9K Total + Debug Version: 166.3K Code, 52.1K Data, 218.4K Total + +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 +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 +tag" (name) associated with the descriptor, which gives the ASL a handle +needed to modify the descriptor. ACPICA BZ 873. + +Added single-thread support to the generic Unix application OSL. +Primarily +for iASL support, this change removes the use of semaphores in the +single- +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 +for 64-bit DSDT/FACS addresses in the FADT. Lin Ming. + +iASL: Moved all compiler messages to a new file, aslmessages.h. + +---------------------------------------- +15 September 2010. Summary of changes for version 20100915: + +1) ACPI CA Core Subsystem: + +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. +AcpiHwDerivePciId has been implemented without recursion. Adds one new +module, hwpci.c. ACPICA BZ 857. + +Implemented a dynamic repair for _HID and _CID strings. The following +problems are now repaired at runtime: 1) Remove a leading asterisk in the +string, and 2) the entire string is uppercased. Both repairs are in +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. +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). +Lin Ming, Bob Moore. + +Added the ACPI_INLINE type to enhance the ACPICA configuration. The +"inline" +keyword is not standard across compilers, and this type allows inline to +be +configured on a per-compiler basis. Lin Ming. + +Made the system global AcpiGbl_SystemAwakeAndRunning publically +available. +Added an extern for this boolean in acpixf.h. Some hosts utilize this +value +during suspend/restore operations. ACPICA BZ 869. + +All code that implements error/warning messages with the "ACPI:" prefix +has +been moved to a new module, utxferror.c. + +The UINT64_OVERLAY was moved to utmath.c, which is the only module where +it +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 +much larger code and data size. + + Previous Release: + Non-Debug Version: 89.1K Code, 19.0K Data, 108.1K Total + Debug Version: 165.1K Code, 51.9K Data, 217.0K Total + Current Release: + Non-Debug Version: 89.9K Code, 19.0K Data, 108.9K Total + Debug Version: 166.3K Code, 52.1K Data, 218.4K Total + +2) iASL Compiler/Disassembler and Tools: + +iASL/Disassembler: Write ACPI errors to stderr instead of the output +file. +This keeps the output files free of random error messages that may +originate +from within the namespace/interpreter code. Used this opportunity to +merge +all ACPI:-style messages into a single new module, utxferror.c. ACPICA BZ +866. Lin Ming, Bob Moore. + +Tools: update some printfs for ansi warnings on size_t. Handle width +change +of size_t on 32-bit versus 64-bit generations. Lin Ming. + +---------------------------------------- +06 August 2010. Summary of changes for version 20100806: + +1) ACPI CA Core Subsystem: + +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 +_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: + AcpiInstallInterface - Add an _OSI string. + AcpiRemoveInterface - Delete an _OSI string. + AcpiInstallInterfaceHandler - Install optional _OSI handler. +Obsolete Functions: + AcpiOsValidateInterface - no longer used. +New Files: + source/components/utilities/utosi.c + +Re-introduced the support to enable multi-byte transfers for Embedded +Controller (EC) operation regions. A reported problem was found to be a +bug +in the host OS, not in the multi-byte support. 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 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 Controller driver to enable 16/32/64/256- +bit +transfers in addition to 8-bit transfers. Alexey Starikovskiy, Lin Ming. + +Fixed a problem with the prototype for AcpiOsReadPciConfiguration. The +prototype in acpiosxf.h had the output value pointer as a (void *). +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 +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 +much larger code and data size. + + Previous Release: + Non-Debug Version: 88.3K Code, 18.8K Data, 107.1K Total + Debug Version: 164.0K Code, 51.5K Data, 215.5K Total + Current Release: + Non-Debug Version: 89.1K Code, 19.0K Data, 108.1K Total + Debug Version: 165.1K Code, 51.9K Data, 217.0K Total + +2) iASL Compiler/Disassembler and Tools: + +iASL/Disassembler: Added a new option (-da, "disassemble all") to load +the +namespace from and disassemble an entire group of AML files. Useful for +loading all of the AML tables for a given machine (DSDT, SSDT1...SSDTn) +and +disassembling with one simple command. ACPICA BZ 865. Lin Ming. + +iASL: Allow multiple invocations of -e option. This change allows +multiple +uses of -e on the command line: "-e ssdt1.dat -e ssdt2.dat". ACPICA BZ +834. +Lin Ming. + +---------------------------------------- +02 July 2010. Summary of changes for version 20100702: + +1) ACPI CA Core Subsystem: + +Implemented several updates to the recently added GPE reference count +support. The model for "wake" GPEs is changing to give the host OS +complete +control of these GPEs. Eventually, the ACPICA core will not execute any +_PRW +methods, since the host already must execute them. Also, additional +changes +were made to help ensure that the reference counts are kept in proper +synchronization with reality. Rafael J. Wysocki. + +1) Ensure that GPEs are not enabled twice during initialization. +2) Ensure that GPE enable masks stay in sync with the reference count. +3) Do not inadvertently enable GPEs when writing GPE registers. +4) Remove the internal wake reference counter and add new AcpiGpeWakeup +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 +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 +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 +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 +much larger code and data size. + + Previous Release: + Non-Debug Version: 88.3K Code, 18.8K Data, 107.1K Total + Debug Version: 164.1K Code, 51.5K Data, 215.6K Total + Current Release: + Non-Debug Version: 88.3K Code, 18.8K Data, 107.1K Total + Debug Version: 164.0K Code, 51.5K Data, 215.5K Total + +2) iASL Compiler/Disassembler and Tools: + +iASL: Implemented a new compiler subsystem to allow definition and +compilation of the non-AML ACPI tables such as FADT, MADT, SRAT, etc. +These +are called "ACPI Data Tables", and the new compiler is the "Data Table +Compiler". This compiler is intended to simplify the existing error-prone +process of creating these tables for the BIOS, as well as allowing the +disassembly, modification, recompilation, and override of existing ACPI +data +tables. See the iASL User Guide for detailed information. + +iASL: Implemented a new Template Generator option in support of the new +Data +Table Compiler. This option will create examples of all known ACPI tables +that can be used as the basis for table development. See the iASL +documentation and the -T option. + +Disassembler and headers: Added support for the WDDT ACPI table (Watchdog +Descriptor Table). + +Updated the Linux makefiles for iASL and AcpiExec to place the generated +object files in the local directory so that there can be no collisions +between the shared files between them that are generated with different +options. + +Added support for Mac OS X in the Unix OSL used for iASL and AcpiExec. +Use +the #define __APPLE__ to enable this support. + +---------------------------------------- +28 May 2010. Summary of changes for version 20100528: Note: The ACPI 4.0a specification was released on April 5, 2010 and is available at www.acpi.info. This is primarily an errata release. 1) ACPI CA Core Subsystem: -Undefined ACPI tables: We are looking for the definitions for the following +Undefined ACPI tables: We are looking for the definitions for the +following 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 -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 -Controller driver to enable 16/32/64/256-bit transfers in addition to 8-bit +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 +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 +Controller driver to enable 16/32/64/256-bit transfers in addition to 8- +bit transfers. Alexey Starikovskiy, Lin Ming -Implemented a performance enhancement for namespace search and access. This -change enhances the performance of namespace searches and walks by adding a -backpointer to the parent in each namespace node. On large namespaces, this -change can improve overall ACPI performance by up to 9X. Adding a pointer to -each namespace node increases the overall size of the internal namespace by +Implemented a performance enhancement for namespace search and access. +This +change enhances the performance of namespace searches and walks by adding +a +backpointer to the parent in each namespace node. On large namespaces, +this +change can improve overall ACPI performance by up to 9X. Adding a pointer +to +each namespace node increases the overall size of the internal namespace +by about 5%, since each namespace entry usually consists of both a namespace 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 -entire namespace was traversed on each control method exit. This change can -improve overall ACPI performance by up to 3X. Alexey Starikovskiy, Bob Moore. +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 +entire namespace was traversed on each control method exit. This change +can +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 +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 Garrett, Bob Moore. @@ -47,22 +3492,28 @@ actually sleep. Configurable, the default maximum is two seconds. ACPICA bugzilla 854. -Added run-time validation support for the _WDG and_WED Microsoft predefined -methods. These objects are defined by "Windows Instrumentation", and are not +Added run-time validation support for the _WDG and_WED Microsoft +predefined +methods. These objects are defined by "Windows Instrumentation", and are +not 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. +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: @@ -75,7 +3526,8 @@ 2) iASL Compiler/Disassembler and Tools: iASL: Added compiler support for the _WDG and_WED Microsoft predefined -methods. These objects are defined by "Windows Instrumentation", and are not +methods. These objects are defined by "Windows Instrumentation", and are +not part of the ACPI spec. ACPICA BZ 860. AcpiExec: added option to disable the memory tracking mechanism. The -dt @@ -91,29 +3543,38 @@ 1) ACPI CA Core Subsystem: Implemented GPE support for dynamically loaded ACPI tables. For all GPEs, -including FADT-based and GPE Block Devices, execute any _PRW methods in the +including FADT-based and GPE Block Devices, execute any _PRW methods in +the 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 -AcpiReallocateRootTable. Also, renamed some of fields in the table manager +Fixed a regression introduced in version 20100331 within the table +manager +where initial table loading could fail. This was introduced in the fix +for +AcpiReallocateRootTable. Also, renamed some of fields in the table +manager data structures to clarify their meaning and use. Fixed a possible allocation overrun during internal object copy in -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. +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: @@ -126,25 +3587,35 @@ 2) iASL Compiler/Disassembler and Tools: iASL: Implemented Min/Max/Len/Gran validation for address resource -descriptors. This change implements validation for the address fields that +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 +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 and aslrestype2.c files into five new files. ACPICA BZ 840. -iASL: Added support for the _Wxx predefined names. This support was missing +iASL: Added support for the _Wxx predefined names. This support was +missing and these names were not recognized by the compiler as valid predefined names. ACPICA BZ 851. -iASL: Added an error for all predefined names that are defined to return no -value and thus must be implemented as Control Methods. These include all of +iASL: Added an error for all predefined names that are defined to return +no +value and thus must be implemented as Control Methods. These include all +of the _Lxx, _Exx, _Wxx, and _Qxx names, as well as some other miscellaneous names such as _DIS, _INI, _IRC, _OFF, _ON, and _PSx. ACPICA BZ 850, 856. -iASL: Implemented the -ts option to emit hex AML data in ASL format, as an -ASL Buffer. Allows ACPI tables to be easily included within ASL files, to be -dynamically loaded via the Load() operator. Also cleaned up output for the - +iASL: Implemented the -ts option to emit hex AML data in ASL format, as +an +ASL Buffer. Allows ACPI tables to be easily included within ASL files, to +be +dynamically loaded via the Load() operator. Also cleaned up output for +the +- ta and -tc options. ACPICA BZ 853. Tests: Added a new file with examples of extended iASL error checking. @@ -156,14 +3627,19 @@ 1) ACPI CA Core Subsystem: -Completed a major update for the GPE support in order to improve support for -shared GPEs and to simplify both host OS and ACPICA code. Added a reference -count mechanism to support shared GPEs that require multiple device drivers. +Completed a major update for the GPE support in order to improve support +for +shared GPEs and to simplify both host OS and ACPICA code. Added a +reference +count mechanism to support shared GPEs that require multiple device +drivers. Several external interfaces have changed. One external interface has been removed. One new external interface was added. Most of the GPE external interfaces now use the GPE spinlock instead of the events mutex (and the -Flags parameter for many GPE interfaces has been removed.) See the updated -ACPICA Programmer Reference for details. Matthew Garrett, Bob Moore, Rafael +Flags parameter for many GPE interfaces has been removed.) See the +updated +ACPICA Programmer Reference for details. Matthew Garrett, Bob Moore, +Rafael Wysocki. ACPICA BZ 831. Changed: @@ -173,32 +3649,44 @@ 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, +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, however. Implemented a new subsystem option to force a copy of the DSDT to local -memory. Optionally copy the entire DSDT to local memory (instead of simply -mapping it.) There are some (albeit very rare) BIOSs that corrupt or replace -the original DSDT, creating the need for this option. Default is FALSE, do +memory. Optionally copy the entire DSDT to local memory (instead of +simply +mapping it.) There are some (albeit very rare) BIOSs that corrupt or +replace +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 -the OS (by firmware). This is typically catastrophic for the system, but has +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. -Fixed two problems with AcpiReallocateRootTable during the root table copy. +Fixed two problems with AcpiReallocateRootTable during the root table +copy. When copying the root table to the new allocation, the length used was -incorrect. The new size was used instead of the current table size, meaning -too much data was copied. Also, the count of available slots for ACPI tables +incorrect. The new size was used instead of the current table size, +meaning +too much data was copied. Also, the count of available slots for ACPI +tables 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: @@ -214,16 +3702,20 @@ 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. -iASL: Added Windows 7 support for the -g option (get local ACPI tables) by +iASL: Added Windows 7 support for the -g option (get local ACPI tables) +by reducing the requested registry access rights. ACPICA BZ 842. -Disassembler: fixed a possible fault when generating External() statements. -Introduced in commit ae7d6fd: Properly handle externals with parent-prefix +Disassembler: fixed a possible fault when generating External() +statements. +Introduced in commit ae7d6fd: Properly handle externals with parent- +prefix (carat). Fixes a string length allocation calculation. Lin Ming. ---------------------------------------- @@ -233,32 +3725,42 @@ 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. -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 +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 -0x prefix for hex output, always use %u for unsigned integer decimal output. -Affects ACPI_INFO, ACPI_ERROR, ACPI_EXCEPTION, and ACPI_WARNING (about 400 +Standardized output of integer values for ACPICA warnings/errors. Always +use +0x prefix for hex output, always use %u for unsigned integer decimal +output. +Affects ACPI_INFO, ACPI_ERROR, ACPI_EXCEPTION, and ACPI_WARNING (about +400 invocations.) These invocations were converted from the original 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: @@ -273,7 +3775,8 @@ 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. @@ -288,34 +3791,50 @@ 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 -code was migrated from ACPI 1.0 (with 32-bit AML integers) to ACPI 2.0 (with -64-bit AML integers). It is now obsolete and this change removes it from the -ACPICA code base, replaced by UINT64. The original typedef has been retained -for now for compatibility with existing device driver code. ACPICA BZ 824. +Removed the obsolete ACPI_INTEGER data type. This type was introduced as +the +code was migrated from ACPI 1.0 (with 32-bit AML integers) to ACPI 2.0 +(with +64-bit AML integers). It is now obsolete and this change removes it from +the +ACPICA code base, replaced by UINT64. The original typedef has been +retained +for now for compatibility with existing device driver code. ACPICA BZ +824. -Removed the unused UINT32_STRUCT type, and the obsolete Integer64 field in +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 -accordingly. This includes some code restructuring to eliminate unreachable -code, elimination of some gotos, elimination of unused return values, some +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: @@ -334,47 +3853,72 @@ 1) ACPI CA Core Subsystem: -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 +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 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 +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 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. - -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 -Device object, etc.). Now executes the code within the current scope instead +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. + +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 +Device object, etc.). Now executes the code within the current scope +instead of the root. ACPICA BZ 762. Lin Ming. -Fixed possible mutex acquisition errors when running _REG methods. Fixes a -problem where mutex errors can occur when running a _REG method that is in -the same scope as a method-defined operation region or an operation region -under a module-level IF block. This type of code is rare, so the problem has +Fixed possible mutex acquisition errors when running _REG methods. Fixes +a +problem where mutex errors can occur when running a _REG method that is +in +the same scope as a method-defined operation region or an operation +region +under a module-level IF block. This type of code is rare, so the problem +has not been seen before. ACPICA BZ 826. Lin Ming, Bob Moore. -Fixed a possible memory leak during module-level code execution. An object +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 -was considered too wordy. Now, messages are only unconditionally emitted if +Removed messages for successful predefined repair(s). The repair +mechanism +was considered too wordy. Now, messages are only unconditionally emitted +if the return object cannot be repaired. Existing messages for successful -repairs were converted to ACPI_DEBUG_PRINT messages for now. ACPICA BZ 827. +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: @@ -386,12 +3930,14 @@ 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. This option specifies the value used to initialize buffers that simulate -operation regions. Default value is zero. Useful for debugging problems that +operation regions. Default value is zero. Useful for debugging problems +that depend on a specific initial value for a region or field. ---------------------------------------- @@ -401,43 +3947,58 @@ Implemented a post-order callback to AcpiWalkNamespace. The existing interface only has a pre-order callback. This change adds an additional -parameter for a post-order callback which will be more useful for bus scans. +parameter for a post-order callback which will be more useful for bus +scans. ACPICA BZ 779. Lin Ming. Updated the ACPICA Programmer Reference. Modified the behavior of the operation region memory mapping cache for -SystemMemory. Ensure that the memory mappings created for operation regions +SystemMemory. Ensure that the memory mappings created for operation +regions do not cross 4K page boundaries. Crossing a page boundary while mapping -regions can cause kernel warnings on some hosts if the pages have different -attributes. Such regions are probably BIOS bugs, and this is the workaround. +regions can cause kernel warnings on some hosts if the pages have +different +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 +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 +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 +Implemented a new internal function to create Integer objects. This +function 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. +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. 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: @@ -449,20 +4010,26 @@ 2) iASL Compiler/Disassembler and Tools: -iASL: Implemented Switch() with While(1) so that Break works correctly. This -change correctly implements the Switch operator with a surrounding While(1) +iASL: Implemented Switch() with While(1) so that Break works correctly. +This +change correctly implements the Switch operator with a surrounding +While(1) so that the Break operator works as expected. ACPICA BZ 461. Lin Ming. -iASL: Added a message if a package initializer list is shorter than package -length. Adds a new remark for a Package() declaration if an initializer list +iASL: Added a message if a package initializer list is shorter than +package +length. Adds a new remark for a Package() declaration if an initializer +list 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. ---------------------------------------- @@ -470,9 +4037,12 @@ 1) ACPI CA Core Subsystem: -Fixed a problem where an Operation Region _REG method could be executed more -than once. If a custom address space handler is installed by the host before -the "initialize operation regions" phase of the ACPICA initialization, any +Fixed a problem where an Operation Region _REG method could be executed +more +than once. If a custom address space handler is installed by the host +before +the "initialize operation regions" phase of the ACPICA initialization, +any _REG methods for that address space could be executed twice. This change fixes the problem. ACPICA BZ 427. Lin Ming. @@ -482,20 +4052,24 @@ 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. -Implemented a run-time repair for the _BIF and _BIX predefined methods. The +Implemented a run-time repair for the _BIF and _BIX predefined methods. +The "OEM Information" field is often incorrectly returned as an Integer with -value zero if the field is not supported by the platform. This is due to an +value zero if the field is not supported by the platform. This is due to +an ambiguity in the ACPI specification. The field should always be a string. ACPICA now automatically repairs this problem by returning a NULL string 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: @@ -508,7 +4082,8 @@ 2) iASL Compiler/Disassembler and Tools: Disassembler: Fixed a problem where references to external symbols that -contained one or more parent-prefixes (carats) were not handled correctly, +contained one or more parent-prefixes (carats) were not handled +correctly, possibly causing a fault. ACPICA BZ 806. Lin Ming. Disassembler: Restructured the code so that all functions that handle @@ -531,26 +4106,36 @@ For Windows Vista compatibility, added the automatic execution of an _INI method located at the namespace root (\_INI). This method is executed at -table load time. This support is in addition to the automatic execution of +table load time. This support is in addition to the automatic execution +of \_SB._INI. Lin Ming. -Fixed a possible memory leak in the interpreter for AML package objects if -the package initializer list is longer than the defined size of the package. -This apparently can only happen if the BIOS changes the package size on the +Fixed a possible memory leak in the interpreter for AML package objects +if +the package initializer list is longer than the defined size of the +package. +This apparently can only happen if the BIOS changes the package size on +the fly (seen in a _PSS object), as ASL compilers do not allow this. The -interpreter will truncate the package to the defined size (and issue an error -message), but previously could leave the extra objects undeleted if they were -pre-created during the argument processing (such is the case if the package +interpreter will truncate the package to the defined size (and issue an +error +message), but previously could leave the extra objects undeleted if they +were +pre-created during the argument processing (such is the case if the +package consists of a number of sub-packages as in the _PSS.) ACPICA BZ 805. Fixed a problem seen when a Buffer or String is stored to itself via ASL. -This has been reported in the field. Previously, ACPICA would zero out the +This has been reported in the field. Previously, ACPICA would zero out +the buffer/string. Now, the operation is treated as a noop. Provides Windows compatibility. ACPICA BZ 803. Lin Ming. Removed an extraneous error message for ASL constructs of the form -Store(LocalX,LocalX) when LocalX is uninitialized. These curious statements -are seen in many BIOSs and are once again treated as NOOPs and no error is +Store(LocalX,LocalX) when LocalX is uninitialized. These curious +statements +are seen in many BIOSs and are once again treated as NOOPs and no error +is emitted when they are encountered. ACPICA BZ 785. Fixed an extraneous warning message if a _DSM reserved method returns a @@ -559,7 +4144,8 @@ 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: @@ -575,9 +4161,11 @@ Templates. The correct alias is now constructed and no error is emitted. ACPICA BZ 738. -iASL: Implemented the -I option to specify additional search directories for +iASL: Implemented the -I option to specify additional search directories +for include files. Allows multiple additional search paths for include files. -Directories are searched in the order specified on the command line (after +Directories are searched in the order specified on the command line +(after the local directory is searched.) ACPICA BZ 800. iASL: Fixed a problem where the full pathname for include files was not @@ -587,12 +4175,15 @@ iASL: Implemented the -@ option to specify a Windows-style response file containing additional command line options. ACPICA BZ 801. -AcpiExec: Added support to load multiple AML files simultaneously (such as a +AcpiExec: Added support to load multiple AML files simultaneously (such +as +a DSDT and multiple SSDTs). Also added support for wildcards within the AML pathname. These features allow all machine tables to be easily loaded and debugged together. ACPICA BZ 804. -Disassembler: Added missing support for disassembly of HEST table Error Bank +Disassembler: Added missing support for disassembly of HEST table Error +Bank subtables. ---------------------------------------- @@ -603,54 +4194,75 @@ 1) ACPI CA Core Subsystem: ACPI 4.0: Added header file support for all new and changed ACPI tables. -Completely new tables are: IBFT, IVRS, MSCT, and WAET. Tables that are new -for ACPI 4.0, but have previously been supported in ACPICA are: CPEP, BERT, -EINJ, ERST, and HEST. Other newly supported tables are: UEFI and WDAT. There +Completely new tables are: IBFT, IVRS, MSCT, and WAET. Tables that are +new +for ACPI 4.0, but have previously been supported in ACPICA are: CPEP, +BERT, +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 -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 +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 typical cases seen in the field. ACPICA BZ 762. Lin Ming. Implemented an automatic dynamic repair for predefined names that return -nested Package objects. This applies to predefined names that are defined to +nested Package objects. This applies to predefined names that are defined +to return a variable-length Package of sub-packages. If the number of sub- -packages is one, BIOS code is occasionally seen that creates a simple single +packages is one, BIOS code is occasionally seen that creates a simple +single package with no sub-packages. This code attempts to fix the problem by -wrapping a new package object around the existing package. These methods can -be repaired: _ALR, _CSD, _HPX, _MLS, _PRT, _PSS, _TRT, and _TSS. ACPICA BZ +wrapping a new package object around the existing package. These methods +can +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 +Fixed a regression introduced in 20090625 for the AcpiGetDevices +interface. +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 -register was one of the protected I/O ports. AcpiReset now bypasses the port -validation mechanism. This may eventually be driven into the AcpiRead/Write +register was one of the protected I/O ports. AcpiReset now bypasses the +port +validation mechanism. This may eventually be driven into the +AcpiRead/Write interfaces. Fixed a regression related to the recent update of the AcpiRead/Write -interfaces. A sleep/suspend could fail if the optional PM2 Control register +interfaces. A sleep/suspend could fail if the optional PM2 Control +register 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 +(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: @@ -675,55 +4287,74 @@ 1) ACPI CA Core Subsystem: ACPI 4.0: Implemented interpreter support for the IPMI operation region -address space. Includes support for bi-directional data buffers and an IPMI -address space handler (to be installed by an IPMI device driver.) ACPICA BZ +address space. Includes support for bi-directional data buffers and an +IPMI +address space handler (to be installed by an IPMI device driver.) ACPICA +BZ 773. Lin Ming. -ACPI 4.0: Added changes for existing ACPI tables - FACS and SRAT. Includes +ACPI 4.0: Added changes for existing ACPI tables - FACS and SRAT. +Includes support in both the header files and the disassembler. Completed a major update for the AcpiGetObjectInfo external interface. Changes include: - Support for variable, unlimited length HID, UID, and CID strings. - - Support Processor objects the same as Devices (HID,UID,CID,ADR,STA, etc.) + - Support Processor objects the same as Devices (HID,UID,CID,ADR,STA, +etc.) - Call the _SxW power methods on behalf of a device object. - Determine if a device is a PCI root bridge. - Change the ACPI_BUFFER parameter to ACPI_DEVICE_INFO. -These changes will require an update to all callers of this interface. See -the updated ACPICA Programmer Reference for details. One new source file has +These changes will require an update to all callers of this interface. +See +the updated ACPICA Programmer Reference for details. One new source file +has 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 +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 all callers of these interfaces. See the ACPICA Programmer Reference for details. ACPICA BZ 768. -Fixed several problems with AcpiAttachData. The handler was not invoked when -the host node was deleted. The data sub-object was not automatically deleted -when the host node was deleted. The interface to the handler had an unused +Fixed several problems with AcpiAttachData. The handler was not invoked +when +the host node was deleted. The data sub-object was not automatically +deleted +when the host node was deleted. The interface to the handler had an +unused parameter, this was removed. ACPICA BZ 778. Enhanced the function that dumps ACPI table headers. All non-printable -characters in the string fields are now replaced with '?' (Signature, OemId, +characters in the string fields are now replaced with '?' (Signature, +OemId, OemTableId, and CompilerId.) ACPI tables with non-printable characters in these fields are occasionally seen in the field. ACPICA BZ 788. Fixed a problem with predefined method repair code where the code that -attempts to repair/convert an object of incorrect type is only executed on -the first time the predefined method is called. The mechanism that disables +attempts to repair/convert an object of incorrect type is only executed +on +the first time the predefined method is called. The mechanism that +disables warnings on subsequent calls was interfering with the repair mechanism. ACPICA BZ 781. -Fixed a possible memory leak in the predefined validation/repair code when a +Fixed a possible memory leak in the predefined validation/repair code +when +a buffer is automatically converted to an expected string object. -Removed obsolete 16-bit files from the distribution and from the current git +Removed obsolete 16-bit files from the distribution and from the current +git 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: @@ -746,8 +4377,11 @@ 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 +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 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 @@ -758,45 +4392,61 @@ 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 -an existing method or to install a missing method without having to override +Implemented a new interface to install or override a single control +method, +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. Fixed several reference count issues with the DdbHandle object that is -created from a Load or LoadTable operator. Prevent premature deletion of the -object. Also, mark the object as invalid once the table has been unloaded. -This is needed because the handle itself may not be deleted after the table +created from a Load or LoadTable operator. Prevent premature deletion of +the +object. Also, mark the object as invalid once the table has been +unloaded. +This is needed because the handle itself may not be deleted after the +table unload, depending on whether it has been stored in a named object by the 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 +mutexes of the same sync level are acquired but then not released in +strict +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 -specification has been changed to make the SyncLevel for mutex objects more -useful. When releasing a mutex, the SyncLevel of the mutex must now be the -same as the current sync level. This makes more sense than the previous rule +specification has been changed to make the SyncLevel for mutex objects +more +useful. When releasing a mutex, the SyncLevel of the mutex must now be +the +same as the current sync level. This makes more sense than the previous +rule (SyncLevel less than or equal). This change updates the code to match the specification. -Fixed a problem with the local version of the AcpiOsPurgeCache function. The +Fixed a problem with the local version of the AcpiOsPurgeCache function. +The (local) cache must be locked during all cache object deletions. Andrew Baumann. -Updated the Load operator to use operation region interfaces. This replaces -direct memory mapping with region access calls. Now, all region accesses go +Updated the Load operator to use operation region interfaces. This +replaces +direct memory mapping with region access calls. Now, all region accesses +go through the installed region handler as they should. -Simplified and optimized the NsGetNextNode function. Reduced parameter count +Simplified and optimized the NsGetNextNode function. Reduced parameter +count 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: @@ -808,8 +4458,10 @@ 2) iASL Compiler/Disassembler and Tools: -Disassembler: Fixed some issues with DMAR, HEST, MADT tables. Some problems -with sub-table disassembly and handling invalid sub-tables. Attempt recovery +Disassembler: Fixed some issues with DMAR, HEST, MADT tables. Some +problems +with sub-table disassembly and handling invalid sub-tables. Attempt +recovery after an invalid sub-table ID. ---------------------------------------- @@ -817,14 +4469,18 @@ 1) ACPI CA Core Subsystem: -Fixed a compatibility issue with the recently released I/O port protection +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 +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. @@ -834,15 +4490,19 @@ statements for the 64-bit build when the type is configured as a pointer. 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, +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: @@ -854,28 +4514,38 @@ 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 compilation summary, not individual errors and warnings. Useful for large batch compilations. -AcpiExec: Implemented a new option (-z) to enable a forced semaphore/mutex -timeout that can be used to detect hang conditions during execution of AML -code (includes both internal semaphores and AML-defined mutexes and events.) +AcpiExec: Implemented a new option (-z) to enable a forced +semaphore/mutex +timeout that can be used to detect hang conditions during execution of +AML +code (includes both internal semaphores and AML-defined mutexes and +events.) Added new makefiles for the generation of acpica in a generic unix-like -environment. These makefiles are intended to generate the acpica tools and +environment. These makefiles are intended to generate the acpica tools +and utilities from the original acpica git source tree structure. Test Suites: Updated and cleaned up the documentation files. Updated the -copyrights to 2009, affecting all source files. Use the new version of iASL -with quiet mode. Increased the number of available semaphores in the Windows -OSL, allowing the aslts to execute fully on Windows. For the Unix OSL, added +copyrights to 2009, affecting all source files. Use the new version of +iASL +with quiet mode. Increased the number of available semaphores in the +Windows +OSL, allowing the aslts to execute fully on Windows. For the Unix OSL, +added an alternate implementation of the semaphore timeout to allow aslts to execute fully on Cygwin. @@ -884,25 +4554,37 @@ 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 -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 +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 +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 implements the reader/writer lock mechanism. ACPICA BZ 749. -Fixed a regression introduced in version 20090220 where a change to the FADT -handling could cause the ACPICA subsystem to access non-existent I/O ports. +Fixed a regression introduced in version 20090220 where a change to the +FADT +handling could cause the ACPICA subsystem to access non-existent I/O +ports. -Modified the handling of FADT register and table (FACS/DSDT) addresses. The +Modified the handling of FADT register and table (FACS/DSDT) addresses. +The FADT can contain both 32-bit and 64-bit versions of these addresses. -Previously, the 64-bit versions were favored, meaning that if both 32 and 64 +Previously, the 64-bit versions were favored, meaning that if both 32 and +64 versions were valid, but not equal, the 64-bit version was used. This was -found to cause some machines to fail. Now, in this case, the 32-bit version +found to cause some machines to fail. Now, in this case, the 32-bit +version is used instead. This now matches the Windows behavior. -Implemented a new mechanism to protect certain I/O ports. Provides Microsoft +Implemented a new mechanism to protect certain I/O ports. Provides +Microsoft compatibility and protects the standard PC I/O ports from access via AML code. Adds a new file, hwvalid.c @@ -910,30 +4592,40 @@ message warns of a 32/64 length mismatch between the legacy and GAS definitions for a register. -Removed the obsolete AcpiOsValidateAddress OSL interface. This interface is -made obsolete by the port protection mechanism above. It was previously used -to validate the entire address range of an operation region, which could be +Removed the obsolete AcpiOsValidateAddress OSL interface. This interface +is +made obsolete by the port protection mechanism above. It was previously +used +to validate the entire address range of an operation region, which could +be incorrect if the range included illegal ports, but fields within the operation region did not actually access those ports. Validation is now 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 -the event (do not clear.) This behavior is clarified in the ACPI 4.0 spec, +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 +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. -Modified the handling of ignored bits for the PM1 A/B Control Registers. As +Modified the handling of ignored bits for the PM1 A/B Control Registers. +As per the ACPI specification, for the control registers, preserve -(read/modify/write) all bits that are defined as either reserved or ignored. +(read/modify/write) all bits that are defined as either reserved or +ignored. Updated the handling of write-only bits in the PM1 A/B Control Registers. When reading the register, zero the write-only bits as per the ACPI spec. ACPICA BZ 443. Lin Ming. Removed "Linux" from the list of supported _OSI strings. Linux no longer -wants to reply true to this request. The Windows strings are the only paths +wants to reply true to this request. The Windows strings are the only +paths through the AML that are tested and known to work properly. Previous Release: @@ -945,7 +4637,8 @@ 2) iASL Compiler/Disassembler and Tools: -Acpiexec: Split the large aeexec.c file into two new files, aehandlers.c and +Acpiexec: Split the large aeexec.c file into two new files, aehandlers.c +and aetables.c ---------------------------------------- @@ -953,51 +4646,77 @@ 1) ACPI CA Core Subsystem: -Optimized the ACPI register locking. Removed locking for reads from the ACPI -bit registers in PM1 Status, Enable, Control, and PM2 Control. The lock is +Optimized the ACPI register locking. Removed locking for reads from the +ACPI +bit registers in PM1 Status, Enable, Control, and PM2 Control. The lock +is not required when reading the single-bit registers. The -AcpiGetRegisterUnlocked function is no longer needed and has been removed. -This will improve performance for reads on these registers. ACPICA BZ 760. +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 -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 +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. Renamed the external ACPI bit register access functions. Renamed AcpiGetRegister and AcpiSetRegister to clarify the purpose of these -functions. The new names are AcpiReadBitRegister and AcpiWriteBitRegister. -Also, restructured the code for these functions by simplifying the code path +functions. The new names are AcpiReadBitRegister and +AcpiWriteBitRegister. +Also, restructured the code for these functions by simplifying the code +path 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 +registers. AcpiHwReadMultiple and AcpiHwWriteMultiple. These two +functions +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 -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. - -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 +Added a function to handle the PM1 control registers, +AcpiHwWritePm1Control. +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. + +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 +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 -obsolete macro, since it is now a simple reference to ->common.type. There +obsolete macro, since it is now a simple reference to ->common.type. +There were about 150 invocations of the macro across 41 files. ACPICA BZ 755. Removed the redundant ACPI_BITREG_SLEEP_TYPE_B. This type is the same as @@ -1008,13 +4727,16 @@ 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 -control method via the ACPI_LV_INFO debug level. Also, reduced some of the +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: @@ -1038,21 +4760,28 @@ 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 -host. With this change, the AcpiOsTableOverride interface is called for each -table found in the RSDT/XSDT during ACPICA initialization, and also whenever +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 +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. Updated FADT flag definitions, especially the Boot Architecture flags. -Debugger: For the Find command, automatically pad the input ACPI name with -underscores if the name is shorter than 4 characters. This enables a match +Debugger: For the Find command, automatically pad the input ACPI name +with +underscores if the name is shorter than 4 characters. This enables a +match 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: @@ -1066,11 +4795,13 @@ Fix build error under Bison-2.4. -Dissasembler: Enhanced FADT support. Added decoding of the Boot Architecture +Dissasembler: Enhanced FADT support. Added decoding of the Boot +Architecture flags. Now decode all flags, regardless of the FADT version. Flag output includes the FADT version which first defined each flag. -The iASL -g option now dumps the RSDT to a file (in addition to the FADT and +The iASL -g option now dumps the RSDT to a file (in addition to the FADT +and DSDT). Windows only. ---------------------------------------- @@ -1078,7 +4809,8 @@ 1) ACPI CA Core Subsystem: -The ACPICA Programmer Reference has been completely updated and revamped for +The ACPICA Programmer Reference has been completely updated and revamped +for this release. This includes updates to the external interfaces, OSL interfaces, the overview sections, and the debugger reference. @@ -1092,31 +4824,38 @@ AcpiRead - Low-level read ACPI register (was HwLowLevelRead.) AcpiWrite - Low-level write ACPI register (was HwLowLevelWrite.) -Most of the public ACPI hardware-related interfaces have been moved to a new +Most of the public ACPI hardware-related interfaces have been moved to a +new 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- -time option was added to fall back to the default hardcoded lengths if the +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 +option is set to true for now, and a warning is issued if a suspicious +FADT register length is overridden with the default value. -Fixed a reference count issue in NsRepairObject. This problem was introduced +Fixed a reference count issue in NsRepairObject. This problem was +introduced in version 20081031 as part of a fix to repair Buffer objects within 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: @@ -1128,88 +4867,124 @@ 2) iASL Compiler/Disassembler and Tools: -iASL: Completed the '-e' option to include additional ACPI tables in order to -aid with disassembly and External statement generation. ACPICA BZ 742. Lin +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. iASL: Removed the "named object in while loop" error. The compiler cannot determine how many times a loop will execute. ACPICA BZ 730. -Disassembler: Implemented support for FADT revision 2 (MS extension). ACPICA +Disassembler: Implemented support for FADT revision 2 (MS extension). +ACPICA BZ 743. -Disassembler: Updates for several ACPI data tables (HEST, EINJ, and MCFG). +Disassembler: Updates for several ACPI data tables (HEST, EINJ, and +MCFG). ---------------------------------------- 31 October 2008. Summary of changes for version 20081031: 1) ACPI CA Core Subsystem: -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 +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 plans include moving all private headers to a new subdirectory. Implemented an automatic Buffer->String return value conversion for -predefined ACPI methods. For these methods (such as _BIF), added automatic -conversion for return objects that are required to be a String, but a Buffer -was found instead. This can happen when reading string battery data from an -operation region, because it used to be difficult to convert the data from -buffer to string from within the ASL. Ensures that the host OS is provided +predefined ACPI methods. For these methods (such as _BIF), added +automatic +conversion for return objects that are required to be a String, but a +Buffer +was found instead. This can happen when reading string battery data from +an +operation region, because it used to be difficult to convert the data +from +buffer to string from within the ASL. Ensures that the host OS is +provided 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 -deciding which vector to use. Also, eliminated the GetFirmwareWakingVector -interface, as it served no purpose (only the firmware reads the vector, OS +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 +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. -Implemented a mechanism to escape infinite AML While() loops. Added a loop -counter to force exit from AML While loops if the count becomes too large. +Implemented a mechanism to escape infinite AML While() loops. Added a +loop +counter to force exit from AML While loops if the count becomes too +large. This can occur in poorly written AML when the hardware does not respond -within a while loop and the loop does not implement a timeout. The maximum -loop count is configurable. A new exception code is returned when a loop is +within a while loop and the loop does not implement a timeout. The +maximum +loop count is configurable. A new exception code is returned when a loop +is broken, AE_AML_INFINITE_LOOP. Alexey Starikovskiy, Bob Moore. Optimized the execution of AML While loops. Previously, a control state object was allocated and freed for each execution of the loop. The -optimization is to simply reuse the control state for each iteration. This +optimization is to simply reuse the control state for each iteration. +This speeds up the raw loop execution time by about 5%. -Enhanced the implicit return mechanism. For Windows compatibility, return an -implicit integer of value zero for methods that contain no executable code. +Enhanced the implicit return mechanism. For Windows compatibility, return +an +implicit integer of value zero for methods that contain no executable +code. Such methods are seen in the field as stubs (presumably), and can cause drivers to fail if they expect a return value. Lin Ming. Allow multiple backslashes as root prefixes in namepaths. In a fully -qualified namepath, allow multiple backslash prefixes. This can happen (and +qualified namepath, allow multiple backslash prefixes. This can happen +(and is seen in the field) because of the use of a double-backslash in strings -(since backslash is the escape character) causing confusion. ACPICA BZ 739 +(since backslash is the escape character) causing confusion. ACPICA BZ +739 Lin Ming. Emit a warning if two different FACS or DSDT tables are discovered in the -FADT. Checks if there are two valid but different addresses for the FACS and +FADT. Checks if there are two valid but different addresses for the FACS +and DSDT within the FADT (mismatch between the 32-bit and 64-bit fields.) -Consolidated the method argument count validation code. Merged the code that +Consolidated the method argument count validation code. Merged the code +that validates control method argument counts into the predefined validation -module. Eliminates possible multiple warnings for incorrect argument counts. +module. Eliminates possible multiple warnings for incorrect argument +counts. Implemented ACPICA example code. Includes code for ACPICA initialization, 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. +Added a global pointer for FACS table to simplify internal FACS access. +Use +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: @@ -1221,14 +4996,20 @@ 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 +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 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 -include the table where the external method(s) are actually declared. Most +properly without the actual declaration of the method. Use the -e option +to +include the table where the external method(s) are actually declared. +Most useful for disassembling SSDTs that make method calls back to the master -DSDT. Lin Ming. Example: To disassemble an SSDT with calls to DSDT: iasl -d +DSDT. Lin Ming. Example: To disassemble an SSDT with calls to DSDT: iasl +-d -e dsdt.aml ssdt1.aml iASL: Fix to allow references to aliases within ASL namepaths. Fixes a @@ -1241,46 +5022,61 @@ 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 +Designed and implemented a mechanism to validate predefined ACPI methods +and +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 +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 include actual repair of incorrect return objects where possible. Two new files are nspredef.c and acpredef.h. -Fixed a fault in the AML parser if a memory allocation fails during the Op +Fixed a fault in the AML parser if a memory allocation fails during the +Op completion routine AcpiPsCompleteThisOp. Lin Ming. ACPICA BZ 492. -Fixed an issue with implicit return compatibility. This change improves the -implicit return mechanism to be more compatible with the MS interpreter. Lin +Fixed an issue with implicit return compatibility. This change improves +the +implicit return mechanism to be more compatible with the MS interpreter. +Lin Ming, ACPICA BZ 349. -Implemented support for zero-length buffer-to-string conversions. Allow zero -length strings during interpreter buffer-to-string conversions. For example, +Implemented support for zero-length buffer-to-string conversions. Allow +zero +length strings during interpreter buffer-to-string conversions. For +example, during the ToDecimalString and ToHexString operators, as well as implicit conversions. Fiodor Suietov, ACPICA BZ 585. Fixed two possible memory leaks in the error exit paths of -AcpiUtUpdateObjectReference and AcpiUtWalkPackageTree. These functions are +AcpiUtUpdateObjectReference and AcpiUtWalkPackageTree. These functions +are 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. Removed the obsolete version number in module headers. Removed the -"$Revision" number that appeared in each module header. This version number -was useful under SourceSafe and CVS, but has no meaning under git. It is not +"$Revision" number that appeared in each module header. This version +number +was useful under SourceSafe and CVS, but has no meaning under git. It is +not 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: @@ -1296,43 +5092,57 @@ 1) ACPI CA Core Subsystem: Completed a major cleanup of the internal ACPI_OPERAND_OBJECT of type -Reference. Changes include the elimination of cheating on the Object field +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 -and continue. Handles the case where the method inadvertently declares too -many arguments, but does not actually use the extra ones. Applies mainly to +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: -Device, Event, Mutex, Region, Thermal, and Scope. Previously, evaluation of -these types were allowed, but an exception would be generated at some point +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. 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. Removed obsolete and/or unused exception codes from the acexcep.h header. -There is the possibility that certain device drivers may be affected if they +There is the possibility that certain device drivers may be affected if +they use any of these exceptions. -The ACPICA documentation has been added to the public git source tree, under +The ACPICA documentation has been added to the public git source tree, +under acpica/documents. Included are the ACPICA programmer reference, the iASL 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: @@ -1348,14 +5158,18 @@ defines _SCP with 3 arguments. Previous versions defined it with only 1 argument. iASL now allows both definitions. -iASL/disassembler: avoid infinite loop on bad ACPI tables. Check for zero- +iASL/disassembler: avoid infinite loop on bad ACPI tables. Check for +zero- length subtables when disassembling ACPI tables. Also fixed a couple of -errors where a full 16-bit table type field was not extracted from the input +errors where a full 16-bit table type field was not extracted from the +input properly. acpisrc: Improve comment counting mechanism for generating source code -statistics. Count first and last lines of multi-line comments as whitespace, -not comment lines. Handle Linux legal header in addition to standard acpica +statistics. Count first and last lines of multi-line comments as +whitespace, +not comment lines. Handle Linux legal header in addition to standard +acpica header. ---------------------------------------- @@ -1365,41 +5179,57 @@ 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 -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 +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 -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 +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 MS compatibility. Lin Ming, Bob Moore. Linux BZ 11105 x2APIC support: changes for MADT and SRAT ACPI tables. There are 2 new subtables for the MADT and one new subtable for the SRAT. Includes -disassembler and AcpiSrc support. Data from the Intel 64 Architecture x2APIC +disassembler and AcpiSrc support. Data from the Intel 64 Architecture +x2APIC Specification, June 2008. -Additional error checking for pathname utilities. Add error check after all +Additional error checking for pathname utilities. Add error check after +all calls to AcpiNsGetPathnameLength. Add status return from -AcpiNsBuildExternalPath and check after all calls. Add parameter validation +AcpiNsBuildExternalPath and check after all calls. Add parameter +validation to AcpiUtInitializeBuffer. Reported by and initial patch by Ingo Molnar. -Return status from the global init function AcpiUtGlobalInitialize. This is -used by both the kernel subsystem and the utilities such as iASL compiler. -The function could possibly fail when the caches are initialized. Yang Yi. +Return status from the global init function AcpiUtGlobalInitialize. This +is +used by both the kernel subsystem and the utilities such as iASL +compiler. +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: @@ -1411,9 +5241,12 @@ 2) iASL Compiler/Disassembler and Tools: -Debugger: fix a possible hang when evaluating non-methods. Fixes a problem -introduced in version 20080701. If the object being evaluated (via execute -command) is not a method, the debugger can hang while trying to obtain non- +Debugger: fix a possible hang when evaluating non-methods. Fixes a +problem +introduced in version 20080701. If the object being evaluated (via +execute +command) is not a method, the debugger can hang while trying to obtain +non- existent parameters. iASL: relax error for using reserved "_T_x" identifiers. These names can @@ -1421,16 +5254,24 @@ 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 -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 +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 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 +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. @@ -1438,13 +5279,16 @@ the ResourceSource argument is omitted but ResourceSourceIndex is present. Now leave room for the Index. BZ 426 -iASL: Prevent error message if CondRefOf target does not exist. Fixes cases +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. @@ -1459,9 +5303,12 @@ 1) ACPI CA Core Subsystem: 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 +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 handlers are installed.) Implemented a copy for dynamically loaded tables. Previously, dynamically @@ -1471,32 +5318,42 @@ 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 -unloaded more than once. Without this change, a table cannot be loaded again +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 -EndTag descriptor in 64-bit mode. The "minimal" descriptors such as EndTag +EndTag descriptor in 64-bit mode. The "minimal" descriptors such as +EndTag are calculated as 12 bytes long, but the actual length in the internal -descriptor is 16 because of the round-up to 8 on the 64-bit build. Reported +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 +Fixed a possible memory leak in the Unload operator. The DdbHandle +returned +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 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. +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. Vegard Nossum. BZ 726 Enhanced the AcpiGetObjectInfo interface to return the number of required -arguments if the object is a control method. Added this call to the debugger +arguments if the object is a control method. Added this call to the +debugger so the proper number of default arguments are passed to a method. This prevents a warning when executing methods from AcpiExec. @@ -1507,7 +5364,8 @@ 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: @@ -1522,20 +5380,28 @@ 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 -iASL: Eliminate warning when result of LoadTable is not used. Eliminate the +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. -All of this allows testing of the Load and Unload operators from AcpiExec. +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 +Debugger: update tables command for unloaded tables. Handle unloaded +tables and use the standard table header output routine. ---------------------------------------- @@ -1543,49 +5409,64 @@ 1) ACPI CA Core Subsystem: -Implemented a workaround for reversed _PRT entries. A significant number of +Implemented a workaround for reversed _PRT entries. A significant number +of BIOSs erroneously reverse the _PRT SourceName and the SourceIndex. This -change dynamically detects and repairs this problem. Provides compatibility +change dynamically detects and repairs this problem. Provides +compatibility with MS ACPI. BZ 6859 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 -information to the notify handler via the control method parameter pointer. - -Fixed a problem where the _SST execution status was incorrectly returned to -the caller of AcpiEnterSleepStatePrep. This was a regression introduced in +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 +the caller of AcpiEnterSleepStatePrep. This was a regression introduced +in 20080514. _SST is optional and a NOT_FOUND exception should never be 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 +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 Unload operator. Lin Ming. BZ 10669 -Cleaned up the debug operand dump mechanism. Eliminated unnecessary operands +Cleaned up the debug operand dump mechanism. Eliminated unnecessary +operands and eliminated the use of a negative index in a loop. Operands are now -displayed in the correct order, not backwards. This also fixes a regression +displayed in the correct order, not backwards. This also fixes a +regression introduced in 20080514 on 64-bit systems where the elimination of -ACPI_NATIVE_UINT caused the negative index to go large and positive. BZ 715 +ACPI_NATIVE_UINT caused the negative index to go large and positive. BZ +715 -Fixed a possible memory leak in EvPciConfigRegionSetup where the error exit +Fixed a possible memory leak in EvPciConfigRegionSetup where the error +exit path did not delete a locally allocated structure. Updated definitions for the DMAR and SRAT tables to synchronize with the current specifications. Includes disassembler support. Fixed a problem in the mutex debug code (in utmutex.c) where an incorrect -loop termination value was used. Loop terminated on iteration early, missing +loop termination value was used. Loop terminated on iteration early, +missing 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: @@ -1611,39 +5492,54 @@ Fixed a problem where GPEs were enabled too early during the ACPICA initialization. This could lead to "handler not installed" errors on some -machines. Moved GPE enable until after _REG/_STA/_INI methods are run. This -ensures that all operation regions and devices throughout the namespace have +machines. Moved GPE enable until after _REG/_STA/_INI methods are run. +This +ensures that all operation regions and devices throughout the namespace +have been initialized before GPEs are enabled. Alexey Starikovskiy, BZ 9916. Implemented a change to the enter sleep code. Moved execution of the _GTS -method to just before setting sleep enable bit. The execution was moved from +method to just before setting sleep enable bit. The execution was moved +from AcpiEnterSleepStatePrep to AcpiEnterSleepState. _GTS is now executed immediately before the SLP_EN bit is set, as per the ACPI specification. Luming Yu, BZ 1653. -Implemented a fix to disable unknown GPEs (2nd version). Now always disable +Implemented a fix to disable unknown GPEs (2nd version). Now always +disable 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 +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 +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. +specification. This provides compatibility with other ACPI +implementations. +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 -fields to the exception string arrays to eliminate a -1 subtraction on the +Fixed a possible negative array index in AcpiUtValidateException. Added +NULL +fields to the exception string arrays to eliminate a -1 subtraction on +the SubStatus field. Updated the debug tracking macros to reduce overall code and data size. @@ -1651,13 +5547,19 @@ instead of pointers to static strings. Jan Beulich and Bob Moore. Implemented argument count checking in control method invocation via -AcpiEvaluateObject. Now emit an error if too few arguments, warning if too -many. This applies only to extern programmatic control method execution, not +AcpiEvaluateObject. Now emit an error if too few arguments, warning if +too +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 +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 32/64-bit platforms is required. Added the C const qualifier for appropriate string constants -- mostly @@ -1665,7 +5567,8 @@ 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: @@ -1677,8 +5580,10 @@ 2) iASL Compiler/Disassembler and Tools: -Implemented ACPI table revision ID validation in the disassembler. Zero is -always invalid. For DSDTs, the ID controls the interpreter integer width. 1 +Implemented ACPI table revision ID validation in the disassembler. Zero +is +always invalid. For DSDTs, the ID controls the interpreter integer width. +1 means 32-bit and this is unusual. 2 or greater is 64-bit. ---------------------------------------- @@ -1687,54 +5592,75 @@ 1) ACPI CA Core Subsystem: 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 +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 from that GPE. BZ 6217 (Zhang Rui) Fixed a problem where NULL package elements were not returned to the AcpiEvaluateObject interface correctly. The element was simply ignored -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 +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, -Qword), Field, BankField, and IndexField operators when invoked from inside -an executing control method. In this case, these operators created namespace +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 temporary nodes. This could cause a problem if there is race condition -between an exiting control method and a running namespace walk. (Reported by +between an exiting control method and a running namespace walk. (Reported +by Linn Crosetto) Fixed a problem where the CreateField and CreateXXXField operators would -incorrectly allow duplicate names (the name of the field) with no exception +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. +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 -NULL objects - either NULL package elements or unresolved named references. +All Reference Objects returned via the AcpiEvaluateObject interface are +now +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 +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 +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 +Implemented several improvements for the output of the ASL "Debug" object +to clarify and keep all data for a given object on one output line. -Fixed two size calculation issues with the variable-length Start Dependent +Fixed two size calculation issues with the variable-length Start +Dependent resource descriptor. 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 +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. Previous Release: @@ -1746,38 +5672,51 @@ 2) iASL Compiler/Disassembler and Tools: -Fixed a problem with the use of the Switch operator where execution of the +Fixed a problem with the use of the Switch operator where execution of +the containing method by multiple concurrent threads could cause an AE_ALREADY_EXISTS exception. This is caused by the fact that there is no actual Switch opcode, it must be simulated with local named temporary -variables and if/else pairs. The solution chosen was to mark any method that -uses Switch as Serialized, thus preventing multiple thread entries. BZ 469. +variables and if/else pairs. The solution chosen was to mark any method +that +uses Switch as Serialized, thus preventing multiple thread entries. BZ +469. ---------------------------------------- 13 February 2008. Summary of changes for version 20080213: 1) ACPI CA Core Subsystem: -Implemented another MS compatibility design change for GPE/Notify handling. -GPEs are now cleared/enabled asynchronously to allow all pending notifies to +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 -control method via the external AcpiEvaluateObject interface could cause an +control method via the external AcpiEvaluateObject interface could cause +an AE_AML_INTERNAL exception depending on the order and type of operators executed by the target control method. Fixed a problem where resource descriptor size optimization could cause a -problem when a _CRS resource template is passed to a _SRS method. The _SRS +problem when a _CRS resource template is passed to a _SRS method. The +_SRS resource template must use the same descriptors (with the same size) as -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, +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, a CopyObject to all other object types should not perform an implicit conversion, as per the ACPI specification. (Lin Ming, Bob Moore) BZ 388 @@ -1785,7 +5724,8 @@ 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, @@ -1797,7 +5737,8 @@ 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 +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. Previous Release: @@ -1823,39 +5764,56 @@ virtually every file in the ACPICA core subsystem, the iASL compiler, and 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 -unexpected AE_PACKAGE_LIMIT errors on some systems (Lin Ming, Bob Moore) BZ +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 +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 -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 +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 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 +Implemented support for UserTerm (Method invocation) for the Unload +operator as per the ACPI spec. (Lin Ming) BZ 580 -Fixed a problem with the LoadTable operator where the OemId and OemTableId -input strings could cause unexpected failures if they were shorter than the +Fixed a problem with the LoadTable operator where the OemId and +OemTableId +input strings could cause unexpected failures if they were shorter than +the maximum lengths allowed. (Lin Ming, Bob Moore) BZ 576 -Implemented support for UserTerm (Method invocation) for the Unload operator +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 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 +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. Previous Release: @@ -1867,25 +5825,32 @@ 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 +Implemented support in the disassembler for checksum validation on +incoming +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 -created during compilation. In addition to the namespace hierarchy, the full +Implemented additional debugging information in the namespace listing +file +created during compilation. In addition to the namespace hierarchy, the +full pathname to each namespace object is displayed. -Fixed a problem with the disassembler where invalid ACPI tables could cause +Fixed a problem with the disassembler where invalid ACPI tables could +cause faults or infinite loops. Fixed an unexpected parse error when using the optional "parameter types" list in a control method declaration. (Lin Ming) BZ 397 -Fixed a problem where two External declarations with the same name did not +Fixed a problem where two External declarations with the same name did +not cause an error (Lin Ming) BZ 509 Implemented support for full TermArgs (adding Argx, Localx and method -invocation) for the ParameterData parameter to the LoadTable operator. (Lin +invocation) for the ParameterData parameter to the LoadTable operator. +(Lin Ming) BZ 583,587 ---------------------------------------- @@ -1895,33 +5860,44 @@ 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 -BankField. Previously, only constants were supported, now any TermArg may be +Implemented full argument resolution support for the BankValue argument +to +BankField. Previously, only constants were supported, now any TermArg may +be used. Lin Ming BZ 387, 393 Fixed a problem with AcpiGetDevices where the search of a branch of the device tree could be terminated prematurely. In accordance with the ACPI -specification, the search down the current branch is terminated if a device -is both not present and not functional (instead of just not present.) Yakui +specification, the search down the current branch is terminated if a +device +is both not present and not functional (instead of just not present.) +Yakui 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 +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 instead of simply ignored. Rui Zhang. -Fixed a problem with Index Fields where the Index register was incorrectly +Fixed a problem with Index Fields where the Index register was +incorrectly limited to a maximum of 32 bits. Now any size may be used. -Fixed a couple memory leaks associated with "implicit return" objects when +Fixed a couple memory leaks associated with "implicit return" objects +when the AML Interpreter slack mode is enabled. Lin Ming BZ 349 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 +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. Previous Release: @@ -1938,37 +5914,49 @@ Implemented event counters for each of the Fixed Events, the ACPI SCI (interrupt) itself, and control methods executed. Named -AcpiFixedEventCount[], AcpiSciCount, and AcpiMethodCount respectively. These +AcpiFixedEventCount[], AcpiSciCount, and AcpiMethodCount respectively. +These should be useful for debugging and statistics. Implemented a new external interface, AcpiGetStatistics, to retrieve the contents of the various event counters. Returns the current values for AcpiSciCount, AcpiGpeCount, the AcpiFixedEventCount array, and -AcpiMethodCount. The interface can be expanded in the future if new counters -are added. Device drivers should use this interface rather than access the +AcpiMethodCount. The interface can be expanded in the future if new +counters +are added. Device drivers should use this interface rather than access +the counters directly. -Fixed a problem with the FromBCD and ToBCD operators. With some compilers, -the ShortDivide function worked incorrectly, causing problems with the BCD +Fixed a problem with the FromBCD and ToBCD operators. With some +compilers, +the ShortDivide function worked incorrectly, causing problems with the +BCD functions with large input values. A truncation from 64-bit to 32-bit inadvertently occurred. Internal BZ 435. Lin Ming -Fixed a problem with Index references passed as method arguments. References -passed as arguments to control methods were dereferenced immediately (before -control was passed to the called method). The references are now correctly +Fixed a problem with Index references passed as method arguments. +References +passed as arguments to control methods were dereferenced immediately +(before +control was passed to the called method). The references are now +correctly passed directly to the called method. BZ 5389. Lin Ming -Fixed a problem with CopyObject used in conjunction with the Index operator. -The reference was incorrectly dereferenced before the copy. The reference is +Fixed a problem with CopyObject used in conjunction with the Index +operator. +The reference was incorrectly dereferenced before the copy. The reference +is now correctly copied. BZ 5391. Lin Ming -Fixed a problem with Control Method references within Package objects. These +Fixed a problem with Control Method references within Package objects. +These references are now correctly generated. This completes the package construction overhaul that began in version 20071019. 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 +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. Previous Release: @@ -1985,9 +5973,11 @@ Operation Region types. New types supported are: PCI_Config, CMOS, and PCIBARTarget. -Fixed a problem with the 64-bit version of AcpiExec where the extended (64- +Fixed a problem with the 64-bit version of AcpiExec where the extended +(64- bit) address fields for the DSDT and FACS within the FADT were not being -used, causing truncation of the upper 32-bits of these addresses. Lin Ming +used, causing truncation of the upper 32-bits of these addresses. Lin +Ming and Bob Moore ---------------------------------------- @@ -1996,14 +5986,18 @@ 1) ACPI CA Core Subsystem: Fixed a problem with the Alias operator when the target of the alias is a -named ASL operator that opens a new scope -- Scope, Device, PowerResource, +named ASL operator that opens a new scope -- Scope, Device, +PowerResource, Processor, and ThermalZone. In these cases, any children of the original -operator could not be accessed via the alias, potentially causing unexpected +operator could not be accessed via the alias, potentially causing +unexpected AE_NOT_FOUND exceptions. (BZ 9067) Fixed a problem with the Package operator where all named references were -created as object references and left otherwise unresolved. According to the -ACPI specification, a Package can only contain Data Objects or references to +created as object references and left otherwise unresolved. According to +the +ACPI specification, a Package can only contain Data Objects or references +to control methods. The implication is that named references to Data Objects (Integer, Buffer, String, Package, BufferField, Field) should be resolved immediately upon package creation. This is the approach taken with this @@ -2012,11 +6006,13 @@ Reverted a change to Notify handling that was introduced in version 20070508. This version changed the Notify handling from asynchronous to -fully synchronous (Device driver Notify handling with respect to the Notify +fully synchronous (Device driver Notify handling with respect to the +Notify ASL operator). It was found that this change caused more problems than it solved and was removed by most users. -Fixed a problem with the Increment and Decrement operators where the type of +Fixed a problem with the Increment and Decrement operators where the type +of the target object could be unexpectedly and incorrectly changed. (BZ 353) Lin Ming. @@ -2027,19 +6023,24 @@ Fixed a problem with the Load operator when loading a table from a buffer object. The input buffer was prematurely zeroed and/or deleted. (BZ 577) -Fixed a problem with the Debug object where a store of a DdbHandle reference +Fixed a problem with the Debug object where a store of a DdbHandle +reference object to the Debug object could cause a fault. -Added a table checksum verification for the Load operator, in the case where +Added a table checksum verification for the Load operator, in the case +where the load is from a buffer. (BZ 578). -Implemented additional parameter validation for the LoadTable operator. The -length of the input strings SignatureString, OemIdString, and OemTableId are +Implemented additional parameter validation for the LoadTable operator. +The +length of the input strings SignatureString, OemIdString, and OemTableId +are now checked for maximum lengths. (BZ 582) Lin Ming. 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 +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. Previous Release: @@ -2062,7 +6063,8 @@ 1) ACPI CA Core Subsystem: Designed and implemented new external interfaces to install and remove -handlers for ACPI table-related events. Current events that are defined are +handlers for ACPI table-related events. Current events that are defined +are LOAD and UNLOAD. These interfaces allow the host to track ACPI tables as they are dynamically loaded and unloaded. See AcpiInstallTableHandler and AcpiRemoveTableHandler. (Lin Ming and Bob Moore) @@ -2077,7 +6079,8 @@ 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 +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. Previous Release: @@ -2090,22 +6093,30 @@ 2) iASL Compiler/Disassembler: -Implemented support to allow multiple files to be compiled/disassembled in a -single invocation. This includes command line wildcard support for both the +Implemented support to allow multiple files to be compiled/disassembled +in +a +single invocation. This includes command line wildcard support for both +the Windows and Unix versions of the compiler. This feature simplifies the -disassembly and compilation of multiple ACPI tables in a single directory. +disassembly and compilation of multiple ACPI tables in a single +directory. ---------------------------------------- 08 May 2007. Summary of changes for version 20070508: 1) ACPI CA Core Subsystem: -Implemented a Microsoft compatibility design change for the handling of the +Implemented a Microsoft compatibility design change for the handling of +the Notify AML operator. Previously, notify handlers were dispatched and executed completely asynchronously in a deferred thread. The new design -still executes the notify handlers in a different thread, but the original -thread that executed the Notify() now waits at a synchronization point for -the notify handler to complete. Some machines depend on a synchronous Notify +still executes the notify handlers in a different thread, but the +original +thread that executed the Notify() now waits at a synchronization point +for +the notify handler to complete. Some machines depend on a synchronous +Notify operator in order to operate correctly. Implemented support to allow Package objects to be passed as method @@ -2114,15 +6125,21 @@ implemented since there were no reserved control methods that required it until recently. -Fixed a problem with the internal FADT conversion where ACPI 1.0 FADTs that +Fixed a problem with the internal FADT conversion where ACPI 1.0 FADTs +that contained invalid non-zero values in reserved fields could cause later -failures because these fields have meaning in later revisions of the FADT. -For incoming ACPI 1.0 FADTs, these fields are now always zeroed. (The fields +failures because these fields have meaning in later revisions of the +FADT. +For incoming ACPI 1.0 FADTs, these fields are now always zeroed. (The +fields are: Preferred_PM_Profile, PSTATE_CNT, CST_CNT, and IAPC_BOOT_FLAGS.) -Fixed a problem where the Global Lock handle was not properly updated if a -thread that acquired the Global Lock via executing AML code then attempted -to acquire the lock via the AcpiAcquireGlobalLock interface. Reported by Joe +Fixed a problem where the Global Lock handle was not properly updated if +a +thread that acquired the Global Lock via executing AML code then +attempted +to acquire the lock via the AcpiAcquireGlobalLock interface. Reported by +Joe Liu. Fixed a problem in AcpiEvDeleteGpeXrupt where the global interrupt list @@ -2131,7 +6148,8 @@ 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 +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. Previous Release: @@ -2149,46 +6167,61 @@ Implemented a change to the order of interpretation and evaluation of AML operand objects within the AML interpreter. The interpreter now evaluates operands in the order that they appear in the AML stream (and the -corresponding ASL code), instead of in the reverse order (after the entire -operand list has been parsed). The previous behavior caused several subtle +corresponding ASL code), instead of in the reverse order (after the +entire +operand list has been parsed). The previous behavior caused several +subtle incompatibilities with the Microsoft AML interpreter as well as being somewhat non-intuitive. BZ 7871, local BZ 263. Valery Podrezov. -Implemented a change to the ACPI Global Lock support. All interfaces to the +Implemented a change to the ACPI Global Lock support. All interfaces to +the global lock now allow the same thread to acquire the lock multiple times. -This affects the AcpiAcquireGlobalLock external interface to the global lock +This affects the AcpiAcquireGlobalLock external interface to the global +lock as well as the internal use of the global lock to support AML fields -- a -control method that is holding the global lock can now simultaneously access -AML fields that require global lock protection. Previously, in both cases, -this would have resulted in an AE_ALREADY_ACQUIRED exception. The change to +control method that is holding the global lock can now simultaneously +access +AML fields that require global lock protection. Previously, in both +cases, +this would have resulted in an AE_ALREADY_ACQUIRED exception. The change +to AcpiAcquireGlobalLock is of special interest to drivers for the Embedded -Controller. There is no change to the behavior of the AML Acquire operator, +Controller. There is no change to the behavior of the AML Acquire +operator, as this can already be used to acquire a mutex multiple times by the same thread. BZ 8066. With assistance from Alexey Starikovskiy. Fixed a problem where invalid objects could be referenced in the AML -Interpreter after error conditions. During operand evaluation, ensure that +Interpreter after error conditions. During operand evaluation, ensure +that the internal "Return Object" field is cleared on error and only valid -pointers are stored there. Caused occasional access to deleted objects that +pointers are stored there. Caused occasional access to deleted objects +that resulted in "large reference count" warning messages. Valery Podrezov. -Fixed a problem where an AE_STACK_OVERFLOW internal exception could occur on +Fixed a problem where an AE_STACK_OVERFLOW internal exception could occur +on deeply nested control method invocations. BZ 7873, local BZ 487. Valery Podrezov. Fixed an internal problem with the handling of result objects on the interpreter result stack. BZ 7872. Valery Podrezov. -Removed obsolete code that handled the case where AML_NAME_OP is the target +Removed obsolete code that handled the case where AML_NAME_OP is the +target of a reference (Reference.Opcode). This code was no longer necessary. BZ 7874. Valery Podrezov. -Removed obsolete ACPI_NO_INTEGER64_SUPPORT from two header files. This was a +Removed obsolete ACPI_NO_INTEGER64_SUPPORT from two header files. This +was +a remnant from the previously discontinued 16-bit support. 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 +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. Previous Release: @@ -2208,12 +6241,14 @@ the utilities. Implemented a fix for an incorrect parameter passed to AcpiTbDeleteTable -during a table load. A bad pointer was passed in the case where the DSDT is +during a table load. A bad pointer was passed in the case where the DSDT +is overridden, causing a fault in this case. 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 +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. Previous Release: @@ -2228,9 +6263,11 @@ 1) ACPI CA Core Subsystem: -Support for 16-bit ACPICA has been completely removed since it is no longer +Support for 16-bit ACPICA has been completely removed since it is no +longer necessary and it clutters the code. All 16-bit macros, types, and -conditional compiles have been removed, cleaning up and simplifying the code +conditional compiles have been removed, cleaning up and simplifying the +code across the entire subsystem. DOS support is no longer needed since the bootable Linux firmware kit is now available. @@ -2239,17 +6276,22 @@ AcpiEvRemoveGlobalLockHandler function. (With assistance from Joel Bretz, HP) -Implemented enhancements to the multithreading support within the debugger -to enable improved multithreading debugging and evaluation of the subsystem. +Implemented enhancements to the multithreading support within the +debugger +to enable improved multithreading debugging and evaluation of the +subsystem. (Valery Podrezov) -Debugger: Enhanced the Statistics/Memory command to emit the total (maximum) -memory used during the execution, as well as the maximum memory consumed by +Debugger: Enhanced the Statistics/Memory command to emit the total +(maximum) +memory used during the execution, as well as the maximum memory consumed +by each of the various object types. (Valery Podrezov) 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 +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. Previous Release: @@ -2270,30 +6312,36 @@ 1) ACPI CA Core Subsystem: -Optimized the Load ASL operator in the case where the source operand is an +Optimized the Load ASL operator in the case where the source operand is +an operation region. Simply map the operation region memory, instead of performing a bytewise read. (Region must be of type SystemMemory, see below.) Fixed the Load ASL operator for the case where the source operand is a -region field. A buffer object is also allowed as the source operand. BZ 480 +region field. A buffer object is also allowed as the source operand. BZ +480 -Fixed a problem where the Load ASL operator allowed the source operand to be +Fixed a problem where the Load ASL operator allowed the source operand to +be an operation region of any type. It is now restricted to regions of type SystemMemory, as per the ACPI specification. BZ 481 Additional cleanup and optimizations for the new Table Manager code. -AcpiEnable will now fail if all of the required ACPI tables are not loaded +AcpiEnable will now fail if all of the required ACPI tables are not +loaded (FADT, FACS, DSDT). BZ 477 -Added #pragma pack(8/4) to acobject.h to ensure that the structures in this +Added #pragma pack(8/4) to acobject.h to ensure that the structures in +this header are always compiled as aligned. The ACPI_OPERAND_OBJECT has been manually optimized to be aligned and will not work if it is byte-packed. 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 +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. Previous Release: @@ -2324,33 +6372,41 @@ use. (Valery Podrezov + interpreter changes in version 20051202 that eliminated namespace loading during the pass one parse.) -Implemented _CID support for PCI Root Bridge detection. If the _HID does not -match the predefined PCI Root Bridge IDs, the _CID list (if present) is now +Implemented _CID support for PCI Root Bridge detection. If the _HID does +not +match the predefined PCI Root Bridge IDs, the _CID list (if present) is +now obtained and also checked for an ID match. -Implemented additional support for the PCI _ADR execution: upsearch until a +Implemented additional support for the PCI _ADR execution: upsearch until +a device scope is found before executing _ADR. This allows PCI_Config -operation regions to be declared locally within control methods underneath +operation regions to be declared locally within control methods +underneath PCI device objects. Fixed a problem with a possible race condition between threads executing AcpiWalkNamespace and the AML interpreter. This condition was removed by -modifying AcpiWalkNamespace to (by default) ignore all temporary namespace +modifying AcpiWalkNamespace to (by default) ignore all temporary +namespace entries created during any concurrent control method execution. An additional namespace race condition is known to exist between AcpiWalkNamespace and the Load/Unload ASL operators and is still under investigation. Restructured the AML ParseLoop function, breaking it into several -subfunctions in order to reduce CPU stack use and improve maintainability. +subfunctions in order to reduce CPU stack use and improve +maintainability. (Mikhail Kouzmich) -AcpiGetHandle: Fix for parameter validation to detect invalid combinations +AcpiGetHandle: Fix for parameter validation to detect invalid +combinations of prefix handle and pathname. BZ 478 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 +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. Previous Release: @@ -2362,7 +6418,8 @@ 2) iASL Compiler/Disassembler and Tools: -Ported the -g option (get local ACPI tables) to the new ACPICA Table Manager +Ported the -g option (get local ACPI tables) to the new ACPICA Table +Manager to restore original behavior. ---------------------------------------- @@ -2376,15 +6433,18 @@ Fixed a problem with the Global Lock where the lock could appear to be obtained before it is actually obtained. The global lock semaphore was -inadvertently created with one unit instead of zero units. (BZ 464) Fiodor +inadvertently created with one unit instead of zero units. (BZ 464) +Fiodor Suietov. -Fixed a possible memory leak and fault in AcpiExResolveObjectToValue during +Fixed a possible memory leak and fault in AcpiExResolveObjectToValue +during a read from a buffer or region field. (BZ 458) Fiodor Suietov. 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 +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. Previous Release: @@ -2397,20 +6457,25 @@ 2) iASL Compiler/Disassembler and Tools: -Fixed a compilation problem with the pre-defined Resource Descriptor field -names where an "object does not exist" error could be incorrectly generated +Fixed a compilation problem with the pre-defined Resource Descriptor +field +names where an "object does not exist" error could be incorrectly +generated if the parent ResourceTemplate pathname places the template within a different namespace scope than the current scope. (BZ 7212) -Fixed a problem where the compiler could hang after syntax errors detected +Fixed a problem where the compiler could hang after syntax errors +detected in an ElseIf construct. (BZ 453) Fixed a problem with the AmlFilename parameter to the DefinitionBlock() -operator. An incorrect output filename was produced when this parameter was +operator. An incorrect output filename was produced when this parameter +was a null string (""). Now, the original input filename is used as the AML output filename, with an ".aml" extension. -Implemented a generic batch command mode for the AcpiExec utility (execute +Implemented a generic batch command mode for the AcpiExec utility +(execute any AML debugger command) (Valery Podrezov). ---------------------------------------- @@ -2420,15 +6485,18 @@ Enhanced the implementation of the "serialized mode" of the interpreter (enabled via the AcpiGbl_AllMethodsSerialized flag.) When this mode is -specified, instead of creating a serialization semaphore per control method, +specified, instead of creating a serialization semaphore per control +method, the interpreter lock is simply no longer released before a blocking operation during control method execution. This effectively makes the AML Interpreter single-threaded. The overhead of a semaphore per-method is eliminated. -Fixed a regression where an error was no longer emitted if a control method +Fixed a regression where an error was no longer emitted if a control +method attempts to create 2 objects of the same name. This once again returns -AE_ALREADY_EXISTS. When this exception occurs, it invokes the mechanism that +AE_ALREADY_EXISTS. When this exception occurs, it invokes the mechanism +that will dynamically serialize the control method to possible prevent future errors. (BZ 440) @@ -2439,13 +6507,18 @@ AcpiHwInitialize function - the FADT registers are now validated when the table is loaded. -Added two new warnings during FADT verification - 1) if the FADT is larger -than the largest known FADT version, and 2) if there is a mismatch between a -32-bit block address and the 64-bit X counterpart (when both are non-zero.) +Added two new warnings during FADT verification - 1) if the FADT is +larger +than the largest known FADT version, and 2) if there is a mismatch +between +a +32-bit block address and the 64-bit X counterpart (when both are non- +zero.) 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 +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. Previous Release: @@ -2458,8 +6531,10 @@ 2) iASL Compiler/Disassembler and Tools: -Fixed a problem with the implementation of the Switch() operator where the -temporary variable was declared too close to the actual Switch, instead of +Fixed a problem with the implementation of the Switch() operator where +the +temporary variable was declared too close to the actual Switch, instead +of at method level. This could cause a problem if the Switch() operator is within a while loop, causing an error on the second iteration. (BZ 460) @@ -2469,17 +6544,20 @@ Disassembly of an FADT now verifies the input FADT and reports any errors found. Fix for proper disassembly of full-sized (ACPI 2.0) FADTs. -Disassembly of raw data buffers with byte initialization data now prefixes +Disassembly of raw data buffers with byte initialization data now +prefixes each output line with the current buffer offset. Disassembly of ASF! table now includes all variable-length data fields at the end of some of the subtables. The disassembler now emits a comment if a buffer appears to be a -ResourceTemplate, but cannot be disassembled as such because the EndTag does +ResourceTemplate, but cannot be disassembled as such because the EndTag +does not appear at the very end of the buffer. -AcpiExec - Added the "-t" command line option to enable the serialized mode +AcpiExec - Added the "-t" command line option to enable the serialized +mode of the AML interpreter. ---------------------------------------- @@ -2495,11 +6573,13 @@ - Additional parameter validation for AcpiGetTable, AcpiGetTableHeader, AcpiGetTableByIndex -Change for GPE support: when a "wake" GPE is received, all wake GPEs are now +Change for GPE support: when a "wake" GPE is received, all wake GPEs are +now immediately disabled to prevent the waking GPE from firing again and to prevent other wake GPEs from interrupting the wake process. -Added the AcpiGpeCount global that tracks the number of processed GPEs, to +Added the AcpiGpeCount global that tracks the number of processed GPEs, +to be used for debugging systems with a large number of ACPI interrupts. Implemented support for the "DMAR" ACPI table (DMA Redirection Table) in @@ -2507,7 +6587,8 @@ 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 +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. Previous Release: @@ -2528,62 +6609,79 @@ 1) ACPI CA Core Subsystem: The Table Manager component has been completely redesigned and -reimplemented. The new design is much simpler, and reduces the overall code -and data size of the kernel-resident ACPICA by approximately 5%. Also, it is +reimplemented. The new design is much simpler, and reduces the overall +code +and data size of the kernel-resident ACPICA by approximately 5%. Also, it +is now possible to obtain the ACPI tables very early during kernel initialization, even before dynamic memory management is initialized. (Alexey Starikovskiy, Fiodor Suietov, Bob Moore) Obsolete ACPICA interfaces: -- AcpiGetFirmwareTable: Use AcpiGetTable instead (works at early kernel init +- AcpiGetFirmwareTable: Use AcpiGetTable instead (works at early kernel +init time). - AcpiLoadTable: Not needed. - AcpiUnloadTable: Not needed. New ACPICA interfaces: -- AcpiInitializeTables: Must be called before the table manager can be used. +- AcpiInitializeTables: Must be called before the table manager can be +used. - AcpiReallocateRootTable: Used to transfer the root table to dynamically allocated memory after it becomes available. -- AcpiGetTableByIndex: Allows the host to easily enumerate all ACPI tables +- AcpiGetTableByIndex: Allows the host to easily enumerate all ACPI +tables in the RSDT/XSDT. Other ACPICA changes: -- AcpiGetTableHeader returns the actual mapped table header, not a copy. Use +- AcpiGetTableHeader returns the actual mapped table header, not a copy. +Use AcpiOsUnmapMemory to free this mapping. - AcpiGetTable returns the actual mapped table. The mapping is managed internally and must not be deleted by the caller. Use of this interface causes no additional dynamic memory allocation. -- AcpiFindRootPointer: Support for physical addressing has been eliminated, +- AcpiFindRootPointer: Support for physical addressing has been +eliminated, it appeared to be unused. - The interface to AcpiOsMapMemory has changed to be consistent with the other allocation interfaces. -- The interface to AcpiOsGetRootPointer has changed to eliminate unnecessary +- The interface to AcpiOsGetRootPointer has changed to eliminate +unnecessary parameters. -- ACPI_PHYSICAL_ADDRESS is now 32 bits on 32-bit platforms, 64 bits on 64- +- ACPI_PHYSICAL_ADDRESS is now 32 bits on 32-bit platforms, 64 bits on +64- bit platforms. Was previously 64 bits on all platforms. -- The interface to the ACPI Global Lock acquire/release macros have changed +- The interface to the ACPI Global Lock acquire/release macros have +changed slightly since ACPICA no longer keeps a local copy of the FACS with a constructed pointer to the actual global lock. Porting to the new table manager: - AcpiInitializeTables: Must be called once, and can be called anytime -during the OS initialization process. It allows the host to specify an area +during the OS initialization process. It allows the host to specify an +area of memory to be used to store the internal version of the RSDT/XSDT (root -table). This allows the host to access ACPI tables before memory management +table). This allows the host to access ACPI tables before memory +management is initialized and running. -- AcpiReallocateRootTable: Can be called after memory management is running +- AcpiReallocateRootTable: Can be called after memory management is +running to copy the root table to a dynamically allocated array, freeing up the scratch memory specified in the call to AcpiInitializeTables. - AcpiSubsystemInitialize: This existing interface is independent of the -Table Manager, and does not have to be called before the Table Manager can +Table Manager, and does not have to be called before the Table Manager +can be used, it only must be called before the rest of ACPICA can be used. -- ACPI Tables: Some changes have been made to the names and structure of the -actbl.h and actbl1.h header files and may require changes to existing code. -For example, bitfields have been completely removed because of their lack of +- ACPI Tables: Some changes have been made to the names and structure of +the +actbl.h and actbl1.h header files and may require changes to existing +code. +For example, bitfields have been completely removed because of their lack +of portability across C compilers. - Update interfaces to the Global Lock acquire/release macros if local versions are used. (see acwin.h) @@ -2594,7 +6692,8 @@ 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 +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. Previous Release: @@ -2616,43 +6715,56 @@ The full source code for the ASL test suite used to validate the iASL compiler and the ACPICA core subsystem is being released with the ACPICA -source for the first time. The source is contained in a separate package and -consists of over 1100 files that exercise all ASL/AML operators. The package -should appear on the Intel/ACPI web site shortly. (Valery Podrezov, Fiodor +source for the first time. The source is contained in a separate package +and +consists of over 1100 files that exercise all ASL/AML operators. The +package +should appear on the Intel/ACPI web site shortly. (Valery Podrezov, +Fiodor Suietov) Completed a new design and implementation for support of the ACPI Global Lock. On the OS side, the global lock is now treated as a standard AML mutex. Previously, multiple OS threads could "acquire" the global lock -simultaneously. However, this could cause the BIOS to be starved out of the +simultaneously. However, this could cause the BIOS to be starved out of +the lock - especially in cases such as the Embedded Controller driver where there is a tight coupling between the OS and the BIOS. Implemented an optimization for the ACPI Global Lock interrupt mechanism. The Global Lock interrupt handler no longer queues the execution of a -separate thread to signal the global lock semaphore. Instead, the semaphore +separate thread to signal the global lock semaphore. Instead, the +semaphore is signaled directly from the interrupt handler. Implemented support within the AML interpreter for package objects that -contain a larger AML length (package list length) than the package element +contain a larger AML length (package list length) than the package +element count. In this case, the length of the package is truncated to match the -package element count. Some BIOS code apparently modifies the package length -on the fly, and this change supports this behavior. Provides compatibility +package element count. Some BIOS code apparently modifies the package +length +on the fly, and this change supports this behavior. Provides +compatibility with the MS AML interpreter. (With assistance from Fiodor Suietov) -Implemented a temporary fix for the BankValue parameter of a Bank Field to +Implemented a temporary fix for the BankValue parameter of a Bank Field +to support all constant values, now including the Zero and One opcodes. -Evaluation of this parameter must eventually be converted to a full TermArg -evaluation. A not-implemented error is now returned (temporarily) for non- +Evaluation of this parameter must eventually be converted to a full +TermArg +evaluation. A not-implemented error is now returned (temporarily) for +non- constant values for this parameter. Fixed problem reports (Fiodor Suietov) integrated: -- Fix for premature object deletion after CopyObject on Operation Region (BZ +- Fix for premature object deletion after CopyObject on Operation Region +(BZ 350) 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 +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. Previous Release: @@ -2678,18 +6790,22 @@ transfers. Some of the debug data structures are packed by default to minimize size. -Added an error message for the case where AcpiOsGetThreadId() returns zero. +Added an error message for the case where AcpiOsGetThreadId() returns +zero. A non-zero value is required by the core ACPICA code to ensure the proper operation of AML mutexes and recursive control methods. The DSDT is now the only ACPI table that determines whether the AML -interpreter is in 32-bit or 64-bit mode. Not really a functional change, but -the hooks for per-table 32/64 switching have been removed from the code. A +interpreter is in 32-bit or 64-bit mode. Not really a functional change, +but +the hooks for per-table 32/64 switching have been removed from the code. +A clarification to the ACPI specification is forthcoming in ACPI 3.0B. Fixed a possible leak of an OwnerID in the error path of AcpiTbInitTableDescriptor (tbinstal.c), and migrated all table OwnerID -deletion to a single place in AcpiTbUninstallTable to correct possible leaks +deletion to a single place in AcpiTbUninstallTable to correct possible +leaks when using the AcpiTbDeleteTablesByType interface (with assistance from Lance Ortiz.) @@ -2697,7 +6813,8 @@ associated with the method could be over-signaled after multiple method invocations. -Fixed two issues with the locking of the internal namespace data structure. +Fixed two issues with the locking of the internal namespace data +structure. Both the Unload() operator and AcpiUnloadTable interface now lock the namespace during the namespace deletion associated with the table unload (with assistance from Linn Crosetto.) @@ -2708,19 +6825,23 @@ Fixed problem reports (Fiodor Suietov) integrated: - Incomplete cleanup branches in AcpiTbGetTableRsdt (BZ 369) - On Address Space handler deletion, needless deactivation call (BZ 374) -- AcpiRemoveAddressSpaceHandler: validate Device handle parameter (BZ 375) -- Possible memory leak, Notify sub-objects of Processor, Power, ThermalZone +- AcpiRemoveAddressSpaceHandler: validate Device handle parameter (BZ +375) +- Possible memory leak, Notify sub-objects of Processor, Power, +ThermalZone (BZ 376) - AcpiRemoveAddressSpaceHandler: validate Handler parameter (BZ 378) - Minimum Length of RSDT should be validated (BZ 379) - AcpiRemoveNotifyHandler: return AE_NOT_EXIST if Processor Obj has no Handler (BZ (380) -- AcpiUnloadTable: return AE_NOT_EXIST if no table of specified type loaded +- AcpiUnloadTable: return AE_NOT_EXIST if no table of specified type +loaded (BZ 381) 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 +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. Previous Release: @@ -2746,39 +6867,53 @@ allows the type to be customized to the host OS for improved efficiency (since a spinlock is usually a very small object.) -Implemented support for "ignored" bits in the ACPI registers. According to +Implemented support for "ignored" bits in the ACPI registers. According +to the ACPI specification, these bits should be preserved when writing the -registers via a read/modify/write cycle. There are 3 bits preserved in this +registers via a read/modify/write cycle. There are 3 bits preserved in +this manner: PM1_CONTROL[0] (SCI_EN), PM1_CONTROL[9], and PM1_STATUS[11]. -Implemented the initial deployment of new OSL mutex interfaces. Since some +Implemented the initial deployment of new OSL mutex interfaces. Since +some host operating systems have separate mutex and semaphore objects, this feature was requested. The base code now uses mutexes (and the new mutex interfaces) wherever a binary semaphore was used previously. However, for -the current release, the mutex interfaces are defined as macros to map them -to the existing semaphore interfaces. Therefore, no OSL changes are required +the current release, the mutex interfaces are defined as macros to map +them +to the existing semaphore interfaces. Therefore, no OSL changes are +required at this time. (See acpiosxf.h) Fixed several problems with the support for the control method SyncLevel -parameter. The SyncLevel now works according to the ACPI specification and -in concert with the Mutex SyncLevel parameter, since the current SyncLevel -is a property of the executing thread. Mutual exclusion for control methods +parameter. The SyncLevel now works according to the ACPI specification +and +in concert with the Mutex SyncLevel parameter, since the current +SyncLevel +is a property of the executing thread. Mutual exclusion for control +methods is now implemented with a mutex instead of a semaphore. Fixed three instances of the use of the C shift operator in the bitfield -support code (exfldio.c) to avoid the use of a shift value larger than the -target data width. The behavior of C compilers is undefined in this case and -can cause unpredictable results, and therefore the case must be detected and +support code (exfldio.c) to avoid the use of a shift value larger than +the +target data width. The behavior of C compilers is undefined in this case +and +can cause unpredictable results, and therefore the case must be detected +and avoided. (Fiodor Suietov) Added an info message whenever an SSDT or OEM table is loaded dynamically -via the Load() or LoadTable() ASL operators. This should improve debugging -capability since it will show exactly what tables have been loaded (beyond +via the Load() or LoadTable() ASL operators. This should improve +debugging +capability since it will show exactly what tables have been loaded +(beyond the tables present in the RSDT/XSDT.) 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 +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. Previous Release: @@ -2798,19 +6933,24 @@ 1) ACPI CA Core Subsystem: -Converted the locking mutex used for the ACPI hardware to a spinlock. This +Converted the locking mutex used for the ACPI hardware to a spinlock. +This change should eliminate all problems caused by attempting to acquire a semaphore at interrupt level, and it means that all ACPICA external -interfaces that directly access the ACPI hardware can be safely called from -interrupt level. OSL code that implements the semaphore interfaces should be +interfaces that directly access the ACPI hardware can be safely called +from +interrupt level. OSL code that implements the semaphore interfaces should +be able to eliminate any workarounds for being called at interrupt level. Fixed a regression introduced in 20060526 where the ACPI device -initialization could be prematurely aborted with an AE_NOT_FOUND if a device +initialization could be prematurely aborted with an AE_NOT_FOUND if a +device did not have an optional _INI method. Fixed an IndexField issue where a write to the Data Register should be -limited in size to the AccessSize (width) of the IndexField itself. (BZ 433, +limited in size to the AccessSize (width) of the IndexField itself. (BZ +433, Fiodor Suietov) Fixed problem reports (Valery Podrezov) integrated: @@ -2824,7 +6964,8 @@ 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 +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. Previous Release: @@ -2852,17 +6993,21 @@ 1) ACPI CA Core Subsystem: Restructured, flattened, and simplified the internal interfaces for -namespace object evaluation - resulting in smaller code, less CPU stack use, +namespace object evaluation - resulting in smaller code, less CPU stack +use, and fewer interfaces. (With assistance from Mikhail Kouzmich) -Fixed a problem with the CopyObject operator where the first parameter was -not typed correctly for the parser, interpreter, compiler, and disassembler. +Fixed a problem with the CopyObject operator where the first parameter +was +not typed correctly for the parser, interpreter, compiler, and +disassembler. Caused various errors and unexpected behavior. Fixed a problem where a ShiftLeft or ShiftRight of more than 64 bits produced incorrect results with some C compilers. Since the behavior of C compilers when the shift value is larger than the datatype width is -apparently not well defined, the interpreter now detects this condition and +apparently not well defined, the interpreter now detects this condition +and simply returns zero as expected in all such cases. (BZ 395) Fixed problem reports (Valery Podrezov) integrated: @@ -2870,21 +7015,25 @@ - Allow interpreter to handle nested method declarations (BZ 5361) Fixed problem reports (Fiodor Suietov) integrated: -- AcpiTerminate doesn't free debug memory allocation list objects (BZ 355) -- After Core Subsystem shutdown, AcpiSubsystemStatus returns AE_OK (BZ 356) +- AcpiTerminate doesn't free debug memory allocation list objects (BZ +355) +- After Core Subsystem shutdown, AcpiSubsystemStatus returns AE_OK (BZ +356) - AcpiOsUnmapMemory for RSDP can be invoked inconsistently (BZ 357) - Resource Manager should return AE_TYPE for non-device objects (BZ 358) - Incomplete cleanup branch in AcpiNsEvaluateRelative (BZ 359) - Use AcpiOsFree instead of ACPI_FREE in AcpiRsSetSrsMethodData (BZ 360) - Incomplete cleanup branch in AcpiPsParseAml (BZ 361) - Incomplete cleanup branch in AcpiDsDeleteWalkState (BZ 362) -- AcpiGetTableHeader returns AE_NO_ACPI_TABLES until DSDT is loaded (BZ 365) +- AcpiGetTableHeader returns AE_NO_ACPI_TABLES until DSDT is loaded (BZ +365) - Status of the Global Initialization Handler call not used (BZ 366) - Incorrect object parameter to Global Initialization Handler (BZ 367) 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 +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. Previous Release: @@ -2900,7 +7049,8 @@ Modified the parser to allow the names IO, DMA, and IRQ to be used as namespace identifiers with no collision with existing resource descriptor macro names. This provides compatibility with other ASL compilers and is -most useful for disassembly/recompilation of existing tables without parse +most useful for disassembly/recompilation of existing tables without +parse errors. (With assistance from Thomas Renninger) Disassembler: fixed an incorrect disassembly problem with the @@ -2913,27 +7063,37 @@ 1) ACPI CA Core Subsystem: Replaced the AcpiOsQueueForExecution interface with a new interface named -AcpiOsExecute. The major difference is that the new interface does not have -a Priority parameter, this appeared to be useless and has been replaced by a +AcpiOsExecute. The major difference is that the new interface does not +have +a Priority parameter, this appeared to be useless and has been replaced +by +a Type parameter. The Type tells the host what type of execution is being requested, such as global lock handler, notify handler, GPE handler, etc. -This allows the host to queue and execute the request as appropriate for the -request type, possibly using different work queues and different priorities +This allows the host to queue and execute the request as appropriate for +the +request type, possibly using different work queues and different +priorities for the various request types. This enables fixes for multithreading -deadlock problems such as BZ #5534, and will require changes to all existing +deadlock problems such as BZ #5534, and will require changes to all +existing OS interface layers. (Alexey Starikovskiy and Bob Moore) -Fixed a possible memory leak associated with the support for the so-called +Fixed a possible memory leak associated with the support for the so- +called "implicit return" ACPI extension. Reported by FreeBSD, BZ #6514. (Fiodor Suietov) Fixed a problem with the Load() operator where a table load from an -operation region could overwrite an internal table buffer by up to 7 bytes -and cause alignment faults on IPF systems. (With assistance from Luming Yu) +operation region could overwrite an internal table buffer by up to 7 +bytes +and cause alignment faults on IPF systems. (With assistance from Luming +Yu) 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 +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. Previous Release: @@ -2947,16 +7107,22 @@ 2) iASL Compiler/Disassembler and Tools: -Disassembler: Implemented support to cross reference the internal namespace -and automatically generate ASL External() statements for symbols not defined +Disassembler: Implemented support to cross reference the internal +namespace +and automatically generate ASL External() statements for symbols not +defined within the current table being disassembled. This will simplify the -disassembly and recompilation of interdependent tables such as SSDTs since +disassembly and recompilation of interdependent tables such as SSDTs +since these statements will no longer have to be added manually. Disassembler: Implemented experimental support to automatically detect -invocations of external control methods and generate appropriate External() -statements. This is problematic because the AML cannot be correctly parsed -until the number of arguments for each control method is known. Currently, +invocations of external control methods and generate appropriate +External() +statements. This is problematic because the AML cannot be correctly +parsed +until the number of arguments for each control method is known. +Currently, standalone method invocations and invocations as the source operand of a Store() statement are supported. @@ -2972,9 +7138,11 @@ Removed a device initialization optimization introduced in 20051216 where the _STA method was not run unless an _INI was also present for the same -device. This optimization could cause problems because it could allow _INI +device. This optimization could cause problems because it could allow +_INI methods to be run within a not-present device subtree. (If a not-present -device had no _INI, _STA would not be run, the not-present status would not +device had no _INI, _STA would not be run, the not-present status would +not be discovered, and the children of the device would be incorrectly traversed.) @@ -2984,7 +7152,8 @@ machines (with assistance from Len Brown.) Implemented support for the device initialization case where the returned -_STA flags indicate a device not-present but functioning. In this case, _INI +_STA flags indicate a device not-present but functioning. In this case, +_INI is not run, but the device children are examined for presence, as per the ACPI specification. @@ -2997,7 +7166,8 @@ interface is called during the creation of all AML operation regions, and allows the host OS to exert control over what addresses it will allow the AML code to access. Operation Regions whose addresses are disallowed will -cause a runtime exception when they are actually accessed (will not affect +cause a runtime exception when they are actually accessed (will not +affect or abort table loading.) See oswinxf or osunixxf for an example implementation. @@ -3007,22 +7177,27 @@ appropriate (with assistance from Bjorn Helgaas.) See oswinxf or osunixxf for an example implementation. -Restructured and corrected various problems in the exception handling code +Restructured and corrected various problems in the exception handling +code paths within DsCallControlMethod and DsTerminateControlMethod in dsmethod (with assistance from Takayoshi Kochi.) -Modified the Linux source converter to ignore quoted string literals while -converting identifiers from mixed to lower case. This will correct problems +Modified the Linux source converter to ignore quoted string literals +while +converting identifiers from mixed to lower case. This will correct +problems with the disassembler and other areas where such strings must not be modified. The ACPI_FUNCTION_* macros no longer require quotes around the function -name. This allows the Linux source converter to convert the names, now that +name. This allows the Linux source converter to convert the names, now +that the converter ignores quoted strings. 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 +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. Previous Release: @@ -3036,21 +7211,28 @@ 2) iASL Compiler/Disassembler and Tools: -Implemented 3 new warnings for iASL, and implemented multiple warning levels +Implemented 3 new warnings for iASL, and implemented multiple warning +levels (w2 flag). -1) Ignored timeouts: If the TimeoutValue parameter to Wait or Acquire is not +1) Ignored timeouts: If the TimeoutValue parameter to Wait or Acquire is +not WAIT_FOREVER (0xFFFF) and the code does not examine the return value to check for the possible timeout, a warning is issued. -2) Useless operators: If an ASL operator does not specify an optional target +2) Useless operators: If an ASL operator does not specify an optional +target operand and it also does not use the function return value from the -operator, a warning is issued since the operator effectively does nothing. +operator, a warning is issued since the operator effectively does +nothing. 3) Unreferenced objects: If a namespace object is created, but never -referenced, a warning is issued. This is a warning level 2 since there are -cases where this is ok, such as when a secondary table is loaded that uses -the unreferenced objects. Even so, care is taken to only flag objects that +referenced, a warning is issued. This is a warning level 2 since there +are +cases where this is ok, such as when a secondary table is loaded that +uses +the unreferenced objects. Even so, care is taken to only flag objects +that don't look like they will ever be used. For example, the reserved methods (starting with an underscore) are usually not referenced because it is expected that the OS will invoke them. @@ -3061,19 +7243,24 @@ 1) ACPI CA Core Subsystem: Implemented header file support for the following additional ACPI tables: -ASF!, BOOT, CPEP, DBGP, MCFG, SPCR, SPMI, TCPA, and WDRT. With this support, -all current and known ACPI tables are now defined in the ACPICA headers and +ASF!, BOOT, CPEP, DBGP, MCFG, SPCR, SPMI, TCPA, and WDRT. With this +support, +all current and known ACPI tables are now defined in the ACPICA headers +and are available for use by device drivers and other software. Implemented support to allow tables that contain ACPI names with invalid characters to be loaded. Previously, this would cause the table load to fail, but since there are several known cases of such tables on existing -machines, this change was made to enable ACPI support for them. Also, this +machines, this change was made to enable ACPI support for them. Also, +this matches the behavior of the Microsoft ACPI implementation. -Fixed a couple regressions introduced during the memory optimization in the +Fixed a couple regressions introduced during the memory optimization in +the 20060317 release. The namespace node definition required additional -reorganization and an internal datatype that had been changed to 8-bit was +reorganization and an internal datatype that had been changed to 8-bit +was restored to 32-bit. (Valery Podrezov) Fixed a problem where a null pointer passed to AcpiUtDeleteGenericState @@ -3082,20 +7269,25 @@ previous implementation before the deployment of AcpiOsReleaseObject. (Valery Podrezov, Fiodor Suietov) -Fixed a memory mapping leak during the deletion of a SystemMemory operation +Fixed a memory mapping leak during the deletion of a SystemMemory +operation region where a cached memory mapping was not deleted. This became a -noticeable problem for operation regions that are defined within frequently +noticeable problem for operation regions that are defined within +frequently used control methods. (Dana Meyers) Reorganized the ACPI table header files into two main files: one for the -ACPI tables consumed by the ACPICA core, and another for the miscellaneous -ACPI tables that are consumed by the drivers and other software. The various +ACPI tables consumed by the ACPICA core, and another for the +miscellaneous +ACPI tables that are consumed by the drivers and other software. The +various FADT definitions were merged into one common section and three different tables (ACPI 1.0, 1.0+, and 2.0) 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 +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. Previous Release: @@ -3110,16 +7302,19 @@ Disassembler: Implemented support to decode and format all non-AML ACPI tables (tables other than DSDTs and SSDTs.) This includes the new tables -added to the ACPICA headers, therefore all current and known ACPI tables are +added to the ACPICA headers, therefore all current and known ACPI tables +are supported. Disassembler: The change to allow ACPI names with invalid characters also -enables the disassembly of such tables. Invalid characters within names are +enables the disassembly of such tables. Invalid characters within names +are changed to '*' to make the name printable; the iASL compiler will still generate an error for such names, however, since this is an invalid ACPI character. -Implemented an option for AcpiXtract (-a) to extract all tables found in the +Implemented an option for AcpiXtract (-a) to extract all tables found in +the input file. The default invocation extracts only the DSDTs and SSDTs. Fixed a couple of gcc generation issues for iASL and AcpiExec and added a @@ -3132,20 +7327,25 @@ Implemented the use of a cache object for all internal namespace nodes. Since there are about 1000 static nodes in a typical system, this will -decrease memory use for cache implementations that minimize per-allocation +decrease memory use for cache implementations that minimize per- +allocation overhead (such as a slab allocator.) -Removed the reference count mechanism for internal namespace nodes, since it +Removed the reference count mechanism for internal namespace nodes, since +it was deemed unnecessary. This reduces the size of each namespace node by -about 5%-10% on all platforms. Nodes are now 20 bytes for the 32-bit case, +about 5%-10% on all platforms. Nodes are now 20 bytes for the 32-bit +case, and 32 bytes for the 64-bit case. -Optimized several internal data structures to reduce object size on 64-bit +Optimized several internal data structures to reduce object size on 64- +bit platforms by packing data within the 64-bit alignment. This includes the frequently used ACPI_OPERAND_OBJECT, of which there can be ~1000 static instances corresponding to the namespace objects. -Added two new strings for the predefined _OSI method: "Windows 2001.1 SP1" +Added two new strings for the predefined _OSI method: "Windows 2001.1 +SP1" and "Windows 2006". Split the allocation tracking mechanism out to a separate file, from @@ -3153,13 +7353,17 @@ application-level code. Kernels may wish to not include uttrack.c in distributions. -Removed all remnants of the obsolete ACPI_REPORT_* macros and the associated +Removed all remnants of the obsolete ACPI_REPORT_* macros and the +associated code. (These macros have been replaced by the ACPI_ERROR and ACPI_WARNING macros.) -Code and Data Size: These are the sizes for the acpica.lib produced by the -Microsoft Visual C++ 6.0 32-bit compiler. The values do not include any ACPI -driver or OSPM code. The debug version of the code includes the debug output +Code and Data Size: These are the sizes for the acpica.lib produced by +the +Microsoft Visual C++ 6.0 32-bit compiler. The values do not include any +ACPI +driver or OSPM code. The debug version of the code includes the debug +output trace mechanism and has a much larger code and data size. Note that these values will vary depending on the efficiency of the compiler and the compiler options used during generation. @@ -3174,7 +7378,8 @@ 2) iASL Compiler/Disassembler and Tools: -Implemented an ANSI C version of the acpixtract utility. This version will +Implemented an ANSI C version of the acpixtract utility. This version +will automatically extract the DSDT and all SSDTs from the input acpidump text file and dump the binary output to separate files. It can also display a summary of the input file including the headers for each table found and @@ -3187,32 +7392,41 @@ 1) ACPI CA Core Subsystem: Tagged all external interfaces to the subsystem with the new -ACPI_EXPORT_SYMBOL macro. This macro can be defined as necessary to assist +ACPI_EXPORT_SYMBOL macro. This macro can be defined as necessary to +assist kernel integration. For Linux, the macro resolves to the EXPORT_SYMBOL macro. The default definition is NULL. -Added the ACPI_THREAD_ID type for the return value from AcpiOsGetThreadId. +Added the ACPI_THREAD_ID type for the return value from +AcpiOsGetThreadId. This allows the host to define this as necessary to simplify kernel integration. The default definition is ACPI_NATIVE_UINT. -Fixed two interpreter problems related to error processing, the deletion of +Fixed two interpreter problems related to error processing, the deletion +of objects, and placing invalid pointers onto the internal operator result stack. BZ 6028, 6151 (Valery Podrezov) -Increased the reference count threshold where a warning is emitted for large -reference counts in order to eliminate unnecessary warnings on systems with +Increased the reference count threshold where a warning is emitted for +large +reference counts in order to eliminate unnecessary warnings on systems +with large namespaces (especially 64-bit.) Increased the value from 0x400 to 0x800. -Due to universal disagreement as to the meaning of the 'c' in the calloc() +Due to universal disagreement as to the meaning of the 'c' in the +calloc() function, the ACPI_MEM_CALLOCATE macro has been renamed to ACPI_ALLOCATE_ZEROED so that the purpose of the interface is 'clear'. ACPI_MEM_ALLOCATE and ACPI_MEM_FREE are renamed to ACPI_ALLOCATE and ACPI_FREE. -Code and Data Size: These are the sizes for the acpica.lib produced by the -Microsoft Visual C++ 6.0 32-bit compiler. The values do not include any ACPI -driver or OSPM code. The debug version of the code includes the debug output +Code and Data Size: These are the sizes for the acpica.lib produced by +the +Microsoft Visual C++ 6.0 32-bit compiler. The values do not include any +ACPI +driver or OSPM code. The debug version of the code includes the debug +output trace mechanism and has a much larger code and data size. Note that these values will vary depending on the efficiency of the compiler and the compiler options used during generation. @@ -3228,23 +7442,30 @@ 2) iASL Compiler/Disassembler: Disassembler: implemented support for symbolic resource descriptor -references. If a CreateXxxxField operator references a fixed offset within a -resource descriptor, a name is assigned to the descriptor and the offset is +references. If a CreateXxxxField operator references a fixed offset +within +a +resource descriptor, a name is assigned to the descriptor and the offset +is translated to the appropriate resource tag and pathname. The addition of this support brings the disassembled code very close to the original ASL -source code and helps eliminate run-time errors when the disassembled code +source code and helps eliminate run-time errors when the disassembled +code is modified (and recompiled) in such a way as to invalidate the original fixed offsets. -Implemented support for a Descriptor Name as the last parameter to the ASL +Implemented support for a Descriptor Name as the last parameter to the +ASL Register() macro. This parameter was inadvertently left out of the ACPI specification, and will be added for ACPI 3.0b. Fixed a problem where the use of the "_OSI" string (versus the full path "\_OSI") caused an internal compiler error. ("No back ptr to op") -Fixed a problem with the error message that occurs when an invalid string is -used for a _HID object (such as one with an embedded asterisk: "*PNP010A".) +Fixed a problem with the error message that occurs when an invalid string +is +used for a _HID object (such as one with an embedded asterisk: +"*PNP010A".) The correct message is now displayed. ---------------------------------------- @@ -3252,9 +7473,12 @@ 1) ACPI CA Core Subsystem: -Implemented a change to the IndexField support to match the behavior of the -Microsoft AML interpreter. The value written to the Index register is now a -byte offset, no longer an index based upon the width of the Data register. +Implemented a change to the IndexField support to match the behavior of +the +Microsoft AML interpreter. The value written to the Index register is now +a +byte offset, no longer an index based upon the width of the Data +register. This should fix IndexField problems seen on some machines where the Data register is not exactly one byte wide. The ACPI specification will be clarified on this point. @@ -3264,12 +7488,16 @@ VendorLong, and Interrupt. This was noticed on IA64 machines, but could affect all platforms. -Fixed a problem where individual resource descriptors were misaligned within +Fixed a problem where individual resource descriptors were misaligned +within the internal buffer, causing alignment faults on IA64 platforms. -Code and Data Size: These are the sizes for the acpica.lib produced by the -Microsoft Visual C++ 6.0 32-bit compiler. The values do not include any ACPI -driver or OSPM code. The debug version of the code includes the debug output +Code and Data Size: These are the sizes for the acpica.lib produced by +the +Microsoft Visual C++ 6.0 32-bit compiler. The values do not include any +ACPI +driver or OSPM code. The debug version of the code includes the debug +output trace mechanism and has a much larger code and data size. Note that these values will vary depending on the efficiency of the compiler and the compiler options used during generation. @@ -3300,36 +7528,47 @@ normal execution. These became apparent after the conversion from ACPI_DEBUG_PRINT. -Fixed a problem where the CreateField operator could hang if the BitIndex or +Fixed a problem where the CreateField operator could hang if the BitIndex +or NumBits parameter referred to a named object. (Valery Podrezov, BZ 5359) Fixed a problem where a DeRefOf operation on a buffer object incorrectly failed with an exception. This also fixes a couple of related RefOf and DeRefOf issues. (Valery Podrezov, BZ 5360/5392/5387) -Fixed a problem where the AE_BUFFER_LIMIT exception was returned instead of -AE_STRING_LIMIT on an out-of-bounds Index() operation. (Valery Podrezov, BZ +Fixed a problem where the AE_BUFFER_LIMIT exception was returned instead +of +AE_STRING_LIMIT on an out-of-bounds Index() operation. (Valery Podrezov, +BZ 5480) -Implemented a memory cleanup at the end of the execution of each iteration -of an AML While() loop, preventing the accumulation of outstanding objects. +Implemented a memory cleanup at the end of the execution of each +iteration +of an AML While() loop, preventing the accumulation of outstanding +objects. (Valery Podrezov, BZ 5427) -Eliminated a chunk of duplicate code in the object resolution code. (Valery +Eliminated a chunk of duplicate code in the object resolution code. +(Valery Podrezov, BZ 5336) Fixed several warnings during the 64-bit code generation. -The AcpiSrc source code conversion tool now inserts one line of whitespace -after an if() statement that is followed immediately by a comment, improving +The AcpiSrc source code conversion tool now inserts one line of +whitespace +after an if() statement that is followed immediately by a comment, +improving readability of the Linux code. Code and Data Size: The current and previous library sizes for the core subsystem are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. These -values do not include any ACPI driver or OSPM code. The debug version of the +acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. +These +values do not include any ACPI driver or OSPM code. The debug version of +the code includes the debug output trace mechanism and has a much larger code -and data size. Note that these values will vary depending on the efficiency +and data size. Note that these values will vary depending on the +efficiency of the compiler and the compiler options used during generation. Previous Release: @@ -3342,7 +7581,8 @@ 2) iASL Compiler/Disassembler: -Fixed a problem with the disassembly of a BankField operator with a complex +Fixed a problem with the disassembly of a BankField operator with a +complex expression for the BankValue parameter. ---------------------------------------- @@ -3350,11 +7590,14 @@ 1) ACPI CA Core Subsystem: -Implemented support in the Resource Manager to allow unresolved namestring -references within resource package objects for the _PRT method. This support +Implemented support in the Resource Manager to allow unresolved +namestring +references within resource package objects for the _PRT method. This +support is in addition to the previously implemented unresolved reference support within the AML parser. If the interpreter slack mode is enabled, these -unresolved references will be passed through to the caller as a NULL package +unresolved references will be passed through to the caller as a NULL +package entry. Implemented and deployed new macros and functions for error and warning @@ -3364,16 +7607,19 @@ macros remain defined to allow ACPI drivers time to migrate to the new macros. -Implemented the ACPI_CPU_FLAGS type to simplify host OS integration of the +Implemented the ACPI_CPU_FLAGS type to simplify host OS integration of +the Acquire/Release Lock OSL interfaces. Fixed a problem where Alias ASL operators are sometimes not correctly resolved, in both the interpreter and the iASL compiler. -Fixed several problems with the implementation of the ConcatenateResTemplate +Fixed several problems with the implementation of the +ConcatenateResTemplate ASL operator. As per the ACPI specification, zero length buffers are now treated as a single EndTag. One-length buffers always cause a fatal -exception. Non-zero length buffers that do not end with a full 2-byte EndTag +exception. Non-zero length buffers that do not end with a full 2-byte +EndTag cause a fatal exception. Fixed a possible structure overwrite in the AcpiGetObjectInfo external @@ -3381,10 +7627,13 @@ Code and Data Size: The current and previous library sizes for the core subsystem are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. These -values do not include any ACPI driver or OSPM code. The debug version of the +acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. +These +values do not include any ACPI driver or OSPM code. The debug version of +the code includes the debug output trace mechanism and has a much larger code -and data size. Note that these values will vary depending on the efficiency +and data size. Note that these values will vary depending on the +efficiency of the compiler and the compiler options used during generation. Previous Release: @@ -3397,7 +7646,8 @@ 2) iASL Compiler/Disassembler: -Fixed an internal error that was generated for any forward references to ASL +Fixed an internal error that was generated for any forward references to +ASL Alias objects. ---------------------------------------- @@ -3409,18 +7659,24 @@ virtually every file in the ACPICA core subsystem, iASL compiler, and the utilities. -Enhanced the ACPICA error reporting in order to simplify user migration to +Enhanced the ACPICA error reporting in order to simplify user migration +to the non-debug version of ACPICA. Replaced all instances of the -ACPI_DEBUG_PRINT macro invoked at the ACPI_DB_ERROR and ACPI_DB_WARN debug +ACPI_DEBUG_PRINT macro invoked at the ACPI_DB_ERROR and ACPI_DB_WARN +debug levels with the ACPI_REPORT_ERROR and ACPI_REPORT_WARNING macros, -respectively. This preserves all error and warning messages in the non-debug +respectively. This preserves all error and warning messages in the non- +debug version of the ACPICA code (this has been referred to as the "debug lite" option.) Over 200 cases were converted to create a total of over 380 -error/warning messages across the ACPICA code. This increases the code and -data size of the default non-debug version of the code somewhat (about 13K), +error/warning messages across the ACPICA code. This increases the code +and +data size of the default non-debug version of the code somewhat (about +13K), but all error/warning reporting may be disabled if desired (and code eliminated) by specifying the ACPI_NO_ERROR_MESSAGES compile-time -configuration option. The size of the debug version of ACPICA remains about +configuration option. The size of the debug version of ACPICA remains +about the same. Fixed a memory leak within the AML Debugger "Set" command. One object was @@ -3428,10 +7684,13 @@ Code and Data Size: The current and previous library sizes for the core subsystem are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. These -values do not include any ACPI driver or OSPM code. The debug version of the +acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. +These +values do not include any ACPI driver or OSPM code. The debug version of +the code includes the debug output trace mechanism and has a much larger code -and data size. Note that these values will vary depending on the efficiency +and data size. Note that these values will vary depending on the +efficiency of the compiler and the compiler options used during generation. Previous Release: @@ -3445,7 +7704,8 @@ 2) iASL Compiler/Disassembler: The compiler now officially supports the ACPI 3.0a specification that was -released on December 30, 2005. (Specification is available at www.acpi.info) +released on December 30, 2005. (Specification is available at +www.acpi.info) ---------------------------------------- 16 December 2005. Summary of changes for version 20051216: @@ -3455,18 +7715,25 @@ Implemented optional support to allow unresolved names within ASL Package objects. A null object is inserted in the package when a named reference cannot be located in the current namespace. Enabled via the interpreter -slack flag, this should eliminate AE_NOT_FOUND exceptions seen on machines +slack flag, this should eliminate AE_NOT_FOUND exceptions seen on +machines that contain such code. -Implemented an optimization to the initialization sequence that can improve -boot time. During ACPI device initialization, the _STA method is now run if -and only if the _INI method exists. The _STA method is used to determine if -the device is present; An _INI can only be run if _STA returns present, but +Implemented an optimization to the initialization sequence that can +improve +boot time. During ACPI device initialization, the _STA method is now run +if +and only if the _INI method exists. The _STA method is used to determine +if +the device is present; An _INI can only be run if _STA returns present, +but it is a waste of time to run the _STA method if the _INI does not exist. (Prototype and assistance from Dong Wei) -Implemented use of the C99 uintptr_t for the pointer casting macros if it is -available in the current compiler. Otherwise, the default (void *) cast is +Implemented use of the C99 uintptr_t for the pointer casting macros if it +is +available in the current compiler. Otherwise, the default (void *) cast +is used as before. Fixed some possible memory leaks found within the execution path of the @@ -3480,7 +7747,8 @@ disassembler and AML debugger to the common utilities directory so that these components are independent. -Implemented support in the AcpiExec utility (-e switch) to globally ignore +Implemented support in the AcpiExec utility (-e switch) to globally +ignore exceptions during control method execution (method is not aborted.) Added the rsinfo.c source file to the AcpiExec makefile for Linux/Unix @@ -3488,10 +7756,13 @@ Code and Data Size: The current and previous library sizes for the core subsystem are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. These -values do not include any ACPI driver or OSPM code. The debug version of the +acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. +These +values do not include any ACPI driver or OSPM code. The debug version of +the code includes the debug output trace mechanism and has a much larger code -and data size. Note that these values will vary depending on the efficiency +and data size. Note that these values will vary depending on the +efficiency of the compiler and the compiler options used during generation. Previous Release: @@ -3504,7 +7775,8 @@ 2) iASL Compiler/Disassembler: -Fixed a problem where a CPU stack overflow fault could occur if a recursive +Fixed a problem where a CPU stack overflow fault could occur if a +recursive method call was made from within a Return statement. ---------------------------------------- @@ -3514,18 +7786,25 @@ Modified the parsing of control methods to no longer create namespace objects during the first pass of the parse. Objects are now created only -during the execute phase, at the moment the namespace creation operator is -encountered in the AML (Name, OperationRegion, CreateByteField, etc.) This +during the execute phase, at the moment the namespace creation operator +is +encountered in the AML (Name, OperationRegion, CreateByteField, etc.) +This should eliminate ALREADY_EXISTS exceptions seen on some machines where -reentrant control methods are protected by an AML mutex. The mutex will now -correctly block multiple threads from attempting to create the same object +reentrant control methods are protected by an AML mutex. The mutex will +now +correctly block multiple threads from attempting to create the same +object more than once. Increased the number of available Owner Ids for namespace object tracking -from 32 to 255. This should eliminate the OWNER_ID_LIMIT exceptions seen on -some machines with a large number of ACPI tables (either static or dynamic). +from 32 to 255. This should eliminate the OWNER_ID_LIMIT exceptions seen +on +some machines with a large number of ACPI tables (either static or +dynamic). -Fixed a problem with the AcpiExec utility where a fault could occur when the +Fixed a problem with the AcpiExec utility where a fault could occur when +the -b switch (batch mode) is used. Enhanced the namespace dump routine to output the owner ID for each @@ -3533,10 +7812,13 @@ Code and Data Size: The current and previous library sizes for the core subsystem are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. These -values do not include any ACPI driver or OSPM code. The debug version of the +acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. +These +values do not include any ACPI driver or OSPM code. The debug version of +the code includes the debug output trace mechanism and has a much larger code -and data size. Note that these values will vary depending on the efficiency +and data size. Note that these values will vary depending on the +efficiency of the compiler and the compiler options used during generation. Previous Release: @@ -3549,8 +7831,10 @@ 2) iASL Compiler/Disassembler: -Fixed a parse error during compilation of certain Switch/Case constructs. To -simplify the parse, the grammar now allows for multiple Default statements +Fixed a parse error during compilation of certain Switch/Case constructs. +To +simplify the parse, the grammar now allows for multiple Default +statements and this error is now detected and flagged during the analysis phase. Disassembler: The disassembly now includes the contents of the original @@ -3563,32 +7847,43 @@ 1) ACPI CA Core Subsystem: Fixed a problem in the AML parser where the method thread count could be -decremented below zero if any errors occurred during the method parse phase. -This should eliminate AE_AML_METHOD_LIMIT exceptions seen on some machines. +decremented below zero if any errors occurred during the method parse +phase. +This should eliminate AE_AML_METHOD_LIMIT exceptions seen on some +machines. This also fixed a related regression with the mechanism that detects and corrects methods that cannot properly handle reentrancy (related to the deployment of the new OwnerId mechanism.) Eliminated the pre-parsing of control methods (to detect errors) during -table load. Related to the problem above, this was causing unwind issues if -any errors occurred during the parse, and it seemed to be overkill. A table +table load. Related to the problem above, this was causing unwind issues +if +any errors occurred during the parse, and it seemed to be overkill. A +table load should not be aborted if there are problems with any single control method, thus rendering this feature rather pointless. -Fixed a problem with the new table-driven resource manager where an internal +Fixed a problem with the new table-driven resource manager where an +internal buffer overflow could occur for small resource templates. -Implemented a new external interface, AcpiGetVendorResource. This interface -will find and return a vendor-defined resource descriptor within a _CRS or -_PRS method via an ACPI 3.0 UUID match. With assistance from Bjorn Helgaas. +Implemented a new external interface, AcpiGetVendorResource. This +interface +will find and return a vendor-defined resource descriptor within a _CRS +or +_PRS method via an ACPI 3.0 UUID match. With assistance from Bjorn +Helgaas. Removed the length limit (200) on string objects as per the upcoming ACPI -3.0A specification. This affects the following areas of the interpreter: 1) -any implicit conversion of a Buffer to a String, 2) a String object result +3.0A specification. This affects the following areas of the interpreter: +1) +any implicit conversion of a Buffer to a String, 2) a String object +result of the ASL Concatentate operator, 3) the String object result of the ASL ToString operator. -Fixed a problem in the Windows OS interface layer (OSL) where a WAIT_FOREVER +Fixed a problem in the Windows OS interface layer (OSL) where a +WAIT_FOREVER on a semaphore object would incorrectly timeout. This allows the multithreading features of the AcpiExec utility to work properly under Windows. @@ -3598,10 +7893,13 @@ Code and Data Size: The current and previous library sizes for the core subsystem are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. These -values do not include any ACPI driver or OSPM code. The debug version of the +acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. +These +values do not include any ACPI driver or OSPM code. The debug version of +the code includes the debug output trace mechanism and has a much larger code -and data size. Note that these values will vary depending on the efficiency +and data size. Note that these values will vary depending on the +efficiency of the compiler and the compiler options used during generation. Previous Release: @@ -3615,15 +7913,18 @@ 2) iASL Compiler/Disassembler: Removed the limit (200) on string objects as per the upcoming ACPI 3.0A -specification. For the iASL compiler, this means that string literals within +specification. For the iASL compiler, this means that string literals +within the source ASL can be of any length. Enhanced the listing output to dump the AML code for resource descriptors -immediately after the ASL code for each descriptor, instead of in a block at +immediately after the ASL code for each descriptor, instead of in a block +at the end of the entire resource template. Enhanced the compiler debug output to dump the entire original parse tree -constructed during the parse phase, before any transforms are applied to the +constructed during the parse phase, before any transforms are applied to +the tree. The transformed tree is dumped also. ---------------------------------------- @@ -3631,34 +7932,45 @@ 1) ACPI CA Core Subsystem: -Modified the subsystem initialization sequence to improve GPE support. The -GPE initialization has been split into two parts in order to defer execution -of the _PRW methods (Power Resources for Wake) until after the hardware is +Modified the subsystem initialization sequence to improve GPE support. +The +GPE initialization has been split into two parts in order to defer +execution +of the _PRW methods (Power Resources for Wake) until after the hardware +is fully initialized and the SCI handler is installed. This allows the _PRW -methods to access fields protected by the Global Lock. This will fix systems +methods to access fields protected by the Global Lock. This will fix +systems where a NO_GLOBAL_LOCK exception has been seen during initialization. -Converted the ACPI internal object disassemble and display code within the +Converted the ACPI internal object disassemble and display code within +the AML debugger to fully table-driven operation, reducing code size and increasing maintainability. -Fixed a regression with the ConcatenateResTemplate() ASL operator introduced +Fixed a regression with the ConcatenateResTemplate() ASL operator +introduced in the 20051021 release. Implemented support for "local" internal ACPI object types within the debugger "Object" command and the AcpiWalkNamespace external interfaces. -These local types include RegionFields, BankFields, IndexFields, Alias, and +These local types include RegionFields, BankFields, IndexFields, Alias, +and reference objects. -Moved common AML resource handling code into a new file, "utresrc.c". This +Moved common AML resource handling code into a new file, "utresrc.c". +This code is shared by both the Resource Manager and the AML Debugger. Code and Data Size: The current and previous library sizes for the core subsystem are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. These -values do not include any ACPI driver or OSPM code. The debug version of the +acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. +These +values do not include any ACPI driver or OSPM code. The debug version of +the code includes the debug output trace mechanism and has a much larger code -and data size. Note that these values will vary depending on the efficiency +and data size. Note that these values will vary depending on the +efficiency of the compiler and the compiler options used during generation. Previous Release: @@ -3671,20 +7983,26 @@ 2) iASL Compiler/Disassembler: -Fixed a problem with very large initializer lists (more than 4000 elements) +Fixed a problem with very large initializer lists (more than 4000 +elements) for both Buffer and Package objects where the parse stack could overflow. -Enhanced the pre-compile source code scan for non-ASCII characters to ignore -characters within comment fields. The scan is now always performed and is no +Enhanced the pre-compile source code scan for non-ASCII characters to +ignore +characters within comment fields. The scan is now always performed and is +no longer optional, detecting invalid characters within a source file immediately rather than during the parse phase or later. -Enhanced the ASL grammar definition to force early reductions on all list- +Enhanced the ASL grammar definition to force early reductions on all +list- style grammar elements so that the overall parse stack usage is greatly -reduced. This should improve performance and reduce the possibility of parse +reduced. This should improve performance and reduce the possibility of +parse stack overflow. -Eliminated all reduce/reduce conflicts in the iASL parser generation. Also, +Eliminated all reduce/reduce conflicts in the iASL parser generation. +Also, with the addition of a %expected statement, the compiler generates from source with no warnings. @@ -3704,27 +8022,34 @@ Completed conversion of the Resource Manager to nearly full table-driven operation. Specifically, the resource conversion code (convert AML to internal format and the reverse) and the debug code to dump internal -resource descriptors are fully table-driven, reducing code and data size and +resource descriptors are fully table-driven, reducing code and data size +and improving maintainability. -The OSL interfaces for Acquire and Release Lock now use a 64-bit flag word -on 64-bit processors instead of a fixed 32-bit word. (With assistance from +The OSL interfaces for Acquire and Release Lock now use a 64-bit flag +word +on 64-bit processors instead of a fixed 32-bit word. (With assistance +from Alexey Starikovskiy) Implemented support within the resource conversion code for the Type- Specific byte within the various ACPI 3.0 *WordSpace macros. -Fixed some issues within the resource conversion code for the type-specific +Fixed some issues within the resource conversion code for the type- +specific flags for both Memory and I/O address resource descriptors. For Memory, implemented support for the MTP and TTP flags. For I/O, split the TRS and TTP flags into two separate fields. Code and Data Size: The current and previous library sizes for the core subsystem are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. These -values do not include any ACPI driver or OSPM code. The debug version of the +acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. +These +values do not include any ACPI driver or OSPM code. The debug version of +the code includes the debug output trace mechanism and has a much larger code -and data size. Note that these values will vary depending on the efficiency +and data size. Note that these values will vary depending on the +efficiency of the compiler and the compiler options used during generation. Previous Release: @@ -3738,23 +8063,29 @@ 2) iASL Compiler/Disassembler: -Relaxed a compiler restriction that disallowed a ResourceIndex byte if the +Relaxed a compiler restriction that disallowed a ResourceIndex byte if +the corresponding ResourceSource string was not also present in a resource descriptor declaration. This restriction caused problems with existing -AML/ASL code that includes the Index byte without the string. When such AML +AML/ASL code that includes the Index byte without the string. When such +AML was disassembled, it could not be compiled without modification. Further, -the modified code created a resource template with a different size than the -original, breaking code that used fixed offsets into the resource template +the modified code created a resource template with a different size than +the +original, breaking code that used fixed offsets into the resource +template buffer. -Removed a recent feature of the disassembler to ignore a lone ResourceIndex +Removed a recent feature of the disassembler to ignore a lone +ResourceIndex byte. This byte is now emitted if present so that the exact AML can be reproduced when the disassembled code is recompiled. Improved comments and text alignment for the resource descriptor code emitted by the disassembler. -Implemented disassembler support for the ACPI 3.0 AccessSize field within a +Implemented disassembler support for the ACPI 3.0 AccessSize field within +a Register() resource descriptor. ---------------------------------------- @@ -3763,10 +8094,13 @@ 1) ACPI CA Core Subsystem: Completed a major overhaul of the Resource Manager code - specifically, -optimizations in the area of the AML/internal resource conversion code. The -code has been optimized to simplify and eliminate duplicated code, CPU stack +optimizations in the area of the AML/internal resource conversion code. +The +code has been optimized to simplify and eliminate duplicated code, CPU +stack use has been decreased by optimizing function parameters and local -variables, and naming conventions across the manager have been standardized +variables, and naming conventions across the manager have been +standardized for clarity and ease of maintenance (this includes function, parameter, variable, and struct/typedef names.) The update may force changes in some driver code, depending on how resources are handled by the host OS. @@ -3776,15 +8110,20 @@ created, named "rsinfo.c". The ACPI return macros (return_ACPI_STATUS, etc.) have been modified to -guarantee that the argument is not evaluated twice, making them less prone +guarantee that the argument is not evaluated twice, making them less +prone to macro side-effects. However, since there exists the possibility of -additional stack use if a particular compiler cannot optimize them (such as -in the debug generation case), the original macros are optionally available. +additional stack use if a particular compiler cannot optimize them (such +as +in the debug generation case), the original macros are optionally +available. Note that some invocations of the return_VALUE macro may now cause size -mismatch warnings; the return_UINT8 and return_UINT32 macros are provided to +mismatch warnings; the return_UINT8 and return_UINT32 macros are provided +to eliminate these. (From Randy Dunlap) -Implemented a new mechanism to enable debug tracing for individual control +Implemented a new mechanism to enable debug tracing for individual +control methods. A new external interface, AcpiDebugTrace, is provided to enable this mechanism. The intent is to allow the host OS to easily enable and disable tracing for problematic control methods. This interface can be @@ -3797,10 +8136,13 @@ Code and Data Size: The current and previous library sizes for the core subsystem are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. These -values do not include any ACPI driver or OSPM code. The debug version of the +acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. +These +values do not include any ACPI driver or OSPM code. The debug version of +the code includes the debug output trace mechanism and has a much larger code -and data size. Note that these values will vary depending on the efficiency +and data size. Note that these values will vary depending on the +efficiency of the compiler and the compiler options used during generation. Previous Release: @@ -3822,11 +8164,13 @@ 1) ACPI CA Core Subsystem: Fixed a problem within the Resource Manager where support for the Generic -Register descriptor was not fully implemented. This descriptor is now fully +Register descriptor was not fully implemented. This descriptor is now +fully recognized, parsed, disassembled, and displayed. Completely restructured the Resource Manager code to utilize table-driven -dispatch and lookup, eliminating many of the large switch() statements. This +dispatch and lookup, eliminating many of the large switch() statements. +This reduces overall subsystem code size and code complexity. Affects the resource parsing and construction, disassembly, and debug dump output. @@ -3838,10 +8182,13 @@ Code and Data Size: The current and previous library sizes for the core subsystem are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. These -values do not include any ACPI driver or OSPM code. The debug version of the +acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. +These +values do not include any ACPI driver or OSPM code. The debug version of +the code includes the debug output trace mechanism and has a much larger code -and data size. Note that these values will vary depending on the efficiency +and data size. Note that these values will vary depending on the +efficiency of the compiler and the compiler options used during generation. Previous Release: @@ -3854,12 +8201,14 @@ 2) iASL Compiler/Disassembler: -Updated the disassembler to automatically insert an EndDependentFn() macro +Updated the disassembler to automatically insert an EndDependentFn() +macro into the ASL stream if this macro is missing in the original AML code, simplifying compilation of the resulting ASL module. Fixed a problem in the disassembler where a disassembled ResourceSource -string (within a large resource descriptor) was not surrounded by quotes and +string (within a large resource descriptor) was not surrounded by quotes +and not followed by a comma, causing errors when the resulting ASL module was compiled. Also, escape sequences within a ResourceSource string are now handled correctly (especially "\\") @@ -3876,15 +8225,18 @@ currently limited to 255. (Alexey Starikovskiy) Completely eliminated all vestiges of support for the "module-level -executable code" until this support is fully implemented and debugged. This +executable code" until this support is fully implemented and debugged. +This should eliminate the NO_RETURN_VALUE exceptions seen during table load on some systems that invoke this support. -Fixed a problem within the resource manager code where the transaction flags +Fixed a problem within the resource manager code where the transaction +flags for a 64-bit address descriptor were handled incorrectly in the type- specific flag byte. -Consolidated duplicate code within the address descriptor resource manager +Consolidated duplicate code within the address descriptor resource +manager code, reducing overall subsystem code size. Fixed a fault when using the AML debugger "disassemble" command to @@ -3896,9 +8248,12 @@ Code and Data Size: The current and previous core subsystem library sizes are shown below. These are the code and data sizes for the acpica.lib produced by the Microsoft Visual C++ 6.0 compiler. These values do not -include any ACPI driver or OSPM code. The debug version of the code includes -the debug output trace mechanism and has a much larger code and data size. -Note that these values will vary depending on the efficiency of the compiler +include any ACPI driver or OSPM code. The debug version of the code +includes +the debug output trace mechanism and has a much larger code and data +size. +Note that these values will vary depending on the efficiency of the +compiler and the compiler options used during generation. Previous Release: @@ -3911,11 +8266,13 @@ 2) iASL Compiler/Disassembler: -Implemented an error check for illegal duplicate values in the interrupt and +Implemented an error check for illegal duplicate values in the interrupt +and dma lists for the following ASL macros: Dma(), Irq(), IrqNoFlags(), and Interrupt(). -Implemented error checking for the Irq() and IrqNoFlags() macros to detect +Implemented error checking for the Irq() and IrqNoFlags() macros to +detect too many values in the interrupt list (16 max) and invalid values in the list (range 0 - 15) @@ -3932,20 +8289,26 @@ 1) ACPI CA Core Subsystem: -Implemented a full bytewise compare to determine if a table load request is -attempting to load a duplicate table. The compare is performed if the table +Implemented a full bytewise compare to determine if a table load request +is +attempting to load a duplicate table. The compare is performed if the +table signatures and table lengths match. This will allow different tables with -the same OEM Table ID and revision to be loaded - probably against the ACPI +the same OEM Table ID and revision to be loaded - probably against the +ACPI specification, but discovered in the field nonetheless. Added the changes.txt logfile to each of the zipped release packages. Code and Data Size: Current and previous core subsystem library sizes are -shown below. These are the code and data sizes for the acpica.lib produced +shown below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these values do not include any ACPI driver or OSPM code. The debug version of the code includes the -debug output trace mechanism and has a much larger code and data size. Note -that these values will vary depending on the efficiency of the compiler and +debug output trace mechanism and has a much larger code and data size. +Note +that these values will vary depending on the efficiency of the compiler +and the compiler options used during generation. Previous Release: @@ -3962,7 +8325,8 @@ objects if optimization is disabled (via the -oa switch). Fixed a problem with where incorrect AML code is generated for variable- -length packages when the package length is not specified and the number of +length packages when the package length is not specified and the number +of initializer values is greater than 255. @@ -3971,37 +8335,48 @@ 1) ACPI CA Core Subsystem: -Implemented support to ignore an attempt to install/load a particular ACPI +Implemented support to ignore an attempt to install/load a particular +ACPI table more than once. Apparently there exists BIOS code that repeatedly attempts to load the same SSDT upon certain events. With assistance from Venkatesh Pallipadi. Restructured the main interface to the AML parser in order to correctly -handle all exceptional conditions. This will prevent leakage of the OwnerId -resource and should eliminate the AE_OWNER_ID_LIMIT exceptions seen on some +handle all exceptional conditions. This will prevent leakage of the +OwnerId +resource and should eliminate the AE_OWNER_ID_LIMIT exceptions seen on +some machines. With assistance from Alexey Starikovskiy. -Support for "module level code" has been disabled in this version due to a -number of issues that have appeared on various machines. The support can be +Support for "module level code" has been disabled in this version due to +a +number of issues that have appeared on various machines. The support can +be enabled by defining ACPI_ENABLE_MODULE_LEVEL_CODE during subsystem -compilation. When the issues are fully resolved, the code will be enabled by +compilation. When the issues are fully resolved, the code will be enabled +by default again. Modified the internal functions for debug print support to define the -FunctionName parameter as a (const char *) for compatibility with compiler +FunctionName parameter as a (const char *) for compatibility with +compiler built-in macros such as __FUNCTION__, etc. Linted the entire ACPICA source tree for both 32-bit and 64-bit. -Implemented support to display an object count summary for the AML Debugger +Implemented support to display an object count summary for the AML +Debugger commands Object and Methods. Code and Data Size: Current and previous core subsystem library sizes are -shown below. These are the code and data sizes for the acpica.lib produced +shown below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these values do not include any ACPI driver or OSPM code. The debug version of the code includes the -debug output trace mechanism and has a much larger code and data size. Note -that these values will vary depending on the efficiency of the compiler and +debug output trace mechanism and has a much larger code and data size. +Note +that these values will vary depending on the efficiency of the compiler +and the compiler options used during generation. Previous Release: @@ -4015,7 +8390,8 @@ 2) iASL Compiler/Disassembler: Fixed a regression that appeared in the 20050708 version of the compiler -where an error message was inadvertently emitted for invocations of the _OSI +where an error message was inadvertently emitted for invocations of the +_OSI reserved control method. ---------------------------------------- @@ -4027,45 +8403,60 @@ considerably reduced. Previously, a debug structure was declared in every function that used the debug macros. This structure has been removed in favor of declaring the individual elements as parameters to the debug -functions. This reduces the cumulative stack use during nested execution of -ACPI function calls at the cost of a small increase in the code size of the -debug version of the subsystem. With assistance from Alexey Starikovskiy and +functions. This reduces the cumulative stack use during nested execution +of +ACPI function calls at the cost of a small increase in the code size of +the +debug version of the subsystem. With assistance from Alexey Starikovskiy +and Len Brown. Added the ACPI_GET_FUNCTION_NAME macro to enable the compiler-dependent headers to define a macro that will return the current function name at -runtime (such as __FUNCTION__ or _func_, etc.) The function name is used by +runtime (such as __FUNCTION__ or _func_, etc.) The function name is used +by the debug trace output. If ACPI_GET_FUNCTION_NAME is not defined in the -compiler-dependent header, the function name is saved on the CPU stack (one +compiler-dependent header, the function name is saved on the CPU stack +(one pointer per function.) This mechanism is used because apparently there -exists no standard ANSI-C defined macro that that returns the function name. +exists no standard ANSI-C defined macro that that returns the function +name. Redesigned and reimplemented the "Owner ID" mechanism used to track namespace objects created/deleted by ACPI tables and control method -execution. A bitmap is now used to allocate and free the IDs, thus solving -the wraparound problem present in the previous implementation. The size of +execution. A bitmap is now used to allocate and free the IDs, thus +solving +the wraparound problem present in the previous implementation. The size +of the namespace node descriptor was reduced by 2 bytes as a result (Alexey Starikovskiy). -Removed the UINT32_BIT and UINT16_BIT types that were used for the bitfield +Removed the UINT32_BIT and UINT16_BIT types that were used for the +bitfield flag definitions within the headers for the predefined ACPI tables. These -have been replaced by UINT8_BIT in order to increase the code portability of +have been replaced by UINT8_BIT in order to increase the code portability +of the subsystem. If the use of UINT8 remains a problem, we may be forced to eliminate bitfields entirely because of a lack of portability. -Enhanced the performance of the AcpiUtUpdateObjectReference procedure. This -is a frequently used function and this improvement increases the performance +Enhanced the performance of the AcpiUtUpdateObjectReference procedure. +This +is a frequently used function and this improvement increases the +performance of the entire subsystem (Alexey Starikovskiy). Fixed several possible memory leaks and the inverse - premature object deletion (Alexey Starikovskiy). Code and Data Size: Current and previous core subsystem library sizes are -shown below. These are the code and data sizes for the acpica.lib produced +shown below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these values do not include any ACPI driver or OSPM code. The debug version of the code includes the -debug output trace mechanism and has a much larger code and data size. Note -that these values will vary depending on the efficiency of the compiler and +debug output trace mechanism and has a much larger code and data size. +Note +that these values will vary depending on the efficiency of the compiler +and the compiler options used during generation. Previous Release: @@ -4081,7 +8472,8 @@ 1) ACPI CA Core Subsystem: Modified the new OSL cache interfaces to use ACPI_CACHE_T as the type for -the host-defined cache object. This allows the OSL implementation to define +the host-defined cache object. This allows the OSL implementation to +define and type this object in any manner desired, simplifying the OSL implementation. For example, ACPI_CACHE_T is defined as kmem_cache_t for Linux, and should be defined in the OS-specific header file for other @@ -4093,21 +8485,28 @@ interface in the first place. AcpiOsAcquireObject is now similar to the AcpiOsAllocate interface. -Implemented a new AML debugger command named Businfo. This command displays -information about all devices that have an associate _PRT object. The _ADR, +Implemented a new AML debugger command named Businfo. This command +displays +information about all devices that have an associate _PRT object. The +_ADR, _HID, _UID, and _CID are displayed for these devices. -Modified the initialization sequence in AcpiInitializeSubsystem to call the -OSL interface AcpiOslInitialize first, before any local initialization. This +Modified the initialization sequence in AcpiInitializeSubsystem to call +the +OSL interface AcpiOslInitialize first, before any local initialization. +This change was required because the global initialization now calls OSL interfaces. -Enhanced the Dump command to display the entire contents of Package objects +Enhanced the Dump command to display the entire contents of Package +objects (including all sub-objects and their values.) Restructured the code base to split some files because of size and/or -because the code logically belonged in a separate file. New files are listed -below. All makefiles and project files included in the ACPI CA release have +because the code logically belonged in a separate file. New files are +listed +below. All makefiles and project files included in the ACPI CA release +have been updated. utilities/utcache.c /* Local cache interfaces */ utilities/utmutex.c /* Local mutex support */ @@ -4115,11 +8514,14 @@ interpreter/parser/psloop.c /* Main AML parse loop */ Code and Data Size: Current and previous core subsystem library sizes are -shown below. These are the code and data sizes for the acpica.lib produced +shown below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these values do not include any ACPI driver or OSPM code. The debug version of the code includes the -debug output trace mechanism and has a much larger code and data size. Note -that these values will vary depending on the efficiency of the compiler and +debug output trace mechanism and has a much larger code and data size. +Note +that these values will vary depending on the efficiency of the compiler +and the compiler options used during generation. Previous Release: @@ -4132,7 +8534,8 @@ 2) iASL Compiler/Disassembler: -Fixed a regression introduced in version 20050513 where the use of a Package +Fixed a regression introduced in version 20050513 where the use of a +Package object within a Case() statement caused a compile time exception. The original behavior has been restored (a Match() operator is emitted.) @@ -4141,10 +8544,13 @@ 1) ACPI CA Core Subsystem: -Moved the object cache operations into the OS interface layer (OSL) to allow +Moved the object cache operations into the OS interface layer (OSL) to +allow the host OS to handle these operations if desired (for example, the Linux -OSL will invoke the slab allocator). This support is optional; the compile -time define ACPI_USE_LOCAL_CACHE may be used to utilize the original cache +OSL will invoke the slab allocator). This support is optional; the +compile +time define ACPI_USE_LOCAL_CACHE may be used to utilize the original +cache code in the ACPI CA core. The new OSL interfaces are shown below. See utalloc.c for an example implementation, and acpiosxf.h for the exact interface definitions. With assistance from Alexey Starikovskiy. @@ -4154,44 +8560,59 @@ AcpiOsAcquireObject AcpiOsReleaseObject -Modified the interfaces to AcpiOsAcquireLock and AcpiOsReleaseLock to return +Modified the interfaces to AcpiOsAcquireLock and AcpiOsReleaseLock to +return and restore a flags parameter. This fits better with many OS lock models. Note: the current execution state (interrupt handler or not) is no longer -passed to these interfaces. If necessary, the OSL must determine this state +passed to these interfaces. If necessary, the OSL must determine this +state by itself, a simple and fast operation. With assistance from Alexey Starikovskiy. Fixed a problem in the ACPI table handling where a valid XSDT was assumed -present if the revision of the RSDP was 2 or greater. According to the ACPI +present if the revision of the RSDP was 2 or greater. According to the +ACPI specification, the XSDT is optional in all cases, and the table manager therefore now checks for both an RSDP >=2 and a valid XSDT pointer. -Otherwise, the RSDT pointer is used. Some ACPI 2.0 compliant BIOSs contain +Otherwise, the RSDT pointer is used. Some ACPI 2.0 compliant BIOSs +contain only the RSDT. -Fixed an interpreter problem with the Mid() operator in the case of an input -string where the resulting output string is of zero length. It now correctly +Fixed an interpreter problem with the Mid() operator in the case of an +input +string where the resulting output string is of zero length. It now +correctly returns a valid, null terminated string object instead of a string object with a null pointer. -Fixed a problem with the control method argument handling to allow a store -to an Arg object that already contains an object of type Device. The Device +Fixed a problem with the control method argument handling to allow a +store +to an Arg object that already contains an object of type Device. The +Device object is now correctly overwritten. Previously, an error was returned. -Enhanced the debugger Find command to emit object values in addition to the -found object pathnames. The output format is the same as the dump namespace +Enhanced the debugger Find command to emit object values in addition to +the +found object pathnames. The output format is the same as the dump +namespace command. -Enhanced the debugger Set command. It now has the ability to set the value -of any Named integer object in the namespace (Previously, only method locals +Enhanced the debugger Set command. It now has the ability to set the +value +of any Named integer object in the namespace (Previously, only method +locals and args could be set.) Code and Data Size: Current and previous core subsystem library sizes are -shown below. These are the code and data sizes for the acpica.lib produced +shown below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these values do not include any ACPI driver or OSPM code. The debug version of the code includes the -debug output trace mechanism and has a much larger code and data size. Note -that these values will vary depending on the efficiency of the compiler and +debug output trace mechanism and has a much larger code and data size. +Note +that these values will vary depending on the efficiency of the compiler +and the compiler options used during generation. Previous Release: @@ -4204,15 +8625,18 @@ 2) iASL Compiler/Disassembler: -Fixed a regression in the disassembler where if/else/while constructs were +Fixed a regression in the disassembler where if/else/while constructs +were output incorrectly. This problem was introduced in the previous release (20050526). This problem also affected the single-step disassembly in the debugger. -Fixed a problem where compiling the reserved _OSI method would randomly (but +Fixed a problem where compiling the reserved _OSI method would randomly +(but rarely) produce compile errors. -Enhanced the disassembler to emit compilable code in the face of incorrect +Enhanced the disassembler to emit compilable code in the face of +incorrect AML resource descriptors. If the optional ResourceSourceIndex is present, but the ResourceSource is not, do not emit the ResourceSourceIndex in the disassembly. Otherwise, the resulting code cannot be compiled without @@ -4224,17 +8648,23 @@ 1) ACPI CA Core Subsystem: Implemented support to execute Type 1 and Type 2 AML opcodes appearing at -the module level (not within a control method.) These opcodes are executed -exactly once at the time the table is loaded. This type of code was legal up -until the release of ACPI 2.0B (2002) and is now supported within ACPI CA in -order to provide backwards compatibility with earlier BIOS implementations. +the module level (not within a control method.) These opcodes are +executed +exactly once at the time the table is loaded. This type of code was legal +up +until the release of ACPI 2.0B (2002) and is now supported within ACPI CA +in +order to provide backwards compatibility with earlier BIOS +implementations. This eliminates the "Encountered executable code at module level" warning that was previously generated upon detection of such code. Fixed a problem in the interpreter where an AE_NOT_FOUND exception could inadvertently be generated during the lookup of namespace objects in the -second pass parse of ACPI tables and control methods. It appears that this -problem could occur during the resolution of forward references to namespace +second pass parse of ACPI tables and control methods. It appears that +this +problem could occur during the resolution of forward references to +namespace objects. Added the ACPI_MUTEX_DEBUG #ifdef to the AcpiUtReleaseMutex function, @@ -4247,15 +8677,19 @@ error conditions and error handling control paths. These fixes were suggested by FreeBSD and the Coverity Prevent source code analysis tool. -Added a check for a null RSDT pointer in AcpiGetFirmwareTable (tbxfroot.c) +Added a check for a null RSDT pointer in AcpiGetFirmwareTable +(tbxfroot.c) to prevent a fault in this error case. Code and Data Size: Current and previous core subsystem library sizes are -shown below. These are the code and data sizes for the acpica.lib produced +shown below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these values do not include any ACPI driver or OSPM code. The debug version of the code includes the -debug output trace mechanism and has a much larger code and data size. Note -that these values will vary depending on the efficiency of the compiler and +debug output trace mechanism and has a much larger code and data size. +Note +that these values will vary depending on the efficiency of the compiler +and the compiler options used during generation. Previous Release: @@ -4270,21 +8704,28 @@ Implemented support to allow Type 1 and Type 2 ASL operators to appear at the module level (not within a control method.) These operators will be -executed once at the time the table is loaded. This type of code was legal +executed once at the time the table is loaded. This type of code was +legal up until the release of ACPI 2.0B (2002) and is now supported by the iASL -compiler in order to provide backwards compatibility with earlier BIOS ASL +compiler in order to provide backwards compatibility with earlier BIOS +ASL code. The ACPI integer width (specified via the table revision ID or the -r -override, 32 or 64 bits) is now used internally during compile-time constant +override, 32 or 64 bits) is now used internally during compile-time +constant folding to ensure that constants are truncated to 32 bits if necessary. -Previously, the revision ID value was only emitted in the AML table header. +Previously, the revision ID value was only emitted in the AML table +header. -An error message is now generated for the Mutex and Method operators if the +An error message is now generated for the Mutex and Method operators if +the SyncLevel parameter is outside the legal range of 0 through 15. -Fixed a problem with the Method operator ParameterTypes list handling (ACPI -3.0). Previously, more than 2 types or 2 arguments generated a syntax error. +Fixed a problem with the Method operator ParameterTypes list handling +(ACPI +3.0). Previously, more than 2 types or 2 arguments generated a syntax +error. The actual underlying implementation of method argument typechecking is still under development, however. @@ -4293,39 +8734,50 @@ 1) ACPI CA Core Subsystem: -Implemented support for PCI Express root bridges -- added support for device +Implemented support for PCI Express root bridges -- added support for +device PNP0A08 in the root bridge search within AcpiEvPciConfigRegionSetup. -The interpreter now automatically truncates incoming 64-bit constants to 32 -bits if currently executing out of a 32-bit ACPI table (Revision < 2). This +The interpreter now automatically truncates incoming 64-bit constants to +32 +bits if currently executing out of a 32-bit ACPI table (Revision < 2). +This also affects the iASL compiler constant folding. (Note: as per below, the iASL compiler no longer allows 64-bit constants within 32-bit tables.) Fixed a problem where string and buffer objects with "static" pointers (pointers to initialization data within an ACPI table) were not handled -consistently. The internal object copy operation now always copies the data +consistently. The internal object copy operation now always copies the +data to a newly allocated buffer, regardless of whether the source object is static or not. Fixed a problem with the FromBCD operator where an implicit result -conversion was improperly performed while storing the result to the target +conversion was improperly performed while storing the result to the +target operand. Since this is an "explicit conversion" operator, the implicit conversion should never be performed on the output. Fixed a problem with the CopyObject operator where a copy to an existing -named object did not always completely overwrite the existing object stored -at name. Specifically, a buffer-to-buffer copy did not delete the existing +named object did not always completely overwrite the existing object +stored +at name. Specifically, a buffer-to-buffer copy did not delete the +existing buffer. -Replaced "InterruptLevel" with "InterruptNumber" in all GPE interfaces and +Replaced "InterruptLevel" with "InterruptNumber" in all GPE interfaces +and structs for consistency. Code and Data Size: Current and previous core subsystem library sizes are -shown below. These are the code and data sizes for the acpica.lib produced +shown below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these values do not include any ACPI driver or OSPM code. The debug version of the code includes the -debug output trace mechanism and has a much larger code and data size. Note -that these values will vary depending on the efficiency of the compiler and +debug output trace mechanism and has a much larger code and data size. +Note +that these values will vary depending on the efficiency of the compiler +and the compiler options used during generation. Previous Release: @@ -4338,17 +8790,21 @@ 2) iASL Compiler/Disassembler: -The compiler now emits a warning if an attempt is made to generate a 64-bit -integer constant from within a 32-bit ACPI table (Revision < 2). The integer +The compiler now emits a warning if an attempt is made to generate a 64- +bit +integer constant from within a 32-bit ACPI table (Revision < 2). The +integer is truncated to 32 bits. Fixed a problem with large package objects: if the static length of the package is greater than 255, the "variable length package" opcode is emitted. Previously, this caused an error. This requires an update to the -ACPI spec, since it currently (incorrectly) states that packages larger than +ACPI spec, since it currently (incorrectly) states that packages larger +than 255 elements are not allowed. -The disassembler now correctly handles variable length packages and packages +The disassembler now correctly handles variable length packages and +packages larger than 255 elements. ---------------------------------------- @@ -4360,31 +8816,41 @@ function was still (internally) 32 bits instead of the required 64 bits. This was the Index argument to the Index, Mid, and Match operators. -The "strupr" function is now permanently local (AcpiUtStrupr), since this is +The "strupr" function is now permanently local (AcpiUtStrupr), since this +is not a POSIX-defined function and not present in most kernel-level C -libraries. All references to the C library strupr function have been removed +libraries. All references to the C library strupr function have been +removed from the headers. -Completed the deployment of static functions/prototypes. All prototypes with -the static attribute have been moved from the headers to the owning C file. +Completed the deployment of static functions/prototypes. All prototypes +with +the static attribute have been moved from the headers to the owning C +file. Implemented an extract option (-e) for the AcpiBin utility (AML binary -utility). This option allows the utility to extract individual ACPI tables +utility). This option allows the utility to extract individual ACPI +tables from the output of AcpiDmp. It provides the same functionality of the acpixtract.pl perl script without the worry of setting the correct perl -options. AcpiBin runs on Windows and has not yet been generated/validated in +options. AcpiBin runs on Windows and has not yet been generated/validated +in the Linux/Unix environment (but should be soon). Updated and fixed the table dump option for AcpiBin (-d). This option -converts a single ACPI table to a hex/ascii file, similar to the output of +converts a single ACPI table to a hex/ascii file, similar to the output +of AcpiDmp. Code and Data Size: Current and previous core subsystem library sizes are -shown below. These are the code and data sizes for the acpica.lib produced +shown below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these values do not include any ACPI driver or OSPM code. The debug version of the code includes the -debug output trace mechanism and has a much larger code and data size. Note -that these values will vary depending on the efficiency of the compiler and +debug output trace mechanism and has a much larger code and data size. +Note +that these values will vary depending on the efficiency of the compiler +and the compiler options used during generation. Previous Release: @@ -4397,8 +8863,10 @@ 2) iASL Compiler/Disassembler: -Disassembler fix: Added a check to ensure that the table length found in the -ACPI table header within the input file is not longer than the actual input +Disassembler fix: Added a check to ensure that the table length found in +the +ACPI table header within the input file is not longer than the actual +input file size. This indicates some kind of file or table corruption. ---------------------------------------- @@ -4406,24 +8874,28 @@ 1) ACPI CA Core Subsystem: -An error is now generated if an attempt is made to create a Buffer Field of +An error is now generated if an attempt is made to create a Buffer Field +of length zero (A CreateField with a length operand of zero.) -The interpreter now issues a warning whenever executable code at the module +The interpreter now issues a warning whenever executable code at the +module level is detected during ACPI table load. This will give some idea of the prevalence of this type of code. Implemented support for references to named objects (other than control methods) within package objects. -Enhanced package object output for the debug object. Package objects are now +Enhanced package object output for the debug object. Package objects are +now completely dumped, showing all elements. Enhanced miscellaneous object output for the debug object. Any object can now be written to the debug object (for example, a device object can be written, and the type of the object will be displayed.) -The "static" qualifier has been added to all local functions across both the +The "static" qualifier has been added to all local functions across both +the core subsystem and the iASL compiler. The number of "long" lines (> 80 chars) within the source has been @@ -4437,11 +8909,14 @@ Removed several obsolete functions that were no longer used. Code and Data Size: Current and previous core subsystem library sizes are -shown below. These are the code and data sizes for the acpica.lib produced +shown below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these values do not include any ACPI driver or OSPM code. The debug version of the code includes the -debug output trace mechanism and has a much larger code and data size. Note -that these values will vary depending on the efficiency of the compiler and +debug output trace mechanism and has a much larger code and data size. +Note +that these values will vary depending on the efficiency of the compiler +and the compiler options used during generation. Previous Release: @@ -4456,10 +8931,12 @@ 2) iASL Compiler/Disassembler: Fixed a problem with the resource descriptor generation/support. For the -ResourceSourceIndex and the ResourceSource fields, both must be present, or +ResourceSourceIndex and the ResourceSource fields, both must be present, +or both must be not present - can't have one without the other. -The compiler now returns non-zero from the main procedure if any errors have +The compiler now returns non-zero from the main procedure if any errors +have occurred during the compilation. @@ -4468,56 +8945,74 @@ 1) ACPI CA Core Subsystem: -The string-to-buffer implicit conversion code has been modified again after -a change to the ACPI specification. In order to match the behavior of the -other major ACPI implementation, the target buffer is no longer truncated if +The string-to-buffer implicit conversion code has been modified again +after +a change to the ACPI specification. In order to match the behavior of +the +other major ACPI implementation, the target buffer is no longer truncated +if the source string is smaller than an existing target buffer. This change requires an update to the ACPI spec, and should eliminate the recent AE_AML_BUFFER_LIMIT issues. -The "implicit return" support was rewritten to a new algorithm that solves -the general case. Rather than attempt to determine when a method is about to -exit, the result of every ASL operator is saved momentarily until the very +The "implicit return" support was rewritten to a new algorithm that +solves +the general case. Rather than attempt to determine when a method is about +to +exit, the result of every ASL operator is saved momentarily until the +very next ASL operator is executed. Therefore, no matter how the method exits, there will always be a saved implicit return value. This feature is only -enabled with the AcpiGbl_EnableInterpreterSlack flag, and should eliminate +enabled with the AcpiGbl_EnableInterpreterSlack flag, and should +eliminate AE_AML_NO_RETURN_VALUE errors when enabled. -Implemented implicit conversion support for the predicate (operand) of the -If, Else, and While operators. String and Buffer arguments are automatically +Implemented implicit conversion support for the predicate (operand) of +the +If, Else, and While operators. String and Buffer arguments are +automatically converted to Integers. Changed the string-to-integer conversion behavior to match the new ACPI errata: "If no integer object exists, a new integer is created. The ASCII string is interpreted as a hexadecimal constant. Each string character is interpreted as a hexadecimal value ('0'-'9', 'A'-'F', 'a', 'f'), starting -with the first character as the most significant digit, and ending with the -first non-hexadecimal character or end-of-string." This means that the first +with the first character as the most significant digit, and ending with +the +first non-hexadecimal character or end-of-string." This means that the +first non-hex character terminates the conversion and this is the code that was changed. -Fixed a problem where the ObjectType operator would fail (fault) when used +Fixed a problem where the ObjectType operator would fail (fault) when +used on an Index of a Package which pointed to a null package element. The operator now properly returns zero (Uninitialized) in this case. Fixed a problem where the While operator used excessive memory by not -properly popping the result stack during execution. There was no memory leak +properly popping the result stack during execution. There was no memory +leak after execution, however. (Code provided by Valery Podrezov.) -Fixed a problem where references to control methods within Package objects +Fixed a problem where references to control methods within Package +objects caused the method to be invoked, instead of producing a reference object pointing to the method. -Restructured and simplified the pswalk.c module (AcpiPsDeleteParseTree) to +Restructured and simplified the pswalk.c module (AcpiPsDeleteParseTree) +to improve performance and reduce code size. (Code provided by Alexey Starikovskiy.) Code and Data Size: Current and previous core subsystem library sizes are -shown below. These are the code and data sizes for the acpica.lib produced +shown below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these values do not include any ACPI driver or OSPM code. The debug version of the code includes the -debug output trace mechanism and has a much larger code and data size. Note -that these values will vary depending on the efficiency of the compiler and +debug output trace mechanism and has a much larger code and data size. +Note +that these values will vary depending on the efficiency of the compiler +and the compiler options used during generation. Previous Release: @@ -4531,25 +9026,29 @@ 2) iASL Compiler/Disassembler: Fixed a problem with the Return operator with no arguments. Since the AML -grammar for the byte encoding requires an operand for the Return opcode, the +grammar for the byte encoding requires an operand for the Return opcode, +the compiler now emits a Return(Zero) for this case. An ACPI specification update has been written for this case. For tables other than the DSDT, namepath optimization is automatically -disabled. This is because SSDTs can be loaded anywhere in the namespace, the +disabled. This is because SSDTs can be loaded anywhere in the namespace, +the compiler has no knowledge of where, and thus cannot optimize namepaths. Added "ProcessorObj" to the ObjectTypeKeyword list. This object type was inadvertently omitted from the ACPI specification, and will require an update to the spec. -The source file scan for ASCII characters is now optional (-a). This change +The source file scan for ASCII characters is now optional (-a). This +change was made because some vendors place non-ascii characters within comments. However, the scan is simply a brute-force byte compare to ensure all characters in the file are in the range 0x00 to 0x7F. Fixed a problem with the CondRefOf operator where the compiler was -inappropriately checking for the existence of the target. Since the point of +inappropriately checking for the existence of the target. Since the point +of the operator is to check for the existence of the target at run-time, the compiler no longer checks for the target existence. @@ -4557,17 +9056,22 @@ during constant folding were not handled properly, causing a fault. Fixed a problem with overly aggressive range checking for the Stall -operator. The valid range (max 255) is now only checked if the operand is of +operator. The valid range (max 255) is now only checked if the operand is +of type Integer. All other operand types cannot be statically checked. -Fixed a problem where control method references within the RefOf, DeRefOf, -and ObjectType operators were not treated properly. They are now treated as +Fixed a problem where control method references within the RefOf, +DeRefOf, +and ObjectType operators were not treated properly. They are now treated +as actual references, not method invocations. -Fixed and enhanced the "list namespace" option (-ln). This option was broken +Fixed and enhanced the "list namespace" option (-ln). This option was +broken a number of releases ago. -Improved error handling for the Field, IndexField, and BankField operators. +Improved error handling for the Field, IndexField, and BankField +operators. The compiler now cleanly reports and recovers from errors in the field component (FieldUnit) list. @@ -4582,20 +9086,24 @@ 1) ACPI CA Core Subsystem: Fixed a problem where the result of an Index() operator (an object -reference) must increment the reference count on the target object for the +reference) must increment the reference count on the target object for +the life of the object reference. Implemented AML Interpreter and Debugger support for the new ACPI 3.0 -Extended Address (IO, Memory, Space), QwordSpace, DwordSpace, and WordSpace +Extended Address (IO, Memory, Space), QwordSpace, DwordSpace, and +WordSpace resource descriptors. Implemented support in the _OSI method for the ACPI 3.0 "Extended Address -Space Descriptor" string, indicating interpreter support for the descriptors +Space Descriptor" string, indicating interpreter support for the +descriptors above. Implemented header support for the new ACPI 3.0 FADT flag bits. -Implemented header support for the new ACPI 3.0 PCI Express bits for the PM1 +Implemented header support for the new ACPI 3.0 PCI Express bits for the +PM1 status/enable registers. Updated header support for the MADT processor local Apic struct and MADT @@ -4603,15 +9111,19 @@ Implemented header support for the SRAT and SLIT ACPI tables. -Implemented the -s switch in AcpiExec to enable the "InterpreterSlack" flag +Implemented the -s switch in AcpiExec to enable the "InterpreterSlack" +flag at runtime. Code and Data Size: Current and previous core subsystem library sizes are -shown below. These are the code and data sizes for the acpica.lib produced +shown below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these values do not include any ACPI driver or OSPM code. The debug version of the code includes the -debug output trace mechanism and has a much larger code and data size. Note -that these values will vary depending on the efficiency of the compiler and +debug output trace mechanism and has a much larger code and data size. +Note +that these values will vary depending on the efficiency of the compiler +and the compiler options used during generation. Previous Release: @@ -4624,15 +9136,18 @@ 2) iASL Compiler/Disassembler: -Fixed a problem with the internal 64-bit String-to-integer conversion with +Fixed a problem with the internal 64-bit String-to-integer conversion +with strings less than two characters long. Fixed a problem with constant folding where the result of the Index() -operator can not be considered a constant. This means that Index() cannot be +operator can not be considered a constant. This means that Index() cannot +be a type3 opcode and this will require an update to the ACPI specification. Disassembler: Implemented support for the TTP, MTP, and TRS resource -descriptor fields. These fields were inadvertently ignored and not output in +descriptor fields. These fields were inadvertently ignored and not output +in the disassembly of the resource descriptor. @@ -4642,29 +9157,40 @@ 1) ACPI CA Core Subsystem: Implemented ACPI 3.0 support for implicit conversion within the Match() -operator. MatchObjects can now be of type integer, buffer, or string instead -of just type integer. Package elements are implicitly converted to the type +operator. MatchObjects can now be of type integer, buffer, or string +instead +of just type integer. Package elements are implicitly converted to the +type of the MatchObject. This change aligns the behavior of Match() with the -behavior of the other logical operators (LLess(), etc.) It also requires an +behavior of the other logical operators (LLess(), etc.) It also requires +an errata change to the ACPI specification as this support was intended for ACPI 3.0, but was inadvertently omitted. -Fixed a problem with the internal implicit "to buffer" conversion. Strings -that are converted to buffers will cause buffer truncation if the string is -smaller than the target buffer. Integers that are converted to buffers will +Fixed a problem with the internal implicit "to buffer" conversion. +Strings +that are converted to buffers will cause buffer truncation if the string +is +smaller than the target buffer. Integers that are converted to buffers +will not cause buffer truncation, only zero extension (both as per the ACPI spec.) The problem was introduced when code was added to truncate the -buffer, but this should not be performed in all cases, only the string case. +buffer, but this should not be performed in all cases, only the string +case. -Fixed a problem with the Buffer and Package operators where the interpreter +Fixed a problem with the Buffer and Package operators where the +interpreter would get confused if two such operators were used as operands to an ASL operator (such as LLess(Buffer(1){0},Buffer(1){1}). The internal result -stack was not being popped after the execution of these operators, resulting +stack was not being popped after the execution of these operators, +resulting in an AE_NO_RETURN_VALUE exception. Fixed a problem with constructs of the form Store(Index(...),...). The -reference object returned from Index was inadvertently resolved to an actual -value. This problem was introduced in version 20050114 when the behavior of +reference object returned from Index was inadvertently resolved to an +actual +value. This problem was introduced in version 20050114 when the behavior +of Store() was modified to restrict the object types that can be used as the source operand (to match the ACPI specification.) @@ -4675,11 +9201,14 @@ Updated the AcpiSrc utility to add the FADT_DESCRIPTOR_REV2_MINUS struct. Code and Data Size: Current and previous core subsystem library sizes are -shown below. These are the code and data sizes for the acpica.lib produced +shown below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these values do not include any ACPI driver or OSPM code. The debug version of the code includes the -debug output trace mechanism and has a much larger code and data size. Note -that these values will vary depending on the efficiency of the compiler and +debug output trace mechanism and has a much larger code and data size. +Note +that these values will vary depending on the efficiency of the compiler +and the compiler options used during generation. Previous Release: @@ -4711,35 +9240,49 @@ The local object cache is now optional, and is disabled by default. Both AcpiExec and the iASL compiler enable the cache because they run in user -mode and this enhances their performance. #define ACPI_ENABLE_OBJECT_CACHE +mode and this enhances their performance. #define +ACPI_ENABLE_OBJECT_CACHE to enable the local cache. -Fixed an issue in the internal function AcpiUtEvaluateObject concerning the -optional "implicit return" support where an error was returned if no return -object was expected, but one was implicitly returned. AE_OK is now returned +Fixed an issue in the internal function AcpiUtEvaluateObject concerning +the +optional "implicit return" support where an error was returned if no +return +object was expected, but one was implicitly returned. AE_OK is now +returned in this case and the implicitly returned object is deleted. -AcpiUtEvaluateObject is only occasionally used, and only to execute reserved +AcpiUtEvaluateObject is only occasionally used, and only to execute +reserved methods such as _STA and _INI where the return type is known up front. -Fixed a few issues with the internal convert-to-integer code. It now returns +Fixed a few issues with the internal convert-to-integer code. It now +returns an error if an attempt is made to convert a null string, a string of only -blanks/tabs, or a zero-length buffer. This affects both implicit conversion +blanks/tabs, or a zero-length buffer. This affects both implicit +conversion and explicit conversion via the ToInteger() operator. -The internal debug code in AcpiUtAcquireMutex has been commented out. It is -not needed for normal operation and should increase the performance of the -entire subsystem. The code remains in case it is needed for debug purposes +The internal debug code in AcpiUtAcquireMutex has been commented out. It +is +not needed for normal operation and should increase the performance of +the +entire subsystem. The code remains in case it is needed for debug +purposes again. -The AcpiExec source and makefile are included in the Unix/Linux package for +The AcpiExec source and makefile are included in the Unix/Linux package +for the first time. Code and Data Size: Current and previous core subsystem library sizes are -shown below. These are the code and data sizes for the acpica.lib produced +shown below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these values do not include any ACPI driver or OSPM code. The debug version of the code includes the -debug output trace mechanism and has a much larger code and data size. Note -that these values will vary depending on the efficiency of the compiler and +debug output trace mechanism and has a much larger code and data size. +Note +that these values will vary depending on the efficiency of the compiler +and the compiler options used during generation. Previous Release: @@ -4751,24 +9294,32 @@ 2) iASL Compiler/Disassembler: -Switch/Case support: A warning is now issued if the type of the Switch value +Switch/Case support: A warning is now issued if the type of the Switch +value cannot be determined at compile time. For example, Switch(Arg0) will -generate the warning, and the type is assumed to be an integer. As per the -ACPI spec, use a construct such as Switch(ToInteger(Arg0)) to eliminate the +generate the warning, and the type is assumed to be an integer. As per +the +ACPI spec, use a construct such as Switch(ToInteger(Arg0)) to eliminate +the warning. Switch/Case support: Implemented support for buffer and string objects as the switch value. This is an ACPI 3.0 feature, now that LEqual supports buffers and strings. -Switch/Case support: The emitted code for the LEqual() comparisons now uses -the switch value as the first operand, not the second. The case value is now +Switch/Case support: The emitted code for the LEqual() comparisons now +uses +the switch value as the first operand, not the second. The case value is +now the second operand, and this allows the case value to be implicitly converted to the type of the switch value, not the other way around. -Switch/Case support: Temporary variables are now emitted immediately within -the control method, not at the global level. This means that there are now -36 temps available per-method, not 36 temps per-module as was the case with +Switch/Case support: Temporary variables are now emitted immediately +within +the control method, not at the global level. This means that there are +now +36 temps available per-method, not 36 temps per-module as was the case +with the earlier implementation (_T_0 through _T_9 and _T_A through _T_Z.) ---------------------------------------- @@ -4780,51 +9331,66 @@ 1) ACPI CA Core Subsystem: Fixed an issue with the String-to-Buffer conversion code where the string -null terminator was not included in the buffer after conversion, but there -is existing ASL that assumes the string null terminator is included. This is +null terminator was not included in the buffer after conversion, but +there +is existing ASL that assumes the string null terminator is included. This +is the root of the ACPI_AML_BUFFER_LIMIT regression. This problem was introduced in the previous version when the code was updated to correctly -set the converted buffer size as per the ACPI specification. The ACPI spec -is ambiguous and will be updated to specify that the null terminator must be +set the converted buffer size as per the ACPI specification. The ACPI +spec +is ambiguous and will be updated to specify that the null terminator must +be included in the converted buffer. This also affects the ToBuffer() ASL operator. Fixed a problem with the Mid() ASL/AML operator where it did not work -correctly on Buffer objects. Newly created sub-buffers were not being marked +correctly on Buffer objects. Newly created sub-buffers were not being +marked as initialized. Fixed a problem in AcpiTbFindTable where incorrect string compares were -performed on the OemId and OemTableId table header fields. These fields are +performed on the OemId and OemTableId table header fields. These fields +are not null terminated, so strncmp is now used instead of strcmp. Implemented a restriction on the Store() ASL/AML operator to align the -behavior with the ACPI specification. Previously, any object could be used -as the source operand. Now, the only objects that may be used are Integers, +behavior with the ACPI specification. Previously, any object could be +used +as the source operand. Now, the only objects that may be used are +Integers, Buffers, Strings, Packages, Object References, and DDB Handles. If necessary, the original behavior can be restored by enabling the EnableInterpreterSlack flag. -Enhanced the optional "implicit return" support to allow an implicit return +Enhanced the optional "implicit return" support to allow an implicit +return value from methods that are invoked externally via the AcpiEvaluateObject interface. This enables implicit returns from the _STA and _INI methods, for example. -Changed the Revision() ASL/AML operator to return the current version of the -AML interpreter, in the YYYYMMDD format. Previously, it incorrectly returned +Changed the Revision() ASL/AML operator to return the current version of +the +AML interpreter, in the YYYYMMDD format. Previously, it incorrectly +returned the supported ACPI version (This is the function of the _REV method). -Updated the _REV predefined method to return the currently supported version +Updated the _REV predefined method to return the currently supported +version of ACPI, now 3. Implemented batch mode option for the AcpiExec utility (-b). Code and Data Size: Current and previous core subsystem library sizes are -shown below. These are the code and data sizes for the acpica.lib produced +shown below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these values do not include any ACPI driver or OSPM code. The debug version of the code includes the -debug output trace mechanism and has a much larger code and data size. Note -that these values will vary depending on the efficiency of the compiler and +debug output trace mechanism and has a much larger code and data size. +Note +that these values will vary depending on the efficiency of the compiler +and the compiler options used during generation. Previous Release: @@ -4842,23 +9408,29 @@ 1) ACPI CA Core Subsystem: -Fixed a problem in the ToDecimalString operator where the resulting string +Fixed a problem in the ToDecimalString operator where the resulting +string length was incorrectly calculated. The length is now calculated exactly, eliminating incorrect AE_STRING_LIMIT exceptions. -Fixed a problem in the ToHexString operator to allow a maximum 200 character +Fixed a problem in the ToHexString operator to allow a maximum 200 +character string to be produced. -Fixed a problem in the internal string-to-buffer and buffer-to-buffer copy +Fixed a problem in the internal string-to-buffer and buffer-to-buffer +copy routine where the length of the resulting buffer was not truncated to the new size (if the target buffer already existed). Code and Data Size: Current and previous core subsystem library sizes are -shown below. These are the code and data sizes for the acpica.lib produced +shown below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these values do not include any ACPI driver or OSPM code. The debug version of the code includes the -debug output trace mechanism and has a much larger code and data size. Note -that these values will vary depending on the efficiency of the compiler and +debug output trace mechanism and has a much larger code and data size. +Note +that these values will vary depending on the efficiency of the compiler +and the compiler options used during generation. Previous Release: @@ -4875,7 +9447,8 @@ ExtendedIO, ExtendedMemory, ExtendedSpace, QWordSpace, and WordSpace. Includes support in the disassembler. -Implemented support for the new (ACPI 3.0) parameter to the Register macro, +Implemented support for the new (ACPI 3.0) parameter to the Register +macro, AccessSize. Fixed a problem where the _HE resource name for the Interrupt macro was @@ -4888,29 +9461,34 @@ was 0 or 1. The optimizer shortened the AML code to a single byte opcode but did not update the surrounding package lengths. -Changes to the Dma macro: All channels within the channel list must be in +Changes to the Dma macro: All channels within the channel list must be +in the range 0-7. Maximum 8 channels can be specified. BusMaster operand is optional (default is BusMaster). Implemented check for maximum 7 data bytes for the VendorShort macro. -The ReadWrite parameter is now optional for the Memory32 and similar macros. +The ReadWrite parameter is now optional for the Memory32 and similar +macros. ---------------------------------------- 03 December 2004. Summary of changes for version 20041203: 1) ACPI CA Core Subsystem: -The low-level field insertion/extraction code (exfldio) has been completely +The low-level field insertion/extraction code (exfldio) has been +completely rewritten to eliminate unnecessary complexity, bugs, and boundary conditions. -Fixed a problem in the ToInteger, ToBuffer, ToHexString, and ToDecimalString +Fixed a problem in the ToInteger, ToBuffer, ToHexString, and +ToDecimalString operators where the input operand could be inadvertently deleted if no conversion was necessary (e.g., if the input to ToInteger was an Integer object.) -Fixed a problem with the ToDecimalString and ToHexString where an incorrect +Fixed a problem with the ToDecimalString and ToHexString where an +incorrect exception code was returned if the resulting string would be > 200 chars. AE_STRING_LIMIT is now returned. @@ -4921,11 +9499,14 @@ semaphores to be allocated. Code and Data Size: Current and previous core subsystem library sizes are -shown below. These are the code and data sizes for the acpica.lib produced +shown below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these values do not include any ACPI driver or OSPM code. The debug version of the code includes the -debug output trace mechanism and has a much larger code and data size. Note -that these values will vary depending on the efficiency of the compiler and +debug output trace mechanism and has a much larger code and data size. +Note +that these values will vary depending on the efficiency of the compiler +and the compiler options used during generation. Previous Release: @@ -4941,7 +9522,8 @@ Fixed typechecking for the ObjectType and SizeOf operators. Problem was recently introduced in 20041119. -Fixed a problem with the ToUUID macro where the upper nybble of each buffer +Fixed a problem with the ToUUID macro where the upper nybble of each +buffer byte was inadvertently set to zero. ---------------------------------------- @@ -4949,31 +9531,42 @@ 1) ACPI CA Core Subsystem: -Fixed a problem in the internal ConvertToInteger routine where new integers -were not truncated to 32 bits for 32-bit ACPI tables. This routine converts +Fixed a problem in the internal ConvertToInteger routine where new +integers +were not truncated to 32 bits for 32-bit ACPI tables. This routine +converts buffers and strings to integers. -Implemented support to store a value to an Index() on a String object. This +Implemented support to store a value to an Index() on a String object. +This is an ACPI 2.0 feature that had not yet been implemented. -Implemented new behavior for storing objects to individual package elements -(via the Index() operator). The previous behavior was to invoke the implicit +Implemented new behavior for storing objects to individual package +elements +(via the Index() operator). The previous behavior was to invoke the +implicit conversion rules if an object was already present at the index. The new -behavior is to simply delete any existing object and directly store the new -object. Although the ACPI specification seems unclear on this subject, other +behavior is to simply delete any existing object and directly store the +new +object. Although the ACPI specification seems unclear on this subject, +other ACPI implementations behave in this manner. (This is the root of the AE_BAD_HEX_CONSTANT issue.) -Modified the RSDP memory scan mechanism to support the extended checksum for +Modified the RSDP memory scan mechanism to support the extended checksum +for ACPI 2.0 (and above) RSDPs. Note that the search continues until a valid RSDP signature is found with a valid checksum. Code and Data Size: Current and previous core subsystem library sizes are -shown below. These are the code and data sizes for the acpica.lib produced +shown below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these values do not include any ACPI driver or OSPM code. The debug version of the code includes the -debug output trace mechanism and has a much larger code and data size. Note -that these values will vary depending on the efficiency of the compiler and +debug output trace mechanism and has a much larger code and data size. +Note +that these values will vary depending on the efficiency of the compiler +and the compiler options used during generation. Previous Release: @@ -4993,30 +9586,38 @@ 1) ACPI CA Core Subsystem: -Implemented support for FADT revision 2. This was an interim table (between +Implemented support for FADT revision 2. This was an interim table +(between ACPI 1.0 and ACPI 2.0) that adds support for the FADT reset register. Implemented optional support to allow uninitialized LocalX and ArgX -variables in a control method. The variables are initialized to an Integer +variables in a control method. The variables are initialized to an +Integer object with a value of zero. This support is enabled by setting the AcpiGbl_EnableInterpreterSlack flag to TRUE. -Implemented support for Integer objects for the SizeOf operator. Either 4 -or 8 is returned, depending on the current integer size (32-bit or 64-bit, +Implemented support for Integer objects for the SizeOf operator. Either +4 +or 8 is returned, depending on the current integer size (32-bit or 64- +bit, depending on the parent table revision). -Fixed a problem in the implementation of the SizeOf and ObjectType operators +Fixed a problem in the implementation of the SizeOf and ObjectType +operators where the operand was resolved to a value too early, causing incorrect return values for some objects. Fixed some possible memory leaks during exceptional conditions. Code and Data Size: Current and previous core subsystem library sizes are -shown below. These are the code and data sizes for the acpica.lib produced +shown below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these values do not include any ACPI driver or OSPM code. The debug version of the code includes the -debug output trace mechanism and has a much larger code and data size. Note -that these values will vary depending on the efficiency of the compiler and +debug output trace mechanism and has a much larger code and data size. +Note +that these values will vary depending on the efficiency of the compiler +and the compiler options used during generation. Previous Release: @@ -5058,8 +9659,10 @@ 1) ACPI CA Core Subsystem: -Fixed two alignment issues on 64-bit platforms - within debug statements in -AcpiEvGpeDetect and AcpiEvCreateGpeBlock. Removed references to the Address +Fixed two alignment issues on 64-bit platforms - within debug statements +in +AcpiEvGpeDetect and AcpiEvCreateGpeBlock. Removed references to the +Address field within the non-aligned ACPI generic address structure. Fixed a problem in the Increment and Decrement operators where incorrect @@ -5067,14 +9670,18 @@ original integer when the integer is passed into another method as an argument and the arg is then incremented/decremented. -Fixed a problem in the FromBCD operator where the upper 32-bits of a 64-bit +Fixed a problem in the FromBCD operator where the upper 32-bits of a 64- +bit BCD number were truncated during conversion. -Fixed a problem in the ToDecimal operator where the length of the resulting -string could be set incorrectly too long if the input operand was a Buffer +Fixed a problem in the ToDecimal operator where the length of the +resulting +string could be set incorrectly too long if the input operand was a +Buffer object. -Fixed a problem in the Logical operators (LLess, etc.) where a NULL byte (0) +Fixed a problem in the Logical operators (LLess, etc.) where a NULL byte +(0) within a buffer would prematurely terminate a compare between buffer objects. @@ -5082,11 +9689,14 @@ specification) during the Concatenate operator with two string operands. Code and Data Size: Current and previous core subsystem library sizes are -shown below. These are the code and data sizes for the acpica.lib produced +shown below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these values do not include any ACPI driver or OSPM code. The debug version of the code includes the -debug output trace mechanism and has a much larger code and data size. Note -that these values will vary depending on the efficiency of the compiler and +debug output trace mechanism and has a much larger code and data size. +Note +that these values will vary depending on the efficiency of the compiler +and the compiler options used during generation. Previous Release: @@ -5103,11 +9713,14 @@ Allow the use of the ObjectType operator on uninitialized Locals and Args (returns 0 as per the ACPI specification). -Fixed a problem where the compiler would fault if there was a syntax error +Fixed a problem where the compiler would fault if there was a syntax +error in the FieldName of all of the various CreateXXXField operators. -Disallow the use of lower case letters within the EISAID macro, as per the -ACPI specification. All EISAID strings must be of the form "UUUNNNN" Where +Disallow the use of lower case letters within the EISAID macro, as per +the +ACPI specification. All EISAID strings must be of the form "UUUNNNN" +Where U is an uppercase letter and N is a hex digit. @@ -5120,41 +9733,52 @@ implements a 64-bit timer with 100 nanosecond granularity. Defined a new OSL interface, AcpiOsGetTimer. This interface is used to -implement the ACPI 3.0 Timer operator. This allows the host OS to implement -the timer with the best clock available. Also, it keeps the core subsystem +implement the ACPI 3.0 Timer operator. This allows the host OS to +implement +the timer with the best clock available. Also, it keeps the core +subsystem out of the clock handling business, since the host OS (usually) performs this function. Fixed an alignment issue on 64-bit platforms. The HwLowLevelRead(Write) functions use a 64-bit address which is part of the packed ACPI Generic -Address Structure. Since the structure is non-aligned, the alignment macros +Address Structure. Since the structure is non-aligned, the alignment +macros are now used to extract the address to a local variable before use. -Fixed a problem where the ToInteger operator assumed all input strings were -hexadecimal. The operator now handles both decimal strings and hex strings +Fixed a problem where the ToInteger operator assumed all input strings +were +hexadecimal. The operator now handles both decimal strings and hex +strings (prefixed with "0x"). Fixed a problem where the string length in the string object created as a result of the internal ConvertToString procedure could be incorrect. This -potentially affected all implicit conversions and also the ToDecimalString +potentially affected all implicit conversions and also the +ToDecimalString and ToHexString operators. Fixed two problems in the ToString operator. If the length parameter was zero, an incorrect string object was created and the value of the input length parameter was inadvertently changed from zero to Ones. -Fixed a problem where the optional ResourceSource string in the ExtendedIRQ +Fixed a problem where the optional ResourceSource string in the +ExtendedIRQ resource macro was ignored. -Simplified the interfaces to the internal division functions, reducing code +Simplified the interfaces to the internal division functions, reducing +code size and complexity. Code and Data Size: Current and previous core subsystem library sizes are -shown below. These are the code and data sizes for the acpica.lib produced +shown below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these values do not include any ACPI driver or OSPM code. The debug version of the code includes the -debug output trace mechanism and has a much larger code and data size. Note -that these values will vary depending on the efficiency of the compiler and +debug output trace mechanism and has a much larger code and data size. +Note +that these values will vary depending on the efficiency of the compiler +and the compiler options used during generation. Previous Release: @@ -5169,11 +9793,13 @@ Implemented support for the ACPI 3.0 Timer operator. -Fixed a problem where the Default() operator was inadvertently ignored in a +Fixed a problem where the Default() operator was inadvertently ignored in +a Switch/Case block. This was a problem in the translation of the Switch statement to If...Else pairs. -Added support to allow a standalone Return operator, with no parentheses (or +Added support to allow a standalone Return operator, with no parentheses +(or operands). Fixed a problem with code generation for the ElseIf operator where the @@ -5185,12 +9811,16 @@ 1) ACPI CA Core Subsystem: -Fixed a problem with the implementation of the LNot() operator where "Ones" -was not returned for the TRUE case. Changed the code to return Ones instead -of (!Arg) which was usually 1. This change affects iASL constant folding for +Fixed a problem with the implementation of the LNot() operator where +"Ones" +was not returned for the TRUE case. Changed the code to return Ones +instead +of (!Arg) which was usually 1. This change affects iASL constant folding +for this operator also. -Fixed a problem in AcpiUtInitializeBuffer where an existing buffer was not +Fixed a problem in AcpiUtInitializeBuffer where an existing buffer was +not initialized properly -- Now zero the entire buffer in this case where the buffer already exists. @@ -5199,19 +9829,24 @@ related code considerably. This will require changes/updates to all OS interface layers (OSLs.) -Implemented a new external interface, AcpiInstallExceptionHandler, to allow -a system exception handler to be installed. This handler is invoked upon any +Implemented a new external interface, AcpiInstallExceptionHandler, to +allow +a system exception handler to be installed. This handler is invoked upon +any run-time exception that occurs during control method execution. Added support for the DSDT in AcpiTbFindTable. This allows the DataTableRegion() operator to access the local copy of the DSDT. Code and Data Size: Current and previous core subsystem library sizes are -shown below. These are the code and data sizes for the acpica.lib produced +shown below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these values do not include any ACPI driver or OSPM code. The debug version of the code includes the -debug output trace mechanism and has a much larger code and data size. Note -that these values will vary depending on the efficiency of the compiler and +debug output trace mechanism and has a much larger code and data size. +Note +that these values will vary depending on the efficiency of the compiler +and the compiler options used during generation. Previous Release: @@ -5225,16 +9860,20 @@ 2) iASL Compiler/Disassembler: Fixed a problem with constant folding and the LNot operator. LNot was -returning 1 in the TRUE case, not Ones as per the ACPI specification. This +returning 1 in the TRUE case, not Ones as per the ACPI specification. +This could result in the generation of an incorrect folded/reduced constant. End-Of-File is now allowed within a "//"-style comment. A parse error no -longer occurs if such a comment is at the very end of the input ASL source +longer occurs if such a comment is at the very end of the input ASL +source file. Implemented the "-r" option to override the Revision in the table header. -The initial use of this option will be to simplify the evaluation of the AML -interpreter by allowing a single ASL source module to be compiled for either +The initial use of this option will be to simplify the evaluation of the +AML +interpreter by allowing a single ASL source module to be compiled for +either 32-bit or 64-bit integers. @@ -5244,41 +9883,55 @@ 1) ACPI CA Core Subsystem: - Implemented support for implicit object conversion in the non-numeric -logical operators (LEqual, LGreater, LGreaterEqual, LLess, LLessEqual, and +logical operators (LEqual, LGreater, LGreaterEqual, LLess, LLessEqual, +and LNotEqual.) Any combination of Integers/Strings/Buffers may now be used; -the second operand is implicitly converted on the fly to match the type of +the second operand is implicitly converted on the fly to match the type +of the first operand. For example: LEqual (Source1, Source2) -Source1 and Source2 must each evaluate to an integer, a string, or a buffer. -The data type of Source1 dictates the required type of Source2. Source2 is +Source1 and Source2 must each evaluate to an integer, a string, or a +buffer. +The data type of Source1 dictates the required type of Source2. Source2 +is implicitly converted if necessary to match the type of Source1. -- Updated and corrected the behavior of the string conversion support. The +- Updated and corrected the behavior of the string conversion support. +The rules concerning conversion of buffers to strings (according to the ACPI specification) are as follows: ToDecimalString - explicit byte-wise conversion of buffer to string of -decimal values (0-255) separated by commas. ToHexString - explicit byte-wise +decimal values (0-255) separated by commas. ToHexString - explicit byte- +wise conversion of buffer to string of hex values (0-FF) separated by commas. -ToString - explicit byte-wise conversion of buffer to string. Byte-by-byte -copy with no transform except NULL terminated. Any other implicit buffer-to- -string conversion - byte-wise conversion of buffer to string of hex values +ToString - explicit byte-wise conversion of buffer to string. Byte-by- +byte +copy with no transform except NULL terminated. Any other implicit buffer- +to- +string conversion - byte-wise conversion of buffer to string of hex +values (0-FF) separated by spaces. - Fixed typo in definition of AcpiGbl_EnableInterpreterSlack. -- Fixed a problem in AcpiNsGetPathnameLength where the returned length was +- Fixed a problem in AcpiNsGetPathnameLength where the returned length +was one byte too short in the case of a node in the root scope. This could cause a fault during debug output. -- Code and Data Size: Current and previous core subsystem library sizes are -shown below. These are the code and data sizes for the acpica.lib produced +- Code and Data Size: Current and previous core subsystem library sizes +are +shown below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these values do not include any ACPI driver or OSPM code. The debug version of the code includes the -debug output trace mechanism and has a much larger code and data size. Note -that these values will vary depending on the efficiency of the compiler and +debug output trace mechanism and has a much larger code and data size. +Note +that these values will vary depending on the efficiency of the compiler +and the compiler options used during generation. Previous Release: @@ -5300,25 +9953,33 @@ 1) ACPI CA Core Subsystem: Designed and implemented support within the AML interpreter for the so- -called "implicit return". This support returns the result of the last ASL +called "implicit return". This support returns the result of the last +ASL operation within a control method, in the absence of an explicit Return() operator. A few machines depend on this behavior, even though it is not -explicitly supported by the ASL language. It is optional support that can +explicitly supported by the ASL language. It is optional support that +can be enabled at runtime via the AcpiGbl_EnableInterpreterSlack flag. -Removed support for the PCI_Config address space from the internal low level +Removed support for the PCI_Config address space from the internal low +level hardware interfaces (AcpiHwLowLevelRead and AcpiHwLowLevelWrite). This -support was not used internally, and would not work correctly anyway because +support was not used internally, and would not work correctly anyway +because the PCI bus number and segment number were not supported. There are -separate interfaces for PCI configuration space access because of the unique +separate interfaces for PCI configuration space access because of the +unique interface. Code and Data Size: Current and previous core subsystem library sizes are -shown below. These are the code and data sizes for the acpica.lib produced +shown below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these values do not include any ACPI driver or OSPM code. The debug version of the code includes the -debug output trace mechanism and has a much larger code and data size. Note -that these values will vary depending on the efficiency of the compiler and +debug output trace mechanism and has a much larger code and data size. +Note +that these values will vary depending on the efficiency of the compiler +and the compiler options used during generation. Previous Release: @@ -5341,30 +10002,39 @@ 1) ACPI CA Core Subsystem: -Restructured the internal HW GPE interfaces to pass/track the current state +Restructured the internal HW GPE interfaces to pass/track the current +state of interrupts (enabled/disabled) in order to avoid possible deadlock and increase flexibility of the interfaces. -Implemented a "lexicographical compare" for String and Buffer objects within -the logical operators -- LGreater, LLess, LGreaterEqual, and LLessEqual -- -as per further clarification to the ACPI specification. Behavior is similar +Implemented a "lexicographical compare" for String and Buffer objects +within +the logical operators -- LGreater, LLess, LGreaterEqual, and LLessEqual - +- +as per further clarification to the ACPI specification. Behavior is +similar to C library "strcmp". Completed a major reduction in CPU stack use for the AcpiGetFirmwareTable external function. In the 32-bit non-debug case, the stack use has been reduced from 168 bytes to 32 bytes. -Deployed a new run-time configuration flag, AcpiGbl_EnableInterpreterSlack, +Deployed a new run-time configuration flag, +AcpiGbl_EnableInterpreterSlack, whose purpose is to allow the AML interpreter to forgive certain bad AML constructs. Default setting is FALSE. -Implemented the first use of AcpiGbl_EnableInterpreterSlack in the Field IO -support code. If enabled, it allows field access to go beyond the end of a -region definition if the field is within the region length rounded up to the +Implemented the first use of AcpiGbl_EnableInterpreterSlack in the Field +IO +support code. If enabled, it allows field access to go beyond the end of +a +region definition if the field is within the region length rounded up to +the next access width boundary (a common coding error.) Renamed OSD_HANDLER to ACPI_OSD_HANDLER, and OSD_EXECUTION_CALLBACK to -ACPI_OSD_EXEC_CALLBACK for consistency with other ACPI symbols. Also, these +ACPI_OSD_EXEC_CALLBACK for consistency with other ACPI symbols. Also, +these symbols are lowercased by the latest version of the AcpiSrc tool. The prototypes for the PCI interfaces in acpiosxf.h have been updated to @@ -5372,11 +10042,14 @@ complaining. Code and Data Size: Current and previous core subsystem library sizes are -shown below. These are the code and data sizes for the acpica.lib produced +shown below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these values do not include any ACPI driver or OSPM code. The debug version of the code includes the -debug output trace mechanism and has a much larger code and data size. Note -that these values will vary depending on the efficiency of the compiler and +debug output trace mechanism and has a much larger code and data size. +Note +that these values will vary depending on the efficiency of the compiler +and the compiler options used during generation. Previous Release: @@ -5391,11 +10064,13 @@ Implemented full support for Package objects within the Case() operator. Note: The Break() operator is currently not supported within Case blocks -(TermLists) as there is some question about backward compatibility with ACPI +(TermLists) as there is some question about backward compatibility with +ACPI 1.0 interpreters. -Fixed a problem where complex terms were not supported properly within the +Fixed a problem where complex terms were not supported properly within +the Switch() operator. Eliminated extraneous warning for compiler-emitted reserved names of the @@ -5410,22 +10085,27 @@ 1) ACPI CA Core Subsystem: -Implemented support for Buffer and String objects (as per ACPI 2.0) for the +Implemented support for Buffer and String objects (as per ACPI 2.0) for +the following ASL operators: LEqual, LGreater, LLess, LGreaterEqual, and LLessEqual. All directory names in the entire source package are lower case, as they were in earlier releases. -Implemented "Disassemble" command in the AML debugger that will disassemble +Implemented "Disassemble" command in the AML debugger that will +disassemble a single control method. Code and Data Size: Current and previous core subsystem library sizes are -shown below. These are the code and data sizes for the acpica.lib produced +shown below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these values do not include any ACPI driver or OSPM code. The debug version of the code includes the -debug output trace mechanism and has a much larger code and data size. Note -that these values will vary depending on the efficiency of the compiler and +debug output trace mechanism and has a much larger code and data size. +Note +that these values will vary depending on the efficiency of the compiler +and the compiler options used during generation. Previous Release: @@ -5439,7 +10119,8 @@ 2) iASL Compiler/Disassembler: -Implemented support for Buffer and String objects (as per ACPI 2.0) for the +Implemented support for Buffer and String objects (as per ACPI 2.0) for +the following ASL operators: LEqual, LGreater, LLess, LGreaterEqual, and LLessEqual. @@ -5449,14 +10130,17 @@ Fixed a fault when using the -g or -d options if the FADT was not found. -Fixed an issue with the Windows version of the compiler where later versions +Fixed an issue with the Windows version of the compiler where later +versions of Windows place the FADT in the registry under the name "FADT" and not "FACP" as earlier versions did. This applies when using the -g or - d options. The compiler now looks for both strings as necessary. -Fixed a problem with compiler namepath optimization where a namepath within -the Scope() operator could not be optimized if the namepath was a subpath of +Fixed a problem with compiler namepath optimization where a namepath +within +the Scope() operator could not be optimized if the namepath was a subpath +of the current scope path. ---------------------------------------- @@ -5464,11 +10148,15 @@ 1) ACPI CA Core Subsystem: -Completed a new design and implementation for EBDA (Extended BIOS Data Area) -support in the RSDP scan code. The original code improperly scanned for the -EBDA by simply scanning from memory location 0 to 0x400. The correct method +Completed a new design and implementation for EBDA (Extended BIOS Data +Area) +support in the RSDP scan code. The original code improperly scanned for +the +EBDA by simply scanning from memory location 0 to 0x400. The correct +method is to first obtain the EBDA pointer from within the BIOS data area, then -scan 1K of memory starting at the EBDA pointer. There appear to be few if +scan 1K of memory starting at the EBDA pointer. There appear to be few +if any machines that place the RSDP in the EBDA, however. Integrated a fix for a possible fault during evaluation of BufferField @@ -5483,11 +10171,14 @@ Code and Data Size: Current and previous core subsystem library sizes are -shown below. These are the code and data sizes for the acpica.lib produced +shown below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these values do not include any ACPI driver or OSPM code. The debug version of the code includes the -debug output trace mechanism and has a much larger code and data size. Note -that these values will vary depending on the efficiency of the compiler and +debug output trace mechanism and has a much larger code and data size. +Note +that these values will vary depending on the efficiency of the compiler +and the compiler options used during generation. Previous Release: @@ -5500,7 +10191,8 @@ 2) iASL Compiler/Disassembler: -Fixed a generation warning produced by some overly-verbose compilers for a +Fixed a generation warning produced by some overly-verbose compilers for +a 64-bit constant. ---------------------------------------- @@ -5514,18 +10206,22 @@ Removed extra "clear all GPEs" when sleeping/waking. Removed AcpiHwEnableGpe and AcpiHwDisableGpe, replaced by the single -AcpiHwWriteGpeEnableReg. Changed a couple of calls to the functions above to +AcpiHwWriteGpeEnableReg. Changed a couple of calls to the functions above +to the new AcpiEv* calls as appropriate. -ACPI_OS_NAME was removed from the OS-specific headers. The default name is -now "Microsoft Windows NT" for maximum compatibility. However this can be +ACPI_OS_NAME was removed from the OS-specific headers. The default name +is +now "Microsoft Windows NT" for maximum compatibility. However this can +be changed by modifying the acconfig.h file. Allow a single invocation of AcpiInstallNotifyHandler for a handler that traps both types of notifies (System, Device). Use ACPI_ALL_NOTIFY flag. Run _INI methods on ThermalZone objects. This is against the ACPI -specification, but there is apparently ASL code in the field that has these +specification, but there is apparently ASL code in the field that has +these _INI methods, and apparently "other" AML interpreters execute them. Performed a full 16/32/64 bit lint that resulted in some small changes. @@ -5533,11 +10229,14 @@ Added a sleep simulation command to the AML debugger to test sleep code. Code and Data Size: Current and previous core subsystem library sizes are -shown below. These are the code and data sizes for the acpica.lib produced +shown below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these values do not include any ACPI driver or OSPM code. The debug version of the code includes the -debug output trace mechanism and has a much larger code and data size. Note -that these values will vary depending on the efficiency of the compiler and +debug output trace mechanism and has a much larger code and data size. +Note +that these values will vary depending on the efficiency of the compiler +and the compiler options used during generation. Previous Release: @@ -5553,26 +10252,36 @@ 1) ACPI CA Core Subsystem: Completed a major overhaul of the GPE handling within ACPI CA. There are -now three types of GPEs: wake-only, runtime-only, and combination wake/run. +now three types of GPEs: wake-only, runtime-only, and combination +wake/run. The only GPEs allowed to be combination wake/run are for button-style -devices such as a control-method power button, control-method sleep button, -or a notebook lid switch. GPEs that have an _Lxx or _Exx method and are not +devices such as a control-method power button, control-method sleep +button, +or a notebook lid switch. GPEs that have an _Lxx or _Exx method and are +not referenced by any _PRW methods are marked for "runtime" and hardware -enabled. Any GPE that is referenced by a _PRW method is marked for "wake" +enabled. Any GPE that is referenced by a _PRW method is marked for +"wake" (and disabled at runtime). However, at sleep time, only those GPEs that -have been specifically enabled for wake via the AcpiEnableGpe interface will +have been specifically enabled for wake via the AcpiEnableGpe interface +will actually be hardware enabled. -A new external interface has been added, AcpiSetGpeType(), that is meant to -be used by device drivers to force a GPE to a particular type. It will be +A new external interface has been added, AcpiSetGpeType(), that is meant +to +be used by device drivers to force a GPE to a particular type. It will +be especially useful for the drivers for the button devices mentioned above. Completed restructuring of the ACPI CA initialization sequence so that -default operation region handlers are installed before GPEs are initialized -and the _PRW methods are executed. This will prevent errors when the _PRW +default operation region handlers are installed before GPEs are +initialized +and the _PRW methods are executed. This will prevent errors when the +_PRW methods attempt to access system memory or I/O space. -GPE enable/disable no longer reads the GPE enable register. We now keep the +GPE enable/disable no longer reads the GPE enable register. We now keep +the enable info for runtime and wake separate and in the GPE_EVENT_INFO. We thus no longer depend on the hardware to maintain these bits. @@ -5582,12 +10291,16 @@ Improved the AML debugger output for displaying the GPE blocks and their current status. -Added new strings for the _OSI method, of the form "Windows 2001 SPx" where +Added new strings for the _OSI method, of the form "Windows 2001 SPx" +where x = 0,1,2,3,4. -Fixed a problem where the physical address was incorrectly calculated when -the Load() operator was used to directly load from an Operation Region (vs. -loading from a Field object.) Also added check for minimum table length for +Fixed a problem where the physical address was incorrectly calculated +when +the Load() operator was used to directly load from an Operation Region +(vs. +loading from a Field object.) Also added check for minimum table length +for this case. Fix for multiple mutex acquisition. Restore original thread SyncLevel on @@ -5600,21 +10313,27 @@ structure for each GPE in the system, so the size of this structure is important. -CPU stack requirement reduction: Cleaned up the method execution and object +CPU stack requirement reduction: Cleaned up the method execution and +object evaluation paths so that now a parameter structure is passed, instead of copying the various method parameters over and over again. In evregion.c: Correctly exit and reenter the interpreter region if and -only if dispatching an operation region request to a user-installed handler. +only if dispatching an operation region request to a user-installed +handler. Do not exit/reenter when dispatching to a default handler (e.g., default system memory or I/O handlers) -Notes for updating drivers for the new GPE support. The following changes -must be made to ACPI-related device drivers that are attached to one or more -GPEs: (This information will be added to the ACPI CA Programmer Reference.) +Notes for updating drivers for the new GPE support. The following +changes +must be made to ACPI-related device drivers that are attached to one or +more +GPEs: (This information will be added to the ACPI CA Programmer +Reference.) -1) AcpiInstallGpeHandler no longer automatically enables the GPE, you must +1) AcpiInstallGpeHandler no longer automatically enables the GPE, you +must explicitly call AcpiEnableGpe. 2) There is a new interface called AcpiSetGpeType. This should be called before enabling the GPE. Also, this interface will automatically disable @@ -5635,18 +10354,24 @@ AcpiSetGpeType (GpeDevice, GpeNum, ACPI_GPE_TYPE_WAKE_RUN); AcpiEnableGpe (GpeDevice, GpeNum, ACPI_NOT_ISR); -For all other devices that have _PRWs, we automatically set the GPE type to -ACPI_GPE_TYPE_WAKE, but the GPE is NOT automatically (wake) enabled. This -must be done on a selective basis, usually requiring some kind of user app +For all other devices that have _PRWs, we automatically set the GPE type +to +ACPI_GPE_TYPE_WAKE, but the GPE is NOT automatically (wake) enabled. +This +must be done on a selective basis, usually requiring some kind of user +app to allow the user to pick the wake devices. Code and Data Size: Current and previous core subsystem library sizes are -shown below. These are the code and data sizes for the acpica.lib produced +shown below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these values do not include any ACPI driver or OSPM code. The debug version of the code includes the -debug output trace mechanism and has a much larger code and data size. Note -that these values will vary depending on the efficiency of the compiler and +debug output trace mechanism and has a much larger code and data size. +Note +that these values will vary depending on the efficiency of the compiler +and the compiler options used during generation. Previous Release: @@ -5666,7 +10391,8 @@ Fixed an interpreter problem where an indirect store through an ArgX parameter was incorrectly applying the "implicit conversion rules" during -the store. From the ACPI specification: "If the target is a method local or +the store. From the ACPI specification: "If the target is a method local +or argument (LocalX or ArgX), no conversion is performed and the result is stored directly to the target". The new behavior is to disable implicit conversion during ALL stores to an ArgX. @@ -5675,16 +10401,20 @@ returned by a given _PRW. This prevents the scan from aborting from the failure of any single _PRW. -Moved the runtime configuration parameters from the global init procedure to +Moved the runtime configuration parameters from the global init procedure +to static variables in acglobal.h. This will allow the host to override the default values easily. Code and Data Size: Current and previous core subsystem library sizes are -shown below. These are the code and data sizes for the acpica.lib produced +shown below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these values do not include any ACPI driver or OSPM code. The debug version of the code includes the -debug output trace mechanism and has a much larger code and data size. Note -that these values will vary depending on the efficiency of the compiler and +debug output trace mechanism and has a much larger code and data size. +Note +that these values will vary depending on the efficiency of the compiler +and the compiler options used during generation. Previous Release: @@ -5697,16 +10427,20 @@ 2) iASL Compiler/Disassembler: -iASL now fully disassembles SSDTs. However, External() statements are not +iASL now fully disassembles SSDTs. However, External() statements are +not generated automatically for unresolved symbols at this time. This is a planned feature for future implementation. -Fixed a scoping problem in the disassembler that occurs when the type of the +Fixed a scoping problem in the disassembler that occurs when the type of +the target of a Scope() operator is overridden. This problem caused an incorrectly nested internal namespace to be constructed. -Any warnings or errors that are emitted during disassembly are now commented -out automatically so that the resulting file can be recompiled without any +Any warnings or errors that are emitted during disassembly are now +commented +out automatically so that the resulting file can be recompiled without +any hand editing. ---------------------------------------- @@ -5717,8 +10451,10 @@ Implemented support for "wake" GPEs via interaction between GPEs and the _PRW methods. Every GPE that is pointed to by one or more _PRWs is identified as a WAKE GPE and by default will no longer be enabled at -runtime. Previously, we were blindly enabling all GPEs with a corresponding -_Lxx or _Exx method - but most of these turn out to be WAKE GPEs anyway. We +runtime. Previously, we were blindly enabling all GPEs with a +corresponding +_Lxx or _Exx method - but most of these turn out to be WAKE GPEs anyway. +We believe this has been the cause of thousands of "spurious" GPEs on some systems. @@ -5730,14 +10466,17 @@ (transferred to the target of the aliased method) before executing the target method. -Fixed a potential race condition on internal object deletion on the return +Fixed a potential race condition on internal object deletion on the +return object in AcpiEvaluateObject. Integrated a fix for resource descriptors where both _MEM and _MTP were being extracted instead of just _MEM. (i.e. bitmask was incorrectly too wide, 0x0F instead of 0x03.) -Added a special case for ACPI_ROOT_OBJECT in AcpiUtGetNodeName, preventing a +Added a special case for ACPI_ROOT_OBJECT in AcpiUtGetNodeName, +preventing +a fault in some cases. Updated Notify() values for debug statements in evmisc.c @@ -5745,11 +10484,14 @@ Return proper status from AcpiUtMutexInitialize, not just simply AE_OK. Code and Data Size: Current and previous core subsystem library sizes are -shown below. These are the code and data sizes for the acpica.lib produced +shown below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these values do not include any ACPI driver or OSPM code. The debug version of the code includes the -debug output trace mechanism and has a much larger code and data size. Note -that these values will vary depending on the efficiency of the compiler and +debug output trace mechanism and has a much larger code and data size. +Note +that these values will vary depending on the efficiency of the compiler +and the compiler options used during generation. Previous Release: @@ -5770,21 +10512,27 @@ installed in the namespace were not deleted. This caused all subsequent invocations of the method to return the AE_ALREADY_EXISTS exception. -Implemented a mechanism to force a control method to "Serialized" execution +Implemented a mechanism to force a control method to "Serialized" +execution if the method attempts to create namespace objects. (The root of the AE_ALREADY_EXISTS problem.) Implemented support for the predefined _OSI "internal" control method. -Initial supported strings are "Linux", "Windows 2000", "Windows 2001", and -"Windows 2001.1", and can be easily upgraded for new strings as necessary. +Initial supported strings are "Linux", "Windows 2000", "Windows 2001", +and +"Windows 2001.1", and can be easily upgraded for new strings as +necessary. This feature will allow "other" operating systems to execute the fully tested, "Windows" code path through the ASL code Global Lock Support: Now allows multiple acquires and releases with any -internal thread. Removed concept of "owning thread" for this special mutex. +internal thread. Removed concept of "owning thread" for this special +mutex. -Fixed two functions that were inappropriately declaring large objects on the -CPU stack: PsParseLoop, NsEvaluateRelative. Reduces the stack usage during +Fixed two functions that were inappropriately declaring large objects on +the +CPU stack: PsParseLoop, NsEvaluateRelative. Reduces the stack usage +during method execution considerably. Fixed a problem in the ACPI 2.0 FACS descriptor (actbl2.h) where the @@ -5793,16 +10541,21 @@ Fixed a problem where AcpiEvGpeDetect would fault if there were no GPEs defined on the machine. -Implemented two runtime options: One to force all control method execution -to "Serialized" to mimic Windows behavior, another to disable _OSI support +Implemented two runtime options: One to force all control method +execution +to "Serialized" to mimic Windows behavior, another to disable _OSI +support if it causes problems on a given machine. Code and Data Size: Current and previous core subsystem library sizes are -shown below. These are the code and data sizes for the acpica.lib produced +shown below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these values do not include any ACPI driver or OSPM code. The debug version of the code includes the -debug output trace mechanism and has a much larger code and data size. Note -that these values will vary depending on the efficiency of the compiler and +debug output trace mechanism and has a much larger code and data size. +Note +that these values will vary depending on the efficiency of the compiler +and the compiler options used during generation. Previous Release: @@ -5837,7 +10590,8 @@ After wake, clear GPE status register(s) before enabling GPEs. -After wake, clear/enable power button. (Perhaps we should clear/enable all +After wake, clear/enable power button. (Perhaps we should clear/enable +all fixed events upon wake.) Fixed a couple of possible memory leaks in the Namespace manager. @@ -5857,15 +10611,18 @@ fail if the store occurs within a different method than the method that created the package. -Fixed a problem where the ToDecimal operator could return incorrect results. +Fixed a problem where the ToDecimal operator could return incorrect +results. -Fixed a problem where the CopyObject operator could fail on some of the more +Fixed a problem where the CopyObject operator could fail on some of the +more obscure objects (e.g., Reference objects.) Improved the output of the Debug object to display buffer, package, and index objects. -Fixed a problem where constructs of the form "RefOf (ArgX)" did not return +Fixed a problem where constructs of the form "RefOf (ArgX)" did not +return the expected result. Added permanent ACPI_REPORT_ERROR macros for all instances of the @@ -5882,7 +10639,8 @@ 1) ACPI CA Core Subsystem: -Improved error messages when there is a problem finding one or more of the +Improved error messages when there is a problem finding one or more of +the required base ACPI tables Reintroduced the definition of APIC_HEADER in actbl.h @@ -5893,7 +10651,8 @@ 2) iASL compiler -Fixed a problem introduced in December that disabled the correct disassembly +Fixed a problem introduced in December that disabled the correct +disassembly of Resource Templates diff -Nru acpica-unix-20100528/common/adfile.c acpica-unix-20140114/common/adfile.c --- acpica-unix-20100528/common/adfile.c 2010-05-28 17:14:20.000000000 +0000 +++ acpica-unix-20140114/common/adfile.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,405 +0,0 @@ -/****************************************************************************** - * - * Module Name: adfile - Application-level disassembler file support routines - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - - -#include "acpi.h" -#include "accommon.h" -#include "acapps.h" - -#include - - -#define _COMPONENT ACPI_TOOLS - ACPI_MODULE_NAME ("adfile") - -/* Local prototypes */ - -INT32 -AdWriteBuffer ( - char *Filename, - char *Buffer, - UINT32 Length); - -char FilenameBuf[20]; - - -/****************************************************************************** - * - * FUNCTION: AfGenerateFilename - * - * PARAMETERS: Prefix - prefix string - * TableId - The table ID - * - * RETURN: Pointer to the completed string - * - * DESCRIPTION: Build an output filename from an ACPI table ID string - * - ******************************************************************************/ - -char * -AdGenerateFilename ( - char *Prefix, - char *TableId) -{ - UINT32 i; - UINT32 j; - - - for (i = 0; Prefix[i]; i++) - { - FilenameBuf[i] = Prefix[i]; - } - - FilenameBuf[i] = '_'; - i++; - - for (j = 0; j < 8 && (TableId[j] != ' ') && (TableId[j] != 0); i++, j++) - { - FilenameBuf[i] = TableId[j]; - } - - FilenameBuf[i] = 0; - strcat (FilenameBuf, ACPI_TABLE_FILE_SUFFIX); - return FilenameBuf; -} - - -/****************************************************************************** - * - * FUNCTION: AfWriteBuffer - * - * PARAMETERS: Filename - name of file - * Buffer - data to write - * Length - length of data - * - * RETURN: Actual number of bytes written - * - * DESCRIPTION: Open a file and write out a single buffer - * - ******************************************************************************/ - -INT32 -AdWriteBuffer ( - char *Filename, - char *Buffer, - UINT32 Length) -{ - FILE *fp; - ACPI_SIZE Actual; - - - fp = fopen (Filename, "wb"); - if (!fp) - { - printf ("Couldn't open %s\n", Filename); - return (-1); - } - - Actual = fwrite (Buffer, (size_t) Length, 1, fp); - fclose (fp); - return ((INT32) Actual); -} - - -/****************************************************************************** - * - * FUNCTION: AfWriteTable - * - * PARAMETERS: Table - pointer to the ACPI table - * Length - length of the table - * TableName - the table signature - * OemTableID - from the table header - * - * RETURN: None - * - * DESCRIPTION: Dump the loaded tables to a file (or files) - * - ******************************************************************************/ - -void -AdWriteTable ( - ACPI_TABLE_HEADER *Table, - UINT32 Length, - char *TableName, - char *OemTableId) -{ - char *Filename; - - - Filename = AdGenerateFilename (TableName, OemTableId); - AdWriteBuffer (Filename, (char *) Table, Length); - - AcpiOsPrintf ("Table [%s] written to \"%s\"\n", TableName, Filename); -} - - -/******************************************************************************* - * - * FUNCTION: FlGenerateFilename - * - * PARAMETERS: InputFilename - Original ASL source filename - * Suffix - New extension. - * - * RETURN: New filename containing the original base + the new suffix - * - * DESCRIPTION: Generate a new filename from the ASL source filename and a new - * extension. Used to create the *.LST, *.TXT, etc. files. - * - ******************************************************************************/ - -char * -FlGenerateFilename ( - char *InputFilename, - char *Suffix) -{ - char *Position; - char *NewFilename; - - - /* - * Copy the original filename to a new buffer. Leave room for the worst case - * where we append the suffix, an added dot and the null terminator. - */ - NewFilename = ACPI_ALLOCATE_ZEROED ((ACPI_SIZE) - strlen (InputFilename) + strlen (Suffix) + 2); - strcpy (NewFilename, InputFilename); - - /* Try to find the last dot in the filename */ - - Position = strrchr (NewFilename, '.'); - if (Position) - { - /* Tack on the new suffix */ - - Position++; - *Position = 0; - strcat (Position, Suffix); - } - else - { - /* No dot, add one and then the suffix */ - - strcat (NewFilename, "."); - strcat (NewFilename, Suffix); - } - - return NewFilename; -} - - -/******************************************************************************* - * - * FUNCTION: FlStrdup - * - * DESCRIPTION: Local strdup function - * - ******************************************************************************/ - -static char * -FlStrdup ( - char *String) -{ - char *NewString; - - - NewString = ACPI_ALLOCATE ((ACPI_SIZE) strlen (String) + 1); - if (!NewString) - { - return (NULL); - } - - strcpy (NewString, String); - return (NewString); -} - - -/******************************************************************************* - * - * FUNCTION: FlSplitInputPathname - * - * PARAMETERS: InputFilename - The user-specified ASL source file to be - * compiled - * OutDirectoryPath - Where the directory path prefix is - * returned - * OutFilename - Where the filename part is returned - * - * RETURN: Status - * - * DESCRIPTION: Split the input path into a directory and filename part - * 1) Directory part used to open include files - * 2) Filename part used to generate output filenames - * - ******************************************************************************/ - -ACPI_STATUS -FlSplitInputPathname ( - char *InputPath, - char **OutDirectoryPath, - char **OutFilename) -{ - char *Substring; - char *DirectoryPath; - char *Filename; - - - *OutDirectoryPath = NULL; - *OutFilename = NULL; - - if (!InputPath) - { - return (AE_OK); - } - - /* Get the path to the input filename's directory */ - - DirectoryPath = FlStrdup (InputPath); - if (!DirectoryPath) - { - return (AE_NO_MEMORY); - } - - Substring = strrchr (DirectoryPath, '\\'); - if (!Substring) - { - Substring = strrchr (DirectoryPath, '/'); - if (!Substring) - { - Substring = strrchr (DirectoryPath, ':'); - } - } - - if (!Substring) - { - DirectoryPath[0] = 0; - Filename = FlStrdup (InputPath); - } - else - { - Filename = FlStrdup (Substring + 1); - *(Substring+1) = 0; - } - - if (!Filename) - { - return (AE_NO_MEMORY); - } - - *OutDirectoryPath = DirectoryPath; - *OutFilename = Filename; - - return (AE_OK); -} - - diff -Nru acpica-unix-20100528/common/adisasm.c acpica-unix-20140114/common/adisasm.c --- acpica-unix-20100528/common/adisasm.c 2010-05-28 17:14:20.000000000 +0000 +++ acpica-unix-20140114/common/adisasm.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1214 +0,0 @@ -/****************************************************************************** - * - * Module Name: adisasm - Application-level disassembler routines - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - - -#include "acpi.h" -#include "accommon.h" -#include "acparser.h" -#include "amlcode.h" -#include "acdebug.h" -#include "acdisasm.h" -#include "acdispat.h" -#include "acnamesp.h" -#include "actables.h" -#include "acapps.h" - -#include -#include - - -#define _COMPONENT ACPI_TOOLS - ACPI_MODULE_NAME ("adisasm") - - -extern int AslCompilerdebug; -extern char *Gbl_ExternalFilename; - - -ACPI_STATUS -LsDisplayNamespace ( - void); - -void -LsSetupNsList ( - void *Handle); - - -/* Local prototypes */ - -void -AdCreateTableHeader ( - char *Filename, - ACPI_TABLE_HEADER *Table); - -void -AdDisassemblerHeader ( - char *Filename); - -ACPI_STATUS -AdDeferredParse ( - ACPI_PARSE_OBJECT *Op, - UINT8 *Aml, - UINT32 AmlLength); - -ACPI_STATUS -AdParseDeferredOps ( - ACPI_PARSE_OBJECT *Root); - - -/* Stubs for ASL compiler */ - -#ifndef ACPI_ASL_COMPILER -BOOLEAN -AcpiDsIsResultUsed ( - ACPI_PARSE_OBJECT *Op, - ACPI_WALK_STATE *WalkState) -{ - return TRUE; -} - -ACPI_STATUS -AcpiDsMethodError ( - ACPI_STATUS Status, - ACPI_WALK_STATE *WalkState) -{ - return (Status); -} -#endif - -ACPI_STATUS -AcpiNsLoadTable ( - UINT32 TableIndex, - ACPI_NAMESPACE_NODE *Node) -{ - return (AE_NOT_IMPLEMENTED); -} - -ACPI_STATUS -AcpiDsRestartControlMethod ( - ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT *ReturnDesc) -{ - return (AE_OK); -} - -void -AcpiDsTerminateControlMethod ( - ACPI_OPERAND_OBJECT *MethodDesc, - ACPI_WALK_STATE *WalkState) -{ - return; -} - -ACPI_STATUS -AcpiDsCallControlMethod ( - ACPI_THREAD_STATE *Thread, - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op) -{ - return (AE_OK); -} - -ACPI_STATUS -AcpiDsMethodDataInitArgs ( - ACPI_OPERAND_OBJECT **Params, - UINT32 MaxParamCount, - ACPI_WALK_STATE *WalkState) -{ - return (AE_OK); -} - - -static ACPI_TABLE_DESC LocalTables[1]; -static ACPI_PARSE_OBJECT *AcpiGbl_ParseOpRoot; - - -/******************************************************************************* - * - * FUNCTION: AdInitialize - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: ACPICA and local initialization - * - ******************************************************************************/ - -ACPI_STATUS -AdInitialize ( - void) -{ - ACPI_STATUS Status; - - - /* ACPI CA subsystem initialization */ - - Status = AcpiOsInitialize (); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - Status = AcpiUtInitGlobals (); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - Status = AcpiUtMutexInitialize (); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - Status = AcpiNsRootInitialize (); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Setup the Table Manager (cheat - there is no RSDT) */ - - AcpiGbl_RootTableList.MaxTableCount = 1; - AcpiGbl_RootTableList.CurrentTableCount = 0; - AcpiGbl_RootTableList.Tables = LocalTables; - - return (Status); -} - - -/****************************************************************************** - * - * FUNCTION: AdAmlDisassemble - * - * PARAMETERS: Filename - AML input filename - * OutToFile - TRUE if output should go to a file - * Prefix - Path prefix for output - * OutFilename - where the filename is returned - * GetAllTables - TRUE if all tables are desired - * - * RETURN: Status - * - * DESCRIPTION: Disassemble an entire ACPI table - * - *****************************************************************************/ - -ACPI_STATUS -AdAmlDisassemble ( - BOOLEAN OutToFile, - char *Filename, - char *Prefix, - char **OutFilename, - BOOLEAN GetAllTables) -{ - ACPI_STATUS Status; - char *DisasmFilename = NULL; - char *ExternalFilename; - FILE *File = NULL; - ACPI_TABLE_HEADER *Table = NULL; - ACPI_TABLE_HEADER *ExternalTable; - ACPI_OWNER_ID OwnerId; - - - /* - * Input: AML code from either a file or via GetTables (memory or - * registry) - */ - if (Filename) - { - Status = AcpiDbGetTableFromFile (Filename, &Table); - if (ACPI_FAILURE (Status)) - { - return Status; - } - - /* - * External filenames separated by commas - * Example: iasl -e file1,file2,file3 -d xxx.aml - */ - if (Gbl_ExternalFilename) - { - ExternalFilename = strtok (Gbl_ExternalFilename, ","); - - while (ExternalFilename) - { - Status = AcpiDbGetTableFromFile (ExternalFilename, &ExternalTable); - if (ACPI_FAILURE (Status)) - { - return Status; - } - - /* Load external table for symbol resolution */ - - if (ExternalTable) - { - Status = AdParseTable (ExternalTable, &OwnerId, TRUE, TRUE); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not parse external ACPI tables, %s\n", - AcpiFormatException (Status)); - return Status; - } - - /* - * Load namespace from names created within control methods - * Set owner id of nodes in external table - */ - AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot, - AcpiGbl_RootNode, OwnerId); - AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot); - } - - /* Next external file name */ - - ExternalFilename = strtok (NULL, ","); - } - - /* Clear external list generated by Scope in external tables */ - - AcpiDmClearExternalList (); - } - } - else - { - Status = AdGetLocalTables (Filename, GetAllTables); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not get ACPI tables, %s\n", - AcpiFormatException (Status)); - return Status; - } - - if (!AcpiGbl_DbOpt_disasm) - { - return AE_OK; - } - - /* Obtained the local tables, just disassemble the DSDT */ - - Status = AcpiGetTable (ACPI_SIG_DSDT, 0, &Table); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not get DSDT, %s\n", - AcpiFormatException (Status)); - return Status; - } - - AcpiOsPrintf ("\nDisassembly of DSDT\n"); - Prefix = AdGenerateFilename ("dsdt", Table->OemTableId); - } - - /* - * Output: ASL code. Redirect to a file if requested - */ - if (OutToFile) - { - /* Create/Open a disassembly output file */ - - DisasmFilename = FlGenerateFilename (Prefix, FILE_SUFFIX_DISASSEMBLY); - if (!OutFilename) - { - fprintf (stderr, "Could not generate output filename\n"); - Status = AE_ERROR; - goto Cleanup; - } - - File = fopen (DisasmFilename, "w+"); - if (!File) - { - fprintf (stderr, "Could not open output file %s\n", DisasmFilename); - Status = AE_ERROR; - goto Cleanup; - } - - AcpiOsRedirectOutput (File); - } - - *OutFilename = DisasmFilename; - - if (!AcpiUtIsAmlTable (Table)) - { - AdDisassemblerHeader (Filename); - AcpiOsPrintf (" * ACPI Data Table [%4.4s]\n *\n", - Table->Signature); - AcpiOsPrintf (" * Format: [HexOffset DecimalOffset ByteLength] FieldName : FieldValue\n */\n\n"); - - AcpiDmDumpDataTable (Table); - fprintf (stderr, "Acpi Data Table [%4.4s] decoded, written to \"%s\"\n", - Table->Signature, DisasmFilename); - } - else - { - /* Always parse the tables, only option is what to display */ - - Status = AdParseTable (Table, &OwnerId, TRUE, FALSE); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not parse ACPI tables, %s\n", - AcpiFormatException (Status)); - goto Cleanup; - } - - if (AslCompilerdebug) - { - AcpiOsPrintf ("/**** Before second load\n"); - - LsSetupNsList (File); - LsDisplayNamespace (); - AcpiOsPrintf ("*****/\n"); - } - - /* - * Load namespace from names created within control methods - */ - AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode, OwnerId); - - /* - * Cross reference the namespace here, in order to generate External() statements - */ - AcpiDmCrossReferenceNamespace (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode, OwnerId); - - if (AslCompilerdebug) - { - AcpiDmDumpTree (AcpiGbl_ParseOpRoot); - } - - /* Find possible calls to external control methods */ - - AcpiDmFindOrphanMethods (AcpiGbl_ParseOpRoot); - - /* Convert fixed-offset references to resource descriptors to symbolic references */ - - AcpiDmConvertResourceIndexes (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode); - - /* - * If we found any external control methods, we must reparse the entire - * tree with the new information (namely, the number of arguments per - * method) - */ - if (AcpiDmGetExternalMethodCount ()) - { - fprintf (stderr, - "\nFound %u external control methods, reparsing with new information\n", - AcpiDmGetExternalMethodCount ()); - - /* - * Reparse, rebuild namespace. no need to xref namespace - */ - AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot); - AcpiNsDeleteNamespaceSubtree (AcpiGbl_RootNode); - - AcpiGbl_RootNode = NULL; - AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME; - AcpiGbl_RootNodeStruct.DescriptorType = ACPI_DESC_TYPE_NAMED; - AcpiGbl_RootNodeStruct.Type = ACPI_TYPE_DEVICE; - AcpiGbl_RootNodeStruct.Parent = NULL; - AcpiGbl_RootNodeStruct.Child = NULL; - AcpiGbl_RootNodeStruct.Peer = NULL; - AcpiGbl_RootNodeStruct.Object = NULL; - AcpiGbl_RootNodeStruct.Flags = 0; - - Status = AcpiNsRootInitialize (); - AcpiDmAddExternalsToNamespace (); - - /* Parse table. No need to reload it, however (FALSE) */ - - Status = AdParseTable (Table, NULL, FALSE, FALSE); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not parse ACPI tables, %s\n", - AcpiFormatException (Status)); - goto Cleanup; - } - - if (AslCompilerdebug) - { - AcpiOsPrintf ("/**** After second load and resource conversion\n"); - LsSetupNsList (File); - LsDisplayNamespace (); - AcpiOsPrintf ("*****/\n"); - - AcpiDmDumpTree (AcpiGbl_ParseOpRoot); - } - } - - /* Optional displays */ - - if (AcpiGbl_DbOpt_disasm) - { - AdDisplayTables (Filename, Table); - fprintf (stderr, - "Disassembly completed, written to \"%s\"\n", - DisasmFilename); - } - } - -Cleanup: - - if (Table && !AcpiUtIsAmlTable (Table)) - { - ACPI_FREE (Table); - } - - if (DisasmFilename) - { - ACPI_FREE (DisasmFilename); - } - - if (OutToFile && File) - { - -#ifdef ASL_DISASM_DEBUG - LsSetupNsList (File); - LsDisplayNamespace (); -#endif - fclose (File); - AcpiOsRedirectOutput (stdout); - } - - AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot); - AcpiGbl_ParseOpRoot = NULL; - return (Status); -} - - -/****************************************************************************** - * - * FUNCTION: AdDisassemblerHeader - * - * PARAMETERS: Filename - Input file for the table - * - * RETURN: None - * - * DESCRIPTION: Create the disassembler header, including ACPI CA signon with - * current time and date. - * - *****************************************************************************/ - -void -AdDisassemblerHeader ( - char *Filename) -{ - time_t Timer; - - time (&Timer); - - /* Header and input table info */ - - AcpiOsPrintf ("/*\n * Intel ACPI Component Architecture\n"); - AcpiOsPrintf (" * AML Disassembler version %8.8X\n", ACPI_CA_VERSION); - - AcpiOsPrintf (" *\n * Disassembly of %s, %s", Filename, ctime (&Timer)); - AcpiOsPrintf (" *\n"); -} - - -/****************************************************************************** - * - * FUNCTION: AdCreateTableHeader - * - * PARAMETERS: Filename - Input file for the table - * Table - Pointer to the raw table - * - * RETURN: None - * - * DESCRIPTION: Create the ASL table header, including ACPI CA signon with - * current time and date. - * - *****************************************************************************/ - -void -AdCreateTableHeader ( - char *Filename, - ACPI_TABLE_HEADER *Table) -{ - char *NewFilename; - UINT8 Checksum; - - - /* - * Print file header and dump original table header - */ - AdDisassemblerHeader (Filename); - - AcpiOsPrintf (" *\n * Original Table Header:\n"); - AcpiOsPrintf (" * Signature \"%4.4s\"\n", Table->Signature); - AcpiOsPrintf (" * Length 0x%8.8X (%u)\n", Table->Length, Table->Length); - - /* Print and validate the revision */ - - AcpiOsPrintf (" * Revision 0x%2.2X", Table->Revision); - - switch (Table->Revision) - { - case 0: - AcpiOsPrintf (" **** Invalid Revision"); - break; - - case 1: - /* Revision of DSDT controls the ACPI integer width */ - - if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_DSDT)) - { - AcpiOsPrintf (" **** ACPI 1.0, no 64-bit math support"); - } - break; - - default: - break; - } - AcpiOsPrintf ("\n"); - - /* Print and validate the table checksum */ - - AcpiOsPrintf (" * Checksum 0x%2.2X", Table->Checksum); - - Checksum = AcpiTbChecksum (ACPI_CAST_PTR (UINT8, Table), Table->Length); - if (Checksum) - { - AcpiOsPrintf (" **** Incorrect checksum, should be 0x%2.2X", - (UINT8) (Table->Checksum - Checksum)); - } - AcpiOsPrintf ("\n"); - - AcpiOsPrintf (" * OEM ID \"%.6s\"\n", Table->OemId); - AcpiOsPrintf (" * OEM Table ID \"%.8s\"\n", Table->OemTableId); - AcpiOsPrintf (" * OEM Revision 0x%8.8X (%u)\n", Table->OemRevision, Table->OemRevision); - AcpiOsPrintf (" * Compiler ID \"%.4s\"\n", Table->AslCompilerId); - AcpiOsPrintf (" * Compiler Version 0x%8.8X (%u)\n", Table->AslCompilerRevision, Table->AslCompilerRevision); - AcpiOsPrintf (" */\n"); - - /* Create AML output filename based on input filename */ - - if (Filename) - { - NewFilename = FlGenerateFilename (Filename, "aml"); - } - else - { - NewFilename = ACPI_ALLOCATE_ZEROED (9); - strncat (NewFilename, Table->Signature, 4); - strcat (NewFilename, ".aml"); - } - - /* Open the ASL definition block */ - - AcpiOsPrintf ( - "DefinitionBlock (\"%s\", \"%4.4s\", %hu, \"%.6s\", \"%.8s\", 0x%8.8X)\n", - NewFilename, Table->Signature, Table->Revision, - Table->OemId, Table->OemTableId, Table->OemRevision); - - ACPI_FREE (NewFilename); -} - - -/****************************************************************************** - * - * FUNCTION: AdDisplayTables - * - * PARAMETERS: Filename - Input file for the table - * Table - Pointer to the raw table - * - * RETURN: Status - * - * DESCRIPTION: Display (disassemble) loaded tables and dump raw tables - * - *****************************************************************************/ - -ACPI_STATUS -AdDisplayTables ( - char *Filename, - ACPI_TABLE_HEADER *Table) -{ - - - if (!AcpiGbl_ParseOpRoot) - { - return AE_NOT_EXIST; - } - - if (!AcpiGbl_DbOpt_verbose) - { - AdCreateTableHeader (Filename, Table); - } - - AcpiDmDisassemble (NULL, AcpiGbl_ParseOpRoot, ACPI_UINT32_MAX); - - if (AcpiGbl_DbOpt_verbose) - { - AcpiOsPrintf ("\n\nTable Header:\n"); - AcpiUtDumpBuffer ((UINT8 *) Table, sizeof (ACPI_TABLE_HEADER), - DB_BYTE_DISPLAY, ACPI_UINT32_MAX); - - AcpiOsPrintf ("Table Body (Length 0x%X)\n", Table->Length); - AcpiUtDumpBuffer (((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER)), Table->Length, - DB_BYTE_DISPLAY, ACPI_UINT32_MAX); - } - - return AE_OK; -} - - -/****************************************************************************** - * - * FUNCTION: AdDeferredParse - * - * PARAMETERS: Op - Root Op of the deferred opcode - * Aml - Pointer to the raw AML - * AmlLength - Length of the AML - * - * RETURN: Status - * - * DESCRIPTION: Parse one deferred opcode - * (Methods, operation regions, etc.) - * - *****************************************************************************/ - -ACPI_STATUS -AdDeferredParse ( - ACPI_PARSE_OBJECT *Op, - UINT8 *Aml, - UINT32 AmlLength) -{ - ACPI_WALK_STATE *WalkState; - ACPI_STATUS Status; - ACPI_PARSE_OBJECT *SearchOp; - ACPI_PARSE_OBJECT *StartOp; - UINT32 BaseAmlOffset; - ACPI_PARSE_OBJECT *ExtraOp; - - - ACPI_FUNCTION_TRACE (AdDeferredParse); - - - fprintf (stderr, "."); - - if (!Aml || !AmlLength) - { - return_ACPI_STATUS (AE_OK); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Parsing %s [%4.4s]\n", - Op->Common.AmlOpName, (char *) &Op->Named.Name)); - - WalkState = AcpiDsCreateWalkState (0, Op, NULL, NULL); - if (!WalkState) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, Aml, - AmlLength, NULL, ACPI_IMODE_LOAD_PASS1); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Parse the method */ - - WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE; - WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE; - Status = AcpiPsParseAml (WalkState); - - /* - * We need to update all of the Aml offsets, since the parser thought - * that the method began at offset zero. In reality, it began somewhere - * within the ACPI table, at the BaseAmlOffset. Walk the entire tree that - * was just created and update the AmlOffset in each Op - */ - BaseAmlOffset = (Op->Common.Value.Arg)->Common.AmlOffset + 1; - StartOp = (Op->Common.Value.Arg)->Common.Next; - SearchOp = StartOp; - - /* Walk the parse tree */ - - while (SearchOp) - { - SearchOp->Common.AmlOffset += BaseAmlOffset; - SearchOp = AcpiPsGetDepthNext (StartOp, SearchOp); - } - - /* - * Link the newly parsed subtree into the main parse tree - */ - switch (Op->Common.AmlOpcode) - { - case AML_BUFFER_OP: - case AML_PACKAGE_OP: - case AML_VAR_PACKAGE_OP: - - switch (Op->Common.AmlOpcode) - { - case AML_PACKAGE_OP: - ExtraOp = Op->Common.Value.Arg; - ExtraOp = ExtraOp->Common.Next; - Op->Common.Value.Arg = ExtraOp->Common.Value.Arg; - break; - - case AML_VAR_PACKAGE_OP: - case AML_BUFFER_OP: - default: - ExtraOp = Op->Common.Value.Arg; - Op->Common.Value.Arg = ExtraOp->Common.Value.Arg; - break; - } - - /* Must point all parents to the main tree */ - - StartOp = Op; - SearchOp = StartOp; - while (SearchOp) - { - if (SearchOp->Common.Parent == ExtraOp) - { - SearchOp->Common.Parent = Op; - } - SearchOp = AcpiPsGetDepthNext (StartOp, SearchOp); - } - break; - - default: - break; - } - - return_ACPI_STATUS (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: AdParseDeferredOps - * - * PARAMETERS: Root - Root of the parse tree - * - * RETURN: Status - * - * DESCRIPTION: Parse the deferred opcodes (Methods, regions, etc.) - * - *****************************************************************************/ - -ACPI_STATUS -AdParseDeferredOps ( - ACPI_PARSE_OBJECT *Root) -{ - ACPI_PARSE_OBJECT *Op = Root; - ACPI_STATUS Status = AE_OK; - const ACPI_OPCODE_INFO *OpInfo; - - - ACPI_FUNCTION_NAME (AdParseDeferredOps); - fprintf (stderr, "Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)\n"); - - while (Op) - { - OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - if (!(OpInfo->Flags & AML_DEFER)) - { - Op = AcpiPsGetDepthNext (Root, Op); - continue; - } - - switch (Op->Common.AmlOpcode) - { - case AML_METHOD_OP: - case AML_BUFFER_OP: - case AML_PACKAGE_OP: - case AML_VAR_PACKAGE_OP: - - Status = AdDeferredParse (Op, Op->Named.Data, Op->Named.Length); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - break; - - case AML_REGION_OP: - case AML_CREATE_QWORD_FIELD_OP: - case AML_CREATE_DWORD_FIELD_OP: - case AML_CREATE_WORD_FIELD_OP: - case AML_CREATE_BYTE_FIELD_OP: - case AML_CREATE_BIT_FIELD_OP: - case AML_CREATE_FIELD_OP: - case AML_BANK_FIELD_OP: - - /* Nothing to do in these cases */ - - break; - - default: - ACPI_ERROR ((AE_INFO, "Unhandled deferred opcode [%s]", - Op->Common.AmlOpName)); - break; - } - - Op = AcpiPsGetDepthNext (Root, Op); - } - - fprintf (stderr, "\n"); - return Status; -} - - -/****************************************************************************** - * - * FUNCTION: AdGetLocalTables - * - * PARAMETERS: Filename - Not used - * GetAllTables - TRUE if all tables are desired - * - * RETURN: Status - * - * DESCRIPTION: Get the ACPI tables from either memory or a file - * - *****************************************************************************/ - -ACPI_STATUS -AdGetLocalTables ( - char *Filename, - BOOLEAN GetAllTables) -{ - ACPI_STATUS Status; - ACPI_TABLE_HEADER TableHeader; - ACPI_TABLE_HEADER *NewTable; - UINT32 NumTables; - UINT32 PointerSize; - UINT32 TableIndex; - - - if (GetAllTables) - { - ACPI_MOVE_32_TO_32 (TableHeader.Signature, ACPI_SIG_RSDT); - AcpiOsTableOverride (&TableHeader, &NewTable); - if (!NewTable) - { - fprintf (stderr, "Could not obtain RSDT\n"); - return AE_NO_ACPI_TABLES; - } - else - { - AdWriteTable (NewTable, NewTable->Length, - ACPI_SIG_RSDT, NewTable->OemTableId); - } - - if (ACPI_COMPARE_NAME (NewTable->Signature, ACPI_SIG_RSDT)) - { - PointerSize = sizeof (UINT32); - } - else - { - PointerSize = sizeof (UINT64); - } - - /* - * Determine the number of tables pointed to by the RSDT/XSDT. - * This is defined by the ACPI Specification to be the number of - * pointers contained within the RSDT/XSDT. The size of the pointers - * is architecture-dependent. - */ - NumTables = (NewTable->Length - sizeof (ACPI_TABLE_HEADER)) / PointerSize; - AcpiOsPrintf ("There are %u tables defined in the %4.4s\n\n", - NumTables, NewTable->Signature); - - /* Get the FADT */ - - ACPI_MOVE_32_TO_32 (TableHeader.Signature, ACPI_SIG_FADT); - AcpiOsTableOverride (&TableHeader, &NewTable); - if (NewTable) - { - AdWriteTable (NewTable, NewTable->Length, - ACPI_SIG_FADT, NewTable->OemTableId); - } - AcpiOsPrintf ("\n"); - - /* Don't bother with FACS, it is usually all zeros */ - } - - /* Always get the DSDT */ - - ACPI_MOVE_32_TO_32 (TableHeader.Signature, ACPI_SIG_DSDT); - AcpiOsTableOverride (&TableHeader, &NewTable); - if (NewTable) - { - AdWriteTable (NewTable, NewTable->Length, - ACPI_SIG_DSDT, NewTable->OemTableId); - - /* Store DSDT in the Table Manager */ - - Status = AcpiTbStoreTable (0, NewTable, NewTable->Length, - 0, &TableIndex); - if (ACPI_FAILURE (Status)) - { - fprintf (stderr, "Could not store DSDT\n"); - return AE_NO_ACPI_TABLES; - } - } - else - { - fprintf (stderr, "Could not obtain DSDT\n"); - return AE_NO_ACPI_TABLES; - } - -#if 0 - /* TBD: Future implementation */ - - AcpiOsPrintf ("\n"); - - /* Get all SSDTs */ - - ACPI_MOVE_32_TO_32 (TableHeader.Signature, ACPI_SIG_SSDT); - do - { - NewTable = NULL; - Status = AcpiOsTableOverride (&TableHeader, &NewTable); - - } while (NewTable); -#endif - - return AE_OK; -} - - -/****************************************************************************** - * - * FUNCTION: AdParseTable - * - * PARAMETERS: Table - Pointer to the raw table - * OwnerId - Returned OwnerId of the table - * LoadTable - If add table to the global table list - * External - If this is an external table - * - * RETURN: Status - * - * DESCRIPTION: Parse the DSDT. - * - *****************************************************************************/ - -ACPI_STATUS -AdParseTable ( - ACPI_TABLE_HEADER *Table, - ACPI_OWNER_ID *OwnerId, - BOOLEAN LoadTable, - BOOLEAN External) -{ - ACPI_STATUS Status = AE_OK; - ACPI_WALK_STATE *WalkState; - UINT8 *AmlStart; - UINT32 AmlLength; - UINT32 TableIndex; - - - if (!Table) - { - return AE_NOT_EXIST; - } - - /* Pass 1: Parse everything except control method bodies */ - - fprintf (stderr, "Pass 1 parse of [%4.4s]\n", (char *) Table->Signature); - - AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER); - AmlStart = ((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER)); - - /* Create the root object */ - - AcpiGbl_ParseOpRoot = AcpiPsCreateScopeOp (); - if (!AcpiGbl_ParseOpRoot) - { - return AE_NO_MEMORY; - } - - /* Create and initialize a new walk state */ - - WalkState = AcpiDsCreateWalkState (0, - AcpiGbl_ParseOpRoot, NULL, NULL); - if (!WalkState) - { - return (AE_NO_MEMORY); - } - - Status = AcpiDsInitAmlWalk (WalkState, AcpiGbl_ParseOpRoot, - NULL, AmlStart, AmlLength, NULL, ACPI_IMODE_LOAD_PASS1); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE; - WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE; - - Status = AcpiPsParseAml (WalkState); - if (ACPI_FAILURE (Status)) - { - return Status; - } - - /* If LoadTable is FALSE, we are parsing the last loaded table */ - - TableIndex = AcpiGbl_RootTableList.CurrentTableCount - 1; - - /* Pass 2 */ - - if (LoadTable) - { - Status = AcpiTbStoreTable ((ACPI_PHYSICAL_ADDRESS) Table, Table, - Table->Length, ACPI_TABLE_ORIGIN_ALLOCATED, &TableIndex); - if (ACPI_FAILURE (Status)) - { - return Status; - } - Status = AcpiTbAllocateOwnerId (TableIndex); - if (ACPI_FAILURE (Status)) - { - return Status; - } - if (OwnerId) - { - Status = AcpiTbGetOwnerId (TableIndex, OwnerId); - if (ACPI_FAILURE (Status)) - { - return Status; - } - } - } - - fprintf (stderr, "Pass 2 parse of [%4.4s]\n", (char *) Table->Signature); - - Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS2, TableIndex, NULL); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* No need to parse control methods of external table */ - - if (External) - { - return AE_OK; - } - - /* Pass 3: Parse control methods and link their parse trees into the main parse tree */ - - Status = AdParseDeferredOps (AcpiGbl_ParseOpRoot); - - /* Process Resource Templates */ - - AcpiDmFindResources (AcpiGbl_ParseOpRoot); - - fprintf (stderr, "Parsing completed\n"); - return AE_OK; -} - - diff -Nru acpica-unix-20100528/common/adwalk.c acpica-unix-20140114/common/adwalk.c --- acpica-unix-20100528/common/adwalk.c 2010-05-28 17:14:20.000000000 +0000 +++ acpica-unix-20140114/common/adwalk.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1076 +0,0 @@ -/****************************************************************************** - * - * Module Name: adwalk - Application-level disassembler parse tree walk routines - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - - -#include "acpi.h" -#include "accommon.h" -#include "acparser.h" -#include "amlcode.h" -#include "acdisasm.h" -#include "acdispat.h" -#include "acnamesp.h" -#include "acapps.h" - - -#define _COMPONENT ACPI_TOOLS - ACPI_MODULE_NAME ("adwalk") - -/* - * aslmap - opcode mappings and reserved method names - */ -ACPI_OBJECT_TYPE -AslMapNamedOpcodeToDataType ( - UINT16 Opcode); - -/* Local prototypes */ - -static ACPI_STATUS -AcpiDmFindOrphanDescending ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -static ACPI_STATUS -AcpiDmDumpDescending ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -static ACPI_STATUS -AcpiDmXrefDescendingOp ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -static ACPI_STATUS -AcpiDmCommonAscendingOp ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -static ACPI_STATUS -AcpiDmLoadDescendingOp ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -static UINT32 -AcpiDmInspectPossibleArgs ( - UINT32 CurrentOpArgCount, - UINT32 TargetCount, - ACPI_PARSE_OBJECT *Op); - -static ACPI_STATUS -AcpiDmResourceDescendingOp ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - - -/******************************************************************************* - * - * FUNCTION: AcpiDmDumpTree - * - * PARAMETERS: Origin - Starting object - * - * RETURN: None - * - * DESCRIPTION: Parse tree walk to format and output the nodes - * - ******************************************************************************/ - -void -AcpiDmDumpTree ( - ACPI_PARSE_OBJECT *Origin) -{ - ACPI_OP_WALK_INFO Info; - - - if (!Origin) - { - return; - } - - AcpiOsPrintf ("/*\nAML Parse Tree\n\n"); - Info.Flags = 0; - Info.Count = 0; - Info.Level = 0; - Info.WalkState = NULL; - AcpiDmWalkParseTree (Origin, AcpiDmDumpDescending, NULL, &Info); - AcpiOsPrintf ("*/\n\n"); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmFindOrphanMethods - * - * PARAMETERS: Origin - Starting object - * - * RETURN: None - * - * DESCRIPTION: Parse tree walk to find "orphaned" method invocations -- methods - * that are not resolved in the namespace - * - ******************************************************************************/ - -void -AcpiDmFindOrphanMethods ( - ACPI_PARSE_OBJECT *Origin) -{ - ACPI_OP_WALK_INFO Info; - - - if (!Origin) - { - return; - } - - Info.Flags = 0; - Info.Level = 0; - Info.WalkState = NULL; - AcpiDmWalkParseTree (Origin, AcpiDmFindOrphanDescending, NULL, &Info); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmFinishNamespaceLoad - * - * PARAMETERS: ParseTreeRoot - Root of the parse tree - * NamespaceRoot - Root of the internal namespace - * OwnerId - OwnerId of the table to be disassembled - * - * RETURN: None - * - * DESCRIPTION: Load all namespace items that are created within control - * methods. Used before namespace cross reference - * - ******************************************************************************/ - -void -AcpiDmFinishNamespaceLoad ( - ACPI_PARSE_OBJECT *ParseTreeRoot, - ACPI_NAMESPACE_NODE *NamespaceRoot, - ACPI_OWNER_ID OwnerId) -{ - ACPI_STATUS Status; - ACPI_OP_WALK_INFO Info; - ACPI_WALK_STATE *WalkState; - - - if (!ParseTreeRoot) - { - return; - } - - /* Create and initialize a new walk state */ - - WalkState = AcpiDsCreateWalkState (OwnerId, ParseTreeRoot, NULL, NULL); - if (!WalkState) - { - return; - } - - Status = AcpiDsScopeStackPush (NamespaceRoot, NamespaceRoot->Type, WalkState); - if (ACPI_FAILURE (Status)) - { - return; - } - - Info.Flags = 0; - Info.Level = 0; - Info.WalkState = WalkState; - AcpiDmWalkParseTree (ParseTreeRoot, AcpiDmLoadDescendingOp, - AcpiDmCommonAscendingOp, &Info); - ACPI_FREE (WalkState); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmCrossReferenceNamespace - * - * PARAMETERS: ParseTreeRoot - Root of the parse tree - * NamespaceRoot - Root of the internal namespace - * OwnerId - OwnerId of the table to be disassembled - * - * RETURN: None - * - * DESCRIPTION: Cross reference the namespace to create externals - * - ******************************************************************************/ - -void -AcpiDmCrossReferenceNamespace ( - ACPI_PARSE_OBJECT *ParseTreeRoot, - ACPI_NAMESPACE_NODE *NamespaceRoot, - ACPI_OWNER_ID OwnerId) -{ - ACPI_STATUS Status; - ACPI_OP_WALK_INFO Info; - ACPI_WALK_STATE *WalkState; - - - if (!ParseTreeRoot) - { - return; - } - - /* Create and initialize a new walk state */ - - WalkState = AcpiDsCreateWalkState (OwnerId, ParseTreeRoot, NULL, NULL); - if (!WalkState) - { - return; - } - - Status = AcpiDsScopeStackPush (NamespaceRoot, NamespaceRoot->Type, WalkState); - if (ACPI_FAILURE (Status)) - { - return; - } - - Info.Flags = 0; - Info.Level = 0; - Info.WalkState = WalkState; - AcpiDmWalkParseTree (ParseTreeRoot, AcpiDmXrefDescendingOp, - AcpiDmCommonAscendingOp, &Info); - ACPI_FREE (WalkState); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmConvertResourceIndexes - * - * PARAMETERS: ParseTreeRoot - Root of the parse tree - * NamespaceRoot - Root of the internal namespace - * - * RETURN: None - * - * DESCRIPTION: Convert fixed-offset references to resource descriptors to - * symbolic references. Should only be called after namespace has - * been cross referenced. - * - ******************************************************************************/ - -void -AcpiDmConvertResourceIndexes ( - ACPI_PARSE_OBJECT *ParseTreeRoot, - ACPI_NAMESPACE_NODE *NamespaceRoot) -{ - ACPI_STATUS Status; - ACPI_OP_WALK_INFO Info; - ACPI_WALK_STATE *WalkState; - - - if (!ParseTreeRoot) - { - return; - } - - /* Create and initialize a new walk state */ - - WalkState = AcpiDsCreateWalkState (0, ParseTreeRoot, NULL, NULL); - if (!WalkState) - { - return; - } - - Status = AcpiDsScopeStackPush (NamespaceRoot, NamespaceRoot->Type, WalkState); - if (ACPI_FAILURE (Status)) - { - return; - } - - Info.Flags = 0; - Info.Level = 0; - Info.WalkState = WalkState; - AcpiDmWalkParseTree (ParseTreeRoot, AcpiDmResourceDescendingOp, - AcpiDmCommonAscendingOp, &Info); - ACPI_FREE (WalkState); - return; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmDumpDescending - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Format and print contents of one parse Op. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDmDumpDescending ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ACPI_OP_WALK_INFO *Info = Context; - char *Path; - - - if (!Op) - { - return (AE_OK); - } - - /* Most of the information (count, level, name) here */ - - Info->Count++; - AcpiOsPrintf ("% 5d [%2.2d] ", Info->Count, Level); - AcpiDmIndent (Level); - AcpiOsPrintf ("%-28s", AcpiPsGetOpcodeName (Op->Common.AmlOpcode)); - - /* Extra info is helpful */ - - switch (Op->Common.AmlOpcode) - { - case AML_BYTE_OP: - case AML_WORD_OP: - case AML_DWORD_OP: - AcpiOsPrintf ("%X", (UINT32) Op->Common.Value.Integer); - break; - - case AML_INT_NAMEPATH_OP: - if (Op->Common.Value.String) - { - AcpiNsExternalizeName (ACPI_UINT32_MAX, Op->Common.Value.String, - NULL, &Path); - AcpiOsPrintf ("%s %p", Path, Op->Common.Node); - ACPI_FREE (Path); - } - else - { - AcpiOsPrintf ("[NULL]"); - } - break; - - case AML_NAME_OP: - case AML_METHOD_OP: - case AML_DEVICE_OP: - case AML_INT_NAMEDFIELD_OP: - AcpiOsPrintf ("%4.4s", ACPI_CAST_PTR (char, &Op->Named.Name)); - break; - - default: - break; - } - - AcpiOsPrintf ("\n"); - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmFindOrphanDescending - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Check namepath Ops for orphaned method invocations - * - * Note: Experimental. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDmFindOrphanDescending ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - const ACPI_OPCODE_INFO *OpInfo; - ACPI_PARSE_OBJECT *ChildOp; - ACPI_PARSE_OBJECT *NextOp; - ACPI_PARSE_OBJECT *ParentOp; - UINT32 ArgCount; - - - if (!Op) - { - return (AE_OK); - } - - OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - - switch (Op->Common.AmlOpcode) - { -#ifdef ACPI_UNDER_DEVELOPMENT - case AML_ADD_OP: - ChildOp = Op->Common.Value.Arg; - if ((ChildOp->Common.AmlOpcode == AML_INT_NAMEPATH_OP) && - !ChildOp->Common.Node) - { - AcpiNsExternalizeName (ACPI_UINT32_MAX, ChildOp->Common.Value.String, - NULL, &Path); - AcpiOsPrintf ("/* %-16s A-NAMEPATH: %s */\n", Op->Common.AmlOpName, Path); - ACPI_FREE (Path); - - NextOp = Op->Common.Next; - if (!NextOp) - { - /* This NamePath has no args, assume it is an integer */ - - AcpiDmAddToExternalList (ChildOp, ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0); - return (AE_OK); - } - - ArgCount = AcpiDmInspectPossibleArgs (3, 1, NextOp); - AcpiOsPrintf ("/* A-CHILDREN: %u Actual %u */\n", ArgCount, AcpiDmCountChildren (Op)); - - if (ArgCount < 1) - { - /* One Arg means this is just a Store(Name,Target) */ - - AcpiDmAddToExternalList (ChildOp, ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0); - return (AE_OK); - } - - AcpiDmAddToExternalList (ChildOp, ChildOp->Common.Value.String, ACPI_TYPE_METHOD, ArgCount); - } - break; -#endif - - case AML_STORE_OP: - - ChildOp = Op->Common.Value.Arg; - if ((ChildOp->Common.AmlOpcode == AML_INT_NAMEPATH_OP) && - !ChildOp->Common.Node) - { - NextOp = Op->Common.Next; - if (!NextOp) - { - /* This NamePath has no args, assume it is an integer */ - - AcpiDmAddToExternalList (ChildOp, ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0); - return (AE_OK); - } - - ArgCount = AcpiDmInspectPossibleArgs (2, 1, NextOp); - if (ArgCount <= 1) - { - /* One Arg means this is just a Store(Name,Target) */ - - AcpiDmAddToExternalList (ChildOp, ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0); - return (AE_OK); - } - - AcpiDmAddToExternalList (ChildOp, ChildOp->Common.Value.String, ACPI_TYPE_METHOD, ArgCount); - } - break; - - case AML_INT_NAMEPATH_OP: - - /* Must examine parent to see if this namepath is an argument */ - - ParentOp = Op->Common.Parent; - OpInfo = AcpiPsGetOpcodeInfo (ParentOp->Common.AmlOpcode); - - if ((OpInfo->Class != AML_CLASS_EXECUTE) && - (OpInfo->Class != AML_CLASS_CREATE) && - (ParentOp->Common.AmlOpcode != AML_INT_METHODCALL_OP) && - !Op->Common.Node) - { - ArgCount = AcpiDmInspectPossibleArgs (0, 0, Op->Common.Next); - - /* - * Check if namepath is a predicate for if/while or lone parameter to - * a return. - */ - if (ArgCount == 0) - { - if (((ParentOp->Common.AmlOpcode == AML_IF_OP) || - (ParentOp->Common.AmlOpcode == AML_WHILE_OP) || - (ParentOp->Common.AmlOpcode == AML_RETURN_OP)) && - - /* And namepath is the first argument */ - (ParentOp->Common.Value.Arg == Op)) - { - AcpiDmAddToExternalList (Op, Op->Common.Value.String, ACPI_TYPE_INTEGER, 0); - break; - } - } - - /* - * This is a standalone namestring (not a parameter to another - * operator) - it *must* be a method invocation, nothing else is - * grammatically possible. - */ - AcpiDmAddToExternalList (Op, Op->Common.Value.String, ACPI_TYPE_METHOD, ArgCount); - - } - break; - - default: - break; - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmLoadDescendingOp - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Descending handler for namespace control method object load - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDmLoadDescendingOp ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ACPI_OP_WALK_INFO *Info = Context; - const ACPI_OPCODE_INFO *OpInfo; - ACPI_WALK_STATE *WalkState; - ACPI_OBJECT_TYPE ObjectType; - ACPI_STATUS Status; - char *Path = NULL; - ACPI_PARSE_OBJECT *NextOp; - ACPI_NAMESPACE_NODE *Node; - char FieldPath[5]; - BOOLEAN PreDefined = FALSE; - UINT8 PreDefineIndex = 0; - - - WalkState = Info->WalkState; - OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - ObjectType = OpInfo->ObjectType; - ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode); - - /* Only interested in operators that create new names */ - - if (!(OpInfo->Flags & AML_NAMED) && - !(OpInfo->Flags & AML_CREATE)) - { - goto Exit; - } - - /* Get the NamePath from the appropriate place */ - - if (OpInfo->Flags & AML_NAMED) - { - /* For all named operators, get the new name */ - - Path = (char *) Op->Named.Path; - - if (!Path && Op->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP) - { - *ACPI_CAST_PTR (UINT32, &FieldPath[0]) = Op->Named.Name; - FieldPath[4] = 0; - Path = FieldPath; - } - } - else if (OpInfo->Flags & AML_CREATE) - { - /* New name is the last child */ - - NextOp = Op->Common.Value.Arg; - - while (NextOp->Common.Next) - { - NextOp = NextOp->Common.Next; - } - Path = NextOp->Common.Value.String; - } - - if (!Path) - { - goto Exit; - } - - /* Insert the name into the namespace */ - - Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, - ACPI_IMODE_LOAD_PASS2, ACPI_NS_DONT_OPEN_SCOPE, - WalkState, &Node); - - Op->Common.Node = Node; - - if (ACPI_SUCCESS (Status)) - { - /* Check if it's a predefined node */ - - while (AcpiGbl_PreDefinedNames[PreDefineIndex].Name) - { - if (!ACPI_STRNCMP (Node->Name.Ascii, - AcpiGbl_PreDefinedNames[PreDefineIndex].Name, 4)) - { - PreDefined = TRUE; - break; - } - - PreDefineIndex++; - } - - /* - * Set node owner id if it satisfies all the following conditions: - * 1) Not a predefined node, _SB_ etc - * 2) Not the root node - * 3) Not a node created by Scope - */ - - if (!PreDefined && Node != AcpiGbl_RootNode && - Op->Common.AmlOpcode != AML_SCOPE_OP) - { - Node->OwnerId = WalkState->OwnerId; - } - } - - -Exit: - - if (AcpiNsOpensScope (ObjectType)) - { - if (Op->Common.Node) - { - Status = AcpiDsScopeStackPush (Op->Common.Node, ObjectType, WalkState); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmXrefDescendingOp - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Descending handler for namespace cross reference - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDmXrefDescendingOp ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ACPI_OP_WALK_INFO *Info = Context; - const ACPI_OPCODE_INFO *OpInfo; - ACPI_WALK_STATE *WalkState; - ACPI_OBJECT_TYPE ObjectType; - ACPI_OBJECT_TYPE ObjectType2; - ACPI_STATUS Status; - char *Path = NULL; - ACPI_PARSE_OBJECT *NextOp; - ACPI_NAMESPACE_NODE *Node; - ACPI_OPERAND_OBJECT *Object; - - - WalkState = Info->WalkState; - OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - ObjectType = OpInfo->ObjectType; - ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode); - - if ((!(OpInfo->Flags & AML_NAMED)) && - (!(OpInfo->Flags & AML_CREATE)) && - (Op->Common.AmlOpcode != AML_INT_NAMEPATH_OP)) - { - goto Exit; - } - - /* Get the NamePath from the appropriate place */ - - if (OpInfo->Flags & AML_NAMED) - { - if ((Op->Common.AmlOpcode == AML_ALIAS_OP) || - (Op->Common.AmlOpcode == AML_SCOPE_OP)) - { - /* - * Only these two operators refer to an existing name, - * first argument - */ - Path = (char *) Op->Named.Path; - } - } - else if (OpInfo->Flags & AML_CREATE) - { - /* Referenced Buffer Name is the first child */ - - NextOp = Op->Common.Value.Arg; - if (NextOp->Common.AmlOpcode == AML_INT_NAMEPATH_OP) - { - Path = NextOp->Common.Value.String; - } - } - else - { - Path = Op->Common.Value.String; - } - - if (!Path) - { - goto Exit; - } - - /* - * Lookup the name in the namespace. Name must exist at this point, or it - * is an invalid reference. - * - * The namespace is also used as a lookup table for references to resource - * descriptors and the fields within them. - */ - Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY, - ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, - WalkState, &Node); - if (ACPI_FAILURE (Status)) - { - if (Status == AE_NOT_FOUND) - { - AcpiDmAddToExternalList (Op, Path, (UINT8) ObjectType, 0); - - /* - * We could install this into the namespace, but we catch duplicate - * externals when they are added to the list. - */ -#if 0 - Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY, - ACPI_IMODE_LOAD_PASS1, ACPI_NS_DONT_OPEN_SCOPE, - WalkState, &Node); -#endif - } - } - - /* - * Found the node in external table, add it to external list - * Node->OwnerId == 0 indicates built-in ACPI Names, _OS_ etc - */ - else if (Node->OwnerId && WalkState->OwnerId != Node->OwnerId) - { - ObjectType2 = ObjectType; - - Object = AcpiNsGetAttachedObject (Node); - if (Object) - { - ObjectType2 = Object->Common.Type; - } - - if (ObjectType2 == ACPI_TYPE_METHOD) - { - AcpiDmAddToExternalList (Op, Path, ACPI_TYPE_METHOD, - Object->Method.ParamCount); - } - else - { - AcpiDmAddToExternalList (Op, Path, (UINT8) ObjectType2, 0); - } - - Op->Common.Node = Node; - } - else - { - Op->Common.Node = Node; - } - - -Exit: - /* Open new scope if necessary */ - - if (AcpiNsOpensScope (ObjectType)) - { - if (Op->Common.Node) - { - Status = AcpiDsScopeStackPush (Op->Common.Node, ObjectType, WalkState); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmResourceDescendingOp - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: None - * - * DESCRIPTION: Process one parse op during symbolic resource index conversion. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDmResourceDescendingOp ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ACPI_OP_WALK_INFO *Info = Context; - const ACPI_OPCODE_INFO *OpInfo; - ACPI_WALK_STATE *WalkState; - ACPI_OBJECT_TYPE ObjectType; - ACPI_STATUS Status; - - - WalkState = Info->WalkState; - OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - - /* Open new scope if necessary */ - - ObjectType = OpInfo->ObjectType; - if (AcpiNsOpensScope (ObjectType)) - { - if (Op->Common.Node) - { - - Status = AcpiDsScopeStackPush (Op->Common.Node, ObjectType, WalkState); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - } - - /* - * Check if this operator contains a reference to a resource descriptor. - * If so, convert the reference into a symbolic reference. - */ - AcpiDmCheckResourceReference (Op, WalkState); - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmCommonAscendingOp - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: None - * - * DESCRIPTION: Ascending handler for combined parse/namespace walks. Closes - * scope if necessary. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDmCommonAscendingOp ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ACPI_OP_WALK_INFO *Info = Context; - const ACPI_OPCODE_INFO *OpInfo; - ACPI_OBJECT_TYPE ObjectType; - - - /* Close scope if necessary */ - - OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - ObjectType = OpInfo->ObjectType; - ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode); - - if (AcpiNsOpensScope (ObjectType)) - { - (void) AcpiDsScopeStackPop (Info->WalkState); - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmInspectPossibleArgs - * - * PARAMETERS: CurrentOpArgCount - Which arg of the current op was the - * possible method invocation found - * TargetCount - Number of targets (0,1,2) for this op - * Op - Parse op - * - * RETURN: Status - * - * DESCRIPTION: Examine following args and next ops for possible arguments - * for an unrecognized method invocation. - * - ******************************************************************************/ - -static UINT32 -AcpiDmInspectPossibleArgs ( - UINT32 CurrentOpArgCount, - UINT32 TargetCount, - ACPI_PARSE_OBJECT *Op) -{ - const ACPI_OPCODE_INFO *OpInfo; - UINT32 i; - UINT32 Last = 0; - UINT32 Lookahead; - - - Lookahead = (ACPI_METHOD_NUM_ARGS + TargetCount) - CurrentOpArgCount; - - /* Lookahead for the maximum number of possible arguments */ - - for (i = 0; i < Lookahead; i++) - { - if (!Op) - { - break; - } - - OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - - /* - * Any one of these operators is "very probably" not a method arg - */ - if ((Op->Common.AmlOpcode == AML_STORE_OP) || - (Op->Common.AmlOpcode == AML_NOTIFY_OP)) - { - break; - } - - if ((OpInfo->Class != AML_CLASS_EXECUTE) && - (OpInfo->Class != AML_CLASS_CONTROL)) - { - Last = i+1; - } - - Op = Op->Common.Next; - } - - return (Last); -} - - diff -Nru acpica-unix-20100528/common/dmextern.c acpica-unix-20140114/common/dmextern.c --- acpica-unix-20100528/common/dmextern.c 2010-05-28 17:14:20.000000000 +0000 +++ acpica-unix-20140114/common/dmextern.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,655 +0,0 @@ -/****************************************************************************** - * - * Module Name: dmextern - Support for External() ASL statements - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "amlcode.h" -#include "acnamesp.h" -#include "acdisasm.h" - - -/* - * This module is used for application-level code (iASL disassembler) only. - * - * It contains the code to create and emit any necessary External() ASL - * statements for the module being disassembled. - */ -#define _COMPONENT ACPI_CA_DISASSEMBLER - ACPI_MODULE_NAME ("dmextern") - - -/* - * This table maps ACPI_OBJECT_TYPEs to the corresponding ASL - * ObjectTypeKeyword. Used to generate typed external declarations - */ -static const char *AcpiGbl_DmTypeNames[] = -{ - /* 00 */ "", /* Type ANY */ - /* 01 */ ", IntObj", - /* 02 */ ", StrObj", - /* 03 */ ", BuffObj", - /* 04 */ ", PkgObj", - /* 05 */ ", FieldUnitObj", - /* 06 */ ", DeviceObj", - /* 07 */ ", EventObj", - /* 08 */ ", MethodObj", - /* 09 */ ", MutexObj", - /* 10 */ ", OpRegionObj", - /* 11 */ ", PowerResObj", - /* 12 */ ", ProcessorObj", - /* 13 */ ", ThermalZoneObj", - /* 14 */ ", BuffFieldObj", - /* 15 */ ", DDBHandleObj", - /* 16 */ "", /* Debug object */ - /* 17 */ ", FieldUnitObj", - /* 18 */ ", FieldUnitObj", - /* 19 */ ", FieldUnitObj" -}; - - -/* Local prototypes */ - -static const char * -AcpiDmGetObjectTypeName ( - ACPI_OBJECT_TYPE Type); - -static char * -AcpiDmNormalizeParentPrefix ( - ACPI_PARSE_OBJECT *Op, - char *Path); - - -/******************************************************************************* - * - * FUNCTION: AcpiDmGetObjectTypeName - * - * PARAMETERS: Type - An ACPI_OBJECT_TYPE - * - * RETURN: Pointer to a string - * - * DESCRIPTION: Map an object type to the ASL object type string. - * - ******************************************************************************/ - -static const char * -AcpiDmGetObjectTypeName ( - ACPI_OBJECT_TYPE Type) -{ - - if (Type == ACPI_TYPE_LOCAL_SCOPE) - { - Type = ACPI_TYPE_DEVICE; - } - - else if (Type > ACPI_TYPE_LOCAL_INDEX_FIELD) - { - return (""); - } - - return (AcpiGbl_DmTypeNames[Type]); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmNormalizeParentPrefix - * - * PARAMETERS: Op - Parse op - * Path - Path with parent prefix - * - * RETURN: The full pathname to the object (from the namespace root) - * - * DESCRIPTION: Returns the full pathname of a path with parent prefix - * The caller must free the fullpath returned. - * - ******************************************************************************/ - -static char * -AcpiDmNormalizeParentPrefix ( - ACPI_PARSE_OBJECT *Op, - char *Path) -{ - ACPI_NAMESPACE_NODE *Node; - char *Fullpath; - char *ParentPath; - ACPI_SIZE Length; - - - /* Search upwards in the parse tree until we reach a namespace node */ - - while (Op) - { - if (Op->Common.Node) - { - break; - } - - Op = Op->Common.Parent; - } - - if (!Op) - { - return (NULL); - } - - /* - * Find the actual parent node for the reference: - * Remove all carat prefixes from the input path. - * There may be multiple parent prefixes (For example, ^^^M000) - */ - Node = Op->Common.Node; - while (Node && (*Path == (UINT8) AML_PARENT_PREFIX)) - { - Node = Node->Parent; - Path++; - } - - if (!Node) - { - return (NULL); - } - - /* Get the full pathname for the parent node */ - - ParentPath = AcpiNsGetExternalPathname (Node); - if (!ParentPath) - { - return (NULL); - } - - Length = (ACPI_STRLEN (ParentPath) + ACPI_STRLEN (Path) + 1); - if (ParentPath[1]) - { - /* - * If ParentPath is not just a simple '\', increment the length - * for the required dot separator (ParentPath.Path) - */ - Length++; - } - - Fullpath = ACPI_ALLOCATE_ZEROED (Length); - if (!Fullpath) - { - goto Cleanup; - } - - /* - * Concatenate parent fullpath and path. For example, - * parent fullpath "\_SB_", Path "^INIT", Fullpath "\_SB_.INIT" - * - * Copy the parent path - */ - ACPI_STRCAT (Fullpath, ParentPath); - - /* Add dot separator (don't need dot if parent fullpath is a single "\") */ - - if (ParentPath[1]) - { - ACPI_STRCAT (Fullpath, "."); - } - - /* Copy child path (carat parent prefix(es) were skipped above) */ - - ACPI_STRCAT (Fullpath, Path); - -Cleanup: - ACPI_FREE (ParentPath); - return (Fullpath); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmAddToExternalList - * - * PARAMETERS: Op - Current parser Op - * Path - Internal (AML) path to the object - * Type - ACPI object type to be added - * Value - Arg count if adding a Method object - * - * RETURN: None - * - * DESCRIPTION: Insert a new name into the global list of Externals which - * will in turn be later emitted as an External() declaration - * in the disassembled output. - * - ******************************************************************************/ - -void -AcpiDmAddToExternalList ( - ACPI_PARSE_OBJECT *Op, - char *Path, - UINT8 Type, - UINT32 Value) -{ - char *ExternalPath; - char *Fullpath = NULL; - ACPI_EXTERNAL_LIST *NewExternal; - ACPI_EXTERNAL_LIST *NextExternal; - ACPI_EXTERNAL_LIST *PrevExternal = NULL; - ACPI_STATUS Status; - - - if (!Path) - { - return; - } - - /* Externalize the ACPI path */ - - Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, Path, - NULL, &ExternalPath); - if (ACPI_FAILURE (Status)) - { - return; - } - - /* Get the full pathname from root if "Path" has a parent prefix */ - - if (*Path == (UINT8) AML_PARENT_PREFIX) - { - Fullpath = AcpiDmNormalizeParentPrefix (Op, ExternalPath); - if (Fullpath) - { - /* Set new external path */ - - ACPI_FREE (ExternalPath); - ExternalPath = Fullpath; - } - } - - /* Check all existing externals to ensure no duplicates */ - - NextExternal = AcpiGbl_ExternalList; - while (NextExternal) - { - if (!ACPI_STRCMP (ExternalPath, NextExternal->Path)) - { - /* Duplicate method, check that the Value (ArgCount) is the same */ - - if ((NextExternal->Type == ACPI_TYPE_METHOD) && - (NextExternal->Value != Value)) - { - ACPI_ERROR ((AE_INFO, - "Argument count mismatch for method %s %u %u", - NextExternal->Path, NextExternal->Value, Value)); - } - - /* Allow upgrade of type from ANY */ - - else if (NextExternal->Type == ACPI_TYPE_ANY) - { - NextExternal->Type = Type; - NextExternal->Value = Value; - } - - ACPI_FREE (ExternalPath); - return; - } - - NextExternal = NextExternal->Next; - } - - /* Allocate and init a new External() descriptor */ - - NewExternal = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EXTERNAL_LIST)); - if (!NewExternal) - { - ACPI_FREE (ExternalPath); - return; - } - - NewExternal->Path = ExternalPath; - NewExternal->Type = Type; - NewExternal->Value = Value; - NewExternal->Length = (UINT16) ACPI_STRLEN (ExternalPath); - - /* Was the external path with parent prefix normalized to a fullpath? */ - - if (Fullpath == ExternalPath) - { - /* Get new internal path */ - - Status = AcpiNsInternalizeName (ExternalPath, &Path); - if (ACPI_FAILURE (Status)) - { - ACPI_FREE (ExternalPath); - ACPI_FREE (NewExternal); - return; - } - - /* Set flag to indicate External->InternalPath need to be freed */ - - NewExternal->Flags |= ACPI_IPATH_ALLOCATED; - } - - NewExternal->InternalPath = Path; - - /* Link the new descriptor into the global list, ordered by string length */ - - NextExternal = AcpiGbl_ExternalList; - while (NextExternal) - { - if (NewExternal->Length <= NextExternal->Length) - { - if (PrevExternal) - { - PrevExternal->Next = NewExternal; - } - else - { - AcpiGbl_ExternalList = NewExternal; - } - - NewExternal->Next = NextExternal; - return; - } - - PrevExternal = NextExternal; - NextExternal = NextExternal->Next; - } - - if (PrevExternal) - { - PrevExternal->Next = NewExternal; - } - else - { - AcpiGbl_ExternalList = NewExternal; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmAddExternalsToNamespace - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Add all externals to the namespace. Allows externals to be - * "resolved". - * - ******************************************************************************/ - -void -AcpiDmAddExternalsToNamespace ( - void) -{ - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *Node; - ACPI_OPERAND_OBJECT *MethodDesc; - ACPI_EXTERNAL_LIST *External = AcpiGbl_ExternalList; - - - while (External) - { - /* Add the external name (object) into the namespace */ - - Status = AcpiNsLookup (NULL, External->InternalPath, External->Type, - ACPI_IMODE_LOAD_PASS1, - ACPI_NS_EXTERNAL | ACPI_NS_DONT_OPEN_SCOPE, - NULL, &Node); - - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "while adding external to namespace [%s]", - External->Path)); - } - else if (External->Type == ACPI_TYPE_METHOD) - { - /* For methods, we need to save the argument count */ - - MethodDesc = AcpiUtCreateInternalObject (ACPI_TYPE_METHOD); - MethodDesc->Method.ParamCount = (UINT8) External->Value; - Node->Object = MethodDesc; - } - - External = External->Next; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmGetExternalMethodCount - * - * PARAMETERS: None - * - * RETURN: The number of control method externals in the external list - * - * DESCRIPTION: Return the number of method externals that have been generated. - * If any control method externals have been found, we must - * re-parse the entire definition block with the new information - * (number of arguments for the methods.) This is limitation of - * AML, we don't know the number of arguments from the control - * method invocation itself. - * - ******************************************************************************/ - -UINT32 -AcpiDmGetExternalMethodCount ( - void) -{ - ACPI_EXTERNAL_LIST *External = AcpiGbl_ExternalList; - UINT32 Count = 0; - - - while (External) - { - if (External->Type == ACPI_TYPE_METHOD) - { - Count++; - } - - External = External->Next; - } - - return (Count); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmClearExternalList - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Free the entire External info list - * - ******************************************************************************/ - -void -AcpiDmClearExternalList ( - void) -{ - ACPI_EXTERNAL_LIST *NextExternal; - - - while (AcpiGbl_ExternalList) - { - NextExternal = AcpiGbl_ExternalList->Next; - ACPI_FREE (AcpiGbl_ExternalList->Path); - ACPI_FREE (AcpiGbl_ExternalList); - AcpiGbl_ExternalList = NextExternal; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmEmitExternals - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Emit an External() ASL statement for each of the externals in - * the global external info list. - * - ******************************************************************************/ - -void -AcpiDmEmitExternals ( - void) -{ - ACPI_EXTERNAL_LIST *NextExternal; - - - if (!AcpiGbl_ExternalList) - { - return; - } - - /* - * Walk the list of externals (unresolved references) - * found during the AML parsing - */ - while (AcpiGbl_ExternalList) - { - AcpiOsPrintf (" External (%s%s", - AcpiGbl_ExternalList->Path, - AcpiDmGetObjectTypeName (AcpiGbl_ExternalList->Type)); - - if (AcpiGbl_ExternalList->Type == ACPI_TYPE_METHOD) - { - AcpiOsPrintf (") // %u Arguments\n", - AcpiGbl_ExternalList->Value); - } - else - { - AcpiOsPrintf (")\n"); - } - - /* Free this external info block and move on to next external */ - - NextExternal = AcpiGbl_ExternalList->Next; - if (AcpiGbl_ExternalList->Flags & ACPI_IPATH_ALLOCATED) - { - ACPI_FREE (AcpiGbl_ExternalList->InternalPath); - } - - ACPI_FREE (AcpiGbl_ExternalList->Path); - ACPI_FREE (AcpiGbl_ExternalList); - AcpiGbl_ExternalList = NextExternal; - } - - AcpiOsPrintf ("\n"); -} - diff -Nru acpica-unix-20100528/common/dmrestag.c acpica-unix-20140114/common/dmrestag.c --- acpica-unix-20100528/common/dmrestag.c 2010-05-28 17:14:20.000000000 +0000 +++ acpica-unix-20140114/common/dmrestag.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,992 +0,0 @@ -/****************************************************************************** - * - * Module Name: dmrestag - Add tags to resource descriptors (Application-level) - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - - -#include "acpi.h" -#include "accommon.h" -#include "acparser.h" -#include "acdisasm.h" -#include "acnamesp.h" -#include "amlcode.h" - -/* This module used for application-level code only */ - -#define _COMPONENT ACPI_CA_DISASSEMBLER - ACPI_MODULE_NAME ("dmrestag") - -/* Local prototypes */ - -static void -AcpiDmUpdateResourceName ( - ACPI_NAMESPACE_NODE *ResourceNode); - -static char * -AcpiDmSearchTagList ( - UINT32 BitIndex, - ACPI_RESOURCE_TAG *TagList); - -static char * -AcpiDmGetResourceTag ( - UINT32 BitIndex, - AML_RESOURCE *Resource, - UINT8 ResourceIndex); - -static char * -AcpiGetTagPathname ( - ACPI_NAMESPACE_NODE *BufferNode, - ACPI_NAMESPACE_NODE *ResourceNode, - UINT32 BitIndex); - -static ACPI_NAMESPACE_NODE * -AcpiDmGetResourceNode ( - ACPI_NAMESPACE_NODE *BufferNode, - UINT32 BitIndex); - -static ACPI_STATUS -AcpiDmAddResourceToNamespace ( - UINT8 *Aml, - UINT32 Length, - UINT32 Offset, - UINT8 ResourceIndex, - void *Context); - -static void -AcpiDmAddResourcesToNamespace ( - ACPI_NAMESPACE_NODE *BufferNode, - ACPI_PARSE_OBJECT *Op); - - -/****************************************************************************** - * - * Resource Tag tables - * - * These are the predefined tags that refer to elements of a resource - * descriptor. Each name and offset is defined in the ACPI specification. - * - * Each table entry contains the bit offset of the field and the associated - * name. - * - ******************************************************************************/ - -static ACPI_RESOURCE_TAG AcpiDmIrqTags[] = -{ - {( 1 * 8), ACPI_RESTAG_INTERRUPT}, - {( 3 * 8) + 0, ACPI_RESTAG_INTERRUPTTYPE}, - {( 3 * 8) + 3, ACPI_RESTAG_INTERRUPTLEVEL}, - {( 3 * 8) + 4, ACPI_RESTAG_INTERRUPTSHARE}, - {0, NULL} -}; - -static ACPI_RESOURCE_TAG AcpiDmDmaTags[] = -{ - {( 1 * 8), ACPI_RESTAG_DMA}, - {( 2 * 8) + 0, ACPI_RESTAG_XFERTYPE}, - {( 2 * 8) + 2, ACPI_RESTAG_BUSMASTER}, - {( 2 * 8) + 5, ACPI_RESTAG_DMATYPE}, - {0, NULL} -}; - -static ACPI_RESOURCE_TAG AcpiDmIoTags[] = -{ - {( 1 * 8) + 0, ACPI_RESTAG_DECODE}, - {( 2 * 8), ACPI_RESTAG_MINADDR}, - {( 4 * 8), ACPI_RESTAG_MAXADDR}, - {( 6 * 8), ACPI_RESTAG_ALIGNMENT}, - {( 7 * 8), ACPI_RESTAG_LENGTH}, - {0, NULL} -}; - -static ACPI_RESOURCE_TAG AcpiDmFixedIoTags[] = -{ - {( 1 * 8), ACPI_RESTAG_BASEADDRESS}, - {( 3 * 8), ACPI_RESTAG_LENGTH}, - {0, NULL} -}; - -static ACPI_RESOURCE_TAG AcpiDmMemory24Tags[] = -{ - {( 3 * 8) + 0, ACPI_RESTAG_READWRITETYPE}, - {( 4 * 8), ACPI_RESTAG_MINADDR}, - {( 6 * 8), ACPI_RESTAG_MAXADDR}, - {( 8 * 8), ACPI_RESTAG_ALIGNMENT}, - {(10 * 8), ACPI_RESTAG_LENGTH}, - {0, NULL} -}; - -static ACPI_RESOURCE_TAG AcpiDmRegisterTags[] = -{ - {( 3 * 8), ACPI_RESTAG_ADDRESSSPACE}, - {( 4 * 8), ACPI_RESTAG_REGISTERBITWIDTH}, - {( 5 * 8), ACPI_RESTAG_REGISTERBITOFFSET}, - {( 6 * 8), ACPI_RESTAG_ACCESSSIZE}, - {( 7 * 8), ACPI_RESTAG_ADDRESS}, - {0, NULL} -}; - -static ACPI_RESOURCE_TAG AcpiDmMemory32Tags[] = -{ - {( 3 * 8) + 0, ACPI_RESTAG_READWRITETYPE}, - {( 4 * 8), ACPI_RESTAG_MINADDR}, - {( 8 * 8), ACPI_RESTAG_MAXADDR}, - {(12 * 8), ACPI_RESTAG_ALIGNMENT}, - {(16 * 8), ACPI_RESTAG_LENGTH}, - {0, NULL} -}; - -static ACPI_RESOURCE_TAG AcpiDmFixedMemory32Tags[] = -{ - {( 3 * 8) + 0, ACPI_RESTAG_READWRITETYPE}, - {( 4 * 8), ACPI_RESTAG_BASEADDRESS}, - {( 8 * 8), ACPI_RESTAG_LENGTH}, - {0, NULL} -}; - -static ACPI_RESOURCE_TAG AcpiDmInterruptTags[] = -{ - {( 3 * 8) + 1, ACPI_RESTAG_INTERRUPTTYPE}, - {( 3 * 8) + 2, ACPI_RESTAG_INTERRUPTLEVEL}, - {( 3 * 8) + 3, ACPI_RESTAG_INTERRUPTSHARE}, - {( 5 * 8), ACPI_RESTAG_INTERRUPT}, - {0, NULL} -}; - -static ACPI_RESOURCE_TAG AcpiDmAddress16Tags[] = -{ - {( 4 * 8) + 1, ACPI_RESTAG_DECODE}, - {( 4 * 8) + 2, ACPI_RESTAG_MINTYPE}, - {( 4 * 8) + 3, ACPI_RESTAG_MAXTYPE}, - {( 6 * 8), ACPI_RESTAG_GRANULARITY}, - {( 8 * 8), ACPI_RESTAG_MINADDR}, - {(10 * 8), ACPI_RESTAG_MAXADDR}, - {(12 * 8), ACPI_RESTAG_TRANSLATION}, - {(14 * 8), ACPI_RESTAG_LENGTH}, - {0, NULL} -}; - -static ACPI_RESOURCE_TAG AcpiDmAddress32Tags[] = -{ - {( 4 * 8) + 1, ACPI_RESTAG_DECODE}, - {( 4 * 8) + 2, ACPI_RESTAG_MINTYPE}, - {( 4 * 8) + 3, ACPI_RESTAG_MAXTYPE}, - {( 6 * 8), ACPI_RESTAG_GRANULARITY}, - {(10 * 8), ACPI_RESTAG_MINADDR}, - {(14 * 8), ACPI_RESTAG_MAXADDR}, - {(18 * 8), ACPI_RESTAG_TRANSLATION}, - {(22 * 8), ACPI_RESTAG_LENGTH}, - {0, NULL} -}; - -static ACPI_RESOURCE_TAG AcpiDmAddress64Tags[] = -{ - {( 4 * 8) + 1, ACPI_RESTAG_DECODE}, - {( 4 * 8) + 2, ACPI_RESTAG_MINTYPE}, - {( 4 * 8) + 3, ACPI_RESTAG_MAXTYPE}, - {( 6 * 8), ACPI_RESTAG_GRANULARITY}, - {(14 * 8), ACPI_RESTAG_MINADDR}, - {(22 * 8), ACPI_RESTAG_MAXADDR}, - {(30 * 8), ACPI_RESTAG_TRANSLATION}, - {(38 * 8), ACPI_RESTAG_LENGTH}, - {0, NULL} -}; - -static ACPI_RESOURCE_TAG AcpiDmExtendedAddressTags[] = -{ - {( 4 * 8) + 1, ACPI_RESTAG_DECODE}, - {( 4 * 8) + 2, ACPI_RESTAG_MINTYPE}, - {( 4 * 8) + 3, ACPI_RESTAG_MAXTYPE}, - {( 8 * 8), ACPI_RESTAG_GRANULARITY}, - {(16 * 8), ACPI_RESTAG_MINADDR}, - {(24 * 8), ACPI_RESTAG_MAXADDR}, - {(32 * 8), ACPI_RESTAG_TRANSLATION}, - {(40 * 8), ACPI_RESTAG_LENGTH}, - {(48 * 8), ACPI_RESTAG_TYPESPECIFICATTRIBUTES}, - {0, NULL} -}; - -/* Special-case tables for the type-specific flags */ - -static ACPI_RESOURCE_TAG AcpiDmMemoryFlagTags[] = -{ - {( 5 * 8) + 0, ACPI_RESTAG_READWRITETYPE}, - {( 5 * 8) + 1, ACPI_RESTAG_MEMTYPE}, - {( 5 * 8) + 3, ACPI_RESTAG_MEMATTRIBUTES}, - {( 5 * 8) + 5, ACPI_RESTAG_TYPE}, - {0, NULL} -}; - -static ACPI_RESOURCE_TAG AcpiDmIoFlagTags[] = -{ - {( 5 * 8) + 0, ACPI_RESTAG_RANGETYPE}, - {( 5 * 8) + 4, ACPI_RESTAG_TYPE}, - {( 5 * 8) + 5, ACPI_RESTAG_TRANSTYPE}, - {0, NULL} -}; - - -/* Dispatch table used to obtain the correct tag table for a descriptor */ - -static ACPI_RESOURCE_TAG *AcpiGbl_ResourceTags [] = -{ - /* Small descriptors */ - - NULL, /* 0x00, Reserved */ - NULL, /* 0x01, Reserved */ - NULL, /* 0x02, Reserved */ - NULL, /* 0x03, Reserved */ - AcpiDmIrqTags, /* 0x04, ACPI_RESOURCE_NAME_IRQ_FORMAT */ - AcpiDmDmaTags, /* 0x05, ACPI_RESOURCE_NAME_DMA_FORMAT */ - NULL, /* 0x06, ACPI_RESOURCE_NAME_START_DEPENDENT */ - NULL, /* 0x07, ACPI_RESOURCE_NAME_END_DEPENDENT */ - AcpiDmIoTags, /* 0x08, ACPI_RESOURCE_NAME_IO_PORT */ - AcpiDmFixedIoTags, /* 0x09, ACPI_RESOURCE_NAME_FIXED_IO_PORT */ - NULL, /* 0x0A, Reserved */ - NULL, /* 0x0B, Reserved */ - NULL, /* 0x0C, Reserved */ - NULL, /* 0x0D, Reserved */ - NULL, /* 0x0E, ACPI_RESOURCE_NAME_SMALL_VENDOR */ - NULL, /* 0x0F, ACPI_RESOURCE_NAME_END_TAG (not used) */ - - /* Large descriptors */ - - NULL, /* 0x00, Reserved */ - AcpiDmMemory24Tags, /* 0x01, ACPI_RESOURCE_NAME_MEMORY_24 */ - AcpiDmRegisterTags, /* 0x02, ACPI_RESOURCE_NAME_GENERIC_REGISTER */ - NULL, /* 0x03, Reserved */ - NULL, /* 0x04, ACPI_RESOURCE_NAME_LARGE_VENDOR */ - AcpiDmMemory32Tags, /* 0x05, ACPI_RESOURCE_NAME_MEMORY_32 */ - AcpiDmFixedMemory32Tags, /* 0x06, ACPI_RESOURCE_NAME_FIXED_MEMORY_32 */ - AcpiDmAddress32Tags, /* 0x07, ACPI_RESOURCE_NAME_DWORD_ADDRESS_SPACE */ - AcpiDmAddress16Tags, /* 0x08, ACPI_RESOURCE_NAME_WORD_ADDRESS_SPACE */ - AcpiDmInterruptTags, /* 0x09, ACPI_RESOURCE_NAME_EXTENDED_XRUPT */ - AcpiDmAddress64Tags, /* 0x0A, ACPI_RESOURCE_NAME_QWORD_ADDRESS_SPACE */ - AcpiDmExtendedAddressTags /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS_SPACE */ -}; - - -/* - * Globals used to generate unique resource descriptor names. We use names that - * start with underscore and a prefix letter that is not used by other ACPI - * reserved names. To this, we append hex 0x00 through 0xFF. These 5 prefixes - * allow for 5*256 = 1280 unique names, probably sufficient for any single ASL - * file. If this becomes too small, we can use alpha+numerals for a total - * of 5*36*36 = 6480. - */ -#define ACPI_NUM_RES_PREFIX 5 - -static UINT32 AcpiGbl_NextResourceId = 0; -static UINT8 AcpiGbl_NextPrefix = 0; -static char AcpiGbl_Prefix[ACPI_NUM_RES_PREFIX] = - {'Y','Z','J','K','X'}; - - -/******************************************************************************* - * - * FUNCTION: AcpiDmCheckResourceReference - * - * PARAMETERS: Op - Parse Op for the AML opcode - * WalkState - Current walk state (with valid scope) - * - * RETURN: None - * - * DESCRIPTION: Convert a reference to a resource descriptor to a symbolic - * reference if possible - * - * NOTE: Bit index is used to transparently handle both resource bit - * fields and byte fields. - * - ******************************************************************************/ - -void -AcpiDmCheckResourceReference ( - ACPI_PARSE_OBJECT *Op, - ACPI_WALK_STATE *WalkState) -{ - ACPI_STATUS Status; - ACPI_PARSE_OBJECT *BufferNameOp; - ACPI_PARSE_OBJECT *IndexOp; - ACPI_NAMESPACE_NODE *BufferNode; - ACPI_NAMESPACE_NODE *ResourceNode; - const ACPI_OPCODE_INFO *OpInfo; - char *Pathname; - UINT32 BitIndex; - - - /* We are only interested in the CreateXxxxField opcodes */ - - OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - if (OpInfo->Type != AML_TYPE_CREATE_FIELD) - { - return; - } - - /* Get the buffer term operand */ - - BufferNameOp = AcpiPsGetDepthNext (NULL, Op); - - /* Must be a named buffer, not an arg or local or method call */ - - if (BufferNameOp->Common.AmlOpcode != AML_INT_NAMEPATH_OP) - { - return; - } - - /* Get the Index term, must be an integer constant to convert */ - - IndexOp = BufferNameOp->Common.Next; - OpInfo = AcpiPsGetOpcodeInfo (IndexOp->Common.AmlOpcode); - if (OpInfo->ObjectType != ACPI_TYPE_INTEGER) - { - return; - } - - /* Get the bit offset of the descriptor within the buffer */ - - if ((Op->Common.AmlOpcode == AML_CREATE_BIT_FIELD_OP) || - (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP)) - { - /* Index operand is a bit offset */ - - BitIndex = (UINT32) IndexOp->Common.Value.Integer; - } - else - { - /* Index operand is a byte offset, convert to bits */ - - BitIndex = (UINT32) ACPI_MUL_8 (IndexOp->Common.Value.Integer); - } - - /* Lookup the buffer in the namespace */ - - Status = AcpiNsLookup (WalkState->ScopeInfo, - BufferNameOp->Common.Value.String, ACPI_TYPE_BUFFER, - ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, - &BufferNode); - if (ACPI_FAILURE (Status)) - { - return; - } - - /* Validate object type, we must have a buffer */ - - if (BufferNode->Type != ACPI_TYPE_BUFFER) - { - return; - } - - /* Find the resource descriptor node corresponding to the index */ - - ResourceNode = AcpiDmGetResourceNode (BufferNode, BitIndex); - if (!ResourceNode) - { - return; - } - - /* Translate the Index to a resource tag pathname */ - - Pathname = AcpiGetTagPathname (BufferNode, ResourceNode, BitIndex); - if (Pathname) - { - /* Complete the conversion of the Index to a symbol */ - - IndexOp->Common.AmlOpcode = AML_INT_NAMEPATH_OP; - IndexOp->Common.Value.String = Pathname; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmGetResourceNode - * - * PARAMETERS: BufferNode - Node for the parent buffer - * BitIndex - Index into the resource descriptor - * - * RETURN: Namespace node for the resource descriptor. NULL if not found - * - * DESCRIPTION: Find a resource descriptor that corresponds to the bit index - * - ******************************************************************************/ - -static ACPI_NAMESPACE_NODE * -AcpiDmGetResourceNode ( - ACPI_NAMESPACE_NODE *BufferNode, - UINT32 BitIndex) -{ - ACPI_NAMESPACE_NODE *Node; - UINT32 ByteIndex = ACPI_DIV_8 (BitIndex); - - - /* - * Child list contains an entry for each resource descriptor. Find - * the descriptor that corresponds to the Index. - * - * If there are no children, this is not a resource template - */ - Node = BufferNode->Child; - while (Node) - { - /* - * Check if the Index falls within this resource. - * - * Value contains the resource offset, Object contains the resource - * length (both in bytes) - */ - if ((ByteIndex >= Node->Value) && - (ByteIndex < (Node->Value + Node->Length))) - { - return (Node); - } - - Node = Node->Peer; - } - - return (NULL); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiGetTagPathname - * - * PARAMETERS: BufferNode - Node for the parent buffer - * ResourceNode - Node for a resource descriptor - * BitIndex - Index into the resource descriptor - * - * RETURN: Full pathname for a resource tag. NULL if no match. - * Path is returned in AML (packed) format. - * - * DESCRIPTION: Convert a BitIndex into a symbolic resource tag (full pathname) - * - ******************************************************************************/ - -static char * -AcpiGetTagPathname ( - ACPI_NAMESPACE_NODE *BufferNode, - ACPI_NAMESPACE_NODE *ResourceNode, - UINT32 BitIndex) -{ - ACPI_STATUS Status; - UINT32 ResourceBitIndex; - UINT8 ResourceTableIndex; - ACPI_SIZE RequiredSize; - char *Pathname; - AML_RESOURCE *Aml; - ACPI_PARSE_OBJECT *Op; - char *InternalPath; - char *Tag; - - - /* Get the Op that contains the actual buffer data */ - - Op = BufferNode->Op->Common.Value.Arg; - Op = Op->Common.Next; - if (!Op) - { - return (NULL); - } - - /* Get the individual resource descriptor and validate it */ - - Aml = ACPI_CAST_PTR (AML_RESOURCE, - &Op->Named.Data[ResourceNode->Value]); - - Status = AcpiUtValidateResource (Aml, &ResourceTableIndex); - if (ACPI_FAILURE (Status)) - { - return (NULL); - } - - /* Get offset into this descriptor (from offset into entire buffer) */ - - ResourceBitIndex = BitIndex - ACPI_MUL_8 (ResourceNode->Value); - - /* Get the tag associated with this resource descriptor and offset */ - - Tag = AcpiDmGetResourceTag (ResourceBitIndex, Aml, ResourceTableIndex); - if (!Tag) - { - return (NULL); - } - - /* - * Now that we know that we have a reference that can be converted to a - * symbol, change the name of the resource to a unique name. - */ - AcpiDmUpdateResourceName (ResourceNode); - - /* Get the full pathname to the parent buffer */ - - RequiredSize = AcpiNsGetPathnameLength (BufferNode); - if (!RequiredSize) - { - return (NULL); - } - - Pathname = ACPI_ALLOCATE_ZEROED (RequiredSize + ACPI_PATH_SEGMENT_LENGTH); - if (!Pathname) - { - return (NULL); - } - - Status = AcpiNsBuildExternalPath (BufferNode, RequiredSize, Pathname); - if (ACPI_FAILURE (Status)) - { - return (NULL); - } - - /* - * Create the full path to the resource and tag by: remove the buffer name, - * append the resource descriptor name, append a dot, append the tag name. - * - * TBD: Always using the full path is a bit brute force, the path can be - * often be optimized with carats (if the original buffer namepath is a - * single nameseg). This doesn't really matter, because these paths do not - * end up in the final compiled AML, it's just an appearance issue for the - * disassembled code. - */ - Pathname[ACPI_STRLEN (Pathname) - ACPI_NAME_SIZE] = 0; - ACPI_STRNCAT (Pathname, ResourceNode->Name.Ascii, ACPI_NAME_SIZE); - ACPI_STRCAT (Pathname, "."); - ACPI_STRNCAT (Pathname, Tag, ACPI_NAME_SIZE); - - /* Internalize the namepath to AML format */ - - AcpiNsInternalizeName (Pathname, &InternalPath); - ACPI_FREE (Pathname); - return (InternalPath); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmUpdateResourceName - * - * PARAMETERS: ResourceNode - Node for a resource descriptor - * - * RETURN: Stores new name in the ResourceNode - * - * DESCRIPTION: Create a new, unique name for a resource descriptor. Used by - * both the disassembly of the descriptor itself and any symbolic - * references to the descriptor. Ignored if a unique name has - * already been assigned to the resource. - * - * NOTE: Single threaded, suitable for applications only! - * - ******************************************************************************/ - -static void -AcpiDmUpdateResourceName ( - ACPI_NAMESPACE_NODE *ResourceNode) -{ - char Name[ACPI_NAME_SIZE]; - - - /* Ignore if a unique name has already been assigned */ - - if (ResourceNode->Name.Integer != ACPI_DEFAULT_RESNAME) - { - return; - } - - /* Generate a new ACPI name for the descriptor */ - - Name[0] = '_'; - Name[1] = AcpiGbl_Prefix[AcpiGbl_NextPrefix]; - Name[2] = AcpiUtHexToAsciiChar (AcpiGbl_NextResourceId, 4); - Name[3] = AcpiUtHexToAsciiChar (AcpiGbl_NextResourceId, 0); - - /* Update globals for next name */ - - AcpiGbl_NextResourceId++; - if (AcpiGbl_NextResourceId >= 256) - { - AcpiGbl_NextResourceId = 0; - AcpiGbl_NextPrefix++; - if (AcpiGbl_NextPrefix > ACPI_NUM_RES_PREFIX) - { - AcpiGbl_NextPrefix = 0; - } - } - - /* Change the resource descriptor name */ - - ResourceNode->Name.Integer = *ACPI_CAST_PTR (UINT32, &Name[0]); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmGetResourceTag - * - * PARAMETERS: BitIndex - Index into the resource descriptor - * Resource - Pointer to the raw resource data - * ResourceIndex - Index correspoinding to the resource type - * - * RETURN: Pointer to the resource tag (ACPI_NAME). NULL if no match. - * - * DESCRIPTION: Convert a BitIndex into a symbolic resource tag. - * - ******************************************************************************/ - -static char * -AcpiDmGetResourceTag ( - UINT32 BitIndex, - AML_RESOURCE *Resource, - UINT8 ResourceIndex) -{ - ACPI_RESOURCE_TAG *TagList; - char *Tag = NULL; - - - /* Get the tag list for this resource descriptor type */ - - TagList = AcpiGbl_ResourceTags[ResourceIndex]; - if (!TagList) - { - /* There are no tags for this resource type */ - - return (NULL); - } - - /* - * Handle the type-specific flags field for the address descriptors. - * Kindof brute force, but just blindly search for an index match. - */ - switch (Resource->DescriptorType) - { - case ACPI_RESOURCE_NAME_ADDRESS16: - case ACPI_RESOURCE_NAME_ADDRESS32: - case ACPI_RESOURCE_NAME_ADDRESS64: - case ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64: - - if (Resource->Address.ResourceType == ACPI_ADDRESS_TYPE_MEMORY_RANGE) - { - Tag = AcpiDmSearchTagList (BitIndex, AcpiDmMemoryFlagTags); - } - else if (Resource->Address.ResourceType == ACPI_ADDRESS_TYPE_IO_RANGE) - { - Tag = AcpiDmSearchTagList (BitIndex, AcpiDmIoFlagTags); - } - - /* If we found a match, all done. Else, drop to normal search below */ - - if (Tag) - { - return (Tag); - } - break; - - default: - break; - } - - /* Search the tag list for this descriptor type */ - - Tag = AcpiDmSearchTagList (BitIndex, TagList); - return (Tag); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmSearchTagList - * - * PARAMETERS: BitIndex - Index into the resource descriptor - * TagList - List to search - * - * RETURN: Pointer to a tag (ACPI_NAME). NULL if no match found. - * - * DESCRIPTION: Search a tag list for a match to the input BitIndex. Matches - * a fixed offset to a symbolic resource tag name. - * - ******************************************************************************/ - -static char * -AcpiDmSearchTagList ( - UINT32 BitIndex, - ACPI_RESOURCE_TAG *TagList) -{ - - /* - * Walk the null-terminated tag list to find a matching bit offset. - * We are looking for an exact match. - */ - for ( ; TagList->Tag; TagList++) - { - if (BitIndex == TagList->BitIndex) - { - return (TagList->Tag); - } - } - - /* A matching offset was not found */ - - return (NULL); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmFindResources - * - * PARAMETERS: Root - Root of the parse tree - * - * RETURN: None - * - * DESCRIPTION: Add all ResourceTemplate declarations to the namespace. Each - * resource descriptor in each template is given a node -- used - * for later conversion of resource references to symbolic refs. - * - ******************************************************************************/ - -void -AcpiDmFindResources ( - ACPI_PARSE_OBJECT *Root) -{ - ACPI_PARSE_OBJECT *Op = Root; - ACPI_PARSE_OBJECT *Parent; - - - /* Walk the entire parse tree */ - - while (Op) - { - /* We are interested in Buffer() declarations */ - - if (Op->Common.AmlOpcode == AML_BUFFER_OP) - { - /* And only declarations of the form Name (XXXX, Buffer()... ) */ - - Parent = Op->Common.Parent; - if (Parent->Common.AmlOpcode == AML_NAME_OP) - { - /* - * If the buffer is a resource template, add the individual - * resource descriptors to the namespace, as children of the - * buffer node. - */ - if (ACPI_SUCCESS (AcpiDmIsResourceTemplate (Op))) - { - Op->Common.DisasmOpcode = ACPI_DASM_RESOURCE; - AcpiDmAddResourcesToNamespace (Parent->Common.Node, Op); - } - } - } - - Op = AcpiPsGetDepthNext (Root, Op); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmAddResourcesToNamespace - * - * PARAMETERS: BufferNode - Node for the parent buffer - * Op - Parse op for the buffer - * - * RETURN: None - * - * DESCRIPTION: Add an entire resource template to the namespace. Each - * resource descriptor is added as a namespace node. - * - ******************************************************************************/ - -static void -AcpiDmAddResourcesToNamespace ( - ACPI_NAMESPACE_NODE *BufferNode, - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *NextOp; - - - /* Get to the ByteData list */ - - NextOp = Op->Common.Value.Arg; - NextOp = NextOp->Common.Next; - if (!NextOp) - { - return; - } - - /* Set Node and Op to point to each other */ - - BufferNode->Op = Op; - Op->Common.Node = BufferNode; - - /* - * Insert each resource into the namespace - * NextOp contains the Aml pointer and the Aml length - */ - AcpiUtWalkAmlResources ((UINT8 *) NextOp->Named.Data, - (ACPI_SIZE) NextOp->Common.Value.Integer, - AcpiDmAddResourceToNamespace, BufferNode); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmAddResourceToNamespace - * - * PARAMETERS: ACPI_WALK_AML_CALLBACK - * BufferNode - Node for the parent buffer - * - * RETURN: Status - * - * DESCRIPTION: Add one resource descriptor to the namespace as a child of the - * parent buffer. The same name is used for each descriptor. This - * is changed later to a unique name if the resource is actually - * referenced by an AML operator. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDmAddResourceToNamespace ( - UINT8 *Aml, - UINT32 Length, - UINT32 Offset, - UINT8 ResourceIndex, - void *Context) -{ - ACPI_STATUS Status; - ACPI_GENERIC_STATE ScopeInfo; - ACPI_NAMESPACE_NODE *Node; - - - /* TBD: Don't need to add descriptors that have no tags defined? */ - - /* Add the resource to the namespace, as child of the buffer */ - - ScopeInfo.Scope.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Context); - Status = AcpiNsLookup (&ScopeInfo, "_TMP", ACPI_TYPE_LOCAL_RESOURCE, - ACPI_IMODE_LOAD_PASS2, - ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_PREFIX_IS_SCOPE, - NULL, &Node); - if (ACPI_FAILURE (Status)) - { - return (AE_OK); - } - - /* Set the name to the default, changed later if resource is referenced */ - - Node->Name.Integer = ACPI_DEFAULT_RESNAME; - - /* Save the offset of the descriptor (within the original buffer) */ - - Node->Value = Offset; - Node->Length = Length; - return (AE_OK); -} - diff -Nru acpica-unix-20100528/common/dmtable.c acpica-unix-20140114/common/dmtable.c --- acpica-unix-20100528/common/dmtable.c 2010-05-28 17:14:21.000000000 +0000 +++ acpica-unix-20140114/common/dmtable.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,965 +0,0 @@ -/****************************************************************************** - * - * Module Name: dmtable - Support for ACPI tables that contain no AML code - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acdisasm.h" -#include "actables.h" -#include "dtcompiler.h" - -/* This module used for application-level code only */ - -#define _COMPONENT ACPI_CA_DISASSEMBLER - ACPI_MODULE_NAME ("dmtable") - -/* Local Prototypes */ - -static void -AcpiDmCheckAscii ( - UINT8 *Target, - char *RepairedName, - UINT32 Count); - -UINT8 -AcpiTbGenerateChecksum ( - ACPI_TABLE_HEADER *Table); - - -/* These tables map a subtable type to a description string */ - -static const char *AcpiDmAsfSubnames[] = -{ - "ASF Information", - "ASF Alerts", - "ASF Remote Control", - "ASF RMCP Boot Options", - "ASF Address", - "Unknown SubTable Type" /* Reserved */ -}; - -static const char *AcpiDmDmarSubnames[] = -{ - "Hardware Unit Definition", - "Reserved Memory Region", - "Root Port ATS Capability", - "Remapping Hardware Static Affinity", - "Unknown SubTable Type" /* Reserved */ -}; - -static const char *AcpiDmHestSubnames[] = -{ - "IA-32 Machine Check Exception", - "IA-32 Corrected Machine Check", - "IA-32 Non-Maskable Interrupt", - "Unknown SubTable Type", /* 3 - Reserved */ - "Unknown SubTable Type", /* 4 - Reserved */ - "Unknown SubTable Type", /* 5 - Reserved */ - "PCI Express Root Port AER", - "PCI Express AER (AER Endpoint)", - "PCI Express/PCI-X Bridge AER", - "Generic Hardware Error Source", - "Unknown SubTable Type" /* Reserved */ -}; - -static const char *AcpiDmHestNotifySubnames[] = -{ - "Polled", - "External Interrupt", - "Local Interrupt", - "SCI", - "NMI", - "Unknown Notify Type" /* Reserved */ -}; - -static const char *AcpiDmMadtSubnames[] = -{ - "Processor Local APIC", /* ACPI_MADT_TYPE_LOCAL_APIC */ - "I/O APIC", /* ACPI_MADT_TYPE_IO_APIC */ - "Interrupt Source Override", /* ACPI_MADT_TYPE_INTERRUPT_OVERRIDE */ - "NMI Source", /* ACPI_MADT_TYPE_NMI_SOURCE */ - "Local APIC NMI", /* ACPI_MADT_TYPE_LOCAL_APIC_NMI */ - "Local APIC Address Override", /* ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE */ - "I/O SAPIC", /* ACPI_MADT_TYPE_IO_SAPIC */ - "Local SAPIC", /* ACPI_MADT_TYPE_LOCAL_SAPIC */ - "Platform Interrupt Sources", /* ACPI_MADT_TYPE_INTERRUPT_SOURCE */ - "Processor Local x2APIC", /* ACPI_MADT_TYPE_LOCAL_X2APIC */ - "Local x2APIC NMI", /* ACPI_MADT_TYPE_LOCAL_X2APIC_NMI */ - "Unknown SubTable Type" /* Reserved */ -}; - -static const char *AcpiDmSratSubnames[] = -{ - "Processor Local APIC/SAPIC Affinity", - "Memory Affinity", - "Processor Local x2APIC Affinity", - "Unknown SubTable Type" /* Reserved */ -}; - -static const char *AcpiDmIvrsSubnames[] = -{ - "Hardware Definition Block", - "Memory Definition Block", - "Unknown SubTable Type" /* Reserved */ -}; - - -#define ACPI_FADT_PM_RESERVED 8 - -static const char *AcpiDmFadtProfiles[] = -{ - "Unspecified", - "Desktop", - "Mobile", - "Workstation", - "Enterprise Server", - "SOHO Server", - "Appliance PC", - "Performance Server", - "Unknown Profile Type" -}; - -/******************************************************************************* - * - * ACPI Table Data, indexed by signature. - * - * Each entry contains: Signature, Table Info, Handler, Description - * - * Simple tables have only a TableInfo structure, complex tables have a handler. - * This table must be NULL terminated. RSDP and FACS are special-cased - * elsewhere. - * - ******************************************************************************/ - -static ACPI_DMTABLE_DATA AcpiDmTableData[] = -{ - {ACPI_SIG_ASF, NULL, AcpiDmDumpAsf, DtCompileAsf, "Alert Standard Format table"}, - {ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, NULL, "Simple Boot Flag Table"}, - {ACPI_SIG_BERT, AcpiDmTableInfoBert, NULL, NULL, "Boot Error Record Table"}, - {ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, DtCompileCpep, "Corrected Platform Error Polling table"}, - {ACPI_SIG_DBGP, AcpiDmTableInfoDbgp, NULL, NULL, "Debug Port table"}, - {ACPI_SIG_DMAR, NULL, AcpiDmDumpDmar, DtCompileDmar, "DMA Remapping table"}, - {ACPI_SIG_ECDT, AcpiDmTableInfoEcdt, NULL, NULL, "Embedded Controller Boot Resources Table"}, - {ACPI_SIG_EINJ, NULL, AcpiDmDumpEinj, DtCompileEinj, "Error Injection table"}, - {ACPI_SIG_ERST, NULL, AcpiDmDumpErst, DtCompileErst, "Error Record Serialization Table"}, - {ACPI_SIG_FADT, NULL, AcpiDmDumpFadt, DtCompileFadt, "Fixed ACPI Description Table"}, - {ACPI_SIG_HEST, NULL, AcpiDmDumpHest, DtCompileHest, "Hardware Error Source Table"}, - {ACPI_SIG_HPET, AcpiDmTableInfoHpet, NULL, NULL, "High Precision Event Timer table"}, - {ACPI_SIG_IVRS, NULL, AcpiDmDumpIvrs, DtCompileIvrs, "I/O Virtualization Reporting Structure"}, - {ACPI_SIG_MADT, NULL, AcpiDmDumpMadt, DtCompileMadt, "Multiple APIC Description Table"}, - {ACPI_SIG_MCFG, NULL, AcpiDmDumpMcfg, DtCompileMcfg, "Memory Mapped Configuration table"}, - {ACPI_SIG_MCHI, AcpiDmTableInfoMchi, NULL, NULL, "Management Controller Host Interface table"}, - {ACPI_SIG_MSCT, NULL, AcpiDmDumpMsct, DtCompileMsct, "Maximum System Characteristics Table"}, - {ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, DtCompileRsdt, "Root System Description Table"}, - {ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, NULL, "Smart Battery Specification Table"}, - {ACPI_SIG_SLIC, AcpiDmTableInfoSlic, NULL, NULL, "Software Licensing Description Table"}, - {ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, DtCompileSlit, "System Locality Information Table"}, - {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, NULL, "Serial Port Console Redirection table"}, - {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, NULL, "Server Platform Management Interface table"}, - {ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, DtCompileSrat, "System Resource Affinity Table"}, - {ACPI_SIG_TCPA, AcpiDmTableInfoTcpa, NULL, NULL, "Trusted Computing Platform Alliance table"}, - {ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, NULL, "UEFI Boot Optimization Table"}, - {ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, NULL, "Windows ACPI Emulated Devices Table"}, - {ACPI_SIG_WDAT, NULL, AcpiDmDumpWdat, DtCompileWdat, "Watchdog Action Table"}, - {ACPI_SIG_WDRT, AcpiDmTableInfoWdrt, NULL, NULL, "Watchdog Resource Table"}, - {ACPI_SIG_XSDT, NULL, AcpiDmDumpXsdt, DtCompileXsdt, "Extended System Description Table"}, - {NULL, NULL, NULL, NULL, NULL} -}; - - -/******************************************************************************* - * - * FUNCTION: AcpiTbGenerateChecksum - * - * PARAMETERS: Table - Pointer to a valid ACPI table (with a - * standard ACPI header) - * - * RETURN: 8 bit checksum of buffer - * - * DESCRIPTION: Computes an 8 bit checksum of the table. - * - ******************************************************************************/ - -UINT8 -AcpiTbGenerateChecksum ( - ACPI_TABLE_HEADER *Table) -{ - UINT8 Checksum; - - - /* Sum the entire table as-is */ - - Checksum = AcpiTbChecksum ((UINT8 *) Table, Table->Length); - - /* Subtract off the existing checksum value in the table */ - - Checksum = (UINT8) (Checksum - Table->Checksum); - - /* Compute the final checksum */ - - Checksum = (UINT8) (0 - Checksum); - return (Checksum); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmGetTableData - * - * PARAMETERS: Signature - ACPI signature (4 chars) to match - * - * RETURN: Pointer to a valid ACPI_DMTABLE_DATA. Null if no match found. - * - * DESCRIPTION: Find a match in the global table of supported ACPI tables - * - ******************************************************************************/ - -ACPI_DMTABLE_DATA * -AcpiDmGetTableData ( - char *Signature) -{ - ACPI_DMTABLE_DATA *TableData; - - - for (TableData = AcpiDmTableData; TableData->Signature; TableData++) - { - if (ACPI_COMPARE_NAME (Signature, TableData->Signature)) - { - return (TableData); - } - } - - return (NULL); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmDumpDataTable - * - * PARAMETERS: Table - An ACPI table - * - * RETURN: None. - * - * DESCRIPTION: Format the contents of an ACPI data table (any table other - * than an SSDT or DSDT that does not contain executable AML code) - * - ******************************************************************************/ - -void -AcpiDmDumpDataTable ( - ACPI_TABLE_HEADER *Table) -{ - ACPI_STATUS Status; - ACPI_DMTABLE_DATA *TableData; - UINT32 Length; - - - /* Ignore tables that contain AML */ - - if (AcpiUtIsAmlTable (Table)) - { - return; - } - - /* - * Handle tables that don't use the common ACPI table header structure. - * Currently, these are the FACS and RSDP. - */ - if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS)) - { - Length = Table->Length; - AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs); - } - else if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_RSDP)) - { - Length = AcpiDmDumpRsdp (Table); - } - else - { - /* - * All other tables must use the common ACPI table header, dump it now - */ - Length = Table->Length; - Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader); - if (ACPI_FAILURE (Status)) - { - return; - } - AcpiOsPrintf ("\n"); - - /* Match signature and dispatch appropriately */ - - TableData = AcpiDmGetTableData (Table->Signature); - if (!TableData) - { - if (!ACPI_STRNCMP (Table->Signature, "OEM", 3)) - { - AcpiOsPrintf ("\n**** OEM-defined ACPI table [%4.4s], unknown contents\n\n", - Table->Signature); - } - else - { - AcpiOsPrintf ("\n**** Unknown ACPI table type [%4.4s]\n\n", - Table->Signature); - } - } - else if (TableData->TableHandler) - { - /* Complex table, has a handler */ - - TableData->TableHandler (Table); - } - else if (TableData->TableInfo) - { - /* Simple table, just walk the info table */ - - AcpiDmDumpTable (Length, 0, Table, 0, TableData->TableInfo); - } - } - - /* Always dump the raw table data */ - - AcpiOsPrintf ("\nRaw Table Data\n\n"); - AcpiUtDumpBuffer2 (ACPI_CAST_PTR (UINT8, Table), Length, DB_BYTE_DISPLAY); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmLineHeader - * - * PARAMETERS: Offset - Current byte offset, from table start - * ByteLength - Length of the field in bytes, 0 for flags - * Name - Name of this field - * Value - Optional value, displayed on left of ':' - * - * RETURN: None - * - * DESCRIPTION: Utility routines for formatting output lines. Displays the - * current table offset in hex and decimal, the field length, - * and the field name. - * - ******************************************************************************/ - -void -AcpiDmLineHeader ( - UINT32 Offset, - UINT32 ByteLength, - char *Name) -{ - - if (ByteLength) - { - AcpiOsPrintf ("[%3.3Xh %4.4d% 3d] %28s : ", - Offset, Offset, ByteLength, Name); - } - else - { - AcpiOsPrintf ("%43s : ", - Name); - } -} - -void -AcpiDmLineHeader2 ( - UINT32 Offset, - UINT32 ByteLength, - char *Name, - UINT32 Value) -{ - - if (ByteLength) - { - AcpiOsPrintf ("[%3.3Xh %4.4d% 3d] %24s % 3d : ", - Offset, Offset, ByteLength, Name, Value); - } - else - { - AcpiOsPrintf ("[%3.3Xh %4.4d ] %24s % 3d : ", - Offset, Offset, Name, Value); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmDumpTable - * - * PARAMETERS: TableLength - Length of the entire ACPI table - * TableOffset - Starting offset within the table for this - * sub-descriptor (0 if main table) - * Table - The ACPI table - * SubtableLength - Length of this sub-descriptor - * Info - Info table for this ACPI table - * - * RETURN: None - * - * DESCRIPTION: Display ACPI table contents by walking the Info table. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDmDumpTable ( - UINT32 TableLength, - UINT32 TableOffset, - void *Table, - UINT32 SubtableLength, - ACPI_DMTABLE_INFO *Info) -{ - UINT8 *Target; - UINT32 CurrentOffset; - UINT32 ByteLength; - UINT8 Temp8; - UINT16 Temp16; - ACPI_DMTABLE_DATA *TableData; - const char *Name; - BOOLEAN LastOutputBlankLine = FALSE; - char RepairedName[8]; - - - if (!Info) - { - AcpiOsPrintf ("Display not implemented\n"); - return (AE_NOT_IMPLEMENTED); - } - - /* Walk entire Info table; Null name terminates */ - - for (; Info->Name; Info++) - { - /* - * Target points to the field within the ACPI Table. CurrentOffset is - * the offset of the field from the start of the main table. - */ - Target = ACPI_ADD_PTR (UINT8, Table, Info->Offset); - CurrentOffset = TableOffset + Info->Offset; - - /* Check for beyond EOT or beyond subtable end */ - - if ((CurrentOffset >= TableLength) || - (SubtableLength && (Info->Offset >= SubtableLength))) - { - AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n"); - return (AE_BAD_DATA); - } - - /* Generate the byte length for this field */ - - switch (Info->Opcode) - { - case ACPI_DMT_UINT8: - case ACPI_DMT_CHKSUM: - case ACPI_DMT_SPACEID: - case ACPI_DMT_IVRS: - case ACPI_DMT_MADT: - case ACPI_DMT_SRAT: - case ACPI_DMT_ASF: - case ACPI_DMT_HESTNTYP: - case ACPI_DMT_FADTPM: - ByteLength = 1; - break; - case ACPI_DMT_UINT16: - case ACPI_DMT_DMAR: - case ACPI_DMT_HEST: - ByteLength = 2; - break; - case ACPI_DMT_UINT24: - ByteLength = 3; - break; - case ACPI_DMT_UINT32: - case ACPI_DMT_NAME4: - case ACPI_DMT_SIG: - ByteLength = 4; - break; - case ACPI_DMT_NAME6: - ByteLength = 6; - break; - case ACPI_DMT_UINT56: - ByteLength = 7; - break; - case ACPI_DMT_UINT64: - case ACPI_DMT_NAME8: - ByteLength = 8; - break; - case ACPI_DMT_BUF16: - ByteLength = 16; - break; - case ACPI_DMT_STRING: - ByteLength = ACPI_STRLEN (ACPI_CAST_PTR (char, Target)) + 1; - break; - case ACPI_DMT_GAS: - if (!LastOutputBlankLine) - { - AcpiOsPrintf ("\n"); - LastOutputBlankLine = TRUE; - } - ByteLength = sizeof (ACPI_GENERIC_ADDRESS); - break; - case ACPI_DMT_HESTNTFY: - if (!LastOutputBlankLine) - { - AcpiOsPrintf ("\n"); - LastOutputBlankLine = TRUE; - } - ByteLength = sizeof (ACPI_HEST_NOTIFY); - break; - default: - ByteLength = 0; - break; - } - - if (CurrentOffset + ByteLength > TableLength) - { - AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n"); - return (AE_BAD_DATA); - } - - /* Start a new line and decode the opcode */ - - AcpiDmLineHeader (CurrentOffset, ByteLength, Info->Name); - - switch (Info->Opcode) - { - /* Single-bit Flag fields. Note: Opcode is the bit position */ - - case ACPI_DMT_FLAG0: - case ACPI_DMT_FLAG1: - case ACPI_DMT_FLAG2: - case ACPI_DMT_FLAG3: - case ACPI_DMT_FLAG4: - case ACPI_DMT_FLAG5: - case ACPI_DMT_FLAG6: - case ACPI_DMT_FLAG7: - - AcpiOsPrintf ("%1.1X\n", (*Target >> Info->Opcode) & 0x01); - break; - - /* 2-bit Flag fields */ - - case ACPI_DMT_FLAGS0: - - AcpiOsPrintf ("%1.1X\n", *Target & 0x03); - break; - - case ACPI_DMT_FLAGS2: - - AcpiOsPrintf ("%1.1X\n", (*Target >> 2) & 0x03); - break; - - /* Standard Data Types */ - - case ACPI_DMT_UINT8: - - AcpiOsPrintf ("%2.2X\n", *Target); - break; - - case ACPI_DMT_UINT16: - - AcpiOsPrintf ("%4.4X\n", ACPI_GET16 (Target)); - break; - - case ACPI_DMT_UINT24: - - AcpiOsPrintf ("%2.2X%2.2X%2.2X\n", - *Target, *(Target + 1), *(Target + 2)); - break; - - case ACPI_DMT_UINT32: - - AcpiOsPrintf ("%8.8X\n", ACPI_GET32 (Target)); - break; - - case ACPI_DMT_UINT56: - - for (Temp8 = 0; Temp8 < 7; Temp8++) - { - AcpiOsPrintf ("%2.2X", Target[Temp8]); - } - AcpiOsPrintf ("\n"); - break; - - case ACPI_DMT_UINT64: - - AcpiOsPrintf ("%8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (ACPI_GET64 (Target))); - break; - - case ACPI_DMT_BUF16: - - /* Buffer of length 16 */ - - for (Temp8 = 0; Temp8 < 16; Temp8++) - { - AcpiOsPrintf ("%2.2X,", Target[Temp8]); - } - AcpiOsPrintf ("\n"); - break; - - case ACPI_DMT_STRING: - - AcpiOsPrintf ("\"%s\"\n", ACPI_CAST_PTR (char, Target)); - break; - - /* Fixed length ASCII name fields */ - - case ACPI_DMT_SIG: - - AcpiDmCheckAscii (Target, RepairedName, 4); - AcpiOsPrintf ("\"%.4s\" ", RepairedName); - TableData = AcpiDmGetTableData (ACPI_CAST_PTR (char, Target)); - if (TableData) - { - AcpiOsPrintf ("/* %s */", TableData->Name); - } - AcpiOsPrintf ("\n"); - break; - - case ACPI_DMT_NAME4: - - AcpiDmCheckAscii (Target, RepairedName, 4); - AcpiOsPrintf ("\"%.4s\"\n", RepairedName); - break; - - case ACPI_DMT_NAME6: - - AcpiDmCheckAscii (Target, RepairedName, 6); - AcpiOsPrintf ("\"%.6s\"\n", RepairedName); - break; - - case ACPI_DMT_NAME8: - - AcpiDmCheckAscii (Target, RepairedName, 8); - AcpiOsPrintf ("\"%.8s\"\n", RepairedName); - break; - - /* Special Data Types */ - - case ACPI_DMT_CHKSUM: - - /* Checksum, display and validate */ - - AcpiOsPrintf ("%2.2X", *Target); - Temp8 = AcpiTbGenerateChecksum (Table); - if (Temp8 != ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum) - { - AcpiOsPrintf ( - " /* Incorrect checksum, should be %2.2X */", Temp8); - } - AcpiOsPrintf ("\n"); - break; - - case ACPI_DMT_SPACEID: - - /* Address Space ID */ - - AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiUtGetRegionName (*Target)); - break; - - case ACPI_DMT_GAS: - - /* Generic Address Structure */ - - AcpiOsPrintf ("\n"); - AcpiDmDumpTable (TableLength, CurrentOffset, Target, - sizeof (ACPI_GENERIC_ADDRESS), AcpiDmTableInfoGas); - AcpiOsPrintf ("\n"); - LastOutputBlankLine = TRUE; - break; - - case ACPI_DMT_ASF: - - /* ASF subtable types */ - - Temp16 = (UINT16) ((*Target) & 0x7F); /* Top bit can be zero or one */ - if (Temp16 > ACPI_ASF_TYPE_RESERVED) - { - Temp16 = ACPI_ASF_TYPE_RESERVED; - } - - AcpiOsPrintf ("%2.2X <%s>\n", *Target, AcpiDmAsfSubnames[Temp16]); - break; - - case ACPI_DMT_DMAR: - - /* DMAR subtable types */ - - Temp16 = ACPI_GET16 (Target); - if (Temp16 > ACPI_DMAR_TYPE_RESERVED) - { - Temp16 = ACPI_DMAR_TYPE_RESERVED; - } - - AcpiOsPrintf ("%4.4X <%s>\n", ACPI_GET16 (Target), AcpiDmDmarSubnames[Temp16]); - break; - - case ACPI_DMT_HEST: - - /* HEST subtable types */ - - Temp16 = ACPI_GET16 (Target); - if (Temp16 > ACPI_HEST_TYPE_RESERVED) - { - Temp16 = ACPI_HEST_TYPE_RESERVED; - } - - AcpiOsPrintf ("%4.4X (%s)\n", ACPI_GET16 (Target), AcpiDmHestSubnames[Temp16]); - break; - - case ACPI_DMT_HESTNTFY: - - AcpiOsPrintf ("\n"); - AcpiDmDumpTable (TableLength, CurrentOffset, Target, - sizeof (ACPI_HEST_NOTIFY), AcpiDmTableInfoHestNotify); - AcpiOsPrintf ("\n"); - LastOutputBlankLine = TRUE; - break; - - case ACPI_DMT_HESTNTYP: - - /* HEST Notify types */ - - Temp8 = *Target; - if (Temp8 > ACPI_HEST_NOTIFY_RESERVED) - { - Temp8 = ACPI_HEST_NOTIFY_RESERVED; - } - - AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmHestNotifySubnames[Temp8]); - break; - - - case ACPI_DMT_MADT: - - /* MADT subtable types */ - - Temp8 = *Target; - if (Temp8 > ACPI_MADT_TYPE_RESERVED) - { - Temp8 = ACPI_MADT_TYPE_RESERVED; - } - - AcpiOsPrintf ("%2.2X <%s>\n", *Target, AcpiDmMadtSubnames[Temp8]); - break; - - case ACPI_DMT_SRAT: - - /* SRAT subtable types */ - - Temp8 = *Target; - if (Temp8 > ACPI_SRAT_TYPE_RESERVED) - { - Temp8 = ACPI_SRAT_TYPE_RESERVED; - } - - AcpiOsPrintf ("%2.2X <%s>\n", *Target, AcpiDmSratSubnames[Temp8]); - break; - - case ACPI_DMT_FADTPM: - - /* FADT Preferred PM Profile names */ - - Temp8 = *Target; - if (Temp8 > ACPI_FADT_PM_RESERVED) - { - Temp8 = ACPI_FADT_PM_RESERVED; - } - - AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmFadtProfiles[Temp8]); - break; - - case ACPI_DMT_IVRS: - - /* IVRS subtable types */ - - Temp8 = *Target; - switch (Temp8) - { - case ACPI_IVRS_TYPE_HARDWARE: - Name = AcpiDmIvrsSubnames[0]; - break; - - case ACPI_IVRS_TYPE_MEMORY1: - case ACPI_IVRS_TYPE_MEMORY2: - case ACPI_IVRS_TYPE_MEMORY3: - Name = AcpiDmIvrsSubnames[1]; - break; - - default: - Name = AcpiDmIvrsSubnames[2]; - break; - } - - AcpiOsPrintf ("%2.2X <%s>\n", *Target, Name); - break; - - case ACPI_DMT_EXIT: - return (AE_OK); - - default: - ACPI_ERROR ((AE_INFO, - "**** Invalid table opcode [0x%X] ****\n", Info->Opcode)); - return (AE_SUPPORT); - } - } - - if (TableOffset && !SubtableLength) - { - /* If this table is not the main table, subtable must have valid length */ - - AcpiOsPrintf ("Invalid zero length subtable\n"); - return (AE_BAD_DATA); - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmCheckAscii - * - * PARAMETERS: Name - Ascii string - * Count - Number of characters to check - * - * RETURN: None - * - * DESCRIPTION: Ensure that the requested number of characters are printable - * Ascii characters. Sets non-printable and null chars to . - * - ******************************************************************************/ - -static void -AcpiDmCheckAscii ( - UINT8 *Name, - char *RepairedName, - UINT32 Count) -{ - UINT32 i; - - - for (i = 0; i < Count; i++) - { - RepairedName[i] = (char) Name[i]; - - if (!Name[i]) - { - return; - } - if (!isprint (Name[i])) - { - RepairedName[i] = ' '; - } - } -} diff -Nru acpica-unix-20100528/common/dmtbdump.c acpica-unix-20140114/common/dmtbdump.c --- acpica-unix-20100528/common/dmtbdump.c 2010-05-28 17:14:21.000000000 +0000 +++ acpica-unix-20140114/common/dmtbdump.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1459 +0,0 @@ -/****************************************************************************** - * - * Module Name: dmtbdump - Dump ACPI data tables that contain no AML code - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acdisasm.h" -#include "actables.h" - -/* This module used for application-level code only */ - -#define _COMPONENT ACPI_CA_DISASSEMBLER - ACPI_MODULE_NAME ("dmtbdump") - - -/******************************************************************************* - * - * FUNCTION: AcpiDmDumpRsdp - * - * PARAMETERS: Table - A RSDP - * - * RETURN: Length of the table (there is no length field, use revision) - * - * DESCRIPTION: Format the contents of a RSDP - * - ******************************************************************************/ - -UINT32 -AcpiDmDumpRsdp ( - ACPI_TABLE_HEADER *Table) -{ - UINT32 Length = ACPI_RSDP_REV0_SIZE; - - - /* Dump the common ACPI 1.0 portion */ - - AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp1); - - /* ACPI 2.0+ contains more data and has a Length field */ - - if (ACPI_CAST_PTR (ACPI_TABLE_RSDP, Table)->Revision > 0) - { - Length = ACPI_CAST_PTR (ACPI_TABLE_RSDP, Table)->Length; - AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp2); - } - - return (Length); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmDumpRsdt - * - * PARAMETERS: Table - A RSDT - * - * RETURN: None - * - * DESCRIPTION: Format the contents of a RSDT - * - ******************************************************************************/ - -void -AcpiDmDumpRsdt ( - ACPI_TABLE_HEADER *Table) -{ - UINT32 *Array; - UINT32 Entries; - UINT32 Offset; - UINT32 i; - - - /* Point to start of table pointer array */ - - Array = ACPI_CAST_PTR (ACPI_TABLE_RSDT, Table)->TableOffsetEntry; - Offset = sizeof (ACPI_TABLE_HEADER); - - /* RSDT uses 32-bit pointers */ - - Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT32); - - for (i = 0; i < Entries; i++) - { - AcpiDmLineHeader2 (Offset, sizeof (UINT32), "ACPI Table Address", i); - AcpiOsPrintf ("%8.8X\n", Array[i]); - Offset += sizeof (UINT32); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmDumpXsdt - * - * PARAMETERS: Table - A XSDT - * - * RETURN: None - * - * DESCRIPTION: Format the contents of a XSDT - * - ******************************************************************************/ - -void -AcpiDmDumpXsdt ( - ACPI_TABLE_HEADER *Table) -{ - UINT64 *Array; - UINT32 Entries; - UINT32 Offset; - UINT32 i; - - - /* Point to start of table pointer array */ - - Array = ACPI_CAST_PTR (ACPI_TABLE_XSDT, Table)->TableOffsetEntry; - Offset = sizeof (ACPI_TABLE_HEADER); - - /* XSDT uses 64-bit pointers */ - - Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT64); - - for (i = 0; i < Entries; i++) - { - AcpiDmLineHeader2 (Offset, sizeof (UINT64), "ACPI Table Address", i); - AcpiOsPrintf ("%8.8X%8.8X\n", ACPI_FORMAT_UINT64 (Array[i])); - Offset += sizeof (UINT64); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmDumpFadt - * - * PARAMETERS: Table - A FADT - * - * RETURN: None - * - * DESCRIPTION: Format the contents of a FADT - * - ******************************************************************************/ - -void -AcpiDmDumpFadt ( - ACPI_TABLE_HEADER *Table) -{ - - /* Common ACPI 1.0 portion of FADT */ - - AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt1); - - /* Check for ACPI 1.0B MS extensions (FADT revision 2) */ - - if (Table->Revision == 2) - { - AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt2); - } - - /* Check for ACPI 2.0+ extended data (FADT revision 3+) */ - - else if (Table->Length >= sizeof (ACPI_TABLE_FADT)) - { - AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt3); - } - - /* Validate various fields in the FADT, including length */ - - AcpiTbCreateLocalFadt (Table, Table->Length); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmDumpAsf - * - * PARAMETERS: Table - A ASF table - * - * RETURN: None - * - * DESCRIPTION: Format the contents of a ASF table - * - ******************************************************************************/ - -void -AcpiDmDumpAsf ( - ACPI_TABLE_HEADER *Table) -{ - ACPI_STATUS Status; - UINT32 Offset = sizeof (ACPI_TABLE_HEADER); - ACPI_ASF_INFO *SubTable; - ACPI_DMTABLE_INFO *InfoTable; - ACPI_DMTABLE_INFO *DataInfoTable = NULL; - UINT8 *DataTable = NULL; - UINT32 DataCount = 0; - UINT32 DataLength = 0; - UINT32 DataOffset = 0; - UINT32 i; - UINT8 Type; - - - /* No main table, only sub-tables */ - - SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, Table, Offset); - while (Offset < Table->Length) - { - /* Common sub-table header */ - - Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, - SubTable->Header.Length, AcpiDmTableInfoAsfHdr); - if (ACPI_FAILURE (Status)) - { - return; - } - - /* The actual type is the lower 7 bits of Type */ - - Type = (UINT8) (SubTable->Header.Type & 0x7F); - - switch (Type) - { - case ACPI_ASF_TYPE_INFO: - InfoTable = AcpiDmTableInfoAsf0; - break; - - case ACPI_ASF_TYPE_ALERT: - InfoTable = AcpiDmTableInfoAsf1; - DataInfoTable = AcpiDmTableInfoAsf1a; - DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ALERT)); - DataCount = ACPI_CAST_PTR (ACPI_ASF_ALERT, SubTable)->Alerts; - DataLength = ACPI_CAST_PTR (ACPI_ASF_ALERT, SubTable)->DataLength; - DataOffset = Offset + sizeof (ACPI_ASF_ALERT); - break; - - case ACPI_ASF_TYPE_CONTROL: - InfoTable = AcpiDmTableInfoAsf2; - DataInfoTable = AcpiDmTableInfoAsf2a; - DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_REMOTE)); - DataCount = ACPI_CAST_PTR (ACPI_ASF_REMOTE, SubTable)->Controls; - DataLength = ACPI_CAST_PTR (ACPI_ASF_REMOTE, SubTable)->DataLength; - DataOffset = Offset + sizeof (ACPI_ASF_REMOTE); - break; - - case ACPI_ASF_TYPE_BOOT: - InfoTable = AcpiDmTableInfoAsf3; - break; - - case ACPI_ASF_TYPE_ADDRESS: - InfoTable = AcpiDmTableInfoAsf4; - DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ADDRESS)); - DataLength = ACPI_CAST_PTR (ACPI_ASF_ADDRESS, SubTable)->Devices; - DataOffset = Offset + sizeof (ACPI_ASF_ADDRESS); - break; - - default: - AcpiOsPrintf ("\n**** Unknown ASF sub-table type 0x%X\n", SubTable->Header.Type); - return; - } - - Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, - SubTable->Header.Length, InfoTable); - if (ACPI_FAILURE (Status)) - { - return; - } - - /* Dump variable-length extra data */ - - switch (Type) - { - case ACPI_ASF_TYPE_ALERT: - case ACPI_ASF_TYPE_CONTROL: - - for (i = 0; i < DataCount; i++) - { - AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Table->Length, DataOffset, - DataTable, DataLength, DataInfoTable); - if (ACPI_FAILURE (Status)) - { - return; - } - - DataTable = ACPI_ADD_PTR (UINT8, DataTable, DataLength); - DataOffset += DataLength; - } - break; - - case ACPI_ASF_TYPE_ADDRESS: - - for (i = 0; i < DataLength; i++) - { - if (!(i % 16)) - { - AcpiDmLineHeader (DataOffset, 1, "Addresses"); - } - - AcpiOsPrintf ("%2.2X ", *DataTable); - DataTable++; - DataOffset++; - if (DataOffset > Table->Length) - { - AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n"); - return; - } - } - - AcpiOsPrintf ("\n"); - break; - - default: - break; - } - - AcpiOsPrintf ("\n"); - - /* Point to next sub-table */ - - if (!SubTable->Header.Length) - { - AcpiOsPrintf ("Invalid zero subtable header length\n"); - return; - } - - Offset += SubTable->Header.Length; - SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, SubTable, SubTable->Header.Length); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmDumpCpep - * - * PARAMETERS: Table - A CPEP table - * - * RETURN: None - * - * DESCRIPTION: Format the contents of a CPEP. This table type consists - * of an open-ended number of subtables. - * - ******************************************************************************/ - -void -AcpiDmDumpCpep ( - ACPI_TABLE_HEADER *Table) -{ - ACPI_STATUS Status; - ACPI_CPEP_POLLING *SubTable; - UINT32 Length = Table->Length; - UINT32 Offset = sizeof (ACPI_TABLE_CPEP); - - - /* Main table */ - - Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoCpep); - if (ACPI_FAILURE (Status)) - { - return; - } - - /* Sub-tables */ - - SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, Table, Offset); - while (Offset < Table->Length) - { - AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Header.Length, AcpiDmTableInfoCpep0); - if (ACPI_FAILURE (Status)) - { - return; - } - - /* Point to next sub-table */ - - Offset += SubTable->Header.Length; - SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, SubTable, - SubTable->Header.Length); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmDumpDmar - * - * PARAMETERS: Table - A DMAR table - * - * RETURN: None - * - * DESCRIPTION: Format the contents of a DMAR. This table type consists - * of an open-ended number of subtables. - * - ******************************************************************************/ - -void -AcpiDmDumpDmar ( - ACPI_TABLE_HEADER *Table) -{ - ACPI_STATUS Status; - ACPI_DMAR_HEADER *SubTable; - UINT32 Length = Table->Length; - UINT32 Offset = sizeof (ACPI_TABLE_DMAR); - ACPI_DMTABLE_INFO *InfoTable; - ACPI_DMAR_DEVICE_SCOPE *ScopeTable; - UINT32 ScopeOffset; - UINT8 *PciPath; - UINT32 PathOffset; - - - /* Main table */ - - Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDmar); - if (ACPI_FAILURE (Status)) - { - return; - } - - /* Sub-tables */ - - SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Table, Offset); - while (Offset < Table->Length) - { - /* Common sub-table header */ - - AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Length, AcpiDmTableInfoDmarHdr); - if (ACPI_FAILURE (Status)) - { - return; - } - - switch (SubTable->Type) - { - case ACPI_DMAR_TYPE_HARDWARE_UNIT: - InfoTable = AcpiDmTableInfoDmar0; - ScopeOffset = sizeof (ACPI_DMAR_HARDWARE_UNIT); - break; - case ACPI_DMAR_TYPE_RESERVED_MEMORY: - InfoTable = AcpiDmTableInfoDmar1; - ScopeOffset = sizeof (ACPI_DMAR_RESERVED_MEMORY); - break; - case ACPI_DMAR_TYPE_ATSR: - InfoTable = AcpiDmTableInfoDmar2; - ScopeOffset = sizeof (ACPI_DMAR_ATSR); - break; - case ACPI_DMAR_HARDWARE_AFFINITY: - InfoTable = AcpiDmTableInfoDmar3; - ScopeOffset = sizeof (ACPI_DMAR_RHSA); - break; - default: - AcpiOsPrintf ("\n**** Unknown DMAR sub-table type 0x%X\n\n", SubTable->Type); - return; - } - - Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Length, InfoTable); - if (ACPI_FAILURE (Status)) - { - return; - } - - /* Dump the device scope entries (if any) */ - - ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, SubTable, ScopeOffset); - while (ScopeOffset < SubTable->Length) - { - AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset + ScopeOffset, ScopeTable, - ScopeTable->Length, AcpiDmTableInfoDmarScope); - if (ACPI_FAILURE (Status)) - { - return; - } - - /* Dump the PCI Path entries for this device scope */ - - PathOffset = sizeof (ACPI_DMAR_DEVICE_SCOPE); /* Path entries start at this offset */ - - PciPath = ACPI_ADD_PTR (UINT8, ScopeTable, - sizeof (ACPI_DMAR_DEVICE_SCOPE)); - - while (PathOffset < ScopeTable->Length) - { - AcpiDmLineHeader ((PathOffset + ScopeOffset + Offset), 2, "PCI Path"); - AcpiOsPrintf ("[%2.2X, %2.2X]\n", PciPath[0], PciPath[1]); - - /* Point to next PCI Path entry */ - - PathOffset += 2; - PciPath += 2; - } - - /* Point to next device scope entry */ - - ScopeOffset += ScopeTable->Length; - ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, - ScopeTable, ScopeTable->Length); - } - - /* Point to next sub-table */ - - Offset += SubTable->Length; - SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, SubTable, SubTable->Length); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmDumpEinj - * - * PARAMETERS: Table - A EINJ table - * - * RETURN: None - * - * DESCRIPTION: Format the contents of a EINJ. This table type consists - * of an open-ended number of subtables. - * - ******************************************************************************/ - -void -AcpiDmDumpEinj ( - ACPI_TABLE_HEADER *Table) -{ - ACPI_STATUS Status; - ACPI_WHEA_HEADER *SubTable; - UINT32 Length = Table->Length; - UINT32 Offset = sizeof (ACPI_TABLE_EINJ); - - - /* Main table */ - - Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoEinj); - if (ACPI_FAILURE (Status)) - { - return; - } - - /* Sub-tables */ - - SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset); - while (Offset < Table->Length) - { - AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset, SubTable, - sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoEinj0); - if (ACPI_FAILURE (Status)) - { - return; - } - - /* Point to next sub-table (each subtable is of fixed length) */ - - Offset += sizeof (ACPI_WHEA_HEADER); - SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable, - sizeof (ACPI_WHEA_HEADER)); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmDumpErst - * - * PARAMETERS: Table - A ERST table - * - * RETURN: None - * - * DESCRIPTION: Format the contents of a ERST. This table type consists - * of an open-ended number of subtables. - * - ******************************************************************************/ - -void -AcpiDmDumpErst ( - ACPI_TABLE_HEADER *Table) -{ - ACPI_STATUS Status; - ACPI_WHEA_HEADER *SubTable; - UINT32 Length = Table->Length; - UINT32 Offset = sizeof (ACPI_TABLE_ERST); - - - /* Main table */ - - Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoErst); - if (ACPI_FAILURE (Status)) - { - return; - } - - /* Sub-tables */ - - SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset); - while (Offset < Table->Length) - { - AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset, SubTable, - sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoEinj0); - if (ACPI_FAILURE (Status)) - { - return; - } - - /* Point to next sub-table (each subtable is of fixed length) */ - - Offset += sizeof (ACPI_WHEA_HEADER); - SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable, - sizeof (ACPI_WHEA_HEADER)); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmDumpHest - * - * PARAMETERS: Table - A HEST table - * - * RETURN: None - * - * DESCRIPTION: Format the contents of a HEST. This table type consists - * of an open-ended number of subtables. - * - ******************************************************************************/ - -void -AcpiDmDumpHest ( - ACPI_TABLE_HEADER *Table) -{ - ACPI_STATUS Status; - ACPI_HEST_HEADER *SubTable; - UINT32 Length = Table->Length; - UINT32 Offset = sizeof (ACPI_TABLE_HEST); - ACPI_DMTABLE_INFO *InfoTable; - UINT32 SubTableLength; - UINT32 BankCount; - ACPI_HEST_IA_ERROR_BANK *BankTable; - - - /* Main table */ - - Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHest); - if (ACPI_FAILURE (Status)) - { - return; - } - - /* Sub-tables */ - - SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Table, Offset); - while (Offset < Table->Length) - { - BankCount = 0; - switch (SubTable->Type) - { - case ACPI_HEST_TYPE_IA32_CHECK: - InfoTable = AcpiDmTableInfoHest0; - SubTableLength = sizeof (ACPI_HEST_IA_MACHINE_CHECK); - BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_MACHINE_CHECK, - SubTable))->NumHardwareBanks; - break; - - case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK: - InfoTable = AcpiDmTableInfoHest1; - SubTableLength = sizeof (ACPI_HEST_IA_CORRECTED); - BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_CORRECTED, - SubTable))->NumHardwareBanks; - break; - - case ACPI_HEST_TYPE_IA32_NMI: - InfoTable = AcpiDmTableInfoHest2; - SubTableLength = sizeof (ACPI_HEST_IA_NMI); - break; - - case ACPI_HEST_TYPE_AER_ROOT_PORT: - InfoTable = AcpiDmTableInfoHest6; - SubTableLength = sizeof (ACPI_HEST_AER_ROOT); - break; - - case ACPI_HEST_TYPE_AER_ENDPOINT: - InfoTable = AcpiDmTableInfoHest7; - SubTableLength = sizeof (ACPI_HEST_AER); - break; - - case ACPI_HEST_TYPE_AER_BRIDGE: - InfoTable = AcpiDmTableInfoHest8; - SubTableLength = sizeof (ACPI_HEST_AER_BRIDGE); - break; - - case ACPI_HEST_TYPE_GENERIC_ERROR: - InfoTable = AcpiDmTableInfoHest9; - SubTableLength = sizeof (ACPI_HEST_GENERIC); - break; - - default: - /* Cannot continue on unknown type - no length */ - - AcpiOsPrintf ("\n**** Unknown HEST sub-table type 0x%X\n", SubTable->Type); - return; - } - - AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTableLength, InfoTable); - if (ACPI_FAILURE (Status)) - { - return; - } - - /* Point to end of current subtable (each subtable above is of fixed length) */ - - Offset += SubTableLength; - - /* If there are any (fixed-length) Error Banks from above, dump them now */ - - if (BankCount) - { - BankTable = ACPI_ADD_PTR (ACPI_HEST_IA_ERROR_BANK, SubTable, SubTableLength); - SubTableLength += BankCount * sizeof (ACPI_HEST_IA_ERROR_BANK); - - while (BankCount) - { - AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset, BankTable, - sizeof (ACPI_HEST_IA_ERROR_BANK), AcpiDmTableInfoHestBank); - if (ACPI_FAILURE (Status)) - { - return; - } - Offset += sizeof (ACPI_HEST_IA_ERROR_BANK); - BankTable++; - BankCount--; - } - } - - /* Point to next sub-table */ - - SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, SubTable, SubTableLength); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmDumpIvrs - * - * PARAMETERS: Table - A IVRS table - * - * RETURN: None - * - * DESCRIPTION: Format the contents of a IVRS - * - ******************************************************************************/ - -static UINT8 EntrySizes[] = {4,8,16,32}; - -void -AcpiDmDumpIvrs ( - ACPI_TABLE_HEADER *Table) -{ - ACPI_STATUS Status; - UINT32 Offset = sizeof (ACPI_TABLE_IVRS); - UINT32 EntryOffset; - UINT32 EntryLength; - UINT32 EntryType; - ACPI_IVRS_DE_HEADER *DeviceEntry; - ACPI_IVRS_HEADER *SubTable; - ACPI_DMTABLE_INFO *InfoTable; - - - /* Main table */ - - Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIvrs); - if (ACPI_FAILURE (Status)) - { - return; - } - - /* Sub-tables */ - - SubTable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Table, Offset); - while (Offset < Table->Length) - { - /* Common sub-table header */ - - AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, - SubTable->Length, AcpiDmTableInfoIvrsHdr); - if (ACPI_FAILURE (Status)) - { - return; - } - - switch (SubTable->Type) - { - case ACPI_IVRS_TYPE_HARDWARE: - InfoTable = AcpiDmTableInfoIvrs0; - break; - case ACPI_IVRS_TYPE_MEMORY1: - case ACPI_IVRS_TYPE_MEMORY2: - case ACPI_IVRS_TYPE_MEMORY3: - InfoTable = AcpiDmTableInfoIvrs1; - break; - default: - AcpiOsPrintf ("\n**** Unknown IVRS sub-table type 0x%X\n", - SubTable->Type); - - /* Attempt to continue */ - - if (!SubTable->Length) - { - AcpiOsPrintf ("Invalid zero length subtable\n"); - return; - } - goto NextSubTable; - } - - /* Dump the subtable */ - - AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, - SubTable->Length, InfoTable); - if (ACPI_FAILURE (Status)) - { - return; - } - - /* The hardware subtable can contain multiple device entries */ - - if (SubTable->Type == ACPI_IVRS_TYPE_HARDWARE) - { - EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE); - DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, SubTable, - sizeof (ACPI_IVRS_HARDWARE)); - - while (EntryOffset < (Offset + SubTable->Length)) - { - AcpiOsPrintf ("\n"); - /* - * Upper 2 bits of Type encode the length of the device entry - * - * 00 = 4 byte - * 01 = 8 byte - * 10 = 16 byte - currently no entries defined - * 11 = 32 byte - currently no entries defined - */ - EntryType = DeviceEntry->Type; - EntryLength = EntrySizes [EntryType >> 6]; - - switch (EntryType) - { - /* 4-byte device entries */ - - case ACPI_IVRS_TYPE_PAD4: - case ACPI_IVRS_TYPE_ALL: - case ACPI_IVRS_TYPE_SELECT: - case ACPI_IVRS_TYPE_START: - case ACPI_IVRS_TYPE_END: - - InfoTable = AcpiDmTableInfoIvrs4; - break; - - /* 8-byte entries, type A */ - - case ACPI_IVRS_TYPE_ALIAS_SELECT: - case ACPI_IVRS_TYPE_ALIAS_START: - - InfoTable = AcpiDmTableInfoIvrs8a; - break; - - /* 8-byte entries, type B */ - - case ACPI_IVRS_TYPE_PAD8: - case ACPI_IVRS_TYPE_EXT_SELECT: - case ACPI_IVRS_TYPE_EXT_START: - - InfoTable = AcpiDmTableInfoIvrs8b; - break; - - /* 8-byte entries, type C */ - - case ACPI_IVRS_TYPE_SPECIAL: - - InfoTable = AcpiDmTableInfoIvrs8c; - break; - - default: - InfoTable = AcpiDmTableInfoIvrs4; - AcpiOsPrintf ( - "\n**** Unknown IVRS device entry type/length: " - "0x%.2X/0x%X at offset 0x%.4X: (header below)\n", - EntryType, EntryLength, EntryOffset); - break; - } - - /* Dump the Device Entry */ - - Status = AcpiDmDumpTable (Table->Length, EntryOffset, - DeviceEntry, EntryLength, InfoTable); - - EntryOffset += EntryLength; - DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, DeviceEntry, - EntryLength); - } - } - -NextSubTable: - /* Point to next sub-table */ - - Offset += SubTable->Length; - SubTable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, SubTable, SubTable->Length); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmDumpMadt - * - * PARAMETERS: Table - A MADT table - * - * RETURN: None - * - * DESCRIPTION: Format the contents of a MADT. This table type consists - * of an open-ended number of subtables. - * - ******************************************************************************/ - -void -AcpiDmDumpMadt ( - ACPI_TABLE_HEADER *Table) -{ - ACPI_STATUS Status; - ACPI_SUBTABLE_HEADER *SubTable; - UINT32 Length = Table->Length; - UINT32 Offset = sizeof (ACPI_TABLE_MADT); - ACPI_DMTABLE_INFO *InfoTable; - - - /* Main table */ - - Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt); - if (ACPI_FAILURE (Status)) - { - return; - } - - /* Sub-tables */ - - SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset); - while (Offset < Table->Length) - { - /* Common sub-table header */ - - AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Length, AcpiDmTableInfoMadtHdr); - if (ACPI_FAILURE (Status)) - { - return; - } - - switch (SubTable->Type) - { - case ACPI_MADT_TYPE_LOCAL_APIC: - InfoTable = AcpiDmTableInfoMadt0; - break; - case ACPI_MADT_TYPE_IO_APIC: - InfoTable = AcpiDmTableInfoMadt1; - break; - case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE: - InfoTable = AcpiDmTableInfoMadt2; - break; - case ACPI_MADT_TYPE_NMI_SOURCE: - InfoTable = AcpiDmTableInfoMadt3; - break; - case ACPI_MADT_TYPE_LOCAL_APIC_NMI: - InfoTable = AcpiDmTableInfoMadt4; - break; - case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE: - InfoTable = AcpiDmTableInfoMadt5; - break; - case ACPI_MADT_TYPE_IO_SAPIC: - InfoTable = AcpiDmTableInfoMadt6; - break; - case ACPI_MADT_TYPE_LOCAL_SAPIC: - InfoTable = AcpiDmTableInfoMadt7; - break; - case ACPI_MADT_TYPE_INTERRUPT_SOURCE: - InfoTable = AcpiDmTableInfoMadt8; - break; - case ACPI_MADT_TYPE_LOCAL_X2APIC: - InfoTable = AcpiDmTableInfoMadt9; - break; - case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI: - InfoTable = AcpiDmTableInfoMadt10; - break; - default: - AcpiOsPrintf ("\n**** Unknown MADT sub-table type 0x%X\n\n", SubTable->Type); - - /* Attempt to continue */ - - if (!SubTable->Length) - { - AcpiOsPrintf ("Invalid zero length subtable\n"); - return; - } - goto NextSubTable; - } - - Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Length, InfoTable); - if (ACPI_FAILURE (Status)) - { - return; - } - -NextSubTable: - /* Point to next sub-table */ - - Offset += SubTable->Length; - SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable, SubTable->Length); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmDumpMcfg - * - * PARAMETERS: Table - A MCFG Table - * - * RETURN: None - * - * DESCRIPTION: Format the contents of a MCFG table - * - ******************************************************************************/ - -void -AcpiDmDumpMcfg ( - ACPI_TABLE_HEADER *Table) -{ - ACPI_STATUS Status; - UINT32 Offset = sizeof (ACPI_TABLE_MCFG); - ACPI_MCFG_ALLOCATION *SubTable; - - - /* Main table */ - - Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMcfg); - if (ACPI_FAILURE (Status)) - { - return; - } - - /* Sub-tables */ - - SubTable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Table, Offset); - while (Offset < Table->Length) - { - if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length) - { - AcpiOsPrintf ("Warning: there are %u invalid trailing bytes\n", - sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length)); - return; - } - - AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, - sizeof (ACPI_MCFG_ALLOCATION), AcpiDmTableInfoMcfg0); - if (ACPI_FAILURE (Status)) - { - return; - } - - /* Point to next sub-table (each subtable is of fixed length) */ - - Offset += sizeof (ACPI_MCFG_ALLOCATION); - SubTable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, SubTable, - sizeof (ACPI_MCFG_ALLOCATION)); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmDumpMsct - * - * PARAMETERS: Table - A MSCT table - * - * RETURN: None - * - * DESCRIPTION: Format the contents of a MSCT - * - ******************************************************************************/ - -void -AcpiDmDumpMsct ( - ACPI_TABLE_HEADER *Table) -{ - ACPI_STATUS Status; - UINT32 Offset = sizeof (ACPI_TABLE_MSCT); - ACPI_MSCT_PROXIMITY *SubTable; - - - /* Main table */ - - Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMsct); - if (ACPI_FAILURE (Status)) - { - return; - } - - /* Sub-tables */ - - SubTable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Table, Offset); - while (Offset < Table->Length) - { - /* Common sub-table header */ - - AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, - sizeof (ACPI_MSCT_PROXIMITY), AcpiDmTableInfoMsct0); - if (ACPI_FAILURE (Status)) - { - return; - } - - /* Point to next sub-table */ - - Offset += sizeof (ACPI_MSCT_PROXIMITY); - SubTable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, SubTable, sizeof (ACPI_MSCT_PROXIMITY)); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmDumpSlit - * - * PARAMETERS: Table - An SLIT - * - * RETURN: None - * - * DESCRIPTION: Format the contents of a SLIT - * - ******************************************************************************/ - -void -AcpiDmDumpSlit ( - ACPI_TABLE_HEADER *Table) -{ - ACPI_STATUS Status; - UINT32 Offset; - UINT8 *Row; - UINT32 Localities; - UINT32 i; - UINT32 j; - - - /* Main table */ - - Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSlit); - if (ACPI_FAILURE (Status)) - { - return; - } - - /* Display the Locality NxN Matrix */ - - Localities = (UINT32) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->LocalityCount; - Offset = ACPI_OFFSET (ACPI_TABLE_SLIT, Entry[0]); - Row = (UINT8 *) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->Entry; - - for (i = 0; i < Localities; i++) - { - /* Display one row of the matrix */ - - AcpiDmLineHeader2 (Offset, Localities, "Locality", i); - for (j = 0; j < Localities; j++) - { - /* Check for beyond EOT */ - - if (Offset >= Table->Length) - { - AcpiOsPrintf ("\n**** Not enough room in table for all localities\n"); - return; - } - - AcpiOsPrintf ("%2.2X ", Row[j]); - Offset++; - - /* Display up to 16 bytes per output row */ - - if (j && (((j+1) % 16) == 0) && ((j+1) < Localities)) - { - AcpiOsPrintf ("\n"); - AcpiDmLineHeader (Offset, 0, ""); - } - } - - /* Point to next row */ - - AcpiOsPrintf ("\n"); - Row += Localities; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmDumpSrat - * - * PARAMETERS: Table - A SRAT table - * - * RETURN: None - * - * DESCRIPTION: Format the contents of a SRAT - * - ******************************************************************************/ - -void -AcpiDmDumpSrat ( - ACPI_TABLE_HEADER *Table) -{ - ACPI_STATUS Status; - UINT32 Offset = sizeof (ACPI_TABLE_SRAT); - ACPI_SUBTABLE_HEADER *SubTable; - ACPI_DMTABLE_INFO *InfoTable; - - - /* Main table */ - - Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSrat); - if (ACPI_FAILURE (Status)) - { - return; - } - - /* Sub-tables */ - - SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset); - while (Offset < Table->Length) - { - /* Common sub-table header */ - - AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, - SubTable->Length, AcpiDmTableInfoSratHdr); - if (ACPI_FAILURE (Status)) - { - return; - } - - switch (SubTable->Type) - { - case ACPI_SRAT_TYPE_CPU_AFFINITY: - InfoTable = AcpiDmTableInfoSrat0; - break; - case ACPI_SRAT_TYPE_MEMORY_AFFINITY: - InfoTable = AcpiDmTableInfoSrat1; - break; - case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY: - InfoTable = AcpiDmTableInfoSrat2; - break; - default: - AcpiOsPrintf ("\n**** Unknown SRAT sub-table type 0x%X\n", SubTable->Type); - - /* Attempt to continue */ - - if (!SubTable->Length) - { - AcpiOsPrintf ("Invalid zero length subtable\n"); - return; - } - goto NextSubTable; - } - - AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, - SubTable->Length, InfoTable); - if (ACPI_FAILURE (Status)) - { - return; - } - -NextSubTable: - /* Point to next sub-table */ - - Offset += SubTable->Length; - SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable, SubTable->Length); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmDumpWdat - * - * PARAMETERS: Table - A WDAT table - * - * RETURN: None - * - * DESCRIPTION: Format the contents of a WDAT - * - ******************************************************************************/ - -void -AcpiDmDumpWdat ( - ACPI_TABLE_HEADER *Table) -{ - ACPI_STATUS Status; - UINT32 Offset = sizeof (ACPI_TABLE_WDAT); - ACPI_WDAT_ENTRY *SubTable; - - - /* Main table */ - - Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoWdat); - if (ACPI_FAILURE (Status)) - { - return; - } - - /* Sub-tables */ - - SubTable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, Table, Offset); - while (Offset < Table->Length) - { - /* Common sub-table header */ - - AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, - sizeof (ACPI_WDAT_ENTRY), AcpiDmTableInfoWdat0); - if (ACPI_FAILURE (Status)) - { - return; - } - - /* Point to next sub-table */ - - Offset += sizeof (ACPI_WDAT_ENTRY); - SubTable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, SubTable, sizeof (ACPI_WDAT_ENTRY)); - } -} diff -Nru acpica-unix-20100528/common/dmtbinfo.c acpica-unix-20140114/common/dmtbinfo.c --- acpica-unix-20100528/common/dmtbinfo.c 2010-05-28 17:14:21.000000000 +0000 +++ acpica-unix-20140114/common/dmtbinfo.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1558 +0,0 @@ -/****************************************************************************** - * - * Module Name: dmtbinfo - Table info for non-AML tables - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acdisasm.h" - -/* This module used for application-level code only */ - -#define _COMPONENT ACPI_CA_DISASSEMBLER - ACPI_MODULE_NAME ("dmtbinfo") - -/* - * Macros used to generate offsets to specific table fields - */ -#define ACPI_FACS_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_FACS,f) -#define ACPI_GAS_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_GENERIC_ADDRESS,f) -#define ACPI_HDR_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_HEADER,f) -#define ACPI_RSDP_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_RSDP,f) -#define ACPI_BOOT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_BOOT,f) -#define ACPI_BERT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_BERT,f) -#define ACPI_CPEP_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_CPEP,f) -#define ACPI_DBGP_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_DBGP,f) -#define ACPI_DMAR_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_DMAR,f) -#define ACPI_ECDT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_ECDT,f) -#define ACPI_EINJ_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_EINJ,f) -#define ACPI_ERST_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_ERST,f) -#define ACPI_HEST_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_HEST,f) -#define ACPI_HPET_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_HPET,f) -#define ACPI_IVRS_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_IVRS,f) -#define ACPI_MADT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MADT,f) -#define ACPI_MCFG_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MCFG,f) -#define ACPI_MCHI_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MCHI,f) -#define ACPI_MSCT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MSCT,f) -#define ACPI_SBST_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SBST,f) -#define ACPI_SLIT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SLIT,f) -#define ACPI_SPCR_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SPCR,f) -#define ACPI_SPMI_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SPMI,f) -#define ACPI_SRAT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SRAT,f) -#define ACPI_TCPA_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_TCPA,f) -#define ACPI_UEFI_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_UEFI,f) -#define ACPI_WAET_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_WAET,f) -#define ACPI_WDAT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_WDAT,f) -#define ACPI_WDRT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_WDRT,f) - -/* Subtables */ - -#define ACPI_ASF0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_INFO,f) -#define ACPI_ASF1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_ALERT,f) -#define ACPI_ASF1a_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_ALERT_DATA,f) -#define ACPI_ASF2_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_REMOTE,f) -#define ACPI_ASF2a_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_CONTROL_DATA,f) -#define ACPI_ASF3_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_RMCP,f) -#define ACPI_ASF4_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_ADDRESS,f) -#define ACPI_CPEP0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_CPEP_POLLING,f) -#define ACPI_DMARS_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_DMAR_DEVICE_SCOPE,f) -#define ACPI_DMAR0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_DMAR_HARDWARE_UNIT,f) -#define ACPI_DMAR1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_DMAR_RESERVED_MEMORY,f) -#define ACPI_DMAR2_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_DMAR_ATSR,f) -#define ACPI_DMAR3_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_DMAR_RHSA,f) -#define ACPI_EINJ0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_WHEA_HEADER,f) -#define ACPI_HEST0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_IA_MACHINE_CHECK,f) -#define ACPI_HEST1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_IA_CORRECTED,f) -#define ACPI_HEST2_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_IA_NMI,f) -#define ACPI_HEST6_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_AER_ROOT,f) -#define ACPI_HEST7_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_AER,f) -#define ACPI_HEST8_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_AER_BRIDGE,f) -#define ACPI_HEST9_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_GENERIC,f) -#define ACPI_HESTN_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_NOTIFY,f) -#define ACPI_HESTB_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_IA_ERROR_BANK,f) -#define ACPI_IVRSH_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_IVRS_HEADER,f) -#define ACPI_IVRS0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_IVRS_HARDWARE,f) -#define ACPI_IVRS1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_IVRS_MEMORY,f) -#define ACPI_IVRSD_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_IVRS_DE_HEADER,f) -#define ACPI_IVRS8A_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_IVRS_DEVICE8A,f) -#define ACPI_IVRS8B_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_IVRS_DEVICE8B,f) -#define ACPI_IVRS8C_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_IVRS_DEVICE8C,f) -#define ACPI_MADT0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_APIC,f) -#define ACPI_MADT1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_IO_APIC,f) -#define ACPI_MADT2_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_INTERRUPT_OVERRIDE,f) -#define ACPI_MADT3_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_NMI_SOURCE,f) -#define ACPI_MADT4_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_APIC_NMI,f) -#define ACPI_MADT5_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_APIC_OVERRIDE,f) -#define ACPI_MADT6_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_IO_SAPIC,f) -#define ACPI_MADT7_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_SAPIC,f) -#define ACPI_MADT8_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_INTERRUPT_SOURCE,f) -#define ACPI_MADT9_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_X2APIC,f) -#define ACPI_MADT10_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_X2APIC_NMI,f) -#define ACPI_MADTH_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SUBTABLE_HEADER,f) -#define ACPI_MCFG0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MCFG_ALLOCATION,f) -#define ACPI_MSCT0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MSCT_PROXIMITY,f) -#define ACPI_SRATH_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SUBTABLE_HEADER,f) -#define ACPI_SRAT0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SRAT_CPU_AFFINITY,f) -#define ACPI_SRAT1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SRAT_MEM_AFFINITY,f) -#define ACPI_SRAT2_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SRAT_X2APIC_CPU_AFFINITY,f) -#define ACPI_WDAT0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_WDAT_ENTRY,f) - -/* - * Simplify access to flag fields by breaking them up into bytes - */ -#define ACPI_FLAG_OFFSET(d,f,o) (UINT8) (ACPI_OFFSET (d,f) + o) - -/* Flags */ - -#define ACPI_FADT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_FADT,f,o) -#define ACPI_FACS_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_FACS,f,o) -#define ACPI_HPET_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_HPET,f,o) -#define ACPI_SRAT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_SRAT_CPU_AFFINITY,f,o) -#define ACPI_SRAT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_SRAT_MEM_AFFINITY,f,o) -#define ACPI_SRAT2_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_SRAT_X2APIC_CPU_AFFINITY,f,o) -#define ACPI_MADT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_MADT,f,o) -#define ACPI_MADT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_APIC,f,o) -#define ACPI_MADT2_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_INTERRUPT_OVERRIDE,f,o) -#define ACPI_MADT3_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_NMI_SOURCE,f,o) -#define ACPI_MADT4_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_APIC_NMI,f,o) -#define ACPI_MADT7_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_SAPIC,f,o) -#define ACPI_MADT8_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_INTERRUPT_SOURCE,f,o) -#define ACPI_MADT9_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_X2APIC,f,o) -#define ACPI_MADT10_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_X2APIC_NMI,f,o) - -/* - * Required terminator for all tables below - */ -#define ACPI_DMT_TERMINATOR {ACPI_DMT_EXIT, 0, NULL, 0} - - -/* - * ACPI Table Information, used to dump formatted ACPI tables - * - * Each entry is of the form: - */ - -/******************************************************************************* - * - * Common ACPI table header - * - ******************************************************************************/ - -ACPI_DMTABLE_INFO AcpiDmTableInfoHeader[] = -{ - {ACPI_DMT_SIG, ACPI_HDR_OFFSET (Signature[0]), "Signature", 0}, - {ACPI_DMT_UINT32, ACPI_HDR_OFFSET (Length), "Table Length", DT_LENGTH}, - {ACPI_DMT_UINT8, ACPI_HDR_OFFSET (Revision), "Revision", 0}, - {ACPI_DMT_CHKSUM, ACPI_HDR_OFFSET (Checksum), "Checksum", 0}, - {ACPI_DMT_NAME6, ACPI_HDR_OFFSET (OemId[0]), "Oem ID", 0}, - {ACPI_DMT_NAME8, ACPI_HDR_OFFSET (OemTableId[0]), "Oem Table ID", 0}, - {ACPI_DMT_UINT32, ACPI_HDR_OFFSET (OemRevision), "Oem Revision", 0}, - {ACPI_DMT_NAME4, ACPI_HDR_OFFSET (AslCompilerId[0]), "Asl Compiler ID", 0}, - {ACPI_DMT_UINT32, ACPI_HDR_OFFSET (AslCompilerRevision), "Asl Compiler Revision", 0}, - ACPI_DMT_TERMINATOR -}; - - -/******************************************************************************* - * - * GAS - Generic Address Structure - * - ******************************************************************************/ - -ACPI_DMTABLE_INFO AcpiDmTableInfoGas[] = -{ - {ACPI_DMT_SPACEID, ACPI_GAS_OFFSET (SpaceId), "Space ID", 0}, - {ACPI_DMT_UINT8, ACPI_GAS_OFFSET (BitWidth), "Bit Width", 0}, - {ACPI_DMT_UINT8, ACPI_GAS_OFFSET (BitOffset), "Bit Offset", 0}, - {ACPI_DMT_UINT8, ACPI_GAS_OFFSET (AccessWidth), "Access Width", 0}, - {ACPI_DMT_UINT64, ACPI_GAS_OFFSET (Address), "Address", 0}, - ACPI_DMT_TERMINATOR -}; - - -/******************************************************************************* - * - * RSDP - Root System Description Pointer (Signature is "RSD PTR ") - * - ******************************************************************************/ - -ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp1[] = -{ - {ACPI_DMT_NAME8, ACPI_RSDP_OFFSET (Signature[0]), "Signature", 0}, - {ACPI_DMT_UINT8, ACPI_RSDP_OFFSET (Checksum), "Checksum", 0}, - {ACPI_DMT_NAME6, ACPI_RSDP_OFFSET (OemId[0]), "Oem ID", 0}, - {ACPI_DMT_UINT8, ACPI_RSDP_OFFSET (Revision), "Revision", 0}, - {ACPI_DMT_UINT32, ACPI_RSDP_OFFSET (RsdtPhysicalAddress), "RSDT Address", 0}, - ACPI_DMT_TERMINATOR -}; - -/* ACPI 2.0+ Extensions */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp2[] = -{ - {ACPI_DMT_UINT32, ACPI_RSDP_OFFSET (Length), "Length", DT_LENGTH}, - {ACPI_DMT_UINT64, ACPI_RSDP_OFFSET (XsdtPhysicalAddress), "XSDT Address", 0}, - {ACPI_DMT_UINT8, ACPI_RSDP_OFFSET (ExtendedChecksum), "Extended Checksum", 0}, - {ACPI_DMT_UINT24, ACPI_RSDP_OFFSET (Reserved[0]), "Reserved", 0}, - ACPI_DMT_TERMINATOR -}; - - -/******************************************************************************* - * - * FACS - Firmware ACPI Control Structure - * - ******************************************************************************/ - -ACPI_DMTABLE_INFO AcpiDmTableInfoFacs[] = -{ - {ACPI_DMT_NAME4, ACPI_FACS_OFFSET (Signature[0]), "Signature", 0}, - {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (Length), "Length", DT_LENGTH}, - {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (HardwareSignature), "Hardware Signature", 0}, - {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (FirmwareWakingVector), "32 Firmware Waking Vector", 0}, - {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (GlobalLock), "Global Lock", 0}, - {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, - {ACPI_DMT_FLAG0, ACPI_FACS_FLAG_OFFSET (Flags,0), "S4BIOS Support Present", 0}, - {ACPI_DMT_FLAG1, ACPI_FACS_FLAG_OFFSET (Flags,0), "64-bit Wake Supported (V2)", 0}, - {ACPI_DMT_UINT64, ACPI_FACS_OFFSET (XFirmwareWakingVector), "64 Firmware Waking Vector", 0}, - {ACPI_DMT_UINT8, ACPI_FACS_OFFSET (Version), "Version", 0}, - {ACPI_DMT_UINT24, ACPI_FACS_OFFSET (Reserved[0]), "Reserved", 0}, - {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (OspmFlags), "OspmFlags (decoded below)", DT_FLAG}, - {ACPI_DMT_FLAG0, ACPI_FACS_FLAG_OFFSET (OspmFlags,0), "64-bit Wake Env Required (V2)", 0}, - ACPI_DMT_TERMINATOR -}; - - -/******************************************************************************* - * - * FADT - Fixed ACPI Description Table (Signature is FACP) - * - ******************************************************************************/ - -/* ACPI 1.0 FADT (Version 1) */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoFadt1[] = -{ - {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Facs), "FACS Address", 0}, - {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Dsdt), "DSDT Address", DT_NON_ZERO}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Model), "Model", 0}, - {ACPI_DMT_FADTPM, ACPI_FADT_OFFSET (PreferredProfile), "PM Profile", 0}, - {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (SciInterrupt), "SCI Interrupt", 0}, - {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (SmiCommand), "SMI Command Port", 0}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (AcpiEnable), "ACPI Enable Value", 0}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (AcpiDisable), "ACPI Disable Value", 0}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (S4BiosRequest), "S4BIOS Command", 0}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (PstateControl), "P-State Control", 0}, - {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Pm1aEventBlock), "PM1A Event Block Address", 0}, - {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Pm1bEventBlock), "PM1B Event Block Address", 0}, - {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Pm1aControlBlock), "PM1A Control Block Address", 0}, - {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Pm1bControlBlock), "PM1B Control Block Address", 0}, - {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Pm2ControlBlock), "PM2 Control Block Address", 0}, - {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (PmTimerBlock), "PM Timer Block Address", 0}, - {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Gpe0Block), "GPE0 Block Address", 0}, - {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Gpe1Block), "GPE1 Block Address", 0}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Pm1EventLength), "PM1 Event Block Length", 0}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Pm1ControlLength), "PM1 Control Block Length", 0}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Pm2ControlLength), "PM2 Control Block Length", 0}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (PmTimerLength), "PM Timer Block Length", 0}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Gpe0BlockLength), "GPE0 Block Length", 0}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Gpe1BlockLength), "GPE1 Block Length", 0}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Gpe1Base), "GPE1 Base Offset", 0}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (CstControl), "_CST Support", 0}, - {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (C2Latency), "C2 Latency", 0}, - {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (C3Latency), "C3 Latency", 0}, - {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (FlushSize), "CPU Cache Size", 0}, - {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (FlushStride), "Cache Flush Stride", 0}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (DutyOffset), "Duty Cycle Offset", 0}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (DutyWidth), "Duty Cycle Width", 0}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (DayAlarm), "RTC Day Alarm Index", 0}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (MonthAlarm), "RTC Month Alarm Index", 0}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Century), "RTC Century Index", 0}, - {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (BootFlags), "Boot Flags (decoded below)", DT_FLAG}, - - /* Boot Architecture Flags byte 0 */ - - {ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (BootFlags,0), "Legacy Devices Supported (V2)", 0}, - {ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (BootFlags,0), "8042 Present on ports 60/64 (V2)", 0}, - {ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (BootFlags,0), "VGA Not Present (V4)", 0}, - {ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (BootFlags,0), "MSI Not Supported (V4)", 0}, - {ACPI_DMT_FLAG4, ACPI_FADT_FLAG_OFFSET (BootFlags,0), "PCIe ASPM Not Supported (V4)", 0}, - - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Reserved), "Reserved", 0}, - {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, - - /* Flags byte 0 */ - - {ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (Flags,0), "WBINVD instruction is operational (V1)", 0}, - {ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (Flags,0), "WBINVD flushes all caches (V1)", 0}, - {ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (Flags,0), "All CPUs support C1 (V1)", 0}, - {ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (Flags,0), "C2 works on MP system (V1)", 0}, - {ACPI_DMT_FLAG4, ACPI_FADT_FLAG_OFFSET (Flags,0), "Control Method Power Button (V1)", 0}, - {ACPI_DMT_FLAG5, ACPI_FADT_FLAG_OFFSET (Flags,0), "Control Method Sleep Button (V1)", 0}, - {ACPI_DMT_FLAG6, ACPI_FADT_FLAG_OFFSET (Flags,0), "RTC wake not in fixed reg space (V1)", 0}, - {ACPI_DMT_FLAG7, ACPI_FADT_FLAG_OFFSET (Flags,0), "RTC can wake system from S4 (V1)", 0}, - - /* Flags byte 1 */ - - {ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (Flags,1), "32-bit PM Timer (V1)", 0}, - {ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (Flags,1), "Docking Supported (V1)", 0}, - {ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (Flags,1), "Reset Register Supported (V2)", 0}, - {ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (Flags,1), "Sealed Case (V3)", 0}, - {ACPI_DMT_FLAG4, ACPI_FADT_FLAG_OFFSET (Flags,1), "Headless - No Video (V3)", 0}, - {ACPI_DMT_FLAG5, ACPI_FADT_FLAG_OFFSET (Flags,1), "Use native instr after SLP_TYPx (V3)", 0}, - {ACPI_DMT_FLAG6, ACPI_FADT_FLAG_OFFSET (Flags,1), "PCIEXP_WAK Bits Supported (V4)", 0}, - {ACPI_DMT_FLAG7, ACPI_FADT_FLAG_OFFSET (Flags,1), "Use Platform Timer (V4)", 0}, - - /* Flags byte 2 */ - - {ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (Flags,2), "RTC_STS valid on S4 wake (V4)", 0}, - {ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (Flags,2), "Remote Power-on capable (V4)", 0}, - {ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (Flags,2), "Use APIC Cluster Model (V4)", 0}, - {ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (Flags,2), "Use APIC Physical Destination Mode (V4)", 0}, - ACPI_DMT_TERMINATOR -}; - -/* ACPI 1.0 MS Extensions (FADT version 2) */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoFadt2[] = -{ - {ACPI_DMT_GAS, ACPI_FADT_OFFSET (ResetRegister), "Reset Register", 0}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (ResetValue), "Value to cause reset", 0}, - {ACPI_DMT_UINT24, ACPI_FADT_OFFSET (Reserved4[0]), "Reserved", 0}, - ACPI_DMT_TERMINATOR -}; - -/* ACPI 2.0+ Extensions (FADT version 3+) */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoFadt3[] = -{ - {ACPI_DMT_GAS, ACPI_FADT_OFFSET (ResetRegister), "Reset Register", 0}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (ResetValue), "Value to cause reset", 0}, - {ACPI_DMT_UINT24, ACPI_FADT_OFFSET (Reserved4[0]), "Reserved", 0}, - {ACPI_DMT_UINT64, ACPI_FADT_OFFSET (XFacs), "FACS Address", 0}, - {ACPI_DMT_UINT64, ACPI_FADT_OFFSET (XDsdt), "DSDT Address", 0}, - {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPm1aEventBlock), "PM1A Event Block", 0}, - {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPm1bEventBlock), "PM1B Event Block", 0}, - {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPm1aControlBlock), "PM1A Control Block", 0}, - {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPm1bControlBlock), "PM1B Control Block", 0}, - {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPm2ControlBlock), "PM2 Control Block", 0}, - {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPmTimerBlock), "PM Timer Block", 0}, - {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XGpe0Block), "GPE0 Block", 0}, - {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XGpe1Block), "GPE1 Block", 0}, - ACPI_DMT_TERMINATOR -}; - - -/* - * Remaining tables are not consumed directly by the ACPICA subsystem - */ - -/******************************************************************************* - * - * ASF - Alert Standard Format table (Signature "ASF!") - * - ******************************************************************************/ - -/* Common Subtable header (one per Subtable) */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoAsfHdr[] = -{ - {ACPI_DMT_ASF, ACPI_ASF0_OFFSET (Header.Type), "Subtable Type", 0}, - {ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (Header.Reserved), "Reserved", 0}, - {ACPI_DMT_UINT16, ACPI_ASF0_OFFSET (Header.Length), "Length", DT_LENGTH}, - ACPI_DMT_TERMINATOR -}; - -/* 0: ASF Information */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoAsf0[] = -{ - {ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (MinResetValue), "Minimum Reset Value", 0}, - {ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (MinPollInterval), "Minimum Polling Interval", 0}, - {ACPI_DMT_UINT16, ACPI_ASF0_OFFSET (SystemId), "System ID", 0}, - {ACPI_DMT_UINT32, ACPI_ASF0_OFFSET (MfgId), "Manufacturer ID", 0}, - {ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (Flags), "Flags", 0}, - {ACPI_DMT_UINT24, ACPI_ASF0_OFFSET (Reserved2[0]), "Reserved", 0}, - ACPI_DMT_TERMINATOR -}; - -/* 1: ASF Alerts */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoAsf1[] = -{ - {ACPI_DMT_UINT8, ACPI_ASF1_OFFSET (AssertMask), "AssertMask", 0}, - {ACPI_DMT_UINT8, ACPI_ASF1_OFFSET (DeassertMask), "DeassertMask", 0}, - {ACPI_DMT_UINT8, ACPI_ASF1_OFFSET (Alerts), "Alert Count", 0}, - {ACPI_DMT_UINT8, ACPI_ASF1_OFFSET (DataLength), "Alert Data Length", 0}, - ACPI_DMT_TERMINATOR -}; - -/* 1a: ASF Alert data */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoAsf1a[] = -{ - {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Address), "Address", 0}, - {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Command), "Command", 0}, - {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Mask), "Mask", 0}, - {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Value), "Value", 0}, - {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (SensorType), "SensorType", 0}, - {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Type), "Type", 0}, - {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Offset), "Offset", 0}, - {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (SourceType), "SourceType", 0}, - {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Severity), "Severity", 0}, - {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (SensorNumber), "SensorNumber", 0}, - {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Entity), "Entity", 0}, - {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Instance), "Instance", 0}, - ACPI_DMT_TERMINATOR -}; - -/* 2: ASF Remote Control */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoAsf2[] = -{ - {ACPI_DMT_UINT8, ACPI_ASF2_OFFSET (Controls), "Control Count", 0}, - {ACPI_DMT_UINT8, ACPI_ASF2_OFFSET (DataLength), "Control Data Length", 0}, - {ACPI_DMT_UINT16, ACPI_ASF2_OFFSET (Reserved2), "Reserved", 0}, - ACPI_DMT_TERMINATOR -}; - -/* 2a: ASF Control data */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoAsf2a[] = -{ - {ACPI_DMT_UINT8, ACPI_ASF2a_OFFSET (Function), "Function", 0}, - {ACPI_DMT_UINT8, ACPI_ASF2a_OFFSET (Address), "Address", 0}, - {ACPI_DMT_UINT8, ACPI_ASF2a_OFFSET (Command), "Command", 0}, - {ACPI_DMT_UINT8, ACPI_ASF2a_OFFSET (Value), "Value", 0}, - ACPI_DMT_TERMINATOR -}; - -/* 3: ASF RMCP Boot Options */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoAsf3[] = -{ - {ACPI_DMT_UINT56, ACPI_ASF3_OFFSET (Capabilities[0]), "Capabilities", 0}, - {ACPI_DMT_UINT8, ACPI_ASF3_OFFSET (CompletionCode), "Completion Code", 0}, - {ACPI_DMT_UINT32, ACPI_ASF3_OFFSET (EnterpriseId), "Enterprise ID", 0}, - {ACPI_DMT_UINT8, ACPI_ASF3_OFFSET (Command), "Command", 0}, - {ACPI_DMT_UINT16, ACPI_ASF3_OFFSET (Parameter), "Parameter", 0}, - {ACPI_DMT_UINT16, ACPI_ASF3_OFFSET (BootOptions), "Boot Options", 0}, - {ACPI_DMT_UINT16, ACPI_ASF3_OFFSET (OemParameters), "Oem Parameters", 0}, - ACPI_DMT_TERMINATOR -}; - -/* 4: ASF Address */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoAsf4[] = -{ - {ACPI_DMT_UINT8, ACPI_ASF4_OFFSET (EpromAddress), "Eprom Address", 0}, - {ACPI_DMT_UINT8, ACPI_ASF4_OFFSET (Devices), "Device Count", DT_COUNT}, - ACPI_DMT_TERMINATOR -}; - - -/******************************************************************************* - * - * BERT - Boot Error Record table - * - ******************************************************************************/ - -ACPI_DMTABLE_INFO AcpiDmTableInfoBert[] = -{ - {ACPI_DMT_UINT32, ACPI_BERT_OFFSET (RegionLength), "Boot Error Region Length", 0}, - {ACPI_DMT_UINT64, ACPI_BERT_OFFSET (Address), "Boot Error Region Address", 0}, - ACPI_DMT_TERMINATOR -}; - - -/******************************************************************************* - * - * BOOT - Simple Boot Flag Table - * - ******************************************************************************/ - -ACPI_DMTABLE_INFO AcpiDmTableInfoBoot[] = -{ - {ACPI_DMT_UINT8, ACPI_BOOT_OFFSET (CmosIndex), "Boot Register Index", 0}, - {ACPI_DMT_UINT24, ACPI_BOOT_OFFSET (Reserved[0]), "Reserved", 0}, - ACPI_DMT_TERMINATOR -}; - - -/******************************************************************************* - * - * CPEP - Corrected Platform Error Polling table - * - ******************************************************************************/ - -ACPI_DMTABLE_INFO AcpiDmTableInfoCpep[] = -{ - {ACPI_DMT_UINT64, ACPI_CPEP_OFFSET (Reserved), "Reserved", 0}, - ACPI_DMT_TERMINATOR -}; - -ACPI_DMTABLE_INFO AcpiDmTableInfoCpep0[] = -{ - {ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Header.Type), "Subtable Type", 0}, - {ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Header.Length), "Length", DT_LENGTH}, - {ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Id), "Processor ID", 0}, - {ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Eid), "Processor EID", 0}, - {ACPI_DMT_UINT32, ACPI_CPEP0_OFFSET (Interval), "Polling Interval", 0}, - ACPI_DMT_TERMINATOR -}; - - -/******************************************************************************* - * - * DBGP - Debug Port - * - ******************************************************************************/ - -ACPI_DMTABLE_INFO AcpiDmTableInfoDbgp[] = -{ - {ACPI_DMT_UINT8, ACPI_DBGP_OFFSET (Type), "Interface Type", 0}, - {ACPI_DMT_UINT24, ACPI_DBGP_OFFSET (Reserved[0]), "Reserved", 0}, - {ACPI_DMT_GAS, ACPI_DBGP_OFFSET (DebugPort), "Debug Port Register", 0}, - ACPI_DMT_TERMINATOR -}; - - -/******************************************************************************* - * - * DMAR - DMA Remapping table - * - ******************************************************************************/ - -ACPI_DMTABLE_INFO AcpiDmTableInfoDmar[] = -{ - {ACPI_DMT_UINT8, ACPI_DMAR_OFFSET (Width), "Host Address Width", 0}, - {ACPI_DMT_UINT8, ACPI_DMAR_OFFSET (Flags), "Flags", 0}, - ACPI_DMT_TERMINATOR -}; - -/* Common Subtable header (one per Subtable) */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoDmarHdr[] = -{ - {ACPI_DMT_DMAR, ACPI_DMAR0_OFFSET (Header.Type), "Subtable Type", 0}, - {ACPI_DMT_UINT16, ACPI_DMAR0_OFFSET (Header.Length), "Length", DT_LENGTH}, - ACPI_DMT_TERMINATOR -}; - -/* Common device scope entry */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoDmarScope[] = -{ - {ACPI_DMT_UINT8, ACPI_DMARS_OFFSET (EntryType), "Device Scope Entry Type", 0}, - {ACPI_DMT_UINT8, ACPI_DMARS_OFFSET (Length), "Entry Length", DT_LENGTH}, - {ACPI_DMT_UINT16, ACPI_DMARS_OFFSET (Reserved), "Reserved", 0}, - {ACPI_DMT_UINT8, ACPI_DMARS_OFFSET (EnumerationId), "Enumeration ID", 0}, - {ACPI_DMT_UINT8, ACPI_DMARS_OFFSET (Bus), "PCI Bus Number", 0}, - ACPI_DMT_TERMINATOR -}; - -/* DMAR Subtables */ - -/* 0: Hardware Unit Definition */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoDmar0[] = -{ - {ACPI_DMT_UINT8, ACPI_DMAR0_OFFSET (Flags), "Flags", 0}, - {ACPI_DMT_UINT8, ACPI_DMAR0_OFFSET (Reserved), "Reserved", 0}, - {ACPI_DMT_UINT16, ACPI_DMAR0_OFFSET (Segment), "PCI Segment Number", 0}, - {ACPI_DMT_UINT64, ACPI_DMAR0_OFFSET (Address), "Register Base Address", 0}, - ACPI_DMT_TERMINATOR -}; - -/* 1: Reserved Memory Definition */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoDmar1[] = -{ - {ACPI_DMT_UINT16, ACPI_DMAR1_OFFSET (Reserved), "Reserved", 0}, - {ACPI_DMT_UINT16, ACPI_DMAR1_OFFSET (Segment), "PCI Segment Number", 0}, - {ACPI_DMT_UINT64, ACPI_DMAR1_OFFSET (BaseAddress), "Base Address", 0}, - {ACPI_DMT_UINT64, ACPI_DMAR1_OFFSET (EndAddress), "End Address (limit)", 0}, - ACPI_DMT_TERMINATOR -}; - -/* 2: Root Port ATS Capability Definition */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoDmar2[] = -{ - {ACPI_DMT_UINT8, ACPI_DMAR2_OFFSET (Flags), "Flags", 0}, - {ACPI_DMT_UINT8, ACPI_DMAR2_OFFSET (Reserved), "Reserved", 0}, - {ACPI_DMT_UINT16, ACPI_DMAR2_OFFSET (Segment), "PCI Segment Number", 0}, - ACPI_DMT_TERMINATOR -}; - -/* 3: Remapping Hardware Static Affinity Structure */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoDmar3[] = -{ - {ACPI_DMT_UINT32, ACPI_DMAR3_OFFSET (Reserved), "Reserved", 0}, - {ACPI_DMT_UINT64, ACPI_DMAR3_OFFSET (BaseAddress), "Base Address", 0}, - {ACPI_DMT_UINT32, ACPI_DMAR3_OFFSET (ProximityDomain), "Proximity Domain", 0}, - ACPI_DMT_TERMINATOR -}; - - -/******************************************************************************* - * - * ECDT - Embedded Controller Boot Resources Table - * - ******************************************************************************/ - -ACPI_DMTABLE_INFO AcpiDmTableInfoEcdt[] = -{ - {ACPI_DMT_GAS, ACPI_ECDT_OFFSET (Control), "Command/Status Register", 0}, - {ACPI_DMT_GAS, ACPI_ECDT_OFFSET (Data), "Data Register", 0}, - {ACPI_DMT_UINT32, ACPI_ECDT_OFFSET (Uid), "UID", 0}, - {ACPI_DMT_UINT8, ACPI_ECDT_OFFSET (Gpe), "GPE Number", 0}, - {ACPI_DMT_STRING, ACPI_ECDT_OFFSET (Id[0]), "Namepath", 0}, - ACPI_DMT_TERMINATOR -}; - - -/******************************************************************************* - * - * EINJ - Error Injection table - * - ******************************************************************************/ - -ACPI_DMTABLE_INFO AcpiDmTableInfoEinj[] = -{ - {ACPI_DMT_UINT32, ACPI_EINJ_OFFSET (HeaderLength), "Injection Header Length", DT_LENGTH}, - {ACPI_DMT_UINT8, ACPI_EINJ_OFFSET (Flags), "Flags", 0}, - {ACPI_DMT_UINT24, ACPI_EINJ_OFFSET (Reserved[0]), "Reserved", 0}, - {ACPI_DMT_UINT32, ACPI_EINJ_OFFSET (Entries), "Injection Entry Count", 0}, - ACPI_DMT_TERMINATOR -}; - -ACPI_DMTABLE_INFO AcpiDmTableInfoEinj0[] = -{ - {ACPI_DMT_UINT8, ACPI_EINJ0_OFFSET (Action), "Action", 0}, - {ACPI_DMT_UINT8, ACPI_EINJ0_OFFSET (Instruction), "Instruction", 0}, - {ACPI_DMT_UINT8, ACPI_EINJ0_OFFSET (Flags), "Flags", 0}, - {ACPI_DMT_UINT8, ACPI_EINJ0_OFFSET (Reserved), "Reserved", 0}, - {ACPI_DMT_GAS, ACPI_EINJ0_OFFSET (RegisterRegion), "Register Region", 0}, - {ACPI_DMT_UINT64, ACPI_EINJ0_OFFSET (Value), "Value", 0}, - {ACPI_DMT_UINT64, ACPI_EINJ0_OFFSET (Mask), "Mask", 0}, - ACPI_DMT_TERMINATOR -}; - - -/******************************************************************************* - * - * ERST - Error Record Serialization table - * - ******************************************************************************/ - -ACPI_DMTABLE_INFO AcpiDmTableInfoErst[] = -{ - {ACPI_DMT_UINT32, ACPI_ERST_OFFSET (HeaderLength), "Serialization Header Length", DT_LENGTH}, - {ACPI_DMT_UINT32, ACPI_ERST_OFFSET (Reserved), "Reserved", 0}, - {ACPI_DMT_UINT32, ACPI_ERST_OFFSET (Entries), "Instruction Entry Count", 0}, - ACPI_DMT_TERMINATOR -}; - - -/******************************************************************************* - * - * HEST - Hardware Error Source table - * - ******************************************************************************/ - -ACPI_DMTABLE_INFO AcpiDmTableInfoHest[] = -{ - {ACPI_DMT_UINT32, ACPI_HEST_OFFSET (ErrorSourceCount), "Error Source Count", 0}, - ACPI_DMT_TERMINATOR -}; - -/* Common HEST structures for subtables */ - -#define ACPI_DM_HEST_HEADER \ - {ACPI_DMT_HEST, ACPI_HEST0_OFFSET (Header.Type), "Subtable Type", 0}, \ - {ACPI_DMT_UINT16, ACPI_HEST0_OFFSET (Header.SourceId), "Source Id", 0} - -#define ACPI_DM_HEST_AER \ - {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Reserved1), "Reserved", 0}, \ - {ACPI_DMT_UINT8, ACPI_HEST6_OFFSET (Aer.Flags), "Flags", 0}, \ - {ACPI_DMT_UINT8, ACPI_HEST6_OFFSET (Aer.Enabled), "Enabled", 0}, \ - {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.RecordsToPreallocate), "Records To Preallocate", 0}, \ - {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.MaxSectionsPerRecord), "Max Sections Per Record", 0}, \ - {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.Bus), "Bus", 0}, \ - {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Device), "Device", 0}, \ - {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Function), "Function", 0}, \ - {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.DeviceControl), "DeviceControl", 0}, \ - {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Reserved2), "Reserved", 0}, \ - {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.UncorrectableMask), "Uncorrectable Mask", 0}, \ - {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.UncorrectableSeverity), "Uncorrectable Severity", 0}, \ - {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.CorrectableMask), "Correctable Mask", 0}, \ - {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.AdvancedCapabilities), "Advanced Capabilities", 0} - - -/* HEST Subtables */ - -/* 0: IA32 Machine Check Exception */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoHest0[] = -{ - ACPI_DM_HEST_HEADER, - {ACPI_DMT_UINT16, ACPI_HEST0_OFFSET (Reserved1), "Reserved", 0}, - {ACPI_DMT_UINT8, ACPI_HEST0_OFFSET (Flags), "Flags", 0}, - {ACPI_DMT_UINT8, ACPI_HEST0_OFFSET (Enabled), "Enabled", 0}, - {ACPI_DMT_UINT32, ACPI_HEST0_OFFSET (RecordsToPreallocate), "Records To Preallocate", 0}, - {ACPI_DMT_UINT32, ACPI_HEST0_OFFSET (MaxSectionsPerRecord), "Max Sections Per Record", 0}, - {ACPI_DMT_UINT64, ACPI_HEST0_OFFSET (GlobalCapabilityData), "Global Capability Data", 0}, - {ACPI_DMT_UINT64, ACPI_HEST0_OFFSET (GlobalControlData), "Global Control Data", 0}, - {ACPI_DMT_UINT8, ACPI_HEST0_OFFSET (NumHardwareBanks), "Num Hardware Banks", 0}, - {ACPI_DMT_UINT56, ACPI_HEST0_OFFSET (Reserved3[0]), "Reserved", 0}, - ACPI_DMT_TERMINATOR -}; - -/* 1: IA32 Corrected Machine Check */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoHest1[] = -{ - ACPI_DM_HEST_HEADER, - {ACPI_DMT_UINT16, ACPI_HEST1_OFFSET (Reserved1), "Reserved", 0}, - {ACPI_DMT_UINT8, ACPI_HEST1_OFFSET (Flags), "Flags", 0}, - {ACPI_DMT_UINT8, ACPI_HEST1_OFFSET (Enabled), "Enabled", 0}, - {ACPI_DMT_UINT32, ACPI_HEST1_OFFSET (RecordsToPreallocate), "Records To Preallocate", 0}, - {ACPI_DMT_UINT32, ACPI_HEST1_OFFSET (MaxSectionsPerRecord), "Max Sections Per Record", 0}, - {ACPI_DMT_HESTNTFY, ACPI_HEST1_OFFSET (Notify), "Notify", 0}, - {ACPI_DMT_UINT8, ACPI_HEST1_OFFSET (NumHardwareBanks), "Num Hardware Banks", 0}, - {ACPI_DMT_UINT24, ACPI_HEST1_OFFSET (Reserved2[0]), "Reserved", 0}, - ACPI_DMT_TERMINATOR -}; - -/* 2: IA32 Non-Maskable Interrupt */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoHest2[] = -{ - ACPI_DM_HEST_HEADER, - {ACPI_DMT_UINT32, ACPI_HEST2_OFFSET (Reserved), "Reserved", 0}, - {ACPI_DMT_UINT32, ACPI_HEST2_OFFSET (RecordsToPreallocate), "Records To Preallocate", 0}, - {ACPI_DMT_UINT32, ACPI_HEST2_OFFSET (MaxSectionsPerRecord), "Max Sections Per Record", 0}, - {ACPI_DMT_UINT32, ACPI_HEST2_OFFSET (MaxRawDataLength), "Max Raw Data Length", 0}, - ACPI_DMT_TERMINATOR -}; - - -/* 6: PCI Express Root Port AER */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoHest6[] = -{ - ACPI_DM_HEST_HEADER, - ACPI_DM_HEST_AER, - {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (RootErrorCommand), "Root Error Command", 0}, - ACPI_DMT_TERMINATOR -}; - -/* 7: PCI Express AER (AER Endpoint) */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoHest7[] = -{ - ACPI_DM_HEST_HEADER, - ACPI_DM_HEST_AER, - ACPI_DMT_TERMINATOR -}; - -/* 8: PCI Express/PCI-X Bridge AER */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoHest8[] = -{ - ACPI_DM_HEST_HEADER, - ACPI_DM_HEST_AER, - {ACPI_DMT_UINT32, ACPI_HEST8_OFFSET (UncorrectableMask2), "2nd Uncorrectable Mask", 0}, - {ACPI_DMT_UINT32, ACPI_HEST8_OFFSET (UncorrectableSeverity2), "2nd Uncorrectable Severity", 0}, - {ACPI_DMT_UINT32, ACPI_HEST8_OFFSET (AdvancedCapabilities2), "2nd Advanced Capabilities", 0}, - ACPI_DMT_TERMINATOR -}; - -/* 9: Generic Hardware Error Source */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoHest9[] = -{ - ACPI_DM_HEST_HEADER, - {ACPI_DMT_UINT16, ACPI_HEST9_OFFSET (RelatedSourceId), "Related Source Id", 0}, - {ACPI_DMT_UINT8, ACPI_HEST9_OFFSET (Reserved), "Reserved", 0}, - {ACPI_DMT_UINT8, ACPI_HEST9_OFFSET (Enabled), "Enabled", 0}, - {ACPI_DMT_UINT32, ACPI_HEST9_OFFSET (RecordsToPreallocate), "Records To Preallocate", 0}, - {ACPI_DMT_UINT32, ACPI_HEST9_OFFSET (MaxSectionsPerRecord), "Max Sections Per Record", 0}, - {ACPI_DMT_UINT32, ACPI_HEST9_OFFSET (MaxRawDataLength), "Max Raw Data Length", 0}, - {ACPI_DMT_GAS, ACPI_HEST9_OFFSET (ErrorStatusAddress), "Error Status Address", 0}, - {ACPI_DMT_HESTNTFY, ACPI_HEST9_OFFSET (Notify), "Notify", 0}, - {ACPI_DMT_UINT32, ACPI_HEST9_OFFSET (ErrorBlockLength), "Error Status Block Length", 0}, - ACPI_DMT_TERMINATOR -}; - -ACPI_DMTABLE_INFO AcpiDmTableInfoHestNotify[] = -{ - {ACPI_DMT_HESTNTYP, ACPI_HESTN_OFFSET (Type), "Notify Type", 0}, - {ACPI_DMT_UINT8, ACPI_HESTN_OFFSET (Length), "Notify Length", DT_LENGTH}, - {ACPI_DMT_UINT16, ACPI_HESTN_OFFSET (ConfigWriteEnable), "Configuration Write Enable", 0}, - {ACPI_DMT_UINT32, ACPI_HESTN_OFFSET (PollInterval), "PollInterval", 0}, - {ACPI_DMT_UINT32, ACPI_HESTN_OFFSET (Vector), "Vector", 0}, - {ACPI_DMT_UINT32, ACPI_HESTN_OFFSET (PollingThresholdValue), "Polling Threshold Value", 0}, - {ACPI_DMT_UINT32, ACPI_HESTN_OFFSET (PollingThresholdWindow), "Polling Threshold Window", 0}, - {ACPI_DMT_UINT32, ACPI_HESTN_OFFSET (ErrorThresholdValue), "Error Threshold Value", 0}, - {ACPI_DMT_UINT32, ACPI_HESTN_OFFSET (ErrorThresholdWindow), "Error Threshold Window", 0}, - ACPI_DMT_TERMINATOR -}; - - -/* - * IA32 Error Bank(s) - Follows the ACPI_HEST_IA_MACHINE_CHECK and - * ACPI_HEST_IA_CORRECTED structures. - */ -ACPI_DMTABLE_INFO AcpiDmTableInfoHestBank[] = -{ - {ACPI_DMT_UINT8, ACPI_HESTB_OFFSET (BankNumber), "Bank Number", 0}, - {ACPI_DMT_UINT8, ACPI_HESTB_OFFSET (ClearStatusOnInit), "Clear Status On Init", 0}, - {ACPI_DMT_UINT8, ACPI_HESTB_OFFSET (StatusFormat), "Status Format", 0}, - {ACPI_DMT_UINT8, ACPI_HESTB_OFFSET (Reserved), "Reserved", 0}, - {ACPI_DMT_UINT32, ACPI_HESTB_OFFSET (ControlRegister), "Control Register", 0}, - {ACPI_DMT_UINT64, ACPI_HESTB_OFFSET (ControlData), "Control Data", 0}, - {ACPI_DMT_UINT32, ACPI_HESTB_OFFSET (StatusRegister), "Status Register", 0}, - {ACPI_DMT_UINT32, ACPI_HESTB_OFFSET (AddressRegister), "Address Register", 0}, - {ACPI_DMT_UINT32, ACPI_HESTB_OFFSET (MiscRegister), "Misc Register", 0}, - ACPI_DMT_TERMINATOR -}; - - -/******************************************************************************* - * - * HPET - High Precision Event Timer table - * - ******************************************************************************/ - -ACPI_DMTABLE_INFO AcpiDmTableInfoHpet[] = -{ - {ACPI_DMT_UINT32, ACPI_HPET_OFFSET (Id), "Hardware Block ID", 0}, - {ACPI_DMT_GAS, ACPI_HPET_OFFSET (Address), "Timer Block Register", 0}, - {ACPI_DMT_UINT8, ACPI_HPET_OFFSET (Sequence), "Sequence Number", 0}, - {ACPI_DMT_UINT16, ACPI_HPET_OFFSET (MinimumTick), "Minimum Clock Ticks", 0}, - {ACPI_DMT_UINT8, ACPI_HPET_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, - {ACPI_DMT_FLAG0, ACPI_HPET_FLAG_OFFSET (Flags,0), "4K Page Protect", 0}, - {ACPI_DMT_FLAG1, ACPI_HPET_FLAG_OFFSET (Flags,0), "64K Page Protect", 0}, - ACPI_DMT_TERMINATOR -}; - - -/******************************************************************************* - * - * IVRS - I/O Virtualization Reporting Structure - * - ******************************************************************************/ - -ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs[] = -{ - {ACPI_DMT_UINT32, ACPI_IVRS_OFFSET (Info), "Virtualization Info", 0}, - {ACPI_DMT_UINT64, ACPI_IVRS_OFFSET (Reserved), "Reserved", 0}, - ACPI_DMT_TERMINATOR -}; - -/* Common Subtable header (one per Subtable) */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoIvrsHdr[] = -{ - {ACPI_DMT_IVRS, ACPI_IVRSH_OFFSET (Type), "Subtable Type", 0}, - {ACPI_DMT_UINT8, ACPI_IVRSH_OFFSET (Flags), "Flags", 0}, - {ACPI_DMT_UINT16, ACPI_IVRSH_OFFSET (Length), "Length", DT_LENGTH}, - {ACPI_DMT_UINT16, ACPI_IVRSH_OFFSET (DeviceId), "DeviceId", 0}, - ACPI_DMT_TERMINATOR -}; - -/* IVRS subtables */ - -/* 0x10: I/O Virtualization Hardware Definition (IVHD) Block */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs0[] = -{ - {ACPI_DMT_UINT16, ACPI_IVRS0_OFFSET (CapabilityOffset), "Capability Offset", 0}, - {ACPI_DMT_UINT64, ACPI_IVRS0_OFFSET (BaseAddress), "Base Address", 0}, - {ACPI_DMT_UINT16, ACPI_IVRS0_OFFSET (PciSegmentGroup), "PCI Segment Group", 0}, - {ACPI_DMT_UINT16, ACPI_IVRS0_OFFSET (Info), "Virtualization Info", 0}, - {ACPI_DMT_UINT32, ACPI_IVRS0_OFFSET (Reserved), "Reserved", 0}, - ACPI_DMT_TERMINATOR -}; - -/* 0x20, 0x21, 0x22: I/O Virtualization Memory Definition (IVMD) Block */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs1[] = -{ - {ACPI_DMT_UINT16, ACPI_IVRS1_OFFSET (AuxData), "Auxiliary Data", 0}, - {ACPI_DMT_UINT64, ACPI_IVRS1_OFFSET (Reserved), "Reserved", 0}, - {ACPI_DMT_UINT64, ACPI_IVRS1_OFFSET (StartAddress), "Start Address", 0}, - {ACPI_DMT_UINT64, ACPI_IVRS1_OFFSET (MemoryLength), "Memory Length", 0}, - ACPI_DMT_TERMINATOR -}; - -/* Device entry header for IVHD block */ - -#define ACPI_DMT_IVRS_DE_HEADER \ - {ACPI_DMT_UINT8, ACPI_IVRSD_OFFSET (Type), "Entry Type", 0}, \ - {ACPI_DMT_UINT16, ACPI_IVRSD_OFFSET (Id), "Device ID", 0}, \ - {ACPI_DMT_UINT8, ACPI_IVRSD_OFFSET (DataSetting), "Data Setting", 0} - -/* 4-byte device entry */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs4[] = -{ - ACPI_DMT_IVRS_DE_HEADER, - {ACPI_DMT_EXIT, 0, NULL, 0}, -}; - -/* 8-byte device entry */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs8a[] = -{ - ACPI_DMT_IVRS_DE_HEADER, - {ACPI_DMT_UINT8, ACPI_IVRS8A_OFFSET (Reserved1), "Reserved", 0}, - {ACPI_DMT_UINT16, ACPI_IVRS8A_OFFSET (UsedId), "Source Used Device ID", 0}, - {ACPI_DMT_UINT8, ACPI_IVRS8A_OFFSET (Reserved2), "Reserved", 0}, - ACPI_DMT_TERMINATOR -}; - -/* 8-byte device entry */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs8b[] = -{ - ACPI_DMT_IVRS_DE_HEADER, - {ACPI_DMT_UINT32, ACPI_IVRS8B_OFFSET (ExtendedData), "Extended Data", 0}, - ACPI_DMT_TERMINATOR -}; - -/* 8-byte device entry */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs8c[] = -{ - ACPI_DMT_IVRS_DE_HEADER, - {ACPI_DMT_UINT8, ACPI_IVRS8C_OFFSET (Handle), "Handle", 0}, - {ACPI_DMT_UINT16, ACPI_IVRS8C_OFFSET (UsedId), "Source Used Device ID", 0}, - {ACPI_DMT_UINT8, ACPI_IVRS8C_OFFSET (Variety), "Variety", 0}, - ACPI_DMT_TERMINATOR -}; - - -/******************************************************************************* - * - * MADT - Multiple APIC Description Table and subtables - * - ******************************************************************************/ - -ACPI_DMTABLE_INFO AcpiDmTableInfoMadt[] = -{ - {ACPI_DMT_UINT32, ACPI_MADT_OFFSET (Address), "Local Apic Address", 0}, - {ACPI_DMT_UINT32, ACPI_MADT_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, - {ACPI_DMT_FLAG0, ACPI_MADT_FLAG_OFFSET (Flags,0), "PC-AT Compatibility", 0}, - ACPI_DMT_TERMINATOR -}; - -/* Common Subtable header (one per Subtable) */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoMadtHdr[] = -{ - {ACPI_DMT_MADT, ACPI_MADTH_OFFSET (Type), "Subtable Type", 0}, - {ACPI_DMT_UINT8, ACPI_MADTH_OFFSET (Length), "Length", DT_LENGTH}, - ACPI_DMT_TERMINATOR -}; - -/* MADT Subtables */ - -/* 0: processor APIC */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoMadt0[] = -{ - {ACPI_DMT_UINT8, ACPI_MADT0_OFFSET (ProcessorId), "Processor ID", 0}, - {ACPI_DMT_UINT8, ACPI_MADT0_OFFSET (Id), "Local Apic ID", 0}, - {ACPI_DMT_UINT32, ACPI_MADT0_OFFSET (LapicFlags), "Flags (decoded below)", DT_FLAG}, - {ACPI_DMT_FLAG0, ACPI_MADT0_FLAG_OFFSET (LapicFlags,0), "Processor Enabled", 0}, - ACPI_DMT_TERMINATOR -}; - -/* 1: IO APIC */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoMadt1[] = -{ - {ACPI_DMT_UINT8, ACPI_MADT1_OFFSET (Id), "I/O Apic ID", 0}, - {ACPI_DMT_UINT8, ACPI_MADT1_OFFSET (Reserved), "Reserved", 0}, - {ACPI_DMT_UINT32, ACPI_MADT1_OFFSET (Address), "Address", 0}, - {ACPI_DMT_UINT32, ACPI_MADT1_OFFSET (GlobalIrqBase), "Interrupt", 0}, - ACPI_DMT_TERMINATOR -}; - -/* 2: Interrupt Override */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoMadt2[] = -{ - {ACPI_DMT_UINT8, ACPI_MADT2_OFFSET (Bus), "Bus", 0}, - {ACPI_DMT_UINT8, ACPI_MADT2_OFFSET (SourceIrq), "Source", 0}, - {ACPI_DMT_UINT32, ACPI_MADT2_OFFSET (GlobalIrq), "Interrupt", 0}, - {ACPI_DMT_UINT16, ACPI_MADT2_OFFSET (IntiFlags), "Flags (decoded below)", DT_FLAG}, - {ACPI_DMT_FLAGS0, ACPI_MADT2_FLAG_OFFSET (IntiFlags,0), "Polarity", 0}, - {ACPI_DMT_FLAGS2, ACPI_MADT2_FLAG_OFFSET (IntiFlags,0), "Trigger Mode", 0}, - ACPI_DMT_TERMINATOR -}; - -/* 3: NMI Sources */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoMadt3[] = -{ - {ACPI_DMT_UINT16, ACPI_MADT3_OFFSET (IntiFlags), "Flags (decoded below)", DT_FLAG}, - {ACPI_DMT_FLAGS0, ACPI_MADT3_FLAG_OFFSET (IntiFlags,0), "Polarity", 0}, - {ACPI_DMT_FLAGS2, ACPI_MADT3_FLAG_OFFSET (IntiFlags,0), "Trigger Mode", 0}, - {ACPI_DMT_UINT32, ACPI_MADT3_OFFSET (GlobalIrq), "Interrupt", 0}, - ACPI_DMT_TERMINATOR -}; - -/* 4: Local APIC NMI */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoMadt4[] = -{ - {ACPI_DMT_UINT8, ACPI_MADT4_OFFSET (ProcessorId), "Processor ID", 0}, - {ACPI_DMT_UINT16, ACPI_MADT4_OFFSET (IntiFlags), "Flags (decoded below)", DT_FLAG}, - {ACPI_DMT_FLAGS0, ACPI_MADT4_FLAG_OFFSET (IntiFlags,0), "Polarity", 0}, - {ACPI_DMT_FLAGS2, ACPI_MADT4_FLAG_OFFSET (IntiFlags,0), "Trigger Mode", 0}, - {ACPI_DMT_UINT8, ACPI_MADT4_OFFSET (Lint), "Interrupt Input LINT", 0}, - ACPI_DMT_TERMINATOR -}; - -/* 5: Address Override */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoMadt5[] = -{ - {ACPI_DMT_UINT16, ACPI_MADT5_OFFSET (Reserved), "Reserved", 0}, - {ACPI_DMT_UINT64, ACPI_MADT5_OFFSET (Address), "APIC Address", 0}, - ACPI_DMT_TERMINATOR -}; - -/* 6: I/O Sapic */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoMadt6[] = -{ - {ACPI_DMT_UINT8, ACPI_MADT6_OFFSET (Id), "I/O Sapic ID", 0}, - {ACPI_DMT_UINT8, ACPI_MADT6_OFFSET (Reserved), "Reserved", 0}, - {ACPI_DMT_UINT32, ACPI_MADT6_OFFSET (GlobalIrqBase), "Interrupt Base", 0}, - {ACPI_DMT_UINT64, ACPI_MADT6_OFFSET (Address), "Address", 0}, - ACPI_DMT_TERMINATOR -}; - -/* 7: Local Sapic */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoMadt7[] = -{ - {ACPI_DMT_UINT8, ACPI_MADT7_OFFSET (ProcessorId), "Processor ID", 0}, - {ACPI_DMT_UINT8, ACPI_MADT7_OFFSET (Id), "Local Sapic ID", 0}, - {ACPI_DMT_UINT8, ACPI_MADT7_OFFSET (Eid), "Local Sapic EID", 0}, - {ACPI_DMT_UINT24, ACPI_MADT7_OFFSET (Reserved[0]), "Reserved", 0}, - {ACPI_DMT_UINT32, ACPI_MADT7_OFFSET (LapicFlags), "Flags (decoded below)", DT_FLAG}, - {ACPI_DMT_FLAG0, ACPI_MADT7_FLAG_OFFSET (LapicFlags,0), "Processor Enabled", 0}, - {ACPI_DMT_UINT32, ACPI_MADT7_OFFSET (Uid), "Processor UID", 0}, - {ACPI_DMT_STRING, ACPI_MADT7_OFFSET (UidString[0]), "Processor UID String", 0}, - ACPI_DMT_TERMINATOR -}; - -/* 8: Platform Interrupt Source */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoMadt8[] = -{ - {ACPI_DMT_UINT16, ACPI_MADT8_OFFSET (IntiFlags), "Flags (decoded below)", DT_FLAG}, - {ACPI_DMT_FLAGS0, ACPI_MADT8_FLAG_OFFSET (IntiFlags,0), "Polarity", 0}, - {ACPI_DMT_FLAGS2, ACPI_MADT8_FLAG_OFFSET (IntiFlags,0), "Trigger Mode", 0}, - {ACPI_DMT_UINT8, ACPI_MADT8_OFFSET (Type), "InterruptType", 0}, - {ACPI_DMT_UINT8, ACPI_MADT8_OFFSET (Id), "Processor ID", 0}, - {ACPI_DMT_UINT8, ACPI_MADT8_OFFSET (Eid), "Processor EID", 0}, - {ACPI_DMT_UINT8, ACPI_MADT8_OFFSET (IoSapicVector), "I/O Sapic Vector", 0}, - {ACPI_DMT_UINT32, ACPI_MADT8_OFFSET (GlobalIrq), "Interrupt", 0}, - {ACPI_DMT_UINT32, ACPI_MADT8_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, - {ACPI_DMT_FLAG0, ACPI_MADT8_OFFSET (Flags), "CPEI Override", 0}, - ACPI_DMT_TERMINATOR -}; - -/* 9: Processor Local X2_APIC (ACPI 4.0) */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoMadt9[] = -{ - {ACPI_DMT_UINT16, ACPI_MADT9_OFFSET (Reserved), "Reserved", 0}, - {ACPI_DMT_UINT32, ACPI_MADT9_OFFSET (LocalApicId), "Processor x2Apic ID", 0}, - {ACPI_DMT_UINT32, ACPI_MADT9_OFFSET (LapicFlags), "Flags (decoded below)", DT_FLAG}, - {ACPI_DMT_FLAG0, ACPI_MADT9_FLAG_OFFSET (LapicFlags,0), "Processor Enabled", 0}, - {ACPI_DMT_UINT32, ACPI_MADT9_OFFSET (Uid), "Processor UID", 0}, - ACPI_DMT_TERMINATOR -}; - -/* 10: Local X2_APIC NMI (ACPI 4.0) */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoMadt10[] = -{ - {ACPI_DMT_UINT16, ACPI_MADT10_OFFSET (IntiFlags), "Flags (decoded below)", DT_FLAG}, - {ACPI_DMT_FLAGS0, ACPI_MADT10_FLAG_OFFSET (IntiFlags,0), "Polarity", 0}, - {ACPI_DMT_FLAGS2, ACPI_MADT10_FLAG_OFFSET (IntiFlags,0), "Trigger Mode", 0}, - {ACPI_DMT_UINT32, ACPI_MADT10_OFFSET (Uid), "Processor UID", 0}, - {ACPI_DMT_UINT8, ACPI_MADT10_OFFSET (Lint), "Interrupt Input LINT", 0}, - {ACPI_DMT_UINT24, ACPI_MADT10_OFFSET (Reserved[0]), "Reserved", 0}, - ACPI_DMT_TERMINATOR -}; - - -/******************************************************************************* - * - * MCFG - PCI Memory Mapped Configuration table and Subtable - * - ******************************************************************************/ - -ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg[] = -{ - {ACPI_DMT_UINT64, ACPI_MCFG_OFFSET (Reserved[0]), "Reserved", 0}, - ACPI_DMT_TERMINATOR -}; - -ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg0[] = -{ - {ACPI_DMT_UINT64, ACPI_MCFG0_OFFSET (Address), "Base Address", 0}, - {ACPI_DMT_UINT16, ACPI_MCFG0_OFFSET (PciSegment), "Segment Group Number", 0}, - {ACPI_DMT_UINT8, ACPI_MCFG0_OFFSET (StartBusNumber), "Start Bus Number", 0}, - {ACPI_DMT_UINT8, ACPI_MCFG0_OFFSET (EndBusNumber), "End Bus Number", 0}, - {ACPI_DMT_UINT32, ACPI_MCFG0_OFFSET (Reserved), "Reserved", 0}, - ACPI_DMT_TERMINATOR -}; - - -/******************************************************************************* - * - * MCHI - Management Controller Host Interface table - * - ******************************************************************************/ - -ACPI_DMTABLE_INFO AcpiDmTableInfoMchi[] = -{ - {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (InterfaceType), "Interface Type", 0}, - {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (Protocol), "Protocol", 0}, - {ACPI_DMT_UINT64, ACPI_MCHI_OFFSET (ProtocolData), "Protocol Data", 0}, - {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (InterruptType), "Interrupt Type", 0}, - {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (Gpe), "Gpe", 0}, - {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (PciDeviceFlag), "Pci Device Flag", 0}, - {ACPI_DMT_UINT32, ACPI_MCHI_OFFSET (GlobalInterrupt), "Global Interrupt", 0}, - {ACPI_DMT_GAS, ACPI_MCHI_OFFSET (ControlRegister), "Control Register", 0}, - {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (PciSegment), "Pci Segment", 0}, - {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (PciBus), "Pci Bus", 0}, - {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (PciDevice), "Pci Device", 0}, - {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (PciFunction), "Pci Function", 0}, - ACPI_DMT_TERMINATOR -}; - - -/******************************************************************************* - * - * MSCT - Maximum System Characteristics Table (ACPI 4.0) - * - ******************************************************************************/ - -ACPI_DMTABLE_INFO AcpiDmTableInfoMsct[] = -{ - {ACPI_DMT_UINT32, ACPI_MSCT_OFFSET (ProximityOffset), "Proximity Offset", 0}, - {ACPI_DMT_UINT32, ACPI_MSCT_OFFSET (MaxProximityDomains), "Max Proximity Domains", 0}, - {ACPI_DMT_UINT32, ACPI_MSCT_OFFSET (MaxClockDomains), "Max Clock Domains", 0}, - {ACPI_DMT_UINT64, ACPI_MSCT_OFFSET (MaxAddress), "Max Physical Address", 0}, - ACPI_DMT_TERMINATOR -}; - -/* Subtable - Maximum Proximity Domain Information. Version 1 */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoMsct0[] = -{ - {ACPI_DMT_UINT8, ACPI_MSCT0_OFFSET (Revision), "Revision", 0}, - {ACPI_DMT_UINT8, ACPI_MSCT0_OFFSET (Length), "Length", DT_LENGTH}, - {ACPI_DMT_UINT32, ACPI_MSCT0_OFFSET (RangeStart), "Domain Range Start", 0}, - {ACPI_DMT_UINT32, ACPI_MSCT0_OFFSET (RangeEnd), "Domain Range End", 0}, - {ACPI_DMT_UINT32, ACPI_MSCT0_OFFSET (ProcessorCapacity), "Processor Capacity", 0}, - {ACPI_DMT_UINT64, ACPI_MSCT0_OFFSET (MemoryCapacity), "Memory Capacity", 0}, - ACPI_DMT_TERMINATOR -}; - - -/******************************************************************************* - * - * SBST - Smart Battery Specification Table - * - ******************************************************************************/ - -ACPI_DMTABLE_INFO AcpiDmTableInfoSbst[] = -{ - {ACPI_DMT_UINT32, ACPI_SBST_OFFSET (WarningLevel), "Warning Level", 0}, - {ACPI_DMT_UINT32, ACPI_SBST_OFFSET (LowLevel), "Low Level", 0}, - {ACPI_DMT_UINT32, ACPI_SBST_OFFSET (CriticalLevel), "Critical Level", 0}, - ACPI_DMT_TERMINATOR -}; - - -/******************************************************************************* - * - * SLIC - Software Licensing Description Table. NOT FULLY IMPLEMENTED, do not - * have the table definition. - * - ******************************************************************************/ - -ACPI_DMTABLE_INFO AcpiDmTableInfoSlic[] = -{ - ACPI_DMT_TERMINATOR -}; - - -/******************************************************************************* - * - * SLIT - System Locality Information Table - * - ******************************************************************************/ - -ACPI_DMTABLE_INFO AcpiDmTableInfoSlit[] = -{ - {ACPI_DMT_UINT64, ACPI_SLIT_OFFSET (LocalityCount), "Localities", 0}, - ACPI_DMT_TERMINATOR -}; - - -/******************************************************************************* - * - * SPCR - Serial Port Console Redirection table - * - ******************************************************************************/ - -ACPI_DMTABLE_INFO AcpiDmTableInfoSpcr[] = -{ - {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (InterfaceType), "Interface Type", 0}, - {ACPI_DMT_UINT24, ACPI_SPCR_OFFSET (Reserved[0]), "Reserved", 0}, - {ACPI_DMT_GAS, ACPI_SPCR_OFFSET (SerialPort), "Serial Port Register", 0}, - {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (InterruptType), "Interrupt Type", 0}, - {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (PcInterrupt), "PCAT-compatible IRQ", 0}, - {ACPI_DMT_UINT32, ACPI_SPCR_OFFSET (Interrupt), "Interrupt", 0}, - {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (BaudRate), "Baud Rate", 0}, - {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (Parity), "Parity", 0}, - {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (StopBits), "Stop Bits", 0}, - {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (FlowControl), "Flow Control", 0}, - {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (TerminalType), "Terminal Type", 0}, - {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (Reserved2), "Reserved", 0}, - {ACPI_DMT_UINT16, ACPI_SPCR_OFFSET (PciDeviceId), "PCI Device ID", 0}, - {ACPI_DMT_UINT16, ACPI_SPCR_OFFSET (PciVendorId), "PCI Vendor ID", 0}, - {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (PciBus), "PCI Bus", 0}, - {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (PciDevice), "PCI Device", 0}, - {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (PciFunction), "PCI Function", 0}, - {ACPI_DMT_UINT32, ACPI_SPCR_OFFSET (PciFlags), "PCI Flags", 0}, - {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (PciSegment), "PCI Segment", 0}, - {ACPI_DMT_UINT32, ACPI_SPCR_OFFSET (Reserved2), "Reserved", 0}, - ACPI_DMT_TERMINATOR -}; - - -/******************************************************************************* - * - * SPMI - Server Platform Management Interface table - * - ******************************************************************************/ - -ACPI_DMTABLE_INFO AcpiDmTableInfoSpmi[] = -{ - {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (InterfaceType), "Interface Type", 0}, - {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (Reserved), "Reserved", 0}, - {ACPI_DMT_UINT16, ACPI_SPMI_OFFSET (SpecRevision), "IPMI Spec Version", 0}, - {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (InterruptType), "Interrupt Type", 0}, - {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (GpeNumber), "GPE Number", 0}, - {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (Reserved1), "Reserved", 0}, - {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (PciDeviceFlag), "PCI Device Flag", 0}, - {ACPI_DMT_UINT32, ACPI_SPMI_OFFSET (Interrupt), "Interrupt", 0}, - {ACPI_DMT_GAS, ACPI_SPMI_OFFSET (IpmiRegister), "IPMI Register", 0}, - {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (PciSegment), "PCI Segment", 0}, - {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (PciBus), "PCI Bus", 0}, - {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (PciDevice), "PCI Device", 0}, - {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (PciFunction), "PCI Function", 0}, - {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (Reserved2), "Reserved", 0}, - ACPI_DMT_TERMINATOR -}; - - -/******************************************************************************* - * - * SRAT - System Resource Affinity Table and Subtables - * - ******************************************************************************/ - -ACPI_DMTABLE_INFO AcpiDmTableInfoSrat[] = -{ - {ACPI_DMT_UINT32, ACPI_SRAT_OFFSET (TableRevision), "Table Revision", 0}, - {ACPI_DMT_UINT64, ACPI_SRAT_OFFSET (Reserved), "Reserved", 0}, - ACPI_DMT_TERMINATOR -}; - -/* Common Subtable header (one per Subtable) */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoSratHdr[] = -{ - {ACPI_DMT_SRAT, ACPI_SRATH_OFFSET (Type), "Subtable Type", 0}, - {ACPI_DMT_UINT8, ACPI_SRATH_OFFSET (Length), "Length", DT_LENGTH}, - ACPI_DMT_TERMINATOR -}; - -/* SRAT Subtables */ - -/* 0: Processor Local APIC/SAPIC Affinity */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoSrat0[] = -{ - {ACPI_DMT_UINT8, ACPI_SRAT0_OFFSET (ProximityDomainLo), "Proximity Domain Low(8)", 0}, - {ACPI_DMT_UINT8, ACPI_SRAT0_OFFSET (ApicId), "Apic ID", 0}, - {ACPI_DMT_UINT32, ACPI_SRAT0_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, - {ACPI_DMT_FLAG0, ACPI_SRAT0_FLAG_OFFSET (Flags,0), "Enabled", 0}, - {ACPI_DMT_UINT8, ACPI_SRAT0_OFFSET (LocalSapicEid), "Local Sapic EID", 0}, - {ACPI_DMT_UINT24, ACPI_SRAT0_OFFSET (ProximityDomainHi[0]), "Proximity Domain High(24)", 0}, - {ACPI_DMT_UINT32, ACPI_SRAT0_OFFSET (Reserved), "Reserved", 0}, - ACPI_DMT_TERMINATOR -}; - -/* 1: Memory Affinity */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoSrat1[] = -{ - {ACPI_DMT_UINT32, ACPI_SRAT1_OFFSET (ProximityDomain), "Proximity Domain", 0}, - {ACPI_DMT_UINT16, ACPI_SRAT1_OFFSET (Reserved), "Reserved", 0}, - {ACPI_DMT_UINT64, ACPI_SRAT1_OFFSET (BaseAddress), "Base Address", 0}, - {ACPI_DMT_UINT64, ACPI_SRAT1_OFFSET (Length), "Address Length", 0}, - {ACPI_DMT_UINT32, ACPI_SRAT1_OFFSET (Reserved1), "Reserved", 0}, - {ACPI_DMT_UINT32, ACPI_SRAT1_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, - {ACPI_DMT_FLAG0, ACPI_SRAT1_FLAG_OFFSET (Flags,0), "Enabled", 0}, - {ACPI_DMT_FLAG1, ACPI_SRAT1_FLAG_OFFSET (Flags,0), "Hot Pluggable", 0}, - {ACPI_DMT_FLAG2, ACPI_SRAT1_FLAG_OFFSET (Flags,0), "Non-Volatile", 0}, - {ACPI_DMT_UINT64, ACPI_SRAT1_OFFSET (Reserved2), "Reserved", 0}, - ACPI_DMT_TERMINATOR -}; - -/* 2: Processor Local X2_APIC Affinity (ACPI 4.0) */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoSrat2[] = -{ - {ACPI_DMT_UINT16, ACPI_SRAT2_OFFSET (Reserved), "Reserved", 0}, - {ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (ProximityDomain), "Proximity Domain", 0}, - {ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (ApicId), "Apic ID", 0}, - {ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, - {ACPI_DMT_FLAG0, ACPI_SRAT2_FLAG_OFFSET (Flags,0), "Enabled", 0}, - {ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (ClockDomain), "Clock Domain", 0}, - {ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (Reserved2), "Reserved", 0}, - ACPI_DMT_TERMINATOR -}; - - -/******************************************************************************* - * - * TCPA - Trusted Computing Platform Alliance table - * - ******************************************************************************/ - -ACPI_DMTABLE_INFO AcpiDmTableInfoTcpa[] = -{ - {ACPI_DMT_UINT16, ACPI_TCPA_OFFSET (Reserved), "Reserved", 0}, - {ACPI_DMT_UINT32, ACPI_TCPA_OFFSET (MaxLogLength), "Max Event Log Length", 0}, - {ACPI_DMT_UINT64, ACPI_TCPA_OFFSET (LogAddress), "Event Log Address", 0}, - ACPI_DMT_TERMINATOR -}; - - -/******************************************************************************* - * - * UEFI - UEFI Boot optimization Table - * - ******************************************************************************/ - -ACPI_DMTABLE_INFO AcpiDmTableInfoUefi[] = -{ - {ACPI_DMT_BUF16, ACPI_UEFI_OFFSET (Identifier[0]), "UUID Identifier", 0}, - {ACPI_DMT_UINT16, ACPI_UEFI_OFFSET (DataOffset), "Data Offset", 0}, - ACPI_DMT_TERMINATOR -}; - - -/******************************************************************************* - * - * WAET - Windows ACPI Emulated devices Table - * - ******************************************************************************/ - -ACPI_DMTABLE_INFO AcpiDmTableInfoWaet[] = -{ - {ACPI_DMT_UINT32, ACPI_WAET_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, - {ACPI_DMT_FLAG0, ACPI_WAET_OFFSET (Flags), "RTC needs no INT ack", 0}, - {ACPI_DMT_FLAG1, ACPI_WAET_OFFSET (Flags), "PM timer, one read only", 0}, - ACPI_DMT_TERMINATOR -}; - - -/******************************************************************************* - * - * WDAT - Watchdog Action Table - * - ******************************************************************************/ - -ACPI_DMTABLE_INFO AcpiDmTableInfoWdat[] = -{ - {ACPI_DMT_UINT32, ACPI_WDAT_OFFSET (HeaderLength), "Header Length", DT_LENGTH}, - {ACPI_DMT_UINT16, ACPI_WDAT_OFFSET (PciSegment), "PCI Segment", 0}, - {ACPI_DMT_UINT8, ACPI_WDAT_OFFSET (PciBus), "PCI Bus", 0}, - {ACPI_DMT_UINT8, ACPI_WDAT_OFFSET (PciDevice), "PCI Device", 0}, - {ACPI_DMT_UINT8, ACPI_WDAT_OFFSET (PciFunction), "PCI Function", 0}, - {ACPI_DMT_UINT24, ACPI_WDAT_OFFSET (Reserved[0]), "Reserved", 0}, - {ACPI_DMT_UINT32, ACPI_WDAT_OFFSET (TimerPeriod), "Timer Period", 0}, - {ACPI_DMT_UINT32, ACPI_WDAT_OFFSET (MaxCount), "Max Count", 0}, - {ACPI_DMT_UINT32, ACPI_WDAT_OFFSET (MinCount), "Min Count", 0}, - {ACPI_DMT_UINT8, ACPI_WDAT_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, - {ACPI_DMT_FLAG0, ACPI_WDAT_OFFSET (Flags), "Enabled", 0}, - {ACPI_DMT_FLAG7, ACPI_WDAT_OFFSET (Flags), "Stopped When Asleep", 0}, - {ACPI_DMT_UINT24, ACPI_WDAT_OFFSET (Reserved2[0]), "Reserved", 0}, - {ACPI_DMT_UINT32, ACPI_WDAT_OFFSET (Entries), "Watchdog Entry Count", 0}, - ACPI_DMT_TERMINATOR -}; - -/* WDAT Subtables - Watchdog Instruction Entries */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoWdat0[] = -{ - {ACPI_DMT_UINT8, ACPI_WDAT0_OFFSET (Action), "Watchdog Action", 0}, - {ACPI_DMT_UINT8, ACPI_WDAT0_OFFSET (Instruction), "Instruction", 0}, - {ACPI_DMT_UINT16, ACPI_WDAT0_OFFSET (Reserved), "Reserved", 0}, - {ACPI_DMT_GAS, ACPI_WDAT0_OFFSET (RegisterRegion), "Register Region", 0}, - {ACPI_DMT_UINT32, ACPI_WDAT0_OFFSET (Value), "Value", 0}, - {ACPI_DMT_UINT32, ACPI_WDAT0_OFFSET (Mask), "Register Mask", 0}, - ACPI_DMT_TERMINATOR -}; - - -/******************************************************************************* - * - * WDRT - Watchdog Resource Table - * - ******************************************************************************/ - -ACPI_DMTABLE_INFO AcpiDmTableInfoWdrt[] = -{ - {ACPI_DMT_GAS, ACPI_WDRT_OFFSET (ControlRegister), "Control Register", 0}, - {ACPI_DMT_GAS, ACPI_WDRT_OFFSET (CountRegister), "Count Register", 0}, - {ACPI_DMT_UINT16, ACPI_WDRT_OFFSET (PciDeviceId), "PCI Device ID", 0}, - {ACPI_DMT_UINT16, ACPI_WDRT_OFFSET (PciVendorId), "PCI Vendor ID", 0}, - {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (PciBus), "PCI Bus", 0}, - {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (PciDevice), "PCI Device", 0}, - {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (PciFunction), "PCI Function", 0}, - {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (PciSegment), "PCI Segment", 0}, - {ACPI_DMT_UINT16, ACPI_WDRT_OFFSET (MaxCount), "Max Count", 0}, - {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (Units), "Counter Units", 0}, - ACPI_DMT_TERMINATOR -}; - diff -Nru acpica-unix-20100528/common/getopt.c acpica-unix-20140114/common/getopt.c --- acpica-unix-20100528/common/getopt.c 2010-05-28 17:14:21.000000000 +0000 +++ acpica-unix-20140114/common/getopt.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,248 +0,0 @@ - -/****************************************************************************** - * - * Module Name: getopt - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - - -#include -#include -#include "acpi.h" -#include "accommon.h" -#include "acapps.h" - -#define ERR(szz,czz) if(AcpiGbl_Opterr){fprintf(stderr,"%s%s%c\n",argv[0],szz,czz);} - - -int AcpiGbl_Opterr = 1; -int AcpiGbl_Optind = 1; -int AcpiGbl_Optopt; -char *AcpiGbl_Optarg; - - -/******************************************************************************* - * - * FUNCTION: AcpiGetopt - * - * PARAMETERS: argc, argv - from main - * opts - options info list - * - * RETURN: Option character or EOF - * - * DESCRIPTION: Get the next option - * - ******************************************************************************/ - -int -AcpiGetopt( - int argc, - char **argv, - char *opts) -{ - static int CurrentCharPtr = 1; - int CurrentChar; - char *OptsPtr; - - - if (CurrentCharPtr == 1) - { - if (AcpiGbl_Optind >= argc || - argv[AcpiGbl_Optind][0] != '-' || - argv[AcpiGbl_Optind][1] == '\0') - { - return(EOF); - } - else if (strcmp (argv[AcpiGbl_Optind], "--") == 0) - { - AcpiGbl_Optind++; - return(EOF); - } - } - - /* Get the option */ - - CurrentChar = - AcpiGbl_Optopt = - argv[AcpiGbl_Optind][CurrentCharPtr]; - - /* Make sure that the option is legal */ - - if (CurrentChar == ':' || - (OptsPtr = strchr (opts, CurrentChar)) == NULL) - { - ERR (": illegal option -- ", CurrentChar); - - if (argv[AcpiGbl_Optind][++CurrentCharPtr] == '\0') - { - AcpiGbl_Optind++; - CurrentCharPtr = 1; - } - - return ('?'); - } - - /* Option requires an argument? */ - - if (*++OptsPtr == ':') - { - if (argv[AcpiGbl_Optind][(int) (CurrentCharPtr+1)] != '\0') - { - AcpiGbl_Optarg = &argv[AcpiGbl_Optind++][(int) (CurrentCharPtr+1)]; - } - else if (++AcpiGbl_Optind >= argc) - { - ERR (": option requires an argument -- ", CurrentChar); - - CurrentCharPtr = 1; - return ('?'); - } - else - { - AcpiGbl_Optarg = argv[AcpiGbl_Optind++]; - } - - CurrentCharPtr = 1; - } - - /* Option has optional single-char arguments? */ - - else if (*OptsPtr == '^') - { - if (argv[AcpiGbl_Optind][(int) (CurrentCharPtr+1)] != '\0') - { - AcpiGbl_Optarg = &argv[AcpiGbl_Optind][(int) (CurrentCharPtr+1)]; - } - else - { - AcpiGbl_Optarg = "^"; - } - - AcpiGbl_Optind++; - CurrentCharPtr = 1; - } - - /* Option with no arguments */ - - else - { - if (argv[AcpiGbl_Optind][++CurrentCharPtr] == '\0') - { - CurrentCharPtr = 1; - AcpiGbl_Optind++; - } - - AcpiGbl_Optarg = NULL; - } - - return (CurrentChar); -} diff -Nru acpica-unix-20100528/compiler/Makefile acpica-unix-20140114/compiler/Makefile --- acpica-unix-20100528/compiler/Makefile 2010-05-28 17:14:27.000000000 +0000 +++ acpica-unix-20140114/compiler/Makefile 1970-01-01 00:00:00.000000000 +0000 @@ -1,161 +0,0 @@ - -PROG= iasl -SRCS= \ - aslcompilerparse.c \ - aslcompilerlex.c \ - aslanalyze.c \ - aslcodegen.c \ - aslcompile.c \ - aslerror.c \ - aslfiles.c \ - aslfold.c \ - asllength.c \ - asllisting.c \ - aslload.c \ - asllookup.c \ - aslmain.c \ - aslmap.c \ - aslopcodes.c \ - asloperands.c \ - aslopt.c \ - aslpredef.c \ - aslresource.c \ - aslrestype1.c \ - aslrestype1i.c \ - aslrestype2.c \ - aslrestype2d.c \ - aslrestype2e.c \ - aslrestype2q.c \ - aslrestype2w.c \ - aslstartup.c \ - aslstubs.c \ - asltransform.c \ - asltree.c \ - aslutils.c \ - dtcompile.c \ - dtfield.c \ - dtio.c \ - dtsubtable.c \ - dttable.c \ - dtutils.c \ - ../common/getopt.c \ - ../utilities/utalloc.c \ - ../utilities/utcache.c \ - ../utilities/utcopy.c \ - ../utilities/utdebug.c \ - ../utilities/utdelete.c \ - ../utilities/utglobal.c \ - ../utilities/utinit.c \ - ../utilities/utlock.c \ - ../utilities/utobject.c \ - ../utilities/utmisc.c \ - ../utilities/utmath.c \ - ../utilities/utmutex.c \ - ../utilities/utresrc.c \ - ../utilities/utstate.c \ - ../utilities/utxface.c \ - ../namespace/nsaccess.c \ - ../namespace/nsalloc.c \ - ../namespace/nsdump.c \ - ../namespace/nsnames.c \ - ../namespace/nsobject.c \ - ../namespace/nsparse.c \ - ../namespace/nssearch.c \ - ../namespace/nsutils.c \ - ../namespace/nswalk.c \ - ../namespace/nsxfobj.c \ - ../parser/psargs.c \ - ../parser/psloop.c \ - ../parser/psopcode.c \ - ../parser/psparse.c \ - ../parser/psscope.c \ - ../parser/pstree.c \ - ../parser/psutils.c \ - ../parser/pswalk.c \ - ../dispatcher/dswscope.c \ - ../dispatcher/dswstate.c \ - ../dispatcher/dsfield.c \ - ../dispatcher/dsobject.c \ - ../dispatcher/dsopcode.c \ - ../dispatcher/dsutils.c \ - ../dispatcher/dswexec.c \ - ../dispatcher/dswload.c \ - ../executer/exconvrt.c \ - ../executer/excreate.c \ - ../executer/exdump.c \ - ../executer/exmisc.c \ - ../executer/exmutex.c \ - ../executer/exnames.c \ - ../executer/exoparg1.c \ - ../executer/exoparg2.c \ - ../executer/exoparg3.c \ - ../executer/exoparg6.c \ - ../executer/exprep.c \ - ../executer/exregion.c \ - ../executer/exresnte.c \ - ../executer/exresolv.c \ - ../executer/exresop.c \ - ../executer/exstore.c \ - ../executer/exstoren.c \ - ../executer/exstorob.c \ - ../executer/exsystem.c \ - ../executer/exutils.c \ - ../common/adfile.c \ - ../common/adisasm.c \ - ../common/adwalk.c \ - ../common/dmextern.c \ - ../common/dmrestag.c \ - ../common/dmtable.c \ - ../common/dmtbinfo.c \ - ../common/dmtbdump.c \ - ../debugger/dbfileio.c \ - ../disassembler/dmbuffer.c \ - ../disassembler/dmnames.c \ - ../disassembler/dmopcode.c \ - ../disassembler/dmobject.c \ - ../disassembler/dmresrc.c \ - ../disassembler/dmresrcl.c \ - ../disassembler/dmresrcs.c \ - ../disassembler/dmutils.c \ - ../disassembler/dmwalk.c \ - ../tables/tbfadt.c \ - ../tables/tbinstal.c \ - ../tables/tbutils.c \ - ../tables/tbxface.c \ - ../osunixxf.c - -NOMAN= YES -CFLAGS+= -Wall -O2 -Wstrict-prototypes -D_LINUX -DACPI_ASL_COMPILER -I../include -I../compiler - -#YACC= yacc -YACC= bison -YFLAGS+= -v -d -LEX= flex -LFLAGS+= -i - -#.if $(YACC) == "bison" -YFLAGS+= -y -pAslCompiler -#.else -#CFLAGS+= -D_USE_BERKELEY_YACC -#.endif - -LDLIBS = -lpthread -lrt - -aslmain : $(patsubst %.c,%.o, $(SRCS)) - $(CC) $(LDFLAGS) $(patsubst %.c,%.o, $(SRCS)) \ - $(LOADLIBES) $(LDLIBS) -o iasl - -CLEANFILES= y.output y.tab.c y.tab.h aslcompiler.y.h \ - aslcompilerparse.c aslcompilerlex.c iasl - -aslcompilerparse.c: aslcompiler.y - ${YACC} ${YFLAGS} aslcompiler.y - cp y.tab.c aslcompilerparse.c - cp y.tab.h aslcompiler.y.h - -aslcompilerlex.c: aslcompiler.l - ${LEX} ${LFLAGS} -PAslCompiler -oaslcompilerlex.c aslcompiler.l - -clean : - rm -f $(CLEANFILES) $(patsubst %.c,%.o, $(SRCS)) - diff -Nru acpica-unix-20100528/compiler/aslanalyze.c acpica-unix-20140114/compiler/aslanalyze.c --- acpica-unix-20100528/compiler/aslanalyze.c 2010-05-28 17:14:21.000000000 +0000 +++ acpica-unix-20140114/compiler/aslanalyze.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2020 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslanalyze.c - check for semantic errors - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - - -#include "aslcompiler.h" -#include "aslcompiler.y.h" -#include "acparser.h" -#include "amlcode.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslanalyze") - -/* Local prototypes */ - -static UINT32 -AnMapArgTypeToBtype ( - UINT32 ArgType); - -static UINT32 -AnMapEtypeToBtype ( - UINT32 Etype); - -static void -AnFormatBtype ( - char *Buffer, - UINT32 Btype); - -static UINT32 -AnGetBtype ( - ACPI_PARSE_OBJECT *Op); - -static UINT32 -AnMapObjTypeToBtype ( - ACPI_PARSE_OBJECT *Op); - -static BOOLEAN -AnLastStatementIsReturn ( - ACPI_PARSE_OBJECT *Op); - -static void -AnCheckMethodReturnValue ( - ACPI_PARSE_OBJECT *Op, - const ACPI_OPCODE_INFO *OpInfo, - ACPI_PARSE_OBJECT *ArgOp, - UINT32 RequiredBtypes, - UINT32 ThisNodeBtype); - -static BOOLEAN -AnIsInternalMethod ( - ACPI_PARSE_OBJECT *Op); - -static UINT32 -AnGetInternalMethodReturnType ( - ACPI_PARSE_OBJECT *Op); - -BOOLEAN -AnIsResultUsed ( - ACPI_PARSE_OBJECT *Op); - - -/******************************************************************************* - * - * FUNCTION: AnIsInternalMethod - * - * PARAMETERS: Op - Current op - * - * RETURN: Boolean - * - * DESCRIPTION: Check for an internal control method. - * - ******************************************************************************/ - -static BOOLEAN -AnIsInternalMethod ( - ACPI_PARSE_OBJECT *Op) -{ - - if ((!ACPI_STRCMP (Op->Asl.ExternalName, "\\_OSI")) || - (!ACPI_STRCMP (Op->Asl.ExternalName, "_OSI"))) - { - return (TRUE); - } - - return (FALSE); -} - - -/******************************************************************************* - * - * FUNCTION: AnGetInternalMethodReturnType - * - * PARAMETERS: Op - Current op - * - * RETURN: Btype - * - * DESCRIPTION: Get the return type of an internal method - * - ******************************************************************************/ - -static UINT32 -AnGetInternalMethodReturnType ( - ACPI_PARSE_OBJECT *Op) -{ - - if ((!ACPI_STRCMP (Op->Asl.ExternalName, "\\_OSI")) || - (!ACPI_STRCMP (Op->Asl.ExternalName, "_OSI"))) - { - return (ACPI_BTYPE_STRING); - } - - return (0); -} - - -/******************************************************************************* - * - * FUNCTION: AnMapArgTypeToBtype - * - * PARAMETERS: ArgType - The ARGI required type(s) for this argument, - * from the opcode info table - * - * RETURN: The corresponding Bit-encoded types - * - * DESCRIPTION: Convert an encoded ARGI required argument type code into a - * bitfield type code. Implements the implicit source conversion - * rules. - * - ******************************************************************************/ - -static UINT32 -AnMapArgTypeToBtype ( - UINT32 ArgType) -{ - - switch (ArgType) - { - - /* Simple types */ - - case ARGI_ANYTYPE: - return (ACPI_BTYPE_OBJECTS_AND_REFS); - - case ARGI_PACKAGE: - return (ACPI_BTYPE_PACKAGE); - - case ARGI_EVENT: - return (ACPI_BTYPE_EVENT); - - case ARGI_MUTEX: - return (ACPI_BTYPE_MUTEX); - - case ARGI_DDBHANDLE: - /* - * DDBHandleObject := SuperName - * ACPI_BTYPE_REFERENCE: Index reference as parameter of Load/Unload - */ - return (ACPI_BTYPE_DDB_HANDLE | ACPI_BTYPE_REFERENCE); - - /* Interchangeable types */ - /* - * Source conversion rules: - * Integer, String, and Buffer are all interchangeable - */ - case ARGI_INTEGER: - case ARGI_STRING: - case ARGI_BUFFER: - case ARGI_BUFFER_OR_STRING: - case ARGI_COMPUTEDATA: - return (ACPI_BTYPE_COMPUTE_DATA); - - /* References */ - - case ARGI_INTEGER_REF: - return (ACPI_BTYPE_INTEGER); - - case ARGI_OBJECT_REF: - return (ACPI_BTYPE_ALL_OBJECTS); - - case ARGI_DEVICE_REF: - return (ACPI_BTYPE_DEVICE_OBJECTS); - - case ARGI_REFERENCE: - return (ACPI_BTYPE_REFERENCE); - - case ARGI_TARGETREF: - case ARGI_FIXED_TARGET: - case ARGI_SIMPLE_TARGET: - return (ACPI_BTYPE_OBJECTS_AND_REFS); - - /* Complex types */ - - case ARGI_DATAOBJECT: - - /* - * Buffer, string, package or reference to a Op - - * Used only by SizeOf operator - */ - return (ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER | - ACPI_BTYPE_PACKAGE | ACPI_BTYPE_REFERENCE); - - case ARGI_COMPLEXOBJ: - - /* Buffer, String, or package */ - - return (ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER | ACPI_BTYPE_PACKAGE); - - case ARGI_REF_OR_STRING: - return (ACPI_BTYPE_STRING | ACPI_BTYPE_REFERENCE); - - case ARGI_REGION_OR_BUFFER: - - /* Used by Load() only. Allow buffers in addition to regions/fields */ - - return (ACPI_BTYPE_REGION | ACPI_BTYPE_BUFFER | ACPI_BTYPE_FIELD_UNIT); - - case ARGI_DATAREFOBJ: - return (ACPI_BTYPE_INTEGER |ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER | - ACPI_BTYPE_PACKAGE | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE); - - default: - break; - } - - return (ACPI_BTYPE_OBJECTS_AND_REFS); -} - - -/******************************************************************************* - * - * FUNCTION: AnMapEtypeToBtype - * - * PARAMETERS: Etype - Encoded ACPI Type - * - * RETURN: Btype corresponding to the Etype - * - * DESCRIPTION: Convert an encoded ACPI type to a bitfield type applying the - * operand conversion rules. In other words, returns the type(s) - * this Etype is implicitly converted to during interpretation. - * - ******************************************************************************/ - -static UINT32 -AnMapEtypeToBtype ( - UINT32 Etype) -{ - - - if (Etype == ACPI_TYPE_ANY) - { - return ACPI_BTYPE_OBJECTS_AND_REFS; - } - - /* Try the standard ACPI data types */ - - if (Etype <= ACPI_TYPE_EXTERNAL_MAX) - { - /* - * This switch statement implements the allowed operand conversion - * rules as per the "ASL Data Types" section of the ACPI - * specification. - */ - switch (Etype) - { - case ACPI_TYPE_INTEGER: - return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_DDB_HANDLE); - - case ACPI_TYPE_STRING: - case ACPI_TYPE_BUFFER: - return (ACPI_BTYPE_COMPUTE_DATA); - - case ACPI_TYPE_PACKAGE: - return (ACPI_BTYPE_PACKAGE); - - case ACPI_TYPE_FIELD_UNIT: - return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_FIELD_UNIT); - - case ACPI_TYPE_BUFFER_FIELD: - return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_BUFFER_FIELD); - - case ACPI_TYPE_DDB_HANDLE: - return (ACPI_BTYPE_INTEGER | ACPI_BTYPE_DDB_HANDLE); - - case ACPI_BTYPE_DEBUG_OBJECT: - - /* Cannot be used as a source operand */ - - return (0); - - default: - return (1 << (Etype - 1)); - } - } - - /* Try the internal data types */ - - switch (Etype) - { - case ACPI_TYPE_LOCAL_REGION_FIELD: - case ACPI_TYPE_LOCAL_BANK_FIELD: - case ACPI_TYPE_LOCAL_INDEX_FIELD: - - /* Named fields can be either Integer/Buffer/String */ - - return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_FIELD_UNIT); - - case ACPI_TYPE_LOCAL_ALIAS: - - return (ACPI_BTYPE_INTEGER); - - - case ACPI_TYPE_LOCAL_RESOURCE: - case ACPI_TYPE_LOCAL_RESOURCE_FIELD: - - return (ACPI_BTYPE_REFERENCE); - - default: - printf ("Unhandled encoded type: %X\n", Etype); - return (0); - } -} - - -/******************************************************************************* - * - * FUNCTION: AnFormatBtype - * - * PARAMETERS: Btype - Bitfield of ACPI types - * Buffer - Where to put the ascii string - * - * RETURN: None. - * - * DESCRIPTION: Convert a Btype to a string of ACPI types - * - ******************************************************************************/ - -static void -AnFormatBtype ( - char *Buffer, - UINT32 Btype) -{ - UINT32 Type; - BOOLEAN First = TRUE; - - - *Buffer = 0; - - if (Btype == 0) - { - strcat (Buffer, "NoReturnValue"); - return; - } - - for (Type = 1; Type <= ACPI_TYPE_EXTERNAL_MAX; Type++) - { - if (Btype & 0x00000001) - { - if (!First) - { - strcat (Buffer, "|"); - } - First = FALSE; - strcat (Buffer, AcpiUtGetTypeName (Type)); - } - Btype >>= 1; - } - - if (Btype & 0x00000001) - { - if (!First) - { - strcat (Buffer, "|"); - } - First = FALSE; - strcat (Buffer, "Reference"); - } - - Btype >>= 1; - if (Btype & 0x00000001) - { - if (!First) - { - strcat (Buffer, "|"); - } - First = FALSE; - strcat (Buffer, "Resource"); - } -} - - -/******************************************************************************* - * - * FUNCTION: AnGetBtype - * - * PARAMETERS: Op - Parse node whose type will be returned. - * - * RETURN: The Btype associated with the Op. - * - * DESCRIPTION: Get the (bitfield) ACPI type associated with the parse node. - * Handles the case where the node is a name or method call and - * the actual type must be obtained from the namespace node. - * - ******************************************************************************/ - -static UINT32 -AnGetBtype ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_NAMESPACE_NODE *Node; - ACPI_PARSE_OBJECT *ReferencedNode; - UINT32 ThisNodeBtype = 0; - - - if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || - (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) || - (Op->Asl.ParseOpcode == PARSEOP_METHODCALL)) - { - Node = Op->Asl.Node; - if (!Node) - { - DbgPrint (ASL_DEBUG_OUTPUT, - "No attached Nsnode: [%s] at line %u name [%s], ignoring typecheck\n", - Op->Asl.ParseOpName, Op->Asl.LineNumber, - Op->Asl.ExternalName); - return ACPI_UINT32_MAX; - } - - ThisNodeBtype = AnMapEtypeToBtype (Node->Type); - if (!ThisNodeBtype) - { - AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Op, - "could not map type"); - } - - /* - * Since it was a named reference, enable the - * reference bit also - */ - ThisNodeBtype |= ACPI_BTYPE_REFERENCE; - - if (Op->Asl.ParseOpcode == PARSEOP_METHODCALL) - { - ReferencedNode = Node->Op; - if (!ReferencedNode) - { - /* Check for an internal method */ - - if (AnIsInternalMethod (Op)) - { - return (AnGetInternalMethodReturnType (Op)); - } - - AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Op, - "null Op pointer"); - return ACPI_UINT32_MAX; - } - - if (ReferencedNode->Asl.CompileFlags & NODE_METHOD_TYPED) - { - ThisNodeBtype = ReferencedNode->Asl.AcpiBtype; - } - else - { - return (ACPI_UINT32_MAX -1); - } - } - } - else - { - ThisNodeBtype = Op->Asl.AcpiBtype; - } - - return (ThisNodeBtype); -} - - -/******************************************************************************* - * - * FUNCTION: AnMapObjTypeToBtype - * - * PARAMETERS: Op - A parse node - * - * RETURN: A Btype - * - * DESCRIPTION: Map object to the associated "Btype" - * - ******************************************************************************/ - -static UINT32 -AnMapObjTypeToBtype ( - ACPI_PARSE_OBJECT *Op) -{ - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_OBJECTTYPE_BFF: /* "BuffFieldObj" */ - return (ACPI_BTYPE_BUFFER_FIELD); - - case PARSEOP_OBJECTTYPE_BUF: /* "BuffObj" */ - return (ACPI_BTYPE_BUFFER); - - case PARSEOP_OBJECTTYPE_DDB: /* "DDBHandleObj" */ - return (ACPI_BTYPE_DDB_HANDLE); - - case PARSEOP_OBJECTTYPE_DEV: /* "DeviceObj" */ - return (ACPI_BTYPE_DEVICE); - - case PARSEOP_OBJECTTYPE_EVT: /* "EventObj" */ - return (ACPI_BTYPE_EVENT); - - case PARSEOP_OBJECTTYPE_FLD: /* "FieldUnitObj" */ - return (ACPI_BTYPE_FIELD_UNIT); - - case PARSEOP_OBJECTTYPE_INT: /* "IntObj" */ - return (ACPI_BTYPE_INTEGER); - - case PARSEOP_OBJECTTYPE_MTH: /* "MethodObj" */ - return (ACPI_BTYPE_METHOD); - - case PARSEOP_OBJECTTYPE_MTX: /* "MutexObj" */ - return (ACPI_BTYPE_MUTEX); - - case PARSEOP_OBJECTTYPE_OPR: /* "OpRegionObj" */ - return (ACPI_BTYPE_REGION); - - case PARSEOP_OBJECTTYPE_PKG: /* "PkgObj" */ - return (ACPI_BTYPE_PACKAGE); - - case PARSEOP_OBJECTTYPE_POW: /* "PowerResObj" */ - return (ACPI_BTYPE_POWER); - - case PARSEOP_OBJECTTYPE_STR: /* "StrObj" */ - return (ACPI_BTYPE_STRING); - - case PARSEOP_OBJECTTYPE_THZ: /* "ThermalZoneObj" */ - return (ACPI_BTYPE_THERMAL); - - case PARSEOP_OBJECTTYPE_UNK: /* "UnknownObj" */ - return (ACPI_BTYPE_OBJECTS_AND_REFS); - - default: - return (0); - } -} - - -/******************************************************************************* - * - * FUNCTION: AnMethodAnalysisWalkBegin - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Descending callback for the analysis walk. Check methods for: - * 1) Initialized local variables - * 2) Valid arguments - * 3) Return types - * - ******************************************************************************/ - -ACPI_STATUS -AnMethodAnalysisWalkBegin ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ASL_ANALYSIS_WALK_INFO *WalkInfo = (ASL_ANALYSIS_WALK_INFO *) Context; - ASL_METHOD_INFO *MethodInfo = WalkInfo->MethodStack; - ACPI_PARSE_OBJECT *Next; - UINT32 RegisterNumber; - UINT32 i; - char LocalName[] = "Local0"; - char ArgName[] = "Arg0"; - ACPI_PARSE_OBJECT *ArgNode; - ACPI_PARSE_OBJECT *NextType; - ACPI_PARSE_OBJECT *NextParamType; - UINT8 ActualArgs = 0; - - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_METHOD: - - TotalMethods++; - - /* Create and init method info */ - - MethodInfo = UtLocalCalloc (sizeof (ASL_METHOD_INFO)); - MethodInfo->Next = WalkInfo->MethodStack; - MethodInfo->Op = Op; - - WalkInfo->MethodStack = MethodInfo; - - /* Get the name node, ignored here */ - - Next = Op->Asl.Child; - - /* Get the NumArguments node */ - - Next = Next->Asl.Next; - MethodInfo->NumArguments = (UINT8) - (((UINT8) Next->Asl.Value.Integer) & 0x07); - - /* Get the SerializeRule and SyncLevel nodes, ignored here */ - - Next = Next->Asl.Next; - Next = Next->Asl.Next; - ArgNode = Next; - - /* Get the ReturnType node */ - - Next = Next->Asl.Next; - - NextType = Next->Asl.Child; - while (NextType) - { - /* Get and map each of the ReturnTypes */ - - MethodInfo->ValidReturnTypes |= AnMapObjTypeToBtype (NextType); - NextType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - NextType = NextType->Asl.Next; - } - - /* Get the ParameterType node */ - - Next = Next->Asl.Next; - - NextType = Next->Asl.Child; - while (NextType) - { - if (NextType->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) - { - NextParamType = NextType->Asl.Child; - while (NextParamType) - { - MethodInfo->ValidArgTypes[ActualArgs] |= AnMapObjTypeToBtype (NextParamType); - NextParamType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - NextParamType = NextParamType->Asl.Next; - } - } - else - { - MethodInfo->ValidArgTypes[ActualArgs] = - AnMapObjTypeToBtype (NextType); - NextType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - ActualArgs++; - } - - NextType = NextType->Asl.Next; - } - - if ((MethodInfo->NumArguments) && - (MethodInfo->NumArguments != ActualArgs)) - { - /* error: Param list did not match number of args */ - } - - /* Allow numarguments == 0 for Function() */ - - if ((!MethodInfo->NumArguments) && (ActualArgs)) - { - MethodInfo->NumArguments = ActualArgs; - ArgNode->Asl.Value.Integer |= ActualArgs; - } - - /* - * Actual arguments are initialized at method entry. - * All other ArgX "registers" can be used as locals, so we - * track their initialization. - */ - for (i = 0; i < MethodInfo->NumArguments; i++) - { - MethodInfo->ArgInitialized[i] = TRUE; - } - break; - - - case PARSEOP_METHODCALL: - - if (MethodInfo && - (Op->Asl.Node == MethodInfo->Op->Asl.Node)) - { - AslError (ASL_REMARK, ASL_MSG_RECURSION, Op, Op->Asl.ExternalName); - } - break; - - - case PARSEOP_LOCAL0: - case PARSEOP_LOCAL1: - case PARSEOP_LOCAL2: - case PARSEOP_LOCAL3: - case PARSEOP_LOCAL4: - case PARSEOP_LOCAL5: - case PARSEOP_LOCAL6: - case PARSEOP_LOCAL7: - - if (!MethodInfo) - { - /* - * Local was used outside a control method, or there was an error - * in the method declaration. - */ - AslError (ASL_REMARK, ASL_MSG_LOCAL_OUTSIDE_METHOD, Op, Op->Asl.ExternalName); - return (AE_ERROR); - } - - RegisterNumber = (Op->Asl.AmlOpcode & 0x000F); - - /* - * If the local is being used as a target, mark the local - * initialized - */ - if (Op->Asl.CompileFlags & NODE_IS_TARGET) - { - MethodInfo->LocalInitialized[RegisterNumber] = TRUE; - } - - /* - * Otherwise, this is a reference, check if the local - * has been previously initialized. - * - * The only operator that accepts an uninitialized value is ObjectType() - */ - else if ((!MethodInfo->LocalInitialized[RegisterNumber]) && - (Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_OBJECTTYPE)) - { - LocalName[strlen (LocalName) -1] = (char) (RegisterNumber + 0x30); - AslError (ASL_ERROR, ASL_MSG_LOCAL_INIT, Op, LocalName); - } - break; - - - case PARSEOP_ARG0: - case PARSEOP_ARG1: - case PARSEOP_ARG2: - case PARSEOP_ARG3: - case PARSEOP_ARG4: - case PARSEOP_ARG5: - case PARSEOP_ARG6: - - if (!MethodInfo) - { - /* - * Arg was used outside a control method, or there was an error - * in the method declaration. - */ - AslError (ASL_REMARK, ASL_MSG_LOCAL_OUTSIDE_METHOD, Op, Op->Asl.ExternalName); - return (AE_ERROR); - } - - RegisterNumber = (Op->Asl.AmlOpcode & 0x000F) - 8; - ArgName[strlen (ArgName) -1] = (char) (RegisterNumber + 0x30); - - /* - * If the Arg is being used as a target, mark the local - * initialized - */ - if (Op->Asl.CompileFlags & NODE_IS_TARGET) - { - MethodInfo->ArgInitialized[RegisterNumber] = TRUE; - } - - /* - * Otherwise, this is a reference, check if the Arg - * has been previously initialized. - * - * The only operator that accepts an uninitialized value is ObjectType() - */ - else if ((!MethodInfo->ArgInitialized[RegisterNumber]) && - (Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_OBJECTTYPE)) - { - AslError (ASL_ERROR, ASL_MSG_ARG_INIT, Op, ArgName); - } - - /* Flag this arg if it is not a "real" argument to the method */ - - if (RegisterNumber >= MethodInfo->NumArguments) - { - AslError (ASL_REMARK, ASL_MSG_NOT_PARAMETER, Op, ArgName); - } - break; - - - case PARSEOP_RETURN: - - if (!MethodInfo) - { - /* - * Probably was an error in the method declaration, - * no additional error here - */ - ACPI_WARNING ((AE_INFO, "%p, No parent method", Op)); - return (AE_ERROR); - } - - /* Child indicates a return value */ - - if ((Op->Asl.Child) && - (Op->Asl.Child->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)) - { - MethodInfo->NumReturnWithValue++; - } - else - { - MethodInfo->NumReturnNoValue++; - } - break; - - - case PARSEOP_BREAK: - case PARSEOP_CONTINUE: - - Next = Op->Asl.Parent; - while (Next) - { - if (Next->Asl.ParseOpcode == PARSEOP_WHILE) - { - break; - } - Next = Next->Asl.Parent; - } - - if (!Next) - { - AslError (ASL_ERROR, ASL_MSG_NO_WHILE, Op, NULL); - } - break; - - - case PARSEOP_STALL: - - /* We can range check if the argument is an integer */ - - if ((Op->Asl.Child->Asl.ParseOpcode == PARSEOP_INTEGER) && - (Op->Asl.Child->Asl.Value.Integer > ACPI_UINT8_MAX)) - { - AslError (ASL_ERROR, ASL_MSG_INVALID_TIME, Op, NULL); - } - break; - - - case PARSEOP_DEVICE: - case PARSEOP_EVENT: - case PARSEOP_MUTEX: - case PARSEOP_OPERATIONREGION: - case PARSEOP_POWERRESOURCE: - case PARSEOP_PROCESSOR: - case PARSEOP_THERMALZONE: - - /* - * The first operand is a name to be created in the namespace. - * Check against the reserved list. - */ - i = ApCheckForPredefinedName (Op, Op->Asl.NameSeg); - if (i < ACPI_VALID_RESERVED_NAME_MAX) - { - AslError (ASL_ERROR, ASL_MSG_RESERVED_USE, Op, Op->Asl.ExternalName); - } - break; - - - case PARSEOP_NAME: - - /* Typecheck any predefined names statically defined with Name() */ - - ApCheckForPredefinedObject (Op, Op->Asl.NameSeg); - - /* Special typechecking for _HID */ - - if (!ACPI_STRCMP (METHOD_NAME__HID, Op->Asl.NameSeg)) - { - Next = Op->Asl.Child->Asl.Next; - if (Next->Asl.ParseOpcode == PARSEOP_STRING_LITERAL) - { - /* - * _HID is a string, all characters must be alphanumeric. - * One of the things we want to catch here is the use of - * a leading asterisk in the string. - */ - for (i = 0; Next->Asl.Value.String[i]; i++) - { - if (!isalnum ((int) Next->Asl.Value.String[i])) - { - AslError (ASL_ERROR, ASL_MSG_ALPHANUMERIC_STRING, - Next, Next->Asl.Value.String); - break; - } - } - } - } - break; - - - default: - break; - } - - return AE_OK; -} - - -/******************************************************************************* - * - * FUNCTION: AnLastStatementIsReturn - * - * PARAMETERS: Op - A method parse node - * - * RETURN: TRUE if last statement is an ASL RETURN. False otherwise - * - * DESCRIPTION: Walk down the list of top level statements within a method - * to find the last one. Check if that last statement is in - * fact a RETURN statement. - * - ******************************************************************************/ - -static BOOLEAN -AnLastStatementIsReturn ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Next; - - - /* - * Check if last statement is a return - */ - Next = ASL_GET_CHILD_NODE (Op); - while (Next) - { - if ((!Next->Asl.Next) && - (Next->Asl.ParseOpcode == PARSEOP_RETURN)) - { - return TRUE; - } - - Next = ASL_GET_PEER_NODE (Next); - } - - return FALSE; -} - - -/******************************************************************************* - * - * FUNCTION: AnMethodAnalysisWalkEnd - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Ascending callback for analysis walk. Complete method - * return analysis. - * - ******************************************************************************/ - -ACPI_STATUS -AnMethodAnalysisWalkEnd ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ASL_ANALYSIS_WALK_INFO *WalkInfo = (ASL_ANALYSIS_WALK_INFO *) Context; - ASL_METHOD_INFO *MethodInfo = WalkInfo->MethodStack; - - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_METHOD: - case PARSEOP_RETURN: - if (!MethodInfo) - { - printf ("No method info for method! [%s]\n", Op->Asl.Namepath); - AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Op, - "No method info for this method"); - CmCleanupAndExit (); - return (AE_AML_INTERNAL); - } - break; - - default: - break; - } - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_METHOD: - - WalkInfo->MethodStack = MethodInfo->Next; - - /* - * Check if there is no return statement at the end of the - * method AND we can actually get there -- i.e., the execution - * of the method can possibly terminate without a return statement. - */ - if ((!AnLastStatementIsReturn (Op)) && - (!(Op->Asl.CompileFlags & NODE_HAS_NO_EXIT))) - { - /* - * No return statement, and execution can possibly exit - * via this path. This is equivalent to Return () - */ - MethodInfo->NumReturnNoValue++; - } - - /* - * Check for case where some return statements have a return value - * and some do not. Exit without a return statement is a return with - * no value - */ - if (MethodInfo->NumReturnNoValue && - MethodInfo->NumReturnWithValue) - { - AslError (ASL_WARNING, ASL_MSG_RETURN_TYPES, Op, - Op->Asl.ExternalName); - } - - /* - * If there are any RETURN() statements with no value, or there is a - * control path that allows the method to exit without a return value, - * we mark the method as a method that does not return a value. This - * knowledge can be used to check method invocations that expect a - * returned value. - */ - if (MethodInfo->NumReturnNoValue) - { - if (MethodInfo->NumReturnWithValue) - { - Op->Asl.CompileFlags |= NODE_METHOD_SOME_NO_RETVAL; - } - else - { - Op->Asl.CompileFlags |= NODE_METHOD_NO_RETVAL; - } - } - - /* - * Check predefined method names for correct return behavior - * and correct number of arguments - */ - ApCheckForPredefinedMethod (Op, MethodInfo); - ACPI_FREE (MethodInfo); - break; - - - case PARSEOP_RETURN: - - /* - * If the parent is a predefined method name, attempt to typecheck - * the return value. Only static types can be validated. - */ - ApCheckPredefinedReturnValue (Op, MethodInfo); - - /* - * The parent block does not "exit" and continue execution -- the - * method is terminated here with the Return() statement. - */ - Op->Asl.Parent->Asl.CompileFlags |= NODE_HAS_NO_EXIT; - - /* Used in the "typing" pass later */ - - Op->Asl.ParentMethod = MethodInfo->Op; - - /* - * If there is a peer node after the return statement, then this - * node is unreachable code -- i.e., it won't be executed because of - * the preceeding Return() statement. - */ - if (Op->Asl.Next) - { - AslError (ASL_WARNING, ASL_MSG_UNREACHABLE_CODE, Op->Asl.Next, NULL); - } - break; - - - case PARSEOP_IF: - - if ((Op->Asl.CompileFlags & NODE_HAS_NO_EXIT) && - (Op->Asl.Next) && - (Op->Asl.Next->Asl.ParseOpcode == PARSEOP_ELSE)) - { - /* - * This IF has a corresponding ELSE. The IF block has no exit, - * (it contains an unconditional Return) - * mark the ELSE block to remember this fact. - */ - Op->Asl.Next->Asl.CompileFlags |= NODE_IF_HAS_NO_EXIT; - } - break; - - - case PARSEOP_ELSE: - - if ((Op->Asl.CompileFlags & NODE_HAS_NO_EXIT) && - (Op->Asl.CompileFlags & NODE_IF_HAS_NO_EXIT)) - { - /* - * This ELSE block has no exit and the corresponding IF block - * has no exit either. Therefore, the parent node has no exit. - */ - Op->Asl.Parent->Asl.CompileFlags |= NODE_HAS_NO_EXIT; - } - break; - - - default: - - if ((Op->Asl.CompileFlags & NODE_HAS_NO_EXIT) && - (Op->Asl.Parent)) - { - /* If this node has no exit, then the parent has no exit either */ - - Op->Asl.Parent->Asl.CompileFlags |= NODE_HAS_NO_EXIT; - } - break; - } - - return AE_OK; -} - - -/******************************************************************************* - * - * FUNCTION: AnMethodTypingWalkBegin - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Descending callback for the typing walk. - * - ******************************************************************************/ - -ACPI_STATUS -AnMethodTypingWalkBegin ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - - return AE_OK; -} - - -/******************************************************************************* - * - * FUNCTION: AnMethodTypingWalkEnd - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Ascending callback for typing walk. Complete the method - * return analysis. Check methods for: - * 1) Initialized local variables - * 2) Valid arguments - * 3) Return types - * - ******************************************************************************/ - -ACPI_STATUS -AnMethodTypingWalkEnd ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - UINT32 ThisNodeBtype; - - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_METHOD: - - Op->Asl.CompileFlags |= NODE_METHOD_TYPED; - break; - - case PARSEOP_RETURN: - - if ((Op->Asl.Child) && - (Op->Asl.Child->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)) - { - ThisNodeBtype = AnGetBtype (Op->Asl.Child); - - if ((Op->Asl.Child->Asl.ParseOpcode == PARSEOP_METHODCALL) && - (ThisNodeBtype == (ACPI_UINT32_MAX -1))) - { - /* - * The called method is untyped at this time (typically a - * forward reference). - * - * Check for a recursive method call first. - */ - if (Op->Asl.ParentMethod != Op->Asl.Child->Asl.Node->Op) - { - /* We must type the method here */ - - TrWalkParseTree (Op->Asl.Child->Asl.Node->Op, - ASL_WALK_VISIT_TWICE, AnMethodTypingWalkBegin, - AnMethodTypingWalkEnd, NULL); - - ThisNodeBtype = AnGetBtype (Op->Asl.Child); - } - } - - /* Returns a value, save the value type */ - - if (Op->Asl.ParentMethod) - { - Op->Asl.ParentMethod->Asl.AcpiBtype |= ThisNodeBtype; - } - } - break; - - default: - break; - } - - return AE_OK; -} - - -/******************************************************************************* - * - * FUNCTION: AnCheckMethodReturnValue - * - * PARAMETERS: Op - Parent - * OpInfo - Parent info - * ArgOp - Method invocation op - * RequiredBtypes - What caller requires - * ThisNodeBtype - What this node returns (if anything) - * - * RETURN: None - * - * DESCRIPTION: Check a method invocation for 1) A return value and if it does - * in fact return a value, 2) check the type of the return value. - * - ******************************************************************************/ - -static void -AnCheckMethodReturnValue ( - ACPI_PARSE_OBJECT *Op, - const ACPI_OPCODE_INFO *OpInfo, - ACPI_PARSE_OBJECT *ArgOp, - UINT32 RequiredBtypes, - UINT32 ThisNodeBtype) -{ - ACPI_PARSE_OBJECT *OwningOp; - ACPI_NAMESPACE_NODE *Node; - - - Node = ArgOp->Asl.Node; - - - /* Examine the parent op of this method */ - - OwningOp = Node->Op; - if (OwningOp->Asl.CompileFlags & NODE_METHOD_NO_RETVAL) - { - /* Method NEVER returns a value */ - - AslError (ASL_ERROR, ASL_MSG_NO_RETVAL, Op, Op->Asl.ExternalName); - } - else if (OwningOp->Asl.CompileFlags & NODE_METHOD_SOME_NO_RETVAL) - { - /* Method SOMETIMES returns a value, SOMETIMES not */ - - AslError (ASL_WARNING, ASL_MSG_SOME_NO_RETVAL, Op, Op->Asl.ExternalName); - } - else if (!(ThisNodeBtype & RequiredBtypes)) - { - /* Method returns a value, but the type is wrong */ - - AnFormatBtype (StringBuffer, ThisNodeBtype); - AnFormatBtype (StringBuffer2, RequiredBtypes); - - - /* - * The case where the method does not return any value at all - * was already handled in the namespace cross reference - * -- Only issue an error if the method in fact returns a value, - * but it is of the wrong type - */ - if (ThisNodeBtype != 0) - { - sprintf (MsgBuffer, - "Method returns [%s], %s operator requires [%s]", - StringBuffer, OpInfo->Name, StringBuffer2); - - AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ArgOp, MsgBuffer); - } - } -} - - -/******************************************************************************* - * - * FUNCTION: AnOperandTypecheckWalkBegin - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Descending callback for the analysis walk. Check methods for: - * 1) Initialized local variables - * 2) Valid arguments - * 3) Return types - * - ******************************************************************************/ - -ACPI_STATUS -AnOperandTypecheckWalkBegin ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - - return AE_OK; -} - - -/******************************************************************************* - * - * FUNCTION: AnOperandTypecheckWalkEnd - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Ascending callback for analysis walk. Complete method - * return analysis. - * - ******************************************************************************/ - -ACPI_STATUS -AnOperandTypecheckWalkEnd ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - const ACPI_OPCODE_INFO *OpInfo; - UINT32 RuntimeArgTypes; - UINT32 RuntimeArgTypes2; - UINT32 RequiredBtypes; - UINT32 ThisNodeBtype; - UINT32 CommonBtypes; - UINT32 OpcodeClass; - ACPI_PARSE_OBJECT *ArgOp; - UINT32 ArgType; - - - switch (Op->Asl.AmlOpcode) - { - case AML_RAW_DATA_BYTE: - case AML_RAW_DATA_WORD: - case AML_RAW_DATA_DWORD: - case AML_RAW_DATA_QWORD: - case AML_RAW_DATA_BUFFER: - case AML_RAW_DATA_CHAIN: - case AML_PACKAGE_LENGTH: - case AML_UNASSIGNED_OPCODE: - case AML_DEFAULT_ARG_OP: - - /* Ignore the internal (compiler-only) AML opcodes */ - - return (AE_OK); - - default: - break; - } - - OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode); - if (!OpInfo) - { - return (AE_OK); - } - - ArgOp = Op->Asl.Child; - RuntimeArgTypes = OpInfo->RuntimeArgs; - OpcodeClass = OpInfo->Class; - -#ifdef ASL_ERROR_NAMED_OBJECT_IN_WHILE - /* - * Update 11/2008: In practice, we can't perform this check. A simple - * analysis is not sufficient. Also, it can cause errors when compiling - * disassembled code because of the way Switch operators are implemented - * (a While(One) loop with a named temp variable created within.) - */ - - /* - * If we are creating a named object, check if we are within a while loop - * by checking if the parent is a WHILE op. This is a simple analysis, but - * probably sufficient for many cases. - * - * Allow Scope(), Buffer(), and Package(). - */ - if (((OpcodeClass == AML_CLASS_NAMED_OBJECT) && (Op->Asl.AmlOpcode != AML_SCOPE_OP)) || - ((OpcodeClass == AML_CLASS_CREATE) && (OpInfo->Flags & AML_NSNODE))) - { - if (Op->Asl.Parent->Asl.AmlOpcode == AML_WHILE_OP) - { - AslError (ASL_ERROR, ASL_MSG_NAMED_OBJECT_IN_WHILE, Op, NULL); - } - } -#endif - - /* - * Special case for control opcodes IF/RETURN/WHILE since they - * have no runtime arg list (at this time) - */ - switch (Op->Asl.AmlOpcode) - { - case AML_IF_OP: - case AML_WHILE_OP: - case AML_RETURN_OP: - - if (ArgOp->Asl.ParseOpcode == PARSEOP_METHODCALL) - { - /* Check for an internal method */ - - if (AnIsInternalMethod (ArgOp)) - { - return (AE_OK); - } - - /* The lone arg is a method call, check it */ - - RequiredBtypes = AnMapArgTypeToBtype (ARGI_INTEGER); - if (Op->Asl.AmlOpcode == AML_RETURN_OP) - { - RequiredBtypes = 0xFFFFFFFF; - } - - ThisNodeBtype = AnGetBtype (ArgOp); - if (ThisNodeBtype == ACPI_UINT32_MAX) - { - return (AE_OK); - } - AnCheckMethodReturnValue (Op, OpInfo, ArgOp, - RequiredBtypes, ThisNodeBtype); - } - return (AE_OK); - - default: - break; - } - - /* Ignore the non-executable opcodes */ - - if (RuntimeArgTypes == ARGI_INVALID_OPCODE) - { - return (AE_OK); - } - - switch (OpcodeClass) - { - case AML_CLASS_EXECUTE: - case AML_CLASS_CREATE: - case AML_CLASS_CONTROL: - case AML_CLASS_RETURN_VALUE: - - /* TBD: Change class or fix typechecking for these */ - - if ((Op->Asl.AmlOpcode == AML_BUFFER_OP) || - (Op->Asl.AmlOpcode == AML_PACKAGE_OP) || - (Op->Asl.AmlOpcode == AML_VAR_PACKAGE_OP)) - { - break; - } - - /* Reverse the runtime argument list */ - - RuntimeArgTypes2 = 0; - while ((ArgType = GET_CURRENT_ARG_TYPE (RuntimeArgTypes))) - { - RuntimeArgTypes2 <<= ARG_TYPE_WIDTH; - RuntimeArgTypes2 |= ArgType; - INCREMENT_ARG_LIST (RuntimeArgTypes); - } - - while ((ArgType = GET_CURRENT_ARG_TYPE (RuntimeArgTypes2))) - { - RequiredBtypes = AnMapArgTypeToBtype (ArgType); - - ThisNodeBtype = AnGetBtype (ArgOp); - if (ThisNodeBtype == ACPI_UINT32_MAX) - { - goto NextArgument; - } - - /* Examine the arg based on the required type of the arg */ - - switch (ArgType) - { - case ARGI_TARGETREF: - - if (ArgOp->Asl.ParseOpcode == PARSEOP_ZERO) - { - /* ZERO is the placeholder for "don't store result" */ - - ThisNodeBtype = RequiredBtypes; - break; - } - - if (ArgOp->Asl.ParseOpcode == PARSEOP_INTEGER) - { - /* - * This is the case where an original reference to a resource - * descriptor field has been replaced by an (Integer) offset. - * These named fields are supported at compile-time only; - * the names are not passed to the interpreter (via the AML). - */ - if ((ArgOp->Asl.Node->Type == ACPI_TYPE_LOCAL_RESOURCE_FIELD) || - (ArgOp->Asl.Node->Type == ACPI_TYPE_LOCAL_RESOURCE)) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_FIELD, ArgOp, NULL); - } - else - { - AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ArgOp, NULL); - } - break; - } - - if ((ArgOp->Asl.ParseOpcode == PARSEOP_METHODCALL) || - (ArgOp->Asl.ParseOpcode == PARSEOP_DEREFOF)) - { - break; - } - - ThisNodeBtype = RequiredBtypes; - break; - - - case ARGI_REFERENCE: /* References */ - case ARGI_INTEGER_REF: - case ARGI_OBJECT_REF: - case ARGI_DEVICE_REF: - - switch (ArgOp->Asl.ParseOpcode) - { - case PARSEOP_LOCAL0: - case PARSEOP_LOCAL1: - case PARSEOP_LOCAL2: - case PARSEOP_LOCAL3: - case PARSEOP_LOCAL4: - case PARSEOP_LOCAL5: - case PARSEOP_LOCAL6: - case PARSEOP_LOCAL7: - - /* TBD: implement analysis of current value (type) of the local */ - /* For now, just treat any local as a typematch */ - - /*ThisNodeBtype = RequiredBtypes;*/ - break; - - case PARSEOP_ARG0: - case PARSEOP_ARG1: - case PARSEOP_ARG2: - case PARSEOP_ARG3: - case PARSEOP_ARG4: - case PARSEOP_ARG5: - case PARSEOP_ARG6: - - /* Hard to analyze argument types, sow we won't */ - /* For now, just treat any arg as a typematch */ - - /* ThisNodeBtype = RequiredBtypes; */ - break; - - case PARSEOP_DEBUG: - break; - - case PARSEOP_REFOF: - case PARSEOP_INDEX: - default: - break; - - } - break; - - case ARGI_INTEGER: - default: - break; - } - - - CommonBtypes = ThisNodeBtype & RequiredBtypes; - - if (ArgOp->Asl.ParseOpcode == PARSEOP_METHODCALL) - { - if (AnIsInternalMethod (ArgOp)) - { - return (AE_OK); - } - - /* Check a method call for a valid return value */ - - AnCheckMethodReturnValue (Op, OpInfo, ArgOp, - RequiredBtypes, ThisNodeBtype); - } - - /* - * Now check if the actual type(s) match at least one - * bit to the required type - */ - else if (!CommonBtypes) - { - /* No match -- this is a type mismatch error */ - - AnFormatBtype (StringBuffer, ThisNodeBtype); - AnFormatBtype (StringBuffer2, RequiredBtypes); - - sprintf (MsgBuffer, "[%s] found, %s operator requires [%s]", - StringBuffer, OpInfo->Name, StringBuffer2); - - AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ArgOp, MsgBuffer); - } - - NextArgument: - ArgOp = ArgOp->Asl.Next; - INCREMENT_ARG_LIST (RuntimeArgTypes2); - } - break; - - default: - break; - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AnIsResultUsed - * - * PARAMETERS: Op - Parent op for the operator - * - * RETURN: TRUE if result from this operation is actually consumed - * - * DESCRIPTION: Determine if the function result value from an operator is - * used. - * - ******************************************************************************/ - -BOOLEAN -AnIsResultUsed ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Parent; - - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_INCREMENT: - case PARSEOP_DECREMENT: - - /* These are standalone operators, no return value */ - - return (TRUE); - - default: - break; - } - - /* Examine parent to determine if the return value is used */ - - Parent = Op->Asl.Parent; - switch (Parent->Asl.ParseOpcode) - { - /* If/While - check if the operator is the predicate */ - - case PARSEOP_IF: - case PARSEOP_WHILE: - - /* First child is the predicate */ - - if (Parent->Asl.Child == Op) - { - return (TRUE); - } - return (FALSE); - - /* Not used if one of these is the parent */ - - case PARSEOP_METHOD: - case PARSEOP_DEFINITIONBLOCK: - case PARSEOP_ELSE: - - return (FALSE); - - default: - /* Any other type of parent means that the result is used */ - - return (TRUE); - } -} - - -/******************************************************************************* - * - * FUNCTION: AnOtherSemanticAnalysisWalkBegin - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Descending callback for the analysis walk. Checks for - * miscellaneous issues in the code. - * - ******************************************************************************/ - -ACPI_STATUS -AnOtherSemanticAnalysisWalkBegin ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ACPI_PARSE_OBJECT *ArgNode; - ACPI_PARSE_OBJECT *PrevArgNode = NULL; - const ACPI_OPCODE_INFO *OpInfo; - - - OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode); - - /* - * Determine if an execution class operator actually does something by - * checking if it has a target and/or the function return value is used. - * (Target is optional, so a standalone statement can actually do nothing.) - */ - if ((OpInfo->Class == AML_CLASS_EXECUTE) && - (OpInfo->Flags & AML_HAS_RETVAL) && - (!AnIsResultUsed (Op))) - { - if (OpInfo->Flags & AML_HAS_TARGET) - { - /* - * Find the target node, it is always the last child. If the traget - * is not specified in the ASL, a default node of type Zero was - * created by the parser. - */ - ArgNode = Op->Asl.Child; - while (ArgNode->Asl.Next) - { - PrevArgNode = ArgNode; - ArgNode = ArgNode->Asl.Next; - } - - /* Divide() is the only weird case, it has two targets */ - - if (Op->Asl.AmlOpcode == AML_DIVIDE_OP) - { - if ((ArgNode->Asl.ParseOpcode == PARSEOP_ZERO) && - (PrevArgNode->Asl.ParseOpcode == PARSEOP_ZERO)) - { - AslError (ASL_WARNING, ASL_MSG_RESULT_NOT_USED, Op, Op->Asl.ExternalName); - } - } - else if (ArgNode->Asl.ParseOpcode == PARSEOP_ZERO) - { - AslError (ASL_WARNING, ASL_MSG_RESULT_NOT_USED, Op, Op->Asl.ExternalName); - } - } - else - { - /* - * Has no target and the result is not used. Only a couple opcodes - * can have this combination. - */ - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_ACQUIRE: - case PARSEOP_WAIT: - case PARSEOP_LOADTABLE: - break; - - default: - AslError (ASL_WARNING, ASL_MSG_RESULT_NOT_USED, Op, Op->Asl.ExternalName); - break; - } - } - } - - - /* - * Semantic checks for individual ASL operators - */ - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_ACQUIRE: - case PARSEOP_WAIT: - /* - * Emit a warning if the timeout parameter for these operators is not - * ACPI_WAIT_FOREVER, and the result value from the operator is not - * checked, meaning that a timeout could happen, but the code - * would not know about it. - */ - - /* First child is the namepath, 2nd child is timeout */ - - ArgNode = Op->Asl.Child; - ArgNode = ArgNode->Asl.Next; - - /* - * Check for the WAIT_FOREVER case - defined by the ACPI spec to be - * 0xFFFF or greater - */ - if (((ArgNode->Asl.ParseOpcode == PARSEOP_WORDCONST) || - (ArgNode->Asl.ParseOpcode == PARSEOP_INTEGER)) && - (ArgNode->Asl.Value.Integer >= (UINT64) ACPI_WAIT_FOREVER)) - { - break; - } - - /* - * The operation could timeout. If the return value is not used - * (indicates timeout occurred), issue a warning - */ - if (!AnIsResultUsed (Op)) - { - AslError (ASL_WARNING, ASL_MSG_TIMEOUT, ArgNode, Op->Asl.ExternalName); - } - break; - - case PARSEOP_CREATEFIELD: - /* - * Check for a zero Length (NumBits) operand. NumBits is the 3rd operand - */ - ArgNode = Op->Asl.Child; - ArgNode = ArgNode->Asl.Next; - ArgNode = ArgNode->Asl.Next; - - if ((ArgNode->Asl.ParseOpcode == PARSEOP_ZERO) || - ((ArgNode->Asl.ParseOpcode == PARSEOP_INTEGER) && - (ArgNode->Asl.Value.Integer == 0))) - { - AslError (ASL_ERROR, ASL_MSG_NON_ZERO, ArgNode, NULL); - } - break; - - default: - break; - } - - return AE_OK; -} - - -/******************************************************************************* - * - * FUNCTION: AnOtherSemanticAnalysisWalkEnd - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Ascending callback for analysis walk. Complete method - * return analysis. - * - ******************************************************************************/ - -ACPI_STATUS -AnOtherSemanticAnalysisWalkEnd ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - - return AE_OK; - -} - - -#ifdef ACPI_OBSOLETE_FUNCTIONS -/******************************************************************************* - * - * FUNCTION: AnMapBtypeToEtype - * - * PARAMETERS: Btype - Bitfield of ACPI types - * - * RETURN: The Etype corresponding the the Btype - * - * DESCRIPTION: Convert a bitfield type to an encoded type - * - ******************************************************************************/ - -UINT32 -AnMapBtypeToEtype ( - UINT32 Btype) -{ - UINT32 i; - UINT32 Etype; - - - if (Btype == 0) - { - return 0; - } - - Etype = 1; - for (i = 1; i < Btype; i *= 2) - { - Etype++; - } - - return (Etype); -} -#endif - diff -Nru acpica-unix-20100528/compiler/aslcodegen.c acpica-unix-20140114/compiler/aslcodegen.c --- acpica-unix-20100528/compiler/aslcodegen.c 2010-05-28 17:14:22.000000000 +0000 +++ acpica-unix-20140114/compiler/aslcodegen.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,660 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslcodegen - AML code generation - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - - -#include "aslcompiler.h" -#include "aslcompiler.y.h" -#include "amlcode.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslcodegen") - -/* Local prototypes */ - -static ACPI_STATUS -CgAmlWriteWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -static void -CgLocalWriteAmlData ( - ACPI_PARSE_OBJECT *Op, - void *Buffer, - UINT32 Length); - -static void -CgWriteAmlOpcode ( - ACPI_PARSE_OBJECT *Op); - -static void -CgWriteTableHeader ( - ACPI_PARSE_OBJECT *Op); - -static void -CgCloseTable ( - void); - -static void -CgWriteNode ( - ACPI_PARSE_OBJECT *Op); - - -/******************************************************************************* - * - * FUNCTION: CgGenerateAmlOutput - * - * PARAMETERS: None. - * - * RETURN: None - * - * DESCRIPTION: Generate AML code. Currently generates the listing file - * simultaneously. - * - ******************************************************************************/ - -void -CgGenerateAmlOutput ( - void) -{ - - DbgPrint (ASL_DEBUG_OUTPUT, "\nWriting AML\n\n"); - - /* Generate the AML output file */ - - FlSeekFile (ASL_FILE_SOURCE_OUTPUT, 0); - Gbl_SourceLine = 0; - Gbl_NextError = Gbl_ErrorLog; - - TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, - CgAmlWriteWalk, NULL, NULL); - CgCloseTable (); -} - - -/******************************************************************************* - * - * FUNCTION: CgAmlWriteWalk - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Parse tree walk to generate the AML code. - * - ******************************************************************************/ - -static ACPI_STATUS -CgAmlWriteWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - - /* - * Print header at level 0. Alignment assumes 32-bit pointers - */ - if (!Level) - { - DbgPrint (ASL_TREE_OUTPUT, - "Final parse tree used for AML output:\n"); - DbgPrint (ASL_TREE_OUTPUT, - "%*s Value P_Op A_Op OpLen PByts Len SubLen PSubLen OpPtr Child Parent Flags AcTyp Final Col L\n", - 76, " "); - } - - /* Debug output */ - - DbgPrint (ASL_TREE_OUTPUT, - "%5.5d [%2d]", Op->Asl.LogicalLineNumber, Level); - UtPrintFormattedName (Op->Asl.ParseOpcode, Level); - - if (Op->Asl.ParseOpcode == PARSEOP_NAMESEG || - Op->Asl.ParseOpcode == PARSEOP_NAMESTRING || - Op->Asl.ParseOpcode == PARSEOP_METHODCALL) - { - DbgPrint (ASL_TREE_OUTPUT, - "%10.32s ", Op->Asl.ExternalName); - } - else - { - DbgPrint (ASL_TREE_OUTPUT, " "); - } - - DbgPrint (ASL_TREE_OUTPUT, - "%08X %04X %04X %01X %04X %04X %04X %04X %08X %08X %08X %08X %08X %04X %02d %02d\n", - /* 1 */ (UINT32) Op->Asl.Value.Integer, - /* 2 */ Op->Asl.ParseOpcode, - /* 3 */ Op->Asl.AmlOpcode, - /* 4 */ Op->Asl.AmlOpcodeLength, - /* 5 */ Op->Asl.AmlPkgLenBytes, - /* 6 */ Op->Asl.AmlLength, - /* 7 */ Op->Asl.AmlSubtreeLength, - /* 8 */ Op->Asl.Parent ? Op->Asl.Parent->Asl.AmlSubtreeLength : 0, - /* 9 */ Op, - /* 10 */ Op->Asl.Child, - /* 11 */ Op->Asl.Parent, - /* 12 */ Op->Asl.CompileFlags, - /* 13 */ Op->Asl.AcpiBtype, - /* 14 */ Op->Asl.FinalAmlLength, - /* 15 */ Op->Asl.Column, - /* 16 */ Op->Asl.LineNumber); - - /* Generate the AML for this node */ - - CgWriteNode (Op); - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: CgLocalWriteAmlData - * - * PARAMETERS: Op - Current parse op - * Buffer - Buffer to write - * Length - Size of data in buffer - * - * RETURN: None - * - * DESCRIPTION: Write a buffer of AML data to the AML output file. - * - ******************************************************************************/ - -static void -CgLocalWriteAmlData ( - ACPI_PARSE_OBJECT *Op, - void *Buffer, - UINT32 Length) -{ - - /* Write the raw data to the AML file */ - - FlWriteFile (ASL_FILE_AML_OUTPUT, Buffer, Length); - - /* Update the final AML length for this node (used for listings) */ - - if (Op) - { - Op->Asl.FinalAmlLength += Length; - } -} - - -/******************************************************************************* - * - * FUNCTION: CgWriteAmlOpcode - * - * PARAMETERS: Op - Parse node with an AML opcode - * - * RETURN: None. - * - * DESCRIPTION: Write the AML opcode corresponding to a parse node. - * - ******************************************************************************/ - -static void -CgWriteAmlOpcode ( - ACPI_PARSE_OBJECT *Op) -{ - UINT8 PkgLenFirstByte; - UINT32 i; - union { - UINT16 Opcode; - UINT8 OpcodeBytes[2]; - } Aml; - union { - UINT32 Len; - UINT8 LenBytes[4]; - } PkgLen; - - - /* We expect some DEFAULT_ARGs, just ignore them */ - - if (Op->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) - { - return; - } - - switch (Op->Asl.AmlOpcode) - { - case AML_UNASSIGNED_OPCODE: - - /* These opcodes should not get here */ - - printf ("Found a node with an unassigned AML opcode\n"); - fprintf (stderr, "Found a node with an unassigned AML opcode\n"); - return; - - case AML_INT_RESERVEDFIELD_OP: - - /* Special opcodes for within a field definition */ - - Aml.Opcode = 0x00; - break; - - case AML_INT_ACCESSFIELD_OP: - - Aml.Opcode = 0x01; - break; - - default: - Aml.Opcode = Op->Asl.AmlOpcode; - break; - } - - - switch (Aml.Opcode) - { - case AML_PACKAGE_LENGTH: - - /* Value is the length to be encoded (Used in field definitions) */ - - PkgLen.Len = (UINT32) Op->Asl.Value.Integer; - break; - - default: - - /* Check for two-byte opcode */ - - if (Aml.Opcode > 0x00FF) - { - /* Write the high byte first */ - - CgLocalWriteAmlData (Op, &Aml.OpcodeBytes[1], 1); - } - - CgLocalWriteAmlData (Op, &Aml.OpcodeBytes[0], 1); - - /* Subtreelength doesn't include length of package length bytes */ - - PkgLen.Len = Op->Asl.AmlSubtreeLength + Op->Asl.AmlPkgLenBytes; - break; - } - - /* Does this opcode have an associated "PackageLength" field? */ - - if (Op->Asl.CompileFlags & NODE_AML_PACKAGE) - { - if (Op->Asl.AmlPkgLenBytes == 1) - { - /* Simplest case -- no bytes to follow, just write the count */ - - CgLocalWriteAmlData (Op, &PkgLen.LenBytes[0], 1); - } - else if (Op->Asl.AmlPkgLenBytes != 0) - { - /* - * Encode the "bytes to follow" in the first byte, top two bits. - * The low-order nybble of the length is in the bottom 4 bits - */ - PkgLenFirstByte = (UINT8) - (((UINT32) (Op->Asl.AmlPkgLenBytes - 1) << 6) | - (PkgLen.LenBytes[0] & 0x0F)); - - CgLocalWriteAmlData (Op, &PkgLenFirstByte, 1); - - /* - * Shift the length over by the 4 bits we just stuffed - * in the first byte - */ - PkgLen.Len >>= 4; - - /* Now we can write the remaining bytes - either 1, 2, or 3 bytes */ - - for (i = 0; i < (UINT32) (Op->Asl.AmlPkgLenBytes - 1); i++) - { - CgLocalWriteAmlData (Op, &PkgLen.LenBytes[i], 1); - } - } - } - - switch (Aml.Opcode) - { - case AML_BYTE_OP: - - CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 1); - break; - - case AML_WORD_OP: - - CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 2); - break; - - case AML_DWORD_OP: - - CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 4); - break; - - case AML_QWORD_OP: - - CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 8); - break; - - case AML_STRING_OP: - - CgLocalWriteAmlData (Op, Op->Asl.Value.String, Op->Asl.AmlLength); - break; - - default: - /* All data opcodes must appear above */ - break; - } -} - - -/******************************************************************************* - * - * FUNCTION: CgWriteTableHeader - * - * PARAMETERS: Op - The DEFINITIONBLOCK node - * - * RETURN: None - * - * DESCRIPTION: Write a table header corresponding to the DEFINITIONBLOCK - * - ******************************************************************************/ - -static void -CgWriteTableHeader ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Child; - - - /* AML filename */ - - Child = Op->Asl.Child; - - /* Signature */ - - Child = Child->Asl.Next; - strncpy (TableHeader.Signature, Child->Asl.Value.String, 4); - - /* Revision */ - - Child = Child->Asl.Next; - TableHeader.Revision = (UINT8) Child->Asl.Value.Integer; - - /* Command-line Revision override */ - - if (Gbl_RevisionOverride) - { - TableHeader.Revision = Gbl_RevisionOverride; - } - - /* OEMID */ - - Child = Child->Asl.Next; - strncpy (TableHeader.OemId, Child->Asl.Value.String, 6); - - /* OEM TableID */ - - Child = Child->Asl.Next; - strncpy (TableHeader.OemTableId, Child->Asl.Value.String, 8); - - /* OEM Revision */ - - Child = Child->Asl.Next; - TableHeader.OemRevision = (UINT32) Child->Asl.Value.Integer; - - /* Compiler ID */ - - strncpy (TableHeader.AslCompilerId, CompilerCreatorId, 4); - - /* Compiler version */ - - TableHeader.AslCompilerRevision = CompilerCreatorRevision; - - /* Table length. Checksum zero for now, will rewrite later */ - - TableHeader.Length = Gbl_TableLength; - TableHeader.Checksum = 0; - - CgLocalWriteAmlData (Op, &TableHeader, sizeof (ACPI_TABLE_HEADER)); -} - - -/******************************************************************************* - * - * FUNCTION: CgCloseTable - * - * PARAMETERS: None. - * - * RETURN: None. - * - * DESCRIPTION: Complete the ACPI table by calculating the checksum and - * re-writing the header. - * - ******************************************************************************/ - -static void -CgCloseTable ( - void) -{ - signed char Sum; - UINT8 FileByte; - - - FlSeekFile (ASL_FILE_AML_OUTPUT, 0); - Sum = 0; - - /* Calculate the checksum over the entire file */ - - while (FlReadFile (ASL_FILE_AML_OUTPUT, &FileByte, 1) == AE_OK) - { - Sum = (signed char) (Sum + FileByte); - } - - /* Re-write the table header with the checksum */ - - TableHeader.Checksum = (UINT8) (0 - Sum); - - FlSeekFile (ASL_FILE_AML_OUTPUT, 0); - CgLocalWriteAmlData (NULL, &TableHeader, sizeof (ACPI_TABLE_HEADER)); -} - - -/******************************************************************************* - * - * FUNCTION: CgWriteNode - * - * PARAMETERS: Op - Parse node to write. - * - * RETURN: None. - * - * DESCRIPTION: Write the AML that corresponds to a parse node. - * - ******************************************************************************/ - -static void -CgWriteNode ( - ACPI_PARSE_OBJECT *Op) -{ - ASL_RESOURCE_NODE *Rnode; - - - /* Always check for DEFAULT_ARG and other "Noop" nodes */ - /* TBD: this may not be the best place for this check */ - - if ((Op->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) || - (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL) || - (Op->Asl.ParseOpcode == PARSEOP_INCLUDE) || - (Op->Asl.ParseOpcode == PARSEOP_INCLUDE_END)) - { - return; - } - - Op->Asl.FinalAmlLength = 0; - - switch (Op->Asl.AmlOpcode) - { - case AML_RAW_DATA_BYTE: - case AML_RAW_DATA_WORD: - case AML_RAW_DATA_DWORD: - case AML_RAW_DATA_QWORD: - - CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, Op->Asl.AmlLength); - return; - - - case AML_RAW_DATA_BUFFER: - - CgLocalWriteAmlData (Op, Op->Asl.Value.Buffer, Op->Asl.AmlLength); - return; - - - case AML_RAW_DATA_CHAIN: - - Rnode = ACPI_CAST_PTR (ASL_RESOURCE_NODE, Op->Asl.Value.Buffer); - while (Rnode) - { - CgLocalWriteAmlData (Op, Rnode->Buffer, Rnode->BufferLength); - Rnode = Rnode->Next; - } - return; - - default: - /* Internal data opcodes must all appear above */ - break; - } - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_DEFAULT_ARG: - - break; - - case PARSEOP_DEFINITIONBLOCK: - - CgWriteTableHeader (Op); - break; - - case PARSEOP_NAMESEG: - case PARSEOP_NAMESTRING: - case PARSEOP_METHODCALL: - - CgLocalWriteAmlData (Op, Op->Asl.Value.String, Op->Asl.AmlLength); - break; - - default: - - CgWriteAmlOpcode (Op); - break; - } -} - - diff -Nru acpica-unix-20100528/compiler/aslcompile.c acpica-unix-20140114/compiler/aslcompile.c --- acpica-unix-20100528/compiler/aslcompile.c 2010-05-28 17:14:22.000000000 +0000 +++ acpica-unix-20140114/compiler/aslcompile.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,920 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslcompile - top level compile module - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - -#include -#include -#include "aslcompiler.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslcompile") - -/* Local prototypes */ - -static void -CmFlushSourceCode ( - void); - -void -FlConsumeAnsiComment ( - ASL_FILE_INFO *FileInfo, - ASL_FILE_STATUS *Status); - -void -FlConsumeNewComment ( - ASL_FILE_INFO *FileInfo, - ASL_FILE_STATUS *Status); - - -/******************************************************************************* - * - * FUNCTION: AslCompilerSignon - * - * PARAMETERS: FileId - ID of the output file - * - * RETURN: None - * - * DESCRIPTION: Display compiler signon - * - ******************************************************************************/ - -void -AslCompilerSignon ( - UINT32 FileId) -{ - char *Prefix = ""; - - - /* Set line prefix depending on the destination file type */ - - switch (FileId) - { - case ASL_FILE_ASM_SOURCE_OUTPUT: - case ASL_FILE_ASM_INCLUDE_OUTPUT: - - Prefix = "; "; - break; - - case ASL_FILE_HEX_OUTPUT: - - if (Gbl_HexOutputFlag == HEX_OUTPUT_ASM) - { - Prefix = "; "; - } - else if ((Gbl_HexOutputFlag == HEX_OUTPUT_C) || - (Gbl_HexOutputFlag == HEX_OUTPUT_ASL)) - { - FlPrintFile (ASL_FILE_HEX_OUTPUT, "/*\n"); - Prefix = " * "; - } - break; - - case ASL_FILE_C_SOURCE_OUTPUT: - case ASL_FILE_C_INCLUDE_OUTPUT: - - Prefix = " * "; - break; - - default: - /* No other output types supported */ - break; - } - - /* - * Compiler signon with copyright - */ - FlPrintFile (FileId, - "%s\n%s%s\n%s", - Prefix, - Prefix, IntelAcpiCA, - Prefix); - - /* Running compiler or disassembler? */ - - if (Gbl_DisasmFlag) - { - FlPrintFile (FileId, - "%s", DisassemblerId); - } - else - { - FlPrintFile (FileId, - "%s", CompilerId); - } - - /* Version, build date, copyright, compliance */ - - FlPrintFile (FileId, - " version %X [%s]\n%s%s\n%s%s\n%s\n", - (UINT32) ACPI_CA_VERSION, __DATE__, - Prefix, CompilerCopyright, - Prefix, CompilerCompliance, - Prefix); -} - - -/******************************************************************************* - * - * FUNCTION: AslCompilerFileHeader - * - * PARAMETERS: FileId - ID of the output file - * - * RETURN: None - * - * DESCRIPTION: Header used at the beginning of output files - * - ******************************************************************************/ - -void -AslCompilerFileHeader ( - UINT32 FileId) -{ - struct tm *NewTime; - time_t Aclock; - char *Prefix = ""; - - - /* Set line prefix depending on the destination file type */ - - switch (FileId) - { - case ASL_FILE_ASM_SOURCE_OUTPUT: - case ASL_FILE_ASM_INCLUDE_OUTPUT: - - Prefix = "; "; - break; - - case ASL_FILE_HEX_OUTPUT: - - if (Gbl_HexOutputFlag == HEX_OUTPUT_ASM) - { - Prefix = "; "; - } - else if ((Gbl_HexOutputFlag == HEX_OUTPUT_C) || - (Gbl_HexOutputFlag == HEX_OUTPUT_ASL)) - { - Prefix = " * "; - } - break; - - case ASL_FILE_C_SOURCE_OUTPUT: - case ASL_FILE_C_INCLUDE_OUTPUT: - - Prefix = " * "; - break; - - default: - /* No other output types supported */ - break; - } - - /* Compilation header with timestamp */ - - (void) time (&Aclock); - NewTime = localtime (&Aclock); - - FlPrintFile (FileId, - "%sCompilation of \"%s\" - %s%s\n", - Prefix, Gbl_Files[ASL_FILE_INPUT].Filename, asctime (NewTime), - Prefix); - - switch (FileId) - { - case ASL_FILE_C_SOURCE_OUTPUT: - case ASL_FILE_C_INCLUDE_OUTPUT: - FlPrintFile (FileId, " */\n"); - break; - - default: - /* Nothing to do for other output types */ - break; - } -} - - -/******************************************************************************* - * - * FUNCTION: CmFlushSourceCode - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Read in any remaining source code after the parse tree - * has been constructed. - * - ******************************************************************************/ - -static void -CmFlushSourceCode ( - void) -{ - char Buffer; - - - while (FlReadFile (ASL_FILE_INPUT, &Buffer, 1) != AE_ERROR) - { - InsertLineBuffer ((int) Buffer); - } - - ResetCurrentLineBuffer (); -} - - -/******************************************************************************* - * - * FUNCTION: FlConsume* - * - * PARAMETERS: FileInfo - Points to an open input file - * - * RETURN: Number of lines consumed - * - * DESCRIPTION: Step over both types of comment during check for ascii chars - * - ******************************************************************************/ - -void -FlConsumeAnsiComment ( - ASL_FILE_INFO *FileInfo, - ASL_FILE_STATUS *Status) -{ - UINT8 Byte; - BOOLEAN ClosingComment = FALSE; - - - while (fread (&Byte, 1, 1, FileInfo->Handle)) - { - /* Scan until comment close is found */ - - if (ClosingComment) - { - if (Byte == '/') - { - return; - } - - if (Byte != '*') - { - /* Reset */ - - ClosingComment = FALSE; - } - } - else if (Byte == '*') - { - ClosingComment = TRUE; - } - - /* Maintain line count */ - - if (Byte == 0x0A) - { - Status->Line++; - } - - Status->Offset++; - } -} - - -void -FlConsumeNewComment ( - ASL_FILE_INFO *FileInfo, - ASL_FILE_STATUS *Status) -{ - UINT8 Byte; - - - while (fread (&Byte, 1, 1, FileInfo->Handle)) - { - Status->Offset++; - - /* Comment ends at newline */ - - if (Byte == 0x0A) - { - Status->Line++; - return; - } - } -} - - -/******************************************************************************* - * - * FUNCTION: FlCheckForAscii - * - * PARAMETERS: FileInfo - Points to an open input file - * - * RETURN: Status - * - * DESCRIPTION: Verify that the input file is entirely ASCII. Ignores characters - * within comments. Note: does not handle nested comments and does - * not handle comment delimiters within string literals. However, - * on the rare chance this happens and an invalid character is - * missed, the parser will catch the error by failing in some - * spectactular manner. - * - ******************************************************************************/ - -ACPI_STATUS -FlCheckForAscii ( - ASL_FILE_INFO *FileInfo) -{ - UINT8 Byte; - ACPI_SIZE BadBytes = 0; - BOOLEAN OpeningComment = FALSE; - ASL_FILE_STATUS Status; - - - Status.Line = 1; - Status.Offset = 0; - - /* Read the entire file */ - - while (fread (&Byte, 1, 1, FileInfo->Handle)) - { - /* Ignore comment fields (allow non-ascii within) */ - - if (OpeningComment) - { - /* Check for second comment open delimiter */ - - if (Byte == '*') - { - FlConsumeAnsiComment (FileInfo, &Status); - } - - if (Byte == '/') - { - FlConsumeNewComment (FileInfo, &Status); - } - - /* Reset */ - - OpeningComment = FALSE; - } - else if (Byte == '/') - { - OpeningComment = TRUE; - } - - /* Check for an ASCII character */ - - if (!ACPI_IS_ASCII (Byte)) - { - if (BadBytes < 10) - { - AcpiOsPrintf ( - "Non-ASCII character [0x%2.2X] found in line %u, file offset 0x%.2X\n", - Byte, Status.Line, Status.Offset); - } - - BadBytes++; - } - - /* Update line counter */ - - else if (Byte == 0x0A) - { - Status.Line++; - } - - Status.Offset++; - } - - /* Seek back to the beginning of the source file */ - - fseek (FileInfo->Handle, 0, SEEK_SET); - - /* Were there any non-ASCII characters in the file? */ - - if (BadBytes) - { - AcpiOsPrintf ( - "%u non-ASCII characters found in input source text, could be a binary file\n", - BadBytes); - AslError (ASL_ERROR, ASL_MSG_NON_ASCII, NULL, FileInfo->Filename); - return (AE_BAD_CHARACTER); - } - - /* File is OK */ - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: CmDoCompile - * - * PARAMETERS: None - * - * RETURN: Status (0 = OK) - * - * DESCRIPTION: This procedure performs the entire compile - * - ******************************************************************************/ - -int -CmDoCompile ( - void) -{ - ACPI_STATUS Status; - UINT8 FullCompile; - UINT8 Event; - - - FullCompile = UtBeginEvent ("*** Total Compile time ***"); - Event = UtBeginEvent ("Open input and output files"); - UtEndEvent (Event); - - /* Build the parse tree */ - - Event = UtBeginEvent ("Parse source code and build parse tree"); - AslCompilerparse(); - UtEndEvent (Event); - - /* Flush out any remaining source after parse tree is complete */ - - Event = UtBeginEvent ("Flush source input"); - CmFlushSourceCode (); - - /* Did the parse tree get successfully constructed? */ - - if (!RootNode) - { - CmCleanupAndExit (); - return -1; - } - - /* Optional parse tree dump, compiler debug output only */ - - LsDumpParseTree (); - - OpcGetIntegerWidth (RootNode); - UtEndEvent (Event); - - /* Pre-process parse tree for any operator transforms */ - - Event = UtBeginEvent ("Parse tree transforms"); - DbgPrint (ASL_DEBUG_OUTPUT, "\nParse tree transforms\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, - TrAmlTransformWalk, NULL, NULL); - UtEndEvent (Event); - - /* Generate AML opcodes corresponding to the parse tokens */ - - Event = UtBeginEvent ("Generate AML opcodes"); - DbgPrint (ASL_DEBUG_OUTPUT, "\nGenerating AML opcodes\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, - OpcAmlOpcodeWalk, NULL); - UtEndEvent (Event); - - /* - * Now that the input is parsed, we can open the AML output file. - * Note: by default, the name of this file comes from the table descriptor - * within the input file. - */ - Event = UtBeginEvent ("Open AML output file"); - Status = FlOpenAmlOutputFile (Gbl_OutputFilenamePrefix); - if (ACPI_FAILURE (Status)) - { - AePrintErrorLog (ASL_FILE_STDERR); - return -1; - } - UtEndEvent (Event); - - /* Interpret and generate all compile-time constants */ - - Event = UtBeginEvent ("Constant folding via AML interpreter"); - DbgPrint (ASL_DEBUG_OUTPUT, - "\nInterpreting compile-time constant expressions\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, - OpcAmlConstantWalk, NULL, NULL); - UtEndEvent (Event); - - /* Update AML opcodes if necessary, after constant folding */ - - Event = UtBeginEvent ("Updating AML opcodes after constant folding"); - DbgPrint (ASL_DEBUG_OUTPUT, - "\nUpdating AML opcodes after constant folding\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, - NULL, OpcAmlOpcodeUpdateWalk, NULL); - UtEndEvent (Event); - - /* Calculate all AML package lengths */ - - Event = UtBeginEvent ("Generate AML package lengths"); - DbgPrint (ASL_DEBUG_OUTPUT, "\nGenerating Package lengths\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, - LnPackageLengthWalk, NULL); - UtEndEvent (Event); - - if (Gbl_ParseOnlyFlag) - { - AePrintErrorLog (ASL_FILE_STDOUT); - UtDisplaySummary (ASL_FILE_STDOUT); - if (Gbl_DebugFlag) - { - /* Print error summary to the debug file */ - - AePrintErrorLog (ASL_FILE_STDERR); - UtDisplaySummary (ASL_FILE_STDERR); - } - return 0; - } - - /* - * Create an internal namespace and use it as a symbol table - */ - - /* Namespace loading */ - - Event = UtBeginEvent ("Create ACPI Namespace"); - Status = LdLoadNamespace (RootNode); - UtEndEvent (Event); - if (ACPI_FAILURE (Status)) - { - return -1; - } - - /* Namespace cross-reference */ - - AslGbl_NamespaceEvent = UtBeginEvent ("Cross reference parse tree and Namespace"); - Status = LkCrossReferenceNamespace (); - if (ACPI_FAILURE (Status)) - { - return -1; - } - - /* Namespace - Check for non-referenced objects */ - - LkFindUnreferencedObjects (); - UtEndEvent (AslGbl_NamespaceEvent); - - /* - * Semantic analysis. This can happen only after the - * namespace has been loaded and cross-referenced. - * - * part one - check control methods - */ - Event = UtBeginEvent ("Analyze control method return types"); - AnalysisWalkInfo.MethodStack = NULL; - - DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Method analysis\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, - AnMethodAnalysisWalkBegin, - AnMethodAnalysisWalkEnd, &AnalysisWalkInfo); - UtEndEvent (Event); - - /* Semantic error checking part two - typing of method returns */ - - Event = UtBeginEvent ("Determine object types returned by methods"); - DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Method typing\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, - AnMethodTypingWalkBegin, - AnMethodTypingWalkEnd, NULL); - UtEndEvent (Event); - - /* Semantic error checking part three - operand type checking */ - - Event = UtBeginEvent ("Analyze AML operand types"); - DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Operand type checking\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, - AnOperandTypecheckWalkBegin, - AnOperandTypecheckWalkEnd, &AnalysisWalkInfo); - UtEndEvent (Event); - - /* Semantic error checking part four - other miscellaneous checks */ - - Event = UtBeginEvent ("Miscellaneous analysis"); - DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - miscellaneous\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, - AnOtherSemanticAnalysisWalkBegin, - AnOtherSemanticAnalysisWalkEnd, &AnalysisWalkInfo); - UtEndEvent (Event); - - /* Calculate all AML package lengths */ - - Event = UtBeginEvent ("Finish AML package length generation"); - DbgPrint (ASL_DEBUG_OUTPUT, "\nGenerating Package lengths\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, - LnInitLengthsWalk, NULL); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, - LnPackageLengthWalk, NULL); - UtEndEvent (Event); - - /* Code generation - emit the AML */ - - Event = UtBeginEvent ("Generate AML code and write output files"); - CgGenerateAmlOutput (); - UtEndEvent (Event); - - Event = UtBeginEvent ("Write optional output files"); - CmDoOutputFiles (); - UtEndEvent (Event); - - UtEndEvent (FullCompile); - CmCleanupAndExit (); - return 0; -} - - -/******************************************************************************* - * - * FUNCTION: CmDoOutputFiles - * - * PARAMETERS: None - * - * RETURN: None. - * - * DESCRIPTION: Create all "listing" type files - * - ******************************************************************************/ - -void -CmDoOutputFiles ( - void) -{ - - /* Create listings and hex files */ - - LsDoListings (); - LsDoHexOutput (); - - /* Dump the namespace to the .nsp file if requested */ - - (void) LsDisplayNamespace (); -} - - -/******************************************************************************* - * - * FUNCTION: CmDumpEvent - * - * PARAMETERS: Event - A compiler event struct - * - * RETURN: None. - * - * DESCRIPTION: Dump a compiler event struct - * - ******************************************************************************/ - -static void -CmDumpEvent ( - ASL_EVENT_INFO *Event) -{ - UINT32 Delta; - UINT32 USec; - UINT32 MSec; - - if (!Event->Valid) - { - return; - } - - /* Delta will be in 100-nanosecond units */ - - Delta = (UINT32) (Event->EndTime - Event->StartTime); - - USec = Delta / 10; - MSec = Delta / 10000; - - /* Round milliseconds up */ - - if ((USec - (MSec * 1000)) >= 500) - { - MSec++; - } - - DbgPrint (ASL_DEBUG_OUTPUT, "%8u usec %8u msec - %s\n", - USec, MSec, Event->EventName); -} - - -/******************************************************************************* - * - * FUNCTION: CmCleanupAndExit - * - * PARAMETERS: None - * - * RETURN: None. - * - * DESCRIPTION: Close all open files and exit the compiler - * - ******************************************************************************/ - -void -CmCleanupAndExit ( - void) -{ - UINT32 i; - - - AePrintErrorLog (ASL_FILE_STDOUT); - if (Gbl_DebugFlag) - { - /* Print error summary to the debug file */ - - AePrintErrorLog (ASL_FILE_STDERR); - } - - DbgPrint (ASL_DEBUG_OUTPUT, "\n\nElapsed time for major events\n\n"); - for (i = 0; i < AslGbl_NextEvent; i++) - { - CmDumpEvent (&AslGbl_Events[i]); - } - - if (Gbl_CompileTimesFlag) - { - printf ("\nElapsed time for major events\n\n"); - for (i = 0; i < AslGbl_NextEvent; i++) - { - CmDumpEvent (&AslGbl_Events[i]); - } - - printf ("\nMiscellaneous compile statistics\n\n"); - printf ("%11u : %s\n", TotalParseNodes, "Parse nodes"); - printf ("%11u : %s\n", Gbl_NsLookupCount, "Namespace searches"); - printf ("%11u : %s\n", TotalNamedObjects, "Named objects"); - printf ("%11u : %s\n", TotalMethods, "Control methods"); - printf ("%11u : %s\n", TotalAllocations, "Memory Allocations"); - printf ("%11u : %s\n", TotalAllocated, "Total allocated memory"); - printf ("%11u : %s\n", TotalFolds, "Constant subtrees folded"); - printf ("\n"); - } - - if (Gbl_NsLookupCount) - { - DbgPrint (ASL_DEBUG_OUTPUT, - "\n\nMiscellaneous compile statistics\n\n"); - - DbgPrint (ASL_DEBUG_OUTPUT, - "%32s : %u\n", "Total Namespace searches", - Gbl_NsLookupCount); - - DbgPrint (ASL_DEBUG_OUTPUT, - "%32s : %u usec\n", "Time per search", ((UINT32) - (AslGbl_Events[AslGbl_NamespaceEvent].EndTime - - AslGbl_Events[AslGbl_NamespaceEvent].StartTime) / 10) / - Gbl_NsLookupCount); - } - - if (Gbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT) - { - printf ("\nMaximum error count (%u) exceeded\n", - ASL_MAX_ERROR_COUNT); - } - - UtDisplaySummary (ASL_FILE_STDOUT); - - /* Close all open files */ - - for (i = 2; i < ASL_MAX_FILE_TYPE; i++) - { - FlCloseFile (i); - } - - /* Delete AML file if there are errors */ - - if ((Gbl_ExceptionCount[ASL_ERROR] > 0) && (!Gbl_IgnoreErrors) && - Gbl_Files[ASL_FILE_AML_OUTPUT].Handle) - { - if (remove (Gbl_Files[ASL_FILE_AML_OUTPUT].Filename)) - { - printf ("%s: ", - Gbl_Files[ASL_FILE_AML_OUTPUT].Filename); - perror ("Could not delete AML file"); - } - } - - /* - * Delete intermediate ("combined") source file (if -ls flag not set) - * - * TBD: SourceOutput should be .TMP, then rename if we want to keep it? - */ - if (!Gbl_SourceOutputFlag) - { - if (remove (Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename)) - { - printf ("%s: ", - Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); - perror ("Could not delete SRC file"); - } - } -} - - diff -Nru acpica-unix-20100528/compiler/aslcompiler.h acpica-unix-20140114/compiler/aslcompiler.h --- acpica-unix-20100528/compiler/aslcompiler.h 2010-05-28 17:14:22.000000000 +0000 +++ acpica-unix-20140114/compiler/aslcompiler.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,1028 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslcompiler.h - common include file for iASL - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - - -#ifndef __ASLCOMPILER_H -#define __ASLCOMPILER_H - - -/* Microsoft-specific */ - -#if (defined WIN32 || defined WIN64) - -/* warn : used #pragma pack */ -#pragma warning(disable:4103) - -/* warn : named type definition in parentheses */ -#pragma warning(disable:4115) -#endif - -#include -#include -#include -#include -#include -#include - - -#include "acpi.h" -#include "accommon.h" -#include "amlresrc.h" -#include "acdebug.h" - -/* Compiler headers */ - -#include "asldefine.h" -#include "asltypes.h" -#include "aslglobal.h" - - -/******************************************************************************* - * - * Compiler prototypes - * - ******************************************************************************/ - -/* - * parser - generated from flex/bison, lex/yacc, etc. - */ -int -AslCompilerparse( - void); - -ACPI_PARSE_OBJECT * -AslDoError ( - void); - -int -AslCompilerlex( - void); - -void -ResetCurrentLineBuffer ( - void); - -void -InsertLineBuffer ( - int SourceChar); - -int -AslPopInputFileStack ( - void); - -void -AslPushInputFileStack ( - FILE *InputFile, - char *Filename); - -/* - * aslstartup - called from main - */ -ACPI_STATUS -AslDoOnePathname ( - char *Pathname); - -ACPI_STATUS -AslDoOneFile ( - char *Filename); - -/* - * aslcompile - compile mainline - */ -void -AslCompilerSignon ( - UINT32 FileId); - -void -AslCompilerFileHeader ( - UINT32 FileId); - -int -CmDoCompile ( - void); - -void -CmDoOutputFiles ( - void); - -void -CmCleanupAndExit ( - void); - -ACPI_STATUS -FlCheckForAscii ( - ASL_FILE_INFO *FileInfo); - - -/* - * aslanalyze - semantic analysis - */ -ACPI_STATUS -AnOtherSemanticAnalysisWalkBegin ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -ACPI_STATUS -AnOtherSemanticAnalysisWalkEnd ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -ACPI_STATUS -AnOperandTypecheckWalkBegin ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -ACPI_STATUS -AnOperandTypecheckWalkEnd ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -ACPI_STATUS -AnMethodAnalysisWalkBegin ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -ACPI_STATUS -AnMethodAnalysisWalkEnd ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -ACPI_STATUS -AnMethodTypingWalkBegin ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -ACPI_STATUS -AnMethodTypingWalkEnd ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - - -/* - * aslerror - error handling/reporting - */ -void -AslError ( - UINT8 Level, - UINT8 MessageId, - ACPI_PARSE_OBJECT *Op, - char *ExtraMessage); - -void -AslCoreSubsystemError ( - ACPI_PARSE_OBJECT *Op, - ACPI_STATUS Status, - char *ExtraMessage, - BOOLEAN Abort); - -int -AslCompilererror( - char *s); - -void -AslCommonError ( - UINT8 Level, - UINT8 MessageId, - UINT32 CurrentLineNumber, - UINT32 LogicalLineNumber, - UINT32 LogicalByteOffset, - UINT32 Column, - char *Filename, - char *ExtraMessage); - -void -AePrintException ( - UINT32 FileId, - ASL_ERROR_MSG *Enode, - char *Header); - -void -AePrintErrorLog ( - UINT32 FileId); - -void -AeClearErrorLog ( - void); - -ACPI_PHYSICAL_ADDRESS -AeLocalGetRootPointer ( - void); - - -/* - * asllisting - generate all "listing" type files - */ -void -LsDoListings ( - void); - -void -LsWriteNodeToAsmListing ( - ACPI_PARSE_OBJECT *Op); - -void -LsWriteNode ( - ACPI_PARSE_OBJECT *Op, - UINT32 FileId); - -void -LsDoHexOutput ( - void); - -void -LsDumpParseTree ( - void); - -/* - * aslfold - constant folding - */ -ACPI_STATUS -OpcAmlConstantWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - - -/* - * aslopcodes - generate AML opcodes - */ -ACPI_STATUS -OpcAmlOpcodeWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -ACPI_STATUS -OpcAmlOpcodeUpdateWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -void -OpcGenerateAmlOpcode ( - ACPI_PARSE_OBJECT *Op); - -UINT32 -OpcSetOptimalIntegerSize ( - ACPI_PARSE_OBJECT *Op); - -void -OpcGetIntegerWidth ( - ACPI_PARSE_OBJECT *Op); - - -/* - * asloperands - generate AML operands for the AML opcodes - */ -ACPI_PARSE_OBJECT * -UtGetArg ( - ACPI_PARSE_OBJECT *Op, - UINT32 Argn); - -void -OpnGenerateAmlOperands ( - ACPI_PARSE_OBJECT *Op); - -void -OpnDoPackage ( - ACPI_PARSE_OBJECT *Op); - - -/* - * aslopt - optmization - */ -void -OptOptimizeNamePath ( - ACPI_PARSE_OBJECT *Op, - UINT32 Flags, - ACPI_WALK_STATE *WalkState, - char *AmlNameString, - ACPI_NAMESPACE_NODE *TargetNode); - - -/* - * aslcodegen - code generation - */ -void -CgGenerateAmlOutput ( - void); - - -/* - * aslfile - */ -void -FlOpenFile ( - UINT32 FileId, - char *Filename, - char *Mode); - - -/* - * asllength - calculate/adjust AML package lengths - */ -ACPI_STATUS -LnPackageLengthWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -ACPI_STATUS -LnInitLengthsWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -void -CgGenerateAmlLengths ( - ACPI_PARSE_OBJECT *Op); - - -/* - * aslmap - opcode mappings and reserved method names - */ -ACPI_OBJECT_TYPE -AslMapNamedOpcodeToDataType ( - UINT16 Opcode); - - -/* - * aslpredef - ACPI predefined names support - */ -void -ApCheckForPredefinedMethod ( - ACPI_PARSE_OBJECT *Op, - ASL_METHOD_INFO *MethodInfo); - -void -ApCheckPredefinedReturnValue ( - ACPI_PARSE_OBJECT *Op, - ASL_METHOD_INFO *MethodInfo); - -UINT32 -ApCheckForPredefinedName ( - ACPI_PARSE_OBJECT *Op, - char *Name); - -void -ApCheckForPredefinedObject ( - ACPI_PARSE_OBJECT *Op, - char *Name); - -void -ApDisplayReservedNames ( - void); - - -/* - * asltransform - parse tree transformations - */ -ACPI_STATUS -TrAmlTransformWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - - -/* - * asltree - parse tree support - */ -ACPI_STATUS -TrWalkParseTree ( - ACPI_PARSE_OBJECT *Op, - UINT32 Visitation, - ASL_WALK_CALLBACK DescendingCallback, - ASL_WALK_CALLBACK AscendingCallback, - void *Context); - -/* Values for "Visitation" parameter above */ - -#define ASL_WALK_VISIT_DOWNWARD 0x01 -#define ASL_WALK_VISIT_UPWARD 0x02 -#define ASL_WALK_VISIT_TWICE (ASL_WALK_VISIT_DOWNWARD | ASL_WALK_VISIT_UPWARD) - - -ACPI_PARSE_OBJECT * -TrAllocateNode ( - UINT32 ParseOpcode); - -void -TrReleaseNode ( - ACPI_PARSE_OBJECT *Op); - -ACPI_PARSE_OBJECT * -TrUpdateNode ( - UINT32 ParseOpcode, - ACPI_PARSE_OBJECT *Op); - -ACPI_PARSE_OBJECT * -TrCreateNode ( - UINT32 ParseOpcode, - UINT32 NumChildren, - ...); - -ACPI_PARSE_OBJECT * -TrCreateLeafNode ( - UINT32 ParseOpcode); - -ACPI_PARSE_OBJECT * -TrCreateValuedLeafNode ( - UINT32 ParseOpcode, - UINT64 Value); - -ACPI_PARSE_OBJECT * -TrLinkChildren ( - ACPI_PARSE_OBJECT *Op, - UINT32 NumChildren, - ...); - -void -TrSetEndLineNumber ( - ACPI_PARSE_OBJECT *Op); - -void -TrWalkTree ( - void); - -ACPI_PARSE_OBJECT * -TrLinkPeerNode ( - ACPI_PARSE_OBJECT *Op1, - ACPI_PARSE_OBJECT *Op2); - -ACPI_PARSE_OBJECT * -TrLinkChildNode ( - ACPI_PARSE_OBJECT *Op1, - ACPI_PARSE_OBJECT *Op2); - -ACPI_PARSE_OBJECT * -TrSetNodeFlags ( - ACPI_PARSE_OBJECT *Op, - UINT32 Flags); - -ACPI_PARSE_OBJECT * -TrLinkPeerNodes ( - UINT32 NumPeers, - ...); - - -/* - * aslfiles - File I/O support - */ -void -AslAbort ( - void); - -void -FlAddIncludeDirectory ( - char *Dir); - -void -FlOpenIncludeFile ( - ACPI_PARSE_OBJECT *Op); - -void -FlFileError ( - UINT32 FileId, - UINT8 ErrorId); - -UINT32 -FlGetFileSize ( - UINT32 FileId); - -ACPI_STATUS -FlReadFile ( - UINT32 FileId, - void *Buffer, - UINT32 Length); - -void -FlWriteFile ( - UINT32 FileId, - void *Buffer, - UINT32 Length); - -void -FlSeekFile ( - UINT32 FileId, - long Offset); - -void -FlCloseFile ( - UINT32 FileId); - -void -FlPrintFile ( - UINT32 FileId, - char *Format, - ...); - -void -FlSetLineNumber ( - ACPI_PARSE_OBJECT *Op); - -ACPI_STATUS -FlOpenInputFile ( - char *InputFilename); - -ACPI_STATUS -FlOpenAmlOutputFile ( - char *InputFilename); - -ACPI_STATUS -FlOpenMiscOutputFiles ( - char *InputFilename); - - -/* - * asload - load namespace in prep for cross reference - */ -ACPI_STATUS -LdLoadNamespace ( - ACPI_PARSE_OBJECT *RootOp); - - -/* - * asllookup - namespace cross reference - */ -ACPI_STATUS -LkCrossReferenceNamespace ( - void); - -void -LkFindUnreferencedObjects ( - void); - -ACPI_STATUS -LsDisplayNamespace ( - void); - - -/* - * aslutils - common compiler utilites - */ -void -DbgPrint ( - UINT32 Type, - char *Format, - ...); - -/* Type values for above */ - -#define ASL_DEBUG_OUTPUT 0 -#define ASL_PARSE_OUTPUT 1 -#define ASL_TREE_OUTPUT 2 - -void -UtDisplayConstantOpcodes ( - void); - -UINT8 -UtBeginEvent ( - char *Name); - -void -UtEndEvent ( - UINT8 Event); - -void * -UtLocalCalloc ( - UINT32 Size); - -void -UtPrintFormattedName ( - UINT16 ParseOpcode, - UINT32 Level); - -void -UtDisplaySummary ( - UINT32 FileId); - -UINT8 -UtHexCharToValue ( - int HexChar); - -void -UtConvertByteToHex ( - UINT8 RawByte, - UINT8 *Buffer); - -void -UtConvertByteToAsmHex ( - UINT8 RawByte, - UINT8 *Buffer); - -char * -UtGetOpName ( - UINT32 ParseOpcode); - -void -UtSetParseOpName ( - ACPI_PARSE_OBJECT *Op); - -char * -UtGetStringBuffer ( - UINT32 Length); - -ACPI_STATUS -UtInternalizeName ( - char *ExternalName, - char **ConvertedName); - -void -UtAttachNamepathToOwner ( - ACPI_PARSE_OBJECT *Op, - ACPI_PARSE_OBJECT *NameNode); - -ACPI_PARSE_OBJECT * -UtCheckIntegerRange ( - ACPI_PARSE_OBJECT *Op, - UINT32 LowValue, - UINT32 HighValue); - -UINT64 -UtDoConstant ( - char *String); - - -/* - * aslresource - Resource template generation utilities - */ -void -RsSmallAddressCheck ( - UINT8 Type, - UINT32 Minimum, - UINT32 Maximum, - UINT32 Length, - UINT32 Alignment, - ACPI_PARSE_OBJECT *MinOp, - ACPI_PARSE_OBJECT *MaxOp, - ACPI_PARSE_OBJECT *LengthOp, - ACPI_PARSE_OBJECT *AlignOp); - -void -RsLargeAddressCheck ( - UINT64 Minimum, - UINT64 Maximum, - UINT64 Length, - UINT64 Granularity, - UINT8 Flags, - ACPI_PARSE_OBJECT *MinOp, - ACPI_PARSE_OBJECT *MaxOp, - ACPI_PARSE_OBJECT *LengthOp, - ACPI_PARSE_OBJECT *GranOp); - -UINT16 -RsGetStringDataLength ( - ACPI_PARSE_OBJECT *InitializerOp); - -ASL_RESOURCE_NODE * -RsAllocateResourceNode ( - UINT32 Size); - -void -RsCreateBitField ( - ACPI_PARSE_OBJECT *Op, - char *Name, - UINT32 ByteOffset, - UINT32 BitOffset); - -void -RsCreateByteField ( - ACPI_PARSE_OBJECT *Op, - char *Name, - UINT32 ByteOffset); - -void -RsSetFlagBits ( - UINT8 *Flags, - ACPI_PARSE_OBJECT *Op, - UINT8 Position, - UINT8 DefaultBit); - -ACPI_PARSE_OBJECT * -RsCompleteNodeAndGetNext ( - ACPI_PARSE_OBJECT *Op); - -void -RsCheckListForDuplicates ( - ACPI_PARSE_OBJECT *Op); - -ASL_RESOURCE_NODE * -RsDoOneResourceDescriptor ( - ACPI_PARSE_OBJECT *DescriptorTypeOp, - UINT32 CurrentByteOffset, - UINT8 *State); - -/* Values for State above */ - -#define ACPI_RSTATE_NORMAL 0 -#define ACPI_RSTATE_START_DEPENDENT 1 -#define ACPI_RSTATE_DEPENDENT_LIST 2 - -UINT32 -RsLinkDescriptorChain ( - ASL_RESOURCE_NODE **PreviousRnode, - ASL_RESOURCE_NODE *Rnode); - -void -RsDoResourceTemplate ( - ACPI_PARSE_OBJECT *Op); - - -/* - * aslrestype1 - Miscellaneous Small descriptors - */ -ASL_RESOURCE_NODE * -RsDoEndTagDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoEndDependentDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoMemory24Descriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoMemory32Descriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoMemory32FixedDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoStartDependentDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoStartDependentNoPriDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoVendorSmallDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - - -/* - * aslrestype1i - I/O-related Small descriptors - */ -ASL_RESOURCE_NODE * -RsDoDmaDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoFixedIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoIrqDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoIrqNoFlagsDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - - -/* - * aslrestype2 - Large resource descriptors - */ -ASL_RESOURCE_NODE * -RsDoInterruptDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoVendorLargeDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoGeneralRegisterDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - - -/* - * aslrestype2d - DWord address descriptors - */ -ASL_RESOURCE_NODE * -RsDoDwordIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoDwordMemoryDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoDwordSpaceDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - - -/* - * aslrestype2e - Extended address descriptors - */ -ASL_RESOURCE_NODE * -RsDoExtendedIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoExtendedMemoryDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoExtendedSpaceDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - - -/* - * aslrestype2q - QWord address descriptors - */ -ASL_RESOURCE_NODE * -RsDoQwordIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoQwordMemoryDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoQwordSpaceDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - - -/* - * aslrestype2w - Word address descriptors - */ -ASL_RESOURCE_NODE * -RsDoWordIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoWordSpaceDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoWordBusNumberDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -/* - * Entry to data table compiler subsystem - */ -ACPI_STATUS -DtDoCompile( - void); - -#endif /* __ASLCOMPILER_H */ - diff -Nru acpica-unix-20100528/compiler/aslcompiler.l acpica-unix-20140114/compiler/aslcompiler.l --- acpica-unix-20100528/compiler/aslcompiler.l 2010-05-28 17:14:22.000000000 +0000 +++ acpica-unix-20140114/compiler/aslcompiler.l 1970-01-01 00:00:00.000000000 +0000 @@ -1,1183 +0,0 @@ - -%{ -/****************************************************************************** - * - * Module Name: aslcompiler.l - Flex input file - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - - -#include -#include -#include "aslcompiler.h" -#include "aslcompiler.y.h" -YYSTYPE AslCompilerlval; - -/* - * Generation: Use the following command line: - * - * flex.exe -PAslCompiler -i -o$(InputPath).c $(InputPath) - * - * -i: Scanner must be case-insensitive - */ - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslscan") -char -comment (void); -char -comment2 (void); -void -count (int type); -char -literal (void); -void -copy (void); - -/*! [Begin] no source code translation */ - -%} - - -LeadNameChar [A-Za-z_] -DigitChar [0-9] -HexDigitChar [A-Fa-f0-9] -RootChar [\\] -Nothing [] - -NameChar [A-Za-z_0-9] -NameSeg1 {LeadNameChar}{NameChar} -NameSeg2 {LeadNameChar}{NameChar}{NameChar} -NameSeg3 {LeadNameChar}{NameChar}{NameChar}{NameChar} -NameSeg {LeadNameChar}|{NameSeg1}|{NameSeg2}|{NameSeg3} - -NameString {RootChar}|{RootChar}{NamePath}|[\^]+{NamePath}|{NonEmptyNamePath} -NamePath {NonEmptyNamePath}? -NonEmptyNamePath {NameSeg}{NamePathTail}* -NamePathTail [.]{NameSeg} - -%% - -[ ] { count (0); } -[\n] { count (0); } /* Handle files with both LF and CR/LF */ -[\r] { count (0); } /* termination on both Unix and Windows */ -[ \t] { count (0); } - - -"/*" { if (!comment ()) yyterminate (); } -"//" { if (!comment2 ()) yyterminate (); } - -"\"" { if (literal ()) return (PARSEOP_STRING_LITERAL); else yyterminate (); } - - -0[xX]{HexDigitChar}+ | -{DigitChar}+ { AslCompilerlval.i = UtDoConstant ((char *) AslCompilertext); - count (1); return (PARSEOP_INTEGER); } - -"Include" { count (1); return (PARSEOP_INCLUDE); } -"#include" { count (1); return (PARSEOP_INCLUDE_CSTYLE); } -"#line" { count (1); return (PARSEOP_LINE_CSTYLE); } -"External" { count (1); return (PARSEOP_EXTERNAL); } - - -"Ones" { count (1); return (PARSEOP_ONES); } -"One" { count (1); return (PARSEOP_ONE); } -"Zero" { count (1); return (PARSEOP_ZERO); } -"Revision" { count (1); return (PARSEOP_REVISION); } - -"Offset" { count (1); return (PARSEOP_OFFSET); } -"AccessAs" { count (1); return (PARSEOP_ACCESSAS); } -"BankField" { count (2); return (PARSEOP_BANKFIELD); } -"CreateBitField" { count (2); return (PARSEOP_CREATEBITFIELD); } -"CreateByteField" { count (2); return (PARSEOP_CREATEBYTEFIELD); } -"CreateDWordField" { count (2); return (PARSEOP_CREATEDWORDFIELD); } -"CreateField" { count (2); return (PARSEOP_CREATEFIELD); } -"CreateQWordField" { count (2); return (PARSEOP_CREATEQWORDFIELD); } -"CreateWordField" { count (2); return (PARSEOP_CREATEWORDFIELD); } -"DataTableRegion" { count (2); return (PARSEOP_DATATABLEREGION); } -"Device" { count (2); return (PARSEOP_DEVICE); } -"Event" { count (2); return (PARSEOP_EVENT); } -"Field" { count (2); return (PARSEOP_FIELD); } -"Function" { count (2); return (PARSEOP_FUNCTION); } -"IndexField" { count (2); return (PARSEOP_INDEXFIELD); } -"Method" { count (2); return (PARSEOP_METHOD); } -"Mutex" { count (2); return (PARSEOP_MUTEX); } -"OperationRegion" { count (2); return (PARSEOP_OPERATIONREGION); } -"PowerResource" { count (2); return (PARSEOP_POWERRESOURCE); } -"Processor" { count (2); return (PARSEOP_PROCESSOR); } -"ThermalZone" { count (2); return (PARSEOP_THERMALZONE); } -"Alias" { count (2); return (PARSEOP_ALIAS); } -"Name" { count (2); return (PARSEOP_NAME); } -"Scope" { count (2); return (PARSEOP_SCOPE); } -"Break" { count (3); return (PARSEOP_BREAK); } -"BreakPoint" { count (3); return (PARSEOP_BREAKPOINT); } -"Continue" { count (3); return (PARSEOP_CONTINUE); } -"Fatal" { count (3); return (PARSEOP_FATAL); } -"If" { count (3); return (PARSEOP_IF); } -"Else" { count (3); return (PARSEOP_ELSE); } -"ElseIf" { count (3); return (PARSEOP_ELSEIF); } -"Load" { count (3); return (PARSEOP_LOAD); } -"Noop" { count (3); return (PARSEOP_NOOP); } -"Notify" { count (3); return (PARSEOP_NOTIFY); } -"Release" { count (3); return (PARSEOP_RELEASE); } -"Reset" { count (3); return (PARSEOP_RESET); } -"Return" { count (3); return (PARSEOP_RETURN); } -"Signal" { count (3); return (PARSEOP_SIGNAL); } -"Sleep" { count (3); return (PARSEOP_SLEEP); } -"Stall" { count (3); return (PARSEOP_STALL); } -"Switch" { count (3); return (PARSEOP_SWITCH); } -"Case" { count (3); return (PARSEOP_CASE); } -"Default" { count (3); return (PARSEOP_DEFAULT); } -"Unload" { count (3); return (PARSEOP_UNLOAD); } -"While" { count (3); return (PARSEOP_WHILE); } - -"Acquire" { count (3); return (PARSEOP_ACQUIRE); } -"Add" { count (3); return (PARSEOP_ADD); } -"And" { count (3); return (PARSEOP_AND); } -"Concatenate" { count (3); return (PARSEOP_CONCATENATE); } -"ConcatenateResTemplate" { count (3); return (PARSEOP_CONCATENATERESTEMPLATE); } -"CondRefOf" { count (3); return (PARSEOP_CONDREFOF); } -"CopyObject" { count (3); return (PARSEOP_COPYOBJECT); } -"Decrement" { count (3); return (PARSEOP_DECREMENT); } -"DeRefOf" { count (3); return (PARSEOP_DEREFOF); } -"Divide" { count (3); return (PARSEOP_DIVIDE); } -"FindSetLeftBit" { count (3); return (PARSEOP_FINDSETLEFTBIT); } -"FindSetRightBit" { count (3); return (PARSEOP_FINDSETRIGHTBIT); } -"FromBCD" { count (3); return (PARSEOP_FROMBCD); } -"Increment" { count (3); return (PARSEOP_INCREMENT); } -"Index" { count (3); return (PARSEOP_INDEX); } -"LAnd" { count (3); return (PARSEOP_LAND); } -"LEqual" { count (3); return (PARSEOP_LEQUAL); } -"LGreater" { count (3); return (PARSEOP_LGREATER); } -"LGreaterEqual" { count (3); return (PARSEOP_LGREATEREQUAL); } -"LLess" { count (3); return (PARSEOP_LLESS); } -"LLessEqual" { count (3); return (PARSEOP_LLESSEQUAL); } -"LNot" { count (3); return (PARSEOP_LNOT); } -"LNotEqual" { count (3); return (PARSEOP_LNOTEQUAL); } -"LoadTable" { count (3); return (PARSEOP_LOADTABLE); } -"LOr" { count (3); return (PARSEOP_LOR); } -"Match" { count (3); return (PARSEOP_MATCH); } -"Mid" { count (3); return (PARSEOP_MID); } -"Mod" { count (3); return (PARSEOP_MOD); } -"Multiply" { count (3); return (PARSEOP_MULTIPLY); } -"NAnd" { count (3); return (PARSEOP_NAND); } -"NOr" { count (3); return (PARSEOP_NOR); } -"Not" { count (3); return (PARSEOP_NOT); } -"ObjectType" { count (3); return (PARSEOP_OBJECTTYPE); } -"Or" { count (3); return (PARSEOP_OR); } -"RefOf" { count (3); return (PARSEOP_REFOF); } -"ShiftLeft" { count (3); return (PARSEOP_SHIFTLEFT); } -"ShiftRight" { count (3); return (PARSEOP_SHIFTRIGHT); } -"SizeOf" { count (3); return (PARSEOP_SIZEOF); } -"Store" { count (3); return (PARSEOP_STORE); } -"Subtract" { count (3); return (PARSEOP_SUBTRACT); } -"Timer" { count (3); return (PARSEOP_TIMER); } -"ToBCD" { count (3); return (PARSEOP_TOBCD); } -"ToBuffer" { count (3); return (PARSEOP_TOBUFFER); } -"ToDecimalString" { count (3); return (PARSEOP_TODECIMALSTRING); } -"ToHexString" { count (3); return (PARSEOP_TOHEXSTRING); } -"ToInteger" { count (3); return (PARSEOP_TOINTEGER); } -"ToString" { count (3); return (PARSEOP_TOSTRING); } -"Wait" { count (3); return (PARSEOP_WAIT); } -"XOr" { count (3); return (PARSEOP_XOR); } - -"Arg0" { count (1); return (PARSEOP_ARG0); } -"Arg1" { count (1); return (PARSEOP_ARG1); } -"Arg2" { count (1); return (PARSEOP_ARG2); } -"Arg3" { count (1); return (PARSEOP_ARG3); } -"Arg4" { count (1); return (PARSEOP_ARG4); } -"Arg5" { count (1); return (PARSEOP_ARG5); } -"Arg6" { count (1); return (PARSEOP_ARG6); } - -"Local0" { count (1); return (PARSEOP_LOCAL0); } -"Local1" { count (1); return (PARSEOP_LOCAL1); } -"Local2" { count (1); return (PARSEOP_LOCAL2); } -"Local3" { count (1); return (PARSEOP_LOCAL3); } -"Local4" { count (1); return (PARSEOP_LOCAL4); } -"Local5" { count (1); return (PARSEOP_LOCAL5); } -"Local6" { count (1); return (PARSEOP_LOCAL6); } -"Local7" { count (1); return (PARSEOP_LOCAL7); } - -"Debug" { count (1); return (PARSEOP_DEBUG); } - -"DefinitionBlock" { count (1); return (PARSEOP_DEFINITIONBLOCK); } -"Buffer" { count (1); return (PARSEOP_BUFFER); } -"Package" { count (1); return (PARSEOP_PACKAGE); } - -"EISAID" { count (1); return (PARSEOP_EISAID); } -"ResourceTemplate" { count (1); return (PARSEOP_RESOURCETEMPLATE); } -"ToUUID" { count (1); return (PARSEOP_TOUUID); } -"Unicode" { count (1); return (PARSEOP_UNICODE); } -"DMA" { count (1); return (PARSEOP_DMA); } -"DWordIO" { count (1); return (PARSEOP_DWORDIO); } -"DWordMemory" { count (1); return (PARSEOP_DWORDMEMORY); } -"DWordSpace" { count (1); return (PARSEOP_DWORDSPACE); } -"EndDependentFn" { count (1); return (PARSEOP_ENDDEPENDENTFN); } -"ExtendedIO" { count (1); return (PARSEOP_EXTENDEDIO); } -"ExtendedMemory" { count (1); return (PARSEOP_EXTENDEDMEMORY); } -"ExtendedSpace" { count (1); return (PARSEOP_EXTENDEDSPACE); } -"FixedIO" { count (1); return (PARSEOP_FIXEDIO); } -"Interrupt" { count (1); return (PARSEOP_INTERRUPT); } -"IO" { count (1); return (PARSEOP_IO); } -"IRQNoFlags" { count (1); return (PARSEOP_IRQNOFLAGS); } -"IRQ" { count (1); return (PARSEOP_IRQ); } -"Memory24" { count (1); return (PARSEOP_MEMORY24); } -"Memory32Fixed" { count (1); return (PARSEOP_MEMORY32FIXED); } -"Memory32" { count (1); return (PARSEOP_MEMORY32); } -"QWordIO" { count (1); return (PARSEOP_QWORDIO); } -"QWordMemory" { count (1); return (PARSEOP_QWORDMEMORY); } -"QWordSpace" { count (1); return (PARSEOP_QWORDSPACE); } -"Register" { count (1); return (PARSEOP_REGISTER); } -"StartDependentFn" { count (1); return (PARSEOP_STARTDEPENDENTFN); } -"StartDependentFnNoPri" { count (1); return (PARSEOP_STARTDEPENDENTFN_NOPRI); } -"VendorLong" { count (1); return (PARSEOP_VENDORLONG); } -"VendorShort" { count (1); return (PARSEOP_VENDORSHORT); } -"WordBusNumber" { count (1); return (PARSEOP_WORDBUSNUMBER); } -"WordIO" { count (1); return (PARSEOP_WORDIO); } -"WordSpace" { count (1); return (PARSEOP_WORDSPACE); } - -"UnknownObj" { count (0); return (PARSEOP_OBJECTTYPE_UNK); } -"IntObj" { count (0); return (PARSEOP_OBJECTTYPE_INT); } -"StrObj" { count (0); return (PARSEOP_OBJECTTYPE_STR); } -"BuffObj" { count (0); return (PARSEOP_OBJECTTYPE_BUF); } -"PkgObj" { count (0); return (PARSEOP_OBJECTTYPE_PKG); } -"FieldUnitObj" { count (0); return (PARSEOP_OBJECTTYPE_FLD); } -"DeviceObj" { count (0); return (PARSEOP_OBJECTTYPE_DEV); } -"EventObj" { count (0); return (PARSEOP_OBJECTTYPE_EVT); } -"MethodObj" { count (0); return (PARSEOP_OBJECTTYPE_MTH); } -"MutexObj" { count (0); return (PARSEOP_OBJECTTYPE_MTX); } -"OpRegionObj" { count (0); return (PARSEOP_OBJECTTYPE_OPR); } -"PowerResObj" { count (0); return (PARSEOP_OBJECTTYPE_POW); } -"ProcessorObj" { count (0); return (PARSEOP_OBJECTTYPE_PRO); } -"ThermalZoneObj" { count (0); return (PARSEOP_OBJECTTYPE_THZ); } -"BuffFieldObj" { count (0); return (PARSEOP_OBJECTTYPE_BFF); } -"DDBHandleObj" { count (0); return (PARSEOP_OBJECTTYPE_DDB); } - -"AnyAcc" { count (0); return (PARSEOP_ACCESSTYPE_ANY); } -"ByteAcc" { count (0); return (PARSEOP_ACCESSTYPE_BYTE); } -"WordAcc" { count (0); return (PARSEOP_ACCESSTYPE_WORD); } -"DWordAcc" { count (0); return (PARSEOP_ACCESSTYPE_DWORD); } -"QWordAcc" { count (0); return (PARSEOP_ACCESSTYPE_QWORD); } -"BufferAcc" { count (0); return (PARSEOP_ACCESSTYPE_BUF); } - -"Lock" { count (0); return (PARSEOP_LOCKRULE_LOCK); } -"NoLock" { count (0); return (PARSEOP_LOCKRULE_NOLOCK); } - -"Preserve" { count (0); return (PARSEOP_UPDATERULE_PRESERVE); } -"WriteAsOnes" { count (0); return (PARSEOP_UPDATERULE_ONES); } -"WriteAsZeros" { count (0); return (PARSEOP_UPDATERULE_ZEROS); } - -"Serialized" { count (0); return (PARSEOP_SERIALIZERULE_SERIAL); } -"NotSerialized" { count (0); return (PARSEOP_SERIALIZERULE_NOTSERIAL); } - -"SystemIO" { count (0); return (PARSEOP_REGIONSPACE_IO); } -"SystemMemory" { count (0); return (PARSEOP_REGIONSPACE_MEM); } -"PCI_Config" { count (0); return (PARSEOP_REGIONSPACE_PCI); } -"EmbeddedControl" { count (0); return (PARSEOP_REGIONSPACE_EC); } -"SMBus" { count (0); return (PARSEOP_REGIONSPACE_SMBUS); } -"SystemCMOS" { count (0); return (PARSEOP_REGIONSPACE_CMOS); } -"PciBarTarget" { count (0); return (PARSEOP_REGIONSPACE_PCIBAR); } -"IPMI" { count (0); return (PARSEOP_REGIONSPACE_IPMI); } - -"FFixedHW" { count (0); return (PARSEOP_ADDRESSSPACE_FFIXEDHW); } - -"SMBQuick" { count (0); return (PARSEOP_ACCESSATTRIB_QUICK); } -"SMBSendReceive" { count (0); return (PARSEOP_ACCESSATTRIB_SND_RCV); } -"SMBByte" { count (0); return (PARSEOP_ACCESSATTRIB_BYTE); } -"SMBWord" { count (0); return (PARSEOP_ACCESSATTRIB_WORD); } -"SMBBlock" { count (0); return (PARSEOP_ACCESSATTRIB_BLOCK); } -"SMBProcessCall" { count (0); return (PARSEOP_ACCESSATTRIB_WORD_CALL); } -"SMBBlockProcessCall" { count (0); return (PARSEOP_ACCESSATTRIB_BLOCK_CALL); } - -"MTR" { count (0); return (PARSEOP_MATCHTYPE_MTR); } -"MEQ" { count (0); return (PARSEOP_MATCHTYPE_MEQ); } -"MLE" { count (0); return (PARSEOP_MATCHTYPE_MLE); } -"MLT" { count (0); return (PARSEOP_MATCHTYPE_MLT); } -"MGE" { count (0); return (PARSEOP_MATCHTYPE_MGE); } -"MGT" { count (0); return (PARSEOP_MATCHTYPE_MGT); } - -"Compatibility" { count (0); return (PARSEOP_DMATYPE_COMPATIBILITY); } -"TypeA" { count (0); return (PARSEOP_DMATYPE_A); } -"TypeB" { count (0); return (PARSEOP_DMATYPE_B); } -"TypeF" { count (0); return (PARSEOP_DMATYPE_F); } - -"BusMaster" { count (0); return (PARSEOP_BUSMASTERTYPE_MASTER); } -"NotBusMaster" { count (0); return (PARSEOP_BUSMASTERTYPE_NOTMASTER); } - -"Transfer8" { count (0); return (PARSEOP_XFERTYPE_8); } -"Transfer8_16" { count (0); return (PARSEOP_XFERTYPE_8_16); } -"Transfer16" { count (0); return (PARSEOP_XFERTYPE_16); } - -"ResourceConsumer" { count (0); return (PARSEOP_RESOURCETYPE_CONSUMER); } -"ResourceProducer" { count (0); return (PARSEOP_RESOURCETYPE_PRODUCER); } - -"MinFixed" { count (0); return (PARSEOP_MINTYPE_FIXED); } -"MinNotFixed" { count (0); return (PARSEOP_MINTYPE_NOTFIXED); } - -"MaxFixed" { count (0); return (PARSEOP_MAXTYPE_FIXED); } -"MaxNotFixed" { count (0); return (PARSEOP_MAXTYPE_NOTFIXED); } - -"PosDecode" { count (0); return (PARSEOP_DECODETYPE_POS); } -"SubDecode" { count (0); return (PARSEOP_DECODETYPE_SUB); } - -"ISAOnlyRanges" { count (0); return (PARSEOP_RANGETYPE_ISAONLY); } -"NonISAOnlyRanges" { count (0); return (PARSEOP_RANGETYPE_NONISAONLY); } -"EntireRange" { count (0); return (PARSEOP_RANGETYPE_ENTIRE); } - -"Cacheable" { count (0); return (PARSEOP_MEMTYPE_CACHEABLE); } -"WriteCombining" { count (0); return (PARSEOP_MEMTYPE_WRITECOMBINING); } -"Prefetchable" { count (0); return (PARSEOP_MEMTYPE_PREFETCHABLE); } -"NonCacheable" { count (0); return (PARSEOP_MEMTYPE_NONCACHEABLE); } - -"ReadWrite" { count (0); return (PARSEOP_READWRITETYPE_BOTH); } -"ReadOnly" { count (0); return (PARSEOP_READWRITETYPE_READONLY); } - -"Edge" { count (0); return (PARSEOP_INTTYPE_EDGE); } -"Level" { count (0); return (PARSEOP_INTTYPE_LEVEL); } - -"ActiveHigh" { count (0); return (PARSEOP_INTLEVEL_ACTIVEHIGH); } -"ActiveLow" { count (0); return (PARSEOP_INTLEVEL_ACTIVELOW); } - -"Shared" { count (0); return (PARSEOP_SHARETYPE_SHARED); } -"Exclusive" { count (0); return (PARSEOP_SHARETYPE_EXCLUSIVE); } - -"Decode10" { count (0); return (PARSEOP_IODECODETYPE_10); } -"Decode16" { count (0); return (PARSEOP_IODECODETYPE_16); } - -"TypeTranslation" { count (0); return (PARSEOP_TYPE_TRANSLATION); } -"TypeStatic" { count (0); return (PARSEOP_TYPE_STATIC); } - -"SparseTranslation" { count (0); return (PARSEOP_TRANSLATIONTYPE_SPARSE); } -"DenseTranslation" { count (0); return (PARSEOP_TRANSLATIONTYPE_DENSE); } - -"AddressRangeMemory" { count (0); return (PARSEOP_ADDRESSTYPE_MEMORY); } -"AddressRangeReserved" { count (0); return (PARSEOP_ADDRESSTYPE_RESERVED); } -"AddressRangeNVS" { count (0); return (PARSEOP_ADDRESSTYPE_NVS); } -"AddressRangeACPI" { count (0); return (PARSEOP_ADDRESSTYPE_ACPI); } - - -"{" { count (0); return('{'); } -"}" { count (0); return('}'); } -"," { count (0); return(','); } -"(" { count (0); return('('); } -")" { count (0); return(')'); } - - -{NameSeg} { char *s; - count (0); - s=malloc (ACPI_NAME_SIZE + 1); - if (strcmp (AslCompilertext, "\\")) - { - strcpy (s, "____"); - AcpiUtStrupr (AslCompilertext); - } - memcpy (s, AslCompilertext, strlen (AslCompilertext)); - AslCompilerlval.s = s; - DbgPrint (ASL_PARSE_OUTPUT, "NameSeg: %s\n", s); - return (PARSEOP_NAMESEG); } - -{NameString} { char *s; - count (0); - s=malloc (strlen (AslCompilertext)+1); - AcpiUtStrupr (AslCompilertext); - strcpy (s, AslCompilertext); - s[strlen (AslCompilertext)] = 0; - AslCompilerlval.s = s; - DbgPrint (ASL_PARSE_OUTPUT, "NameString: %s\n", s); - return (PARSEOP_NAMESTRING); } - -"*" | -"/" { count (1); - AslCompilererror ("Parse error, expecting ASL keyword or name");} - -. { count (1); - sprintf (MsgBuffer, - "Invalid character (0x%2.2X), expecting ASL keyword or name", - *AslCompilertext); - AslCompilererror (MsgBuffer);} - -<> { if (AslPopInputFileStack ()) - yyterminate(); - else - return (PARSEOP_INCLUDE_END);}; - -%% - -/*! [End] no source code translation !*/ - -typedef struct asl_file_node -{ - FILE *File; - UINT32 CurrentLineNumber; - YY_BUFFER_STATE State; - char *Filename; - struct asl_file_node *Next; - -} ASL_FILE_NODE; - -ASL_FILE_NODE *InputStack = NULL; - - -/******************************************************************************* - * - * FUNCTION: AslPopInputFileStack - * - * PARAMETERS: None - * - * RETURN: 0 if a node was popped, -1 otherwise - * - * DESCRIPTION: Pop the top of the input file stack and point the parser to - * the saved parse buffer contained in the fnode. Also, set the - * global line counters to the saved values. This function is - * called when an include file reaches EOF. - * - ******************************************************************************/ - -int -AslPopInputFileStack ( - void) -{ - ASL_FILE_NODE *Fnode; - FILE *InputFile = NULL; - - - Fnode = InputStack; - DbgPrint (ASL_PARSE_OUTPUT, "\nPop InputFile Stack, Fnode %p\n\n", Fnode); - - - if (!Fnode) - { - return -1; - } - - /* Close the current include file */ - - fclose (yyin); - - /* Update the top-of-stack */ - - InputStack = Fnode->Next; - InputFile = Fnode->File; - - /* Reset global line counter and filename */ - - Gbl_Files[ASL_FILE_INPUT].Filename = Fnode->Filename; - Gbl_CurrentLineNumber = Fnode->CurrentLineNumber; - - /* Point the parser to the popped file */ - - yy_delete_buffer (YY_CURRENT_BUFFER); - yy_switch_to_buffer (Fnode->State); - - /* All done with this node */ - - ACPI_FREE (Fnode); - return 0; -} - - -/******************************************************************************* - * - * FUNCTION: AslPushInputFileStack - * - * PARAMETERS: InputFile - Open file pointer - * Filename - Name of the file - * - * RETURN: None - * - * DESCRIPTION: Push the InputFile onto the file stack, and point the parser - * to this file. Called when an include file is successfully - * opened. - * - ******************************************************************************/ - -void -AslPushInputFileStack ( - FILE *InputFile, - char *Filename) -{ - ASL_FILE_NODE *Fnode; - YY_BUFFER_STATE State; - - - /* Save the current state in an Fnode */ - - Fnode = UtLocalCalloc (sizeof (ASL_FILE_NODE)); - - Fnode->File = yyin; - Fnode->Next = InputStack; - Fnode->State = YY_CURRENT_BUFFER; - Fnode->CurrentLineNumber = Gbl_CurrentLineNumber; - Fnode->Filename = Gbl_Files[ASL_FILE_INPUT].Filename; - - /* Push it on the stack */ - - InputStack = Fnode; - - /* Point the parser to this file */ - - State = yy_create_buffer (InputFile, YY_BUF_SIZE); - yy_switch_to_buffer (State); - - DbgPrint (ASL_PARSE_OUTPUT, "\nPush InputFile Stack, returning %p\n\n", InputFile); - - /* Reset the global line count and filename */ - - Gbl_Files[ASL_FILE_INPUT].Filename = Filename; - Gbl_CurrentLineNumber = 1; - yyin = InputFile; -} - - -/******************************************************************************* - * - * FUNCTION: ResetCurrentLineBuffer - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Reset the Line Buffer to zero, increment global line numbers. - * - ******************************************************************************/ - -void -ResetCurrentLineBuffer ( - void) -{ - - if (Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle) - { - FlWriteFile (ASL_FILE_SOURCE_OUTPUT, Gbl_CurrentLineBuffer, - Gbl_LineBufPtr - Gbl_CurrentLineBuffer); - } - - Gbl_CurrentLineOffset += Gbl_CurrentColumn; - Gbl_CurrentColumn = 0; - - Gbl_CurrentLineNumber++; - Gbl_LogicalLineNumber++; - Gbl_LineBufPtr = Gbl_CurrentLineBuffer; -} - - -/******************************************************************************* - * - * FUNCTION: InsertLineBuffer - * - * PARAMETERS: SourceChar - One char from the input ASL source file - * - * RETURN: None - * - * DESCRIPTION: Put one character of the source file into the temp line buffer - * - ******************************************************************************/ - -#define ASL_SPACES_PER_TAB 4 - -void -InsertLineBuffer ( - int SourceChar) -{ - UINT32 i; - UINT32 Count = 1; - - - if (SourceChar == EOF) - { - return; - } - - Gbl_InputByteCount++; - - /* Handle tabs. Convert to spaces */ - - if (SourceChar == '\t') - { - SourceChar = ' '; - Count = ASL_SPACES_PER_TAB - - (Gbl_CurrentColumn & (ASL_SPACES_PER_TAB-1)); - } - - - for (i = 0; i < Count; i++) - { - Gbl_CurrentColumn++; - - /* Insert the character into the line buffer */ - - *Gbl_LineBufPtr = (UINT8) SourceChar; - Gbl_LineBufPtr++; - - if (Gbl_LineBufPtr > (Gbl_CurrentLineBuffer + (ASL_LINE_BUFFER_SIZE - 1))) - { -#if 0 - /* - * Warning if we have split a long source line. - * - */ - sprintf (MsgBuffer, "Max %u", ASL_LINE_BUFFER_SIZE); - AslCommonError (ASL_WARNING, ASL_MSG_LONG_LINE, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, MsgBuffer); -#endif - - ResetCurrentLineBuffer (); - } - else if (SourceChar == '\n') - { - /* End of line */ - - ResetCurrentLineBuffer (); - } - } -} - - -/******************************************************************************* - * - * FUNCTION: count - * - * PARAMETERS: yytext - Contains the matched keyword. - * Type - Keyword/Character type: - * 0 = anything except a keyword - * 1 = pseudo-keywords - * 2 = non-executable ASL keywords - * 3 = executable ASL keywords - * - * RETURN: None - * - * DESCRIPTION: Count keywords and put them into the line buffer - * - ******************************************************************************/ - -void -count ( - int Type) -{ - int i; - - - switch (Type) - { - case 2: - TotalKeywords++; - TotalNamedObjects++; - break; - - case 3: - TotalKeywords++; - TotalExecutableOpcodes++; - break; - } - - for (i = 0; (yytext[i] != 0) && (yytext[i] != EOF); i++) - { - InsertLineBuffer (yytext[i]); - *Gbl_LineBufPtr = 0; - } -} - - -/******************************************************************************* - * - * FUNCTION: comment - * - * PARAMETERS: none - * - * RETURN: none - * - * DESCRIPTION: Process a standard comment. - * - ******************************************************************************/ - -char -comment (void) -{ - char c; - char c1 = 0; - - - InsertLineBuffer ('/'); - InsertLineBuffer ('*'); - -loop: - - /* Eat chars until end-of-comment */ - - while ((c = (char) input()) != '*' && c != EOF) - { - InsertLineBuffer (c); - c1 = c; - } - - if (c == EOF) - { - goto EarlyEOF; - } - - /* - * Check for nested comment -- can help catch cases where a previous - * comment was accidently left unterminated - */ - if ((c1 == '/') && (c == '*')) - { - AslCommonError (ASL_WARNING, ASL_MSG_NESTED_COMMENT, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_InputByteCount, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); - } - - /* Comment is closed only if the NEXT character is a slash */ - - InsertLineBuffer (c); - - if ((c1 = (char) input()) != '/' && c1 != EOF) - { - unput(c1); - goto loop; - } - - if (c1 == EOF) - { - goto EarlyEOF; - } - - InsertLineBuffer (c1); - return TRUE; - - -EarlyEOF: - /* - * Premature End-Of-File - */ - AslCommonError (ASL_ERROR, ASL_MSG_EARLY_EOF, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); - return (FALSE); -} - - -/******************************************************************************* - * - * FUNCTION: comment - * - * PARAMETERS: none - * - * RETURN: none - * - * DESCRIPTION: Process a new "//" comment. - * - ******************************************************************************/ - -char -comment2 (void) -{ - char c; - - - InsertLineBuffer ('/'); - InsertLineBuffer ('/'); - - while ((c = (char) input()) != '\n' && c != EOF) - { - InsertLineBuffer (c); - } - - if (c == EOF) - { - /* End of file is OK, change to newline. Let parser detect EOF later */ - - c = '\n'; - } - - InsertLineBuffer (c); - return (TRUE); -} - - -/******************************************************************************* - * - * FUNCTION: literal - * - * PARAMETERS: none - * - * RETURN: none - * - * DESCRIPTION: Process a string literal (surrounded by quotes) - * - ******************************************************************************/ - -#define ASL_NORMAL_CHAR 0 -#define ASL_ESCAPE_SEQUENCE 1 -#define ASL_OCTAL_CONSTANT 2 -#define ASL_HEX_CONSTANT 3 - -char -literal (void) -{ - char *StringBuffer = MsgBuffer; - char *EndBuffer = MsgBuffer + ASL_MSG_BUFFER_SIZE; - char *CleanString; - char StringChar; - UINT32 State = ASL_NORMAL_CHAR; - UINT32 i = 0; - UINT8 Digit; - char ConvertBuffer[4]; - - - /* - * Eat chars until end-of-literal. - * NOTE: Put back the original surrounding quotes into the - * source line buffer. - */ - InsertLineBuffer ('\"'); - while ((StringChar = (char) input()) != EOF) - { - InsertLineBuffer (StringChar); - -DoCharacter: - - switch (State) - { - case ASL_NORMAL_CHAR: - - switch (StringChar) - { - case '\\': - /* - * Special handling for backslash-escape sequence. We will - * toss the backslash and translate the escape char(s). - */ - State = ASL_ESCAPE_SEQUENCE; - continue; - - case '\"': - - /* String terminator */ - - goto CompletedString; - } - break; - - - case ASL_ESCAPE_SEQUENCE: - - State = ASL_NORMAL_CHAR; - switch (StringChar) - { - case 'a': - StringChar = 0x07; /* BELL */ - break; - - case 'b': - StringChar = 0x08; /* BACKSPACE */ - break; - - case 'f': - StringChar = 0x0C; /* FORMFEED */ - break; - - case 'n': - StringChar = 0x0A; /* LINEFEED */ - break; - - case 'r': - StringChar = 0x0D; /* CARRIAGE RETURN*/ - break; - - case 't': - StringChar = 0x09; /* HORIZONTAL TAB */ - break; - - case 'v': - StringChar = 0x0B; /* VERTICAL TAB */ - break; - - case 'x': - State = ASL_HEX_CONSTANT; - i = 0; - continue; - - case '\'': /* Single Quote */ - case '\"': /* Double Quote */ - case '\\': /* Backslash */ - break; - - default: - - /* Check for an octal digit (0-7) */ - - if (ACPI_IS_OCTAL_DIGIT (StringChar)) - { - State = ASL_OCTAL_CONSTANT; - ConvertBuffer[0] = StringChar; - i = 1; - continue; - } - - /* Unknown escape sequence issue warning, but use the character */ - - AslCommonError (ASL_WARNING, ASL_MSG_INVALID_ESCAPE, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); - break; - } - break; - - - case ASL_OCTAL_CONSTANT: - - /* Up to three octal digits allowed */ - - if (!ACPI_IS_OCTAL_DIGIT (StringChar) || - (i > 2)) - { - /* - * Reached end of the constant. Convert the assembled ASCII - * string and resume processing of the next character - */ - ConvertBuffer[i] = 0; - Digit = (UINT8) ACPI_STRTOUL (ConvertBuffer, NULL, 8); - - /* Check for NULL or non-ascii character (ignore if so) */ - - if ((Digit == 0) || (Digit > ACPI_ASCII_MAX)) - { - AslCommonError (ASL_WARNING, ASL_MSG_INVALID_STRING, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); - } - else - { - *StringBuffer = (char) Digit; - StringBuffer++; - if (StringBuffer >= EndBuffer) - { - goto BufferOverflow; - } - } - - State = ASL_NORMAL_CHAR; - goto DoCharacter; - break; - } - - /* Append another digit of the constant */ - - ConvertBuffer[i] = StringChar; - i++; - continue; - - - case ASL_HEX_CONSTANT: - - /* Up to two hex digits allowed */ - - if (!ACPI_IS_XDIGIT (StringChar) || - (i > 1)) - { - /* - * Reached end of the constant. Convert the assembled ASCII - * string and resume processing of the next character - */ - ConvertBuffer[i] = 0; - Digit = (UINT8) ACPI_STRTOUL (ConvertBuffer, NULL, 16); - - /* Check for NULL or non-ascii character (ignore if so) */ - - if ((Digit == 0) || (Digit > ACPI_ASCII_MAX)) - { - AslCommonError (ASL_WARNING, ASL_MSG_INVALID_STRING, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); - } - else - { - *StringBuffer = (char) Digit; - StringBuffer++; - if (StringBuffer >= EndBuffer) - { - goto BufferOverflow; - } - } - - State = ASL_NORMAL_CHAR; - goto DoCharacter; - break; - } - - /* Append another digit of the constant */ - - ConvertBuffer[i] = StringChar; - i++; - continue; - } - - /* Save the finished character */ - - *StringBuffer = StringChar; - StringBuffer++; - if (StringBuffer >= EndBuffer) - { - goto BufferOverflow; - } - } - - /* - * Premature End-Of-File - */ - AslCommonError (ASL_ERROR, ASL_MSG_EARLY_EOF, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); - return (FALSE); - - -CompletedString: - /* - * Null terminate the input string and copy string to a new buffer - */ - *StringBuffer = 0; - - CleanString = UtGetStringBuffer (strlen (MsgBuffer) + 1); - if (!CleanString) - { - AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); - return (FALSE); - } - - ACPI_STRCPY (CleanString, MsgBuffer); - AslCompilerlval.s = CleanString; - return (TRUE); - - -BufferOverflow: - - /* Literal was too long */ - - AslCommonError (ASL_ERROR, ASL_MSG_STRING_LENGTH, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, "Max length 4096"); - return (FALSE); -} - - diff -Nru acpica-unix-20100528/compiler/aslcompiler.y acpica-unix-20140114/compiler/aslcompiler.y --- acpica-unix-20100528/compiler/aslcompiler.y 2010-05-28 17:14:22.000000000 +0000 +++ acpica-unix-20140114/compiler/aslcompiler.y 1970-01-01 00:00:00.000000000 +0000 @@ -1,3189 +0,0 @@ - -%{ -/****************************************************************************** - * - * Module Name: aslcompiler.y - Bison input file (ASL grammar and actions) - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - -#define YYDEBUG 1 -#define YYERROR_VERBOSE 1 - -/* - * State stack - compiler will fault if it overflows. (Default was 200) - */ -#define YYINITDEPTH 600 - -#include "aslcompiler.h" -#include -#include -#include -#include "acpi.h" -#include "accommon.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslparse") - -/* - * Global Notes: - * - * October 2005: The following list terms have been optimized (from the - * original ASL grammar in the ACPI specification) to force the immediate - * reduction of each list item so that the parse stack use doesn't increase on - * each list element and possibly overflow on very large lists (>4000 items). - * This dramatically reduces use of the parse stack overall. - * - * ArgList, TermList, Objectlist, ByteList, DWordList, PackageList, - * ResourceMacroList, and FieldUnitList - */ - - -/* - * Next statement is important - this makes everything public so that - * we can access some of the parser tables from other modules - */ -#define static -#undef alloca -#define alloca AslLocalAllocate -#define YYERROR_VERBOSE 1 - -void * -AslLocalAllocate (unsigned int Size); - -/* - * The windows version of bison defines this incorrectly as "32768" (Not negative). - * Using a custom (edited binary) version of bison that defines YYFLAG as YYFBAD - * instead (#define YYFBAD 32768), so we can define it correctly here. - * - * The problem is that if YYFLAG is positive, the extended syntax error messages - * are disabled. - */ - -#define YYFLAG -32768 - - -%} - - -/* - * Declare the type of values in the grammar - */ - -%union { - UINT64 i; - char *s; - ACPI_PARSE_OBJECT *n; -} - - -/*! [Begin] no source code translation */ - -/* - * These shift/reduce conflicts are expected. There should be zero - * reduce/reduce conflicts. - */ -%expect 60 - - -/* - * Token types: These are returned by the lexer - * - * NOTE: This list MUST match the AslKeywordMapping table found - * in aslmap.c EXACTLY! Double check any changes! - */ - -%token PARSEOP_ACCESSAS -%token PARSEOP_ACCESSATTRIB_BLOCK -%token PARSEOP_ACCESSATTRIB_BLOCK_CALL -%token PARSEOP_ACCESSATTRIB_BYTE -%token PARSEOP_ACCESSATTRIB_WORD_CALL -%token PARSEOP_ACCESSATTRIB_QUICK -%token PARSEOP_ACCESSATTRIB_SND_RCV -%token PARSEOP_ACCESSATTRIB_WORD -%token PARSEOP_ACCESSTYPE_ANY -%token PARSEOP_ACCESSTYPE_BUF -%token PARSEOP_ACCESSTYPE_BYTE -%token PARSEOP_ACCESSTYPE_DWORD -%token PARSEOP_ACCESSTYPE_QWORD -%token PARSEOP_ACCESSTYPE_WORD -%token PARSEOP_ACQUIRE -%token PARSEOP_ADD -%token PARSEOP_ADDRESSSPACE_FFIXEDHW -%token PARSEOP_ADDRESSTYPE_ACPI -%token PARSEOP_ADDRESSTYPE_MEMORY -%token PARSEOP_ADDRESSTYPE_NVS -%token PARSEOP_ADDRESSTYPE_RESERVED -%token PARSEOP_ALIAS -%token PARSEOP_AND -%token PARSEOP_ARG0 -%token PARSEOP_ARG1 -%token PARSEOP_ARG2 -%token PARSEOP_ARG3 -%token PARSEOP_ARG4 -%token PARSEOP_ARG5 -%token PARSEOP_ARG6 -%token PARSEOP_BANKFIELD -%token PARSEOP_BREAK -%token PARSEOP_BREAKPOINT -%token PARSEOP_BUFFER -%token PARSEOP_BUSMASTERTYPE_MASTER -%token PARSEOP_BUSMASTERTYPE_NOTMASTER -%token PARSEOP_BYTECONST -%token PARSEOP_CASE -%token PARSEOP_CONCATENATE -%token PARSEOP_CONCATENATERESTEMPLATE -%token PARSEOP_CONDREFOF -%token PARSEOP_CONTINUE -%token PARSEOP_COPYOBJECT -%token PARSEOP_CREATEBITFIELD -%token PARSEOP_CREATEBYTEFIELD -%token PARSEOP_CREATEDWORDFIELD -%token PARSEOP_CREATEFIELD -%token PARSEOP_CREATEQWORDFIELD -%token PARSEOP_CREATEWORDFIELD -%token PARSEOP_DATATABLEREGION -%token PARSEOP_DEBUG -%token PARSEOP_DECODETYPE_POS -%token PARSEOP_DECODETYPE_SUB -%token PARSEOP_DECREMENT -%token PARSEOP_DEFAULT -%token PARSEOP_DEFAULT_ARG -%token PARSEOP_DEFINITIONBLOCK -%token PARSEOP_DEREFOF -%token PARSEOP_DEVICE -%token PARSEOP_DIVIDE -%token PARSEOP_DMA -%token PARSEOP_DMATYPE_A -%token PARSEOP_DMATYPE_COMPATIBILITY -%token PARSEOP_DMATYPE_B -%token PARSEOP_DMATYPE_F -%token PARSEOP_DWORDCONST -%token PARSEOP_DWORDIO -%token PARSEOP_DWORDMEMORY -%token PARSEOP_DWORDSPACE -%token PARSEOP_EISAID -%token PARSEOP_ELSE -%token PARSEOP_ELSEIF -%token PARSEOP_ENDDEPENDENTFN -%token PARSEOP_ENDTAG -%token PARSEOP_ERRORNODE -%token PARSEOP_EVENT -%token PARSEOP_EXTENDEDIO -%token PARSEOP_EXTENDEDMEMORY -%token PARSEOP_EXTENDEDSPACE -%token PARSEOP_EXTERNAL -%token PARSEOP_FATAL -%token PARSEOP_FIELD -%token PARSEOP_FINDSETLEFTBIT -%token PARSEOP_FINDSETRIGHTBIT -%token PARSEOP_FIXEDIO -%token PARSEOP_FROMBCD -%token PARSEOP_FUNCTION -%token PARSEOP_IF -%token PARSEOP_INCLUDE -%token PARSEOP_INCLUDE_CSTYLE -%token PARSEOP_INCLUDE_END -%token PARSEOP_INCREMENT -%token PARSEOP_INDEX -%token PARSEOP_INDEXFIELD -%token PARSEOP_INTEGER -%token PARSEOP_INTERRUPT -%token PARSEOP_INTLEVEL_ACTIVEHIGH -%token PARSEOP_INTLEVEL_ACTIVELOW -%token PARSEOP_INTTYPE_EDGE -%token PARSEOP_INTTYPE_LEVEL -%token PARSEOP_IO -%token PARSEOP_IODECODETYPE_10 -%token PARSEOP_IODECODETYPE_16 -%token PARSEOP_IRQ -%token PARSEOP_IRQNOFLAGS -%token PARSEOP_LAND -%token PARSEOP_LEQUAL -%token PARSEOP_LGREATER -%token PARSEOP_LGREATEREQUAL -%token PARSEOP_LINE_CSTYLE -%token PARSEOP_LLESS -%token PARSEOP_LLESSEQUAL -%token PARSEOP_LNOT -%token PARSEOP_LNOTEQUAL -%token PARSEOP_LOAD -%token PARSEOP_LOADTABLE -%token PARSEOP_LOCAL0 -%token PARSEOP_LOCAL1 -%token PARSEOP_LOCAL2 -%token PARSEOP_LOCAL3 -%token PARSEOP_LOCAL4 -%token PARSEOP_LOCAL5 -%token PARSEOP_LOCAL6 -%token PARSEOP_LOCAL7 -%token PARSEOP_LOCKRULE_LOCK -%token PARSEOP_LOCKRULE_NOLOCK -%token PARSEOP_LOR -%token PARSEOP_MATCH -%token PARSEOP_MATCHTYPE_MEQ -%token PARSEOP_MATCHTYPE_MGE -%token PARSEOP_MATCHTYPE_MGT -%token PARSEOP_MATCHTYPE_MLE -%token PARSEOP_MATCHTYPE_MLT -%token PARSEOP_MATCHTYPE_MTR -%token PARSEOP_MAXTYPE_FIXED -%token PARSEOP_MAXTYPE_NOTFIXED -%token PARSEOP_MEMORY24 -%token PARSEOP_MEMORY32 -%token PARSEOP_MEMORY32FIXED -%token PARSEOP_MEMTYPE_CACHEABLE -%token PARSEOP_MEMTYPE_NONCACHEABLE -%token PARSEOP_MEMTYPE_PREFETCHABLE -%token PARSEOP_MEMTYPE_WRITECOMBINING -%token PARSEOP_METHOD -%token PARSEOP_METHODCALL -%token PARSEOP_MID -%token PARSEOP_MINTYPE_FIXED -%token PARSEOP_MINTYPE_NOTFIXED -%token PARSEOP_MOD -%token PARSEOP_MULTIPLY -%token PARSEOP_MUTEX -%token PARSEOP_NAME -%token PARSEOP_NAMESEG -%token PARSEOP_NAMESTRING -%token PARSEOP_NAND -%token PARSEOP_NOOP -%token PARSEOP_NOR -%token PARSEOP_NOT -%token PARSEOP_NOTIFY -%token PARSEOP_OBJECTTYPE -%token PARSEOP_OBJECTTYPE_BFF -%token PARSEOP_OBJECTTYPE_BUF -%token PARSEOP_OBJECTTYPE_DDB -%token PARSEOP_OBJECTTYPE_DEV -%token PARSEOP_OBJECTTYPE_EVT -%token PARSEOP_OBJECTTYPE_FLD -%token PARSEOP_OBJECTTYPE_INT -%token PARSEOP_OBJECTTYPE_MTH -%token PARSEOP_OBJECTTYPE_MTX -%token PARSEOP_OBJECTTYPE_OPR -%token PARSEOP_OBJECTTYPE_PKG -%token PARSEOP_OBJECTTYPE_POW -%token PARSEOP_OBJECTTYPE_PRO -%token PARSEOP_OBJECTTYPE_STR -%token PARSEOP_OBJECTTYPE_THZ -%token PARSEOP_OBJECTTYPE_UNK -%token PARSEOP_OFFSET -%token PARSEOP_ONE -%token PARSEOP_ONES -%token PARSEOP_OPERATIONREGION -%token PARSEOP_OR -%token PARSEOP_PACKAGE -%token PARSEOP_PACKAGE_LENGTH -%token PARSEOP_POWERRESOURCE -%token PARSEOP_PROCESSOR -%token PARSEOP_QWORDCONST -%token PARSEOP_QWORDIO -%token PARSEOP_QWORDMEMORY -%token PARSEOP_QWORDSPACE -%token PARSEOP_RANGETYPE_ENTIRE -%token PARSEOP_RANGETYPE_ISAONLY -%token PARSEOP_RANGETYPE_NONISAONLY -%token PARSEOP_RAW_DATA -%token PARSEOP_READWRITETYPE_BOTH -%token PARSEOP_READWRITETYPE_READONLY -%token PARSEOP_REFOF -%token PARSEOP_REGIONSPACE_CMOS -%token PARSEOP_REGIONSPACE_EC -%token PARSEOP_REGIONSPACE_IO -%token PARSEOP_REGIONSPACE_IPMI -%token PARSEOP_REGIONSPACE_MEM -%token PARSEOP_REGIONSPACE_PCI -%token PARSEOP_REGIONSPACE_PCIBAR -%token PARSEOP_REGIONSPACE_SMBUS -%token PARSEOP_REGISTER -%token PARSEOP_RELEASE -%token PARSEOP_RESERVED_BYTES -%token PARSEOP_RESET -%token PARSEOP_RESOURCETEMPLATE -%token PARSEOP_RESOURCETYPE_CONSUMER -%token PARSEOP_RESOURCETYPE_PRODUCER -%token PARSEOP_RETURN -%token PARSEOP_REVISION -%token PARSEOP_SCOPE -%token PARSEOP_SERIALIZERULE_NOTSERIAL -%token PARSEOP_SERIALIZERULE_SERIAL -%token PARSEOP_SHARETYPE_EXCLUSIVE -%token PARSEOP_SHARETYPE_SHARED -%token PARSEOP_SHIFTLEFT -%token PARSEOP_SHIFTRIGHT -%token PARSEOP_SIGNAL -%token PARSEOP_SIZEOF -%token PARSEOP_SLEEP -%token PARSEOP_STALL -%token PARSEOP_STARTDEPENDENTFN -%token PARSEOP_STARTDEPENDENTFN_NOPRI -%token PARSEOP_STORE -%token PARSEOP_STRING_LITERAL -%token PARSEOP_SUBTRACT -%token PARSEOP_SWITCH -%token PARSEOP_THERMALZONE -%token PARSEOP_TIMER -%token PARSEOP_TOBCD -%token PARSEOP_TOBUFFER -%token PARSEOP_TODECIMALSTRING -%token PARSEOP_TOHEXSTRING -%token PARSEOP_TOINTEGER -%token PARSEOP_TOSTRING -%token PARSEOP_TOUUID -%token PARSEOP_TRANSLATIONTYPE_DENSE -%token PARSEOP_TRANSLATIONTYPE_SPARSE -%token PARSEOP_TYPE_STATIC -%token PARSEOP_TYPE_TRANSLATION -%token PARSEOP_UNICODE -%token PARSEOP_UNLOAD -%token PARSEOP_UPDATERULE_ONES -%token PARSEOP_UPDATERULE_PRESERVE -%token PARSEOP_UPDATERULE_ZEROS -%token PARSEOP_VAR_PACKAGE -%token PARSEOP_VENDORLONG -%token PARSEOP_VENDORSHORT -%token PARSEOP_WAIT -%token PARSEOP_WHILE -%token PARSEOP_WORDBUSNUMBER -%token PARSEOP_WORDCONST -%token PARSEOP_WORDIO -%token PARSEOP_WORDSPACE -%token PARSEOP_XFERTYPE_8 -%token PARSEOP_XFERTYPE_8_16 -%token PARSEOP_XFERTYPE_16 -%token PARSEOP_XOR -%token PARSEOP_ZERO - - -/* - * Production names - */ - -%type ASLCode -%type DefinitionBlockTerm -%type TermList -%type Term -%type CompilerDirective -%type ObjectList -%type Object -%type DataObject -%type BufferData -%type PackageData -%type IntegerData -%type StringData -%type NamedObject -%type NameSpaceModifier -%type UserTerm -%type ArgList -%type TermArg -%type Target -%type RequiredTarget -%type SimpleTarget -%type BufferTermData -%type ParameterTypePackage -%type ParameterTypePackageList -%type ParameterTypesPackage -%type ParameterTypesPackageList - -%type Type1Opcode -%type Type2Opcode -%type Type2IntegerOpcode -%type Type2StringOpcode -%type Type2BufferOpcode -%type Type2BufferOrStringOpcode -%type Type3Opcode - -/* Obsolete %type Type4Opcode */ - -%type Type5Opcode -%type Type6Opcode - -%type LineTerm -%type IncludeTerm -%type IncludeCStyleTerm -%type ExternalTerm - -%type FieldUnitList -%type FieldUnit -%type FieldUnitEntry - -%type OffsetTerm -%type AccessAsTerm -%type OptionalAccessAttribTerm - - -/* Named Objects */ - -%type BankFieldTerm -%type CreateBitFieldTerm -%type CreateByteFieldTerm -%type CreateDWordFieldTerm -%type CreateFieldTerm -%type CreateQWordFieldTerm -%type CreateWordFieldTerm -%type DataRegionTerm -%type DeviceTerm -%type EventTerm -%type FieldTerm -%type FunctionTerm -%type IndexFieldTerm -%type MethodTerm -%type MutexTerm -%type OpRegionTerm -%type OpRegionSpaceIdTerm -%type PowerResTerm -%type ProcessorTerm -%type ThermalZoneTerm - - -/* Namespace modifiers */ - -%type AliasTerm -%type NameTerm -%type ScopeTerm - -/* Type 1 opcodes */ - -%type BreakTerm -%type BreakPointTerm -%type ContinueTerm -%type FatalTerm -%type IfElseTerm -%type IfTerm -%type ElseTerm -%type LoadTerm -%type NoOpTerm -%type NotifyTerm -%type ReleaseTerm -%type ResetTerm -%type ReturnTerm -%type SignalTerm -%type SleepTerm -%type StallTerm -%type SwitchTerm -%type CaseDefaultTermList -//%type CaseTermList -%type CaseTerm -%type DefaultTerm -%type UnloadTerm -%type WhileTerm - -/* Type 2 opcodes */ - -%type AcquireTerm -%type AddTerm -%type AndTerm -%type ConcatTerm -%type ConcatResTerm -%type CondRefOfTerm -%type CopyObjectTerm -%type DecTerm -%type DerefOfTerm -%type DivideTerm -%type FindSetLeftBitTerm -%type FindSetRightBitTerm -%type FromBCDTerm -%type IncTerm -%type IndexTerm -%type LAndTerm -%type LEqualTerm -%type LGreaterTerm -%type LGreaterEqualTerm -%type LLessTerm -%type LLessEqualTerm -%type LNotTerm -%type LNotEqualTerm -%type LoadTableTerm -%type LOrTerm -%type MatchTerm -%type MidTerm -%type ModTerm -%type MultiplyTerm -%type NAndTerm -%type NOrTerm -%type NotTerm -%type ObjectTypeTerm -%type OrTerm -%type RefOfTerm -%type ShiftLeftTerm -%type ShiftRightTerm -%type SizeOfTerm -%type StoreTerm -%type SubtractTerm -%type TimerTerm -%type ToBCDTerm -%type ToBufferTerm -%type ToDecimalStringTerm -%type ToHexStringTerm -%type ToIntegerTerm -%type ToStringTerm -%type WaitTerm -%type XOrTerm - -%type OptionalTermArg -%type OptionalReturnArg -%type OptionalListString - - -/* Keywords */ - -%type ObjectTypeKeyword -%type AccessTypeKeyword -%type AccessAttribKeyword -%type LockRuleKeyword -%type UpdateRuleKeyword -%type RegionSpaceKeyword -%type AddressSpaceKeyword -%type MatchOpKeyword -%type SerializeRuleKeyword -%type DMATypeKeyword -%type OptionalBusMasterKeyword -%type XferTypeKeyword -%type ResourceTypeKeyword -%type MinKeyword -%type MaxKeyword -%type DecodeKeyword -%type RangeTypeKeyword -%type MemTypeKeyword -%type OptionalReadWriteKeyword -%type InterruptTypeKeyword -%type InterruptLevel -%type ShareTypeKeyword -%type IODecodeKeyword -%type TypeKeyword -%type TranslationKeyword -%type AddressKeyword - -/* Types */ - -%type SuperName -%type ArgTerm -%type LocalTerm -%type DebugTerm - -%type Integer -%type ByteConst -%type WordConst -%type DWordConst -%type QWordConst -%type String - -%type ConstTerm -%type ByteConstExpr -%type WordConstExpr -%type DWordConstExpr -%type QWordConstExpr -%type ConstExprTerm - -%type BufferTerm -%type ByteList -%type DWordList - -%type PackageTerm -%type PackageList -%type PackageElement - -%type VarPackageLengthTerm - -/* Macros */ - -%type EISAIDTerm -%type ResourceTemplateTerm -%type ToUUIDTerm -%type UnicodeTerm -%type ResourceMacroList -%type ResourceMacroTerm - -%type DMATerm -%type DWordIOTerm -%type DWordMemoryTerm -%type DWordSpaceTerm -%type EndDependentFnTerm -%type ExtendedIOTerm -%type ExtendedMemoryTerm -%type ExtendedSpaceTerm -%type FixedIOTerm -%type InterruptTerm -%type IOTerm -%type IRQNoFlagsTerm -%type IRQTerm -%type Memory24Term -%type Memory32FixedTerm -%type Memory32Term -%type QWordIOTerm -%type QWordMemoryTerm -%type QWordSpaceTerm -%type RegisterTerm -%type StartDependentFnTerm -%type StartDependentFnNoPriTerm -%type VendorLongTerm -%type VendorShortTerm -%type WordBusNumberTerm -%type WordIOTerm -%type WordSpaceTerm - -%type NameString -%type NameSeg - - -/* Local types that help construct the AML, not in ACPI spec */ - -%type IncludeEndTerm -%type AmlPackageLengthTerm -%type OptionalByteConstExpr -%type OptionalDWordConstExpr -%type OptionalQWordConstExpr -%type OptionalSerializeRuleKeyword -%type OptionalResourceType_First -%type OptionalResourceType -%type OptionalMinType -%type OptionalMaxType -%type OptionalMemType -%type OptionalCount -%type OptionalDecodeType -%type OptionalRangeType -%type OptionalShareType -%type OptionalType -%type OptionalType_Last -%type OptionalTranslationType_Last -%type OptionalStringData -%type OptionalNameString -%type OptionalNameString_First -%type OptionalNameString_Last -%type OptionalAddressRange -%type OptionalObjectTypeKeyword -%type OptionalParameterTypePackage -%type OptionalParameterTypesPackage -%type OptionalReference -%type OptionalAccessSize - - -%type TermArgItem -%type NameStringItem - -%% - - -/******************************************************************************* - * - * Production rules start here - * - ******************************************************************************/ - -/* - * ASL Names - */ - - -/* - * Blocks, Data, and Opcodes - */ - -ASLCode - : DefinitionBlockTerm - | error {YYABORT; $$ = NULL;} - ; - -DefinitionBlockTerm - : PARSEOP_DEFINITIONBLOCK '(' {$$ = TrCreateLeafNode (PARSEOP_DEFINITIONBLOCK);} - String ',' - String ',' - ByteConst ',' - String ',' - String ',' - DWordConst - ')' {TrSetEndLineNumber ($3);} - '{' TermList '}' {$$ = TrLinkChildren ($3,7,$4,$6,$8,$10,$12,$14,$18);} - ; - -/* ACPI 3.0 -- allow semicolons between terms */ - -TermList - : {$$ = NULL;} - | TermList Term {$$ = TrLinkPeerNode (TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$2);} - | TermList ';' Term {$$ = TrLinkPeerNode (TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$3);} - ; - -Term - : Object {} - | Type1Opcode {} - | Type2Opcode {} - | Type2IntegerOpcode {} - | Type2StringOpcode {} - | Type2BufferOpcode {} - | Type2BufferOrStringOpcode {} - | error {$$ = AslDoError(); yyclearin;} - ; - -CompilerDirective - : IncludeTerm {} - | IncludeCStyleTerm {$$ = NULL;} - | LineTerm {$$ = NULL;} - | ExternalTerm {} - ; - -ObjectList - : {$$ = NULL;} - | ObjectList Object {$$ = TrLinkPeerNode ($1,$2);} - | error {$$ = AslDoError(); yyclearin;} - ; - -Object - : CompilerDirective {} - | NamedObject {} - | NameSpaceModifier {} - ; - -DataObject - : BufferData {} - | PackageData {} - | IntegerData {} - | StringData {} - ; - -BufferData - : Type5Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);} - | Type2BufferOrStringOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);} - | Type2BufferOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);} - | BufferTerm {} - ; - -PackageData - : PackageTerm {} - ; - -IntegerData - : Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);} - | Type3Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);} - | Integer {} - | ConstTerm {} - ; - -StringData - : Type2StringOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);} - | String {} - ; - -NamedObject - : BankFieldTerm {} - | CreateBitFieldTerm {} - | CreateByteFieldTerm {} - | CreateDWordFieldTerm {} - | CreateFieldTerm {} - | CreateQWordFieldTerm {} - | CreateWordFieldTerm {} - | DataRegionTerm {} - | DeviceTerm {} - | EventTerm {} - | FieldTerm {} - | FunctionTerm {} - | IndexFieldTerm {} - | MethodTerm {} - | MutexTerm {} - | OpRegionTerm {} - | PowerResTerm {} - | ProcessorTerm {} - | ThermalZoneTerm {} - ; - -NameSpaceModifier - : AliasTerm {} - | NameTerm {} - | ScopeTerm {} - ; - -UserTerm - : NameString '(' {TrUpdateNode (PARSEOP_METHODCALL, $1);} - ArgList ')' {$$ = TrLinkChildNode ($1,$4);} - ; - -ArgList - : {$$ = NULL;} - | TermArg - | ArgList ',' /* Allows a trailing comma at list end */ - | ArgList ',' - TermArg {$$ = TrLinkPeerNode ($1,$3);} - ; - -/* -Removed from TermArg due to reduce/reduce conflicts - | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} - | Type2StringOpcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} - | Type2BufferOpcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} - | Type2BufferOrStringOpcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} - -*/ - -TermArg - : Type2Opcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} - | DataObject {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} - | NameString {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} - | ArgTerm {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} - | LocalTerm {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} - ; - -Target - : {$$ = TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO), NODE_IS_TARGET | NODE_COMPILE_TIME_CONST);} /* Placeholder is a ZeroOp object */ - | ',' {$$ = TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO), NODE_IS_TARGET | NODE_COMPILE_TIME_CONST);} /* Placeholder is a ZeroOp object */ - | ',' SuperName {$$ = TrSetNodeFlags ($2, NODE_IS_TARGET);} - ; - -RequiredTarget - : ',' SuperName {$$ = TrSetNodeFlags ($2, NODE_IS_TARGET);} - ; - -SimpleTarget - : NameString {} - | LocalTerm {} - | ArgTerm {} - ; - -/* Rules for specifying the type of one method argument or return value */ - -ParameterTypePackage - : {$$ = NULL;} - | ObjectTypeKeyword {$$ = $1;} - | ParameterTypePackage ',' - ObjectTypeKeyword {$$ = TrLinkPeerNodes (2,$1,$3);} - ; - -ParameterTypePackageList - : {$$ = NULL;} - | ObjectTypeKeyword {$$ = $1;} - | '{' ParameterTypePackage '}' {$$ = $2;} - ; - -OptionalParameterTypePackage - : {$$ = TrCreateLeafNode (PARSEOP_DEFAULT_ARG);} - | ',' ParameterTypePackageList {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_DEFAULT_ARG),1,$2);} - ; - -/* Rules for specifying the types for method arguments */ - -ParameterTypesPackage - : ParameterTypePackageList {$$ = $1;} - | ParameterTypesPackage ',' - ParameterTypePackageList {$$ = TrLinkPeerNodes (2,$1,$3);} - ; - -ParameterTypesPackageList - : {$$ = NULL;} - | ObjectTypeKeyword {$$ = $1;} - | '{' ParameterTypesPackage '}' {$$ = $2;} - ; - -OptionalParameterTypesPackage - : {$$ = TrCreateLeafNode (PARSEOP_DEFAULT_ARG);} - | ',' ParameterTypesPackageList {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_DEFAULT_ARG),1,$2);} - ; - - -/* Opcode types */ - -Type1Opcode - : BreakTerm {} - | BreakPointTerm {} - | ContinueTerm {} - | FatalTerm {} - | IfElseTerm {} - | LoadTerm {} - | NoOpTerm {} - | NotifyTerm {} - | ReleaseTerm {} - | ResetTerm {} - | ReturnTerm {} - | SignalTerm {} - | SleepTerm {} - | StallTerm {} - | SwitchTerm {} - | UnloadTerm {} - | WhileTerm {} - ; - -Type2Opcode - : AcquireTerm {} - | CondRefOfTerm {} - | CopyObjectTerm {} - | DerefOfTerm {} - | ObjectTypeTerm {} - | RefOfTerm {} - | SizeOfTerm {} - | StoreTerm {} - | TimerTerm {} - | WaitTerm {} - | UserTerm {} - ; - -/* - * Type 3/4/5 opcodes - */ - -Type2IntegerOpcode /* "Type3" opcodes */ - : AddTerm {} - | AndTerm {} - | DecTerm {} - | DivideTerm {} - | FindSetLeftBitTerm {} - | FindSetRightBitTerm {} - | FromBCDTerm {} - | IncTerm {} - | IndexTerm {} - | LAndTerm {} - | LEqualTerm {} - | LGreaterTerm {} - | LGreaterEqualTerm {} - | LLessTerm {} - | LLessEqualTerm {} - | LNotTerm {} - | LNotEqualTerm {} - | LoadTableTerm {} - | LOrTerm {} - | MatchTerm {} - | ModTerm {} - | MultiplyTerm {} - | NAndTerm {} - | NOrTerm {} - | NotTerm {} - | OrTerm {} - | ShiftLeftTerm {} - | ShiftRightTerm {} - | SubtractTerm {} - | ToBCDTerm {} - | ToIntegerTerm {} - | XOrTerm {} - ; - -Type2StringOpcode /* "Type4" Opcodes */ - : ToDecimalStringTerm {} - | ToHexStringTerm {} - | ToStringTerm {} - ; - -Type2BufferOpcode /* "Type5" Opcodes */ - : ToBufferTerm {} - | ConcatResTerm {} - ; - -Type2BufferOrStringOpcode - : ConcatTerm {} - | MidTerm {} - ; - -/* - * A type 3 opcode evaluates to an Integer and cannot have a destination operand - */ - -Type3Opcode - : EISAIDTerm {} - ; - -/* Obsolete -Type4Opcode - : ConcatTerm {} - | ToDecimalStringTerm {} - | ToHexStringTerm {} - | MidTerm {} - | ToStringTerm {} - ; -*/ - - -Type5Opcode - : ResourceTemplateTerm {} - | UnicodeTerm {} - | ToUUIDTerm {} - ; - -Type6Opcode - : RefOfTerm {} - | DerefOfTerm {} - | IndexTerm {} - | UserTerm {} - ; - -IncludeTerm - : PARSEOP_INCLUDE '(' {$$ = TrCreateLeafNode (PARSEOP_INCLUDE);} - String ')' {TrLinkChildren ($3,1,$4);FlOpenIncludeFile ($4);} - TermList - IncludeEndTerm {$$ = TrLinkPeerNodes (3,$3,$7,$8);} - ; - -IncludeEndTerm - : PARSEOP_INCLUDE_END {$$ = TrCreateLeafNode (PARSEOP_INCLUDE_END);} - ; - -IncludeCStyleTerm - : PARSEOP_INCLUDE_CSTYLE - String {FlOpenIncludeFile ($2);} - ; - -LineTerm - : PARSEOP_LINE_CSTYLE - Integer {FlSetLineNumber ($2);} - ; - -ExternalTerm - : PARSEOP_EXTERNAL '(' - NameString - OptionalObjectTypeKeyword - OptionalParameterTypePackage - OptionalParameterTypesPackage - ')' {$$ = TrCreateNode (PARSEOP_EXTERNAL,4,$3,$4,$5,$6);} - | PARSEOP_EXTERNAL '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - - -/******* Named Objects *******************************************************/ - - -BankFieldTerm - : PARSEOP_BANKFIELD '(' {$$ = TrCreateLeafNode (PARSEOP_BANKFIELD);} - NameString - NameStringItem - TermArgItem - ',' AccessTypeKeyword - ',' LockRuleKeyword - ',' UpdateRuleKeyword - ')' '{' - FieldUnitList '}' {$$ = TrLinkChildren ($3,7,$4,$5,$6,$8,$10,$12,$15);} - | PARSEOP_BANKFIELD '(' - error ')' '{' error '}' {$$ = AslDoError(); yyclearin;} - ; - -FieldUnitList - : {$$ = NULL;} - | FieldUnit - | FieldUnitList ',' /* Allows a trailing comma at list end */ - | FieldUnitList ',' - FieldUnit {$$ = TrLinkPeerNode ($1,$3);} - ; - -FieldUnit - : FieldUnitEntry {} - | OffsetTerm {} - | AccessAsTerm {} - ; - -FieldUnitEntry - : ',' AmlPackageLengthTerm {$$ = TrCreateNode (PARSEOP_RESERVED_BYTES,1,$2);} - | NameSeg ',' - AmlPackageLengthTerm {$$ = TrLinkChildNode ($1,$3);} - ; - -OffsetTerm - : PARSEOP_OFFSET '(' - AmlPackageLengthTerm - ')' {$$ = TrCreateNode (PARSEOP_OFFSET,1,$3);} - | PARSEOP_OFFSET '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -AccessAsTerm - : PARSEOP_ACCESSAS '(' - AccessTypeKeyword - OptionalAccessAttribTerm - ')' {$$ = TrCreateNode (PARSEOP_ACCESSAS,2,$3,$4);} - | PARSEOP_ACCESSAS '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -CreateBitFieldTerm - : PARSEOP_CREATEBITFIELD '(' {$$ = TrCreateLeafNode (PARSEOP_CREATEBITFIELD);} - TermArg - TermArgItem - NameStringItem - ')' {$$ = TrLinkChildren ($3,3,$4,$5,TrSetNodeFlags ($6, NODE_IS_NAME_DECLARATION));} - | PARSEOP_CREATEBITFIELD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -CreateByteFieldTerm - : PARSEOP_CREATEBYTEFIELD '(' {$$ = TrCreateLeafNode (PARSEOP_CREATEBYTEFIELD);} - TermArg - TermArgItem - NameStringItem - ')' {$$ = TrLinkChildren ($3,3,$4,$5,TrSetNodeFlags ($6, NODE_IS_NAME_DECLARATION));} - | PARSEOP_CREATEBYTEFIELD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -CreateDWordFieldTerm - : PARSEOP_CREATEDWORDFIELD '(' {$$ = TrCreateLeafNode (PARSEOP_CREATEDWORDFIELD);} - TermArg - TermArgItem - NameStringItem - ')' {$$ = TrLinkChildren ($3,3,$4,$5,TrSetNodeFlags ($6, NODE_IS_NAME_DECLARATION));} - | PARSEOP_CREATEDWORDFIELD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -CreateFieldTerm - : PARSEOP_CREATEFIELD '(' {$$ = TrCreateLeafNode (PARSEOP_CREATEFIELD);} - TermArg - TermArgItem - TermArgItem - NameStringItem - ')' {$$ = TrLinkChildren ($3,4,$4,$5,$6,TrSetNodeFlags ($7, NODE_IS_NAME_DECLARATION));} - | PARSEOP_CREATEFIELD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -CreateQWordFieldTerm - : PARSEOP_CREATEQWORDFIELD '(' {$$ = TrCreateLeafNode (PARSEOP_CREATEQWORDFIELD);} - TermArg - TermArgItem - NameStringItem - ')' {$$ = TrLinkChildren ($3,3,$4,$5,TrSetNodeFlags ($6, NODE_IS_NAME_DECLARATION));} - | PARSEOP_CREATEQWORDFIELD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -CreateWordFieldTerm - : PARSEOP_CREATEWORDFIELD '(' {$$ = TrCreateLeafNode (PARSEOP_CREATEWORDFIELD);} - TermArg - TermArgItem - NameStringItem - ')' {$$ = TrLinkChildren ($3,3,$4,$5,TrSetNodeFlags ($6, NODE_IS_NAME_DECLARATION));} - | PARSEOP_CREATEWORDFIELD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -DataRegionTerm - : PARSEOP_DATATABLEREGION '(' {$$ = TrCreateLeafNode (PARSEOP_DATATABLEREGION);} - NameString - TermArgItem - TermArgItem - TermArgItem - ')' {$$ = TrLinkChildren ($3,4,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$5,$6,$7);} - | PARSEOP_DATATABLEREGION '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -DeviceTerm - : PARSEOP_DEVICE '(' {$$ = TrCreateLeafNode (PARSEOP_DEVICE);} - NameString - ')' '{' - ObjectList '}' {$$ = TrLinkChildren ($3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$7);} - | PARSEOP_DEVICE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -EventTerm - : PARSEOP_EVENT '(' {$$ = TrCreateLeafNode (PARSEOP_EVENT);} - NameString - ')' {$$ = TrLinkChildren ($3,1,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION));} - | PARSEOP_EVENT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -FieldTerm - : PARSEOP_FIELD '(' {$$ = TrCreateLeafNode (PARSEOP_FIELD);} - NameString - ',' AccessTypeKeyword - ',' LockRuleKeyword - ',' UpdateRuleKeyword - ')' '{' - FieldUnitList '}' {$$ = TrLinkChildren ($3,5,$4,$6,$8,$10,$13);} - | PARSEOP_FIELD '(' - error ')' '{' error '}' {$$ = AslDoError(); yyclearin;} - ; - -FunctionTerm - : PARSEOP_FUNCTION '(' {$$ = TrCreateLeafNode (PARSEOP_METHOD);} - NameString - OptionalParameterTypePackage - OptionalParameterTypesPackage - ')' '{' - TermList '}' {$$ = TrLinkChildren ($3,7,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION), - TrCreateValuedLeafNode (PARSEOP_BYTECONST, 0), - TrCreateLeafNode (PARSEOP_SERIALIZERULE_NOTSERIAL), - TrCreateValuedLeafNode (PARSEOP_BYTECONST, 0),$5,$6,$9);} - | PARSEOP_FUNCTION '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -IndexFieldTerm - : PARSEOP_INDEXFIELD '(' {$$ = TrCreateLeafNode (PARSEOP_INDEXFIELD);} - NameString - NameStringItem - ',' AccessTypeKeyword - ',' LockRuleKeyword - ',' UpdateRuleKeyword - ')' '{' - FieldUnitList '}' {$$ = TrLinkChildren ($3,6,$4,$5,$7,$9,$11,$14);} - | PARSEOP_INDEXFIELD '(' - error ')' '{' error '}' {$$ = AslDoError(); yyclearin;} - ; - -MethodTerm - : PARSEOP_METHOD '(' {$$ = TrCreateLeafNode (PARSEOP_METHOD);} - NameString - OptionalByteConstExpr {UtCheckIntegerRange ($5, 0, 7);} - OptionalSerializeRuleKeyword - OptionalByteConstExpr - OptionalParameterTypePackage - OptionalParameterTypesPackage - ')' '{' - TermList '}' {$$ = TrLinkChildren ($3,7,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$5,$7,$8,$9,$10,$13);} - | PARSEOP_METHOD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -MutexTerm - : PARSEOP_MUTEX '(' {$$ = TrCreateLeafNode (PARSEOP_MUTEX);} - NameString - ',' ByteConstExpr - ')' {$$ = TrLinkChildren ($3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6);} - | PARSEOP_MUTEX '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -OpRegionTerm - : PARSEOP_OPERATIONREGION '(' {$$ = TrCreateLeafNode (PARSEOP_OPERATIONREGION);} - NameString - ',' OpRegionSpaceIdTerm - TermArgItem - TermArgItem - ')' {$$ = TrLinkChildren ($3,4,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6,$7,$8);} - | PARSEOP_OPERATIONREGION '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -OpRegionSpaceIdTerm - : RegionSpaceKeyword {} - | ByteConst {$$ = UtCheckIntegerRange ($1, 0x80, 0xFF);} - ; - -PowerResTerm - : PARSEOP_POWERRESOURCE '(' {$$ = TrCreateLeafNode (PARSEOP_POWERRESOURCE);} - NameString - ',' ByteConstExpr - ',' WordConstExpr - ')' '{' - ObjectList '}' {$$ = TrLinkChildren ($3,4,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6,$8,$11);} - | PARSEOP_POWERRESOURCE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ProcessorTerm - : PARSEOP_PROCESSOR '(' {$$ = TrCreateLeafNode (PARSEOP_PROCESSOR);} - NameString - ',' ByteConstExpr - OptionalDWordConstExpr - OptionalByteConstExpr - ')' '{' - ObjectList '}' {$$ = TrLinkChildren ($3,5,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6,$7,$8,$11);} - | PARSEOP_PROCESSOR '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ThermalZoneTerm - : PARSEOP_THERMALZONE '(' {$$ = TrCreateLeafNode (PARSEOP_THERMALZONE);} - NameString - ')' '{' - ObjectList '}' {$$ = TrLinkChildren ($3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$7);} - | PARSEOP_THERMALZONE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - - -/******* Namespace modifiers *************************************************/ - - -AliasTerm - : PARSEOP_ALIAS '(' {$$ = TrCreateLeafNode (PARSEOP_ALIAS);} - NameString - NameStringItem - ')' {$$ = TrLinkChildren ($3,2,$4,TrSetNodeFlags ($5, NODE_IS_NAME_DECLARATION));} - | PARSEOP_ALIAS '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -NameTerm - : PARSEOP_NAME '(' {$$ = TrCreateLeafNode (PARSEOP_NAME);} - NameString - ',' DataObject - ')' {$$ = TrLinkChildren ($3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6);} - | PARSEOP_NAME '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ScopeTerm - : PARSEOP_SCOPE '(' {$$ = TrCreateLeafNode (PARSEOP_SCOPE);} - NameString - ')' '{' - ObjectList '}' {$$ = TrLinkChildren ($3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$7);} - | PARSEOP_SCOPE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - - -/******* Type 1 opcodes *******************************************************/ - - -BreakTerm - : PARSEOP_BREAK {$$ = TrCreateNode (PARSEOP_BREAK, 0);} - ; - -BreakPointTerm - : PARSEOP_BREAKPOINT {$$ = TrCreateNode (PARSEOP_BREAKPOINT, 0);} - ; - -ContinueTerm - : PARSEOP_CONTINUE {$$ = TrCreateNode (PARSEOP_CONTINUE, 0);} - ; - -FatalTerm - : PARSEOP_FATAL '(' {$$ = TrCreateLeafNode (PARSEOP_FATAL);} - ByteConstExpr - ',' DWordConstExpr - TermArgItem - ')' {$$ = TrLinkChildren ($3,3,$4,$6,$7);} - | PARSEOP_FATAL '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -IfElseTerm - : IfTerm ElseTerm {$$ = TrLinkPeerNode ($1,$2);} - ; - -IfTerm - : PARSEOP_IF '(' {$$ = TrCreateLeafNode (PARSEOP_IF);} - TermArg - ')' '{' - TermList '}' {$$ = TrLinkChildren ($3,2,$4,$7);} - - | PARSEOP_IF '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ElseTerm - : {$$ = NULL;} - | PARSEOP_ELSE '{' {$$ = TrCreateLeafNode (PARSEOP_ELSE);} - TermList '}' {$$ = TrLinkChildren ($3,1,$4);} - - | PARSEOP_ELSE '{' - error '}' {$$ = AslDoError(); yyclearin;} - - | PARSEOP_ELSE - error {$$ = AslDoError(); yyclearin;} - - | PARSEOP_ELSEIF '(' {$$ = TrCreateLeafNode (PARSEOP_ELSE);} - TermArg {$$ = TrCreateLeafNode (PARSEOP_IF);} - ')' '{' - TermList '}' {TrLinkChildren ($5,2,$4,$8);} - ElseTerm {TrLinkPeerNode ($5,$11);} - {$$ = TrLinkChildren ($3,1,$5);} - - | PARSEOP_ELSEIF '(' - error ')' {$$ = AslDoError(); yyclearin;} - - | PARSEOP_ELSEIF - error {$$ = AslDoError(); yyclearin;} - ; - -LoadTerm - : PARSEOP_LOAD '(' {$$ = TrCreateLeafNode (PARSEOP_LOAD);} - NameString - RequiredTarget - ')' {$$ = TrLinkChildren ($3,2,$4,$5);} - | PARSEOP_LOAD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -NoOpTerm - : PARSEOP_NOOP {$$ = TrCreateNode (PARSEOP_NOOP, 0);} - ; - -NotifyTerm - : PARSEOP_NOTIFY '(' {$$ = TrCreateLeafNode (PARSEOP_NOTIFY);} - SuperName - TermArgItem - ')' {$$ = TrLinkChildren ($3,2,$4,$5);} - | PARSEOP_NOTIFY '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ReleaseTerm - : PARSEOP_RELEASE '(' {$$ = TrCreateLeafNode (PARSEOP_RELEASE);} - SuperName - ')' {$$ = TrLinkChildren ($3,1,$4);} - | PARSEOP_RELEASE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ResetTerm - : PARSEOP_RESET '(' {$$ = TrCreateLeafNode (PARSEOP_RESET);} - SuperName - ')' {$$ = TrLinkChildren ($3,1,$4);} - | PARSEOP_RESET '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ReturnTerm - : PARSEOP_RETURN '(' {$$ = TrCreateLeafNode (PARSEOP_RETURN);} - OptionalReturnArg - ')' {$$ = TrLinkChildren ($3,1,$4);} - | PARSEOP_RETURN {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_RETURN),1,TrCreateLeafNode (PARSEOP_ZERO));} - | PARSEOP_RETURN '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -SignalTerm - : PARSEOP_SIGNAL '(' {$$ = TrCreateLeafNode (PARSEOP_SIGNAL);} - SuperName - ')' {$$ = TrLinkChildren ($3,1,$4);} - | PARSEOP_SIGNAL '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -SleepTerm - : PARSEOP_SLEEP '(' {$$ = TrCreateLeafNode (PARSEOP_SLEEP);} - TermArg - ')' {$$ = TrLinkChildren ($3,1,$4);} - | PARSEOP_SLEEP '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -StallTerm - : PARSEOP_STALL '(' {$$ = TrCreateLeafNode (PARSEOP_STALL);} - TermArg - ')' {$$ = TrLinkChildren ($3,1,$4);} - | PARSEOP_STALL '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -SwitchTerm - : PARSEOP_SWITCH '(' {$$ = TrCreateLeafNode (PARSEOP_SWITCH);} - TermArg - ')' '{' - CaseDefaultTermList '}' - {$$ = TrLinkChildren ($3,2,$4,$7);} - | PARSEOP_SWITCH '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -/* - * Case-Default list; allow only one Default term and unlimited Case terms - */ - -CaseDefaultTermList - : {$$ = NULL;} - | CaseTerm {} - | DefaultTerm {} - | CaseDefaultTermList - CaseTerm {$$ = TrLinkPeerNode ($1,$2);} - | CaseDefaultTermList - DefaultTerm {$$ = TrLinkPeerNode ($1,$2);} - -/* Original - attempts to force zero or one default term within the switch */ - -/* -CaseDefaultTermList - : {$$ = NULL;} - | CaseTermList - DefaultTerm - CaseTermList {$$ = TrLinkPeerNode ($1,TrLinkPeerNode ($2, $3));} - | CaseTermList - CaseTerm {$$ = TrLinkPeerNode ($1,$2);} - ; - -CaseTermList - : {$$ = NULL;} - | CaseTerm {} - | CaseTermList - CaseTerm {$$ = TrLinkPeerNode ($1,$2);} - ; -*/ - -CaseTerm - : PARSEOP_CASE '(' {$$ = TrCreateLeafNode (PARSEOP_CASE);} - DataObject - ')' '{' - TermList '}' {$$ = TrLinkChildren ($3,2,$4,$7);} - | PARSEOP_CASE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -DefaultTerm - : PARSEOP_DEFAULT '{' {$$ = TrCreateLeafNode (PARSEOP_DEFAULT);} - TermList '}' {$$ = TrLinkChildren ($3,1,$4);} - | PARSEOP_DEFAULT '{' - error '}' {$$ = AslDoError(); yyclearin;} - ; - -UnloadTerm - : PARSEOP_UNLOAD '(' {$$ = TrCreateLeafNode (PARSEOP_UNLOAD);} - SuperName - ')' {$$ = TrLinkChildren ($3,1,$4);} - | PARSEOP_UNLOAD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -WhileTerm - : PARSEOP_WHILE '(' {$$ = TrCreateLeafNode (PARSEOP_WHILE);} - TermArg - ')' '{' TermList '}' - {$$ = TrLinkChildren ($3,2,$4,$7);} - | PARSEOP_WHILE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - - -/******* Type 2 opcodes *******************************************************/ - -AcquireTerm - : PARSEOP_ACQUIRE '(' {$$ = TrCreateLeafNode (PARSEOP_ACQUIRE);} - SuperName - ',' WordConstExpr - ')' {$$ = TrLinkChildren ($3,2,$4,$6);} - | PARSEOP_ACQUIRE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -AddTerm - : PARSEOP_ADD '(' {$$ = TrCreateLeafNode (PARSEOP_ADD);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($3,3,$4,$5,$6);} - | PARSEOP_ADD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -AndTerm - : PARSEOP_AND '(' {$$ = TrCreateLeafNode (PARSEOP_AND);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($3,3,$4,$5,$6);} - | PARSEOP_AND '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ConcatTerm - : PARSEOP_CONCATENATE '(' {$$ = TrCreateLeafNode (PARSEOP_CONCATENATE);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($3,3,$4,$5,$6);} - | PARSEOP_CONCATENATE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ConcatResTerm - : PARSEOP_CONCATENATERESTEMPLATE '(' {$$ = TrCreateLeafNode (PARSEOP_CONCATENATERESTEMPLATE);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($3,3,$4,$5,$6);} - | PARSEOP_CONCATENATERESTEMPLATE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -CondRefOfTerm - : PARSEOP_CONDREFOF '(' {$$ = TrCreateLeafNode (PARSEOP_CONDREFOF);} - SuperName - Target - ')' {$$ = TrLinkChildren ($3,2,$4,$5);} - | PARSEOP_CONDREFOF '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -CopyObjectTerm - : PARSEOP_COPYOBJECT '(' {$$ = TrCreateLeafNode (PARSEOP_COPYOBJECT);} - TermArg - ',' SimpleTarget - ')' {$$ = TrLinkChildren ($3,2,$4,TrSetNodeFlags ($6, NODE_IS_TARGET));} - | PARSEOP_COPYOBJECT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -DecTerm - : PARSEOP_DECREMENT '(' {$$ = TrCreateLeafNode (PARSEOP_DECREMENT);} - SuperName - ')' {$$ = TrLinkChildren ($3,1,$4);} - | PARSEOP_DECREMENT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -DerefOfTerm - : PARSEOP_DEREFOF '(' {$$ = TrCreateLeafNode (PARSEOP_DEREFOF);} - TermArg - ')' {$$ = TrLinkChildren ($3,1,$4);} - | PARSEOP_DEREFOF '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -DivideTerm - : PARSEOP_DIVIDE '(' {$$ = TrCreateLeafNode (PARSEOP_DIVIDE);} - TermArg - TermArgItem - Target - Target - ')' {$$ = TrLinkChildren ($3,4,$4,$5,$6,$7);} - | PARSEOP_DIVIDE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -FindSetLeftBitTerm - : PARSEOP_FINDSETLEFTBIT '(' {$$ = TrCreateLeafNode (PARSEOP_FINDSETLEFTBIT);} - TermArg - Target - ')' {$$ = TrLinkChildren ($3,2,$4,$5);} - | PARSEOP_FINDSETLEFTBIT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -FindSetRightBitTerm - : PARSEOP_FINDSETRIGHTBIT '(' {$$ = TrCreateLeafNode (PARSEOP_FINDSETRIGHTBIT);} - TermArg - Target - ')' {$$ = TrLinkChildren ($3,2,$4,$5);} - | PARSEOP_FINDSETRIGHTBIT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -FromBCDTerm - : PARSEOP_FROMBCD '(' {$$ = TrCreateLeafNode (PARSEOP_FROMBCD);} - TermArg - Target - ')' {$$ = TrLinkChildren ($3,2,$4,$5);} - | PARSEOP_FROMBCD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -IncTerm - : PARSEOP_INCREMENT '(' {$$ = TrCreateLeafNode (PARSEOP_INCREMENT);} - SuperName - ')' {$$ = TrLinkChildren ($3,1,$4);} - | PARSEOP_INCREMENT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -IndexTerm - : PARSEOP_INDEX '(' {$$ = TrCreateLeafNode (PARSEOP_INDEX);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($3,3,$4,$5,$6);} - | PARSEOP_INDEX '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -LAndTerm - : PARSEOP_LAND '(' {$$ = TrCreateLeafNode (PARSEOP_LAND);} - TermArg - TermArgItem - ')' {$$ = TrLinkChildren ($3,2,$4,$5);} - | PARSEOP_LAND '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -LEqualTerm - : PARSEOP_LEQUAL '(' {$$ = TrCreateLeafNode (PARSEOP_LEQUAL);} - TermArg - TermArgItem - ')' {$$ = TrLinkChildren ($3,2,$4,$5);} - | PARSEOP_LEQUAL '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -LGreaterTerm - : PARSEOP_LGREATER '(' {$$ = TrCreateLeafNode (PARSEOP_LGREATER);} - TermArg - TermArgItem - ')' {$$ = TrLinkChildren ($3,2,$4,$5);} - | PARSEOP_LGREATER '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -LGreaterEqualTerm - : PARSEOP_LGREATEREQUAL '(' {$$ = TrCreateLeafNode (PARSEOP_LLESS);} - TermArg - TermArgItem - ')' {$$ = TrCreateNode (PARSEOP_LNOT, 1, TrLinkChildren ($3,2,$4,$5));} - | PARSEOP_LGREATEREQUAL '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -LLessTerm - : PARSEOP_LLESS '(' {$$ = TrCreateLeafNode (PARSEOP_LLESS);} - TermArg - TermArgItem - ')' {$$ = TrLinkChildren ($3,2,$4,$5);} - | PARSEOP_LLESS '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -LLessEqualTerm - : PARSEOP_LLESSEQUAL '(' {$$ = TrCreateLeafNode (PARSEOP_LGREATER);} - TermArg - TermArgItem - ')' {$$ = TrCreateNode (PARSEOP_LNOT, 1, TrLinkChildren ($3,2,$4,$5));} - | PARSEOP_LLESSEQUAL '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -LNotTerm - : PARSEOP_LNOT '(' {$$ = TrCreateLeafNode (PARSEOP_LNOT);} - TermArg - ')' {$$ = TrLinkChildren ($3,1,$4);} - | PARSEOP_LNOT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -LNotEqualTerm - : PARSEOP_LNOTEQUAL '(' {$$ = TrCreateLeafNode (PARSEOP_LEQUAL);} - TermArg - TermArgItem - ')' {$$ = TrCreateNode (PARSEOP_LNOT, 1, TrLinkChildren ($3,2,$4,$5));} - | PARSEOP_LNOTEQUAL '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -LoadTableTerm - : PARSEOP_LOADTABLE '(' {$$ = TrCreateLeafNode (PARSEOP_LOADTABLE);} - TermArg - TermArgItem - TermArgItem - OptionalListString - OptionalListString - OptionalReference - ')' {$$ = TrLinkChildren ($3,6,$4,$5,$6,$7,$8,$9);} - | PARSEOP_LOADTABLE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -LOrTerm - : PARSEOP_LOR '(' {$$ = TrCreateLeafNode (PARSEOP_LOR);} - TermArg - TermArgItem - ')' {$$ = TrLinkChildren ($3,2,$4,$5);} - | PARSEOP_LOR '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -MatchTerm - : PARSEOP_MATCH '(' {$$ = TrCreateLeafNode (PARSEOP_MATCH);} - TermArg - ',' MatchOpKeyword - TermArgItem - ',' MatchOpKeyword - TermArgItem - TermArgItem - ')' {$$ = TrLinkChildren ($3,6,$4,$6,$7,$9,$10,$11);} - | PARSEOP_MATCH '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -MidTerm - : PARSEOP_MID '(' {$$ = TrCreateLeafNode (PARSEOP_MID);} - TermArg - TermArgItem - TermArgItem - Target - ')' {$$ = TrLinkChildren ($3,4,$4,$5,$6,$7);} - | PARSEOP_MID '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ModTerm - : PARSEOP_MOD '(' {$$ = TrCreateLeafNode (PARSEOP_MOD);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($3,3,$4,$5,$6);} - | PARSEOP_MOD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -MultiplyTerm - : PARSEOP_MULTIPLY '(' {$$ = TrCreateLeafNode (PARSEOP_MULTIPLY);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($3,3,$4,$5,$6);} - | PARSEOP_MULTIPLY '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -NAndTerm - : PARSEOP_NAND '(' {$$ = TrCreateLeafNode (PARSEOP_NAND);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($3,3,$4,$5,$6);} - | PARSEOP_NAND '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -NOrTerm - : PARSEOP_NOR '(' {$$ = TrCreateLeafNode (PARSEOP_NOR);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($3,3,$4,$5,$6);} - | PARSEOP_NOR '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -NotTerm - : PARSEOP_NOT '(' {$$ = TrCreateLeafNode (PARSEOP_NOT);} - TermArg - Target - ')' {$$ = TrLinkChildren ($3,2,$4,$5);} - | PARSEOP_NOT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ObjectTypeTerm - : PARSEOP_OBJECTTYPE '(' {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE);} - SuperName - ')' {$$ = TrLinkChildren ($3,1,$4);} - | PARSEOP_OBJECTTYPE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -OrTerm - : PARSEOP_OR '(' {$$ = TrCreateLeafNode (PARSEOP_OR);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($3,3,$4,$5,$6);} - | PARSEOP_OR '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -/* - * In RefOf, the node isn't really a target, but we can't keep track of it after - * we've taken a pointer to it. (hard to tell if a local becomes initialized this way.) - */ -RefOfTerm - : PARSEOP_REFOF '(' {$$ = TrCreateLeafNode (PARSEOP_REFOF);} - SuperName - ')' {$$ = TrLinkChildren ($3,1,TrSetNodeFlags ($4, NODE_IS_TARGET));} - | PARSEOP_REFOF '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ShiftLeftTerm - : PARSEOP_SHIFTLEFT '(' {$$ = TrCreateLeafNode (PARSEOP_SHIFTLEFT);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($3,3,$4,$5,$6);} - | PARSEOP_SHIFTLEFT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ShiftRightTerm - : PARSEOP_SHIFTRIGHT '(' {$$ = TrCreateLeafNode (PARSEOP_SHIFTRIGHT);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($3,3,$4,$5,$6);} - | PARSEOP_SHIFTRIGHT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -SizeOfTerm - : PARSEOP_SIZEOF '(' {$$ = TrCreateLeafNode (PARSEOP_SIZEOF);} - SuperName - ')' {$$ = TrLinkChildren ($3,1,$4);} - | PARSEOP_SIZEOF '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -StoreTerm - : PARSEOP_STORE '(' {$$ = TrCreateLeafNode (PARSEOP_STORE);} - TermArg - ',' SuperName - ')' {$$ = TrLinkChildren ($3,2,$4,TrSetNodeFlags ($6, NODE_IS_TARGET));} - | PARSEOP_STORE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -SubtractTerm - : PARSEOP_SUBTRACT '(' {$$ = TrCreateLeafNode (PARSEOP_SUBTRACT);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($3,3,$4,$5,$6);} - | PARSEOP_SUBTRACT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -TimerTerm - : PARSEOP_TIMER '(' {$$ = TrCreateLeafNode (PARSEOP_TIMER);} - ')' {$$ = TrLinkChildren ($3,0);} - | PARSEOP_TIMER {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_TIMER),0);} - | PARSEOP_TIMER '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ToBCDTerm - : PARSEOP_TOBCD '(' {$$ = TrCreateLeafNode (PARSEOP_TOBCD);} - TermArg - Target - ')' {$$ = TrLinkChildren ($3,2,$4,$5);} - | PARSEOP_TOBCD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ToBufferTerm - : PARSEOP_TOBUFFER '(' {$$ = TrCreateLeafNode (PARSEOP_TOBUFFER);} - TermArg - Target - ')' {$$ = TrLinkChildren ($3,2,$4,$5);} - | PARSEOP_TOBUFFER '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ToDecimalStringTerm - : PARSEOP_TODECIMALSTRING '(' {$$ = TrCreateLeafNode (PARSEOP_TODECIMALSTRING);} - TermArg - Target - ')' {$$ = TrLinkChildren ($3,2,$4,$5);} - | PARSEOP_TODECIMALSTRING '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ToHexStringTerm - : PARSEOP_TOHEXSTRING '(' {$$ = TrCreateLeafNode (PARSEOP_TOHEXSTRING);} - TermArg - Target - ')' {$$ = TrLinkChildren ($3,2,$4,$5);} - | PARSEOP_TOHEXSTRING '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ToIntegerTerm - : PARSEOP_TOINTEGER '(' {$$ = TrCreateLeafNode (PARSEOP_TOINTEGER);} - TermArg - Target - ')' {$$ = TrLinkChildren ($3,2,$4,$5);} - | PARSEOP_TOINTEGER '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ToStringTerm - : PARSEOP_TOSTRING '(' {$$ = TrCreateLeafNode (PARSEOP_TOSTRING);} - TermArg - OptionalCount - Target - ')' {$$ = TrLinkChildren ($3,3,$4,$5,$6);} - | PARSEOP_TOSTRING '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ToUUIDTerm - : PARSEOP_TOUUID '(' - StringData ')' {$$ = TrUpdateNode (PARSEOP_TOUUID, $3);} - | PARSEOP_TOUUID '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -WaitTerm - : PARSEOP_WAIT '(' {$$ = TrCreateLeafNode (PARSEOP_WAIT);} - SuperName - TermArgItem - ')' {$$ = TrLinkChildren ($3,2,$4,$5);} - | PARSEOP_WAIT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -XOrTerm - : PARSEOP_XOR '(' {$$ = TrCreateLeafNode (PARSEOP_XOR);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($3,3,$4,$5,$6);} - | PARSEOP_XOR '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - - -/******* Keywords *************************************************************/ - - -ObjectTypeKeyword - : PARSEOP_OBJECTTYPE_UNK {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_UNK);} - | PARSEOP_OBJECTTYPE_INT {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_INT);} - | PARSEOP_OBJECTTYPE_STR {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_STR);} - | PARSEOP_OBJECTTYPE_BUF {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_BUF);} - | PARSEOP_OBJECTTYPE_PKG {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_PKG);} - | PARSEOP_OBJECTTYPE_FLD {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_FLD);} - | PARSEOP_OBJECTTYPE_DEV {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_DEV);} - | PARSEOP_OBJECTTYPE_EVT {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_EVT);} - | PARSEOP_OBJECTTYPE_MTH {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_MTH);} - | PARSEOP_OBJECTTYPE_MTX {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_MTX);} - | PARSEOP_OBJECTTYPE_OPR {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_OPR);} - | PARSEOP_OBJECTTYPE_POW {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_POW);} - | PARSEOP_OBJECTTYPE_PRO {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_PRO);} - | PARSEOP_OBJECTTYPE_THZ {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_THZ);} - | PARSEOP_OBJECTTYPE_BFF {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_BFF);} - | PARSEOP_OBJECTTYPE_DDB {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_DDB);} - ; - -AccessTypeKeyword - : PARSEOP_ACCESSTYPE_ANY {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_ANY);} - | PARSEOP_ACCESSTYPE_BYTE {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_BYTE);} - | PARSEOP_ACCESSTYPE_WORD {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_WORD);} - | PARSEOP_ACCESSTYPE_DWORD {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_DWORD);} - | PARSEOP_ACCESSTYPE_QWORD {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_QWORD);} - | PARSEOP_ACCESSTYPE_BUF {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_BUF);} - ; - -AccessAttribKeyword - : PARSEOP_ACCESSATTRIB_QUICK {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_QUICK );} - | PARSEOP_ACCESSATTRIB_SND_RCV {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_SND_RCV);} - | PARSEOP_ACCESSATTRIB_BYTE {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_BYTE);} - | PARSEOP_ACCESSATTRIB_WORD {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_WORD);} - | PARSEOP_ACCESSATTRIB_BLOCK {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_BLOCK);} - | PARSEOP_ACCESSATTRIB_WORD_CALL {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_WORD_CALL);} - | PARSEOP_ACCESSATTRIB_BLOCK_CALL {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_BLOCK_CALL);} - ; - -LockRuleKeyword - : PARSEOP_LOCKRULE_LOCK {$$ = TrCreateLeafNode (PARSEOP_LOCKRULE_LOCK);} - | PARSEOP_LOCKRULE_NOLOCK {$$ = TrCreateLeafNode (PARSEOP_LOCKRULE_NOLOCK);} - ; - -UpdateRuleKeyword - : PARSEOP_UPDATERULE_PRESERVE {$$ = TrCreateLeafNode (PARSEOP_UPDATERULE_PRESERVE);} - | PARSEOP_UPDATERULE_ONES {$$ = TrCreateLeafNode (PARSEOP_UPDATERULE_ONES);} - | PARSEOP_UPDATERULE_ZEROS {$$ = TrCreateLeafNode (PARSEOP_UPDATERULE_ZEROS);} - ; - - -RegionSpaceKeyword - : PARSEOP_REGIONSPACE_IO {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_IO);} - | PARSEOP_REGIONSPACE_MEM {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_MEM);} - | PARSEOP_REGIONSPACE_PCI {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_PCI);} - | PARSEOP_REGIONSPACE_EC {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_EC);} - | PARSEOP_REGIONSPACE_SMBUS {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_SMBUS);} - | PARSEOP_REGIONSPACE_CMOS {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_CMOS);} - | PARSEOP_REGIONSPACE_PCIBAR {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_PCIBAR);} - | PARSEOP_REGIONSPACE_IPMI {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_IPMI);} - ; - -AddressSpaceKeyword - : ByteConst {$$ = UtCheckIntegerRange ($1, 0x80, 0xFF);} - | RegionSpaceKeyword {} - | PARSEOP_ADDRESSSPACE_FFIXEDHW {$$ = TrCreateLeafNode (PARSEOP_ADDRESSSPACE_FFIXEDHW);} - ; - - -SerializeRuleKeyword - : PARSEOP_SERIALIZERULE_SERIAL {$$ = TrCreateLeafNode (PARSEOP_SERIALIZERULE_SERIAL);} - | PARSEOP_SERIALIZERULE_NOTSERIAL {$$ = TrCreateLeafNode (PARSEOP_SERIALIZERULE_NOTSERIAL);} - ; - -MatchOpKeyword - : PARSEOP_MATCHTYPE_MTR {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MTR);} - | PARSEOP_MATCHTYPE_MEQ {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MEQ);} - | PARSEOP_MATCHTYPE_MLE {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MLE);} - | PARSEOP_MATCHTYPE_MLT {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MLT);} - | PARSEOP_MATCHTYPE_MGE {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MGE);} - | PARSEOP_MATCHTYPE_MGT {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MGT);} - ; - -DMATypeKeyword - : PARSEOP_DMATYPE_A {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_A);} - | PARSEOP_DMATYPE_COMPATIBILITY {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_COMPATIBILITY);} - | PARSEOP_DMATYPE_B {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_B);} - | PARSEOP_DMATYPE_F {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_F);} - ; - -XferTypeKeyword - : PARSEOP_XFERTYPE_8 {$$ = TrCreateLeafNode (PARSEOP_XFERTYPE_8);} - | PARSEOP_XFERTYPE_8_16 {$$ = TrCreateLeafNode (PARSEOP_XFERTYPE_8_16);} - | PARSEOP_XFERTYPE_16 {$$ = TrCreateLeafNode (PARSEOP_XFERTYPE_16);} - ; - -ResourceTypeKeyword - : PARSEOP_RESOURCETYPE_CONSUMER {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_CONSUMER);} - | PARSEOP_RESOURCETYPE_PRODUCER {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_PRODUCER);} - ; - -MinKeyword - : PARSEOP_MINTYPE_FIXED {$$ = TrCreateLeafNode (PARSEOP_MINTYPE_FIXED);} - | PARSEOP_MINTYPE_NOTFIXED {$$ = TrCreateLeafNode (PARSEOP_MINTYPE_NOTFIXED);} - ; - -MaxKeyword - : PARSEOP_MAXTYPE_FIXED {$$ = TrCreateLeafNode (PARSEOP_MAXTYPE_FIXED);} - | PARSEOP_MAXTYPE_NOTFIXED {$$ = TrCreateLeafNode (PARSEOP_MAXTYPE_NOTFIXED);} - ; - -DecodeKeyword - : PARSEOP_DECODETYPE_POS {$$ = TrCreateLeafNode (PARSEOP_DECODETYPE_POS);} - | PARSEOP_DECODETYPE_SUB {$$ = TrCreateLeafNode (PARSEOP_DECODETYPE_SUB);} - ; - -RangeTypeKeyword - : PARSEOP_RANGETYPE_ISAONLY {$$ = TrCreateLeafNode (PARSEOP_RANGETYPE_ISAONLY);} - | PARSEOP_RANGETYPE_NONISAONLY {$$ = TrCreateLeafNode (PARSEOP_RANGETYPE_NONISAONLY);} - | PARSEOP_RANGETYPE_ENTIRE {$$ = TrCreateLeafNode (PARSEOP_RANGETYPE_ENTIRE);} - ; - -MemTypeKeyword - : PARSEOP_MEMTYPE_CACHEABLE {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_CACHEABLE);} - | PARSEOP_MEMTYPE_WRITECOMBINING {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_WRITECOMBINING);} - | PARSEOP_MEMTYPE_PREFETCHABLE {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_PREFETCHABLE);} - | PARSEOP_MEMTYPE_NONCACHEABLE {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_NONCACHEABLE);} - ; - -OptionalReadWriteKeyword - : {$$ = TrCreateLeafNode (PARSEOP_READWRITETYPE_BOTH);} - | PARSEOP_READWRITETYPE_BOTH {$$ = TrCreateLeafNode (PARSEOP_READWRITETYPE_BOTH);} - | PARSEOP_READWRITETYPE_READONLY {$$ = TrCreateLeafNode (PARSEOP_READWRITETYPE_READONLY);} - ; - -InterruptTypeKeyword - : PARSEOP_INTTYPE_EDGE {$$ = TrCreateLeafNode (PARSEOP_INTTYPE_EDGE);} - | PARSEOP_INTTYPE_LEVEL {$$ = TrCreateLeafNode (PARSEOP_INTTYPE_LEVEL);} - ; - -InterruptLevel - : PARSEOP_INTLEVEL_ACTIVEHIGH {$$ = TrCreateLeafNode (PARSEOP_INTLEVEL_ACTIVEHIGH);} - | PARSEOP_INTLEVEL_ACTIVELOW {$$ = TrCreateLeafNode (PARSEOP_INTLEVEL_ACTIVELOW);} - ; - -ShareTypeKeyword - : PARSEOP_SHARETYPE_SHARED {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_SHARED);} - | PARSEOP_SHARETYPE_EXCLUSIVE {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_EXCLUSIVE);} - ; - -IODecodeKeyword - : PARSEOP_IODECODETYPE_16 {$$ = TrCreateLeafNode (PARSEOP_IODECODETYPE_16);} - | PARSEOP_IODECODETYPE_10 {$$ = TrCreateLeafNode (PARSEOP_IODECODETYPE_10);} - ; - -TypeKeyword - : PARSEOP_TYPE_TRANSLATION {$$ = TrCreateLeafNode (PARSEOP_TYPE_TRANSLATION);} - | PARSEOP_TYPE_STATIC {$$ = TrCreateLeafNode (PARSEOP_TYPE_STATIC);} - ; - -TranslationKeyword - : PARSEOP_TRANSLATIONTYPE_SPARSE {$$ = TrCreateLeafNode (PARSEOP_TRANSLATIONTYPE_SPARSE);} - | PARSEOP_TRANSLATIONTYPE_DENSE {$$ = TrCreateLeafNode (PARSEOP_TRANSLATIONTYPE_DENSE);} - ; - -AddressKeyword - : PARSEOP_ADDRESSTYPE_MEMORY {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_MEMORY);} - | PARSEOP_ADDRESSTYPE_RESERVED {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_RESERVED);} - | PARSEOP_ADDRESSTYPE_NVS {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_NVS);} - | PARSEOP_ADDRESSTYPE_ACPI {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_ACPI);} - ; - - -/******* Miscellaneous Types **************************************************/ - - -SuperName - : NameString {} - | ArgTerm {} - | LocalTerm {} - | DebugTerm {} - | Type6Opcode {} -/* | UserTerm {} */ /* Caused reduce/reduce with Type6Opcode->UserTerm */ - ; - -ArgTerm - : PARSEOP_ARG0 {$$ = TrCreateLeafNode (PARSEOP_ARG0);} - | PARSEOP_ARG1 {$$ = TrCreateLeafNode (PARSEOP_ARG1);} - | PARSEOP_ARG2 {$$ = TrCreateLeafNode (PARSEOP_ARG2);} - | PARSEOP_ARG3 {$$ = TrCreateLeafNode (PARSEOP_ARG3);} - | PARSEOP_ARG4 {$$ = TrCreateLeafNode (PARSEOP_ARG4);} - | PARSEOP_ARG5 {$$ = TrCreateLeafNode (PARSEOP_ARG5);} - | PARSEOP_ARG6 {$$ = TrCreateLeafNode (PARSEOP_ARG6);} - ; - -LocalTerm - : PARSEOP_LOCAL0 {$$ = TrCreateLeafNode (PARSEOP_LOCAL0);} - | PARSEOP_LOCAL1 {$$ = TrCreateLeafNode (PARSEOP_LOCAL1);} - | PARSEOP_LOCAL2 {$$ = TrCreateLeafNode (PARSEOP_LOCAL2);} - | PARSEOP_LOCAL3 {$$ = TrCreateLeafNode (PARSEOP_LOCAL3);} - | PARSEOP_LOCAL4 {$$ = TrCreateLeafNode (PARSEOP_LOCAL4);} - | PARSEOP_LOCAL5 {$$ = TrCreateLeafNode (PARSEOP_LOCAL5);} - | PARSEOP_LOCAL6 {$$ = TrCreateLeafNode (PARSEOP_LOCAL6);} - | PARSEOP_LOCAL7 {$$ = TrCreateLeafNode (PARSEOP_LOCAL7);} - ; - -DebugTerm - : PARSEOP_DEBUG {$$ = TrCreateLeafNode (PARSEOP_DEBUG);} - ; - - -ByteConst - : Integer {$$ = TrUpdateNode (PARSEOP_BYTECONST, $1);} - ; - -WordConst - : Integer {$$ = TrUpdateNode (PARSEOP_WORDCONST, $1);} - ; - -DWordConst - : Integer {$$ = TrUpdateNode (PARSEOP_DWORDCONST, $1);} - ; - -QWordConst - : Integer {$$ = TrUpdateNode (PARSEOP_QWORDCONST, $1);} - ; - -Integer - : PARSEOP_INTEGER {$$ = TrCreateValuedLeafNode (PARSEOP_INTEGER, AslCompilerlval.i);} - ; - -String - : PARSEOP_STRING_LITERAL {$$ = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL, (ACPI_NATIVE_INT) AslCompilerlval.s);} - ; - -ConstTerm - : ConstExprTerm {} - | PARSEOP_REVISION {$$ = TrCreateLeafNode (PARSEOP_REVISION);} - ; - -ByteConstExpr - : Type3Opcode {$$ = TrUpdateNode (PARSEOP_BYTECONST, $1);} - | Type2IntegerOpcode {$$ = TrUpdateNode (PARSEOP_BYTECONST, $1);} - | ConstExprTerm {$$ = TrUpdateNode (PARSEOP_BYTECONST, $1);} - | ByteConst {} - ; - -WordConstExpr - : Type3Opcode {$$ = TrUpdateNode (PARSEOP_WORDCONST, $1);} - | Type2IntegerOpcode {$$ = TrUpdateNode (PARSEOP_WORDCONST, $1);} - | ConstExprTerm {$$ = TrUpdateNode (PARSEOP_WORDCONST, $1);} - | WordConst {} - ; - -DWordConstExpr - : Type3Opcode {$$ = TrUpdateNode (PARSEOP_DWORDCONST, $1);} - | Type2IntegerOpcode {$$ = TrUpdateNode (PARSEOP_DWORDCONST, $1);} - | ConstExprTerm {$$ = TrUpdateNode (PARSEOP_DWORDCONST, $1);} - | DWordConst {} - ; - -QWordConstExpr - : Type3Opcode {$$ = TrUpdateNode (PARSEOP_QWORDCONST, $1);} - | Type2IntegerOpcode {$$ = TrUpdateNode (PARSEOP_QWORDCONST, $1);} - | ConstExprTerm {$$ = TrUpdateNode (PARSEOP_QWORDCONST, $1);} - | QWordConst {} - ; - -ConstExprTerm - : PARSEOP_ZERO {$$ = TrCreateValuedLeafNode (PARSEOP_ZERO, 0);} - | PARSEOP_ONE {$$ = TrCreateValuedLeafNode (PARSEOP_ONE, 1);} - | PARSEOP_ONES {$$ = TrCreateValuedLeafNode (PARSEOP_ONES, ACPI_UINT64_MAX);} - ; - -/* OptionalCount must appear before ByteList or an incorrect reduction will result */ - -OptionalCount - : {$$ = TrCreateLeafNode (PARSEOP_ONES);} /* Placeholder is a OnesOp object */ - | ',' {$$ = TrCreateLeafNode (PARSEOP_ONES);} /* Placeholder is a OnesOp object */ - | ',' TermArg {$$ = $2;} - ; - - -BufferTerm - : PARSEOP_BUFFER '(' {$$ = TrCreateLeafNode (PARSEOP_BUFFER);} - OptionalTermArg - ')' '{' - BufferTermData '}' {$$ = TrLinkChildren ($3,2,$4,$7);} - | PARSEOP_BUFFER '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -BufferTermData - : ByteList {} - | StringData {} - ; - -ByteList - : {$$ = NULL;} - | ByteConstExpr - | ByteList ',' /* Allows a trailing comma at list end */ - | ByteList ',' - ByteConstExpr {$$ = TrLinkPeerNode ($1,$3);} - ; - -DWordList - : {$$ = NULL;} - | DWordConstExpr - | DWordList ',' /* Allows a trailing comma at list end */ - | DWordList ',' - DWordConstExpr {$$ = TrLinkPeerNode ($1,$3);} - ; - -PackageTerm - : PARSEOP_PACKAGE '(' {$$ = TrCreateLeafNode (PARSEOP_VAR_PACKAGE);} - VarPackageLengthTerm - ')' '{' - PackageList '}' {$$ = TrLinkChildren ($3,2,$4,$7);} - | PARSEOP_PACKAGE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -VarPackageLengthTerm - : {$$ = TrCreateLeafNode (PARSEOP_DEFAULT_ARG);} - | TermArg {$$ = $1;} - ; - -PackageList - : {$$ = NULL;} - | PackageElement - | PackageList ',' /* Allows a trailing comma at list end */ - | PackageList ',' - PackageElement {$$ = TrLinkPeerNode ($1,$3);} - ; - -PackageElement - : DataObject {} - | NameString {} - ; - -EISAIDTerm - : PARSEOP_EISAID '(' - StringData ')' {$$ = TrUpdateNode (PARSEOP_EISAID, $3);} - | PARSEOP_EISAID '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - - -/******* Resources and Memory ***********************************************/ - - -/* - * Note: Create two default nodes to allow conversion to a Buffer AML opcode - * Also, insert the EndTag at the end of the template. - */ -ResourceTemplateTerm - : PARSEOP_RESOURCETEMPLATE '(' ')' - '{' - ResourceMacroList '}' {$$ = TrCreateNode (PARSEOP_RESOURCETEMPLATE,4, - TrCreateLeafNode (PARSEOP_DEFAULT_ARG), - TrCreateLeafNode (PARSEOP_DEFAULT_ARG), - $5, - TrCreateLeafNode (PARSEOP_ENDTAG));} - ; - -UnicodeTerm - : PARSEOP_UNICODE '(' {$$ = TrCreateLeafNode (PARSEOP_UNICODE);} - StringData - ')' {$$ = TrLinkChildren ($3,2,0,$4);} - | PARSEOP_UNICODE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ResourceMacroList - : {$$ = NULL;} - | ResourceMacroList - ResourceMacroTerm {$$ = TrLinkPeerNode ($1,$2);} - ; - -ResourceMacroTerm - : DMATerm {} - | DWordIOTerm {} - | DWordMemoryTerm {} - | DWordSpaceTerm {} - | EndDependentFnTerm {} - | ExtendedIOTerm {} - | ExtendedMemoryTerm {} - | ExtendedSpaceTerm {} - | FixedIOTerm {} - | InterruptTerm {} - | IOTerm {} - | IRQNoFlagsTerm {} - | IRQTerm {} - | Memory24Term {} - | Memory32FixedTerm {} - | Memory32Term {} - | QWordIOTerm {} - | QWordMemoryTerm {} - | QWordSpaceTerm {} - | RegisterTerm {} - | StartDependentFnTerm {} - | StartDependentFnNoPriTerm {} - | VendorLongTerm {} - | VendorShortTerm {} - | WordBusNumberTerm {} - | WordIOTerm {} - | WordSpaceTerm {} - ; - -DMATerm - : PARSEOP_DMA '(' {$$ = TrCreateLeafNode (PARSEOP_DMA);} - DMATypeKeyword - OptionalBusMasterKeyword - ',' XferTypeKeyword - OptionalNameString_Last - ')' '{' - ByteList '}' {$$ = TrLinkChildren ($3,5,$4,$5,$7,$8,$11);} - | PARSEOP_DMA '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -DWordIOTerm - : PARSEOP_DWORDIO '(' {$$ = TrCreateLeafNode (PARSEOP_DWORDIO);} - OptionalResourceType_First - OptionalMinType - OptionalMaxType - OptionalDecodeType - OptionalRangeType - ',' DWordConstExpr - ',' DWordConstExpr - ',' DWordConstExpr - ',' DWordConstExpr - ',' DWordConstExpr - OptionalByteConstExpr - OptionalStringData - OptionalNameString - OptionalType - OptionalTranslationType_Last - ')' {$$ = TrLinkChildren ($3,15,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$19,$20,$21,$22,$23);} - | PARSEOP_DWORDIO '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -DWordMemoryTerm - : PARSEOP_DWORDMEMORY '(' {$$ = TrCreateLeafNode (PARSEOP_DWORDMEMORY);} - OptionalResourceType_First - OptionalDecodeType - OptionalMinType - OptionalMaxType - OptionalMemType - ',' OptionalReadWriteKeyword - ',' DWordConstExpr - ',' DWordConstExpr - ',' DWordConstExpr - ',' DWordConstExpr - ',' DWordConstExpr - OptionalByteConstExpr - OptionalStringData - OptionalNameString - OptionalAddressRange - OptionalType_Last - ')' {$$ = TrLinkChildren ($3,16,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$20,$21,$22,$23,$24,$25);} - | PARSEOP_DWORDMEMORY '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -DWordSpaceTerm - : PARSEOP_DWORDSPACE '(' {$$ = TrCreateLeafNode (PARSEOP_DWORDSPACE);} - ByteConstExpr {UtCheckIntegerRange ($4, 0xC0, 0xFF);} - OptionalResourceType - OptionalDecodeType - OptionalMinType - OptionalMaxType - ',' ByteConstExpr - ',' DWordConstExpr - ',' DWordConstExpr - ',' DWordConstExpr - ',' DWordConstExpr - ',' DWordConstExpr - OptionalByteConstExpr - OptionalStringData - OptionalNameString_Last - ')' {$$ = TrLinkChildren ($3,14,$4,$6,$7,$8,$9,$11,$13,$15,$17,$19,$21,$22,$23,$24);} - | PARSEOP_DWORDSPACE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - - -EndDependentFnTerm - : PARSEOP_ENDDEPENDENTFN '(' - ')' {$$ = TrCreateLeafNode (PARSEOP_ENDDEPENDENTFN);} - | PARSEOP_ENDDEPENDENTFN '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ExtendedIOTerm - : PARSEOP_EXTENDEDIO '(' {$$ = TrCreateLeafNode (PARSEOP_EXTENDEDIO);} - OptionalResourceType_First - OptionalMinType - OptionalMaxType - OptionalDecodeType - OptionalRangeType - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - OptionalQWordConstExpr - OptionalNameString - OptionalType - OptionalTranslationType_Last - ')' {$$ = TrLinkChildren ($3,14,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$19,$20,$21,$22);} - | PARSEOP_EXTENDEDIO '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ExtendedMemoryTerm - : PARSEOP_EXTENDEDMEMORY '(' {$$ = TrCreateLeafNode (PARSEOP_EXTENDEDMEMORY);} - OptionalResourceType_First - OptionalDecodeType - OptionalMinType - OptionalMaxType - OptionalMemType - ',' OptionalReadWriteKeyword - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - OptionalQWordConstExpr - OptionalNameString - OptionalAddressRange - OptionalType_Last - ')' {$$ = TrLinkChildren ($3,15,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$20,$21,$22,$23,$24);} - | PARSEOP_EXTENDEDMEMORY '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ExtendedSpaceTerm - : PARSEOP_EXTENDEDSPACE '(' {$$ = TrCreateLeafNode (PARSEOP_EXTENDEDSPACE);} - ByteConstExpr {UtCheckIntegerRange ($4, 0xC0, 0xFF);} - OptionalResourceType - OptionalDecodeType - OptionalMinType - OptionalMaxType - ',' ByteConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - OptionalQWordConstExpr - OptionalNameString_Last - ')' {$$ = TrLinkChildren ($3,13,$4,$6,$7,$8,$9,$11,$13,$15,$17,$19,$21,$22,$23);} - | PARSEOP_EXTENDEDSPACE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -FixedIOTerm - : PARSEOP_FIXEDIO '(' {$$ = TrCreateLeafNode (PARSEOP_FIXEDIO);} - WordConstExpr - ',' ByteConstExpr - OptionalNameString_Last - ')' {$$ = TrLinkChildren ($3,3,$4,$6,$7);} - | PARSEOP_FIXEDIO '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -InterruptTerm - : PARSEOP_INTERRUPT '(' {$$ = TrCreateLeafNode (PARSEOP_INTERRUPT);} - OptionalResourceType_First - ',' InterruptTypeKeyword - ',' InterruptLevel - OptionalShareType - OptionalByteConstExpr - OptionalStringData - OptionalNameString_Last - ')' '{' - DWordList '}' {$$ = TrLinkChildren ($3,8,$4,$6,$8,$9,$10,$11,$12,$15);} - | PARSEOP_INTERRUPT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -IOTerm - : PARSEOP_IO '(' {$$ = TrCreateLeafNode (PARSEOP_IO);} - IODecodeKeyword - ',' WordConstExpr - ',' WordConstExpr - ',' ByteConstExpr - ',' ByteConstExpr - OptionalNameString_Last - ')' {$$ = TrLinkChildren ($3,6,$4,$6,$8,$10,$12,$13);} - | PARSEOP_IO '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -IRQNoFlagsTerm - : PARSEOP_IRQNOFLAGS '(' {$$ = TrCreateLeafNode (PARSEOP_IRQNOFLAGS);} - OptionalNameString_First - ')' '{' - ByteList '}' {$$ = TrLinkChildren ($3,2,$4,$7);} - | PARSEOP_IRQNOFLAGS '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -IRQTerm - : PARSEOP_IRQ '(' {$$ = TrCreateLeafNode (PARSEOP_IRQ);} - InterruptTypeKeyword - ',' InterruptLevel - OptionalShareType - OptionalNameString_Last - ')' '{' - ByteList '}' {$$ = TrLinkChildren ($3,5,$4,$6,$7,$8,$11);} - | PARSEOP_IRQ '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -Memory24Term - : PARSEOP_MEMORY24 '(' {$$ = TrCreateLeafNode (PARSEOP_MEMORY24);} - OptionalReadWriteKeyword - ',' WordConstExpr - ',' WordConstExpr - ',' WordConstExpr - ',' WordConstExpr - OptionalNameString_Last - ')' {$$ = TrLinkChildren ($3,6,$4,$6,$8,$10,$12,$13);} - | PARSEOP_MEMORY24 '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -Memory32FixedTerm - : PARSEOP_MEMORY32FIXED '(' {$$ = TrCreateLeafNode (PARSEOP_MEMORY32FIXED);} - OptionalReadWriteKeyword - ',' DWordConstExpr - ',' DWordConstExpr - OptionalNameString_Last - ')' {$$ = TrLinkChildren ($3,4,$4,$6,$8,$9);} - | PARSEOP_MEMORY32FIXED '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -Memory32Term - : PARSEOP_MEMORY32 '(' {$$ = TrCreateLeafNode (PARSEOP_MEMORY32);} - OptionalReadWriteKeyword - ',' DWordConstExpr - ',' DWordConstExpr - ',' DWordConstExpr - ',' DWordConstExpr - OptionalNameString_Last - ')' {$$ = TrLinkChildren ($3,6,$4,$6,$8,$10,$12,$13);} - | PARSEOP_MEMORY32 '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -QWordIOTerm - : PARSEOP_QWORDIO '(' {$$ = TrCreateLeafNode (PARSEOP_QWORDIO);} - OptionalResourceType_First - OptionalMinType - OptionalMaxType - OptionalDecodeType - OptionalRangeType - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - OptionalByteConstExpr - OptionalStringData - OptionalNameString - OptionalType - OptionalTranslationType_Last - ')' {$$ = TrLinkChildren ($3,15,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$19,$20,$21,$22,$23);} - | PARSEOP_QWORDIO '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -QWordMemoryTerm - : PARSEOP_QWORDMEMORY '(' {$$ = TrCreateLeafNode (PARSEOP_QWORDMEMORY);} - OptionalResourceType_First - OptionalDecodeType - OptionalMinType - OptionalMaxType - OptionalMemType - ',' OptionalReadWriteKeyword - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - OptionalByteConstExpr - OptionalStringData - OptionalNameString - OptionalAddressRange - OptionalType_Last - ')' {$$ = TrLinkChildren ($3,16,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$20,$21,$22,$23,$24,$25);} - | PARSEOP_QWORDMEMORY '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -QWordSpaceTerm - : PARSEOP_QWORDSPACE '(' {$$ = TrCreateLeafNode (PARSEOP_QWORDSPACE);} - ByteConstExpr {UtCheckIntegerRange ($4, 0xC0, 0xFF);} - OptionalResourceType - OptionalDecodeType - OptionalMinType - OptionalMaxType - ',' ByteConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - OptionalByteConstExpr - OptionalStringData - OptionalNameString_Last - ')' {$$ = TrLinkChildren ($3,14,$4,$6,$7,$8,$9,$11,$13,$15,$17,$19,$21,$22,$23,$24);} - | PARSEOP_QWORDSPACE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -RegisterTerm - : PARSEOP_REGISTER '(' {$$ = TrCreateLeafNode (PARSEOP_REGISTER);} - AddressSpaceKeyword - ',' ByteConstExpr - ',' ByteConstExpr - ',' QWordConstExpr - OptionalAccessSize - OptionalNameString_Last - ')' {$$ = TrLinkChildren ($3,6,$4,$6,$8,$10,$11,$12);} - | PARSEOP_REGISTER '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -StartDependentFnTerm - : PARSEOP_STARTDEPENDENTFN '(' {$$ = TrCreateLeafNode (PARSEOP_STARTDEPENDENTFN);} - ByteConstExpr - ',' ByteConstExpr - ')' '{' - ResourceMacroList '}' {$$ = TrLinkChildren ($3,3,$4,$6,$9);} - | PARSEOP_STARTDEPENDENTFN '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -StartDependentFnNoPriTerm - : PARSEOP_STARTDEPENDENTFN_NOPRI '(' {$$ = TrCreateLeafNode (PARSEOP_STARTDEPENDENTFN_NOPRI);} - ')' '{' - ResourceMacroList '}' {$$ = TrLinkChildren ($3,1,$6);} - | PARSEOP_STARTDEPENDENTFN_NOPRI '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -VendorLongTerm - : PARSEOP_VENDORLONG '(' {$$ = TrCreateLeafNode (PARSEOP_VENDORLONG);} - OptionalNameString_First - ')' '{' - ByteList '}' {$$ = TrLinkChildren ($3,2,$4,$7);} - | PARSEOP_VENDORLONG '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -VendorShortTerm - : PARSEOP_VENDORSHORT '(' {$$ = TrCreateLeafNode (PARSEOP_VENDORSHORT);} - OptionalNameString_First - ')' '{' - ByteList '}' {$$ = TrLinkChildren ($3,2,$4,$7);} - | PARSEOP_VENDORSHORT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -WordBusNumberTerm - : PARSEOP_WORDBUSNUMBER '(' {$$ = TrCreateLeafNode (PARSEOP_WORDBUSNUMBER);} - OptionalResourceType_First - OptionalMinType - OptionalMaxType - OptionalDecodeType - ',' WordConstExpr - ',' WordConstExpr - ',' WordConstExpr - ',' WordConstExpr - ',' WordConstExpr - OptionalByteConstExpr - OptionalStringData - OptionalNameString_Last - ')' {$$ = TrLinkChildren ($3,12,$4,$5,$6,$7,$9,$11,$13,$15,$17,$18,$19,$20);} - | PARSEOP_WORDBUSNUMBER '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -WordIOTerm - : PARSEOP_WORDIO '(' {$$ = TrCreateLeafNode (PARSEOP_WORDIO);} - OptionalResourceType_First - OptionalMinType - OptionalMaxType - OptionalDecodeType - OptionalRangeType - ',' WordConstExpr - ',' WordConstExpr - ',' WordConstExpr - ',' WordConstExpr - ',' WordConstExpr - OptionalByteConstExpr - OptionalStringData - OptionalNameString - OptionalType - OptionalTranslationType_Last - ')' {$$ = TrLinkChildren ($3,15,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$19,$20,$21,$22,$23);} - | PARSEOP_WORDIO '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -WordSpaceTerm - : PARSEOP_WORDSPACE '(' {$$ = TrCreateLeafNode (PARSEOP_WORDSPACE);} - ByteConstExpr {UtCheckIntegerRange ($4, 0xC0, 0xFF);} - OptionalResourceType - OptionalDecodeType - OptionalMinType - OptionalMaxType - ',' ByteConstExpr - ',' WordConstExpr - ',' WordConstExpr - ',' WordConstExpr - ',' WordConstExpr - ',' WordConstExpr - OptionalByteConstExpr - OptionalStringData - OptionalNameString_Last - ')' {$$ = TrLinkChildren ($3,14,$4,$6,$7,$8,$9,$11,$13,$15,$17,$19,$21,$22,$23,$24);} - | PARSEOP_WORDSPACE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - - -/******* Object References ***********************************************/ - -/* Allow IO, DMA, IRQ Resource macro names to also be used as identifiers */ - -NameString - : NameSeg {} - | PARSEOP_NAMESTRING {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) AslCompilerlval.s);} - | PARSEOP_IO {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "IO");} - | PARSEOP_DMA {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "DMA");} - | PARSEOP_IRQ {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "IRQ");} - ; - -NameSeg - : PARSEOP_NAMESEG {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESEG, (ACPI_NATIVE_INT) AslCompilerlval.s);} - ; - - -/******* Helper rules ****************************************************/ - - -AmlPackageLengthTerm - : Integer {$$ = TrUpdateNode (PARSEOP_PACKAGE_LENGTH,(ACPI_PARSE_OBJECT *) $1);} - ; - -OptionalBusMasterKeyword - : ',' {$$ = TrCreateLeafNode (PARSEOP_BUSMASTERTYPE_MASTER);} - | ',' PARSEOP_BUSMASTERTYPE_MASTER {$$ = TrCreateLeafNode (PARSEOP_BUSMASTERTYPE_MASTER);} - | ',' PARSEOP_BUSMASTERTYPE_NOTMASTER {$$ = TrCreateLeafNode (PARSEOP_BUSMASTERTYPE_NOTMASTER);} - ; - -OptionalAccessAttribTerm - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' ByteConstExpr {$$ = $2;} - | ',' AccessAttribKeyword {$$ = $2;} - ; - -OptionalAccessSize - : {$$ = TrCreateValuedLeafNode (PARSEOP_BYTECONST, 0);} - | ',' {$$ = TrCreateValuedLeafNode (PARSEOP_BYTECONST, 0);} - | ',' ByteConstExpr {$$ = $2;} - ; - -OptionalAddressRange - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' AddressKeyword {$$ = $2;} - ; - -OptionalByteConstExpr - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' ByteConstExpr {$$ = $2;} - ; - -OptionalDecodeType - : ',' {$$ = NULL;} - | ',' DecodeKeyword {$$ = $2;} - ; - -OptionalDWordConstExpr - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' DWordConstExpr {$$ = $2;} - ; - -OptionalListString - : {$$ = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL, ACPI_TO_INTEGER (""));} /* Placeholder is a NULL string */ - | ',' {$$ = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL, ACPI_TO_INTEGER (""));} /* Placeholder is a NULL string */ - | ',' TermArg {$$ = $2;} - ; - -OptionalMaxType - : ',' {$$ = NULL;} - | ',' MaxKeyword {$$ = $2;} - ; - -OptionalMemType - : ',' {$$ = NULL;} - | ',' MemTypeKeyword {$$ = $2;} - ; - -OptionalMinType - : ',' {$$ = NULL;} - | ',' MinKeyword {$$ = $2;} - ; - -OptionalNameString - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' NameString {$$ = $2;} - ; - -OptionalNameString_Last - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' NameString {$$ = $2;} - ; - -OptionalNameString_First - : {$$ = TrCreateLeafNode (PARSEOP_ZERO);} - | NameString {$$ = $1;} - ; - -OptionalObjectTypeKeyword - : {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_UNK);} - | ',' ObjectTypeKeyword {$$ = $2;} - ; - -OptionalQWordConstExpr - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' QWordConstExpr {$$ = $2;} - ; - -OptionalRangeType - : ',' {$$ = NULL;} - | ',' RangeTypeKeyword {$$ = $2;} - ; - -OptionalReference - : {$$ = TrCreateLeafNode (PARSEOP_ZERO);} /* Placeholder is a ZeroOp object */ - | ',' {$$ = TrCreateLeafNode (PARSEOP_ZERO);} /* Placeholder is a ZeroOp object */ - | ',' TermArg {$$ = $2;} - ; - -OptionalResourceType_First - : {$$ = NULL;} - | ResourceTypeKeyword {$$ = $1;} - ; - -OptionalResourceType - : ',' {$$ = NULL;} - | ',' ResourceTypeKeyword {$$ = $2;} - ; - -OptionalSerializeRuleKeyword - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' SerializeRuleKeyword {$$ = $2;} - ; - -OptionalShareType - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' ShareTypeKeyword {$$ = $2;} - ; - -OptionalStringData - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' StringData {$$ = $2;} - ; - -OptionalTermArg - : {$$ = NULL;} - | TermArg {$$ = $1;} - ; - -OptionalReturnArg - : {$$ = TrCreateLeafNode (PARSEOP_ZERO);} /* Placeholder is a ZeroOp object */ - | TermArg {$$ = $1;} - ; - -OptionalType - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' TypeKeyword {$$ = $2;} - ; - -OptionalType_Last - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' TypeKeyword {$$ = $2;} - ; - -OptionalTranslationType_Last - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' TranslationKeyword {$$ = $2;} - ; - - -TermArgItem - : ',' TermArg {$$ = $2;} - | ',' error {$$ = AslDoError (); yyclearin;} - ; - -NameStringItem - : ',' NameString {$$ = $2;} - | ',' error {$$ = AslDoError (); yyclearin;} - ; - - -%% - - -/* - * Local support functions - */ - -int -AslCompilerwrap(void) -{ - return 1; -} - -/*! [End] no source code translation !*/ - -void * -AslLocalAllocate (unsigned int Size) -{ - void *Mem; - - - DbgPrint (ASL_PARSE_OUTPUT, "\nAslLocalAllocate: Expanding Stack to %u\n\n", Size); - - Mem = ACPI_ALLOCATE_ZEROED (Size); - if (!Mem) - { - AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_InputByteCount, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); - exit (1); - } - - return (Mem); -} - -ACPI_PARSE_OBJECT * -AslDoError (void) -{ - - - return (TrCreateLeafNode (PARSEOP_ERRORNODE)); - -} diff -Nru acpica-unix-20100528/compiler/asldefine.h acpica-unix-20140114/compiler/asldefine.h --- acpica-unix-20100528/compiler/asldefine.h 2010-05-28 17:14:22.000000000 +0000 +++ acpica-unix-20140114/compiler/asldefine.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,217 +0,0 @@ - -/****************************************************************************** - * - * Module Name: asldefine.h - Common defines for the iASL compiler - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - - -#ifndef __ASLDEFINE_H -#define __ASLDEFINE_H - - -/* - * Compiler versions and names - */ -#define CompilerCreatorRevision ACPI_CA_VERSION - -#define IntelAcpiCA "Intel ACPI Component Architecture" -#define CompilerId "ASL Optimizing Compiler" -#define DisassemblerId "AML Disassembler" -#define CompilerCopyright "Copyright (c) 2000 - 2010 Intel Corporation" -#define CompilerCompliance "Supports ACPI Specification Revision 4.0a" -#define CompilerName "iasl" -#define CompilerCreatorId "INTL" - - -/* Configuration constants */ - -#define ASL_MAX_ERROR_COUNT 200 -#define ASL_NODE_CACHE_SIZE 1024 -#define ASL_STRING_CACHE_SIZE 32768 - -#define ASL_FIRST_PARSE_OPCODE PARSEOP_ACCESSAS -#define ASL_YYTNAME_START 3 - -#define ASL_PARSE_OPCODE_BASE PARSEOP_ACCESSAS /* First Lex type */ - - -/* - * Macros - */ -#define ASL_RESDESC_OFFSET(m) ACPI_OFFSET (AML_RESOURCE, m) -#define ASL_PTR_DIFF(a,b) ((UINT8 *)(b) - (UINT8 *)(a)) -#define ASL_PTR_ADD(a,b) ((UINT8 *)(a) = ((UINT8 *)(a) + (b))) -#define ASL_GET_CHILD_NODE(a) (a)->Asl.Child -#define ASL_GET_PEER_NODE(a) (a)->Asl.Next -#define OP_TABLE_ENTRY(a,b,c,d) {b,d,a,c} - - -/* Internal AML opcodes */ - -#define AML_RAW_DATA_BYTE (UINT16) 0xAA01 /* write one raw byte */ -#define AML_RAW_DATA_WORD (UINT16) 0xAA02 /* write 2 raw bytes */ -#define AML_RAW_DATA_DWORD (UINT16) 0xAA04 /* write 4 raw bytes */ -#define AML_RAW_DATA_QWORD (UINT16) 0xAA08 /* write 8 raw bytes */ -#define AML_RAW_DATA_BUFFER (UINT16) 0xAA0B /* raw buffer with length */ -#define AML_RAW_DATA_CHAIN (UINT16) 0xAA0C /* chain of raw buffers */ -#define AML_PACKAGE_LENGTH (UINT16) 0xAA10 -#define AML_UNASSIGNED_OPCODE (UINT16) 0xEEEE -#define AML_DEFAULT_ARG_OP (UINT16) 0xDDDD - - -/* filename suffixes for output files */ - -#define FILE_SUFFIX_AML_CODE "aml" -#define FILE_SUFFIX_LISTING "lst" -#define FILE_SUFFIX_HEX_DUMP "hex" -#define FILE_SUFFIX_DEBUG "txt" -#define FILE_SUFFIX_SOURCE "src" -#define FILE_SUFFIX_NAMESPACE "nsp" -#define FILE_SUFFIX_ASM_SOURCE "asm" -#define FILE_SUFFIX_C_SOURCE "c" -#define FILE_SUFFIX_DISASSEMBLY "dsl" -#define FILE_SUFFIX_ASM_INCLUDE "inc" -#define FILE_SUFFIX_C_INCLUDE "h" - - -/* Types for input files */ - -#define ASL_INPUT_TYPE_BINARY 0 -#define ASL_INPUT_TYPE_ASCII_ASL 1 -#define ASL_INPUT_TYPE_ASCII_DATA 2 - - -/* Misc */ - -#define ASL_EXTERNAL_METHOD 255 -#define ASL_ABORT TRUE -#define ASL_NO_ABORT FALSE - - -/* Support for reserved method names */ - -#define ACPI_VALID_RESERVED_NAME_MAX 0x80000000 -#define ACPI_NOT_RESERVED_NAME ACPI_UINT32_MAX -#define ACPI_PREDEFINED_NAME (ACPI_UINT32_MAX - 1) -#define ACPI_EVENT_RESERVED_NAME (ACPI_UINT32_MAX - 2) -#define ACPI_COMPILER_RESERVED_NAME (ACPI_UINT32_MAX - 3) - - -/* String to Integer conversion */ - -#define NEGATIVE 1 -#define POSITIVE 0 - - -#endif /* ASLDEFINE.H */ - diff -Nru acpica-unix-20100528/compiler/aslerror.c acpica-unix-20140114/compiler/aslerror.c --- acpica-unix-20100528/compiler/aslerror.c 2010-05-28 17:14:22.000000000 +0000 +++ acpica-unix-20140114/compiler/aslerror.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,670 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslerror - Error handling and statistics - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - -#define ASL_EXCEPTIONS -#include "aslcompiler.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslerror") - -/* Local prototypes */ - -static void -AeAddToErrorLog ( - ASL_ERROR_MSG *Enode); - - -void -AeClearErrorLog ( - void) -{ - ASL_ERROR_MSG *Enode = Gbl_ErrorLog; - ASL_ERROR_MSG *Next; - - /* Walk the error node list */ - - while (Enode) - { - Next = Enode->Next; - ACPI_FREE (Enode); - Enode = Next; - } - - Gbl_ErrorLog = NULL; -} - - -/******************************************************************************* - * - * FUNCTION: AeAddToErrorLog - * - * PARAMETERS: Enode - An error node to add to the log - * - * RETURN: None - * - * DESCRIPTION: Add a new error node to the error log. The error log is - * ordered by the "logical" line number (cumulative line number - * including all include files.) - * - ******************************************************************************/ - -static void -AeAddToErrorLog ( - ASL_ERROR_MSG *Enode) -{ - ASL_ERROR_MSG *Next; - ASL_ERROR_MSG *Prev; - - - /* If Gbl_ErrorLog is null, this is the first error node */ - - if (!Gbl_ErrorLog) - { - Gbl_ErrorLog = Enode; - return; - } - - /* - * Walk error list until we find a line number greater than ours. - * List is sorted according to line number. - */ - Prev = NULL; - Next = Gbl_ErrorLog; - - while ((Next) && - (Next->LogicalLineNumber <= Enode->LogicalLineNumber)) - { - Prev = Next; - Next = Next->Next; - } - - /* Found our place in the list */ - - Enode->Next = Next; - - if (Prev) - { - Prev->Next = Enode; - } - else - { - Gbl_ErrorLog = Enode; - } -} - - -/******************************************************************************* - * - * FUNCTION: AePrintException - * - * PARAMETERS: FileId - ID of output file - * Enode - Error node to print - * Header - Additional text before each message - * - * RETURN: None - * - * DESCRIPTION: Print the contents of an error node. - * - * NOTE: We don't use the FlxxxFile I/O functions here because on error - * they abort the compiler and call this function! Since we - * are reporting errors here, we ignore most output errors and - * just try to get out as much as we can. - * - ******************************************************************************/ - -void -AePrintException ( - UINT32 FileId, - ASL_ERROR_MSG *Enode, - char *Header) -{ - UINT8 SourceByte; - int Actual; - size_t RActual; - UINT32 MsgLength; - char *MainMessage; - char *ExtraMessage; - UINT32 SourceColumn; - UINT32 ErrorColumn; - FILE *OutputFile; - FILE *SourceFile; - - - if (Gbl_NoErrors) - { - return; - } - - /* - * Only listing files have a header, and remarks/optimizations - * are always output - */ - if (!Header) - { - /* Ignore remarks if requested */ - - switch (Enode->Level) - { - case ASL_REMARK: - if (!Gbl_DisplayRemarks) - { - return; - } - break; - - case ASL_OPTIMIZATION: - if (!Gbl_DisplayOptimizations) - { - return; - } - break; - - default: - break; - } - } - - /* Get the file handles */ - - OutputFile = Gbl_Files[FileId].Handle; - SourceFile = Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle; - - if (Header) - { - fprintf (OutputFile, "%s", Header); - } - - /* Print filename and line number if present and valid */ - - if (Enode->Filename) - { - if (Gbl_VerboseErrors) - { - fprintf (OutputFile, "%6s", Enode->Filename); - - if (Enode->LineNumber) - { - fprintf (OutputFile, "%6u: ", Enode->LineNumber); - - /* - * Seek to the offset in the combined source file, read the source - * line, and write it to the output. - */ - Actual = fseek (SourceFile, (long) Enode->LogicalByteOffset, - (int) SEEK_SET); - if (Actual) - { - fprintf (OutputFile, - "[*** iASL: Seek error on source code temp file %s ***]", - Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); - } - else - { - RActual = fread (&SourceByte, 1, 1, SourceFile); - if (!RActual) - { - fprintf (OutputFile, - "[*** iASL: Read error on source code temp file %s ***]", - Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); - } - - else while (RActual && SourceByte && (SourceByte != '\n')) - { - fwrite (&SourceByte, 1, 1, OutputFile); - RActual = fread (&SourceByte, 1, 1, SourceFile); - } - } - fprintf (OutputFile, "\n"); - } - } - else - { - fprintf (OutputFile, "%s", Enode->Filename); - - if (Enode->LineNumber) - { - fprintf (OutputFile, "(%u) : ", Enode->LineNumber); - } - } - } - - /* NULL message ID, just print the raw message */ - - if (Enode->MessageId == 0) - { - fprintf (OutputFile, "%s\n", Enode->Message); - } - else - { - /* Decode the message ID */ - - fprintf (OutputFile, "%s %4.4d -", - AslErrorLevel[Enode->Level], - Enode->MessageId + ((Enode->Level+1) * 1000)); - - MainMessage = AslMessages[Enode->MessageId]; - ExtraMessage = Enode->Message; - - if (Enode->LineNumber) - { - MsgLength = strlen (MainMessage); - if (MsgLength == 0) - { - MainMessage = Enode->Message; - - MsgLength = strlen (MainMessage); - ExtraMessage = NULL; - } - - if (Gbl_VerboseErrors) - { - SourceColumn = Enode->Column + Enode->FilenameLength + 6 + 2; - ErrorColumn = ASL_ERROR_LEVEL_LENGTH + 5 + 2 + 1; - - if ((MsgLength + ErrorColumn) < (SourceColumn - 1)) - { - fprintf (OutputFile, "%*s%s", - (int) ((SourceColumn - 1) - ErrorColumn), - MainMessage, " ^ "); - } - else - { - fprintf (OutputFile, "%*s %s", - (int) ((SourceColumn - ErrorColumn) + 1), "^", - MainMessage); - } - } - else - { - fprintf (OutputFile, " %s", MainMessage); - } - - /* Print the extra info message if present */ - - if (ExtraMessage) - { - fprintf (OutputFile, " (%s)", ExtraMessage); - } - - fprintf (OutputFile, "\n"); - if (Gbl_VerboseErrors) - { - fprintf (OutputFile, "\n"); - } - } - else - { - fprintf (OutputFile, " %s %s\n\n", MainMessage, ExtraMessage); - } - } -} - - -/******************************************************************************* - * - * FUNCTION: AePrintErrorLog - * - * PARAMETERS: FileId - Where to output the error log - * - * RETURN: None - * - * DESCRIPTION: Print the entire contents of the error log - * - ******************************************************************************/ - -void -AePrintErrorLog ( - UINT32 FileId) -{ - ASL_ERROR_MSG *Enode = Gbl_ErrorLog; - - - /* Walk the error node list */ - - while (Enode) - { - AePrintException (FileId, Enode, NULL); - Enode = Enode->Next; - } -} - - -/******************************************************************************* - * - * FUNCTION: AslCommonError - * - * PARAMETERS: Level - Seriousness (Warning/error, etc.) - * MessageId - Index into global message buffer - * CurrentLineNumber - Actual file line number - * LogicalLineNumber - Cumulative line number - * LogicalByteOffset - Byte offset in source file - * Column - Column in current line - * Filename - source filename - * ExtraMessage - additional error message - * - * RETURN: None - * - * DESCRIPTION: Create a new error node and add it to the error log - * - ******************************************************************************/ - -void -AslCommonError ( - UINT8 Level, - UINT8 MessageId, - UINT32 CurrentLineNumber, - UINT32 LogicalLineNumber, - UINT32 LogicalByteOffset, - UINT32 Column, - char *Filename, - char *ExtraMessage) -{ - UINT32 MessageSize; - char *MessageBuffer = NULL; - ASL_ERROR_MSG *Enode; - - - Enode = UtLocalCalloc (sizeof (ASL_ERROR_MSG)); - - if (ExtraMessage) - { - /* Allocate a buffer for the message and a new error node */ - - MessageSize = strlen (ExtraMessage) + 1; - MessageBuffer = UtLocalCalloc (MessageSize); - - /* Keep a copy of the extra message */ - - ACPI_STRCPY (MessageBuffer, ExtraMessage); - } - - /* Initialize the error node */ - - if (Filename) - { - Enode->Filename = Filename; - Enode->FilenameLength = strlen (Filename); - if (Enode->FilenameLength < 6) - { - Enode->FilenameLength = 6; - } - } - - Enode->MessageId = MessageId; - Enode->Level = Level; - Enode->LineNumber = CurrentLineNumber; - Enode->LogicalLineNumber = LogicalLineNumber; - Enode->LogicalByteOffset = LogicalByteOffset; - Enode->Column = Column; - Enode->Message = MessageBuffer; - - /* Add the new node to the error node list */ - - AeAddToErrorLog (Enode); - - if (Gbl_DebugFlag) - { - /* stderr is a file, send error to it immediately */ - - AePrintException (ASL_FILE_STDERR, Enode, NULL); - } - - Gbl_ExceptionCount[Level]++; - if (Gbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT) - { - printf ("\nMaximum error count (%u) exceeded\n", ASL_MAX_ERROR_COUNT); - - Gbl_SourceLine = 0; - Gbl_NextError = Gbl_ErrorLog; - CmDoOutputFiles (); - CmCleanupAndExit (); - exit(1); - } - - return; -} - - -/******************************************************************************* - * - * FUNCTION: AslError - * - * PARAMETERS: Level - Seriousness (Warning/error, etc.) - * MessageId - Index into global message buffer - * Op - Parse node where error happened - * ExtraMessage - additional error message - * - * RETURN: None - * - * DESCRIPTION: Main error reporting routine for the ASL compiler (all code - * except the parser.) - * - ******************************************************************************/ - -void -AslError ( - UINT8 Level, - UINT8 MessageId, - ACPI_PARSE_OBJECT *Op, - char *ExtraMessage) -{ - - switch (Level) - { - case ASL_WARNING2: - case ASL_WARNING3: - if (Gbl_WarningLevel < Level) - { - return; - } - break; - - default: - break; - } - - - if (Op) - { - AslCommonError (Level, MessageId, Op->Asl.LineNumber, - Op->Asl.LogicalLineNumber, - Op->Asl.LogicalByteOffset, - Op->Asl.Column, - Op->Asl.Filename, ExtraMessage); - } - else - { - AslCommonError (Level, MessageId, 0, - 0, 0, 0, NULL, ExtraMessage); - } -} - - -/******************************************************************************* - * - * FUNCTION: AslCoreSubsystemError - * - * PARAMETERS: Op - Parse node where error happened - * Status - The ACPI CA Exception - * ExtraMessage - additional error message - * Abort - TRUE -> Abort compilation - * - * RETURN: None - * - * DESCRIPTION: Error reporting routine for exceptions returned by the ACPI - * CA core subsystem. - * - ******************************************************************************/ - -void -AslCoreSubsystemError ( - ACPI_PARSE_OBJECT *Op, - ACPI_STATUS Status, - char *ExtraMessage, - BOOLEAN Abort) -{ - - sprintf (MsgBuffer, "%s %s", AcpiFormatException (Status), ExtraMessage); - - if (Op) - { - AslCommonError (ASL_ERROR, ASL_MSG_CORE_EXCEPTION, Op->Asl.LineNumber, - Op->Asl.LogicalLineNumber, - Op->Asl.LogicalByteOffset, - Op->Asl.Column, - Op->Asl.Filename, MsgBuffer); - } - else - { - AslCommonError (ASL_ERROR, ASL_MSG_CORE_EXCEPTION, 0, - 0, 0, 0, NULL, MsgBuffer); - } - - if (Abort) - { - AslAbort (); - } -} - - -/******************************************************************************* - * - * FUNCTION: AslCompilererror - * - * PARAMETERS: CompilerMessage - Error message from the parser - * - * RETURN: Status (0 for now) - * - * DESCRIPTION: Report an error situation discovered in a production - * NOTE: don't change the name of this function, it is called - * from the auto-generated parser. - * - ******************************************************************************/ - -int -AslCompilererror ( - char *CompilerMessage) -{ - - AslCommonError (ASL_ERROR, ASL_MSG_SYNTAX, Gbl_CurrentLineNumber, - Gbl_LogicalLineNumber, Gbl_CurrentLineOffset, - Gbl_CurrentColumn, Gbl_Files[ASL_FILE_INPUT].Filename, - CompilerMessage); - - return 0; -} - - diff -Nru acpica-unix-20100528/compiler/aslfiles.c acpica-unix-20140114/compiler/aslfiles.c --- acpica-unix-20100528/compiler/aslfiles.c 2010-05-28 17:14:23.000000000 +0000 +++ acpica-unix-20140114/compiler/aslfiles.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1025 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslfiles - file I/O suppoert - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - -#include "aslcompiler.h" -#include "acapps.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslfiles") - -/* Local prototypes */ - -FILE * -FlOpenIncludeWithPrefix ( - char *PrefixDir, - char *Filename); - - -#ifdef ACPI_OBSOLETE_FUNCTIONS -ACPI_STATUS -FlParseInputPathname ( - char *InputFilename); -#endif - - -/******************************************************************************* - * - * FUNCTION: AslAbort - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Dump the error log and abort the compiler. Used for serious - * I/O errors - * - ******************************************************************************/ - -void -AslAbort ( - void) -{ - - AePrintErrorLog (ASL_FILE_STDOUT); - if (Gbl_DebugFlag) - { - /* Print error summary to the debug file */ - - AePrintErrorLog (ASL_FILE_STDERR); - } - - exit (1); -} - - -/******************************************************************************* - * - * FUNCTION: FlFileError - * - * PARAMETERS: FileId - Index into file info array - * ErrorId - Index into error message array - * - * RETURN: None - * - * DESCRIPTION: Decode errno to an error message and add the entire error - * to the error log. - * - ******************************************************************************/ - -void -FlFileError ( - UINT32 FileId, - UINT8 ErrorId) -{ - - sprintf (MsgBuffer, "\"%s\" (%s)", Gbl_Files[FileId].Filename, - strerror (errno)); - AslCommonError (ASL_ERROR, ErrorId, 0, 0, 0, 0, NULL, MsgBuffer); -} - - -/******************************************************************************* - * - * FUNCTION: FlOpenFile - * - * PARAMETERS: FileId - Index into file info array - * Filename - file pathname to open - * Mode - Open mode for fopen - * - * RETURN: None - * - * DESCRIPTION: Open a file. - * NOTE: Aborts compiler on any error. - * - ******************************************************************************/ - -void -FlOpenFile ( - UINT32 FileId, - char *Filename, - char *Mode) -{ - FILE *File; - - - File = fopen (Filename, Mode); - - Gbl_Files[FileId].Filename = Filename; - Gbl_Files[FileId].Handle = File; - - if (!File) - { - FlFileError (FileId, ASL_MSG_OPEN); - AslAbort (); - } -} - - -/******************************************************************************* - * - * FUNCTION: FlGetFileSize - * - * PARAMETERS: FileId - Index into file info array - * - * RETURN: File Size - * - * DESCRIPTION: Get current file size. Uses seek-to-EOF. File must be open. - * - ******************************************************************************/ - -UINT32 -FlGetFileSize ( - UINT32 FileId) -{ - FILE *fp; - UINT32 FileSize; - - - fp = Gbl_Files[FileId].Handle; - - fseek (fp, 0, SEEK_END); - FileSize = (UINT32) ftell (fp); - fseek (fp, 0, SEEK_SET); - - return (FileSize); -} - - -/******************************************************************************* - * - * FUNCTION: FlReadFile - * - * PARAMETERS: FileId - Index into file info array - * Buffer - Where to place the data - * Length - Amount to read - * - * RETURN: Status. AE_ERROR indicates EOF. - * - * DESCRIPTION: Read data from an open file. - * NOTE: Aborts compiler on any error. - * - ******************************************************************************/ - -ACPI_STATUS -FlReadFile ( - UINT32 FileId, - void *Buffer, - UINT32 Length) -{ - UINT32 Actual; - - - /* Read and check for error */ - - Actual = fread (Buffer, 1, Length, Gbl_Files[FileId].Handle); - if (Actual != Length) - { - if (feof (Gbl_Files[FileId].Handle)) - { - /* End-of-file, just return error */ - - return (AE_ERROR); - } - - FlFileError (FileId, ASL_MSG_READ); - AslAbort (); - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: FlWriteFile - * - * PARAMETERS: FileId - Index into file info array - * Buffer - Data to write - * Length - Amount of data to write - * - * RETURN: None - * - * DESCRIPTION: Write data to an open file. - * NOTE: Aborts compiler on any error. - * - ******************************************************************************/ - -void -FlWriteFile ( - UINT32 FileId, - void *Buffer, - UINT32 Length) -{ - UINT32 Actual; - - - /* Write and check for error */ - - Actual = fwrite ((char *) Buffer, 1, Length, Gbl_Files[FileId].Handle); - if (Actual != Length) - { - FlFileError (FileId, ASL_MSG_WRITE); - AslAbort (); - } -} - - -/******************************************************************************* - * - * FUNCTION: FlPrintFile - * - * PARAMETERS: FileId - Index into file info array - * Format - Printf format string - * ... - Printf arguments - * - * RETURN: None - * - * DESCRIPTION: Formatted write to an open file. - * NOTE: Aborts compiler on any error. - * - ******************************************************************************/ - -void -FlPrintFile ( - UINT32 FileId, - char *Format, - ...) -{ - INT32 Actual; - va_list Args; - - - va_start (Args, Format); - - Actual = vfprintf (Gbl_Files[FileId].Handle, Format, Args); - va_end (Args); - - if (Actual == -1) - { - FlFileError (FileId, ASL_MSG_WRITE); - AslAbort (); - } -} - - -/******************************************************************************* - * - * FUNCTION: FlSeekFile - * - * PARAMETERS: FileId - Index into file info array - * Offset - Absolute byte offset in file - * - * RETURN: None - * - * DESCRIPTION: Seek to absolute offset - * NOTE: Aborts compiler on any error. - * - ******************************************************************************/ - -void -FlSeekFile ( - UINT32 FileId, - long Offset) -{ - int Error; - - - Error = fseek (Gbl_Files[FileId].Handle, Offset, SEEK_SET); - if (Error) - { - FlFileError (FileId, ASL_MSG_SEEK); - AslAbort (); - } -} - - -/******************************************************************************* - * - * FUNCTION: FlCloseFile - * - * PARAMETERS: FileId - Index into file info array - * - * RETURN: None - * - * DESCRIPTION: Close an open file. Aborts compiler on error - * - ******************************************************************************/ - -void -FlCloseFile ( - UINT32 FileId) -{ - int Error; - - - if (!Gbl_Files[FileId].Handle) - { - return; - } - - Error = fclose (Gbl_Files[FileId].Handle); - Gbl_Files[FileId].Handle = NULL; - - if (Error) - { - FlFileError (FileId, ASL_MSG_CLOSE); - AslAbort (); - } - - return; -} - - -/******************************************************************************* - * - * FUNCTION: FlSetLineNumber - * - * PARAMETERS: Op - Parse node for the LINE asl statement - * - * RETURN: None. - * - * DESCRIPTION: Set the current line number - * - ******************************************************************************/ - -void -FlSetLineNumber ( - ACPI_PARSE_OBJECT *Op) -{ - - Gbl_CurrentLineNumber = (UINT32) Op->Asl.Value.Integer; - Gbl_LogicalLineNumber = (UINT32) Op->Asl.Value.Integer; -} - - -/******************************************************************************* - * - * FUNCTION: FlAddIncludeDirectory - * - * PARAMETERS: Dir - Directory pathname string - * - * RETURN: None - * - * DESCRIPTION: Add a directory the list of include prefix directories. - * - ******************************************************************************/ - -void -FlAddIncludeDirectory ( - char *Dir) -{ - ASL_INCLUDE_DIR *NewDir; - ASL_INCLUDE_DIR *NextDir; - ASL_INCLUDE_DIR *PrevDir = NULL; - UINT32 NeedsSeparator = 0; - size_t DirLength; - - - DirLength = strlen (Dir); - if (!DirLength) - { - return; - } - - /* Make sure that the pathname ends with a path separator */ - - if ((Dir[DirLength-1] != '/') && - (Dir[DirLength-1] != '\\')) - { - NeedsSeparator = 1; - } - - NewDir = ACPI_ALLOCATE_ZEROED (sizeof (ASL_INCLUDE_DIR)); - NewDir->Dir = ACPI_ALLOCATE (DirLength + 1 + NeedsSeparator); - strcpy (NewDir->Dir, Dir); - if (NeedsSeparator) - { - strcat (NewDir->Dir, "/"); - } - - /* - * Preserve command line ordering of -I options by adding new elements - * at the end of the list - */ - NextDir = Gbl_IncludeDirList; - while (NextDir) - { - PrevDir = NextDir; - NextDir = NextDir->Next; - } - - if (PrevDir) - { - PrevDir->Next = NewDir; - } - else - { - Gbl_IncludeDirList = NewDir; - } -} - - -/******************************************************************************* - * - * FUNCTION: FlOpenIncludeWithPrefix - * - * PARAMETERS: PrefixDir - Prefix directory pathname. Can be a zero - * length string. - * Filename - The include filename from the source ASL. - * - * RETURN: Valid file descriptor if successful. Null otherwise. - * - * DESCRIPTION: Open an include file and push it on the input file stack. - * - ******************************************************************************/ - -FILE * -FlOpenIncludeWithPrefix ( - char *PrefixDir, - char *Filename) -{ - FILE *IncludeFile; - char *Pathname; - - - /* Build the full pathname to the file */ - - Pathname = ACPI_ALLOCATE (strlen (PrefixDir) + strlen (Filename) + 1); - - strcpy (Pathname, PrefixDir); - strcat (Pathname, Filename); - - DbgPrint (ASL_PARSE_OUTPUT, "\nAttempt to open include file: path %s\n\n", - Pathname); - - /* Attempt to open the file, push if successful */ - - IncludeFile = fopen (Pathname, "r"); - if (IncludeFile) - { - /* Push the include file on the open input file stack */ - - AslPushInputFileStack (IncludeFile, Pathname); - return (IncludeFile); - } - - ACPI_FREE (Pathname); - return (NULL); -} - - -/******************************************************************************* - * - * FUNCTION: FlOpenIncludeFile - * - * PARAMETERS: Op - Parse node for the INCLUDE ASL statement - * - * RETURN: None. - * - * DESCRIPTION: Open an include file and push it on the input file stack. - * - ******************************************************************************/ - -void -FlOpenIncludeFile ( - ACPI_PARSE_OBJECT *Op) -{ - FILE *IncludeFile; - ASL_INCLUDE_DIR *NextDir; - - - /* Op must be valid */ - - if (!Op) - { - AslCommonError (ASL_ERROR, ASL_MSG_INCLUDE_FILE_OPEN, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_InputByteCount, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, " - Null parse node"); - - return; - } - - /* - * Flush out the "include ()" statement on this line, start - * the actual include file on the next line - */ - ResetCurrentLineBuffer (); - FlPrintFile (ASL_FILE_SOURCE_OUTPUT, "\n"); - Gbl_CurrentLineOffset++; - - - /* Attempt to open the include file */ - - /* If the file specifies an absolute path, just open it */ - - if ((Op->Asl.Value.String[0] == '/') || - (Op->Asl.Value.String[0] == '\\') || - (Op->Asl.Value.String[1] == ':')) - { - IncludeFile = FlOpenIncludeWithPrefix ("", Op->Asl.Value.String); - if (!IncludeFile) - { - goto ErrorExit; - } - return; - } - - /* - * The include filename is not an absolute path. - * - * First, search for the file within the "local" directory -- meaning - * the same directory that contains the source file. - * - * Construct the file pathname from the global directory name. - */ - IncludeFile = FlOpenIncludeWithPrefix (Gbl_DirectoryPath, Op->Asl.Value.String); - if (IncludeFile) - { - return; - } - - /* - * Second, search for the file within the (possibly multiple) directories - * specified by the -I option on the command line. - */ - NextDir = Gbl_IncludeDirList; - while (NextDir) - { - IncludeFile = FlOpenIncludeWithPrefix (NextDir->Dir, Op->Asl.Value.String); - if (IncludeFile) - { - return; - } - - NextDir = NextDir->Next; - } - - /* We could not open the include file after trying very hard */ - -ErrorExit: - sprintf (MsgBuffer, "%s, %s", Op->Asl.Value.String, strerror (errno)); - AslError (ASL_ERROR, ASL_MSG_INCLUDE_FILE_OPEN, Op, MsgBuffer); -} - - -/******************************************************************************* - * - * FUNCTION: FlOpenInputFile - * - * PARAMETERS: InputFilename - The user-specified ASL source file to be - * compiled - * - * RETURN: Status - * - * DESCRIPTION: Open the specified input file, and save the directory path to - * the file so that include files can be opened in - * the same directory. - * - ******************************************************************************/ - -ACPI_STATUS -FlOpenInputFile ( - char *InputFilename) -{ - - /* Open the input ASL file, text mode */ - - FlOpenFile (ASL_FILE_INPUT, InputFilename, "r"); - AslCompilerin = Gbl_Files[ASL_FILE_INPUT].Handle; - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: FlOpenAmlOutputFile - * - * PARAMETERS: FilenamePrefix - The user-specified ASL source file - * - * RETURN: Status - * - * DESCRIPTION: Create the output filename (*.AML) and open the file. The file - * is created in the same directory as the parent input file. - * - ******************************************************************************/ - -ACPI_STATUS -FlOpenAmlOutputFile ( - char *FilenamePrefix) -{ - char *Filename; - - - /* Output filename usually comes from the ASL itself */ - - Filename = Gbl_Files[ASL_FILE_AML_OUTPUT].Filename; - if (!Filename) - { - /* Create the output AML filename */ - - Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_AML_CODE); - if (!Filename) - { - AslCommonError (ASL_ERROR, ASL_MSG_OUTPUT_FILENAME, - 0, 0, 0, 0, NULL, NULL); - return (AE_ERROR); - } - } - - /* Open the output AML file in binary mode */ - - FlOpenFile (ASL_FILE_AML_OUTPUT, Filename, "w+b"); - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: FlOpenMiscOutputFiles - * - * PARAMETERS: FilenamePrefix - The user-specified ASL source file - * - * RETURN: Status - * - * DESCRIPTION: Create and open the various output files needed, depending on - * the command line options - * - ******************************************************************************/ - -ACPI_STATUS -FlOpenMiscOutputFiles ( - char *FilenamePrefix) -{ - char *Filename; - - - /* Create/Open a combined source output file */ - - Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_SOURCE); - if (!Filename) - { - AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, - 0, 0, 0, 0, NULL, NULL); - return (AE_ERROR); - } - - /* - * Open the source output file, binary mode (so that LF does not get - * expanded to CR/LF on some systems, messing up our seek - * calculations.) - */ - FlOpenFile (ASL_FILE_SOURCE_OUTPUT, Filename, "w+b"); - - /* Create/Open a listing output file if asked */ - - if (Gbl_ListingFlag) - { - Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_LISTING); - if (!Filename) - { - AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, - 0, 0, 0, 0, NULL, NULL); - return (AE_ERROR); - } - - /* Open the listing file, text mode */ - - FlOpenFile (ASL_FILE_LISTING_OUTPUT, Filename, "w+"); - - AslCompilerSignon (ASL_FILE_LISTING_OUTPUT); - AslCompilerFileHeader (ASL_FILE_LISTING_OUTPUT); - } - - /* Create/Open a assembly code source output file if asked */ - - if (Gbl_AsmOutputFlag) - { - Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_ASM_SOURCE); - if (!Filename) - { - AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, - 0, 0, 0, 0, NULL, NULL); - return (AE_ERROR); - } - - /* Open the assembly code source file, text mode */ - - FlOpenFile (ASL_FILE_ASM_SOURCE_OUTPUT, Filename, "w+"); - - AslCompilerSignon (ASL_FILE_ASM_SOURCE_OUTPUT); - AslCompilerFileHeader (ASL_FILE_ASM_SOURCE_OUTPUT); - } - - /* Create/Open a C code source output file if asked */ - - if (Gbl_C_OutputFlag) - { - Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_C_SOURCE); - if (!Filename) - { - AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, - 0, 0, 0, 0, NULL, NULL); - return (AE_ERROR); - } - - /* Open the C code source file, text mode */ - - FlOpenFile (ASL_FILE_C_SOURCE_OUTPUT, Filename, "w+"); - - FlPrintFile (ASL_FILE_C_SOURCE_OUTPUT, "/*\n"); - AslCompilerSignon (ASL_FILE_C_SOURCE_OUTPUT); - AslCompilerFileHeader (ASL_FILE_C_SOURCE_OUTPUT); - } - - /* Create/Open a assembly include output file if asked */ - - if (Gbl_AsmIncludeOutputFlag) - { - Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_ASM_INCLUDE); - if (!Filename) - { - AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, - 0, 0, 0, 0, NULL, NULL); - return (AE_ERROR); - } - - /* Open the assembly include file, text mode */ - - FlOpenFile (ASL_FILE_ASM_INCLUDE_OUTPUT, Filename, "w+"); - - AslCompilerSignon (ASL_FILE_ASM_INCLUDE_OUTPUT); - AslCompilerFileHeader (ASL_FILE_ASM_INCLUDE_OUTPUT); - } - - /* Create/Open a C include output file if asked */ - - if (Gbl_C_IncludeOutputFlag) - { - Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_C_INCLUDE); - if (!Filename) - { - AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, - 0, 0, 0, 0, NULL, NULL); - return (AE_ERROR); - } - - /* Open the C include file, text mode */ - - FlOpenFile (ASL_FILE_C_INCLUDE_OUTPUT, Filename, "w+"); - - FlPrintFile (ASL_FILE_C_INCLUDE_OUTPUT, "/*\n"); - AslCompilerSignon (ASL_FILE_C_INCLUDE_OUTPUT); - AslCompilerFileHeader (ASL_FILE_C_INCLUDE_OUTPUT); - } - - /* Create/Open a hex output file if asked */ - - if (Gbl_HexOutputFlag) - { - Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_HEX_DUMP); - if (!Filename) - { - AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, - 0, 0, 0, 0, NULL, NULL); - return (AE_ERROR); - } - - /* Open the hex file, text mode */ - - FlOpenFile (ASL_FILE_HEX_OUTPUT, Filename, "w+"); - - AslCompilerSignon (ASL_FILE_HEX_OUTPUT); - AslCompilerFileHeader (ASL_FILE_HEX_OUTPUT); - } - - /* Create a namespace output file if asked */ - - if (Gbl_NsOutputFlag) - { - Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_NAMESPACE); - if (!Filename) - { - AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, - 0, 0, 0, 0, NULL, NULL); - return (AE_ERROR); - } - - /* Open the namespace file, text mode */ - - FlOpenFile (ASL_FILE_NAMESPACE_OUTPUT, Filename, "w+"); - - AslCompilerSignon (ASL_FILE_NAMESPACE_OUTPUT); - AslCompilerFileHeader (ASL_FILE_NAMESPACE_OUTPUT); - } - - /* Create/Open a debug output file if asked */ - - if (Gbl_DebugFlag) - { - Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_DEBUG); - if (!Filename) - { - AslCommonError (ASL_ERROR, ASL_MSG_DEBUG_FILENAME, - 0, 0, 0, 0, NULL, NULL); - return (AE_ERROR); - } - - /* Open the debug file as STDERR, text mode */ - - /* TBD: hide this behind a FlReopenFile function */ - - Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Filename = Filename; - Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Handle = - freopen (Filename, "w+t", stderr); - - AslCompilerSignon (ASL_FILE_DEBUG_OUTPUT); - AslCompilerFileHeader (ASL_FILE_DEBUG_OUTPUT); - } - - return (AE_OK); -} - - -#ifdef ACPI_OBSOLETE_FUNCTIONS -/******************************************************************************* - * - * FUNCTION: FlParseInputPathname - * - * PARAMETERS: InputFilename - The user-specified ASL source file to be - * compiled - * - * RETURN: Status - * - * DESCRIPTION: Split the input path into a directory and filename part - * 1) Directory part used to open include files - * 2) Filename part used to generate output filenames - * - ******************************************************************************/ - -ACPI_STATUS -FlParseInputPathname ( - char *InputFilename) -{ - char *Substring; - - - if (!InputFilename) - { - return (AE_OK); - } - - /* Get the path to the input filename's directory */ - - Gbl_DirectoryPath = strdup (InputFilename); - if (!Gbl_DirectoryPath) - { - return (AE_NO_MEMORY); - } - - Substring = strrchr (Gbl_DirectoryPath, '\\'); - if (!Substring) - { - Substring = strrchr (Gbl_DirectoryPath, '/'); - if (!Substring) - { - Substring = strrchr (Gbl_DirectoryPath, ':'); - } - } - - if (!Substring) - { - Gbl_DirectoryPath[0] = 0; - if (Gbl_UseDefaultAmlFilename) - { - Gbl_OutputFilenamePrefix = strdup (InputFilename); - } - } - else - { - if (Gbl_UseDefaultAmlFilename) - { - Gbl_OutputFilenamePrefix = strdup (Substring + 1); - } - *(Substring+1) = 0; - } - - return (AE_OK); -} -#endif - - diff -Nru acpica-unix-20100528/compiler/aslfold.c acpica-unix-20140114/compiler/aslfold.c --- acpica-unix-20100528/compiler/aslfold.c 2010-05-28 17:14:23.000000000 +0000 +++ acpica-unix-20140114/compiler/aslfold.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,563 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslfold - Constant folding - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - - -#include "aslcompiler.h" -#include "aslcompiler.y.h" -#include "amlcode.h" - -#include "acdispat.h" -#include "acparser.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslfold") - -/* Local prototypes */ - -static ACPI_STATUS -OpcAmlEvaluationWalk1 ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -static ACPI_STATUS -OpcAmlEvaluationWalk2 ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -static ACPI_STATUS -OpcAmlCheckForConstant ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - - -/******************************************************************************* - * - * FUNCTION: OpcAmlEvaluationWalk1 - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Descending callback for AML execution of constant subtrees - * - ******************************************************************************/ - -static ACPI_STATUS -OpcAmlEvaluationWalk1 ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ACPI_WALK_STATE *WalkState = Context; - ACPI_STATUS Status; - ACPI_PARSE_OBJECT *OutOp; - - - WalkState->Op = Op; - WalkState->Opcode = Op->Common.AmlOpcode; - WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - - /* Copy child pointer to Arg for compatibility with Interpreter */ - - if (Op->Asl.Child) - { - Op->Common.Value.Arg = Op->Asl.Child; - } - - /* Call AML dispatcher */ - - Status = AcpiDsExecBeginOp (WalkState, &OutOp); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Constant interpretation failed - %s\n", - AcpiFormatException (Status)); - } - - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: OpcAmlEvaluationWalk2 - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Ascending callback for AML execution of constant subtrees - * - ******************************************************************************/ - -static ACPI_STATUS -OpcAmlEvaluationWalk2 ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ACPI_WALK_STATE *WalkState = Context; - ACPI_STATUS Status; - - - WalkState->Op = Op; - WalkState->Opcode = Op->Common.AmlOpcode; - WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - - /* Copy child pointer to Arg for compatibility with Interpreter */ - - if (Op->Asl.Child) - { - Op->Common.Value.Arg = Op->Asl.Child; - } - - /* Call AML dispatcher */ - - Status = AcpiDsExecEndOp (WalkState); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Constant interpretation failed - %s\n", - AcpiFormatException (Status)); - } - - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: OpcAmlCheckForConstant - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Check one Op for a type 3/4/5 AML opcode - * - ******************************************************************************/ - -static ACPI_STATUS -OpcAmlCheckForConstant ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ACPI_WALK_STATE *WalkState = Context; - - - WalkState->Op = Op; - WalkState->Opcode = Op->Common.AmlOpcode; - WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - - DbgPrint (ASL_PARSE_OUTPUT, "[%.4d] Opcode: %12.12s ", - Op->Asl.LogicalLineNumber, Op->Asl.ParseOpName); - - if (!(WalkState->OpInfo->Flags & AML_CONSTANT)) - { - /* The opcode is not a Type 3/4/5 opcode */ - - if (Op->Asl.CompileFlags & NODE_IS_TARGET) - { - DbgPrint (ASL_PARSE_OUTPUT, - "**** Valid Target, cannot reduce ****\n"); - } - else - { - DbgPrint (ASL_PARSE_OUTPUT, - "**** Not a Type 3/4/5 opcode ****\n"); - } - - if (WalkState->WalkType == ACPI_WALK_CONST_OPTIONAL) - { - /* - * We are looking at at normal expression to see if it can be - * reduced. It can't. No error - */ - return (AE_TYPE); - } - - /* - * This is an expression that MUST reduce to a constant, and it - * can't be reduced. This is an error - */ - if (Op->Asl.CompileFlags & NODE_IS_TARGET) - { - AslError (ASL_ERROR, ASL_MSG_INVALID_TARGET, Op, - Op->Asl.ParseOpName); - } - else - { - AslError (ASL_ERROR, ASL_MSG_INVALID_CONSTANT_OP, Op, - Op->Asl.ParseOpName); - } - - return (AE_TYPE); - } - - /* Debug output */ - - DbgPrint (ASL_PARSE_OUTPUT, "TYPE_345"); - - if (Op->Asl.CompileFlags & NODE_IS_TARGET) - { - DbgPrint (ASL_PARSE_OUTPUT, " TARGET"); - } - if (Op->Asl.CompileFlags & NODE_IS_TERM_ARG) - { - DbgPrint (ASL_PARSE_OUTPUT, " TERMARG"); - } - DbgPrint (ASL_PARSE_OUTPUT, "\n"); - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: OpcAmlConstantWalk - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Reduce an Op and its subtree to a constant if possible - * - ******************************************************************************/ - -ACPI_STATUS -OpcAmlConstantWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ACPI_WALK_STATE *WalkState; - ACPI_STATUS Status = AE_OK; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_PARSE_OBJECT *RootOp; - ACPI_PARSE_OBJECT *OriginalParentOp; - UINT8 WalkType; - - - /* - * Only interested in subtrees that could possibly contain - * expressions that can be evaluated at this time - */ - if ((!(Op->Asl.CompileFlags & NODE_COMPILE_TIME_CONST)) || - (Op->Asl.CompileFlags & NODE_IS_TARGET)) - { - return (AE_OK); - } - - /* Set the walk type based on the reduction used for this op */ - - if (Op->Asl.CompileFlags & NODE_IS_TERM_ARG) - { - /* Op is a TermArg, constant folding is merely optional */ - - if (!Gbl_FoldConstants) - { - return (AE_CTRL_DEPTH); - } - - WalkType = ACPI_WALK_CONST_OPTIONAL; - } - else - { - /* Op is a DataObject, the expression MUST reduced to a constant */ - - WalkType = ACPI_WALK_CONST_REQUIRED; - } - - /* Create a new walk state */ - - WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL); - if (!WalkState) - { - return AE_NO_MEMORY; - } - - WalkState->NextOp = NULL; - WalkState->Params = NULL; - WalkState->CallerReturnDesc = &ObjDesc; - WalkState->WalkType = WalkType; - - /* - * Examine the entire subtree -- all nodes must be constants - * or type 3/4/5 opcodes - */ - Status = TrWalkParseTree (Op, ASL_WALK_VISIT_DOWNWARD, - OpcAmlCheckForConstant, NULL, WalkState); - - /* - * Did we find an entire subtree that contains all constants and type 3/4/5 - * opcodes? (Only AE_OK or AE_TYPE returned from above) - */ - if (Status == AE_TYPE) - { - /* Subtree cannot be reduced to a constant */ - - if (WalkState->WalkType == ACPI_WALK_CONST_OPTIONAL) - { - AcpiDsDeleteWalkState (WalkState); - return (AE_OK); - } - - /* Don't descend any further, and use a default "constant" value */ - - Status = AE_CTRL_DEPTH; - } - else - { - /* Subtree can be reduced */ - - /* Allocate a new temporary root for this subtree */ - - RootOp = TrAllocateNode (PARSEOP_INTEGER); - if (!RootOp) - { - return (AE_NO_MEMORY); - } - - RootOp->Common.AmlOpcode = AML_INT_EVAL_SUBTREE_OP; - - OriginalParentOp = Op->Common.Parent; - Op->Common.Parent = RootOp; - - /* Hand off the subtree to the AML interpreter */ - - Status = TrWalkParseTree (Op, ASL_WALK_VISIT_TWICE, - OpcAmlEvaluationWalk1, OpcAmlEvaluationWalk2, WalkState); - Op->Common.Parent = OriginalParentOp; - - /* TBD: we really *should* release the RootOp node */ - - if (ACPI_SUCCESS (Status)) - { - TotalFolds++; - - /* Get the final result */ - - Status = AcpiDsResultPop (&ObjDesc, WalkState); - } - } - - if (ACPI_FAILURE (Status)) - { - /* We could not resolve the subtree for some reason */ - - AslCoreSubsystemError (Op, Status, - "Failure during constant evaluation", FALSE); - AslError (ASL_ERROR, ASL_MSG_CONSTANT_EVALUATION, Op, - Op->Asl.ParseOpName); - - /* Set the subtree value to ZERO anyway. Eliminates further errors */ - - Op->Asl.ParseOpcode = PARSEOP_INTEGER; - Op->Common.Value.Integer = 0; - OpcSetOptimalIntegerSize (Op); - } - else - { - AslError (ASL_OPTIMIZATION, ASL_MSG_CONSTANT_FOLDED, Op, - Op->Asl.ParseOpName); - - /* - * Because we know we executed type 3/4/5 opcodes above, we know that - * the result must be either an Integer, String, or Buffer. - */ - switch (ObjDesc->Common.Type) - { - case ACPI_TYPE_INTEGER: - - Op->Asl.ParseOpcode = PARSEOP_INTEGER; - Op->Common.Value.Integer = ObjDesc->Integer.Value; - OpcSetOptimalIntegerSize (Op); - - DbgPrint (ASL_PARSE_OUTPUT, - "Constant expression reduced to (INTEGER) %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); - break; - - - case ACPI_TYPE_STRING: - - Op->Asl.ParseOpcode = PARSEOP_STRING_LITERAL; - Op->Common.AmlOpcode = AML_STRING_OP; - Op->Asl.AmlLength = ACPI_STRLEN (ObjDesc->String.Pointer) + 1; - Op->Common.Value.String = ObjDesc->String.Pointer; - - DbgPrint (ASL_PARSE_OUTPUT, - "Constant expression reduced to (STRING) %s\n", - Op->Common.Value.String); - - break; - - - case ACPI_TYPE_BUFFER: - - Op->Asl.ParseOpcode = PARSEOP_BUFFER; - Op->Common.AmlOpcode = AML_BUFFER_OP; - Op->Asl.CompileFlags = NODE_AML_PACKAGE; - UtSetParseOpName (Op); - - /* Child node is the buffer length */ - - RootOp = TrAllocateNode (PARSEOP_INTEGER); - - RootOp->Asl.AmlOpcode = AML_DWORD_OP; - RootOp->Asl.Value.Integer = ObjDesc->Buffer.Length; - RootOp->Asl.Parent = Op; - - (void) OpcSetOptimalIntegerSize (RootOp); - - Op->Asl.Child = RootOp; - Op = RootOp; - UtSetParseOpName (Op); - - /* Peer to the child is the raw buffer data */ - - RootOp = TrAllocateNode (PARSEOP_RAW_DATA); - RootOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER; - RootOp->Asl.AmlLength = ObjDesc->Buffer.Length; - RootOp->Asl.Value.String = (char *) ObjDesc->Buffer.Pointer; - RootOp->Asl.Parent = Op->Asl.Parent; - - Op->Asl.Next = RootOp; - Op = RootOp; - - DbgPrint (ASL_PARSE_OUTPUT, - "Constant expression reduced to (BUFFER) length %X\n", - ObjDesc->Buffer.Length); - break; - - - default: - printf ("Unsupported return type: %s\n", - AcpiUtGetObjectTypeName (ObjDesc)); - break; - } - } - - UtSetParseOpName (Op); - Op->Asl.Child = NULL; - - AcpiDsDeleteWalkState (WalkState); - - return (AE_CTRL_DEPTH); -} - diff -Nru acpica-unix-20100528/compiler/aslglobal.h acpica-unix-20140114/compiler/aslglobal.h --- acpica-unix-20100528/compiler/aslglobal.h 2010-05-28 17:14:23.000000000 +0000 +++ acpica-unix-20140114/compiler/aslglobal.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,295 +0,0 @@ - - -/****************************************************************************** - * - * Module Name: aslglobal.h - Global variable definitions - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - - -#ifndef __ASLGLOBAL_H -#define __ASLGLOBAL_H - - -/* - * Global variables. Defined in aslmain.c only, externed in all other files - */ - -#undef ASL_EXTERN - -#ifdef _DECLARE_GLOBALS -#define ASL_EXTERN -#define ASL_INIT_GLOBAL(a,b) (a)=(b) -#else -#define ASL_EXTERN extern -#define ASL_INIT_GLOBAL(a,b) (a) -#endif - - -/* - * Parser and other externals - */ -extern int yydebug; -extern FILE *AslCompilerin; -extern int AslCompilerdebug; -extern const ASL_MAPPING_ENTRY AslKeywordMapping[]; -extern char *AslCompilertext; -extern char HexLookup[]; - -#define ASL_LINE_BUFFER_SIZE 1024 -#define ASL_MSG_BUFFER_SIZE 4096 -#define HEX_TABLE_LINE_SIZE 8 -#define HEX_LISTING_LINE_SIZE 8 - - -/* Source code buffers and pointers for error reporting */ - -ASL_EXTERN char Gbl_CurrentLineBuffer[ASL_LINE_BUFFER_SIZE]; -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentColumn, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentLineNumber, 1); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_LogicalLineNumber, 1); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentLineOffset, 0); -ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_LineBufPtr, Gbl_CurrentLineBuffer); - - -/* Exception reporting */ - -ASL_EXTERN ASL_ERROR_MSG ASL_INIT_GLOBAL (*Gbl_ErrorLog,NULL); -ASL_EXTERN ASL_ERROR_MSG ASL_INIT_GLOBAL (*Gbl_NextError,NULL); - - -/* Option flags */ - -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoCompile, TRUE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoSignon, TRUE); - -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_Acpi2, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_UseDefaultAmlFilename, TRUE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NsOutputFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DebugFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_AsmOutputFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_C_OutputFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_AsmIncludeOutputFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_C_IncludeOutputFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_ListingFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_IgnoreErrors, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_SourceOutputFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_ParseOnlyFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_CompileTimesFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_FoldConstants, TRUE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_VerboseErrors, TRUE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NoErrors, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NoResourceChecking, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisasmFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_GetAllTables, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_IntegerOptimizationFlag, TRUE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_ReferenceOptimizationFlag, TRUE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisplayRemarks, TRUE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisplayOptimizations, FALSE); -ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_WarningLevel, ASL_WARNING); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_UseOriginalCompilerId, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DataTableCompilerAvailable, FALSE); - - -#define HEX_OUTPUT_NONE 0 -#define HEX_OUTPUT_C 1 -#define HEX_OUTPUT_ASM 2 -#define HEX_OUTPUT_ASL 3 - -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_HexOutputFlag, HEX_OUTPUT_NONE); - - -/* Files */ - -ASL_EXTERN ASL_FILE_INFO Gbl_Files [ASL_NUM_FILES]; - -ASL_EXTERN char *Gbl_DirectoryPath; -ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_ExternalFilename, NULL); -ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_IncludeFilename, NULL); -ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_OutputFilenamePrefix, NULL); -ASL_EXTERN ASL_INCLUDE_DIR ASL_INIT_GLOBAL (*Gbl_IncludeDirList, NULL); -ASL_EXTERN char *Gbl_CurrentInputFilename; - -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_HasIncludeFiles, FALSE); - - -/* Statistics */ - -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_InputByteCount, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_InputFieldCount, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_NsLookupCount, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalKeywords, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalNamedObjects, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalExecutableOpcodes, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalParseNodes, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalMethods, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalAllocations, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalAllocated, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalFolds, 0); - - -/* Misc */ - -ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_RevisionOverride, 0); -ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_TempCount, 0); -ASL_EXTERN ACPI_PARSE_OBJECT ASL_INIT_GLOBAL (*RootNode, NULL); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_TableLength, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_SourceLine, 0); -ASL_EXTERN ASL_LISTING_NODE ASL_INIT_GLOBAL (*Gbl_ListingNode, NULL); -ASL_EXTERN ACPI_PARSE_OBJECT ASL_INIT_GLOBAL (*Gbl_NodeCacheNext, NULL); -ASL_EXTERN ACPI_PARSE_OBJECT ASL_INIT_GLOBAL (*Gbl_NodeCacheLast, NULL); -ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_StringCacheNext, NULL); -ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_StringCacheLast, NULL); -ASL_EXTERN ACPI_PARSE_OBJECT *Gbl_FirstLevelInsertionNode; -ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_FileType, 0); -ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_Signature, NULL); - - -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentHexColumn, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentAmlOffset, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentLine, 0); -ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_HexBytesWereWritten, FALSE); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_NumNamespaceObjects, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_ReservedMethods, 0); -ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_TableSignature, "NO_SIG"); -ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_TableId, "NO_ID"); -ASL_EXTERN FILE *AcpiGbl_DebugFile; /* Placeholder for oswinxf only */ - - -/* Static structures */ - -ASL_EXTERN ASL_ANALYSIS_WALK_INFO AnalysisWalkInfo; -ASL_EXTERN ACPI_TABLE_HEADER TableHeader; - -/* Event timing */ - -#define ASL_NUM_EVENTS 19 -ASL_EXTERN ASL_EVENT_INFO AslGbl_Events[ASL_NUM_EVENTS]; -ASL_EXTERN UINT8 AslGbl_NextEvent; -ASL_EXTERN UINT8 AslGbl_NamespaceEvent; - -/* Scratch buffers */ - -ASL_EXTERN UINT8 Gbl_AmlBuffer[HEX_LISTING_LINE_SIZE]; -ASL_EXTERN char MsgBuffer[ASL_MSG_BUFFER_SIZE]; -ASL_EXTERN char StringBuffer[ASL_MSG_BUFFER_SIZE]; -ASL_EXTERN char StringBuffer2[ASL_MSG_BUFFER_SIZE]; - - -#ifdef _DECLARE_GLOBALS -UINT32 Gbl_ExceptionCount[ASL_NUM_REPORT_LEVELS] = {0,0,0,0,0,0}; -#else -extern UINT32 Gbl_ExceptionCount[ASL_NUM_REPORT_LEVELS]; -#endif - -#endif /* __ASLGLOBAL_H */ - diff -Nru acpica-unix-20100528/compiler/asllength.c acpica-unix-20140114/compiler/asllength.c --- acpica-unix-20100528/compiler/asllength.c 2010-05-28 17:14:23.000000000 +0000 +++ acpica-unix-20140114/compiler/asllength.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,530 +0,0 @@ - -/****************************************************************************** - * - * Module Name: asllength - Tree walk to determine package and opcode lengths - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - - -#include "aslcompiler.h" -#include "aslcompiler.y.h" -#include "amlcode.h" - - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("asllength") - -/* Local prototypes */ - -static UINT8 -CgGetPackageLenByteCount ( - ACPI_PARSE_OBJECT *Op, - UINT32 PackageLength); - -static void -CgGenerateAmlOpcodeLength ( - ACPI_PARSE_OBJECT *Op); - - -#ifdef ACPI_OBSOLETE_FUNCTIONS -void -LnAdjustLengthToRoot ( - ACPI_PARSE_OBJECT *Op, - UINT32 LengthDelta); -#endif - - -/******************************************************************************* - * - * FUNCTION: LnInitLengthsWalk - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Walk callback to initialize (and re-initialize) the node - * subtree length(s) to zero. The Subtree lengths are bubbled - * up to the root node in order to get a total AML length. - * - ******************************************************************************/ - -ACPI_STATUS -LnInitLengthsWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - - Op->Asl.AmlSubtreeLength = 0; - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: LnPackageLengthWalk - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Walk callback to calculate the total AML length. - * 1) Calculate the AML lengths (opcode, package length, etc.) for - * THIS node. - * 2) Bubbble up all of these lengths to the parent node by summing - * them all into the parent subtree length. - * - * Note: The SubtreeLength represents the total AML length of all child nodes - * in all subtrees under a given node. Therefore, once this walk is - * complete, the Root Node subtree length is the AML length of the entire - * tree (and thus, the entire ACPI table) - * - ******************************************************************************/ - -ACPI_STATUS -LnPackageLengthWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - - /* Generate the AML lengths for this node */ - - CgGenerateAmlLengths (Op); - - /* Bubble up all lengths (this node and all below it) to the parent */ - - if ((Op->Asl.Parent) && - (Op->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)) - { - Op->Asl.Parent->Asl.AmlSubtreeLength += (Op->Asl.AmlLength + - Op->Asl.AmlOpcodeLength + - Op->Asl.AmlPkgLenBytes + - Op->Asl.AmlSubtreeLength); - } - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: CgGetPackageLenByteCount - * - * PARAMETERS: Op - Parse node - * PackageLength - Length to be encoded - * - * RETURN: Required length of the package length encoding - * - * DESCRIPTION: Calculate the number of bytes required to encode the given - * package length. - * - ******************************************************************************/ - -static UINT8 -CgGetPackageLenByteCount ( - ACPI_PARSE_OBJECT *Op, - UINT32 PackageLength) -{ - - /* - * Determine the number of bytes required to encode the package length - * Note: the package length includes the number of bytes used to encode - * the package length, so we must account for this also. - */ - if (PackageLength <= (0x0000003F - 1)) - { - return (1); - } - else if (PackageLength <= (0x00000FFF - 2)) - { - return (2); - } - else if (PackageLength <= (0x000FFFFF - 3)) - { - return (3); - } - else if (PackageLength <= (0x0FFFFFFF - 4)) - { - return (4); - } - else - { - /* Fatal error - the package length is too large to encode */ - - AslError (ASL_ERROR, ASL_MSG_ENCODING_LENGTH, Op, NULL); - } - - return (0); -} - - -/******************************************************************************* - * - * FUNCTION: CgGenerateAmlOpcodeLength - * - * PARAMETERS: Op - Parse node whose AML opcode lengths will be - * calculated - * - * RETURN: None. - * - * DESCRIPTION: Calculate the AmlOpcodeLength, AmlPkgLenBytes, and AmlLength - * fields for this node. - * - ******************************************************************************/ - -static void -CgGenerateAmlOpcodeLength ( - ACPI_PARSE_OBJECT *Op) -{ - - /* Check for two-byte opcode */ - - if (Op->Asl.AmlOpcode > 0x00FF) - { - Op->Asl.AmlOpcodeLength = 2; - } - else - { - Op->Asl.AmlOpcodeLength = 1; - } - - /* Does this opcode have an associated "PackageLength" field? */ - - Op->Asl.AmlPkgLenBytes = 0; - if (Op->Asl.CompileFlags & NODE_AML_PACKAGE) - { - Op->Asl.AmlPkgLenBytes = CgGetPackageLenByteCount ( - Op, Op->Asl.AmlSubtreeLength); - } - - /* Data opcode lengths are easy */ - - switch (Op->Asl.AmlOpcode) - { - case AML_BYTE_OP: - - Op->Asl.AmlLength = 1; - break; - - case AML_WORD_OP: - - Op->Asl.AmlLength = 2; - break; - - case AML_DWORD_OP: - - Op->Asl.AmlLength = 4; - break; - - case AML_QWORD_OP: - - Op->Asl.AmlLength = 8; - break; - - default: - /* All data opcodes must be above */ - break; - } -} - - -/******************************************************************************* - * - * FUNCTION: CgGenerateAmlLengths - * - * PARAMETERS: Op - Parse node - * - * RETURN: None. - * - * DESCRIPTION: Generate internal length fields based on the AML opcode or - * parse opcode. - * - ******************************************************************************/ - -void -CgGenerateAmlLengths ( - ACPI_PARSE_OBJECT *Op) -{ - char *Buffer; - ACPI_STATUS Status; - - - switch (Op->Asl.AmlOpcode) - { - case AML_RAW_DATA_BYTE: - - Op->Asl.AmlOpcodeLength = 0; - Op->Asl.AmlLength = 1; - return; - - case AML_RAW_DATA_WORD: - - Op->Asl.AmlOpcodeLength = 0; - Op->Asl.AmlLength = 2; - return; - - case AML_RAW_DATA_DWORD: - - Op->Asl.AmlOpcodeLength = 0; - Op->Asl.AmlLength = 4; - return; - - case AML_RAW_DATA_QWORD: - - Op->Asl.AmlOpcodeLength = 0; - Op->Asl.AmlLength = 8; - return; - - case AML_RAW_DATA_BUFFER: - - /* Aml length is/was set by creator */ - - Op->Asl.AmlOpcodeLength = 0; - return; - - case AML_RAW_DATA_CHAIN: - - /* Aml length is/was set by creator */ - - Op->Asl.AmlOpcodeLength = 0; - return; - - default: - break; - } - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_DEFINITIONBLOCK: - - Gbl_TableLength = sizeof (ACPI_TABLE_HEADER) + - Op->Asl.AmlSubtreeLength; - break; - - case PARSEOP_NAMESEG: - - Op->Asl.AmlOpcodeLength = 0; - Op->Asl.AmlLength = 4; - Op->Asl.ExternalName = Op->Asl.Value.String; - break; - - case PARSEOP_NAMESTRING: - case PARSEOP_METHODCALL: - - if (Op->Asl.CompileFlags & NODE_NAME_INTERNALIZED) - { - break; - } - - Op->Asl.AmlOpcodeLength = 0; - Status = UtInternalizeName (Op->Asl.Value.String, &Buffer); - if (ACPI_FAILURE (Status)) - { - DbgPrint (ASL_DEBUG_OUTPUT, - "Failure from internalize name %X\n", Status); - break; - } - - Op->Asl.ExternalName = Op->Asl.Value.String; - Op->Asl.Value.String = Buffer; - Op->Asl.CompileFlags |= NODE_NAME_INTERNALIZED; - - Op->Asl.AmlLength = strlen (Buffer); - - /* - * Check for single backslash reference to root, - * make it a null terminated string in the AML - */ - if (Op->Asl.AmlLength == 1) - { - Op->Asl.AmlLength = 2; - } - break; - - case PARSEOP_STRING_LITERAL: - - Op->Asl.AmlOpcodeLength = 1; - - /* Get null terminator */ - - Op->Asl.AmlLength = strlen (Op->Asl.Value.String) + 1; - break; - - case PARSEOP_PACKAGE_LENGTH: - - Op->Asl.AmlOpcodeLength = 0; - Op->Asl.AmlPkgLenBytes = CgGetPackageLenByteCount (Op, - (UINT32) Op->Asl.Value.Integer); - break; - - case PARSEOP_RAW_DATA: - - Op->Asl.AmlOpcodeLength = 0; - break; - - case PARSEOP_DEFAULT_ARG: - case PARSEOP_EXTERNAL: - case PARSEOP_INCLUDE: - case PARSEOP_INCLUDE_END: - - /* Ignore the "default arg" nodes, they are extraneous at this point */ - - break; - - default: - - CgGenerateAmlOpcodeLength (Op); - break; - } -} - - -#ifdef ACPI_OBSOLETE_FUNCTIONS -/******************************************************************************* - * - * FUNCTION: LnAdjustLengthToRoot - * - * PARAMETERS: Op - Node whose Length was changed - * - * RETURN: None. - * - * DESCRIPTION: Change the Subtree length of the given node, and bubble the - * change all the way up to the root node. This allows for - * last second changes to a package length (for example, if the - * package length encoding gets shorter or longer.) - * - ******************************************************************************/ - -void -LnAdjustLengthToRoot ( - ACPI_PARSE_OBJECT *SubtreeOp, - UINT32 LengthDelta) -{ - ACPI_PARSE_OBJECT *Op; - - - /* Adjust all subtree lengths up to the root */ - - Op = SubtreeOp->Asl.Parent; - while (Op) - { - Op->Asl.AmlSubtreeLength -= LengthDelta; - Op = Op->Asl.Parent; - } - - /* Adjust the global table length */ - - Gbl_TableLength -= LengthDelta; -} -#endif - - diff -Nru acpica-unix-20100528/compiler/asllisting.c acpica-unix-20140114/compiler/asllisting.c --- acpica-unix-20100528/compiler/asllisting.c 2010-05-28 17:14:23.000000000 +0000 +++ acpica-unix-20140114/compiler/asllisting.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1614 +0,0 @@ - -/****************************************************************************** - * - * Module Name: asllisting - Listing file generation - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - - -#include "aslcompiler.h" -#include "aslcompiler.y.h" -#include "amlcode.h" -#include "acparser.h" -#include "acnamesp.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslisting") - -/* Local prototypes */ - -static void -LsDumpAscii ( - UINT32 FileId, - UINT32 Count, - UINT8 *Buffer); - -static void -LsDumpAsciiInComment ( - UINT32 FileId, - UINT32 Count, - UINT8 *Buffer); - -static ACPI_STATUS -LsAmlListingWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -static void -LsGenerateListing ( - UINT32 FileId); - -static void -LsPushNode ( - char *Filename); - -static ASL_LISTING_NODE * -LsPopNode ( - void); - -static void -LsCheckException ( - UINT32 LineNumber, - UINT32 FileId); - -static void -LsFlushListingBuffer ( - UINT32 FileId); - -static void -LsWriteListingHexBytes ( - UINT8 *Buffer, - UINT32 Length, - UINT32 FileId); - -static UINT32 -LsWriteOneSourceLine ( - UINT32 FileId); - -static void -LsFinishSourceListing ( - UINT32 FileId); - -static void -LsWriteSourceLines ( - UINT32 ToLineNumber, - UINT32 ToLogicalLineNumber, - UINT32 FileId); - -static void -LsWriteNodeToListing ( - ACPI_PARSE_OBJECT *Op, - UINT32 FileId); - -static void -LsDoHexOutputC ( - void); - -static void -LsDoHexOutputAsm ( - void); - -static void -LsDoHexOutputAsl ( - void); - -ACPI_STATUS -LsTreeWriteWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - - -/******************************************************************************* - * - * FUNCTION: LsTreeWriteWalk - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * - * RETURN: None. - * - * DESCRIPTION: Dump entire parse tree, for compiler debug only - * - ******************************************************************************/ - -ACPI_STATUS -LsTreeWriteWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - - /* Debug output */ - - DbgPrint (ASL_TREE_OUTPUT, - "%5.5d [%2d]", Op->Asl.LogicalLineNumber, Level); - UtPrintFormattedName (Op->Asl.ParseOpcode, Level); - - - DbgPrint (ASL_TREE_OUTPUT, "\n"); - return (AE_OK); -} - - -void -LsDumpParseTree ( - void) -{ - - if (!Gbl_DebugFlag) - { - return; - } - - DbgPrint (ASL_TREE_OUTPUT, "\nOriginal parse tree from parser:\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, - LsTreeWriteWalk, NULL, NULL); -} - - -/******************************************************************************* - * - * FUNCTION: LsDumpAscii - * - * PARAMETERS: FileId - ID of current listing file - * Count - Number of bytes to convert - * Buffer - Buffer of bytes to convert - * - * RETURN: None. - * - * DESCRIPTION: Convert hex bytes to ascii - * - ******************************************************************************/ - -static void -LsDumpAscii ( - UINT32 FileId, - UINT32 Count, - UINT8 *Buffer) -{ - UINT8 BufChar; - UINT32 i; - - - FlPrintFile (FileId, " \""); - for (i = 0; i < Count; i++) - { - BufChar = Buffer[i]; - if (isprint (BufChar)) - { - FlPrintFile (FileId, "%c", BufChar); - } - else - { - /* Not a printable character, just put out a dot */ - - FlPrintFile (FileId, "."); - } - } - FlPrintFile (FileId, "\""); -} - - -/******************************************************************************* - * - * FUNCTION: LsDumpAsciiInComment - * - * PARAMETERS: FileId - ID of current listing file - * Count - Number of bytes to convert - * Buffer - Buffer of bytes to convert - * - * RETURN: None. - * - * DESCRIPTION: Convert hex bytes to ascii - * - ******************************************************************************/ - -static void -LsDumpAsciiInComment ( - UINT32 FileId, - UINT32 Count, - UINT8 *Buffer) -{ - UINT8 BufChar = 0; - UINT8 LastChar; - UINT32 i; - - - FlPrintFile (FileId, " \""); - for (i = 0; i < Count; i++) - { - LastChar = BufChar; - BufChar = Buffer[i]; - - if (isprint (BufChar)) - { - /* Handle embedded C comment sequences */ - - if (((LastChar == '*') && (BufChar == '/')) || - ((LastChar == '/') && (BufChar == '*'))) - { - /* Insert a space to break the sequence */ - - FlPrintFile (FileId, ".", BufChar); - } - - FlPrintFile (FileId, "%c", BufChar); - } - else - { - /* Not a printable character, just put out a dot */ - - FlPrintFile (FileId, "."); - } - } - FlPrintFile (FileId, "\""); -} - - -/******************************************************************************* - * - * FUNCTION: LsAmlListingWalk - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Process one node during a listing file generation. - * - ******************************************************************************/ - -static ACPI_STATUS -LsAmlListingWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - UINT8 FileByte; - UINT32 i; - UINT32 FileId = (UINT32) ACPI_TO_INTEGER (Context); - - - LsWriteNodeToListing (Op, FileId); - - if (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DATA) - { - /* Buffer is a resource template, don't dump the data all at once */ - - return (AE_OK); - } - - /* Write the hex bytes to the listing file(s) (if requested) */ - - for (i = 0; i < Op->Asl.FinalAmlLength; i++) - { - if (ACPI_FAILURE (FlReadFile (ASL_FILE_AML_OUTPUT, &FileByte, 1))) - { - FlFileError (ASL_FILE_AML_OUTPUT, ASL_MSG_READ); - AslAbort (); - } - LsWriteListingHexBytes (&FileByte, 1, FileId); - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: LsGenerateListing - * - * PARAMETERS: FileId - ID of listing file - * - * RETURN: None - * - * DESCRIPTION: Generate a listing file. This can be one of the several types - * of "listings" supported. - * - ******************************************************************************/ - -static void -LsGenerateListing ( - UINT32 FileId) -{ - - /* Start at the beginning of both the source and AML files */ - - FlSeekFile (ASL_FILE_SOURCE_OUTPUT, 0); - FlSeekFile (ASL_FILE_AML_OUTPUT, 0); - Gbl_SourceLine = 0; - Gbl_CurrentHexColumn = 0; - LsPushNode (Gbl_Files[ASL_FILE_INPUT].Filename); - - /* Process all parse nodes */ - - TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, LsAmlListingWalk, - NULL, (void *) ACPI_TO_POINTER (FileId)); - - /* Final processing */ - - LsFinishSourceListing (FileId); -} - - -/******************************************************************************* - * - * FUNCTION: LsDoListings - * - * PARAMETERS: None. - * - * RETURN: None - * - * DESCRIPTION: Generate all requested listing files. - * - ******************************************************************************/ - -void -LsDoListings ( - void) -{ - - if (Gbl_C_OutputFlag) - { - LsGenerateListing (ASL_FILE_C_SOURCE_OUTPUT); - } - - if (Gbl_ListingFlag) - { - LsGenerateListing (ASL_FILE_LISTING_OUTPUT); - } - - if (Gbl_AsmOutputFlag) - { - LsGenerateListing (ASL_FILE_ASM_SOURCE_OUTPUT); - } - - if (Gbl_C_IncludeOutputFlag) - { - LsGenerateListing (ASL_FILE_C_INCLUDE_OUTPUT); - } - - if (Gbl_AsmIncludeOutputFlag) - { - LsGenerateListing (ASL_FILE_ASM_INCLUDE_OUTPUT); - } -} - - -/******************************************************************************* - * - * FUNCTION: LsPushNode - * - * PARAMETERS: Filename - Pointer to the include filename - * - * RETURN: None - * - * DESCRIPTION: Push a listing node on the listing/include file stack. This - * stack enables tracking of include files (infinitely nested) - * and resumption of the listing of the parent file when the - * include file is finished. - * - ******************************************************************************/ - -static void -LsPushNode ( - char *Filename) -{ - ASL_LISTING_NODE *Lnode; - - - /* Create a new node */ - - Lnode = UtLocalCalloc (sizeof (ASL_LISTING_NODE)); - - /* Initialize */ - - Lnode->Filename = Filename; - Lnode->LineNumber = 0; - - /* Link (push) */ - - Lnode->Next = Gbl_ListingNode; - Gbl_ListingNode = Lnode; -} - - -/******************************************************************************* - * - * FUNCTION: LsPopNode - * - * PARAMETERS: None - * - * RETURN: List head after current head is popped off - * - * DESCRIPTION: Pop the current head of the list, free it, and return the - * next node on the stack (the new current node). - * - ******************************************************************************/ - -static ASL_LISTING_NODE * -LsPopNode ( - void) -{ - ASL_LISTING_NODE *Lnode; - - - /* Just grab the node at the head of the list */ - - Lnode = Gbl_ListingNode; - if ((!Lnode) || - (!Lnode->Next)) - { - AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, NULL, - "Could not pop empty listing stack"); - return Gbl_ListingNode; - } - - Gbl_ListingNode = Lnode->Next; - ACPI_FREE (Lnode); - - /* New "Current" node is the new head */ - - return (Gbl_ListingNode); -} - - -/******************************************************************************* - * - * FUNCTION: LsCheckException - * - * PARAMETERS: LineNumber - Current logical (cumulative) line # - * FileId - ID of output listing file - * - * RETURN: None - * - * DESCRIPTION: Check if there is an exception for this line, and if there is, - * put it in the listing immediately. Handles multiple errors - * per line. Gbl_NextError points to the next error in the - * sorted (by line #) list of compile errors/warnings. - * - ******************************************************************************/ - -static void -LsCheckException ( - UINT32 LineNumber, - UINT32 FileId) -{ - - if ((!Gbl_NextError) || - (LineNumber < Gbl_NextError->LogicalLineNumber )) - { - return; - } - - /* Handle multiple errors per line */ - - if (FileId == ASL_FILE_LISTING_OUTPUT) - { - while (Gbl_NextError && - (LineNumber >= Gbl_NextError->LogicalLineNumber)) - { - AePrintException (FileId, Gbl_NextError, "\n[****iasl****]\n"); - - Gbl_NextError = Gbl_NextError->Next; - } - - FlPrintFile (FileId, "\n"); - } -} - - -/******************************************************************************* - * - * FUNCTION: LsFlushListingBuffer - * - * PARAMETERS: FileId - ID of the listing file - * - * RETURN: None - * - * DESCRIPTION: Flush out the current contents of the 16-byte hex AML code - * buffer. Usually called at the termination of a single line - * of source code or when the buffer is full. - * - ******************************************************************************/ - -static void -LsFlushListingBuffer ( - UINT32 FileId) -{ - UINT32 i; - - - if (Gbl_CurrentHexColumn == 0) - { - return; - } - - /* Write the hex bytes */ - - switch (FileId) - { - case ASL_FILE_LISTING_OUTPUT: - - for (i = 0; i < Gbl_CurrentHexColumn; i++) - { - FlPrintFile (FileId, "%2.2X ", Gbl_AmlBuffer[i]); - } - - for (i = 0; i < ((HEX_LISTING_LINE_SIZE - Gbl_CurrentHexColumn) * 3); i++) - { - FlWriteFile (FileId, ".", 1); - } - - /* Write the ASCII character associated with each of the bytes */ - - LsDumpAscii (FileId, Gbl_CurrentHexColumn, Gbl_AmlBuffer); - break; - - - case ASL_FILE_ASM_SOURCE_OUTPUT: - - for (i = 0; i < Gbl_CurrentHexColumn; i++) - { - if (i > 0) - { - FlPrintFile (FileId, ","); - } - FlPrintFile (FileId, "0%2.2Xh", Gbl_AmlBuffer[i]); - } - - for (i = 0; i < ((HEX_LISTING_LINE_SIZE - Gbl_CurrentHexColumn) * 5); i++) - { - FlWriteFile (FileId, " ", 1); - } - - FlPrintFile (FileId, " ;%8.8X", - Gbl_CurrentAmlOffset - HEX_LISTING_LINE_SIZE); - - /* Write the ASCII character associated with each of the bytes */ - - LsDumpAscii (FileId, Gbl_CurrentHexColumn, Gbl_AmlBuffer); - break; - - - case ASL_FILE_C_SOURCE_OUTPUT: - - for (i = 0; i < Gbl_CurrentHexColumn; i++) - { - FlPrintFile (FileId, "0x%2.2X,", Gbl_AmlBuffer[i]); - } - - for (i = 0; i < ((HEX_LISTING_LINE_SIZE - Gbl_CurrentHexColumn) * 5); i++) - { - FlWriteFile (FileId, " ", 1); - } - - FlPrintFile (FileId, " /* %8.8X", - Gbl_CurrentAmlOffset - HEX_LISTING_LINE_SIZE); - - /* Write the ASCII character associated with each of the bytes */ - - LsDumpAsciiInComment (FileId, Gbl_CurrentHexColumn, Gbl_AmlBuffer); - FlPrintFile (FileId, " */"); - break; - - default: - /* No other types supported */ - return; - } - - FlPrintFile (FileId, "\n"); - - Gbl_CurrentHexColumn = 0; - Gbl_HexBytesWereWritten = TRUE; -} - - -/******************************************************************************* - * - * FUNCTION: LsWriteListingHexBytes - * - * PARAMETERS: Buffer - AML code buffer - * Length - Number of AML bytes to write - * FileId - ID of current listing file. - * - * RETURN: None - * - * DESCRIPTION: Write the contents of the AML buffer to the listing file via - * the listing buffer. The listing buffer is flushed every 16 - * AML bytes. - * - ******************************************************************************/ - -static void -LsWriteListingHexBytes ( - UINT8 *Buffer, - UINT32 Length, - UINT32 FileId) -{ - UINT32 i; - - - /* Transfer all requested bytes */ - - for (i = 0; i < Length; i++) - { - /* Print line header when buffer is empty */ - - if (Gbl_CurrentHexColumn == 0) - { - if (Gbl_HasIncludeFiles) - { - FlPrintFile (FileId, "%*s", 10, " "); - } - - switch (FileId) - { - case ASL_FILE_LISTING_OUTPUT: - - FlPrintFile (FileId, "%8.8X....", Gbl_CurrentAmlOffset); - break; - - case ASL_FILE_ASM_SOURCE_OUTPUT: - - FlPrintFile (FileId, " db "); - break; - - case ASL_FILE_C_SOURCE_OUTPUT: - - FlPrintFile (FileId, " "); - break; - - default: - /* No other types supported */ - return; - } - } - - /* Transfer AML byte and update counts */ - - Gbl_AmlBuffer[Gbl_CurrentHexColumn] = Buffer[i]; - - Gbl_CurrentHexColumn++; - Gbl_CurrentAmlOffset++; - - /* Flush buffer when it is full */ - - if (Gbl_CurrentHexColumn >= HEX_LISTING_LINE_SIZE) - { - LsFlushListingBuffer (FileId); - } - } -} - - -/******************************************************************************* - * - * FUNCTION: LsWriteOneSourceLine - * - * PARAMETERS: FileID - ID of current listing file - * - * RETURN: FALSE on EOF (input source file), TRUE otherwise - * - * DESCRIPTION: Read one line from the input source file and echo it to the - * listing file, prefixed with the line number, and if the source - * file contains include files, prefixed with the current filename - * - ******************************************************************************/ - -static UINT32 -LsWriteOneSourceLine ( - UINT32 FileId) -{ - UINT8 FileByte; - - - Gbl_SourceLine++; - Gbl_ListingNode->LineNumber++; - - if (FileId == ASL_FILE_C_SOURCE_OUTPUT) - { - FlPrintFile (FileId, " *"); - } - if (FileId == ASL_FILE_ASM_SOURCE_OUTPUT) - { - FlPrintFile (FileId, "; "); - } - - if (Gbl_HasIncludeFiles) - { - /* - * This file contains "include" statements, print the current - * filename and line number within the current file - */ - FlPrintFile (FileId, "%12s %5d....", - Gbl_ListingNode->Filename, Gbl_ListingNode->LineNumber); - } - else - { - /* No include files, just print the line number */ - - FlPrintFile (FileId, "%8d....", Gbl_SourceLine); - } - - /* Read one line (up to a newline or EOF) */ - - while (FlReadFile (ASL_FILE_SOURCE_OUTPUT, &FileByte, 1) == AE_OK) - { - if (FileId == ASL_FILE_C_SOURCE_OUTPUT) - { - if (FileByte == '/') - { - FileByte = '*'; - } - } - - FlWriteFile (FileId, &FileByte, 1); - if (FileByte == '\n') - { - /* - * Check if an error occurred on this source line during the compile. - * If so, we print the error message after the source line. - */ - LsCheckException (Gbl_SourceLine, FileId); - return (1); - } - } - - /* EOF on the input file was reached */ - - return (0); -} - - -/******************************************************************************* - * - * FUNCTION: LsFinishSourceListing - * - * PARAMETERS: FileId - ID of current listing file. - * - * RETURN: None - * - * DESCRIPTION: Cleanup routine for the listing file. Flush the hex AML - * listing buffer, and flush out any remaining lines in the - * source input file. - * - ******************************************************************************/ - -static void -LsFinishSourceListing ( - UINT32 FileId) -{ - - if ((FileId == ASL_FILE_ASM_INCLUDE_OUTPUT) || - (FileId == ASL_FILE_C_INCLUDE_OUTPUT)) - { - return; - } - - LsFlushListingBuffer (FileId); - Gbl_CurrentAmlOffset = 0; - - /* Flush any remaining text in the source file */ - - if (FileId == ASL_FILE_C_SOURCE_OUTPUT) - { - FlPrintFile (FileId, " /*\n"); - } - - while (LsWriteOneSourceLine (FileId)) - { ; } - - if (FileId == ASL_FILE_C_SOURCE_OUTPUT) - { - FlPrintFile (FileId, "\n */\n };\n"); - } - - FlPrintFile (FileId, "\n"); - - if (FileId == ASL_FILE_LISTING_OUTPUT) - { - /* Print a summary of the compile exceptions */ - - FlPrintFile (FileId, "\n\nSummary of errors and warnings\n\n"); - AePrintErrorLog (FileId); - FlPrintFile (FileId, "\n\n"); - UtDisplaySummary (FileId); - FlPrintFile (FileId, "\n\n"); - } -} - - -/******************************************************************************* - * - * FUNCTION: LsWriteSourceLines - * - * PARAMETERS: ToLineNumber - - * ToLogicalLineNumber - Write up to this source line number - * FileId - ID of current listing file - * - * RETURN: None - * - * DESCRIPTION: Read then write source lines to the listing file until we have - * reached the specified logical (cumulative) line number. This - * automatically echos out comment blocks and other non-AML - * generating text until we get to the actual AML-generating line - * of ASL code specified by the logical line number. - * - ******************************************************************************/ - -static void -LsWriteSourceLines ( - UINT32 ToLineNumber, - UINT32 ToLogicalLineNumber, - UINT32 FileId) -{ - - if ((FileId == ASL_FILE_ASM_INCLUDE_OUTPUT) || - (FileId == ASL_FILE_C_INCLUDE_OUTPUT)) - { - return; - } - - Gbl_CurrentLine = ToLogicalLineNumber; - - /* Flush any hex bytes remaining from the last opcode */ - - LsFlushListingBuffer (FileId); - - /* Read lines and write them as long as we are not caught up */ - - if (Gbl_SourceLine < Gbl_CurrentLine) - { - /* - * If we just completed writing some AML hex bytes, output a linefeed - * to add some whitespace for readability. - */ - if (Gbl_HexBytesWereWritten) - { - FlPrintFile (FileId, "\n"); - Gbl_HexBytesWereWritten = FALSE; - } - - if (FileId == ASL_FILE_C_SOURCE_OUTPUT) - { - FlPrintFile (FileId, " /*\n"); - } - - /* Write one line at a time until we have reached the target line # */ - - while ((Gbl_SourceLine < Gbl_CurrentLine) && - LsWriteOneSourceLine (FileId)) - { ; } - - if (FileId == ASL_FILE_C_SOURCE_OUTPUT) - { - FlPrintFile (FileId, " */"); - } - FlPrintFile (FileId, "\n"); - } -} - - -/******************************************************************************* - * - * FUNCTION: LsWriteNodeToListing - * - * PARAMETERS: Op - Parse node to write to the listing file. - * FileId - ID of current listing file - * - * RETURN: None. - * - * DESCRIPTION: Write "a node" to the listing file. This means to - * 1) Write out all of the source text associated with the node - * 2) Write out all of the AML bytes associated with the node - * 3) Write any compiler exceptions associated with the node - * - ******************************************************************************/ - -static void -LsWriteNodeToListing ( - ACPI_PARSE_OBJECT *Op, - UINT32 FileId) -{ - const ACPI_OPCODE_INFO *OpInfo; - UINT32 OpClass; - char *Pathname; - UINT32 Length; - UINT32 i; - - - OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode); - OpClass = OpInfo->Class; - - /* TBD: clean this up with a single flag that says: - * I start a named output block - */ - if (FileId == ASL_FILE_C_SOURCE_OUTPUT) - { - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_DEFINITIONBLOCK: - case PARSEOP_METHODCALL: - case PARSEOP_INCLUDE: - case PARSEOP_INCLUDE_END: - case PARSEOP_DEFAULT_ARG: - - break; - - default: - switch (OpClass) - { - case AML_CLASS_NAMED_OBJECT: - switch (Op->Asl.AmlOpcode) - { - case AML_SCOPE_OP: - case AML_ALIAS_OP: - break; - - default: - if (Op->Asl.ExternalName) - { - LsFlushListingBuffer (FileId); - FlPrintFile (FileId, " };\n"); - } - break; - } - break; - - default: - /* Don't care about other objects */ - break; - } - break; - } - } - - /* These cases do not have a corresponding AML opcode */ - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_DEFINITIONBLOCK: - - LsWriteSourceLines (Op->Asl.EndLine, Op->Asl.EndLogicalLine, FileId); - - /* Use the table Signature and TableId to build a unique name */ - - if (FileId == ASL_FILE_ASM_SOURCE_OUTPUT) - { - FlPrintFile (FileId, - "%s_%s_Header \\\n", - Gbl_TableSignature, Gbl_TableId); - } - if (FileId == ASL_FILE_C_SOURCE_OUTPUT) - { - FlPrintFile (FileId, - " unsigned char %s_%s_Header [] =\n {\n", - Gbl_TableSignature, Gbl_TableId); - } - if (FileId == ASL_FILE_ASM_INCLUDE_OUTPUT) - { - FlPrintFile (FileId, - "extrn %s_%s_Header : byte\n", - Gbl_TableSignature, Gbl_TableId); - } - if (FileId == ASL_FILE_C_INCLUDE_OUTPUT) - { - FlPrintFile (FileId, - "extern unsigned char %s_%s_Header [];\n", - Gbl_TableSignature, Gbl_TableId); - } - return; - - - case PARSEOP_METHODCALL: - - LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber, - FileId); - return; - - - case PARSEOP_INCLUDE: - - /* Flush everything up to and including the include source line */ - - LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber, - FileId); - - /* Create a new listing node and push it */ - - LsPushNode (Op->Asl.Child->Asl.Value.String); - return; - - - case PARSEOP_INCLUDE_END: - - /* Flush out the rest of the include file */ - - LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber, - FileId); - - /* Pop off this listing node and go back to the parent file */ - - (void) LsPopNode (); - return; - - - case PARSEOP_DEFAULT_ARG: - - if (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DESC) - { - LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.EndLogicalLine, - FileId); - } - return; - - - default: - /* All other opcodes have an AML opcode */ - break; - } - - /* - * Otherwise, we look at the AML opcode because we can - * switch on the opcode type, getting an entire class - * at once - */ - switch (OpClass) - { - case AML_CLASS_ARGUMENT: /* argument type only */ - case AML_CLASS_INTERNAL: - - break; - - - case AML_CLASS_NAMED_OBJECT: - - switch (Op->Asl.AmlOpcode) - { - case AML_FIELD_OP: - case AML_INDEX_FIELD_OP: - case AML_BANK_FIELD_OP: - - /* - * For fields, we want to dump all the AML after the - * entire definition - */ - LsWriteSourceLines (Op->Asl.EndLine, Op->Asl.EndLogicalLine, - FileId); - break; - - case AML_NAME_OP: - - if (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DESC) - { - LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber, - FileId); - } - else - { - /* - * For fields, we want to dump all the AML after the - * entire definition - */ - LsWriteSourceLines (Op->Asl.EndLine, Op->Asl.EndLogicalLine, - FileId); - } - break; - - default: - LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber, - FileId); - break; - } - - switch (Op->Asl.AmlOpcode) - { - case AML_SCOPE_OP: - case AML_ALIAS_OP: - - /* These opcodes do not declare a new object, ignore them */ - - break; - - default: - - /* All other named object opcodes come here */ - - switch (FileId) - { - case ASL_FILE_ASM_SOURCE_OUTPUT: - case ASL_FILE_C_SOURCE_OUTPUT: - case ASL_FILE_ASM_INCLUDE_OUTPUT: - case ASL_FILE_C_INCLUDE_OUTPUT: - - /* - * For named objects, we will create a valid symbol so that the - * AML code can be referenced from C or ASM - */ - if (Op->Asl.ExternalName) - { - /* Get the full pathname associated with this node */ - - Pathname = AcpiNsGetExternalPathname (Op->Asl.Node); - Length = strlen (Pathname); - if (Length >= 4) - { - /* Convert all dots in the path to underscores */ - - for (i = 0; i < Length; i++) - { - if (Pathname[i] == '.') - { - Pathname[i] = '_'; - } - } - - /* Create the appropriate symbol in the output file */ - - if (FileId == ASL_FILE_ASM_SOURCE_OUTPUT) - { - FlPrintFile (FileId, - "%s_%s_%s \\\n", - Gbl_TableSignature, Gbl_TableId, &Pathname[1]); - } - if (FileId == ASL_FILE_C_SOURCE_OUTPUT) - { - FlPrintFile (FileId, - " unsigned char %s_%s_%s [] =\n {\n", - Gbl_TableSignature, Gbl_TableId, &Pathname[1]); - } - if (FileId == ASL_FILE_ASM_INCLUDE_OUTPUT) - { - FlPrintFile (FileId, - "extrn %s_%s_%s : byte\n", - Gbl_TableSignature, Gbl_TableId, &Pathname[1]); - } - if (FileId == ASL_FILE_C_INCLUDE_OUTPUT) - { - FlPrintFile (FileId, - "extern unsigned char %s_%s_%s [];\n", - Gbl_TableSignature, Gbl_TableId, &Pathname[1]); - } - } - ACPI_FREE (Pathname); - } - break; - - default: - /* Nothing to do for listing file */ - break; - } - } - break; - - case AML_CLASS_EXECUTE: - case AML_CLASS_CREATE: - default: - - if ((Op->Asl.ParseOpcode == PARSEOP_BUFFER) && - (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DESC)) - { - return; - } - - LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber, - FileId); - break; - - case AML_CLASS_UNKNOWN: - break; - } -} - - -/******************************************************************************* - * - * FUNCTION: LsDoHexOutput - * - * PARAMETERS: None - * - * RETURN: None. - * - * DESCRIPTION: Create the hex output file. - * - ******************************************************************************/ - -void -LsDoHexOutput ( - void) -{ - - switch (Gbl_HexOutputFlag) - { - case HEX_OUTPUT_C: - - LsDoHexOutputC (); - break; - - case HEX_OUTPUT_ASM: - - LsDoHexOutputAsm (); - break; - - case HEX_OUTPUT_ASL: - - LsDoHexOutputAsl (); - break; - - default: - /* No other output types supported */ - break; - } -} - - -/******************************************************************************* - * - * FUNCTION: LsDoHexOutputC - * - * PARAMETERS: None - * - * RETURN: None. - * - * DESCRIPTION: Create the hex output file. This is the same data as the AML - * output file, but formatted into hex/ascii bytes suitable for - * inclusion into a C source file. - * - ******************************************************************************/ - -static void -LsDoHexOutputC ( - void) -{ - UINT8 FileData[HEX_TABLE_LINE_SIZE]; - UINT32 LineLength; - UINT32 Offset = 0; - UINT32 AmlFileSize; - UINT32 i; - - - /* Get AML size, seek back to start */ - - AmlFileSize = FlGetFileSize (ASL_FILE_AML_OUTPUT); - - FlPrintFile (ASL_FILE_HEX_OUTPUT, " * C source code output\n"); - FlPrintFile (ASL_FILE_HEX_OUTPUT, " * AML code block contains 0x%X bytes\n *\n */\n", - AmlFileSize); - FlPrintFile (ASL_FILE_HEX_OUTPUT, "unsigned char AmlCode[] =\n{\n"); - - while (Offset < AmlFileSize) - { - /* Read enough bytes needed for one output line */ - - LineLength = fread (FileData, 1, HEX_TABLE_LINE_SIZE, - Gbl_Files[ASL_FILE_AML_OUTPUT].Handle); - if (!LineLength) - { - break; - } - - FlPrintFile (ASL_FILE_HEX_OUTPUT, " "); - - for (i = 0; i < LineLength; i++) - { - /* - * Print each hex byte. - * Add a comma until the very last byte of the AML file - * (Some C compilers complain about a trailing comma) - */ - FlPrintFile (ASL_FILE_HEX_OUTPUT, "0x%2.2X", FileData[i]); - if ((Offset + i + 1) < AmlFileSize) - { - FlPrintFile (ASL_FILE_HEX_OUTPUT, ","); - } - else - { - FlPrintFile (ASL_FILE_HEX_OUTPUT, " "); - } - } - - /* Add fill spaces if needed for last line */ - - if (LineLength < HEX_TABLE_LINE_SIZE) - { - FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s", - 5 * (HEX_TABLE_LINE_SIZE - LineLength), " "); - } - - /* Emit the offset and ascii dump for the entire line */ - - FlPrintFile (ASL_FILE_HEX_OUTPUT, " /* %8.8X", Offset); - LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT, LineLength, FileData); - FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s*/\n", - HEX_TABLE_LINE_SIZE - LineLength + 1, " "); - - Offset += LineLength; - } - - FlPrintFile (ASL_FILE_HEX_OUTPUT, "};\n"); - FlCloseFile (ASL_FILE_HEX_OUTPUT); -} - - -/******************************************************************************* - * - * FUNCTION: LsDoHexOutputAsl - * - * PARAMETERS: None - * - * RETURN: None. - * - * DESCRIPTION: Create the hex output file. This is the same data as the AML - * output file, but formatted into hex/ascii bytes suitable for - * inclusion into a C source file. - * - ******************************************************************************/ - -static void -LsDoHexOutputAsl ( - void) -{ - UINT8 FileData[HEX_TABLE_LINE_SIZE]; - UINT32 LineLength; - UINT32 Offset = 0; - UINT32 AmlFileSize; - UINT32 i; - - - /* Get AML size, seek back to start */ - - AmlFileSize = FlGetFileSize (ASL_FILE_AML_OUTPUT); - - FlPrintFile (ASL_FILE_HEX_OUTPUT, " * ASL source code output\n"); - FlPrintFile (ASL_FILE_HEX_OUTPUT, " * AML code block contains 0x%X bytes\n *\n */\n", - AmlFileSize); - FlPrintFile (ASL_FILE_HEX_OUTPUT, " Name (BUF1, Buffer()\n {\n"); - - while (Offset < AmlFileSize) - { - /* Read enough bytes needed for one output line */ - - LineLength = fread (FileData, 1, HEX_TABLE_LINE_SIZE, - Gbl_Files[ASL_FILE_AML_OUTPUT].Handle); - if (!LineLength) - { - break; - } - - FlPrintFile (ASL_FILE_HEX_OUTPUT, " "); - - for (i = 0; i < LineLength; i++) - { - /* - * Print each hex byte. - * Add a comma until the very last byte of the AML file - * (Some C compilers complain about a trailing comma) - */ - FlPrintFile (ASL_FILE_HEX_OUTPUT, "0x%2.2X", FileData[i]); - if ((Offset + i + 1) < AmlFileSize) - { - FlPrintFile (ASL_FILE_HEX_OUTPUT, ","); - } - else - { - FlPrintFile (ASL_FILE_HEX_OUTPUT, " "); - } - } - - /* Add fill spaces if needed for last line */ - - if (LineLength < HEX_TABLE_LINE_SIZE) - { - FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s", - 5 * (HEX_TABLE_LINE_SIZE - LineLength), " "); - } - - /* Emit the offset and ascii dump for the entire line */ - - FlPrintFile (ASL_FILE_HEX_OUTPUT, " /* %8.8X", Offset); - LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT, LineLength, FileData); - FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s*/\n", - HEX_TABLE_LINE_SIZE - LineLength + 1, " "); - - Offset += LineLength; - } - - FlPrintFile (ASL_FILE_HEX_OUTPUT, " })\n"); - FlCloseFile (ASL_FILE_HEX_OUTPUT); -} - - -/******************************************************************************* - * - * FUNCTION: LsDoHexOutputAsm - * - * PARAMETERS: None - * - * RETURN: None. - * - * DESCRIPTION: Create the hex output file. This is the same data as the AML - * output file, but formatted into hex/ascii bytes suitable for - * inclusion into a ASM source file. - * - ******************************************************************************/ - -static void -LsDoHexOutputAsm ( - void) -{ - UINT8 FileData[HEX_TABLE_LINE_SIZE]; - UINT32 LineLength; - UINT32 Offset = 0; - UINT32 AmlFileSize; - UINT32 i; - - - /* Get AML size, seek back to start */ - - AmlFileSize = FlGetFileSize (ASL_FILE_AML_OUTPUT); - - FlPrintFile (ASL_FILE_HEX_OUTPUT, "; Assembly code source output\n"); - FlPrintFile (ASL_FILE_HEX_OUTPUT, "; AML code block contains 0x%X bytes\n;\n", - AmlFileSize); - - while (Offset < AmlFileSize) - { - /* Read enough bytes needed for one output line */ - - LineLength = fread (FileData, 1, HEX_TABLE_LINE_SIZE, - Gbl_Files[ASL_FILE_AML_OUTPUT].Handle); - if (!LineLength) - { - break; - } - - FlPrintFile (ASL_FILE_HEX_OUTPUT, " db "); - - for (i = 0; i < LineLength; i++) - { - /* - * Print each hex byte. - * Add a comma until the last byte of the line - */ - FlPrintFile (ASL_FILE_HEX_OUTPUT, "0%2.2Xh", FileData[i]); - if ((i + 1) < LineLength) - { - FlPrintFile (ASL_FILE_HEX_OUTPUT, ","); - } - } - - FlPrintFile (ASL_FILE_HEX_OUTPUT, " "); - - /* Add fill spaces if needed for last line */ - - if (LineLength < HEX_TABLE_LINE_SIZE) - { - FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s", - 5 * (HEX_TABLE_LINE_SIZE - LineLength), " "); - } - - /* Emit the offset and ascii dump for the entire line */ - - FlPrintFile (ASL_FILE_HEX_OUTPUT, " ; %8.8X", Offset); - LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT, LineLength, FileData); - FlPrintFile (ASL_FILE_HEX_OUTPUT, "\n"); - - Offset += LineLength; - } - - FlPrintFile (ASL_FILE_HEX_OUTPUT, "\n"); - FlCloseFile (ASL_FILE_HEX_OUTPUT); -} - - diff -Nru acpica-unix-20100528/compiler/aslload.c acpica-unix-20140114/compiler/aslload.c --- acpica-unix-20100528/compiler/aslload.c 2010-05-28 17:14:23.000000000 +0000 +++ acpica-unix-20140114/compiler/aslload.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,974 +0,0 @@ -/****************************************************************************** - * - * Module Name: dswload - Dispatcher namespace load callbacks - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - -#define __ASLLOAD_C__ - -#include "aslcompiler.h" -#include "amlcode.h" -#include "acdispat.h" -#include "acnamesp.h" - -#include "aslcompiler.y.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslload") - -/* Local prototypes */ - -static ACPI_STATUS -LdLoadFieldElements ( - ACPI_PARSE_OBJECT *Op, - ACPI_WALK_STATE *WalkState); - -static ACPI_STATUS -LdLoadResourceElements ( - ACPI_PARSE_OBJECT *Op, - ACPI_WALK_STATE *WalkState); - -static ACPI_STATUS -LdNamespace1Begin ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -static ACPI_STATUS -LdNamespace2Begin ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -static ACPI_STATUS -LdCommonNamespaceEnd ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - - -/******************************************************************************* - * - * FUNCTION: LdLoadNamespace - * - * PARAMETERS: RootOp - Root of the parse tree - * - * RETURN: Status - * - * DESCRIPTION: Perform a walk of the parse tree that in turn loads all of the - * named ASL/AML objects into the namespace. The namespace is - * constructed in order to resolve named references and references - * to named fields within resource templates/descriptors. - * - ******************************************************************************/ - -ACPI_STATUS -LdLoadNamespace ( - ACPI_PARSE_OBJECT *RootOp) -{ - ACPI_WALK_STATE *WalkState; - - - DbgPrint (ASL_DEBUG_OUTPUT, "\nCreating namespace\n\n"); - - /* Create a new walk state */ - - WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL); - if (!WalkState) - { - return AE_NO_MEMORY; - } - - /* Walk the entire parse tree, first pass */ - - TrWalkParseTree (RootOp, ASL_WALK_VISIT_TWICE, LdNamespace1Begin, - LdCommonNamespaceEnd, WalkState); - - /* Second pass to handle forward references */ - - TrWalkParseTree (RootOp, ASL_WALK_VISIT_TWICE, LdNamespace2Begin, - LdCommonNamespaceEnd, WalkState); - - /* Dump the namespace if debug is enabled */ - - AcpiNsDumpTables (ACPI_NS_ALL, ACPI_UINT32_MAX); - return AE_OK; -} - - -/******************************************************************************* - * - * FUNCTION: LdLoadFieldElements - * - * PARAMETERS: Op - Parent node (Field) - * WalkState - Current walk state - * - * RETURN: Status - * - * DESCRIPTION: Enter the named elements of the field (children of the parent) - * into the namespace. - * - ******************************************************************************/ - -static ACPI_STATUS -LdLoadFieldElements ( - ACPI_PARSE_OBJECT *Op, - ACPI_WALK_STATE *WalkState) -{ - ACPI_PARSE_OBJECT *Child = NULL; - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - - - /* Get the first named field element */ - - switch (Op->Asl.AmlOpcode) - { - case AML_BANK_FIELD_OP: - - Child = UtGetArg (Op, 6); - break; - - case AML_INDEX_FIELD_OP: - - Child = UtGetArg (Op, 5); - break; - - case AML_FIELD_OP: - - Child = UtGetArg (Op, 4); - break; - - default: - /* No other opcodes should arrive here */ - return (AE_BAD_PARAMETER); - } - - /* Enter all elements into the namespace */ - - while (Child) - { - switch (Child->Asl.AmlOpcode) - { - case AML_INT_RESERVEDFIELD_OP: - case AML_INT_ACCESSFIELD_OP: - - break; - - default: - - Status = AcpiNsLookup (WalkState->ScopeInfo, - Child->Asl.Value.String, - ACPI_TYPE_LOCAL_REGION_FIELD, - ACPI_IMODE_LOAD_PASS1, - ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | - ACPI_NS_ERROR_IF_FOUND, - NULL, &Node); - if (ACPI_FAILURE (Status)) - { - if (Status != AE_ALREADY_EXISTS) - { - AslError (ASL_ERROR, ASL_MSG_CORE_EXCEPTION, Child, - Child->Asl.Value.String); - return (Status); - } - - /* - * The name already exists in this scope - * But continue processing the elements - */ - AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Child, - Child->Asl.Value.String); - } - else - { - Child->Asl.Node = Node; - Node->Op = Child; - } - break; - } - Child = Child->Asl.Next; - } - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: LdLoadResourceElements - * - * PARAMETERS: Op - Parent node (Resource Descriptor) - * WalkState - Current walk state - * - * RETURN: Status - * - * DESCRIPTION: Enter the named elements of the resource descriptor (children - * of the parent) into the namespace. - * - * NOTE: In the real AML namespace, these named elements never exist. But - * we simply use the namespace here as a symbol table so we can look - * them up as they are referenced. - * - ******************************************************************************/ - -static ACPI_STATUS -LdLoadResourceElements ( - ACPI_PARSE_OBJECT *Op, - ACPI_WALK_STATE *WalkState) -{ - ACPI_PARSE_OBJECT *InitializerOp = NULL; - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - - - /* - * Enter the resource name into the namespace. Name must not already exist. - * This opens a scope, so later field names are guaranteed to be new/unique. - */ - Status = AcpiNsLookup (WalkState->ScopeInfo, Op->Asl.Namepath, - ACPI_TYPE_LOCAL_RESOURCE, ACPI_IMODE_LOAD_PASS1, - ACPI_NS_NO_UPSEARCH | ACPI_NS_ERROR_IF_FOUND, - WalkState, &Node); - if (ACPI_FAILURE (Status)) - { - if (Status == AE_ALREADY_EXISTS) - { - /* Actual node causing the error was saved in ParentMethod */ - - AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS, - (ACPI_PARSE_OBJECT *) Op->Asl.ParentMethod, Op->Asl.Namepath); - return (AE_OK); - } - return (Status); - } - - Node->Value = (UINT32) Op->Asl.Value.Integer; - Node->Op = Op; - Op->Asl.Node = Node; - - /* - * Now enter the predefined fields, for easy lookup when referenced - * by the source ASL - */ - InitializerOp = ASL_GET_CHILD_NODE (Op); - while (InitializerOp) - { - - if (InitializerOp->Asl.ExternalName) - { - Status = AcpiNsLookup (WalkState->ScopeInfo, - InitializerOp->Asl.ExternalName, - ACPI_TYPE_LOCAL_RESOURCE_FIELD, - ACPI_IMODE_LOAD_PASS1, - ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE, - NULL, &Node); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* - * Store the field offset in the namespace node so it - * can be used when the field is referenced - */ - Node->Value = (UINT32) InitializerOp->Asl.Value.Integer; - InitializerOp->Asl.Node = Node; - Node->Op = InitializerOp; - - /* Pass thru the field type (Bitfield or Bytefield) */ - - if (InitializerOp->Asl.CompileFlags & NODE_IS_BIT_OFFSET) - { - Node->Flags |= ANOBJ_IS_BIT_OFFSET; - } - } - InitializerOp = ASL_GET_PEER_NODE (InitializerOp); - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: LdNamespace1Begin - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Descending callback used during the parse tree walk. If this - * is a named AML opcode, enter into the namespace - * - ******************************************************************************/ - -static ACPI_STATUS -LdNamespace1Begin ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context; - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - ACPI_OBJECT_TYPE ObjectType; - ACPI_OBJECT_TYPE ActualObjectType = ACPI_TYPE_ANY; - char *Path; - UINT32 Flags = ACPI_NS_NO_UPSEARCH; - ACPI_PARSE_OBJECT *Arg; - UINT32 i; - BOOLEAN ForceNewScope = FALSE; - - - ACPI_FUNCTION_NAME (LdNamespace1Begin); - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op %p [%s]\n", - Op, Op->Asl.ParseOpName)); - - - /* - * We are only interested in opcodes that have an associated name - * (or multiple names) - */ - switch (Op->Asl.AmlOpcode) - { - case AML_BANK_FIELD_OP: - case AML_INDEX_FIELD_OP: - case AML_FIELD_OP: - - Status = LdLoadFieldElements (Op, WalkState); - return (Status); - - default: - - /* All other opcodes go below */ - break; - } - - /* Check if this object has already been installed in the namespace */ - - if (Op->Asl.Node) - { - return (AE_OK); - } - - Path = Op->Asl.Namepath; - if (!Path) - { - return (AE_OK); - } - - /* Map the raw opcode into an internal object type */ - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_NAME: - - Arg = Op->Asl.Child; /* Get the NameSeg/NameString node */ - Arg = Arg->Asl.Next; /* First peer is the object to be associated with the name */ - - /* - * If this name refers to a ResourceTemplate, we will need to open - * a new scope so that the resource subfield names can be entered into - * the namespace underneath this name - */ - if (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DESC) - { - ForceNewScope = TRUE; - } - - /* Get the data type associated with the named object, not the name itself */ - - /* Log2 loop to convert from Btype (binary) to Etype (encoded) */ - - ObjectType = 1; - for (i = 1; i < Arg->Asl.AcpiBtype; i *= 2) - { - ObjectType++; - } - break; - - - case PARSEOP_EXTERNAL: - - /* - * "External" simply enters a name and type into the namespace. - * We must be careful to not open a new scope, however, no matter - * what type the external name refers to (e.g., a method) - * - * first child is name, next child is ObjectType - */ - ActualObjectType = (UINT8) Op->Asl.Child->Asl.Next->Asl.Value.Integer; - ObjectType = ACPI_TYPE_ANY; - - /* - * We will mark every new node along the path as "External". This - * allows some or all of the nodes to be created later in the ASL - * code. Handles cases like this: - * - * External (\_SB_.PCI0.ABCD, IntObj) - * Scope (_SB_) - * { - * Device (PCI0) - * { - * } - * } - * Method (X) - * { - * Store (\_SB_.PCI0.ABCD, Local0) - * } - */ - Flags |= ACPI_NS_EXTERNAL; - break; - - case PARSEOP_DEFAULT_ARG: - - if (Op->Asl.CompileFlags == NODE_IS_RESOURCE_DESC) - { - Status = LdLoadResourceElements (Op, WalkState); - return_ACPI_STATUS (Status); - } - - ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode); - break; - - - case PARSEOP_SCOPE: - - /* - * The name referenced by Scope(Name) must already exist at this point. - * In other words, forward references for Scope() are not supported. - * The only real reason for this is that the MS interpreter cannot - * handle this case. Perhaps someday this case can go away. - */ - Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY, - ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, - WalkState, &(Node)); - if (ACPI_FAILURE (Status)) - { - if (Status == AE_NOT_FOUND) - { - /* The name was not found, go ahead and create it */ - - Status = AcpiNsLookup (WalkState->ScopeInfo, Path, - ACPI_TYPE_LOCAL_SCOPE, - ACPI_IMODE_LOAD_PASS1, Flags, - WalkState, &(Node)); - - /* - * However, this is an error -- primarily because the MS - * interpreter can't handle a forward reference from the - * Scope() operator. - */ - AslError (ASL_ERROR, ASL_MSG_NOT_FOUND, Op, - Op->Asl.ExternalName); - AslError (ASL_ERROR, ASL_MSG_SCOPE_FWD_REF, Op, - Op->Asl.ExternalName); - goto FinishNode; - } - - AslCoreSubsystemError (Op, Status, - "Failure from namespace lookup", FALSE); - - return_ACPI_STATUS (Status); - } - - /* We found a node with this name, now check the type */ - - switch (Node->Type) - { - case ACPI_TYPE_LOCAL_SCOPE: - case ACPI_TYPE_DEVICE: - case ACPI_TYPE_POWER: - case ACPI_TYPE_PROCESSOR: - case ACPI_TYPE_THERMAL: - - /* These are acceptable types - they all open a new scope */ - break; - - case ACPI_TYPE_INTEGER: - case ACPI_TYPE_STRING: - case ACPI_TYPE_BUFFER: - - /* - * These types we will allow, but we will change the type. - * This enables some existing code of the form: - * - * Name (DEB, 0) - * Scope (DEB) { ... } - * - * Which is used to workaround the fact that the MS interpreter - * does not allow Scope() forward references. - */ - sprintf (MsgBuffer, "%s [%s], changing type to [Scope]", - Op->Asl.ExternalName, AcpiUtGetTypeName (Node->Type)); - AslError (ASL_REMARK, ASL_MSG_SCOPE_TYPE, Op, MsgBuffer); - - /* Switch the type to scope, open the new scope */ - - Node->Type = ACPI_TYPE_LOCAL_SCOPE; - Status = AcpiDsScopeStackPush (Node, ACPI_TYPE_LOCAL_SCOPE, - WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - break; - - default: - - /* All other types are an error */ - - sprintf (MsgBuffer, "%s [%s]", Op->Asl.ExternalName, - AcpiUtGetTypeName (Node->Type)); - AslError (ASL_ERROR, ASL_MSG_SCOPE_TYPE, Op, MsgBuffer); - - /* - * However, switch the type to be an actual scope so - * that compilation can continue without generating a whole - * cascade of additional errors. Open the new scope. - */ - Node->Type = ACPI_TYPE_LOCAL_SCOPE; - Status = AcpiDsScopeStackPush (Node, ACPI_TYPE_LOCAL_SCOPE, - WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - break; - } - - Status = AE_OK; - goto FinishNode; - - - default: - - ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode); - break; - } - - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Loading name: %s, (%s)\n", - Op->Asl.ExternalName, AcpiUtGetTypeName (ObjectType))); - - /* The name must not already exist */ - - Flags |= ACPI_NS_ERROR_IF_FOUND; - - /* - * Enter the named type into the internal namespace. We enter the name - * as we go downward in the parse tree. Any necessary subobjects that - * involve arguments to the opcode must be created as we go back up the - * parse tree later. - */ - Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, - ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &Node); - if (ACPI_FAILURE (Status)) - { - if (Status == AE_ALREADY_EXISTS) - { - /* The name already exists in this scope */ - - if (Node->Type == ACPI_TYPE_LOCAL_SCOPE) - { - /* Allow multiple references to the same scope */ - - Node->Type = (UINT8) ObjectType; - Status = AE_OK; - } - else if ((Node->Flags & ANOBJ_IS_EXTERNAL) && - (Op->Asl.ParseOpcode != PARSEOP_EXTERNAL)) - { - /* - * Allow one create on an object or segment that was - * previously declared External - */ - Node->Flags &= ~ANOBJ_IS_EXTERNAL; - Node->Type = (UINT8) ObjectType; - - /* Just retyped a node, probably will need to open a scope */ - - if (AcpiNsOpensScope (ObjectType)) - { - Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - Status = AE_OK; - } - else - { - /* Valid error, object already exists */ - - AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Op, - Op->Asl.ExternalName); - return_ACPI_STATUS (AE_OK); - } - } - else - { - AslCoreSubsystemError (Op, Status, - "Failure from namespace lookup", FALSE); - return_ACPI_STATUS (Status); - } - } - - if (ForceNewScope) - { - Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - -FinishNode: - /* - * Point the parse node to the new namespace node, and point - * the Node back to the original Parse node - */ - Op->Asl.Node = Node; - Node->Op = Op; - - /* Set the actual data type if appropriate (EXTERNAL term only) */ - - if (ActualObjectType != ACPI_TYPE_ANY) - { - Node->Type = (UINT8) ActualObjectType; - Node->Value = ASL_EXTERNAL_METHOD; - } - - if (Op->Asl.ParseOpcode == PARSEOP_METHOD) - { - /* - * Get the method argument count from "Extra" and save - * it in the namespace node - */ - Node->Value = (UINT32) Op->Asl.Extra; - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: LdNamespace2Begin - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Descending callback used during the pass 2 parse tree walk. - * Second pass resolves some forward references. - * - * Notes: - * Currently only needs to handle the Alias operator. - * Could be used to allow forward references from the Scope() operator, but - * the MS interpreter does not allow this, so this compiler does not either. - * - ******************************************************************************/ - -static ACPI_STATUS -LdNamespace2Begin ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context; - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *Node; - ACPI_OBJECT_TYPE ObjectType; - BOOLEAN ForceNewScope = FALSE; - ACPI_PARSE_OBJECT *Arg; - char *Path; - ACPI_NAMESPACE_NODE *TargetNode; - - - ACPI_FUNCTION_NAME (LdNamespace2Begin); - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op %p [%s]\n", - Op, Op->Asl.ParseOpName)); - - - /* Ignore Ops with no namespace node */ - - Node = Op->Asl.Node; - if (!Node) - { - return (AE_OK); - } - - /* Get the type to determine if we should push the scope */ - - if ((Op->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) && - (Op->Asl.CompileFlags == NODE_IS_RESOURCE_DESC)) - { - ObjectType = ACPI_TYPE_LOCAL_RESOURCE; - } - else - { - ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode); - } - - /* Push scope for Resource Templates */ - - if (Op->Asl.ParseOpcode == PARSEOP_NAME) - { - if (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DESC) - { - ForceNewScope = TRUE; - } - } - - /* Push the scope stack */ - - if (ForceNewScope || AcpiNsOpensScope (ObjectType)) - { - Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - - if (Op->Asl.ParseOpcode == PARSEOP_ALIAS) - { - /* Complete the alias node by getting and saving the target node */ - - /* First child is the alias target */ - - Arg = Op->Asl.Child; - - /* Get the target pathname */ - - Path = Arg->Asl.Namepath; - if (!Path) - { - Status = UtInternalizeName (Arg->Asl.ExternalName, &Path); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - - /* Get the NS node associated with the target. It must exist. */ - - Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY, - ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, - WalkState, &TargetNode); - if (ACPI_FAILURE (Status)) - { - if (Status == AE_NOT_FOUND) - { - AslError (ASL_ERROR, ASL_MSG_NOT_FOUND, Op, - Op->Asl.ExternalName); - - /* - * The name was not found, go ahead and create it. - * This prevents more errors later. - */ - Status = AcpiNsLookup (WalkState->ScopeInfo, Path, - ACPI_TYPE_ANY, - ACPI_IMODE_LOAD_PASS1, ACPI_NS_NO_UPSEARCH, - WalkState, &(Node)); - return (AE_OK); - } - - AslCoreSubsystemError (Op, Status, - "Failure from namespace lookup", FALSE); - return (AE_OK); - } - - /* Save the target node within the alias node */ - - Node->Object = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, TargetNode); - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: LdCommonNamespaceEnd - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Ascending callback used during the loading of the namespace, - * We only need to worry about managing the scope stack here. - * - ******************************************************************************/ - -static ACPI_STATUS -LdCommonNamespaceEnd ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context; - ACPI_OBJECT_TYPE ObjectType; - BOOLEAN ForceNewScope = FALSE; - - - ACPI_FUNCTION_NAME (LdCommonNamespaceEnd); - - - /* We are only interested in opcodes that have an associated name */ - - if (!Op->Asl.Namepath) - { - return (AE_OK); - } - - /* Get the type to determine if we should pop the scope */ - - if ((Op->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) && - (Op->Asl.CompileFlags == NODE_IS_RESOURCE_DESC)) - { - /* TBD: Merge into AcpiDsMapNamedOpcodeToDataType */ - - ObjectType = ACPI_TYPE_LOCAL_RESOURCE; - } - else - { - ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode); - } - - /* Pop scope that was pushed for Resource Templates */ - - if (Op->Asl.ParseOpcode == PARSEOP_NAME) - { - if (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DESC) - { - ForceNewScope = TRUE; - } - } - - /* Pop the scope stack */ - - if (ForceNewScope || AcpiNsOpensScope (ObjectType)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "(%s): Popping scope for Op [%s] %p\n", - AcpiUtGetTypeName (ObjectType), Op->Asl.ParseOpName, Op)); - - (void) AcpiDsScopeStackPop (WalkState); - } - - return (AE_OK); -} - - diff -Nru acpica-unix-20100528/compiler/asllookup.c acpica-unix-20140114/compiler/asllookup.c --- acpica-unix-20100528/compiler/asllookup.c 2010-05-28 17:14:23.000000000 +0000 +++ acpica-unix-20140114/compiler/asllookup.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1440 +0,0 @@ -/****************************************************************************** - * - * Module Name: asllookup- Namespace lookup - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - - -#include "aslcompiler.h" -#include "aslcompiler.y.h" - -#include "acparser.h" -#include "amlcode.h" -#include "acnamesp.h" -#include "acdispat.h" - - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("asllookup") - -/* Local prototypes */ - -static ACPI_STATUS -LsCompareOneNamespaceObject ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue); - -static ACPI_STATUS -LsDoOneNamespaceObject ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue); - -static BOOLEAN -LkObjectExists ( - char *Name); - -static void -LkCheckFieldRange ( - ACPI_PARSE_OBJECT *Op, - UINT32 RegionBitLength, - UINT32 FieldBitOffset, - UINT32 FieldBitLength, - UINT32 AccessBitWidth); - -static ACPI_STATUS -LkNamespaceLocateBegin ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -static ACPI_STATUS -LkNamespaceLocateEnd ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -static ACPI_STATUS -LkIsObjectUsed ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue); - -static ACPI_STATUS -LsDoOnePathname ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue); - -void -LsSetupNsList ( - void *Handle); - -ACPI_PARSE_OBJECT * -LkGetNameOp ( - ACPI_PARSE_OBJECT *Op); - - -/******************************************************************************* - * - * FUNCTION: LsDoOneNamespaceObject - * - * PARAMETERS: ACPI_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Dump a namespace object to the namespace output file. - * Called during the walk of the namespace to dump all objects. - * - ******************************************************************************/ - -static ACPI_STATUS -LsDoOneNamespaceObject ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue) -{ - ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_PARSE_OBJECT *Op; - - - Gbl_NumNamespaceObjects++; - - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%5u [%u] %*s %4.4s - %s", - Gbl_NumNamespaceObjects, Level, (Level * 3), " ", - &Node->Name, - AcpiUtGetTypeName (Node->Type)); - - Op = Node->Op; - ObjDesc = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Node->Object); - - if (!Op) - { - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "\n"); - return (AE_OK); - } - - - if ((ObjDesc) && - (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND)) - { - switch (Node->Type) - { - case ACPI_TYPE_INTEGER: - - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, - " [Initial Value 0x%8.8X%8.8X]", - ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); - break; - - - case ACPI_TYPE_STRING: - - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, - " [Initial Value \"%s\"]", - ObjDesc->String.Pointer); - break; - - default: - /* Nothing to do for other types */ - break; - } - - } - else - { - switch (Node->Type) - { - case ACPI_TYPE_INTEGER: - - if (Op->Asl.ParseOpcode == PARSEOP_NAME) - { - Op = Op->Asl.Child; - } - if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || - (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING)) - { - Op = Op->Asl.Next; - } - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, - " [Initial Value 0x%8.8X%8.8X]", - ACPI_FORMAT_UINT64 (Op->Asl.Value.Integer)); - break; - - - case ACPI_TYPE_STRING: - - if (Op->Asl.ParseOpcode == PARSEOP_NAME) - { - Op = Op->Asl.Child; - } - if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || - (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING)) - { - Op = Op->Asl.Next; - } - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, - " [Initial Value \"%s\"]", - Op->Asl.Value.String); - break; - - - case ACPI_TYPE_LOCAL_REGION_FIELD: - - if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || - (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING)) - { - Op = Op->Asl.Child; - } - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, - " [Offset 0x%04X Length 0x%04X bits]", - Op->Asl.Parent->Asl.ExtraValue, (UINT32) Op->Asl.Value.Integer); - break; - - - case ACPI_TYPE_BUFFER_FIELD: - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_CREATEBYTEFIELD: - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [BYTE ( 8 bit)]"); - break; - - case PARSEOP_CREATEDWORDFIELD: - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [DWORD (32 bit)]"); - break; - - case PARSEOP_CREATEQWORDFIELD: - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [QWORD (64 bit)]"); - break; - - case PARSEOP_CREATEWORDFIELD: - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [WORD (16 bit)]"); - break; - - case PARSEOP_CREATEBITFIELD: - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [BIT ( 1 bit)]"); - break; - - case PARSEOP_CREATEFIELD: - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [Arbitrary Bit Field]"); - break; - - default: - break; - - } - break; - - - case ACPI_TYPE_PACKAGE: - - if (Op->Asl.ParseOpcode == PARSEOP_NAME) - { - Op = Op->Asl.Child; - } - if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || - (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING)) - { - Op = Op->Asl.Next; - } - Op = Op->Asl.Child; - - if ((Op->Asl.ParseOpcode == PARSEOP_BYTECONST) || - (Op->Asl.ParseOpcode == PARSEOP_RAW_DATA)) - { - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, - " [Initial Length 0x%.2X elements]", - Op->Asl.Value.Integer); - } - break; - - - case ACPI_TYPE_BUFFER: - - if (Op->Asl.ParseOpcode == PARSEOP_NAME) - { - Op = Op->Asl.Child; - } - if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || - (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING)) - { - Op = Op->Asl.Next; - } - Op = Op->Asl.Child; - - if (Op && (Op->Asl.ParseOpcode == PARSEOP_INTEGER)) - { - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, - " [Initial Length 0x%.2X bytes]", - Op->Asl.Value.Integer); - } - break; - - - case ACPI_TYPE_METHOD: - - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, - " [Code Length 0x%.4X bytes]", - Op->Asl.AmlSubtreeLength); - break; - - - case ACPI_TYPE_LOCAL_RESOURCE: - - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, - " [Desc Offset 0x%.4X Bytes]", Node->Value); - break; - - - case ACPI_TYPE_LOCAL_RESOURCE_FIELD: - - if (Node->Flags & 0x80) - { - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, - " [Field Offset 0x%.4X Bits 0x%.4X Bytes]", - Node->Value, Node->Value / 8); - } - else - { - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, - " [Field Offset 0x%.4X Bytes]", Node->Value); - } - break; - - - default: - /* Nothing to do for other types */ - break; - } - } - - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "\n"); - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: LsSetupNsList - * - * PARAMETERS: Handle - local file handle - * - * RETURN: None - * - * DESCRIPTION: Set the namespace output file to the input handle - * - ******************************************************************************/ - -void -LsSetupNsList ( - void *Handle) -{ - - Gbl_NsOutputFlag = TRUE; - Gbl_Files[ASL_FILE_NAMESPACE_OUTPUT].Handle = Handle; -} - - -/******************************************************************************* - * - * FUNCTION: LsDoOnePathname - * - * PARAMETERS: ACPI_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Print the full pathname for a namespace node. - * - ******************************************************************************/ - -static ACPI_STATUS -LsDoOnePathname ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue) -{ - ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; - ACPI_STATUS Status; - ACPI_BUFFER TargetPath; - - - TargetPath.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiNsHandleToPathname (Node, &TargetPath); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%s\n", TargetPath.Pointer); - ACPI_FREE (TargetPath.Pointer); - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: LsDisplayNamespace - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Walk the namespace an display information about each node - * in the tree. Information is written to the optional - * namespace output file. - * - ******************************************************************************/ - -ACPI_STATUS -LsDisplayNamespace ( - void) -{ - ACPI_STATUS Status; - - - if (!Gbl_NsOutputFlag) - { - return (AE_OK); - } - - Gbl_NumNamespaceObjects = 0; - - /* File header */ - - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "Contents of ACPI Namespace\n\n"); - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "Count Depth Name - Type\n\n"); - - /* Walk entire namespace from the root */ - - Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, FALSE, LsDoOneNamespaceObject, NULL, - NULL, NULL); - - /* Print the full pathname for each namespace node */ - - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "\nNamespace pathnames\n\n"); - - Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, FALSE, LsDoOnePathname, NULL, - NULL, NULL); - - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: LsCompareOneNamespaceObject - * - * PARAMETERS: ACPI_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Compare name of one object. - * - ******************************************************************************/ - -static ACPI_STATUS -LsCompareOneNamespaceObject ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue) -{ - ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; - - - /* Simply check the name */ - - if (*((UINT32 *) (Context)) == Node->Name.Integer) - { - /* Abort walk if we found one instance */ - - return (AE_CTRL_TRUE); - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: LkObjectExists - * - * PARAMETERS: Name - 4 char ACPI name - * - * RETURN: TRUE if name exists in namespace - * - * DESCRIPTION: Walk the namespace to find an object - * - ******************************************************************************/ - -static BOOLEAN -LkObjectExists ( - char *Name) -{ - ACPI_STATUS Status; - - - /* Walk entire namespace from the supplied root */ - - Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, FALSE, LsCompareOneNamespaceObject, NULL, - Name, NULL); - if (Status == AE_CTRL_TRUE) - { - /* At least one instance of the name was found */ - - return (TRUE); - } - - return (FALSE); -} - - -/******************************************************************************* - * - * FUNCTION: LkGetNameOp - * - * PARAMETERS: Op - Current Op - * - * RETURN: NameOp associated with the input op - * - * DESCRIPTION: Find the name declaration op associated with the operator - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -LkGetNameOp ( - ACPI_PARSE_OBJECT *Op) -{ - const ACPI_OPCODE_INFO *OpInfo; - ACPI_PARSE_OBJECT *NameOp = Op; - - - OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode); - - - /* Get the NamePath from the appropriate place */ - - if (OpInfo->Flags & AML_NAMED) - { - /* For nearly all NAMED operators, the name reference is the first child */ - - NameOp = Op->Asl.Child; - if (Op->Asl.AmlOpcode == AML_ALIAS_OP) - { - /* - * ALIAS is the only oddball opcode, the name declaration - * (alias name) is the second operand - */ - NameOp = Op->Asl.Child->Asl.Next; - } - } - else if (OpInfo->Flags & AML_CREATE) - { - /* Name must appear as the last parameter */ - - NameOp = Op->Asl.Child; - while (!(NameOp->Asl.CompileFlags & NODE_IS_NAME_DECLARATION)) - { - NameOp = NameOp->Asl.Next; - } - } - - return (NameOp); -} - - -/******************************************************************************* - * - * FUNCTION: LkIsObjectUsed - * - * PARAMETERS: ACPI_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Check for an unreferenced namespace object and emit a warning. - * We have to be careful, because some types and names are - * typically or always unreferenced, we don't want to issue - * excessive warnings. - * - ******************************************************************************/ - -static ACPI_STATUS -LkIsObjectUsed ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue) -{ - ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle); - - - /* Referenced flag is set during the namespace xref */ - - if (Node->Flags & ANOBJ_IS_REFERENCED) - { - return (AE_OK); - } - - /* - * Ignore names that start with an underscore, - * these are the reserved ACPI names and are typically not referenced, - * they are called by the host OS. - */ - if (Node->Name.Ascii[0] == '_') - { - return (AE_OK); - } - - /* There are some types that are typically not referenced, ignore them */ - - switch (Node->Type) - { - case ACPI_TYPE_DEVICE: - case ACPI_TYPE_PROCESSOR: - case ACPI_TYPE_POWER: - case ACPI_TYPE_LOCAL_RESOURCE: - return (AE_OK); - - default: - break; - } - - /* All others are valid unreferenced namespace objects */ - - if (Node->Op) - { - AslError (ASL_WARNING2, ASL_MSG_NOT_REFERENCED, LkGetNameOp (Node->Op), NULL); - } - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: LkFindUnreferencedObjects - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Namespace walk to find objects that are not referenced in any - * way. Must be called after the namespace has been cross - * referenced. - * - ******************************************************************************/ - -void -LkFindUnreferencedObjects ( - void) -{ - - /* Walk entire namespace from the supplied root */ - - (void) AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, FALSE, LkIsObjectUsed, NULL, - NULL, NULL); -} - - -/******************************************************************************* - * - * FUNCTION: LkCrossReferenceNamespace - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Perform a cross reference check of the parse tree against the - * namespace. Every named referenced within the parse tree - * should be get resolved with a namespace lookup. If not, the - * original reference in the ASL code is invalid -- i.e., refers - * to a non-existent object. - * - * NOTE: The ASL "External" operator causes the name to be inserted into the - * namespace so that references to the external name will be resolved - * correctly here. - * - ******************************************************************************/ - -ACPI_STATUS -LkCrossReferenceNamespace ( - void) -{ - ACPI_WALK_STATE *WalkState; - - - DbgPrint (ASL_DEBUG_OUTPUT, "\nCross referencing namespace\n\n"); - - /* - * Create a new walk state for use when looking up names - * within the namespace (Passed as context to the callbacks) - */ - WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL); - if (!WalkState) - { - return AE_NO_MEMORY; - } - - /* Walk the entire parse tree */ - - TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, LkNamespaceLocateBegin, - LkNamespaceLocateEnd, WalkState); - return AE_OK; -} - - -/******************************************************************************* - * - * FUNCTION: LkCheckFieldRange - * - * PARAMETERS: RegionBitLength - Length of entire parent region - * FieldBitOffset - Start of the field unit (within region) - * FieldBitLength - Entire length of field unit - * AccessBitWidth - Access width of the field unit - * - * RETURN: None - * - * DESCRIPTION: Check one field unit to make sure it fits in the parent - * op region. - * - * Note: AccessBitWidth must be either 8,16,32, or 64 - * - ******************************************************************************/ - -static void -LkCheckFieldRange ( - ACPI_PARSE_OBJECT *Op, - UINT32 RegionBitLength, - UINT32 FieldBitOffset, - UINT32 FieldBitLength, - UINT32 AccessBitWidth) -{ - UINT32 FieldEndBitOffset; - - - /* - * Check each field unit against the region size. The entire - * field unit (start offset plus length) must fit within the - * region. - */ - FieldEndBitOffset = FieldBitOffset + FieldBitLength; - - if (FieldEndBitOffset > RegionBitLength) - { - /* Field definition itself is beyond the end-of-region */ - - AslError (ASL_ERROR, ASL_MSG_FIELD_UNIT_OFFSET, Op, NULL); - return; - } - - /* - * Now check that the field plus AccessWidth doesn't go beyond - * the end-of-region. Assumes AccessBitWidth is a power of 2 - */ - FieldEndBitOffset = ACPI_ROUND_UP (FieldEndBitOffset, AccessBitWidth); - - if (FieldEndBitOffset > RegionBitLength) - { - /* Field definition combined with the access is beyond EOR */ - - AslError (ASL_ERROR, ASL_MSG_FIELD_UNIT_ACCESS_WIDTH, Op, NULL); - } -} - -/******************************************************************************* - * - * FUNCTION: LkNamespaceLocateBegin - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Descending callback used during cross-reference. For named - * object references, attempt to locate the name in the - * namespace. - * - * NOTE: ASL references to named fields within resource descriptors are - * resolved to integer values here. Therefore, this step is an - * important part of the code generation. We don't know that the - * name refers to a resource descriptor until now. - * - ******************************************************************************/ - -static ACPI_STATUS -LkNamespaceLocateBegin ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context; - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - ACPI_OBJECT_TYPE ObjectType; - char *Path; - UINT8 PassedArgs; - ACPI_PARSE_OBJECT *NextOp; - ACPI_PARSE_OBJECT *OwningOp; - ACPI_PARSE_OBJECT *SpaceIdOp; - UINT32 MinimumLength; - UINT32 Temp; - const ACPI_OPCODE_INFO *OpInfo; - UINT32 Flags; - - - ACPI_FUNCTION_TRACE_PTR (LkNamespaceLocateBegin, Op); - - /* - * If this node is the actual declaration of a name - * [such as the XXXX name in "Method (XXXX)"], - * we are not interested in it here. We only care about names that are - * references to other objects within the namespace and the parent objects - * of name declarations - */ - if (Op->Asl.CompileFlags & NODE_IS_NAME_DECLARATION) - { - return (AE_OK); - } - - /* We are only interested in opcodes that have an associated name */ - - OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode); - - if ((!(OpInfo->Flags & AML_NAMED)) && - (!(OpInfo->Flags & AML_CREATE)) && - (Op->Asl.ParseOpcode != PARSEOP_NAMESTRING) && - (Op->Asl.ParseOpcode != PARSEOP_NAMESEG) && - (Op->Asl.ParseOpcode != PARSEOP_METHODCALL)) - { - return (AE_OK); - } - - /* - * One special case: CondRefOf operator - we don't care if the name exists - * or not at this point, just ignore it, the point of the operator is to - * determine if the name exists at runtime. - */ - if ((Op->Asl.Parent) && - (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF)) - { - return (AE_OK); - } - - /* - * We must enable the "search-to-root" for single NameSegs, but - * we have to be very careful about opening up scopes - */ - Flags = ACPI_NS_SEARCH_PARENT; - if ((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) || - (Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || - (Op->Asl.ParseOpcode == PARSEOP_METHODCALL)) - { - /* - * These are name references, do not push the scope stack - * for them. - */ - Flags |= ACPI_NS_DONT_OPEN_SCOPE; - } - - /* Get the NamePath from the appropriate place */ - - if (OpInfo->Flags & AML_NAMED) - { - /* For nearly all NAMED operators, the name reference is the first child */ - - Path = Op->Asl.Child->Asl.Value.String; - if (Op->Asl.AmlOpcode == AML_ALIAS_OP) - { - /* - * ALIAS is the only oddball opcode, the name declaration - * (alias name) is the second operand - */ - Path = Op->Asl.Child->Asl.Next->Asl.Value.String; - } - } - else if (OpInfo->Flags & AML_CREATE) - { - /* Name must appear as the last parameter */ - - NextOp = Op->Asl.Child; - while (!(NextOp->Asl.CompileFlags & NODE_IS_NAME_DECLARATION)) - { - NextOp = NextOp->Asl.Next; - } - Path = NextOp->Asl.Value.String; - } - else - { - Path = Op->Asl.Value.String; - } - - ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode); - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Type=%s\n", AcpiUtGetTypeName (ObjectType))); - - /* - * Lookup the name in the namespace. Name must exist at this point, or it - * is an invalid reference. - * - * The namespace is also used as a lookup table for references to resource - * descriptors and the fields within them. - */ - Gbl_NsLookupCount++; - - Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, - ACPI_IMODE_EXECUTE, Flags, WalkState, &(Node)); - if (ACPI_FAILURE (Status)) - { - if (Status == AE_NOT_FOUND) - { - /* - * We didn't find the name reference by path -- we can qualify this - * a little better before we print an error message - */ - if (strlen (Path) == ACPI_NAME_SIZE) - { - /* A simple, one-segment ACPI name */ - - if (LkObjectExists (Path)) - { - /* - * There exists such a name, but we couldn't get to it - * from this scope - */ - AslError (ASL_ERROR, ASL_MSG_NOT_REACHABLE, Op, - Op->Asl.ExternalName); - } - else - { - /* The name doesn't exist, period */ - - AslError (ASL_ERROR, ASL_MSG_NOT_EXIST, - Op, Op->Asl.ExternalName); - } - } - else - { - /* Check for a fully qualified path */ - - if (Path[0] == AML_ROOT_PREFIX) - { - /* Gave full path, the object does not exist */ - - AslError (ASL_ERROR, ASL_MSG_NOT_EXIST, Op, - Op->Asl.ExternalName); - } - else - { - /* - * We can't tell whether it doesn't exist or just - * can't be reached. - */ - AslError (ASL_ERROR, ASL_MSG_NOT_FOUND, Op, - Op->Asl.ExternalName); - } - } - - Status = AE_OK; - } - return (Status); - } - - /* Check for a reference vs. name declaration */ - - if (!(OpInfo->Flags & AML_NAMED) && - !(OpInfo->Flags & AML_CREATE)) - { - /* This node has been referenced, mark it for reference check */ - - Node->Flags |= ANOBJ_IS_REFERENCED; - } - - /* Attempt to optimize the NamePath */ - - OptOptimizeNamePath (Op, OpInfo->Flags, WalkState, Path, Node); - - /* - * 1) Dereference an alias (A name reference that is an alias) - * Aliases are not nested, the alias always points to the final object - */ - if ((Op->Asl.ParseOpcode != PARSEOP_ALIAS) && - (Node->Type == ACPI_TYPE_LOCAL_ALIAS)) - { - /* This node points back to the original PARSEOP_ALIAS */ - - NextOp = Node->Op; - - /* The first child is the alias target op */ - - NextOp = NextOp->Asl.Child; - - /* That in turn points back to original target alias node */ - - if (NextOp->Asl.Node) - { - Node = NextOp->Asl.Node; - } - - /* Else - forward reference to alias, will be resolved later */ - } - - /* 2) Check for a reference to a resource descriptor */ - - if ((Node->Type == ACPI_TYPE_LOCAL_RESOURCE_FIELD) || - (Node->Type == ACPI_TYPE_LOCAL_RESOURCE)) - { - /* - * This was a reference to a field within a resource descriptor. Extract - * the associated field offset (either a bit or byte offset depending on - * the field type) and change the named reference into an integer for - * AML code generation - */ - Temp = Node->Value; - if (Node->Flags & ANOBJ_IS_BIT_OFFSET) - { - Op->Asl.CompileFlags |= NODE_IS_BIT_OFFSET; - } - - /* Perform BitOffset <--> ByteOffset conversion if necessary */ - - switch (Op->Asl.Parent->Asl.AmlOpcode) - { - case AML_CREATE_FIELD_OP: - - /* We allow a Byte offset to Bit Offset conversion for this op */ - - if (!(Op->Asl.CompileFlags & NODE_IS_BIT_OFFSET)) - { - /* Simply multiply byte offset times 8 to get bit offset */ - - Temp = ACPI_MUL_8 (Temp); - } - break; - - - case AML_CREATE_BIT_FIELD_OP: - - /* This op requires a Bit Offset */ - - if (!(Op->Asl.CompileFlags & NODE_IS_BIT_OFFSET)) - { - AslError (ASL_ERROR, ASL_MSG_BYTES_TO_BITS, Op, NULL); - } - break; - - - case AML_CREATE_BYTE_FIELD_OP: - case AML_CREATE_WORD_FIELD_OP: - case AML_CREATE_DWORD_FIELD_OP: - case AML_CREATE_QWORD_FIELD_OP: - case AML_INDEX_OP: - - /* These Ops require Byte offsets */ - - if (Op->Asl.CompileFlags & NODE_IS_BIT_OFFSET) - { - AslError (ASL_ERROR, ASL_MSG_BITS_TO_BYTES, Op, NULL); - } - break; - - - default: - /* Nothing to do for other opcodes */ - break; - } - - /* Now convert this node to an integer whose value is the field offset */ - - Op->Asl.AmlLength = 0; - Op->Asl.ParseOpcode = PARSEOP_INTEGER; - Op->Asl.Value.Integer = (UINT64) Temp; - Op->Asl.CompileFlags |= NODE_IS_RESOURCE_FIELD; - - OpcGenerateAmlOpcode (Op); - } - - /* 3) Check for a method invocation */ - - else if ((((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) || (Op->Asl.ParseOpcode == PARSEOP_NAMESEG)) && - (Node->Type == ACPI_TYPE_METHOD) && - (Op->Asl.Parent) && - (Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_METHOD)) || - - (Op->Asl.ParseOpcode == PARSEOP_METHODCALL)) - { - - /* - * A reference to a method within one of these opcodes is not an - * invocation of the method, it is simply a reference to the method. - */ - if ((Op->Asl.Parent) && - ((Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_REFOF) || - (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_DEREFOF) || - (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_OBJECTTYPE))) - { - return (AE_OK); - } - /* - * There are two types of method invocation: - * 1) Invocation with arguments -- the parser recognizes this - * as a METHODCALL. - * 2) Invocation with no arguments --the parser cannot determine that - * this is a method invocation, therefore we have to figure it out - * here. - */ - if (Node->Type != ACPI_TYPE_METHOD) - { - sprintf (MsgBuffer, "%s is a %s", - Op->Asl.ExternalName, AcpiUtGetTypeName (Node->Type)); - - AslError (ASL_ERROR, ASL_MSG_NOT_METHOD, Op, MsgBuffer); - return (AE_OK); - } - - /* Save the method node in the caller's op */ - - Op->Asl.Node = Node; - if (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF) - { - return (AE_OK); - } - - /* - * This is a method invocation, with or without arguments. - * Count the number of arguments, each appears as a child - * under the parent node - */ - Op->Asl.ParseOpcode = PARSEOP_METHODCALL; - UtSetParseOpName (Op); - - PassedArgs = 0; - NextOp = Op->Asl.Child; - - while (NextOp) - { - PassedArgs++; - NextOp = NextOp->Asl.Next; - } - - if (Node->Value != ASL_EXTERNAL_METHOD) - { - /* - * Check the parsed arguments with the number expected by the - * method declaration itself - */ - if (PassedArgs != Node->Value) - { - sprintf (MsgBuffer, "%s requires %u", Op->Asl.ExternalName, - Node->Value); - - if (PassedArgs < Node->Value) - { - AslError (ASL_ERROR, ASL_MSG_ARG_COUNT_LO, Op, MsgBuffer); - } - else - { - AslError (ASL_ERROR, ASL_MSG_ARG_COUNT_HI, Op, MsgBuffer); - } - } - } - } - - /* 4) Check for an ASL Field definition */ - - else if ((Op->Asl.Parent) && - ((Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_FIELD) || - (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_BANKFIELD))) - { - /* - * Offset checking for fields. If the parent operation region has a - * constant length (known at compile time), we can check fields - * defined in that region against the region length. This will catch - * fields and field units that cannot possibly fit within the region. - * - * Note: Index fields do not directly reference an operation region, - * thus they are not included in this check. - */ - if (Op == Op->Asl.Parent->Asl.Child) - { - /* - * This is the first child of the field node, which is - * the name of the region. Get the parse node for the - * region -- which contains the length of the region. - */ - OwningOp = Node->Op; - Op->Asl.Parent->Asl.ExtraValue = - ACPI_MUL_8 ((UINT32) OwningOp->Asl.Value.Integer); - - /* Examine the field access width */ - - switch ((UINT8) Op->Asl.Parent->Asl.Value.Integer) - { - case AML_FIELD_ACCESS_ANY: - case AML_FIELD_ACCESS_BYTE: - case AML_FIELD_ACCESS_BUFFER: - default: - MinimumLength = 1; - break; - - case AML_FIELD_ACCESS_WORD: - MinimumLength = 2; - break; - - case AML_FIELD_ACCESS_DWORD: - MinimumLength = 4; - break; - - case AML_FIELD_ACCESS_QWORD: - MinimumLength = 8; - break; - } - - /* - * Is the region at least as big as the access width? - * Note: DataTableRegions have 0 length - */ - if (((UINT32) OwningOp->Asl.Value.Integer) && - ((UINT32) OwningOp->Asl.Value.Integer < MinimumLength)) - { - AslError (ASL_ERROR, ASL_MSG_FIELD_ACCESS_WIDTH, Op, NULL); - } - - /* - * Check EC/CMOS/SMBUS fields to make sure that the correct - * access type is used (BYTE for EC/CMOS, BUFFER for SMBUS) - */ - SpaceIdOp = OwningOp->Asl.Child->Asl.Next; - switch ((UINT32) SpaceIdOp->Asl.Value.Integer) - { - case REGION_EC: - case REGION_CMOS: - - if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != AML_FIELD_ACCESS_BYTE) - { - AslError (ASL_ERROR, ASL_MSG_REGION_BYTE_ACCESS, Op, NULL); - } - break; - - case REGION_SMBUS: - case REGION_IPMI: - - if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != AML_FIELD_ACCESS_BUFFER) - { - AslError (ASL_ERROR, ASL_MSG_REGION_BUFFER_ACCESS, Op, NULL); - } - break; - - default: - - /* Nothing to do for other address spaces */ - break; - } - } - else - { - /* - * This is one element of the field list. Check to make sure - * that it does not go beyond the end of the parent operation region. - * - * In the code below: - * Op->Asl.Parent->Asl.ExtraValue - Region Length (bits) - * Op->Asl.ExtraValue - Field start offset (bits) - * Op->Asl.Child->Asl.Value.Integer32 - Field length (bits) - * Op->Asl.Child->Asl.ExtraValue - Field access width (bits) - */ - if (Op->Asl.Parent->Asl.ExtraValue && Op->Asl.Child) - { - LkCheckFieldRange (Op, - Op->Asl.Parent->Asl.ExtraValue, - Op->Asl.ExtraValue, - (UINT32) Op->Asl.Child->Asl.Value.Integer, - Op->Asl.Child->Asl.ExtraValue); - } - } - } - - Op->Asl.Node = Node; - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: LkNamespaceLocateEnd - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Ascending callback used during cross reference. We only - * need to worry about scope management here. - * - ******************************************************************************/ - -static ACPI_STATUS -LkNamespaceLocateEnd ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context; - const ACPI_OPCODE_INFO *OpInfo; - - - ACPI_FUNCTION_TRACE (LkNamespaceLocateEnd); - - - /* We are only interested in opcodes that have an associated name */ - - OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode); - if (!(OpInfo->Flags & AML_NAMED)) - { - return (AE_OK); - } - - /* Not interested in name references, we did not open a scope for them */ - - if ((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) || - (Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || - (Op->Asl.ParseOpcode == PARSEOP_METHODCALL)) - { - return (AE_OK); - } - - /* Pop the scope stack if necessary */ - - if (AcpiNsOpensScope (AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode))) - { - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "%s: Popping scope for Op %p\n", - AcpiUtGetTypeName (OpInfo->ObjectType), Op)); - - (void) AcpiDsScopeStackPop (WalkState); - } - - return (AE_OK); -} - - diff -Nru acpica-unix-20100528/compiler/aslmain.c acpica-unix-20140114/compiler/aslmain.c --- acpica-unix-20100528/compiler/aslmain.c 2010-05-28 17:14:24.000000000 +0000 +++ acpica-unix-20140114/compiler/aslmain.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,978 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslmain - compiler main and utilities - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - - -#define _DECLARE_GLOBALS - -#include "aslcompiler.h" -#include "acapps.h" - -#ifdef _DEBUG -#include -#endif - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslmain") - -/* Local prototypes */ - -static void -Options ( - void); - -static void -HelpMessage ( - void); - -static void -Usage ( - void); - -static void -AslInitialize ( - void); - -static int -AslCommandLine ( - int argc, - char **argv); - -static int -AslDoOptions ( - int argc, - char **argv, - BOOLEAN IsResponseFile); - -static void -AslMergeOptionTokens ( - char *InBuffer, - char *OutBuffer); - -static int -AslDoResponseFile ( - char *Filename); - - -#define ASL_TOKEN_SEPARATORS " \t\n" -#define ASL_SUPPORTED_OPTIONS "@:2b:c:d^e:fgh^i^I:l^no:p:r:s:t:v:w:x:yz" - - -/******************************************************************************* - * - * FUNCTION: Options - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Display option help message - * - ******************************************************************************/ - -static void -Options ( - void) -{ - - printf ("Global:\n"); - printf (" -@ Specify command file\n"); - printf (" -I Specify additional include directory\n"); - - printf ("\nGeneral Output:\n"); - printf (" -p Specify path/filename prefix for all output files\n"); - printf (" -va Disable all errors and warnings (summary only)\n"); - printf (" -vi Less verbose errors and warnings for use with IDEs\n"); - printf (" -vo Enable optimization comments\n"); - printf (" -vr Disable remarks\n"); - printf (" -vs Disable signon\n"); - printf (" -w<1|2|3> Set warning reporting level\n"); - - printf ("\nAML Output Files:\n"); - printf (" -s Create AML in assembler or C source file (*.asm or *.c)\n"); - printf (" -i Create assembler or C include file (*.inc or *.h)\n"); - printf (" -t Create AML in assembler, C, or ASL hex table (*.hex)\n"); - - printf ("\nAML Code Generation:\n"); - printf (" -oa Disable all optimizations (compatibility mode)\n"); - printf (" -of Disable constant folding\n"); - printf (" -oi Disable integer optimization to Zero/One/Ones\n"); - printf (" -on Disable named reference string optimization\n"); - printf (" -cr Disable Resource Descriptor error checking\n"); - printf (" -r Override table header Revision (1-255)\n"); - - printf ("\nListings:\n"); - printf (" -l Create mixed listing file (ASL source and AML) (*.lst)\n"); - printf (" -ln Create namespace file (*.nsp)\n"); - printf (" -ls Create combined source file (expanded includes) (*.src)\n"); - - printf ("\nAML Disassembler:\n"); - printf (" -d [file] Disassemble or decode binary ACPI table to file (*.dsl)\n"); - printf (" -dc [file] Disassemble AML and immediately compile it\n"); - printf (" (Obtain DSDT from current system if no input file)\n"); - printf (" -e [f1,f2] Include ACPI table(s) for external symbol resolution\n"); - printf (" -2 Emit ACPI 2.0 compatible ASL code\n"); - printf (" -g Get ACPI tables and write to files (*.dat)\n"); - - printf ("\nHelp:\n"); - printf (" -h Additional help and compiler debug options\n"); - printf (" -hc Display operators allowed in constant expressions\n"); - printf (" -hr Display ACPI reserved method names\n"); -} - - -/******************************************************************************* - * - * FUNCTION: HelpMessage - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Display help message - * - ******************************************************************************/ - -static void -HelpMessage ( - void) -{ - - printf ("AML output filename generation:\n"); - printf (" Output filenames are generated by appending an extension to a common\n"); - printf (" filename prefix. The filename prefix is obtained via one of the\n"); - printf (" following methods (in priority order):\n"); - printf (" 1) The -p option specifies the prefix\n"); - printf (" 2) The prefix of the AMLFileName in the ASL Definition Block\n"); - printf (" 3) The prefix of the input filename\n"); - printf ("\n"); - - Options (); - - printf ("\nCompiler/Disassembler Debug Options:\n"); - printf (" -b Create compiler debug/trace file (*.txt)\n"); - printf (" Types: Parse/Tree/Both\n"); - printf (" -f Ignore errors, force creation of AML output file(s)\n"); - printf (" -n Parse only, no output generation\n"); - printf (" -ot Display compile times\n"); - printf (" -x Set debug level for trace output\n"); - printf (" -y Temporary: Enable data table compiler\n"); - printf (" -z Do not insert new compiler ID for DataTables\n"); -} - - -/******************************************************************************* - * - * FUNCTION: Usage - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Display usage and option message - * - ******************************************************************************/ - -static void -Usage ( - void) -{ - - printf ("Usage: %s [Options] [Files]\n\n", CompilerName); - Options (); -} - - -/******************************************************************************* - * - * FUNCTION: AslInitialize - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Initialize compiler globals - * - ******************************************************************************/ - -static void -AslInitialize ( - void) -{ - UINT32 i; - - -#ifdef _DEBUG - _CrtSetDbgFlag (_CRTDBG_CHECK_ALWAYS_DF | _CrtSetDbgFlag(0)); -#endif - - AcpiDbgLevel = 0; - - for (i = 0; i < ASL_NUM_FILES; i++) - { - Gbl_Files[i].Handle = NULL; - Gbl_Files[i].Filename = NULL; - } - - Gbl_Files[ASL_FILE_STDOUT].Handle = stdout; - Gbl_Files[ASL_FILE_STDOUT].Filename = "STDOUT"; - - Gbl_Files[ASL_FILE_STDERR].Handle = stderr; - Gbl_Files[ASL_FILE_STDERR].Filename = "STDERR"; -} - - -/******************************************************************************* - * - * FUNCTION: AslMergeOptionTokens - * - * PARAMETERS: InBuffer - Input containing an option string - * OutBuffer - Merged output buffer - * - * RETURN: None - * - * DESCRIPTION: Remove all whitespace from an option string. - * - ******************************************************************************/ - -static void -AslMergeOptionTokens ( - char *InBuffer, - char *OutBuffer) -{ - char *Token; - - - *OutBuffer = 0; - - Token = strtok (InBuffer, ASL_TOKEN_SEPARATORS); - while (Token) - { - strcat (OutBuffer, Token); - Token = strtok (NULL, ASL_TOKEN_SEPARATORS); - } -} - - -/******************************************************************************* - * - * FUNCTION: AslDoResponseFile - * - * PARAMETERS: Filename - Name of the response file - * - * RETURN: Status - * - * DESCRIPTION: Open a response file and process all options within. - * - ******************************************************************************/ - -static int -AslDoResponseFile ( - char *Filename) -{ - char *argv = StringBuffer2; - FILE *ResponseFile; - int OptStatus = 0; - int Opterr; - int Optind; - - - ResponseFile = fopen (Filename, "r"); - if (!ResponseFile) - { - printf ("Could not open command file %s, %s\n", - Filename, strerror (errno)); - return -1; - } - - /* Must save the current GetOpt globals */ - - Opterr = AcpiGbl_Opterr; - Optind = AcpiGbl_Optind; - - /* - * Process all lines in the response file. There must be one complete - * option per line - */ - while (fgets (StringBuffer, ASL_MSG_BUFFER_SIZE, ResponseFile)) - { - /* Compress all tokens, allowing us to use a single argv entry */ - - AslMergeOptionTokens (StringBuffer, StringBuffer2); - - /* Process the option */ - - AcpiGbl_Opterr = 0; - AcpiGbl_Optind = 0; - - OptStatus = AslDoOptions (1, &argv, TRUE); - if (OptStatus) - { - printf ("Invalid option in command file %s: %s\n", - Filename, StringBuffer); - break; - } - } - - /* Restore the GetOpt globals */ - - AcpiGbl_Opterr = Opterr; - AcpiGbl_Optind = Optind; - - fclose (ResponseFile); - return (OptStatus); -} - - -/******************************************************************************* - * - * FUNCTION: AslDoOptions - * - * PARAMETERS: argc/argv - Standard argc/argv - * IsResponseFile - TRUE if executing a response file. - * - * RETURN: Status - * - * DESCRIPTION: Command line option processing - * - ******************************************************************************/ - -static int -AslDoOptions ( - int argc, - char **argv, - BOOLEAN IsResponseFile) -{ - int j; - - - /* Get the command line options */ - - while ((j = AcpiGetopt (argc, argv, ASL_SUPPORTED_OPTIONS)) != EOF) switch (j) - { - case '@': /* Begin a response file */ - - if (IsResponseFile) - { - printf ("Nested command files are not supported\n"); - return -1; - } - - if (AslDoResponseFile (AcpiGbl_Optarg)) - { - return -1; - } - break; - - - case '2': - - Gbl_Acpi2 = TRUE; - break; - - - case 'b': - - switch (AcpiGbl_Optarg[0]) - { - case 'b': - AslCompilerdebug = 1; /* same as yydebug */ - break; - - case 'p': - AslCompilerdebug = 1; /* same as yydebug */ - break; - - case 't': - break; - - default: - printf ("Unknown option: -b%s\n", AcpiGbl_Optarg); - return (-1); - } - - /* Produce debug output file */ - - Gbl_DebugFlag = TRUE; - break; - - - case 'c': - switch (AcpiGbl_Optarg[0]) - { - case 'r': - Gbl_NoResourceChecking = TRUE; - break; - - default: - printf ("Unknown option: -c%s\n", AcpiGbl_Optarg); - return (-1); - } - break; - - - case 'd': - switch (AcpiGbl_Optarg[0]) - { - case '^': - Gbl_DoCompile = FALSE; - break; - - case 'c': - break; - - default: - printf ("Unknown option: -d%s\n", AcpiGbl_Optarg); - return (-1); - } - - Gbl_DisasmFlag = TRUE; - break; - - - case 'e': - Gbl_ExternalFilename = AcpiGbl_Optarg; - break; - - - case 'f': - - /* Ignore errors and force creation of aml file */ - - Gbl_IgnoreErrors = TRUE; - break; - - - case 'g': - - /* Get all ACPI tables */ - - Gbl_GetAllTables = TRUE; - Gbl_DoCompile = FALSE; - break; - - - case 'h': - - switch (AcpiGbl_Optarg[0]) - { - case '^': - HelpMessage (); - exit (0); - - case 'c': - UtDisplayConstantOpcodes (); - exit (0); - - case 'r': - /* reserved names */ - - ApDisplayReservedNames (); - exit (0); - - default: - printf ("Unknown option: -h%s\n", AcpiGbl_Optarg); - return (-1); - } - break; - - - case 'I': /* Add an include file search directory */ - - FlAddIncludeDirectory (AcpiGbl_Optarg); - break; - - - case 'i': - - switch (AcpiGbl_Optarg[0]) - { - case 'a': - - /* Produce assembly code include file */ - - Gbl_AsmIncludeOutputFlag = TRUE; - break; - - case 'c': - - /* Produce C include file */ - - Gbl_C_IncludeOutputFlag = TRUE; - break; - - default: - printf ("Unknown option: -s%s\n", AcpiGbl_Optarg); - return (-1); - } - break; - - - case 'l': - - switch (AcpiGbl_Optarg[0]) - { - case '^': - /* Produce listing file (Mixed source/aml) */ - - Gbl_ListingFlag = TRUE; - break; - - case 'n': - /* Produce namespace file */ - - Gbl_NsOutputFlag = TRUE; - break; - - case 's': - /* Produce combined source file */ - - Gbl_SourceOutputFlag = TRUE; - break; - - default: - printf ("Unknown option: -l%s\n", AcpiGbl_Optarg); - return (-1); - } - break; - - - case 'o': - - switch (AcpiGbl_Optarg[0]) - { - case 'a': - - /* Disable all optimizations */ - - Gbl_FoldConstants = FALSE; - Gbl_IntegerOptimizationFlag = FALSE; - Gbl_ReferenceOptimizationFlag = FALSE; - break; - - case 'f': - - /* Disable folding on "normal" expressions */ - - Gbl_FoldConstants = FALSE; - break; - - case 'i': - - /* Disable integer optimization to constants */ - - Gbl_IntegerOptimizationFlag = FALSE; - break; - - case 'n': - - /* Disable named reference optimization */ - - Gbl_ReferenceOptimizationFlag = FALSE; - break; - - case 't': - - /* Display compile time(s) */ - - Gbl_CompileTimesFlag = TRUE; - break; - - default: - printf ("Unknown option: -c%s\n", AcpiGbl_Optarg); - return (-1); - } - break; - - - case 'n': - - /* Parse only */ - - Gbl_ParseOnlyFlag = TRUE; - break; - - - case 'p': - - /* Override default AML output filename */ - - Gbl_OutputFilenamePrefix = AcpiGbl_Optarg; - Gbl_UseDefaultAmlFilename = FALSE; - break; - - - case 'r': - Gbl_RevisionOverride = (UINT8) strtoul (AcpiGbl_Optarg, NULL, 0); - break; - - - case 's': - - switch (AcpiGbl_Optarg[0]) - { - case 'a': - - /* Produce assembly code output file */ - - Gbl_AsmOutputFlag = TRUE; - break; - - case 'c': - - /* Produce C hex output file */ - - Gbl_C_OutputFlag = TRUE; - break; - - default: - printf ("Unknown option: -s%s\n", AcpiGbl_Optarg); - return (-1); - } - break; - - - case 't': - - /* Produce hex table output file */ - - switch (AcpiGbl_Optarg[0]) - { - case 'a': - Gbl_HexOutputFlag = HEX_OUTPUT_ASM; - break; - - case 'c': - Gbl_HexOutputFlag = HEX_OUTPUT_C; - break; - - case 's': - Gbl_HexOutputFlag = HEX_OUTPUT_ASL; - break; - - default: - printf ("Unknown option: -t%s\n", AcpiGbl_Optarg); - return (-1); - } - break; - - - case 'v': - - switch (AcpiGbl_Optarg[0]) - { - case 'a': - /* Disable All error/warning messages */ - - Gbl_NoErrors = TRUE; - break; - - case 'i': - /* Less verbose error messages */ - - Gbl_VerboseErrors = FALSE; - break; - - case 'o': - Gbl_DisplayOptimizations = TRUE; - break; - - case 'r': - Gbl_DisplayRemarks = FALSE; - break; - - case 's': - Gbl_DoSignon = FALSE; - break; - - default: - printf ("Unknown option: -v%s\n", AcpiGbl_Optarg); - return (-1); - } - break; - - - case 'w': /* Set warning levels */ - - switch (AcpiGbl_Optarg[0]) - { - case '1': - Gbl_WarningLevel = ASL_WARNING; - break; - - case '2': - Gbl_WarningLevel = ASL_WARNING2; - break; - - case '3': - Gbl_WarningLevel = ASL_WARNING3; - break; - - default: - printf ("Unknown option: -w%s\n", AcpiGbl_Optarg); - return (-1); - } - break; - - - case 'x': - - AcpiDbgLevel = strtoul (AcpiGbl_Optarg, NULL, 16); - break; - - - case 'y': - - Gbl_DataTableCompilerAvailable = TRUE; - break; - - - case 'z': - - Gbl_UseOriginalCompilerId = TRUE; - break; - - - default: - - return (-1); - } - - return (0); -} - - -/******************************************************************************* - * - * FUNCTION: AslCommandLine - * - * PARAMETERS: argc/argv - * - * RETURN: Last argv index - * - * DESCRIPTION: Command line processing - * - ******************************************************************************/ - -static int -AslCommandLine ( - int argc, - char **argv) -{ - int BadCommandLine = 0; - - - /* Minimum command line contains at least the command and an input file */ - - if (argc < 2) - { - AslCompilerSignon (ASL_FILE_STDOUT); - Usage (); - exit (1); - } - - /* Process all command line options */ - - BadCommandLine = AslDoOptions (argc, argv, FALSE); - - /* Next parameter must be the input filename */ - - if (!argv[AcpiGbl_Optind] && - !Gbl_DisasmFlag && - !Gbl_GetAllTables) - { - printf ("Missing input filename\n"); - BadCommandLine = TRUE; - } - - if (Gbl_DoSignon) - { - AslCompilerSignon (ASL_FILE_STDOUT); - } - - /* Abort if anything went wrong on the command line */ - - if (BadCommandLine) - { - printf ("\n"); - Usage (); - exit (1); - } - - return (AcpiGbl_Optind); -} - - -/******************************************************************************* - * - * FUNCTION: main - * - * PARAMETERS: Standard argc/argv - * - * RETURN: Program termination code - * - * DESCRIPTION: C main routine for the Asl Compiler. Handle command line - * options and begin the compile for each file on the command line - * - ******************************************************************************/ - -int ACPI_SYSTEM_XFACE -main ( - int argc, - char **argv) -{ - ACPI_STATUS Status; - int Index; - - -#ifdef _DEBUG - _CrtSetDbgFlag (_CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_LEAK_CHECK_DF | - _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG)); -#endif - - /* Init and command line */ - - AslInitialize (); - Index = AslCommandLine (argc, argv); - - /* Options that have no additional parameters or pathnames */ - - if (Gbl_GetAllTables) - { - Status = AslDoOneFile (NULL); - if (ACPI_FAILURE (Status)) - { - return (-1); - } - return (0); - } - - /* Process each pathname/filename in the list, with possible wildcards */ - - while (argv[Index]) - { - Status = AslDoOnePathname (argv[Index]); - if (ACPI_FAILURE (Status)) - { - return (-1); - } - - Index++; - } - - return (0); -} - - diff -Nru acpica-unix-20100528/compiler/aslmap.c acpica-unix-20140114/compiler/aslmap.c --- acpica-unix-20100528/compiler/aslmap.c 2010-05-28 17:14:24.000000000 +0000 +++ acpica-unix-20140114/compiler/aslmap.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,467 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslmap - parser to AML opcode mapping table - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - -#include "aslcompiler.h" -#include "amlcode.h" -#include "acparser.h" - - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslmap") - - -/******************************************************************************* - * - * FUNCTION: AslMapNamedOpcodeToDataType - * - * PARAMETERS: Opcode - The Named AML opcode to map - * - * RETURN: The ACPI type associated with the named opcode - * - * DESCRIPTION: Convert a raw Named AML opcode to the associated data type. - * Named opcodes are a subset of the AML opcodes. - * - ******************************************************************************/ - -ACPI_OBJECT_TYPE -AslMapNamedOpcodeToDataType ( - UINT16 Opcode) -{ - const ACPI_OPCODE_INFO *OpInfo; - - - /* - * There are some differences from the opcode table types, we - * catch them here. - */ - OpInfo = AcpiPsGetOpcodeInfo (Opcode); - - if (Opcode == AML_INT_NAMEPATH_OP) - { - return (ACPI_TYPE_ANY); - } - - if (Opcode == AML_INT_METHODCALL_OP) - { - return (ACPI_TYPE_ANY); - } - - if (OpInfo->Flags & AML_NSOBJECT) - { - return (OpInfo->ObjectType); - } - - return (ACPI_TYPE_ANY); -} - - -/******************************************************************************* - * - * DATA STRUCTURE: AslKeywordMapping - * - * DESCRIPTION: Maps the ParseOpcode to the actual AML opcode. The parse - * opcodes are generated from Bison, and this table must - * track any additions to them. - * - * Each entry in the table contains the following items: - * - * AML opcode - Opcode that is written to the AML file - * Value - Value of the object to be written (if applicable) - * Flags - 1) Whether this opcode opens an AML "package". - * - ******************************************************************************/ -/* - * TBD: - * AccessAttrib - * AccessType - * AMlop for DMA? - * ObjectType keywords - * Register - */ - -const ASL_MAPPING_ENTRY AslKeywordMapping [] = -{ -/*! [Begin] no source code translation (keep the table structure) */ - - -/* ACCESSAS */ OP_TABLE_ENTRY (AML_INT_ACCESSFIELD_OP, 0, 0, 0), -/* ACCESSATTRIB_BLOCK */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_SMB_BLOCK, 0, 0), -/* ACCESSATTRIB_BLOCK_CALL */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_SMB_BLOCK_CALL,0, 0), -/* ACCESSATTRIB_BYTE */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_SMB_BYTE, 0, 0), -/* ACCESSATTRIB_WORD_CALL */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_SMB_WORD_CALL, 0, 0), -/* ACCESSATTRIB_QUICK */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_SMB_QUICK, 0, 0), -/* ACCESSATTRIB_SND_RCV */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_SMB_SEND_RCV, 0, 0), -/* ACCESSATTRIB_WORD */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_SMB_WORD, 0, 0), -/* ACCESSTYPE_ANY */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ACCESS_ANY, 0, 0), -/* ACCESSTYPE_BUF */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ACCESS_BUFFER, 0, 0), -/* ACCESSTYPE_BYTE */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ACCESS_BYTE, 0, 0), -/* ACCESSTYPE_DWORD */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ACCESS_DWORD, 0, 0), -/* ACCESSTYPE_QWORD */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ACCESS_QWORD, 0, 0), -/* 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), -/* 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), -/* ADDRESSTYPE_RESERVED */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* ALIAS */ OP_TABLE_ENTRY (AML_ALIAS_OP, 0, 0, 0), -/* AND */ OP_TABLE_ENTRY (AML_BIT_AND_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* ARG0 */ OP_TABLE_ENTRY (AML_ARG0, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* ARG1 */ OP_TABLE_ENTRY (AML_ARG1, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* ARG2 */ OP_TABLE_ENTRY (AML_ARG2, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* ARG3 */ OP_TABLE_ENTRY (AML_ARG3, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* ARG4 */ OP_TABLE_ENTRY (AML_ARG4, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* ARG5 */ OP_TABLE_ENTRY (AML_ARG5, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* ARG6 */ OP_TABLE_ENTRY (AML_ARG6, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* BANKFIELD */ OP_TABLE_ENTRY (AML_BANK_FIELD_OP, 0, NODE_AML_PACKAGE, 0), -/* BREAK */ OP_TABLE_ENTRY (AML_BREAK_OP, 0, 0, 0), -/* BREAKPOINT */ OP_TABLE_ENTRY (AML_BREAK_POINT_OP, 0, 0, 0), -/* BUFFER */ OP_TABLE_ENTRY (AML_BUFFER_OP, 0, NODE_AML_PACKAGE, ACPI_BTYPE_BUFFER), -/* BUSMASTERTYPE_MASTER */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* BUSMASTERTYPE_NOTMASTER */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* BYTECONST */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, 0, 0, ACPI_BTYPE_INTEGER), -/* CASE */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* CONCATENATE */ OP_TABLE_ENTRY (AML_CONCAT_OP, 0, 0, ACPI_BTYPE_COMPUTE_DATA), -/* CONCATENATERESTEMPLATE */ OP_TABLE_ENTRY (AML_CONCAT_RES_OP, 0, 0, ACPI_BTYPE_BUFFER), -/* CONDREFOF */ OP_TABLE_ENTRY (AML_COND_REF_OF_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* CONTINUE */ OP_TABLE_ENTRY (AML_CONTINUE_OP, 0, 0, 0), -/* COPY */ OP_TABLE_ENTRY (AML_COPY_OP, 0, 0, ACPI_BTYPE_DATA_REFERENCE), -/* CREATEBITFIELD */ OP_TABLE_ENTRY (AML_CREATE_BIT_FIELD_OP, 0, 0, 0), -/* CREATEBYTEFIELD */ OP_TABLE_ENTRY (AML_CREATE_BYTE_FIELD_OP, 0, 0, 0), -/* CREATEDWORDFIELD */ OP_TABLE_ENTRY (AML_CREATE_DWORD_FIELD_OP, 0, 0, 0), -/* CREATEFIELD */ OP_TABLE_ENTRY (AML_CREATE_FIELD_OP, 0, 0, 0), -/* CREATEQWORDFIELD */ OP_TABLE_ENTRY (AML_CREATE_QWORD_FIELD_OP, 0, 0, 0), -/* CREATEWORDFIELD */ OP_TABLE_ENTRY (AML_CREATE_WORD_FIELD_OP, 0, 0, 0), -/* DATATABLEREGION */ OP_TABLE_ENTRY (AML_DATA_REGION_OP, 0, 0, 0), -/* DEBUG */ OP_TABLE_ENTRY (AML_DEBUG_OP, 0, 0, ACPI_BTYPE_DEBUG_OBJECT), -/* DECODETYPE_POS */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* DECODETYPE_SUB */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* DECREMENT */ OP_TABLE_ENTRY (AML_DECREMENT_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* DEFAULT */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* DEFAULT_ARG */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* DEFINITIONBLOCK */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* DEREFOF */ OP_TABLE_ENTRY (AML_DEREF_OF_OP, 0, 0, ACPI_BTYPE_DATA_REFERENCE | ACPI_BTYPE_STRING), -/* DEVICE */ OP_TABLE_ENTRY (AML_DEVICE_OP, 0, NODE_AML_PACKAGE, 0), -/* DIVIDE */ OP_TABLE_ENTRY (AML_DIVIDE_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* DMA */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* DMATYPE_A */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* DMATYPE_COMPATIBILITY */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* DMATYPE_B */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0), -/* DMATYPE_F */ OP_TABLE_ENTRY (AML_BYTE_OP, 3, 0, 0), -/* DWORDCONST */ OP_TABLE_ENTRY (AML_RAW_DATA_DWORD, 0, 0, ACPI_BTYPE_INTEGER), -/* DWORDIO */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* DWORDMEMORY */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* DWORDSPACE */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* EISAID */ OP_TABLE_ENTRY (AML_DWORD_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* ELSE */ OP_TABLE_ENTRY (AML_ELSE_OP, 0, NODE_AML_PACKAGE, 0), -/* ELSEIF */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, NODE_AML_PACKAGE, 0), -/* ENDDEPENDENTFN */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* ENDTAG */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* ERRORNODE */ OP_TABLE_ENTRY (AML_NOOP_OP, 0, 0, 0), -/* EVENT */ OP_TABLE_ENTRY (AML_EVENT_OP, 0, 0, 0), -/* EXTENDEDIO */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* EXTENDEDMEMORY */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* EXTENDEDSPACE */ OP_TABLE_ENTRY (AML_RAW_DATA_QWORD, 0, 0, ACPI_BTYPE_INTEGER), -/* EXTERNAL */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* FATAL */ OP_TABLE_ENTRY (AML_FATAL_OP, 0, 0, 0), -/* FIELD */ OP_TABLE_ENTRY (AML_FIELD_OP, 0, NODE_AML_PACKAGE, 0), -/* FINDSETLEFTBIT */ OP_TABLE_ENTRY (AML_FIND_SET_LEFT_BIT_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* FINDSETRIGHTBIT */ OP_TABLE_ENTRY (AML_FIND_SET_RIGHT_BIT_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* FIXEDIO */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* FROMBCD */ OP_TABLE_ENTRY (AML_FROM_BCD_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* FUNCTION */ OP_TABLE_ENTRY (AML_METHOD_OP, 0, NODE_AML_PACKAGE, 0), -/* IF */ OP_TABLE_ENTRY (AML_IF_OP, 0, NODE_AML_PACKAGE, 0), -/* INCLUDE */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* INCLUDE_CSTYLE */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* INCLUDE_END */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* INCREMENT */ OP_TABLE_ENTRY (AML_INCREMENT_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* INDEX */ OP_TABLE_ENTRY (AML_INDEX_OP, 0, 0, ACPI_BTYPE_REFERENCE), -/* INDEXFIELD */ OP_TABLE_ENTRY (AML_INDEX_FIELD_OP, 0, NODE_AML_PACKAGE, 0), -/* INTEGER */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* INTERRUPT */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* INTLEVEL_ACTIVEHIGH */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* INTLEVEL_ACTIVELOW */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* INTTYPE_EDGE */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* INTTYPE_LEVEL */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* IO */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* IODECODETYPE_10 */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* IODECODETYPE_16 */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* IRQ */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* IRQNOFLAGS */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* LAND */ OP_TABLE_ENTRY (AML_LAND_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* LEQUAL */ OP_TABLE_ENTRY (AML_LEQUAL_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* LGREATER */ OP_TABLE_ENTRY (AML_LGREATER_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* LGREATEREQUAL */ OP_TABLE_ENTRY (AML_LGREATEREQUAL_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* LINE */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* LLESS */ OP_TABLE_ENTRY (AML_LLESS_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* LLESSEQUAL */ OP_TABLE_ENTRY (AML_LLESSEQUAL_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* LNOT */ OP_TABLE_ENTRY (AML_LNOT_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* LNOTEQUAL */ OP_TABLE_ENTRY (AML_LNOTEQUAL_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* LOAD */ OP_TABLE_ENTRY (AML_LOAD_OP, 0, 0, 0), -/* LOADTABLE */ OP_TABLE_ENTRY (AML_LOAD_TABLE_OP, 0, 0, ACPI_BTYPE_DDB_HANDLE), -/* LOCAL0 */ OP_TABLE_ENTRY (AML_LOCAL0, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* LOCAL1 */ OP_TABLE_ENTRY (AML_LOCAL1, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* LOCAL2 */ OP_TABLE_ENTRY (AML_LOCAL2, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* LOCAL3 */ OP_TABLE_ENTRY (AML_LOCAL3, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* LOCAL4 */ OP_TABLE_ENTRY (AML_LOCAL4, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* LOCAL5 */ OP_TABLE_ENTRY (AML_LOCAL5, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* LOCAL6 */ OP_TABLE_ENTRY (AML_LOCAL6, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* LOCAL7 */ OP_TABLE_ENTRY (AML_LOCAL7, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* LOCKRULE_LOCK */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_LOCK_ALWAYS, 0, 0), -/* LOCKRULE_NOLOCK */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_LOCK_NEVER, 0, 0), -/* LOR */ OP_TABLE_ENTRY (AML_LOR_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* MATCH */ OP_TABLE_ENTRY (AML_MATCH_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* MATCHTYPE_MEQ */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, MATCH_MEQ, 0, ACPI_BTYPE_INTEGER), -/* MATCHTYPE_MGE */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, MATCH_MGE, 0, ACPI_BTYPE_INTEGER), -/* MATCHTYPE_MGT */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, MATCH_MGT, 0, ACPI_BTYPE_INTEGER), -/* MATCHTYPE_MLE */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, MATCH_MLE, 0, ACPI_BTYPE_INTEGER), -/* MATCHTYPE_MLT */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, MATCH_MLT, 0, ACPI_BTYPE_INTEGER), -/* MATCHTYPE_MTR */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, MATCH_MTR, 0, ACPI_BTYPE_INTEGER), -/* MAXTYPE_FIXED */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* MAXTYPE_NOTFIXED */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* MEMORY24 */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* MEMORY32 */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* MEMORY32FIXED */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* MEMTYPE_CACHEABLE */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* MEMTYPE_NONCACHEABLE */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* MEMTYPE_PREFETCHABLE */ OP_TABLE_ENTRY (AML_BYTE_OP, 3, 0, 0), -/* MEMTYPE_WRITECOMBINING */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0), -/* METHOD */ OP_TABLE_ENTRY (AML_METHOD_OP, 0, NODE_AML_PACKAGE, 0), -/* METHODCALL */ OP_TABLE_ENTRY (AML_INT_METHODCALL_OP, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* MID */ OP_TABLE_ENTRY (AML_MID_OP, 0, 0, ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER), -/* MINTYPE_FIXED */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* MINTYPE_NOTFIXED */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* MOD */ OP_TABLE_ENTRY (AML_MOD_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* MULTIPLY */ OP_TABLE_ENTRY (AML_MULTIPLY_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* MUTEX */ OP_TABLE_ENTRY (AML_MUTEX_OP, 0, 0, 0), -/* NAME */ OP_TABLE_ENTRY (AML_NAME_OP, 0, 0, 0), -/* NAMESEG */ OP_TABLE_ENTRY (AML_INT_NAMEPATH_OP, 0, 0, 0), -/* NAMESTRING */ OP_TABLE_ENTRY (AML_INT_NAMEPATH_OP, 0, 0, 0), -/* NAND */ OP_TABLE_ENTRY (AML_BIT_NAND_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* NOOP */ OP_TABLE_ENTRY (AML_NOOP_OP, 0, 0, 0), -/* NOR */ OP_TABLE_ENTRY (AML_BIT_NOR_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* NOT */ OP_TABLE_ENTRY (AML_BIT_NOT_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* NOTIFY */ OP_TABLE_ENTRY (AML_NOTIFY_OP, 0, 0, 0), -/* OBJECTTYPE */ OP_TABLE_ENTRY (AML_TYPE_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* OBJECTTYPE_BFF */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_BUFFER_FIELD, 0, 0), -/* OBJECTTYPE_BUF */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_BUFFER, 0, 0), -/* OBJECTTYPE_DDB */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_DDB_HANDLE, 0, 0), -/* OBJECTTYPE_DEV */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_DEVICE, 0, 0), -/* OBJECTTYPE_EVT */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_EVENT, 0, 0), -/* OBJECTTYPE_FLD */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_FIELD_UNIT, 0, 0), -/* OBJECTTYPE_INT */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_INTEGER, 0, 0), -/* OBJECTTYPE_MTH */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_METHOD, 0, 0), -/* OBJECTTYPE_MTX */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_MUTEX, 0, 0), -/* OBJECTTYPE_OPR */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_REGION, 0, 0), -/* OBJECTTYPE_PKG */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_PACKAGE, 0, 0), -/* OBJECTTYPE_POW */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_POWER, 0, 0), -/* OBJECTTYPE_PRO */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_PROCESSOR, 0, 0), -/* OBJECTTYPE_STR */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_STRING, 0, 0), -/* OBJECTTYPE_THZ */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_THERMAL, 0, 0), -/* OBJECTTYPE_UNK */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_ANY, 0, 0), -/* OFFSET */ OP_TABLE_ENTRY (AML_INT_RESERVEDFIELD_OP, 0, 0, 0), -/* ONE */ OP_TABLE_ENTRY (AML_ONE_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* ONES */ OP_TABLE_ENTRY (AML_ONES_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* OPERATIONREGION */ OP_TABLE_ENTRY (AML_REGION_OP, 0, 0, 0), -/* OR */ OP_TABLE_ENTRY (AML_BIT_OR_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* PACKAGE */ OP_TABLE_ENTRY (AML_PACKAGE_OP, 0, NODE_AML_PACKAGE, ACPI_BTYPE_PACKAGE), -/* PACKAGEP_LENGTH */ OP_TABLE_ENTRY (AML_PACKAGE_LENGTH, 0, NODE_AML_PACKAGE, 0), -/* POWERRESOURCE */ OP_TABLE_ENTRY (AML_POWER_RES_OP, 0, NODE_AML_PACKAGE, 0), -/* PROCESSOR */ OP_TABLE_ENTRY (AML_PROCESSOR_OP, 0, NODE_AML_PACKAGE, 0), -/* QWORDCONST */ OP_TABLE_ENTRY (AML_RAW_DATA_QWORD, 0, 0, ACPI_BTYPE_INTEGER), -/* QWORDIO */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* QWORDMEMORY */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* QWORDSPACE */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* RANGE_TYPE_ENTIRE */ OP_TABLE_ENTRY (AML_BYTE_OP, 3, 0, 0), -/* RANGE_TYPE_ISAONLY */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0), -/* RANGE_TYPE_NONISAONLY */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* RAW_DATA */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* 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), -/* 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), -/* RESET */ OP_TABLE_ENTRY (AML_RESET_OP, 0, 0, 0), -/* RESOURCETEMPLATE */ OP_TABLE_ENTRY (AML_BUFFER_OP, 0, 0, ACPI_BTYPE_BUFFER), -/* RESOURCETYPE_CONSUMER */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* RESOURCETYPE_PRODUCER */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* RETURN */ OP_TABLE_ENTRY (AML_RETURN_OP, 0, 0, 0), -/* REVISION */ OP_TABLE_ENTRY (AML_REVISION_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* SCOPE */ OP_TABLE_ENTRY (AML_SCOPE_OP, 0, NODE_AML_PACKAGE, 0), -/* SERIALIZERULE_NOTSERIAL */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* SERIALIZERULE_SERIAL */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* SHARETYPE_EXCLUSIVE */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* SHARETYPE_SHARED */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* SHIFTLEFT */ OP_TABLE_ENTRY (AML_SHIFT_LEFT_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* SHIFTRIGHT */ OP_TABLE_ENTRY (AML_SHIFT_RIGHT_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* SIGNAL */ OP_TABLE_ENTRY (AML_SIGNAL_OP, 0, 0, 0), -/* SIZEOF */ OP_TABLE_ENTRY (AML_SIZE_OF_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* SLEEP */ OP_TABLE_ENTRY (AML_SLEEP_OP, 0, 0, 0), -/* STALL */ OP_TABLE_ENTRY (AML_STALL_OP, 0, 0, 0), -/* STARTDEPENDENTFN */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* STARTDEPENDENTFN_NOPRI */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* STORE */ OP_TABLE_ENTRY (AML_STORE_OP, 0, 0, ACPI_BTYPE_DATA_REFERENCE), -/* STRING_LITERAL */ OP_TABLE_ENTRY (AML_STRING_OP, 0, 0, ACPI_BTYPE_STRING), -/* SUBTRACT */ OP_TABLE_ENTRY (AML_SUBTRACT_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* SWITCH */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* THERMALZONE */ OP_TABLE_ENTRY (AML_THERMAL_ZONE_OP, 0, NODE_AML_PACKAGE, 0), -/* TIMER */ OP_TABLE_ENTRY (AML_TIMER_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* TOBCD */ OP_TABLE_ENTRY (AML_TO_BCD_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* TOBUFFER */ OP_TABLE_ENTRY (AML_TO_BUFFER_OP, 0, 0, ACPI_BTYPE_BUFFER), -/* TODECIMALSTRING */ OP_TABLE_ENTRY (AML_TO_DECSTRING_OP, 0, 0, ACPI_BTYPE_STRING), -/* TOHEXSTRING */ OP_TABLE_ENTRY (AML_TO_HEXSTRING_OP, 0, 0, ACPI_BTYPE_STRING), -/* TOINTEGER */ OP_TABLE_ENTRY (AML_TO_INTEGER_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* TOSTRING */ OP_TABLE_ENTRY (AML_TO_STRING_OP, 0, 0, ACPI_BTYPE_STRING), -/* TOUUID */ OP_TABLE_ENTRY (AML_DWORD_OP, 0, NODE_AML_PACKAGE, ACPI_BTYPE_INTEGER), -/* TRANSLATIONTYPE_DENSE */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* TRANSLATIONTYPE_SPARSE */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* TYPE_STATIC */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* TYPE_TRANSLATION */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* UNICODE */ OP_TABLE_ENTRY (AML_BUFFER_OP, 0, NODE_AML_PACKAGE, 0), -/* UNLOAD */ OP_TABLE_ENTRY (AML_UNLOAD_OP, 0, 0, 0), -/* UPDATERULE_ONES */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_UPDATE_WRITE_AS_ONES, 0, 0), -/* UPDATERULE_PRESERVE */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_UPDATE_PRESERVE, 0, 0), -/* UPDATERULE_ZEROS */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_UPDATE_WRITE_AS_ZEROS,0, 0), -/* VAR_PACKAGE */ OP_TABLE_ENTRY (AML_VAR_PACKAGE_OP, 0, NODE_AML_PACKAGE, ACPI_BTYPE_PACKAGE), -/* VENDORLONG */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* VENDORSHORT */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* WAIT */ OP_TABLE_ENTRY (AML_WAIT_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* WHILE */ OP_TABLE_ENTRY (AML_WHILE_OP, 0, NODE_AML_PACKAGE, 0), -/* WORDBUSNUMBER */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* WORDCONST */ OP_TABLE_ENTRY (AML_RAW_DATA_WORD, 0, 0, ACPI_BTYPE_INTEGER), -/* WORDIO */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* WORDSPACE */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* XFERTYPE_8 */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* XFERTYPE_8_16 */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* XFERTYPE_16 */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0), -/* XOR */ OP_TABLE_ENTRY (AML_BIT_XOR_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* ZERO */ OP_TABLE_ENTRY (AML_ZERO_OP, 0, 0, ACPI_BTYPE_INTEGER), - -/*! [End] no source code translation !*/ - -}; - - diff -Nru acpica-unix-20100528/compiler/aslopcodes.c acpica-unix-20140114/compiler/aslopcodes.c --- acpica-unix-20100528/compiler/aslopcodes.c 2010-05-28 17:14:24.000000000 +0000 +++ acpica-unix-20140114/compiler/aslopcodes.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,811 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslopcode - AML opcode generation - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - - -#include "aslcompiler.h" -#include "aslcompiler.y.h" -#include "amlcode.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslopcodes") - - -/* UUID support */ - -static UINT8 OpcMapToUUID[16] = -{ - 6,4,2,0,11,9,16,14,19,21,24,26,28,30,32,34 -}; - -/* Local prototypes */ - -static void -OpcDoAccessAs ( - ACPI_PARSE_OBJECT *Op); - -static void -OpcDoUnicode ( - ACPI_PARSE_OBJECT *Op); - -static void -OpcDoEisaId ( - ACPI_PARSE_OBJECT *Op); - -static void -OpcDoUuId ( - ACPI_PARSE_OBJECT *Op); - - -/******************************************************************************* - * - * FUNCTION: OpcAmlOpcodeUpdateWalk - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Opcode update walk, ascending callback - * - ******************************************************************************/ - -ACPI_STATUS -OpcAmlOpcodeUpdateWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - - /* - * Handle the Package() case where the actual opcode cannot be determined - * until the PackageLength operand has been folded and minimized. - * (PackageOp versus VarPackageOp) - * - * This is (as of ACPI 3.0) the only case where the AML opcode can change - * based upon the value of a parameter. - * - * The parser always inserts a VarPackage opcode, which can possibly be - * optimized to a Package opcode. - */ - if (Op->Asl.ParseOpcode == PARSEOP_VAR_PACKAGE) - { - OpnDoPackage (Op); - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: OpcAmlOpcodeWalk - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Parse tree walk to generate both the AML opcodes and the AML - * operands. - * - ******************************************************************************/ - -ACPI_STATUS -OpcAmlOpcodeWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - - TotalParseNodes++; - - OpcGenerateAmlOpcode (Op); - OpnGenerateAmlOperands (Op); - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: OpcGetIntegerWidth - * - * PARAMETERS: Op - DEFINITION BLOCK op - * - * RETURN: none - * - * DESCRIPTION: Extract integer width from the table revision - * - ******************************************************************************/ - -void -OpcGetIntegerWidth ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Child; - - - if (!Op) - { - return; - } - - if (Gbl_RevisionOverride) - { - AcpiUtSetIntegerWidth (Gbl_RevisionOverride); - } - else - { - Child = Op->Asl.Child; - Child = Child->Asl.Next; - Child = Child->Asl.Next; - - /* Use the revision to set the integer width */ - - AcpiUtSetIntegerWidth ((UINT8) Child->Asl.Value.Integer); - } -} - - -/******************************************************************************* - * - * FUNCTION: OpcSetOptimalIntegerSize - * - * PARAMETERS: Op - A parse tree node - * - * RETURN: Integer width, in bytes. Also sets the node AML opcode to the - * optimal integer AML prefix opcode. - * - * DESCRIPTION: Determine the optimal AML encoding of an integer. All leading - * zeros can be truncated to squeeze the integer into the - * minimal number of AML bytes. - * - ******************************************************************************/ - -UINT32 -OpcSetOptimalIntegerSize ( - ACPI_PARSE_OBJECT *Op) -{ - -#if 0 - /* - * TBD: - we don't want to optimize integers in the block header, but the - * code below does not work correctly. - */ - if (Op->Asl.Parent && - Op->Asl.Parent->Asl.Parent && - (Op->Asl.Parent->Asl.Parent->Asl.ParseOpcode == PARSEOP_DEFINITIONBLOCK)) - { - return 0; - } -#endif - - /* - * Check for the special AML integers first - Zero, One, Ones. - * These are single-byte opcodes that are the smallest possible - * representation of an integer. - * - * This optimization is optional. - */ - if (Gbl_IntegerOptimizationFlag) - { - switch (Op->Asl.Value.Integer) - { - case 0: - - Op->Asl.AmlOpcode = AML_ZERO_OP; - AslError (ASL_OPTIMIZATION, ASL_MSG_INTEGER_OPTIMIZATION, - Op, "Zero"); - return 1; - - case 1: - - Op->Asl.AmlOpcode = AML_ONE_OP; - AslError (ASL_OPTIMIZATION, ASL_MSG_INTEGER_OPTIMIZATION, - Op, "One"); - return 1; - - case ACPI_UINT32_MAX: - - /* Check for table integer width (32 or 64) */ - - if (AcpiGbl_IntegerByteWidth == 4) - { - Op->Asl.AmlOpcode = AML_ONES_OP; - AslError (ASL_OPTIMIZATION, ASL_MSG_INTEGER_OPTIMIZATION, - Op, "Ones"); - return 1; - } - break; - - case ACPI_UINT64_MAX: - - /* Check for table integer width (32 or 64) */ - - if (AcpiGbl_IntegerByteWidth == 8) - { - Op->Asl.AmlOpcode = AML_ONES_OP; - AslError (ASL_OPTIMIZATION, ASL_MSG_INTEGER_OPTIMIZATION, - Op, "Ones"); - return 1; - } - break; - - default: - break; - } - } - - /* Find the best fit using the various AML integer prefixes */ - - if (Op->Asl.Value.Integer <= ACPI_UINT8_MAX) - { - Op->Asl.AmlOpcode = AML_BYTE_OP; - return 1; - } - if (Op->Asl.Value.Integer <= ACPI_UINT16_MAX) - { - Op->Asl.AmlOpcode = AML_WORD_OP; - return 2; - } - if (Op->Asl.Value.Integer <= ACPI_UINT32_MAX) - { - Op->Asl.AmlOpcode = AML_DWORD_OP; - return 4; - } - else - { - if (AcpiGbl_IntegerByteWidth == 4) - { - AslError (ASL_WARNING, ASL_MSG_INTEGER_LENGTH, - Op, NULL); - - if (!Gbl_IgnoreErrors) - { - /* Truncate the integer to 32-bit */ - Op->Asl.AmlOpcode = AML_DWORD_OP; - return 4; - } - } - - Op->Asl.AmlOpcode = AML_QWORD_OP; - return 8; - } -} - - -/******************************************************************************* - * - * FUNCTION: OpcDoAccessAs - * - * PARAMETERS: Op - Parse node - * - * RETURN: None - * - * DESCRIPTION: Implement the ACCESS_AS ASL keyword. - * - ******************************************************************************/ - -static void -OpcDoAccessAs ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Next; - - - Op->Asl.AmlOpcodeLength = 1; - Next = Op->Asl.Child; - - /* First child is the access type */ - - Next->Asl.AmlOpcode = AML_RAW_DATA_BYTE; - Next->Asl.ParseOpcode = PARSEOP_RAW_DATA; - - /* Second child is the optional access attribute */ - - Next = Next->Asl.Next; - if (Next->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) - { - Next->Asl.Value.Integer = 0; - } - Next->Asl.AmlOpcode = AML_RAW_DATA_BYTE; - Next->Asl.ParseOpcode = PARSEOP_RAW_DATA; -} - - -/******************************************************************************* - * - * FUNCTION: OpcDoUnicode - * - * PARAMETERS: Op - Parse node - * - * RETURN: None - * - * DESCRIPTION: Implement the UNICODE ASL "macro". Convert the input string - * to a unicode buffer. There is no Unicode AML opcode. - * - * Note: The Unicode string is 16 bits per character, no leading signature, - * with a 16-bit terminating NULL. - * - ******************************************************************************/ - -static void -OpcDoUnicode ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *InitializerOp; - UINT32 Length; - UINT32 Count; - UINT32 i; - UINT8 *AsciiString; - UINT16 *UnicodeString; - ACPI_PARSE_OBJECT *BufferLengthOp; - - - /* Change op into a buffer object */ - - Op->Asl.CompileFlags &= ~NODE_COMPILE_TIME_CONST; - Op->Asl.ParseOpcode = PARSEOP_BUFFER; - UtSetParseOpName (Op); - - /* Buffer Length is first, followed by the string */ - - BufferLengthOp = Op->Asl.Child; - InitializerOp = BufferLengthOp->Asl.Next; - - AsciiString = (UINT8 *) InitializerOp->Asl.Value.String; - - /* Create a new buffer for the Unicode string */ - - Count = strlen (InitializerOp->Asl.Value.String) + 1; - Length = Count * sizeof (UINT16); - UnicodeString = UtLocalCalloc (Length); - - /* Convert to Unicode string (including null terminator) */ - - for (i = 0; i < Count; i++) - { - UnicodeString[i] = (UINT16) AsciiString[i]; - } - - /* - * Just set the buffer size node to be the buffer length, regardless - * of whether it was previously an integer or a default_arg placeholder - */ - BufferLengthOp->Asl.ParseOpcode = PARSEOP_INTEGER; - BufferLengthOp->Asl.AmlOpcode = AML_DWORD_OP; - BufferLengthOp->Asl.Value.Integer = Length; - UtSetParseOpName (BufferLengthOp); - - (void) OpcSetOptimalIntegerSize (BufferLengthOp); - - /* The Unicode string is a raw data buffer */ - - InitializerOp->Asl.Value.Buffer = (UINT8 *) UnicodeString; - InitializerOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER; - InitializerOp->Asl.AmlLength = Length; - InitializerOp->Asl.ParseOpcode = PARSEOP_RAW_DATA; - InitializerOp->Asl.Child = NULL; - UtSetParseOpName (InitializerOp); -} - - -/******************************************************************************* - * - * FUNCTION: OpcDoEisaId - * - * PARAMETERS: Op - Parse node - * - * RETURN: None - * - * DESCRIPTION: Convert a string EISA ID to numeric representation. See the - * Pnp BIOS Specification for details. Here is an excerpt: - * - * A seven character ASCII representation of the product - * identifier compressed into a 32-bit identifier. The seven - * character ID consists of a three character manufacturer code, - * a three character hexadecimal product identifier, and a one - * character hexadecimal revision number. The manufacturer code - * is a 3 uppercase character code that is compressed into 3 5-bit - * values as follows: - * 1) Find hex ASCII value for each letter - * 2) Subtract 40h from each ASCII value - * 3) Retain 5 least signficant bits for each letter by - * discarding upper 3 bits because they are always 0. - * 4) Compressed code = concatenate 0 and the 3 5-bit values - * - * The format of the compressed product identifier is as follows: - * Byte 0: Bit 7 - Reserved (0) - * Bits 6-2: - 1st character of compressed mfg code - * Bits 1-0 - Upper 2 bits of 2nd character of mfg code - * Byte 1: Bits 7-5 - Lower 3 bits of 2nd character of mfg code - * Bits 4-0 - 3rd character of mfg code - * Byte 2: Bits 7-4 - 1st hex digit of product number - * Bits 3-0 - 2nd hex digit of product number - * Byte 3: Bits 7-4 - 3st hex digit of product number - * Bits 3-0 - Hex digit of the revision number - * - ******************************************************************************/ - -static void -OpcDoEisaId ( - ACPI_PARSE_OBJECT *Op) -{ - UINT32 EisaId = 0; - UINT32 BigEndianId; - char *InString; - ACPI_STATUS Status = AE_OK; - UINT32 i; - - - InString = (char *) Op->Asl.Value.String; - - /* - * The EISAID string must be exactly 7 characters and of the form - * "UUUXXXX" -- 3 uppercase letters and 4 hex digits (e.g., "PNP0001") - */ - if (ACPI_STRLEN (InString) != 7) - { - Status = AE_BAD_PARAMETER; - } - else - { - /* Check all 7 characters for correct format */ - - for (i = 0; i < 7; i++) - { - /* First 3 characters must be uppercase letters */ - - if (i < 3) - { - if (!isupper ((int) InString[i])) - { - Status = AE_BAD_PARAMETER; - } - } - - /* Last 4 characters must be hex digits */ - - else if (!isxdigit ((int) InString[i])) - { - Status = AE_BAD_PARAMETER; - } - } - } - - if (ACPI_FAILURE (Status)) - { - AslError (ASL_ERROR, ASL_MSG_INVALID_EISAID, Op, Op->Asl.Value.String); - } - else - { - /* Create ID big-endian first (bits are contiguous) */ - - BigEndianId = - (UINT32) (InString[0] - 0x40) << 26 | - (UINT32) (InString[1] - 0x40) << 21 | - (UINT32) (InString[2] - 0x40) << 16 | - - (UtHexCharToValue (InString[3])) << 12 | - (UtHexCharToValue (InString[4])) << 8 | - (UtHexCharToValue (InString[5])) << 4 | - UtHexCharToValue (InString[6]); - - /* Swap to little-endian to get final ID (see function header) */ - - EisaId = AcpiUtDwordByteSwap (BigEndianId); - } - - /* - * Morph the Op into an integer, regardless of whether there - * was an error in the EISAID string - */ - Op->Asl.Value.Integer = EisaId; - - Op->Asl.CompileFlags &= ~NODE_COMPILE_TIME_CONST; - Op->Asl.ParseOpcode = PARSEOP_INTEGER; - (void) OpcSetOptimalIntegerSize (Op); - - /* Op is now an integer */ - - UtSetParseOpName (Op); -} - - -/******************************************************************************* - * - * FUNCTION: OpcDoUiId - * - * PARAMETERS: Op - Parse node - * - * RETURN: None - * - * DESCRIPTION: Convert UUID string to 16-byte buffer - * - ******************************************************************************/ - -static void -OpcDoUuId ( - ACPI_PARSE_OBJECT *Op) -{ - char *InString; - char *Buffer; - ACPI_STATUS Status = AE_OK; - UINT32 i; - ACPI_PARSE_OBJECT *NewOp; - - - InString = (char *) Op->Asl.Value.String; - - if (ACPI_STRLEN (InString) != 36) - { - Status = AE_BAD_PARAMETER; - } - else - { - /* Check all 36 characters for correct format */ - - for (i = 0; i < 36; i++) - { - if ((i == 8) || (i == 13) || (i == 18) || (i == 23)) - { - if (InString[i] != '-') - { - Status = AE_BAD_PARAMETER; - } - } - else - { - if (!isxdigit ((int) InString[i])) - { - Status = AE_BAD_PARAMETER; - } - } - } - } - - Buffer = UtLocalCalloc (16); - - if (ACPI_FAILURE (Status)) - { - AslError (ASL_ERROR, ASL_MSG_INVALID_UUID, Op, Op->Asl.Value.String); - } - else for (i = 0; i < 16; i++) - { - Buffer[i] = (char) (UtHexCharToValue (InString[OpcMapToUUID[i]]) << 4); - Buffer[i] |= (char) UtHexCharToValue (InString[OpcMapToUUID[i] + 1]); - } - - /* Change Op to a Buffer */ - - Op->Asl.ParseOpcode = PARSEOP_BUFFER; - Op->Common.AmlOpcode = AML_BUFFER_OP; - - /* Disable further optimization */ - - Op->Asl.CompileFlags &= ~NODE_COMPILE_TIME_CONST; - UtSetParseOpName (Op); - - /* Child node is the buffer length */ - - NewOp = TrAllocateNode (PARSEOP_INTEGER); - - NewOp->Asl.AmlOpcode = AML_BYTE_OP; - NewOp->Asl.Value.Integer = 16; - NewOp->Asl.Parent = Op; - - Op->Asl.Child = NewOp; - Op = NewOp; - - /* Peer to the child is the raw buffer data */ - - NewOp = TrAllocateNode (PARSEOP_RAW_DATA); - NewOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER; - NewOp->Asl.AmlLength = 16; - NewOp->Asl.Value.String = (char *) Buffer; - NewOp->Asl.Parent = Op->Asl.Parent; - - Op->Asl.Next = NewOp; -} - - -/******************************************************************************* - * - * FUNCTION: OpcGenerateAmlOpcode - * - * PARAMETERS: Op - Parse node - * - * RETURN: None - * - * DESCRIPTION: Generate the AML opcode associated with the node and its - * parse (lex/flex) keyword opcode. Essentially implements - * a mapping between the parse opcodes and the actual AML opcodes. - * - ******************************************************************************/ - -void -OpcGenerateAmlOpcode ( - ACPI_PARSE_OBJECT *Op) -{ - - UINT16 Index; - - - Index = (UINT16) (Op->Asl.ParseOpcode - ASL_PARSE_OPCODE_BASE); - - Op->Asl.AmlOpcode = AslKeywordMapping[Index].AmlOpcode; - Op->Asl.AcpiBtype = AslKeywordMapping[Index].AcpiBtype; - Op->Asl.CompileFlags |= AslKeywordMapping[Index].Flags; - - if (!Op->Asl.Value.Integer) - { - Op->Asl.Value.Integer = AslKeywordMapping[Index].Value; - } - - /* Special handling for some opcodes */ - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_INTEGER: - /* - * Set the opcode based on the size of the integer - */ - (void) OpcSetOptimalIntegerSize (Op); - break; - - case PARSEOP_OFFSET: - - Op->Asl.AmlOpcodeLength = 1; - break; - - case PARSEOP_ACCESSAS: - - OpcDoAccessAs (Op); - break; - - case PARSEOP_EISAID: - - OpcDoEisaId (Op); - break; - - case PARSEOP_TOUUID: - - OpcDoUuId (Op); - break; - - case PARSEOP_UNICODE: - - OpcDoUnicode (Op); - break; - - case PARSEOP_INCLUDE: - - Op->Asl.Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - Gbl_HasIncludeFiles = TRUE; - break; - - case PARSEOP_EXTERNAL: - - Op->Asl.Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - Op->Asl.Child->Asl.Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - break; - - default: - /* Nothing to do for other opcodes */ - break; - } - - return; -} - - diff -Nru acpica-unix-20100528/compiler/asloperands.c acpica-unix-20140114/compiler/asloperands.c --- acpica-unix-20100528/compiler/asloperands.c 2010-05-28 17:14:24.000000000 +0000 +++ acpica-unix-20140114/compiler/asloperands.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1252 +0,0 @@ - -/****************************************************************************** - * - * Module Name: asloperands - AML operand processing - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - - -#include "aslcompiler.h" -#include "aslcompiler.y.h" -#include "amlcode.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("asloperands") - -/* Local prototypes */ - -static void -OpnDoField ( - ACPI_PARSE_OBJECT *Op); - -static void -OpnDoBankField ( - ACPI_PARSE_OBJECT *Op); - -static void -OpnDoBuffer ( - ACPI_PARSE_OBJECT *Op); - -static void -OpnDoDefinitionBlock ( - ACPI_PARSE_OBJECT *Op); - -static void -OpnDoFieldCommon ( - ACPI_PARSE_OBJECT *FieldOp, - ACPI_PARSE_OBJECT *Op); - -static void -OpnDoIndexField ( - ACPI_PARSE_OBJECT *Op); - -static void -OpnDoLoadTable ( - ACPI_PARSE_OBJECT *Op); - -static void -OpnDoMethod ( - ACPI_PARSE_OBJECT *Op); - -static void -OpnDoMutex ( - ACPI_PARSE_OBJECT *Op); - -static void -OpnDoRegion ( - ACPI_PARSE_OBJECT *Op); - -static void -OpnAttachNameToNode ( - ACPI_PARSE_OBJECT *Op); - - -/******************************************************************************* - * - * FUNCTION: OpnDoMutex - * - * PARAMETERS: Op - The parent parse node - * - * RETURN: None - * - * DESCRIPTION: Construct the operands for the MUTEX ASL keyword. - * - ******************************************************************************/ - -static void -OpnDoMutex ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Next; - - - Next = Op->Asl.Child; - Next = Next->Asl.Next; - - if (Next->Asl.Value.Integer > 15) - { - AslError (ASL_ERROR, ASL_MSG_SYNC_LEVEL, Next, NULL); - } - return; -} - - -/******************************************************************************* - * - * FUNCTION: OpnDoMethod - * - * PARAMETERS: Op - The parent parse node - * - * RETURN: None - * - * DESCRIPTION: Construct the operands for the METHOD ASL keyword. - * - ******************************************************************************/ - -static void -OpnDoMethod ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Next; - - /* Optional arguments for this opcode with defaults */ - - UINT8 NumArgs = 0; - UINT8 Serialized = 0; - UINT8 Concurrency = 0; - UINT8 MethodFlags; - - - /* Opcode and package length first */ - /* Method name */ - - Next = Op->Asl.Child; - - /* Num args */ - - Next = Next->Asl.Next; - if (Next->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - NumArgs = (UINT8) Next->Asl.Value.Integer; - Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - } - - /* Serialized Flag */ - - Next = Next->Asl.Next; - if (Next->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - Serialized = (UINT8) Next->Asl.Value.Integer; - Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - } - - /* Concurrency value (valid values are 0-15) */ - - Next = Next->Asl.Next; - if (Next->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - if (Next->Asl.Value.Integer > 15) - { - AslError (ASL_ERROR, ASL_MSG_SYNC_LEVEL, Next, NULL); - } - Concurrency = (UINT8) Next->Asl.Value.Integer; - } - - /* Put the bits in their proper places */ - - MethodFlags = (UINT8) ((NumArgs & 0x7) | - ((Serialized & 0x1) << 3) | - ((Concurrency & 0xF) << 4)); - - /* Use the last node for the combined flags byte */ - - Next->Asl.Value.Integer = MethodFlags; - Next->Asl.AmlOpcode = AML_RAW_DATA_BYTE; - Next->Asl.AmlLength = 1; - Next->Asl.ParseOpcode = PARSEOP_RAW_DATA; - - /* Save the arg count in the first node */ - - Op->Asl.Extra = NumArgs; -} - - -/******************************************************************************* - * - * FUNCTION: OpnDoFieldCommon - * - * PARAMETERS: FieldOp - Node for an ASL field - * Op - The parent parse node - * - * RETURN: None - * - * DESCRIPTION: Construct the AML operands for the various field keywords, - * FIELD, BANKFIELD, INDEXFIELD - * - ******************************************************************************/ - -static void -OpnDoFieldCommon ( - ACPI_PARSE_OBJECT *FieldOp, - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Next; - ACPI_PARSE_OBJECT *PkgLengthNode; - UINT32 CurrentBitOffset; - UINT32 NewBitOffset; - UINT8 AccessType; - UINT8 LockRule; - UINT8 UpdateRule; - UINT8 FieldFlags; - UINT32 MinimumLength; - - - /* AccessType -- not optional, so no need to check for DEFAULT_ARG */ - - AccessType = (UINT8) Op->Asl.Value.Integer; - Op->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - - /* Set the access type in the parent (field) node for use later */ - - FieldOp->Asl.Value.Integer = AccessType; - - /* LockRule -- not optional, so no need to check for DEFAULT_ARG */ - - Next = Op->Asl.Next; - LockRule = (UINT8) Next->Asl.Value.Integer; - Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - - /* UpdateRule -- not optional, so no need to check for DEFAULT_ARG */ - - Next = Next->Asl.Next; - UpdateRule = (UINT8) Next->Asl.Value.Integer; - - /* - * Generate the flags byte. The various fields are already - * in the right bit position via translation from the - * keywords by the parser. - */ - FieldFlags = (UINT8) (AccessType | LockRule | UpdateRule); - - /* Use the previous node to be the FieldFlags node */ - - /* Set the node to RAW_DATA */ - - Next->Asl.Value.Integer = FieldFlags; - Next->Asl.AmlOpcode = AML_RAW_DATA_BYTE; - Next->Asl.AmlLength = 1; - Next->Asl.ParseOpcode = PARSEOP_RAW_DATA; - - /* Process the FieldUnitList */ - - Next = Next->Asl.Next; - CurrentBitOffset = 0; - - while (Next) - { - /* Save the offset of this field unit */ - - Next->Asl.ExtraValue = CurrentBitOffset; - - switch (Next->Asl.ParseOpcode) - { - case PARSEOP_ACCESSAS: - - PkgLengthNode = Next->Asl.Child; - AccessType = (UINT8) PkgLengthNode->Asl.Value.Integer; - - /* Nothing additional to do */ - break; - - - case PARSEOP_OFFSET: - - /* New offset into the field */ - - PkgLengthNode = Next->Asl.Child; - NewBitOffset = ((UINT32) PkgLengthNode->Asl.Value.Integer) * 8; - - /* - * Examine the specified offset in relation to the - * current offset counter. - */ - if (NewBitOffset < CurrentBitOffset) - { - /* - * Not allowed to specify a backwards offset! - * Issue error and ignore this node. - */ - AslError (ASL_ERROR, ASL_MSG_BACKWARDS_OFFSET, PkgLengthNode, - NULL); - Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - PkgLengthNode->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - } - else if (NewBitOffset == CurrentBitOffset) - { - /* - * Offset is redundant; we don't need to output an - * offset opcode. Just set these nodes to default - */ - Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - PkgLengthNode->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - } - else - { - /* - * Valid new offset - set the value to be inserted into the AML - * and update the offset counter. - */ - PkgLengthNode->Asl.Value.Integer = - NewBitOffset - CurrentBitOffset; - CurrentBitOffset = NewBitOffset; - } - break; - - - case PARSEOP_NAMESEG: - case PARSEOP_RESERVED_BYTES: - - /* Named or reserved field entry */ - - PkgLengthNode = Next->Asl.Child; - NewBitOffset = (UINT32) PkgLengthNode->Asl.Value.Integer; - CurrentBitOffset += NewBitOffset; - - /* Save the current AccessAs value for error checking later */ - - switch (AccessType) - { - case AML_FIELD_ACCESS_ANY: - case AML_FIELD_ACCESS_BYTE: - case AML_FIELD_ACCESS_BUFFER: - default: - MinimumLength = 8; - break; - - case AML_FIELD_ACCESS_WORD: - MinimumLength = 16; - break; - - case AML_FIELD_ACCESS_DWORD: - MinimumLength = 32; - break; - - case AML_FIELD_ACCESS_QWORD: - MinimumLength = 64; - break; - } - - PkgLengthNode->Asl.ExtraValue = MinimumLength; - break; - - default: - /* All supported field opcodes must appear above */ - break; - } - - /* Move on to next entry in the field list */ - - Next = Next->Asl.Next; - } -} - - -/******************************************************************************* - * - * FUNCTION: OpnDoField - * - * PARAMETERS: Op - The parent parse node - * - * RETURN: None - * - * DESCRIPTION: Construct the AML operands for the FIELD ASL keyword - * - ******************************************************************************/ - -static void -OpnDoField ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Next; - - - /* Opcode is parent node */ - /* First child is field name */ - - Next = Op->Asl.Child; - - /* Second child is the AccessType */ - - OpnDoFieldCommon (Op, Next->Asl.Next); -} - - -/******************************************************************************* - * - * FUNCTION: OpnDoIndexField - * - * PARAMETERS: Op - The parent parse node - * - * RETURN: None - * - * DESCRIPTION: Construct the AML operands for the INDEXFIELD ASL keyword - * - ******************************************************************************/ - -static void -OpnDoIndexField ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Next; - - - /* Opcode is parent node */ - /* First child is the index name */ - - Next = Op->Asl.Child; - - /* Second child is the data name */ - - Next = Next->Asl.Next; - - /* Third child is the AccessType */ - - OpnDoFieldCommon (Op, Next->Asl.Next); -} - - -/******************************************************************************* - * - * FUNCTION: OpnDoBankField - * - * PARAMETERS: Op - The parent parse node - * - * RETURN: None - * - * DESCRIPTION: Construct the AML operands for the BANKFIELD ASL keyword - * - ******************************************************************************/ - -static void -OpnDoBankField ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Next; - - - /* Opcode is parent node */ - /* First child is the region name */ - - Next = Op->Asl.Child; - - /* Second child is the bank name */ - - Next = Next->Asl.Next; - - /* Third child is the bank value */ - - Next = Next->Asl.Next; - - /* Fourth child is the AccessType */ - - OpnDoFieldCommon (Op, Next->Asl.Next); -} - - -/******************************************************************************* - * - * FUNCTION: OpnDoRegion - * - * PARAMETERS: Op - The parent parse node - * - * RETURN: None - * - * DESCRIPTION: Tries to get the length of the region. Can only do this at - * compile time if the length is a constant. - * - ******************************************************************************/ - -static void -OpnDoRegion ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Next; - - - /* Opcode is parent node */ - /* First child is the region name */ - - Next = Op->Asl.Child; - - /* Second child is the space ID*/ - - Next = Next->Asl.Next; - - /* Third child is the region offset */ - - Next = Next->Asl.Next; - - /* Fourth child is the region length */ - - Next = Next->Asl.Next; - if (Next->Asl.ParseOpcode == PARSEOP_INTEGER) - { - Op->Asl.Value.Integer = Next->Asl.Value.Integer; - } - else - { - Op->Asl.Value.Integer = ACPI_UINT64_MAX; - } -} - - -/******************************************************************************* - * - * FUNCTION: OpnDoBuffer - * - * PARAMETERS: Op - The parent parse node - * - * RETURN: None - * - * DESCRIPTION: Construct the AML operands for the BUFFER ASL keyword. We - * build a single raw byte buffer from the initialization nodes, - * each parse node contains a buffer byte. - * - ******************************************************************************/ - -static void -OpnDoBuffer ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *InitializerOp; - ACPI_PARSE_OBJECT *BufferLengthOp; - - /* Optional arguments for this opcode with defaults */ - - UINT32 BufferLength = 0; - - - /* Opcode and package length first */ - /* Buffer Length is next, followed by the initializer list */ - - BufferLengthOp = Op->Asl.Child; - InitializerOp = BufferLengthOp->Asl.Next; - - /* - * If the BufferLength is not an INTEGER or was not specified in the ASL - * (DEFAULT_ARG), it is a TermArg that is - * evaluated at run-time, and we are therefore finished. - */ - if ((BufferLengthOp->Asl.ParseOpcode != PARSEOP_INTEGER) && - (BufferLengthOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)) - { - return; - } - - /* - * We want to count the number of items in the initializer list, because if - * it is larger than the buffer length, we will define the buffer size - * to be the size of the initializer list (as per the ACPI Specification) - */ - switch (InitializerOp->Asl.ParseOpcode) - { - case PARSEOP_INTEGER: - case PARSEOP_BYTECONST: - case PARSEOP_WORDCONST: - case PARSEOP_DWORDCONST: - - /* The peer list contains the byte list (if any...) */ - - while (InitializerOp) - { - /* For buffers, this is a list of raw bytes */ - - InitializerOp->Asl.AmlOpcode = AML_RAW_DATA_BYTE; - InitializerOp->Asl.AmlLength = 1; - InitializerOp->Asl.ParseOpcode = PARSEOP_RAW_DATA; - - BufferLength++; - InitializerOp = ASL_GET_PEER_NODE (InitializerOp); - } - break; - - - case PARSEOP_STRING_LITERAL: - - /* - * Only one initializer, the string. Buffer must be big enough to hold - * the string plus the null termination byte - */ - BufferLength = strlen (InitializerOp->Asl.Value.String) + 1; - - InitializerOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER; - InitializerOp->Asl.AmlLength = BufferLength; - InitializerOp->Asl.ParseOpcode = PARSEOP_RAW_DATA; - break; - - - case PARSEOP_RAW_DATA: - - /* Buffer nodes are already initialized (e.g. Unicode operator) */ - return; - - - case PARSEOP_DEFAULT_ARG: - break; - - - default: - AslError (ASL_ERROR, ASL_MSG_INVALID_OPERAND, InitializerOp, - "Unknown buffer initializer opcode"); - printf ("Unknown buffer initializer opcode [%s]\n", - UtGetOpName (InitializerOp->Asl.ParseOpcode)); - return; - } - - /* Check if initializer list is longer than the buffer length */ - - if (BufferLengthOp->Asl.Value.Integer > BufferLength) - { - BufferLength = (UINT32) BufferLengthOp->Asl.Value.Integer; - } - - if (!BufferLength) - { - /* No length AND no items -- issue notice */ - - AslError (ASL_REMARK, ASL_MSG_BUFFER_LENGTH, BufferLengthOp, NULL); - - /* But go ahead and put the buffer length of zero into the AML */ - } - - /* - * Just set the buffer size node to be the buffer length, regardless - * of whether it was previously an integer or a default_arg placeholder - */ - BufferLengthOp->Asl.ParseOpcode = PARSEOP_INTEGER; - BufferLengthOp->Asl.AmlOpcode = AML_DWORD_OP; - BufferLengthOp->Asl.Value.Integer = BufferLength; - - (void) OpcSetOptimalIntegerSize (BufferLengthOp); - - /* Remaining nodes are handled via the tree walk */ -} - - -/******************************************************************************* - * - * FUNCTION: OpnDoPackage - * - * PARAMETERS: Op - The parent parse node - * - * RETURN: None - * - * DESCRIPTION: Construct the AML operands for the PACKAGE ASL keyword. NOTE: - * can only be called after constants have been folded, to ensure - * that the PackageLength operand has been fully reduced. - * - ******************************************************************************/ - -void -OpnDoPackage ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *InitializerOp; - ACPI_PARSE_OBJECT *PackageLengthOp; - UINT32 PackageLength = 0; - - - /* Opcode and package length first, followed by the initializer list */ - - PackageLengthOp = Op->Asl.Child; - InitializerOp = PackageLengthOp->Asl.Next; - - /* Count the number of items in the initializer list */ - - if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - /* The peer list contains the byte list (if any...) */ - - while (InitializerOp) - { - PackageLength++; - InitializerOp = InitializerOp->Asl.Next; - } - } - - /* If package length is a constant, compare to the initializer list */ - - if ((PackageLengthOp->Asl.ParseOpcode == PARSEOP_INTEGER) || - (PackageLengthOp->Asl.ParseOpcode == PARSEOP_QWORDCONST)) - { - if (PackageLengthOp->Asl.Value.Integer > PackageLength) - { - /* - * Allow package length to be longer than the initializer - * list -- but if the length of initializer list is nonzero, - * issue a message since this is probably a coding error, - * even though technically legal. - */ - if (PackageLength > 0) - { - AslError (ASL_REMARK, ASL_MSG_LIST_LENGTH_SHORT, - PackageLengthOp, NULL); - } - - PackageLength = (UINT32) PackageLengthOp->Asl.Value.Integer; - } - else if (PackageLengthOp->Asl.Value.Integer < PackageLength) - { - /* - * The package length is smaller than the length of the - * initializer list. This is an error as per the ACPI spec. - */ - AslError (ASL_ERROR, ASL_MSG_LIST_LENGTH_LONG, - PackageLengthOp, NULL); - } - } - - if (PackageLengthOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) - { - /* - * This is the case if the PackageLength was left empty - Package() - * The package length becomes the length of the initializer list - */ - Op->Asl.Child->Asl.ParseOpcode = PARSEOP_INTEGER; - Op->Asl.Child->Asl.Value.Integer = PackageLength; - - /* Set the AML opcode */ - - (void) OpcSetOptimalIntegerSize (Op->Asl.Child); - } - - /* If not a variable-length package, check for a zero package length */ - - if ((PackageLengthOp->Asl.ParseOpcode == PARSEOP_INTEGER) || - (PackageLengthOp->Asl.ParseOpcode == PARSEOP_QWORDCONST) || - (PackageLengthOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)) - { - if (!PackageLength) - { - /* No length AND no initializer list -- issue a remark */ - - AslError (ASL_REMARK, ASL_MSG_PACKAGE_LENGTH, - PackageLengthOp, NULL); - - /* But go ahead and put the buffer length of zero into the AML */ - } - } - - /* - * If the PackageLength is a constant <= 255, we can change the - * AML opcode from VarPackage to a simple (ACPI 1.0) Package opcode. - */ - if ((Op->Asl.Child->Asl.ParseOpcode == PARSEOP_INTEGER) && - (Op->Asl.Child->Asl.Value.Integer <= 255)) - { - Op->Asl.AmlOpcode = AML_PACKAGE_OP; - Op->Asl.ParseOpcode = PARSEOP_PACKAGE; - - /* - * Just set the package size node to be the package length, regardless - * of whether it was previously an integer or a default_arg placeholder - */ - PackageLengthOp->Asl.AmlOpcode = AML_RAW_DATA_BYTE; - PackageLengthOp->Asl.AmlLength = 1; - PackageLengthOp->Asl.ParseOpcode = PARSEOP_RAW_DATA; - PackageLengthOp->Asl.Value.Integer = PackageLength; - } - - /* Remaining nodes are handled via the tree walk */ -} - - -/******************************************************************************* - * - * FUNCTION: OpnDoLoadTable - * - * PARAMETERS: Op - The parent parse node - * - * RETURN: None - * - * DESCRIPTION: Construct the AML operands for the LOADTABLE ASL keyword. - * - ******************************************************************************/ - -static void -OpnDoLoadTable ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Next; - - - /* Opcode is parent node */ - /* First child is the table signature */ - - Next = Op->Asl.Child; - - /* Second child is the OEM ID*/ - - Next = Next->Asl.Next; - - /* Third child is the OEM table ID */ - - Next = Next->Asl.Next; - - /* Fourth child is the RootPath string */ - - Next = Next->Asl.Next; - if (Next->Asl.ParseOpcode == PARSEOP_ZERO) - { - Next->Asl.ParseOpcode = PARSEOP_STRING_LITERAL; - Next->Asl.Value.String = "\\"; - Next->Asl.AmlLength = 2; - OpcGenerateAmlOpcode (Next); - } - -#ifdef ASL_FUTURE_IMPLEMENTATION - - /* TBD: NOT IMPLEMENTED */ - /* Fifth child is the [optional] ParameterPathString */ - /* Sixth child is the [optional] ParameterData */ - - Next = Next->Asl.Next; - if (Next->Asl.ParseOpcode == DEFAULT_ARG) - { - Next->Asl.AmlLength = 1; - Next->Asl.ParseOpcode = ZERO; - OpcGenerateAmlOpcode (Next); - } - - - Next = Next->Asl.Next; - if (Next->Asl.ParseOpcode == DEFAULT_ARG) - { - Next->Asl.AmlLength = 1; - Next->Asl.ParseOpcode = ZERO; - OpcGenerateAmlOpcode (Next); - } -#endif -} - - -/******************************************************************************* - * - * FUNCTION: OpnDoDefinitionBlock - * - * PARAMETERS: Op - The parent parse node - * - * RETURN: None - * - * DESCRIPTION: Construct the AML operands for the DEFINITIONBLOCK ASL keyword - * - ******************************************************************************/ - -static void -OpnDoDefinitionBlock ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Child; - ACPI_SIZE Length; - UINT32 i; - char *Filename; - - - /* - * These nodes get stuffed into the table header. They are special - * cased when the table is written to the output file. - * - * Mark all of these nodes as non-usable so they won't get output - * as AML opcodes! - */ - - /* Get AML filename. Use it if non-null */ - - Child = Op->Asl.Child; - if (Child->Asl.Value.Buffer && - *Child->Asl.Value.Buffer && - (Gbl_UseDefaultAmlFilename)) - { - /* - * We will use the AML filename that is embedded in the source file - * for the output filename. - */ - Filename = ACPI_ALLOCATE (strlen (Gbl_DirectoryPath) + - strlen ((char *) Child->Asl.Value.Buffer) + 1); - - /* Prepend the current directory path */ - - strcpy (Filename, Gbl_DirectoryPath); - strcat (Filename, (char *) Child->Asl.Value.Buffer); - - Gbl_OutputFilenamePrefix = Filename; - } - Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - - /* Signature */ - - Child = Child->Asl.Next; - Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - if (Child->Asl.Value.String) - { - Gbl_TableSignature = Child->Asl.Value.String; - if (ACPI_STRLEN (Gbl_TableSignature) != 4) - { - AslError (ASL_ERROR, ASL_MSG_TABLE_SIGNATURE, Child, - "Length not exactly 4"); - } - - for (i = 0; i < 4; i++) - { - if (!isalnum ((int) Gbl_TableSignature[i])) - { - AslError (ASL_ERROR, ASL_MSG_TABLE_SIGNATURE, Child, - "Contains non-alphanumeric characters"); - } - } - } - - /* Revision */ - - Child = Child->Asl.Next; - Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - /* - * We used the revision to set the integer width earlier - */ - - /* OEMID */ - - Child = Child->Asl.Next; - Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - - /* OEM TableID */ - - Child = Child->Asl.Next; - Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - if (Child->Asl.Value.String) - { - Length = ACPI_STRLEN (Child->Asl.Value.String); - Gbl_TableId = AcpiOsAllocate (Length + 1); - ACPI_STRCPY (Gbl_TableId, Child->Asl.Value.String); - - for (i = 0; i < Length; i++) - { - if (Gbl_TableId[i] == ' ') - { - Gbl_TableId[i] = 0; - break; - } - } - } - - /* OEM Revision */ - - Child = Child->Asl.Next; - Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; -} - - -/******************************************************************************* - * - * FUNCTION: UtGetArg - * - * PARAMETERS: Op - Get an argument for this op - * Argn - Nth argument to get - * - * RETURN: The argument (as an Op object). NULL if argument does not exist - * - * DESCRIPTION: Get the specified op's argument (peer) - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -UtGetArg ( - ACPI_PARSE_OBJECT *Op, - UINT32 Argn) -{ - ACPI_PARSE_OBJECT *Arg = NULL; - - - /* Get the requested argument object */ - - Arg = Op->Asl.Child; - while (Arg && Argn) - { - Argn--; - Arg = Arg->Asl.Next; - } - - return (Arg); -} - - -/******************************************************************************* - * - * FUNCTION: OpnAttachNameToNode - * - * PARAMETERS: Op - The parent parse node - * - * RETURN: None - * - * DESCRIPTION: For the named ASL/AML operators, get the actual name from the - * argument list and attach it to the parent node so that we - * can get to it quickly later. - * - ******************************************************************************/ - -static void -OpnAttachNameToNode ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Child = NULL; - - - if (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL) - { - Child = UtGetArg (Op, 0); - } - else switch (Op->Asl.AmlOpcode) - { - case AML_DATA_REGION_OP: - case AML_DEVICE_OP: - case AML_EVENT_OP: - case AML_METHOD_OP: - case AML_MUTEX_OP: - case AML_REGION_OP: - case AML_POWER_RES_OP: - case AML_PROCESSOR_OP: - case AML_THERMAL_ZONE_OP: - case AML_NAME_OP: - case AML_SCOPE_OP: - - Child = UtGetArg (Op, 0); - break; - - case AML_ALIAS_OP: - - Child = UtGetArg (Op, 1); - break; - - case AML_CREATE_BIT_FIELD_OP: - case AML_CREATE_BYTE_FIELD_OP: - case AML_CREATE_WORD_FIELD_OP: - case AML_CREATE_DWORD_FIELD_OP: - case AML_CREATE_QWORD_FIELD_OP: - - Child = UtGetArg (Op, 2); - break; - - case AML_CREATE_FIELD_OP: - - Child = UtGetArg (Op, 3); - break; - - case AML_BANK_FIELD_OP: - case AML_INDEX_FIELD_OP: - case AML_FIELD_OP: - - return; - - default: - return; - } - - if (Child) - { - UtAttachNamepathToOwner (Op, Child); - } -} - - -/******************************************************************************* - * - * FUNCTION: OpnGenerateAmlOperands - * - * PARAMETERS: Op - The parent parse node - * - * RETURN: None - * - * DESCRIPTION: Prepare nodes to be output as AML data and operands. The more - * complex AML opcodes require processing of the child nodes - * (arguments/operands). - * - ******************************************************************************/ - -void -OpnGenerateAmlOperands ( - ACPI_PARSE_OBJECT *Op) -{ - - - if (Op->Asl.AmlOpcode == AML_RAW_DATA_BYTE) - { - return; - } - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_DEFINITIONBLOCK: - OpnDoDefinitionBlock (Op); - break; - - case PARSEOP_METHOD: - OpnDoMethod (Op); - break; - - case PARSEOP_MUTEX: - OpnDoMutex (Op); - break; - - case PARSEOP_FIELD: - OpnDoField (Op); - break; - - case PARSEOP_INDEXFIELD: - OpnDoIndexField (Op); - break; - - case PARSEOP_BANKFIELD: - OpnDoBankField (Op); - break; - - case PARSEOP_BUFFER: - OpnDoBuffer (Op); - break; - - case PARSEOP_LOADTABLE: - OpnDoLoadTable (Op); - break; - - case PARSEOP_OPERATIONREGION: - OpnDoRegion (Op); - break; - - case PARSEOP_RESOURCETEMPLATE: - RsDoResourceTemplate (Op); - break; - - case PARSEOP_NAMESEG: - case PARSEOP_NAMESTRING: - case PARSEOP_METHODCALL: - case PARSEOP_STRING_LITERAL: - break; - - default: - break; - } - - /* TBD: move */ - - OpnAttachNameToNode (Op); -} - - diff -Nru acpica-unix-20100528/compiler/aslopt.c acpica-unix-20140114/compiler/aslopt.c --- acpica-unix-20100528/compiler/aslopt.c 2010-05-28 17:14:24.000000000 +0000 +++ acpica-unix-20140114/compiler/aslopt.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,868 +0,0 @@ -/****************************************************************************** - * - * Module Name: aslopt- Compiler optimizations - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - - -#include "aslcompiler.h" -#include "aslcompiler.y.h" - -#include "acparser.h" -#include "amlcode.h" -#include "acnamesp.h" - - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslopt") - - -static UINT32 OptTotal = 0; - -/* Local prototypes */ - -static ACPI_STATUS -OptSearchToRoot ( - ACPI_PARSE_OBJECT *Op, - ACPI_WALK_STATE *WalkState, - ACPI_NAMESPACE_NODE *CurrentNode, - ACPI_NAMESPACE_NODE *TargetNode, - ACPI_BUFFER *TargetPath, - char **NewPath); - -static ACPI_STATUS -OptBuildShortestPath ( - ACPI_PARSE_OBJECT *Op, - ACPI_WALK_STATE *WalkState, - ACPI_NAMESPACE_NODE *CurrentNode, - ACPI_NAMESPACE_NODE *TargetNode, - ACPI_BUFFER *CurrentPath, - ACPI_BUFFER *TargetPath, - ACPI_SIZE AmlNameStringLength, - UINT8 IsDeclaration, - char **ReturnNewPath); - -static ACPI_STATUS -OptOptimizeNameDeclaration ( - ACPI_PARSE_OBJECT *Op, - ACPI_WALK_STATE *WalkState, - ACPI_NAMESPACE_NODE *CurrentNode, - ACPI_NAMESPACE_NODE *TargetNode, - char *AmlNameString, - char **NewPath); - - -/******************************************************************************* - * - * FUNCTION: OptSearchToRoot - * - * PARAMETERS: Op - Current parser op - * WalkState - Current state - * CurrentNode - Where we are in the namespace - * TargetNode - Node to which we are referring - * TargetPath - External full path to the target node - * NewPath - Where the optimized path is returned - * - * RETURN: Status - * - * DESCRIPTION: Attempt to optimize a reference to a single 4-character ACPI - * name utilizing the search-to-root name resolution algorithm - * that is used by AML interpreters. - * - ******************************************************************************/ - -static ACPI_STATUS -OptSearchToRoot ( - ACPI_PARSE_OBJECT *Op, - ACPI_WALK_STATE *WalkState, - ACPI_NAMESPACE_NODE *CurrentNode, - ACPI_NAMESPACE_NODE *TargetNode, - ACPI_BUFFER *TargetPath, - char **NewPath) -{ - ACPI_NAMESPACE_NODE *Node; - ACPI_GENERIC_STATE ScopeInfo; - ACPI_STATUS Status; - char *Path; - - - ACPI_FUNCTION_NAME (OptSearchToRoot); - - - /* - * Check if search-to-root can be utilized. Use the last NameSeg of - * the NamePath and 1) See if can be found and 2) If found, make - * sure that it is the same node that we want. If there is another - * name in the search path before the one we want, the nodes will - * not match, and we cannot use this optimization. - */ - Path = &(((char *) TargetPath->Pointer)[TargetPath->Length - - ACPI_NAME_SIZE]), - ScopeInfo.Scope.Node = CurrentNode; - - /* Lookup the NameSeg using SEARCH_PARENT (search-to-root) */ - - Status = AcpiNsLookup (&ScopeInfo, Path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, - ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, - WalkState, &(Node)); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* - * We found the name, but we must check to make sure that the node - * matches. Otherwise, there is another identical name in the search - * path that precludes the use of this optimization. - */ - if (Node != TargetNode) - { - /* - * This means that another object with the same name was found first, - * and we cannot use this optimization. - */ - return (AE_NOT_FOUND); - } - - /* Found the node, we can use this optimization */ - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, - "NAMESEG: %-24s", Path)); - - /* We must allocate a new string for the name (TargetPath gets deleted) */ - - *NewPath = ACPI_ALLOCATE_ZEROED (ACPI_NAME_SIZE + 1); - ACPI_STRCPY (*NewPath, Path); - - if (ACPI_STRNCMP (*NewPath, "_T_", 3)) - { - AslError (ASL_OPTIMIZATION, ASL_MSG_SINGLE_NAME_OPTIMIZATION, Op, - *NewPath); - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: OptBuildShortestPath - * - * PARAMETERS: Op - Current parser op - * WalkState - Current state - * CurrentNode - Where we are in the namespace - * TargetNode - Node to which we are referring - * CurrentPath - External full path to the current node - * TargetPath - External full path to the target node - * AmlNameStringLength - Length of the original namepath - * IsDeclaration - TRUE for declaration, FALSE for reference - * ReturnNewPath - Where the optimized path is returned - * - * RETURN: Status - * - * DESCRIPTION: Build an optimal NamePath using carats - * - ******************************************************************************/ - -static ACPI_STATUS -OptBuildShortestPath ( - ACPI_PARSE_OBJECT *Op, - ACPI_WALK_STATE *WalkState, - ACPI_NAMESPACE_NODE *CurrentNode, - ACPI_NAMESPACE_NODE *TargetNode, - ACPI_BUFFER *CurrentPath, - ACPI_BUFFER *TargetPath, - ACPI_SIZE AmlNameStringLength, - UINT8 IsDeclaration, - char **ReturnNewPath) -{ - UINT32 NumCommonSegments; - UINT32 MaxCommonSegments; - UINT32 Index; - UINT32 NumCarats; - UINT32 i; - char *NewPath; - char *NewPathExternal; - ACPI_NAMESPACE_NODE *Node; - ACPI_GENERIC_STATE ScopeInfo; - ACPI_STATUS Status; - BOOLEAN SubPath = FALSE; - - - ACPI_FUNCTION_NAME (OptBuildShortestPath); - - - ScopeInfo.Scope.Node = CurrentNode; - - /* - * Determine the maximum number of NameSegs that the Target and Current paths - * can possibly have in common. (To optimize, we have to have at least 1) - * - * Note: The external NamePath string lengths are always a multiple of 5 - * (ACPI_NAME_SIZE + separator) - */ - MaxCommonSegments = TargetPath->Length / ACPI_PATH_SEGMENT_LENGTH; - if (CurrentPath->Length < TargetPath->Length) - { - MaxCommonSegments = CurrentPath->Length / ACPI_PATH_SEGMENT_LENGTH; - } - - /* - * Determine how many NameSegs the two paths have in common. - * (Starting from the root) - */ - for (NumCommonSegments = 0; - NumCommonSegments < MaxCommonSegments; - NumCommonSegments++) - { - /* Compare two single NameSegs */ - - if (ACPI_STRNCMP ( - &((char *) TargetPath->Pointer)[(NumCommonSegments * - ACPI_PATH_SEGMENT_LENGTH) + 1], - &((char *) CurrentPath->Pointer)[(NumCommonSegments * - ACPI_PATH_SEGMENT_LENGTH) + 1], - ACPI_NAME_SIZE)) - { - /* Mismatch */ - - break; - } - } - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " COMMON: %u", - NumCommonSegments)); - - /* There must be at least 1 common NameSeg in order to optimize */ - - if (NumCommonSegments == 0) - { - return (AE_NOT_FOUND); - } - - if (NumCommonSegments == MaxCommonSegments) - { - if (CurrentPath->Length == TargetPath->Length) - { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " SAME PATH")); - return (AE_NOT_FOUND); - } - else - { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " SUBPATH")); - SubPath = TRUE; - } - } - - /* Determine how many prefix Carats are required */ - - NumCarats = (CurrentPath->Length / ACPI_PATH_SEGMENT_LENGTH) - - NumCommonSegments; - - /* - * Construct a new target string - */ - NewPathExternal = ACPI_ALLOCATE_ZEROED ( - TargetPath->Length + NumCarats + 1); - - /* Insert the Carats into the Target string */ - - for (i = 0; i < NumCarats; i++) - { - NewPathExternal[i] = '^'; - } - - /* - * Copy only the necessary (optimal) segments from the original - * target string - */ - Index = (NumCommonSegments * ACPI_PATH_SEGMENT_LENGTH) + 1; - - /* Special handling for exact subpath in a name declaration */ - - if (IsDeclaration && SubPath && (CurrentPath->Length > TargetPath->Length)) - { - /* - * The current path is longer than the target, and the target is a - * subpath of the current path. We must include one more NameSeg of - * the target path - */ - Index -= ACPI_PATH_SEGMENT_LENGTH; - - /* Special handling for Scope() operator */ - - if (Op->Asl.AmlOpcode == AML_SCOPE_OP) - { - NewPathExternal[i] = '^'; - i++; - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "(EXTRA ^)")); - } - } - - /* Make sure we haven't gone off the end of the target path */ - - if (Index > TargetPath->Length) - { - Index = TargetPath->Length; - } - - ACPI_STRCPY (&NewPathExternal[i], &((char *) TargetPath->Pointer)[Index]); - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " %-24s", NewPathExternal)); - - /* - * Internalize the new target string and check it against the original - * string to make sure that this is in fact an optimization. If the - * original string is already optimal, there is no point in continuing. - */ - Status = AcpiNsInternalizeName (NewPathExternal, &NewPath); - if (ACPI_FAILURE (Status)) - { - AslCoreSubsystemError (Op, Status, "Internalizing new NamePath", - ASL_NO_ABORT); - ACPI_FREE (NewPathExternal); - return (Status); - } - - if (ACPI_STRLEN (NewPath) >= AmlNameStringLength) - { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, - " NOT SHORTER (New %u old %u)", - (UINT32) ACPI_STRLEN (NewPath), (UINT32) AmlNameStringLength)); - ACPI_FREE (NewPathExternal); - return (AE_NOT_FOUND); - } - - /* - * Check to make sure that the optimization finds the node we are - * looking for. This is simply a sanity check on the new - * path that has been created. - */ - Status = AcpiNsLookup (&ScopeInfo, NewPath, - ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, - ACPI_NS_DONT_OPEN_SCOPE, WalkState, &(Node)); - if (ACPI_SUCCESS (Status)) - { - /* Found the namepath, but make sure the node is correct */ - - if (Node == TargetNode) - { - /* The lookup matched the node, accept this optimization */ - - AslError (ASL_OPTIMIZATION, ASL_MSG_NAME_OPTIMIZATION, - Op, NewPathExternal); - *ReturnNewPath = NewPath; - } - else - { - /* Node is not correct, do not use this optimization */ - - Status = AE_NOT_FOUND; - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " ***** WRONG NODE")); - AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op, - "Not using optimized name - found wrong node"); - } - } - else - { - /* The lookup failed, we obviously cannot use this optimization */ - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " ***** NOT FOUND")); - AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op, - "Not using optimized name - did not find node"); - } - - ACPI_FREE (NewPathExternal); - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: OptOptimizeNameDeclaration - * - * PARAMETERS: Op - Current parser op - * WalkState - Current state - * CurrentNode - Where we are in the namespace - * AmlNameString - Unoptimized namepath - * NewPath - Where the optimized path is returned - * - * RETURN: Status. AE_OK If path is optimized - * - * DESCRIPTION: Perform a simple optimization of removing an extraneous - * backslash prefix if we are already at the root scope. - * - ******************************************************************************/ - -static ACPI_STATUS -OptOptimizeNameDeclaration ( - ACPI_PARSE_OBJECT *Op, - ACPI_WALK_STATE *WalkState, - ACPI_NAMESPACE_NODE *CurrentNode, - ACPI_NAMESPACE_NODE *TargetNode, - char *AmlNameString, - char **NewPath) -{ - ACPI_STATUS Status; - char *NewPathExternal; - ACPI_GENERIC_STATE ScopeInfo; - ACPI_NAMESPACE_NODE *Node; - - - ACPI_FUNCTION_TRACE (OptOptimizeNameDeclaration); - - - if (((CurrentNode == AcpiGbl_RootNode) || - (Op->Common.Parent->Asl.ParseOpcode == PARSEOP_DEFINITIONBLOCK)) && - (AmlNameString[0] == '\\')) - { - /* - * The current scope is the root, and the namepath has a root prefix - * that is therefore extraneous. Remove it. - */ - *NewPath = &AmlNameString[1]; - - /* Debug output */ - - Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, *NewPath, - NULL, &NewPathExternal); - if (ACPI_FAILURE (Status)) - { - AslCoreSubsystemError (Op, Status, "Externalizing NamePath", - ASL_NO_ABORT); - return (Status); - } - - /* - * Check to make sure that the optimization finds the node we are - * looking for. This is simply a sanity check on the new - * path that has been created. - */ - ScopeInfo.Scope.Node = CurrentNode; - Status = AcpiNsLookup (&ScopeInfo, *NewPath, - ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, - ACPI_NS_DONT_OPEN_SCOPE, WalkState, &(Node)); - if (ACPI_SUCCESS (Status)) - { - /* Found the namepath, but make sure the node is correct */ - - if (Node == TargetNode) - { - /* The lookup matched the node, accept this optimization */ - - AslError (ASL_OPTIMIZATION, ASL_MSG_NAME_OPTIMIZATION, - Op, NewPathExternal); - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, - "AT ROOT: %-24s", NewPathExternal)); - } - else - { - /* Node is not correct, do not use this optimization */ - - Status = AE_NOT_FOUND; - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, - " ***** WRONG NODE")); - AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op, - "Not using optimized name - found wrong node"); - } - } - else - { - /* The lookup failed, we obviously cannot use this optimization */ - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, - " ***** NOT FOUND")); - AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op, - "Not using optimized name - did not find node"); - } - - ACPI_FREE (NewPathExternal); - return (Status); - } - - /* Could not optimize */ - - return (AE_NOT_FOUND); -} - - -/******************************************************************************* - * - * FUNCTION: OptOptimizeNamePath - * - * PARAMETERS: Op - Current parser op - * Flags - Opcode info flags - * WalkState - Current state - * AmlNameString - Unoptimized namepath - * TargetNode - Node to which AmlNameString refers - * - * RETURN: None. If path is optimized, the Op is updated with new path - * - * DESCRIPTION: Optimize a Named Declaration or Reference to the minimal length. - * Must take into account both the current location in the - * namespace and the actual reference path. - * - ******************************************************************************/ - -void -OptOptimizeNamePath ( - ACPI_PARSE_OBJECT *Op, - UINT32 Flags, - ACPI_WALK_STATE *WalkState, - char *AmlNameString, - ACPI_NAMESPACE_NODE *TargetNode) -{ - ACPI_STATUS Status; - ACPI_BUFFER TargetPath; - ACPI_BUFFER CurrentPath; - ACPI_SIZE AmlNameStringLength; - ACPI_NAMESPACE_NODE *CurrentNode; - char *ExternalNameString; - char *NewPath = NULL; - ACPI_SIZE HowMuchShorter; - ACPI_PARSE_OBJECT *NextOp; - - - ACPI_FUNCTION_TRACE (OptOptimizeNamePath); - - - /* This is an optional optimization */ - - if (!Gbl_ReferenceOptimizationFlag) - { - return_VOID; - } - - /* Various required items */ - - if (!TargetNode || !WalkState || !AmlNameString || !Op->Common.Parent) - { - return_VOID; - } - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "%5d [%12.12s] [%12.12s] ", - Op->Asl.LogicalLineNumber, - AcpiPsGetOpcodeName (Op->Common.Parent->Common.AmlOpcode), - AcpiPsGetOpcodeName (Op->Common.AmlOpcode))); - - if (!(Flags & (AML_NAMED | AML_CREATE))) - { - if (Op->Asl.CompileFlags & NODE_IS_NAME_DECLARATION) - { - /* We don't want to fuss with actual name declaration nodes here */ - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, - "******* NAME DECLARATION\n")); - return_VOID; - } - } - - /* - * The original path must be longer than one NameSeg (4 chars) for there - * to be any possibility that it can be optimized to a shorter string - */ - AmlNameStringLength = ACPI_STRLEN (AmlNameString); - if (AmlNameStringLength <= ACPI_NAME_SIZE) - { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, - "NAMESEG %4.4s\n", AmlNameString)); - return_VOID; - } - - /* - * We need to obtain the node that represents the current scope -- where - * we are right now in the namespace. We will compare this path - * against the Namepath, looking for commonality. - */ - CurrentNode = AcpiGbl_RootNode; - if (WalkState->ScopeInfo) - { - CurrentNode = WalkState->ScopeInfo->Scope.Node; - } - - if (Flags & (AML_NAMED | AML_CREATE)) - { - /* This is the declaration of a new name */ - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "NAME")); - - /* - * The node of interest is the parent of this node - * (the containing scope) - */ - CurrentNode = Op->Asl.Parent->Asl.Node; - if (!CurrentNode) - { - CurrentNode = AcpiGbl_RootNode; - } - } - else - { - /* This is a reference to an existing named object */ - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "REF ")); - } - - /* - * Obtain the full paths to the two nodes that we are interested in - * (Target and current namespace location) in external - * format -- something we can easily manipulate - */ - TargetPath.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiNsHandleToPathname (TargetNode, &TargetPath); - if (ACPI_FAILURE (Status)) - { - AslCoreSubsystemError (Op, Status, "Getting Target NamePath", - ASL_NO_ABORT); - return_VOID; - } - TargetPath.Length--; /* Subtract one for null terminator */ - - /* CurrentPath is the path to this scope (where we are in the namespace) */ - - CurrentPath.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiNsHandleToPathname (CurrentNode, &CurrentPath); - if (ACPI_FAILURE (Status)) - { - AslCoreSubsystemError (Op, Status, "Getting Current NamePath", - ASL_NO_ABORT); - return_VOID; - } - CurrentPath.Length--; /* Subtract one for null terminator */ - - /* Debug output only */ - - Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, AmlNameString, - NULL, &ExternalNameString); - if (ACPI_FAILURE (Status)) - { - AslCoreSubsystemError (Op, Status, "Externalizing NamePath", - ASL_NO_ABORT); - return_VOID; - } - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, - "%37s (%2u) ==> %-32s(%2u) %-32s", - (char *) CurrentPath.Pointer, (UINT32) CurrentPath.Length, - (char *) TargetPath.Pointer, (UINT32) TargetPath.Length, ExternalNameString)); - - ACPI_FREE (ExternalNameString); - - /* - * Attempt an optmization depending on the type of namepath - */ - if (Flags & (AML_NAMED | AML_CREATE)) - { - /* - * This is a named opcode and the namepath is a name declaration, not - * a reference. - */ - Status = OptOptimizeNameDeclaration (Op, WalkState, CurrentNode, - TargetNode, AmlNameString, &NewPath); - if (ACPI_FAILURE (Status)) - { - /* - * 2) now attempt to - * optimize the namestring with carats (up-arrow) - */ - Status = OptBuildShortestPath (Op, WalkState, CurrentNode, - TargetNode, &CurrentPath, &TargetPath, - AmlNameStringLength, 1, &NewPath); - } - } - else - { - /* - * This is a reference to an existing named object - * - * 1) Check if search-to-root can be utilized using the last - * NameSeg of the NamePath - */ - Status = OptSearchToRoot (Op, WalkState, CurrentNode, - TargetNode, &TargetPath, &NewPath); - if (ACPI_FAILURE (Status)) - { - /* - * 2) Search-to-root could not be used, now attempt to - * optimize the namestring with carats (up-arrow) - */ - Status = OptBuildShortestPath (Op, WalkState, CurrentNode, - TargetNode, &CurrentPath, &TargetPath, - AmlNameStringLength, 0, &NewPath); - } - } - - /* - * Success from above indicates that the NamePath was successfully - * optimized. We need to update the parse op with the new name - */ - if (ACPI_SUCCESS (Status)) - { - HowMuchShorter = (AmlNameStringLength - ACPI_STRLEN (NewPath)); - OptTotal += HowMuchShorter; - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " REDUCED %2u (%u)", - (UINT32) HowMuchShorter, OptTotal)); - - if (Flags & AML_NAMED) - { - if (Op->Asl.AmlOpcode == AML_ALIAS_OP) - { - /* - * ALIAS is the only oddball opcode, the name declaration - * (alias name) is the second operand - */ - Op->Asl.Child->Asl.Next->Asl.Value.String = NewPath; - Op->Asl.Child->Asl.Next->Asl.AmlLength = ACPI_STRLEN (NewPath); - } - else - { - Op->Asl.Child->Asl.Value.String = NewPath; - Op->Asl.Child->Asl.AmlLength = ACPI_STRLEN (NewPath); - } - } - else if (Flags & AML_CREATE) - { - /* Name must appear as the last parameter */ - - NextOp = Op->Asl.Child; - while (!(NextOp->Asl.CompileFlags & NODE_IS_NAME_DECLARATION)) - { - NextOp = NextOp->Asl.Next; - } - /* Update the parse node with the new NamePath */ - - NextOp->Asl.Value.String = NewPath; - NextOp->Asl.AmlLength = ACPI_STRLEN (NewPath); - } - else - { - /* Update the parse node with the new NamePath */ - - Op->Asl.Value.String = NewPath; - Op->Asl.AmlLength = ACPI_STRLEN (NewPath); - } - } - else - { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " ALREADY OPTIMAL")); - } - - /* Cleanup path buffers */ - - ACPI_FREE (TargetPath.Pointer); - ACPI_FREE (CurrentPath.Pointer); - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "\n")); - return_VOID; -} - diff -Nru acpica-unix-20100528/compiler/aslpredef.c acpica-unix-20140114/compiler/aslpredef.c --- acpica-unix-20100528/compiler/aslpredef.c 2010-05-28 17:14:24.000000000 +0000 +++ acpica-unix-20140114/compiler/aslpredef.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,831 +0,0 @@ -/****************************************************************************** - * - * Module Name: aslpredef - support for ACPI predefined names - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - -#define ACPI_CREATE_PREDEFINED_TABLE - -#include "aslcompiler.h" -#include "aslcompiler.y.h" -#include "amlcode.h" -#include "acparser.h" -#include "acpredef.h" - - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslpredef") - - -/* Local prototypes */ - -static UINT32 -ApCheckForSpecialName ( - ACPI_PARSE_OBJECT *Op, - char *Name); - -static void -ApCheckObjectType ( - ACPI_PARSE_OBJECT *Op, - UINT32 ExpectedBtypes); - -static void -ApGetExpectedTypes ( - char *Buffer, - UINT32 ExpectedBtypes); - - -/* - * Names for the types that can be returned by the predefined objects. - * Used for warning messages. Must be in the same order as the ACPI_RTYPEs - */ -static const char *AcpiRtypeNames[] = -{ - "/Integer", - "/String", - "/Buffer", - "/Package", - "/Reference", -}; - -/* - * Predefined names for use in Resource Descriptors. These names do not - * appear in the global Predefined Name table (since these names never - * appear in actual AML byte code, only in the original ASL) - */ -static const ACPI_PREDEFINED_INFO ResourceNames[] = { - {{"_ALN", 0, 0}}, - {{"_ASI", 0, 0}}, - {{"_ASZ", 0, 0}}, - {{"_ATT", 0, 0}}, - {{"_BAS", 0, 0}}, - {{"_BM_", 0, 0}}, - {{"_DEC", 0, 0}}, - {{"_GRA", 0, 0}}, - {{"_HE_", 0, 0}}, - {{"_INT", 0, 0}}, - {{"_LEN", 0, 0}}, - {{"_LL_", 0, 0}}, - {{"_MAF", 0, 0}}, - {{"_MAX", 0, 0}}, - {{"_MEM", 0, 0}}, - {{"_MIF", 0, 0}}, - {{"_MIN", 0, 0}}, - {{"_MTP", 0, 0}}, - {{"_RBO", 0, 0}}, - {{"_RBW", 0, 0}}, - {{"_RNG", 0, 0}}, - {{"_RT_", 0, 0}}, /* Acpi 3.0 */ - {{"_RW_", 0, 0}}, - {{"_SHR", 0, 0}}, - {{"_SIZ", 0, 0}}, - {{"_TRA", 0, 0}}, - {{"_TRS", 0, 0}}, - {{"_TSF", 0, 0}}, /* Acpi 3.0 */ - {{"_TTP", 0, 0}}, - {{"_TYP", 0, 0}}, - {{{0,0,0,0}, 0, 0}} /* Table terminator */ -}; - -static const ACPI_PREDEFINED_INFO ScopeNames[] = { - {{"_SB_", 0, 0}}, - {{"_SI_", 0, 0}}, - {{"_TZ_", 0, 0}}, - {{{0,0,0,0}, 0, 0}} /* Table terminator */ -}; - - -/******************************************************************************* - * - * FUNCTION: ApCheckForPredefinedMethod - * - * PARAMETERS: Op - A parse node of type "METHOD". - * MethodInfo - Saved info about this method - * - * RETURN: None - * - * DESCRIPTION: If method is a predefined name, check that the number of - * arguments and the return type (returns a value or not) - * is correct. - * - ******************************************************************************/ - -void -ApCheckForPredefinedMethod ( - ACPI_PARSE_OBJECT *Op, - ASL_METHOD_INFO *MethodInfo) -{ - UINT32 Index; - UINT32 RequiredArgsCurrent; - UINT32 RequiredArgsOld; - - - /* Check for a match against the predefined name list */ - - Index = ApCheckForPredefinedName (Op, Op->Asl.NameSeg); - - switch (Index) - { - case ACPI_NOT_RESERVED_NAME: /* No underscore or _Txx or _xxx name not matched */ - case ACPI_PREDEFINED_NAME: /* Resource Name or reserved scope name */ - case ACPI_COMPILER_RESERVED_NAME: /* A _Txx that was not emitted by compiler */ - - /* Just return, nothing to do */ - break; - - - case ACPI_EVENT_RESERVED_NAME: /* _Lxx/_Exx/_Wxx/_Qxx methods */ - - Gbl_ReservedMethods++; - - /* NumArguments must be zero for all _Lxx/_Exx/_Wxx/_Qxx methods */ - - if (MethodInfo->NumArguments != 0) - { - sprintf (MsgBuffer, "%s requires %u", Op->Asl.ExternalName, 0); - - AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op, - MsgBuffer); - } - break; - - - default: - /* - * Matched a predefined method name - * - * Validate the ASL-defined argument count. Allow two different legal - * arg counts. - */ - Gbl_ReservedMethods++; - - RequiredArgsCurrent = PredefinedNames[Index].Info.ParamCount & 0x0F; - RequiredArgsOld = PredefinedNames[Index].Info.ParamCount >> 4; - - if ((MethodInfo->NumArguments != RequiredArgsCurrent) && - (MethodInfo->NumArguments != RequiredArgsOld)) - { - sprintf (MsgBuffer, "%4.4s requires %u", - PredefinedNames[Index].Info.Name, RequiredArgsCurrent); - - if (MethodInfo->NumArguments > RequiredArgsCurrent) - { - AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op, - MsgBuffer); - } - else - { - AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_LO, Op, - MsgBuffer); - } - } - - /* - * Check if method returns no value, but the predefined name is - * required to return a value - */ - if (MethodInfo->NumReturnNoValue && - PredefinedNames[Index].Info.ExpectedBtypes) - { - ApGetExpectedTypes (StringBuffer, - PredefinedNames[Index].Info.ExpectedBtypes); - - sprintf (MsgBuffer, "%s required for %4.4s", - StringBuffer, PredefinedNames[Index].Info.Name); - - AslError (ASL_WARNING, ASL_MSG_RESERVED_RETURN_VALUE, Op, - MsgBuffer); - } - break; - } -} - - -/******************************************************************************* - * - * FUNCTION: ApCheckPredefinedReturnValue - * - * PARAMETERS: Op - A parse node of type "RETURN". - * MethodInfo - Saved info about this method - * - * RETURN: None - * - * DESCRIPTION: If method is a predefined name, attempt to validate the return - * value. Only "static" types can be validated - a simple return - * of an integer/string/buffer/package or a named reference to - * a static object. Values such as a Localx or Argx or a control - * method invocation are not checked. - * - ******************************************************************************/ - -void -ApCheckPredefinedReturnValue ( - ACPI_PARSE_OBJECT *Op, - ASL_METHOD_INFO *MethodInfo) -{ - UINT32 Index; - ACPI_PARSE_OBJECT *ReturnValueOp; - - - /* Check parent method for a match against the predefined name list */ - - Index = ApCheckForPredefinedName (MethodInfo->Op, - MethodInfo->Op->Asl.NameSeg); - - switch (Index) - { - case ACPI_NOT_RESERVED_NAME: /* No underscore or _Txx or _xxx name not matched */ - case ACPI_PREDEFINED_NAME: /* Resource Name or reserved scope name */ - case ACPI_COMPILER_RESERVED_NAME: /* A _Txx that was not emitted by compiler */ - case ACPI_EVENT_RESERVED_NAME: /* _Lxx/_Exx/_Wxx/_Qxx methods */ - - /* Just return, nothing to do */ - return; - - default: /* A standard predefined ACPI name */ - - /* Exit if no return value expected */ - - if (!PredefinedNames[Index].Info.ExpectedBtypes) - { - return; - } - - /* Get the object returned, it is the next argument */ - - ReturnValueOp = Op->Asl.Child; - switch (ReturnValueOp->Asl.ParseOpcode) - { - case PARSEOP_ZERO: - case PARSEOP_ONE: - case PARSEOP_ONES: - case PARSEOP_INTEGER: - case PARSEOP_STRING_LITERAL: - case PARSEOP_BUFFER: - case PARSEOP_PACKAGE: - - /* Static data return object - check against expected type */ - - ApCheckObjectType (ReturnValueOp, - PredefinedNames[Index].Info.ExpectedBtypes); - break; - - default: - - /* - * All other ops are very difficult or impossible to typecheck at - * compile time. These include all Localx, Argx, and method - * invocations. Also, NAMESEG and NAMESTRING because the type of - * any named object can be changed at runtime (for example, - * CopyObject will change the type of the target object.) - */ - break; - } - } -} - - -/******************************************************************************* - * - * FUNCTION: ApCheckForPredefinedObject - * - * PARAMETERS: Op - A parse node - * Name - The ACPI name to be checked - * - * RETURN: None - * - * DESCRIPTION: Check for a predefined name for a static object (created via - * the ASL Name operator). If it is a predefined ACPI name, ensure - * that the name does not require any arguments (which would - * require a control method implemenation of the name), and that - * the type of the object is one of the expected types for the - * predefined name. - * - ******************************************************************************/ - -void -ApCheckForPredefinedObject ( - ACPI_PARSE_OBJECT *Op, - char *Name) -{ - UINT32 Index; - - - /* - * Check for a real predefined name -- not a resource descriptor name - * or a predefined scope name - */ - Index = ApCheckForPredefinedName (Op, Name); - - switch (Index) - { - case ACPI_NOT_RESERVED_NAME: /* No underscore or _Txx or _xxx name not matched */ - case ACPI_PREDEFINED_NAME: /* Resource Name or reserved scope name */ - case ACPI_COMPILER_RESERVED_NAME: /* A _Txx that was not emitted by compiler */ - - /* Nothing to do */ - return; - - case ACPI_EVENT_RESERVED_NAME: /* _Lxx/_Exx/_Wxx/_Qxx methods */ - - /* - * These names must be control methods, by definition in ACPI spec. - * Also because they are defined to return no value. None of them - * require any arguments. - */ - AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op, - "with zero arguments"); - return; - - default: /* A standard predefined ACPI name */ - - /* - * If this predefined name requires input arguments, then - * it must be implemented as a control method - */ - if (PredefinedNames[Index].Info.ParamCount > 0) - { - AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op, - "with arguments"); - return; - } - - /* - * If no return value is expected from this predefined name, then - * it follows that it must be implemented as a control method - * (with zero args, because the args > 0 case was handled above) - * Examples are: _DIS, _INI, _IRC, _OFF, _ON, _PSx - */ - if (!PredefinedNames[Index].Info.ExpectedBtypes) - { - AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op, - "with zero arguments"); - return; - } - - /* Typecheck the actual object, it is the next argument */ - - ApCheckObjectType (Op->Asl.Child->Asl.Next, - PredefinedNames[Index].Info.ExpectedBtypes); - return; - } -} - - -/******************************************************************************* - * - * FUNCTION: ApCheckForPredefinedName - * - * PARAMETERS: Op - A parse node - * Name - NameSeg to check - * - * RETURN: None - * - * DESCRIPTION: Check a NameSeg against the reserved list. - * - ******************************************************************************/ - -UINT32 -ApCheckForPredefinedName ( - ACPI_PARSE_OBJECT *Op, - char *Name) -{ - UINT32 i; - - - if (Name[0] == 0) - { - AcpiOsPrintf ("Found a null name, external = %s\n", - Op->Asl.ExternalName); - } - - /* All reserved names are prefixed with a single underscore */ - - if (Name[0] != '_') - { - return (ACPI_NOT_RESERVED_NAME); - } - - /* Check for a standard predefined method name */ - - for (i = 0; PredefinedNames[i].Info.Name[0]; i++) - { - if (ACPI_COMPARE_NAME (Name, PredefinedNames[i].Info.Name)) - { - /* Return index into predefined array */ - return (i); - } - } - - /* Check for resource names and predefined scope names */ - - for (i = 0; ResourceNames[i].Info.Name[0]; i++) - { - if (ACPI_COMPARE_NAME (Name, ResourceNames[i].Info.Name)) - { - return (ACPI_PREDEFINED_NAME); - } - } - - for (i = 0; ScopeNames[i].Info.Name[0]; i++) - { - if (ACPI_COMPARE_NAME (Name, ScopeNames[i].Info.Name)) - { - return (ACPI_PREDEFINED_NAME); - } - } - - /* Check for _Lxx/_Exx/_Wxx/_Qxx/_T_x. Warning if unknown predefined name */ - - return (ApCheckForSpecialName (Op, Name)); -} - - -/******************************************************************************* - * - * FUNCTION: ApCheckForSpecialName - * - * PARAMETERS: Op - A parse node - * Name - NameSeg to check - * - * RETURN: None - * - * DESCRIPTION: Check for the "special" predefined names - - * _Lxx, _Exx, _Qxx, _Wxx, and _T_x - * - ******************************************************************************/ - -static UINT32 -ApCheckForSpecialName ( - ACPI_PARSE_OBJECT *Op, - char *Name) -{ - - /* - * Check for the "special" predefined names. We already know that the - * first character is an underscore. - * GPE: _Lxx - * GPE: _Exx - * GPE: _Wxx - * EC: _Qxx - */ - if ((Name[1] == 'L') || - (Name[1] == 'E') || - (Name[1] == 'W') || - (Name[1] == 'Q')) - { - /* The next two characters must be hex digits */ - - if ((isxdigit ((int) Name[2])) && - (isxdigit ((int) Name[3]))) - { - return (ACPI_EVENT_RESERVED_NAME); - } - } - - /* Check for the names reserved for the compiler itself: _T_x */ - - else if ((Op->Asl.ExternalName[1] == 'T') && - (Op->Asl.ExternalName[2] == '_')) - { - /* Ignore if actually emitted by the compiler */ - - if (Op->Asl.CompileFlags & NODE_COMPILER_EMITTED) - { - return (ACPI_NOT_RESERVED_NAME); - } - - /* - * Was not actually emitted by the compiler. This is a special case, - * however. If the ASL code being compiled was the result of a - * dissasembly, it may possibly contain valid compiler-emitted names - * of the form "_T_x". We don't want to issue an error or even a - * warning and force the user to manually change the names. So, we - * will issue a remark instead. - */ - AslError (ASL_REMARK, ASL_MSG_COMPILER_RESERVED, Op, Op->Asl.ExternalName); - return (ACPI_COMPILER_RESERVED_NAME); - } - - /* - * The name didn't match any of the known predefined names. Flag it as a - * warning, since the entire namespace starting with an underscore is - * reserved by the ACPI spec. - */ - AslError (ASL_WARNING, ASL_MSG_UNKNOWN_RESERVED_NAME, Op, - Op->Asl.ExternalName); - - return (ACPI_NOT_RESERVED_NAME); -} - - -/******************************************************************************* - * - * FUNCTION: ApCheckObjectType - * - * PARAMETERS: Op - Current parse node - * ExpectedBtypes - Bitmap of expected return type(s) - * - * RETURN: None - * - * DESCRIPTION: Check if the object type is one of the types that is expected - * by the predefined name. Only a limited number of object types - * can be returned by the predefined names. - * - ******************************************************************************/ - -static void -ApCheckObjectType ( - ACPI_PARSE_OBJECT *Op, - UINT32 ExpectedBtypes) -{ - UINT32 ReturnBtype; - - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_ZERO: - case PARSEOP_ONE: - case PARSEOP_ONES: - case PARSEOP_INTEGER: - ReturnBtype = ACPI_RTYPE_INTEGER; - break; - - case PARSEOP_BUFFER: - ReturnBtype = ACPI_RTYPE_BUFFER; - break; - - case PARSEOP_STRING_LITERAL: - ReturnBtype = ACPI_RTYPE_STRING; - break; - - case PARSEOP_PACKAGE: - ReturnBtype = ACPI_RTYPE_PACKAGE; - break; - - default: - /* Not one of the supported object types */ - - goto TypeErrorExit; - } - - /* Exit if the object is one of the expected types */ - - if (ReturnBtype & ExpectedBtypes) - { - return; - } - - -TypeErrorExit: - - /* Format the expected types and emit an error message */ - - ApGetExpectedTypes (StringBuffer, ExpectedBtypes); - - sprintf (MsgBuffer, "found %s, requires %s", - UtGetOpName (Op->Asl.ParseOpcode), StringBuffer); - - AslError (ASL_ERROR, ASL_MSG_RESERVED_OPERAND_TYPE, Op, - MsgBuffer); -} - - -/******************************************************************************* - * - * FUNCTION: ApDisplayReservedNames - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Dump information about the ACPI predefined names and predefined - * resource descriptor names. - * - ******************************************************************************/ - -void -ApDisplayReservedNames ( - void) -{ - const ACPI_PREDEFINED_INFO *ThisName; - char TypeBuffer[48]; /* Room for 5 types */ - UINT32 Count; - - - /* - * Predefined names/methods - */ - printf ("\nPredefined Name Information\n\n"); - - Count = 0; - ThisName = PredefinedNames; - while (ThisName->Info.Name[0]) - { - printf ("%4.4s Requires %u arguments, ", - ThisName->Info.Name, ThisName->Info.ParamCount & 0x0F); - - if (ThisName->Info.ExpectedBtypes) - { - ApGetExpectedTypes (TypeBuffer, ThisName->Info.ExpectedBtypes); - printf ("Must return: %s\n", TypeBuffer); - } - else - { - printf ("No return value\n"); - } - - /* - * Skip next entry in the table if this name returns a Package - * (next entry contains the package info) - */ - if (ThisName->Info.ExpectedBtypes & ACPI_RTYPE_PACKAGE) - { - ThisName++; - } - - Count++; - ThisName++; - } - - printf ("%u Predefined Names are recognized\n", Count); - - /* - * Resource Descriptor names - */ - printf ("\nResource Descriptor Predefined Names\n\n"); - - Count = 0; - ThisName = ResourceNames; - while (ThisName->Info.Name[0]) - { - printf ("%4.4s Resource Descriptor\n", ThisName->Info.Name); - Count++; - ThisName++; - } - - printf ("%u Resource Descriptor Names are recognized\n", Count); - - /* - * Predefined scope names - */ - printf ("\nPredefined Scope Names\n\n"); - - ThisName = ScopeNames; - while (ThisName->Info.Name[0]) - { - printf ("%4.4s Scope\n", ThisName->Info.Name); - ThisName++; - } -} - - -/******************************************************************************* - * - * FUNCTION: ApGetExpectedTypes - * - * PARAMETERS: Buffer - Where the formatted string is returned - * ExpectedBTypes - Bitfield of expected data types - * - * RETURN: None, formatted string - * - * DESCRIPTION: Format the expected object types into a printable string. - * - ******************************************************************************/ - -static void -ApGetExpectedTypes ( - char *Buffer, - UINT32 ExpectedBtypes) -{ - UINT32 ThisRtype; - UINT32 i; - UINT32 j; - - - j = 1; - Buffer[0] = 0; - ThisRtype = ACPI_RTYPE_INTEGER; - - for (i = 0; i < ACPI_NUM_RTYPES; i++) - { - /* If one of the expected types, concatenate the name of this type */ - - if (ExpectedBtypes & ThisRtype) - { - ACPI_STRCAT (Buffer, &AcpiRtypeNames[i][j]); - j = 0; /* Use name separator from now on */ - } - ThisRtype <<= 1; /* Next Rtype */ - } -} - diff -Nru acpica-unix-20100528/compiler/aslresource.c acpica-unix-20140114/compiler/aslresource.c --- acpica-unix-20100528/compiler/aslresource.c 2010-05-28 17:14:24.000000000 +0000 +++ acpica-unix-20140114/compiler/aslresource.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1051 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslresource - Resource template/descriptor utilities - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - - -#include "aslcompiler.h" -#include "aslcompiler.y.h" -#include "amlcode.h" - - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslresource") - - -/******************************************************************************* - * - * FUNCTION: RsSmallAddressCheck - * - * PARAMETERS: Minimum - Address Min value - * Maximum - Address Max value - * Length - Address range value - * Alignment - Address alignment value - * MinOp - Original Op for Address Min - * MaxOp - Original Op for Address Max - * LengthOp - Original Op for address range - * AlignOp - Original Op for address alignment. If - * NULL, means "zero value for alignment is - * OK, and means 64K alignment" (for - * Memory24 descriptor) - * - * RETURN: None. Adds error messages to error log if necessary - * - * DESCRIPTION: Perform common value checks for "small" address descriptors. - * Currently: - * Io, Memory24, Memory32 - * - ******************************************************************************/ - -void -RsSmallAddressCheck ( - UINT8 Type, - UINT32 Minimum, - UINT32 Maximum, - UINT32 Length, - UINT32 Alignment, - ACPI_PARSE_OBJECT *MinOp, - ACPI_PARSE_OBJECT *MaxOp, - ACPI_PARSE_OBJECT *LengthOp, - ACPI_PARSE_OBJECT *AlignOp) -{ - - if (Gbl_NoResourceChecking) - { - return; - } - - /* Special case for Memory24, values are compressed */ - - if (Type == ACPI_RESOURCE_NAME_MEMORY24) - { - if (!Alignment) /* Alignment==0 means 64K - no invalid alignment */ - { - Alignment = ACPI_UINT16_MAX + 1; - } - - Minimum <<= 8; - Maximum <<= 8; - Length *= 256; - } - - /* IO descriptor has different definition of min/max, don't check */ - - if (Type != ACPI_RESOURCE_NAME_IO) - { - /* Basic checks on Min/Max/Length */ - - if (Minimum > Maximum) - { - AslError (ASL_ERROR, ASL_MSG_INVALID_MIN_MAX, MinOp, NULL); - } - else if (Length > (Maximum - Minimum + 1)) - { - AslError (ASL_ERROR, ASL_MSG_INVALID_LENGTH, LengthOp, NULL); - } - } - - /* Alignment of zero is not in ACPI spec, but is used to mean byte acc */ - - if (!Alignment) - { - Alignment = 1; - } - - /* Addresses must be an exact multiple of the alignment value */ - - if (Minimum % Alignment) - { - AslError (ASL_ERROR, ASL_MSG_ALIGNMENT, MinOp, NULL); - } - if (Maximum % Alignment) - { - AslError (ASL_ERROR, ASL_MSG_ALIGNMENT, MaxOp, NULL); - } -} - - -/******************************************************************************* - * - * FUNCTION: RsLargeAddressCheck - * - * PARAMETERS: Minimum - Address Min value - * Maximum - Address Max value - * Length - Address range value - * Granularity - Address granularity value - * Flags - General flags for address descriptors: - * _MIF, _MAF, _DEC - * MinOp - Original Op for Address Min - * MaxOp - Original Op for Address Max - * LengthOp - Original Op for address range - * GranOp - Original Op for address granularity - * - * RETURN: None. Adds error messages to error log if necessary - * - * DESCRIPTION: Perform common value checks for "large" address descriptors. - * Currently: - * WordIo, WordBusNumber, WordSpace - * DWordIo, DWordMemory, DWordSpace - * QWordIo, QWordMemory, QWordSpace - * ExtendedIo, ExtendedMemory, ExtendedSpace - * - * _MIF flag set means that the minimum address is fixed and is not relocatable - * _MAF flag set means that the maximum address is fixed and is not relocatable - * Length of zero means that the record size is variable - * - * This function implements the LEN/MIF/MAF/MIN/MAX/GRA rules within Table 6-40 - * of the ACPI 4.0a specification. Added 04/2010. - * - ******************************************************************************/ - -void -RsLargeAddressCheck ( - UINT64 Minimum, - UINT64 Maximum, - UINT64 Length, - UINT64 Granularity, - UINT8 Flags, - ACPI_PARSE_OBJECT *MinOp, - ACPI_PARSE_OBJECT *MaxOp, - ACPI_PARSE_OBJECT *LengthOp, - ACPI_PARSE_OBJECT *GranOp) -{ - - if (Gbl_NoResourceChecking) - { - return; - } - - /* Basic checks on Min/Max/Length */ - - if (Minimum > Maximum) - { - AslError (ASL_ERROR, ASL_MSG_INVALID_MIN_MAX, MinOp, NULL); - return; - } - else if (Length > (Maximum - Minimum + 1)) - { - AslError (ASL_ERROR, ASL_MSG_INVALID_LENGTH, LengthOp, NULL); - return; - } - - /* If specified (non-zero), ensure granularity is a power-of-two minus one */ - - if (Granularity) - { - if ((Granularity + 1) & - Granularity) - { - AslError (ASL_ERROR, ASL_MSG_INVALID_GRANULARITY, GranOp, NULL); - return; - } - } - - /* - * Check the various combinations of Length, MinFixed, and MaxFixed - */ - if (Length) - { - /* Fixed non-zero length */ - - switch (Flags & (ACPI_RESOURCE_FLAG_MIF | ACPI_RESOURCE_FLAG_MAF)) - { - case 0: - /* - * Fixed length, variable locations (both _MIN and _MAX). - * Length must be a multiple of granularity - */ - if (Granularity & Length) - { - AslError (ASL_ERROR, ASL_MSG_ALIGNMENT, LengthOp, NULL); - } - break; - - case (ACPI_RESOURCE_FLAG_MIF | ACPI_RESOURCE_FLAG_MAF): - - /* Fixed length, fixed location. Granularity must be zero */ - - if (Granularity != 0) - { - AslError (ASL_ERROR, ASL_MSG_INVALID_GRAN_FIXED, GranOp, NULL); - } - - /* Length must be exactly the size of the min/max window */ - - if (Length != (Maximum - Minimum + 1)) - { - AslError (ASL_ERROR, ASL_MSG_INVALID_LENGTH_FIXED, LengthOp, NULL); - } - break; - - /* All other combinations are invalid */ - - case ACPI_RESOURCE_FLAG_MIF: - case ACPI_RESOURCE_FLAG_MAF: - default: - AslError (ASL_ERROR, ASL_MSG_INVALID_ADDR_FLAGS, LengthOp, NULL); - } - } - else - { - /* Variable length (length==0) */ - - switch (Flags & (ACPI_RESOURCE_FLAG_MIF | ACPI_RESOURCE_FLAG_MAF)) - { - case 0: - /* - * Both _MIN and _MAX are variable. - * No additional requirements, just exit - */ - break; - - case ACPI_RESOURCE_FLAG_MIF: - - /* _MIN is fixed. _MIN must be multiple of _GRA */ - - /* - * The granularity is defined by the ACPI specification to be a - * power-of-two minus one, therefore the granularity is a - * bitmask which can be used to easily validate the addresses. - */ - if (Granularity & Minimum) - { - AslError (ASL_ERROR, ASL_MSG_ALIGNMENT, MinOp, NULL); - } - break; - - case ACPI_RESOURCE_FLAG_MAF: - - /* _MAX is fixed. (_MAX + 1) must be multiple of _GRA */ - - if (Granularity & (Maximum + 1)) - { - AslError (ASL_ERROR, ASL_MSG_ALIGNMENT, MaxOp, "-1"); - } - break; - - /* Both MIF/MAF set is invalid if length is zero */ - - case (ACPI_RESOURCE_FLAG_MIF | ACPI_RESOURCE_FLAG_MAF): - default: - AslError (ASL_ERROR, ASL_MSG_INVALID_ADDR_FLAGS, LengthOp, NULL); - } - } -} - - -/******************************************************************************* - * - * FUNCTION: RsGetStringDataLength - * - * PARAMETERS: InitializerOp - Start of a subtree of init nodes - * - * RETURN: Valid string length if a string node is found (otherwise 0) - * - * DESCRIPTION: In a list of peer nodes, find the first one that contains a - * string and return the length of the string. - * - ******************************************************************************/ - -UINT16 -RsGetStringDataLength ( - ACPI_PARSE_OBJECT *InitializerOp) -{ - - while (InitializerOp) - { - if (InitializerOp->Asl.ParseOpcode == PARSEOP_STRING_LITERAL) - { - return ((UINT16) (strlen (InitializerOp->Asl.Value.String) + 1)); - } - InitializerOp = ASL_GET_PEER_NODE (InitializerOp); - } - - return 0; -} - - -/******************************************************************************* - * - * FUNCTION: RsAllocateResourceNode - * - * PARAMETERS: Size - Size of node in bytes - * - * RETURN: The allocated node - aborts on allocation failure - * - * DESCRIPTION: Allocate a resource description node and the resource - * descriptor itself (the nodes are used to link descriptors). - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsAllocateResourceNode ( - UINT32 Size) -{ - ASL_RESOURCE_NODE *Rnode; - - - /* Allocate the node */ - - Rnode = UtLocalCalloc (sizeof (ASL_RESOURCE_NODE)); - - /* Allocate the resource descriptor itself */ - - Rnode->Buffer = UtLocalCalloc (Size); - Rnode->BufferLength = Size; - - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsCreateBitField - * - * PARAMETERS: Op - Resource field node - * Name - Name of the field (Used only to reference - * the field in the ASL, not in the AML) - * ByteOffset - Offset from the field start - * BitOffset - Additional bit offset - * - * RETURN: None, sets fields within the input node - * - * DESCRIPTION: Utility function to generate a named bit field within a - * resource descriptor. Mark a node as 1) a field in a resource - * descriptor, and 2) set the value to be a BIT offset - * - ******************************************************************************/ - -void -RsCreateBitField ( - ACPI_PARSE_OBJECT *Op, - char *Name, - UINT32 ByteOffset, - UINT32 BitOffset) -{ - - Op->Asl.ExternalName = Name; - Op->Asl.Value.Integer = ((UINT64) ByteOffset * 8) + BitOffset; - Op->Asl.CompileFlags |= (NODE_IS_RESOURCE_FIELD | NODE_IS_BIT_OFFSET); -} - - -/******************************************************************************* - * - * FUNCTION: RsCreateByteField - * - * PARAMETERS: Op - Resource field node - * Name - Name of the field (Used only to reference - * the field in the ASL, not in the AML) - * ByteOffset - Offset from the field start - * - * RETURN: None, sets fields within the input node - * - * DESCRIPTION: Utility function to generate a named byte field within a - * resource descriptor. Mark a node as 1) a field in a resource - * descriptor, and 2) set the value to be a BYTE offset - * - ******************************************************************************/ - -void -RsCreateByteField ( - ACPI_PARSE_OBJECT *Op, - char *Name, - UINT32 ByteOffset) -{ - - Op->Asl.ExternalName = Name; - Op->Asl.Value.Integer = ByteOffset; - Op->Asl.CompileFlags |= NODE_IS_RESOURCE_FIELD; -} - - -/******************************************************************************* - * - * FUNCTION: RsSetFlagBits - * - * PARAMETERS: *Flags - Pointer to the flag byte - * Op - Flag initialization node - * Position - Bit position within the flag byte - * Default - Used if the node is DEFAULT. - * - * RETURN: Sets bits within the *Flags output byte. - * - * DESCRIPTION: Set a bit in a cumulative flags word from an initialization - * node. Will use a default value if the node is DEFAULT, meaning - * that no value was specified in the ASL. Used to merge multiple - * keywords into a single flags byte. - * - ******************************************************************************/ - -void -RsSetFlagBits ( - UINT8 *Flags, - ACPI_PARSE_OBJECT *Op, - UINT8 Position, - UINT8 DefaultBit) -{ - - if (Op->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) - { - /* Use the default bit */ - - *Flags |= (DefaultBit << Position); - } - else - { - /* Use the bit specified in the initialization node */ - - *Flags |= (((UINT8) Op->Asl.Value.Integer) << Position); - } -} - - -/******************************************************************************* - * - * FUNCTION: RsCompleteNodeAndGetNext - * - * PARAMETERS: Op - Resource node to be completed - * - * RETURN: The next peer to the input node. - * - * DESCRIPTION: Mark the current node completed and return the next peer. - * The node ParseOpcode is set to DEFAULT_ARG, meaning that - * this node is to be ignored from now on. - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -RsCompleteNodeAndGetNext ( - ACPI_PARSE_OBJECT *Op) -{ - - /* Mark this node unused */ - - Op->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - - /* Move on to the next peer node in the initializer list */ - - return (ASL_GET_PEER_NODE (Op)); -} - - -/******************************************************************************* - * - * FUNCTION: RsCheckListForDuplicates - * - * PARAMETERS: Op - First op in the initializer list - * - * RETURN: None - * - * DESCRIPTION: Check an initializer list for duplicate values. Emits an error - * if any duplicates are found. - * - ******************************************************************************/ - -void -RsCheckListForDuplicates ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *NextValueOp = Op; - ACPI_PARSE_OBJECT *NextOp; - UINT32 Value; - - - if (!Op) - { - return; - } - - /* Search list once for each value in the list */ - - while (NextValueOp) - { - Value = (UINT32) NextValueOp->Asl.Value.Integer; - - /* Compare this value to all remaining values in the list */ - - NextOp = ASL_GET_PEER_NODE (NextValueOp); - while (NextOp) - { - if (NextOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - /* Compare values */ - - if (Value == (UINT32) NextOp->Asl.Value.Integer) - { - /* Emit error only once per duplicate node */ - - if (!(NextOp->Asl.CompileFlags & NODE_IS_DUPLICATE)) - { - NextOp->Asl.CompileFlags |= NODE_IS_DUPLICATE; - AslError (ASL_ERROR, ASL_MSG_DUPLICATE_ITEM, - NextOp, NULL); - } - } - } - - NextOp = ASL_GET_PEER_NODE (NextOp); - } - - NextValueOp = ASL_GET_PEER_NODE (NextValueOp); - } -} - - -/******************************************************************************* - * - * FUNCTION: RsDoOneResourceDescriptor - * - * PARAMETERS: DescriptorTypeOp - Parent parse node of the descriptor - * CurrentByteOffset - Offset in the resource descriptor - * buffer. - * - * RETURN: A valid resource node for the descriptor - * - * DESCRIPTION: Dispatches the processing of one resource descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoOneResourceDescriptor ( - ACPI_PARSE_OBJECT *DescriptorTypeOp, - UINT32 CurrentByteOffset, - UINT8 *State) -{ - ASL_RESOURCE_NODE *Rnode = NULL; - - - /* Construct the resource */ - - switch (DescriptorTypeOp->Asl.ParseOpcode) - { - case PARSEOP_DMA: - Rnode = RsDoDmaDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_DWORDIO: - Rnode = RsDoDwordIoDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_DWORDMEMORY: - Rnode = RsDoDwordMemoryDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_DWORDSPACE: - Rnode = RsDoDwordSpaceDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_ENDDEPENDENTFN: - switch (*State) - { - case ACPI_RSTATE_NORMAL: - AslError (ASL_ERROR, ASL_MSG_MISSING_STARTDEPENDENT, - DescriptorTypeOp, NULL); - break; - - case ACPI_RSTATE_START_DEPENDENT: - AslError (ASL_ERROR, ASL_MSG_DEPENDENT_NESTING, - DescriptorTypeOp, NULL); - break; - - case ACPI_RSTATE_DEPENDENT_LIST: - default: - break; - } - - *State = ACPI_RSTATE_NORMAL; - Rnode = RsDoEndDependentDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_ENDTAG: - Rnode = RsDoEndTagDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_EXTENDEDIO: - Rnode = RsDoExtendedIoDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_EXTENDEDMEMORY: - Rnode = RsDoExtendedMemoryDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_EXTENDEDSPACE: - Rnode = RsDoExtendedSpaceDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_FIXEDIO: - Rnode = RsDoFixedIoDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_INTERRUPT: - Rnode = RsDoInterruptDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_IO: - Rnode = RsDoIoDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_IRQ: - Rnode = RsDoIrqDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_IRQNOFLAGS: - Rnode = RsDoIrqNoFlagsDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_MEMORY24: - Rnode = RsDoMemory24Descriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_MEMORY32: - Rnode = RsDoMemory32Descriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_MEMORY32FIXED: - Rnode = RsDoMemory32FixedDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_QWORDIO: - Rnode = RsDoQwordIoDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_QWORDMEMORY: - Rnode = RsDoQwordMemoryDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_QWORDSPACE: - Rnode = RsDoQwordSpaceDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_REGISTER: - Rnode = RsDoGeneralRegisterDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_STARTDEPENDENTFN: - switch (*State) - { - case ACPI_RSTATE_START_DEPENDENT: - AslError (ASL_ERROR, ASL_MSG_DEPENDENT_NESTING, - DescriptorTypeOp, NULL); - break; - - case ACPI_RSTATE_NORMAL: - case ACPI_RSTATE_DEPENDENT_LIST: - default: - break; - } - - *State = ACPI_RSTATE_START_DEPENDENT; - Rnode = RsDoStartDependentDescriptor (DescriptorTypeOp, - CurrentByteOffset); - *State = ACPI_RSTATE_DEPENDENT_LIST; - break; - - case PARSEOP_STARTDEPENDENTFN_NOPRI: - switch (*State) - { - case ACPI_RSTATE_START_DEPENDENT: - AslError (ASL_ERROR, ASL_MSG_DEPENDENT_NESTING, - DescriptorTypeOp, NULL); - break; - - case ACPI_RSTATE_NORMAL: - case ACPI_RSTATE_DEPENDENT_LIST: - default: - break; - } - - *State = ACPI_RSTATE_START_DEPENDENT; - Rnode = RsDoStartDependentNoPriDescriptor (DescriptorTypeOp, - CurrentByteOffset); - *State = ACPI_RSTATE_DEPENDENT_LIST; - break; - - case PARSEOP_VENDORLONG: - Rnode = RsDoVendorLargeDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_VENDORSHORT: - Rnode = RsDoVendorSmallDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_WORDBUSNUMBER: - Rnode = RsDoWordBusNumberDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_WORDIO: - Rnode = RsDoWordIoDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_WORDSPACE: - Rnode = RsDoWordSpaceDescriptor (DescriptorTypeOp, - CurrentByteOffset); - break; - - case PARSEOP_DEFAULT_ARG: - /* Just ignore any of these, they are used as fillers/placeholders */ - break; - - default: - printf ("Unknown resource descriptor type [%s]\n", - DescriptorTypeOp->Asl.ParseOpName); - break; - } - - /* - * Mark original node as unused, but head of a resource descriptor. - * This allows the resource to be installed in the namespace so that - * references to the descriptor can be resolved. - */ - DescriptorTypeOp->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - DescriptorTypeOp->Asl.CompileFlags = NODE_IS_RESOURCE_DESC; - DescriptorTypeOp->Asl.Value.Integer = CurrentByteOffset; - - if (Rnode) - { - DescriptorTypeOp->Asl.FinalAmlLength = Rnode->BufferLength; - } - - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsLinkDescriptorChain - * - * PARAMETERS: PreviousRnode - Pointer to the node that will be previous - * to the linked node, At exit, set to the - * last node in the new chain. - * Rnode - Resource node to link into the list - * - * RETURN: Cumulative buffer byte offset of the new segment of chain - * - * DESCRIPTION: Link a descriptor chain at the end of an existing chain. - * - ******************************************************************************/ - -UINT32 -RsLinkDescriptorChain ( - ASL_RESOURCE_NODE **PreviousRnode, - ASL_RESOURCE_NODE *Rnode) -{ - ASL_RESOURCE_NODE *LastRnode; - UINT32 CurrentByteOffset; - - - /* Anything to do? */ - - if (!Rnode) - { - return 0; - } - - /* Point the previous node to the new node */ - - (*PreviousRnode)->Next = Rnode; - CurrentByteOffset = Rnode->BufferLength; - - /* Walk to the end of the chain headed by Rnode */ - - LastRnode = Rnode; - while (LastRnode->Next) - { - LastRnode = LastRnode->Next; - CurrentByteOffset += LastRnode->BufferLength; - } - - /* Previous node becomes the last node in the chain */ - - *PreviousRnode = LastRnode; - return CurrentByteOffset; -} - - -/******************************************************************************* - * - * FUNCTION: RsDoResourceTemplate - * - * PARAMETERS: Op - Parent of a resource template list - * - * RETURN: None. Sets input node to point to a list of AML code - * - * DESCRIPTION: Merge a list of resource descriptors into a single AML buffer, - * in preparation for output to the AML output file. - * - ******************************************************************************/ - -void -RsDoResourceTemplate ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *BufferLengthOp; - ACPI_PARSE_OBJECT *BufferOp; - ACPI_PARSE_OBJECT *DescriptorTypeOp; - ACPI_PARSE_OBJECT *LastOp = NULL; - UINT32 CurrentByteOffset = 0; - ASL_RESOURCE_NODE HeadRnode; - ASL_RESOURCE_NODE *PreviousRnode; - ASL_RESOURCE_NODE *Rnode; - UINT8 State; - - - /* Mark parent as containing a resource template */ - - if (Op->Asl.Parent) - { - Op->Asl.Parent->Asl.CompileFlags |= NODE_IS_RESOURCE_DESC; - } - - /* ResourceTemplate Opcode is first (Op) */ - /* Buffer Length node is first child */ - - BufferLengthOp = ASL_GET_CHILD_NODE (Op); - - /* Buffer Op is first peer */ - - BufferOp = ASL_GET_PEER_NODE (BufferLengthOp); - - /* First Descriptor type is next */ - - DescriptorTypeOp = ASL_GET_PEER_NODE (BufferOp); - - /* - * Process all resource descriptors in the list - * Note: It is assumed that the EndTag node has been automatically - * inserted at the end of the template by the parser. - */ - State = ACPI_RSTATE_NORMAL; - PreviousRnode = &HeadRnode; - while (DescriptorTypeOp) - { - DescriptorTypeOp->Asl.CompileFlags |= NODE_IS_RESOURCE_DESC; - Rnode = RsDoOneResourceDescriptor (DescriptorTypeOp, CurrentByteOffset, - &State); - - /* - * Update current byte offset to indicate the number of bytes from the - * start of the buffer. Buffer can include multiple descriptors, we - * must keep track of the offset of not only each descriptor, but each - * element (field) within each descriptor as well. - */ - CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode, Rnode); - - /* Get the next descriptor in the list */ - - LastOp = DescriptorTypeOp; - DescriptorTypeOp = ASL_GET_PEER_NODE (DescriptorTypeOp); - } - - if (State == ACPI_RSTATE_DEPENDENT_LIST) - { - if (LastOp) - { - LastOp = LastOp->Asl.Parent; - } - AslError (ASL_ERROR, ASL_MSG_MISSING_ENDDEPENDENT, LastOp, NULL); - } - - /* - * Transform the nodes into the following - * - * Op -> AML_BUFFER_OP - * First Child -> BufferLength - * Second Child -> Descriptor Buffer (raw byte data) - */ - Op->Asl.ParseOpcode = PARSEOP_BUFFER; - Op->Asl.AmlOpcode = AML_BUFFER_OP; - Op->Asl.CompileFlags = NODE_AML_PACKAGE | NODE_IS_RESOURCE_DESC; - - BufferLengthOp->Asl.ParseOpcode = PARSEOP_INTEGER; - BufferLengthOp->Asl.Value.Integer = CurrentByteOffset; - (void) OpcSetOptimalIntegerSize (BufferLengthOp); - - BufferOp->Asl.ParseOpcode = PARSEOP_RAW_DATA; - BufferOp->Asl.AmlOpcode = AML_RAW_DATA_CHAIN; - BufferOp->Asl.AmlOpcodeLength = 0; - BufferOp->Asl.AmlLength = CurrentByteOffset; - BufferOp->Asl.Value.Buffer = (UINT8 *) HeadRnode.Next; - BufferOp->Asl.CompileFlags |= NODE_IS_RESOURCE_DATA; - - return; -} - - diff -Nru acpica-unix-20100528/compiler/aslrestype1.c acpica-unix-20140114/compiler/aslrestype1.c --- acpica-unix-20100528/compiler/aslrestype1.c 2010-05-28 17:14:25.000000000 +0000 +++ acpica-unix-20140114/compiler/aslrestype1.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,719 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslrestype1 - Miscellaneous small resource descriptors - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - - -#include "aslcompiler.h" -#include "aslcompiler.y.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslrestype1") - -/* - * This module contains miscellaneous small resource descriptors: - * - * EndTag - * EndDependentFn - * Memory24 - * Memory32 - * Memory32Fixed - * StartDependentFn - * StartDependentFnNoPri - * VendorShort - */ - -/******************************************************************************* - * - * FUNCTION: RsDoEndTagDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a short "EndDependentFn" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoEndTagDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ASL_RESOURCE_NODE *Rnode; - - - Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_END_TAG)); - - Descriptor = Rnode->Buffer; - Descriptor->EndTag.DescriptorType = ACPI_RESOURCE_NAME_END_TAG | - ASL_RDESC_END_TAG_SIZE; - Descriptor->EndTag.Checksum = 0; - - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoEndDependentDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a short "EndDependentFn" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoEndDependentDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ASL_RESOURCE_NODE *Rnode; - - - Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_END_DEPENDENT)); - - Descriptor = Rnode->Buffer; - Descriptor->EndDpf.DescriptorType = ACPI_RESOURCE_NAME_END_DEPENDENT | - ASL_RDESC_END_DEPEND_SIZE; - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoMemory24Descriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a short "Memory24" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoMemory24Descriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ACPI_PARSE_OBJECT *MinOp = NULL; - ACPI_PARSE_OBJECT *MaxOp = NULL; - ACPI_PARSE_OBJECT *LengthOp = NULL; - ACPI_PARSE_OBJECT *AlignOp = NULL; - ASL_RESOURCE_NODE *Rnode; - UINT32 i; - - - InitializerOp = Op->Asl.Child; - Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_MEMORY24)); - - Descriptor = Rnode->Buffer; - Descriptor->Memory24.DescriptorType = ACPI_RESOURCE_NAME_MEMORY24; - Descriptor->Memory24.ResourceLength = 9; - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Read/Write type */ - - RsSetFlagBits (&Descriptor->Memory24.Flags, InitializerOp, 0, 1); - RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Flags), 0); - break; - - case 1: /* Min Address */ - - Descriptor->Memory24.Minimum = (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Minimum)); - MinOp = InitializerOp; - break; - - case 2: /* Max Address */ - - Descriptor->Memory24.Maximum = (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Maximum)); - MaxOp = InitializerOp; - break; - - case 3: /* Alignment */ - - Descriptor->Memory24.Alignment = (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT, - CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Alignment)); - AlignOp = InitializerOp; - break; - - case 4: /* Length */ - - Descriptor->Memory24.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.AddressLength)); - LengthOp = InitializerOp; - break; - - case 5: /* Name */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Validate the Min/Max/Len/Align values (Alignment==0 means 64K) */ - - RsSmallAddressCheck (ACPI_RESOURCE_NAME_MEMORY24, - Descriptor->Memory24.Minimum, - Descriptor->Memory24.Maximum, - Descriptor->Memory24.AddressLength, - Descriptor->Memory24.Alignment, - MinOp, MaxOp, LengthOp, NULL); - - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoMemory32Descriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a short "Memory32" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoMemory32Descriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ACPI_PARSE_OBJECT *MinOp = NULL; - ACPI_PARSE_OBJECT *MaxOp = NULL; - ACPI_PARSE_OBJECT *LengthOp = NULL; - ACPI_PARSE_OBJECT *AlignOp = NULL; - ASL_RESOURCE_NODE *Rnode; - UINT32 i; - - - InitializerOp = Op->Asl.Child; - Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_MEMORY32)); - - Descriptor = Rnode->Buffer; - Descriptor->Memory32.DescriptorType = ACPI_RESOURCE_NAME_MEMORY32; - Descriptor->Memory32.ResourceLength = 17; - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Read/Write type */ - - RsSetFlagBits (&Descriptor->Memory32.Flags, InitializerOp, 0, 1); - RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Flags), 0); - break; - - case 1: /* Min Address */ - - Descriptor->Memory32.Minimum = (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Minimum)); - MinOp = InitializerOp; - break; - - case 2: /* Max Address */ - - Descriptor->Memory32.Maximum = (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Maximum)); - MaxOp = InitializerOp; - break; - - case 3: /* Alignment */ - - Descriptor->Memory32.Alignment = (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT, - CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Alignment)); - AlignOp = InitializerOp; - break; - - case 4: /* Length */ - - Descriptor->Memory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.AddressLength)); - LengthOp = InitializerOp; - break; - - case 5: /* Name */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Validate the Min/Max/Len/Align values */ - - RsSmallAddressCheck (ACPI_RESOURCE_NAME_MEMORY32, - Descriptor->Memory32.Minimum, - Descriptor->Memory32.Maximum, - Descriptor->Memory32.AddressLength, - Descriptor->Memory32.Alignment, - MinOp, MaxOp, LengthOp, AlignOp); - - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoMemory32FixedDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a short "Memory32Fixed" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoMemory32FixedDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ASL_RESOURCE_NODE *Rnode; - UINT32 i; - - - InitializerOp = Op->Asl.Child; - Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_FIXED_MEMORY32)); - - Descriptor = Rnode->Buffer; - Descriptor->FixedMemory32.DescriptorType = ACPI_RESOURCE_NAME_FIXED_MEMORY32; - Descriptor->FixedMemory32.ResourceLength = 9; - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Read/Write type */ - - RsSetFlagBits (&Descriptor->FixedMemory32.Flags, InitializerOp, 0, 1); - RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.Flags), 0); - break; - - case 1: /* Address */ - - Descriptor->FixedMemory32.Address = (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_BASEADDRESS, - CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.Address)); - break; - - case 2: /* Length */ - - Descriptor->FixedMemory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.AddressLength)); - break; - - case 3: /* Name */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoStartDependentDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a short "StartDependentFn" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoStartDependentDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ASL_RESOURCE_NODE *Rnode; - ASL_RESOURCE_NODE *PreviousRnode; - ASL_RESOURCE_NODE *NextRnode; - UINT32 i; - UINT8 State; - - - InitializerOp = Op->Asl.Child; - Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_START_DEPENDENT)); - - PreviousRnode = Rnode; - Descriptor = Rnode->Buffer; - - /* Descriptor has priority byte */ - - Descriptor->StartDpf.DescriptorType = ACPI_RESOURCE_NAME_START_DEPENDENT | - (ASL_RDESC_ST_DEPEND_SIZE + 0x01); - - /* Process all child initialization nodes */ - - State = ACPI_RSTATE_START_DEPENDENT; - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Compatibility Priority */ - - if ((UINT8) InitializerOp->Asl.Value.Integer > 2) - { - AslError (ASL_ERROR, ASL_MSG_INVALID_PRIORITY, - InitializerOp, NULL); - } - - RsSetFlagBits (&Descriptor->StartDpf.Flags, InitializerOp, 0, 0); - break; - - case 1: /* Performance/Robustness Priority */ - - if ((UINT8) InitializerOp->Asl.Value.Integer > 2) - { - AslError (ASL_ERROR, ASL_MSG_INVALID_PERFORMANCE, - InitializerOp, NULL); - } - - RsSetFlagBits (&Descriptor->StartDpf.Flags, InitializerOp, 2, 0); - break; - - default: - - NextRnode = RsDoOneResourceDescriptor (InitializerOp, - CurrentByteOffset, &State); - - /* - * Update current byte offset to indicate the number of bytes from the - * start of the buffer. Buffer can include multiple descriptors, we - * must keep track of the offset of not only each descriptor, but each - * element (field) within each descriptor as well. - */ - CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode, - NextRnode); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoStartDependentNoPriDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a short "StartDependentNoPri" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoStartDependentNoPriDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ASL_RESOURCE_NODE *Rnode; - ASL_RESOURCE_NODE *PreviousRnode; - ASL_RESOURCE_NODE *NextRnode; - UINT8 State; - - - InitializerOp = Op->Asl.Child; - Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_START_DEPENDENT_NOPRIO)); - - Descriptor = Rnode->Buffer; - Descriptor->StartDpf.DescriptorType = ACPI_RESOURCE_NAME_START_DEPENDENT | - ASL_RDESC_ST_DEPEND_SIZE; - PreviousRnode = Rnode; - - /* Process all child initialization nodes */ - - State = ACPI_RSTATE_START_DEPENDENT; - while (InitializerOp) - { - NextRnode = RsDoOneResourceDescriptor (InitializerOp, - CurrentByteOffset, &State); - - /* - * Update current byte offset to indicate the number of bytes from the - * start of the buffer. Buffer can include multiple descriptors, we - * must keep track of the offset of not only each descriptor, but each - * element (field) within each descriptor as well. - */ - CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode, NextRnode); - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoVendorSmallDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a short "VendorShort" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoVendorSmallDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ASL_RESOURCE_NODE *Rnode; - UINT8 *VendorData; - UINT32 i; - - - InitializerOp = Op->Asl.Child; - - /* Allocate worst case - 7 vendor bytes */ - - Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_VENDOR_SMALL) + 7); - - Descriptor = Rnode->Buffer; - Descriptor->VendorSmall.DescriptorType = ACPI_RESOURCE_NAME_VENDOR_SMALL; - VendorData = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_SMALL_HEADER); - - /* Process all child initialization nodes */ - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - for (i = 0; InitializerOp; i++) - { - if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) - { - break; - } - - /* Maximum 7 vendor data bytes allowed (0-6) */ - - if (i >= 7) - { - AslError (ASL_ERROR, ASL_MSG_VENDOR_LIST, InitializerOp, NULL); - - /* Eat the excess initializers */ - - while (InitializerOp) - { - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - break; - } - - VendorData[i] = (UINT8) InitializerOp->Asl.Value.Integer; - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Adjust the Rnode buffer size, so correct number of bytes are emitted */ - - Rnode->BufferLength -= (7 - i); - - /* Set the length in the Type Tag */ - - Descriptor->VendorSmall.DescriptorType |= (UINT8) i; - return (Rnode); -} - diff -Nru acpica-unix-20100528/compiler/aslrestype1i.c acpica-unix-20140114/compiler/aslrestype1i.c --- acpica-unix-20100528/compiler/aslrestype1i.c 2010-05-28 17:14:25.000000000 +0000 +++ acpica-unix-20140114/compiler/aslrestype1i.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,668 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslrestype1i - Small I/O-related resource descriptors - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - - -#include "aslcompiler.h" -#include "aslcompiler.y.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslrestype1i") - -/* - * This module contains the I/O-related small resource descriptors: - * - * DMA - * FixedIO - * IO - * IRQ - * IRQNoFlags - */ - -/******************************************************************************* - * - * FUNCTION: RsDoDmaDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a short "DMA" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoDmaDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ASL_RESOURCE_NODE *Rnode; - UINT32 i; - UINT8 DmaChannelMask = 0; - UINT8 DmaChannels = 0; - - - InitializerOp = Op->Asl.Child; - Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_DMA)); - - Descriptor = Rnode->Buffer; - Descriptor->Dma.DescriptorType = ACPI_RESOURCE_NAME_DMA | - ASL_RDESC_DMA_SIZE; - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* DMA type */ - - RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 5, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_DMATYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 5); - break; - - case 1: /* Bus Master */ - - RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 2, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_BUSMASTER, - CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 2); - break; - - case 2: /* Xfer Type (transfer width) */ - - RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 0, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_XFERTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 0); - break; - - case 3: /* Name */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - default: - - /* All DMA channel bytes are handled here, after flags and name */ - - if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - /* Up to 8 channels can be specified in the list */ - - DmaChannels++; - if (DmaChannels > 8) - { - AslError (ASL_ERROR, ASL_MSG_DMA_LIST, - InitializerOp, NULL); - return (Rnode); - } - - /* Only DMA channels 0-7 are allowed (mask is 8 bits) */ - - if (InitializerOp->Asl.Value.Integer > 7) - { - AslError (ASL_ERROR, ASL_MSG_DMA_CHANNEL, - InitializerOp, NULL); - } - - /* Build the mask */ - - DmaChannelMask |= - (1 << ((UINT8) InitializerOp->Asl.Value.Integer)); - } - - if (i == 4) /* case 4: First DMA byte */ - { - /* Check now for duplicates in list */ - - RsCheckListForDuplicates (InitializerOp); - - /* Create a named field at the start of the list */ - - RsCreateByteField (InitializerOp, ACPI_RESTAG_DMA, - CurrentByteOffset + - ASL_RESDESC_OFFSET (Dma.DmaChannelMask)); - } - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Now we can set the channel mask */ - - Descriptor->Dma.DmaChannelMask = DmaChannelMask; - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoFixedIoDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a short "FixedIO" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoFixedIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ACPI_PARSE_OBJECT *AddressOp = NULL; - ASL_RESOURCE_NODE *Rnode; - UINT32 i; - - - InitializerOp = Op->Asl.Child; - Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_FIXED_IO)); - - Descriptor = Rnode->Buffer; - Descriptor->Io.DescriptorType = ACPI_RESOURCE_NAME_FIXED_IO | - ASL_RDESC_FIXED_IO_SIZE; - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Base Address */ - - Descriptor->FixedIo.Address = - (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_BASEADDRESS, - CurrentByteOffset + ASL_RESDESC_OFFSET (FixedIo.Address)); - AddressOp = InitializerOp; - break; - - case 1: /* Length */ - - Descriptor->FixedIo.AddressLength = - (UINT8) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (FixedIo.AddressLength)); - break; - - case 2: /* Name */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Error checks */ - - if (Descriptor->FixedIo.Address > 0x03FF) - { - AslError (ASL_WARNING, ASL_MSG_ISA_ADDRESS, AddressOp, NULL); - } - - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoIoDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a short "IO" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ACPI_PARSE_OBJECT *MinOp = NULL; - ACPI_PARSE_OBJECT *MaxOp = NULL; - ACPI_PARSE_OBJECT *LengthOp = NULL; - ACPI_PARSE_OBJECT *AlignOp = NULL; - ASL_RESOURCE_NODE *Rnode; - UINT32 i; - - - InitializerOp = Op->Asl.Child; - Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IO)); - - Descriptor = Rnode->Buffer; - Descriptor->Io.DescriptorType = ACPI_RESOURCE_NAME_IO | - ASL_RDESC_IO_SIZE; - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Decode size */ - - RsSetFlagBits (&Descriptor->Io.Flags, InitializerOp, 0, 1); - RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Flags), 0); - break; - - case 1: /* Min Address */ - - Descriptor->Io.Minimum = - (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Minimum)); - MinOp = InitializerOp; - break; - - case 2: /* Max Address */ - - Descriptor->Io.Maximum = - (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Maximum)); - MaxOp = InitializerOp; - break; - - case 3: /* Alignment */ - - Descriptor->Io.Alignment = - (UINT8) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT, - CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Alignment)); - AlignOp = InitializerOp; - break; - - case 4: /* Length */ - - Descriptor->Io.AddressLength = - (UINT8) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (Io.AddressLength)); - LengthOp = InitializerOp; - break; - - case 5: /* Name */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Validate the Min/Max/Len/Align values */ - - RsSmallAddressCheck (ACPI_RESOURCE_NAME_IO, - Descriptor->Io.Minimum, - Descriptor->Io.Maximum, - Descriptor->Io.AddressLength, - Descriptor->Io.Alignment, - MinOp, MaxOp, LengthOp, AlignOp); - - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoIrqDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a short "IRQ" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoIrqDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ASL_RESOURCE_NODE *Rnode; - UINT32 Interrupts = 0; - UINT16 IrqMask = 0; - UINT32 i; - - - InitializerOp = Op->Asl.Child; - Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IRQ)); - - /* Length = 3 (with flag byte) */ - - Descriptor = Rnode->Buffer; - Descriptor->Irq.DescriptorType = ACPI_RESOURCE_NAME_IRQ | - (ASL_RDESC_IRQ_SIZE + 0x01); - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Interrupt Type (or Mode - edge/level) */ - - RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 0, 1); - RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 0); - break; - - case 1: /* Interrupt Level (or Polarity - Active high/low) */ - - RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTLEVEL, - CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 3); - break; - - case 2: /* Share Type - Default: exclusive (0) */ - - RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 4, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 4); - break; - - case 3: /* Name */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - default: - - /* All IRQ bytes are handled here, after the flags and name */ - - if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - /* Up to 16 interrupts can be specified in the list */ - - Interrupts++; - if (Interrupts > 16) - { - AslError (ASL_ERROR, ASL_MSG_INTERRUPT_LIST, - InitializerOp, NULL); - return (Rnode); - } - - /* Only interrupts 0-15 are allowed (mask is 16 bits) */ - - if (InitializerOp->Asl.Value.Integer > 15) - { - AslError (ASL_ERROR, ASL_MSG_INTERRUPT_NUMBER, - InitializerOp, NULL); - } - else - { - IrqMask |= (1 << (UINT8) InitializerOp->Asl.Value.Integer); - } - } - - /* Case 4: First IRQ value in list */ - - if (i == 4) - { - /* Check now for duplicates in list */ - - RsCheckListForDuplicates (InitializerOp); - - /* Create a named field at the start of the list */ - - RsCreateByteField (InitializerOp, ACPI_RESTAG_INTERRUPT, - CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.IrqMask)); - } - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Now we can set the channel mask */ - - Descriptor->Irq.IrqMask = IrqMask; - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoIrqNoFlagsDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a short "IRQNoFlags" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoIrqNoFlagsDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ASL_RESOURCE_NODE *Rnode; - UINT16 IrqMask = 0; - UINT32 Interrupts = 0; - UINT32 i; - - - InitializerOp = Op->Asl.Child; - Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IRQ_NOFLAGS)); - - Descriptor = Rnode->Buffer; - Descriptor->Irq.DescriptorType = ACPI_RESOURCE_NAME_IRQ | - ASL_RDESC_IRQ_SIZE; - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Name */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - default: - - /* IRQ bytes are handled here, after the flags and name */ - - if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - /* Up to 16 interrupts can be specified in the list */ - - Interrupts++; - if (Interrupts > 16) - { - AslError (ASL_ERROR, ASL_MSG_INTERRUPT_LIST, - InitializerOp, NULL); - return (Rnode); - } - - /* Only interrupts 0-15 are allowed (mask is 16 bits) */ - - if (InitializerOp->Asl.Value.Integer > 15) - { - AslError (ASL_ERROR, ASL_MSG_INTERRUPT_NUMBER, - InitializerOp, NULL); - } - else - { - IrqMask |= (1 << ((UINT8) InitializerOp->Asl.Value.Integer)); - } - } - - /* Case 1: First IRQ value in list */ - - if (i == 1) - { - /* Check now for duplicates in list */ - - RsCheckListForDuplicates (InitializerOp); - - /* Create a named field at the start of the list */ - - RsCreateByteField (InitializerOp, ACPI_RESTAG_INTERRUPT, - CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.IrqMask)); - } - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Now we can set the interrupt mask */ - - Descriptor->Irq.IrqMask = IrqMask; - return (Rnode); -} diff -Nru acpica-unix-20100528/compiler/aslrestype2.c acpica-unix-20140114/compiler/aslrestype2.c --- acpica-unix-20100528/compiler/aslrestype2.c 2010-05-28 17:14:25.000000000 +0000 +++ acpica-unix-20140114/compiler/aslrestype2.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,534 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslrestype2 - Miscellaneous Large resource descriptors - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - - -#include "aslcompiler.h" -#include "aslcompiler.y.h" -#include "amlcode.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslrestype2") - -/* - * This module contains miscellaneous large resource descriptors: - * - * Register - * Interrupt - * VendorLong - */ - -/******************************************************************************* - * - * FUNCTION: RsDoGeneralRegisterDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a long "Register" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoGeneralRegisterDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ASL_RESOURCE_NODE *Rnode; - UINT32 i; - - - InitializerOp = Op->Asl.Child; - Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_GENERIC_REGISTER)); - - Descriptor = Rnode->Buffer; - Descriptor->GenericReg.DescriptorType = ACPI_RESOURCE_NAME_GENERIC_REGISTER; - Descriptor->GenericReg.ResourceLength = 12; - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Address space */ - - Descriptor->GenericReg.AddressSpaceId = (UINT8) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_ADDRESSSPACE, - CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.AddressSpaceId)); - break; - - case 1: /* Register Bit Width */ - - Descriptor->GenericReg.BitWidth = (UINT8) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_REGISTERBITWIDTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.BitWidth)); - break; - - case 2: /* Register Bit Offset */ - - Descriptor->GenericReg.BitOffset = (UINT8) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_REGISTERBITOFFSET, - CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.BitOffset)); - break; - - case 3: /* Register Address */ - - Descriptor->GenericReg.Address = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_ADDRESS, - CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.Address)); - break; - - case 4: /* Access Size (ACPI 3.0) */ - - Descriptor->GenericReg.AccessSize = (UINT8) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_ACCESSSIZE, - CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.AccessSize)); - - if (Descriptor->GenericReg.AccessSize > AML_FIELD_ACCESS_QWORD) - { - AslError (ASL_ERROR, ASL_MSG_INVALID_ACCESS_SIZE, - InitializerOp, NULL); - } - break; - - case 5: /* ResourceTag (ACPI 3.0b) */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoInterruptDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a long "Interrupt" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoInterruptDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - AML_RESOURCE *Rover = NULL; - ACPI_PARSE_OBJECT *InitializerOp; - ASL_RESOURCE_NODE *Rnode; - UINT16 StringLength = 0; - UINT32 OptionIndex = 0; - UINT32 i; - BOOLEAN HasResSourceIndex = FALSE; - UINT8 ResSourceIndex = 0; - UINT8 *ResSourceString = NULL; - - - InitializerOp = Op->Asl.Child; - StringLength = RsGetStringDataLength (InitializerOp); - - /* Count the interrupt numbers */ - - for (i = 0; InitializerOp; i++) - { - InitializerOp = ASL_GET_PEER_NODE (InitializerOp); - - if (i <= 6) - { - if (i == 3 && - InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - /* - * ResourceSourceIndex was specified, always make room for - * it, even if the ResourceSource was omitted. - */ - OptionIndex++; - } - - continue; - } - - OptionIndex += 4; - } - - InitializerOp = Op->Asl.Child; - Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_EXTENDED_IRQ) + - 1 + OptionIndex + StringLength); - - Descriptor = Rnode->Buffer; - Descriptor->ExtendedIrq.DescriptorType = ACPI_RESOURCE_NAME_EXTENDED_IRQ; - - /* - * Initial descriptor length -- may be enlarged if there are - * optional fields present - */ - Descriptor->ExtendedIrq.ResourceLength = 2; /* Flags and table length byte */ - Descriptor->ExtendedIrq.InterruptCount = 0; - - Rover = ACPI_CAST_PTR (AML_RESOURCE, - (&(Descriptor->ExtendedIrq.Interrupts[0]))); - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Resource Usage (Default: consumer (1) */ - - RsSetFlagBits (&Descriptor->ExtendedIrq.Flags, InitializerOp, 0, 1); - break; - - case 1: /* Interrupt Type (or Mode - edge/level) */ - - RsSetFlagBits (&Descriptor->ExtendedIrq.Flags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtendedIrq.Flags), 1); - break; - - case 2: /* Interrupt Level (or Polarity - Active high/low) */ - - RsSetFlagBits (&Descriptor->ExtendedIrq.Flags, InitializerOp, 2, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTLEVEL, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtendedIrq.Flags), 2); - break; - - case 3: /* Share Type - Default: exclusive (0) */ - - RsSetFlagBits (&Descriptor->ExtendedIrq.Flags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtendedIrq.Flags), 3); - break; - - case 4: /* ResSourceIndex [Optional Field - BYTE] */ - - if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - HasResSourceIndex = TRUE; - ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer; - } - break; - - case 5: /* ResSource [Optional Field - STRING] */ - - if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) && - (InitializerOp->Asl.Value.String)) - { - if (StringLength) - { - ResSourceString = (UINT8 *) InitializerOp->Asl.Value.String; - } - - /* ResourceSourceIndex must also be valid */ - - if (!HasResSourceIndex) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX, - InitializerOp, NULL); - } - } - -#if 0 - /* - * Not a valid ResourceSource, ResourceSourceIndex must also - * be invalid - */ - else if (HasResSourceIndex) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE, - InitializerOp, NULL); - } -#endif - break; - - case 6: /* ResourceTag */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - default: - /* - * Interrupt Numbers come through here, repeatedly - */ - - /* Maximum 255 interrupts allowed for this descriptor */ - - if (Descriptor->ExtendedIrq.InterruptCount == 255) - { - AslError (ASL_ERROR, ASL_MSG_EX_INTERRUPT_LIST, - InitializerOp, NULL); - return (Rnode); - } - - /* Each interrupt number must be a 32-bit value */ - - if (InitializerOp->Asl.Value.Integer > ACPI_UINT32_MAX) - { - AslError (ASL_ERROR, ASL_MSG_EX_INTERRUPT_NUMBER, - InitializerOp, NULL); - } - - /* Save the integer and move pointer to the next one */ - - Rover->DwordItem = (UINT32) InitializerOp->Asl.Value.Integer; - Rover = ACPI_ADD_PTR (AML_RESOURCE, &(Rover->DwordItem), 4); - Descriptor->ExtendedIrq.InterruptCount++; - Descriptor->ExtendedIrq.ResourceLength += 4; - - /* Case 7: First interrupt number in list */ - - if (i == 7) - { - if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) - { - /* Must be at least one interrupt */ - - AslError (ASL_ERROR, ASL_MSG_EX_INTERRUPT_LIST_MIN, - InitializerOp, NULL); - } - - /* Check now for duplicates in list */ - - RsCheckListForDuplicates (InitializerOp); - - /* Create a named field at the start of the list */ - - RsCreateByteField (InitializerOp, ACPI_RESTAG_INTERRUPT, - CurrentByteOffset + - ASL_RESDESC_OFFSET (ExtendedIrq.Interrupts[0])); - } - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - - /* Add optional ResSourceIndex if present */ - - if (HasResSourceIndex) - { - Rover->ByteItem = ResSourceIndex; - Rover = ACPI_ADD_PTR (AML_RESOURCE, &(Rover->ByteItem), 1); - Descriptor->ExtendedIrq.ResourceLength += 1; - } - - /* Add optional ResSource string if present */ - - if (StringLength && ResSourceString) - { - - strcpy ((char *) Rover, (char *) ResSourceString); - Rover = ACPI_ADD_PTR ( - AML_RESOURCE, &(Rover->ByteItem), StringLength); - - Descriptor->ExtendedIrq.ResourceLength = (UINT16) - (Descriptor->ExtendedIrq.ResourceLength + StringLength); - } - - Rnode->BufferLength = (ASL_RESDESC_OFFSET (ExtendedIrq.Interrupts[0]) - - ASL_RESDESC_OFFSET (ExtendedIrq.DescriptorType)) - + OptionIndex + StringLength; - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoVendorLargeDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a long "VendorLong" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoVendorLargeDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ASL_RESOURCE_NODE *Rnode; - UINT8 *VendorData; - UINT32 i; - - - /* Count the number of data bytes */ - - InitializerOp = Op->Asl.Child; - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - - for (i = 0; InitializerOp; i++) - { - if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) - { - break; - } - InitializerOp = InitializerOp->Asl.Next; - } - - InitializerOp = Op->Asl.Child; - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_VENDOR_LARGE) + i); - - Descriptor = Rnode->Buffer; - Descriptor->VendorLarge.DescriptorType = ACPI_RESOURCE_NAME_VENDOR_LARGE; - Descriptor->VendorLarge.ResourceLength = (UINT16) i; - - /* Point to end-of-descriptor for vendor data */ - - VendorData = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_LARGE_HEADER); - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) - { - break; - } - - VendorData[i] = (UINT8) InitializerOp->Asl.Value.Integer; - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - return (Rnode); -} diff -Nru acpica-unix-20100528/compiler/aslrestype2d.c acpica-unix-20140114/compiler/aslrestype2d.c --- acpica-unix-20100528/compiler/aslrestype2d.c 2010-05-28 17:14:25.000000000 +0000 +++ acpica-unix-20140114/compiler/aslrestype2d.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,814 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslrestype2d - Large DWord address resource descriptors - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - - -#include "aslcompiler.h" -#include "aslcompiler.y.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslrestype2d") - -/* - * This module contains the Dword (32-bit) address space descriptors: - * - * DwordIO - * DwordMemory - * DwordSpace - */ - -/******************************************************************************* - * - * FUNCTION: RsDoDwordIoDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a long "DwordIO" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoDwordIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ACPI_PARSE_OBJECT *MinOp = NULL; - ACPI_PARSE_OBJECT *MaxOp = NULL; - ACPI_PARSE_OBJECT *LengthOp = NULL; - ACPI_PARSE_OBJECT *GranOp = NULL; - ASL_RESOURCE_NODE *Rnode; - UINT16 StringLength = 0; - UINT32 OptionIndex = 0; - UINT8 *OptionalFields; - UINT32 i; - BOOLEAN ResSourceIndex = FALSE; - - - InitializerOp = Op->Asl.Child; - StringLength = RsGetStringDataLength (InitializerOp); - - Rnode = RsAllocateResourceNode ( - sizeof (AML_RESOURCE_ADDRESS32) + 1 + StringLength); - - Descriptor = Rnode->Buffer; - Descriptor->Address32.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS32; - Descriptor->Address32.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE; - - /* - * Initial descriptor length -- may be enlarged if there are - * optional fields present - */ - OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS32); - Descriptor->Address32.ResourceLength = (UINT16) - (sizeof (AML_RESOURCE_ADDRESS32) - - sizeof (AML_RESOURCE_LARGE_HEADER)); - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Resource Usage */ - - RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 0, 1); - break; - - case 1: /* MinType */ - - RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 2, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 2); - break; - - case 2: /* MaxType */ - - RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 3); - break; - - case 3: /* DecodeType */ - - RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 1); - break; - - case 4: /* Range Type */ - - RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 0, 3); - RsCreateBitField (InitializerOp, ACPI_RESTAG_RANGETYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 0); - break; - - case 5: /* Address Granularity */ - - Descriptor->Address32.Granularity = - (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity)); - GranOp = InitializerOp; - break; - - case 6: /* Address Min */ - - Descriptor->Address32.Minimum = - (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum)); - MinOp = InitializerOp; - break; - - case 7: /* Address Max */ - - Descriptor->Address32.Maximum = - (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum)); - MaxOp = InitializerOp; - break; - - case 8: /* Translation Offset */ - - Descriptor->Address32.TranslationOffset = - (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset)); - break; - - case 9: /* Address Length */ - - Descriptor->Address32.AddressLength = - (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength)); - LengthOp = InitializerOp; - break; - - case 10: /* ResSourceIndex [Optional Field - BYTE] */ - - if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - /* Found a valid ResourceSourceIndex */ - - OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer; - OptionIndex++; - Descriptor->Address32.ResourceLength++; - ResSourceIndex = TRUE; - } - break; - - case 11: /* ResSource [Optional Field - STRING] */ - - if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) && - (InitializerOp->Asl.Value.String)) - { - if (StringLength) - { - /* Found a valid ResourceSource */ - - Descriptor->Address32.ResourceLength = (UINT16) - (Descriptor->Address32.ResourceLength + StringLength); - - strcpy ((char *) - &OptionalFields[OptionIndex], - InitializerOp->Asl.Value.String); - - /* ResourceSourceIndex must also be valid */ - - if (!ResSourceIndex) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX, - InitializerOp, NULL); - } - } - } - -#if 0 - /* - * Not a valid ResourceSource, ResourceSourceIndex must also - * be invalid - */ - else if (ResSourceIndex) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE, - InitializerOp, NULL); - } -#endif - break; - - case 12: /* ResourceTag */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - case 13: /* Type */ - - RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 4, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 4); - break; - - case 14: /* Translation Type */ - - RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 5, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_TRANSTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 5); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Validate the Min/Max/Len/Gran values */ - - RsLargeAddressCheck ( - Descriptor->Address32.Minimum, - Descriptor->Address32.Maximum, - Descriptor->Address32.AddressLength, - Descriptor->Address32.Granularity, - Descriptor->Address32.Flags, - MinOp, MaxOp, LengthOp, GranOp); - - Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) + - OptionIndex + StringLength; - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoDwordMemoryDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a long "DwordMemory" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoDwordMemoryDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ACPI_PARSE_OBJECT *MinOp = NULL; - ACPI_PARSE_OBJECT *MaxOp = NULL; - ACPI_PARSE_OBJECT *LengthOp = NULL; - ACPI_PARSE_OBJECT *GranOp = NULL; - ASL_RESOURCE_NODE *Rnode; - UINT8 *OptionalFields; - UINT16 StringLength = 0; - UINT32 OptionIndex = 0; - UINT32 i; - BOOLEAN ResSourceIndex = FALSE; - - - InitializerOp = Op->Asl.Child; - StringLength = RsGetStringDataLength (InitializerOp); - - Rnode = RsAllocateResourceNode ( - sizeof (AML_RESOURCE_ADDRESS32) + 1 + StringLength); - - Descriptor = Rnode->Buffer; - Descriptor->Address32.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS32; - Descriptor->Address32.ResourceType = ACPI_ADDRESS_TYPE_MEMORY_RANGE; - - /* - * Initial descriptor length -- may be enlarged if there are - * optional fields present - */ - OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS32); - Descriptor->Address32.ResourceLength = (UINT16) - (sizeof (AML_RESOURCE_ADDRESS32) - - sizeof (AML_RESOURCE_LARGE_HEADER)); - - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Resource Usage */ - - RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 0, 1); - break; - - case 1: /* DecodeType */ - - RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 1); - break; - - case 2: /* MinType */ - - RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 2, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 2); - break; - - case 3: /* MaxType */ - - RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 3); - break; - - case 4: /* Memory Type */ - - RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 1); - break; - - case 5: /* Read/Write Type */ - - RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 0, 1); - RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 0); - break; - - case 6: /* Address Granularity */ - - Descriptor->Address32.Granularity = - (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity)); - GranOp = InitializerOp; - break; - - case 7: /* Min Address */ - - Descriptor->Address32.Minimum = - (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum)); - MinOp = InitializerOp; - break; - - case 8: /* Max Address */ - - Descriptor->Address32.Maximum = - (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum)); - MaxOp = InitializerOp; - break; - - case 9: /* Translation Offset */ - - Descriptor->Address32.TranslationOffset = - (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset)); - break; - - case 10: /* Address Length */ - - Descriptor->Address32.AddressLength = - (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength)); - LengthOp = InitializerOp; - break; - - case 11: /* ResSourceIndex [Optional Field - BYTE] */ - - if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer; - OptionIndex++; - Descriptor->Address32.ResourceLength++; - ResSourceIndex = TRUE; - } - break; - - case 12: /* ResSource [Optional Field - STRING] */ - - if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) && - (InitializerOp->Asl.Value.String)) - { - if (StringLength) - { - Descriptor->Address32.ResourceLength = (UINT16) - (Descriptor->Address32.ResourceLength + StringLength); - - strcpy ((char *) - &OptionalFields[OptionIndex], - InitializerOp->Asl.Value.String); - - /* ResourceSourceIndex must also be valid */ - - if (!ResSourceIndex) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX, - InitializerOp, NULL); - } - } - } - -#if 0 - /* - * Not a valid ResourceSource, ResourceSourceIndex must also - * be invalid - */ - else if (ResSourceIndex) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE, - InitializerOp, NULL); - } -#endif - break; - - case 13: /* ResourceTag */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - - case 14: /* Address Range */ - - RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMATTRIBUTES, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 3); - break; - - case 15: /* Type */ - - RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 5, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 5); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Validate the Min/Max/Len/Gran values */ - - RsLargeAddressCheck ( - Descriptor->Address32.Minimum, - Descriptor->Address32.Maximum, - Descriptor->Address32.AddressLength, - Descriptor->Address32.Granularity, - Descriptor->Address32.Flags, - MinOp, MaxOp, LengthOp, GranOp); - - Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) + - OptionIndex + StringLength; - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoDwordSpaceDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a long "DwordSpace" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoDwordSpaceDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ACPI_PARSE_OBJECT *MinOp = NULL; - ACPI_PARSE_OBJECT *MaxOp = NULL; - ACPI_PARSE_OBJECT *LengthOp = NULL; - ACPI_PARSE_OBJECT *GranOp = NULL; - ASL_RESOURCE_NODE *Rnode; - UINT8 *OptionalFields; - UINT16 StringLength = 0; - UINT32 OptionIndex = 0; - UINT32 i; - BOOLEAN ResSourceIndex = FALSE; - - - InitializerOp = Op->Asl.Child; - StringLength = RsGetStringDataLength (InitializerOp); - - Rnode = RsAllocateResourceNode ( - sizeof (AML_RESOURCE_ADDRESS32) + 1 + StringLength); - - Descriptor = Rnode->Buffer; - Descriptor->Address32.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS32; - - /* - * Initial descriptor length -- may be enlarged if there are - * optional fields present - */ - OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS32); - Descriptor->Address32.ResourceLength = (UINT16) - (sizeof (AML_RESOURCE_ADDRESS32) - - sizeof (AML_RESOURCE_LARGE_HEADER)); - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Resource Type */ - - Descriptor->Address32.ResourceType = - (UINT8) InitializerOp->Asl.Value.Integer; - break; - - case 1: /* Resource Usage */ - - RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 0, 1); - break; - - case 2: /* DecodeType */ - - RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 1); - break; - - case 3: /* MinType */ - - RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 2, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 2); - break; - - case 4: /* MaxType */ - - RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 3); - break; - - case 5: /* Type-Specific flags */ - - Descriptor->Address32.SpecificFlags = - (UINT8) InitializerOp->Asl.Value.Integer; - break; - - case 6: /* Address Granularity */ - - Descriptor->Address32.Granularity = - (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity)); - GranOp = InitializerOp; - break; - - case 7: /* Min Address */ - - Descriptor->Address32.Minimum = - (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum)); - MinOp = InitializerOp; - break; - - case 8: /* Max Address */ - - Descriptor->Address32.Maximum = - (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum)); - MaxOp = InitializerOp; - break; - - case 9: /* Translation Offset */ - - Descriptor->Address32.TranslationOffset = - (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset)); - break; - - case 10: /* Address Length */ - - Descriptor->Address32.AddressLength = - (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength)); - LengthOp = InitializerOp; - break; - - case 11: /* ResSourceIndex [Optional Field - BYTE] */ - - if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer; - OptionIndex++; - Descriptor->Address32.ResourceLength++; - ResSourceIndex = TRUE; - } - break; - - case 12: /* ResSource [Optional Field - STRING] */ - - if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) && - (InitializerOp->Asl.Value.String)) - { - if (StringLength) - { - Descriptor->Address32.ResourceLength = (UINT16) - (Descriptor->Address32.ResourceLength + StringLength); - - strcpy ((char *) - &OptionalFields[OptionIndex], - InitializerOp->Asl.Value.String); - - /* ResourceSourceIndex must also be valid */ - - if (!ResSourceIndex) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX, - InitializerOp, NULL); - } - } - } - -#if 0 - /* - * Not a valid ResourceSource, ResourceSourceIndex must also - * be invalid - */ - else if (ResSourceIndex) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE, - InitializerOp, NULL); - } -#endif - break; - - case 13: /* ResourceTag */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, - InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Validate the Min/Max/Len/Gran values */ - - RsLargeAddressCheck ( - Descriptor->Address32.Minimum, - Descriptor->Address32.Maximum, - Descriptor->Address32.AddressLength, - Descriptor->Address32.Granularity, - Descriptor->Address32.Flags, - MinOp, MaxOp, LengthOp, GranOp); - - Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) + - OptionIndex + StringLength; - return (Rnode); -} diff -Nru acpica-unix-20100528/compiler/aslrestype2e.c acpica-unix-20140114/compiler/aslrestype2e.c --- acpica-unix-20100528/compiler/aslrestype2e.c 2010-05-28 17:14:25.000000000 +0000 +++ acpica-unix-20140114/compiler/aslrestype2e.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,646 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslrestype2e - Large Extended address resource descriptors - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - - -#include "aslcompiler.h" -#include "aslcompiler.y.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslrestype2e") - -/* - * This module contains the Extended (64-bit) address space descriptors: - * - * ExtendedIO - * ExtendedMemory - * ExtendedSpace - */ - -/******************************************************************************* - * - * FUNCTION: RsDoExtendedIoDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a long "ExtendedIO" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoExtendedIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ACPI_PARSE_OBJECT *MinOp = NULL; - ACPI_PARSE_OBJECT *MaxOp = NULL; - ACPI_PARSE_OBJECT *LengthOp = NULL; - ACPI_PARSE_OBJECT *GranOp = NULL; - ASL_RESOURCE_NODE *Rnode; - UINT16 StringLength = 0; - UINT32 i; - - - InitializerOp = Op->Asl.Child; - StringLength = RsGetStringDataLength (InitializerOp); - - Rnode = RsAllocateResourceNode ( - sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + 1 + StringLength); - - Descriptor = Rnode->Buffer; - Descriptor->ExtAddress64.DescriptorType = ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64; - Descriptor->ExtAddress64.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE; - Descriptor->ExtAddress64.RevisionID = AML_RESOURCE_EXTENDED_ADDRESS_REVISION; - - Descriptor->ExtAddress64.ResourceLength = (UINT16) - (sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) - - sizeof (AML_RESOURCE_LARGE_HEADER)); - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Resource Usage */ - - RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 0, 1); - break; - - case 1: /* MinType */ - - RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 2, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 2); - break; - - case 2: /* MaxType */ - - RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 3); - break; - - case 3: /* DecodeType */ - - RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 1); - break; - - case 4: /* Range Type */ - - RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 0, 3); - RsCreateBitField (InitializerOp, ACPI_RESTAG_RANGETYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 0); - break; - - case 5: /* Address Granularity */ - - Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity)); - GranOp = InitializerOp; - break; - - case 6: /* Address Min */ - - Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum)); - MinOp = InitializerOp; - break; - - case 7: /* Address Max */ - - Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum)); - MaxOp = InitializerOp; - break; - - case 8: /* Translation Offset */ - - Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset)); - break; - - case 9: /* Address Length */ - - Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength)); - LengthOp = InitializerOp; - break; - - case 10: /* Type-Specific Attributes */ - - Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific)); - break; - - case 11: /* ResourceTag */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - case 12: /* Type */ - - RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 4, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 4); - break; - - case 13: /* Translation Type */ - - RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 5, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_TRANSTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 5); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Validate the Min/Max/Len/Gran values */ - - RsLargeAddressCheck ( - Descriptor->ExtAddress64.Minimum, - Descriptor->ExtAddress64.Maximum, - Descriptor->ExtAddress64.AddressLength, - Descriptor->ExtAddress64.Granularity, - Descriptor->ExtAddress64.Flags, - MinOp, MaxOp, LengthOp, GranOp); - - Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + StringLength; - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoExtendedMemoryDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a long "ExtendedMemory" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoExtendedMemoryDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ACPI_PARSE_OBJECT *MinOp = NULL; - ACPI_PARSE_OBJECT *MaxOp = NULL; - ACPI_PARSE_OBJECT *LengthOp = NULL; - ACPI_PARSE_OBJECT *GranOp = NULL; - ASL_RESOURCE_NODE *Rnode; - UINT16 StringLength = 0; - UINT32 i; - - - InitializerOp = Op->Asl.Child; - StringLength = RsGetStringDataLength (InitializerOp); - - Rnode = RsAllocateResourceNode ( - sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + 1 + StringLength); - - Descriptor = Rnode->Buffer; - Descriptor->ExtAddress64.DescriptorType = ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64; - Descriptor->ExtAddress64.ResourceType = ACPI_ADDRESS_TYPE_MEMORY_RANGE; - Descriptor->ExtAddress64.RevisionID = AML_RESOURCE_EXTENDED_ADDRESS_REVISION; - - Descriptor->ExtAddress64.ResourceLength = (UINT16) - (sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) - - sizeof (AML_RESOURCE_LARGE_HEADER)); - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Resource Usage */ - - RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 0, 1); - break; - - case 1: /* DecodeType */ - - RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 1); - break; - - case 2: /* MinType */ - - RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 2, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 2); - break; - - case 3: /* MaxType */ - - RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 3); - break; - - case 4: /* Memory Type */ - - RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 1); - break; - - case 5: /* Read/Write Type */ - - RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 0, 1); - RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 0); - break; - - case 6: /* Address Granularity */ - - Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity)); - GranOp = InitializerOp; - break; - - case 7: /* Min Address */ - - Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum)); - MinOp = InitializerOp; - break; - - case 8: /* Max Address */ - - Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum)); - MaxOp = InitializerOp; - break; - - case 9: /* Translation Offset */ - - Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset)); - break; - - case 10: /* Address Length */ - - Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength)); - LengthOp = InitializerOp; - break; - - case 11: /* Type-Specific Attributes */ - - Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific)); - break; - - case 12: /* ResourceTag */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - - case 13: /* Address Range */ - - RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMATTRIBUTES, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 3); - break; - - case 14: /* Type */ - - RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 5, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 5); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Validate the Min/Max/Len/Gran values */ - - RsLargeAddressCheck ( - Descriptor->ExtAddress64.Minimum, - Descriptor->ExtAddress64.Maximum, - Descriptor->ExtAddress64.AddressLength, - Descriptor->ExtAddress64.Granularity, - Descriptor->ExtAddress64.Flags, - MinOp, MaxOp, LengthOp, GranOp); - - Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + StringLength; - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoExtendedSpaceDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a long "ExtendedSpace" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoExtendedSpaceDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ACPI_PARSE_OBJECT *MinOp = NULL; - ACPI_PARSE_OBJECT *MaxOp = NULL; - ACPI_PARSE_OBJECT *LengthOp = NULL; - ACPI_PARSE_OBJECT *GranOp = NULL; - ASL_RESOURCE_NODE *Rnode; - UINT16 StringLength = 0; - UINT32 i; - - - InitializerOp = Op->Asl.Child; - StringLength = RsGetStringDataLength (InitializerOp); - - Rnode = RsAllocateResourceNode ( - sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + 1 + StringLength); - - Descriptor = Rnode->Buffer; - Descriptor->ExtAddress64.DescriptorType = ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64; - Descriptor->ExtAddress64.RevisionID = AML_RESOURCE_EXTENDED_ADDRESS_REVISION; - - Descriptor->ExtAddress64.ResourceLength = (UINT16) - (sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) - - sizeof (AML_RESOURCE_LARGE_HEADER)); - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Resource Type */ - - Descriptor->ExtAddress64.ResourceType = - (UINT8) InitializerOp->Asl.Value.Integer; - break; - - case 1: /* Resource Usage */ - - RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 0, 1); - break; - - case 2: /* DecodeType */ - - RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 1); - break; - - case 3: /* MinType */ - - RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 2, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 2); - break; - - case 4: /* MaxType */ - - RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 3); - break; - - case 5: /* Type-Specific flags */ - - Descriptor->ExtAddress64.SpecificFlags = - (UINT8) InitializerOp->Asl.Value.Integer; - break; - - case 6: /* Address Granularity */ - - Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity)); - GranOp = InitializerOp; - break; - - case 7: /* Min Address */ - - Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum)); - MinOp = InitializerOp; - break; - - case 8: /* Max Address */ - - Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum)); - MaxOp = InitializerOp; - break; - - case 9: /* Translation Offset */ - - Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset)); - break; - - case 10: /* Address Length */ - - Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength)); - LengthOp = InitializerOp; - break; - - case 11: /* Type-Specific Attributes */ - - Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific)); - break; - - case 12: /* ResourceTag */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Validate the Min/Max/Len/Gran values */ - - RsLargeAddressCheck ( - Descriptor->ExtAddress64.Minimum, - Descriptor->ExtAddress64.Maximum, - Descriptor->ExtAddress64.AddressLength, - Descriptor->ExtAddress64.Granularity, - Descriptor->ExtAddress64.Flags, - MinOp, MaxOp, LengthOp, GranOp); - - Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + StringLength; - return (Rnode); -} diff -Nru acpica-unix-20100528/compiler/aslrestype2q.c acpica-unix-20140114/compiler/aslrestype2q.c --- acpica-unix-20100528/compiler/aslrestype2q.c 2010-05-28 17:14:25.000000000 +0000 +++ acpica-unix-20140114/compiler/aslrestype2q.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,793 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslrestype2q - Large QWord address resource descriptors - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - - -#include "aslcompiler.h" -#include "aslcompiler.y.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslrestype2q") - -/* - * This module contains the QWord (64-bit) address space descriptors: - * - * QWordIO - * QWordMemory - * QWordSpace - */ - -/******************************************************************************* - * - * FUNCTION: RsDoQwordIoDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a long "QwordIO" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoQwordIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ACPI_PARSE_OBJECT *MinOp = NULL; - ACPI_PARSE_OBJECT *MaxOp = NULL; - ACPI_PARSE_OBJECT *LengthOp = NULL; - ACPI_PARSE_OBJECT *GranOp = NULL; - ASL_RESOURCE_NODE *Rnode; - UINT8 *OptionalFields; - UINT16 StringLength = 0; - UINT32 OptionIndex = 0; - UINT32 i; - BOOLEAN ResSourceIndex = FALSE; - - - InitializerOp = Op->Asl.Child; - StringLength = RsGetStringDataLength (InitializerOp); - - Rnode = RsAllocateResourceNode ( - sizeof (AML_RESOURCE_ADDRESS64) + 1 + StringLength); - - Descriptor = Rnode->Buffer; - Descriptor->Address64.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS64; - Descriptor->Address64.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE; - - /* - * Initial descriptor length -- may be enlarged if there are - * optional fields present - */ - OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS64); - Descriptor->Address64.ResourceLength = (UINT16) - (sizeof (AML_RESOURCE_ADDRESS64) - - sizeof (AML_RESOURCE_LARGE_HEADER)); - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Resource Usage */ - - RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 0, 1); - break; - - case 1: /* MinType */ - - RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 2, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 2); - break; - - case 2: /* MaxType */ - - RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 3); - break; - - case 3: /* DecodeType */ - - RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 1); - break; - - case 4: /* Range Type */ - - RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 0, 3); - RsCreateBitField (InitializerOp, ACPI_RESTAG_RANGETYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 0); - break; - - case 5: /* Address Granularity */ - - Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity)); - GranOp = InitializerOp; - break; - - case 6: /* Address Min */ - - Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum)); - MinOp = InitializerOp; - break; - - case 7: /* Address Max */ - - Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum)); - MaxOp = InitializerOp; - break; - - case 8: /* Translation Offset */ - - Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset)); - break; - - case 9: /* Address Length */ - - Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength)); - LengthOp = InitializerOp; - break; - - case 10: /* ResSourceIndex [Optional Field - BYTE] */ - - if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer; - OptionIndex++; - Descriptor->Address64.ResourceLength++; - ResSourceIndex = TRUE; - } - break; - - case 11: /* ResSource [Optional Field - STRING] */ - - if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) && - (InitializerOp->Asl.Value.String)) - { - if (StringLength) - { - Descriptor->Address64.ResourceLength = (UINT16) - (Descriptor->Address64.ResourceLength + StringLength); - - strcpy ((char *) - &OptionalFields[OptionIndex], - InitializerOp->Asl.Value.String); - - /* ResourceSourceIndex must also be valid */ - - if (!ResSourceIndex) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX, - InitializerOp, NULL); - } - } - } - -#if 0 - /* - * Not a valid ResourceSource, ResourceSourceIndex must also - * be invalid - */ - else if (ResSourceIndex) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE, - InitializerOp, NULL); - } -#endif - break; - - case 12: /* ResourceTag */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - case 13: /* Type */ - - RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 4, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 4); - break; - - case 14: /* Translation Type */ - - RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 5, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_TRANSTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 5); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Validate the Min/Max/Len/Gran values */ - - RsLargeAddressCheck ( - Descriptor->Address64.Minimum, - Descriptor->Address64.Maximum, - Descriptor->Address64.AddressLength, - Descriptor->Address64.Granularity, - Descriptor->Address64.Flags, - MinOp, MaxOp, LengthOp, GranOp); - - Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) + - OptionIndex + StringLength; - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoQwordMemoryDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a long "QwordMemory" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoQwordMemoryDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ACPI_PARSE_OBJECT *MinOp = NULL; - ACPI_PARSE_OBJECT *MaxOp = NULL; - ACPI_PARSE_OBJECT *LengthOp = NULL; - ACPI_PARSE_OBJECT *GranOp = NULL; - ASL_RESOURCE_NODE *Rnode; - UINT8 *OptionalFields; - UINT16 StringLength = 0; - UINT32 OptionIndex = 0; - UINT32 i; - BOOLEAN ResSourceIndex = FALSE; - - - InitializerOp = Op->Asl.Child; - StringLength = RsGetStringDataLength (InitializerOp); - - Rnode = RsAllocateResourceNode ( - sizeof (AML_RESOURCE_ADDRESS64) + 1 + StringLength); - - Descriptor = Rnode->Buffer; - Descriptor->Address64.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS64; - Descriptor->Address64.ResourceType = ACPI_ADDRESS_TYPE_MEMORY_RANGE; - - /* - * Initial descriptor length -- may be enlarged if there are - * optional fields present - */ - OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS64); - Descriptor->Address64.ResourceLength = (UINT16) - (sizeof (AML_RESOURCE_ADDRESS64) - - sizeof (AML_RESOURCE_LARGE_HEADER)); - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Resource Usage */ - - RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 0, 1); - break; - - case 1: /* DecodeType */ - - RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 1); - break; - - case 2: /* MinType */ - - RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 2, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 2); - break; - - case 3: /* MaxType */ - - RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 3); - break; - - case 4: /* Memory Type */ - - RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 1); - break; - - case 5: /* Read/Write Type */ - - RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 0, 1); - RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 0); - break; - - case 6: /* Address Granularity */ - - Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity)); - GranOp = InitializerOp; - break; - - case 7: /* Min Address */ - - Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum)); - MinOp = InitializerOp; - break; - - case 8: /* Max Address */ - - Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum)); - MaxOp = InitializerOp; - break; - - case 9: /* Translation Offset */ - - Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset)); - break; - - case 10: /* Address Length */ - - Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength)); - LengthOp = InitializerOp; - break; - - case 11: /* ResSourceIndex [Optional Field - BYTE] */ - - if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer; - OptionIndex++; - Descriptor->Address64.ResourceLength++; - ResSourceIndex = TRUE; - } - break; - - case 12: /* ResSource [Optional Field - STRING] */ - - if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) && - (InitializerOp->Asl.Value.String)) - { - if (StringLength) - { - Descriptor->Address64.ResourceLength = (UINT16) - (Descriptor->Address64.ResourceLength + StringLength); - - strcpy ((char *) - &OptionalFields[OptionIndex], - InitializerOp->Asl.Value.String); - - /* ResourceSourceIndex must also be valid */ - - if (!ResSourceIndex) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX, - InitializerOp, NULL); - } - } - } - -#if 0 - /* - * Not a valid ResourceSource, ResourceSourceIndex must also - * be invalid - */ - else if (ResSourceIndex) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE, - InitializerOp, NULL); - } -#endif - break; - - case 13: /* ResourceTag */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - - case 14: /* Address Range */ - - RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMATTRIBUTES, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 3); - break; - - case 15: /* Type */ - - RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 5, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 5); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Validate the Min/Max/Len/Gran values */ - - RsLargeAddressCheck ( - Descriptor->Address64.Minimum, - Descriptor->Address64.Maximum, - Descriptor->Address64.AddressLength, - Descriptor->Address64.Granularity, - Descriptor->Address64.Flags, - MinOp, MaxOp, LengthOp, GranOp); - - Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) + - OptionIndex + StringLength; - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoQwordSpaceDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a long "QwordSpace" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoQwordSpaceDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ACPI_PARSE_OBJECT *MinOp = NULL; - ACPI_PARSE_OBJECT *MaxOp = NULL; - ACPI_PARSE_OBJECT *LengthOp = NULL; - ACPI_PARSE_OBJECT *GranOp = NULL; - ASL_RESOURCE_NODE *Rnode; - UINT8 *OptionalFields; - UINT16 StringLength = 0; - UINT32 OptionIndex = 0; - UINT32 i; - BOOLEAN ResSourceIndex = FALSE; - - - InitializerOp = Op->Asl.Child; - StringLength = RsGetStringDataLength (InitializerOp); - - Rnode = RsAllocateResourceNode ( - sizeof (AML_RESOURCE_ADDRESS64) + 1 + StringLength); - - Descriptor = Rnode->Buffer; - Descriptor->Address64.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS64; - - /* - * Initial descriptor length -- may be enlarged if there are - * optional fields present - */ - OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS64); - Descriptor->Address64.ResourceLength = (UINT16) - (sizeof (AML_RESOURCE_ADDRESS64) - - sizeof (AML_RESOURCE_LARGE_HEADER)); - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Resource Type */ - - Descriptor->Address64.ResourceType = - (UINT8) InitializerOp->Asl.Value.Integer; - break; - - case 1: /* Resource Usage */ - - RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 0, 1); - break; - - case 2: /* DecodeType */ - - RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 1); - break; - - case 3: /* MinType */ - - RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 2, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 2); - break; - - case 4: /* MaxType */ - - RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 3); - break; - - case 5: /* Type-Specific flags */ - - Descriptor->Address64.SpecificFlags = - (UINT8) InitializerOp->Asl.Value.Integer; - break; - - case 6: /* Address Granularity */ - - Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity)); - GranOp = InitializerOp; - break; - - case 7: /* Min Address */ - - Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum)); - MinOp = InitializerOp; - break; - - case 8: /* Max Address */ - - Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum)); - MaxOp = InitializerOp; - break; - - case 9: /* Translation Offset */ - - Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset)); - break; - - case 10: /* Address Length */ - - Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength)); - LengthOp = InitializerOp; - break; - - case 11: /* ResSourceIndex [Optional Field - BYTE] */ - - if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer; - OptionIndex++; - Descriptor->Address64.ResourceLength++; - ResSourceIndex = TRUE; - } - break; - - case 12: /* ResSource [Optional Field - STRING] */ - - if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) && - (InitializerOp->Asl.Value.String)) - { - if (StringLength) - { - Descriptor->Address64.ResourceLength = (UINT16) - (Descriptor->Address64.ResourceLength + StringLength); - - strcpy ((char *) - &OptionalFields[OptionIndex], - InitializerOp->Asl.Value.String); - - /* ResourceSourceIndex must also be valid */ - - if (!ResSourceIndex) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX, - InitializerOp, NULL); - } - } - } - -#if 0 - /* - * Not a valid ResourceSource, ResourceSourceIndex must also - * be invalid - */ - else if (ResSourceIndex) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE, - InitializerOp, NULL); - } -#endif - break; - - case 13: /* ResourceTag */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Validate the Min/Max/Len/Gran values */ - - RsLargeAddressCheck ( - Descriptor->Address64.Minimum, - Descriptor->Address64.Maximum, - Descriptor->Address64.AddressLength, - Descriptor->Address64.Granularity, - Descriptor->Address64.Flags, - MinOp, MaxOp, LengthOp, GranOp); - - Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) + - OptionIndex + StringLength; - return (Rnode); -} diff -Nru acpica-unix-20100528/compiler/aslrestype2w.c acpica-unix-20140114/compiler/aslrestype2w.c --- acpica-unix-20100528/compiler/aslrestype2w.c 2010-05-28 17:14:25.000000000 +0000 +++ acpica-unix-20140114/compiler/aslrestype2w.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,774 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslrestype2w - Large Word address resource descriptors - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - - -#include "aslcompiler.h" -#include "aslcompiler.y.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslrestype2w") - -/* - * This module contains the Word (16-bit) address space descriptors: - * - * WordIO - * WordMemory - * WordSpace - */ - -/******************************************************************************* - * - * FUNCTION: RsDoWordIoDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a long "WordIO" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoWordIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ACPI_PARSE_OBJECT *MinOp = NULL; - ACPI_PARSE_OBJECT *MaxOp = NULL; - ACPI_PARSE_OBJECT *LengthOp = NULL; - ACPI_PARSE_OBJECT *GranOp = NULL; - ASL_RESOURCE_NODE *Rnode; - UINT8 *OptionalFields; - UINT16 StringLength = 0; - UINT32 OptionIndex = 0; - UINT32 i; - BOOLEAN ResSourceIndex = FALSE; - - - InitializerOp = Op->Asl.Child; - StringLength = RsGetStringDataLength (InitializerOp); - - Rnode = RsAllocateResourceNode ( - sizeof (AML_RESOURCE_ADDRESS16) + 1 + StringLength); - - Descriptor = Rnode->Buffer; - Descriptor->Address16.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS16; - Descriptor->Address16.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE; - - /* - * Initial descriptor length -- may be enlarged if there are - * optional fields present - */ - OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS16); - Descriptor->Address16.ResourceLength = (UINT16) - (sizeof (AML_RESOURCE_ADDRESS16) - - sizeof (AML_RESOURCE_LARGE_HEADER)); - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Resource Usage */ - - RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 0, 1); - break; - - case 1: /* MinType */ - - RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 2, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 2); - break; - - case 2: /* MaxType */ - - RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 3); - break; - - case 3: /* DecodeType */ - - RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 1); - break; - - case 4: /* Range Type */ - - RsSetFlagBits (&Descriptor->Address16.SpecificFlags, InitializerOp, 0, 3); - RsCreateBitField (InitializerOp, ACPI_RESTAG_RANGETYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.SpecificFlags), 0); - break; - - case 5: /* Address Granularity */ - - Descriptor->Address16.Granularity = (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity)); - GranOp = InitializerOp; - break; - - case 6: /* Address Min */ - - Descriptor->Address16.Minimum = (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum)); - MinOp = InitializerOp; - break; - - case 7: /* Address Max */ - - Descriptor->Address16.Maximum = (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum)); - MaxOp = InitializerOp; - break; - - case 8: /* Translation Offset */ - - Descriptor->Address16.TranslationOffset = (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset)); - break; - - case 9: /* Address Length */ - - Descriptor->Address16.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength)); - LengthOp = InitializerOp; - break; - - case 10: /* ResSourceIndex [Optional Field - BYTE] */ - - if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer; - OptionIndex++; - Descriptor->Address16.ResourceLength++; - ResSourceIndex = TRUE; - } - break; - - case 11: /* ResSource [Optional Field - STRING] */ - - if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) && - (InitializerOp->Asl.Value.String)) - { - if (StringLength) - { - Descriptor->Address16.ResourceLength = (UINT16) - (Descriptor->Address16.ResourceLength + StringLength); - - strcpy ((char *) - &OptionalFields[OptionIndex], - InitializerOp->Asl.Value.String); - - /* ResourceSourceIndex must also be valid */ - - if (!ResSourceIndex) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX, - InitializerOp, NULL); - } - } - } - -#if 0 - /* - * Not a valid ResourceSource, ResourceSourceIndex must also - * be invalid - */ - else if (ResSourceIndex) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE, - InitializerOp, NULL); - } -#endif - break; - - case 12: /* ResourceTag */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - case 13: /* Type */ - - RsSetFlagBits (&Descriptor->Address16.SpecificFlags, InitializerOp, 4, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.SpecificFlags), 4); - break; - - case 14: /* Translation Type */ - - RsSetFlagBits (&Descriptor->Address16.SpecificFlags, InitializerOp, 5, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_TRANSTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.SpecificFlags), 5); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Validate the Min/Max/Len/Gran values */ - - RsLargeAddressCheck ( - Descriptor->Address16.Minimum, - Descriptor->Address16.Maximum, - Descriptor->Address16.AddressLength, - Descriptor->Address16.Granularity, - Descriptor->Address16.Flags, - MinOp, MaxOp, LengthOp, GranOp); - - Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) + - OptionIndex + StringLength; - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoWordBusNumberDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a long "WordBusNumber" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoWordBusNumberDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ACPI_PARSE_OBJECT *MinOp = NULL; - ACPI_PARSE_OBJECT *MaxOp = NULL; - ACPI_PARSE_OBJECT *LengthOp = NULL; - ACPI_PARSE_OBJECT *GranOp = NULL; - ASL_RESOURCE_NODE *Rnode; - UINT8 *OptionalFields; - UINT16 StringLength = 0; - UINT32 OptionIndex = 0; - UINT32 i; - BOOLEAN ResSourceIndex = FALSE; - - - InitializerOp = Op->Asl.Child; - StringLength = RsGetStringDataLength (InitializerOp); - - Rnode = RsAllocateResourceNode ( - sizeof (AML_RESOURCE_ADDRESS16) + 1 + StringLength); - - Descriptor = Rnode->Buffer; - Descriptor->Address16.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS16; - Descriptor->Address16.ResourceType = ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE; - - /* - * Initial descriptor length -- may be enlarged if there are - * optional fields present - */ - OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS16); - Descriptor->Address16.ResourceLength = (UINT16) - (sizeof (AML_RESOURCE_ADDRESS16) - - sizeof (AML_RESOURCE_LARGE_HEADER)); - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Resource Usage */ - - RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 0, 1); - break; - - case 1: /* MinType */ - - RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 2, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 2); - break; - - case 2: /* MaxType */ - - RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 3); - break; - - case 3: /* DecodeType */ - - RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 1); - break; - - case 4: /* Address Granularity */ - - Descriptor->Address16.Granularity = - (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity)); - GranOp = InitializerOp; - break; - - case 5: /* Min Address */ - - Descriptor->Address16.Minimum = - (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum)); - MinOp = InitializerOp; - break; - - case 6: /* Max Address */ - - Descriptor->Address16.Maximum = - (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum)); - MaxOp = InitializerOp; - break; - - case 7: /* Translation Offset */ - - Descriptor->Address16.TranslationOffset = - (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset)); - break; - - case 8: /* Address Length */ - - Descriptor->Address16.AddressLength = - (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength)); - LengthOp = InitializerOp; - break; - - case 9: /* ResSourceIndex [Optional Field - BYTE] */ - - if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer; - OptionIndex++; - Descriptor->Address16.ResourceLength++; - ResSourceIndex = TRUE; - } - break; - - case 10: /* ResSource [Optional Field - STRING] */ - - if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) && - (InitializerOp->Asl.Value.String)) - { - if (StringLength) - { - Descriptor->Address16.ResourceLength = (UINT16) - (Descriptor->Address16.ResourceLength + StringLength); - - strcpy ((char *) - &OptionalFields[OptionIndex], - InitializerOp->Asl.Value.String); - - /* ResourceSourceIndex must also be valid */ - - if (!ResSourceIndex) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX, - InitializerOp, NULL); - } - } - } - -#if 0 - /* - * Not a valid ResourceSource, ResourceSourceIndex must also - * be invalid - */ - else if (ResSourceIndex) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE, - InitializerOp, NULL); - } -#endif - break; - - case 11: /* ResourceTag */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Validate the Min/Max/Len/Gran values */ - - RsLargeAddressCheck ( - Descriptor->Address16.Minimum, - Descriptor->Address16.Maximum, - Descriptor->Address16.AddressLength, - Descriptor->Address16.Granularity, - Descriptor->Address16.Flags, - MinOp, MaxOp, LengthOp, GranOp); - - Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) + - OptionIndex + StringLength; - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoWordSpaceDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a long "WordSpace" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoWordSpaceDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - AML_RESOURCE *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ACPI_PARSE_OBJECT *MinOp = NULL; - ACPI_PARSE_OBJECT *MaxOp = NULL; - ACPI_PARSE_OBJECT *LengthOp = NULL; - ACPI_PARSE_OBJECT *GranOp = NULL; - ASL_RESOURCE_NODE *Rnode; - UINT8 *OptionalFields; - UINT16 StringLength = 0; - UINT32 OptionIndex = 0; - UINT32 i; - BOOLEAN ResSourceIndex = FALSE; - - - InitializerOp = Op->Asl.Child; - StringLength = RsGetStringDataLength (InitializerOp); - - Rnode = RsAllocateResourceNode ( - sizeof (AML_RESOURCE_ADDRESS16) + 1 + StringLength); - - Descriptor = Rnode->Buffer; - Descriptor->Address16.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS16; - - /* - * Initial descriptor length -- may be enlarged if there are - * optional fields present - */ - OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS16); - Descriptor->Address16.ResourceLength = (UINT16) - (sizeof (AML_RESOURCE_ADDRESS16) - - sizeof (AML_RESOURCE_LARGE_HEADER)); - - /* Process all child initialization nodes */ - - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Resource Type */ - - Descriptor->Address16.ResourceType = - (UINT8) InitializerOp->Asl.Value.Integer; - break; - - case 1: /* Resource Usage */ - - RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 0, 1); - break; - - case 2: /* DecodeType */ - - RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 1); - break; - - case 3: /* MinType */ - - RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 2, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 2); - break; - - case 4: /* MaxType */ - - RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 3); - break; - - case 5: /* Type-Specific flags */ - - Descriptor->Address16.SpecificFlags = - (UINT8) InitializerOp->Asl.Value.Integer; - break; - - case 6: /* Address Granularity */ - - Descriptor->Address16.Granularity = - (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity)); - GranOp = InitializerOp; - break; - - case 7: /* Min Address */ - - Descriptor->Address16.Minimum = - (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum)); - MinOp = InitializerOp; - break; - - case 8: /* Max Address */ - - Descriptor->Address16.Maximum = - (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum)); - MaxOp = InitializerOp; - break; - - case 9: /* Translation Offset */ - - Descriptor->Address16.TranslationOffset = - (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset)); - break; - - case 10: /* Address Length */ - - Descriptor->Address16.AddressLength = - (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength)); - LengthOp = InitializerOp; - break; - - case 11: /* ResSourceIndex [Optional Field - BYTE] */ - - if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer; - OptionIndex++; - Descriptor->Address16.ResourceLength++; - ResSourceIndex = TRUE; - } - break; - - case 12: /* ResSource [Optional Field - STRING] */ - - if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) && - (InitializerOp->Asl.Value.String)) - { - if (StringLength) - { - Descriptor->Address16.ResourceLength = (UINT16) - (Descriptor->Address16.ResourceLength + StringLength); - - strcpy ((char *) - &OptionalFields[OptionIndex], - InitializerOp->Asl.Value.String); - - /* ResourceSourceIndex must also be valid */ - - if (!ResSourceIndex) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX, - InitializerOp, NULL); - } - } - } - -#if 0 - /* - * Not a valid ResourceSource, ResourceSourceIndex must also - * be invalid - */ - else if (ResSourceIndex) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE, - InitializerOp, NULL); - } -#endif - break; - - case 13: /* ResourceTag */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Validate the Min/Max/Len/Gran values */ - - RsLargeAddressCheck ( - Descriptor->Address16.Minimum, - Descriptor->Address16.Maximum, - Descriptor->Address16.AddressLength, - Descriptor->Address16.Granularity, - Descriptor->Address16.Flags, - MinOp, MaxOp, LengthOp, GranOp); - - Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) + - OptionIndex + StringLength; - return (Rnode); -} diff -Nru acpica-unix-20100528/compiler/aslstartup.c acpica-unix-20140114/compiler/aslstartup.c --- acpica-unix-20100528/compiler/aslstartup.c 2010-05-28 17:14:25.000000000 +0000 +++ acpica-unix-20140114/compiler/aslstartup.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,597 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslstartup - Compiler startup routines, called from main - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - - -#include "aslcompiler.h" -#include "actables.h" -#include "acapps.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslstartup") - - -#define ASL_MAX_FILES 256 -char *FileList[ASL_MAX_FILES]; -int FileCount; -BOOLEAN AslToFile = TRUE; - - -/* Local prototypes */ - -static void -AslInitializeGlobals ( - void); - -static char ** -AsDoWildcard ( - char *DirectoryPathname, - char *FileSpecifier); - -UINT8 -AslDetectSourceFileType ( - ASL_FILE_INFO *Info); - - -/******************************************************************************* - * - * FUNCTION: AslInitializeGlobals - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Re-initialize globals needed to restart the compiler. This - * allows multiple files to be disassembled and/or compiled. - * - ******************************************************************************/ - -static void -AslInitializeGlobals ( - void) -{ - UINT32 i; - - - /* Init compiler globals */ - - Gbl_CurrentColumn = 0; - Gbl_CurrentLineNumber = 1; - Gbl_LogicalLineNumber = 1; - Gbl_CurrentLineOffset = 0; - Gbl_InputFieldCount = 0; - Gbl_LineBufPtr = Gbl_CurrentLineBuffer; - - Gbl_ErrorLog = NULL; - Gbl_NextError = NULL; - Gbl_Signature = NULL; - Gbl_FileType = 0; - - AslGbl_NextEvent = 0; - for (i = 0; i < ASL_NUM_REPORT_LEVELS; i++) - { - Gbl_ExceptionCount[i] = 0; - } - - Gbl_Files[ASL_FILE_AML_OUTPUT].Filename = NULL; - Gbl_Files[ASL_FILE_AML_OUTPUT].Handle = NULL; -} - - -/****************************************************************************** - * - * FUNCTION: AsDoWildcard - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Process files via wildcards. This function is for the Windows - * case only. - * - ******************************************************************************/ - -static char ** -AsDoWildcard ( - char *DirectoryPathname, - char *FileSpecifier) -{ -#ifdef WIN32 - void *DirInfo; - char *Filename; - - - FileCount = 0; - - /* Open parent directory */ - - DirInfo = AcpiOsOpenDirectory (DirectoryPathname, FileSpecifier, REQUEST_FILE_ONLY); - if (!DirInfo) - { - /* Either the directory of file does not exist */ - - Gbl_Files[ASL_FILE_INPUT].Filename = FileSpecifier; - FlFileError (ASL_FILE_INPUT, ASL_MSG_OPEN); - AslAbort (); - } - - /* Process each file that matches the wildcard specification */ - - while ((Filename = AcpiOsGetNextFilename (DirInfo))) - { - /* Add the filename to the file list */ - - FileList[FileCount] = AcpiOsAllocate (strlen (Filename) + 1); - strcpy (FileList[FileCount], Filename); - FileCount++; - - if (FileCount >= ASL_MAX_FILES) - { - printf ("Max files reached\n"); - FileList[0] = NULL; - return (FileList); - } - } - - /* Cleanup */ - - AcpiOsCloseDirectory (DirInfo); - FileList[FileCount] = NULL; - return (FileList); - -#else - /* - * Linux/Unix cases - Wildcards are expanded by the shell automatically. - * Just return the filename in a null terminated list - */ - FileList[0] = AcpiOsAllocate (strlen (FileSpecifier) + 1); - strcpy (FileList[0], FileSpecifier); - FileList[1] = NULL; - - return (FileList); -#endif -} - - -/******************************************************************************* - * - * FUNCTION: AslDetectSourceFileType - * - * PARAMETERS: Info - Name/Handle for the file (must be open) - * - * RETURN: File Type - * - * DESCRIPTION: Determine the type of the input file. Either binary (contains - * non-ASCII characters), ASL file, or an ACPI Data Table file. - * - ******************************************************************************/ - -UINT8 -AslDetectSourceFileType ( - ASL_FILE_INFO *Info) -{ - char *FileChar; - UINT8 Type; - ACPI_STATUS Status; - - - /* Check for 100% ASCII source file (comments are ignored) */ - - Status = FlCheckForAscii (Info); - if (ACPI_FAILURE (Status)) - { - printf ("Non-ascii input file - %s\n", Info->Filename); - Type = ASL_INPUT_TYPE_BINARY; - goto Cleanup; - } - - /* - * File is ASCII. Determine if this is an ASL file or an ACPI data - * table file. - */ - while (fgets (Gbl_CurrentLineBuffer, ASL_LINE_BUFFER_SIZE, Info->Handle)) - { - /* Uppercase the buffer for caseless compare */ - - FileChar = Gbl_CurrentLineBuffer; - while (*FileChar) - { - *FileChar = (char) toupper ((int) *FileChar); - FileChar++; - } - - /* Presence of "DefinitionBlock" indicates actual ASL code */ - - if (strstr (Gbl_CurrentLineBuffer, "DEFINITIONBLOCK")) - { - /* Appears to be an ASL file */ - - Type = ASL_INPUT_TYPE_ASCII_ASL; - goto Cleanup; - } - } - - /* Not an ASL source file, default to a data table source file */ - - Type = ASL_INPUT_TYPE_ASCII_DATA; - -Cleanup: - - /* Must seek back to the start of the file */ - - fseek (Info->Handle, 0, SEEK_SET); - return (Type); -} - - -/******************************************************************************* - * - * FUNCTION: AslDoOneFile - * - * PARAMETERS: Filename - Name of the file - * - * RETURN: Status - * - * DESCRIPTION: Process a single file - either disassemble, compile, or both - * - ******************************************************************************/ - -ACPI_STATUS -AslDoOneFile ( - char *Filename) -{ - ACPI_STATUS Status; - - - Gbl_Files[ASL_FILE_INPUT].Filename = Filename; - - /* Re-initialize "some" compiler globals */ - - AslInitializeGlobals (); - - /* - * AML Disassembly (Optional) - */ - if (Gbl_DisasmFlag || Gbl_GetAllTables) - { - /* ACPICA subsystem initialization */ - - Status = AdInitialize (); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - Status = AcpiAllocateRootTable (4); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not initialize ACPI Table Manager, %s\n", - AcpiFormatException (Status)); - return (Status); - } - - /* This is where the disassembly happens */ - - AcpiGbl_DbOpt_disasm = TRUE; - Status = AdAmlDisassemble (AslToFile, - Gbl_Files[ASL_FILE_INPUT].Filename, - Gbl_OutputFilenamePrefix, - &Gbl_Files[ASL_FILE_INPUT].Filename, - Gbl_GetAllTables); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Shutdown compiler and ACPICA subsystem */ - - AeClearErrorLog (); - AcpiTerminate (); - - /* - * Gbl_Files[ASL_FILE_INPUT].Filename was replaced with the - * .DSL disassembly file, which can now be compiled if requested - */ - if (Gbl_DoCompile) - { - AcpiOsPrintf ("\nCompiling \"%s\"\n", - Gbl_Files[ASL_FILE_INPUT].Filename); - } - else - { - Gbl_Files[ASL_FILE_INPUT].Filename = NULL; - return (AE_OK); - } - } - - /* - * Open the input file. Here, this should be an ASCII source file, - * either an ASL file or a Data Table file - */ - Status = FlOpenInputFile (Gbl_Files[ASL_FILE_INPUT].Filename); - if (ACPI_FAILURE (Status)) - { - AePrintErrorLog (ASL_FILE_STDERR); - return (AE_ERROR); - } - - /* Determine input file type */ - - Gbl_FileType = AslDetectSourceFileType (&Gbl_Files[ASL_FILE_INPUT]); - if (Gbl_FileType == ASL_INPUT_TYPE_BINARY) - { - return (AE_ERROR); - } - - /* - * If -p not specified, we will use the input filename as the - * output filename prefix - */ - if (Gbl_UseDefaultAmlFilename) - { - Gbl_OutputFilenamePrefix = Gbl_Files[ASL_FILE_INPUT].Filename; - } - - /* Open the optional output files (listings, etc.) */ - - Status = FlOpenMiscOutputFiles (Gbl_OutputFilenamePrefix); - if (ACPI_FAILURE (Status)) - { - AePrintErrorLog (ASL_FILE_STDERR); - return (AE_ERROR); - } - - /* - * Compilation of ASL source versus DataTable source uses different - * compiler subsystems - */ - switch (Gbl_FileType) - { - /* - * Data Table Compilation - */ - case ASL_INPUT_TYPE_ASCII_DATA: - - /* - * Require use of command-line option to enable the data table - * compiler -- for now, until development of the compiler is - * complete. - */ - if (!Gbl_DataTableCompilerAvailable) - { - printf ("Data Table Compiler is not available yet\n"); - return (AE_SUPPORT); - } - - Status = DtDoCompile (); - - if (Gbl_Signature) - { - ACPI_FREE (Gbl_Signature); - Gbl_Signature = NULL; - } - AeClearErrorLog (); - return (Status); - - /* - * ASL Compilation (Optional) - */ - case ASL_INPUT_TYPE_ASCII_ASL: - - - /* ACPICA subsystem initialization */ - - Status = AdInitialize (); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - Status = CmDoCompile (); - AcpiTerminate (); - - /* - * Return non-zero exit code if there have been errors, unless the - * global ignore error flag has been set - */ - if ((Gbl_ExceptionCount[ASL_ERROR] > 0) && (!Gbl_IgnoreErrors)) - { - return (AE_ERROR); - } - - AeClearErrorLog (); - return (AE_OK); - - case ASL_INPUT_TYPE_BINARY: - - AePrintErrorLog (ASL_FILE_STDERR); - return (AE_ERROR); - - default: - printf ("Unknown file type %X\n", Gbl_FileType); - return (AE_ERROR); - } -} - - -/******************************************************************************* - * - * FUNCTION: AslDoOnePathname - * - * PARAMETERS: Pathname - Full pathname, possibly with wildcards - * - * RETURN: Status - * - * DESCRIPTION: Process one pathname, possible terminated with a wildcard - * specification. If a wildcard, it is expanded and the multiple - * files are processed. - * - ******************************************************************************/ - -ACPI_STATUS -AslDoOnePathname ( - char *Pathname) -{ - ACPI_STATUS Status = AE_OK; - char **FileList; - char *Filename; - char *FullPathname; - - - /* Split incoming path into a directory/filename combo */ - - Status = FlSplitInputPathname (Pathname, &Gbl_DirectoryPath, &Filename); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Expand possible wildcard into a file list (Windows/DOS only) */ - - FileList = AsDoWildcard (Gbl_DirectoryPath, Filename); - while (*FileList) - { - FullPathname = ACPI_ALLOCATE ( - strlen (Gbl_DirectoryPath) + strlen (*FileList) + 1); - - /* Construct a full path to the file */ - - strcpy (FullPathname, Gbl_DirectoryPath); - strcat (FullPathname, *FileList); - - /* - * If -p not specified, we will use the input filename as the - * output filename prefix - */ - if (Gbl_UseDefaultAmlFilename) - { - Gbl_OutputFilenamePrefix = FullPathname; - } - - /* Save status from all compiles */ - - Status |= AslDoOneFile (FullPathname); - - ACPI_FREE (FullPathname); - ACPI_FREE (*FileList); - *FileList = NULL; - FileList++; - } - - ACPI_FREE (Gbl_DirectoryPath); - ACPI_FREE (Filename); - return (Status); -} - diff -Nru acpica-unix-20100528/compiler/aslstubs.c acpica-unix-20140114/compiler/aslstubs.c --- acpica-unix-20100528/compiler/aslstubs.c 2010-05-28 17:14:25.000000000 +0000 +++ acpica-unix-20140114/compiler/aslstubs.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,306 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslstubs - Stubs used to link to Aml interpreter - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - -#include "aslcompiler.h" -#include "acdispat.h" -#include "actables.h" -#include "acevents.h" -#include "acinterp.h" -#include "acnamesp.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslstubs") - - -/* - * Stubs to simplify linkage to the ACPI CA core subsystem. - * Things like Events, Global Lock, etc. are not used - * by the compiler, so they are stubbed out here. - */ -ACPI_PHYSICAL_ADDRESS -AeLocalGetRootPointer ( - void) -{ - return 0; -} - -void -AcpiNsExecModuleCodeList ( - void) -{ -} - -ACPI_STATUS -AcpiHwReadPort ( - ACPI_IO_ADDRESS Address, - UINT32 *Value, - UINT32 Width) -{ - return (AE_OK); -} - -ACPI_STATUS -AcpiHwWritePort ( - ACPI_IO_ADDRESS Address, - UINT32 Value, - UINT32 Width) -{ - return (AE_OK); -} - -ACPI_STATUS -AcpiDsMethodError ( - ACPI_STATUS Status, - ACPI_WALK_STATE *WalkState) -{ - return (Status); -} - -ACPI_STATUS -AcpiDsMethodDataGetValue ( - UINT8 Type, - UINT32 Index, - ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT **DestDesc) -{ - return (AE_OK); -} - -ACPI_STATUS -AcpiDsMethodDataGetNode ( - UINT8 Type, - UINT32 Index, - ACPI_WALK_STATE *WalkState, - ACPI_NAMESPACE_NODE **Node) -{ - return (AE_OK); -} - -ACPI_STATUS -AcpiDsStoreObjectToLocal ( - UINT8 Type, - UINT32 Index, - ACPI_OPERAND_OBJECT *SrcDesc, - ACPI_WALK_STATE *WalkState) -{ - return (AE_OK); -} - -ACPI_STATUS -AcpiEvDeleteGpeBlock ( - ACPI_GPE_BLOCK_INFO *GpeBlock) -{ - return (AE_OK); -} - -ACPI_STATUS -AcpiEvQueueNotifyRequest ( - ACPI_NAMESPACE_NODE *Node, - UINT32 NotifyValue) -{ - return (AE_OK); -} - -BOOLEAN -AcpiEvIsNotifyObject ( - ACPI_NAMESPACE_NODE *Node) -{ - return (FALSE); -} - -ACPI_STATUS -AcpiEvAcquireGlobalLock ( - UINT16 Timeout) -{ - return (AE_OK); -} - -ACPI_STATUS -AcpiEvReleaseGlobalLock ( - void) -{ - return (AE_OK); -} - -ACPI_STATUS -AcpiEvInitializeRegion ( - ACPI_OPERAND_OBJECT *RegionObj, - BOOLEAN AcpiNsLocked) -{ - return (AE_OK); -} - -void -AcpiExDoDebugObject ( - ACPI_OPERAND_OBJECT *SourceDesc, - UINT32 Level, - UINT32 Index) -{ - return; -} - -ACPI_STATUS -AcpiExReadDataFromField ( - ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_OPERAND_OBJECT **RetBufferDesc) -{ - return (AE_SUPPORT); -} - -ACPI_STATUS -AcpiExWriteDataToField ( - ACPI_OPERAND_OBJECT *SourceDesc, - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_OPERAND_OBJECT **ResultDesc) -{ - return (AE_SUPPORT); -} - -ACPI_STATUS -AcpiExLoadTableOp ( - ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT **ReturnDesc) -{ - return (AE_SUPPORT); -} - -ACPI_STATUS -AcpiExUnloadTable ( - ACPI_OPERAND_OBJECT *DdbHandle) -{ - return (AE_SUPPORT); -} - -ACPI_STATUS -AcpiExLoadOp ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_OPERAND_OBJECT *Target, - ACPI_WALK_STATE *WalkState) -{ - return (AE_SUPPORT); -} - -ACPI_STATUS -AcpiTbFindTable ( - char *Signature, - char *OemId, - char *OemTableId, - UINT32 *TableIndex) -{ - return (AE_SUPPORT); -} - diff -Nru acpica-unix-20100528/compiler/asltransform.c acpica-unix-20140114/compiler/asltransform.c --- acpica-unix-20100528/compiler/asltransform.c 2010-05-28 17:14:26.000000000 +0000 +++ acpica-unix-20140114/compiler/asltransform.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,841 +0,0 @@ - -/****************************************************************************** - * - * Module Name: asltransform - Parse tree transforms - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - - -#include "aslcompiler.h" -#include "aslcompiler.y.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("asltransform") - -/* Local prototypes */ - -static void -TrTransformSubtree ( - ACPI_PARSE_OBJECT *Op); - -static char * -TrAmlGetNextTempName ( - ACPI_PARSE_OBJECT *Op, - UINT8 *TempCount); - -static void -TrAmlInitLineNumbers ( - ACPI_PARSE_OBJECT *Op, - ACPI_PARSE_OBJECT *Neighbor); - -static void -TrAmlInitNode ( - ACPI_PARSE_OBJECT *Op, - UINT16 ParseOpcode); - -static void -TrAmlSetSubtreeParent ( - ACPI_PARSE_OBJECT *Op, - ACPI_PARSE_OBJECT *Parent); - -static void -TrAmlInsertPeer ( - ACPI_PARSE_OBJECT *Op, - ACPI_PARSE_OBJECT *NewPeer); - -static void -TrDoDefinitionBlock ( - ACPI_PARSE_OBJECT *Op); - -static void -TrDoSwitch ( - ACPI_PARSE_OBJECT *StartNode); - - -/******************************************************************************* - * - * FUNCTION: TrAmlGetNextTempName - * - * PARAMETERS: Op - Current parse op - * TempCount - Current temporary counter. Was originally - * per-module; Currently per method, could be - * expanded to per-scope. - * - * RETURN: A pointer to name (allocated here). - * - * DESCRIPTION: Generate an ACPI name of the form _T_x. These names are - * reserved for use by the ASL compiler. (_T_0 through _T_Z) - * - ******************************************************************************/ - -static char * -TrAmlGetNextTempName ( - ACPI_PARSE_OBJECT *Op, - UINT8 *TempCount) -{ - char *TempName; - - - if (*TempCount >= (10+26)) /* 0-35 valid: 0-9 and A-Z for TempName[3] */ - { - /* Too many temps */ - - AslError (ASL_ERROR, ASL_MSG_TOO_MANY_TEMPS, Op, NULL); - return (NULL); - } - - TempName = UtLocalCalloc (5); - - if (*TempCount < 10) /* 0-9 */ - { - TempName[3] = (char) (*TempCount + '0'); - } - else /* 10-35: A-Z */ - { - TempName[3] = (char) (*TempCount + ('A' - 10)); - } - (*TempCount)++; - - /* First three characters are always "_T_" */ - - TempName[0] = '_'; - TempName[1] = 'T'; - TempName[2] = '_'; - - return (TempName); -} - - -/******************************************************************************* - * - * FUNCTION: TrAmlInitLineNumbers - * - * PARAMETERS: Op - Op to be initialized - * Neighbor - Op used for initialization values - * - * RETURN: None - * - * DESCRIPTION: Initialized the various line numbers for a parse node. - * - ******************************************************************************/ - -static void -TrAmlInitLineNumbers ( - ACPI_PARSE_OBJECT *Op, - ACPI_PARSE_OBJECT *Neighbor) -{ - - Op->Asl.EndLine = Neighbor->Asl.EndLine; - Op->Asl.EndLogicalLine = Neighbor->Asl.EndLogicalLine; - Op->Asl.LineNumber = Neighbor->Asl.LineNumber; - Op->Asl.LogicalByteOffset = Neighbor->Asl.LogicalByteOffset; - Op->Asl.LogicalLineNumber = Neighbor->Asl.LogicalLineNumber; -} - - -/******************************************************************************* - * - * FUNCTION: TrAmlInitNode - * - * PARAMETERS: Op - Op to be initialized - * ParseOpcode - Opcode for this node - * - * RETURN: None - * - * DESCRIPTION: Initialize a node with the parse opcode and opcode name. - * - ******************************************************************************/ - -static void -TrAmlInitNode ( - ACPI_PARSE_OBJECT *Op, - UINT16 ParseOpcode) -{ - - Op->Asl.ParseOpcode = ParseOpcode; - UtSetParseOpName (Op); -} - - -/******************************************************************************* - * - * FUNCTION: TrAmlSetSubtreeParent - * - * PARAMETERS: Op - First node in a list of peer nodes - * Parent - Parent of the subtree - * - * RETURN: None - * - * DESCRIPTION: Set the parent for all peer nodes in a subtree - * - ******************************************************************************/ - -static void -TrAmlSetSubtreeParent ( - ACPI_PARSE_OBJECT *Op, - ACPI_PARSE_OBJECT *Parent) -{ - ACPI_PARSE_OBJECT *Next; - - - Next = Op; - while (Next) - { - Next->Asl.Parent = Parent; - Next = Next->Asl.Next; - } -} - - -/******************************************************************************* - * - * FUNCTION: TrAmlInsertPeer - * - * PARAMETERS: Op - First node in a list of peer nodes - * NewPeer - Peer node to insert - * - * RETURN: None - * - * DESCRIPTION: Insert a new peer node into a list of peers. - * - ******************************************************************************/ - -static void -TrAmlInsertPeer ( - ACPI_PARSE_OBJECT *Op, - ACPI_PARSE_OBJECT *NewPeer) -{ - - NewPeer->Asl.Next = Op->Asl.Next; - Op->Asl.Next = NewPeer; -} - - -/******************************************************************************* - * - * FUNCTION: TrAmlTransformWalk - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: None - * - * DESCRIPTION: Parse tree walk to generate both the AML opcodes and the AML - * operands. - * - ******************************************************************************/ - -ACPI_STATUS -TrAmlTransformWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - - TrTransformSubtree (Op); - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: TrTransformSubtree - * - * PARAMETERS: Op - The parent parse node - * - * RETURN: None - * - * DESCRIPTION: Prepare nodes to be output as AML data and operands. The more - * complex AML opcodes require processing of the child nodes - * (arguments/operands). - * - ******************************************************************************/ - -static void -TrTransformSubtree ( - ACPI_PARSE_OBJECT *Op) -{ - - if (Op->Asl.AmlOpcode == AML_RAW_DATA_BYTE) - { - return; - } - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_DEFINITIONBLOCK: - TrDoDefinitionBlock (Op); - break; - - case PARSEOP_SWITCH: - TrDoSwitch (Op); - break; - - case PARSEOP_METHOD: - - /* - * TBD: Zero the tempname (_T_x) count. Probably shouldn't be a global, - * however - */ - Gbl_TempCount = 0; - break; - - default: - /* Nothing to do here for other opcodes */ - break; - } -} - - -/******************************************************************************* - * - * FUNCTION: TrDoDefinitionBlock - * - * PARAMETERS: Op - Parse node - * - * RETURN: None - * - * DESCRIPTION: Find the end of the definition block and set a global to this - * node. It is used by the compiler to insert compiler-generated - * names at the root level of the namespace. - * - ******************************************************************************/ - -static void -TrDoDefinitionBlock ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Next; - UINT32 i; - - - Next = Op->Asl.Child; - for (i = 0; i < 5; i++) - { - Next = Next->Asl.Next; - if (i == 0) - { - /* - * This is the table signature. Only the DSDT can be assumed - * to be at the root of the namespace; Therefore, namepath - * optimization can only be performed on the DSDT. - */ - if (!ACPI_COMPARE_NAME (Next->Asl.Value.String, ACPI_SIG_DSDT)) - { - Gbl_ReferenceOptimizationFlag = FALSE; - } - } - } - - Gbl_FirstLevelInsertionNode = Next; -} - - -/******************************************************************************* - * - * FUNCTION: TrDoSwitch - * - * PARAMETERS: StartNode - Parse node for SWITCH - * - * RETURN: None - * - * - * DESCRIPTION: Translate ASL SWITCH statement to if/else pairs. There is - * no actual AML opcode for SWITCH -- it must be simulated. - * - ******************************************************************************/ - -static void -TrDoSwitch ( - ACPI_PARSE_OBJECT *StartNode) -{ - ACPI_PARSE_OBJECT *Next; - ACPI_PARSE_OBJECT *CaseOp = NULL; - ACPI_PARSE_OBJECT *CaseBlock = NULL; - ACPI_PARSE_OBJECT *DefaultOp = NULL; - ACPI_PARSE_OBJECT *CurrentParentNode; - ACPI_PARSE_OBJECT *Conditional = NULL; - ACPI_PARSE_OBJECT *Predicate; - ACPI_PARSE_OBJECT *Peer; - ACPI_PARSE_OBJECT *NewOp; - ACPI_PARSE_OBJECT *NewOp2; - ACPI_PARSE_OBJECT *MethodOp; - ACPI_PARSE_OBJECT *StoreOp; - ACPI_PARSE_OBJECT *BreakOp; - char *PredicateValueName; - UINT16 Index; - UINT32 Btype; - - - /* Start node is the Switch() node */ - - CurrentParentNode = StartNode; - - /* Create a new temp name of the form _T_x */ - - PredicateValueName = TrAmlGetNextTempName (StartNode, &Gbl_TempCount); - if (!PredicateValueName) - { - return; - } - - /* First child is the Switch() predicate */ - - Next = StartNode->Asl.Child; - - /* - * Examine the return type of the Switch Value - - * must be Integer/Buffer/String - */ - Index = (UINT16) (Next->Asl.ParseOpcode - ASL_PARSE_OPCODE_BASE); - Btype = AslKeywordMapping[Index].AcpiBtype; - if ((Btype != ACPI_BTYPE_INTEGER) && - (Btype != ACPI_BTYPE_STRING) && - (Btype != ACPI_BTYPE_BUFFER)) - { - AslError (ASL_WARNING, ASL_MSG_SWITCH_TYPE, Next, NULL); - Btype = ACPI_BTYPE_INTEGER; - } - - /* CASE statements start at next child */ - - Peer = Next->Asl.Next; - while (Peer) - { - Next = Peer; - Peer = Next->Asl.Next; - - if (Next->Asl.ParseOpcode == PARSEOP_CASE) - { - if (CaseOp) - { - /* Add an ELSE to complete the previous CASE */ - - if (!Conditional) - { - return; - } - NewOp = TrCreateLeafNode (PARSEOP_ELSE); - NewOp->Asl.Parent = Conditional->Asl.Parent; - TrAmlInitLineNumbers (NewOp, NewOp->Asl.Parent); - - /* Link ELSE node as a peer to the previous IF */ - - TrAmlInsertPeer (Conditional, NewOp); - CurrentParentNode = NewOp; - } - - CaseOp = Next; - Conditional = CaseOp; - CaseBlock = CaseOp->Asl.Child->Asl.Next; - Conditional->Asl.Child->Asl.Next = NULL; - Predicate = CaseOp->Asl.Child; - - if ((Predicate->Asl.ParseOpcode == PARSEOP_PACKAGE) || - (Predicate->Asl.ParseOpcode == PARSEOP_VAR_PACKAGE)) - { - /* - * Convert the package declaration to this form: - * - * If (LNotEqual (Match (Package(){}, - * MEQ, _T_x, MTR, Zero, Zero), Ones)) - */ - NewOp2 = TrCreateLeafNode (PARSEOP_MATCHTYPE_MEQ); - Predicate->Asl.Next = NewOp2; - TrAmlInitLineNumbers (NewOp2, Conditional); - - NewOp = NewOp2; - NewOp2 = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, - (UINT64) ACPI_TO_INTEGER (PredicateValueName)); - NewOp->Asl.Next = NewOp2; - TrAmlInitLineNumbers (NewOp2, Predicate); - - NewOp = NewOp2; - NewOp2 = TrCreateLeafNode (PARSEOP_MATCHTYPE_MTR); - NewOp->Asl.Next = NewOp2; - TrAmlInitLineNumbers (NewOp2, Predicate); - - NewOp = NewOp2; - NewOp2 = TrCreateLeafNode (PARSEOP_ZERO); - NewOp->Asl.Next = NewOp2; - TrAmlInitLineNumbers (NewOp2, Predicate); - - NewOp = NewOp2; - NewOp2 = TrCreateLeafNode (PARSEOP_ZERO); - NewOp->Asl.Next = NewOp2; - TrAmlInitLineNumbers (NewOp2, Predicate); - - NewOp2 = TrCreateLeafNode (PARSEOP_MATCH); - NewOp2->Asl.Child = Predicate; /* PARSEOP_PACKAGE */ - TrAmlInitLineNumbers (NewOp2, Conditional); - TrAmlSetSubtreeParent (Predicate, NewOp2); - - NewOp = NewOp2; - NewOp2 = TrCreateLeafNode (PARSEOP_ONES); - NewOp->Asl.Next = NewOp2; - TrAmlInitLineNumbers (NewOp2, Conditional); - - NewOp2 = TrCreateLeafNode (PARSEOP_LEQUAL); - NewOp2->Asl.Child = NewOp; - NewOp->Asl.Parent = NewOp2; - TrAmlInitLineNumbers (NewOp2, Conditional); - TrAmlSetSubtreeParent (NewOp, NewOp2); - - NewOp = NewOp2; - NewOp2 = TrCreateLeafNode (PARSEOP_LNOT); - NewOp2->Asl.Child = NewOp; - NewOp2->Asl.Parent = Conditional; - NewOp->Asl.Parent = NewOp2; - TrAmlInitLineNumbers (NewOp2, Conditional); - - Conditional->Asl.Child = NewOp2; - NewOp2->Asl.Next = CaseBlock; - } - else - { - /* - * Integer and Buffer case. - * - * Change CaseOp() to: If (LEqual (SwitchValue, CaseValue)) {...} - * Note: SwitchValue is first to allow the CaseValue to be implicitly - * converted to the type of SwitchValue if necessary. - * - * CaseOp->Child is the case value - * CaseOp->Child->Peer is the beginning of the case block - */ - NewOp = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, - (UINT64) ACPI_TO_INTEGER (PredicateValueName)); - NewOp->Asl.Next = Predicate; - TrAmlInitLineNumbers (NewOp, Predicate); - - NewOp2 = TrCreateLeafNode (PARSEOP_LEQUAL); - NewOp2->Asl.Parent = Conditional; - NewOp2->Asl.Child = NewOp; - TrAmlInitLineNumbers (NewOp2, Conditional); - - TrAmlSetSubtreeParent (NewOp, NewOp2); - - Predicate = NewOp2; - Predicate->Asl.Next = CaseBlock; - - TrAmlSetSubtreeParent (Predicate, Conditional); - Conditional->Asl.Child = Predicate; - } - - /* Reinitialize the CASE node to an IF node */ - - TrAmlInitNode (Conditional, PARSEOP_IF); - - /* - * The first CASE(IF) is not nested under an ELSE. - * All other CASEs are children of a parent ELSE. - */ - if (CurrentParentNode == StartNode) - { - Conditional->Asl.Next = NULL; - } - else - { - /* - * The IF is a child of previous IF/ELSE. It - * is therefore without peer. - */ - CurrentParentNode->Asl.Child = Conditional; - Conditional->Asl.Parent = CurrentParentNode; - Conditional->Asl.Next = NULL; - } - } - else if (Next->Asl.ParseOpcode == PARSEOP_DEFAULT) - { - if (DefaultOp) - { - /* - * More than one Default - * (Parser does not catch this, must check here) - */ - AslError (ASL_ERROR, ASL_MSG_MULTIPLE_DEFAULT, Next, NULL); - } - else - { - /* Save the DEFAULT node for later, after CASEs */ - - DefaultOp = Next; - } - } - else - { - /* Unknown peer opcode */ - - AcpiOsPrintf ("Unknown parse opcode for switch statement: %s (%u)\n", - Next->Asl.ParseOpName, Next->Asl.ParseOpcode); - } - } - - /* Add the default case at the end of the if/else construct */ - - if (DefaultOp) - { - /* If no CASE statements, this is an error - see below */ - - if (CaseOp) - { - /* Convert the DEFAULT node to an ELSE */ - - if (!Conditional) - { - return; - } - - TrAmlInitNode (DefaultOp, PARSEOP_ELSE); - DefaultOp->Asl.Parent = Conditional->Asl.Parent; - - /* Link ELSE node as a peer to the previous IF */ - - TrAmlInsertPeer (Conditional, DefaultOp); - } - } - - if (!CaseOp) - { - AslError (ASL_ERROR, ASL_MSG_NO_CASES, StartNode, NULL); - } - - - /* - * Create a Name(_T_x, ...) statement. This statement must appear at the - * method level, in case a loop surrounds the switch statement and could - * cause the name to be created twice (error). - */ - - /* Create the Name node */ - - Predicate = StartNode->Asl.Child; - NewOp = TrCreateLeafNode (PARSEOP_NAME); - - /* Find the parent method */ - - Next = StartNode; - while ((Next->Asl.ParseOpcode != PARSEOP_METHOD) && - (Next->Asl.ParseOpcode != PARSEOP_DEFINITIONBLOCK)) - { - Next = Next->Asl.Parent; - } - MethodOp = Next; - - NewOp->Asl.CompileFlags |= NODE_COMPILER_EMITTED; - NewOp->Asl.Parent = Next; - - /* Insert name after the method name and arguments */ - - Next = Next->Asl.Child; /* Name */ - Next = Next->Asl.Next; /* NumArgs */ - Next = Next->Asl.Next; /* SerializeRule */ - - /* - * If method is not Serialized, we must make is so, because of the way - * that Switch() must be implemented -- we cannot allow multiple threads - * to execute this method concurrently since we need to create local - * temporary name(s). - */ - if (Next->Asl.ParseOpcode != PARSEOP_SERIALIZERULE_SERIAL) - { - AslError (ASL_REMARK, ASL_MSG_SERIALIZED, MethodOp, "Due to use of Switch operator"); - Next->Asl.ParseOpcode = PARSEOP_SERIALIZERULE_SERIAL; - } - - Next = Next->Asl.Next; /* SyncLevel */ - Next = Next->Asl.Next; /* ReturnType */ - Next = Next->Asl.Next; /* ParameterTypes */ - - TrAmlInsertPeer (Next, NewOp); - TrAmlInitLineNumbers (NewOp, Next); - - /* Create the NameSeg child for the Name node */ - - NewOp2 = TrCreateValuedLeafNode (PARSEOP_NAMESEG, - (UINT64) ACPI_TO_INTEGER (PredicateValueName)); - NewOp2->Asl.CompileFlags |= NODE_IS_NAME_DECLARATION; - NewOp->Asl.Child = NewOp2; - - /* Create the initial value for the Name. Btype was already validated above */ - - switch (Btype) - { - case ACPI_BTYPE_INTEGER: - NewOp2->Asl.Next = TrCreateValuedLeafNode (PARSEOP_ZERO, - (UINT64) 0); - break; - - case ACPI_BTYPE_STRING: - NewOp2->Asl.Next = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL, - (UINT64) ACPI_TO_INTEGER ("")); - break; - - case ACPI_BTYPE_BUFFER: - (void) TrLinkPeerNode (NewOp2, TrCreateValuedLeafNode (PARSEOP_BUFFER, - (UINT64) 0)); - Next = NewOp2->Asl.Next; - (void) TrLinkChildren (Next, 1, TrCreateValuedLeafNode (PARSEOP_ZERO, - (UINT64) 1)); - (void) TrLinkPeerNode (Next->Asl.Child, - TrCreateValuedLeafNode (PARSEOP_DEFAULT_ARG, (UINT64) 0)); - - TrAmlSetSubtreeParent (Next->Asl.Child, Next); - break; - - default: - break; - } - - TrAmlSetSubtreeParent (NewOp2, NewOp); - - /* - * Transform the Switch() into a While(One)-Break node. - * And create a Store() node which will be used to save the - * Switch() value. The store is of the form: Store (Value, _T_x) - * where _T_x is the temp variable. - */ - TrAmlInitNode (StartNode, PARSEOP_WHILE); - NewOp = TrCreateLeafNode (PARSEOP_ONE); - NewOp->Asl.Next = Predicate->Asl.Next; - NewOp->Asl.Parent = StartNode; - StartNode->Asl.Child = NewOp; - - /* Create a Store() node */ - - StoreOp = TrCreateLeafNode (PARSEOP_STORE); - StoreOp->Asl.Parent = StartNode; - TrAmlInsertPeer (NewOp, StoreOp); - - /* Complete the Store subtree */ - - StoreOp->Asl.Child = Predicate; - Predicate->Asl.Parent = StoreOp; - - NewOp = TrCreateValuedLeafNode (PARSEOP_NAMESEG, - (UINT64) ACPI_TO_INTEGER (PredicateValueName)); - NewOp->Asl.Parent = StoreOp; - Predicate->Asl.Next = NewOp; - - /* Create a Break() node and insert it into the end of While() */ - - Conditional = StartNode->Asl.Child; - while (Conditional->Asl.Next) - { - Conditional = Conditional->Asl.Next; - } - - BreakOp = TrCreateLeafNode (PARSEOP_BREAK); - BreakOp->Asl.Parent = StartNode; - TrAmlInsertPeer (Conditional, BreakOp); -} - - diff -Nru acpica-unix-20100528/compiler/asltree.c acpica-unix-20140114/compiler/asltree.c --- acpica-unix-20100528/compiler/asltree.c 2010-05-28 17:14:26.000000000 +0000 +++ acpica-unix-20140114/compiler/asltree.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1194 +0,0 @@ - -/****************************************************************************** - * - * Module Name: asltree - parse tree management - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - - -#include "aslcompiler.h" -#include "aslcompiler.y.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("asltree") - -/* Local prototypes */ - -static ACPI_PARSE_OBJECT * -TrGetNextNode ( - void); - -static char * -TrGetNodeFlagName ( - UINT32 Flags); - - -/******************************************************************************* - * - * FUNCTION: TrGetNextNode - * - * PARAMETERS: None - * - * RETURN: New parse node. Aborts on allocation failure - * - * DESCRIPTION: Allocate a new parse node for the parse tree. Bypass the local - * dynamic memory manager for performance reasons (This has a - * major impact on the speed of the compiler.) - * - ******************************************************************************/ - -static ACPI_PARSE_OBJECT * -TrGetNextNode ( - void) -{ - - if (Gbl_NodeCacheNext >= Gbl_NodeCacheLast) - { - Gbl_NodeCacheNext = UtLocalCalloc (sizeof (ACPI_PARSE_OBJECT) * - ASL_NODE_CACHE_SIZE); - Gbl_NodeCacheLast = Gbl_NodeCacheNext + ASL_NODE_CACHE_SIZE; - } - - return (Gbl_NodeCacheNext++); -} - - -/******************************************************************************* - * - * FUNCTION: TrAllocateNode - * - * PARAMETERS: ParseOpcode - Opcode to be assigned to the node - * - * RETURN: New parse node. Aborts on allocation failure - * - * DESCRIPTION: Allocate and initialize a new parse node for the parse tree - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -TrAllocateNode ( - UINT32 ParseOpcode) -{ - ACPI_PARSE_OBJECT *Op; - - - Op = TrGetNextNode (); - - Op->Asl.ParseOpcode = (UINT16) ParseOpcode; - Op->Asl.Filename = Gbl_Files[ASL_FILE_INPUT].Filename; - Op->Asl.LineNumber = Gbl_CurrentLineNumber; - Op->Asl.LogicalLineNumber = Gbl_LogicalLineNumber; - Op->Asl.LogicalByteOffset = Gbl_CurrentLineOffset; - Op->Asl.Column = Gbl_CurrentColumn; - - UtSetParseOpName (Op); - return Op; -} - - -/******************************************************************************* - * - * FUNCTION: TrReleaseNode - * - * PARAMETERS: Op - Op to be released - * - * RETURN: None - * - * DESCRIPTION: "release" a node. In truth, nothing is done since the node - * is part of a larger buffer - * - ******************************************************************************/ - -void -TrReleaseNode ( - ACPI_PARSE_OBJECT *Op) -{ - - return; -} - - -/******************************************************************************* - * - * FUNCTION: TrUpdateNode - * - * PARAMETERS: ParseOpcode - New opcode to be assigned to the node - * Op - An existing parse node - * - * RETURN: The updated node - * - * DESCRIPTION: Change the parse opcode assigned to a node. Usually used to - * change an opcode to DEFAULT_ARG so that the node is ignored - * during the code generation. Also used to set generic integers - * to a specific size (8, 16, 32, or 64 bits) - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -TrUpdateNode ( - UINT32 ParseOpcode, - ACPI_PARSE_OBJECT *Op) -{ - - if (!Op) - { - return NULL; - } - - DbgPrint (ASL_PARSE_OUTPUT, - "\nUpdateNode: Old - %s, New - %s\n\n", - UtGetOpName (Op->Asl.ParseOpcode), - UtGetOpName (ParseOpcode)); - - /* Assign new opcode and name */ - - if (Op->Asl.ParseOpcode == PARSEOP_ONES) - { - switch (ParseOpcode) - { - case PARSEOP_BYTECONST: - Op->Asl.Value.Integer = 0xFF; - break; - - case PARSEOP_WORDCONST: - Op->Asl.Value.Integer = 0xFFFF; - break; - - case PARSEOP_DWORDCONST: - Op->Asl.Value.Integer = 0xFFFFFFFF; - break; - - default: - /* Don't care about others, don't need to check QWORD */ - break; - } - } - - Op->Asl.ParseOpcode = (UINT16) ParseOpcode; - UtSetParseOpName (Op); - - /* - * For the BYTE, WORD, and DWORD constants, make sure that the integer - * that was passed in will actually fit into the data type - */ - switch (ParseOpcode) - { - case PARSEOP_BYTECONST: - Op = UtCheckIntegerRange (Op, 0x00, ACPI_UINT8_MAX); - break; - - case PARSEOP_WORDCONST: - Op = UtCheckIntegerRange (Op, 0x00, ACPI_UINT16_MAX); - break; - - case PARSEOP_DWORDCONST: - Op = UtCheckIntegerRange (Op, 0x00, ACPI_UINT32_MAX); - break; - - default: - /* Don't care about others, don't need to check QWORD */ - break; - } - - return Op; -} - - -/******************************************************************************* - * - * FUNCTION: TrGetNodeFlagName - * - * PARAMETERS: Flags - Flags word to be decoded - * - * RETURN: Name string. Always returns a valid string pointer. - * - * DESCRIPTION: Decode a flags word - * - ******************************************************************************/ - -static char * -TrGetNodeFlagName ( - UINT32 Flags) -{ - - switch (Flags) - { - case NODE_VISITED: - return ("NODE_VISITED"); - - case NODE_AML_PACKAGE: - return ("NODE_AML_PACKAGE"); - - case NODE_IS_TARGET: - return ("NODE_IS_TARGET"); - - case NODE_IS_RESOURCE_DESC: - return ("NODE_IS_RESOURCE_DESC"); - - case NODE_IS_RESOURCE_FIELD: - return ("NODE_IS_RESOURCE_FIELD"); - - case NODE_HAS_NO_EXIT: - return ("NODE_HAS_NO_EXIT"); - - case NODE_IF_HAS_NO_EXIT: - return ("NODE_IF_HAS_NO_EXIT"); - - case NODE_NAME_INTERNALIZED: - return ("NODE_NAME_INTERNALIZED"); - - case NODE_METHOD_NO_RETVAL: - return ("NODE_METHOD_NO_RETVAL"); - - case NODE_METHOD_SOME_NO_RETVAL: - return ("NODE_METHOD_SOME_NO_RETVAL"); - - case NODE_RESULT_NOT_USED: - return ("NODE_RESULT_NOT_USED"); - - case NODE_METHOD_TYPED: - return ("NODE_METHOD_TYPED"); - - case NODE_IS_BIT_OFFSET: - return ("NODE_IS_BIT_OFFSET"); - - case NODE_COMPILE_TIME_CONST: - return ("NODE_COMPILE_TIME_CONST"); - - case NODE_IS_TERM_ARG: - return ("NODE_IS_TERM_ARG"); - - case NODE_WAS_ONES_OP: - return ("NODE_WAS_ONES_OP"); - - case NODE_IS_NAME_DECLARATION: - return ("NODE_IS_NAME_DECLARATION"); - - default: - return ("Multiple Flags (or unknown flag) set"); - } -} - - -/******************************************************************************* - * - * FUNCTION: TrSetNodeFlags - * - * PARAMETERS: Op - An existing parse node - * Flags - New flags word - * - * RETURN: The updated parser op - * - * DESCRIPTION: Set bits in the node flags word. Will not clear bits, only set - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -TrSetNodeFlags ( - ACPI_PARSE_OBJECT *Op, - UINT32 Flags) -{ - - DbgPrint (ASL_PARSE_OUTPUT, - "\nSetNodeFlags: Op %p, %8.8X %s\n\n", Op, Flags, - TrGetNodeFlagName (Flags)); - - if (!Op) - { - return NULL; - } - - Op->Asl.CompileFlags |= Flags; - - return Op; -} - - -/******************************************************************************* - * - * FUNCTION: TrSetEndLineNumber - * - * PARAMETERS: Op - An existing parse node - * - * RETURN: None. - * - * DESCRIPTION: Set the ending line numbers (file line and logical line) of a - * parse node to the current line numbers. - * - ******************************************************************************/ - -void -TrSetEndLineNumber ( - ACPI_PARSE_OBJECT *Op) -{ - - /* If the end line # is already set, just return */ - - if (Op->Asl.EndLine) - { - return; - } - - Op->Asl.EndLine = Gbl_CurrentLineNumber; - Op->Asl.EndLogicalLine = Gbl_LogicalLineNumber; -} - - -/******************************************************************************* - * - * FUNCTION: TrCreateLeafNode - * - * PARAMETERS: ParseOpcode - New opcode to be assigned to the node - * - * RETURN: Pointer to the new node. Aborts on allocation failure - * - * DESCRIPTION: Create a simple leaf node (no children or peers, and no value - * assigned to the node) - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -TrCreateLeafNode ( - UINT32 ParseOpcode) -{ - ACPI_PARSE_OBJECT *Op; - - - Op = TrAllocateNode (ParseOpcode); - - DbgPrint (ASL_PARSE_OUTPUT, - "\nCreateLeafNode Ln/Col %u/%u NewNode %p Op %s\n\n", - Op->Asl.LineNumber, Op->Asl.Column, Op, UtGetOpName(ParseOpcode)); - - return Op; -} - - -/******************************************************************************* - * - * FUNCTION: TrCreateValuedLeafNode - * - * PARAMETERS: ParseOpcode - New opcode to be assigned to the node - * Value - Value to be assigned to the node - * - * RETURN: Pointer to the new node. Aborts on allocation failure - * - * DESCRIPTION: Create a leaf node (no children or peers) with a value - * assigned to it - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -TrCreateValuedLeafNode ( - UINT32 ParseOpcode, - UINT64 Value) -{ - ACPI_PARSE_OBJECT *Op; - - - Op = TrAllocateNode (ParseOpcode); - - DbgPrint (ASL_PARSE_OUTPUT, - "\nCreateValuedLeafNode Ln/Col %u/%u NewNode %p Op %s Value %8.8X%8.8X ", - Op->Asl.LineNumber, Op->Asl.Column, Op, UtGetOpName(ParseOpcode), - ACPI_FORMAT_UINT64 (Value)); - Op->Asl.Value.Integer = Value; - - switch (ParseOpcode) - { - case PARSEOP_STRING_LITERAL: - DbgPrint (ASL_PARSE_OUTPUT, "STRING->%s", Value); - break; - - case PARSEOP_NAMESEG: - DbgPrint (ASL_PARSE_OUTPUT, "NAMESEG->%s", Value); - break; - - case PARSEOP_NAMESTRING: - DbgPrint (ASL_PARSE_OUTPUT, "NAMESTRING->%s", Value); - break; - - case PARSEOP_EISAID: - DbgPrint (ASL_PARSE_OUTPUT, "EISAID->%s", Value); - break; - - case PARSEOP_METHOD: - DbgPrint (ASL_PARSE_OUTPUT, "METHOD"); - break; - - case PARSEOP_INTEGER: - DbgPrint (ASL_PARSE_OUTPUT, "INTEGER"); - break; - - default: - break; - } - - DbgPrint (ASL_PARSE_OUTPUT, "\n\n"); - return Op; -} - - -/******************************************************************************* - * - * FUNCTION: TrCreateNode - * - * PARAMETERS: ParseOpcode - Opcode to be assigned to the node - * NumChildren - Number of children to follow - * ... - A list of child nodes to link to the new - * node. NumChildren long. - * - * RETURN: Pointer to the new node. Aborts on allocation failure - * - * DESCRIPTION: Create a new parse node and link together a list of child - * nodes underneath the new node. - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -TrCreateNode ( - UINT32 ParseOpcode, - UINT32 NumChildren, - ...) -{ - ACPI_PARSE_OBJECT *Op; - ACPI_PARSE_OBJECT *Child; - ACPI_PARSE_OBJECT *PrevChild; - va_list ap; - UINT32 i; - BOOLEAN FirstChild; - - - va_start (ap, NumChildren); - - /* Allocate one new node */ - - Op = TrAllocateNode (ParseOpcode); - - DbgPrint (ASL_PARSE_OUTPUT, - "\nCreateNode Ln/Col %u/%u NewParent %p Child %u Op %s ", - Op->Asl.LineNumber, Op->Asl.Column, Op, NumChildren, UtGetOpName(ParseOpcode)); - - /* Some extra debug output based on the parse opcode */ - - switch (ParseOpcode) - { - case PARSEOP_DEFINITIONBLOCK: - RootNode = Op; - DbgPrint (ASL_PARSE_OUTPUT, "DEFINITION_BLOCK (Tree Completed)->"); - break; - - case PARSEOP_OPERATIONREGION: - DbgPrint (ASL_PARSE_OUTPUT, "OPREGION->"); - break; - - case PARSEOP_OR: - DbgPrint (ASL_PARSE_OUTPUT, "OR->"); - break; - - default: - /* Nothing to do for other opcodes */ - break; - } - - /* Link the new node to its children */ - - PrevChild = NULL; - FirstChild = TRUE; - for (i = 0; i < NumChildren; i++) - { - /* Get the next child */ - - Child = va_arg (ap, ACPI_PARSE_OBJECT *); - DbgPrint (ASL_PARSE_OUTPUT, "%p, ", Child); - - /* - * If child is NULL, this means that an optional argument - * was omitted. We must create a placeholder with a special - * opcode (DEFAULT_ARG) so that the code generator will know - * that it must emit the correct default for this argument - */ - if (!Child) - { - Child = TrAllocateNode (PARSEOP_DEFAULT_ARG); - } - - /* Link first child to parent */ - - if (FirstChild) - { - FirstChild = FALSE; - Op->Asl.Child = Child; - } - - /* Point all children to parent */ - - Child->Asl.Parent = Op; - - /* Link children in a peer list */ - - if (PrevChild) - { - PrevChild->Asl.Next = Child; - }; - - /* - * This child might be a list, point all nodes in the list - * to the same parent - */ - while (Child->Asl.Next) - { - Child = Child->Asl.Next; - Child->Asl.Parent = Op; - } - - PrevChild = Child; - } - va_end(ap); - - DbgPrint (ASL_PARSE_OUTPUT, "\n\n"); - return Op; -} - - -/******************************************************************************* - * - * FUNCTION: TrLinkChildren - * - * PARAMETERS: Op - An existing parse node - * NumChildren - Number of children to follow - * ... - A list of child nodes to link to the new - * node. NumChildren long. - * - * RETURN: The updated (linked) node - * - * DESCRIPTION: Link a group of nodes to an existing parse node - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -TrLinkChildren ( - ACPI_PARSE_OBJECT *Op, - UINT32 NumChildren, - ...) -{ - ACPI_PARSE_OBJECT *Child; - ACPI_PARSE_OBJECT *PrevChild; - va_list ap; - UINT32 i; - BOOLEAN FirstChild; - - - va_start (ap, NumChildren); - - - TrSetEndLineNumber (Op); - - DbgPrint (ASL_PARSE_OUTPUT, - "\nLinkChildren Line [%u to %u] NewParent %p Child %u Op %s ", - Op->Asl.LineNumber, Op->Asl.EndLine, - Op, NumChildren, UtGetOpName(Op->Asl.ParseOpcode)); - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_DEFINITIONBLOCK: - RootNode = Op; - DbgPrint (ASL_PARSE_OUTPUT, "DEFINITION_BLOCK (Tree Completed)->"); - break; - - case PARSEOP_OPERATIONREGION: - DbgPrint (ASL_PARSE_OUTPUT, "OPREGION->"); - break; - - case PARSEOP_OR: - DbgPrint (ASL_PARSE_OUTPUT, "OR->"); - break; - - default: - /* Nothing to do for other opcodes */ - break; - } - - /* Link the new node to it's children */ - - PrevChild = NULL; - FirstChild = TRUE; - for (i = 0; i < NumChildren; i++) - { - Child = va_arg (ap, ACPI_PARSE_OBJECT *); - - if ((Child == PrevChild) && (Child != NULL)) - { - AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Child, - "Child node list invalid"); - return Op; - } - - DbgPrint (ASL_PARSE_OUTPUT, "%p, ", Child); - - /* - * If child is NULL, this means that an optional argument - * was omitted. We must create a placeholder with a special - * opcode (DEFAULT_ARG) so that the code generator will know - * that it must emit the correct default for this argument - */ - if (!Child) - { - Child = TrAllocateNode (PARSEOP_DEFAULT_ARG); - } - - /* Link first child to parent */ - - if (FirstChild) - { - FirstChild = FALSE; - Op->Asl.Child = Child; - } - - /* Point all children to parent */ - - Child->Asl.Parent = Op; - - /* Link children in a peer list */ - - if (PrevChild) - { - PrevChild->Asl.Next = Child; - }; - - /* - * This child might be a list, point all nodes in the list - * to the same parent - */ - while (Child->Asl.Next) - { - Child = Child->Asl.Next; - Child->Asl.Parent = Op; - } - PrevChild = Child; - } - va_end(ap); - - DbgPrint (ASL_PARSE_OUTPUT, "\n\n"); - return Op; -} - - -/******************************************************************************* - * - * FUNCTION: TrLinkPeerNode - * - * PARAMETERS: Op1 - First peer - * Op2 - Second peer - * - * RETURN: Op1 or the non-null node. - * - * DESCRIPTION: Link two nodes as peers. Handles cases where one peer is null. - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -TrLinkPeerNode ( - ACPI_PARSE_OBJECT *Op1, - ACPI_PARSE_OBJECT *Op2) -{ - ACPI_PARSE_OBJECT *Next; - - - DbgPrint (ASL_PARSE_OUTPUT, - "\nLinkPeerNode: 1=%p (%s), 2=%p (%s)\n\n", - Op1, Op1 ? UtGetOpName(Op1->Asl.ParseOpcode) : NULL, - Op2, Op2 ? UtGetOpName(Op2->Asl.ParseOpcode) : NULL); - - - if ((!Op1) && (!Op2)) - { - DbgPrint (ASL_PARSE_OUTPUT, "\nTwo Null nodes!\n"); - return Op1; - } - - /* If one of the nodes is null, just return the non-null node */ - - if (!Op2) - { - return Op1; - } - - if (!Op1) - { - return Op2; - } - - if (Op1 == Op2) - { - DbgPrint (ASL_DEBUG_OUTPUT, - "\n\n************* Internal error, linking node to itself %p\n\n\n", - Op1); - AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op1, - "Linking node to itself"); - return Op1; - } - - Op1->Asl.Parent = Op2->Asl.Parent; - - /* - * Op 1 may already have a peer list (such as an IF/ELSE pair), - * so we must walk to the end of the list and attach the new - * peer at the end - */ - Next = Op1; - while (Next->Asl.Next) - { - Next = Next->Asl.Next; - } - - Next->Asl.Next = Op2; - return Op1; -} - - -/******************************************************************************* - * - * FUNCTION: TrLinkPeerNodes - * - * PARAMETERS: NumPeers - The number of nodes in the list to follow - * ... - A list of nodes to link together as peers - * - * RETURN: The first node in the list (head of the peer list) - * - * DESCRIPTION: Link together an arbitrary number of peer nodes. - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -TrLinkPeerNodes ( - UINT32 NumPeers, - ...) -{ - ACPI_PARSE_OBJECT *This; - ACPI_PARSE_OBJECT *Next; - va_list ap; - UINT32 i; - ACPI_PARSE_OBJECT *Start; - - - DbgPrint (ASL_PARSE_OUTPUT, - "\nLinkPeerNodes: (%u) ", NumPeers); - - va_start (ap, NumPeers); - This = va_arg (ap, ACPI_PARSE_OBJECT *); - Start = This; - - /* - * Link all peers - */ - for (i = 0; i < (NumPeers -1); i++) - { - DbgPrint (ASL_PARSE_OUTPUT, "%u=%p ", (i+1), This); - - while (This->Asl.Next) - { - This = This->Asl.Next; - } - - /* Get another peer node */ - - Next = va_arg (ap, ACPI_PARSE_OBJECT *); - if (!Next) - { - Next = TrAllocateNode (PARSEOP_DEFAULT_ARG); - } - - /* link new node to the current node */ - - This->Asl.Next = Next; - This = Next; - } - va_end (ap); - - DbgPrint (ASL_PARSE_OUTPUT,"\n\n"); - return (Start); -} - - -/******************************************************************************* - * - * FUNCTION: TrLinkChildNode - * - * PARAMETERS: Op1 - Parent node - * Op2 - Op to become a child - * - * RETURN: The parent node - * - * DESCRIPTION: Link two nodes together as a parent and child - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -TrLinkChildNode ( - ACPI_PARSE_OBJECT *Op1, - ACPI_PARSE_OBJECT *Op2) -{ - ACPI_PARSE_OBJECT *Next; - - - DbgPrint (ASL_PARSE_OUTPUT, - "\nLinkChildNode: Parent=%p (%s), Child=%p (%s)\n\n", - Op1, Op1 ? UtGetOpName(Op1->Asl.ParseOpcode): NULL, - Op2, Op2 ? UtGetOpName(Op2->Asl.ParseOpcode): NULL); - - if (!Op1 || !Op2) - { - return Op1; - } - - Op1->Asl.Child = Op2; - - /* Set the child and all peers of the child to point to the parent */ - - Next = Op2; - while (Next) - { - Next->Asl.Parent = Op1; - Next = Next->Asl.Next; - } - - return Op1; -} - - -/******************************************************************************* - * - * FUNCTION: TrWalkParseTree - * - * PARAMETERS: Visitation - Type of walk - * DescendingCallback - Called during tree descent - * AscendingCallback - Called during tree ascent - * Context - To be passed to the callbacks - * - * RETURN: Status from callback(s) - * - * DESCRIPTION: Walk the entire parse tree. - * - ******************************************************************************/ - -ACPI_STATUS -TrWalkParseTree ( - ACPI_PARSE_OBJECT *Op, - UINT32 Visitation, - ASL_WALK_CALLBACK DescendingCallback, - ASL_WALK_CALLBACK AscendingCallback, - void *Context) -{ - UINT32 Level; - BOOLEAN NodePreviouslyVisited; - ACPI_PARSE_OBJECT *StartOp = Op; - ACPI_STATUS Status; - - - if (!RootNode) - { - return (AE_OK); - } - - Level = 0; - NodePreviouslyVisited = FALSE; - - switch (Visitation) - { - case ASL_WALK_VISIT_DOWNWARD: - - while (Op) - { - if (!NodePreviouslyVisited) - { - /* Let the callback process the node. */ - - Status = DescendingCallback (Op, Level, Context); - if (ACPI_SUCCESS (Status)) - { - /* Visit children first, once */ - - if (Op->Asl.Child) - { - Level++; - Op = Op->Asl.Child; - continue; - } - } - else if (Status != AE_CTRL_DEPTH) - { - /* Exit immediately on any error */ - - return (Status); - } - } - - /* Terminate walk at start op */ - - if (Op == StartOp) - { - break; - } - - /* No more children, visit peers */ - - if (Op->Asl.Next) - { - Op = Op->Asl.Next; - NodePreviouslyVisited = FALSE; - } - else - { - /* No children or peers, re-visit parent */ - - if (Level != 0 ) - { - Level--; - } - Op = Op->Asl.Parent; - NodePreviouslyVisited = TRUE; - } - } - break; - - - case ASL_WALK_VISIT_UPWARD: - - while (Op) - { - /* Visit leaf node (no children) or parent node on return trip */ - - if ((!Op->Asl.Child) || - (NodePreviouslyVisited)) - { - /* Let the callback process the node. */ - - Status = AscendingCallback (Op, Level, Context); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - else - { - /* Visit children first, once */ - - Level++; - Op = Op->Asl.Child; - continue; - } - - /* Terminate walk at start op */ - - if (Op == StartOp) - { - break; - } - - /* No more children, visit peers */ - - if (Op->Asl.Next) - { - Op = Op->Asl.Next; - NodePreviouslyVisited = FALSE; - } - else - { - /* No children or peers, re-visit parent */ - - if (Level != 0 ) - { - Level--; - } - Op = Op->Asl.Parent; - NodePreviouslyVisited = TRUE; - } - } - break; - - - case ASL_WALK_VISIT_TWICE: - - while (Op) - { - if (NodePreviouslyVisited) - { - Status = AscendingCallback (Op, Level, Context); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - else - { - /* Let the callback process the node. */ - - Status = DescendingCallback (Op, Level, Context); - if (ACPI_SUCCESS (Status)) - { - /* Visit children first, once */ - - if (Op->Asl.Child) - { - Level++; - Op = Op->Asl.Child; - continue; - } - } - else if (Status != AE_CTRL_DEPTH) - { - /* Exit immediately on any error */ - - return (Status); - } - } - - /* Terminate walk at start op */ - - if (Op == StartOp) - { - break; - } - - /* No more children, visit peers */ - - if (Op->Asl.Next) - { - Op = Op->Asl.Next; - NodePreviouslyVisited = FALSE; - } - else - { - /* No children or peers, re-visit parent */ - - if (Level != 0 ) - { - Level--; - } - Op = Op->Asl.Parent; - NodePreviouslyVisited = TRUE; - } - } - break; - - default: - /* No other types supported */ - break; - } - - /* If we get here, the walk completed with no errors */ - - return (AE_OK); -} - - diff -Nru acpica-unix-20100528/compiler/asltypes.h acpica-unix-20140114/compiler/asltypes.h --- acpica-unix-20100528/compiler/asltypes.h 2010-05-28 17:14:26.000000000 +0000 +++ acpica-unix-20140114/compiler/asltypes.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,608 +0,0 @@ - -/****************************************************************************** - * - * Module Name: asltypes.h - compiler data types and struct definitions - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - - -#ifndef __ASLTYPES_H -#define __ASLTYPES_H - - -/******************************************************************************* - * - * Structure definitions - * - ******************************************************************************/ - - -/* Op flags for the ACPI_PARSE_OBJECT */ - -#define NODE_VISITED 0x00000001 -#define NODE_AML_PACKAGE 0x00000002 -#define NODE_IS_TARGET 0x00000004 -#define NODE_IS_RESOURCE_DESC 0x00000008 -#define NODE_IS_RESOURCE_FIELD 0x00000010 -#define NODE_HAS_NO_EXIT 0x00000020 -#define NODE_IF_HAS_NO_EXIT 0x00000040 -#define NODE_NAME_INTERNALIZED 0x00000080 -#define NODE_METHOD_NO_RETVAL 0x00000100 -#define NODE_METHOD_SOME_NO_RETVAL 0x00000200 -#define NODE_RESULT_NOT_USED 0x00000400 -#define NODE_METHOD_TYPED 0x00000800 -#define NODE_IS_BIT_OFFSET 0x00001000 -#define NODE_COMPILE_TIME_CONST 0x00002000 -#define NODE_IS_TERM_ARG 0x00004000 -#define NODE_WAS_ONES_OP 0x00008000 -#define NODE_IS_NAME_DECLARATION 0x00010000 -#define NODE_COMPILER_EMITTED 0x00020000 -#define NODE_IS_DUPLICATE 0x00040000 -#define NODE_IS_RESOURCE_DATA 0x00080000 - -/* Keeps information about individual control methods */ - -typedef struct asl_method_info -{ - UINT8 NumArguments; - UINT8 LocalInitialized[ACPI_METHOD_NUM_LOCALS]; - UINT8 ArgInitialized[ACPI_METHOD_NUM_ARGS]; - UINT32 ValidArgTypes[ACPI_METHOD_NUM_ARGS]; - UINT32 ValidReturnTypes; - UINT32 NumReturnNoValue; - UINT32 NumReturnWithValue; - ACPI_PARSE_OBJECT *Op; - struct asl_method_info *Next; - UINT8 HasBeenTyped; - -} ASL_METHOD_INFO; - - -/* Parse tree walk info for control method analysis */ - -typedef struct asl_analysis_walk_info -{ - ASL_METHOD_INFO *MethodStack; - -} ASL_ANALYSIS_WALK_INFO; - - -/* An entry in the ParseOpcode to AmlOpcode mapping table */ - -typedef struct asl_mapping_entry -{ - UINT32 Value; - UINT32 AcpiBtype; /* Object type or return type */ - UINT16 AmlOpcode; - UINT8 Flags; - -} ASL_MAPPING_ENTRY; - - -/* Parse tree walk info structure */ - -typedef struct asl_walk_info -{ - ACPI_PARSE_OBJECT **NodePtr; - UINT32 *LevelPtr; - -} ASL_WALK_INFO; - - -/* File info */ - -typedef struct asl_file_info -{ - FILE *Handle; - char *Filename; - -} ASL_FILE_INFO; - -typedef struct asl_file_status -{ - UINT32 Line; - UINT32 Offset; - -} ASL_FILE_STATUS; - - -/* File types */ - -typedef enum -{ - ASL_FILE_STDOUT = 0, - ASL_FILE_STDERR, - ASL_FILE_INPUT, - ASL_FILE_AML_OUTPUT, - ASL_FILE_SOURCE_OUTPUT, - ASL_FILE_LISTING_OUTPUT, - ASL_FILE_HEX_OUTPUT, - ASL_FILE_NAMESPACE_OUTPUT, - ASL_FILE_DEBUG_OUTPUT, - ASL_FILE_ASM_SOURCE_OUTPUT, - ASL_FILE_C_SOURCE_OUTPUT, - ASL_FILE_ASM_INCLUDE_OUTPUT, - ASL_FILE_C_INCLUDE_OUTPUT - -} ASL_FILE_TYPES; - - -#define ASL_MAX_FILE_TYPE 12 -#define ASL_NUM_FILES (ASL_MAX_FILE_TYPE + 1) - - -typedef struct asl_include_dir -{ - char *Dir; - struct asl_include_dir *Next; - -} ASL_INCLUDE_DIR; - - -/* An entry in the exception list, one for each error/warning */ - -typedef struct asl_error_msg -{ - UINT32 LineNumber; - UINT32 LogicalLineNumber; - UINT32 LogicalByteOffset; - UINT32 Column; - char *Message; - struct asl_error_msg *Next; - char *Filename; - UINT32 FilenameLength; - UINT8 MessageId; - UINT8 Level; - -} ASL_ERROR_MSG; - - -/* An entry in the listing file stack (for include files) */ - -typedef struct asl_listing_node -{ - char *Filename; - UINT32 LineNumber; - struct asl_listing_node *Next; - -} ASL_LISTING_NODE; - - -/* Callback interface for a parse tree walk */ - -/* - * TBD - another copy of this is in adisasm.h, fix - */ -#ifndef ASL_WALK_CALLBACK_DEFINED -typedef -ACPI_STATUS (*ASL_WALK_CALLBACK) ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); -#define ASL_WALK_CALLBACK_DEFINED -#endif - - -typedef struct asl_event_info -{ - UINT64 StartTime; - UINT64 EndTime; - char *EventName; - BOOLEAN Valid; - -} ASL_EVENT_INFO; - - -#define ASL_WARNING 0 -#define ASL_WARNING2 1 -#define ASL_WARNING3 2 -#define ASL_ERROR 3 -#define ASL_REMARK 4 -#define ASL_OPTIMIZATION 5 -#define ASL_NUM_REPORT_LEVELS 6 - - -typedef enum -{ - ASL_MSG_RESERVED = 0, - ASL_MSG_ALPHANUMERIC_STRING, - ASL_MSG_AML_NOT_IMPLEMENTED, - ASL_MSG_ARG_COUNT_HI, - ASL_MSG_ARG_COUNT_LO, - ASL_MSG_ARG_INIT, - ASL_MSG_BACKWARDS_OFFSET, - ASL_MSG_BITS_TO_BYTES, - ASL_MSG_BUFFER_LENGTH, - ASL_MSG_BYTES_TO_BITS, - ASL_MSG_CLOSE, - ASL_MSG_COMPILER_INTERNAL, - ASL_MSG_CONSTANT_EVALUATION, - ASL_MSG_CONSTANT_FOLDED, - ASL_MSG_CORE_EXCEPTION, - ASL_MSG_DEBUG_FILE_OPEN, - ASL_MSG_DEBUG_FILENAME, - ASL_MSG_DEPENDENT_NESTING, - ASL_MSG_DMA_CHANNEL, - ASL_MSG_DMA_LIST, - ASL_MSG_DUPLICATE_CASE, - ASL_MSG_DUPLICATE_ITEM, - ASL_MSG_EARLY_EOF, - ASL_MSG_ENCODING_LENGTH, - ASL_MSG_EX_INTERRUPT_LIST, - ASL_MSG_EX_INTERRUPT_LIST_MIN, - ASL_MSG_EX_INTERRUPT_NUMBER, - ASL_MSG_FIELD_ACCESS_WIDTH, - ASL_MSG_FIELD_UNIT_ACCESS_WIDTH, - ASL_MSG_FIELD_UNIT_OFFSET, - ASL_MSG_INCLUDE_FILE_OPEN, - ASL_MSG_INPUT_FILE_OPEN, - ASL_MSG_INTEGER_LENGTH, - ASL_MSG_INTEGER_OPTIMIZATION, - ASL_MSG_INTERRUPT_LIST, - ASL_MSG_INTERRUPT_NUMBER, - ASL_MSG_INVALID_CONSTANT_OP, - ASL_MSG_INVALID_EISAID, - ASL_MSG_INVALID_ESCAPE, - ASL_MSG_INVALID_OPERAND, - ASL_MSG_INVALID_PERFORMANCE, - ASL_MSG_INVALID_PRIORITY, - ASL_MSG_INVALID_STRING, - ASL_MSG_INVALID_TARGET, - ASL_MSG_INVALID_TIME, - ASL_MSG_INVALID_TYPE, - ASL_MSG_INVALID_UUID, - ASL_MSG_LIST_LENGTH_LONG, - ASL_MSG_LIST_LENGTH_SHORT, - ASL_MSG_LISTING_FILE_OPEN, - ASL_MSG_LISTING_FILENAME, - ASL_MSG_LOCAL_INIT, - ASL_MSG_LONG_LINE, - ASL_MSG_MEMORY_ALLOCATION, - ASL_MSG_MISSING_ENDDEPENDENT, - ASL_MSG_MISSING_STARTDEPENDENT, - ASL_MSG_MULTIPLE_TYPES, - ASL_MSG_NAME_EXISTS, - ASL_MSG_NAME_OPTIMIZATION, - ASL_MSG_NESTED_COMMENT, - ASL_MSG_NO_CASES, - ASL_MSG_NO_RETVAL, - ASL_MSG_NO_WHILE, - ASL_MSG_NON_ASCII, - ASL_MSG_NOT_EXIST, - ASL_MSG_NOT_FOUND, - ASL_MSG_NOT_METHOD, - ASL_MSG_NOT_PARAMETER, - ASL_MSG_NOT_REACHABLE, - ASL_MSG_OPEN, - ASL_MSG_OUTPUT_FILE_OPEN, - ASL_MSG_OUTPUT_FILENAME, - ASL_MSG_PACKAGE_LENGTH, - ASL_MSG_READ, - ASL_MSG_RECURSION, - ASL_MSG_REGION_BUFFER_ACCESS, - ASL_MSG_REGION_BYTE_ACCESS, - ASL_MSG_RESERVED_ARG_COUNT_HI, - ASL_MSG_RESERVED_ARG_COUNT_LO, - ASL_MSG_RESERVED_METHOD, - ASL_MSG_RESERVED_OPERAND_TYPE, - ASL_MSG_RESERVED_RETURN_VALUE, - ASL_MSG_RESERVED_USE, - ASL_MSG_RESERVED_WORD, - ASL_MSG_RESOURCE_FIELD, - ASL_MSG_RESOURCE_INDEX, - ASL_MSG_RESOURCE_LIST, - ASL_MSG_RESOURCE_SOURCE, - ASL_MSG_RETURN_TYPES, - ASL_MSG_SCOPE_FWD_REF, - ASL_MSG_SCOPE_TYPE, - ASL_MSG_SEEK, - ASL_MSG_SINGLE_NAME_OPTIMIZATION, - ASL_MSG_SOME_NO_RETVAL, - ASL_MSG_SWITCH_TYPE, - ASL_MSG_SYNC_LEVEL, - ASL_MSG_SYNTAX, - ASL_MSG_TABLE_SIGNATURE, - ASL_MSG_TOO_MANY_TEMPS, - ASL_MSG_UNKNOWN_RESERVED_NAME, - ASL_MSG_UNREACHABLE_CODE, - ASL_MSG_UNSUPPORTED, - ASL_MSG_VENDOR_LIST, - ASL_MSG_WRITE, - ASL_MSG_MULTIPLE_DEFAULT, - ASL_MSG_TIMEOUT, - ASL_MSG_RESULT_NOT_USED, - ASL_MSG_NOT_REFERENCED, - ASL_MSG_NON_ZERO, - ASL_MSG_STRING_LENGTH, - ASL_MSG_SERIALIZED, - ASL_MSG_COMPILER_RESERVED, - ASL_MSG_NAMED_OBJECT_IN_WHILE, - ASL_MSG_LOCAL_OUTSIDE_METHOD, - ASL_MSG_ALIGNMENT, - ASL_MSG_ISA_ADDRESS, - ASL_MSG_INVALID_MIN_MAX, - ASL_MSG_INVALID_LENGTH, - ASL_MSG_INVALID_LENGTH_FIXED, - ASL_MSG_INVALID_GRANULARITY, - ASL_MSG_INVALID_GRAN_FIXED, - ASL_MSG_INVALID_ACCESS_SIZE, - ASL_MSG_INVALID_ADDR_FLAGS, - ASL_MSG_INVALID_FIELD_NAME, - ASL_MSG_INTEGER_SIZE, - ASL_MSG_INVALID_HEX_INTEGER, - ASL_MSG_BUFFER_ELEMENT, - ASL_MSG_RESERVED_VALUE, - ASL_MSG_FLAG_VALUE, - ASL_MSG_ZERO_VALUE, - ASL_MSG_UNKNOWN_TABLE, - ASL_MSG_UNKNOWN_SUBTABLE, - ASL_MSG_OEM_TABLE - -} ASL_MESSAGE_IDS; - -#ifdef ASL_EXCEPTIONS - -char *AslMessages [] = { -/* The zeroth message is reserved */ "", -/* ASL_MSG_ALPHANUMERIC_STRING */ "String must be entirely alphanumeric", -/* ASL_MSG_AML_NOT_IMPLEMENTED */ "Opcode is not implemented in compiler AML code generator", -/* ASL_MSG_ARG_COUNT_HI */ "Too many arguments", -/* ASL_MSG_ARG_COUNT_LO */ "Too few arguments", -/* ASL_MSG_ARG_INIT */ "Method argument is not initialized", -/* ASL_MSG_BACKWARDS_OFFSET */ "Invalid backwards offset", -/* ASL_MSG_BITS_TO_BYTES */ "Field offset is in bits, but a byte offset is required", -/* ASL_MSG_BUFFER_LENGTH */ "Effective AML buffer length is zero", -/* ASL_MSG_BYTES_TO_BITS */ "Field offset is in bytes, but a bit offset is required", -/* ASL_MSG_CLOSE */ "Could not close file", -/* ASL_MSG_COMPILER_INTERNAL */ "Internal compiler error", -/* ASL_MSG_CONSTANT_EVALUATION */ "Could not evaluate constant expression", -/* ASL_MSG_CONSTANT_FOLDED */ "Constant expression evaluated and reduced", -/* ASL_MSG_CORE_EXCEPTION */ "From ACPI CA Subsystem", -/* ASL_MSG_DEBUG_FILE_OPEN */ "Could not open debug file", -/* ASL_MSG_DEBUG_FILENAME */ "Could not create debug filename", -/* ASL_MSG_DEPENDENT_NESTING */ "Dependent function macros cannot be nested",\ -/* ASL_MSG_DMA_CHANNEL */ "Invalid DMA channel (must be 0-7)", -/* ASL_MSG_DMA_LIST */ "Too many DMA channels (8 max)", -/* ASL_MSG_DUPLICATE_CASE */ "Case value already specified", -/* ASL_MSG_DUPLICATE_ITEM */ "Duplicate value in list", -/* ASL_MSG_EARLY_EOF */ "Premature end-of-file reached", -/* ASL_MSG_ENCODING_LENGTH */ "Package length too long to encode", -/* ASL_MSG_EX_INTERRUPT_LIST */ "Too many interrupts (255 max)", -/* ASL_MSG_EX_INTERRUPT_LIST_MIN */ "Too few interrupts (1 minimum required)", -/* ASL_MSG_EX_INTERRUPT_NUMBER */ "Invalid interrupt number (must be 32 bits)", -/* ASL_MSG_FIELD_ACCESS_WIDTH */ "Access width is greater than region size", -/* ASL_MSG_FIELD_UNIT_ACCESS_WIDTH */ "Access width of Field Unit extends beyond region limit", -/* ASL_MSG_FIELD_UNIT_OFFSET */ "Field Unit extends beyond region limit", -/* ASL_MSG_INCLUDE_FILE_OPEN */ "Could not open include file", -/* ASL_MSG_INPUT_FILE_OPEN */ "Could not open input file", -/* ASL_MSG_INTEGER_LENGTH */ "64-bit integer in 32-bit table, truncating", -/* ASL_MSG_INTEGER_OPTIMIZATION */ "Integer optimized to single-byte AML opcode", -/* ASL_MSG_INTERRUPT_LIST */ "Too many interrupts (16 max)", -/* ASL_MSG_INTERRUPT_NUMBER */ "Invalid interrupt number (must be 0-15)", -/* ASL_MSG_INVALID_CONSTANT_OP */ "Invalid operator in constant expression (not type 3/4/5)", -/* ASL_MSG_INVALID_EISAID */ "EISAID string must be of the form \"UUUXXXX\" (3 uppercase, 4 hex digits)", -/* ASL_MSG_INVALID_ESCAPE */ "Invalid or unknown escape sequence", -/* ASL_MSG_INVALID_OPERAND */ "Invalid operand", -/* ASL_MSG_INVALID_PERFORMANCE */ "Invalid performance/robustness value", -/* ASL_MSG_INVALID_PRIORITY */ "Invalid priority value", -/* ASL_MSG_INVALID_STRING */ "Invalid Hex/Octal Escape - Non-ASCII or NULL", -/* ASL_MSG_INVALID_TARGET */ "Target operand not allowed in constant expression", -/* ASL_MSG_INVALID_TIME */ "Time parameter too long (255 max)", -/* ASL_MSG_INVALID_TYPE */ "Invalid type", -/* ASL_MSG_INVALID_UUID */ "UUID string must be of the form \"aabbccdd-eeff-gghh-iijj-kkllmmnnoopp\"", -/* ASL_MSG_LIST_LENGTH_LONG */ "Initializer list longer than declared package length", -/* ASL_MSG_LIST_LENGTH_SHORT */ "Initializer list shorter than declared package length", -/* ASL_MSG_LISTING_FILE_OPEN */ "Could not open listing file", -/* ASL_MSG_LISTING_FILENAME */ "Could not create listing filename", -/* ASL_MSG_LOCAL_INIT */ "Method local variable is not initialized", -/* ASL_MSG_LONG_LINE */ "Splitting long input line", -/* ASL_MSG_MEMORY_ALLOCATION */ "Memory allocation failure", -/* ASL_MSG_MISSING_ENDDEPENDENT */ "Missing EndDependentFn() macro in dependent resource list", -/* ASL_MSG_MISSING_STARTDEPENDENT */ "Missing StartDependentFn() macro in dependent resource list", -/* ASL_MSG_MULTIPLE_TYPES */ "Multiple types", -/* ASL_MSG_NAME_EXISTS */ "Name already exists in scope", -/* ASL_MSG_NAME_OPTIMIZATION */ "NamePath optimized", -/* ASL_MSG_NESTED_COMMENT */ "Nested comment found", -/* ASL_MSG_NO_CASES */ "No Case statements under Switch", -/* ASL_MSG_NO_RETVAL */ "Called method returns no value", -/* ASL_MSG_NO_WHILE */ "No enclosing While statement", -/* ASL_MSG_NON_ASCII */ "Invalid characters found in file", -/* ASL_MSG_NOT_EXIST */ "Object does not exist", -/* ASL_MSG_NOT_FOUND */ "Object not found or not accessible from scope", -/* ASL_MSG_NOT_METHOD */ "Not a control method, cannot invoke", -/* ASL_MSG_NOT_PARAMETER */ "Not a parameter, used as local only", -/* ASL_MSG_NOT_REACHABLE */ "Object is not accessible from this scope", -/* ASL_MSG_OPEN */ "Could not open file", -/* ASL_MSG_OUTPUT_FILE_OPEN */ "Could not open output AML file", -/* ASL_MSG_OUTPUT_FILENAME */ "Could not create output filename", -/* ASL_MSG_PACKAGE_LENGTH */ "Effective AML package length is zero", -/* ASL_MSG_READ */ "Could not read file", -/* ASL_MSG_RECURSION */ "Recursive method call", -/* ASL_MSG_REGION_BUFFER_ACCESS */ "Host Operation Region requires BufferAcc access", -/* ASL_MSG_REGION_BYTE_ACCESS */ "Host Operation Region requires ByteAcc access", -/* ASL_MSG_RESERVED_ARG_COUNT_HI */ "Reserved method has too many arguments", -/* ASL_MSG_RESERVED_ARG_COUNT_LO */ "Reserved method has too few arguments", -/* ASL_MSG_RESERVED_METHOD */ "Reserved name must be a control method", -/* ASL_MSG_RESERVED_OPERAND_TYPE */ "Invalid object type for reserved name", -/* ASL_MSG_RESERVED_RETURN_VALUE */ "Reserved method must return a value", -/* ASL_MSG_RESERVED_USE */ "Invalid use of reserved name", -/* ASL_MSG_RESERVED_WORD */ "Use of reserved name", -/* ASL_MSG_RESOURCE_FIELD */ "Resource field name cannot be used as a target", -/* ASL_MSG_RESOURCE_INDEX */ "Missing ResourceSourceIndex (required)", -/* ASL_MSG_RESOURCE_LIST */ "Too many resource items (internal error)", -/* ASL_MSG_RESOURCE_SOURCE */ "Missing ResourceSource string (required)", -/* ASL_MSG_RETURN_TYPES */ "Not all control paths return a value", -/* ASL_MSG_SCOPE_FWD_REF */ "Forward references from Scope operator not allowed", -/* ASL_MSG_SCOPE_TYPE */ "Existing object has invalid type for Scope operator", -/* ASL_MSG_SEEK */ "Could not seek file", -/* ASL_MSG_SINGLE_NAME_OPTIMIZATION */ "NamePath optimized to NameSeg (uses run-time search path)", -/* ASL_MSG_SOME_NO_RETVAL */ "Called method may not always return a value", -/* ASL_MSG_SWITCH_TYPE */ "Switch expression is not a static Integer/Buffer/String data type, defaulting to Integer", -/* ASL_MSG_SYNC_LEVEL */ "SyncLevel must be in the range 0-15", -/* ASL_MSG_SYNTAX */ "", -/* ASL_MSG_TABLE_SIGNATURE */ "Invalid Table Signature", -/* ASL_MSG_TOO_MANY_TEMPS */ "Method requires too many temporary variables (_T_x)", -/* ASL_MSG_UNKNOWN_RESERVED_NAME */ "Unknown reserved name", -/* ASL_MSG_UNREACHABLE_CODE */ "Statement is unreachable", -/* ASL_MSG_UNSUPPORTED */ "Unsupported feature", -/* ASL_MSG_VENDOR_LIST */ "Too many vendor data bytes (7 max)", -/* ASL_MSG_WRITE */ "Could not write file", -/* ASL_MSG_MULTIPLE_DEFAULT */ "More than one Default statement within Switch construct", -/* ASL_MSG_TIMEOUT */ "Possible operator timeout is ignored", -/* ASL_MSG_RESULT_NOT_USED */ "Result is not used, operator has no effect", -/* ASL_MSG_NOT_REFERENCED */ "Namespace object is not referenced", -/* ASL_MSG_NON_ZERO */ "Operand evaluates to zero", -/* ASL_MSG_STRING_LENGTH */ "String literal too long", -/* ASL_MSG_SERIALIZED */ "Control Method marked Serialized", -/* ASL_MSG_COMPILER_RESERVED */ "Use of compiler reserved name", -/* ASL_MSG_NAMED_OBJECT_IN_WHILE */ "Creating a named object in a While loop", -/* ASL_MSG_LOCAL_OUTSIDE_METHOD */ "Local or Arg used outside a control method", -/* ASL_MSG_ALIGNMENT */ "Must be a multiple of alignment/granularity value", -/* ASL_MSG_ISA_ADDRESS */ "Maximum 10-bit ISA address (0x3FF)", -/* ASL_MSG_INVALID_MIN_MAX */ "Address Min is greater than Address Max", -/* ASL_MSG_INVALID_LENGTH */ "Length is larger than Min/Max window", -/* ASL_MSG_INVALID_LENGTH_FIXED */ "Length is not equal to fixed Min/Max window", -/* ASL_MSG_INVALID_GRANULARITY */ "Granularity must be zero or a power of two minus one", -/* ASL_MSG_INVALID_GRAN_FIXED */ "Granularity must be zero for fixed Min/Max", -/* ASL_MSG_INVALID_ACCESS_SIZE */ "Invalid AccessSize (Maximum is 4 - QWord access)", -/* ASL_MSG_INVALID_ADDR_FLAGS */ "Invalid combination of Length and Min/Max fixed flags", - -/* These messages are used by the data table compiler only */ - -/* ASL_MSG_INVALID_FIELD_NAME */ "Invalid Field Name", -/* ASL_MSG_INTEGER_SIZE */ "Integer too large for target", -/* ASL_MSG_INVALID_HEX_INTEGER */ "Invalid hex integer constant", -/* ASL_MSG_BUFFER_ELEMENT */ "Invalid element in buffer initializer list", -/* ASL_MSG_RESERVED_VALUE */ "Reserved field must be zero", -/* ASL_MSG_FLAG_VALUE */ "Flag value is too large", -/* ASL_MSG_ZERO_VALUE */ "Value must be non-zero", -/* ASL_MSG_UNKNOWN_TABLE */ "Unknown ACPI table signature", -/* ASL_MSG_UNKNOWN_SUBTABLE */ "Unknown subtable type", -/* ASL_MSG_OEM_TABLE */ "OEM table - unknown contents" - -}; - - -char *AslErrorLevel [ASL_NUM_REPORT_LEVELS] = { - "Warning ", - "Warning ", - "Warning ", - "Error ", - "Remark ", - "Optimize" -}; - -#define ASL_ERROR_LEVEL_LENGTH 8 /* Length of strings above */ - -#endif /* ASL_EXCEPTIONS */ - -#endif /* __ASLTYPES_H */ diff -Nru acpica-unix-20100528/compiler/aslutils.c acpica-unix-20140114/compiler/aslutils.c --- acpica-unix-20100528/compiler/aslutils.c 2010-05-28 17:14:26.000000000 +0000 +++ acpica-unix-20140114/compiler/aslutils.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1086 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslutils -- compiler utilities - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - - -#include "aslcompiler.h" -#include "aslcompiler.y.h" -#include "acnamesp.h" -#include "amlcode.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslutils") - -#ifdef _USE_BERKELEY_YACC -extern const char * const AslCompilername[]; -static const char * const *yytname = &AslCompilername[254]; -#else -extern const char * const yytname[]; -#endif - -char HexLookup[] = -{ - '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' -}; - - -/* Local prototypes */ - -static ACPI_STATUS -UtStrtoul64 ( - char *String, - UINT32 Base, - UINT64 *RetInteger); - -static void -UtPadNameWithUnderscores ( - char *NameSeg, - char *PaddedNameSeg); - -static void -UtAttachNameseg ( - ACPI_PARSE_OBJECT *Op, - char *Name); - - -/******************************************************************************* - * - * FUNCTION: AcpiPsDisplayConstantOpcodes - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Print AML opcodes that can be used in constant expressions. - * - ******************************************************************************/ - -void -UtDisplayConstantOpcodes ( - void) -{ - UINT32 i; - - - printf ("Constant expression opcode information\n\n"); - - for (i = 0; i < sizeof (AcpiGbl_AmlOpInfo) / sizeof (ACPI_OPCODE_INFO); i++) - { - if (AcpiGbl_AmlOpInfo[i].Flags & AML_CONSTANT) - { - printf ("%s\n", AcpiGbl_AmlOpInfo[i].Name); - } - } -} - - -/******************************************************************************* - * - * FUNCTION: UtLocalCalloc - * - * PARAMETERS: Size - Bytes to be allocated - * - * RETURN: Pointer to the allocated memory. Guaranteed to be valid. - * - * DESCRIPTION: Allocate zero-initialized memory. Aborts the compile on an - * allocation failure, on the assumption that nothing more can be - * accomplished. - * - ******************************************************************************/ - -void * -UtLocalCalloc ( - UINT32 Size) -{ - void *Allocated; - - - Allocated = ACPI_ALLOCATE_ZEROED (Size); - if (!Allocated) - { - AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_InputByteCount, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); - - CmCleanupAndExit (); - exit (1); - } - - TotalAllocations++; - TotalAllocated += Size; - return (Allocated); -} - - -/******************************************************************************* - * - * FUNCTION: UtBeginEvent - * - * PARAMETERS: Name - Ascii name of this event - * - * RETURN: Event - Event number (integer index) - * - * DESCRIPTION: Saves the current time with this event - * - ******************************************************************************/ - -UINT8 -UtBeginEvent ( - char *Name) -{ - - if (AslGbl_NextEvent >= ASL_NUM_EVENTS) - { - AcpiOsPrintf ("Ran out of compiler event structs!\n"); - return (AslGbl_NextEvent); - } - - /* Init event with current (start) time */ - - AslGbl_Events[AslGbl_NextEvent].StartTime = AcpiOsGetTimer (); - AslGbl_Events[AslGbl_NextEvent].EventName = Name; - AslGbl_Events[AslGbl_NextEvent].Valid = TRUE; - - return (AslGbl_NextEvent++); -} - - -/******************************************************************************* - * - * FUNCTION: UtEndEvent - * - * PARAMETERS: Event - Event number (integer index) - * - * RETURN: None - * - * DESCRIPTION: Saves the current time (end time) with this event - * - ******************************************************************************/ - -void -UtEndEvent ( - UINT8 Event) -{ - - if (Event >= ASL_NUM_EVENTS) - { - return; - } - - /* Insert end time for event */ - - AslGbl_Events[Event].EndTime = AcpiOsGetTimer (); -} - - -/******************************************************************************* - * - * FUNCTION: UtHexCharToValue - * - * PARAMETERS: HexChar - Hex character in Ascii - * - * RETURN: The binary value of the hex character - * - * DESCRIPTION: Perform ascii-to-hex translation - * - ******************************************************************************/ - -UINT8 -UtHexCharToValue ( - int HexChar) -{ - - if (HexChar <= 0x39) - { - return ((UINT8) (HexChar - 0x30)); - } - - if (HexChar <= 0x46) - { - return ((UINT8) (HexChar - 0x37)); - } - - return ((UINT8) (HexChar - 0x57)); -} - - -/******************************************************************************* - * - * FUNCTION: UtConvertByteToHex - * - * PARAMETERS: RawByte - Binary data - * Buffer - Pointer to where the hex bytes will be stored - * - * RETURN: Ascii hex byte is stored in Buffer. - * - * DESCRIPTION: Perform hex-to-ascii translation. The return data is prefixed - * with "0x" - * - ******************************************************************************/ - -void -UtConvertByteToHex ( - UINT8 RawByte, - UINT8 *Buffer) -{ - - Buffer[0] = '0'; - Buffer[1] = 'x'; - - Buffer[2] = (UINT8) HexLookup[(RawByte >> 4) & 0xF]; - Buffer[3] = (UINT8) HexLookup[RawByte & 0xF]; -} - - -/******************************************************************************* - * - * FUNCTION: UtConvertByteToAsmHex - * - * PARAMETERS: RawByte - Binary data - * Buffer - Pointer to where the hex bytes will be stored - * - * RETURN: Ascii hex byte is stored in Buffer. - * - * DESCRIPTION: Perform hex-to-ascii translation. The return data is prefixed - * with "0x" - * - ******************************************************************************/ - -void -UtConvertByteToAsmHex ( - UINT8 RawByte, - UINT8 *Buffer) -{ - - Buffer[0] = '0'; - Buffer[1] = (UINT8) HexLookup[(RawByte >> 4) & 0xF]; - Buffer[2] = (UINT8) HexLookup[RawByte & 0xF]; - Buffer[3] = 'h'; -} - - -/******************************************************************************* - * - * FUNCTION: DbgPrint - * - * PARAMETERS: Type - Type of output - * Fmt - Printf format string - * ... - variable printf list - * - * RETURN: None - * - * DESCRIPTION: Conditional print statement. Prints to stderr only if the - * debug flag is set. - * - ******************************************************************************/ - -void -DbgPrint ( - UINT32 Type, - char *Fmt, - ...) -{ - va_list Args; - - - va_start (Args, Fmt); - - if (!Gbl_DebugFlag) - { - return; - } - - if ((Type == ASL_PARSE_OUTPUT) && - (!(AslCompilerdebug))) - { - return; - } - - (void) vfprintf (stderr, Fmt, Args); - va_end (Args); - return; -} - - -/******************************************************************************* - * - * FUNCTION: UtPrintFormattedName - * - * PARAMETERS: ParseOpcode - Parser keyword ID - * Level - Indentation level - * - * RETURN: None - * - * DESCRIPTION: Print the ascii name of the parse opcode. - * - ******************************************************************************/ - -#define TEXT_OFFSET 10 - -void -UtPrintFormattedName ( - UINT16 ParseOpcode, - UINT32 Level) -{ - - if (Level) - { - DbgPrint (ASL_TREE_OUTPUT, - "%*s", (3 * Level), " "); - } - DbgPrint (ASL_TREE_OUTPUT, - " %-20.20s", UtGetOpName (ParseOpcode)); - - if (Level < TEXT_OFFSET) - { - DbgPrint (ASL_TREE_OUTPUT, - "%*s", (TEXT_OFFSET - Level) * 3, " "); - } -} - - -/******************************************************************************* - * - * FUNCTION: UtSetParseOpName - * - * PARAMETERS: Op - * - * RETURN: None - * - * DESCRIPTION: Insert the ascii name of the parse opcode - * - ******************************************************************************/ - -void -UtSetParseOpName ( - ACPI_PARSE_OBJECT *Op) -{ - - strncpy (Op->Asl.ParseOpName, UtGetOpName (Op->Asl.ParseOpcode), - ACPI_MAX_PARSEOP_NAME); -} - - -/******************************************************************************* - * - * FUNCTION: UtGetOpName - * - * PARAMETERS: ParseOpcode - Parser keyword ID - * - * RETURN: Pointer to the opcode name - * - * DESCRIPTION: Get the ascii name of the parse opcode - * - ******************************************************************************/ - -char * -UtGetOpName ( - UINT32 ParseOpcode) -{ - - /* - * First entries (ASL_YYTNAME_START) in yytname are special reserved names. - * Ignore first 8 characters of the name - */ - return ((char *) yytname - [(ParseOpcode - ASL_FIRST_PARSE_OPCODE) + ASL_YYTNAME_START] + 8); -} - - -/******************************************************************************* - * - * FUNCTION: UtDisplaySummary - * - * PARAMETERS: FileID - ID of outpout file - * - * RETURN: None - * - * DESCRIPTION: Display compilation statistics - * - ******************************************************************************/ - -void -UtDisplaySummary ( - UINT32 FileId) -{ - - if (FileId != ASL_FILE_STDOUT) - { - /* Compiler name and version number */ - - FlPrintFile (FileId, "%s version %X [%s]\n", - CompilerId, (UINT32) ACPI_CA_VERSION, __DATE__); - } - - if (Gbl_FileType == ASL_INPUT_TYPE_ASCII_DATA) - { - FlPrintFile (FileId, - "Table Input: %s - %u lines, %u bytes, %u fields\n", - Gbl_Files[ASL_FILE_INPUT].Filename, Gbl_CurrentLineNumber, - Gbl_InputByteCount, Gbl_InputFieldCount); - - if ((Gbl_ExceptionCount[ASL_ERROR] == 0) || (Gbl_IgnoreErrors)) - { - FlPrintFile (FileId, - "Binary Output: %s - %u bytes\n\n", - Gbl_Files[ASL_FILE_AML_OUTPUT].Filename, Gbl_TableLength); - } - } - else - { - /* Input/Output summary */ - - FlPrintFile (FileId, - "ASL Input: %s - %u lines, %u bytes, %u keywords\n", - Gbl_Files[ASL_FILE_INPUT].Filename, Gbl_CurrentLineNumber, - Gbl_InputByteCount, TotalKeywords); - - /* AML summary */ - - if ((Gbl_ExceptionCount[ASL_ERROR] == 0) || (Gbl_IgnoreErrors)) - { - FlPrintFile (FileId, - "AML Output: %s - %u bytes, %u named objects, %u executable opcodes\n\n", - Gbl_Files[ASL_FILE_AML_OUTPUT].Filename, Gbl_TableLength, - TotalNamedObjects, TotalExecutableOpcodes); - } - } - - /* Error summary */ - - FlPrintFile (FileId, - "Compilation complete. %u Errors, %u Warnings, %u Remarks", - Gbl_ExceptionCount[ASL_ERROR], - Gbl_ExceptionCount[ASL_WARNING] + - Gbl_ExceptionCount[ASL_WARNING2] + - Gbl_ExceptionCount[ASL_WARNING3], - Gbl_ExceptionCount[ASL_REMARK]); - - if (Gbl_FileType != ASL_INPUT_TYPE_ASCII_DATA) - { - FlPrintFile (FileId, - ", %u Optimizations", Gbl_ExceptionCount[ASL_OPTIMIZATION]); - } - - FlPrintFile (FileId, "\n"); -} - - -/******************************************************************************* - * - * FUNCTION: UtDisplaySummary - * - * PARAMETERS: Op - Integer parse node - * LowValue - Smallest allowed value - * HighValue - Largest allowed value - * - * RETURN: Op if OK, otherwise NULL - * - * DESCRIPTION: Check integer for an allowable range - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -UtCheckIntegerRange ( - ACPI_PARSE_OBJECT *Op, - UINT32 LowValue, - UINT32 HighValue) -{ - char *ParseError = NULL; - char Buffer[64]; - - - if (!Op) - { - return NULL; - } - - if (Op->Asl.Value.Integer < LowValue) - { - ParseError = "Value below valid range"; - Op->Asl.Value.Integer = LowValue; - } - - if (Op->Asl.Value.Integer > HighValue) - { - ParseError = "Value above valid range"; - Op->Asl.Value.Integer = HighValue; - } - - if (ParseError) - { - sprintf (Buffer, "%s 0x%X-0x%X", ParseError, LowValue, HighValue); - AslCompilererror (Buffer); - - return NULL; - } - - return Op; -} - - -/******************************************************************************* - * - * FUNCTION: UtGetStringBuffer - * - * PARAMETERS: Length - Size of buffer requested - * - * RETURN: Pointer to the buffer. Aborts on allocation failure - * - * DESCRIPTION: Allocate a string buffer. Bypass the local - * dynamic memory manager for performance reasons (This has a - * major impact on the speed of the compiler.) - * - ******************************************************************************/ - -char * -UtGetStringBuffer ( - UINT32 Length) -{ - char *Buffer; - - - if ((Gbl_StringCacheNext + Length) >= Gbl_StringCacheLast) - { - Gbl_StringCacheNext = UtLocalCalloc (ASL_STRING_CACHE_SIZE + Length); - Gbl_StringCacheLast = Gbl_StringCacheNext + ASL_STRING_CACHE_SIZE + - Length; - } - - Buffer = Gbl_StringCacheNext; - Gbl_StringCacheNext += Length; - - return (Buffer); -} - - -/******************************************************************************* - * - * FUNCTION: UtInternalizeName - * - * PARAMETERS: ExternalName - Name to convert - * ConvertedName - Where the converted name is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert an external (ASL) name to an internal (AML) name - * - ******************************************************************************/ - -ACPI_STATUS -UtInternalizeName ( - char *ExternalName, - char **ConvertedName) -{ - ACPI_NAMESTRING_INFO Info; - ACPI_STATUS Status; - - - if (!ExternalName) - { - return (AE_OK); - } - - /* Get the length of the new internal name */ - - Info.ExternalName = ExternalName; - AcpiNsGetInternalNameLength (&Info); - - /* We need a segment to store the internal name */ - - Info.InternalName = UtGetStringBuffer (Info.Length); - if (!Info.InternalName) - { - return (AE_NO_MEMORY); - } - - /* Build the name */ - - Status = AcpiNsBuildInternalName (&Info); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - *ConvertedName = Info.InternalName; - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: UtPadNameWithUnderscores - * - * PARAMETERS: NameSeg - Input nameseg - * PaddedNameSeg - Output padded nameseg - * - * RETURN: Padded nameseg. - * - * DESCRIPTION: Pads a NameSeg with underscores if necessary to form a full - * ACPI_NAME. - * - ******************************************************************************/ - -static void -UtPadNameWithUnderscores ( - char *NameSeg, - char *PaddedNameSeg) -{ - UINT32 i; - - - for (i = 0; (i < ACPI_NAME_SIZE); i++) - { - if (*NameSeg) - { - *PaddedNameSeg = *NameSeg; - NameSeg++; - } - else - { - *PaddedNameSeg = '_'; - } - PaddedNameSeg++; - } -} - - -/******************************************************************************* - * - * FUNCTION: UtAttachNameseg - * - * PARAMETERS: Op - Parent parse node - * Name - Full ExternalName - * - * RETURN: None; Sets the NameSeg field in parent node - * - * DESCRIPTION: Extract the last nameseg of the ExternalName and store it - * in the NameSeg field of the Op. - * - ******************************************************************************/ - -static void -UtAttachNameseg ( - ACPI_PARSE_OBJECT *Op, - char *Name) -{ - char *NameSeg; - char PaddedNameSeg[4]; - - - if (!Name) - { - return; - } - - /* Look for the last dot in the namepath */ - - NameSeg = strrchr (Name, '.'); - if (NameSeg) - { - /* Found last dot, we have also found the final nameseg */ - - NameSeg++; - UtPadNameWithUnderscores (NameSeg, PaddedNameSeg); - } - else - { - /* No dots in the namepath, there is only a single nameseg. */ - /* Handle prefixes */ - - while ((*Name == '\\') || (*Name == '^')) - { - Name++; - } - - /* Remaing string should be one single nameseg */ - - UtPadNameWithUnderscores (Name, PaddedNameSeg); - } - - strncpy (Op->Asl.NameSeg, PaddedNameSeg, 4); -} - - -/******************************************************************************* - * - * FUNCTION: UtAttachNamepathToOwner - * - * PARAMETERS: Op - Parent parse node - * NameOp - Node that contains the name - * - * RETURN: Sets the ExternalName and Namepath in the parent node - * - * DESCRIPTION: Store the name in two forms in the parent node: The original - * (external) name, and the internalized name that is used within - * the ACPI namespace manager. - * - ******************************************************************************/ - -void -UtAttachNamepathToOwner ( - ACPI_PARSE_OBJECT *Op, - ACPI_PARSE_OBJECT *NameOp) -{ - ACPI_STATUS Status; - - - /* Full external path */ - - Op->Asl.ExternalName = NameOp->Asl.Value.String; - - /* Save the NameOp for possible error reporting later */ - - Op->Asl.ParentMethod = (void *) NameOp; - - /* Last nameseg of the path */ - - UtAttachNameseg (Op, Op->Asl.ExternalName); - - /* Create internalized path */ - - Status = UtInternalizeName (NameOp->Asl.Value.String, &Op->Asl.Namepath); - if (ACPI_FAILURE (Status)) - { - /* TBD: abort on no memory */ - } -} - - -/******************************************************************************* - * - * FUNCTION: UtDoConstant - * - * PARAMETERS: String - Hex, Octal, or Decimal string - * - * RETURN: Converted Integer - * - * DESCRIPTION: Convert a string to an integer. With error checking. - * - ******************************************************************************/ - -UINT64 -UtDoConstant ( - char *String) -{ - ACPI_STATUS Status; - UINT64 Converted; - char ErrBuf[64]; - - - Status = UtStrtoul64 (String, 0, &Converted); - if (ACPI_FAILURE (Status)) - { - sprintf (ErrBuf, "%s %s\n", "Conversion error:", - AcpiFormatException (Status)); - AslCompilererror (ErrBuf); - } - - return (Converted); -} - - -/* TBD: use version in ACPI CA main code base? */ - -/******************************************************************************* - * - * FUNCTION: UtStrtoul64 - * - * PARAMETERS: String - Null terminated string - * Terminater - Where a pointer to the terminating byte is - * returned - * Base - Radix of the string - * - * RETURN: Converted value - * - * DESCRIPTION: Convert a string into an unsigned value. - * - ******************************************************************************/ - -static ACPI_STATUS -UtStrtoul64 ( - char *String, - UINT32 Base, - UINT64 *RetInteger) -{ - UINT32 Index; - UINT32 Sign; - UINT64 ReturnValue = 0; - ACPI_STATUS Status = AE_OK; - - - *RetInteger = 0; - - switch (Base) - { - case 0: - case 8: - case 10: - case 16: - break; - - default: - /* - * The specified Base parameter is not in the domain of - * this function: - */ - return (AE_BAD_PARAMETER); - } - - /* Skip over any white space in the buffer: */ - - while (isspace ((int) *String) || *String == '\t') - { - ++String; - } - - /* - * The buffer may contain an optional plus or minus sign. - * If it does, then skip over it but remember what is was: - */ - if (*String == '-') - { - Sign = NEGATIVE; - ++String; - } - else if (*String == '+') - { - ++String; - Sign = POSITIVE; - } - else - { - Sign = POSITIVE; - } - - /* - * If the input parameter Base is zero, then we need to - * determine if it is octal, decimal, or hexadecimal: - */ - if (Base == 0) - { - if (*String == '0') - { - if (tolower ((int) *(++String)) == 'x') - { - Base = 16; - ++String; - } - else - { - Base = 8; - } - } - else - { - Base = 10; - } - } - - /* - * For octal and hexadecimal bases, skip over the leading - * 0 or 0x, if they are present. - */ - if (Base == 8 && *String == '0') - { - String++; - } - - if (Base == 16 && - *String == '0' && - tolower ((int) *(++String)) == 'x') - { - String++; - } - - /* Main loop: convert the string to an unsigned long */ - - while (*String) - { - if (isdigit ((int) *String)) - { - Index = ((UINT8) *String) - '0'; - } - else - { - Index = (UINT8) toupper ((int) *String); - if (isupper ((int) Index)) - { - Index = Index - 'A' + 10; - } - else - { - goto ErrorExit; - } - } - - if (Index >= Base) - { - goto ErrorExit; - } - - /* Check to see if value is out of range: */ - - if (ReturnValue > ((ACPI_UINT64_MAX - (UINT64) Index) / - (UINT64) Base)) - { - goto ErrorExit; - } - else - { - ReturnValue *= Base; - ReturnValue += Index; - } - - ++String; - } - - - /* If a minus sign was present, then "the conversion is negated": */ - - if (Sign == NEGATIVE) - { - ReturnValue = (ACPI_UINT32_MAX - ReturnValue) + 1; - } - - *RetInteger = ReturnValue; - return (Status); - - -ErrorExit: - switch (Base) - { - case 8: - Status = AE_BAD_OCTAL_CONSTANT; - break; - - case 10: - Status = AE_BAD_DECIMAL_CONSTANT; - break; - - case 16: - Status = AE_BAD_HEX_CONSTANT; - break; - - default: - /* Base validated above */ - break; - } - - return (Status); -} - - diff -Nru acpica-unix-20100528/compiler/dtcompile.c acpica-unix-20140114/compiler/dtcompile.c --- acpica-unix-20100528/compiler/dtcompile.c 2010-05-28 17:14:26.000000000 +0000 +++ acpica-unix-20140114/compiler/dtcompile.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,614 +0,0 @@ -/****************************************************************************** - * - * Module Name: dtcompile.c - Front-end for data table compiler - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - -#define __DTCOMPILE_C__ -#define _DECLARE_DT_GLOBALS - -#include "aslcompiler.h" -#include "dtcompiler.h" - -#define _COMPONENT DT_COMPILER - ACPI_MODULE_NAME ("dtcompile") - -static char VersionString[9]; - - -/* Local prototypes */ - -static void -DtInitialize ( - void); - -static ACPI_STATUS -DtCompileDataTable ( - DT_FIELD **Field); - -static void -DtInsertCompilerIds ( - DT_FIELD *FieldList); - - -/****************************************************************************** - * - * FUNCTION: DtDoCompile - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Main entry point for the data table compiler. - * - * Note: Assumes Gbl_Files[ASL_FILE_INPUT] is initialized and the file is - * open at seek offset zero. - * - *****************************************************************************/ - -ACPI_STATUS -DtDoCompile ( - void) -{ - ACPI_STATUS Status; - UINT8 Event; - DT_FIELD *FieldList; - - - /* Initialize globals */ - - DtInitialize (); - - /* - * Scan the input file (file is already open) and - * build the parse tree - */ - Event = UtBeginEvent ("Scan and parse input file"); - FieldList = DtScanFile (Gbl_Files[ASL_FILE_INPUT].Handle); - UtEndEvent (Event); - - /* Did the parse tree get successfully constructed? */ - - if (!FieldList) - { - /* TBD: temporary error message. Msgs should come from function above */ - - DtError (ASL_ERROR, ASL_MSG_SYNTAX, NULL, - "Could not parse input file"); - return (AE_ERROR); - } - - Event = UtBeginEvent ("Compile parse tree"); - - /* - * Compile the parse tree - */ - Status = DtCompileDataTable (&FieldList); - UtEndEvent (Event); - - DtFreeFieldList (); - - if (ACPI_FAILURE (Status)) - { - /* TBD: temporary error message. Msgs should come from function above */ - - DtError (ASL_ERROR, ASL_MSG_SYNTAX, NULL, - "Could not compile input file"); - goto CleanupAndExit; - } - - /* Create/open the binary output file */ - - Gbl_Files[ASL_FILE_AML_OUTPUT].Filename = NULL; - Status = FlOpenAmlOutputFile (Gbl_OutputFilenamePrefix); - if (ACPI_FAILURE (Status)) - { - goto CleanupAndExit; - } - - /* Write the binary, then the optional hex file */ - - DtOutputBinary (Gbl_RootTable); - LsDoHexOutput (); - -CleanupAndExit: - - CmCleanupAndExit (); - return (Status); -} - - -/****************************************************************************** - * - * FUNCTION: DtInitialize - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Initialize data table compiler globals. Enables multiple - * compiles per invocation. - * - *****************************************************************************/ - -static void -DtInitialize ( - void) -{ - - Gbl_FieldList = NULL; - Gbl_RootTable = NULL; - Gbl_SubtableStack = NULL; - - sprintf (VersionString, "%X", (UINT32) ACPI_CA_VERSION); -} - - -/****************************************************************************** - * - * FUNCTION: DtInsertCompilerIds - * - * PARAMETERS: FieldList - Current field list pointer - * - * RETURN: None - * - * DESCRIPTION: Insert the IDs (Name, Version) of the current compiler into - * the original ACPI table header. - * - *****************************************************************************/ - -static void -DtInsertCompilerIds ( - DT_FIELD *FieldList) -{ - DT_FIELD *Next; - UINT32 i; - - - /* - * Don't insert current compiler ID if requested. Used for compiler - * debug/validation only. - */ - if (Gbl_UseOriginalCompilerId) - { - return; - } - - /* Walk to the Compiler fields at the end of the header */ - - Next = FieldList; - for (i = 0; i < 7; i++) - { - Next = Next->Next; - } - - Next->Value = CompilerCreatorId; - Next->Flags = DT_FIELD_NOT_ALLOCATED; - - Next = Next->Next; - Next->Value = VersionString; - Next->Flags = DT_FIELD_NOT_ALLOCATED; -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileDataTable - * - * PARAMETERS: FieldList - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Entry point to compile one data table - * - *****************************************************************************/ - -static ACPI_STATUS -DtCompileDataTable ( - DT_FIELD **FieldList) -{ - ACPI_DMTABLE_DATA *TableData; - DT_SUBTABLE *Subtable; - char *Signature; - ACPI_TABLE_HEADER *AcpiTableHeader; - ACPI_STATUS Status; - - - /* Verify that we at least have a table signature and save it */ - - Signature = DtGetFieldValue (*FieldList, "Signature"); - if (!Signature) - { - DtError (ASL_ERROR, ASL_MSG_TABLE_SIGNATURE, *FieldList, NULL); - return (AE_ERROR); - } - - Gbl_Signature = UtLocalCalloc (ACPI_STRLEN (Signature) + 1); - strcpy (Gbl_Signature, Signature); - - /* - * Handle tables that don't use the common ACPI table header structure. - * Currently, these are the FACS and RSDP. Also check for an OEMx table, - * these tables have user-defined contents. - */ - if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_FACS)) - { - Status = DtCompileFacs (FieldList); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - DtSetTableLength (); - return (Status); - } - else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_RSDP)) - { - Status = DtCompileRsdp (FieldList); - return (Status); - } - else if (!ACPI_STRNCMP (Signature, "OEM", 3)) - { - DtFatal (ASL_MSG_OEM_TABLE, *FieldList, Signature); - return (AE_ERROR); - } - - /* - * All other tables must use the common ACPI table header. Insert the - * current iASL IDs (name, version), and compile the header now. - */ - DtInsertCompilerIds (*FieldList); - - Status = DtCompileTable (FieldList, AcpiDmTableInfoHeader, - &Gbl_RootTable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - DtPushSubtable (Gbl_RootTable); - - /* Match signature and dispatch appropriately */ - - TableData = AcpiDmGetTableData (Signature); - if (!TableData) - { - DtFatal (ASL_MSG_UNKNOWN_TABLE, *FieldList, Signature); - return (AE_ERROR); - } - - if (TableData->CmTableHandler) - { - /* Complex table, has a handler */ - - Status = TableData->CmTableHandler ((void **) FieldList); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - else if (TableData->TableInfo) - { - /* Simple table, just walk the info table */ - - Subtable = NULL; - Status = DtCompileTable (FieldList, TableData->TableInfo, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - DtInsertSubtable (Gbl_RootTable, Subtable); - DtPopSubtable (); - } - else - { - DtFatal (ASL_MSG_COMPILER_INTERNAL, *FieldList, - "Missing table dispatch info"); - return (AE_ERROR); - } - - /* Set the final table length and then the checksum */ - - DtSetTableLength (); - AcpiTableHeader = ACPI_CAST_PTR ( - ACPI_TABLE_HEADER, Gbl_RootTable->Buffer); - DtSetTableChecksum (&AcpiTableHeader->Checksum); - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileTable - * - * PARAMETERS: Field - Current field list pointer - * Info - Info table for this ACPI table - * RetSubtable - Compile result of table - * Required - If this subtable must exist - * - * RETURN: Status - * - * DESCRIPTION: Compile a subtable - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileTable ( - DT_FIELD **Field, - ACPI_DMTABLE_INFO *Info, - DT_SUBTABLE **RetSubtable, - BOOLEAN Required) -{ - DT_FIELD *LocalField; - UINT32 Length; - DT_SUBTABLE *Subtable; - DT_SUBTABLE *InlineSubtable; - UINT32 FieldLength = 0; - UINT8 FieldType; - UINT8 *Buffer; - UINT8 *FlagBuffer = NULL; - UINT32 FlagBitPosition = 0; - ACPI_STATUS Status; - - - if (!Field || !*Field) - { - return (AE_BAD_PARAMETER); - } - - Length = DtGetSubtableLength (*Field, Info); - Subtable = UtLocalCalloc (sizeof (DT_SUBTABLE)); - - Subtable->Buffer = UtLocalCalloc (Length); - Subtable->Length = Length; - Subtable->TotalLength = Length; - Buffer = Subtable->Buffer; - - LocalField = *Field; - - /* - * Main loop walks the info table for this ACPI table or subtable - */ - for (; Info->Name; Info++) - { - if (!LocalField) - { - sprintf (MsgBuffer, "Found NULL field - Field name \"%s\" needed", - Info->Name); - DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, MsgBuffer); - Status = AE_BAD_DATA; - 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; - } - } - - FieldLength = DtGetFieldLength (LocalField, Info); - FieldType = DtGetFieldType (Info); - Gbl_InputFieldCount++; - - switch (FieldType) - { - case DT_FIELD_TYPE_FLAGS_INTEGER: - /* - * Start of the definition of a flags field. - * This master flags integer starts at value zero, in preparation - * to compile and insert the flag fields from the individual bits - */ - LocalField = LocalField->Next; - *Field = LocalField; - - FlagBitPosition = 0; - FlagBuffer = Buffer; - break; - - case DT_FIELD_TYPE_FLAG: - - /* Individual Flag field, can be multiple bits */ - - if (FlagBuffer) - { - FlagBitPosition = DtCompileFlag (FlagBuffer, - LocalField, Info, FlagBitPosition); - } - else - { - /* TBD - this is an internal error */ - } - - LocalField = LocalField->Next; - *Field = LocalField; - break; - - case DT_FIELD_TYPE_INLINE_SUBTABLE: - /* - * Recursion (one level max): compile GAS (Generic Address) - * or Notify in-line subtable - */ - LocalField = LocalField->Next; - *Field = LocalField; - - if (Info->Opcode == ACPI_DMT_GAS) - { - Status = DtCompileTable (Field, AcpiDmTableInfoGas, - &InlineSubtable, TRUE); - } - else - { - Status = DtCompileTable (Field, AcpiDmTableInfoHestNotify, - &InlineSubtable, TRUE); - } - - if (ACPI_FAILURE (Status)) - { - goto Error; - } - - ACPI_MEMCPY (Buffer, InlineSubtable->Buffer, FieldLength); - ACPI_FREE (InlineSubtable->Buffer); - ACPI_FREE (InlineSubtable); - LocalField = *Field; - break; - - default: - - /* Normal case for most field types (Integer, String, etc.) */ - - DtCompileOneField (Buffer, LocalField, - FieldLength, FieldType, Info->Flags); - LocalField = LocalField->Next; - - if (Info->Flags & DT_LENGTH) - { - /* Field is an Integer that will contain a subtable length */ - - Subtable->LengthField = Buffer; - Subtable->SizeOfLengthField = FieldLength; - } - break; - } - - Buffer += FieldLength; - } - - *Field = LocalField; - *RetSubtable = Subtable; - return (AE_OK); - -Error: - ACPI_FREE (Subtable->Buffer); - ACPI_FREE (Subtable); - return (Status); -} diff -Nru acpica-unix-20100528/compiler/dtcompiler.h acpica-unix-20140114/compiler/dtcompiler.h --- acpica-unix-20100528/compiler/dtcompiler.h 2010-05-28 17:14:26.000000000 +0000 +++ acpica-unix-20140114/compiler/dtcompiler.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,455 +0,0 @@ -/****************************************************************************** - * - * Module Name: dtcompiler.h - header for data table compiler - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - -#define __DTCOMPILER_H__ - -#ifndef _DTCOMPILER -#define _DTCOMPILER - -#include -#include "acdisasm.h" - - -#undef DT_EXTERN - -#ifdef _DECLARE_DT_GLOBALS -#define DT_EXTERN -#define DT_INIT_GLOBAL(a,b) (a)=(b) -#else -#define DT_EXTERN extern -#define DT_INIT_GLOBAL(a,b) (a) -#endif - - -/* Types for individual fields (one per input line) */ - -#define DT_FIELD_TYPE_STRING 0 -#define DT_FIELD_TYPE_INTEGER 1 -#define DT_FIELD_TYPE_BUFFER 2 -#define DT_FIELD_TYPE_PCI_PATH 3 -#define DT_FIELD_TYPE_FLAG 4 -#define DT_FIELD_TYPE_FLAGS_INTEGER 5 -#define DT_FIELD_TYPE_INLINE_SUBTABLE 6 - - -/* - * Structure used for each individual field within an ACPI table - */ -typedef struct dt_field -{ - char *Name; - char *Value; - struct dt_field *Next; - UINT32 Line; /* Line number for this field */ - UINT32 ByteOffset; /* Offset in source file for field */ - UINT32 NameColumn; /* Start column for field name */ - UINT32 Column; /* Start column for field value */ - UINT8 Flags; - -} DT_FIELD; - -/* Flags for above */ - -#define DT_FIELD_NOT_ALLOCATED 1 - - -/* - * Structure used for individual subtables within an ACPI table - */ -typedef struct dt_subtable -{ - struct dt_subtable *Parent; - struct dt_subtable *Child; - struct dt_subtable *Peer; - struct dt_subtable *StackTop; - UINT8 *Buffer; - UINT8 *LengthField; - UINT32 Length; - UINT32 TotalLength; - UINT32 SizeOfLengthField; - UINT8 Flags; - -} DT_SUBTABLE; - - -/* - * Globals - */ - -/* List of all field names and values from the input source */ - -DT_EXTERN DT_FIELD DT_INIT_GLOBAL (*Gbl_FieldList, NULL); - -/* List of all compiled tables and subtables */ - -DT_EXTERN DT_SUBTABLE DT_INIT_GLOBAL (*Gbl_RootTable, NULL); - -/* Stack for subtables */ - -DT_EXTERN DT_SUBTABLE DT_INIT_GLOBAL (*Gbl_SubtableStack, NULL); - - -/* dtcompiler - main module */ - -ACPI_STATUS -DtCompileTable ( - DT_FIELD **Field, - ACPI_DMTABLE_INFO *Info, - DT_SUBTABLE **RetSubtable, - BOOLEAN Required); - - -/* dtio - binary and text input/output */ - -DT_FIELD * -DtScanFile ( - FILE *Handle); - -void -DtOutputBinary ( - DT_SUBTABLE *RootTable); - - -/* dtsubtable - compile subtables */ - -void -DtCreateSubtable ( - UINT8 *Buffer, - UINT32 Length, - DT_SUBTABLE **RetSubtable); - -UINT32 -DtGetSubtableLength ( - DT_FIELD *Field, - ACPI_DMTABLE_INFO *Info); - -void -DtSetSubtableLength ( - DT_SUBTABLE *Subtable); - -void -DtPushSubtable ( - DT_SUBTABLE *Subtable); - -void -DtPopSubtable ( - void); - -DT_SUBTABLE * -DtPeekSubtable ( - void); - -void -DtInsertSubtable ( - DT_SUBTABLE *ParentTable, - DT_SUBTABLE *Subtable); - -DT_SUBTABLE * -DtGetNextSubtable ( - DT_SUBTABLE *ParentTable, - DT_SUBTABLE *ChildTable); - -DT_SUBTABLE * -DtGetParentSubtable ( - DT_SUBTABLE *Subtable); - - -/* dtfield - Compile individual fields within a table */ - -void -DtCompileOneField ( - UINT8 *Buffer, - DT_FIELD *Field, - UINT32 ByteLength, - UINT8 Type, - UINT8 Flags); - -void -DtCompileInteger ( - UINT8 *Buffer, - DT_FIELD *Field, - UINT32 ByteLength, - UINT8 Flags); - -UINT32 -DtCompileBuffer ( - UINT8 *Buffer, - char *Value, - DT_FIELD *Field, - UINT32 ByteLength); - -UINT32 -DtCompileFlag ( - UINT8 *Buffer, - DT_FIELD *Field, - ACPI_DMTABLE_INFO *Info, - UINT32 BitPosition); - - -/* dtutils - Miscellaneous utilities */ - -typedef -void (*DT_WALK_CALLBACK) ( - DT_SUBTABLE *Subtable, - void *Context, - void *ReturnValue); - -void -DtWalkTableTree ( - DT_SUBTABLE *StartTable, - DT_WALK_CALLBACK UserFunction, - void *Context, - void *ReturnValue); - -void -DtError ( - UINT8 Level, - UINT8 MessageId, - DT_FIELD *FieldObject, - char *ExtraMessage); - -void -DtNameError ( - UINT8 Level, - UINT8 MessageId, - DT_FIELD *FieldObject, - char *ExtraMessage); - -void -DtFatal ( - UINT8 MessageId, - DT_FIELD *FieldObject, - char *ExtraMessage); - -ACPI_STATUS -DtStrtoul64 ( - char *String, - UINT64 *ReturnInteger); - -UINT32 -DtGetFileSize ( - FILE *Handle); - -char* -DtGetFieldValue ( - DT_FIELD *Field, - char *Name); - -UINT8 -DtGetFieldType ( - ACPI_DMTABLE_INFO *Info); - -UINT32 -DtGetBufferLength ( - char *Buffer); - -UINT32 -DtGetFieldLength ( - DT_FIELD *Field, - ACPI_DMTABLE_INFO *Info); - -void -DtSetTableChecksum ( - UINT8 *ChecksumPointer); - -void -DtSetTableLength( - void); - -void -DtFreeFieldList ( - void); - - -/* dttable - individual table compilation */ - -ACPI_STATUS -DtCompileFacs ( - DT_FIELD **PFieldList); - -ACPI_STATUS -DtCompileRsdp ( - DT_FIELD **PFieldList); - -ACPI_STATUS -DtCompileAsf ( - void **PFieldList); - -ACPI_STATUS -DtCompileCpep ( - void **PFieldList); - -ACPI_STATUS -DtCompileDmar ( - void **PFieldList); - -ACPI_STATUS -DtCompileEinj ( - void **PFieldList); - -ACPI_STATUS -DtCompileErst ( - void **PFieldList); - -ACPI_STATUS -DtCompileFadt ( - void **PFieldList); - -ACPI_STATUS -DtCompileHest ( - void **PFieldList); - -ACPI_STATUS -DtCompileIvrs ( - void **PFieldList); - -ACPI_STATUS -DtCompileMadt ( - void **PFieldList); - -ACPI_STATUS -DtCompileMcfg ( - void **PFieldList); - -ACPI_STATUS -DtCompileMsct ( - void **PFieldList); - -ACPI_STATUS -DtCompileRsdt ( - void **PFieldList); - -ACPI_STATUS -DtCompileSlit ( - void **PFieldList); - -ACPI_STATUS -DtCompileSrat ( - void **PFieldList); - -ACPI_STATUS -DtCompileWdat ( - void **PFieldList); - -ACPI_STATUS -DtCompileXsdt ( - void **PFieldList); - - -/* Debug */ - -#define MYDEBUG printf - -#endif diff -Nru acpica-unix-20100528/compiler/dtfield.c acpica-unix-20140114/compiler/dtfield.c --- acpica-unix-20100528/compiler/dtfield.c 2010-05-28 17:14:26.000000000 +0000 +++ acpica-unix-20140114/compiler/dtfield.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,543 +0,0 @@ -/****************************************************************************** - * - * Module Name: dtfield.c - Code generation for individual source fields - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - -#define __DTFIELD_C__ - -#include "aslcompiler.h" -#include "dtcompiler.h" - -#define _COMPONENT DT_COMPILER - ACPI_MODULE_NAME ("dtfield") - - -/* Local prototypes */ - -static void -DtCompileString ( - UINT8 *Buffer, - DT_FIELD *Field, - UINT32 ByteLength); - -static char * -DtPciPathToBuffer ( - char *PciPath); - -static void -DtCompilePciPath ( - UINT8 *Buffer, - char *StringValue, - DT_FIELD *Field, - UINT32 ByteLength); - - -/****************************************************************************** - * - * FUNCTION: DtCompileOneField - * - * PARAMETERS: Buffer - Output buffer - * Field - Field to be compiled - * ByteLength - Byte length of the field - * Type - Field type - * - * RETURN: None - * - * DESCRIPTION: Compile a field value to binary - * - *****************************************************************************/ - -void -DtCompileOneField ( - UINT8 *Buffer, - DT_FIELD *Field, - UINT32 ByteLength, - UINT8 Type, - UINT8 Flags) -{ - - switch (Type) - { - case DT_FIELD_TYPE_INTEGER: - DtCompileInteger (Buffer, Field, ByteLength, Flags); - break; - - case DT_FIELD_TYPE_STRING: - DtCompileString (Buffer, Field, ByteLength); - break; - - case DT_FIELD_TYPE_BUFFER: - DtCompileBuffer (Buffer, Field->Value, Field, ByteLength); - break; - - case DT_FIELD_TYPE_PCI_PATH: - DtCompilePciPath (Buffer, Field->Value, Field, ByteLength); - break; - - default: - DtFatal (ASL_MSG_COMPILER_INTERNAL, Field, "Invalid field type"); - break; - } -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileString - * - * PARAMETERS: Buffer - Output buffer - * Field - String to be copied to buffer - * ByteLength - Maximum length of string - * - * RETURN: None - * - * DESCRIPTION: Copy string to the buffer - * - *****************************************************************************/ - -static void -DtCompileString ( - UINT8 *Buffer, - DT_FIELD *Field, - UINT32 ByteLength) -{ - UINT32 Length; - - - Length = ACPI_STRLEN (Field->Value); - - /* Check if the string is too long for the field */ - - if (Length > ByteLength) - { - sprintf (MsgBuffer, "Maximum %u characters", ByteLength); - DtError (ASL_ERROR, ASL_MSG_STRING_LENGTH, Field, MsgBuffer); - Length = ByteLength; - } - - /* If input string is shorter than ByteLength, pad with blanks */ - - ACPI_MEMSET (Buffer, 0x20, ByteLength); - ACPI_MEMCPY (Buffer, Field->Value, Length); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileInteger - * - * PARAMETERS: Buffer - Output buffer - * Field - Field obj with Integer to be compiled - * ByteLength - Byte length of the integer - * - * RETURN: None - * - * DESCRIPTION: Compile an integer - * - *****************************************************************************/ - -void -DtCompileInteger ( - UINT8 *Buffer, - DT_FIELD *Field, - UINT32 ByteLength, - UINT8 Flags) -{ - UINT64 Value = 0; - UINT64 MaxValue; - UINT8 *Hex; - char *Message = NULL; - ACPI_STATUS Status; - int i; - - - /* Byte length must be in range 1-8 */ - - if ((ByteLength > 8) || (ByteLength == 0)) - { - DtFatal (ASL_MSG_COMPILER_INTERNAL, Field, - "Invalid internal Byte length"); - return; - } - - /* Convert string to an actual integer */ - - Status = DtStrtoul64 (Field->Value, &Value); - if (ACPI_FAILURE (Status)) - { - 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); - goto Exit; - } - - /* Ensure that reserved fields are set to zero */ - /* TBD: should we set to zero, or just make this an ERROR? */ - /* TBD: Probably better to use a flag */ - - if (!ACPI_STRCMP (Field->Name, "Reserved") && - (Value != 0)) - { - DtError (ASL_WARNING, ASL_MSG_RESERVED_VALUE, Field, - "Setting to zero"); - Value = 0; - } - - /* Check if the value must be non-zero */ - - if ((Value == 0) && (Flags & DT_NON_ZERO)) - { - DtError (ASL_ERROR, ASL_MSG_ZERO_VALUE, Field, NULL); - } - - /* - * Generate the maximum value for the data type (ByteLength) - * Note: construct chosen for maximum portability - */ - MaxValue = ((UINT64) (-1)) >> (64 - (ByteLength * 8)); - - /* Validate that the input value is within range of the target */ - - if (Value > MaxValue) - { - sprintf (MsgBuffer, "Maximum %u bytes", ByteLength); - DtError (ASL_ERROR, ASL_MSG_INTEGER_SIZE, Field, MsgBuffer); - } - - /* - * TBD: hard code for ASF! Capabilites field. - * - * This field is actually a buffer, not a 56-bit integer -- - * so, the ordering is reversed. Something should be fixed - * so we don't need this code. - */ - if (ByteLength == 7) - { - Hex = ACPI_CAST_PTR (UINT8, &Value); - for (i = 6; i >= 0; i--) - { - Buffer[i] = *Hex; - Hex++; - } - return; - } - -Exit: - ACPI_MEMCPY (Buffer, &Value, ByteLength); - return; -} - - -/****************************************************************************** - * - * FUNCTION: DtPciPathToBuffer - * - * PARAMETERS: PciPath - DMAR "PCI Path" field - * - * RETURN: Strings of PCI path - * - * DESCRIPTION: Remove brackets and comma from DMAR "PCI Path" string, for - * example: [1D, 01] ==> 1D 01 - * - *****************************************************************************/ - -static char * -DtPciPathToBuffer ( - char *PciPath) -{ - char *Buffer; - - - Buffer = UtLocalCalloc (6); - - Buffer[0] = PciPath[1]; - Buffer[1] = PciPath[2]; - Buffer[2] = ' '; - Buffer[3] = PciPath[5]; - Buffer[4] = PciPath[6]; - - return (Buffer); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileBuffer - * - * PARAMETERS: Buffer - Output buffer - * StringValue - Integer list to be compiled - * Field - Current field object - * ByteLength - Byte length of the integer list - * - * RETURN: Count of remaining data in the input list - * - * DESCRIPTION: Compile and pack an integer list, for example - * "AA 1F 20 3B" ==> Buffer[] = {0xAA,0x1F,0x20,0x3B} - * - *****************************************************************************/ - -UINT32 -DtCompileBuffer ( - UINT8 *Buffer, - char *StringValue, - DT_FIELD *Field, - UINT32 ByteLength) -{ - ACPI_STATUS Status; - char Hex[3]; - UINT64 Value; - UINT32 i; - UINT32 Count; - - - Count = ACPI_STRLEN (StringValue) / 3 + 1; - - Hex[2] = 0; - for (i = 0; i < Count; i++) - { - Hex[0] = StringValue[0]; - Hex[1] = StringValue[1]; - - /* Convert one hex byte */ - - Value = 0; - Status = DtStrtoul64 (Hex, &Value); - if (ACPI_FAILURE (Status)) - { - DtError (ASL_ERROR, ASL_MSG_BUFFER_ELEMENT, Field, MsgBuffer); - return (ByteLength - Count); - } - - Buffer[i] = (UINT8) Value; - StringValue += 3; - } - - return (ByteLength - Count); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompilePciPath - * - * PARAMETERS: Buffer - Output buffer - * StringValue - DMAR pci path string - * ByteLength - Byte length of DMAR pci path string, 2 - * - * RETURN: None - * - * DESCRIPTION: Compile DMAR PCI path string to binary - * - *****************************************************************************/ - -static void -DtCompilePciPath ( - UINT8 *Buffer, - char *StringValue, - DT_FIELD *Field, - UINT32 ByteLength) -{ - char *PciPathBuffer; - - - /* Parse path to simple hex digits, then convert to binary */ - - PciPathBuffer = DtPciPathToBuffer (StringValue); - - DtCompileBuffer (Buffer, PciPathBuffer, Field, ByteLength); - ACPI_FREE (PciPathBuffer); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileFlag - * - * PARAMETERS: Buffer - Output buffer - * Field - Field to be compiled - * Info - Flag info - * BitPosition - Flag bit position - * - * RETURN: Next flag bit position - * - * DESCRIPTION: Compile a flag - * - *****************************************************************************/ - -UINT32 -DtCompileFlag ( - UINT8 *Buffer, - DT_FIELD *Field, - ACPI_DMTABLE_INFO *Info, - UINT32 BitPosition) -{ - UINT64 Value = 0; - UINT32 BitLength = 1; - ACPI_STATUS Status; - - - Status = DtStrtoul64 (Field->Value, &Value); - if (ACPI_FAILURE (Status)) - { - DtError (ASL_ERROR, ASL_MSG_INVALID_HEX_INTEGER, Field, NULL); - } - - switch (Info->Opcode) - { - case ACPI_DMT_FLAG0: - case ACPI_DMT_FLAG1: - case ACPI_DMT_FLAG2: - case ACPI_DMT_FLAG3: - case ACPI_DMT_FLAG4: - case ACPI_DMT_FLAG5: - case ACPI_DMT_FLAG6: - case ACPI_DMT_FLAG7: - - BitLength = 1; - break; - - case ACPI_DMT_FLAGS0: - case ACPI_DMT_FLAGS2: - - BitLength = 2; - break; - - default: - - DtFatal (ASL_MSG_COMPILER_INTERNAL, Field, "Invalid flag opcode"); - break; - } - - /* Check range of the input flag value */ - - if (Value >= ((UINT64) 1 << BitLength)) - { - sprintf (MsgBuffer, "Maximum %u bit", BitLength); - DtError (ASL_ERROR, ASL_MSG_FLAG_VALUE, Field, MsgBuffer); - Value = 0; - } - - /* Insert the flag, return next flag bit position */ - - Buffer += ACPI_DIV_8 (BitPosition); - *Buffer |= (UINT8) (Value << ACPI_MOD_8 (BitPosition)); - - return (BitPosition + BitLength); -} diff -Nru acpica-unix-20100528/compiler/dtio.c acpica-unix-20140114/compiler/dtio.c --- acpica-unix-20100528/compiler/dtio.c 2010-05-28 17:14:26.000000000 +0000 +++ acpica-unix-20140114/compiler/dtio.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,512 +0,0 @@ -/****************************************************************************** - * - * Module Name: dtio.c - File I/O support for data table compiler - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - -#define __DTIO_C__ - -#include "aslcompiler.h" -#include "dtcompiler.h" - -#define _COMPONENT DT_COMPILER - ACPI_MODULE_NAME ("dtio") - - -/****************************************************************************** - * - * FUNCTION: DtIsComment - * - * PARAMETERS: Line - Current source code line - * - * RETURN: TRUE if comment, FALSE otherwise - * - * DESCRIPTION: Detect a comment in the source module - * - *****************************************************************************/ - -/* TBD: Temporary: very simple code to detect comments */ - -static int -DtIsComment( - char *Line) -{ - - if (!ACPI_STRNCMP (Line, "/*", 2) || - !ACPI_STRNCMP (Line, " *", 2)) - { - return 1; - } - - return 0; -} - - -/****************************************************************************** - * - * FUNCTION: DtTrim - * - * PARAMETERS: String - Current source code line to trim - * - * RETURN: Trimmed line. Must be freed by caller. - * - * DESCRIPTION: Trim left and right spaces - * - *****************************************************************************/ - -static char * -DtTrim ( - char *String) -{ - char *Start; - char *End; - char *ReturnString; - ACPI_SIZE Length; - - - /* Skip lines that start with a space */ - - if (!ACPI_STRCMP (String, " ")) - { - ReturnString = UtLocalCalloc (1); - return (ReturnString); - } - - /* Setup pointers to start and end of input string */ - - Start = String; - End = String + ACPI_STRLEN (String) - 1; - - /* Find first non-whitespace character */ - - while ((Start <= End) && ((*Start == ' ') || (*Start == '\t'))) - { - Start++; - } - - /* Find last non-space character */ - - while (End >= Start) - { - if (*End == '\r' || *End == '\n') - { - End--; - continue; - } - - if (*End != ' ') - { - break; - } - - End--; - } - - /* Remove any quotes around the string */ - - if (*Start == '\"') - { - Start++; - } - if (*End == '\"') - { - End--; - } - - /* Create the trimmed return string */ - - Length = ACPI_PTR_DIFF (End, Start) + 1; - ReturnString = UtLocalCalloc (Length + 1); - if (ACPI_STRLEN (Start)) - { - ACPI_STRNCPY (ReturnString, Start, Length); - } - - ReturnString[Length] = 0; - return (ReturnString); -} - - -/****************************************************************************** - * - * FUNCTION: DtLinkField - * - * PARAMETERS: Field - New field object to link - * - * RETURN: None - * - * DESCRIPTION: Link one field name and value to the list - * - *****************************************************************************/ - -static void -DtLinkField ( - DT_FIELD *Field) -{ - DT_FIELD *Prev; - DT_FIELD *Next; - - - Prev = Next = Gbl_FieldList; - - while (Next) - { - Prev = Next; - Next = Next->Next; - } - - if (Prev) - { - Prev->Next = Field; - } - else - { - Gbl_FieldList = Field; - } -} - - -/****************************************************************************** - * - * FUNCTION: DtParseLine - * - * PARAMETERS: LineBuffer - Current source code line - * Line - Current line number in the source - * Offset - Current byte offset of the line - * - * RETURN: None - * - * DESCRIPTION: Parse one source line - * - *****************************************************************************/ - -static void -DtParseLine ( - char *LineBuffer, - UINT32 Line, - UINT32 Offset) -{ - char *Start; - char *End; - char *TmpName; - char *TmpValue; - char *Name; - char *Value; - char *Colon; - UINT32 Length; - DT_FIELD *Field; - UINT32 Column; - UINT32 NameColumn; - - - if (!LineBuffer || DtIsComment (LineBuffer)) - { - return; - } - - Colon = strchr (LineBuffer, ':'); - if (!Colon || *(Colon - 1) != ' ') - { - return; - } - - Start = LineBuffer; - End = Colon; - - while (Start < Colon) - { - if (*Start == ' ') - { - Start++; - continue; - } - - /* Found left bracket, go to the right bracket */ - - if (*Start == '[') - { - while (Start < Colon && *Start != ']') - { - Start++; - } - - if (Start == Colon) - { - MYDEBUG ("ERROR: right bracket reaches colon position\n"); - break; - } - - Start++; - continue; - } - - break; - } - - /* - * There are two column values. One for the field name, - * and one for the field value. - */ - Column = ACPI_PTR_DIFF (Colon, LineBuffer) + 3; - NameColumn = ACPI_PTR_DIFF (Start, LineBuffer) + 1; - - Length = ACPI_PTR_DIFF (End, Start); - - TmpName = UtLocalCalloc (Length + 1); - ACPI_STRNCPY (TmpName, Start, Length); - Name = DtTrim (TmpName); - ACPI_FREE (TmpName); - - Start = End = (Colon + 1); - - while (*End) - { - /* Found left quotation, go to the right quotation and break */ - - if (*End == '"') - { - End++; - while (*End && *End != '"') - { - End++; - } - - End++; - break; - } - - if (*End == '(' || - *End == '<' || - *End == '/') - { - break; - } - - End++; - } - - Length = ACPI_PTR_DIFF (End, Start); - TmpValue = UtLocalCalloc (Length + 1); - ACPI_STRNCPY (TmpValue, Start, Length); - Value = DtTrim (TmpValue); - ACPI_FREE (TmpValue); - - if (Name && Value) - { - Field = UtLocalCalloc (sizeof (DT_FIELD)); - Field->Name = Name; - Field->Value = Value; - Field->Line = Line; - Field->ByteOffset = Offset; - Field->NameColumn = NameColumn; - Field->Column = Column; - - DtLinkField (Field); - } -} - - -/****************************************************************************** - * - * FUNCTION: DtScanFile - * - * PARAMETERS: Handle - Open file handle for the source file - * - * RETURN: Pointer to start of the constructed parse tree. - * - * DESCRIPTION: Scan source file, link all field name and value - * to the global parse tree: Gbl_FieldList - * - *****************************************************************************/ - -DT_FIELD * -DtScanFile ( - FILE *Handle) -{ - UINT32 Line = 0; - UINT32 Offset = 0; - - - /* Get the file size */ - - Gbl_InputByteCount = DtGetFileSize (Handle); - - /* Scan line-by-line */ - - while (fgets (Gbl_CurrentLineBuffer, ASL_LINE_BUFFER_SIZE, Handle)) - { - Line++; - Gbl_CurrentLineNumber++; - DtParseLine (Gbl_CurrentLineBuffer, Line, Offset); - - Offset = (UINT32) ftell (Handle); - } - - return (Gbl_FieldList); -} - - -/* - * Output functions - */ - - -/****************************************************************************** - * - * FUNCTION: DtWriteBinary - * - * PARAMETERS: DT_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Write one subtable of a binary ACPI table - * - *****************************************************************************/ - -static void -DtWriteBinary ( - DT_SUBTABLE *Subtable, - void *Context, - void *ReturnValue) -{ - - FlWriteFile (ASL_FILE_AML_OUTPUT, Subtable->Buffer, Subtable->Length); -} - - -/****************************************************************************** - * - * FUNCTION: DtOutputBinary - * - * PARAMETERS: - * - * RETURN: Status - * - * DESCRIPTION: Write entire binary ACPI table (result of compilation) - * - *****************************************************************************/ - -void -DtOutputBinary ( - DT_SUBTABLE *RootTable) -{ - - if (!RootTable) - { - return; - } - - /* Walk the entire parse tree, emitting the binary data */ - - DtWalkTableTree (RootTable, DtWriteBinary, NULL, NULL); - Gbl_TableLength = DtGetFileSize (Gbl_Files[ASL_FILE_AML_OUTPUT].Handle); -} diff -Nru acpica-unix-20100528/compiler/dtsubtable.c acpica-unix-20140114/compiler/dtsubtable.c --- acpica-unix-20100528/compiler/dtsubtable.c 2010-05-28 17:14:26.000000000 +0000 +++ acpica-unix-20140114/compiler/dtsubtable.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,400 +0,0 @@ -/****************************************************************************** - * - * Module Name: dtsubtable.c - handling of subtables within ACPI tables - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - -#define __DTSUBTABLE_C__ - -#include "aslcompiler.h" -#include "dtcompiler.h" - -#define _COMPONENT DT_COMPILER - ACPI_MODULE_NAME ("dtsubtable") - - -/****************************************************************************** - * - * FUNCTION: DtCreateSubtable - * - * PARAMETERS: Buffer - Input buffer - * Length - Buffer length - * RetSubtable - Returned newly created subtable - * - * RETURN: None - * - * DESCRIPTION: Create a subtable that is not listed with ACPI_DMTABLE_INFO - * For example, FACS has 24 bytes reserved at the end - * and it's not listed at AcpiDmTableInfoFacs - * - *****************************************************************************/ - -void -DtCreateSubtable ( - UINT8 *Buffer, - UINT32 Length, - DT_SUBTABLE **RetSubtable) -{ - DT_SUBTABLE *Subtable; - - - Subtable = UtLocalCalloc (sizeof (DT_SUBTABLE)); - - /* Create a new buffer for the subtable data */ - - Subtable->Buffer = UtLocalCalloc (Length); - ACPI_MEMCPY (Subtable->Buffer, Buffer, Length); - - Subtable->Length = Length; - Subtable->TotalLength = Length; - - *RetSubtable = Subtable; -} - - -/****************************************************************************** - * - * FUNCTION: DtInsertSubtable - * - * PARAMETERS: ParentTable - The Parent of the new subtable - * Subtable - The new subtable to insert - * - * RETURN: None - * - * DESCRIPTION: Insert the new subtable to the parent table - * - *****************************************************************************/ - -void -DtInsertSubtable ( - DT_SUBTABLE *ParentTable, - DT_SUBTABLE *Subtable) -{ - DT_SUBTABLE *ChildTable; - - - Subtable->Peer = NULL; - Subtable->Parent = ParentTable; - - /* Link the new entry into the child list */ - - if (!ParentTable->Child) - { - ParentTable->Child = Subtable; - } - else - { - /* Walk to the end of the child list */ - - ChildTable = ParentTable->Child; - while (ChildTable->Peer) - { - ChildTable = ChildTable->Peer; - } - - /* Add new subtable at the end of the child list */ - - ChildTable->Peer = Subtable; - } -} - - -/****************************************************************************** - * - * FUNCTION: DtPushSubtable - * - * PARAMETERS: Subtable - Subtable to push - * - * RETURN: None - * - * DESCRIPTION: Push a subtable onto a subtable stack - * - *****************************************************************************/ - -void -DtPushSubtable ( - DT_SUBTABLE *Subtable) -{ - - Subtable->StackTop = Gbl_SubtableStack; - Gbl_SubtableStack = Subtable; -} - - -/****************************************************************************** - * - * FUNCTION: DtPopSubtable - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Pop a subtable from a subtable stack. Uses global SubtableStack - * - *****************************************************************************/ - -void -DtPopSubtable ( - void) -{ - DT_SUBTABLE *Subtable; - - - Subtable = Gbl_SubtableStack; - - if (Subtable) - { - Gbl_SubtableStack = Subtable->StackTop; - } -} - - -/****************************************************************************** - * - * FUNCTION: DtPeekSubtable - * - * PARAMETERS: None - * - * RETURN: The subtable on top of stack - * - * DESCRIPTION: Get the subtable on top of stack - * - *****************************************************************************/ - -DT_SUBTABLE * -DtPeekSubtable ( - void) -{ - - return (Gbl_SubtableStack); -} - - -/****************************************************************************** - * - * FUNCTION: DtGetNextSubtable - * - * PARAMETERS: ParentTable - Parent table whose children we are - * getting - * ChildTable - Previous child that was found. - * The NEXT child will be returned - * - * RETURN: Pointer to the NEXT child or NULL if none is found. - * - * DESCRIPTION: Return the next peer subtable within the tree. - * - *****************************************************************************/ - -DT_SUBTABLE * -DtGetNextSubtable ( - DT_SUBTABLE *ParentTable, - DT_SUBTABLE *ChildTable) -{ - ACPI_FUNCTION_ENTRY (); - - - if (!ChildTable) - { - /* It's really the parent's _scope_ that we want */ - - return (ParentTable->Child); - } - - /* Otherwise just return the next peer (NULL if at end-of-list) */ - - return (ChildTable->Peer); -} - - -/****************************************************************************** - * - * FUNCTION: DtGetParentSubtable - * - * PARAMETERS: Subtable - Current subtable - * - * RETURN: Parent of the given subtable - * - * DESCRIPTION: Get the parent of the given subtable in the tree - * - *****************************************************************************/ - -DT_SUBTABLE * -DtGetParentSubtable ( - DT_SUBTABLE *Subtable) -{ - - if (!Subtable) - { - return (NULL); - } - - return (Subtable->Parent); -} - - -/****************************************************************************** - * - * FUNCTION: DtGetSubtableLength - * - * PARAMETERS: Field - Current field list pointer - * Info - Data table info - * - * RETURN: Subtable length - * - * DESCRIPTION: Get length of bytes needed to compile the subtable - * - *****************************************************************************/ - -UINT32 -DtGetSubtableLength ( - DT_FIELD *Field, - ACPI_DMTABLE_INFO *Info) -{ - UINT32 ByteLength = 0; - - - /* Walk entire Info table; Null name terminates */ - - for (; Info->Name; Info++) - { - ByteLength += DtGetFieldLength (Field, Info); - } - - return (ByteLength); -} - - -/****************************************************************************** - * - * FUNCTION: DtSetSubtableLength - * - * PARAMETERS: Subtable - Subtable - * - * RETURN: None - * - * DESCRIPTION: Set length of the subtable into its length field - * - *****************************************************************************/ - -void -DtSetSubtableLength ( - DT_SUBTABLE *Subtable) -{ - - if (!Subtable->LengthField) - { - return; - } - - ACPI_MEMCPY (Subtable->LengthField, &Subtable->TotalLength, - Subtable->SizeOfLengthField); -} diff -Nru acpica-unix-20100528/compiler/dttable.c acpica-unix-20140114/compiler/dttable.c --- acpica-unix-20100528/compiler/dttable.c 2010-05-28 17:14:27.000000000 +0000 +++ acpica-unix-20140114/compiler/dttable.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1399 +0,0 @@ -/****************************************************************************** - * - * Module Name: dttable.c - handling for specific ACPI tables - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - -#define __DTTABLE_C__ - -/* Compile all complex data tables */ - -#include "aslcompiler.h" -#include "dtcompiler.h" - -#define _COMPONENT DT_COMPILER - ACPI_MODULE_NAME ("dttable") - - -/* TBD: merge these into dmtbinfo.c? */ - -static ACPI_DMTABLE_INFO TableInfoAsfAddress[] = -{ - {ACPI_DMT_BUFFER, 0, "Addresses", 0}, - {ACPI_DMT_EXIT, 0, NULL, 0} -}; - -static ACPI_DMTABLE_INFO TableInfoDmarPciPath[] = -{ - {ACPI_DMT_PCI_PATH, 0, "PCI Path", 0}, - {ACPI_DMT_EXIT, 0, NULL, 0} -}; - - -/* TBD: move to acmacros.h */ - -#define ACPI_SUB_PTR(t, a, b) \ - ACPI_CAST_PTR (t, (ACPI_CAST_PTR (UINT8, (a)) - (ACPI_SIZE)(b))) - - -/* Local prototypes */ - -static ACPI_STATUS -DtCompileTwoSubtables ( - void **List, - ACPI_DMTABLE_INFO *TableInfo1, - ACPI_DMTABLE_INFO *TableInfo2); - - -/****************************************************************************** - * - * FUNCTION: DtCompileTwoSubtables - * - * PARAMETERS: List - Current field list pointer - * TableInfo1 - Info table 1 - * TableInfo1 - Info table 2 - * - * RETURN: Status - * - * DESCRIPTION: Compile tables with a header and one or more same subtables. - * Include CPEP, EINJ, ERST, MCFG, MSCT, WDAT - * - *****************************************************************************/ - -static ACPI_STATUS -DtCompileTwoSubtables ( - void **List, - ACPI_DMTABLE_INFO *TableInfo1, - ACPI_DMTABLE_INFO *TableInfo2) -{ - ACPI_STATUS Status; - DT_SUBTABLE *Subtable; - DT_SUBTABLE *ParentTable; - DT_FIELD **PFieldList = (DT_FIELD **) List; - - - Status = DtCompileTable (PFieldList, TableInfo1, &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - - while (*PFieldList) - { - Status = DtCompileTable (PFieldList, TableInfo2, &Subtable, FALSE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - DtInsertSubtable (ParentTable, Subtable); - } - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileFacs - * - * PARAMETERS: PFieldList - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile FACS. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileFacs ( - DT_FIELD **PFieldList) -{ - DT_SUBTABLE *Subtable; - UINT8 *ReservedBuffer; - ACPI_STATUS Status; - UINT32 ReservedSize; - - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoFacs, - &Gbl_RootTable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Large FACS reserved area at the end of the table */ - - ReservedSize = (UINT32) sizeof (((ACPI_TABLE_FACS *) NULL)->Reserved1); - ReservedBuffer = UtLocalCalloc (ReservedSize); - - DtCreateSubtable (ReservedBuffer, ReservedSize, &Subtable); - - ACPI_FREE (ReservedBuffer); - DtInsertSubtable (Gbl_RootTable, Subtable); - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileRsdp - * - * PARAMETERS: PFieldList - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile RSDP. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileRsdp ( - DT_FIELD **PFieldList) -{ - DT_SUBTABLE *Subtable; - ACPI_TABLE_RSDP *Table; - ACPI_STATUS Status; - - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoRsdp1, - &Gbl_RootTable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - Table = ACPI_CAST_PTR (ACPI_TABLE_RSDP, Gbl_RootTable->Buffer); - DtSetTableChecksum (&Table->Checksum); - - if (Table->Revision > 0) - { - Status = DtCompileTable (PFieldList, AcpiDmTableInfoRsdp2, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - DtInsertSubtable (Gbl_RootTable, Subtable); - DtSetTableChecksum (&Table->ExtendedChecksum); - } - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileAsf - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile ASF!. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileAsf ( - void **List) -{ - ACPI_ASF_INFO *AsfTable; - DT_SUBTABLE *Subtable; - DT_SUBTABLE *ParentTable; - ACPI_DMTABLE_INFO *InfoTable; - ACPI_DMTABLE_INFO *DataInfoTable = NULL; - UINT32 DataCount = 0; - ACPI_STATUS Status; - UINT32 i; - DT_FIELD **PFieldList = (DT_FIELD **) List; - DT_FIELD *SubtableStart; - - - while (*PFieldList) - { - SubtableStart = *PFieldList; - Status = DtCompileTable (PFieldList, AcpiDmTableInfoAsfHdr, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - DtPushSubtable (Subtable); - - AsfTable = ACPI_CAST_PTR (ACPI_ASF_INFO, Subtable->Buffer); - - switch (AsfTable->Header.Type & 0x7F) /* Mask off top bit */ - { - case ACPI_ASF_TYPE_INFO: - InfoTable = AcpiDmTableInfoAsf0; - break; - - case ACPI_ASF_TYPE_ALERT: - InfoTable = AcpiDmTableInfoAsf1; - break; - - case ACPI_ASF_TYPE_CONTROL: - InfoTable = AcpiDmTableInfoAsf2; - break; - - case ACPI_ASF_TYPE_BOOT: - InfoTable = AcpiDmTableInfoAsf3; - break; - - case ACPI_ASF_TYPE_ADDRESS: - InfoTable = AcpiDmTableInfoAsf4; - break; - - default: - DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "ASF!"); - return (AE_ERROR); - } - - Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - - switch (AsfTable->Header.Type & 0x7F) /* Mask off top bit */ - { - case ACPI_ASF_TYPE_INFO: - DataInfoTable = NULL; - break; - - case ACPI_ASF_TYPE_ALERT: - DataInfoTable = AcpiDmTableInfoAsf1a; - DataCount = ACPI_CAST_PTR (ACPI_ASF_ALERT, - ACPI_SUB_PTR (UINT8, Subtable->Buffer, - sizeof (ACPI_ASF_HEADER)))->Alerts; - break; - - case ACPI_ASF_TYPE_CONTROL: - DataInfoTable = AcpiDmTableInfoAsf2a; - DataCount = ACPI_CAST_PTR (ACPI_ASF_REMOTE, - ACPI_SUB_PTR (UINT8, Subtable->Buffer, - sizeof (ACPI_ASF_HEADER)))->Controls; - break; - - case ACPI_ASF_TYPE_BOOT: - DataInfoTable = NULL; - break; - - case ACPI_ASF_TYPE_ADDRESS: - DataInfoTable = TableInfoAsfAddress; - DataCount = ACPI_CAST_PTR (ACPI_ASF_ADDRESS, - ACPI_SUB_PTR (UINT8, Subtable->Buffer, - sizeof (ACPI_ASF_HEADER)))->Devices; - break; - - default: - DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "ASF!"); - return (AE_ERROR); - } - - if (DataInfoTable) - { - switch (AsfTable->Header.Type & 0x7F) - { - case ACPI_ASF_TYPE_ADDRESS: - - while (DataCount > 0) - { - Status = DtCompileTable (PFieldList, DataInfoTable, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - DtInsertSubtable (ParentTable, Subtable); - DataCount = DataCount - Subtable->Length; - } - break; - - default: - - for (i = 0; i < DataCount; i++) - { - Status = DtCompileTable (PFieldList, DataInfoTable, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - DtInsertSubtable (ParentTable, Subtable); - } - break; - } - } - - DtPopSubtable (); - } - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileCpep - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile CPEP. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileCpep ( - void **List) -{ - ACPI_STATUS Status; - - - Status = DtCompileTwoSubtables (List, - AcpiDmTableInfoCpep, AcpiDmTableInfoCpep0); - return (Status); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileDmar - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile DMAR. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileDmar ( - void **List) -{ - ACPI_STATUS Status; - DT_SUBTABLE *Subtable; - DT_SUBTABLE *ParentTable; - DT_FIELD **PFieldList = (DT_FIELD **) List; - DT_FIELD *SubtableStart; - ACPI_DMTABLE_INFO *InfoTable; - ACPI_DMAR_HEADER *DmarHeader; - UINT8 *ReservedBuffer; - UINT32 ReservedSize; - - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmar, &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - - /* DMAR Reserved area */ - - ReservedSize = (UINT32) sizeof (((ACPI_TABLE_DMAR *) NULL)->Reserved); - ReservedBuffer = UtLocalCalloc (ReservedSize); - - DtCreateSubtable (ReservedBuffer, ReservedSize, &Subtable); - - ACPI_FREE (ReservedBuffer); - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - - while (*PFieldList) - { - /* DMAR Header */ - - SubtableStart = *PFieldList; - Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmarHdr, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - DtPushSubtable (Subtable); - - DmarHeader = ACPI_CAST_PTR (ACPI_DMAR_HEADER, Subtable->Buffer); - - switch (DmarHeader->Type) - { - case ACPI_DMAR_TYPE_HARDWARE_UNIT: - InfoTable = AcpiDmTableInfoDmar0; - break; - case ACPI_DMAR_TYPE_RESERVED_MEMORY: - InfoTable = AcpiDmTableInfoDmar1; - break; - case ACPI_DMAR_TYPE_ATSR: - InfoTable = AcpiDmTableInfoDmar2; - break; - case ACPI_DMAR_HARDWARE_AFFINITY: - InfoTable = AcpiDmTableInfoDmar3; - break; - default: - DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "DMAR"); - return (AE_ERROR); - } - - /* DMAR Subtable */ - - Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - - /* Optional Device Scope subtables */ - - while (*PFieldList) - { - Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmarScope, - &Subtable, FALSE); - if (Status == AE_NOT_FOUND) - { - break; - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - DtPushSubtable (Subtable); - - /* Optional PCI Paths */ - - while (*PFieldList) - { - Status = DtCompileTable (PFieldList, TableInfoDmarPciPath, - &Subtable, FALSE); - if (Status == AE_NOT_FOUND) - { - DtPopSubtable (); - break; - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - } - } - - DtPopSubtable (); - } - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileEinj - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile EINJ. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileEinj ( - void **List) -{ - ACPI_STATUS Status; - - - Status = DtCompileTwoSubtables (List, - AcpiDmTableInfoEinj, AcpiDmTableInfoEinj0); - return (Status); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileErst - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile ERST. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileErst ( - void **List) -{ - ACPI_STATUS Status; - - - Status = DtCompileTwoSubtables (List, - AcpiDmTableInfoErst, AcpiDmTableInfoEinj0); - return (Status); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileFadt - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile FADT. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileFadt ( - void **List) -{ - ACPI_STATUS Status; - DT_SUBTABLE *Subtable; - DT_SUBTABLE *ParentTable; - DT_FIELD **PFieldList = (DT_FIELD **) List; - ACPI_TABLE_HEADER *Table; - UINT8 Revision; - - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoFadt1, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - - Table = ACPI_CAST_PTR (ACPI_TABLE_HEADER, ParentTable->Buffer); - Revision = Table->Revision; - - if (Revision == 2) - { - Status = DtCompileTable (PFieldList, AcpiDmTableInfoFadt2, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - DtInsertSubtable (ParentTable, Subtable); - } - else if (Revision >= 2) - { - Status = DtCompileTable (PFieldList, AcpiDmTableInfoFadt3, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - DtInsertSubtable (ParentTable, Subtable); - } - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileHest - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile HEST. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileHest ( - void **List) -{ - ACPI_STATUS Status; - DT_SUBTABLE *Subtable; - DT_SUBTABLE *ParentTable; - DT_FIELD **PFieldList = (DT_FIELD **) List; - DT_FIELD *SubtableStart; - ACPI_DMTABLE_INFO *InfoTable; - UINT16 Type; - UINT32 BankCount; - - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoHest, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - - while (*PFieldList) - { - /* Get subtable type */ - - SubtableStart = *PFieldList; - DtCompileInteger ((UINT8 *) &Type, *PFieldList, 2, 0); - - switch (Type) - { - case ACPI_HEST_TYPE_IA32_CHECK: - InfoTable = AcpiDmTableInfoHest0; - break; - - case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK: - InfoTable = AcpiDmTableInfoHest1; - break; - - case ACPI_HEST_TYPE_IA32_NMI: - InfoTable = AcpiDmTableInfoHest2; - break; - - case ACPI_HEST_TYPE_AER_ROOT_PORT: - InfoTable = AcpiDmTableInfoHest6; - break; - - case ACPI_HEST_TYPE_AER_ENDPOINT: - InfoTable = AcpiDmTableInfoHest7; - break; - - case ACPI_HEST_TYPE_AER_BRIDGE: - InfoTable = AcpiDmTableInfoHest8; - break; - - case ACPI_HEST_TYPE_GENERIC_ERROR: - InfoTable = AcpiDmTableInfoHest9; - break; - - default: - /* Cannot continue on unknown type */ - - DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "HEST"); - return (AE_ERROR); - } - - Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - DtInsertSubtable (ParentTable, Subtable); - - /* - * Additional subtable data - IA32 Error Bank(s) - */ - BankCount = 0; - switch (Type) - { - case ACPI_HEST_TYPE_IA32_CHECK: - BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_MACHINE_CHECK, - Subtable->Buffer))->NumHardwareBanks; - break; - - case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK: - BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_CORRECTED, - Subtable->Buffer))->NumHardwareBanks; - break; - - default: - break; - } - - while (BankCount) - { - Status = DtCompileTable (PFieldList, AcpiDmTableInfoHestBank, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - DtInsertSubtable (ParentTable, Subtable); - BankCount--; - } - } - - return AE_OK; -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileIvrs - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile IVRS. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileIvrs ( - void **List) -{ - ACPI_STATUS Status; - DT_SUBTABLE *Subtable; - DT_SUBTABLE *ParentTable; - DT_FIELD **PFieldList = (DT_FIELD **) List; - DT_FIELD *SubtableStart; - ACPI_DMTABLE_INFO *InfoTable; - ACPI_IVRS_HEADER *IvrsHeader; - UINT8 EntryType; - - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoIvrs, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - - while (*PFieldList) - { - SubtableStart = *PFieldList; - Status = DtCompileTable (PFieldList, AcpiDmTableInfoIvrsHdr, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - DtPushSubtable (Subtable); - - IvrsHeader = ACPI_CAST_PTR (ACPI_IVRS_HEADER, Subtable->Buffer); - - switch (IvrsHeader->Type) - { - case ACPI_IVRS_TYPE_HARDWARE: - InfoTable = AcpiDmTableInfoIvrs0; - break; - - case ACPI_IVRS_TYPE_MEMORY1: - case ACPI_IVRS_TYPE_MEMORY2: - case ACPI_IVRS_TYPE_MEMORY3: - InfoTable = AcpiDmTableInfoIvrs1; - break; - - default: - DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "IVRS"); - return (AE_ERROR); - } - - Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - - if (IvrsHeader->Type == ACPI_IVRS_TYPE_HARDWARE) - { - while (*PFieldList && - !ACPI_STRCMP ((*PFieldList)->Name, "Entry Type")) - { - SubtableStart = *PFieldList; - DtCompileInteger (&EntryType, *PFieldList, 1, 0); - - switch (EntryType) - { - /* 4-byte device entries */ - - case ACPI_IVRS_TYPE_PAD4: - case ACPI_IVRS_TYPE_ALL: - case ACPI_IVRS_TYPE_SELECT: - case ACPI_IVRS_TYPE_START: - case ACPI_IVRS_TYPE_END: - - InfoTable = AcpiDmTableInfoIvrs4; - break; - - /* 8-byte entries, type A */ - - case ACPI_IVRS_TYPE_ALIAS_SELECT: - case ACPI_IVRS_TYPE_ALIAS_START: - - InfoTable = AcpiDmTableInfoIvrs8a; - break; - - /* 8-byte entries, type B */ - - case ACPI_IVRS_TYPE_PAD8: - case ACPI_IVRS_TYPE_EXT_SELECT: - case ACPI_IVRS_TYPE_EXT_START: - - InfoTable = AcpiDmTableInfoIvrs8b; - break; - - /* 8-byte entries, type C */ - - case ACPI_IVRS_TYPE_SPECIAL: - - InfoTable = AcpiDmTableInfoIvrs8c; - break; - - default: - DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, - "IVRS Device Entry"); - return (AE_ERROR); - } - - Status = DtCompileTable (PFieldList, InfoTable, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - DtInsertSubtable (ParentTable, Subtable); - } - } - - DtPopSubtable (); - } - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileMadt - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile MADT. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileMadt ( - void **List) -{ - ACPI_STATUS Status; - DT_SUBTABLE *Subtable; - DT_SUBTABLE *ParentTable; - DT_FIELD **PFieldList = (DT_FIELD **) List; - DT_FIELD *SubtableStart; - ACPI_SUBTABLE_HEADER *MadtHeader; - ACPI_DMTABLE_INFO *InfoTable; - - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoMadt, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - - while (*PFieldList) - { - SubtableStart = *PFieldList; - Status = DtCompileTable (PFieldList, AcpiDmTableInfoMadtHdr, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - DtPushSubtable (Subtable); - - MadtHeader = ACPI_CAST_PTR (ACPI_SUBTABLE_HEADER, Subtable->Buffer); - - switch (MadtHeader->Type) - { - case ACPI_MADT_TYPE_LOCAL_APIC: - InfoTable = AcpiDmTableInfoMadt0; - break; - case ACPI_MADT_TYPE_IO_APIC: - InfoTable = AcpiDmTableInfoMadt1; - break; - case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE: - InfoTable = AcpiDmTableInfoMadt2; - break; - case ACPI_MADT_TYPE_NMI_SOURCE: - InfoTable = AcpiDmTableInfoMadt3; - break; - case ACPI_MADT_TYPE_LOCAL_APIC_NMI: - InfoTable = AcpiDmTableInfoMadt4; - break; - case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE: - InfoTable = AcpiDmTableInfoMadt5; - break; - case ACPI_MADT_TYPE_IO_SAPIC: - InfoTable = AcpiDmTableInfoMadt6; - break; - case ACPI_MADT_TYPE_LOCAL_SAPIC: - InfoTable = AcpiDmTableInfoMadt7; - break; - case ACPI_MADT_TYPE_INTERRUPT_SOURCE: - InfoTable = AcpiDmTableInfoMadt8; - break; - case ACPI_MADT_TYPE_LOCAL_X2APIC: - InfoTable = AcpiDmTableInfoMadt9; - break; - case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI: - InfoTable = AcpiDmTableInfoMadt10; - break; - default: - DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "MADT"); - return (AE_ERROR); - } - - Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - DtPopSubtable (); - } - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileMcfg - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile MCFG. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileMcfg ( - void **List) -{ - ACPI_STATUS Status; - - - Status = DtCompileTwoSubtables (List, - AcpiDmTableInfoMcfg, AcpiDmTableInfoMcfg0); - return (Status); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileMsct - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile MSCT. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileMsct ( - void **List) -{ - ACPI_STATUS Status; - - - Status = DtCompileTwoSubtables (List, - AcpiDmTableInfoMsct, AcpiDmTableInfoMsct0); - return (Status); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileRsdt - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile RSDT. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileRsdt ( - void **List) -{ - DT_SUBTABLE *Subtable; - DT_SUBTABLE *ParentTable; - DT_FIELD *FieldList = *(DT_FIELD **) List; - UINT32 Address; - - - ParentTable = DtPeekSubtable (); - - while (FieldList) - { - DtCompileInteger ((UINT8 *) &Address, FieldList, 4, DT_NON_ZERO); - - DtCreateSubtable ((UINT8 *) &Address, 4, &Subtable); - DtInsertSubtable (ParentTable, Subtable); - FieldList = FieldList->Next; - } - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileSlit - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile SLIT. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileSlit ( - void **List) -{ - ACPI_STATUS Status; - DT_SUBTABLE *Subtable; - DT_SUBTABLE *ParentTable; - DT_FIELD **PFieldList = (DT_FIELD **) List; - DT_FIELD *FieldList; - UINT32 Localities; - UINT8 *LocalityBuffer; - UINT32 RemainingData; - - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoSlit, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - - Localities = *ACPI_CAST_PTR (UINT32, Subtable->Buffer); - LocalityBuffer = UtLocalCalloc (Localities); - - 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; - } - - DtCreateSubtable (LocalityBuffer, Localities, &Subtable); - DtInsertSubtable (ParentTable, Subtable); - } - - ACPI_FREE (LocalityBuffer); - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileSrat - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile SRAT. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileSrat ( - void **List) -{ - ACPI_STATUS Status; - DT_SUBTABLE *Subtable; - DT_SUBTABLE *ParentTable; - DT_FIELD **PFieldList = (DT_FIELD **) List; - DT_FIELD *SubtableStart; - ACPI_SUBTABLE_HEADER *SratHeader; - ACPI_DMTABLE_INFO *InfoTable; - - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoSrat, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - - while (*PFieldList) - { - SubtableStart = *PFieldList; - Status = DtCompileTable (PFieldList, AcpiDmTableInfoSratHdr, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - DtPushSubtable (Subtable); - - SratHeader = ACPI_CAST_PTR (ACPI_SUBTABLE_HEADER, Subtable->Buffer); - - switch (SratHeader->Type) - { - case ACPI_SRAT_TYPE_CPU_AFFINITY: - InfoTable = AcpiDmTableInfoSrat0; - break; - case ACPI_SRAT_TYPE_MEMORY_AFFINITY: - InfoTable = AcpiDmTableInfoSrat1; - break; - case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY: - InfoTable = AcpiDmTableInfoSrat2; - break; - default: - DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "SRAT"); - return (AE_ERROR); - } - - Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - DtPopSubtable (); - } - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileWdat - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile WDAT. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileWdat ( - void **List) -{ - ACPI_STATUS Status; - - - Status = DtCompileTwoSubtables (List, - AcpiDmTableInfoWdat, AcpiDmTableInfoWdat0); - return (Status); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileXsdt - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile XSDT. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileXsdt ( - void **List) -{ - DT_SUBTABLE *Subtable; - DT_SUBTABLE *ParentTable; - DT_FIELD *FieldList = *(DT_FIELD **) List; - UINT64 Address; - - ParentTable = DtPeekSubtable (); - - while (FieldList) - { - DtCompileInteger ((UINT8 *) &Address, FieldList, 8, DT_NON_ZERO); - - DtCreateSubtable ((UINT8 *) &Address, 8, &Subtable); - DtInsertSubtable (ParentTable, Subtable); - FieldList = FieldList->Next; - } - - return (AE_OK); -} diff -Nru acpica-unix-20100528/compiler/dtutils.c acpica-unix-20140114/compiler/dtutils.c --- acpica-unix-20100528/compiler/dtutils.c 2010-05-28 17:14:27.000000000 +0000 +++ acpica-unix-20140114/compiler/dtutils.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,894 +0,0 @@ -/****************************************************************************** - * - * Module Name: dtutils.c - Utility routines for the data table compiler - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - -#define __DTUTILS_C__ - -#include "aslcompiler.h" -#include "dtcompiler.h" -#include "actables.h" - -#define _COMPONENT DT_COMPILER - ACPI_MODULE_NAME ("dtutils") - -/* Local prototypes */ - -static void -DtSum ( - DT_SUBTABLE *Subtable, - void *Context, - void *ReturnValue); - - -/****************************************************************************** - * - * FUNCTION: DtError - * - * PARAMETERS: Level - Seriousness (Warning/error, etc.) - * MessageId - Index into global message buffer - * Op - Parse node where error happened - * ExtraMessage - additional error message - * - * RETURN: None - * - * DESCRIPTION: Common error interface for data table compiler - * - *****************************************************************************/ - -void -DtError ( - UINT8 Level, - UINT8 MessageId, - DT_FIELD *FieldObject, - char *ExtraMessage) -{ - - switch (Level) - { - case ASL_WARNING2: - case ASL_WARNING3: - if (Gbl_WarningLevel < Level) - { - return; - } - break; - - default: - break; - } - - if (FieldObject) - { - AslCommonError (Level, MessageId, - FieldObject->Line, - FieldObject->Line, - FieldObject->ByteOffset, - FieldObject->Column, - Gbl_Files[ASL_FILE_INPUT].Filename, ExtraMessage); - } - else - { - AslCommonError (Level, MessageId, 0, - 0, 0, 0, 0, ExtraMessage); - } -} - - -/****************************************************************************** - * - * FUNCTION: DtNameError - * - * PARAMETERS: Level - Seriousness (Warning/error, etc.) - * MessageId - Index into global message buffer - * Op - Parse node where error happened - * ExtraMessage - additional error message - * - * RETURN: None - * - * DESCRIPTION: Error interface for named objects - * - *****************************************************************************/ - -void -DtNameError ( - UINT8 Level, - UINT8 MessageId, - DT_FIELD *FieldObject, - char *ExtraMessage) -{ - - switch (Level) - { - case ASL_WARNING2: - case ASL_WARNING3: - if (Gbl_WarningLevel < Level) - { - return; - } - break; - - default: - break; - } - - if (FieldObject) - { - AslCommonError (Level, MessageId, - FieldObject->Line, - FieldObject->Line, - FieldObject->ByteOffset, - FieldObject->NameColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, ExtraMessage); - } - else - { - AslCommonError (Level, MessageId, 0, - 0, 0, 0, 0, ExtraMessage); - } -} - - -/******************************************************************************* - * - * FUNCTION: DtFatal - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Dump the error log and abort the compiler. Used for serious - * compile or I/O errors - * - ******************************************************************************/ - -void -DtFatal ( - UINT8 MessageId, - DT_FIELD *FieldObject, - char *ExtraMessage) -{ - - DtError (ASL_ERROR, MessageId, FieldObject, ExtraMessage); - - CmCleanupAndExit (); - exit (1); -} - - -/****************************************************************************** - * - * FUNCTION: DtStrtoul64 - * - * PARAMETERS: String - Null terminated string - * ReturnInteger - Where the converted integer is returned - * - * RETURN: Status - * - * DESCRIPTION: Simple conversion of a string hex integer constant to unsigned - * value. Assumes no leading "0x" for the constant. - * - * Portability note: The reason this function exists is because a 64-bit - * sscanf is not available in all environments. - * - *****************************************************************************/ - -ACPI_STATUS -DtStrtoul64 ( - char *String, - UINT64 *ReturnInteger) -{ - char *ThisChar = String; - UINT32 ThisDigit; - UINT64 ReturnValue = 0; - int DigitCount = 0; - - - /* Skip over any white space in the buffer */ - - while ((*ThisChar == ' ') || (*ThisChar == '\t')) - { - ThisChar++; - } - - /* Skip leading zeros */ - - while ((*ThisChar) == '0') - { - ThisChar++; - } - - /* Convert character-by-character */ - - while (*ThisChar) - { - if (ACPI_IS_DIGIT (*ThisChar)) - { - /* Convert ASCII 0-9 to Decimal value */ - - ThisDigit = ((UINT8) *ThisChar) - '0'; - } - else /* Letter */ - { - ThisDigit = (UINT32) ACPI_TOUPPER (*ThisChar); - if (!ACPI_IS_XDIGIT ((char) ThisDigit)) - { - /* Not A-F */ - - return (AE_BAD_CHARACTER); - } - - /* Convert ASCII Hex char (A-F) to value */ - - ThisDigit = (ThisDigit - 'A') + 10; - } - - /* Insert the 4-bit hex digit */ - - ReturnValue <<= 4; - ReturnValue += ThisDigit; - - ThisChar++; - DigitCount++; - if (DigitCount > 16) - { - /* Value is too large (> 64 bits/8 bytes/16 hex digits) */ - - return (AE_LIMIT); - } - } - - *ReturnInteger = ReturnValue; - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: DtGetFileSize - * - * PARAMETERS: Handle - Open file handler - * - * RETURN: Current file size - * - * DESCRIPTION: Get the current size of a file. Seek to the EOF and get the - * offset. Seek back to the original location. - * - *****************************************************************************/ - -UINT32 -DtGetFileSize ( - FILE *Handle) -{ - int CurrentOffset; - int LastOffset; - - - CurrentOffset = ftell (Handle); - fseek (Handle, 0, SEEK_END); - LastOffset = ftell (Handle); - fseek (Handle, CurrentOffset, SEEK_SET); - - return ((UINT32) LastOffset); -} - - -/****************************************************************************** - * - * FUNCTION: DtGetFieldValue - * - * PARAMETERS: Field - Current field list pointer - * Name - Field name - * - * RETURN: Field value - * - * DESCRIPTION: Get field value - * - *****************************************************************************/ - -char * -DtGetFieldValue ( - DT_FIELD *Field, - char *Name) -{ - - /* Search the field list for the name */ - - while (Field) - { - if (!ACPI_STRCMP (Name, Field->Name)) - { - return (Field->Value); - } - - Field = Field->Next; - } - - return (NULL); -} - - -/****************************************************************************** - * - * FUNCTION: DtGetFieldType - * - * PARAMETERS: Info - Data table info - * - * RETURN: Field type - * - * DESCRIPTION: Get field type - * - *****************************************************************************/ - -UINT8 -DtGetFieldType ( - ACPI_DMTABLE_INFO *Info) -{ - UINT8 Type; - - - /* DT_FLAG means that this is the start of a block of flag bits */ - /* TBD - we can make these a separate opcode later */ - - if (Info->Flags & DT_FLAG) - { - return (DT_FIELD_TYPE_FLAGS_INTEGER); - } - - /* Type is based upon the opcode for this field in the info table */ - - switch (Info->Opcode) - { - case ACPI_DMT_FLAG0: - case ACPI_DMT_FLAG1: - case ACPI_DMT_FLAG2: - case ACPI_DMT_FLAG3: - case ACPI_DMT_FLAG4: - case ACPI_DMT_FLAG5: - case ACPI_DMT_FLAG6: - case ACPI_DMT_FLAG7: - case ACPI_DMT_FLAGS0: - case ACPI_DMT_FLAGS2: - Type = DT_FIELD_TYPE_FLAG; - break; - - case ACPI_DMT_NAME4: - case ACPI_DMT_SIG: - case ACPI_DMT_NAME6: - case ACPI_DMT_NAME8: - case ACPI_DMT_STRING: - Type = DT_FIELD_TYPE_STRING; - break; - - case ACPI_DMT_BUFFER: - case ACPI_DMT_BUF16: - Type = DT_FIELD_TYPE_BUFFER; - break; - - case ACPI_DMT_PCI_PATH: - Type = DT_FIELD_TYPE_PCI_PATH; - break; - - case ACPI_DMT_GAS: - case ACPI_DMT_HESTNTFY: - Type = DT_FIELD_TYPE_INLINE_SUBTABLE; - break; - - default: - Type = DT_FIELD_TYPE_INTEGER; - break; - } - - return (Type); -} - - -/****************************************************************************** - * - * FUNCTION: DtGetBufferLength - * - * PARAMETERS: Buffer - List of integers, - * for example "10 3A 4F 2E" - * - * RETURN: Count of integer - * - * DESCRIPTION: Get length of bytes needed to store the integers - * - *****************************************************************************/ - -UINT32 -DtGetBufferLength ( - char *Buffer) -{ - UINT32 ByteLength = 0; - - - while (*Buffer) - { - if (*Buffer == ' ') - { - ByteLength++; - - while (*Buffer == ' ') - { - Buffer++; - } - } - - Buffer++; - } - - return (++ByteLength); -} - - -/****************************************************************************** - * - * FUNCTION: DtGetFieldLength - * - * PARAMETERS: Field - Current field list pointer - * Info - Data table info - * - * RETURN: Field length - * - * DESCRIPTION: Get length of bytes needed to compile the field - * - *****************************************************************************/ - -UINT32 -DtGetFieldLength ( - DT_FIELD *Field, - ACPI_DMTABLE_INFO *Info) -{ - UINT32 ByteLength = 0; - char *Value; - - - /* Length is based upon the opcode for this field in the info table */ - - switch (Info->Opcode) - { - case ACPI_DMT_FLAG0: - case ACPI_DMT_FLAG1: - case ACPI_DMT_FLAG2: - case ACPI_DMT_FLAG3: - case ACPI_DMT_FLAG4: - case ACPI_DMT_FLAG5: - case ACPI_DMT_FLAG6: - case ACPI_DMT_FLAG7: - case ACPI_DMT_FLAGS0: - case ACPI_DMT_FLAGS2: - ByteLength = 0; - break; - - case ACPI_DMT_UINT8: - case ACPI_DMT_CHKSUM: - case ACPI_DMT_SPACEID: - case ACPI_DMT_MADT: - case ACPI_DMT_SRAT: - case ACPI_DMT_ASF: - case ACPI_DMT_HESTNTYP: - case ACPI_DMT_FADTPM: - case ACPI_DMT_IVRS: - ByteLength = 1; - break; - - case ACPI_DMT_UINT16: - case ACPI_DMT_DMAR: - case ACPI_DMT_HEST: - case ACPI_DMT_PCI_PATH: - ByteLength = 2; - break; - - case ACPI_DMT_UINT24: - ByteLength = 3; - break; - - case ACPI_DMT_UINT32: - case ACPI_DMT_NAME4: - case ACPI_DMT_SIG: - ByteLength = 4; - break; - - case ACPI_DMT_NAME6: - ByteLength = 6; - break; - - case ACPI_DMT_UINT56: - ByteLength = 7; - break; - - case ACPI_DMT_UINT64: - case ACPI_DMT_NAME8: - ByteLength = 8; - break; - - case ACPI_DMT_STRING: - Value = DtGetFieldValue (Field, Info->Name); - - /* TBD: error if Value is NULL? (as below?) */ - - ByteLength = ACPI_STRLEN (Value) + 1; - break; - - case ACPI_DMT_GAS: - ByteLength = sizeof (ACPI_GENERIC_ADDRESS); - break; - - case ACPI_DMT_HESTNTFY: - ByteLength = sizeof (ACPI_HEST_NOTIFY); - break; - - case ACPI_DMT_BUFFER: - Value = DtGetFieldValue (Field, Info->Name); - if (Value) - { - ByteLength = DtGetBufferLength (Value); - } - else - { /* At this point, this is a fatal error */ - - sprintf (MsgBuffer, "Expected \"%s\"", Info->Name); - DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, MsgBuffer); - } - break; - - case ACPI_DMT_BUF16: - ByteLength = 16; - break; - - default: - DtFatal (ASL_MSG_COMPILER_INTERNAL, Field, "Invalid table opcode"); - break; - } - - return (ByteLength); -} - - -/****************************************************************************** - * - * FUNCTION: DtSum - * - * PARAMETERS: DT_WALK_CALLBACK: - * Subtable - Subtable - * Context - Unused - * ReturnValue - Store the checksum of subtable - * - * RETURN: Status - * - * DESCRIPTION: Get the checksum of subtable - * - *****************************************************************************/ - -static void -DtSum ( - DT_SUBTABLE *Subtable, - void *Context, - void *ReturnValue) -{ - UINT8 Checksum; - UINT8 *Sum = ReturnValue; - - - Checksum = AcpiTbChecksum (Subtable->Buffer, Subtable->Length); - *Sum = (UINT8) (*Sum + Checksum); -} - - -/****************************************************************************** - * - * FUNCTION: DtSetTableChecksum - * - * PARAMETERS: ChecksumPointer - Where to return the checksum - * - * RETURN: None - * - * DESCRIPTION: Set checksum of the whole data table into the checksum field - * - *****************************************************************************/ - -void -DtSetTableChecksum ( - UINT8 *ChecksumPointer) -{ - UINT8 Checksum = 0; - UINT8 OldSum; - - - DtWalkTableTree (Gbl_RootTable, DtSum, NULL, &Checksum); - - OldSum = *ChecksumPointer; - Checksum = (UINT8) (Checksum - OldSum); - - /* Compute the final checksum */ - - Checksum = (UINT8) (0 - Checksum); - *ChecksumPointer = Checksum; -} - - -/****************************************************************************** - * - * FUNCTION: DtSetTableLength - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Walk the subtables and set all the length fields - * - *****************************************************************************/ - -void -DtSetTableLength ( - void) -{ - DT_SUBTABLE *ParentTable; - DT_SUBTABLE *ChildTable; - - - ParentTable = Gbl_RootTable; - ChildTable = NULL; - - if (!ParentTable) - { - return; - } - - DtSetSubtableLength (ParentTable); - - while (1) - { - ChildTable = DtGetNextSubtable (ParentTable, ChildTable); - if (ChildTable) - { - if (ChildTable->Child) - { - ParentTable = ChildTable; - ChildTable = NULL; - } - else - { - ParentTable->TotalLength += ChildTable->TotalLength; - if (ParentTable->LengthField) - { - DtSetSubtableLength (ParentTable); - } - } - } - else - { - ChildTable = ParentTable; - - if (ChildTable == Gbl_RootTable) - { - break; - } - - ParentTable = DtGetParentSubtable (ParentTable); - - ParentTable->TotalLength += ChildTable->TotalLength; - if (ParentTable->LengthField) - { - DtSetSubtableLength (ParentTable); - } - } - } -} - - -/****************************************************************************** - * - * FUNCTION: DtWalkTableTree - * - * PARAMETERS: StartTable - Subtable in the tree where walking begins - * UserFunction - Called during the walk - * Context - Passed to user function - * ReturnValue - The return value of UserFunction - * - * RETURN: None - * - * DESCRIPTION: Performs a depth-first walk of the subtable tree - * - *****************************************************************************/ - -void -DtWalkTableTree ( - DT_SUBTABLE *StartTable, - DT_WALK_CALLBACK UserFunction, - void *Context, - void *ReturnValue) -{ - DT_SUBTABLE *ParentTable; - DT_SUBTABLE *ChildTable; - - - ParentTable = StartTable; - ChildTable = NULL; - - if (!ParentTable) - { - return; - } - - UserFunction (ParentTable, Context, ReturnValue); - - while (1) - { - ChildTable = DtGetNextSubtable (ParentTable, ChildTable); - if (ChildTable) - { - UserFunction (ChildTable, Context, ReturnValue); - - if (ChildTable->Child) - { - ParentTable = ChildTable; - ChildTable = NULL; - } - } - else - { - ChildTable = ParentTable; - if (ChildTable == Gbl_RootTable) - { - break; - } - - ParentTable = DtGetParentSubtable (ParentTable); - - if (ChildTable->Peer == StartTable) - { - break; - } - } - } -} - - -/****************************************************************************** - * - * FUNCTION: DtFreeFieldList - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Free the field list - * - *****************************************************************************/ - -void -DtFreeFieldList ( - void) -{ - DT_FIELD *Field = Gbl_FieldList; - DT_FIELD *NextField; - - - /* Walk and free entire field list */ - - while (Field) - { - NextField = Field->Next; /* Save link */ - - if (!(Field->Flags & DT_FIELD_NOT_ALLOCATED)) - { - ACPI_FREE (Field->Name); - ACPI_FREE (Field->Value); - } - - ACPI_FREE (Field); - Field = NextField; - } -} diff -Nru acpica-unix-20100528/compiler/readme.txt acpica-unix-20140114/compiler/readme.txt --- acpica-unix-20100528/compiler/readme.txt 2010-05-28 17:14:27.000000000 +0000 +++ acpica-unix-20140114/compiler/readme.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,85 +0,0 @@ - -Instructions for integrating iASL compiler into MS VC++ 6.0 environment. - -Part 1. Integration as a custom tool - -This procedure adds the iASL compiler as a custom tool that can be used -to compile ASL source files. The output is sent to the VC output -window. - -a) Select Tools->Customize. - -b) Select the "Tools" tab. - -c) Scroll down to the bottom of the "Menu Contents" window. There you - will see an empty rectangle. Click in the rectangle to enter a - name for this tool. - -d) Type "iASL Compiler" in the box and hit enter. You can now edit - the other fields for this new custom tool. - -e) Enter the following into the fields: - - Command: C:\Acpi\iasl.exe - Arguments: -e "$(FilePath)" - Initial Directory "$(FileDir)" - Use Output Window - - "Command" must be the path to wherever you copied the compiler. - "-e" instructs the compiler to produce messages appropriate for VC. - Quotes around FilePath and FileDir enable spaces in filenames. - -f) Select "Close". - -These steps will add the compiler to the tools menu as a custom tool. -By enabling "Use Output Window", you can click on error messages in -the output window and the source file and source line will be -automatically displayed by VC. Also, you can use F4 to step through -the messages and the corresponding source line(s). - - -Part 2. Integration into a project build - -This procedure creates a project that compiles ASL files to AML. - -a) Create a new, empty project and add your .ASL files to the project - -b) For all ASL files in the project, specify a custom build (under -Project/Settings/CustomBuild with the following settings (or similar): - -Commands: -c:\acpi\libraries\iasl.exe -vs -vi "$(InputPath)" - -Output: -$(InputDir)\$(InputPath).aml - - - -Compiler Generation From Source - -Generation of the ASL compiler from source code requires these items: - - -Required Tools -1) The Flex (or Lex) lexical analyzer generator. -2) The Bison (or Yacc) parser generator. -3) An ANSI C compiler. - - -Required Source Code. - -There are three major source code components that are required to -generate the compiler: - -1) The ASL compiler source. -2) The ACPI CA Core Subsystem source. In particular, the Namespace Manager - component is used to create an internal ACPI namespace and symbol table, - and the AML Interpreter is used to evaluate constant expressions. -3) The Common source for all ACPI components. - - - - - - - diff -Nru acpica-unix-20100528/debian/README acpica-unix-20140114/debian/README --- acpica-unix-20100528/debian/README 1970-01-01 00:00:00.000000000 +0000 +++ acpica-unix-20140114/debian/README 2014-01-28 13:06:26.000000000 +0000 @@ -0,0 +1,79 @@ +acpica-unix +----------- + +This source release includes: + + +1) a cross-OS AML interpreter + +This is intended to allow commercial and open source operating systems +to be enabled for ACPI. OS specific code is still needed, but the +AML interpreter should greatly improve the development speed of ACPI +support. + +The AML interpreter source should be integrated into the kernel's +build process. We recommend establishing an automated method for +this, so later versions can also be incorporated easily. Please see +the documentation on the website for API and other implementation +information. + + +2) iasl, an ASL compiler/decompiler + +iasl compiles ASL (ACPI Source Language) into AML (ACPI Machine +Language). This AML is suitable for inclusion as a DSDT in system +firmware. It also can disassemble AML, for debugging purposes. + +To compile: + +cd compiler +make + +It has been compiled on Linux, but should easily port to other Unix +environments. + +Run 'iasl -h' for more information, or download the binary version for +documentation in PDF format. + + +3) acpisrc, a source code conversion tool + +acpisrc converts the standard form of the acpica source release (included +here) into a version that meets Linux coding guidelines. This consists +mainly of performing a series of string replacements and transformations +to the code. + +To compile: + +cd tools/acpisrc +make + +It has been compiled on Linux, but should easily port to other Unix +environments. + + +4) acpibin, an AML file tool + +acpibin compares AML files, dumps AML binary files to text files, +extracts binary AML from text files, and other AML file +manipulation. + +To compile: + +cd tools/acpibin +make + + +5) acpiexec, a user-space AML interpreter + +acpiexec allows the loading of ACPI tables and execution of control +methods from user space. Useful for debugging AML code and testing +the AML interpreter. + +To compile: + +cd tools/acpiexec +make + + +Thanks -- The ACPI CA Team diff -Nru acpica-unix-20100528/debian/README.Debian acpica-unix-20140114/debian/README.Debian --- acpica-unix-20100528/debian/README.Debian 2012-12-19 02:49:15.000000000 +0000 +++ acpica-unix-20140114/debian/README.Debian 2014-01-28 13:06:26.000000000 +0000 @@ -1,7 +1,57 @@ - README for Debian package of iasl - ================================= +Packaging Notes for Debian +========================== +Upstream has documentation that may or may not be licensed in a freely +redistributable manner. In an excess of caution, the manuals in question +are not include in the source we start with. You can still get your own +copies of the documentation from here: -You can find more iASL documentation on Intel Corp. site: -http://developer.intel.com/technology/iapc/acpi/downloads/AslCompiler.pdf + https://www.acpica.org/documentation/ -See also: http://developer.intel.com/technology/iapc/acpi/ +The two manuals affected are: + + (1) ACPICA Reference Manual, describing the ACPI Component Architecture + in some detail, and + + (2) ASL Compiler Reference Manual, describing how to use iasl + +While there are man pages for the commands, they are very brief. The +documents above are recommended reading. + + +Preparing the Source Tarball +============================ +ACPICA upstream splits the git tree into two separate source tarballs for +Unix flavored use. We put them back together to make it easier to track +changes againt the upstream git tree. For example, to create the +orig.tar.gz for this version, the author did the following: + + $ cd workdir + $ wget https://www.acpica.org/download/acpica-unix2-20130117.tar.gz + $ wget https://www.acpica.org/download/acpitests-unix-20130117.tar.gz + +NB: note the use of "unix2" and "unix". + + $ mkdir acpica-unix-20130117 + $ cd acpica-unix-20130117 + $ tar --strip-components=1 -xzf ../acpica-unix2-20130117.tar.gz + $ tar --strip-components=1 -xzf ../acpitests-unix-20130117.tar.gz + +The source is now unpacked into the same directory structure used in +the upstream git tree. Now create the .orig.tar.gz: + + $ cd .. + $ tar czf acpica-unix_20130117.orig.tar.gz acpica-unix-20130117 + + +Test Cases +========== +The aapits tests do not currently build properly. They will be added to +this package once they do. In the meantime, ASL, template and misc tests +will be run as part of make check + + +Licensing +========= +The source for this package has been dual-licensed under the Intel +ACPI license or the GPLv2. Per that dual-licensing, this source package +is being redistributed under the terms of the GPLv2. diff -Nru acpica-unix-20100528/debian/acpi-dsdt.dsl acpica-unix-20140114/debian/acpi-dsdt.dsl --- acpica-unix-20100528/debian/acpi-dsdt.dsl 2012-12-19 02:49:15.000000000 +0000 +++ acpica-unix-20140114/debian/acpi-dsdt.dsl 1970-01-01 00:00:00.000000000 +0000 @@ -1,559 +0,0 @@ -/* - * QEMU ACPI DSDT ASL definition - * - * Copyright (c) 2006 Fabrice Bellard - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2 as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -DefinitionBlock ( - "acpi-dsdt.aml", // Output Filename - "DSDT", // Signature - 0x01, // DSDT Compliance Revision - "QEMU", // OEMID - "QEMUDSDT", // TABLE ID - 0x1 // OEM Revision - ) -{ - Scope (\) - { - /* CMOS memory access */ - OperationRegion (CMS, SystemIO, 0x70, 0x02) - Field (CMS, ByteAcc, NoLock, Preserve) - { - CMSI, 8, - CMSD, 8 - } - Method (CMRD, 1, NotSerialized) - { - Store (Arg0, CMSI) - Store (CMSD, Local0) - Return (Local0) - } - - /* Debug Output */ - OperationRegion (DBG, SystemIO, 0xb044, 0x04) - Field (DBG, DWordAcc, NoLock, Preserve) - { - DBGL, 32, - } - } - - - /* PCI Bus definition */ - Scope(\_SB) { - Device(PCI0) { - Name (_HID, EisaId ("PNP0A03")) - Name (_ADR, 0x00) - Name (_UID, 1) - Name(_PRT, Package() { - /* PCI IRQ routing table, example from ACPI 2.0a specification, - section 6.2.8.1 */ - /* Note: we provide the same info as the PCI routing - table of the Bochs BIOS */ - - // PCI Slot 0 - Package() {0x0000ffff, 0, LNKD, 0}, - Package() {0x0000ffff, 1, LNKA, 0}, - Package() {0x0000ffff, 2, LNKB, 0}, - Package() {0x0000ffff, 3, LNKC, 0}, - - // PCI Slot 1 - Package() {0x0001ffff, 0, LNKA, 0}, - Package() {0x0001ffff, 1, LNKB, 0}, - Package() {0x0001ffff, 2, LNKC, 0}, - Package() {0x0001ffff, 3, LNKD, 0}, - - // PCI Slot 2 - Package() {0x0002ffff, 0, LNKB, 0}, - Package() {0x0002ffff, 1, LNKC, 0}, - Package() {0x0002ffff, 2, LNKD, 0}, - Package() {0x0002ffff, 3, LNKA, 0}, - - // PCI Slot 3 - Package() {0x0003ffff, 0, LNKC, 0}, - Package() {0x0003ffff, 1, LNKD, 0}, - Package() {0x0003ffff, 2, LNKA, 0}, - Package() {0x0003ffff, 3, LNKB, 0}, - - // PCI Slot 4 - Package() {0x0004ffff, 0, LNKD, 0}, - Package() {0x0004ffff, 1, LNKA, 0}, - Package() {0x0004ffff, 2, LNKB, 0}, - Package() {0x0004ffff, 3, LNKC, 0}, - - // PCI Slot 5 - Package() {0x0005ffff, 0, LNKA, 0}, - Package() {0x0005ffff, 1, LNKB, 0}, - Package() {0x0005ffff, 2, LNKC, 0}, - Package() {0x0005ffff, 3, LNKD, 0}, - }) - - Method (_CRS, 0, NotSerialized) - { - Name (MEMP, ResourceTemplate () - { - WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode, - 0x0000, // Address Space Granularity - 0x0000, // Address Range Minimum - 0x00FF, // Address Range Maximum - 0x0000, // Address Translation Offset - 0x0100, // Address Length - ,, ) - IO (Decode16, - 0x0CF8, // Address Range Minimum - 0x0CF8, // Address Range Maximum - 0x01, // Address Alignment - 0x08, // Address Length - ) - WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, - 0x0000, // Address Space Granularity - 0x0000, // Address Range Minimum - 0x0CF7, // Address Range Maximum - 0x0000, // Address Translation Offset - 0x0CF8, // Address Length - ,, , TypeStatic) - WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, - 0x0000, // Address Space Granularity - 0x0D00, // Address Range Minimum - 0xFFFF, // Address Range Maximum - 0x0000, // Address Translation Offset - 0xF300, // Address Length - ,, , TypeStatic) - DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite, - 0x00000000, // Address Space Granularity - 0x000A0000, // Address Range Minimum - 0x000BFFFF, // Address Range Maximum - 0x00000000, // Address Translation Offset - 0x00020000, // Address Length - ,, , AddressRangeMemory, TypeStatic) - DWordMemory (ResourceProducer, PosDecode, MinNotFixed, MaxFixed, NonCacheable, ReadWrite, - 0x00000000, // Address Space Granularity - 0x00000000, // Address Range Minimum - 0xFEBFFFFF, // Address Range Maximum - 0x00000000, // Address Translation Offset - 0x00000000, // Address Length - ,, MEMF, AddressRangeMemory, TypeStatic) - }) - CreateDWordField (MEMP, \_SB.PCI0._CRS.MEMF._MIN, PMIN) - CreateDWordField (MEMP, \_SB.PCI0._CRS.MEMF._MAX, PMAX) - CreateDWordField (MEMP, \_SB.PCI0._CRS.MEMF._LEN, PLEN) - /* compute available RAM */ - Add(CMRD(0x34), ShiftLeft(CMRD(0x35), 8), Local0) - ShiftLeft(Local0, 16, Local0) - Add(Local0, 0x1000000, Local0) - /* update field of last region */ - Store(Local0, PMIN) - Subtract (PMAX, PMIN, PLEN) - Increment (PLEN) - Return (MEMP) - } - } - } - - Scope(\_SB.PCI0) { - - /* PIIX3 ISA bridge */ - Device (ISA) { - Name (_ADR, 0x00010000) - - /* PIIX PCI to ISA irq remapping */ - OperationRegion (P40C, PCI_Config, 0x60, 0x04) - - - /* Keyboard seems to be important for WinXP install */ - Device (KBD) - { - Name (_HID, EisaId ("PNP0303")) - Method (_STA, 0, NotSerialized) - { - Return (0x0f) - } - - Method (_CRS, 0, NotSerialized) - { - Name (TMP, ResourceTemplate () - { - IO (Decode16, - 0x0060, // Address Range Minimum - 0x0060, // Address Range Maximum - 0x01, // Address Alignment - 0x01, // Address Length - ) - IO (Decode16, - 0x0064, // Address Range Minimum - 0x0064, // Address Range Maximum - 0x01, // Address Alignment - 0x01, // Address Length - ) - IRQNoFlags () - {1} - }) - Return (TMP) - } - } - - /* PS/2 mouse */ - Device (MOU) - { - Name (_HID, EisaId ("PNP0F13")) - Method (_STA, 0, NotSerialized) - { - Return (0x0f) - } - - Method (_CRS, 0, NotSerialized) - { - Name (TMP, ResourceTemplate () - { - IRQNoFlags () {12} - }) - Return (TMP) - } - } - - /* PS/2 floppy controller */ - Device (FDC0) - { - Name (_HID, EisaId ("PNP0700")) - Method (_STA, 0, NotSerialized) - { - Return (0x0F) - } - Method (_CRS, 0, NotSerialized) - { - Name (BUF0, ResourceTemplate () - { - IO (Decode16, 0x03F2, 0x03F2, 0x00, 0x04) - IO (Decode16, 0x03F7, 0x03F7, 0x00, 0x01) - IRQNoFlags () {6} - DMA (Compatibility, NotBusMaster, Transfer8) {2} - }) - Return (BUF0) - } - } - - /* Parallel port */ - Device (LPT) - { - Name (_HID, EisaId ("PNP0400")) - Method (_STA, 0, NotSerialized) - { - Store (\_SB.PCI0.PX13.DRSA, Local0) - And (Local0, 0x80000000, Local0) - If (LEqual (Local0, 0)) - { - Return (0x00) - } - Else - { - Return (0x0F) - } - } - Method (_CRS, 0, NotSerialized) - { - Name (BUF0, ResourceTemplate () - { - IO (Decode16, 0x0378, 0x0378, 0x08, 0x08) - IRQNoFlags () {7} - }) - Return (BUF0) - } - } - - /* Serial Ports */ - Device (COM1) - { - Name (_HID, EisaId ("PNP0501")) - Name (_UID, 0x01) - Method (_STA, 0, NotSerialized) - { - Store (\_SB.PCI0.PX13.DRSC, Local0) - And (Local0, 0x08000000, Local0) - If (LEqual (Local0, 0)) - { - Return (0x00) - } - Else - { - Return (0x0F) - } - } - Method (_CRS, 0, NotSerialized) - { - Name (BUF0, ResourceTemplate () - { - IO (Decode16, 0x03F8, 0x03F8, 0x00, 0x08) - IRQNoFlags () {4} - }) - Return (BUF0) - } - } - - Device (COM2) - { - Name (_HID, EisaId ("PNP0501")) - Name (_UID, 0x02) - Method (_STA, 0, NotSerialized) - { - Store (\_SB.PCI0.PX13.DRSC, Local0) - And (Local0, 0x80000000, Local0) - If (LEqual (Local0, 0)) - { - Return (0x00) - } - Else - { - Return (0x0F) - } - } - Method (_CRS, 0, NotSerialized) - { - Name (BUF0, ResourceTemplate () - { - IO (Decode16, 0x02F8, 0x02F8, 0x00, 0x08) - IRQNoFlags () {3} - }) - Return (BUF0) - } - } - } - - /* PIIX4 PM */ - Device (PX13) { - Name (_ADR, 0x00010003) - - OperationRegion (P13C, PCI_Config, 0x5c, 0x24) - Field (P13C, DWordAcc, NoLock, Preserve) - { - DRSA, 32, - DRSB, 32, - DRSC, 32, - DRSE, 32, - DRSF, 32, - DRSG, 32, - DRSH, 32, - DRSI, 32, - DRSJ, 32 - } - } - } - - /* PCI IRQs */ - Scope(\_SB) { - Field (\_SB.PCI0.ISA.P40C, ByteAcc, NoLock, Preserve) - { - PRQ0, 8, - PRQ1, 8, - PRQ2, 8, - PRQ3, 8 - } - - Device(LNKA){ - Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link - Name(_UID, 1) - Name(_PRS, ResourceTemplate(){ - IRQ (Level, ActiveLow, Shared) - {3,4,5,6,7,9,10,11,12} - }) - Method (_STA, 0, NotSerialized) - { - Store (0x0B, Local0) - If (And (0x80, PRQ0, Local1)) - { - Store (0x09, Local0) - } - Return (Local0) - } - Method (_DIS, 0, NotSerialized) - { - Or (PRQ0, 0x80, PRQ0) - } - Method (_CRS, 0, NotSerialized) - { - Name (PRR0, ResourceTemplate () - { - IRQ (Level, ActiveLow, Shared) - {1} - }) - CreateWordField (PRR0, 0x01, TMP) - Store (PRQ0, Local0) - If (LLess (Local0, 0x80)) - { - ShiftLeft (One, Local0, TMP) - } - Else - { - Store (Zero, TMP) - } - Return (PRR0) - } - Method (_SRS, 1, NotSerialized) - { - CreateWordField (Arg0, 0x01, TMP) - FindSetRightBit (TMP, Local0) - Decrement (Local0) - Store (Local0, PRQ0) - } - } - Device(LNKB){ - Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link - Name(_UID, 2) - Name(_PRS, ResourceTemplate(){ - IRQ (Level, ActiveLow, Shared) - {3,4,5,6,7,9,10,11,12} - }) - Method (_STA, 0, NotSerialized) - { - Store (0x0B, Local0) - If (And (0x80, PRQ1, Local1)) - { - Store (0x09, Local0) - } - Return (Local0) - } - Method (_DIS, 0, NotSerialized) - { - Or (PRQ1, 0x80, PRQ1) - } - Method (_CRS, 0, NotSerialized) - { - Name (PRR0, ResourceTemplate () - { - IRQ (Level, ActiveLow, Shared) - {1} - }) - CreateWordField (PRR0, 0x01, TMP) - Store (PRQ1, Local0) - If (LLess (Local0, 0x80)) - { - ShiftLeft (One, Local0, TMP) - } - Else - { - Store (Zero, TMP) - } - Return (PRR0) - } - Method (_SRS, 1, NotSerialized) - { - CreateWordField (Arg0, 0x01, TMP) - FindSetRightBit (TMP, Local0) - Decrement (Local0) - Store (Local0, PRQ1) - } - } - Device(LNKC){ - Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link - Name(_UID, 3) - Name(_PRS, ResourceTemplate(){ - IRQ (Level, ActiveLow, Shared) - {3,4,5,6,7,9,10,11,12} - }) - Method (_STA, 0, NotSerialized) - { - Store (0x0B, Local0) - If (And (0x80, PRQ2, Local1)) - { - Store (0x09, Local0) - } - Return (Local0) - } - Method (_DIS, 0, NotSerialized) - { - Or (PRQ2, 0x80, PRQ2) - } - Method (_CRS, 0, NotSerialized) - { - Name (PRR0, ResourceTemplate () - { - IRQ (Level, ActiveLow, Shared) - {1} - }) - CreateWordField (PRR0, 0x01, TMP) - Store (PRQ2, Local0) - If (LLess (Local0, 0x80)) - { - ShiftLeft (One, Local0, TMP) - } - Else - { - Store (Zero, TMP) - } - Return (PRR0) - } - Method (_SRS, 1, NotSerialized) - { - CreateWordField (Arg0, 0x01, TMP) - FindSetRightBit (TMP, Local0) - Decrement (Local0) - Store (Local0, PRQ2) - } - } - Device(LNKD){ - Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link - Name(_UID, 4) - Name(_PRS, ResourceTemplate(){ - IRQ (Level, ActiveLow, Shared) - {3,4,5,6,7,9,10,11,12} - }) - Method (_STA, 0, NotSerialized) - { - Store (0x0B, Local0) - If (And (0x80, PRQ3, Local1)) - { - Store (0x09, Local0) - } - Return (Local0) - } - Method (_DIS, 0, NotSerialized) - { - Or (PRQ3, 0x80, PRQ3) - } - Method (_CRS, 0, NotSerialized) - { - Name (PRR0, ResourceTemplate () - { - IRQ (Level, ActiveLow, Shared) - {1} - }) - CreateWordField (PRR0, 0x01, TMP) - Store (PRQ3, Local0) - If (LLess (Local0, 0x80)) - { - ShiftLeft (One, Local0, TMP) - } - Else - { - Store (Zero, TMP) - } - Return (PRR0) - } - Method (_SRS, 1, NotSerialized) - { - CreateWordField (Arg0, 0x01, TMP) - FindSetRightBit (TMP, Local0) - Decrement (Local0) - Store (Local0, PRQ3) - } - } - } - - /* S5 = power off state */ - Name (_S5, Package (4) { - 0x00, // PM1a_CNT.SLP_TYP - 0x00, // PM2a_CNT.SLP_TYP - 0x00, // reserved - 0x00, // reserved - }) -} diff -Nru acpica-unix-20100528/debian/acpi-dsdt.hex acpica-unix-20140114/debian/acpi-dsdt.hex --- acpica-unix-20100528/debian/acpi-dsdt.hex 2012-12-19 02:49:15.000000000 +0000 +++ acpica-unix-20140114/debian/acpi-dsdt.hex 1970-01-01 00:00:00.000000000 +0000 @@ -1,266 +0,0 @@ -unsigned char AmlCode[] = -{ - 0x44,0x53,0x44,0x54,0x32,0x08,0x00,0x00, /* 00000000 "DSDT2..." */ - 0x01,0x49,0x51,0x45,0x4D,0x55,0x00,0x00, /* 00000008 ".IQEMU.." */ - 0x51,0x45,0x4D,0x55,0x44,0x53,0x44,0x54, /* 00000010 "QEMUDSDT" */ - 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ - 0x28,0x05,0x10,0x20,0x10,0x4F,0x04,0x5C, /* 00000020 "(.. .O.\" */ - 0x00,0x5B,0x80,0x43,0x4D,0x53,0x5F,0x01, /* 00000028 ".[.CMS_." */ - 0x0A,0x70,0x0A,0x02,0x5B,0x81,0x10,0x43, /* 00000030 ".p..[..C" */ - 0x4D,0x53,0x5F,0x01,0x43,0x4D,0x53,0x49, /* 00000038 "MS_.CMSI" */ - 0x08,0x43,0x4D,0x53,0x44,0x08,0x14,0x14, /* 00000040 ".CMSD..." */ - 0x43,0x4D,0x52,0x44,0x01,0x70,0x68,0x43, /* 00000048 "CMRD.phC" */ - 0x4D,0x53,0x49,0x70,0x43,0x4D,0x53,0x44, /* 00000050 "MSIpCMSD" */ - 0x60,0xA4,0x60,0x5B,0x80,0x44,0x42,0x47, /* 00000058 "`.`[.DBG" */ - 0x5F,0x01,0x0B,0x44,0xB0,0x0A,0x04,0x5B, /* 00000060 "_..D...[" */ - 0x81,0x0B,0x44,0x42,0x47,0x5F,0x03,0x44, /* 00000068 "..DBG_.D" */ - 0x42,0x47,0x4C,0x20,0x10,0x4E,0x25,0x5F, /* 00000070 "BGL .N%_" */ - 0x53,0x42,0x5F,0x5B,0x82,0x46,0x25,0x50, /* 00000078 "SB_[.F%P" */ - 0x43,0x49,0x30,0x08,0x5F,0x48,0x49,0x44, /* 00000080 "CI0._HID" */ - 0x0C,0x41,0xD0,0x0A,0x03,0x08,0x5F,0x41, /* 00000088 ".A...._A" */ - 0x44,0x52,0x00,0x08,0x5F,0x55,0x49,0x44, /* 00000090 "DR.._UID" */ - 0x01,0x08,0x5F,0x50,0x52,0x54,0x12,0x47, /* 00000098 ".._PRT.G" */ - 0x15,0x18,0x12,0x0B,0x04,0x0B,0xFF,0xFF, /* 000000A0 "........" */ - 0x00,0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0B, /* 000000A8 ".LNKD..." */ - 0x04,0x0B,0xFF,0xFF,0x01,0x4C,0x4E,0x4B, /* 000000B0 ".....LNK" */ - 0x41,0x00,0x12,0x0C,0x04,0x0B,0xFF,0xFF, /* 000000B8 "A......." */ - 0x0A,0x02,0x4C,0x4E,0x4B,0x42,0x00,0x12, /* 000000C0 "..LNKB.." */ - 0x0C,0x04,0x0B,0xFF,0xFF,0x0A,0x03,0x4C, /* 000000C8 ".......L" */ - 0x4E,0x4B,0x43,0x00,0x12,0x0D,0x04,0x0C, /* 000000D0 "NKC....." */ - 0xFF,0xFF,0x01,0x00,0x00,0x4C,0x4E,0x4B, /* 000000D8 ".....LNK" */ - 0x41,0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF, /* 000000E0 "A......." */ - 0x01,0x00,0x01,0x4C,0x4E,0x4B,0x42,0x00, /* 000000E8 "...LNKB." */ - 0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x01,0x00, /* 000000F0 "........" */ - 0x0A,0x02,0x4C,0x4E,0x4B,0x43,0x00,0x12, /* 000000F8 "..LNKC.." */ - 0x0E,0x04,0x0C,0xFF,0xFF,0x01,0x00,0x0A, /* 00000100 "........" */ - 0x03,0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0D, /* 00000108 ".LNKD..." */ - 0x04,0x0C,0xFF,0xFF,0x02,0x00,0x00,0x4C, /* 00000110 ".......L" */ - 0x4E,0x4B,0x42,0x00,0x12,0x0D,0x04,0x0C, /* 00000118 "NKB....." */ - 0xFF,0xFF,0x02,0x00,0x01,0x4C,0x4E,0x4B, /* 00000120 ".....LNK" */ - 0x43,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF, /* 00000128 "C......." */ - 0x02,0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x44, /* 00000130 "....LNKD" */ - 0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x02, /* 00000138 "........" */ - 0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x41,0x00, /* 00000140 "...LNKA." */ - 0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x03,0x00, /* 00000148 "........" */ - 0x00,0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0D, /* 00000150 ".LNKC..." */ - 0x04,0x0C,0xFF,0xFF,0x03,0x00,0x01,0x4C, /* 00000158 ".......L" */ - 0x4E,0x4B,0x44,0x00,0x12,0x0E,0x04,0x0C, /* 00000160 "NKD....." */ - 0xFF,0xFF,0x03,0x00,0x0A,0x02,0x4C,0x4E, /* 00000168 "......LN" */ - 0x4B,0x41,0x00,0x12,0x0E,0x04,0x0C,0xFF, /* 00000170 "KA......" */ - 0xFF,0x03,0x00,0x0A,0x03,0x4C,0x4E,0x4B, /* 00000178 ".....LNK" */ - 0x42,0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF, /* 00000180 "B......." */ - 0x04,0x00,0x00,0x4C,0x4E,0x4B,0x44,0x00, /* 00000188 "...LNKD." */ - 0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x04,0x00, /* 00000190 "........" */ - 0x01,0x4C,0x4E,0x4B,0x41,0x00,0x12,0x0E, /* 00000198 ".LNKA..." */ - 0x04,0x0C,0xFF,0xFF,0x04,0x00,0x0A,0x02, /* 000001A0 "........" */ - 0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0E,0x04, /* 000001A8 "LNKB...." */ - 0x0C,0xFF,0xFF,0x04,0x00,0x0A,0x03,0x4C, /* 000001B0 ".......L" */ - 0x4E,0x4B,0x43,0x00,0x12,0x0D,0x04,0x0C, /* 000001B8 "NKC....." */ - 0xFF,0xFF,0x05,0x00,0x00,0x4C,0x4E,0x4B, /* 000001C0 ".....LNK" */ - 0x41,0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF, /* 000001C8 "A......." */ - 0x05,0x00,0x01,0x4C,0x4E,0x4B,0x42,0x00, /* 000001D0 "...LNKB." */ - 0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x05,0x00, /* 000001D8 "........" */ - 0x0A,0x02,0x4C,0x4E,0x4B,0x43,0x00,0x12, /* 000001E0 "..LNKC.." */ - 0x0E,0x04,0x0C,0xFF,0xFF,0x05,0x00,0x0A, /* 000001E8 "........" */ - 0x03,0x4C,0x4E,0x4B,0x44,0x00,0x14,0x4C, /* 000001F0 ".LNKD..L" */ - 0x0D,0x5F,0x43,0x52,0x53,0x00,0x08,0x4D, /* 000001F8 "._CRS..M" */ - 0x45,0x4D,0x50,0x11,0x42,0x07,0x0A,0x6E, /* 00000200 "EMP.B..n" */ - 0x88,0x0D,0x00,0x02,0x0C,0x00,0x00,0x00, /* 00000208 "........" */ - 0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x01, /* 00000210 "........" */ - 0x47,0x01,0xF8,0x0C,0xF8,0x0C,0x01,0x08, /* 00000218 "G......." */ - 0x88,0x0D,0x00,0x01,0x0C,0x03,0x00,0x00, /* 00000220 "........" */ - 0x00,0x00,0xF7,0x0C,0x00,0x00,0xF8,0x0C, /* 00000228 "........" */ - 0x88,0x0D,0x00,0x01,0x0C,0x03,0x00,0x00, /* 00000230 "........" */ - 0x00,0x0D,0xFF,0xFF,0x00,0x00,0x00,0xF3, /* 00000238 "........" */ - 0x87,0x17,0x00,0x00,0x0C,0x03,0x00,0x00, /* 00000240 "........" */ - 0x00,0x00,0x00,0x00,0x0A,0x00,0xFF,0xFF, /* 00000248 "........" */ - 0x0B,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000250 "........" */ - 0x02,0x00,0x87,0x17,0x00,0x00,0x08,0x01, /* 00000258 "........" */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000260 "........" */ - 0xFF,0xFF,0xBF,0xFE,0x00,0x00,0x00,0x00, /* 00000268 "........" */ - 0x00,0x00,0x00,0x00,0x79,0x00,0x8A,0x4D, /* 00000270 "....y..M" */ - 0x45,0x4D,0x50,0x0A,0x5C,0x50,0x4D,0x49, /* 00000278 "EMP.\PMI" */ - 0x4E,0x8A,0x4D,0x45,0x4D,0x50,0x0A,0x60, /* 00000280 "N.MEMP.`" */ - 0x50,0x4D,0x41,0x58,0x8A,0x4D,0x45,0x4D, /* 00000288 "PMAX.MEM" */ - 0x50,0x0A,0x68,0x50,0x4C,0x45,0x4E,0x72, /* 00000290 "P.hPLENr" */ - 0x43,0x4D,0x52,0x44,0x0A,0x34,0x79,0x43, /* 00000298 "CMRD.4yC" */ - 0x4D,0x52,0x44,0x0A,0x35,0x0A,0x08,0x00, /* 000002A0 "MRD.5..." */ - 0x60,0x79,0x60,0x0A,0x10,0x60,0x72,0x60, /* 000002A8 "`y`..`r`" */ - 0x0C,0x00,0x00,0x00,0x01,0x60,0x70,0x60, /* 000002B0 ".....`p`" */ - 0x50,0x4D,0x49,0x4E,0x74,0x50,0x4D,0x41, /* 000002B8 "PMINtPMA" */ - 0x58,0x50,0x4D,0x49,0x4E,0x50,0x4C,0x45, /* 000002C0 "XPMINPLE" */ - 0x4E,0x75,0x50,0x4C,0x45,0x4E,0xA4,0x4D, /* 000002C8 "NuPLEN.M" */ - 0x45,0x4D,0x50,0x10,0x42,0x26,0x2E,0x5F, /* 000002D0 "EMP.B&._" */ - 0x53,0x42,0x5F,0x50,0x43,0x49,0x30,0x5B, /* 000002D8 "SB_PCI0[" */ - 0x82,0x43,0x20,0x49,0x53,0x41,0x5F,0x08, /* 000002E0 ".C ISA_." */ - 0x5F,0x41,0x44,0x52,0x0C,0x00,0x00,0x01, /* 000002E8 "_ADR...." */ - 0x00,0x5B,0x80,0x50,0x34,0x30,0x43,0x02, /* 000002F0 ".[.P40C." */ - 0x0A,0x60,0x0A,0x04,0x5B,0x82,0x44,0x04, /* 000002F8 ".`..[.D." */ - 0x4B,0x42,0x44,0x5F,0x08,0x5F,0x48,0x49, /* 00000300 "KBD_._HI" */ - 0x44,0x0C,0x41,0xD0,0x03,0x03,0x14,0x09, /* 00000308 "D.A....." */ - 0x5F,0x53,0x54,0x41,0x00,0xA4,0x0A,0x0F, /* 00000310 "_STA...." */ - 0x14,0x29,0x5F,0x43,0x52,0x53,0x00,0x08, /* 00000318 ".)_CRS.." */ - 0x54,0x4D,0x50,0x5F,0x11,0x18,0x0A,0x15, /* 00000320 "TMP_...." */ - 0x47,0x01,0x60,0x00,0x60,0x00,0x01,0x01, /* 00000328 "G.`.`..." */ - 0x47,0x01,0x64,0x00,0x64,0x00,0x01,0x01, /* 00000330 "G.d.d..." */ - 0x22,0x02,0x00,0x79,0x00,0xA4,0x54,0x4D, /* 00000338 ""..y..TM" */ - 0x50,0x5F,0x5B,0x82,0x33,0x4D,0x4F,0x55, /* 00000340 "P_[.3MOU" */ - 0x5F,0x08,0x5F,0x48,0x49,0x44,0x0C,0x41, /* 00000348 "_._HID.A" */ - 0xD0,0x0F,0x13,0x14,0x09,0x5F,0x53,0x54, /* 00000350 "....._ST" */ - 0x41,0x00,0xA4,0x0A,0x0F,0x14,0x19,0x5F, /* 00000358 "A......_" */ - 0x43,0x52,0x53,0x00,0x08,0x54,0x4D,0x50, /* 00000360 "CRS..TMP" */ - 0x5F,0x11,0x08,0x0A,0x05,0x22,0x00,0x10, /* 00000368 "_....".." */ - 0x79,0x00,0xA4,0x54,0x4D,0x50,0x5F,0x5B, /* 00000370 "y..TMP_[" */ - 0x82,0x47,0x04,0x46,0x44,0x43,0x30,0x08, /* 00000378 ".G.FDC0." */ - 0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x07, /* 00000380 "_HID.A.." */ - 0x00,0x14,0x09,0x5F,0x53,0x54,0x41,0x00, /* 00000388 "..._STA." */ - 0xA4,0x0A,0x0F,0x14,0x2C,0x5F,0x43,0x52, /* 00000390 "....,_CR" */ - 0x53,0x00,0x08,0x42,0x55,0x46,0x30,0x11, /* 00000398 "S..BUF0." */ - 0x1B,0x0A,0x18,0x47,0x01,0xF2,0x03,0xF2, /* 000003A0 "...G...." */ - 0x03,0x00,0x04,0x47,0x01,0xF7,0x03,0xF7, /* 000003A8 "...G...." */ - 0x03,0x00,0x01,0x22,0x40,0x00,0x2A,0x04, /* 000003B0 "..."@.*." */ - 0x00,0x79,0x00,0xA4,0x42,0x55,0x46,0x30, /* 000003B8 ".y..BUF0" */ - 0x5B,0x82,0x4B,0x05,0x4C,0x50,0x54,0x5F, /* 000003C0 "[.K.LPT_" */ - 0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0, /* 000003C8 "._HID.A." */ - 0x04,0x00,0x14,0x28,0x5F,0x53,0x54,0x41, /* 000003D0 "...(_STA" */ - 0x00,0x70,0x5E,0x5E,0x5E,0x2E,0x50,0x58, /* 000003D8 ".p^^^.PX" */ - 0x31,0x33,0x44,0x52,0x53,0x41,0x60,0x7B, /* 000003E0 "13DRSA`{" */ - 0x60,0x0C,0x00,0x00,0x00,0x80,0x60,0xA0, /* 000003E8 "`.....`." */ - 0x06,0x93,0x60,0x00,0xA4,0x00,0xA1,0x04, /* 000003F0 "..`....." */ - 0xA4,0x0A,0x0F,0x14,0x21,0x5F,0x43,0x52, /* 000003F8 "....!_CR" */ - 0x53,0x00,0x08,0x42,0x55,0x46,0x30,0x11, /* 00000400 "S..BUF0." */ - 0x10,0x0A,0x0D,0x47,0x01,0x78,0x03,0x78, /* 00000408 "...G.x.x" */ - 0x03,0x08,0x08,0x22,0x80,0x00,0x79,0x00, /* 00000410 "..."..y." */ - 0xA4,0x42,0x55,0x46,0x30,0x5B,0x82,0x41, /* 00000418 ".BUF0[.A" */ - 0x06,0x43,0x4F,0x4D,0x31,0x08,0x5F,0x48, /* 00000420 ".COM1._H" */ - 0x49,0x44,0x0C,0x41,0xD0,0x05,0x01,0x08, /* 00000428 "ID.A...." */ - 0x5F,0x55,0x49,0x44,0x01,0x14,0x28,0x5F, /* 00000430 "_UID..(_" */ - 0x53,0x54,0x41,0x00,0x70,0x5E,0x5E,0x5E, /* 00000438 "STA.p^^^" */ - 0x2E,0x50,0x58,0x31,0x33,0x44,0x52,0x53, /* 00000440 ".PX13DRS" */ - 0x43,0x60,0x7B,0x60,0x0C,0x00,0x00,0x00, /* 00000448 "C`{`...." */ - 0x08,0x60,0xA0,0x06,0x93,0x60,0x00,0xA4, /* 00000450 ".`...`.." */ - 0x00,0xA1,0x04,0xA4,0x0A,0x0F,0x14,0x21, /* 00000458 ".......!" */ - 0x5F,0x43,0x52,0x53,0x00,0x08,0x42,0x55, /* 00000460 "_CRS..BU" */ - 0x46,0x30,0x11,0x10,0x0A,0x0D,0x47,0x01, /* 00000468 "F0....G." */ - 0xF8,0x03,0xF8,0x03,0x00,0x08,0x22,0x10, /* 00000470 "......"." */ - 0x00,0x79,0x00,0xA4,0x42,0x55,0x46,0x30, /* 00000478 ".y..BUF0" */ - 0x5B,0x82,0x42,0x06,0x43,0x4F,0x4D,0x32, /* 00000480 "[.B.COM2" */ - 0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0, /* 00000488 "._HID.A." */ - 0x05,0x01,0x08,0x5F,0x55,0x49,0x44,0x0A, /* 00000490 "..._UID." */ - 0x02,0x14,0x28,0x5F,0x53,0x54,0x41,0x00, /* 00000498 "..(_STA." */ - 0x70,0x5E,0x5E,0x5E,0x2E,0x50,0x58,0x31, /* 000004A0 "p^^^.PX1" */ - 0x33,0x44,0x52,0x53,0x43,0x60,0x7B,0x60, /* 000004A8 "3DRSC`{`" */ - 0x0C,0x00,0x00,0x00,0x80,0x60,0xA0,0x06, /* 000004B0 ".....`.." */ - 0x93,0x60,0x00,0xA4,0x00,0xA1,0x04,0xA4, /* 000004B8 ".`......" */ - 0x0A,0x0F,0x14,0x21,0x5F,0x43,0x52,0x53, /* 000004C0 "...!_CRS" */ - 0x00,0x08,0x42,0x55,0x46,0x30,0x11,0x10, /* 000004C8 "..BUF0.." */ - 0x0A,0x0D,0x47,0x01,0xF8,0x02,0xF8,0x02, /* 000004D0 "..G....." */ - 0x00,0x08,0x22,0x08,0x00,0x79,0x00,0xA4, /* 000004D8 ".."..y.." */ - 0x42,0x55,0x46,0x30,0x5B,0x82,0x40,0x05, /* 000004E0 "BUF0[.@." */ - 0x50,0x58,0x31,0x33,0x08,0x5F,0x41,0x44, /* 000004E8 "PX13._AD" */ - 0x52,0x0C,0x03,0x00,0x01,0x00,0x5B,0x80, /* 000004F0 "R.....[." */ - 0x50,0x31,0x33,0x43,0x02,0x0A,0x5C,0x0A, /* 000004F8 "P13C..\." */ - 0x24,0x5B,0x81,0x33,0x50,0x31,0x33,0x43, /* 00000500 "$[.3P13C" */ - 0x03,0x44,0x52,0x53,0x41,0x20,0x44,0x52, /* 00000508 ".DRSA DR" */ - 0x53,0x42,0x20,0x44,0x52,0x53,0x43,0x20, /* 00000510 "SB DRSC " */ - 0x44,0x52,0x53,0x45,0x20,0x44,0x52,0x53, /* 00000518 "DRSE DRS" */ - 0x46,0x20,0x44,0x52,0x53,0x47,0x20,0x44, /* 00000520 "F DRSG D" */ - 0x52,0x53,0x48,0x20,0x44,0x52,0x53,0x49, /* 00000528 "RSH DRSI" */ - 0x20,0x44,0x52,0x53,0x4A,0x20,0x10,0x4F, /* 00000530 " DRSJ .O" */ - 0x2E,0x5F,0x53,0x42,0x5F,0x5B,0x81,0x24, /* 00000538 "._SB_[.$" */ - 0x2F,0x03,0x50,0x43,0x49,0x30,0x49,0x53, /* 00000540 "/.PCI0IS" */ - 0x41,0x5F,0x50,0x34,0x30,0x43,0x01,0x50, /* 00000548 "A_P40C.P" */ - 0x52,0x51,0x30,0x08,0x50,0x52,0x51,0x31, /* 00000550 "RQ0.PRQ1" */ - 0x08,0x50,0x52,0x51,0x32,0x08,0x50,0x52, /* 00000558 ".PRQ2.PR" */ - 0x51,0x33,0x08,0x5B,0x82,0x4E,0x0A,0x4C, /* 00000560 "Q3.[.N.L" */ - 0x4E,0x4B,0x41,0x08,0x5F,0x48,0x49,0x44, /* 00000568 "NKA._HID" */ - 0x0C,0x41,0xD0,0x0C,0x0F,0x08,0x5F,0x55, /* 00000570 ".A...._U" */ - 0x49,0x44,0x01,0x08,0x5F,0x50,0x52,0x53, /* 00000578 "ID.._PRS" */ - 0x11,0x09,0x0A,0x06,0x23,0xF8,0x1E,0x18, /* 00000580 "....#..." */ - 0x79,0x00,0x14,0x1A,0x5F,0x53,0x54,0x41, /* 00000588 "y..._STA" */ - 0x00,0x70,0x0A,0x0B,0x60,0xA0,0x0D,0x7B, /* 00000590 ".p..`..{" */ - 0x0A,0x80,0x50,0x52,0x51,0x30,0x61,0x70, /* 00000598 "..PRQ0ap" */ - 0x0A,0x09,0x60,0xA4,0x60,0x14,0x11,0x5F, /* 000005A0 "..`.`.._" */ - 0x44,0x49,0x53,0x00,0x7D,0x50,0x52,0x51, /* 000005A8 "DIS.}PRQ" */ - 0x30,0x0A,0x80,0x50,0x52,0x51,0x30,0x14, /* 000005B0 "0..PRQ0." */ - 0x3F,0x5F,0x43,0x52,0x53,0x00,0x08,0x50, /* 000005B8 "?_CRS..P" */ - 0x52,0x52,0x30,0x11,0x09,0x0A,0x06,0x23, /* 000005C0 "RR0....#" */ - 0x02,0x00,0x18,0x79,0x00,0x8B,0x50,0x52, /* 000005C8 "...y..PR" */ - 0x52,0x30,0x01,0x54,0x4D,0x50,0x5F,0x70, /* 000005D0 "R0.TMP_p" */ - 0x50,0x52,0x51,0x30,0x60,0xA0,0x0C,0x95, /* 000005D8 "PRQ0`..." */ - 0x60,0x0A,0x80,0x79,0x01,0x60,0x54,0x4D, /* 000005E0 "`..y.`TM" */ - 0x50,0x5F,0xA1,0x07,0x70,0x00,0x54,0x4D, /* 000005E8 "P_..p.TM" */ - 0x50,0x5F,0xA4,0x50,0x52,0x52,0x30,0x14, /* 000005F0 "P_.PRR0." */ - 0x1B,0x5F,0x53,0x52,0x53,0x01,0x8B,0x68, /* 000005F8 "._SRS..h" */ - 0x01,0x54,0x4D,0x50,0x5F,0x82,0x54,0x4D, /* 00000600 ".TMP_.TM" */ - 0x50,0x5F,0x60,0x76,0x60,0x70,0x60,0x50, /* 00000608 "P_`v`p`P" */ - 0x52,0x51,0x30,0x5B,0x82,0x4F,0x0A,0x4C, /* 00000610 "RQ0[.O.L" */ - 0x4E,0x4B,0x42,0x08,0x5F,0x48,0x49,0x44, /* 00000618 "NKB._HID" */ - 0x0C,0x41,0xD0,0x0C,0x0F,0x08,0x5F,0x55, /* 00000620 ".A...._U" */ - 0x49,0x44,0x0A,0x02,0x08,0x5F,0x50,0x52, /* 00000628 "ID..._PR" */ - 0x53,0x11,0x09,0x0A,0x06,0x23,0xF8,0x1E, /* 00000630 "S....#.." */ - 0x18,0x79,0x00,0x14,0x1A,0x5F,0x53,0x54, /* 00000638 ".y..._ST" */ - 0x41,0x00,0x70,0x0A,0x0B,0x60,0xA0,0x0D, /* 00000640 "A.p..`.." */ - 0x7B,0x0A,0x80,0x50,0x52,0x51,0x31,0x61, /* 00000648 "{..PRQ1a" */ - 0x70,0x0A,0x09,0x60,0xA4,0x60,0x14,0x11, /* 00000650 "p..`.`.." */ - 0x5F,0x44,0x49,0x53,0x00,0x7D,0x50,0x52, /* 00000658 "_DIS.}PR" */ - 0x51,0x31,0x0A,0x80,0x50,0x52,0x51,0x31, /* 00000660 "Q1..PRQ1" */ - 0x14,0x3F,0x5F,0x43,0x52,0x53,0x00,0x08, /* 00000668 ".?_CRS.." */ - 0x50,0x52,0x52,0x30,0x11,0x09,0x0A,0x06, /* 00000670 "PRR0...." */ - 0x23,0x02,0x00,0x18,0x79,0x00,0x8B,0x50, /* 00000678 "#...y..P" */ - 0x52,0x52,0x30,0x01,0x54,0x4D,0x50,0x5F, /* 00000680 "RR0.TMP_" */ - 0x70,0x50,0x52,0x51,0x31,0x60,0xA0,0x0C, /* 00000688 "pPRQ1`.." */ - 0x95,0x60,0x0A,0x80,0x79,0x01,0x60,0x54, /* 00000690 ".`..y.`T" */ - 0x4D,0x50,0x5F,0xA1,0x07,0x70,0x00,0x54, /* 00000698 "MP_..p.T" */ - 0x4D,0x50,0x5F,0xA4,0x50,0x52,0x52,0x30, /* 000006A0 "MP_.PRR0" */ - 0x14,0x1B,0x5F,0x53,0x52,0x53,0x01,0x8B, /* 000006A8 ".._SRS.." */ - 0x68,0x01,0x54,0x4D,0x50,0x5F,0x82,0x54, /* 000006B0 "h.TMP_.T" */ - 0x4D,0x50,0x5F,0x60,0x76,0x60,0x70,0x60, /* 000006B8 "MP_`v`p`" */ - 0x50,0x52,0x51,0x31,0x5B,0x82,0x4F,0x0A, /* 000006C0 "PRQ1[.O." */ - 0x4C,0x4E,0x4B,0x43,0x08,0x5F,0x48,0x49, /* 000006C8 "LNKC._HI" */ - 0x44,0x0C,0x41,0xD0,0x0C,0x0F,0x08,0x5F, /* 000006D0 "D.A...._" */ - 0x55,0x49,0x44,0x0A,0x03,0x08,0x5F,0x50, /* 000006D8 "UID..._P" */ - 0x52,0x53,0x11,0x09,0x0A,0x06,0x23,0xF8, /* 000006E0 "RS....#." */ - 0x1E,0x18,0x79,0x00,0x14,0x1A,0x5F,0x53, /* 000006E8 "..y..._S" */ - 0x54,0x41,0x00,0x70,0x0A,0x0B,0x60,0xA0, /* 000006F0 "TA.p..`." */ - 0x0D,0x7B,0x0A,0x80,0x50,0x52,0x51,0x32, /* 000006F8 ".{..PRQ2" */ - 0x61,0x70,0x0A,0x09,0x60,0xA4,0x60,0x14, /* 00000700 "ap..`.`." */ - 0x11,0x5F,0x44,0x49,0x53,0x00,0x7D,0x50, /* 00000708 "._DIS.}P" */ - 0x52,0x51,0x32,0x0A,0x80,0x50,0x52,0x51, /* 00000710 "RQ2..PRQ" */ - 0x32,0x14,0x3F,0x5F,0x43,0x52,0x53,0x00, /* 00000718 "2.?_CRS." */ - 0x08,0x50,0x52,0x52,0x30,0x11,0x09,0x0A, /* 00000720 ".PRR0..." */ - 0x06,0x23,0x02,0x00,0x18,0x79,0x00,0x8B, /* 00000728 ".#...y.." */ - 0x50,0x52,0x52,0x30,0x01,0x54,0x4D,0x50, /* 00000730 "PRR0.TMP" */ - 0x5F,0x70,0x50,0x52,0x51,0x32,0x60,0xA0, /* 00000738 "_pPRQ2`." */ - 0x0C,0x95,0x60,0x0A,0x80,0x79,0x01,0x60, /* 00000740 "..`..y.`" */ - 0x54,0x4D,0x50,0x5F,0xA1,0x07,0x70,0x00, /* 00000748 "TMP_..p." */ - 0x54,0x4D,0x50,0x5F,0xA4,0x50,0x52,0x52, /* 00000750 "TMP_.PRR" */ - 0x30,0x14,0x1B,0x5F,0x53,0x52,0x53,0x01, /* 00000758 "0.._SRS." */ - 0x8B,0x68,0x01,0x54,0x4D,0x50,0x5F,0x82, /* 00000760 ".h.TMP_." */ - 0x54,0x4D,0x50,0x5F,0x60,0x76,0x60,0x70, /* 00000768 "TMP_`v`p" */ - 0x60,0x50,0x52,0x51,0x32,0x5B,0x82,0x4F, /* 00000770 "`PRQ2[.O" */ - 0x0A,0x4C,0x4E,0x4B,0x44,0x08,0x5F,0x48, /* 00000778 ".LNKD._H" */ - 0x49,0x44,0x0C,0x41,0xD0,0x0C,0x0F,0x08, /* 00000780 "ID.A...." */ - 0x5F,0x55,0x49,0x44,0x0A,0x04,0x08,0x5F, /* 00000788 "_UID..._" */ - 0x50,0x52,0x53,0x11,0x09,0x0A,0x06,0x23, /* 00000790 "PRS....#" */ - 0xF8,0x1E,0x18,0x79,0x00,0x14,0x1A,0x5F, /* 00000798 "...y..._" */ - 0x53,0x54,0x41,0x00,0x70,0x0A,0x0B,0x60, /* 000007A0 "STA.p..`" */ - 0xA0,0x0D,0x7B,0x0A,0x80,0x50,0x52,0x51, /* 000007A8 "..{..PRQ" */ - 0x33,0x61,0x70,0x0A,0x09,0x60,0xA4,0x60, /* 000007B0 "3ap..`.`" */ - 0x14,0x11,0x5F,0x44,0x49,0x53,0x00,0x7D, /* 000007B8 ".._DIS.}" */ - 0x50,0x52,0x51,0x33,0x0A,0x80,0x50,0x52, /* 000007C0 "PRQ3..PR" */ - 0x51,0x33,0x14,0x3F,0x5F,0x43,0x52,0x53, /* 000007C8 "Q3.?_CRS" */ - 0x00,0x08,0x50,0x52,0x52,0x30,0x11,0x09, /* 000007D0 "..PRR0.." */ - 0x0A,0x06,0x23,0x02,0x00,0x18,0x79,0x00, /* 000007D8 "..#...y." */ - 0x8B,0x50,0x52,0x52,0x30,0x01,0x54,0x4D, /* 000007E0 ".PRR0.TM" */ - 0x50,0x5F,0x70,0x50,0x52,0x51,0x33,0x60, /* 000007E8 "P_pPRQ3`" */ - 0xA0,0x0C,0x95,0x60,0x0A,0x80,0x79,0x01, /* 000007F0 "...`..y." */ - 0x60,0x54,0x4D,0x50,0x5F,0xA1,0x07,0x70, /* 000007F8 "`TMP_..p" */ - 0x00,0x54,0x4D,0x50,0x5F,0xA4,0x50,0x52, /* 00000800 ".TMP_.PR" */ - 0x52,0x30,0x14,0x1B,0x5F,0x53,0x52,0x53, /* 00000808 "R0.._SRS" */ - 0x01,0x8B,0x68,0x01,0x54,0x4D,0x50,0x5F, /* 00000810 "..h.TMP_" */ - 0x82,0x54,0x4D,0x50,0x5F,0x60,0x76,0x60, /* 00000818 ".TMP_`v`" */ - 0x70,0x60,0x50,0x52,0x51,0x33,0x08,0x5F, /* 00000820 "p`PRQ3._" */ - 0x53,0x35,0x5F,0x12,0x06,0x04,0x00,0x00, /* 00000828 "S5_....." */ - 0x00,0x00 /* 00000830 ".." */ -}; diff -Nru acpica-unix-20100528/debian/acpibin.1 acpica-unix-20140114/debian/acpibin.1 --- acpica-unix-20100528/debian/acpibin.1 1970-01-01 00:00:00.000000000 +0000 +++ acpica-unix-20140114/debian/acpibin.1 2014-01-28 13:06:26.000000000 +0000 @@ -0,0 +1,64 @@ +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH ACPIBIN 1 "January 23, 2013" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +acpibin \- ACPI binary AML file utility +.SH SYNOPSIS +.B acpibin +.RI [