diff options
author | Samuel Ortiz <sameo@linux.intel.com> | 2012-11-18 08:13:20 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-11-21 15:43:58 -0500 |
commit | c1174c0edf546805a0ebc10d5d6154edbb56e1cf (patch) | |
tree | f1cc9084b89fa8965db5759d84e3094967575b3a /drivers/misc/mei/interrupt.c | |
parent | be9d87a790765bcc85d8bdab8a9be31cf7457b28 (diff) |
mei: Simplify the ME client enumeration code
After enumerating all ME clients we call the client init functions for
all matching UUIDs from a separate context.
This remove the hackish cascading client initialisation process that was
interleaving properties and connection command replies.
Signed-off-by: Samuel Ortiz <sameo@linux.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/interrupt.c')
-rw-r--r-- | drivers/misc/mei/interrupt.c | 75 |
1 files changed, 23 insertions, 52 deletions
diff --git a/drivers/misc/mei/interrupt.c b/drivers/misc/mei/interrupt.c index e5aa0ed3b8eb..04fa2134615e 100644 --- a/drivers/misc/mei/interrupt.c +++ b/drivers/misc/mei/interrupt.c | |||
@@ -252,8 +252,6 @@ static void mei_client_connect_response(struct mei_device *dev, | |||
252 | dev_dbg(&dev->pdev->dev, "successfully connected to WD client.\n"); | 252 | dev_dbg(&dev->pdev->dev, "successfully connected to WD client.\n"); |
253 | mei_watchdog_register(dev); | 253 | mei_watchdog_register(dev); |
254 | 254 | ||
255 | /* next step in the state maching */ | ||
256 | mei_amthif_host_init(dev); | ||
257 | return; | 255 | return; |
258 | } | 256 | } |
259 | 257 | ||
@@ -470,6 +468,7 @@ static void mei_irq_thread_read_bus_message(struct mei_device *dev, | |||
470 | struct mei_msg_hdr *mei_hdr) | 468 | struct mei_msg_hdr *mei_hdr) |
471 | { | 469 | { |
472 | struct mei_bus_message *mei_msg; | 470 | struct mei_bus_message *mei_msg; |
471 | struct mei_me_client *me_client; | ||
473 | struct hbm_host_version_response *version_res; | 472 | struct hbm_host_version_response *version_res; |
474 | struct hbm_client_connect_response *connect_res; | 473 | struct hbm_client_connect_response *connect_res; |
475 | struct hbm_client_connect_response *disconnect_res; | 474 | struct hbm_client_connect_response *disconnect_res; |
@@ -478,8 +477,6 @@ static void mei_irq_thread_read_bus_message(struct mei_device *dev, | |||
478 | struct hbm_props_response *props_res; | 477 | struct hbm_props_response *props_res; |
479 | struct hbm_host_enum_response *enum_res; | 478 | struct hbm_host_enum_response *enum_res; |
480 | struct hbm_host_stop_request *stop_req; | 479 | struct hbm_host_stop_request *stop_req; |
481 | int res; | ||
482 | |||
483 | 480 | ||
484 | /* read the message to our buffer */ | 481 | /* read the message to our buffer */ |
485 | BUG_ON(mei_hdr->length >= sizeof(dev->rd_msg_buf)); | 482 | BUG_ON(mei_hdr->length >= sizeof(dev->rd_msg_buf)); |
@@ -547,64 +544,37 @@ static void mei_irq_thread_read_bus_message(struct mei_device *dev, | |||
547 | 544 | ||
548 | case HOST_CLIENT_PROPERTIES_RES_CMD: | 545 | case HOST_CLIENT_PROPERTIES_RES_CMD: |
549 | props_res = (struct hbm_props_response *)mei_msg; | 546 | props_res = (struct hbm_props_response *)mei_msg; |
547 | me_client = &dev->me_clients[dev->me_client_presentation_num]; | ||
548 | |||
550 | if (props_res->status || !dev->me_clients) { | 549 | if (props_res->status || !dev->me_clients) { |
551 | dev_dbg(&dev->pdev->dev, "reset due to received host client properties response bus message wrong status.\n"); | 550 | dev_dbg(&dev->pdev->dev, "reset due to received host client properties response bus message wrong status.\n"); |
552 | mei_reset(dev, 1); | 551 | mei_reset(dev, 1); |
553 | return; | 552 | return; |
554 | } | 553 | } |
555 | if (dev->me_clients[dev->me_client_presentation_num] | ||
556 | .client_id == props_res->address) { | ||
557 | 554 | ||
558 | dev->me_clients[dev->me_client_presentation_num].props | 555 | if (me_client->client_id != props_res->address) { |
559 | = props_res->client_properties; | 556 | dev_err(&dev->pdev->dev, |
557 | "Host client properties reply mismatch\n"); | ||
558 | mei_reset(dev, 1); | ||
560 | 559 | ||
561 | if (dev->dev_state == MEI_DEV_INIT_CLIENTS && | 560 | return; |
562 | dev->init_clients_state == | 561 | } |
563 | MEI_CLIENT_PROPERTIES_MESSAGE) { | ||
564 | dev->me_client_index++; | ||
565 | dev->me_client_presentation_num++; | ||
566 | |||
567 | /** Send Client Properties request **/ | ||
568 | res = mei_host_client_properties(dev); | ||
569 | if (res < 0) { | ||
570 | dev_dbg(&dev->pdev->dev, "mei_host_client_properties() failed"); | ||
571 | return; | ||
572 | } else if (!res) { | ||
573 | /* | ||
574 | * No more clients to send to. | ||
575 | * Clear Map for indicating now ME clients | ||
576 | * with associated host client | ||
577 | */ | ||
578 | bitmap_zero(dev->host_clients_map, MEI_CLIENTS_MAX); | ||
579 | dev->open_handle_count = 0; | ||
580 | |||
581 | /* | ||
582 | * Reserving the first three client IDs | ||
583 | * Client Id 0 - Reserved for MEI Bus Message communications | ||
584 | * Client Id 1 - Reserved for Watchdog | ||
585 | * Client ID 2 - Reserved for AMTHI | ||
586 | */ | ||
587 | bitmap_set(dev->host_clients_map, 0, 3); | ||
588 | dev->dev_state = MEI_DEV_ENABLED; | ||
589 | |||
590 | /* if wd initialization fails, initialization the AMTHI client, | ||
591 | * otherwise the AMTHI client will be initialized after the WD client connect response | ||
592 | * will be received | ||
593 | */ | ||
594 | if (mei_wd_host_init(dev)) | ||
595 | mei_amthif_host_init(dev); | ||
596 | } | ||
597 | 562 | ||
598 | } else { | 563 | if (dev->dev_state != MEI_DEV_INIT_CLIENTS || |
599 | dev_dbg(&dev->pdev->dev, "reset due to received host client properties response bus message"); | 564 | dev->init_clients_state != MEI_CLIENT_PROPERTIES_MESSAGE) { |
600 | mei_reset(dev, 1); | 565 | dev_err(&dev->pdev->dev, |
601 | return; | 566 | "Unexpected client properties reply\n"); |
602 | } | ||
603 | } else { | ||
604 | dev_dbg(&dev->pdev->dev, "reset due to received host client properties response bus message for wrong client ID\n"); | ||
605 | mei_reset(dev, 1); | 567 | mei_reset(dev, 1); |
568 | |||
606 | return; | 569 | return; |
607 | } | 570 | } |
571 | |||
572 | me_client->props = props_res->client_properties; | ||
573 | dev->me_client_index++; | ||
574 | dev->me_client_presentation_num++; | ||
575 | |||
576 | mei_host_client_enumerate(dev); | ||
577 | |||
608 | break; | 578 | break; |
609 | 579 | ||
610 | case HOST_ENUM_RES_CMD: | 580 | case HOST_ENUM_RES_CMD: |
@@ -618,7 +588,8 @@ static void mei_irq_thread_read_bus_message(struct mei_device *dev, | |||
618 | mei_allocate_me_clients_storage(dev); | 588 | mei_allocate_me_clients_storage(dev); |
619 | dev->init_clients_state = | 589 | dev->init_clients_state = |
620 | MEI_CLIENT_PROPERTIES_MESSAGE; | 590 | MEI_CLIENT_PROPERTIES_MESSAGE; |
621 | mei_host_client_properties(dev); | 591 | |
592 | mei_host_client_enumerate(dev); | ||
622 | } else { | 593 | } else { |
623 | dev_dbg(&dev->pdev->dev, "reset due to received host enumeration clients response bus message.\n"); | 594 | dev_dbg(&dev->pdev->dev, "reset due to received host enumeration clients response bus message.\n"); |
624 | mei_reset(dev, 1); | 595 | mei_reset(dev, 1); |