14265 Commits

Author SHA1 Message Date
Erik Schmauss
340f83ee49 ASLTS: onamedloc: fixing expected values to reflect CreateField() change
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2019-12-11 15:51:01 -08:00
Erik Schmauss
94e1af1876 ASLTS: namespace: fixing values to reflect CreateField() changes
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2019-12-11 15:51:01 -08:00
Erik Schmauss
a46bb4cbd6 ASLTS: misc: fixing code to reflect CreateField() change
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2019-12-11 15:51:01 -08:00
Erik Schmauss
8ab1142a68 ASLTS: region: fixing expected values to reflect CreateField() change
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2019-12-11 15:51:01 -08:00
Erik Schmauss
c6b7deb500 ASLTS: bfield: fixing results to align with CreateField() changes
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2019-12-11 15:51:01 -08:00
Erik Schmauss
8e3da86214 ASLTS: Reference: clean up and fix expected values for CreateField() behavior change
Clean up involves adding line numbers to error check control methods

Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2019-12-11 15:51:01 -08:00
Robert Moore
972806f700 aslerror.c - fix some typos/misspellings
Also, some cleanup.
2019-12-11 13:55:14 -08:00
Robert Moore
debc8322c5
Merge pull request #526 from SchmErik/create-field
Dispatcher: always generate buffer objects for ASL CreateField() oper…
2019-12-11 12:52:13 -08:00
Robert Moore
246c54262a
Merge pull request #529 from SchmErik/iasl-error-log-fix
iASL: switch to the correct file during error node creation
2019-12-11 12:42:29 -08:00
Erik Schmauss
ba444fff87 iASL: switch to the correct file during error node creation
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2019-12-11 10:43:22 -08:00
Robert Moore
75a3eadcfd
Merge pull request #528 from SchmErik/aslts-control-flags
ASLTS: control: add expected compiler error for duplicate case statem…
2019-12-11 10:06:47 -08:00
Erik Schmauss
cef0fbbd8e ASLTS: control: add expected compiler error for duplicate case statements
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2019-12-11 09:44:17 -08:00
Robert Moore
40a102c145
Merge pull request #527 from SchmErik/trivial
iASL: emit error on duplicate named objects rather than a warning
2019-12-10 13:25:56 -08:00
Robert Moore
c1fcd032ed iASL: Add detection of duplicate Case values for Switch
Handles detection of duplicate integers, strings, and buffers.
Package objects are not supported.
2019-12-10 13:23:19 -08:00
Erik Schmauss
7206d42f91 iASL: emit error on duplicate named objects rather than a warning
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2019-12-09 12:37:49 -08:00
Maximilian Luz
79a466b64e Dispatcher: always generate buffer objects for ASL CreateField() operator
According to table 19-419 of the ACPI 6.3 specification, BufferFields
created using the ASL CreateField() Operator have been treated as
integers if the BufferField is small enough to fit inside of an ASL
integer (32-bits or 64-bits depending on the definition block
revision). If they are larger, buffer fields are treated as ASL
Buffer objects. However, this is not true for other AML interpreter
implementations.

It has been discovered that other AML interpreters always treat
buffer fields created by CreateField() as a buffer regardless of the
length of the buffer field.

More specifically, the Microsoft AML interpreter always treats buffer
fields created by the CreateField() operator as buffer. ACPICA
currently does this only when the field size is larger than the
maximum integer width. This causes problems with AML code shipped in
Microsoft Surface devices.

More details:

The control methods in these devices determine the success of an ASL
control method execution by examining the type resulting from storing
a buffer field created by a CreateField() operator. On success, a
Buffer object is expected, on failure an Integer containing an error
code. This buffer object is created with a dynamic size via the
CreateField() operator. Due to the difference in behavior, Buffer
values of small size are however converted to Integers and thus
interpreted by the control method as having failed, whereas in
reality it succeeded. Below is an example of a control method called
TEST that illustrates this behavior.

Method (CBUF) // Create a Buffer field
{
    /*
     * Depending on the value of RAND, ACPICA interpreter will treat
     * BF00 as an integer or buffer.
     */
    CreateField (BUFF, 0, RAND, BF00)
    return (BF00)
}

Method (TEST)
{
    /*
     * Storing the value returned by CBUF to local0 will result in
     * implicit type conversion outlined in the ACPI specification.
     *
     * ACPICA will treat local0 like an ASL integer if RAND is less
     * than or equal to 64 or 32 (depending on the DefinitionBlock
     * revision). If RAND is greater, it will be treated like an ASL
     * buffer. Other implementations treat local0 like an ASL buffer
     * regardless of the value of RAND.
     */
    local0 = CBUF()

    /*
     * ObjectType of 0x03 represents an ASL Buffer
     */
    if (ObjectType (Local0) != 0x03)
    {
        // Error on ACPICA if RAND is small enough
    }
    else
    {
        /*
         * Success on APICA if RAND is large enough
         * Other implementations always take this path because local0
         * is always treated as a buffer.
         */
    }
}

