aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-03-31 12:15:44 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2013-04-09 14:13:27 -0400
commitaacce706fae01dbef03a0c2ca40a363bcb88b24a (patch)
tree1acdaf53db118d089049979337c02824476cfbc8 /drivers/scsi
parent56b8e8e53523c9a3e1ffacadf35c389fdb427a34 (diff)
ips: switch to ->show_info()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/ips.c232
-rw-r--r--drivers/scsi/ips.h9
2 files changed, 80 insertions, 161 deletions
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
index 9aa86a315a08..3f9b335292da 100644
--- a/drivers/scsi/ips.c
+++ b/drivers/scsi/ips.c
@@ -326,10 +326,9 @@ static void ips_scmd_buf_write(struct scsi_cmnd * scmd, void *data,
326static void ips_scmd_buf_read(struct scsi_cmnd * scmd, void *data, 326static void ips_scmd_buf_read(struct scsi_cmnd * scmd, void *data,
327 unsigned int count); 327 unsigned int count);
328 328
329static int ips_proc_info(struct Scsi_Host *, char *, char **, off_t, int, int); 329static int ips_write_info(struct Scsi_Host *, char *, int);
330static int ips_host_info(ips_ha_t *, char *, off_t, int); 330static int ips_show_info(struct seq_file *, struct Scsi_Host *);
331static void copy_mem_info(IPS_INFOSTR *, char *, int); 331static int ips_host_info(ips_ha_t *, struct seq_file *);
332static int copy_info(IPS_INFOSTR *, char *, ...);
333static int ips_abort_init(ips_ha_t * ha, int index); 332static int ips_abort_init(ips_ha_t * ha, int index);
334static int ips_init_phase2(int index); 333static int ips_init_phase2(int index);
335 334
@@ -367,7 +366,8 @@ static struct scsi_host_template ips_driver_template = {
367 .eh_abort_handler = ips_eh_abort, 366 .eh_abort_handler = ips_eh_abort,
368 .eh_host_reset_handler = ips_eh_reset, 367 .eh_host_reset_handler = ips_eh_reset,
369 .proc_name = "ips", 368 .proc_name = "ips",
370 .proc_info = ips_proc_info, 369 .show_info = ips_show_info,
370 .write_info = ips_write_info,
371 .slave_configure = ips_slave_configure, 371 .slave_configure = ips_slave_configure,
372 .bios_param = ips_biosparam, 372 .bios_param = ips_biosparam,
373 .this_id = -1, 373 .this_id = -1,
@@ -1433,25 +1433,12 @@ ips_info(struct Scsi_Host *SH)
1433 return (bp); 1433 return (bp);
1434} 1434}
1435 1435
1436/****************************************************************************/
1437/* */
1438/* Routine Name: ips_proc_info */
1439/* */
1440/* Routine Description: */
1441/* */
1442/* The passthru interface for the driver */
1443/* */
1444/****************************************************************************/
1445static int 1436static int
1446ips_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset, 1437ips_write_info(struct Scsi_Host *host, char *buffer, int length)
1447 int length, int func)
1448{ 1438{
1449 int i; 1439 int i;
1450 int ret;
1451 ips_ha_t *ha = NULL; 1440 ips_ha_t *ha = NULL;
1452 1441
1453 METHOD_TRACE("ips_proc_info", 1);
1454
1455 /* Find our host structure */ 1442 /* Find our host structure */
1456 for (i = 0; i < ips_next_controller; i++) { 1443 for (i = 0; i < ips_next_controller; i++) {
1457 if (ips_sh[i]) { 1444 if (ips_sh[i]) {
@@ -1465,18 +1452,29 @@ ips_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset,
1465 if (!ha) 1452 if (!ha)
1466 return (-EINVAL); 1453 return (-EINVAL);
1467 1454
1468 if (func) { 1455 return 0;
1469 /* write */ 1456}
1470 return (0);
1471 } else {
1472 /* read */
1473 if (start)
1474 *start = buffer;
1475 1457
1476 ret = ips_host_info(ha, buffer, offset, length); 1458static int
1459ips_show_info(struct seq_file *m, struct Scsi_Host *host)
1460{
1461 int i;
1462 ips_ha_t *ha = NULL;
1477 1463
1478 return (ret); 1464 /* Find our host structure */
1465 for (i = 0; i < ips_next_controller; i++) {
1466 if (ips_sh[i]) {
1467 if (ips_sh[i] == host) {
1468 ha = (ips_ha_t *) ips_sh[i]->hostdata;
1469 break;
1470 }
1471 }
1479 } 1472 }
1473
1474 if (!ha)
1475 return (-EINVAL);
1476
1477 return ips_host_info(ha, m);
1480} 1478}
1481 1479
1482/*--------------------------------------------------------------------------*/ 1480/*--------------------------------------------------------------------------*/
@@ -2035,183 +2033,113 @@ ips_cleanup_passthru(ips_ha_t * ha, ips_scb_t * scb)
2035/* */ 2033/* */
2036/****************************************************************************/ 2034/****************************************************************************/
2037static int 2035static int
2038ips_host_info(ips_ha_t * ha, char *ptr, off_t offset, int len) 2036ips_host_info(ips_ha_t *ha, struct seq_file *m)
2039{ 2037{
2040 IPS_INFOSTR info;
2041
2042 METHOD_TRACE("ips_host_info", 1); 2038 METHOD_TRACE("ips_host_info", 1);
2043 2039
2044 info.buffer = ptr; 2040 seq_printf(m, "\nIBM ServeRAID General Information:\n\n");
2045 info.length = len;
2046 info.offset = offset;
2047 info.pos = 0;
2048 info.localpos = 0;
2049
2050 copy_info(&info, "\nIBM ServeRAID General Information:\n\n");
2051 2041
2052 if ((le32_to_cpu(ha->nvram->signature) == IPS_NVRAM_P5_SIG) && 2042 if ((le32_to_cpu(ha->nvram->signature) == IPS_NVRAM_P5_SIG) &&
2053 (le16_to_cpu(ha->nvram->adapter_type) != 0)) 2043 (le16_to_cpu(ha->nvram->adapter_type) != 0))
2054 copy_info(&info, "\tController Type : %s\n", 2044 seq_printf(m, "\tController Type : %s\n",
2055 ips_adapter_name[ha->ad_type - 1]); 2045 ips_adapter_name[ha->ad_type - 1]);
2056 else 2046 else
2057 copy_info(&info, 2047 seq_printf(m,
2058 "\tController Type : Unknown\n"); 2048 "\tController Type : Unknown\n");
2059 2049
2060 if (ha->io_addr) 2050 if (ha->io_addr)
2061 copy_info(&info, 2051 seq_printf(m,
2062 "\tIO region : 0x%lx (%d bytes)\n", 2052 "\tIO region : 0x%lx (%d bytes)\n",
2063 ha->io_addr, ha->io_len); 2053 ha->io_addr, ha->io_len);
2064 2054
2065 if (ha->mem_addr) { 2055 if (ha->mem_addr) {
2066 copy_info(&info, 2056 seq_printf(m,
2067 "\tMemory region : 0x%lx (%d bytes)\n", 2057 "\tMemory region : 0x%lx (%d bytes)\n",
2068 ha->mem_addr, ha->mem_len); 2058 ha->mem_addr, ha->mem_len);
2069 copy_info(&info, 2059 seq_printf(m,
2070 "\tShared memory address : 0x%lx\n", 2060 "\tShared memory address : 0x%lx\n",
2071 ha->mem_ptr); 2061 ha->mem_ptr);
2072 } 2062 }
2073 2063
2074 copy_info(&info, "\tIRQ number : %d\n", ha->pcidev->irq); 2064 seq_printf(m, "\tIRQ number : %d\n", ha->pcidev->irq);
2075 2065
2076 /* For the Next 3 lines Check for Binary 0 at the end and don't include it if it's there. */ 2066 /* For the Next 3 lines Check for Binary 0 at the end and don't include it if it's there. */
2077 /* That keeps everything happy for "text" operations on the proc file. */ 2067 /* That keeps everything happy for "text" operations on the proc file. */
2078 2068
2079 if (le32_to_cpu(ha->nvram->signature) == IPS_NVRAM_P5_SIG) { 2069 if (le32_to_cpu(ha->nvram->signature) == IPS_NVRAM_P5_SIG) {
2080 if (ha->nvram->bios_low[3] == 0) { 2070 if (ha->nvram->bios_low[3] == 0) {
2081 copy_info(&info, 2071 seq_printf(m,
2082 "\tBIOS Version : %c%c%c%c%c%c%c\n", 2072 "\tBIOS Version : %c%c%c%c%c%c%c\n",
2083 ha->nvram->bios_high[0], ha->nvram->bios_high[1], 2073 ha->nvram->bios_high[0], ha->nvram->bios_high[1],
2084 ha->nvram->bios_high[2], ha->nvram->bios_high[3], 2074 ha->nvram->bios_high[2], ha->nvram->bios_high[3],
2085 ha->nvram->bios_low[0], ha->nvram->bios_low[1], 2075 ha->nvram->bios_low[0], ha->nvram->bios_low[1],
2086 ha->nvram->bios_low[2]); 2076 ha->nvram->bios_low[2]);
2087 2077
2088 } else { 2078 } else {
2089 copy_info(&info, 2079 seq_printf(m,
2090 "\tBIOS Version : %c%c%c%c%c%c%c%c\n", 2080 "\tBIOS Version : %c%c%c%c%c%c%c%c\n",
2091 ha->nvram->bios_high[0], ha->nvram->bios_high[1], 2081 ha->nvram->bios_high[0], ha->nvram->bios_high[1],
2092 ha->nvram->bios_high[2], ha->nvram->bios_high[3], 2082 ha->nvram->bios_high[2], ha->nvram->bios_high[3],
2093 ha->nvram->bios_low[0], ha->nvram->bios_low[1], 2083 ha->nvram->bios_low[0], ha->nvram->bios_low[1],
2094 ha->nvram->bios_low[2], ha->nvram->bios_low[3]); 2084 ha->nvram->bios_low[2], ha->nvram->bios_low[3]);
2095 } 2085 }
2096 2086
2097 } 2087 }
2098 2088
2099 if (ha->enq->CodeBlkVersion[7] == 0) { 2089 if (ha->enq->CodeBlkVersion[7] == 0) {
2100 copy_info(&info, 2090 seq_printf(m,
2101 "\tFirmware Version : %c%c%c%c%c%c%c\n", 2091 "\tFirmware Version : %c%c%c%c%c%c%c\n",
2102 ha->enq->CodeBlkVersion[0], ha->enq->CodeBlkVersion[1], 2092 ha->enq->CodeBlkVersion[0], ha->enq->CodeBlkVersion[1],
2103 ha->enq->CodeBlkVersion[2], ha->enq->CodeBlkVersion[3], 2093 ha->enq->CodeBlkVersion[2], ha->enq->CodeBlkVersion[3],
2104 ha->enq->CodeBlkVersion[4], ha->enq->CodeBlkVersion[5], 2094 ha->enq->CodeBlkVersion[4], ha->enq->CodeBlkVersion[5],
2105 ha->enq->CodeBlkVersion[6]); 2095 ha->enq->CodeBlkVersion[6]);
2106 } else { 2096 } else {
2107 copy_info(&info, 2097 seq_printf(m,
2108 "\tFirmware Version : %c%c%c%c%c%c%c%c\n", 2098 "\tFirmware Version : %c%c%c%c%c%c%c%c\n",
2109 ha->enq->CodeBlkVersion[0], ha->enq->CodeBlkVersion[1], 2099 ha->enq->CodeBlkVersion[0], ha->enq->CodeBlkVersion[1],
2110 ha->enq->CodeBlkVersion[2], ha->enq->CodeBlkVersion[3], 2100 ha->enq->CodeBlkVersion[2], ha->enq->CodeBlkVersion[3],
2111 ha->enq->CodeBlkVersion[4], ha->enq->CodeBlkVersion[5], 2101 ha->enq->CodeBlkVersion[4], ha->enq->CodeBlkVersion[5],
2112 ha->enq->CodeBlkVersion[6], ha->enq->CodeBlkVersion[7]); 2102 ha->enq->CodeBlkVersion[6], ha->enq->CodeBlkVersion[7]);
2113 } 2103 }
2114 2104
2115 if (ha->enq->BootBlkVersion[7] == 0) { 2105 if (ha->enq->BootBlkVersion[7] == 0) {
2116 copy_info(&info, 2106 seq_printf(m,
2117 "\tBoot Block Version : %c%c%c%c%c%c%c\n", 2107 "\tBoot Block Version : %c%c%c%c%c%c%c\n",
2118 ha->enq->BootBlkVersion[0], ha->enq->BootBlkVersion[1], 2108 ha->enq->BootBlkVersion[0], ha->enq->BootBlkVersion[1],
2119 ha->enq->BootBlkVersion[2], ha->enq->BootBlkVersion[3], 2109 ha->enq->BootBlkVersion[2], ha->enq->BootBlkVersion[3],
2120 ha->enq->BootBlkVersion[4], ha->enq->BootBlkVersion[5], 2110 ha->enq->BootBlkVersion[4], ha->enq->BootBlkVersion[5],
2121 ha->enq->BootBlkVersion[6]); 2111 ha->enq->BootBlkVersion[6]);
2122 } else { 2112 } else {
2123 copy_info(&info, 2113 seq_printf(m,
2124 "\tBoot Block Version : %c%c%c%c%c%c%c%c\n", 2114 "\tBoot Block Version : %c%c%c%c%c%c%c%c\n",
2125 ha->enq->BootBlkVersion[0], ha->enq->BootBlkVersion[1], 2115 ha->enq->BootBlkVersion[0], ha->enq->BootBlkVersion[1],
2126 ha->enq->BootBlkVersion[2], ha->enq->BootBlkVersion[3], 2116 ha->enq->BootBlkVersion[2], ha->enq->BootBlkVersion[3],
2127 ha->enq->BootBlkVersion[4], ha->enq->BootBlkVersion[5], 2117 ha->enq->BootBlkVersion[4], ha->enq->BootBlkVersion[5],
2128 ha->enq->BootBlkVersion[6], ha->enq->BootBlkVersion[7]); 2118 ha->enq->BootBlkVersion[6], ha->enq->BootBlkVersion[7]);
2129 } 2119 }
2130 2120
2131 copy_info(&info, "\tDriver Version : %s%s\n", 2121 seq_printf(m, "\tDriver Version : %s%s\n",
2132 IPS_VERSION_HIGH, IPS_VERSION_LOW); 2122 IPS_VERSION_HIGH, IPS_VERSION_LOW);
2133 2123
2134 copy_info(&info, "\tDriver Build : %d\n", 2124 seq_printf(m, "\tDriver Build : %d\n",
2135 IPS_BUILD_IDENT); 2125 IPS_BUILD_IDENT);
2136 2126
2137 copy_info(&info, "\tMax Physical Devices : %d\n", 2127 seq_printf(m, "\tMax Physical Devices : %d\n",
2138 ha->enq->ucMaxPhysicalDevices); 2128 ha->enq->ucMaxPhysicalDevices);
2139 copy_info(&info, "\tMax Active Commands : %d\n", 2129 seq_printf(m, "\tMax Active Commands : %d\n",
2140 ha->max_cmds); 2130 ha->max_cmds);
2141 copy_info(&info, "\tCurrent Queued Commands : %d\n", 2131 seq_printf(m, "\tCurrent Queued Commands : %d\n",
2142 ha->scb_waitlist.count); 2132 ha->scb_waitlist.count);
2143 copy_info(&info, "\tCurrent Active Commands : %d\n", 2133 seq_printf(m, "\tCurrent Active Commands : %d\n",
2144 ha->scb_activelist.count - ha->num_ioctl); 2134 ha->scb_activelist.count - ha->num_ioctl);
2145 copy_info(&info, "\tCurrent Queued PT Commands : %d\n", 2135 seq_printf(m, "\tCurrent Queued PT Commands : %d\n",
2146 ha->copp_waitlist.count); 2136 ha->copp_waitlist.count);
2147 copy_info(&info, "\tCurrent Active PT Commands : %d\n", 2137 seq_printf(m, "\tCurrent Active PT Commands : %d\n",
2148 ha->num_ioctl); 2138 ha->num_ioctl);
2149 2139
2150 copy_info(&info, "\n"); 2140 seq_printf(m, "\n");
2151
2152 return (info.localpos);
2153}
2154
2155/****************************************************************************/
2156/* */
2157/* Routine Name: copy_mem_info */
2158/* */
2159/* Routine Description: */
2160/* */
2161/* Copy data into an IPS_INFOSTR structure */
2162/* */
2163/****************************************************************************/
2164static void
2165copy_mem_info(IPS_INFOSTR * info, char *data, int len)
2166{
2167 METHOD_TRACE("copy_mem_info", 1);
2168
2169 if (info->pos + len < info->offset) {
2170 info->pos += len;
2171 return;
2172 }
2173
2174 if (info->pos < info->offset) {
2175 data += (info->offset - info->pos);
2176 len -= (info->offset - info->pos);
2177 info->pos += (info->offset - info->pos);
2178 }
2179
2180 if (info->localpos + len > info->length)
2181 len = info->length - info->localpos;
2182 2141
2183 if (len > 0) { 2142 return 0;
2184 memcpy(info->buffer + info->localpos, data, len);
2185 info->pos += len;
2186 info->localpos += len;
2187 }
2188}
2189
2190/****************************************************************************/
2191/* */
2192/* Routine Name: copy_info */
2193/* */
2194/* Routine Description: */
2195/* */
2196/* printf style wrapper for an info structure */
2197/* */
2198/****************************************************************************/
2199static int
2200copy_info(IPS_INFOSTR * info, char *fmt, ...)
2201{
2202 va_list args;
2203 char buf[128];
2204 int len;
2205
2206 METHOD_TRACE("copy_info", 1);
2207
2208 va_start(args, fmt);
2209 len = vsprintf(buf, fmt, args);
2210 va_end(args);
2211
2212 copy_mem_info(info, buf, len);
2213
2214 return (len);
2215} 2143}
2216 2144
2217/****************************************************************************/ 2145/****************************************************************************/
diff --git a/drivers/scsi/ips.h b/drivers/scsi/ips.h
index f2df0593332b..45b9566b928e 100644
--- a/drivers/scsi/ips.h
+++ b/drivers/scsi/ips.h
@@ -416,7 +416,6 @@
416 /* 416 /*
417 * Scsi_Host Template 417 * Scsi_Host Template
418 */ 418 */
419 static int ips_proc_info(struct Scsi_Host *, char *, char **, off_t, int, int);
420 static int ips_biosparam(struct scsi_device *sdev, struct block_device *bdev, 419 static int ips_biosparam(struct scsi_device *sdev, struct block_device *bdev,
421 sector_t capacity, int geom[]); 420 sector_t capacity, int geom[]);
422 static int ips_slave_configure(struct scsi_device *SDptr); 421 static int ips_slave_configure(struct scsi_device *SDptr);
@@ -959,14 +958,6 @@ typedef union {
959 IPS_ENH_SG_LIST *enh_list; 958 IPS_ENH_SG_LIST *enh_list;
960} IPS_SG_LIST; 959} IPS_SG_LIST;
961 960
962typedef struct _IPS_INFOSTR {
963 char *buffer;
964 int length;
965 int offset;
966 int pos;
967 int localpos;
968} IPS_INFOSTR;
969
970typedef struct { 961typedef struct {
971 char *option_name; 962 char *option_name;
972 int *option_flag; 963 int *option_flag;