aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/mei
diff options
context:
space:
mode:
authorAlexander Usyskin <alexander.usyskin@intel.com>2013-09-15 11:11:07 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-09-26 11:39:27 -0400
commitc0abffbd982ccf9460187206a074e52cb23e8be3 (patch)
tree131fcbc33f58ce635bf8e4cf5160d8d14c26bb6c /drivers/misc/mei
parenta9c8a17aea8ced19598b388db618e9094f3c1245 (diff)
mei: prefix client log messages with client me and host ids
define cl_dbg and cl_err macros that add me and host id prefix for debug and error log messages so we can track for the client context of the flow. Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mei')
-rw-r--r--drivers/misc/mei/client.c43
-rw-r--r--drivers/misc/mei/client.h9
-rw-r--r--drivers/misc/mei/interrupt.c18
3 files changed, 38 insertions, 32 deletions
diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c
index a82b443e4518..bccc3164ea4c 100644
--- a/drivers/misc/mei/client.c
+++ b/drivers/misc/mei/client.c
@@ -187,10 +187,14 @@ int mei_io_cb_alloc_resp_buf(struct mei_cl_cb *cb, size_t length)
187 */ 187 */
188int mei_cl_flush_queues(struct mei_cl *cl) 188int mei_cl_flush_queues(struct mei_cl *cl)
189{ 189{
190 struct mei_device *dev;
191
190 if (WARN_ON(!cl || !cl->dev)) 192 if (WARN_ON(!cl || !cl->dev))
191 return -EINVAL; 193 return -EINVAL;
192 194
193 dev_dbg(&cl->dev->pdev->dev, "remove list entry belonging to cl\n"); 195 dev = cl->dev;
196
197 cl_dbg(dev, cl, "remove list entry belonging to cl\n");
194 mei_io_list_flush(&cl->dev->read_list, cl); 198 mei_io_list_flush(&cl->dev->read_list, cl);
195 mei_io_list_flush(&cl->dev->write_list, cl); 199 mei_io_list_flush(&cl->dev->write_list, cl);
196 mei_io_list_flush(&cl->dev->write_waiting_list, cl); 200 mei_io_list_flush(&cl->dev->write_waiting_list, cl);
@@ -302,7 +306,7 @@ int mei_cl_link(struct mei_cl *cl, int id)
302 306
303 cl->state = MEI_FILE_INITIALIZING; 307 cl->state = MEI_FILE_INITIALIZING;
304 308
305 dev_dbg(&dev->pdev->dev, "link cl host id = %d\n", cl->host_client_id); 309 cl_dbg(dev, cl, "link cl\n");
306 return 0; 310 return 0;
307} 311}
308 312
@@ -328,7 +332,7 @@ int mei_cl_unlink(struct mei_cl *cl)
328 332
329 list_for_each_entry_safe(pos, next, &dev->file_list, link) { 333 list_for_each_entry_safe(pos, next, &dev->file_list, link) {
330 if (cl->host_client_id == pos->host_client_id) { 334 if (cl->host_client_id == pos->host_client_id) {
331 dev_dbg(&dev->pdev->dev, "remove host client = %d, ME client = %d\n", 335 cl_dbg(dev, cl, "remove host client = %d, ME client = %d\n",
332 pos->host_client_id, pos->me_client_id); 336 pos->host_client_id, pos->me_client_id);
333 list_del_init(&pos->link); 337 list_del_init(&pos->link);
334 break; 338 break;
@@ -396,6 +400,8 @@ int mei_cl_disconnect(struct mei_cl *cl)
396 400
397 dev = cl->dev; 401 dev = cl->dev;
398 402
403 cl_dbg(dev, cl, "disconnecting");
404
399 if (cl->state != MEI_FILE_DISCONNECTING) 405 if (cl->state != MEI_FILE_DISCONNECTING)
400 return 0; 406 return 0;
401 407
@@ -408,13 +414,13 @@ int mei_cl_disconnect(struct mei_cl *cl)
408 dev->hbuf_is_ready = false; 414 dev->hbuf_is_ready = false;
409 if (mei_hbm_cl_disconnect_req(dev, cl)) { 415 if (mei_hbm_cl_disconnect_req(dev, cl)) {
410 rets = -ENODEV; 416 rets = -ENODEV;
411 dev_err(&dev->pdev->dev, "failed to disconnect.\n"); 417 cl_err(dev, cl, "failed to disconnect.\n");
412 goto free; 418 goto free;
413 } 419 }
414 mdelay(10); /* Wait for hardware disconnection ready */ 420 mdelay(10); /* Wait for hardware disconnection ready */
415 list_add_tail(&cb->list, &dev->ctrl_rd_list.list); 421 list_add_tail(&cb->list, &dev->ctrl_rd_list.list);
416 } else { 422 } else {
417 dev_dbg(&dev->pdev->dev, "add disconnect cb to control write list\n"); 423 cl_dbg(dev, cl, "add disconnect cb to control write list\n");
418 list_add_tail(&cb->list, &dev->ctrl_wr_list.list); 424 list_add_tail(&cb->list, &dev->ctrl_wr_list.list);
419 425
420 } 426 }
@@ -427,18 +433,17 @@ int mei_cl_disconnect(struct mei_cl *cl)
427 mutex_lock(&dev->device_lock); 433 mutex_lock(&dev->device_lock);
428 if (MEI_FILE_DISCONNECTED == cl->state) { 434 if (MEI_FILE_DISCONNECTED == cl->state) {
429 rets = 0; 435 rets = 0;
430 dev_dbg(&dev->pdev->dev, "successfully disconnected from FW client.\n"); 436 cl_dbg(dev, cl, "successfully disconnected from FW client.\n");
431 } else { 437 } else {
432 rets = -ENODEV; 438 rets = -ENODEV;
433 if (MEI_FILE_DISCONNECTED != cl->state) 439 if (MEI_FILE_DISCONNECTED != cl->state)
434 dev_dbg(&dev->pdev->dev, "wrong status client disconnect.\n"); 440 cl_err(dev, cl, "wrong status client disconnect.\n");
435 441
436 if (err) 442 if (err)
437 dev_dbg(&dev->pdev->dev, 443 cl_dbg(dev, cl, "wait failed disconnect err=%08x\n",
438 "wait failed disconnect err=%08x\n",
439 err); 444 err);
440 445
441 dev_dbg(&dev->pdev->dev, "failed to disconnect from FW client.\n"); 446 cl_err(dev, cl, "failed to disconnect from FW client.\n");
442 } 447 }
443 448
444 mei_io_list_flush(&dev->ctrl_rd_list, cl); 449 mei_io_list_flush(&dev->ctrl_rd_list, cl);
@@ -645,13 +650,12 @@ int mei_cl_read_start(struct mei_cl *cl, size_t length)
645 return -ENODEV; 650 return -ENODEV;
646 651
647 if (cl->read_cb) { 652 if (cl->read_cb) {
648 dev_dbg(&dev->pdev->dev, "read is pending.\n"); 653 cl_dbg(dev, cl, "read is pending.\n");
649 return -EBUSY; 654 return -EBUSY;
650 } 655 }
651 i = mei_me_cl_by_id(dev, cl->me_client_id); 656 i = mei_me_cl_by_id(dev, cl->me_client_id);
652 if (i < 0) { 657 if (i < 0) {
653 dev_err(&dev->pdev->dev, "no such me client %d\n", 658 cl_err(dev, cl, "no such me client %d\n", cl->me_client_id);
654 cl->me_client_id);
655 return -ENODEV; 659 return -ENODEV;
656 } 660 }
657 661
@@ -670,6 +674,7 @@ int mei_cl_read_start(struct mei_cl *cl, size_t length)
670 if (dev->hbuf_is_ready) { 674 if (dev->hbuf_is_ready) {
671 dev->hbuf_is_ready = false; 675 dev->hbuf_is_ready = false;
672 if (mei_hbm_cl_flow_control_req(dev, cl)) { 676 if (mei_hbm_cl_flow_control_req(dev, cl)) {
677 cl_err(dev, cl, "flow control send failed\n");
673 rets = -ENODEV; 678 rets = -ENODEV;
674 goto err; 679 goto err;
675 } 680 }
@@ -720,9 +725,8 @@ int mei_cl_irq_write_complete(struct mei_cl *cl, struct mei_cl_cb *cb,
720 return 0; 725 return 0;
721 } 726 }
722 727
723 dev_dbg(&dev->pdev->dev, "buf: size = %d idx = %lu\n", 728 cl_dbg(dev, cl, "buf: size = %d idx = %lu\n",
724 cb->request_buffer.size, cb->buf_idx); 729 cb->request_buffer.size, cb->buf_idx);
725 dev_dbg(&dev->pdev->dev, MEI_HDR_FMT, MEI_HDR_PRM(&mei_hdr));
726 730
727 *slots -= msg_slots; 731 *slots -= msg_slots;
728 if (mei_write_message(dev, &mei_hdr, 732 if (mei_write_message(dev, &mei_hdr,
@@ -773,7 +777,7 @@ int mei_cl_write(struct mei_cl *cl, struct mei_cl_cb *cb, bool blocking)
773 777
774 buf = &cb->request_buffer; 778 buf = &cb->request_buffer;
775 779
776 dev_dbg(&dev->pdev->dev, "mei_cl_write %d\n", buf->size); 780 cl_dbg(dev, cl, "mei_cl_write %d\n", buf->size);
777 781
778 782
779 cb->fop_type = MEI_FOP_WRITE; 783 cb->fop_type = MEI_FOP_WRITE;
@@ -806,9 +810,6 @@ int mei_cl_write(struct mei_cl *cl, struct mei_cl_cb *cb, bool blocking)
806 mei_hdr.me_addr = cl->me_client_id; 810 mei_hdr.me_addr = cl->me_client_id;
807 mei_hdr.reserved = 0; 811 mei_hdr.reserved = 0;
808 812
809 dev_dbg(&dev->pdev->dev, "write " MEI_HDR_FMT "\n",
810 MEI_HDR_PRM(&mei_hdr));
811
812 813
813 if (mei_write_message(dev, &mei_hdr, buf->data)) { 814 if (mei_write_message(dev, &mei_hdr, buf->data)) {
814 rets = -EIO; 815 rets = -EIO;
@@ -904,11 +905,11 @@ void mei_cl_all_wakeup(struct mei_device *dev)
904 struct mei_cl *cl, *next; 905 struct mei_cl *cl, *next;
905 list_for_each_entry_safe(cl, next, &dev->file_list, link) { 906 list_for_each_entry_safe(cl, next, &dev->file_list, link) {
906 if (waitqueue_active(&cl->rx_wait)) { 907 if (waitqueue_active(&cl->rx_wait)) {
907 dev_dbg(&dev->pdev->dev, "Waking up reading client!\n"); 908 cl_dbg(dev, cl, "Waking up reading client!\n");
908 wake_up_interruptible(&cl->rx_wait); 909 wake_up_interruptible(&cl->rx_wait);
909 } 910 }
910 if (waitqueue_active(&cl->tx_wait)) { 911 if (waitqueue_active(&cl->tx_wait)) {
911 dev_dbg(&dev->pdev->dev, "Waking up writing client!\n"); 912 cl_dbg(dev, cl, "Waking up writing client!\n");
912 wake_up_interruptible(&cl->tx_wait); 913 wake_up_interruptible(&cl->tx_wait);
913 } 914 }
914 } 915 }
diff --git a/drivers/misc/mei/client.h b/drivers/misc/mei/client.h
index 9eb031e92070..6374ed99e233 100644
--- a/drivers/misc/mei/client.h
+++ b/drivers/misc/mei/client.h
@@ -109,4 +109,13 @@ void mei_cl_all_disconnect(struct mei_device *dev);
109void mei_cl_all_wakeup(struct mei_device *dev); 109void mei_cl_all_wakeup(struct mei_device *dev);
110void mei_cl_all_write_clear(struct mei_device *dev); 110void mei_cl_all_write_clear(struct mei_device *dev);
111 111
112#define MEI_CL_FMT "cl:host=%02d me=%02d "
113#define MEI_CL_PRM(cl) (cl)->host_client_id, (cl)->me_client_id
114
115#define cl_dbg(dev, cl, format, arg...) \
116 dev_dbg(&(dev)->pdev->dev, MEI_CL_FMT format, MEI_CL_PRM(cl), ##arg)
117
118#define cl_err(dev, cl, format, arg...) \
119 dev_err(&(dev)->pdev->dev, MEI_CL_FMT format, MEI_CL_PRM(cl), ##arg)
120
112#endif /* _MEI_CLIENT_H_ */ 121#endif /* _MEI_CLIENT_H_ */
diff --git a/drivers/misc/mei/interrupt.c b/drivers/misc/mei/interrupt.c
index 4b59cb742dee..d27804e7d2cd 100644
--- a/drivers/misc/mei/interrupt.c
+++ b/drivers/misc/mei/interrupt.c
@@ -113,13 +113,13 @@ static int mei_cl_irq_read_msg(struct mei_device *dev,
113 113
114 if (cb->response_buffer.size == 0 || 114 if (cb->response_buffer.size == 0 ||
115 cb->response_buffer.data == NULL) { 115 cb->response_buffer.data == NULL) {
116 dev_err(&dev->pdev->dev, "response buffer is not allocated.\n"); 116 cl_err(dev, cl, "response buffer is not allocated.\n");
117 list_del(&cb->list); 117 list_del(&cb->list);
118 return -ENOMEM; 118 return -ENOMEM;
119 } 119 }
120 120
121 if (cb->response_buffer.size < mei_hdr->length + cb->buf_idx) { 121 if (cb->response_buffer.size < mei_hdr->length + cb->buf_idx) {
122 dev_dbg(&dev->pdev->dev, "message overflow. size %d len %d idx %ld\n", 122 cl_dbg(dev, cl, "message overflow. size %d len %d idx %ld\n",
123 cb->response_buffer.size, 123 cb->response_buffer.size,
124 mei_hdr->length, cb->buf_idx); 124 mei_hdr->length, cb->buf_idx);
125 buffer = krealloc(cb->response_buffer.data, 125 buffer = krealloc(cb->response_buffer.data,
@@ -127,7 +127,7 @@ static int mei_cl_irq_read_msg(struct mei_device *dev,
127 GFP_KERNEL); 127 GFP_KERNEL);
128 128
129 if (!buffer) { 129 if (!buffer) {
130 dev_err(&dev->pdev->dev, "allocation failed.\n"); 130 cl_err(dev, cl, "allocation failed.\n");
131 list_del(&cb->list); 131 list_del(&cb->list);
132 return -ENOMEM; 132 return -ENOMEM;
133 } 133 }
@@ -143,9 +143,7 @@ static int mei_cl_irq_read_msg(struct mei_device *dev,
143 if (mei_hdr->msg_complete) { 143 if (mei_hdr->msg_complete) {
144 cl->status = 0; 144 cl->status = 0;
145 list_del(&cb->list); 145 list_del(&cb->list);
146 dev_dbg(&dev->pdev->dev, "completed read H cl = %d, ME cl = %d, length = %lu\n", 146 cl_dbg(dev, cl, "completed read length = %lu\n",
147 cl->host_client_id,
148 cl->me_client_id,
149 cb->buf_idx); 147 cb->buf_idx);
150 list_add_tail(&cb->list, &complete_list->list); 148 list_add_tail(&cb->list, &complete_list->list);
151 } 149 }
@@ -423,12 +421,12 @@ int mei_irq_write_handler(struct mei_device *dev, struct mei_cl_cb *cmpl_list)
423 if (MEI_WRITING == cl->writing_state && 421 if (MEI_WRITING == cl->writing_state &&
424 cb->fop_type == MEI_FOP_WRITE && 422 cb->fop_type == MEI_FOP_WRITE &&
425 cl != &dev->iamthif_cl) { 423 cl != &dev->iamthif_cl) {
426 dev_dbg(&dev->pdev->dev, "MEI WRITE COMPLETE\n"); 424 cl_dbg(dev, cl, "MEI WRITE COMPLETE\n");
427 cl->writing_state = MEI_WRITE_COMPLETE; 425 cl->writing_state = MEI_WRITE_COMPLETE;
428 list_add_tail(&cb->list, &cmpl_list->list); 426 list_add_tail(&cb->list, &cmpl_list->list);
429 } 427 }
430 if (cl == &dev->iamthif_cl) { 428 if (cl == &dev->iamthif_cl) {
431 dev_dbg(&dev->pdev->dev, "check iamthif flow control.\n"); 429 cl_dbg(dev, cl, "check iamthif flow control.\n");
432 if (dev->iamthif_flow_control_pending) { 430 if (dev->iamthif_flow_control_pending) {
433 ret = mei_amthif_irq_read(dev, &slots); 431 ret = mei_amthif_irq_read(dev, &slots);
434 if (ret) 432 if (ret)
@@ -510,9 +508,7 @@ int mei_irq_write_handler(struct mei_device *dev, struct mei_cl_cb *cmpl_list)
510 if (cl == NULL) 508 if (cl == NULL)
511 continue; 509 continue;
512 if (mei_cl_flow_ctrl_creds(cl) <= 0) { 510 if (mei_cl_flow_ctrl_creds(cl) <= 0) {
513 dev_dbg(&dev->pdev->dev, 511 cl_dbg(dev, cl, "No flow control credentials, not sending.\n");
514 "No flow control credentials for client %d, not sending.\n",
515 cl->host_client_id);
516 continue; 512 continue;
517 } 513 }
518 514