This change prohibits the previously mentioned integer conversion to
match other AML interpreter implementations (Microsoft) that do not
conform to the ACPI specification.

Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2019-12-06 13:55:39 -08:00
Robert Moore
c9277a123b Merge branch 'master' of ssh://ssh.github.com/acpica/acpica
Merge latest pull request.
2019-11-21 07:38:38 -08:00
Robert Moore
2ffc68d55c
Merge pull request #520 from SchmErik/acpisrc-unix-line-end
acpisrc: add unix line ending support for non-windows build
2019-11-21 07:38:26 -08:00
Robert Moore
30f0d65c3d Merge branch 'master' of ssh://ssh.github.com/acpica/acpica
Merge latest pull requests.
2019-11-21 07:16:12 -08:00
Robert Moore
b2c34d320c
Merge pull request #524 from SchmErik/trivial
iASL: remove unneeded NULL checks
2019-11-21 07:15:56 -08:00
Robert Moore
63d51bf098
Merge pull request #525 from SchmErik/iasl-external-method
iASL: save parameter count of external control method calls for analysis
2019-11-21 07:14:25 -08:00
Erik Schmauss
350622eec1 iASL: save parameter count of external control method calls for analysis
As of now, iASL does not keep track of parameter counts for external
declarations of methods. In order to determine the parameter count of
external control methods, iASL looks at the first method and saves
the parameter count in AML. However, this information is not present
during namespace cross reference.

This allows code like this to compile without errors:

DefinitionBlock ("", "DSDT", 2, "", "", 0x01)
{
    External (DS01, MethodObj)
    DS01(0x2,0x2) // DS01 is called with 2 parameters
    DS01()        // DS01 is called with 0 parameters
}

This change saves the parameter count of the first method call and
uses it to analyze subsequent method calls. This ensure that a method
that is declared external is called with the same amount of
parameters each time.

Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2019-11-19 13:38:05 -08:00
Erik Schmauss
9990f6a0af iASL: remove unneeded NULL checks
They are unneeded because these functions do not return NULL. In the
case that these functions fail, they end up aborting the entire
program rather than returning NULL.

Reported-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2019-11-18 09:41:29 -08:00
Erik Schmauss
48ef9f7456 acpisrc: add unix line ending support for non-windows build
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2019-11-14 15:05:39 -08:00
Robert Moore
fb492456ac badcode.asl: Update the compile-time statistics
Output from iASL.
2019-11-14 13:46:25 -08:00
Robert Moore
4b39f688d9
Merge pull request #523 from SchmErik/disasm-set-integer-width
Disassembler: set integer width for AML indicated by the table revision
2019-11-14 13:41:06 -08:00
Robert Moore
42519dbbcb
Merge pull request #522 from SchmErik/disasm-create-buffer-field
Disassembler: create buffer fields in ACPI_PARSE_LOAD_PASS1
2019-11-14 13:40:58 -08:00
Robert Moore
aabca3750c
Merge pull request #521 from SchmErik/iasl-move-traverse
iASL: move opcode walk and transformation
2019-11-14 13:40:37 -08:00
Robert Moore
a114b18fb3
Merge pull request #518 from SchmErik/get-current-file
iASL: abort with an error when current file is not found
2019-11-14 13:39:51 -08:00
Robert Moore
d5b78aac2d
Merge pull request #516 from SchmErik/acpisrc-add
Acpisrc: add ACPI_REGION_WALK_INFO for linuxization
2019-11-14 13:39:13 -08:00
Robert Moore
b18926aba0 iASL: Add error message for >255 NameSegs within a NameString
This is illegal because the number of namesegs is specified via
a BYTE in the AML for a NameString.

ACPICA BZ #1505 & #1506.
2019-11-14 13:35:31 -08:00
Erik Schmauss
793c1f3b00 Disassembler: set integer width for AML indicated by the table revision
By setting the integer width, the disassembler no longer trucates 64-
bit integers in AML tables with revision 2 or higher.

Reported-by: Elia Geretto <elia.f.geretto@gmail.com>
Tested-by: Elia Geretto <elia.f.geretto@gmail.com>
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2019-11-14 10:34:19 -08:00
Erik Schmauss
29cc8dbc54 Disassembler: create buffer fields in ACPI_PARSE_LOAD_PASS1
CreateBufferField is a deferred op that is typically processed in
load pass 2. However, disassembly of control method contents walk the
parse tree with ACPI_PARSE_LOAD_PASS1 and AML_CREATE operators are
processed in a later walk. This is a problem when there is a control
method that has the same name as the AML_CREATE object. In this case,
any use of the name segment will be detected as a method call rather
than a reference to a buffer field. If this is detected as a method
call, it can result in a mal-formed parse tree if the control methods
have parameters.

