diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2013-01-08 23:07:29 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-08 16:40:47 -0800 |
commit | 115ba28c5e075c6bffd8106a2b5e23db88d0c3b5 (patch) | |
tree | 20e0f51fbbc9669f960e40ddc443fa2a4e3a4f56 /drivers/misc/mei/hw-me.c | |
parent | 9ea73ddd4f144952b8f69fac93dc592ea48e4113 (diff) |
mei: abstract host and device readieness
Add mei_host_set_ready function to enable the device
and is_ready function to query the host and me readiness
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mei/hw-me.c')
-rw-r--r-- | drivers/misc/mei/hw-me.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/drivers/misc/mei/hw-me.c b/drivers/misc/mei/hw-me.c index ed61659fd38..49b558ddf5b 100644 --- a/drivers/misc/mei/hw-me.c +++ b/drivers/misc/mei/hw-me.c @@ -172,6 +172,39 @@ void mei_hw_reset(struct mei_device *dev, bool intr_enable) dev_dbg(&dev->pdev->dev, "current HCSR = 0x%08x.\n", hcsr); } +/** + * mei_host_set_ready - enable device + * + * @dev - mei device + * returns bool + */ + +void mei_host_set_ready(struct mei_device *dev) +{ + dev->host_hw_state |= H_IE | H_IG | H_RDY; + mei_hcsr_set(dev); +} +/** + * mei_host_is_ready - check whether the host has turned ready + * + * @dev - mei device + * returns bool + */ +bool mei_host_is_ready(struct mei_device *dev) +{ + return (dev->host_hw_state & H_RDY) == H_RDY; +} + +/** + * mei_me_is_ready - check whether the me has turned ready + * + * @dev - mei device + * returns bool + */ +bool mei_me_is_ready(struct mei_device *dev) +{ + return (dev->me_hw_state & ME_RDY_HRA) == ME_RDY_HRA; +} /** * mei_interrupt_quick_handler - The ISR of the MEI device @@ -290,7 +323,7 @@ int mei_write_message(struct mei_device *dev, struct mei_msg_hdr *header, dev->host_hw_state |= H_IG; mei_hcsr_set(dev); dev->me_hw_state = mei_mecsr_read(dev); - if ((dev->me_hw_state & ME_RDY_HRA) != ME_RDY_HRA) + if (!mei_me_is_ready(dev)) return -EIO; return 0; |