Skip to content

Commit b77874c

Browse files
asaithambiaxboe
authored andcommitted
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 <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 8ce8009 commit b77874c

File tree

2 files changed

+67
-21
lines changed

2 files changed

+67
-21
lines changed

Documentation/ABI/testing/sysfs-block-rssd

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,21 @@ Description: This is a read-only file. Dumps below driver information and
66
hardware registers.
77
- S ACTive
88
- Command Issue
9-
- Allocated
109
- Completed
1110
- PORT IRQ STAT
1211
- HOST IRQ STAT
12+
- Allocated
13+
- Commands in Q
1314

1415
What: /sys/block/rssd*/status
1516
Date: April 2012
1617
KernelVersion: 3.4
1718
Contact: Asai Thambi S P <[email protected]>
18-
Description: This is a read-only file. Indicates the status of the device.
19+
Description: This is a read-only file. Indicates the status of the device.
20+
21+
What: /sys/block/rssd*/flags
22+
Date: May 2012
23+
KernelVersion: 3.5
24+
Contact: Asai Thambi S P <[email protected]>
25+
Description: This is a read-only file. Dumps the flags in port and driver
26+
data structure

drivers/block/mtip32xx/mtip32xx.c

Lines changed: 57 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2564,40 +2564,58 @@ static ssize_t mtip_hw_show_registers(struct device *dev,
25642564
int size = 0;
25652565
int n;
25662566

2567-
size += sprintf(&buf[size], "S ACTive:\n");
2567+
size += sprintf(&buf[size], "Hardware\n--------\n");
2568+
size += sprintf(&buf[size], "S ACTive : [ 0x");
25682569

2569-
for (n = 0; n < dd->slot_groups; n++)
2570-
size += sprintf(&buf[size], "0x%08x\n",
2570+
for (n = dd->slot_groups-1; n >= 0; n--)
2571+
size += sprintf(&buf[size], "%08X ",
25712572
readl(dd->port->s_active[n]));
25722573

2573-
size += sprintf(&buf[size], "Command Issue:\n");
2574+
size += sprintf(&buf[size], "]\n");
2575+
size += sprintf(&buf[size], "Command Issue : [ 0x");
25742576

2575-
for (n = 0; n < dd->slot_groups; n++)
2576-
size += sprintf(&buf[size], "0x%08x\n",
2577+
for (n = dd->slot_groups-1; n >= 0; n--)
2578+
size += sprintf(&buf[size], "%08X ",
25772579
readl(dd->port->cmd_issue[n]));
25782580

2579-
size += sprintf(&buf[size], "Allocated:\n");
2581+
size += sprintf(&buf[size], "]\n");
2582+
size += sprintf(&buf[size], "Completed : [ 0x");
25802583

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--) {
25822599
if (sizeof(long) > sizeof(u32))
25832600
group_allocated =
25842601
dd->port->allocated[n/2] >> (32*(n&1));
25852602
else
25862603
group_allocated = dd->port->allocated[n];
2587-
size += sprintf(&buf[size], "0x%08x\n",
2588-
group_allocated);
2604+
size += sprintf(&buf[size], "%08X ", group_allocated);
25892605
}
2606+
size += sprintf(&buf[size], "]\n");
25902607

2591-
size += sprintf(&buf[size], "Completed:\n");
2608+
size += sprintf(&buf[size], "Commands in Q: [ 0x");
25922609

2593-
for (n = 0; n < dd->slot_groups; n++)
2594-
size += sprintf(&buf[size], "0x%08x\n",
2595-
readl(dd->port->completed[n]));
2596-
2597-
size += sprintf(&buf[size], "PORT IRQ STAT : 0x%08x\n",
2598-
readl(dd->port->mmio + PORT_IRQ_STAT));
2599-
size += sprintf(&buf[size], "HOST IRQ STAT : 0x%08x\n",
2600-
readl(dd->mmio + HOST_IRQ_STAT));
2610+
for (n = dd->slot_groups-1; n >= 0; n--) {
2611+
if (sizeof(long) > sizeof(u32))
2612+
group_allocated =
2613+
dd->port->cmds_to_issue[n/2] >> (32*(n&1));
2614+
else
2615+
group_allocated = dd->port->cmds_to_issue[n];
2616+
size += sprintf(&buf[size], "%08X ", group_allocated);
2617+
}
2618+
size += sprintf(&buf[size], "]\n");
26012619

26022620
return size;
26032621
}
@@ -2619,8 +2637,24 @@ static ssize_t mtip_hw_show_status(struct device *dev,
26192637
return size;
26202638
}
26212639

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+
26222655
static DEVICE_ATTR(registers, S_IRUGO, mtip_hw_show_registers, NULL);
26232656
static DEVICE_ATTR(status, S_IRUGO, mtip_hw_show_status, NULL);
2657+
static DEVICE_ATTR(flags, S_IRUGO, mtip_hw_show_flags, NULL);
26242658

26252659
/*
26262660
* Create the sysfs related attributes.
@@ -2643,6 +2677,9 @@ static int mtip_hw_sysfs_init(struct driver_data *dd, struct kobject *kobj)
26432677
if (sysfs_create_file(kobj, &dev_attr_status.attr))
26442678
dev_warn(&dd->pdev->dev,
26452679
"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");
26462683
return 0;
26472684
}
26482685

@@ -2663,6 +2700,7 @@ static int mtip_hw_sysfs_exit(struct driver_data *dd, struct kobject *kobj)
26632700

26642701
sysfs_remove_file(kobj, &dev_attr_registers.attr);
26652702
sysfs_remove_file(kobj, &dev_attr_status.attr);
2703+
sysfs_remove_file(kobj, &dev_attr_flags.attr);
26662704

26672705
return 0;
26682706
}

0 commit comments

Comments
 (0)