diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2014-09-29 09:31:42 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-09-29 11:56:01 -0400 |
commit | 2bf94cabb199f73402a5ddefa4a7bf1a82aaeda5 (patch) | |
tree | 334572e3557836eab69581513b36fc4d7ba9dfdd /drivers/misc/mei/amthif.c | |
parent | 3a7e9b6c661a23429b4a106d1ffa8aa5ce6c62bb (diff) |
mei: get rid of most of the pci dependencies in mei
For purpose of adding testing HW we would like
to get rid of pci dependency in generic mei code
This patch provides only straight forward changes
FW status and prob quirks need to be handled separately
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mei/amthif.c')
-rw-r--r-- | drivers/misc/mei/amthif.c | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/drivers/misc/mei/amthif.c b/drivers/misc/mei/amthif.c index 1f80873c8fe9..5d47d1b36ccf 100644 --- a/drivers/misc/mei/amthif.c +++ b/drivers/misc/mei/amthif.c | |||
@@ -78,7 +78,7 @@ int mei_amthif_host_init(struct mei_device *dev) | |||
78 | 78 | ||
79 | me_cl = mei_me_cl_by_uuid(dev, &mei_amthif_guid); | 79 | me_cl = mei_me_cl_by_uuid(dev, &mei_amthif_guid); |
80 | if (!me_cl) { | 80 | if (!me_cl) { |
81 | dev_info(&dev->pdev->dev, "amthif: failed to find the client"); | 81 | dev_info(dev->dev, "amthif: failed to find the client"); |
82 | return -ENOTTY; | 82 | return -ENOTTY; |
83 | } | 83 | } |
84 | 84 | ||
@@ -88,7 +88,7 @@ int mei_amthif_host_init(struct mei_device *dev) | |||
88 | /* Assign iamthif_mtu to the value received from ME */ | 88 | /* Assign iamthif_mtu to the value received from ME */ |
89 | 89 | ||
90 | dev->iamthif_mtu = me_cl->props.max_msg_length; | 90 | dev->iamthif_mtu = me_cl->props.max_msg_length; |
91 | dev_dbg(&dev->pdev->dev, "IAMTHIF_MTU = %d\n", dev->iamthif_mtu); | 91 | dev_dbg(dev->dev, "IAMTHIF_MTU = %d\n", dev->iamthif_mtu); |
92 | 92 | ||
93 | kfree(dev->iamthif_msg_buf); | 93 | kfree(dev->iamthif_msg_buf); |
94 | dev->iamthif_msg_buf = NULL; | 94 | dev->iamthif_msg_buf = NULL; |
@@ -104,7 +104,7 @@ int mei_amthif_host_init(struct mei_device *dev) | |||
104 | ret = mei_cl_link(cl, MEI_IAMTHIF_HOST_CLIENT_ID); | 104 | ret = mei_cl_link(cl, MEI_IAMTHIF_HOST_CLIENT_ID); |
105 | 105 | ||
106 | if (ret < 0) { | 106 | if (ret < 0) { |
107 | dev_err(&dev->pdev->dev, | 107 | dev_err(dev->dev, |
108 | "amthif: failed link client %d\n", ret); | 108 | "amthif: failed link client %d\n", ret); |
109 | return ret; | 109 | return ret; |
110 | } | 110 | } |
@@ -164,11 +164,11 @@ int mei_amthif_read(struct mei_device *dev, struct file *file, | |||
164 | 164 | ||
165 | /* Only possible if we are in timeout */ | 165 | /* Only possible if we are in timeout */ |
166 | if (!cl) { | 166 | if (!cl) { |
167 | dev_err(&dev->pdev->dev, "bad file ext.\n"); | 167 | dev_err(dev->dev, "bad file ext.\n"); |
168 | return -ETIME; | 168 | return -ETIME; |
169 | } | 169 | } |
170 | 170 | ||
171 | dev_dbg(&dev->pdev->dev, "checking amthif data\n"); | 171 | dev_dbg(dev->dev, "checking amthif data\n"); |
172 | cb = mei_amthif_find_read_list_entry(dev, file); | 172 | cb = mei_amthif_find_read_list_entry(dev, file); |
173 | 173 | ||
174 | /* Check for if we can block or not*/ | 174 | /* Check for if we can block or not*/ |
@@ -176,7 +176,7 @@ int mei_amthif_read(struct mei_device *dev, struct file *file, | |||
176 | return -EAGAIN; | 176 | return -EAGAIN; |
177 | 177 | ||
178 | 178 | ||
179 | dev_dbg(&dev->pdev->dev, "waiting for amthif data\n"); | 179 | dev_dbg(dev->dev, "waiting for amthif data\n"); |
180 | while (cb == NULL) { | 180 | while (cb == NULL) { |
181 | /* unlock the Mutex */ | 181 | /* unlock the Mutex */ |
182 | mutex_unlock(&dev->device_lock); | 182 | mutex_unlock(&dev->device_lock); |
@@ -190,21 +190,21 @@ int mei_amthif_read(struct mei_device *dev, struct file *file, | |||
190 | if (wait_ret) | 190 | if (wait_ret) |
191 | return -ERESTARTSYS; | 191 | return -ERESTARTSYS; |
192 | 192 | ||
193 | dev_dbg(&dev->pdev->dev, "woke up from sleep\n"); | 193 | dev_dbg(dev->dev, "woke up from sleep\n"); |
194 | } | 194 | } |
195 | 195 | ||
196 | 196 | ||
197 | dev_dbg(&dev->pdev->dev, "Got amthif data\n"); | 197 | dev_dbg(dev->dev, "Got amthif data\n"); |
198 | dev->iamthif_timer = 0; | 198 | dev->iamthif_timer = 0; |
199 | 199 | ||
200 | if (cb) { | 200 | if (cb) { |
201 | timeout = cb->read_time + | 201 | timeout = cb->read_time + |
202 | mei_secs_to_jiffies(MEI_IAMTHIF_READ_TIMER); | 202 | mei_secs_to_jiffies(MEI_IAMTHIF_READ_TIMER); |
203 | dev_dbg(&dev->pdev->dev, "amthif timeout = %lud\n", | 203 | dev_dbg(dev->dev, "amthif timeout = %lud\n", |
204 | timeout); | 204 | timeout); |
205 | 205 | ||
206 | if (time_after(jiffies, timeout)) { | 206 | if (time_after(jiffies, timeout)) { |
207 | dev_dbg(&dev->pdev->dev, "amthif Time out\n"); | 207 | dev_dbg(dev->dev, "amthif Time out\n"); |
208 | /* 15 sec for the message has expired */ | 208 | /* 15 sec for the message has expired */ |
209 | list_del(&cb->list); | 209 | list_del(&cb->list); |
210 | rets = -ETIME; | 210 | rets = -ETIME; |
@@ -224,16 +224,16 @@ int mei_amthif_read(struct mei_device *dev, struct file *file, | |||
224 | * remove message from deletion list | 224 | * remove message from deletion list |
225 | */ | 225 | */ |
226 | 226 | ||
227 | dev_dbg(&dev->pdev->dev, "amthif cb->response_buffer size - %d\n", | 227 | dev_dbg(dev->dev, "amthif cb->response_buffer size - %d\n", |
228 | cb->response_buffer.size); | 228 | cb->response_buffer.size); |
229 | dev_dbg(&dev->pdev->dev, "amthif cb->buf_idx - %lu\n", cb->buf_idx); | 229 | dev_dbg(dev->dev, "amthif cb->buf_idx - %lu\n", cb->buf_idx); |
230 | 230 | ||
231 | /* length is being truncated to PAGE_SIZE, however, | 231 | /* length is being truncated to PAGE_SIZE, however, |
232 | * the buf_idx may point beyond */ | 232 | * the buf_idx may point beyond */ |
233 | length = min_t(size_t, length, (cb->buf_idx - *offset)); | 233 | length = min_t(size_t, length, (cb->buf_idx - *offset)); |
234 | 234 | ||
235 | if (copy_to_user(ubuf, cb->response_buffer.data + *offset, length)) { | 235 | if (copy_to_user(ubuf, cb->response_buffer.data + *offset, length)) { |
236 | dev_dbg(&dev->pdev->dev, "failed to copy data to userland\n"); | 236 | dev_dbg(dev->dev, "failed to copy data to userland\n"); |
237 | rets = -EFAULT; | 237 | rets = -EFAULT; |
238 | } else { | 238 | } else { |
239 | rets = length; | 239 | rets = length; |
@@ -243,7 +243,7 @@ int mei_amthif_read(struct mei_device *dev, struct file *file, | |||
243 | } | 243 | } |
244 | } | 244 | } |
245 | free: | 245 | free: |
246 | dev_dbg(&dev->pdev->dev, "free amthif cb memory.\n"); | 246 | dev_dbg(dev->dev, "free amthif cb memory.\n"); |
247 | *offset = 0; | 247 | *offset = 0; |
248 | mei_io_cb_free(cb); | 248 | mei_io_cb_free(cb); |
249 | out: | 249 | out: |
@@ -267,7 +267,7 @@ static int mei_amthif_send_cmd(struct mei_device *dev, struct mei_cl_cb *cb) | |||
267 | if (!dev || !cb) | 267 | if (!dev || !cb) |
268 | return -ENODEV; | 268 | return -ENODEV; |
269 | 269 | ||
270 | dev_dbg(&dev->pdev->dev, "write data to amthif client.\n"); | 270 | dev_dbg(dev->dev, "write data to amthif client.\n"); |
271 | 271 | ||
272 | dev->iamthif_state = MEI_IAMTHIF_WRITING; | 272 | dev->iamthif_state = MEI_IAMTHIF_WRITING; |
273 | dev->iamthif_current_cb = cb; | 273 | dev->iamthif_current_cb = cb; |
@@ -306,12 +306,12 @@ static int mei_amthif_send_cmd(struct mei_device *dev, struct mei_cl_cb *cb) | |||
306 | return -EIO; | 306 | return -EIO; |
307 | dev->iamthif_flow_control_pending = true; | 307 | dev->iamthif_flow_control_pending = true; |
308 | dev->iamthif_state = MEI_IAMTHIF_FLOW_CONTROL; | 308 | dev->iamthif_state = MEI_IAMTHIF_FLOW_CONTROL; |
309 | dev_dbg(&dev->pdev->dev, "add amthif cb to write waiting list\n"); | 309 | dev_dbg(dev->dev, "add amthif cb to write waiting list\n"); |
310 | dev->iamthif_current_cb = cb; | 310 | dev->iamthif_current_cb = cb; |
311 | dev->iamthif_file_object = cb->file_object; | 311 | dev->iamthif_file_object = cb->file_object; |
312 | list_add_tail(&cb->list, &dev->write_waiting_list.list); | 312 | list_add_tail(&cb->list, &dev->write_waiting_list.list); |
313 | } else { | 313 | } else { |
314 | dev_dbg(&dev->pdev->dev, "message does not complete, so add amthif cb to write list.\n"); | 314 | dev_dbg(dev->dev, "message does not complete, so add amthif cb to write list.\n"); |
315 | list_add_tail(&cb->list, &dev->write_list.list); | 315 | list_add_tail(&cb->list, &dev->write_list.list); |
316 | } | 316 | } |
317 | } else { | 317 | } else { |
@@ -344,9 +344,9 @@ int mei_amthif_write(struct mei_device *dev, struct mei_cl_cb *cb) | |||
344 | 344 | ||
345 | if (!list_empty(&dev->amthif_cmd_list.list) || | 345 | if (!list_empty(&dev->amthif_cmd_list.list) || |
346 | dev->iamthif_state != MEI_IAMTHIF_IDLE) { | 346 | dev->iamthif_state != MEI_IAMTHIF_IDLE) { |
347 | dev_dbg(&dev->pdev->dev, | 347 | dev_dbg(dev->dev, |
348 | "amthif state = %d\n", dev->iamthif_state); | 348 | "amthif state = %d\n", dev->iamthif_state); |
349 | dev_dbg(&dev->pdev->dev, "AMTHIF: add cb to the wait list\n"); | 349 | dev_dbg(dev->dev, "AMTHIF: add cb to the wait list\n"); |
350 | list_add_tail(&cb->list, &dev->amthif_cmd_list.list); | 350 | list_add_tail(&cb->list, &dev->amthif_cmd_list.list); |
351 | return 0; | 351 | return 0; |
352 | } | 352 | } |
@@ -376,7 +376,7 @@ void mei_amthif_run_next_cmd(struct mei_device *dev) | |||
376 | dev->iamthif_timer = 0; | 376 | dev->iamthif_timer = 0; |
377 | dev->iamthif_file_object = NULL; | 377 | dev->iamthif_file_object = NULL; |
378 | 378 | ||
379 | dev_dbg(&dev->pdev->dev, "complete amthif cmd_list cb.\n"); | 379 | dev_dbg(dev->dev, "complete amthif cmd_list cb.\n"); |
380 | 380 | ||
381 | list_for_each_entry_safe(cb, next, &dev->amthif_cmd_list.list, list) { | 381 | list_for_each_entry_safe(cb, next, &dev->amthif_cmd_list.list, list) { |
382 | list_del(&cb->list); | 382 | list_del(&cb->list); |
@@ -384,7 +384,7 @@ void mei_amthif_run_next_cmd(struct mei_device *dev) | |||
384 | continue; | 384 | continue; |
385 | status = mei_amthif_send_cmd(dev, cb); | 385 | status = mei_amthif_send_cmd(dev, cb); |
386 | if (status) | 386 | if (status) |
387 | dev_warn(&dev->pdev->dev, "amthif write failed status = %d\n", | 387 | dev_warn(dev->dev, "amthif write failed status = %d\n", |
388 | status); | 388 | status); |
389 | break; | 389 | break; |
390 | } | 390 | } |
@@ -407,7 +407,7 @@ unsigned int mei_amthif_poll(struct mei_device *dev, | |||
407 | dev->iamthif_file_object == file) { | 407 | dev->iamthif_file_object == file) { |
408 | 408 | ||
409 | mask |= (POLLIN | POLLRDNORM); | 409 | mask |= (POLLIN | POLLRDNORM); |
410 | dev_dbg(&dev->pdev->dev, "run next amthif cb\n"); | 410 | dev_dbg(dev->dev, "run next amthif cb\n"); |
411 | mei_amthif_run_next_cmd(dev); | 411 | mei_amthif_run_next_cmd(dev); |
412 | } | 412 | } |
413 | mutex_unlock(&dev->device_lock); | 413 | mutex_unlock(&dev->device_lock); |
@@ -467,7 +467,7 @@ int mei_amthif_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb, | |||
467 | return 0; | 467 | return 0; |
468 | } | 468 | } |
469 | 469 | ||
470 | dev_dbg(&dev->pdev->dev, MEI_HDR_FMT, MEI_HDR_PRM(&mei_hdr)); | 470 | dev_dbg(dev->dev, MEI_HDR_FMT, MEI_HDR_PRM(&mei_hdr)); |
471 | 471 | ||
472 | rets = mei_write_message(dev, &mei_hdr, | 472 | rets = mei_write_message(dev, &mei_hdr, |
473 | dev->iamthif_msg_buf + dev->iamthif_msg_buf_index); | 473 | dev->iamthif_msg_buf + dev->iamthif_msg_buf_index); |
@@ -529,10 +529,10 @@ int mei_amthif_irq_read_msg(struct mei_device *dev, | |||
529 | if (!mei_hdr->msg_complete) | 529 | if (!mei_hdr->msg_complete) |
530 | return 0; | 530 | return 0; |
531 | 531 | ||
532 | dev_dbg(&dev->pdev->dev, "amthif_message_buffer_index =%d\n", | 532 | dev_dbg(dev->dev, "amthif_message_buffer_index =%d\n", |
533 | mei_hdr->length); | 533 | mei_hdr->length); |
534 | 534 | ||
535 | dev_dbg(&dev->pdev->dev, "completed amthif read.\n "); | 535 | dev_dbg(dev->dev, "completed amthif read.\n "); |
536 | if (!dev->iamthif_current_cb) | 536 | if (!dev->iamthif_current_cb) |
537 | return -ENODEV; | 537 | return -ENODEV; |
538 | 538 | ||
@@ -547,8 +547,8 @@ int mei_amthif_irq_read_msg(struct mei_device *dev, | |||
547 | cb->read_time = jiffies; | 547 | cb->read_time = jiffies; |
548 | if (dev->iamthif_ioctl) { | 548 | if (dev->iamthif_ioctl) { |
549 | /* found the iamthif cb */ | 549 | /* found the iamthif cb */ |
550 | dev_dbg(&dev->pdev->dev, "complete the amthif read cb.\n "); | 550 | dev_dbg(dev->dev, "complete the amthif read cb.\n "); |
551 | dev_dbg(&dev->pdev->dev, "add the amthif read cb to complete.\n "); | 551 | dev_dbg(dev->dev, "add the amthif read cb to complete.\n "); |
552 | list_add_tail(&cb->list, &complete_list->list); | 552 | list_add_tail(&cb->list, &complete_list->list); |
553 | } | 553 | } |
554 | return 0; | 554 | return 0; |
@@ -572,11 +572,11 @@ int mei_amthif_irq_read(struct mei_device *dev, s32 *slots) | |||
572 | *slots -= msg_slots; | 572 | *slots -= msg_slots; |
573 | 573 | ||
574 | if (mei_hbm_cl_flow_control_req(dev, &dev->iamthif_cl)) { | 574 | if (mei_hbm_cl_flow_control_req(dev, &dev->iamthif_cl)) { |
575 | dev_dbg(&dev->pdev->dev, "iamthif flow control failed\n"); | 575 | dev_dbg(dev->dev, "iamthif flow control failed\n"); |
576 | return -EIO; | 576 | return -EIO; |
577 | } | 577 | } |
578 | 578 | ||
579 | dev_dbg(&dev->pdev->dev, "iamthif flow control success\n"); | 579 | dev_dbg(dev->dev, "iamthif flow control success\n"); |
580 | dev->iamthif_state = MEI_IAMTHIF_READING; | 580 | dev->iamthif_state = MEI_IAMTHIF_READING; |
581 | dev->iamthif_flow_control_pending = false; | 581 | dev->iamthif_flow_control_pending = false; |
582 | dev->iamthif_msg_buf_index = 0; | 582 | dev->iamthif_msg_buf_index = 0; |
@@ -601,15 +601,15 @@ void mei_amthif_complete(struct mei_device *dev, struct mei_cl_cb *cb) | |||
601 | dev->iamthif_msg_buf, | 601 | dev->iamthif_msg_buf, |
602 | dev->iamthif_msg_buf_index); | 602 | dev->iamthif_msg_buf_index); |
603 | list_add_tail(&cb->list, &dev->amthif_rd_complete_list.list); | 603 | list_add_tail(&cb->list, &dev->amthif_rd_complete_list.list); |
604 | dev_dbg(&dev->pdev->dev, "amthif read completed\n"); | 604 | dev_dbg(dev->dev, "amthif read completed\n"); |
605 | dev->iamthif_timer = jiffies; | 605 | dev->iamthif_timer = jiffies; |
606 | dev_dbg(&dev->pdev->dev, "dev->iamthif_timer = %ld\n", | 606 | dev_dbg(dev->dev, "dev->iamthif_timer = %ld\n", |
607 | dev->iamthif_timer); | 607 | dev->iamthif_timer); |
608 | } else { | 608 | } else { |
609 | mei_amthif_run_next_cmd(dev); | 609 | mei_amthif_run_next_cmd(dev); |
610 | } | 610 | } |
611 | 611 | ||
612 | dev_dbg(&dev->pdev->dev, "completing amthif call back.\n"); | 612 | dev_dbg(dev->dev, "completing amthif call back.\n"); |
613 | wake_up_interruptible(&dev->iamthif_cl.wait); | 613 | wake_up_interruptible(&dev->iamthif_cl.wait); |
614 | } | 614 | } |
615 | 615 | ||
@@ -715,11 +715,11 @@ int mei_amthif_release(struct mei_device *dev, struct file *file) | |||
715 | if (dev->iamthif_file_object == file && | 715 | if (dev->iamthif_file_object == file && |
716 | dev->iamthif_state != MEI_IAMTHIF_IDLE) { | 716 | dev->iamthif_state != MEI_IAMTHIF_IDLE) { |
717 | 717 | ||
718 | dev_dbg(&dev->pdev->dev, "amthif canceled iamthif state %d\n", | 718 | dev_dbg(dev->dev, "amthif canceled iamthif state %d\n", |
719 | dev->iamthif_state); | 719 | dev->iamthif_state); |
720 | dev->iamthif_canceled = true; | 720 | dev->iamthif_canceled = true; |
721 | if (dev->iamthif_state == MEI_IAMTHIF_READ_COMPLETE) { | 721 | if (dev->iamthif_state == MEI_IAMTHIF_READ_COMPLETE) { |
722 | dev_dbg(&dev->pdev->dev, "run next amthif iamthif cb\n"); | 722 | dev_dbg(dev->dev, "run next amthif iamthif cb\n"); |
723 | mei_amthif_run_next_cmd(dev); | 723 | mei_amthif_run_next_cmd(dev); |
724 | } | 724 | } |
725 | } | 725 | } |