11da177e4SLinus Torvalds /* 21da177e4SLinus Torvalds * Copyright (c) 2000-2001 Adaptec Inc. 31da177e4SLinus Torvalds * All rights reserved. 41da177e4SLinus Torvalds * 51da177e4SLinus Torvalds * Redistribution and use in source and binary forms, with or without 61da177e4SLinus Torvalds * modification, are permitted provided that the following conditions 71da177e4SLinus Torvalds * are met: 81da177e4SLinus Torvalds * 1. Redistributions of source code must retain the above copyright 91da177e4SLinus Torvalds * notice, this list of conditions, and the following disclaimer, 101da177e4SLinus Torvalds * without modification. 111da177e4SLinus Torvalds * 2. Redistributions in binary form must reproduce at minimum a disclaimer 121da177e4SLinus Torvalds * substantially similar to the "NO WARRANTY" disclaimer below 131da177e4SLinus Torvalds * ("Disclaimer") and any redistribution must be conditioned upon 141da177e4SLinus Torvalds * including a substantially similar Disclaimer requirement for further 151da177e4SLinus Torvalds * binary redistribution. 161da177e4SLinus Torvalds * 3. Neither the names of the above-listed copyright holders nor the names 171da177e4SLinus Torvalds * of any contributors may be used to endorse or promote products derived 181da177e4SLinus Torvalds * from this software without specific prior written permission. 191da177e4SLinus Torvalds * 201da177e4SLinus Torvalds * Alternatively, this software may be distributed under the terms of the 211da177e4SLinus Torvalds * GNU General Public License ("GPL") version 2 as published by the Free 221da177e4SLinus Torvalds * Software Foundation. 231da177e4SLinus Torvalds * 241da177e4SLinus Torvalds * NO WARRANTY 251da177e4SLinus Torvalds * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 261da177e4SLinus Torvalds * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 271da177e4SLinus Torvalds * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 281da177e4SLinus Torvalds * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 291da177e4SLinus Torvalds * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 301da177e4SLinus Torvalds * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 311da177e4SLinus Torvalds * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 321da177e4SLinus Torvalds * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 331da177e4SLinus Torvalds * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 341da177e4SLinus Torvalds * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 351da177e4SLinus Torvalds * POSSIBILITY OF SUCH DAMAGES. 361da177e4SLinus Torvalds * 371da177e4SLinus Torvalds * String handling code courtesy of Gerard Roudier's <groudier@club-internet.fr> 381da177e4SLinus Torvalds * sym driver. 391da177e4SLinus Torvalds * 401da177e4SLinus Torvalds * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_proc.c#19 $ 411da177e4SLinus Torvalds */ 421da177e4SLinus Torvalds #include "aic79xx_osm.h" 431da177e4SLinus Torvalds #include "aic79xx_inline.h" 441da177e4SLinus Torvalds 451da177e4SLinus Torvalds static void copy_mem_info(struct info_str *info, char *data, int len); 461da177e4SLinus Torvalds static int copy_info(struct info_str *info, char *fmt, ...); 471da177e4SLinus Torvalds static void ahd_dump_target_state(struct ahd_softc *ahd, 481da177e4SLinus Torvalds struct info_str *info, 491da177e4SLinus Torvalds u_int our_id, char channel, 50f89d0a4eSHannes Reinecke u_int target_id); 511da177e4SLinus Torvalds static void ahd_dump_device_state(struct info_str *info, 5273a25462SHannes Reinecke struct scsi_device *sdev); 531da177e4SLinus Torvalds static int ahd_proc_write_seeprom(struct ahd_softc *ahd, 541da177e4SLinus Torvalds char *buffer, int length); 551da177e4SLinus Torvalds 561ff92730SChristoph Hellwig /* 571ff92730SChristoph Hellwig * Table of syncrates that don't follow the "divisible by 4" 581ff92730SChristoph Hellwig * rule. This table will be expanded in future SCSI specs. 591ff92730SChristoph Hellwig */ 60980b306aSDenys Vlasenko static const struct { 611ff92730SChristoph Hellwig u_int period_factor; 621ff92730SChristoph Hellwig u_int period; /* in 100ths of ns */ 631ff92730SChristoph Hellwig } scsi_syncrates[] = { 641ff92730SChristoph Hellwig { 0x08, 625 }, /* FAST-160 */ 651ff92730SChristoph Hellwig { 0x09, 1250 }, /* FAST-80 */ 661ff92730SChristoph Hellwig { 0x0a, 2500 }, /* FAST-40 40MHz */ 671ff92730SChristoph Hellwig { 0x0b, 3030 }, /* FAST-40 33MHz */ 681ff92730SChristoph Hellwig { 0x0c, 5000 } /* FAST-20 */ 691ff92730SChristoph Hellwig }; 701ff92730SChristoph Hellwig 711ff92730SChristoph Hellwig /* 721ff92730SChristoph Hellwig * Return the frequency in kHz corresponding to the given 731ff92730SChristoph Hellwig * sync period factor. 741ff92730SChristoph Hellwig */ 751ff92730SChristoph Hellwig static u_int 761ff92730SChristoph Hellwig ahd_calc_syncsrate(u_int period_factor) 771ff92730SChristoph Hellwig { 781ff92730SChristoph Hellwig int i; 791ff92730SChristoph Hellwig 801ff92730SChristoph Hellwig /* See if the period is in the "exception" table */ 816391a113STobias Klauser for (i = 0; i < ARRAY_SIZE(scsi_syncrates); i++) { 821ff92730SChristoph Hellwig 831ff92730SChristoph Hellwig if (period_factor == scsi_syncrates[i].period_factor) { 841ff92730SChristoph Hellwig /* Period in kHz */ 851ff92730SChristoph Hellwig return (100000000 / scsi_syncrates[i].period); 861ff92730SChristoph Hellwig } 871ff92730SChristoph Hellwig } 881ff92730SChristoph Hellwig 891ff92730SChristoph Hellwig /* 901ff92730SChristoph Hellwig * Wasn't in the table, so use the standard 911ff92730SChristoph Hellwig * 4 times conversion. 921ff92730SChristoph Hellwig */ 931ff92730SChristoph Hellwig return (10000000 / (period_factor * 4 * 10)); 941ff92730SChristoph Hellwig } 951ff92730SChristoph Hellwig 961ff92730SChristoph Hellwig 971da177e4SLinus Torvalds static void 981da177e4SLinus Torvalds copy_mem_info(struct info_str *info, char *data, int len) 991da177e4SLinus Torvalds { 1001da177e4SLinus Torvalds if (info->pos + len > info->offset + info->length) 1011da177e4SLinus Torvalds len = info->offset + info->length - info->pos; 1021da177e4SLinus Torvalds 1031da177e4SLinus Torvalds if (info->pos + len < info->offset) { 1041da177e4SLinus Torvalds info->pos += len; 1051da177e4SLinus Torvalds return; 1061da177e4SLinus Torvalds } 1071da177e4SLinus Torvalds 1081da177e4SLinus Torvalds if (info->pos < info->offset) { 1091da177e4SLinus Torvalds off_t partial; 1101da177e4SLinus Torvalds 1111da177e4SLinus Torvalds partial = info->offset - info->pos; 1121da177e4SLinus Torvalds data += partial; 1131da177e4SLinus Torvalds info->pos += partial; 1141da177e4SLinus Torvalds len -= partial; 1151da177e4SLinus Torvalds } 1161da177e4SLinus Torvalds 1171da177e4SLinus Torvalds if (len > 0) { 1181da177e4SLinus Torvalds memcpy(info->buffer, data, len); 1191da177e4SLinus Torvalds info->pos += len; 1201da177e4SLinus Torvalds info->buffer += len; 1211da177e4SLinus Torvalds } 1221da177e4SLinus Torvalds } 1231da177e4SLinus Torvalds 1241da177e4SLinus Torvalds static int 1251da177e4SLinus Torvalds copy_info(struct info_str *info, char *fmt, ...) 1261da177e4SLinus Torvalds { 1271da177e4SLinus Torvalds va_list args; 1281da177e4SLinus Torvalds char buf[256]; 1291da177e4SLinus Torvalds int len; 1301da177e4SLinus Torvalds 1311da177e4SLinus Torvalds va_start(args, fmt); 1321da177e4SLinus Torvalds len = vsprintf(buf, fmt, args); 1331da177e4SLinus Torvalds va_end(args); 1341da177e4SLinus Torvalds 1351da177e4SLinus Torvalds copy_mem_info(info, buf, len); 1361da177e4SLinus Torvalds return (len); 1371da177e4SLinus Torvalds } 1381da177e4SLinus Torvalds 139289fe5b1SAdrian Bunk static void 1401da177e4SLinus Torvalds ahd_format_transinfo(struct info_str *info, struct ahd_transinfo *tinfo) 1411da177e4SLinus Torvalds { 1421da177e4SLinus Torvalds u_int speed; 1431da177e4SLinus Torvalds u_int freq; 1441da177e4SLinus Torvalds u_int mb; 1451da177e4SLinus Torvalds 1461da177e4SLinus Torvalds if (tinfo->period == AHD_PERIOD_UNKNOWN) { 1471da177e4SLinus Torvalds copy_info(info, "Renegotiation Pending\n"); 1481da177e4SLinus Torvalds return; 1491da177e4SLinus Torvalds } 1501da177e4SLinus Torvalds speed = 3300; 1511da177e4SLinus Torvalds freq = 0; 1521da177e4SLinus Torvalds if (tinfo->offset != 0) { 1531ff92730SChristoph Hellwig freq = ahd_calc_syncsrate(tinfo->period); 1541da177e4SLinus Torvalds speed = freq; 1551da177e4SLinus Torvalds } 1561da177e4SLinus Torvalds speed *= (0x01 << tinfo->width); 1571da177e4SLinus Torvalds mb = speed / 1000; 1581da177e4SLinus Torvalds if (mb > 0) 1591da177e4SLinus Torvalds copy_info(info, "%d.%03dMB/s transfers", mb, speed % 1000); 1601da177e4SLinus Torvalds else 1611da177e4SLinus Torvalds copy_info(info, "%dKB/s transfers", speed); 1621da177e4SLinus Torvalds 1631da177e4SLinus Torvalds if (freq != 0) { 1641da177e4SLinus Torvalds int printed_options; 1651da177e4SLinus Torvalds 1661da177e4SLinus Torvalds printed_options = 0; 1671da177e4SLinus Torvalds copy_info(info, " (%d.%03dMHz", freq / 1000, freq % 1000); 1681da177e4SLinus Torvalds if ((tinfo->ppr_options & MSG_EXT_PPR_RD_STRM) != 0) { 1691da177e4SLinus Torvalds copy_info(info, " RDSTRM"); 1701da177e4SLinus Torvalds printed_options++; 1711da177e4SLinus Torvalds } 1721da177e4SLinus Torvalds if ((tinfo->ppr_options & MSG_EXT_PPR_DT_REQ) != 0) { 1731da177e4SLinus Torvalds copy_info(info, "%s", printed_options ? "|DT" : " DT"); 1741da177e4SLinus Torvalds printed_options++; 1751da177e4SLinus Torvalds } 1761da177e4SLinus Torvalds if ((tinfo->ppr_options & MSG_EXT_PPR_IU_REQ) != 0) { 1771da177e4SLinus Torvalds copy_info(info, "%s", printed_options ? "|IU" : " IU"); 1781da177e4SLinus Torvalds printed_options++; 1791da177e4SLinus Torvalds } 1801da177e4SLinus Torvalds if ((tinfo->ppr_options & MSG_EXT_PPR_RTI) != 0) { 1811da177e4SLinus Torvalds copy_info(info, "%s", 1821da177e4SLinus Torvalds printed_options ? "|RTI" : " RTI"); 1831da177e4SLinus Torvalds printed_options++; 1841da177e4SLinus Torvalds } 1851da177e4SLinus Torvalds if ((tinfo->ppr_options & MSG_EXT_PPR_QAS_REQ) != 0) { 1861da177e4SLinus Torvalds copy_info(info, "%s", 1871da177e4SLinus Torvalds printed_options ? "|QAS" : " QAS"); 1881da177e4SLinus Torvalds printed_options++; 1891da177e4SLinus Torvalds } 1901da177e4SLinus Torvalds } 1911da177e4SLinus Torvalds 1921da177e4SLinus Torvalds if (tinfo->width > 0) { 1931da177e4SLinus Torvalds if (freq != 0) { 1941da177e4SLinus Torvalds copy_info(info, ", "); 1951da177e4SLinus Torvalds } else { 1961da177e4SLinus Torvalds copy_info(info, " ("); 1971da177e4SLinus Torvalds } 1981da177e4SLinus Torvalds copy_info(info, "%dbit)", 8 * (0x01 << tinfo->width)); 1991da177e4SLinus Torvalds } else if (freq != 0) { 2001da177e4SLinus Torvalds copy_info(info, ")"); 2011da177e4SLinus Torvalds } 2021da177e4SLinus Torvalds copy_info(info, "\n"); 2031da177e4SLinus Torvalds } 2041da177e4SLinus Torvalds 2051da177e4SLinus Torvalds static void 2061da177e4SLinus Torvalds ahd_dump_target_state(struct ahd_softc *ahd, struct info_str *info, 207f89d0a4eSHannes Reinecke u_int our_id, char channel, u_int target_id) 2081da177e4SLinus Torvalds { 20973a25462SHannes Reinecke struct scsi_target *starget; 2101da177e4SLinus Torvalds struct ahd_initiator_tinfo *tinfo; 2111da177e4SLinus Torvalds struct ahd_tmode_tstate *tstate; 2121da177e4SLinus Torvalds int lun; 2131da177e4SLinus Torvalds 2141da177e4SLinus Torvalds tinfo = ahd_fetch_transinfo(ahd, channel, our_id, 2151da177e4SLinus Torvalds target_id, &tstate); 2161da177e4SLinus Torvalds copy_info(info, "Target %d Negotiation Settings\n", target_id); 2171da177e4SLinus Torvalds copy_info(info, "\tUser: "); 2181da177e4SLinus Torvalds ahd_format_transinfo(info, &tinfo->user); 219f89d0a4eSHannes Reinecke starget = ahd->platform_data->starget[target_id]; 2203f40d7d6SJames Bottomley if (starget == NULL) 2211da177e4SLinus Torvalds return; 2221da177e4SLinus Torvalds 2231da177e4SLinus Torvalds copy_info(info, "\tGoal: "); 2241da177e4SLinus Torvalds ahd_format_transinfo(info, &tinfo->goal); 2251da177e4SLinus Torvalds copy_info(info, "\tCurr: "); 2261da177e4SLinus Torvalds ahd_format_transinfo(info, &tinfo->curr); 2271da177e4SLinus Torvalds 2281da177e4SLinus Torvalds for (lun = 0; lun < AHD_NUM_LUNS; lun++) { 22973a25462SHannes Reinecke struct scsi_device *dev; 2301da177e4SLinus Torvalds 231f89d0a4eSHannes Reinecke dev = scsi_device_lookup_by_target(starget, lun); 2321da177e4SLinus Torvalds 2331da177e4SLinus Torvalds if (dev == NULL) 2341da177e4SLinus Torvalds continue; 2351da177e4SLinus Torvalds 2361da177e4SLinus Torvalds ahd_dump_device_state(info, dev); 2371da177e4SLinus Torvalds } 2381da177e4SLinus Torvalds } 2391da177e4SLinus Torvalds 2401da177e4SLinus Torvalds static void 24173a25462SHannes Reinecke ahd_dump_device_state(struct info_str *info, struct scsi_device *sdev) 2421da177e4SLinus Torvalds { 24373a25462SHannes Reinecke struct ahd_linux_device *dev = scsi_transport_device_data(sdev); 24473a25462SHannes Reinecke 2451da177e4SLinus Torvalds copy_info(info, "\tChannel %c Target %d Lun %d Settings\n", 24673a25462SHannes Reinecke sdev->sdev_target->channel + 'A', 24773a25462SHannes Reinecke sdev->sdev_target->id, sdev->lun); 2481da177e4SLinus Torvalds 2491da177e4SLinus Torvalds copy_info(info, "\t\tCommands Queued %ld\n", dev->commands_issued); 2501da177e4SLinus Torvalds copy_info(info, "\t\tCommands Active %d\n", dev->active); 2511da177e4SLinus Torvalds copy_info(info, "\t\tCommand Openings %d\n", dev->openings); 2521da177e4SLinus Torvalds copy_info(info, "\t\tMax Tagged Openings %d\n", dev->maxtags); 2531da177e4SLinus Torvalds copy_info(info, "\t\tDevice Queue Frozen Count %d\n", dev->qfrozen); 2541da177e4SLinus Torvalds } 2551da177e4SLinus Torvalds 2561da177e4SLinus Torvalds static int 2571da177e4SLinus Torvalds ahd_proc_write_seeprom(struct ahd_softc *ahd, char *buffer, int length) 2581da177e4SLinus Torvalds { 2591da177e4SLinus Torvalds ahd_mode_state saved_modes; 2601da177e4SLinus Torvalds int have_seeprom; 2611da177e4SLinus Torvalds u_long s; 2621da177e4SLinus Torvalds int paused; 2631da177e4SLinus Torvalds int written; 2641da177e4SLinus Torvalds 2651da177e4SLinus Torvalds /* Default to failure. */ 2661da177e4SLinus Torvalds written = -EINVAL; 2671da177e4SLinus Torvalds ahd_lock(ahd, &s); 2681da177e4SLinus Torvalds paused = ahd_is_paused(ahd); 2691da177e4SLinus Torvalds if (!paused) 2701da177e4SLinus Torvalds ahd_pause(ahd); 2711da177e4SLinus Torvalds 2721da177e4SLinus Torvalds saved_modes = ahd_save_modes(ahd); 2731da177e4SLinus Torvalds ahd_set_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI); 2741da177e4SLinus Torvalds if (length != sizeof(struct seeprom_config)) { 2751da177e4SLinus Torvalds printf("ahd_proc_write_seeprom: incorrect buffer size\n"); 2761da177e4SLinus Torvalds goto done; 2771da177e4SLinus Torvalds } 2781da177e4SLinus Torvalds 2791da177e4SLinus Torvalds have_seeprom = ahd_verify_cksum((struct seeprom_config*)buffer); 2801da177e4SLinus Torvalds if (have_seeprom == 0) { 2811da177e4SLinus Torvalds printf("ahd_proc_write_seeprom: cksum verification failed\n"); 2821da177e4SLinus Torvalds goto done; 2831da177e4SLinus Torvalds } 2841da177e4SLinus Torvalds 2851da177e4SLinus Torvalds have_seeprom = ahd_acquire_seeprom(ahd); 2861da177e4SLinus Torvalds if (!have_seeprom) { 2871da177e4SLinus Torvalds printf("ahd_proc_write_seeprom: No Serial EEPROM\n"); 2881da177e4SLinus Torvalds goto done; 2891da177e4SLinus Torvalds } else { 2901da177e4SLinus Torvalds u_int start_addr; 2911da177e4SLinus Torvalds 2921da177e4SLinus Torvalds if (ahd->seep_config == NULL) { 2931da177e4SLinus Torvalds ahd->seep_config = malloc(sizeof(*ahd->seep_config), 2941da177e4SLinus Torvalds M_DEVBUF, M_NOWAIT); 2951da177e4SLinus Torvalds if (ahd->seep_config == NULL) { 2961da177e4SLinus Torvalds printf("aic79xx: Unable to allocate serial " 2971da177e4SLinus Torvalds "eeprom buffer. Write failing\n"); 2981da177e4SLinus Torvalds goto done; 2991da177e4SLinus Torvalds } 3001da177e4SLinus Torvalds } 3011da177e4SLinus Torvalds printf("aic79xx: Writing Serial EEPROM\n"); 3021da177e4SLinus Torvalds start_addr = 32 * (ahd->channel - 'A'); 3031da177e4SLinus Torvalds ahd_write_seeprom(ahd, (u_int16_t *)buffer, start_addr, 3041da177e4SLinus Torvalds sizeof(struct seeprom_config)/2); 3051da177e4SLinus Torvalds ahd_read_seeprom(ahd, (uint16_t *)ahd->seep_config, 3061da177e4SLinus Torvalds start_addr, sizeof(struct seeprom_config)/2, 3071da177e4SLinus Torvalds /*ByteStream*/FALSE); 3081da177e4SLinus Torvalds ahd_release_seeprom(ahd); 3091da177e4SLinus Torvalds written = length; 3101da177e4SLinus Torvalds } 3111da177e4SLinus Torvalds 3121da177e4SLinus Torvalds done: 3131da177e4SLinus Torvalds ahd_restore_modes(ahd, saved_modes); 3141da177e4SLinus Torvalds if (!paused) 3151da177e4SLinus Torvalds ahd_unpause(ahd); 3161da177e4SLinus Torvalds ahd_unlock(ahd, &s); 3171da177e4SLinus Torvalds return (written); 3181da177e4SLinus Torvalds } 3191da177e4SLinus Torvalds /* 3201da177e4SLinus Torvalds * Return information to handle /proc support for the driver. 3211da177e4SLinus Torvalds */ 3221da177e4SLinus Torvalds int 3231da177e4SLinus Torvalds ahd_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start, 3241da177e4SLinus Torvalds off_t offset, int length, int inout) 3251da177e4SLinus Torvalds { 32685a46523SChristoph Hellwig struct ahd_softc *ahd = *(struct ahd_softc **)shost->hostdata; 3271da177e4SLinus Torvalds struct info_str info; 3281da177e4SLinus Torvalds char ahd_info[256]; 3291da177e4SLinus Torvalds u_int max_targ; 3301da177e4SLinus Torvalds u_int i; 3311da177e4SLinus Torvalds int retval; 3321da177e4SLinus Torvalds 3331da177e4SLinus Torvalds /* Has data been written to the file? */ 3341da177e4SLinus Torvalds if (inout == TRUE) { 3351da177e4SLinus Torvalds retval = ahd_proc_write_seeprom(ahd, buffer, length); 3361da177e4SLinus Torvalds goto done; 3371da177e4SLinus Torvalds } 3381da177e4SLinus Torvalds 3391da177e4SLinus Torvalds if (start) 3401da177e4SLinus Torvalds *start = buffer; 3411da177e4SLinus Torvalds 3421da177e4SLinus Torvalds info.buffer = buffer; 3431da177e4SLinus Torvalds info.length = length; 3441da177e4SLinus Torvalds info.offset = offset; 3451da177e4SLinus Torvalds info.pos = 0; 3461da177e4SLinus Torvalds 3471da177e4SLinus Torvalds copy_info(&info, "Adaptec AIC79xx driver version: %s\n", 3481da177e4SLinus Torvalds AIC79XX_DRIVER_VERSION); 3491da177e4SLinus Torvalds copy_info(&info, "%s\n", ahd->description); 3501da177e4SLinus Torvalds ahd_controller_info(ahd, ahd_info); 3511da177e4SLinus Torvalds copy_info(&info, "%s\n", ahd_info); 3521da177e4SLinus Torvalds copy_info(&info, "Allocated SCBs: %d, SG List Length: %d\n\n", 3531da177e4SLinus Torvalds ahd->scb_data.numscbs, AHD_NSEG); 3541da177e4SLinus Torvalds 355f89d0a4eSHannes Reinecke max_targ = 16; 3561da177e4SLinus Torvalds 3571da177e4SLinus Torvalds if (ahd->seep_config == NULL) 3581da177e4SLinus Torvalds copy_info(&info, "No Serial EEPROM\n"); 3591da177e4SLinus Torvalds else { 3601da177e4SLinus Torvalds copy_info(&info, "Serial EEPROM:\n"); 3611da177e4SLinus Torvalds for (i = 0; i < sizeof(*ahd->seep_config)/2; i++) { 3621da177e4SLinus Torvalds if (((i % 8) == 0) && (i != 0)) { 3631da177e4SLinus Torvalds copy_info(&info, "\n"); 3641da177e4SLinus Torvalds } 3651da177e4SLinus Torvalds copy_info(&info, "0x%.4x ", 3661da177e4SLinus Torvalds ((uint16_t*)ahd->seep_config)[i]); 3671da177e4SLinus Torvalds } 3681da177e4SLinus Torvalds copy_info(&info, "\n"); 3691da177e4SLinus Torvalds } 3701da177e4SLinus Torvalds copy_info(&info, "\n"); 3711da177e4SLinus Torvalds 3721da177e4SLinus Torvalds if ((ahd->features & AHD_WIDE) == 0) 373f89d0a4eSHannes Reinecke max_targ = 8; 3741da177e4SLinus Torvalds 375f89d0a4eSHannes Reinecke for (i = 0; i < max_targ; i++) { 3761da177e4SLinus Torvalds 3771da177e4SLinus Torvalds ahd_dump_target_state(ahd, &info, ahd->our_id, 'A', 378f89d0a4eSHannes Reinecke /*target_id*/i); 3791da177e4SLinus Torvalds } 3801da177e4SLinus Torvalds retval = info.pos > info.offset ? info.pos - info.offset : 0; 3811da177e4SLinus Torvalds done: 3821da177e4SLinus Torvalds return (retval); 3831da177e4SLinus Torvalds } 384