Source
/*
* ACPI Hardware Watchdog (WDAT) driver.
*
* Copyright (C) 2016, Intel Corporation
* Author: Mika Westerberg <mika.westerberg@linux.intel.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
/**
* struct wdat_instruction - Single ACPI WDAT instruction
* @entry: Copy of the ACPI table instruction
* @reg: Register the instruction is accessing
* @node: Next instruction in action sequence
*/
struct wdat_instruction {
struct acpi_wdat_entry entry;
void __iomem *reg;
struct list_head node;
};
/**
* struct wdat_wdt - ACPI WDAT watchdog device
* @pdev: Parent platform device
* @wdd: Watchdog core device
* @period: How long is one watchdog period in ms
* @stopped_in_sleep: Is this watchdog stopped by the firmware in S1-S5
* @stopped: Was the watchdog stopped by the driver in suspend
* @actions: An array of instruction lists indexed by an action number from
* the WDAT table. There can be %NULL entries for not implemented
* actions.
*/
struct wdat_wdt {
struct platform_device *pdev;
struct watchdog_device wdd;
unsigned int period;
bool stopped_in_sleep;
bool stopped;
struct list_head *instructions[MAX_WDAT_ACTIONS];
};
static bool nowayout = WATCHDOG_NOWAYOUT;
module_param(nowayout, bool, 0);
MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
static int wdat_wdt_read(struct wdat_wdt *wdat,
const struct wdat_instruction *instr, u32 *value)
{
const struct acpi_generic_address *gas = &instr->entry.register_region;