kernel_optimize_test/drivers/acpi/acpica
Maximilian Luz 6d232b29cf ACPICA: Dispatcher: always generate buffer objects for ASL create_field() operator
ACPICA commit 79a466b64e6af36cc83102f05915e56cb7dd89ab

According to table 19-419 of the ACPI 6.3 specification, buffer_fields
created using the ASL create_field() Operator have been treated as
integers if the buffer_field 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 create_field() as a buffer regardless of the
length of the buffer field.

More specifically, the Microsoft AML interpreter always treats buffer
fields created by the create_field() 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 create_field() 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
create_field() 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.
     */
    create_field (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 definition_block
     * 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()

    /*
     * object_type of 0x03 represents an ASL Buffer
     */
    if (object_type (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.

Link: https://github.com/acpica/acpica/commit/79a466b6
Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-12-19 23:04:21 +01:00
..
acapps.h ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
accommon.h ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
acconvert.h ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
acdebug.h ACPICA: debugger: add command to dump all fields of particular subtype 2019-10-28 22:12:46 +01:00
acdispat.h ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
acevents.h ACPICA: Clear status of GPEs on first direct enable 2019-06-19 11:46:21 +02:00
acglobal.h ACPICA: remove legacy module-level code due to deprecation 2019-07-04 00:59:43 +02:00
achware.h ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
acinterp.h ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
aclocal.h ACPICA: Increase total number of possible Owner IDs 2019-08-21 00:00:36 +02:00
acmacros.h ACPI/ACPICA: Trivial: fix spelling mistakes and fix whitespace formatting 2019-02-24 21:12:01 +01:00
acnamesp.h ACPICA: remove legacy module-level code due to deprecation 2019-07-04 00:59:43 +02:00
acobject.h ACPICA: Dispatcher: always generate buffer objects for ASL create_field() operator 2019-12-19 23:04:21 +01:00
acopcode.h ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
acparser.h ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
acpredef.h ACPICA: ACPI 6.3: Adding predefined methods _NBS, _NCH, _NIC, _NIH, and _NIG 2019-02-18 11:21:11 +01:00
acresrc.h ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
acstruct.h ACPICA: debugger: add command to dump all fields of particular subtype 2019-10-28 22:12:46 +01:00
actables.h ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
acutils.h ACPICA: utilities: add flag to only display data when dumping buffers 2019-10-28 22:12:46 +01:00
amlcode.h ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
amlresrc.h ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
dbcmds.c
dbconvert.c ACPICA: debugger: remove leading whitespaces when converting a string to a buffer 2019-10-28 22:12:46 +01:00
dbdisply.c ACPICA: Results from Clang 2019-10-28 22:12:46 +01:00
dbexec.c ACPICA: Rename nameseg compare macro for clarity 2019-04-09 10:08:28 +02:00
dbfileio.c ACPICA: make acpi_load_table() return table index 2019-10-28 22:12:46 +01:00
dbhistry.c ACPICA: Fix issues with arg types within printf format strings 2019-08-21 00:00:36 +02:00
dbinput.c ACPICA: debugger: fix spelling mistake "adress" -> "address" 2019-12-19 23:04:21 +01:00
dbmethod.c ACPICA: Results from Clang 2019-10-28 22:12:46 +01:00
dbnames.c ACPICA: debugger: surround field unit output with braces '{' 2019-10-28 22:12:46 +01:00
dbobject.c ACPICA: Results from Clang 2019-10-28 22:12:46 +01:00
dbstats.c ACPICA: Fully deploy ACPI_PRINTF_LIKE macro 2019-08-21 00:00:37 +02:00
dbtest.c ACPICA: Debugger: Fix possible fault with the "test objects" command 2019-02-18 11:21:10 +01:00
dbutils.c
dbxface.c ACPICA: Debugger: refactor to fix unused variable warning 2018-11-08 18:41:47 +01:00
dsargs.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
dscontrol.c ACPICA: Win OSL: Replace get_tick_count with get_tick_count64 2019-10-28 22:12:46 +01:00
dsdebug.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
dsfield.c ACPICA: Disassembler: create buffer fields in ACPI_PARSE_LOAD_PASS1 2019-12-19 23:04:21 +01:00
dsinit.c ACPICA: Update for object initialization sequence 2019-07-04 00:59:43 +02:00
dsmethod.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
dsmthdat.c
dsobject.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
dsopcode.c ACPICA: Dispatcher: always generate buffer objects for ASL create_field() operator 2019-12-19 23:04:21 +01:00
dspkginit.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
dsutils.c ACPICA: Remove defines that use deprecated flag 2018-12-13 22:40:51 +01:00
dswexec.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
dswload.c ACPICA: Disassembler: create buffer fields in ACPI_PARSE_LOAD_PASS1 2019-12-19 23:04:21 +01:00
dswload2.c ACPI/ACPICA: Trivial: fix spelling mistakes and fix whitespace formatting 2019-02-24 21:12:01 +01:00
dswscope.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
dswstate.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
evevent.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
evglock.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
evgpe.c ACPICA: Clear status of GPEs on first direct enable 2019-06-19 11:46:21 +02:00
evgpeblk.c ACPICA: Results from Clang 2019-10-28 22:12:46 +01:00
evgpeinit.c ACPICA: Results from Clang 2019-10-28 22:12:46 +01:00
evgpeutil.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
evhandler.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
evmisc.c ACPICA: Results from Clang 2019-10-28 22:12:46 +01:00
evregion.c ACPICA: Results from Clang 2019-10-28 22:12:46 +01:00
evrgnini.c ACPICA: Results from Clang 2019-10-28 22:12:46 +01:00
evsci.c
evxface.c ACPICA: Clear status of GPEs on first direct enable 2019-06-19 11:46:21 +02:00
evxfevnt.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
evxfgpe.c ACPICA: Return u32 from acpi_dispatch_gpe() 2019-07-23 09:46:13 +02:00
evxfregn.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
exconcat.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
exconfig.c ACPICA: Update table load object initialization 2019-07-11 22:38:42 +02:00
exconvrt.c ACPI/ACPICA: Trivial: fix spelling mistakes and fix whitespace formatting 2019-02-24 21:12:01 +01:00
excreate.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
exdebug.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
exdump.c ACPICA: Increase total number of possible Owner IDs 2019-08-21 00:00:36 +02:00
exfield.c ACPICA: Dispatcher: always generate buffer objects for ASL create_field() operator 2019-12-19 23:04:21 +01:00
exfldio.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
exmisc.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
exmutex.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
exnames.c ACPICA: Rename nameseg length macro/define for clarity 2019-04-09 11:24:48 +02:00
exoparg1.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
exoparg2.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
exoparg3.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
exoparg6.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
exprep.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
exregion.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
exresnte.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
exresolv.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
exresop.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
exserial.c ACPI/ACPICA: Trivial: fix spelling mistakes and fix whitespace formatting 2019-02-24 21:12:01 +01:00
exstore.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
exstoren.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
exstorob.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
exsystem.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
extrace.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
exutils.c ACPI/ACPICA: Trivial: fix spelling mistakes and fix whitespace formatting 2019-02-24 21:12:01 +01:00
hwacpi.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
hwesleep.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
hwgpe.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
hwpci.c
hwregs.c ACPICA: ACPICA: add status check for acpi_hw_read before assigning return value 2018-08-14 23:49:13 +02:00
hwsleep.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
hwtimer.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
hwvalid.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
hwxface.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
hwxfsleep.c ACPICA: More Clang changes 2019-10-28 22:12:46 +01:00
Makefile ACPICA: Remove PCI bits from ACPICA when CONFIG_PCI is unset 2018-12-20 10:19:49 +01:00
nsaccess.c ACPICA: Fully deploy ACPI_PRINTF_LIKE macro 2019-08-21 00:00:37 +02:00
nsalloc.c ACPICA: Increase total number of possible Owner IDs 2019-08-21 00:00:36 +02:00
nsarguments.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
nsconvert.c ACPICA: More Clang changes 2019-10-28 22:12:46 +01:00
nsdump.c ACPICA: More Clang changes 2019-10-28 22:12:46 +01:00
nsdumpdv.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
nseval.c ACPICA: remove legacy module-level code due to deprecation 2019-07-04 00:59:43 +02:00
nsinit.c ACPICA: Update for object initialization sequence 2019-07-04 00:59:43 +02:00
nsload.c ACPICA: remove legacy module-level code due to deprecation 2019-07-04 00:59:43 +02:00
nsnames.c ACPICA: Rename nameseg length macro/define for clarity 2019-04-09 11:24:48 +02:00
nsobject.c ACPICA: Namespace: remove address node from global list after method termination 2019-04-09 10:05:11 +02:00
nsparse.c ACPICA: Rename nameseg compare macro for clarity 2019-04-09 10:08:28 +02:00
nspredef.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
nsprepkg.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
nsrepair.c ACPICA: Rename nameseg compare macro for clarity 2019-04-09 10:08:28 +02:00
nsrepair2.c ACPICA: Fix issues with arg types within printf format strings 2019-08-21 00:00:36 +02:00
nssearch.c ACPICA: Revert "iASL: change processing of external op namespace nodes for correctness" 2018-07-09 11:14:45 +02:00
nsutils.c ACPICA: remove legacy module-level code due to deprecation 2019-07-04 00:59:43 +02:00
nswalk.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
nsxfeval.c
nsxfname.c ACPICA: More Clang changes 2019-10-28 22:12:46 +01:00
nsxfobj.c
psargs.c ACPICA: Rename nameseg length macro/define for clarity 2019-04-09 11:24:48 +02:00
psloop.c ACPICA: Remove legacy module-level code support 2019-02-18 11:21:10 +01:00
psobject.c ACPICA: More Clang changes 2019-10-28 22:12:46 +01:00
psopcode.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
psopinfo.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
psparse.c ACPICA: Update/clarify messages for control method failures 2019-02-18 11:21:10 +01:00
psscope.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
pstree.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
psutils.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
pswalk.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
psxface.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
rsaddr.c
rscalc.c
rscreate.c ACPICA: More Clang changes 2019-10-28 22:12:46 +01:00
rsdump.c
rsdumpinfo.c ACPI/ACPICA: Trivial: fix spelling mistakes and fix whitespace formatting 2019-02-24 21:12:01 +01:00
rsinfo.c
rsio.c
rsirq.c ACPI/ACPICA: Trivial: fix spelling mistakes and fix whitespace formatting 2019-02-24 21:12:01 +01:00
rslist.c
rsmemory.c
rsmisc.c
rsserial.c ACPI/ACPICA: Trivial: fix spelling mistakes and fix whitespace formatting 2019-02-24 21:12:01 +01:00
rsutils.c
rsxface.c ACPICA: Rename nameseg compare macro for clarity 2019-04-09 10:08:28 +02:00
tbdata.c ACPICA: More Clang changes 2019-10-28 22:12:46 +01:00
tbfadt.c ACPI/ACPICA: Trivial: fix spelling mistakes and fix whitespace formatting 2019-02-24 21:12:01 +01:00
tbfind.c ACPICA: Rename nameseg length macro/define for clarity 2019-04-09 11:24:48 +02:00
tbinstal.c ACPICA: Rename nameseg compare macro for clarity 2019-04-09 10:08:28 +02:00
tbprint.c ACPICA: Rename nameseg length macro/define for clarity 2019-04-09 11:24:48 +02:00
tbutils.c ACPICA: Rename nameseg compare macro for clarity 2019-04-09 10:08:28 +02:00
tbxface.c ACPICA: Rename nameseg compare macro for clarity 2019-04-09 10:08:28 +02:00
tbxfload.c ACPICA: make acpi_load_table() return table index 2019-10-28 22:12:46 +01:00
tbxfroot.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
utaddress.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
utalloc.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
utascii.c ACPICA: Rename nameseg length macro/define for clarity 2019-04-09 11:24:48 +02:00
utbuffer.c ACPICA: utilities: add flag to only display data when dumping buffers 2019-10-28 22:12:46 +01:00
utcache.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
utcopy.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
utdebug.c ACPICA: Fully deploy ACPI_PRINTF_LIKE macro 2019-08-21 00:00:37 +02:00
utdecode.c ACPICA: utilities: fix spelling of PCC to platform_comm_channel 2019-04-09 11:25:26 +02:00
utdelete.c ACPICA: ACPI 6.3: add PCC operation region support for AML interpreter 2019-02-24 21:11:20 +01:00
uterror.c ACPICA: Increase total number of possible Owner IDs 2019-08-21 00:00:36 +02:00
uteval.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
utexcep.c
utglobal.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
uthex.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
utids.c ACPICA: More Clang changes 2019-10-28 22:12:46 +01:00
utinit.c ACPICA: remove legacy module-level code due to deprecation 2019-07-04 00:59:43 +02:00
utlock.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
utmath.c
utmisc.c ACPICA: Rename nameseg compare macro for clarity 2019-04-09 10:08:28 +02:00
utmutex.c
utnonansi.c
utobject.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
utosi.c ACPICA: Add "Windows 2019" string to _OSI support. 2019-08-21 00:00:37 +02:00
utownerid.c ACPICA: Increase total number of possible Owner IDs 2019-08-21 00:00:36 +02:00
utpredef.c ACPICA: Rename nameseg compare macro for clarity 2019-04-09 10:08:28 +02:00
utprint.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
utresdecode.c
utresrc.c
utstate.c
utstring.c ACPICA: Rename nameseg length macro/define for clarity 2019-04-09 11:24:48 +02:00
utstrsuppt.c ACPICA: Utilities: split hex detection into smaller functions 2018-08-14 23:49:13 +02:00
utstrtoul64.c ACPICA: Utilities: split hex detection into smaller functions 2018-08-14 23:49:13 +02:00
uttrack.c ACPICA: Results from Clang 2019-10-28 22:12:46 +01:00
utuuid.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
utxface.c ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
utxferror.c ACPICA: Convert more ACPI errors to firmware errors 2019-01-15 18:04:02 +01:00
utxfinit.c ACPICA: Update for object initialization sequence 2019-07-04 00:59:43 +02:00
utxfmutex.c