diff options
author | Asai Thambi S P <asamymuthupa@micron.com> | 2012-05-29 21:44:54 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2012-05-31 02:46:50 -0400 |
commit | b77874c9699522540e65aa4291e37a7e43533bf3 (patch) | |
tree | 7da11a926fc8d697e3a475ee662e04f239b9cff5 /drivers/block | |
parent | 8ce800935d074ee4667a6a950fb4784009a969ea (diff) |
mtip32xx: Changes to sysfs entries
* Formatted the output of 'registers' entry
* Added "Commands in Q' to output of 'registers' entry
* Added a new entry 'flags'
Signed-off-by: Asai Thambi S P <asamymuthupa@micron.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/mtip32xx/mtip32xx.c | 76 |
1 files changed, 57 insertions, 19 deletions
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index 29735316730a..264bc77dcb91 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c | |||
@@ -2564,40 +2564,58 @@ static ssize_t mtip_hw_show_registers(struct device *dev, | |||
2564 | int size = 0; | 2564 | int size = 0; |
2565 | int n; | 2565 | int n; |
2566 | 2566 | ||
2567 | size += sprintf(&buf[size], "S ACTive:\n"); | 2567 | size += sprintf(&buf[size], "Hardware\n--------\n"); |
2568 | size += sprintf(&buf[size], "S ACTive : [ 0x"); | ||
2568 | 2569 | ||
2569 | for (n = 0; n < dd->slot_groups; n++) | 2570 | for (n = dd->slot_groups-1; n >= 0; n--) |
2570 | size += sprintf(&buf[size], "0x%08x\n", | 2571 | size += sprintf(&buf[size], "%08X ", |
2571 | readl(dd->port->s_active[n])); | 2572 | readl(dd->port->s_active[n])); |
2572 | 2573 | ||
2573 | size += sprintf(&buf[size], "Command Issue:\n"); | 2574 | size += sprintf(&buf[size], "]\n"); |
2575 | size += sprintf(&buf[size], "Command Issue : [ 0x"); | ||
2574 | 2576 | ||
2575 | for (n = 0; n < dd->slot_groups; n++) | 2577 | for (n = dd->slot_groups-1; n >= 0; n--) |
2576 | size += sprintf(&buf[size], "0x%08x\n", | 2578 | size += sprintf(&buf[size], "%08X ", |
2577 | readl(dd->port->cmd_issue[n])); | 2579 | readl(dd->port->cmd_issue[n])); |
2578 | 2580 | ||
2579 | size += sprintf(&buf[size], "Allocated:\n"); | 2581 | size += sprintf(&buf[size], "]\n"); |
2582 | size += sprintf(&buf[size], "Completed : [ 0x"); | ||
2580 | 2583 | ||
2581 | for (n = 0; n < dd->slot_groups; n++) { | 2584 | for (n = dd->slot_groups-1; n >= 0; n--) |
2585 | size += sprintf(&buf[size], "%08X ", | ||
2586 | readl(dd->port->completed[n])); | ||
2587 | |||
2588 | size += sprintf(&buf[size], "]\n"); | ||
2589 | size += sprintf(&buf[size], "PORT IRQ STAT : [ 0x%08X ]\n", | ||
2590 | readl(dd->port->mmio + PORT_IRQ_STAT)); | ||
2591 | size += sprintf(&buf[size], "HOST IRQ STAT : [ 0x%08X ]\n", | ||
2592 | readl(dd->mmio + HOST_IRQ_STAT)); | ||
2593 | size += sprintf(&buf[size], "\n"); | ||
2594 | |||
2595 | size += sprintf(&buf[size], "Local\n-----\n"); | ||
2596 | size += sprintf(&buf[size], "Allocated : [ 0x"); | ||
2597 | |||
2598 | for (n = dd->slot_groups-1; n >= 0; n--) { | ||
2582 | if (sizeof(long) > sizeof(u32)) | 2599 | if (sizeof(long) > sizeof(u32)) |
2583 | group_allocated = | 2600 | group_allocated = |
2584 | dd->port->allocated[n/2] >> (32*(n&1)); | 2601 | dd->port->allocated[n/2] >> (32*(n&1)); |
2585 | else | 2602 | else |
2586 | group_allocated = dd->port->allocated[n]; | 2603 | group_allocated = dd->port->allocated[n]; |
2587 | size += sprintf(&buf[size], "0x%08x\n", | 2604 | size += sprintf(&buf[size], "%08X ", group_allocated); |
2588 | group_allocated); | ||
2589 | } | 2605 | } |
2606 | size += sprintf(&buf[size], "]\n"); | ||
2590 | 2607 | ||
2591 | size += sprintf(&buf[size], "Completed:\n"); | 2608 | size += sprintf(&buf[size], "Commands in Q: [ 0x"); |
2592 | 2609 | ||
2593 | for (n = 0; n < dd->slot_groups; n++) | 2610 | for (n = dd->slot_groups-1; n >= 0; n--) { |
2594 | size += sprintf(&buf[size], "0x%08x\n", | 2611 | if (sizeof(long) > sizeof(u32)) |
2595 | readl(dd->port->completed[n])); | 2612 | group_allocated = |
2596 | 2613 | dd->port->cmds_to_issue[n/2] >> (32*(n&1)); | |
2597 | size += sprintf(&buf[size], "PORT IRQ STAT : 0x%08x\n", | 2614 | else |
2598 | readl(dd->port->mmio + PORT_IRQ_STAT)); | 2615 | group_allocated = dd->port->cmds_to_issue[n]; |
2599 | size += sprintf(&buf[size], "HOST IRQ STAT : 0x%08x\n", | 2616 | size += sprintf(&buf[size], "%08X ", group_allocated); |
2600 | readl(dd->mmio + HOST_IRQ_STAT)); | 2617 | } |
2618 | size += sprintf(&buf[size], "]\n"); | ||
2601 | 2619 | ||
2602 | return size; | 2620 | return size; |
2603 | } | 2621 | } |
@@ -2619,8 +2637,24 @@ static ssize_t mtip_hw_show_status(struct device *dev, | |||
2619 | return size; | 2637 | return size; |
2620 | } | 2638 | } |
2621 | 2639 | ||
2640 | static ssize_t mtip_hw_show_flags(struct device *dev, | ||
2641 | struct device_attribute *attr, | ||
2642 | char *buf) | ||
2643 | { | ||
2644 | struct driver_data *dd = dev_to_disk(dev)->private_data; | ||
2645 | int size = 0; | ||
2646 | |||
2647 | size += sprintf(&buf[size], "Flag in port struct : [ %08lX ]\n", | ||
2648 | dd->port->flags); | ||
2649 | size += sprintf(&buf[size], "Flag in dd struct : [ %08lX ]\n", | ||
2650 | dd->dd_flag); | ||
2651 | |||
2652 | return size; | ||
2653 | } | ||
2654 | |||
2622 | static DEVICE_ATTR(registers, S_IRUGO, mtip_hw_show_registers, NULL); | 2655 | static DEVICE_ATTR(registers, S_IRUGO, mtip_hw_show_registers, NULL); |
2623 | static DEVICE_ATTR(status, S_IRUGO, mtip_hw_show_status, NULL); | 2656 | static DEVICE_ATTR(status, S_IRUGO, mtip_hw_show_status, NULL); |
2657 | static DEVICE_ATTR(flags, S_IRUGO, mtip_hw_show_flags, NULL); | ||
2624 | 2658 | ||
2625 | /* | 2659 | /* |
2626 | * Create the sysfs related attributes. | 2660 | * Create the sysfs related attributes. |
@@ -2643,6 +2677,9 @@ static int mtip_hw_sysfs_init(struct driver_data *dd, struct kobject *kobj) | |||
2643 | if (sysfs_create_file(kobj, &dev_attr_status.attr)) | 2677 | if (sysfs_create_file(kobj, &dev_attr_status.attr)) |
2644 | dev_warn(&dd->pdev->dev, | 2678 | dev_warn(&dd->pdev->dev, |
2645 | "Error creating 'status' sysfs entry\n"); | 2679 | "Error creating 'status' sysfs entry\n"); |
2680 | if (sysfs_create_file(kobj, &dev_attr_flags.attr)) | ||
2681 | dev_warn(&dd->pdev->dev, | ||
2682 | "Error creating 'flags' sysfs entry\n"); | ||
2646 | return 0; | 2683 | return 0; |
2647 | } | 2684 | } |
2648 | 2685 | ||
@@ -2663,6 +2700,7 @@ static int mtip_hw_sysfs_exit(struct driver_data *dd, struct kobject *kobj) | |||
2663 | 2700 | ||
2664 | sysfs_remove_file(kobj, &dev_attr_registers.attr); | 2701 | sysfs_remove_file(kobj, &dev_attr_registers.attr); |
2665 | sysfs_remove_file(kobj, &dev_attr_status.attr); | 2702 | sysfs_remove_file(kobj, &dev_attr_status.attr); |
2703 | sysfs_remove_file(kobj, &dev_attr_flags.attr); | ||
2666 | 2704 | ||
2667 | return 0; | 2705 | return 0; |
2668 | } | 2706 | } |