History

platform/x86: asus-wmi: Increase input buffer size of WMI methods

The asus-nb-wmi driver is matched by WMI alias but fails to load on TUF Gaming series laptops producing multiple ACPI errors in the kernel log. The input buffer for WMI method invocation size is 2 dwords, whereas 3 are expected by this model. FX505GM: .. Method (WMNB, 3, Serialized) { P8XH (Zero, 0x11) CreateDWordField (Arg2, Zero, IIA0) CreateDWordField (Arg2, 0x04, IIA1) CreateDWordField (Arg2, 0x08, IIA2) Local0 = (Arg1 & 0xFFFFFFFF) ... Compare with older K54C: ... Method (WMNB, 3, NotSerialized) { CreateDWordField (Arg2, 0x00, IIA0) CreateDWordField (Arg2, 0x04, IIA1) Local0 = (Arg1 & 0xFFFFFFFF) ... Increase buffer size to 3 dwords. No negative consequences of this change are expected, as the input buffer size is not verified. The original function is replaced by a wrapper for a new method passing value 0 for the last parameter. The new function will be used to control RGB keyboard backlight.

Yurii Pavlovskyi committed 7 years ago

Commit 98e865a1 parent 8853a2f1 file · +9 −1Browse files

Unified · Split

drivers/platform/x86/asus-wmi.c+9−1
@@ -98,6 +98,7 @@ static bool ashs_present(void) · 97 unmodified lines
98struct bios_args {98struct bios_args {
99 u32 arg0;99 u32 arg0;
100 u32 arg1;100 u32 arg1;
101 u32 arg2; /* At least TUF Gaming series uses 3 dword input buffer. */
101} __packed;102} __packed;
102 103
103/*104/*
@@ -224,11 +225,13 @@ static void asus_wmi_input_exit(struct asus_wmi *asus) · 120 unmodified lines
224 asus->inputdev = NULL;225 asus->inputdev = NULL;
225}226}
226 227
227int asus_wmi_evaluate_method(u32 method_id, u32 arg0, u32 arg1, u32 *retval)228static int asus_wmi_evaluate_method3(u32 method_id,
229 u32 arg0, u32 arg1, u32 arg2, u32 *retval)
228{230{
229 struct bios_args args = {231 struct bios_args args = {
230 .arg0 = arg0,232 .arg0 = arg0,
231 .arg1 = arg1,233 .arg1 = arg1,
234 .arg2 = arg2,
232 };235 };
233 struct acpi_buffer input = { (acpi_size) sizeof(args), &args };236 struct acpi_buffer input = { (acpi_size) sizeof(args), &args };
234 struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };237 struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
@@ -260,6 +263,11 @@ exit: · 25 unmodified lines
260 263
261 return 0;264 return 0;
262}265}
266
267int asus_wmi_evaluate_method(u32 method_id, u32 arg0, u32 arg1, u32 *retval)
268{
269 return asus_wmi_evaluate_method3(method_id, arg0, arg1, 0, retval);
270}
263EXPORT_SYMBOL_GPL(asus_wmi_evaluate_method);271EXPORT_SYMBOL_GPL(asus_wmi_evaluate_method);
264 272
265static int asus_wmi_evaluate_method_agfn(const struct acpi_buffer args)273static int asus_wmi_evaluate_method_agfn(const struct acpi_buffer args)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t