Message ID | 1450991926-20937-3-git-send-email-pali.rohar@gmail.com (mailing list archive) |
---|---|
State | Changes Requested, archived |
Headers | show |
> BIOS/ACPI on devices with WMI interface version 0 does not clear buffer > before filling it. So next time when BIOS/ACPI send WMI event which is > smaller as previous then it contains garbage in buffer from previous event. > > BIOS/ACPI on devices with WMI interface version 1 clears buffer and > sometimes send more events in buffer at one call. Are the explanations above based on your observations or perhaps some documentation?
On Monday 28 December 2015 14:40:56 Micha? K?pie? wrote: > > BIOS/ACPI on devices with WMI interface version 0 does not clear > > buffer before filling it. So next time when BIOS/ACPI send WMI > > event which is smaller as previous then it contains garbage in > > buffer from previous event. > > > > BIOS/ACPI on devices with WMI interface version 1 clears buffer and > > sometimes send more events in buffer at one call. > > Are the explanations above based on your observations or perhaps some > documentation? Just observation from all DSDT files which I have seen.
diff --git a/drivers/platform/x86/dell-wmi.c b/drivers/platform/x86/dell-wmi.c index 09ee8ed..62f2f7a 100644 --- a/drivers/platform/x86/dell-wmi.c +++ b/drivers/platform/x86/dell-wmi.c @@ -237,6 +237,22 @@ static void dell_wmi_notify(u32 value, void *context) buffer_end = buffer_entry + buffer_size; + /* + * BIOS/ACPI on devices with WMI interface version 0 does not clear + * buffer before filling it. So next time when BIOS/ACPI send WMI event + * which is smaller as previous then it contains garbage in buffer from + * previous event. + * + * BIOS/ACPI on devices with WMI interface version 1 clears buffer and + * sometimes send more events in buffer at one call. + * + * So to prevent reading garbage from buffer we will process only first + * one event on devices with WMI interface version 0. + */ + if (dell_wmi_interface_version == 0 && buffer_entry < buffer_end) + if (buffer_end > buffer_entry + buffer_entry[0] + 1) + buffer_end = buffer_entry + buffer_entry[0] + 1; + while (buffer_entry < buffer_end) { len = buffer_entry[0];
BIOS/ACPI on devices with WMI interface version 0 does not clear buffer before filling it. So next time when BIOS/ACPI send WMI event which is smaller as previous then it contains garbage in buffer from previous event. BIOS/ACPI on devices with WMI interface version 1 clears buffer and sometimes send more events in buffer at one call. Since commit 83fc44c32ad8 ("dell-wmi: Update code for processing WMI events") dell-wmi process all events in buffer (and not just first). So to prevent reading garbage from buffer we will process only first one event on devices with WMI interface version 0. Signed-off-by: Pali Rohár <pali.rohar@gmail.com> --- drivers/platform/x86/dell-wmi.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)