wd33c93.c (94bd217e2d683719ab21a4ac117d8a1b91cbedc9) wd33c93.c (408bb25ba50c6abaf516d844fd62556ec89a0af2)
1/*
2 * Copyright (c) 1996 John Shifflett, GeoLog Consulting
3 * john@geolog.com
4 * jshiffle@netcom.com
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)

--- 2040 unchanged lines hidden (view full) ---

2049#endif
2050 printk(" setup_args=");
2051 for (i = 0; i < MAX_SETUP_ARGS; i++)
2052 printk("%s,", setup_args[i]);
2053 printk("\n");
2054 printk(" Version %s - %s\n", WD33C93_VERSION, WD33C93_DATE);
2055}
2056
1/*
2 * Copyright (c) 1996 John Shifflett, GeoLog Consulting
3 * john@geolog.com
4 * jshiffle@netcom.com
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)

--- 2040 unchanged lines hidden (view full) ---

2049#endif
2050 printk(" setup_args=");
2051 for (i = 0; i < MAX_SETUP_ARGS; i++)
2052 printk("%s,", setup_args[i]);
2053 printk("\n");
2054 printk(" Version %s - %s\n", WD33C93_VERSION, WD33C93_DATE);
2055}
2056
2057int
2058wd33c93_proc_info(struct Scsi_Host *instance, char *buf, char **start, off_t off, int len, int in)
2057int wd33c93_write_info(struct Scsi_Host *instance, char *buf, int len)
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
2070 hd = (struct WD33C93_hostdata *) instance->hostdata;
2071
2063
2064 hd = (struct WD33C93_hostdata *) instance->hostdata;
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):
2074 * debug
2075 * disconnect
2076 * period
2077 * resync
2078 * proc
2079 * nodma
2080 * level2
2081 * burst
2082 * fast
2083 * nosync
2084 */
2085
2067 * keywords (same format as command-line, but arguments are not optional):
2068 * debug
2069 * disconnect
2070 * period
2071 * resync
2072 * proc
2073 * nodma
2074 * level2
2075 * burst
2076 * fast
2077 * nosync
2078 */
2079
2086 if (in) {
2087 buf[len] = '\0';
2088 for (bp = buf; *bp; ) {
2089 while (',' == *bp || ' ' == *bp)
2090 ++bp;
2091 if (!strncmp(bp, "debug:", 6)) {
2092 hd->args = simple_strtoul(bp+6, &bp, 0) & DB_MASK;
2093 } else if (!strncmp(bp, "disconnect:", 11)) {
2094 x = simple_strtoul(bp+11, &bp, 0);
2095 if (x < DIS_NEVER || x > DIS_ALWAYS)
2096 x = DIS_ADAPTIVE;
2097 hd->disconnect = x;
2098 } else if (!strncmp(bp, "period:", 7)) {
2080 buf[len] = '\0';
2081 for (bp = buf; *bp; ) {
2082 while (',' == *bp || ' ' == *bp)
2083 ++bp;
2084 if (!strncmp(bp, "debug:", 6)) {
2085 hd->args = simple_strtoul(bp+6, &bp, 0) & DB_MASK;
2086 } else if (!strncmp(bp, "disconnect:", 11)) {
2087 x = simple_strtoul(bp+11, &bp, 0);
2088 if (x < DIS_NEVER || x > DIS_ALWAYS)
2089 x = DIS_ADAPTIVE;
2090 hd->disconnect = x;
2091 } 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 =
2101 hd->sx_table[round_period((unsigned int) x,
2102 hd->sx_table)].period_ns;
2103 } else if (!strncmp(bp, "resync:", 7)) {
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 }
2114 set_resync(hd, x ^ hd->no_sync);
2115 hd->no_sync = x;
2116 } else {
2117 break; /* unknown keyword,syntax-error,... */
2126 }
2118 }
2127 return len;
2128 }
2119 }
2120 return len;
2121#else
2122 return 0;
2123#endif
2124}
2129
2125
2126int
2127wd33c93_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;
2135
2130 spin_lock_irq(&hd->lock);
2136 spin_lock_irq(&hd->lock);
2131 bp = buf;
2132 *bp = '\0';
2133 if (hd->proc & PR_VERSION) {
2134 sprintf(tbuf, "\nVersion %s - %s.",
2137 if (hd->proc & PR_VERSION)
2138 seq_printf(m, "\nVersion %s - %s.",
2135 WD33C93_VERSION, WD33C93_DATE);
2139 WD33C93_VERSION, WD33C93_DATE);
2136 strcat(bp, tbuf);
2137 }
2140
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",
2141 hd->clock_freq, hd->no_sync, hd->no_dma, hd->dma_mode, hd->fast);
2143 " dma_mode=%02x fast=%d",
2144 hd->clock_freq, hd->no_sync, hd->no_dma, hd->dma_mode, hd->fast);
2142 strcat(bp, tbuf);
2143 strcat(bp, "\nsync_xfer[] = ");
2144 for (x = 0; x < 7; x++) {
2145 sprintf(tbuf, "\t%02x", hd->sync_xfer[x]);
2146 strcat(bp, tbuf);
2147 }
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 }
2145 seq_printf(m, "\nsync_xfer[] = ");
2146 for (x = 0; x < 7; x++)
2147 seq_printf(m, "\t%02x", hd->sync_xfer[x]);
2148 seq_printf(m, "\nsync_stat[] = ");
2149 for (x = 0; x < 7; x++)
2150 seq_printf(m, "\t%02x", hd->sync_stat[x]);
2153 }
2154#ifdef PROC_STATISTICS
2155 if (hd->proc & PR_STATISTICS) {
2151 }
2152#ifdef PROC_STATISTICS
2153 if (hd->proc & PR_STATISTICS) {
2156 strcat(bp, "\ncommands issued: ");
2157 for (x = 0; x < 7; x++) {
2158 sprintf(tbuf, "\t%ld", hd->cmd_cnt[x]);
2159 strcat(bp, tbuf);
2160 }
2161 strcat(bp, "\ndisconnects allowed:");
2162 for (x = 0; x < 7; x++) {
2163 sprintf(tbuf, "\t%ld", hd->disc_allowed_cnt[x]);
2164 strcat(bp, tbuf);
2165 }
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,
2154 seq_printf(m, "\ncommands issued: ");
2155 for (x = 0; x < 7; x++)
2156 seq_printf(m, "\t%ld", hd->cmd_cnt[x]);
2157 seq_printf(m, "\ndisconnects allowed:");
2158 for (x = 0; x < 7; x++)
2159 seq_printf(m, "\t%ld", hd->disc_allowed_cnt[x]);
2160 seq_printf(m, "\ndisconnects done: ");
2161 for (x = 0; x < 7; x++)
2162 seq_printf(m, "\t%ld", hd->disc_done_cnt[x]);
2163 seq_printf(m,
2172 "\ninterrupts: %ld, DATA_PHASE ints: %ld DMA, %ld PIO",
2173 hd->int_cnt, hd->dma_cnt, hd->pio_cnt);
2164 "\ninterrupts: %ld, DATA_PHASE ints: %ld DMA, %ld PIO",
2165 hd->int_cnt, hd->dma_cnt, hd->pio_cnt);
2174 strcat(bp, tbuf);
2175 }
2176#endif
2177 if (hd->proc & PR_CONNECTED) {
2166 }
2167#endif
2168 if (hd->proc & PR_CONNECTED) {
2178 strcat(bp, "\nconnected: ");
2169 seq_printf(m, "\nconnected: ");
2179 if (hd->connected) {
2180 cmd = (struct scsi_cmnd *) hd->connected;
2170 if (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 }
2185 }
2186 if (hd->proc & PR_INPUTQ) {
2174 }
2175 }
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;
2189 while (cmd) {
2178 cmd = (struct scsi_cmnd *) hd->input_Q;
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;
2194 }
2195 }
2196 if (hd->proc & PR_DISCQ) {
2182 cmd = (struct scsi_cmnd *) cmd->host_scribble;
2183 }
2184 }
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;
2199 while (cmd) {
2187 cmd = (struct scsi_cmnd *) hd->disconnected_Q;
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;
2204 }
2205 }
2191 cmd = (struct scsi_cmnd *) cmd->host_scribble;
2192 }
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}
2226
2227EXPORT_SYMBOL(wd33c93_host_reset);
2228EXPORT_SYMBOL(wd33c93_init);
2229EXPORT_SYMBOL(wd33c93_abort);
2230EXPORT_SYMBOL(wd33c93_queuecommand);
2231EXPORT_SYMBOL(wd33c93_intr);
2198}
2199
2200EXPORT_SYMBOL(wd33c93_host_reset);
2201EXPORT_SYMBOL(wd33c93_init);
2202EXPORT_SYMBOL(wd33c93_abort);
2203EXPORT_SYMBOL(wd33c93_queuecommand);
2204EXPORT_SYMBOL(wd33c93_intr);
2232EXPORT_SYMBOL(wd33c93_proc_info);
2205EXPORT_SYMBOL(wd33c93_show_info);
2206EXPORT_SYMBOL(wd33c93_write_info);