diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2013-01-08 16:07:29 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-08 19:40:47 -0500 |
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 ed61659fd388..49b558ddf5b5 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) | |||
172 | dev_dbg(&dev->pdev->dev, "current HCSR = 0x%08x.\n", hcsr); | 172 | dev_dbg(&dev->pdev->dev, "current HCSR = 0x%08x.\n", hcsr); |
173 | } | 173 | } |
174 | 174 | ||
175 | /** | ||
176 | * mei_host_set_ready - enable device | ||
177 | * | ||
178 | * @dev - mei device | ||
179 | * returns bool | ||
180 | */ | ||
181 | |||
182 | void mei_host_set_ready(struct mei_device *dev) | ||
183 | { | ||
184 | dev->host_hw_state |= H_IE | H_IG | H_RDY; | ||
185 | mei_hcsr_set(dev); | ||
186 | } | ||
187 | /** | ||
188 | * mei_host_is_ready - check whether the host has turned ready | ||
189 | * | ||
190 | * @dev - mei device | ||
191 | * returns bool | ||
192 | */ | ||
193 | bool mei_host_is_ready(struct mei_device *dev) | ||
194 | { | ||
195 | return (dev->host_hw_state & H_RDY) == H_RDY; | ||
196 | } | ||
197 | |||
198 | /** | ||
199 | * mei_me_is_ready - check whether the me has turned ready | ||
200 | * | ||
201 | * @dev - mei device | ||
202 | * returns bool | ||
203 | */ | ||
204 | bool mei_me_is_ready(struct mei_device *dev) | ||
205 | { | ||
206 | return (dev->me_hw_state & ME_RDY_HRA) == ME_RDY_HRA; | ||
207 | } | ||
175 | 208 | ||
176 | /** | 209 | /** |
177 | * mei_interrupt_quick_handler - The ISR of the MEI device | 210 | * 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, | |||
290 | dev->host_hw_state |= H_IG; | 323 | dev->host_hw_state |= H_IG; |
291 | mei_hcsr_set(dev); | 324 | mei_hcsr_set(dev); |
292 | dev->me_hw_state = mei_mecsr_read(dev); | 325 | dev->me_hw_state = mei_mecsr_read(dev); |
293 | if ((dev->me_hw_state & ME_RDY_HRA) != ME_RDY_HRA) | 326 | if (!mei_me_is_ready(dev)) |
294 | return -EIO; | 327 | return -EIO; |
295 | 328 | ||
296 | return 0; | 329 | return 0; |