Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Intel Management Engine Interface (Intel MEI) Linux driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * Copyright (c) 2015, Intel Corporation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <linux/debugfs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <linux/completion.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <linux/watchdog.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <linux/uuid.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <linux/mei_cl_bus.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  * iAMT Watchdog Device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #define INTEL_AMT_WATCHDOG_ID "iamt_wdt"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #define MEI_WDT_DEFAULT_TIMEOUT   120  /* seconds */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #define MEI_WDT_MIN_TIMEOUT       120  /* seconds */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #define MEI_WDT_MAX_TIMEOUT     65535  /* seconds */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) /* Commands */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #define MEI_MANAGEMENT_CONTROL 0x02
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) /* MEI Management Control version number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) #define MEI_MC_VERSION_NUMBER  0x10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) /* Sub Commands */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #define MEI_MC_START_WD_TIMER_REQ  0x13
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) #define MEI_MC_START_WD_TIMER_RES  0x83
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) #define   MEI_WDT_STATUS_SUCCESS 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) #define   MEI_WDT_WDSTATE_NOT_REQUIRED 0x1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) #define MEI_MC_STOP_WD_TIMER_REQ   0x14
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40)  * enum mei_wdt_state - internal watchdog state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42)  * @MEI_WDT_PROBE: wd in probing stage
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43)  * @MEI_WDT_IDLE: wd is idle and not opened
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44)  * @MEI_WDT_START: wd was opened, start was called
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45)  * @MEI_WDT_RUNNING: wd is expecting keep alive pings
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46)  * @MEI_WDT_STOPPING: wd is stopping and will move to IDLE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47)  * @MEI_WDT_NOT_REQUIRED: wd device is not required
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) enum mei_wdt_state {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	MEI_WDT_PROBE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	MEI_WDT_IDLE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	MEI_WDT_START,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	MEI_WDT_RUNNING,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	MEI_WDT_STOPPING,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	MEI_WDT_NOT_REQUIRED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) static const char *mei_wdt_state_str(enum mei_wdt_state state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	switch (state) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	case MEI_WDT_PROBE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 		return "PROBE";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	case MEI_WDT_IDLE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 		return "IDLE";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	case MEI_WDT_START:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 		return "START";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	case MEI_WDT_RUNNING:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 		return "RUNNING";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	case MEI_WDT_STOPPING:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 		return "STOPPING";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	case MEI_WDT_NOT_REQUIRED:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 		return "NOT_REQUIRED";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 		return "unknown";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79)  * struct mei_wdt - mei watchdog driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80)  * @wdd: watchdog device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82)  * @cldev: mei watchdog client device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83)  * @state: watchdog internal state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84)  * @resp_required: ping required response
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85)  * @response: ping response completion
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86)  * @unregister: unregister worker
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87)  * @reg_lock: watchdog device registration lock
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88)  * @timeout: watchdog current timeout
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90)  * @dbgfs_dir: debugfs dir entry
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) struct mei_wdt {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	struct watchdog_device wdd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	struct mei_cl_device *cldev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	enum mei_wdt_state state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	bool resp_required;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	struct completion response;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	struct work_struct unregister;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	struct mutex reg_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	u16 timeout;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) #if IS_ENABLED(CONFIG_DEBUG_FS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	struct dentry *dbgfs_dir;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) #endif /* CONFIG_DEBUG_FS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)  * struct mei_mc_hdr - Management Control Command Header
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)  * @command: Management Control (0x2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)  * @bytecount: Number of bytes in the message beyond this byte
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113)  * @subcommand: Management Control Subcommand
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)  * @versionnumber: Management Control Version (0x10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) struct mei_mc_hdr {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	u8 command;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	u8 bytecount;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	u8 subcommand;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	u8 versionnumber;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)  * struct mei_wdt_start_request watchdog start/ping
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)  * @hdr: Management Control Command Header
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)  * @timeout: timeout value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128)  * @reserved: reserved (legacy)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) struct mei_wdt_start_request {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	struct mei_mc_hdr hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	u16 timeout;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	u8 reserved[17];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)  * struct mei_wdt_start_response watchdog start/ping response
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139)  * @hdr: Management Control Command Header
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140)  * @status: operation status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)  * @wdstate: watchdog status bit mask
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) struct mei_wdt_start_response {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	struct mei_mc_hdr hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	u8 status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	u8 wdstate;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150)  * struct mei_wdt_stop_request - watchdog stop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152)  * @hdr: Management Control Command Header
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) struct mei_wdt_stop_request {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	struct mei_mc_hdr hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)  * mei_wdt_ping - send wd start/ping command
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161)  * @wdt: mei watchdog device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163)  * Return: 0 on success,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164)  *         negative errno code on failure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) static int mei_wdt_ping(struct mei_wdt *wdt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	struct mei_wdt_start_request req;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	const size_t req_len = sizeof(req);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	memset(&req, 0, req_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	req.hdr.command = MEI_MANAGEMENT_CONTROL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	req.hdr.bytecount = req_len - offsetof(struct mei_mc_hdr, subcommand);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	req.hdr.subcommand = MEI_MC_START_WD_TIMER_REQ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	req.hdr.versionnumber = MEI_MC_VERSION_NUMBER;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	req.timeout = wdt->timeout;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	ret = mei_cldev_send(wdt->cldev, (u8 *)&req, req_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 		return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187)  * mei_wdt_stop - send wd stop command
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)  * @wdt: mei watchdog device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191)  * Return: 0 on success,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)  *         negative errno code on failure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) static int mei_wdt_stop(struct mei_wdt *wdt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	struct mei_wdt_stop_request req;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	const size_t req_len = sizeof(req);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	memset(&req, 0, req_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	req.hdr.command = MEI_MANAGEMENT_CONTROL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 	req.hdr.bytecount = req_len - offsetof(struct mei_mc_hdr, subcommand);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	req.hdr.subcommand = MEI_MC_STOP_WD_TIMER_REQ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	req.hdr.versionnumber = MEI_MC_VERSION_NUMBER;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 	ret = mei_cldev_send(wdt->cldev, (u8 *)&req, req_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 		return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214)  * mei_wdt_ops_start - wd start command from the watchdog core.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216)  * @wdd: watchdog device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218)  * Return: 0 on success or -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) static int mei_wdt_ops_start(struct watchdog_device *wdd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	struct mei_wdt *wdt = watchdog_get_drvdata(wdd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 	wdt->state = MEI_WDT_START;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	wdd->timeout = wdt->timeout;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230)  * mei_wdt_ops_stop - wd stop command from the watchdog core.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232)  * @wdd: watchdog device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234)  * Return: 0 if success, negative errno code for failure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) static int mei_wdt_ops_stop(struct watchdog_device *wdd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 	struct mei_wdt *wdt = watchdog_get_drvdata(wdd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 	if (wdt->state != MEI_WDT_RUNNING)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 	wdt->state = MEI_WDT_STOPPING;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 	ret = mei_wdt_stop(wdt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 	if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 		return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 	wdt->state = MEI_WDT_IDLE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256)  * mei_wdt_ops_ping - wd ping command from the watchdog core.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258)  * @wdd: watchdog device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260)  * Return: 0 if success, negative errno code on failure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) static int mei_wdt_ops_ping(struct watchdog_device *wdd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 	struct mei_wdt *wdt = watchdog_get_drvdata(wdd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 	if (wdt->state != MEI_WDT_START && wdt->state != MEI_WDT_RUNNING)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 	if (wdt->resp_required)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 		init_completion(&wdt->response);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 	wdt->state = MEI_WDT_RUNNING;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 	ret = mei_wdt_ping(wdt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 	if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 		return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) 	if (wdt->resp_required)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 		ret = wait_for_completion_killable(&wdt->response);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285)  * mei_wdt_ops_set_timeout - wd set timeout command from the watchdog core.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287)  * @wdd: watchdog device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288)  * @timeout: timeout value to set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290)  * Return: 0 if success, negative errno code for failure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) static int mei_wdt_ops_set_timeout(struct watchdog_device *wdd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 				   unsigned int timeout)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) 	struct mei_wdt *wdt = watchdog_get_drvdata(wdd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) 	/* valid value is already checked by the caller */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) 	wdt->timeout = timeout;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) 	wdd->timeout = timeout;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) static const struct watchdog_ops wd_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) 	.owner       = THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) 	.start       = mei_wdt_ops_start,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) 	.stop        = mei_wdt_ops_stop,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) 	.ping        = mei_wdt_ops_ping,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) 	.set_timeout = mei_wdt_ops_set_timeout,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) /* not const as the firmware_version field need to be retrieved */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) static struct watchdog_info wd_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) 	.identity = INTEL_AMT_WATCHDOG_ID,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) 	.options  = WDIOF_KEEPALIVEPING |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) 		    WDIOF_SETTIMEOUT |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) 		    WDIOF_ALARMONLY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322)  * __mei_wdt_is_registered - check if wdt is registered
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324)  * @wdt: mei watchdog device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326)  * Return: true if the wdt is registered with the watchdog subsystem
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327)  * Locking: should be called under wdt->reg_lock
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) static inline bool __mei_wdt_is_registered(struct mei_wdt *wdt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) 	return !!watchdog_get_drvdata(&wdt->wdd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335)  * mei_wdt_unregister - unregister from the watchdog subsystem
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337)  * @wdt: mei watchdog device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) static void mei_wdt_unregister(struct mei_wdt *wdt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) 	mutex_lock(&wdt->reg_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) 	if (__mei_wdt_is_registered(wdt)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) 		watchdog_unregister_device(&wdt->wdd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) 		watchdog_set_drvdata(&wdt->wdd, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) 		memset(&wdt->wdd, 0, sizeof(wdt->wdd));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) 	mutex_unlock(&wdt->reg_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353)  * mei_wdt_register - register with the watchdog subsystem
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355)  * @wdt: mei watchdog device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357)  * Return: 0 if success, negative errno code for failure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) static int mei_wdt_register(struct mei_wdt *wdt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) 	struct device *dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) 	if (!wdt || !wdt->cldev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 		return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) 	dev = &wdt->cldev->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) 	mutex_lock(&wdt->reg_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) 	if (__mei_wdt_is_registered(wdt)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) 		ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) 		goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) 	wdt->wdd.info = &wd_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) 	wdt->wdd.ops = &wd_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) 	wdt->wdd.parent = dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) 	wdt->wdd.timeout = MEI_WDT_DEFAULT_TIMEOUT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) 	wdt->wdd.min_timeout = MEI_WDT_MIN_TIMEOUT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) 	wdt->wdd.max_timeout = MEI_WDT_MAX_TIMEOUT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) 	watchdog_set_drvdata(&wdt->wdd, wdt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) 	watchdog_stop_on_reboot(&wdt->wdd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) 	watchdog_stop_on_unregister(&wdt->wdd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) 	ret = watchdog_register_device(&wdt->wdd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) 	if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) 		watchdog_set_drvdata(&wdt->wdd, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) 	wdt->state = MEI_WDT_IDLE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) 	mutex_unlock(&wdt->reg_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) static void mei_wdt_unregister_work(struct work_struct *work)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) 	struct mei_wdt *wdt = container_of(work, struct mei_wdt, unregister);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) 	mei_wdt_unregister(wdt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406)  * mei_wdt_rx - callback for data receive
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408)  * @cldev: bus device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) static void mei_wdt_rx(struct mei_cl_device *cldev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) 	struct mei_wdt *wdt = mei_cldev_get_drvdata(cldev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) 	struct mei_wdt_start_response res;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) 	const size_t res_len = sizeof(res);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) 	ret = mei_cldev_recv(wdt->cldev, (u8 *)&res, res_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) 	if (ret < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) 		dev_err(&cldev->dev, "failure in recv %d\n", ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) 	/* Empty response can be sent on stop */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) 	if (ret == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) 	if (ret < sizeof(struct mei_mc_hdr)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) 		dev_err(&cldev->dev, "recv small data %d\n", ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) 	if (res.hdr.command != MEI_MANAGEMENT_CONTROL ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) 	    res.hdr.versionnumber != MEI_MC_VERSION_NUMBER) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) 		dev_err(&cldev->dev, "wrong command received\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) 	if (res.hdr.subcommand != MEI_MC_START_WD_TIMER_RES) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) 		dev_warn(&cldev->dev, "unsupported command %d :%s[%d]\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) 			 res.hdr.subcommand,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) 			 mei_wdt_state_str(wdt->state),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) 			 wdt->state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) 	/* Run the unregistration in a worker as this can be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) 	 * run only after ping completion, otherwise the flow will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) 	 * deadlock on watchdog core mutex.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) 	if (wdt->state == MEI_WDT_RUNNING) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) 		if (res.wdstate & MEI_WDT_WDSTATE_NOT_REQUIRED) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) 			wdt->state = MEI_WDT_NOT_REQUIRED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) 			schedule_work(&wdt->unregister);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) 		goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) 	if (wdt->state == MEI_WDT_PROBE) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) 		if (res.wdstate & MEI_WDT_WDSTATE_NOT_REQUIRED) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) 			wdt->state = MEI_WDT_NOT_REQUIRED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) 		} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) 			/* stop the watchdog and register watchdog device */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) 			mei_wdt_stop(wdt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) 			mei_wdt_register(wdt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) 	dev_warn(&cldev->dev, "not in correct state %s[%d]\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) 			 mei_wdt_state_str(wdt->state), wdt->state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) 	if (!completion_done(&wdt->response))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) 		complete(&wdt->response);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478)  * mei_wdt_notif - callback for event notification
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480)  * @cldev: bus device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) static void mei_wdt_notif(struct mei_cl_device *cldev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) 	struct mei_wdt *wdt = mei_cldev_get_drvdata(cldev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) 	if (wdt->state != MEI_WDT_NOT_REQUIRED)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) 	mei_wdt_register(wdt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) #if IS_ENABLED(CONFIG_DEBUG_FS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) static ssize_t mei_dbgfs_read_activation(struct file *file, char __user *ubuf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) 					size_t cnt, loff_t *ppos)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) 	struct mei_wdt *wdt = file->private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) 	const size_t bufsz = 32;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) 	char buf[32];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) 	ssize_t pos;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) 	mutex_lock(&wdt->reg_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) 	pos = scnprintf(buf, bufsz, "%s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) 		__mei_wdt_is_registered(wdt) ? "activated" : "deactivated");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) 	mutex_unlock(&wdt->reg_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) 	return simple_read_from_buffer(ubuf, cnt, ppos, buf, pos);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) static const struct file_operations dbgfs_fops_activation = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) 	.open    = simple_open,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) 	.read    = mei_dbgfs_read_activation,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) 	.llseek  = generic_file_llseek,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) static ssize_t mei_dbgfs_read_state(struct file *file, char __user *ubuf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) 				    size_t cnt, loff_t *ppos)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) 	struct mei_wdt *wdt = file->private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) 	char buf[32];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) 	ssize_t pos;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) 	pos = scnprintf(buf, sizeof(buf), "state: %s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) 			mei_wdt_state_str(wdt->state));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) 	return simple_read_from_buffer(ubuf, cnt, ppos, buf, pos);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) static const struct file_operations dbgfs_fops_state = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) 	.open = simple_open,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) 	.read = mei_dbgfs_read_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) 	.llseek = generic_file_llseek,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) static void dbgfs_unregister(struct mei_wdt *wdt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) 	debugfs_remove_recursive(wdt->dbgfs_dir);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) 	wdt->dbgfs_dir = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) static void dbgfs_register(struct mei_wdt *wdt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) 	struct dentry *dir;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) 	dir = debugfs_create_dir(KBUILD_MODNAME, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) 	wdt->dbgfs_dir = dir;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) 	debugfs_create_file("state", S_IRUSR, dir, wdt, &dbgfs_fops_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) 	debugfs_create_file("activation", S_IRUSR, dir, wdt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) 			    &dbgfs_fops_activation);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) static inline void dbgfs_unregister(struct mei_wdt *wdt) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) static inline void dbgfs_register(struct mei_wdt *wdt) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) #endif /* CONFIG_DEBUG_FS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) static int mei_wdt_probe(struct mei_cl_device *cldev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) 			 const struct mei_cl_device_id *id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) 	struct mei_wdt *wdt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) 	wdt = kzalloc(sizeof(struct mei_wdt), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) 	if (!wdt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570) 	wdt->timeout = MEI_WDT_DEFAULT_TIMEOUT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) 	wdt->state = MEI_WDT_PROBE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) 	wdt->cldev = cldev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) 	wdt->resp_required = mei_cldev_ver(cldev) > 0x1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) 	mutex_init(&wdt->reg_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575) 	init_completion(&wdt->response);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) 	INIT_WORK(&wdt->unregister, mei_wdt_unregister_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) 	mei_cldev_set_drvdata(cldev, wdt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) 	ret = mei_cldev_enable(cldev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) 	if (ret < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) 		dev_err(&cldev->dev, "Could not enable cl device\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) 		goto err_out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) 	ret = mei_cldev_register_rx_cb(wdt->cldev, mei_wdt_rx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) 	if (ret) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) 		dev_err(&cldev->dev, "Could not reg rx event ret=%d\n", ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) 		goto err_disable;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) 	ret = mei_cldev_register_notif_cb(wdt->cldev, mei_wdt_notif);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) 	/* on legacy devices notification is not supported
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) 	if (ret && ret != -EOPNOTSUPP) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) 		dev_err(&cldev->dev, "Could not reg notif event ret=%d\n", ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) 		goto err_disable;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) 	wd_info.firmware_version = mei_cldev_ver(cldev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) 	if (wdt->resp_required)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) 		ret = mei_wdt_ping(wdt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) 		ret = mei_wdt_register(wdt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) 	if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608) 		goto err_disable;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610) 	dbgfs_register(wdt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) err_disable:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615) 	mei_cldev_disable(cldev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) err_out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) 	kfree(wdt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623) static int mei_wdt_remove(struct mei_cl_device *cldev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625) 	struct mei_wdt *wdt = mei_cldev_get_drvdata(cldev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627) 	/* Free the caller in case of fw initiated or unexpected reset */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628) 	if (!completion_done(&wdt->response))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629) 		complete(&wdt->response);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) 	cancel_work_sync(&wdt->unregister);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633) 	mei_wdt_unregister(wdt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635) 	mei_cldev_disable(cldev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637) 	dbgfs_unregister(wdt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639) 	kfree(wdt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644) #define MEI_UUID_WD UUID_LE(0x05B79A6F, 0x4628, 0x4D7F, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645) 			    0x89, 0x9D, 0xA9, 0x15, 0x14, 0xCB, 0x32, 0xAB)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647) static const struct mei_cl_device_id mei_wdt_tbl[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648) 	{ .uuid = MEI_UUID_WD, .version = MEI_CL_VERSION_ANY },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649) 	/* required last entry */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650) 	{ }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652) MODULE_DEVICE_TABLE(mei, mei_wdt_tbl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654) static struct mei_cl_driver mei_wdt_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655) 	.id_table = mei_wdt_tbl,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656) 	.name = KBUILD_MODNAME,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658) 	.probe = mei_wdt_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659) 	.remove = mei_wdt_remove,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662) module_mei_cl_driver(mei_wdt_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664) MODULE_AUTHOR("Intel Corporation");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665) MODULE_LICENSE("GPL v2");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666) MODULE_DESCRIPTION("Device driver for Intel MEI iAMT watchdog");