linux/drivers
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
..
accessibility
acpi ACPICA: Dispatcher: always generate buffer objects for ASL create_field() operator 2019-12-19 23:04:21 +01:00
amba
android binder: fix incorrect calculation for num_valid 2019-12-14 09:10:47 +01:00
ata pci-v5.5-changes 2019-12-03 13:58:22 -08:00
atm
auxdisplay auxdisplay: charlcd: deduplicate simple_strtoul() 2019-12-04 19:44:12 -08:00
base Merge branch 'remove-ksys-mount-dup' of git://git.kernel.org/pub/scm/linux/kernel/git/brodo/linux 2019-12-15 11:36:12 -08:00
bcma
block xen: branch for v5.5-rc2 2019-12-15 12:24:44 -08:00
bluetooth
bus Few ti-sysc related fixes for v5.5 merge window 2019-12-06 08:26:50 -08:00
cdrom
char drm msm + fixes for 5.5-rc1 2019-12-06 10:28:09 -08:00
clk ARM: SoC platform updates 2019-12-05 11:38:40 -08:00
clocksource Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2019-12-03 12:20:25 -08:00
connector
counter
cpufreq cpufreq: tegra: Changes for v5.5-rc1 2019-12-06 08:28:13 -08:00
cpuidle cpuidle: Drop unnecessary type cast in cpuidle_poll_time() 2019-12-12 17:56:08 +01:00
crypto Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2019-12-02 17:23:21 -08:00
dax
dca
devfreq PM / devfreq: Use PM QoS for sysfs min/max_freq 2019-12-09 12:19:16 +09:00
dio
dma
dma-buf - A fix for a memory leak in the dma-buf support 2019-12-09 17:13:19 +10:00
edac
eisa
extcon
firewire FireWire (IEEE 1394) subsystem updates: 2019-12-02 14:13:00 -08:00
firmware treewide: Use sizeof_field() macro 2019-12-09 10:36:44 -08:00
fpga
fsi
gnss
gpio gpio: pca953x: tighten up indentation 2019-12-04 19:44:14 -08:00
gpu Merge tag 'drm-fixes-5.5-2019-12-12' of git://people.freedesktop.org/~agd5f/linux into drm-fixes 2019-12-13 14:50:01 +10:00
greybus
hid
hsi
hv
hwmon
hwspinlock
hwtracing
i2c i2c: remove i2c_new_dummy() API 2019-12-10 23:15:09 +01:00
i3c
ide
idle
iio First set of fixes for IIO in the 5.5 cycle. 2019-12-09 09:27:52 +01:00
infiniband Pull request for 5.5-rc2 2019-12-15 14:58:13 -08:00
input Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2019-12-07 18:33:01 -08:00
interconnect interconnect: qcom: msm8974: Walk the list safely on node removal 2019-12-12 10:28:54 +01:00
iommu pci-v5.5-changes 2019-12-03 13:58:22 -08:00
ipack
irqchip pci-v5.5-changes 2019-12-03 13:58:22 -08:00
isdn
leds
lightnvm
macintosh
mailbox
mcb
md for-linus-20191212 2019-12-13 14:27:19 -08:00
media treewide: Use sizeof_field() macro 2019-12-09 10:36:44 -08:00
memory memory: tegra: Fixes for v5.5-rc1 2019-12-06 08:28:51 -08:00
memstick pci-v5.5-changes 2019-12-03 13:58:22 -08:00
message
mfd chrome platform changes for v5.5 2019-12-03 14:37:12 -08:00
misc lib/genalloc.c: rename addr_in_gen_pool to gen_pool_has_addr 2019-12-04 19:44:13 -08:00
mmc
mtd TTY/Serial patches for 5.5-rc1 2019-12-03 14:09:14 -08:00
mux
net treewide: Use sizeof_field() macro 2019-12-09 10:36:44 -08:00
nfc
ntb Add Hygon Device ID to the AMD NTB device driver 2019-12-07 18:38:17 -08:00
nubus
nvdimm
nvme for-linus-20191212 2019-12-13 14:27:19 -08:00
nvmem ARM: SoC-related driver updates 2019-12-05 11:43:31 -08:00
of of/platform: Unconditionally pause/resume sync state during kernel init 2019-12-12 18:39:52 -06:00
opp
oprofile
parisc
parport
pci PCI: rockchip: Fix IO outbound ATU register number 2019-12-12 15:25:37 -06:00
pcmcia
perf
phy ARM: SoC-related driver updates 2019-12-05 11:43:31 -08:00
pinctrl Merge branch 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2019-12-03 09:29:50 -08:00
platform chrome platform changes for v5.5 2019-12-03 14:37:12 -08:00
pnp
power Additional power management updates for 5.5-rc1 2019-12-04 10:48:09 -08:00
powercap
pps
ps3
ptp
pwm pwm: Changes for v5.5-rc1 2019-12-05 11:28:14 -08:00
rapidio drivers/rapidio/rio-access.c: fix missing include of <linux/rio_drv.h> 2019-12-04 19:44:13 -08:00
ras
regulator
remoteproc
reset ARM: SoC-related driver updates 2019-12-05 11:43:31 -08:00
rpmsg
rtc RTC for 5.5 2019-12-03 13:31:08 -08:00
s390 treewide: Use sizeof_field() macro 2019-12-09 10:36:44 -08:00
sbus
scsi SCSI fixes on 20191214 2019-12-14 12:51:57 -08:00
sfi
sh
siox
slimbus
soc ARM: SoC fixes 2019-12-06 14:19:37 -08:00
soundwire
spi
spmi
ssb
staging Staging/IIO fixes for 5.5-rc2 2019-12-14 12:43:57 -08:00
target treewide: Use sizeof_field() macro 2019-12-09 10:36:44 -08:00
tc
tee Merge mainline/master into arm/fixes 2019-12-05 13:18:54 -08:00
thermal thermal: power_allocator: Fix Kconfig warning 2019-12-07 21:49:06 +08:00
thunderbolt
tty TTY/Serial patches for 5.5-rc1 2019-12-03 14:09:14 -08:00
uio
usb USB driver fixes for 5.5-rc2 2019-12-14 12:40:39 -08:00
vfio VFIO updates for v5.5-rc1 2019-12-07 14:51:04 -08:00
vhost Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2019-12-08 13:28:11 -08:00
video pci-v5.5-changes 2019-12-03 13:58:22 -08:00
virt
virtio virtio_balloon: divide/multiply instead of shifts 2019-12-11 08:14:07 -05:00
visorbus
vlynq
vme
w1
watchdog
xen xen: branch for v5.5-rc2 2019-12-15 12:24:44 -08:00
zorro
Kconfig
Makefile