]> git.baikalelectronics.ru Git - kernel.git/commit
platform/x86: hp-wmi: Correctly determine method id in WMI calls
authorPaulo Alcantara <pcacjr@zytor.com>
Sun, 30 Jul 2017 12:47:55 +0000 (09:47 -0300)
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Sun, 13 Aug 2017 12:17:24 +0000 (15:17 +0300)
commitaf23694f875256cec322b9d0449ee8cf1d56730c
treec917238bb34050b69f6cc9806f9c07c12eb40ce6
parente63c5e2804b9afe3575af495af4b65f7a5783425
platform/x86: hp-wmi: Correctly determine method id in WMI calls

The WMI queries are performed by evaluating the WMPV() method from ACPI
DSDT tables, and it takes three arguments: instance index, method id and
input data (buffer).

Currently the method id is hard-coded to 0x3 in hp_wmi_perform_query()
which means that it will perform WMI calls that expect an output data of
size 0x80 (128). The output size is usually OK for the WMI queries we
perform, however it would be better to pick the correct one before
evaluating the WMI method.

Which correct method id to choose can be figured out by looking at the
following ASL code from WVPI() method:

...
Name (PVSZ, Package (0x05)
            {
            Zero,
            0x04,
            0x80,
            0x0400,
            0x1000
            })
Store (Zero, Local0)
If (LAnd (LGreaterEqual (Arg1, One), LLessEqual (Arg1, 0x05)))
{
    Store (DerefOf (Index (PVSZ, Subtract (Arg1, One))), Local0)
}
...

Arg1 is the method id and PVSZ is the package used to index the
corresponding output size; 1 -> 0, 2 -> 4, 3 -> 128, 4 -> 1024, 5 ->
4096.

This patch maps the output size passed in hp_wmi_perform_query() to the
correct method id before evaluating the WMI method.

Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
drivers/platform/x86/hp-wmi.c