18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Copyright (c) 2000-2001 Adaptec Inc. 38c2ecf20Sopenharmony_ci * All rights reserved. 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Redistribution and use in source and binary forms, with or without 68c2ecf20Sopenharmony_ci * modification, are permitted provided that the following conditions 78c2ecf20Sopenharmony_ci * are met: 88c2ecf20Sopenharmony_ci * 1. Redistributions of source code must retain the above copyright 98c2ecf20Sopenharmony_ci * notice, this list of conditions, and the following disclaimer, 108c2ecf20Sopenharmony_ci * without modification. 118c2ecf20Sopenharmony_ci * 2. Redistributions in binary form must reproduce at minimum a disclaimer 128c2ecf20Sopenharmony_ci * substantially similar to the "NO WARRANTY" disclaimer below 138c2ecf20Sopenharmony_ci * ("Disclaimer") and any redistribution must be conditioned upon 148c2ecf20Sopenharmony_ci * including a substantially similar Disclaimer requirement for further 158c2ecf20Sopenharmony_ci * binary redistribution. 168c2ecf20Sopenharmony_ci * 3. Neither the names of the above-listed copyright holders nor the names 178c2ecf20Sopenharmony_ci * of any contributors may be used to endorse or promote products derived 188c2ecf20Sopenharmony_ci * from this software without specific prior written permission. 198c2ecf20Sopenharmony_ci * 208c2ecf20Sopenharmony_ci * Alternatively, this software may be distributed under the terms of the 218c2ecf20Sopenharmony_ci * GNU General Public License ("GPL") version 2 as published by the Free 228c2ecf20Sopenharmony_ci * Software Foundation. 238c2ecf20Sopenharmony_ci * 248c2ecf20Sopenharmony_ci * NO WARRANTY 258c2ecf20Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 268c2ecf20Sopenharmony_ci * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 278c2ecf20Sopenharmony_ci * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 288c2ecf20Sopenharmony_ci * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 298c2ecf20Sopenharmony_ci * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 308c2ecf20Sopenharmony_ci * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 318c2ecf20Sopenharmony_ci * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 328c2ecf20Sopenharmony_ci * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 338c2ecf20Sopenharmony_ci * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 348c2ecf20Sopenharmony_ci * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 358c2ecf20Sopenharmony_ci * POSSIBILITY OF SUCH DAMAGES. 368c2ecf20Sopenharmony_ci * 378c2ecf20Sopenharmony_ci * String handling code courtesy of Gerard Roudier's <groudier@club-internet.fr> 388c2ecf20Sopenharmony_ci * sym driver. 398c2ecf20Sopenharmony_ci * 408c2ecf20Sopenharmony_ci * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_proc.c#29 $ 418c2ecf20Sopenharmony_ci */ 428c2ecf20Sopenharmony_ci#include "aic7xxx_osm.h" 438c2ecf20Sopenharmony_ci#include "aic7xxx_inline.h" 448c2ecf20Sopenharmony_ci#include "aic7xxx_93cx6.h" 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_cistatic void ahc_dump_target_state(struct ahc_softc *ahc, 478c2ecf20Sopenharmony_ci struct seq_file *m, 488c2ecf20Sopenharmony_ci u_int our_id, char channel, 498c2ecf20Sopenharmony_ci u_int target_id, u_int target_offset); 508c2ecf20Sopenharmony_cistatic void ahc_dump_device_state(struct seq_file *m, 518c2ecf20Sopenharmony_ci struct scsi_device *dev); 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ci/* 548c2ecf20Sopenharmony_ci * Table of syncrates that don't follow the "divisible by 4" 558c2ecf20Sopenharmony_ci * rule. This table will be expanded in future SCSI specs. 568c2ecf20Sopenharmony_ci */ 578c2ecf20Sopenharmony_cistatic const struct { 588c2ecf20Sopenharmony_ci u_int period_factor; 598c2ecf20Sopenharmony_ci u_int period; /* in 100ths of ns */ 608c2ecf20Sopenharmony_ci} scsi_syncrates[] = { 618c2ecf20Sopenharmony_ci { 0x08, 625 }, /* FAST-160 */ 628c2ecf20Sopenharmony_ci { 0x09, 1250 }, /* FAST-80 */ 638c2ecf20Sopenharmony_ci { 0x0a, 2500 }, /* FAST-40 40MHz */ 648c2ecf20Sopenharmony_ci { 0x0b, 3030 }, /* FAST-40 33MHz */ 658c2ecf20Sopenharmony_ci { 0x0c, 5000 } /* FAST-20 */ 668c2ecf20Sopenharmony_ci}; 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ci/* 698c2ecf20Sopenharmony_ci * Return the frequency in kHz corresponding to the given 708c2ecf20Sopenharmony_ci * sync period factor. 718c2ecf20Sopenharmony_ci */ 728c2ecf20Sopenharmony_cistatic u_int 738c2ecf20Sopenharmony_ciahc_calc_syncsrate(u_int period_factor) 748c2ecf20Sopenharmony_ci{ 758c2ecf20Sopenharmony_ci int i; 768c2ecf20Sopenharmony_ci 778c2ecf20Sopenharmony_ci /* See if the period is in the "exception" table */ 788c2ecf20Sopenharmony_ci for (i = 0; i < ARRAY_SIZE(scsi_syncrates); i++) { 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_ci if (period_factor == scsi_syncrates[i].period_factor) { 818c2ecf20Sopenharmony_ci /* Period in kHz */ 828c2ecf20Sopenharmony_ci return (100000000 / scsi_syncrates[i].period); 838c2ecf20Sopenharmony_ci } 848c2ecf20Sopenharmony_ci } 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ci /* 878c2ecf20Sopenharmony_ci * Wasn't in the table, so use the standard 888c2ecf20Sopenharmony_ci * 4 times conversion. 898c2ecf20Sopenharmony_ci */ 908c2ecf20Sopenharmony_ci return (10000000 / (period_factor * 4 * 10)); 918c2ecf20Sopenharmony_ci} 928c2ecf20Sopenharmony_ci 938c2ecf20Sopenharmony_cistatic void 948c2ecf20Sopenharmony_ciahc_format_transinfo(struct seq_file *m, struct ahc_transinfo *tinfo) 958c2ecf20Sopenharmony_ci{ 968c2ecf20Sopenharmony_ci u_int speed; 978c2ecf20Sopenharmony_ci u_int freq; 988c2ecf20Sopenharmony_ci u_int mb; 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_ci speed = 3300; 1018c2ecf20Sopenharmony_ci freq = 0; 1028c2ecf20Sopenharmony_ci if (tinfo->offset != 0) { 1038c2ecf20Sopenharmony_ci freq = ahc_calc_syncsrate(tinfo->period); 1048c2ecf20Sopenharmony_ci speed = freq; 1058c2ecf20Sopenharmony_ci } 1068c2ecf20Sopenharmony_ci speed *= (0x01 << tinfo->width); 1078c2ecf20Sopenharmony_ci mb = speed / 1000; 1088c2ecf20Sopenharmony_ci if (mb > 0) 1098c2ecf20Sopenharmony_ci seq_printf(m, "%d.%03dMB/s transfers", mb, speed % 1000); 1108c2ecf20Sopenharmony_ci else 1118c2ecf20Sopenharmony_ci seq_printf(m, "%dKB/s transfers", speed); 1128c2ecf20Sopenharmony_ci 1138c2ecf20Sopenharmony_ci if (freq != 0) { 1148c2ecf20Sopenharmony_ci seq_printf(m, " (%d.%03dMHz%s, offset %d", 1158c2ecf20Sopenharmony_ci freq / 1000, freq % 1000, 1168c2ecf20Sopenharmony_ci (tinfo->ppr_options & MSG_EXT_PPR_DT_REQ) != 0 1178c2ecf20Sopenharmony_ci ? " DT" : "", tinfo->offset); 1188c2ecf20Sopenharmony_ci } 1198c2ecf20Sopenharmony_ci 1208c2ecf20Sopenharmony_ci if (tinfo->width > 0) { 1218c2ecf20Sopenharmony_ci if (freq != 0) { 1228c2ecf20Sopenharmony_ci seq_puts(m, ", "); 1238c2ecf20Sopenharmony_ci } else { 1248c2ecf20Sopenharmony_ci seq_puts(m, " ("); 1258c2ecf20Sopenharmony_ci } 1268c2ecf20Sopenharmony_ci seq_printf(m, "%dbit)", 8 * (0x01 << tinfo->width)); 1278c2ecf20Sopenharmony_ci } else if (freq != 0) { 1288c2ecf20Sopenharmony_ci seq_putc(m, ')'); 1298c2ecf20Sopenharmony_ci } 1308c2ecf20Sopenharmony_ci seq_putc(m, '\n'); 1318c2ecf20Sopenharmony_ci} 1328c2ecf20Sopenharmony_ci 1338c2ecf20Sopenharmony_cistatic void 1348c2ecf20Sopenharmony_ciahc_dump_target_state(struct ahc_softc *ahc, struct seq_file *m, 1358c2ecf20Sopenharmony_ci u_int our_id, char channel, u_int target_id, 1368c2ecf20Sopenharmony_ci u_int target_offset) 1378c2ecf20Sopenharmony_ci{ 1388c2ecf20Sopenharmony_ci struct scsi_target *starget; 1398c2ecf20Sopenharmony_ci struct ahc_initiator_tinfo *tinfo; 1408c2ecf20Sopenharmony_ci struct ahc_tmode_tstate *tstate; 1418c2ecf20Sopenharmony_ci int lun; 1428c2ecf20Sopenharmony_ci 1438c2ecf20Sopenharmony_ci tinfo = ahc_fetch_transinfo(ahc, channel, our_id, 1448c2ecf20Sopenharmony_ci target_id, &tstate); 1458c2ecf20Sopenharmony_ci if ((ahc->features & AHC_TWIN) != 0) 1468c2ecf20Sopenharmony_ci seq_printf(m, "Channel %c ", channel); 1478c2ecf20Sopenharmony_ci seq_printf(m, "Target %d Negotiation Settings\n", target_id); 1488c2ecf20Sopenharmony_ci seq_puts(m, "\tUser: "); 1498c2ecf20Sopenharmony_ci ahc_format_transinfo(m, &tinfo->user); 1508c2ecf20Sopenharmony_ci starget = ahc->platform_data->starget[target_offset]; 1518c2ecf20Sopenharmony_ci if (!starget) 1528c2ecf20Sopenharmony_ci return; 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_ci seq_puts(m, "\tGoal: "); 1558c2ecf20Sopenharmony_ci ahc_format_transinfo(m, &tinfo->goal); 1568c2ecf20Sopenharmony_ci seq_puts(m, "\tCurr: "); 1578c2ecf20Sopenharmony_ci ahc_format_transinfo(m, &tinfo->curr); 1588c2ecf20Sopenharmony_ci 1598c2ecf20Sopenharmony_ci for (lun = 0; lun < AHC_NUM_LUNS; lun++) { 1608c2ecf20Sopenharmony_ci struct scsi_device *sdev; 1618c2ecf20Sopenharmony_ci 1628c2ecf20Sopenharmony_ci sdev = scsi_device_lookup_by_target(starget, lun); 1638c2ecf20Sopenharmony_ci 1648c2ecf20Sopenharmony_ci if (sdev == NULL) 1658c2ecf20Sopenharmony_ci continue; 1668c2ecf20Sopenharmony_ci 1678c2ecf20Sopenharmony_ci ahc_dump_device_state(m, sdev); 1688c2ecf20Sopenharmony_ci } 1698c2ecf20Sopenharmony_ci} 1708c2ecf20Sopenharmony_ci 1718c2ecf20Sopenharmony_cistatic void 1728c2ecf20Sopenharmony_ciahc_dump_device_state(struct seq_file *m, struct scsi_device *sdev) 1738c2ecf20Sopenharmony_ci{ 1748c2ecf20Sopenharmony_ci struct ahc_linux_device *dev = scsi_transport_device_data(sdev); 1758c2ecf20Sopenharmony_ci 1768c2ecf20Sopenharmony_ci seq_printf(m, "\tChannel %c Target %d Lun %d Settings\n", 1778c2ecf20Sopenharmony_ci sdev->sdev_target->channel + 'A', 1788c2ecf20Sopenharmony_ci sdev->sdev_target->id, (u8)sdev->lun); 1798c2ecf20Sopenharmony_ci 1808c2ecf20Sopenharmony_ci seq_printf(m, "\t\tCommands Queued %ld\n", dev->commands_issued); 1818c2ecf20Sopenharmony_ci seq_printf(m, "\t\tCommands Active %d\n", dev->active); 1828c2ecf20Sopenharmony_ci seq_printf(m, "\t\tCommand Openings %d\n", dev->openings); 1838c2ecf20Sopenharmony_ci seq_printf(m, "\t\tMax Tagged Openings %d\n", dev->maxtags); 1848c2ecf20Sopenharmony_ci seq_printf(m, "\t\tDevice Queue Frozen Count %d\n", dev->qfrozen); 1858c2ecf20Sopenharmony_ci} 1868c2ecf20Sopenharmony_ci 1878c2ecf20Sopenharmony_ciint 1888c2ecf20Sopenharmony_ciahc_proc_write_seeprom(struct Scsi_Host *shost, char *buffer, int length) 1898c2ecf20Sopenharmony_ci{ 1908c2ecf20Sopenharmony_ci struct ahc_softc *ahc = *(struct ahc_softc **)shost->hostdata; 1918c2ecf20Sopenharmony_ci struct seeprom_descriptor sd; 1928c2ecf20Sopenharmony_ci int have_seeprom; 1938c2ecf20Sopenharmony_ci u_long s; 1948c2ecf20Sopenharmony_ci int paused; 1958c2ecf20Sopenharmony_ci int written; 1968c2ecf20Sopenharmony_ci 1978c2ecf20Sopenharmony_ci /* Default to failure. */ 1988c2ecf20Sopenharmony_ci written = -EINVAL; 1998c2ecf20Sopenharmony_ci ahc_lock(ahc, &s); 2008c2ecf20Sopenharmony_ci paused = ahc_is_paused(ahc); 2018c2ecf20Sopenharmony_ci if (!paused) 2028c2ecf20Sopenharmony_ci ahc_pause(ahc); 2038c2ecf20Sopenharmony_ci 2048c2ecf20Sopenharmony_ci if (length != sizeof(struct seeprom_config)) { 2058c2ecf20Sopenharmony_ci printk("ahc_proc_write_seeprom: incorrect buffer size\n"); 2068c2ecf20Sopenharmony_ci goto done; 2078c2ecf20Sopenharmony_ci } 2088c2ecf20Sopenharmony_ci 2098c2ecf20Sopenharmony_ci have_seeprom = ahc_verify_cksum((struct seeprom_config*)buffer); 2108c2ecf20Sopenharmony_ci if (have_seeprom == 0) { 2118c2ecf20Sopenharmony_ci printk("ahc_proc_write_seeprom: cksum verification failed\n"); 2128c2ecf20Sopenharmony_ci goto done; 2138c2ecf20Sopenharmony_ci } 2148c2ecf20Sopenharmony_ci 2158c2ecf20Sopenharmony_ci sd.sd_ahc = ahc; 2168c2ecf20Sopenharmony_ci#if AHC_PCI_CONFIG > 0 2178c2ecf20Sopenharmony_ci if ((ahc->chip & AHC_PCI) != 0) { 2188c2ecf20Sopenharmony_ci sd.sd_control_offset = SEECTL; 2198c2ecf20Sopenharmony_ci sd.sd_status_offset = SEECTL; 2208c2ecf20Sopenharmony_ci sd.sd_dataout_offset = SEECTL; 2218c2ecf20Sopenharmony_ci if (ahc->flags & AHC_LARGE_SEEPROM) 2228c2ecf20Sopenharmony_ci sd.sd_chip = C56_66; 2238c2ecf20Sopenharmony_ci else 2248c2ecf20Sopenharmony_ci sd.sd_chip = C46; 2258c2ecf20Sopenharmony_ci sd.sd_MS = SEEMS; 2268c2ecf20Sopenharmony_ci sd.sd_RDY = SEERDY; 2278c2ecf20Sopenharmony_ci sd.sd_CS = SEECS; 2288c2ecf20Sopenharmony_ci sd.sd_CK = SEECK; 2298c2ecf20Sopenharmony_ci sd.sd_DO = SEEDO; 2308c2ecf20Sopenharmony_ci sd.sd_DI = SEEDI; 2318c2ecf20Sopenharmony_ci have_seeprom = ahc_acquire_seeprom(ahc, &sd); 2328c2ecf20Sopenharmony_ci } else 2338c2ecf20Sopenharmony_ci#endif 2348c2ecf20Sopenharmony_ci if ((ahc->chip & AHC_VL) != 0) { 2358c2ecf20Sopenharmony_ci sd.sd_control_offset = SEECTL_2840; 2368c2ecf20Sopenharmony_ci sd.sd_status_offset = STATUS_2840; 2378c2ecf20Sopenharmony_ci sd.sd_dataout_offset = STATUS_2840; 2388c2ecf20Sopenharmony_ci sd.sd_chip = C46; 2398c2ecf20Sopenharmony_ci sd.sd_MS = 0; 2408c2ecf20Sopenharmony_ci sd.sd_RDY = EEPROM_TF; 2418c2ecf20Sopenharmony_ci sd.sd_CS = CS_2840; 2428c2ecf20Sopenharmony_ci sd.sd_CK = CK_2840; 2438c2ecf20Sopenharmony_ci sd.sd_DO = DO_2840; 2448c2ecf20Sopenharmony_ci sd.sd_DI = DI_2840; 2458c2ecf20Sopenharmony_ci have_seeprom = TRUE; 2468c2ecf20Sopenharmony_ci } else { 2478c2ecf20Sopenharmony_ci printk("ahc_proc_write_seeprom: unsupported adapter type\n"); 2488c2ecf20Sopenharmony_ci goto done; 2498c2ecf20Sopenharmony_ci } 2508c2ecf20Sopenharmony_ci 2518c2ecf20Sopenharmony_ci if (!have_seeprom) { 2528c2ecf20Sopenharmony_ci printk("ahc_proc_write_seeprom: No Serial EEPROM\n"); 2538c2ecf20Sopenharmony_ci goto done; 2548c2ecf20Sopenharmony_ci } else { 2558c2ecf20Sopenharmony_ci u_int start_addr; 2568c2ecf20Sopenharmony_ci 2578c2ecf20Sopenharmony_ci if (ahc->seep_config == NULL) { 2588c2ecf20Sopenharmony_ci ahc->seep_config = kmalloc(sizeof(*ahc->seep_config), GFP_ATOMIC); 2598c2ecf20Sopenharmony_ci if (ahc->seep_config == NULL) { 2608c2ecf20Sopenharmony_ci printk("aic7xxx: Unable to allocate serial " 2618c2ecf20Sopenharmony_ci "eeprom buffer. Write failing\n"); 2628c2ecf20Sopenharmony_ci goto done; 2638c2ecf20Sopenharmony_ci } 2648c2ecf20Sopenharmony_ci } 2658c2ecf20Sopenharmony_ci printk("aic7xxx: Writing Serial EEPROM\n"); 2668c2ecf20Sopenharmony_ci start_addr = 32 * (ahc->channel - 'A'); 2678c2ecf20Sopenharmony_ci ahc_write_seeprom(&sd, (u_int16_t *)buffer, start_addr, 2688c2ecf20Sopenharmony_ci sizeof(struct seeprom_config)/2); 2698c2ecf20Sopenharmony_ci ahc_read_seeprom(&sd, (uint16_t *)ahc->seep_config, 2708c2ecf20Sopenharmony_ci start_addr, sizeof(struct seeprom_config)/2); 2718c2ecf20Sopenharmony_ci#if AHC_PCI_CONFIG > 0 2728c2ecf20Sopenharmony_ci if ((ahc->chip & AHC_VL) == 0) 2738c2ecf20Sopenharmony_ci ahc_release_seeprom(&sd); 2748c2ecf20Sopenharmony_ci#endif 2758c2ecf20Sopenharmony_ci written = length; 2768c2ecf20Sopenharmony_ci } 2778c2ecf20Sopenharmony_ci 2788c2ecf20Sopenharmony_cidone: 2798c2ecf20Sopenharmony_ci if (!paused) 2808c2ecf20Sopenharmony_ci ahc_unpause(ahc); 2818c2ecf20Sopenharmony_ci ahc_unlock(ahc, &s); 2828c2ecf20Sopenharmony_ci return (written); 2838c2ecf20Sopenharmony_ci} 2848c2ecf20Sopenharmony_ci 2858c2ecf20Sopenharmony_ci/* 2868c2ecf20Sopenharmony_ci * Return information to handle /proc support for the driver. 2878c2ecf20Sopenharmony_ci */ 2888c2ecf20Sopenharmony_ciint 2898c2ecf20Sopenharmony_ciahc_linux_show_info(struct seq_file *m, struct Scsi_Host *shost) 2908c2ecf20Sopenharmony_ci{ 2918c2ecf20Sopenharmony_ci struct ahc_softc *ahc = *(struct ahc_softc **)shost->hostdata; 2928c2ecf20Sopenharmony_ci char ahc_info[256]; 2938c2ecf20Sopenharmony_ci u_int max_targ; 2948c2ecf20Sopenharmony_ci u_int i; 2958c2ecf20Sopenharmony_ci 2968c2ecf20Sopenharmony_ci seq_printf(m, "Adaptec AIC7xxx driver version: %s\n", 2978c2ecf20Sopenharmony_ci AIC7XXX_DRIVER_VERSION); 2988c2ecf20Sopenharmony_ci seq_printf(m, "%s\n", ahc->description); 2998c2ecf20Sopenharmony_ci ahc_controller_info(ahc, ahc_info); 3008c2ecf20Sopenharmony_ci seq_printf(m, "%s\n", ahc_info); 3018c2ecf20Sopenharmony_ci seq_printf(m, "Allocated SCBs: %d, SG List Length: %d\n\n", 3028c2ecf20Sopenharmony_ci ahc->scb_data->numscbs, AHC_NSEG); 3038c2ecf20Sopenharmony_ci 3048c2ecf20Sopenharmony_ci 3058c2ecf20Sopenharmony_ci if (ahc->seep_config == NULL) 3068c2ecf20Sopenharmony_ci seq_puts(m, "No Serial EEPROM\n"); 3078c2ecf20Sopenharmony_ci else { 3088c2ecf20Sopenharmony_ci seq_puts(m, "Serial EEPROM:\n"); 3098c2ecf20Sopenharmony_ci for (i = 0; i < sizeof(*ahc->seep_config)/2; i++) { 3108c2ecf20Sopenharmony_ci if (((i % 8) == 0) && (i != 0)) { 3118c2ecf20Sopenharmony_ci seq_putc(m, '\n'); 3128c2ecf20Sopenharmony_ci } 3138c2ecf20Sopenharmony_ci seq_printf(m, "0x%.4x ", 3148c2ecf20Sopenharmony_ci ((uint16_t*)ahc->seep_config)[i]); 3158c2ecf20Sopenharmony_ci } 3168c2ecf20Sopenharmony_ci seq_putc(m, '\n'); 3178c2ecf20Sopenharmony_ci } 3188c2ecf20Sopenharmony_ci seq_putc(m, '\n'); 3198c2ecf20Sopenharmony_ci 3208c2ecf20Sopenharmony_ci max_targ = 16; 3218c2ecf20Sopenharmony_ci if ((ahc->features & (AHC_WIDE|AHC_TWIN)) == 0) 3228c2ecf20Sopenharmony_ci max_targ = 8; 3238c2ecf20Sopenharmony_ci 3248c2ecf20Sopenharmony_ci for (i = 0; i < max_targ; i++) { 3258c2ecf20Sopenharmony_ci u_int our_id; 3268c2ecf20Sopenharmony_ci u_int target_id; 3278c2ecf20Sopenharmony_ci char channel; 3288c2ecf20Sopenharmony_ci 3298c2ecf20Sopenharmony_ci channel = 'A'; 3308c2ecf20Sopenharmony_ci our_id = ahc->our_id; 3318c2ecf20Sopenharmony_ci target_id = i; 3328c2ecf20Sopenharmony_ci if (i > 7 && (ahc->features & AHC_TWIN) != 0) { 3338c2ecf20Sopenharmony_ci channel = 'B'; 3348c2ecf20Sopenharmony_ci our_id = ahc->our_id_b; 3358c2ecf20Sopenharmony_ci target_id = i % 8; 3368c2ecf20Sopenharmony_ci } 3378c2ecf20Sopenharmony_ci 3388c2ecf20Sopenharmony_ci ahc_dump_target_state(ahc, m, our_id, 3398c2ecf20Sopenharmony_ci channel, target_id, i); 3408c2ecf20Sopenharmony_ci } 3418c2ecf20Sopenharmony_ci return 0; 3428c2ecf20Sopenharmony_ci} 343