Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 268305
b: refs/heads/master
c: 4a3cafd
h: refs/heads/master
i:
  268303: 9c0b19e
v: v3
  • Loading branch information
Oren Weil authored and Greg Kroah-Hartman committed Sep 9, 2011
1 parent b099826 commit a946ced
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 17 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9ce178e539e0511571a9517e63980e68427b5585
refs/heads/master: 4a3cafd5d98e7442471e1dae821b044ec49348de
2 changes: 1 addition & 1 deletion trunk/drivers/staging/mei/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ static struct cdev mei_cdev;
static int mei_major;
/* The device pointer */
/* Currently this driver works as long as there is only a single AMT device. */
static struct pci_dev *mei_device;
struct pci_dev *mei_device;

static struct class *mei_class;

Expand Down
5 changes: 5 additions & 0 deletions trunk/drivers/staging/mei/mei_dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@
#define MEI_WD_PARAMS_SIZE 4
#define MEI_WD_STATE_INDEPENDENCE_MSG_SENT (1 << 0)

/*
* MEI PCI Device object
*/
extern struct pci_dev *mei_device;

/*
* AMT Watchdog Device
*/
Expand Down
95 changes: 80 additions & 15 deletions trunk/drivers/staging/mei/wd.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,6 @@
#include "interface.h"
#include "mei.h"

/*
* Watchdog Device structs
*/
const struct watchdog_info wd_info = {
.identity = INTEL_AMT_WATCHDOG_ID,
};

struct watchdog_device amt_wd_dev = {
.info = &wd_info,
.timeout = AMT_WD_DEFAULT_TIMEOUT,
.min_timeout = AMT_WD_MIN_TIMEOUT,
.max_timeout = AMT_WD_MAX_TIMEOUT,
};


/*
* MEI Watchdog Module Parameters
*/
Expand Down Expand Up @@ -210,3 +195,83 @@ int mei_wd_stop(struct mei_device *dev, bool preserve)
return ret;
}

/*
* mei_wd_ops_start - wd start command from the watchdog core.
*
* @wd_dev - watchdog device struct
*
* returns 0 if success, negative errno code for failure
*/
static int mei_wd_ops_start(struct watchdog_device *wd_dev)
{
int err = -ENODEV;
struct mei_device *dev;

dev = pci_get_drvdata(mei_device);
if (!dev)
return -ENODEV;

mutex_lock(&dev->device_lock);

if (dev->mei_state != MEI_ENABLED) {
dev_dbg(&dev->pdev->dev, "mei_state != MEI_ENABLED mei_state= %d\n",
dev->mei_state);
goto end_unlock;
}

if (dev->wd_cl.state != MEI_FILE_CONNECTED) {
dev_dbg(&dev->pdev->dev, "MEI Driver is not connected to Watchdog Client\n");
goto end_unlock;
}

mei_wd_start_setup(dev);

err = 0;
end_unlock:
mutex_unlock(&dev->device_lock);
return err;
}

/*
* mei_wd_ops_stop - wd stop command from the watchdog core.
*
* @wd_dev - watchdog device struct
*
* returns 0 if success, negative errno code for failure
*/
static int mei_wd_ops_stop(struct watchdog_device *wd_dev)
{
struct mei_device *dev;
dev = pci_get_drvdata(mei_device);

if (!dev)
return -ENODEV;

mutex_lock(&dev->device_lock);
mei_wd_stop(dev, false);
mutex_unlock(&dev->device_lock);

return 0;
}

/*
* Watchdog Device structs
*/
const struct watchdog_ops wd_ops = {
.owner = THIS_MODULE,
.start = mei_wd_ops_start,
.stop = mei_wd_ops_stop,
};
const struct watchdog_info wd_info = {
.identity = INTEL_AMT_WATCHDOG_ID,
};

struct watchdog_device amt_wd_dev = {
.info = &wd_info,
.ops = &wd_ops,
.timeout = AMT_WD_DEFAULT_TIMEOUT,
.min_timeout = AMT_WD_MIN_TIMEOUT,
.max_timeout = AMT_WD_MAX_TIMEOUT,
};


0 comments on commit a946ced

Please sign in to comment.