Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2000-2001 Adaptec Inc. |
| 3 | * All rights reserved. |
| 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions |
| 7 | * are met: |
| 8 | * 1. Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions, and the following disclaimer, |
| 10 | * without modification. |
| 11 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer |
| 12 | * substantially similar to the "NO WARRANTY" disclaimer below |
| 13 | * ("Disclaimer") and any redistribution must be conditioned upon |
| 14 | * including a substantially similar Disclaimer requirement for further |
| 15 | * binary redistribution. |
| 16 | * 3. Neither the names of the above-listed copyright holders nor the names |
| 17 | * of any contributors may be used to endorse or promote products derived |
| 18 | * from this software without specific prior written permission. |
| 19 | * |
| 20 | * Alternatively, this software may be distributed under the terms of the |
| 21 | * GNU General Public License ("GPL") version 2 as published by the Free |
| 22 | * Software Foundation. |
| 23 | * |
| 24 | * NO WARRANTY |
| 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 26 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 27 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR |
| 28 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 29 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 31 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 32 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 33 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
| 34 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 35 | * POSSIBILITY OF SUCH DAMAGES. |
| 36 | * |
| 37 | * String handling code courtesy of Gerard Roudier's <groudier@club-internet.fr> |
| 38 | * sym driver. |
| 39 | * |
| 40 | * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_proc.c#29 $ |
| 41 | */ |
| 42 | #include "aic7xxx_osm.h" |
| 43 | #include "aic7xxx_inline.h" |
| 44 | #include "aic7xxx_93cx6.h" |
| 45 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | static void ahc_dump_target_state(struct ahc_softc *ahc, |
Al Viro | 6b3a8bb | 2013-03-31 04:07:31 -0400 | [diff] [blame] | 47 | struct seq_file *m, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | u_int our_id, char channel, |
| 49 | u_int target_id, u_int target_offset); |
Al Viro | 6b3a8bb | 2013-03-31 04:07:31 -0400 | [diff] [blame] | 50 | static void ahc_dump_device_state(struct seq_file *m, |
James Bottomley | b1abb4d | 2005-05-24 17:15:43 -0500 | [diff] [blame] | 51 | struct scsi_device *dev); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | |
Christoph Hellwig | 1ff9273 | 2005-08-19 18:57:13 +0200 | [diff] [blame] | 53 | /* |
| 54 | * Table of syncrates that don't follow the "divisible by 4" |
| 55 | * rule. This table will be expanded in future SCSI specs. |
| 56 | */ |
Denys Vlasenko | 980b306 | 2008-04-25 04:36:01 +0200 | [diff] [blame] | 57 | static const struct { |
Christoph Hellwig | 1ff9273 | 2005-08-19 18:57:13 +0200 | [diff] [blame] | 58 | u_int period_factor; |
| 59 | u_int period; /* in 100ths of ns */ |
| 60 | } scsi_syncrates[] = { |
| 61 | { 0x08, 625 }, /* FAST-160 */ |
| 62 | { 0x09, 1250 }, /* FAST-80 */ |
| 63 | { 0x0a, 2500 }, /* FAST-40 40MHz */ |
| 64 | { 0x0b, 3030 }, /* FAST-40 33MHz */ |
| 65 | { 0x0c, 5000 } /* FAST-20 */ |
| 66 | }; |
| 67 | |
| 68 | /* |
| 69 | * Return the frequency in kHz corresponding to the given |
| 70 | * sync period factor. |
| 71 | */ |
| 72 | static u_int |
| 73 | ahc_calc_syncsrate(u_int period_factor) |
| 74 | { |
| 75 | int i; |
Christoph Hellwig | 1ff9273 | 2005-08-19 18:57:13 +0200 | [diff] [blame] | 76 | |
Christoph Hellwig | 1ff9273 | 2005-08-19 18:57:13 +0200 | [diff] [blame] | 77 | /* See if the period is in the "exception" table */ |
Tobias Klauser | 6391a11 | 2006-06-08 22:23:48 -0700 | [diff] [blame] | 78 | for (i = 0; i < ARRAY_SIZE(scsi_syncrates); i++) { |
Christoph Hellwig | 1ff9273 | 2005-08-19 18:57:13 +0200 | [diff] [blame] | 79 | |
| 80 | if (period_factor == scsi_syncrates[i].period_factor) { |
| 81 | /* Period in kHz */ |
| 82 | return (100000000 / scsi_syncrates[i].period); |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | /* |
| 87 | * Wasn't in the table, so use the standard |
| 88 | * 4 times conversion. |
| 89 | */ |
| 90 | return (10000000 / (period_factor * 4 * 10)); |
| 91 | } |
| 92 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 93 | static void |
Al Viro | 6b3a8bb | 2013-03-31 04:07:31 -0400 | [diff] [blame] | 94 | ahc_format_transinfo(struct seq_file *m, struct ahc_transinfo *tinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 95 | { |
| 96 | u_int speed; |
| 97 | u_int freq; |
| 98 | u_int mb; |
| 99 | |
| 100 | speed = 3300; |
| 101 | freq = 0; |
| 102 | if (tinfo->offset != 0) { |
Christoph Hellwig | 1ff9273 | 2005-08-19 18:57:13 +0200 | [diff] [blame] | 103 | freq = ahc_calc_syncsrate(tinfo->period); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 104 | speed = freq; |
| 105 | } |
| 106 | speed *= (0x01 << tinfo->width); |
| 107 | mb = speed / 1000; |
| 108 | if (mb > 0) |
Al Viro | 6b3a8bb | 2013-03-31 04:07:31 -0400 | [diff] [blame] | 109 | seq_printf(m, "%d.%03dMB/s transfers", mb, speed % 1000); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 110 | else |
Al Viro | 6b3a8bb | 2013-03-31 04:07:31 -0400 | [diff] [blame] | 111 | seq_printf(m, "%dKB/s transfers", speed); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 112 | |
| 113 | if (freq != 0) { |
Al Viro | 6b3a8bb | 2013-03-31 04:07:31 -0400 | [diff] [blame] | 114 | seq_printf(m, " (%d.%03dMHz%s, offset %d", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 115 | freq / 1000, freq % 1000, |
| 116 | (tinfo->ppr_options & MSG_EXT_PPR_DT_REQ) != 0 |
| 117 | ? " DT" : "", tinfo->offset); |
| 118 | } |
| 119 | |
| 120 | if (tinfo->width > 0) { |
| 121 | if (freq != 0) { |
Rasmus Villemoes | 91c40f2 | 2014-12-03 00:10:52 +0100 | [diff] [blame] | 122 | seq_puts(m, ", "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 123 | } else { |
Rasmus Villemoes | 91c40f2 | 2014-12-03 00:10:52 +0100 | [diff] [blame] | 124 | seq_puts(m, " ("); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 125 | } |
Al Viro | 6b3a8bb | 2013-03-31 04:07:31 -0400 | [diff] [blame] | 126 | seq_printf(m, "%dbit)", 8 * (0x01 << tinfo->width)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 127 | } else if (freq != 0) { |
Rasmus Villemoes | f50332f | 2014-12-03 00:10:54 +0100 | [diff] [blame] | 128 | seq_putc(m, ')'); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 129 | } |
Rasmus Villemoes | f50332f | 2014-12-03 00:10:54 +0100 | [diff] [blame] | 130 | seq_putc(m, '\n'); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 131 | } |
| 132 | |
| 133 | static void |
Al Viro | 6b3a8bb | 2013-03-31 04:07:31 -0400 | [diff] [blame] | 134 | ahc_dump_target_state(struct ahc_softc *ahc, struct seq_file *m, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 135 | u_int our_id, char channel, u_int target_id, |
| 136 | u_int target_offset) |
| 137 | { |
James Bottomley | b1abb4d | 2005-05-24 17:15:43 -0500 | [diff] [blame] | 138 | struct scsi_target *starget; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 139 | struct ahc_initiator_tinfo *tinfo; |
| 140 | struct ahc_tmode_tstate *tstate; |
| 141 | int lun; |
| 142 | |
| 143 | tinfo = ahc_fetch_transinfo(ahc, channel, our_id, |
| 144 | target_id, &tstate); |
| 145 | if ((ahc->features & AHC_TWIN) != 0) |
Al Viro | 6b3a8bb | 2013-03-31 04:07:31 -0400 | [diff] [blame] | 146 | seq_printf(m, "Channel %c ", channel); |
| 147 | seq_printf(m, "Target %d Negotiation Settings\n", target_id); |
Rasmus Villemoes | 91c40f2 | 2014-12-03 00:10:52 +0100 | [diff] [blame] | 148 | seq_puts(m, "\tUser: "); |
Al Viro | 6b3a8bb | 2013-03-31 04:07:31 -0400 | [diff] [blame] | 149 | ahc_format_transinfo(m, &tinfo->user); |
James Bottomley | b1abb4d | 2005-05-24 17:15:43 -0500 | [diff] [blame] | 150 | starget = ahc->platform_data->starget[target_offset]; |
James Bottomley | c0df28c | 2005-06-25 16:23:44 -0500 | [diff] [blame] | 151 | if (!starget) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 152 | return; |
| 153 | |
Rasmus Villemoes | 91c40f2 | 2014-12-03 00:10:52 +0100 | [diff] [blame] | 154 | seq_puts(m, "\tGoal: "); |
Al Viro | 6b3a8bb | 2013-03-31 04:07:31 -0400 | [diff] [blame] | 155 | ahc_format_transinfo(m, &tinfo->goal); |
Rasmus Villemoes | 91c40f2 | 2014-12-03 00:10:52 +0100 | [diff] [blame] | 156 | seq_puts(m, "\tCurr: "); |
Al Viro | 6b3a8bb | 2013-03-31 04:07:31 -0400 | [diff] [blame] | 157 | ahc_format_transinfo(m, &tinfo->curr); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 158 | |
| 159 | for (lun = 0; lun < AHC_NUM_LUNS; lun++) { |
James Bottomley | b1abb4d | 2005-05-24 17:15:43 -0500 | [diff] [blame] | 160 | struct scsi_device *sdev; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 161 | |
Hannes Reinecke | 9080063 | 2006-10-23 15:25:36 +0200 | [diff] [blame] | 162 | sdev = scsi_device_lookup_by_target(starget, lun); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 163 | |
James Bottomley | b1abb4d | 2005-05-24 17:15:43 -0500 | [diff] [blame] | 164 | if (sdev == NULL) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 165 | continue; |
| 166 | |
Al Viro | 6b3a8bb | 2013-03-31 04:07:31 -0400 | [diff] [blame] | 167 | ahc_dump_device_state(m, sdev); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 168 | } |
| 169 | } |
| 170 | |
| 171 | static void |
Al Viro | 6b3a8bb | 2013-03-31 04:07:31 -0400 | [diff] [blame] | 172 | ahc_dump_device_state(struct seq_file *m, struct scsi_device *sdev) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 173 | { |
James Bottomley | b1abb4d | 2005-05-24 17:15:43 -0500 | [diff] [blame] | 174 | struct ahc_linux_device *dev = scsi_transport_device_data(sdev); |
| 175 | |
Al Viro | 6b3a8bb | 2013-03-31 04:07:31 -0400 | [diff] [blame] | 176 | seq_printf(m, "\tChannel %c Target %d Lun %d Settings\n", |
James Bottomley | b1abb4d | 2005-05-24 17:15:43 -0500 | [diff] [blame] | 177 | sdev->sdev_target->channel + 'A', |
Hannes Reinecke | 9cb78c1 | 2014-06-25 15:27:36 +0200 | [diff] [blame] | 178 | sdev->sdev_target->id, (u8)sdev->lun); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 179 | |
Al Viro | 6b3a8bb | 2013-03-31 04:07:31 -0400 | [diff] [blame] | 180 | seq_printf(m, "\t\tCommands Queued %ld\n", dev->commands_issued); |
| 181 | seq_printf(m, "\t\tCommands Active %d\n", dev->active); |
| 182 | seq_printf(m, "\t\tCommand Openings %d\n", dev->openings); |
| 183 | seq_printf(m, "\t\tMax Tagged Openings %d\n", dev->maxtags); |
| 184 | seq_printf(m, "\t\tDevice Queue Frozen Count %d\n", dev->qfrozen); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 185 | } |
| 186 | |
Al Viro | 6b3a8bb | 2013-03-31 04:07:31 -0400 | [diff] [blame] | 187 | int |
| 188 | ahc_proc_write_seeprom(struct Scsi_Host *shost, char *buffer, int length) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 189 | { |
Al Viro | 6b3a8bb | 2013-03-31 04:07:31 -0400 | [diff] [blame] | 190 | struct ahc_softc *ahc = *(struct ahc_softc **)shost->hostdata; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 191 | struct seeprom_descriptor sd; |
| 192 | int have_seeprom; |
| 193 | u_long s; |
| 194 | int paused; |
| 195 | int written; |
| 196 | |
| 197 | /* Default to failure. */ |
| 198 | written = -EINVAL; |
| 199 | ahc_lock(ahc, &s); |
| 200 | paused = ahc_is_paused(ahc); |
| 201 | if (!paused) |
| 202 | ahc_pause(ahc); |
| 203 | |
| 204 | if (length != sizeof(struct seeprom_config)) { |
Pekka Enberg | 48813cf | 2010-07-14 13:12:57 +0300 | [diff] [blame] | 205 | printk("ahc_proc_write_seeprom: incorrect buffer size\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 206 | goto done; |
| 207 | } |
| 208 | |
| 209 | have_seeprom = ahc_verify_cksum((struct seeprom_config*)buffer); |
| 210 | if (have_seeprom == 0) { |
Pekka Enberg | 48813cf | 2010-07-14 13:12:57 +0300 | [diff] [blame] | 211 | printk("ahc_proc_write_seeprom: cksum verification failed\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 212 | goto done; |
| 213 | } |
| 214 | |
| 215 | sd.sd_ahc = ahc; |
| 216 | #if AHC_PCI_CONFIG > 0 |
| 217 | if ((ahc->chip & AHC_PCI) != 0) { |
| 218 | sd.sd_control_offset = SEECTL; |
| 219 | sd.sd_status_offset = SEECTL; |
| 220 | sd.sd_dataout_offset = SEECTL; |
| 221 | if (ahc->flags & AHC_LARGE_SEEPROM) |
| 222 | sd.sd_chip = C56_66; |
| 223 | else |
| 224 | sd.sd_chip = C46; |
| 225 | sd.sd_MS = SEEMS; |
| 226 | sd.sd_RDY = SEERDY; |
| 227 | sd.sd_CS = SEECS; |
| 228 | sd.sd_CK = SEECK; |
| 229 | sd.sd_DO = SEEDO; |
| 230 | sd.sd_DI = SEEDI; |
| 231 | have_seeprom = ahc_acquire_seeprom(ahc, &sd); |
| 232 | } else |
| 233 | #endif |
| 234 | if ((ahc->chip & AHC_VL) != 0) { |
| 235 | sd.sd_control_offset = SEECTL_2840; |
| 236 | sd.sd_status_offset = STATUS_2840; |
| 237 | sd.sd_dataout_offset = STATUS_2840; |
| 238 | sd.sd_chip = C46; |
| 239 | sd.sd_MS = 0; |
| 240 | sd.sd_RDY = EEPROM_TF; |
| 241 | sd.sd_CS = CS_2840; |
| 242 | sd.sd_CK = CK_2840; |
| 243 | sd.sd_DO = DO_2840; |
| 244 | sd.sd_DI = DI_2840; |
| 245 | have_seeprom = TRUE; |
| 246 | } else { |
Pekka Enberg | 48813cf | 2010-07-14 13:12:57 +0300 | [diff] [blame] | 247 | printk("ahc_proc_write_seeprom: unsupported adapter type\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 248 | goto done; |
| 249 | } |
| 250 | |
| 251 | if (!have_seeprom) { |
Pekka Enberg | 48813cf | 2010-07-14 13:12:57 +0300 | [diff] [blame] | 252 | printk("ahc_proc_write_seeprom: No Serial EEPROM\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 253 | goto done; |
| 254 | } else { |
| 255 | u_int start_addr; |
| 256 | |
| 257 | if (ahc->seep_config == NULL) { |
Pekka Enberg | 48813cf | 2010-07-14 13:12:57 +0300 | [diff] [blame] | 258 | ahc->seep_config = kmalloc(sizeof(*ahc->seep_config), GFP_ATOMIC); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 259 | if (ahc->seep_config == NULL) { |
Pekka Enberg | 48813cf | 2010-07-14 13:12:57 +0300 | [diff] [blame] | 260 | printk("aic7xxx: Unable to allocate serial " |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 261 | "eeprom buffer. Write failing\n"); |
| 262 | goto done; |
| 263 | } |
| 264 | } |
Pekka Enberg | 48813cf | 2010-07-14 13:12:57 +0300 | [diff] [blame] | 265 | printk("aic7xxx: Writing Serial EEPROM\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 266 | start_addr = 32 * (ahc->channel - 'A'); |
| 267 | ahc_write_seeprom(&sd, (u_int16_t *)buffer, start_addr, |
| 268 | sizeof(struct seeprom_config)/2); |
| 269 | ahc_read_seeprom(&sd, (uint16_t *)ahc->seep_config, |
| 270 | start_addr, sizeof(struct seeprom_config)/2); |
| 271 | #if AHC_PCI_CONFIG > 0 |
| 272 | if ((ahc->chip & AHC_VL) == 0) |
| 273 | ahc_release_seeprom(&sd); |
| 274 | #endif |
| 275 | written = length; |
| 276 | } |
| 277 | |
| 278 | done: |
| 279 | if (!paused) |
| 280 | ahc_unpause(ahc); |
| 281 | ahc_unlock(ahc, &s); |
| 282 | return (written); |
| 283 | } |
| 284 | |
| 285 | /* |
| 286 | * Return information to handle /proc support for the driver. |
| 287 | */ |
| 288 | int |
Al Viro | 6b3a8bb | 2013-03-31 04:07:31 -0400 | [diff] [blame] | 289 | ahc_linux_show_info(struct seq_file *m, struct Scsi_Host *shost) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 290 | { |
Christoph Hellwig | 3d65692 | 2005-06-11 00:14:30 +0200 | [diff] [blame] | 291 | struct ahc_softc *ahc = *(struct ahc_softc **)shost->hostdata; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 292 | char ahc_info[256]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 293 | u_int max_targ; |
| 294 | u_int i; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 295 | |
Al Viro | 6b3a8bb | 2013-03-31 04:07:31 -0400 | [diff] [blame] | 296 | seq_printf(m, "Adaptec AIC7xxx driver version: %s\n", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 297 | AIC7XXX_DRIVER_VERSION); |
Al Viro | 6b3a8bb | 2013-03-31 04:07:31 -0400 | [diff] [blame] | 298 | seq_printf(m, "%s\n", ahc->description); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 299 | ahc_controller_info(ahc, ahc_info); |
Al Viro | 6b3a8bb | 2013-03-31 04:07:31 -0400 | [diff] [blame] | 300 | seq_printf(m, "%s\n", ahc_info); |
| 301 | seq_printf(m, "Allocated SCBs: %d, SG List Length: %d\n\n", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 302 | ahc->scb_data->numscbs, AHC_NSEG); |
| 303 | |
| 304 | |
| 305 | if (ahc->seep_config == NULL) |
Rasmus Villemoes | 91c40f2 | 2014-12-03 00:10:52 +0100 | [diff] [blame] | 306 | seq_puts(m, "No Serial EEPROM\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 307 | else { |
Rasmus Villemoes | 91c40f2 | 2014-12-03 00:10:52 +0100 | [diff] [blame] | 308 | seq_puts(m, "Serial EEPROM:\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 309 | for (i = 0; i < sizeof(*ahc->seep_config)/2; i++) { |
| 310 | if (((i % 8) == 0) && (i != 0)) { |
Rasmus Villemoes | f50332f | 2014-12-03 00:10:54 +0100 | [diff] [blame] | 311 | seq_putc(m, '\n'); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 312 | } |
Al Viro | 6b3a8bb | 2013-03-31 04:07:31 -0400 | [diff] [blame] | 313 | seq_printf(m, "0x%.4x ", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 314 | ((uint16_t*)ahc->seep_config)[i]); |
| 315 | } |
Rasmus Villemoes | f50332f | 2014-12-03 00:10:54 +0100 | [diff] [blame] | 316 | seq_putc(m, '\n'); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 317 | } |
Rasmus Villemoes | f50332f | 2014-12-03 00:10:54 +0100 | [diff] [blame] | 318 | seq_putc(m, '\n'); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 319 | |
Hannes Reinecke | 9080063 | 2006-10-23 15:25:36 +0200 | [diff] [blame] | 320 | max_targ = 16; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 321 | if ((ahc->features & (AHC_WIDE|AHC_TWIN)) == 0) |
Hannes Reinecke | 9080063 | 2006-10-23 15:25:36 +0200 | [diff] [blame] | 322 | max_targ = 8; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 323 | |
Hannes Reinecke | 9080063 | 2006-10-23 15:25:36 +0200 | [diff] [blame] | 324 | for (i = 0; i < max_targ; i++) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 325 | u_int our_id; |
| 326 | u_int target_id; |
| 327 | char channel; |
| 328 | |
| 329 | channel = 'A'; |
| 330 | our_id = ahc->our_id; |
| 331 | target_id = i; |
| 332 | if (i > 7 && (ahc->features & AHC_TWIN) != 0) { |
| 333 | channel = 'B'; |
| 334 | our_id = ahc->our_id_b; |
| 335 | target_id = i % 8; |
| 336 | } |
| 337 | |
Al Viro | 6b3a8bb | 2013-03-31 04:07:31 -0400 | [diff] [blame] | 338 | ahc_dump_target_state(ahc, m, our_id, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 339 | channel, target_id, i); |
| 340 | } |
Al Viro | 6b3a8bb | 2013-03-31 04:07:31 -0400 | [diff] [blame] | 341 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 342 | } |