This change in processing AML_CREATE ops earlier solves this issue by
inserting the named object in the ACPI namespace so that references
to this name would be detected as a name string rather than a method
call.

Reported-by: Elia Geretto <elia.f.geretto@gmail.com>
Tested-by: Elia Geretto <elia.f.geretto@gmail.com>
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2019-11-14 10:12:43 -08:00
Erik Schmauss
82ebcac35e iASL: move opcode walk and transformation
This change fixes the opcode walk and the transformation walk to only
traverse the parse tree after the entire parse tree has been formed.
parse tree. Walking the entire tree any earlier would require repeated
calls to walk the parse tree and results in longer execution time.

Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2019-11-12 12:59:08 -08:00
Robert Moore
3f433b35f0 Fix a typo in hwxfsleep
Legacy_function -> LegacyFunction
Reported by Sascha Wildner (swildner@gmail.com).
AcpiCA bugzilla # 1502
2019-11-08 12:43:27 -08:00
Robert Moore
3dcd13aa62 iASL: Use ACPI_COMPARE_NAMESEG instead of strcmp
For _HID, _CID processing. Reported by Benjamin Berg
(benjamin@sipsolutions.net).
2019-11-08 07:33:54 -08:00
Robert Moore
33b527108f iASL: Use NUM_PREDEFINED_REGIONS instead of hardwired integer
Was 0xA0 previously.
2019-11-07 13:52:42 -08:00
Robert Moore
7819219b06 ASLTS: Remove trailing spaces
In the .asl files
From: ehaouas@noos.fr
2019-11-07 13:05:52 -08:00
Robert Moore
38eed936f9 .gitignore - ignore tests/misc directory
Ignore any .aml and/or .dsl files
2019-11-07 12:58:28 -08:00
Robert Moore
a57482fea5 MSVC project files - remove trailing spaces
Remove trailing spaces from each of the .dsp files
From: ehaouas@noos.fr
2019-11-07 12:55:19 -08:00
Robert Moore
1e34e64706
Merge pull request #519 from ColinIanKing/master
debugger: fix spelling mistake "adress" -> "address"
2019-11-06 07:08:20 -08:00
Colin Ian King
7aa72c5fdf debugger: fix spelling mistake "adress" -> "address"
There is a spelling mistake in an error message. Fix it.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
2019-11-05 14:43:41 +00:00
Erik Schmauss
a2637bab58 iASL: abort with an error when current file is not found
In iASL, not being able to find the internal representation of an
input file is an unrecoverable condition. Instead of returning NULL
for this case, it's better to simply abort iASL instead of continuing
the compilation.

Reported-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2019-10-31 14:47:27 -07:00
Robert Moore
f76bd7e33c
Merge pull request #517 from ahs3/badexit
compiler/asloptions.c : correct exit code for iasl -T ALL
2019-10-30 08:06:46 -07:00
Al Stone
13d0b49cee compiler/asloptions.c : correct exit code for iasl -T ALL
When all templates are being generated, iasl will exit with a non-zero
status even when everything works just fine.  Correct the exit() call
to exit(0) for this case, instead of exit(1).

Signed-off-by: Al Stone <ahs3@ahs3.net>
2019-10-29 17:27:07 -06:00
Erik Schmauss
896ed6eaf6 Acpisrc: add ACPI_REGION_WALK_INFO for linuxization
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2019-10-25 14:50:09 -07:00
Robert Moore
3e0d03893c Revert a clang change for strcpy->UtSafeStrcpy.
UtSafeStrcpy pulls in a module that is not part of the kernel.
2019-10-23 14:04:14 -07:00
Robert Moore
27d8166f97
Merge pull request #514 from ColinIanKing/master
iASL: fix memory leak of LocalityBuffer on error return path
2019-10-23 13:49:34 -07:00
Colin Ian King
e1413b42cb iASL: fix memory leak of LocalityBuffer on error return path
The error return path is not free'ing previously allocated
resource LocalityBuffer and hence there is a memory leak. Fix this
by free'ing it before returning.

Fixes: c22c0b1df98c ("Data table compiler: Add error messages for SLIT locality buffers")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
2019-10-19 16:30:28 +01:00
Robert Moore
3d70fd4894 Update version to 20191018
Version 20191018.
R10_18_19
2019-10-18 09:04:42 -07:00