summaryrefslogtreecommitdiffstats
path: root/drivers/fpga
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/fpga')
-rw-r--r--drivers/fpga/fpga-mgr.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/fpga/fpga-mgr.c b/drivers/fpga/fpga-mgr.c
index c1564cf827fe..a41b07e37884 100644
--- a/drivers/fpga/fpga-mgr.c
+++ b/drivers/fpga/fpga-mgr.c
@@ -406,12 +406,40 @@ static ssize_t state_show(struct device *dev,
406 return sprintf(buf, "%s\n", state_str[mgr->state]); 406 return sprintf(buf, "%s\n", state_str[mgr->state]);
407} 407}
408 408
409static ssize_t status_show(struct device *dev,
410 struct device_attribute *attr, char *buf)
411{
412 struct fpga_manager *mgr = to_fpga_manager(dev);
413 u64 status;
414 int len = 0;
415
416 if (!mgr->mops->status)
417 return -ENOENT;
418
419 status = mgr->mops->status(mgr);
420
421 if (status & FPGA_MGR_STATUS_OPERATION_ERR)
422 len += sprintf(buf + len, "reconfig operation error\n");
423 if (status & FPGA_MGR_STATUS_CRC_ERR)
424 len += sprintf(buf + len, "reconfig CRC error\n");
425 if (status & FPGA_MGR_STATUS_INCOMPATIBLE_IMAGE_ERR)
426 len += sprintf(buf + len, "reconfig incompatible image\n");
427 if (status & FPGA_MGR_STATUS_IP_PROTOCOL_ERR)
428 len += sprintf(buf + len, "reconfig IP protocol error\n");
429 if (status & FPGA_MGR_STATUS_FIFO_OVERFLOW_ERR)
430 len += sprintf(buf + len, "reconfig fifo overflow error\n");
431
432 return len;
433}
434
409static DEVICE_ATTR_RO(name); 435static DEVICE_ATTR_RO(name);
410static DEVICE_ATTR_RO(state); 436static DEVICE_ATTR_RO(state);
437static DEVICE_ATTR_RO(status);
411 438
412static struct attribute *fpga_mgr_attrs[] = { 439static struct attribute *fpga_mgr_attrs[] = {
413 &dev_attr_name.attr, 440 &dev_attr_name.attr,
414 &dev_attr_state.attr, 441 &dev_attr_state.attr,
442 &dev_attr_status.attr,
415 NULL, 443 NULL,
416}; 444};
417ATTRIBUTE_GROUPS(fpga_mgr); 445ATTRIBUTE_GROUPS(fpga_mgr);