diff options
Diffstat (limited to 'drivers/scsi/wd33c93.c')
-rw-r--r-- | drivers/scsi/wd33c93.c | 194 |
1 files changed, 84 insertions, 110 deletions
diff --git a/drivers/scsi/wd33c93.c b/drivers/scsi/wd33c93.c index c0ee4ea28a19..41883a87931d 100644 --- a/drivers/scsi/wd33c93.c +++ b/drivers/scsi/wd33c93.c | |||
@@ -2054,22 +2054,16 @@ wd33c93_init(struct Scsi_Host *instance, const wd33c93_regs regs, | |||
2054 | printk(" Version %s - %s\n", WD33C93_VERSION, WD33C93_DATE); | 2054 | printk(" Version %s - %s\n", WD33C93_VERSION, WD33C93_DATE); |
2055 | } | 2055 | } |
2056 | 2056 | ||
2057 | int | 2057 | int wd33c93_write_info(struct Scsi_Host *instance, char *buf, int len) |
2058 | wd33c93_proc_info(struct Scsi_Host *instance, char *buf, char **start, off_t off, int len, int in) | ||
2059 | { | 2058 | { |
2060 | |||
2061 | #ifdef PROC_INTERFACE | 2059 | #ifdef PROC_INTERFACE |
2062 | |||
2063 | char *bp; | 2060 | char *bp; |
2064 | char tbuf[128]; | ||
2065 | struct WD33C93_hostdata *hd; | 2061 | struct WD33C93_hostdata *hd; |
2066 | struct scsi_cmnd *cmd; | ||
2067 | int x; | 2062 | int x; |
2068 | static int stop = 0; | ||
2069 | 2063 | ||
2070 | hd = (struct WD33C93_hostdata *) instance->hostdata; | 2064 | hd = (struct WD33C93_hostdata *) instance->hostdata; |
2071 | 2065 | ||
2072 | /* If 'in' is TRUE we need to _read_ the proc file. We accept the following | 2066 | /* We accept the following |
2073 | * keywords (same format as command-line, but arguments are not optional): | 2067 | * keywords (same format as command-line, but arguments are not optional): |
2074 | * debug | 2068 | * debug |
2075 | * disconnect | 2069 | * disconnect |
@@ -2083,145 +2077,124 @@ wd33c93_proc_info(struct Scsi_Host *instance, char *buf, char **start, off_t off | |||
2083 | * nosync | 2077 | * nosync |
2084 | */ | 2078 | */ |
2085 | 2079 | ||
2086 | if (in) { | 2080 | buf[len] = '\0'; |
2087 | buf[len] = '\0'; | 2081 | for (bp = buf; *bp; ) { |
2088 | for (bp = buf; *bp; ) { | 2082 | while (',' == *bp || ' ' == *bp) |
2089 | while (',' == *bp || ' ' == *bp) | 2083 | ++bp; |
2090 | ++bp; | 2084 | if (!strncmp(bp, "debug:", 6)) { |
2091 | if (!strncmp(bp, "debug:", 6)) { | 2085 | hd->args = simple_strtoul(bp+6, &bp, 0) & DB_MASK; |
2092 | hd->args = simple_strtoul(bp+6, &bp, 0) & DB_MASK; | 2086 | } else if (!strncmp(bp, "disconnect:", 11)) { |
2093 | } else if (!strncmp(bp, "disconnect:", 11)) { | 2087 | x = simple_strtoul(bp+11, &bp, 0); |
2094 | x = simple_strtoul(bp+11, &bp, 0); | 2088 | if (x < DIS_NEVER || x > DIS_ALWAYS) |
2095 | if (x < DIS_NEVER || x > DIS_ALWAYS) | 2089 | x = DIS_ADAPTIVE; |
2096 | x = DIS_ADAPTIVE; | 2090 | hd->disconnect = x; |
2097 | hd->disconnect = x; | 2091 | } else if (!strncmp(bp, "period:", 7)) { |
2098 | } else if (!strncmp(bp, "period:", 7)) { | 2092 | x = simple_strtoul(bp+7, &bp, 0); |
2093 | hd->default_sx_per = | ||
2094 | hd->sx_table[round_period((unsigned int) x, | ||
2095 | hd->sx_table)].period_ns; | ||
2096 | } else if (!strncmp(bp, "resync:", 7)) { | ||
2097 | set_resync(hd, (int)simple_strtoul(bp+7, &bp, 0)); | ||
2098 | } else if (!strncmp(bp, "proc:", 5)) { | ||
2099 | hd->proc = simple_strtoul(bp+5, &bp, 0); | ||
2100 | } else if (!strncmp(bp, "nodma:", 6)) { | ||
2101 | hd->no_dma = simple_strtoul(bp+6, &bp, 0); | ||
2102 | } else if (!strncmp(bp, "level2:", 7)) { | ||
2103 | hd->level2 = simple_strtoul(bp+7, &bp, 0); | ||
2104 | } else if (!strncmp(bp, "burst:", 6)) { | ||
2105 | hd->dma_mode = | ||
2106 | simple_strtol(bp+6, &bp, 0) ? CTRL_BURST:CTRL_DMA; | ||
2107 | } else if (!strncmp(bp, "fast:", 5)) { | ||
2108 | x = !!simple_strtol(bp+5, &bp, 0); | ||
2109 | if (x != hd->fast) | ||
2110 | set_resync(hd, 0xff); | ||
2111 | hd->fast = x; | ||
2112 | } else if (!strncmp(bp, "nosync:", 7)) { | ||
2099 | x = simple_strtoul(bp+7, &bp, 0); | 2113 | x = simple_strtoul(bp+7, &bp, 0); |
2100 | hd->default_sx_per = | 2114 | set_resync(hd, x ^ hd->no_sync); |
2101 | hd->sx_table[round_period((unsigned int) x, | 2115 | hd->no_sync = x; |
2102 | hd->sx_table)].period_ns; | 2116 | } else { |
2103 | } else if (!strncmp(bp, "resync:", 7)) { | 2117 | break; /* unknown keyword,syntax-error,... */ |
2104 | set_resync(hd, (int)simple_strtoul(bp+7, &bp, 0)); | ||
2105 | } else if (!strncmp(bp, "proc:", 5)) { | ||
2106 | hd->proc = simple_strtoul(bp+5, &bp, 0); | ||
2107 | } else if (!strncmp(bp, "nodma:", 6)) { | ||
2108 | hd->no_dma = simple_strtoul(bp+6, &bp, 0); | ||
2109 | } else if (!strncmp(bp, "level2:", 7)) { | ||
2110 | hd->level2 = simple_strtoul(bp+7, &bp, 0); | ||
2111 | } else if (!strncmp(bp, "burst:", 6)) { | ||
2112 | hd->dma_mode = | ||
2113 | simple_strtol(bp+6, &bp, 0) ? CTRL_BURST:CTRL_DMA; | ||
2114 | } else if (!strncmp(bp, "fast:", 5)) { | ||
2115 | x = !!simple_strtol(bp+5, &bp, 0); | ||
2116 | if (x != hd->fast) | ||
2117 | set_resync(hd, 0xff); | ||
2118 | hd->fast = x; | ||
2119 | } else if (!strncmp(bp, "nosync:", 7)) { | ||
2120 | x = simple_strtoul(bp+7, &bp, 0); | ||
2121 | set_resync(hd, x ^ hd->no_sync); | ||
2122 | hd->no_sync = x; | ||
2123 | } else { | ||
2124 | break; /* unknown keyword,syntax-error,... */ | ||
2125 | } | ||
2126 | } | 2118 | } |
2127 | return len; | ||
2128 | } | 2119 | } |
2120 | return len; | ||
2121 | #else | ||
2122 | return 0; | ||
2123 | #endif | ||
2124 | } | ||
2125 | |||
2126 | int | ||
2127 | wd33c93_show_info(struct seq_file *m, struct Scsi_Host *instance) | ||
2128 | { | ||
2129 | #ifdef PROC_INTERFACE | ||
2130 | struct WD33C93_hostdata *hd; | ||
2131 | struct scsi_cmnd *cmd; | ||
2132 | int x; | ||
2133 | |||
2134 | hd = (struct WD33C93_hostdata *) instance->hostdata; | ||
2129 | 2135 | ||
2130 | spin_lock_irq(&hd->lock); | 2136 | spin_lock_irq(&hd->lock); |
2131 | bp = buf; | 2137 | if (hd->proc & PR_VERSION) |
2132 | *bp = '\0'; | 2138 | seq_printf(m, "\nVersion %s - %s.", |
2133 | if (hd->proc & PR_VERSION) { | ||
2134 | sprintf(tbuf, "\nVersion %s - %s.", | ||
2135 | WD33C93_VERSION, WD33C93_DATE); | 2139 | WD33C93_VERSION, WD33C93_DATE); |
2136 | strcat(bp, tbuf); | 2140 | |
2137 | } | ||
2138 | if (hd->proc & PR_INFO) { | 2141 | if (hd->proc & PR_INFO) { |
2139 | sprintf(tbuf, "\nclock_freq=%02x no_sync=%02x no_dma=%d" | 2142 | seq_printf(m, "\nclock_freq=%02x no_sync=%02x no_dma=%d" |
2140 | " dma_mode=%02x fast=%d", | 2143 | " dma_mode=%02x fast=%d", |
2141 | hd->clock_freq, hd->no_sync, hd->no_dma, hd->dma_mode, hd->fast); | 2144 | hd->clock_freq, hd->no_sync, hd->no_dma, hd->dma_mode, hd->fast); |
2142 | strcat(bp, tbuf); | 2145 | seq_printf(m, "\nsync_xfer[] = "); |
2143 | strcat(bp, "\nsync_xfer[] = "); | 2146 | for (x = 0; x < 7; x++) |
2144 | for (x = 0; x < 7; x++) { | 2147 | seq_printf(m, "\t%02x", hd->sync_xfer[x]); |
2145 | sprintf(tbuf, "\t%02x", hd->sync_xfer[x]); | 2148 | seq_printf(m, "\nsync_stat[] = "); |
2146 | strcat(bp, tbuf); | 2149 | for (x = 0; x < 7; x++) |
2147 | } | 2150 | seq_printf(m, "\t%02x", hd->sync_stat[x]); |
2148 | strcat(bp, "\nsync_stat[] = "); | ||
2149 | for (x = 0; x < 7; x++) { | ||
2150 | sprintf(tbuf, "\t%02x", hd->sync_stat[x]); | ||
2151 | strcat(bp, tbuf); | ||
2152 | } | ||
2153 | } | 2151 | } |
2154 | #ifdef PROC_STATISTICS | 2152 | #ifdef PROC_STATISTICS |
2155 | if (hd->proc & PR_STATISTICS) { | 2153 | if (hd->proc & PR_STATISTICS) { |
2156 | strcat(bp, "\ncommands issued: "); | 2154 | seq_printf(m, "\ncommands issued: "); |
2157 | for (x = 0; x < 7; x++) { | 2155 | for (x = 0; x < 7; x++) |
2158 | sprintf(tbuf, "\t%ld", hd->cmd_cnt[x]); | 2156 | seq_printf(m, "\t%ld", hd->cmd_cnt[x]); |
2159 | strcat(bp, tbuf); | 2157 | seq_printf(m, "\ndisconnects allowed:"); |
2160 | } | 2158 | for (x = 0; x < 7; x++) |
2161 | strcat(bp, "\ndisconnects allowed:"); | 2159 | seq_printf(m, "\t%ld", hd->disc_allowed_cnt[x]); |
2162 | for (x = 0; x < 7; x++) { | 2160 | seq_printf(m, "\ndisconnects done: "); |
2163 | sprintf(tbuf, "\t%ld", hd->disc_allowed_cnt[x]); | 2161 | for (x = 0; x < 7; x++) |
2164 | strcat(bp, tbuf); | 2162 | seq_printf(m, "\t%ld", hd->disc_done_cnt[x]); |
2165 | } | 2163 | seq_printf(m, |
2166 | strcat(bp, "\ndisconnects done: "); | ||
2167 | for (x = 0; x < 7; x++) { | ||
2168 | sprintf(tbuf, "\t%ld", hd->disc_done_cnt[x]); | ||
2169 | strcat(bp, tbuf); | ||
2170 | } | ||
2171 | sprintf(tbuf, | ||
2172 | "\ninterrupts: %ld, DATA_PHASE ints: %ld DMA, %ld PIO", | 2164 | "\ninterrupts: %ld, DATA_PHASE ints: %ld DMA, %ld PIO", |
2173 | hd->int_cnt, hd->dma_cnt, hd->pio_cnt); | 2165 | hd->int_cnt, hd->dma_cnt, hd->pio_cnt); |
2174 | strcat(bp, tbuf); | ||
2175 | } | 2166 | } |
2176 | #endif | 2167 | #endif |
2177 | if (hd->proc & PR_CONNECTED) { | 2168 | if (hd->proc & PR_CONNECTED) { |
2178 | strcat(bp, "\nconnected: "); | 2169 | seq_printf(m, "\nconnected: "); |
2179 | if (hd->connected) { | 2170 | if (hd->connected) { |
2180 | cmd = (struct scsi_cmnd *) hd->connected; | 2171 | cmd = (struct scsi_cmnd *) hd->connected; |
2181 | sprintf(tbuf, " %d:%d(%02x)", | 2172 | seq_printf(m, " %d:%d(%02x)", |
2182 | cmd->device->id, cmd->device->lun, cmd->cmnd[0]); | 2173 | cmd->device->id, cmd->device->lun, cmd->cmnd[0]); |
2183 | strcat(bp, tbuf); | ||
2184 | } | 2174 | } |
2185 | } | 2175 | } |
2186 | if (hd->proc & PR_INPUTQ) { | 2176 | if (hd->proc & PR_INPUTQ) { |
2187 | strcat(bp, "\ninput_Q: "); | 2177 | seq_printf(m, "\ninput_Q: "); |
2188 | cmd = (struct scsi_cmnd *) hd->input_Q; | 2178 | cmd = (struct scsi_cmnd *) hd->input_Q; |
2189 | while (cmd) { | 2179 | while (cmd) { |
2190 | sprintf(tbuf, " %d:%d(%02x)", | 2180 | seq_printf(m, " %d:%d(%02x)", |
2191 | cmd->device->id, cmd->device->lun, cmd->cmnd[0]); | 2181 | cmd->device->id, cmd->device->lun, cmd->cmnd[0]); |
2192 | strcat(bp, tbuf); | ||
2193 | cmd = (struct scsi_cmnd *) cmd->host_scribble; | 2182 | cmd = (struct scsi_cmnd *) cmd->host_scribble; |
2194 | } | 2183 | } |
2195 | } | 2184 | } |
2196 | if (hd->proc & PR_DISCQ) { | 2185 | if (hd->proc & PR_DISCQ) { |
2197 | strcat(bp, "\ndisconnected_Q:"); | 2186 | seq_printf(m, "\ndisconnected_Q:"); |
2198 | cmd = (struct scsi_cmnd *) hd->disconnected_Q; | 2187 | cmd = (struct scsi_cmnd *) hd->disconnected_Q; |
2199 | while (cmd) { | 2188 | while (cmd) { |
2200 | sprintf(tbuf, " %d:%d(%02x)", | 2189 | seq_printf(m, " %d:%d(%02x)", |
2201 | cmd->device->id, cmd->device->lun, cmd->cmnd[0]); | 2190 | cmd->device->id, cmd->device->lun, cmd->cmnd[0]); |
2202 | strcat(bp, tbuf); | ||
2203 | cmd = (struct scsi_cmnd *) cmd->host_scribble; | 2191 | cmd = (struct scsi_cmnd *) cmd->host_scribble; |
2204 | } | 2192 | } |
2205 | } | 2193 | } |
2206 | strcat(bp, "\n"); | 2194 | seq_printf(m, "\n"); |
2207 | spin_unlock_irq(&hd->lock); | 2195 | spin_unlock_irq(&hd->lock); |
2208 | *start = buf; | ||
2209 | if (stop) { | ||
2210 | stop = 0; | ||
2211 | return 0; | ||
2212 | } | ||
2213 | if (off > 0x40000) /* ALWAYS stop after 256k bytes have been read */ | ||
2214 | stop = 1; | ||
2215 | if (hd->proc & PR_STOP) /* stop every other time */ | ||
2216 | stop = 1; | ||
2217 | return strlen(bp); | ||
2218 | |||
2219 | #else /* PROC_INTERFACE */ | ||
2220 | |||
2221 | return 0; | ||
2222 | |||
2223 | #endif /* PROC_INTERFACE */ | 2196 | #endif /* PROC_INTERFACE */ |
2224 | 2197 | return 0; | |
2225 | } | 2198 | } |
2226 | 2199 | ||
2227 | EXPORT_SYMBOL(wd33c93_host_reset); | 2200 | EXPORT_SYMBOL(wd33c93_host_reset); |
@@ -2229,4 +2202,5 @@ EXPORT_SYMBOL(wd33c93_init); | |||
2229 | EXPORT_SYMBOL(wd33c93_abort); | 2202 | EXPORT_SYMBOL(wd33c93_abort); |
2230 | EXPORT_SYMBOL(wd33c93_queuecommand); | 2203 | EXPORT_SYMBOL(wd33c93_queuecommand); |
2231 | EXPORT_SYMBOL(wd33c93_intr); | 2204 | EXPORT_SYMBOL(wd33c93_intr); |
2232 | EXPORT_SYMBOL(wd33c93_proc_info); | 2205 | EXPORT_SYMBOL(wd33c93_show_info); |
2206 | EXPORT_SYMBOL(wd33c93_write_info); | ||