diff options
author | Alexander Usyskin <alexander.usyskin@intel.com> | 2016-10-29 19:42:18 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-10-31 06:00:09 -0400 |
commit | 88d1bece891f85523048de208906258d63678d11 (patch) | |
tree | 9b85ee7b1ece180ac36072a040eda482cc28085c /drivers/misc | |
parent | d3f45647a427ddbb7ac763ed512eab8b809443e8 (diff) |
mei: show the HBM protocol versions in the device attributes
The HBM protocol version is negotiated during the setup phase, then settled
on a highest possible common version of the driver and the firmware.
The sysfs API advertises both negotiated and driver supported versions
in the device attributes.
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')
-rw-r--r-- | drivers/misc/mei/main.c | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c index fa50635512e8..a1484574cfa8 100644 --- a/drivers/misc/mei/main.c +++ b/drivers/misc/mei/main.c | |||
@@ -653,7 +653,7 @@ static int mei_fasync(int fd, struct file *file, int band) | |||
653 | } | 653 | } |
654 | 654 | ||
655 | /** | 655 | /** |
656 | * fw_status_show - mei device attribute show method | 656 | * fw_status_show - mei device fw_status attribute show method |
657 | * | 657 | * |
658 | * @device: device pointer | 658 | * @device: device pointer |
659 | * @attr: attribute pointer | 659 | * @attr: attribute pointer |
@@ -684,8 +684,49 @@ static ssize_t fw_status_show(struct device *device, | |||
684 | } | 684 | } |
685 | static DEVICE_ATTR_RO(fw_status); | 685 | static DEVICE_ATTR_RO(fw_status); |
686 | 686 | ||
687 | /** | ||
688 | * hbm_ver_show - display HBM protocol version negotiated with FW | ||
689 | * | ||
690 | * @device: device pointer | ||
691 | * @attr: attribute pointer | ||
692 | * @buf: char out buffer | ||
693 | * | ||
694 | * Return: number of the bytes printed into buf or error | ||
695 | */ | ||
696 | static ssize_t hbm_ver_show(struct device *device, | ||
697 | struct device_attribute *attr, char *buf) | ||
698 | { | ||
699 | struct mei_device *dev = dev_get_drvdata(device); | ||
700 | struct hbm_version ver; | ||
701 | |||
702 | mutex_lock(&dev->device_lock); | ||
703 | ver = dev->version; | ||
704 | mutex_unlock(&dev->device_lock); | ||
705 | |||
706 | return sprintf(buf, "%u.%u\n", ver.major_version, ver.minor_version); | ||
707 | } | ||
708 | static DEVICE_ATTR_RO(hbm_ver); | ||
709 | |||
710 | /** | ||
711 | * hbm_ver_drv_show - display HBM protocol version advertised by driver | ||
712 | * | ||
713 | * @device: device pointer | ||
714 | * @attr: attribute pointer | ||
715 | * @buf: char out buffer | ||
716 | * | ||
717 | * Return: number of the bytes printed into buf or error | ||
718 | */ | ||
719 | static ssize_t hbm_ver_drv_show(struct device *device, | ||
720 | struct device_attribute *attr, char *buf) | ||
721 | { | ||
722 | return sprintf(buf, "%u.%u\n", HBM_MAJOR_VERSION, HBM_MINOR_VERSION); | ||
723 | } | ||
724 | static DEVICE_ATTR_RO(hbm_ver_drv); | ||
725 | |||
687 | static struct attribute *mei_attrs[] = { | 726 | static struct attribute *mei_attrs[] = { |
688 | &dev_attr_fw_status.attr, | 727 | &dev_attr_fw_status.attr, |
728 | &dev_attr_hbm_ver.attr, | ||
729 | &dev_attr_hbm_ver_drv.attr, | ||
689 | NULL | 730 | NULL |
690 | }; | 731 | }; |
691 | ATTRIBUTE_GROUPS(mei); | 732 | ATTRIBUTE_GROUPS(mei); |