diff options
author | Oren Weil <oren.jer.weil@intel.com> | 2011-09-07 02:03:12 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-09-09 16:28:20 -0400 |
commit | 55d3385672ba6315d45b396e9668e2660e426179 (patch) | |
tree | 82bae84fdb51ada377605f9393c04b4ff548854d | |
parent | 8c4a59a789dfee1e66d7597521e860d2fd8cd638 (diff) |
staging: mei: adding set_timeout watchdog function
add the ability to let the watchdog core set
the AMT watchdog timeout value.
the default value will be only set in the start function.
Signed-off-by: Oren Weil <oren.jer.weil@intel.com>
Acked-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/staging/mei/interface.h | 2 | ||||
-rw-r--r-- | drivers/staging/mei/main.c | 1 | ||||
-rw-r--r-- | drivers/staging/mei/wd.c | 40 |
3 files changed, 36 insertions, 7 deletions
diff --git a/drivers/staging/mei/interface.h b/drivers/staging/mei/interface.h index 2b5a22c23f7..7bd38ae2c23 100644 --- a/drivers/staging/mei/interface.h +++ b/drivers/staging/mei/interface.h | |||
@@ -51,7 +51,7 @@ int mei_flow_ctrl_creds(struct mei_device *dev, struct mei_cl *cl); | |||
51 | int mei_wd_send(struct mei_device *dev); | 51 | int mei_wd_send(struct mei_device *dev); |
52 | int mei_wd_stop(struct mei_device *dev, bool preserve); | 52 | int mei_wd_stop(struct mei_device *dev, bool preserve); |
53 | bool mei_wd_host_init(struct mei_device *dev); | 53 | bool mei_wd_host_init(struct mei_device *dev); |
54 | void mei_wd_start_setup(struct mei_device *dev); | 54 | void mei_wd_set_start_timeout(struct mei_device *dev, u16 timeout); |
55 | 55 | ||
56 | int mei_flow_ctrl_reduce(struct mei_device *dev, struct mei_cl *cl); | 56 | int mei_flow_ctrl_reduce(struct mei_device *dev, struct mei_cl *cl); |
57 | 57 | ||
diff --git a/drivers/staging/mei/main.c b/drivers/staging/mei/main.c index 386c27952d1..670feb7f91a 100644 --- a/drivers/staging/mei/main.c +++ b/drivers/staging/mei/main.c | |||
@@ -1153,7 +1153,6 @@ static int mei_pci_resume(struct device *device) | |||
1153 | 1153 | ||
1154 | /* Start watchdog if stopped in suspend */ | 1154 | /* Start watchdog if stopped in suspend */ |
1155 | if (dev->wd_timeout) { | 1155 | if (dev->wd_timeout) { |
1156 | mei_wd_start_setup(dev); | ||
1157 | dev->wd_due_counter = 1; | 1156 | dev->wd_due_counter = 1; |
1158 | schedule_delayed_work(&dev->wd_work, HZ); | 1157 | schedule_delayed_work(&dev->wd_work, HZ); |
1159 | } | 1158 | } |
diff --git a/drivers/staging/mei/wd.c b/drivers/staging/mei/wd.c index 9338394b236..6643f7aa97d 100644 --- a/drivers/staging/mei/wd.c +++ b/drivers/staging/mei/wd.c | |||
@@ -51,12 +51,12 @@ const uuid_le mei_wd_guid = UUID_LE(0x05B79A6F, 0x4628, 0x4D7F, 0x89, | |||
51 | 0x32, 0xAB); | 51 | 0x32, 0xAB); |
52 | 52 | ||
53 | 53 | ||
54 | void mei_wd_start_setup(struct mei_device *dev) | 54 | void mei_wd_set_start_timeout(struct mei_device *dev, u16 timeout) |
55 | { | 55 | { |
56 | dev_dbg(&dev->pdev->dev, "dev->wd_timeout=%d.\n", dev->wd_timeout); | 56 | dev_dbg(&dev->pdev->dev, "timeout=%d.\n", timeout); |
57 | memcpy(dev->wd_data, mei_start_wd_params, MEI_WD_PARAMS_SIZE); | 57 | memcpy(dev->wd_data, mei_start_wd_params, MEI_WD_PARAMS_SIZE); |
58 | memcpy(dev->wd_data + MEI_WD_PARAMS_SIZE, | 58 | memcpy(dev->wd_data + MEI_WD_PARAMS_SIZE, |
59 | &dev->wd_timeout, sizeof(u16)); | 59 | &timeout, sizeof(u16)); |
60 | } | 60 | } |
61 | 61 | ||
62 | /** | 62 | /** |
@@ -75,7 +75,6 @@ bool mei_wd_host_init(struct mei_device *dev) | |||
75 | dev->wd_timeout = watchdog_timeout; | 75 | dev->wd_timeout = watchdog_timeout; |
76 | 76 | ||
77 | if (dev->wd_timeout > 0) { | 77 | if (dev->wd_timeout > 0) { |
78 | mei_wd_start_setup(dev); | ||
79 | /* find ME WD client */ | 78 | /* find ME WD client */ |
80 | mei_find_me_client_update_filext(dev, &dev->wd_cl, | 79 | mei_find_me_client_update_filext(dev, &dev->wd_cl, |
81 | &mei_wd_guid, MEI_WD_HOST_CLIENT_ID); | 80 | &mei_wd_guid, MEI_WD_HOST_CLIENT_ID); |
@@ -224,7 +223,7 @@ static int mei_wd_ops_start(struct watchdog_device *wd_dev) | |||
224 | goto end_unlock; | 223 | goto end_unlock; |
225 | } | 224 | } |
226 | 225 | ||
227 | mei_wd_start_setup(dev); | 226 | mei_wd_set_start_timeout(dev, dev->wd_timeout); |
228 | 227 | ||
229 | err = 0; | 228 | err = 0; |
230 | end_unlock: | 229 | end_unlock: |
@@ -307,6 +306,36 @@ end: | |||
307 | } | 306 | } |
308 | 307 | ||
309 | /* | 308 | /* |
309 | * mei_wd_ops_set_timeout - wd set timeout command from the watchdog core. | ||
310 | * | ||
311 | * @wd_dev - watchdog device struct | ||
312 | * @timeout - timeout value to set | ||
313 | * | ||
314 | * returns 0 if success, negative errno code for failure | ||
315 | */ | ||
316 | static int mei_wd_ops_set_timeout(struct watchdog_device *wd_dev, unsigned int timeout) | ||
317 | { | ||
318 | struct mei_device *dev; | ||
319 | dev = pci_get_drvdata(mei_device); | ||
320 | |||
321 | if (!dev) | ||
322 | return -ENODEV; | ||
323 | |||
324 | /* Check Timeout value */ | ||
325 | if (timeout < AMT_WD_MIN_TIMEOUT || timeout > AMT_WD_MAX_TIMEOUT) | ||
326 | return -EINVAL; | ||
327 | |||
328 | mutex_lock(&dev->device_lock); | ||
329 | |||
330 | dev->wd_timeout = timeout; | ||
331 | mei_wd_set_start_timeout(dev, dev->wd_timeout); | ||
332 | |||
333 | mutex_unlock(&dev->device_lock); | ||
334 | |||
335 | return 0; | ||
336 | } | ||
337 | |||
338 | /* | ||
310 | * Watchdog Device structs | 339 | * Watchdog Device structs |
311 | */ | 340 | */ |
312 | const struct watchdog_ops wd_ops = { | 341 | const struct watchdog_ops wd_ops = { |
@@ -314,6 +343,7 @@ const struct watchdog_ops wd_ops = { | |||
314 | .start = mei_wd_ops_start, | 343 | .start = mei_wd_ops_start, |
315 | .stop = mei_wd_ops_stop, | 344 | .stop = mei_wd_ops_stop, |
316 | .ping = mei_wd_ops_ping, | 345 | .ping = mei_wd_ops_ping, |
346 | .set_timeout = mei_wd_ops_set_timeout, | ||
317 | }; | 347 | }; |
318 | const struct watchdog_info wd_info = { | 348 | const struct watchdog_info wd_info = { |
319 | .identity = INTEL_AMT_WATCHDOG_ID, | 349 | .identity = INTEL_AMT_WATCHDOG_ID, |