diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2014-02-12 14:41:52 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-02-14 14:12:46 -0500 |
commit | 6bb948c9e500d24321c36c67c81daf8d1a7e561e (patch) | |
tree | bd45c66165b1e42c0eed0cc64b15aa75345d9a34 /drivers/misc/mei/hbm.c | |
parent | 02a7eecc6ee565f5f3af836d56fe25bafcc49c98 (diff) |
mei: get rid of ext_msg
Use more standard message writing for
oob data.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mei/hbm.c')
-rw-r--r-- | drivers/misc/mei/hbm.c | 64 |
1 files changed, 45 insertions, 19 deletions
diff --git a/drivers/misc/mei/hbm.c b/drivers/misc/mei/hbm.c index 0c770255bf89..d3fcb23bb081 100644 --- a/drivers/misc/mei/hbm.c +++ b/drivers/misc/mei/hbm.c | |||
@@ -283,17 +283,18 @@ static int mei_hbm_prop_req(struct mei_device *dev) | |||
283 | } | 283 | } |
284 | 284 | ||
285 | /** | 285 | /** |
286 | * mei_hbm_stop_req_prepare - prepare stop request message | 286 | * mei_hbm_stop_req - send stop request message |
287 | * | 287 | * |
288 | * @dev - mei device | 288 | * @dev - mei device |
289 | * @mei_hdr - mei message header | 289 | * @cl: client info |
290 | * @data - hbm message body buffer | 290 | * |
291 | * This function returns -EIO on write failure | ||
291 | */ | 292 | */ |
292 | static void mei_hbm_stop_req_prepare(struct mei_device *dev, | 293 | static int mei_hbm_stop_req(struct mei_device *dev) |
293 | struct mei_msg_hdr *mei_hdr, unsigned char *data) | ||
294 | { | 294 | { |
295 | struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr; | ||
295 | struct hbm_host_stop_request *req = | 296 | struct hbm_host_stop_request *req = |
296 | (struct hbm_host_stop_request *)data; | 297 | (struct hbm_host_stop_request *)dev->wr_msg.data; |
297 | const size_t len = sizeof(struct hbm_host_stop_request); | 298 | const size_t len = sizeof(struct hbm_host_stop_request); |
298 | 299 | ||
299 | mei_hbm_hdr(mei_hdr, len); | 300 | mei_hbm_hdr(mei_hdr, len); |
@@ -301,6 +302,8 @@ static void mei_hbm_stop_req_prepare(struct mei_device *dev, | |||
301 | memset(req, 0, len); | 302 | memset(req, 0, len); |
302 | req->hbm_cmd = HOST_STOP_REQ_CMD; | 303 | req->hbm_cmd = HOST_STOP_REQ_CMD; |
303 | req->reason = DRIVER_STOP_REQUEST; | 304 | req->reason = DRIVER_STOP_REQUEST; |
305 | |||
306 | return mei_write_message(dev, mei_hdr, dev->wr_msg.data); | ||
304 | } | 307 | } |
305 | 308 | ||
306 | /** | 309 | /** |
@@ -405,6 +408,25 @@ int mei_hbm_cl_disconnect_req(struct mei_device *dev, struct mei_cl *cl) | |||
405 | } | 408 | } |
406 | 409 | ||
407 | /** | 410 | /** |
411 | * mei_hbm_cl_disconnect_rsp - sends disconnect respose to the FW | ||
412 | * | ||
413 | * @dev: the device structure | ||
414 | * @cl: a client to disconnect from | ||
415 | * | ||
416 | * This function returns -EIO on write failure | ||
417 | */ | ||
418 | int mei_hbm_cl_disconnect_rsp(struct mei_device *dev, struct mei_cl *cl) | ||
419 | { | ||
420 | struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr; | ||
421 | const size_t len = sizeof(struct hbm_client_connect_response); | ||
422 | |||
423 | mei_hbm_hdr(mei_hdr, len); | ||
424 | mei_hbm_cl_hdr(cl, CLIENT_DISCONNECT_RES_CMD, dev->wr_msg.data, len); | ||
425 | |||
426 | return mei_write_message(dev, mei_hdr, dev->wr_msg.data); | ||
427 | } | ||
428 | |||
429 | /** | ||
408 | * mei_hbm_cl_disconnect_res - disconnect response from ME | 430 | * mei_hbm_cl_disconnect_res - disconnect response from ME |
409 | * | 431 | * |
410 | * @dev: the device structure | 432 | * @dev: the device structure |
@@ -525,12 +547,14 @@ static void mei_hbm_cl_connect_res(struct mei_device *dev, | |||
525 | * | 547 | * |
526 | * @dev: the device structure. | 548 | * @dev: the device structure. |
527 | * @disconnect_req: disconnect request bus message from the me | 549 | * @disconnect_req: disconnect request bus message from the me |
550 | * | ||
551 | * returns -ENOMEM on allocation failure | ||
528 | */ | 552 | */ |
529 | static void mei_hbm_fw_disconnect_req(struct mei_device *dev, | 553 | static int mei_hbm_fw_disconnect_req(struct mei_device *dev, |
530 | struct hbm_client_connect_request *disconnect_req) | 554 | struct hbm_client_connect_request *disconnect_req) |
531 | { | 555 | { |
532 | struct mei_cl *cl, *next; | 556 | struct mei_cl *cl, *next; |
533 | const size_t len = sizeof(struct hbm_client_connect_response); | 557 | struct mei_cl_cb *cb; |
534 | 558 | ||
535 | list_for_each_entry_safe(cl, next, &dev->file_list, link) { | 559 | list_for_each_entry_safe(cl, next, &dev->file_list, link) { |
536 | if (mei_hbm_cl_addr_equal(cl, disconnect_req)) { | 560 | if (mei_hbm_cl_addr_equal(cl, disconnect_req)) { |
@@ -544,13 +568,17 @@ static void mei_hbm_fw_disconnect_req(struct mei_device *dev, | |||
544 | else if (cl == &dev->iamthif_cl) | 568 | else if (cl == &dev->iamthif_cl) |
545 | dev->iamthif_timer = 0; | 569 | dev->iamthif_timer = 0; |
546 | 570 | ||
547 | /* prepare disconnect response */ | 571 | cb = mei_io_cb_init(cl, NULL); |
548 | mei_hbm_hdr(&dev->wr_ext_msg.hdr, len); | 572 | if (!cb) |
549 | mei_hbm_cl_hdr(cl, CLIENT_DISCONNECT_RES_CMD, | 573 | return -ENOMEM; |
550 | dev->wr_ext_msg.data, len); | 574 | cb->fop_type = MEI_FOP_DISCONNECT_RSP; |
575 | cl_dbg(dev, cl, "add disconnect response as first\n"); | ||
576 | list_add(&cb->list, &dev->ctrl_wr_list.list); | ||
577 | |||
551 | break; | 578 | break; |
552 | } | 579 | } |
553 | } | 580 | } |
581 | return 0; | ||
554 | } | 582 | } |
555 | 583 | ||
556 | 584 | ||
@@ -629,10 +657,7 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr) | |||
629 | dev_warn(&dev->pdev->dev, "hbm: start: version mismatch - stopping the driver.\n"); | 657 | dev_warn(&dev->pdev->dev, "hbm: start: version mismatch - stopping the driver.\n"); |
630 | 658 | ||
631 | dev->hbm_state = MEI_HBM_STOPPED; | 659 | dev->hbm_state = MEI_HBM_STOPPED; |
632 | mei_hbm_stop_req_prepare(dev, &dev->wr_msg.hdr, | 660 | if (mei_hbm_stop_req(dev)) { |
633 | dev->wr_msg.data); | ||
634 | if (mei_write_message(dev, &dev->wr_msg.hdr, | ||
635 | dev->wr_msg.data)) { | ||
636 | dev_err(&dev->pdev->dev, "hbm: start: failed to send stop request\n"); | 661 | dev_err(&dev->pdev->dev, "hbm: start: failed to send stop request\n"); |
637 | return -EIO; | 662 | return -EIO; |
638 | } | 663 | } |
@@ -778,10 +803,11 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr) | |||
778 | 803 | ||
779 | case ME_STOP_REQ_CMD: | 804 | case ME_STOP_REQ_CMD: |
780 | dev_dbg(&dev->pdev->dev, "hbm: stop request: message received\n"); | 805 | dev_dbg(&dev->pdev->dev, "hbm: stop request: message received\n"); |
781 | |||
782 | dev->hbm_state = MEI_HBM_STOPPED; | 806 | dev->hbm_state = MEI_HBM_STOPPED; |
783 | mei_hbm_stop_req_prepare(dev, &dev->wr_ext_msg.hdr, | 807 | if (mei_hbm_stop_req(dev)) { |
784 | dev->wr_ext_msg.data); | 808 | dev_err(&dev->pdev->dev, "hbm: start: failed to send stop request\n"); |
809 | return -EIO; | ||
810 | } | ||
785 | break; | 811 | break; |
786 | default: | 812 | default: |
787 | BUG(); | 813 | BUG(); |