summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/soc/aspeed/aspeed-mctp.c18
-rw-r--r--include/uapi/linux/aspeed-mctp.h8
2 files changed, 25 insertions, 1 deletions
diff --git a/drivers/soc/aspeed/aspeed-mctp.c b/drivers/soc/aspeed/aspeed-mctp.c
index 5073f0e14dc3..befee29501b3 100644
--- a/drivers/soc/aspeed/aspeed-mctp.c
+++ b/drivers/soc/aspeed/aspeed-mctp.c
@@ -1297,6 +1297,20 @@ out:
return ret;
}
+static int aspeed_mctp_set_own_eid(struct aspeed_mctp *priv, void __user *userbuf)
+{
+ struct aspeed_mctp_set_own_eid data;
+
+ if (copy_from_user(&data, userbuf, sizeof(data))) {
+ dev_err(priv->dev, "copy from user failed\n");
+ return -EFAULT;
+ }
+
+ priv->eid = data.eid;
+
+ return 0;
+}
+
static long
aspeed_mctp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
@@ -1350,6 +1364,10 @@ aspeed_mctp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
ret = aspeed_mctp_set_eid_info(priv, userbuf, ASPEED_MCTP_EXTENDED_ADDR_FORMAT);
break;
+ case ASPEED_MCTP_IOCTL_SET_OWN_EID:
+ ret = aspeed_mctp_set_own_eid(priv, userbuf);
+ break;
+
default:
dev_err(priv->dev, "Command not found\n");
ret = -ENOTTY;
diff --git a/include/uapi/linux/aspeed-mctp.h b/include/uapi/linux/aspeed-mctp.h
index d1b253bbe171..ec3a6a0c1357 100644
--- a/include/uapi/linux/aspeed-mctp.h
+++ b/include/uapi/linux/aspeed-mctp.h
@@ -52,6 +52,7 @@
* mappings and return count which is lesser of the two: requested count and existing count
* @ASPEED_MCTP_SET_EID_EXT_INFO: write or overwrite already existing list of
* CPU EID and Domain ID mappings
+ * @ASPEED_MCTP_SET_OWN_EID: write/overwrite own EID information
*/
struct aspeed_mctp_filter_eid {
@@ -101,6 +102,10 @@ struct aspeed_mctp_set_eid_info {
__u16 count;
};
+struct aspeed_mctp_set_own_eid {
+ __u8 eid;
+};
+
#define ASPEED_MCTP_IOCTL_BASE 0x4d
#define ASPEED_MCTP_IOCTL_FILTER_EID \
@@ -125,6 +130,7 @@ struct aspeed_mctp_set_eid_info {
_IOW(ASPEED_MCTP_IOCTL_BASE, 10, struct aspeed_mctp_get_eid_info)
#define ASPEED_MCTP_IOCTL_SET_EID_EXT_INFO \
_IOW(ASPEED_MCTP_IOCTL_BASE, 11, struct aspeed_mctp_set_eid_info)
-
+#define ASPEED_MCTP_IOCTL_SET_OWN_EID \
+ _IOW(ASPEED_MCTP_IOCTL_BASE, 12, struct aspeed_mctp_set_own_eid)
#endif /* _UAPI_LINUX_ASPEED_MCTP_H */