diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2015-09-10 03:18:00 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-09-20 22:30:10 -0400 |
commit | 40b7320ee413d0d1cc89c32c2a757fda56d27708 (patch) | |
tree | 28532e912f62603e3ee2744a4c6773ea0c53961b | |
parent | 59796edcf21c7c19d58a223001f9ed13746c51c2 (diff) |
mei: bus: export client protocol version
export me client protocol version to sysfs and uevent
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | Documentation/ABI/testing/sysfs-bus-mei | 7 | ||||
-rw-r--r-- | drivers/misc/mei/bus.c | 18 | ||||
-rw-r--r-- | drivers/misc/mei/client.h | 12 |
3 files changed, 37 insertions, 0 deletions
diff --git a/Documentation/ABI/testing/sysfs-bus-mei b/Documentation/ABI/testing/sysfs-bus-mei index 20e4d1638bac..6bd45346ac7e 100644 --- a/Documentation/ABI/testing/sysfs-bus-mei +++ b/Documentation/ABI/testing/sysfs-bus-mei | |||
@@ -19,3 +19,10 @@ KernelVersion: 4.2 | |||
19 | Contact: Tomas Winkler <tomas.winkler@intel.com> | 19 | Contact: Tomas Winkler <tomas.winkler@intel.com> |
20 | Description: Stores mei client device uuid | 20 | Description: Stores mei client device uuid |
21 | Format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | 21 | Format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
22 | |||
23 | What: /sys/bus/mei/devices/.../version | ||
24 | Date: Aug 2015 | ||
25 | KernelVersion: 4.3 | ||
26 | Contact: Tomas Winkler <tomas.winkler@intel.com> | ||
27 | Description: Stores mei client protocol version | ||
28 | Format: %d | ||
diff --git a/drivers/misc/mei/bus.c b/drivers/misc/mei/bus.c index e294f70741a0..d92017fa1630 100644 --- a/drivers/misc/mei/bus.c +++ b/drivers/misc/mei/bus.c | |||
@@ -590,6 +590,19 @@ static ssize_t uuid_show(struct device *dev, struct device_attribute *a, | |||
590 | } | 590 | } |
591 | static DEVICE_ATTR_RO(uuid); | 591 | static DEVICE_ATTR_RO(uuid); |
592 | 592 | ||
593 | static ssize_t version_show(struct device *dev, struct device_attribute *a, | ||
594 | char *buf) | ||
595 | { | ||
596 | struct mei_cl_device *cldev = to_mei_cl_device(dev); | ||
597 | u8 version = mei_me_cl_ver(cldev->me_cl); | ||
598 | size_t len; | ||
599 | |||
600 | len = snprintf(buf, PAGE_SIZE, "%02X", version); | ||
601 | |||
602 | return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len; | ||
603 | } | ||
604 | static DEVICE_ATTR_RO(version); | ||
605 | |||
593 | static ssize_t modalias_show(struct device *dev, struct device_attribute *a, | 606 | static ssize_t modalias_show(struct device *dev, struct device_attribute *a, |
594 | char *buf) | 607 | char *buf) |
595 | { | 608 | { |
@@ -605,6 +618,7 @@ static DEVICE_ATTR_RO(modalias); | |||
605 | static struct attribute *mei_cl_dev_attrs[] = { | 618 | static struct attribute *mei_cl_dev_attrs[] = { |
606 | &dev_attr_name.attr, | 619 | &dev_attr_name.attr, |
607 | &dev_attr_uuid.attr, | 620 | &dev_attr_uuid.attr, |
621 | &dev_attr_version.attr, | ||
608 | &dev_attr_modalias.attr, | 622 | &dev_attr_modalias.attr, |
609 | NULL, | 623 | NULL, |
610 | }; | 624 | }; |
@@ -622,6 +636,10 @@ static int mei_cl_device_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
622 | { | 636 | { |
623 | struct mei_cl_device *cldev = to_mei_cl_device(dev); | 637 | struct mei_cl_device *cldev = to_mei_cl_device(dev); |
624 | const uuid_le *uuid = mei_me_cl_uuid(cldev->me_cl); | 638 | const uuid_le *uuid = mei_me_cl_uuid(cldev->me_cl); |
639 | u8 version = mei_me_cl_ver(cldev->me_cl); | ||
640 | |||
641 | if (add_uevent_var(env, "MEI_CL_VERSION=%d", version)) | ||
642 | return -ENOMEM; | ||
625 | 643 | ||
626 | if (add_uevent_var(env, "MEI_CL_UUID=%pUl", uuid)) | 644 | if (add_uevent_var(env, "MEI_CL_UUID=%pUl", uuid)) |
627 | return -ENOMEM; | 645 | return -ENOMEM; |
diff --git a/drivers/misc/mei/client.h b/drivers/misc/mei/client.h index 1c7cad07d731..04e1aa39243f 100644 --- a/drivers/misc/mei/client.h +++ b/drivers/misc/mei/client.h | |||
@@ -68,6 +68,18 @@ static inline const uuid_le *mei_me_cl_uuid(const struct mei_me_client *me_cl) | |||
68 | return &me_cl->props.protocol_name; | 68 | return &me_cl->props.protocol_name; |
69 | } | 69 | } |
70 | 70 | ||
71 | /** | ||
72 | * mei_me_cl_ver - return me client protocol version | ||
73 | * | ||
74 | * @me_cl: me client | ||
75 | * | ||
76 | * Return: me client protocol version | ||
77 | */ | ||
78 | static inline u8 mei_me_cl_ver(const struct mei_me_client *me_cl) | ||
79 | { | ||
80 | return me_cl->props.protocol_version; | ||
81 | } | ||
82 | |||
71 | /* | 83 | /* |
72 | * MEI IO Functions | 84 | * MEI IO Functions |
73 | */ | 85 | */ |