Commit 5a802a7a authored by Mika Westerberg's avatar Mika Westerberg Committed by Rafael J. Wysocki

ACPI / watchdog: Prefer iTCO_wdt always when WDAT table uses RTC SRAM

After we added quirk for Lenovo Z50-70 it turns out there are at least
two more systems where WDAT table includes instructions accessing RTC
SRAM. Instead of quirking each system separately, look for such
instructions in the table and automatically prefer iTCO_wdt if found.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=199033Reported-by: default avatarArnold Guy <aurnoldg@gmail.com>
Reported-by: default avatarAlois Nespor <nespor@fssp.cz>
Reported-by: default avatarYury Pakin <zxwarior@gmail.com>
Reported-by: default avatarIhor Chyhin <ihorchyhin@ukr.net>
Signed-off-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 771c577c
...@@ -12,35 +12,51 @@ ...@@ -12,35 +12,51 @@
#define pr_fmt(fmt) "ACPI: watchdog: " fmt #define pr_fmt(fmt) "ACPI: watchdog: " fmt
#include <linux/acpi.h> #include <linux/acpi.h>
#include <linux/dmi.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include "internal.h" #include "internal.h"
static const struct dmi_system_id acpi_watchdog_skip[] = { #ifdef CONFIG_RTC_MC146818_LIB
{ #include <linux/mc146818rtc.h>
/*
* On Lenovo Z50-70 there are two issues with the WDAT /*
* table. First some of the instructions use RTC SRAM * There are several systems where the WDAT table is accessing RTC SRAM to
* to store persistent information. This does not work well * store persistent information. This does not work well with the Linux RTC
* with Linux RTC driver. Second, more important thing is * driver so on those systems we skip WDAT driver and prefer iTCO_wdt
* that the instructions do not actually reset the system. * instead.
*
* On this particular system iTCO_wdt seems to work just
* fine so we prefer that over WDAT for now.
* *
* See also https://bugzilla.kernel.org/show_bug.cgi?id=199033. * See also https://bugzilla.kernel.org/show_bug.cgi?id=199033.
*/ */
.ident = "Lenovo Z50-70", static bool acpi_watchdog_uses_rtc(const struct acpi_table_wdat *wdat)
.matches = { {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), const struct acpi_wdat_entry *entries;
DMI_MATCH(DMI_PRODUCT_NAME, "20354"), int i;
DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo Z50-70"),
}, entries = (struct acpi_wdat_entry *)(wdat + 1);
}, for (i = 0; i < wdat->entries; i++) {
{} const struct acpi_generic_address *gas;
};
gas = &entries[i].register_region;
if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_IO) {
switch (gas->address) {
case RTC_PORT(0):
case RTC_PORT(1):
case RTC_PORT(2):
case RTC_PORT(3):
return true;
}
}
}
return false;
}
#else
static bool acpi_watchdog_uses_rtc(const struct acpi_table_wdat *wdat)
{
return false;
}
#endif
static const struct acpi_table_wdat *acpi_watchdog_get_wdat(void) static const struct acpi_table_wdat *acpi_watchdog_get_wdat(void)
{ {
...@@ -50,9 +66,6 @@ static const struct acpi_table_wdat *acpi_watchdog_get_wdat(void) ...@@ -50,9 +66,6 @@ static const struct acpi_table_wdat *acpi_watchdog_get_wdat(void)
if (acpi_disabled) if (acpi_disabled)
return NULL; return NULL;
if (dmi_check_system(acpi_watchdog_skip))
return NULL;
status = acpi_get_table(ACPI_SIG_WDAT, 0, status = acpi_get_table(ACPI_SIG_WDAT, 0,
(struct acpi_table_header **)&wdat); (struct acpi_table_header **)&wdat);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
...@@ -60,6 +73,11 @@ static const struct acpi_table_wdat *acpi_watchdog_get_wdat(void) ...@@ -60,6 +73,11 @@ static const struct acpi_table_wdat *acpi_watchdog_get_wdat(void)
return NULL; return NULL;
} }
if (acpi_watchdog_uses_rtc(wdat)) {
pr_info("Skipping WDAT on this system because it uses RTC SRAM\n");
return NULL;
}
return wdat; return wdat;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment