diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2013-06-16 02:16:31 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-06-17 19:43:09 -0400 |
commit | 2c9b48ac3cb2cd2c84c43f235c65b7fc238f6f1f (patch) | |
tree | 9eac8a297ba1c3867f7cf10260aee7580ead7fbf | |
parent | a151427ed086952cc28f1d5f1cda84c33e48e358 (diff) |
mei: support HBM versioning
Driver can work properly if device support driver HBM version
or driver can downgrade its supported HBM version level
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/misc/mei/hbm.c | 37 | ||||
-rw-r--r-- | drivers/misc/mei/hbm.h | 2 | ||||
-rw-r--r-- | drivers/misc/mei/init.c | 3 |
3 files changed, 34 insertions, 8 deletions
diff --git a/drivers/misc/mei/hbm.c b/drivers/misc/mei/hbm.c index 6916045166eb..565027b1bc73 100644 --- a/drivers/misc/mei/hbm.c +++ b/drivers/misc/mei/hbm.c | |||
@@ -536,6 +536,20 @@ static void mei_hbm_fw_disconnect_req(struct mei_device *dev, | |||
536 | 536 | ||
537 | 537 | ||
538 | /** | 538 | /** |
539 | * mei_hbm_version_is_supported - checks whether the driver can | ||
540 | * support the hbm version of the device | ||
541 | * | ||
542 | * @dev: the device structure | ||
543 | * returns true if driver can support hbm version of the device | ||
544 | */ | ||
545 | bool mei_hbm_version_is_supported(struct mei_device *dev) | ||
546 | { | ||
547 | return (dev->version.major_version < HBM_MAJOR_VERSION) || | ||
548 | (dev->version.major_version == HBM_MAJOR_VERSION && | ||
549 | dev->version.minor_version <= HBM_MINOR_VERSION); | ||
550 | } | ||
551 | |||
552 | /** | ||
539 | * mei_hbm_dispatch - bottom half read routine after ISR to | 553 | * mei_hbm_dispatch - bottom half read routine after ISR to |
540 | * handle the read bus message cmd processing. | 554 | * handle the read bus message cmd processing. |
541 | * | 555 | * |
@@ -562,9 +576,24 @@ void mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr) | |||
562 | switch (mei_msg->hbm_cmd) { | 576 | switch (mei_msg->hbm_cmd) { |
563 | case HOST_START_RES_CMD: | 577 | case HOST_START_RES_CMD: |
564 | version_res = (struct hbm_host_version_response *)mei_msg; | 578 | version_res = (struct hbm_host_version_response *)mei_msg; |
565 | if (!version_res->host_version_supported) { | 579 | |
566 | dev->version = version_res->me_max_version; | 580 | dev_dbg(&dev->pdev->dev, "HBM VERSION: DRIVER=%02d:%02d DEVICE=%02d:%02d\n", |
567 | dev_dbg(&dev->pdev->dev, "version mismatch.\n"); | 581 | HBM_MAJOR_VERSION, HBM_MINOR_VERSION, |
582 | version_res->me_max_version.major_version, | ||
583 | version_res->me_max_version.minor_version); | ||
584 | |||
585 | if (version_res->host_version_supported) { | ||
586 | dev->version.major_version = HBM_MAJOR_VERSION; | ||
587 | dev->version.minor_version = HBM_MINOR_VERSION; | ||
588 | } else { | ||
589 | dev->version.major_version = | ||
590 | version_res->me_max_version.major_version; | ||
591 | dev->version.minor_version = | ||
592 | version_res->me_max_version.minor_version; | ||
593 | } | ||
594 | |||
595 | if (!mei_hbm_version_is_supported(dev)) { | ||
596 | dev_warn(&dev->pdev->dev, "hbm version mismatch: stopping the driver.\n"); | ||
568 | 597 | ||
569 | dev->hbm_state = MEI_HBM_STOP; | 598 | dev->hbm_state = MEI_HBM_STOP; |
570 | mei_hbm_stop_req_prepare(dev, &dev->wr_msg.hdr, | 599 | mei_hbm_stop_req_prepare(dev, &dev->wr_msg.hdr, |
@@ -575,8 +604,6 @@ void mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr) | |||
575 | return; | 604 | return; |
576 | } | 605 | } |
577 | 606 | ||
578 | dev->version.major_version = HBM_MAJOR_VERSION; | ||
579 | dev->version.minor_version = HBM_MINOR_VERSION; | ||
580 | if (dev->dev_state == MEI_DEV_INIT_CLIENTS && | 607 | if (dev->dev_state == MEI_DEV_INIT_CLIENTS && |
581 | dev->hbm_state == MEI_HBM_START) { | 608 | dev->hbm_state == MEI_HBM_START) { |
582 | dev->init_clients_timer = 0; | 609 | dev->init_clients_timer = 0; |
diff --git a/drivers/misc/mei/hbm.h b/drivers/misc/mei/hbm.h index e80dc24ef3e2..4ae2e56e404f 100644 --- a/drivers/misc/mei/hbm.h +++ b/drivers/misc/mei/hbm.h | |||
@@ -54,7 +54,7 @@ int mei_hbm_start_wait(struct mei_device *dev); | |||
54 | int mei_hbm_cl_flow_control_req(struct mei_device *dev, struct mei_cl *cl); | 54 | int mei_hbm_cl_flow_control_req(struct mei_device *dev, struct mei_cl *cl); |
55 | int mei_hbm_cl_disconnect_req(struct mei_device *dev, struct mei_cl *cl); | 55 | int mei_hbm_cl_disconnect_req(struct mei_device *dev, struct mei_cl *cl); |
56 | int mei_hbm_cl_connect_req(struct mei_device *dev, struct mei_cl *cl); | 56 | int mei_hbm_cl_connect_req(struct mei_device *dev, struct mei_cl *cl); |
57 | 57 | bool mei_hbm_version_is_supported(struct mei_device *dev); | |
58 | 58 | ||
59 | #endif /* _MEI_HBM_H_ */ | 59 | #endif /* _MEI_HBM_H_ */ |
60 | 60 | ||
diff --git a/drivers/misc/mei/init.c b/drivers/misc/mei/init.c index f580d30bb784..79e9e1c30562 100644 --- a/drivers/misc/mei/init.c +++ b/drivers/misc/mei/init.c | |||
@@ -106,8 +106,7 @@ int mei_start(struct mei_device *dev) | |||
106 | goto err; | 106 | goto err; |
107 | } | 107 | } |
108 | 108 | ||
109 | if (dev->version.major_version != HBM_MAJOR_VERSION || | 109 | if (!mei_hbm_version_is_supported(dev)) { |
110 | dev->version.minor_version != HBM_MINOR_VERSION) { | ||
111 | dev_dbg(&dev->pdev->dev, "MEI start failed.\n"); | 110 | dev_dbg(&dev->pdev->dev, "MEI start failed.\n"); |
112 | goto err; | 111 | goto err; |
113 | } | 112 | } |