diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2014-08-21 07:29:21 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-09-24 01:57:48 -0400 |
commit | bae1cc7d41fd3048f55c21a6e59c35a3f0abaafe (patch) | |
tree | 368091f74129915864cc221147dafd8439ec0dec /drivers/misc | |
parent | 2af89db1d61a872e5f2f1fb18d44cf5d8f5f6a2a (diff) |
mei: extract supported features from the hbm version
extract supported hbm features and commands from the hbm version
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/mei/hbm.c | 25 | ||||
-rw-r--r-- | drivers/misc/mei/hw-me.c | 6 | ||||
-rw-r--r-- | drivers/misc/mei/mei_dev.h | 4 |
3 files changed, 29 insertions, 6 deletions
diff --git a/drivers/misc/mei/hbm.c b/drivers/misc/mei/hbm.c index 280befc46d11..9fc051b7f1a3 100644 --- a/drivers/misc/mei/hbm.c +++ b/drivers/misc/mei/hbm.c | |||
@@ -372,7 +372,8 @@ static int mei_hbm_prop_req(struct mei_device *dev) | |||
372 | * @dev: the device structure | 372 | * @dev: the device structure |
373 | * @pg_cmd: the pg command code | 373 | * @pg_cmd: the pg command code |
374 | * | 374 | * |
375 | * This function returns -EIO on write failure | 375 | * returns -EIO on write failure |
376 | * -EOPNOTSUPP if the operation is not supported by the protocol | ||
376 | */ | 377 | */ |
377 | int mei_hbm_pg(struct mei_device *dev, u8 pg_cmd) | 378 | int mei_hbm_pg(struct mei_device *dev, u8 pg_cmd) |
378 | { | 379 | { |
@@ -381,6 +382,9 @@ int mei_hbm_pg(struct mei_device *dev, u8 pg_cmd) | |||
381 | const size_t len = sizeof(struct hbm_power_gate); | 382 | const size_t len = sizeof(struct hbm_power_gate); |
382 | int ret; | 383 | int ret; |
383 | 384 | ||
385 | if (!dev->hbm_f_pg_supported) | ||
386 | return -EOPNOTSUPP; | ||
387 | |||
384 | mei_hbm_hdr(mei_hdr, len); | 388 | mei_hbm_hdr(mei_hdr, len); |
385 | 389 | ||
386 | req = (struct hbm_power_gate *)dev->wr_msg.data; | 390 | req = (struct hbm_power_gate *)dev->wr_msg.data; |
@@ -660,6 +664,23 @@ static int mei_hbm_fw_disconnect_req(struct mei_device *dev, | |||
660 | return 0; | 664 | return 0; |
661 | } | 665 | } |
662 | 666 | ||
667 | /** | ||
668 | * mei_hbm_config_features: check what hbm features and commands | ||
669 | * are supported by the fw | ||
670 | * | ||
671 | * @dev: the device structure | ||
672 | */ | ||
673 | static void mei_hbm_config_features(struct mei_device *dev) | ||
674 | { | ||
675 | /* Power Gating Isolation Support */ | ||
676 | dev->hbm_f_pg_supported = 0; | ||
677 | if (dev->version.major_version > HBM_MAJOR_VERSION_PGI) | ||
678 | dev->hbm_f_pg_supported = 1; | ||
679 | |||
680 | if (dev->version.major_version == HBM_MAJOR_VERSION_PGI && | ||
681 | dev->version.minor_version >= HBM_MINOR_VERSION_PGI) | ||
682 | dev->hbm_f_pg_supported = 1; | ||
683 | } | ||
663 | 684 | ||
664 | /** | 685 | /** |
665 | * mei_hbm_version_is_supported - checks whether the driver can | 686 | * mei_hbm_version_is_supported - checks whether the driver can |
@@ -743,6 +764,8 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr) | |||
743 | break; | 764 | break; |
744 | } | 765 | } |
745 | 766 | ||
767 | mei_hbm_config_features(dev); | ||
768 | |||
746 | if (dev->dev_state != MEI_DEV_INIT_CLIENTS || | 769 | if (dev->dev_state != MEI_DEV_INIT_CLIENTS || |
747 | dev->hbm_state != MEI_HBM_STARTING) { | 770 | dev->hbm_state != MEI_HBM_STARTING) { |
748 | dev_err(&dev->pdev->dev, "hbm: start: state mismatch, [%d, %d]\n", | 771 | dev_err(&dev->pdev->dev, "hbm: start: state mismatch, [%d, %d]\n", |
diff --git a/drivers/misc/mei/hw-me.c b/drivers/misc/mei/hw-me.c index caf0da335994..498bd42bca25 100644 --- a/drivers/misc/mei/hw-me.c +++ b/drivers/misc/mei/hw-me.c | |||
@@ -574,11 +574,7 @@ static bool mei_me_pg_is_enabled(struct mei_device *dev) | |||
574 | if ((reg & ME_PGIC_HRA) == 0) | 574 | if ((reg & ME_PGIC_HRA) == 0) |
575 | goto notsupported; | 575 | goto notsupported; |
576 | 576 | ||
577 | if (dev->version.major_version < HBM_MAJOR_VERSION_PGI) | 577 | if (!dev->hbm_f_pg_supported) |
578 | goto notsupported; | ||
579 | |||
580 | if (dev->version.major_version == HBM_MAJOR_VERSION_PGI && | ||
581 | dev->version.minor_version < HBM_MINOR_VERSION_PGI) | ||
582 | goto notsupported; | 578 | goto notsupported; |
583 | 579 | ||
584 | return true; | 580 | return true; |
diff --git a/drivers/misc/mei/mei_dev.h b/drivers/misc/mei/mei_dev.h index 79124ae6a249..719edeeb3ceb 100644 --- a/drivers/misc/mei/mei_dev.h +++ b/drivers/misc/mei/mei_dev.h | |||
@@ -402,6 +402,9 @@ struct mei_cfg { | |||
402 | * | 402 | * |
403 | * @reset_count - limits the number of consecutive resets | 403 | * @reset_count - limits the number of consecutive resets |
404 | * @hbm_state - state of host bus message protocol | 404 | * @hbm_state - state of host bus message protocol |
405 | * | ||
406 | * @hbm_f_pg_supported - hbm feature pgi protocol | ||
407 | * | ||
405 | * @pg_event - power gating event | 408 | * @pg_event - power gating event |
406 | * @mem_addr - mem mapped base register address | 409 | * @mem_addr - mem mapped base register address |
407 | 410 | ||
@@ -476,6 +479,7 @@ struct mei_device { | |||
476 | } wr_msg; | 479 | } wr_msg; |
477 | 480 | ||
478 | struct hbm_version version; | 481 | struct hbm_version version; |
482 | unsigned int hbm_f_pg_supported:1; | ||
479 | 483 | ||
480 | struct list_head me_clients; | 484 | struct list_head me_clients; |
481 | DECLARE_BITMAP(me_clients_map, MEI_CLIENTS_MAX); | 485 | DECLARE_BITMAP(me_clients_map, MEI_CLIENTS_MAX); |