1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #ifndef _SYS_SCSI_ADAPTERS_FASVAR_H 28*7c478bd9Sstevel@tonic-gate #define _SYS_SCSI_ADAPTERS_FASVAR_H 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*7c478bd9Sstevel@tonic-gate 32*7c478bd9Sstevel@tonic-gate /* 33*7c478bd9Sstevel@tonic-gate * QLogic FAS (Enhanced Scsi Processor) Definitions, 34*7c478bd9Sstevel@tonic-gate * Software && Hardware. 35*7c478bd9Sstevel@tonic-gate */ 36*7c478bd9Sstevel@tonic-gate 37*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 38*7c478bd9Sstevel@tonic-gate extern "C" { 39*7c478bd9Sstevel@tonic-gate #endif 40*7c478bd9Sstevel@tonic-gate 41*7c478bd9Sstevel@tonic-gate #include <sys/note.h> 42*7c478bd9Sstevel@tonic-gate 43*7c478bd9Sstevel@tonic-gate /* 44*7c478bd9Sstevel@tonic-gate * Compile options 45*7c478bd9Sstevel@tonic-gate */ 46*7c478bd9Sstevel@tonic-gate #if DEBUG 47*7c478bd9Sstevel@tonic-gate #define FASDEBUG /* turn on debugging code */ 48*7c478bd9Sstevel@tonic-gate #define FASTEST 49*7c478bd9Sstevel@tonic-gate #endif /* DEBUG */ 50*7c478bd9Sstevel@tonic-gate 51*7c478bd9Sstevel@tonic-gate /* 52*7c478bd9Sstevel@tonic-gate * Software Definitions 53*7c478bd9Sstevel@tonic-gate */ 54*7c478bd9Sstevel@tonic-gate #define POLL_TIMEOUT (2 * SCSI_POLL_TIMEOUT * 1000000) 55*7c478bd9Sstevel@tonic-gate #define SHORT_POLL_TIMEOUT (1000000) /* in usec, about 1 secs */ 56*7c478bd9Sstevel@tonic-gate #define FAS_MUTEX(fas) (&(fas)->f_mutex) 57*7c478bd9Sstevel@tonic-gate #define FAS_CV(fas) (&(fas)->f_cv) 58*7c478bd9Sstevel@tonic-gate #define FAS_INITIAL_SOFT_SPACE 4 /* Used for the softstate_init func */ 59*7c478bd9Sstevel@tonic-gate #define FAS_QUIESCE_TIMEOUT 1 /* 1 sec */ 60*7c478bd9Sstevel@tonic-gate 61*7c478bd9Sstevel@tonic-gate /* 62*7c478bd9Sstevel@tonic-gate * Data Structure for this Host Adapter. 63*7c478bd9Sstevel@tonic-gate * 64*7c478bd9Sstevel@tonic-gate * structure to hold active outstanding cmds 65*7c478bd9Sstevel@tonic-gate */ 66*7c478bd9Sstevel@tonic-gate struct f_slots { 67*7c478bd9Sstevel@tonic-gate ushort_t f_dups; 68*7c478bd9Sstevel@tonic-gate ushort_t f_tags; 69*7c478bd9Sstevel@tonic-gate int f_timeout; 70*7c478bd9Sstevel@tonic-gate int f_timebase; 71*7c478bd9Sstevel@tonic-gate /* t_slot size is 1 for non-tagged, and */ 72*7c478bd9Sstevel@tonic-gate /* 256 for tagged targets */ 73*7c478bd9Sstevel@tonic-gate ushort_t f_n_slots; /* number of a_slots */ 74*7c478bd9Sstevel@tonic-gate ushort_t f_size; 75*7c478bd9Sstevel@tonic-gate struct fas_cmd *f_slot[1]; /* may be for 256 for TQ */ 76*7c478bd9Sstevel@tonic-gate }; 77*7c478bd9Sstevel@tonic-gate 78*7c478bd9Sstevel@tonic-gate #define FAS_F_SLOTS_SIZE_TQ (sizeof (struct f_slots) + \ 79*7c478bd9Sstevel@tonic-gate (sizeof (struct fas_cmd *) * (NTAGS -1))) 80*7c478bd9Sstevel@tonic-gate #define FAS_F_SLOT_SIZE (sizeof (struct f_slots)) 81*7c478bd9Sstevel@tonic-gate 82*7c478bd9Sstevel@tonic-gate /* 83*7c478bd9Sstevel@tonic-gate * HBA interface macros 84*7c478bd9Sstevel@tonic-gate */ 85*7c478bd9Sstevel@tonic-gate #define SDEV2TRAN(sd) ((sd)->sd_address.a_hba_tran) 86*7c478bd9Sstevel@tonic-gate #define SDEV2ADDR(sd) (&((sd)->sd_address)) 87*7c478bd9Sstevel@tonic-gate #define PKT2TRAN(pkt) ((pkt)->pkt_address.a_hba_tran) 88*7c478bd9Sstevel@tonic-gate #define ADDR2TRAN(ap) ((ap)->a_hba_tran) 89*7c478bd9Sstevel@tonic-gate 90*7c478bd9Sstevel@tonic-gate #define TRAN2FAS(tran) ((struct fas *)(tran)->tran_hba_private) 91*7c478bd9Sstevel@tonic-gate #define SDEV2FAS(sd) (TRAN2FAS(SDEV2TRAN(sd))) 92*7c478bd9Sstevel@tonic-gate #define PKT2FAS(pkt) (TRAN2FAS(PKT2TRAN(pkt))) 93*7c478bd9Sstevel@tonic-gate #define ADDR2FAS(ap) (TRAN2FAS(ADDR2TRAN(ap))) 94*7c478bd9Sstevel@tonic-gate 95*7c478bd9Sstevel@tonic-gate 96*7c478bd9Sstevel@tonic-gate /* 97*7c478bd9Sstevel@tonic-gate * soft state information for this host adapter 98*7c478bd9Sstevel@tonic-gate */ 99*7c478bd9Sstevel@tonic-gate #define N_SLOTS (NTARGETS_WIDE*NLUNS_PER_TARGET) 100*7c478bd9Sstevel@tonic-gate #define REG_TRACE_BUF_SIZE 1024 101*7c478bd9Sstevel@tonic-gate 102*7c478bd9Sstevel@tonic-gate struct fas { 103*7c478bd9Sstevel@tonic-gate int f_instance; 104*7c478bd9Sstevel@tonic-gate /* 105*7c478bd9Sstevel@tonic-gate * Transport structure for this instance of the hba 106*7c478bd9Sstevel@tonic-gate */ 107*7c478bd9Sstevel@tonic-gate scsi_hba_tran_t *f_tran; 108*7c478bd9Sstevel@tonic-gate 109*7c478bd9Sstevel@tonic-gate /* 110*7c478bd9Sstevel@tonic-gate * dev_info_t reference 111*7c478bd9Sstevel@tonic-gate */ 112*7c478bd9Sstevel@tonic-gate dev_info_t *f_dev; 113*7c478bd9Sstevel@tonic-gate 114*7c478bd9Sstevel@tonic-gate /* 115*7c478bd9Sstevel@tonic-gate * mutex to protect softstate and hw regs 116*7c478bd9Sstevel@tonic-gate */ 117*7c478bd9Sstevel@tonic-gate kmutex_t f_mutex; 118*7c478bd9Sstevel@tonic-gate 119*7c478bd9Sstevel@tonic-gate /* 120*7c478bd9Sstevel@tonic-gate * Interrupt block cookie 121*7c478bd9Sstevel@tonic-gate */ 122*7c478bd9Sstevel@tonic-gate ddi_iblock_cookie_t f_iblock; 123*7c478bd9Sstevel@tonic-gate 124*7c478bd9Sstevel@tonic-gate /* 125*7c478bd9Sstevel@tonic-gate * Next in a linked list of host adapters 126*7c478bd9Sstevel@tonic-gate */ 127*7c478bd9Sstevel@tonic-gate struct fas *f_next; 128*7c478bd9Sstevel@tonic-gate 129*7c478bd9Sstevel@tonic-gate /* 130*7c478bd9Sstevel@tonic-gate * Type byte for this host adapter 131*7c478bd9Sstevel@tonic-gate * and rev of the FEPS chip 132*7c478bd9Sstevel@tonic-gate */ 133*7c478bd9Sstevel@tonic-gate uchar_t f_type; 134*7c478bd9Sstevel@tonic-gate uchar_t f_hm_rev; 135*7c478bd9Sstevel@tonic-gate 136*7c478bd9Sstevel@tonic-gate /* 137*7c478bd9Sstevel@tonic-gate * value for configuration register 1. 138*7c478bd9Sstevel@tonic-gate * Also contains Initiator Id. 139*7c478bd9Sstevel@tonic-gate */ 140*7c478bd9Sstevel@tonic-gate uint8_t f_fasconf; 141*7c478bd9Sstevel@tonic-gate 142*7c478bd9Sstevel@tonic-gate /* 143*7c478bd9Sstevel@tonic-gate * value for configuration register 2 144*7c478bd9Sstevel@tonic-gate */ 145*7c478bd9Sstevel@tonic-gate uint8_t f_fasconf2; 146*7c478bd9Sstevel@tonic-gate 147*7c478bd9Sstevel@tonic-gate /* 148*7c478bd9Sstevel@tonic-gate * value for configuration register 3 149*7c478bd9Sstevel@tonic-gate */ 150*7c478bd9Sstevel@tonic-gate uint8_t f_fasconf3[NTARGETS_WIDE]; 151*7c478bd9Sstevel@tonic-gate uint8_t f_fasconf3_reg_last; 152*7c478bd9Sstevel@tonic-gate 153*7c478bd9Sstevel@tonic-gate /* 154*7c478bd9Sstevel@tonic-gate * clock conversion register value for this host adapter. 155*7c478bd9Sstevel@tonic-gate * clock cycle value * 1000 for this host adapter, 156*7c478bd9Sstevel@tonic-gate * to retain 5 significant digits. 157*7c478bd9Sstevel@tonic-gate */ 158*7c478bd9Sstevel@tonic-gate uchar_t f_clock_conv; 159*7c478bd9Sstevel@tonic-gate ushort_t f_clock_cycle; 160*7c478bd9Sstevel@tonic-gate 161*7c478bd9Sstevel@tonic-gate /* 162*7c478bd9Sstevel@tonic-gate * selection timeout register value 163*7c478bd9Sstevel@tonic-gate */ 164*7c478bd9Sstevel@tonic-gate uint8_t f_stval; 165*7c478bd9Sstevel@tonic-gate 166*7c478bd9Sstevel@tonic-gate /* 167*7c478bd9Sstevel@tonic-gate * State of the host adapter 168*7c478bd9Sstevel@tonic-gate */ 169*7c478bd9Sstevel@tonic-gate uchar_t f_sdtr_sent; /* Count of sync data negotiation messages: */ 170*7c478bd9Sstevel@tonic-gate /* zeroed for every selection attempt, */ 171*7c478bd9Sstevel@tonic-gate /* every reconnection, and every disconnect */ 172*7c478bd9Sstevel@tonic-gate /* interrupt. Each SYNCHRONOUS DATA TRANSFER */ 173*7c478bd9Sstevel@tonic-gate /* message, both coming from the target, and */ 174*7c478bd9Sstevel@tonic-gate /* sent to the target, causes this tag to be */ 175*7c478bd9Sstevel@tonic-gate /* incremented. This allows the received */ 176*7c478bd9Sstevel@tonic-gate /* message handling to determine whether */ 177*7c478bd9Sstevel@tonic-gate /* a received SYNCHRONOUS DATA TRANSFER */ 178*7c478bd9Sstevel@tonic-gate /* message is in response to one that we */ 179*7c478bd9Sstevel@tonic-gate /* sent. */ 180*7c478bd9Sstevel@tonic-gate uchar_t f_wdtr_sent; /* same for wide negotations */ 181*7c478bd9Sstevel@tonic-gate uchar_t f_stat; /* soft copy of status register */ 182*7c478bd9Sstevel@tonic-gate uchar_t f_stat2; /* soft copy of status2 register */ 183*7c478bd9Sstevel@tonic-gate uchar_t f_intr; /* soft copy of interrupt register */ 184*7c478bd9Sstevel@tonic-gate uchar_t f_step; /* soft copy of step register */ 185*7c478bd9Sstevel@tonic-gate uchar_t f_abort_msg_sent; /* indicates that abort message went out */ 186*7c478bd9Sstevel@tonic-gate uchar_t f_reset_msg_sent; /* indicates that device reset message */ 187*7c478bd9Sstevel@tonic-gate /* went out */ 188*7c478bd9Sstevel@tonic-gate uchar_t f_last_cmd; /* last cmd sent to fas chip */ 189*7c478bd9Sstevel@tonic-gate 190*7c478bd9Sstevel@tonic-gate ushort_t f_state; /* state of the driver */ 191*7c478bd9Sstevel@tonic-gate ushort_t f_laststate; /* last state of the driver */ 192*7c478bd9Sstevel@tonic-gate uchar_t f_suspended; /* true if driver is suspended */ 193*7c478bd9Sstevel@tonic-gate uchar_t f_dslot; /* delta to next slot */ 194*7c478bd9Sstevel@tonic-gate uchar_t f_idcode; /* chips idcode */ 195*7c478bd9Sstevel@tonic-gate uchar_t f_polled_intr; /* current interrupt was polled. */ 196*7c478bd9Sstevel@tonic-gate 197*7c478bd9Sstevel@tonic-gate /* 198*7c478bd9Sstevel@tonic-gate * Message handling: enough space is reserved for the expected length 199*7c478bd9Sstevel@tonic-gate * of all messages we could either send or receive. 200*7c478bd9Sstevel@tonic-gate * 201*7c478bd9Sstevel@tonic-gate * For sending, we expect to send only SYNCHRONOUS extended messages 202*7c478bd9Sstevel@tonic-gate * (5 bytes). We keep a history of the last message sent, and in order 203*7c478bd9Sstevel@tonic-gate * to control which message to send, an output message length is set 204*7c478bd9Sstevel@tonic-gate * to indicate whether and how much of the message area is to be used 205*7c478bd9Sstevel@tonic-gate * in sending a message. If a target shifts to message out phase 206*7c478bd9Sstevel@tonic-gate * unexpectedly, the default action will be to send a MSG_NOP message. 207*7c478bd9Sstevel@tonic-gate * 208*7c478bd9Sstevel@tonic-gate * After the successful transmission of a message, the initial message 209*7c478bd9Sstevel@tonic-gate * byte is moved to the f_last_msgout area for tracking what was the 210*7c478bd9Sstevel@tonic-gate * last message sent. 211*7c478bd9Sstevel@tonic-gate */ 212*7c478bd9Sstevel@tonic-gate 213*7c478bd9Sstevel@tonic-gate #define OMSGSIZE 12 214*7c478bd9Sstevel@tonic-gate uchar_t f_cur_msgout[OMSGSIZE]; 215*7c478bd9Sstevel@tonic-gate uchar_t f_last_msgout; 216*7c478bd9Sstevel@tonic-gate uchar_t f_omsglen; 217*7c478bd9Sstevel@tonic-gate 218*7c478bd9Sstevel@tonic-gate 219*7c478bd9Sstevel@tonic-gate /* 220*7c478bd9Sstevel@tonic-gate * We expect, at, most, to receive a maximum of 7 bytes 221*7c478bd9Sstevel@tonic-gate * of an incoming extended message (MODIFY DATA POINTER), 222*7c478bd9Sstevel@tonic-gate * and thus reserve enough space for that. 223*7c478bd9Sstevel@tonic-gate */ 224*7c478bd9Sstevel@tonic-gate #define IMSGSIZE 8 225*7c478bd9Sstevel@tonic-gate uchar_t f_imsgarea[IMSGSIZE]; 226*7c478bd9Sstevel@tonic-gate 227*7c478bd9Sstevel@tonic-gate /* 228*7c478bd9Sstevel@tonic-gate * These are used to index how far we've 229*7c478bd9Sstevel@tonic-gate * gone in receiving incoming messages. 230*7c478bd9Sstevel@tonic-gate */ 231*7c478bd9Sstevel@tonic-gate uchar_t f_imsglen; 232*7c478bd9Sstevel@tonic-gate uchar_t f_imsgindex; 233*7c478bd9Sstevel@tonic-gate 234*7c478bd9Sstevel@tonic-gate /* 235*7c478bd9Sstevel@tonic-gate * Saved last msgin. 236*7c478bd9Sstevel@tonic-gate */ 237*7c478bd9Sstevel@tonic-gate uchar_t f_last_msgin; 238*7c478bd9Sstevel@tonic-gate 239*7c478bd9Sstevel@tonic-gate /* 240*7c478bd9Sstevel@tonic-gate * round robin scheduling of requests in fas_ustart() 241*7c478bd9Sstevel@tonic-gate */ 242*7c478bd9Sstevel@tonic-gate uchar_t f_next_slot; 243*7c478bd9Sstevel@tonic-gate 244*7c478bd9Sstevel@tonic-gate /* 245*7c478bd9Sstevel@tonic-gate * save reselecting slot when waiting for tag bytes 246*7c478bd9Sstevel@tonic-gate */ 247*7c478bd9Sstevel@tonic-gate uchar_t f_resel_slot; 248*7c478bd9Sstevel@tonic-gate 249*7c478bd9Sstevel@tonic-gate /* 250*7c478bd9Sstevel@tonic-gate * Target information 251*7c478bd9Sstevel@tonic-gate * Synchronous SCSI Information, 252*7c478bd9Sstevel@tonic-gate * Disconnect/reconnect capabilities 253*7c478bd9Sstevel@tonic-gate * Noise Susceptibility 254*7c478bd9Sstevel@tonic-gate */ 255*7c478bd9Sstevel@tonic-gate uchar_t f_offset[NTARGETS_WIDE]; /* synch offset + req-ack delay */ 256*7c478bd9Sstevel@tonic-gate uchar_t f_sync_period[NTARGETS_WIDE]; /* synch period reg val */ 257*7c478bd9Sstevel@tonic-gate uchar_t f_neg_period[NTARGETS_WIDE]; /* synch periods (negotiated) */ 258*7c478bd9Sstevel@tonic-gate ushort_t f_backoff; /* sync/wide backoff bit mask */ 259*7c478bd9Sstevel@tonic-gate uchar_t f_req_ack_delay; /* req ack delay in offset reg */ 260*7c478bd9Sstevel@tonic-gate uchar_t f_offset_reg_last; /* save last offset value */ 261*7c478bd9Sstevel@tonic-gate uchar_t f_period_reg_last; /* save last period value */ 262*7c478bd9Sstevel@tonic-gate 263*7c478bd9Sstevel@tonic-gate /* 264*7c478bd9Sstevel@tonic-gate * fifo length and fifo contents stored here before reading intr reg 265*7c478bd9Sstevel@tonic-gate */ 266*7c478bd9Sstevel@tonic-gate uchar_t f_fifolen; 267*7c478bd9Sstevel@tonic-gate uchar_t f_fifo[2*FIFOSIZE]; 268*7c478bd9Sstevel@tonic-gate 269*7c478bd9Sstevel@tonic-gate /* 270*7c478bd9Sstevel@tonic-gate * These ushort_t's are bit maps for targets 271*7c478bd9Sstevel@tonic-gate */ 272*7c478bd9Sstevel@tonic-gate ushort_t f_wide_known; /* wide negotiate on next cmd */ 273*7c478bd9Sstevel@tonic-gate ushort_t f_nowide; /* no wide for this target */ 274*7c478bd9Sstevel@tonic-gate ushort_t f_wide_enabled; /* wide enabled for this target */ 275*7c478bd9Sstevel@tonic-gate 276*7c478bd9Sstevel@tonic-gate ushort_t f_sync_known; /* sync negotiate on next cmd */ 277*7c478bd9Sstevel@tonic-gate ushort_t f_nosync; /* no sync for this target */ 278*7c478bd9Sstevel@tonic-gate ushort_t f_sync_enabled; /* sync enabled for this target */ 279*7c478bd9Sstevel@tonic-gate 280*7c478bd9Sstevel@tonic-gate /* 281*7c478bd9Sstevel@tonic-gate * This ushort_t is a bit map for targets to 282*7c478bd9Sstevel@tonic-gate * disable sync on request from the target driver 283*7c478bd9Sstevel@tonic-gate */ 284*7c478bd9Sstevel@tonic-gate ushort_t f_force_async; 285*7c478bd9Sstevel@tonic-gate ushort_t f_force_narrow; 286*7c478bd9Sstevel@tonic-gate 287*7c478bd9Sstevel@tonic-gate /* 288*7c478bd9Sstevel@tonic-gate * This ushort_t is a bit map for targets who don't appear 289*7c478bd9Sstevel@tonic-gate * to be able to support tagged commands. 290*7c478bd9Sstevel@tonic-gate */ 291*7c478bd9Sstevel@tonic-gate ushort_t f_notag; 292*7c478bd9Sstevel@tonic-gate 293*7c478bd9Sstevel@tonic-gate /* 294*7c478bd9Sstevel@tonic-gate * This ushort_t is a bit map for targets who need to have 295*7c478bd9Sstevel@tonic-gate * their properties update deferred. 296*7c478bd9Sstevel@tonic-gate */ 297*7c478bd9Sstevel@tonic-gate ushort_t f_props_update; 298*7c478bd9Sstevel@tonic-gate 299*7c478bd9Sstevel@tonic-gate /* 300*7c478bd9Sstevel@tonic-gate * scsi_options for bus and per target 301*7c478bd9Sstevel@tonic-gate */ 302*7c478bd9Sstevel@tonic-gate int f_target_scsi_options_defined; 303*7c478bd9Sstevel@tonic-gate int f_scsi_options; 304*7c478bd9Sstevel@tonic-gate int f_target_scsi_options[NTARGETS_WIDE]; 305*7c478bd9Sstevel@tonic-gate 306*7c478bd9Sstevel@tonic-gate /* 307*7c478bd9Sstevel@tonic-gate * tag age limit per bus 308*7c478bd9Sstevel@tonic-gate */ 309*7c478bd9Sstevel@tonic-gate int f_scsi_tag_age_limit; 310*7c478bd9Sstevel@tonic-gate 311*7c478bd9Sstevel@tonic-gate /* 312*7c478bd9Sstevel@tonic-gate * scsi reset delay per bus 313*7c478bd9Sstevel@tonic-gate */ 314*7c478bd9Sstevel@tonic-gate uint_t f_scsi_reset_delay; 315*7c478bd9Sstevel@tonic-gate 316*7c478bd9Sstevel@tonic-gate /* 317*7c478bd9Sstevel@tonic-gate * Scratch Buffer, allocated out of iopbmap for commands 318*7c478bd9Sstevel@tonic-gate * The same size as the FAS's fifo. 319*7c478bd9Sstevel@tonic-gate */ 320*7c478bd9Sstevel@tonic-gate uchar_t *f_cmdarea; 321*7c478bd9Sstevel@tonic-gate 322*7c478bd9Sstevel@tonic-gate /* 323*7c478bd9Sstevel@tonic-gate * shadow copy of dma_csr to avoid unnecessary I/O reads which are 324*7c478bd9Sstevel@tonic-gate * expensive 325*7c478bd9Sstevel@tonic-gate */ 326*7c478bd9Sstevel@tonic-gate uint32_t f_dma_csr; 327*7c478bd9Sstevel@tonic-gate 328*7c478bd9Sstevel@tonic-gate /* 329*7c478bd9Sstevel@tonic-gate * Scratch Buffer DMA cookie and handle for cmdarea 330*7c478bd9Sstevel@tonic-gate */ 331*7c478bd9Sstevel@tonic-gate ddi_dma_cookie_t f_dmacookie; 332*7c478bd9Sstevel@tonic-gate ddi_dma_handle_t f_dmahandle; 333*7c478bd9Sstevel@tonic-gate 334*7c478bd9Sstevel@tonic-gate /* 335*7c478bd9Sstevel@tonic-gate * dma attrs for fas scsi engine 336*7c478bd9Sstevel@tonic-gate */ 337*7c478bd9Sstevel@tonic-gate ddi_dma_attr_t *f_dma_attr; 338*7c478bd9Sstevel@tonic-gate 339*7c478bd9Sstevel@tonic-gate /* 340*7c478bd9Sstevel@tonic-gate * critical counters 341*7c478bd9Sstevel@tonic-gate */ 342*7c478bd9Sstevel@tonic-gate short f_ncmds; /* number of commands stored here at present */ 343*7c478bd9Sstevel@tonic-gate short f_ndisc; /* number of disconnected cmds at present */ 344*7c478bd9Sstevel@tonic-gate 345*7c478bd9Sstevel@tonic-gate /* 346*7c478bd9Sstevel@tonic-gate * Hardware pointers 347*7c478bd9Sstevel@tonic-gate * 348*7c478bd9Sstevel@tonic-gate * Pointer to mapped in FAS registers 349*7c478bd9Sstevel@tonic-gate */ 350*7c478bd9Sstevel@tonic-gate volatile struct fasreg *f_reg; 351*7c478bd9Sstevel@tonic-gate 352*7c478bd9Sstevel@tonic-gate /* 353*7c478bd9Sstevel@tonic-gate * Pointer to mapped in DMA Gate Array registers 354*7c478bd9Sstevel@tonic-gate */ 355*7c478bd9Sstevel@tonic-gate 356*7c478bd9Sstevel@tonic-gate volatile struct dma *f_dma; 357*7c478bd9Sstevel@tonic-gate 358*7c478bd9Sstevel@tonic-gate /* 359*7c478bd9Sstevel@tonic-gate * last and current state, queues 360*7c478bd9Sstevel@tonic-gate */ 361*7c478bd9Sstevel@tonic-gate uint32_t f_lastdma; /* last dma address */ 362*7c478bd9Sstevel@tonic-gate uint32_t f_lastcount; /* last dma count */ 363*7c478bd9Sstevel@tonic-gate 364*7c478bd9Sstevel@tonic-gate struct fas_cmd *f_current_sp; /* currently active cmd */ 365*7c478bd9Sstevel@tonic-gate struct f_slots *f_active[N_SLOTS]; /* outstanding cmds */ 366*7c478bd9Sstevel@tonic-gate 367*7c478bd9Sstevel@tonic-gate struct fas_cmd *f_readyf[N_SLOTS]; /* waiting cmds */ 368*7c478bd9Sstevel@tonic-gate struct fas_cmd *f_readyb[N_SLOTS]; 369*7c478bd9Sstevel@tonic-gate 370*7c478bd9Sstevel@tonic-gate /* 371*7c478bd9Sstevel@tonic-gate * if throttle >= 0 then 372*7c478bd9Sstevel@tonic-gate * continue submitting cmds 373*7c478bd9Sstevel@tonic-gate * if throttle == 0 then hold cmds 374*7c478bd9Sstevel@tonic-gate * if throttle == -1 then drain 375*7c478bd9Sstevel@tonic-gate * if throttle == -2 do special handling 376*7c478bd9Sstevel@tonic-gate * for queue full 377*7c478bd9Sstevel@tonic-gate * f_throttle and f_tcmds are not part of 378*7c478bd9Sstevel@tonic-gate * f_active so fas_ustart() can walk thru 379*7c478bd9Sstevel@tonic-gate * these more efficiently 380*7c478bd9Sstevel@tonic-gate */ 381*7c478bd9Sstevel@tonic-gate short f_throttle[N_SLOTS]; 382*7c478bd9Sstevel@tonic-gate 383*7c478bd9Sstevel@tonic-gate /* 384*7c478bd9Sstevel@tonic-gate * number of disconnected + active commands 385*7c478bd9Sstevel@tonic-gate * (i.e. stored in the f_active list) for 386*7c478bd9Sstevel@tonic-gate * the slot 387*7c478bd9Sstevel@tonic-gate */ 388*7c478bd9Sstevel@tonic-gate short f_tcmds[N_SLOTS]; 389*7c478bd9Sstevel@tonic-gate 390*7c478bd9Sstevel@tonic-gate /* 391*7c478bd9Sstevel@tonic-gate * if a device reset has been performed, a 392*7c478bd9Sstevel@tonic-gate * delay is required before accessing the target 393*7c478bd9Sstevel@tonic-gate * again; reset delays are in milli secs 394*7c478bd9Sstevel@tonic-gate * (assuming that reset watchdog runs every 395*7c478bd9Sstevel@tonic-gate * scsi-watchdog-tick milli secs; 396*7c478bd9Sstevel@tonic-gate * the watchdog decrements the reset delay) 397*7c478bd9Sstevel@tonic-gate */ 398*7c478bd9Sstevel@tonic-gate int f_reset_delay[NTARGETS_WIDE]; 399*7c478bd9Sstevel@tonic-gate 400*7c478bd9Sstevel@tonic-gate /* 401*7c478bd9Sstevel@tonic-gate * list for auto request sense packets 402*7c478bd9Sstevel@tonic-gate */ 403*7c478bd9Sstevel@tonic-gate struct fas_cmd *f_arq_pkt[N_SLOTS]; 404*7c478bd9Sstevel@tonic-gate 405*7c478bd9Sstevel@tonic-gate /* 406*7c478bd9Sstevel@tonic-gate * queue of packets that need callback and other callback info 407*7c478bd9Sstevel@tonic-gate */ 408*7c478bd9Sstevel@tonic-gate struct fas_cmd *f_c_qf; 409*7c478bd9Sstevel@tonic-gate struct fas_cmd *f_c_qb; 410*7c478bd9Sstevel@tonic-gate kmutex_t f_c_mutex; 411*7c478bd9Sstevel@tonic-gate int f_c_in_callback; 412*7c478bd9Sstevel@tonic-gate 413*7c478bd9Sstevel@tonic-gate /* 414*7c478bd9Sstevel@tonic-gate * a queue for packets in case the fas mutex is locked 415*7c478bd9Sstevel@tonic-gate */ 416*7c478bd9Sstevel@tonic-gate kmutex_t f_waitQ_mutex; 417*7c478bd9Sstevel@tonic-gate struct fas_cmd *f_waitf; 418*7c478bd9Sstevel@tonic-gate struct fas_cmd *f_waitb; 419*7c478bd9Sstevel@tonic-gate 420*7c478bd9Sstevel@tonic-gate /* 421*7c478bd9Sstevel@tonic-gate * list of reset notification requests 422*7c478bd9Sstevel@tonic-gate */ 423*7c478bd9Sstevel@tonic-gate struct scsi_reset_notify_entry *f_reset_notify_listf; 424*7c478bd9Sstevel@tonic-gate 425*7c478bd9Sstevel@tonic-gate /* 426*7c478bd9Sstevel@tonic-gate * qfull handling 427*7c478bd9Sstevel@tonic-gate */ 428*7c478bd9Sstevel@tonic-gate uchar_t f_qfull_retries[NTARGETS_WIDE]; 429*7c478bd9Sstevel@tonic-gate ushort_t f_qfull_retry_interval[NTARGETS_WIDE]; 430*7c478bd9Sstevel@tonic-gate timeout_id_t f_restart_cmd_timeid; 431*7c478bd9Sstevel@tonic-gate 432*7c478bd9Sstevel@tonic-gate /* 433*7c478bd9Sstevel@tonic-gate * kmem cache for packets 434*7c478bd9Sstevel@tonic-gate */ 435*7c478bd9Sstevel@tonic-gate struct kmem_cache *f_kmem_cache; 436*7c478bd9Sstevel@tonic-gate 437*7c478bd9Sstevel@tonic-gate /* 438*7c478bd9Sstevel@tonic-gate * data access handle for register mapping 439*7c478bd9Sstevel@tonic-gate */ 440*7c478bd9Sstevel@tonic-gate ddi_acc_handle_t f_regs_acc_handle; 441*7c478bd9Sstevel@tonic-gate /* 442*7c478bd9Sstevel@tonic-gate * data access handle for cmd area 443*7c478bd9Sstevel@tonic-gate */ 444*7c478bd9Sstevel@tonic-gate ddi_acc_handle_t f_cmdarea_acc_handle; 445*7c478bd9Sstevel@tonic-gate /* 446*7c478bd9Sstevel@tonic-gate * data access handle for dma 447*7c478bd9Sstevel@tonic-gate */ 448*7c478bd9Sstevel@tonic-gate ddi_acc_handle_t f_dmar_acc_handle; 449*7c478bd9Sstevel@tonic-gate 450*7c478bd9Sstevel@tonic-gate /* 451*7c478bd9Sstevel@tonic-gate * state flags 452*7c478bd9Sstevel@tonic-gate */ 453*7c478bd9Sstevel@tonic-gate uint_t f_flags; 454*7c478bd9Sstevel@tonic-gate 455*7c478bd9Sstevel@tonic-gate /* 456*7c478bd9Sstevel@tonic-gate * cv for bus quiesce/unquiesce 457*7c478bd9Sstevel@tonic-gate */ 458*7c478bd9Sstevel@tonic-gate kcondvar_t f_cv; 459*7c478bd9Sstevel@tonic-gate 460*7c478bd9Sstevel@tonic-gate /* 461*7c478bd9Sstevel@tonic-gate * soft state flags 462*7c478bd9Sstevel@tonic-gate */ 463*7c478bd9Sstevel@tonic-gate uint_t f_softstate; 464*7c478bd9Sstevel@tonic-gate 465*7c478bd9Sstevel@tonic-gate /* 466*7c478bd9Sstevel@tonic-gate * quiesce timeout ID 467*7c478bd9Sstevel@tonic-gate */ 468*7c478bd9Sstevel@tonic-gate timeout_id_t f_quiesce_timeid; 469*7c478bd9Sstevel@tonic-gate 470*7c478bd9Sstevel@tonic-gate /* 471*7c478bd9Sstevel@tonic-gate * kstat_intr support 472*7c478bd9Sstevel@tonic-gate */ 473*7c478bd9Sstevel@tonic-gate struct kstat *f_intr_kstat; 474*7c478bd9Sstevel@tonic-gate 475*7c478bd9Sstevel@tonic-gate #ifdef FASDEBUG 476*7c478bd9Sstevel@tonic-gate /* 477*7c478bd9Sstevel@tonic-gate * register trace for debugging 478*7c478bd9Sstevel@tonic-gate */ 479*7c478bd9Sstevel@tonic-gate uint_t f_reg_trace_index; 480*7c478bd9Sstevel@tonic-gate uint_t f_reg_trace[REG_TRACE_BUF_SIZE+1]; 481*7c478bd9Sstevel@tonic-gate 482*7c478bd9Sstevel@tonic-gate uint_t f_reserved[256]; 483*7c478bd9Sstevel@tonic-gate 484*7c478bd9Sstevel@tonic-gate uint_t f_reg_reads; 485*7c478bd9Sstevel@tonic-gate uint_t f_reg_dma_reads; 486*7c478bd9Sstevel@tonic-gate uint_t f_reg_writes; 487*7c478bd9Sstevel@tonic-gate uint_t f_reg_dma_writes; 488*7c478bd9Sstevel@tonic-gate uint_t f_reg_cmds; 489*7c478bd9Sstevel@tonic-gate uint_t f_total_cmds; 490*7c478bd9Sstevel@tonic-gate #endif 491*7c478bd9Sstevel@tonic-gate }; 492*7c478bd9Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(fas::f_mutex, fas)) 493*7c478bd9Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(fas::f_waitQ_mutex, fas::f_waitf fas::f_waitb)) 494*7c478bd9Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(fas::f_c_mutex, fas::f_c_qf fas::f_c_qb 495*7c478bd9Sstevel@tonic-gate fas::f_c_in_callback)) 496*7c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(fas::f_flags)) 497*7c478bd9Sstevel@tonic-gate 498*7c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("unique per packet or safe sharing", 499*7c478bd9Sstevel@tonic-gate scsi_cdb scsi_status scsi_pkt buf)) 500*7c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("stable data", scsi_device scsi_address)) 501*7c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("safe sharing", fas::f_next fas::f_state)) 502*7c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("safe sharing", 503*7c478bd9Sstevel@tonic-gate fas::f_dma fas::f_dma_attr fas::f_hm_rev)) 504*7c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("stable data", 505*7c478bd9Sstevel@tonic-gate fas::f_target_scsi_options fas::f_scsi_options)) 506*7c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("stable data", fas::f_instance)) 507*7c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("only debugging", 508*7c478bd9Sstevel@tonic-gate fas::f_reg_trace_index fas::f_reg_trace)) 509*7c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("protected by kmem lock", fas::f_kmem_cache)) 510*7c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("safe sharing", 511*7c478bd9Sstevel@tonic-gate fas::f_notag fas::f_suspended fas::f_ndisc)) 512*7c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("stable data", fas::f_dev fas::f_tran)) 513*7c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("only debugging", fas::f_reg_dma_reads)) 514*7c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("safe sharing", fas::f_quiesce_timeid)) 515*7c478bd9Sstevel@tonic-gate 516*7c478bd9Sstevel@tonic-gate /* 517*7c478bd9Sstevel@tonic-gate * kstat_intr support 518*7c478bd9Sstevel@tonic-gate */ 519*7c478bd9Sstevel@tonic-gate 520*7c478bd9Sstevel@tonic-gate #define FAS_KSTAT_INTR(fas) KSTAT_INTR_PTR(fas->f_intr_kstat)->\ 521*7c478bd9Sstevel@tonic-gate intrs[KSTAT_INTR_HARD]++ 522*7c478bd9Sstevel@tonic-gate 523*7c478bd9Sstevel@tonic-gate /* 524*7c478bd9Sstevel@tonic-gate * defaults for the global properties 525*7c478bd9Sstevel@tonic-gate */ 526*7c478bd9Sstevel@tonic-gate #define DEFAULT_SCSI_OPTIONS SCSI_OPTIONS_DR 527*7c478bd9Sstevel@tonic-gate #define DEFAULT_TAG_AGE_LIMIT 2 528*7c478bd9Sstevel@tonic-gate #define DEFAULT_WD_TICK 10 529*7c478bd9Sstevel@tonic-gate 530*7c478bd9Sstevel@tonic-gate /* 531*7c478bd9Sstevel@tonic-gate * define for f_flags 532*7c478bd9Sstevel@tonic-gate */ 533*7c478bd9Sstevel@tonic-gate #define FAS_FLG_NOTIMEOUTS 0x0001 /* disallow timeout rescheduling */ 534*7c478bd9Sstevel@tonic-gate 535*7c478bd9Sstevel@tonic-gate #define FAS_CAN_SCHED ((fas->f_flags & FAS_FLG_NOTIMEOUTS) == 0) 536*7c478bd9Sstevel@tonic-gate 537*7c478bd9Sstevel@tonic-gate /* 538*7c478bd9Sstevel@tonic-gate * f_req_ack_delay: 539*7c478bd9Sstevel@tonic-gate */ 540*7c478bd9Sstevel@tonic-gate #define DEFAULT_REQ_ACK_DELAY 0x50 /* delay assert period by 1/2 cycle */ 541*7c478bd9Sstevel@tonic-gate 542*7c478bd9Sstevel@tonic-gate /* 543*7c478bd9Sstevel@tonic-gate * Representations of Driver states (stored in tags f_state && f_laststate). 544*7c478bd9Sstevel@tonic-gate * 545*7c478bd9Sstevel@tonic-gate * Totally idle. There may or may not disconnected commands still 546*7c478bd9Sstevel@tonic-gate * running on targets. 547*7c478bd9Sstevel@tonic-gate */ 548*7c478bd9Sstevel@tonic-gate #define STATE_FREE 0x00 549*7c478bd9Sstevel@tonic-gate 550*7c478bd9Sstevel@tonic-gate /* 551*7c478bd9Sstevel@tonic-gate * Selecting States. These states represent a selection attempt 552*7c478bd9Sstevel@tonic-gate * for a target. 553*7c478bd9Sstevel@tonic-gate */ 554*7c478bd9Sstevel@tonic-gate #define STATE_SELECT_NORMAL 0x0100 555*7c478bd9Sstevel@tonic-gate #define STATE_SELECT_N_STOP 0x0200 556*7c478bd9Sstevel@tonic-gate #define STATE_SELECT_N_SENDMSG 0x0400 557*7c478bd9Sstevel@tonic-gate #define STATE_SYNC_ASKING 0x0800 558*7c478bd9Sstevel@tonic-gate #define STATE_SELECT_N_TAG 0x1000 559*7c478bd9Sstevel@tonic-gate #define STATE_SELECTING 0xFF00 /* Select mask */ 560*7c478bd9Sstevel@tonic-gate 561*7c478bd9Sstevel@tonic-gate 562*7c478bd9Sstevel@tonic-gate /* 563*7c478bd9Sstevel@tonic-gate * When the driver is neither idle nor selecting, it is in one of 564*7c478bd9Sstevel@tonic-gate * the information transfer phases. These states are not unique 565*7c478bd9Sstevel@tonic-gate * bit patterns- they are simple numbers used to mark transitions. 566*7c478bd9Sstevel@tonic-gate * They must start at 1 and proceed sequentially upwards and 567*7c478bd9Sstevel@tonic-gate * match the indexing of function vectors declared in the function 568*7c478bd9Sstevel@tonic-gate * fas_phasemanage(). 569*7c478bd9Sstevel@tonic-gate */ 570*7c478bd9Sstevel@tonic-gate #define STATE_ITPHASES 0x00FF /* Phase mask */ 571*7c478bd9Sstevel@tonic-gate 572*7c478bd9Sstevel@tonic-gate /* 573*7c478bd9Sstevel@tonic-gate * These states cover finishing sending a command out (if it wasn't 574*7c478bd9Sstevel@tonic-gate * sent as a side-effect of selecting), or the case of starting 575*7c478bd9Sstevel@tonic-gate * a command that was linked to the previous command (i.e., no 576*7c478bd9Sstevel@tonic-gate * selection phase for this particular command as the target 577*7c478bd9Sstevel@tonic-gate * remained connected when the previous command completed). 578*7c478bd9Sstevel@tonic-gate */ 579*7c478bd9Sstevel@tonic-gate #define ACTS_CMD_START 0x01 580*7c478bd9Sstevel@tonic-gate #define ACTS_CMD_DONE 0x02 581*7c478bd9Sstevel@tonic-gate 582*7c478bd9Sstevel@tonic-gate /* 583*7c478bd9Sstevel@tonic-gate * These states are the begin and end of sending out a message. 584*7c478bd9Sstevel@tonic-gate * The message to be sent is stored in the field f_msgout (see above). 585*7c478bd9Sstevel@tonic-gate */ 586*7c478bd9Sstevel@tonic-gate #define ACTS_MSG_OUT 0x03 587*7c478bd9Sstevel@tonic-gate #define ACTS_MSG_OUT_DONE 0x04 588*7c478bd9Sstevel@tonic-gate 589*7c478bd9Sstevel@tonic-gate /* 590*7c478bd9Sstevel@tonic-gate * These states are the beginning, middle, and end of incoming messages. 591*7c478bd9Sstevel@tonic-gate * 592*7c478bd9Sstevel@tonic-gate */ 593*7c478bd9Sstevel@tonic-gate #define ACTS_MSG_IN 0x05 594*7c478bd9Sstevel@tonic-gate #define ACTS_MSG_IN_MORE 0x06 595*7c478bd9Sstevel@tonic-gate #define ACTS_MSG_IN_DONE 0x07 596*7c478bd9Sstevel@tonic-gate 597*7c478bd9Sstevel@tonic-gate /* 598*7c478bd9Sstevel@tonic-gate * This state is reached when the target may be getting 599*7c478bd9Sstevel@tonic-gate * ready to clear the bus (disconnect or command complete). 600*7c478bd9Sstevel@tonic-gate */ 601*7c478bd9Sstevel@tonic-gate #define ACTS_CLEARING 0x08 602*7c478bd9Sstevel@tonic-gate 603*7c478bd9Sstevel@tonic-gate /* 604*7c478bd9Sstevel@tonic-gate * These states elide the begin and end of a DATA phase 605*7c478bd9Sstevel@tonic-gate */ 606*7c478bd9Sstevel@tonic-gate #define ACTS_DATA 0x09 607*7c478bd9Sstevel@tonic-gate #define ACTS_DATA_DONE 0x0A 608*7c478bd9Sstevel@tonic-gate 609*7c478bd9Sstevel@tonic-gate /* 610*7c478bd9Sstevel@tonic-gate * This state indicates that we were in status phase. We handle status 611*7c478bd9Sstevel@tonic-gate * phase by issuing the FAS command 'CMD_COMP_SEQ' which causes the 612*7c478bd9Sstevel@tonic-gate * FAS to read the status byte, and then to read a message in (presumably 613*7c478bd9Sstevel@tonic-gate * one of COMMAND COMPLETE, LINKED COMMAND COMPLETE or LINKED COMMAND 614*7c478bd9Sstevel@tonic-gate * COMPLETE WITH FLAG). 615*7c478bd9Sstevel@tonic-gate * 616*7c478bd9Sstevel@tonic-gate * This state is what is expected to follow after the issuance of the 617*7c478bd9Sstevel@tonic-gate * FAS command 'CMD_COMP_SEQ'. 618*7c478bd9Sstevel@tonic-gate */ 619*7c478bd9Sstevel@tonic-gate #define ACTS_C_CMPLT 0x0B 620*7c478bd9Sstevel@tonic-gate 621*7c478bd9Sstevel@tonic-gate /* 622*7c478bd9Sstevel@tonic-gate * This state is used by the driver to indicate that it 623*7c478bd9Sstevel@tonic-gate * is in the middle of processing a reselection attempt. 624*7c478bd9Sstevel@tonic-gate */ 625*7c478bd9Sstevel@tonic-gate #define ACTS_RESEL 0x0C 626*7c478bd9Sstevel@tonic-gate 627*7c478bd9Sstevel@tonic-gate /* 628*7c478bd9Sstevel@tonic-gate * This state is used by the driver to indicate that it doesn't know 629*7c478bd9Sstevel@tonic-gate * what the next state is, and that it should look at the FAS's status 630*7c478bd9Sstevel@tonic-gate * register to find out what SCSI bus phase we are in in order to select 631*7c478bd9Sstevel@tonic-gate * the next state to transition to. 632*7c478bd9Sstevel@tonic-gate */ 633*7c478bd9Sstevel@tonic-gate #define ACTS_UNKNOWN 0x0D 634*7c478bd9Sstevel@tonic-gate 635*7c478bd9Sstevel@tonic-gate /* 636*7c478bd9Sstevel@tonic-gate * This state is used by the driver to indicate that a self-inititated 637*7c478bd9Sstevel@tonic-gate * Bus reset is in progress. 638*7c478bd9Sstevel@tonic-gate */ 639*7c478bd9Sstevel@tonic-gate #define ACTS_RESET 0x0E 640*7c478bd9Sstevel@tonic-gate 641*7c478bd9Sstevel@tonic-gate /* 642*7c478bd9Sstevel@tonic-gate * Hiwater mark of vectored states 643*7c478bd9Sstevel@tonic-gate */ 644*7c478bd9Sstevel@tonic-gate #define ACTS_ENDVEC 0x0E 645*7c478bd9Sstevel@tonic-gate 646*7c478bd9Sstevel@tonic-gate /* 647*7c478bd9Sstevel@tonic-gate * XXX - needs to distinguish between bus states and internal states 648*7c478bd9Sstevel@tonic-gate */ 649*7c478bd9Sstevel@tonic-gate 650*7c478bd9Sstevel@tonic-gate /* 651*7c478bd9Sstevel@tonic-gate * This state is used by the driver to indicate to itself that it is 652*7c478bd9Sstevel@tonic-gate * in the middle of aborting things. 653*7c478bd9Sstevel@tonic-gate */ 654*7c478bd9Sstevel@tonic-gate #define ACTS_ABORTING 0x1D 655*7c478bd9Sstevel@tonic-gate 656*7c478bd9Sstevel@tonic-gate /* 657*7c478bd9Sstevel@tonic-gate * This state is used by the driver to just hold the state of 658*7c478bd9Sstevel@tonic-gate * the softc structure while it is either aborting or resetting 659*7c478bd9Sstevel@tonic-gate * everything. 660*7c478bd9Sstevel@tonic-gate */ 661*7c478bd9Sstevel@tonic-gate #define ACTS_FROZEN 0x1F 662*7c478bd9Sstevel@tonic-gate 663*7c478bd9Sstevel@tonic-gate 664*7c478bd9Sstevel@tonic-gate /* 665*7c478bd9Sstevel@tonic-gate * Interrupt dispatch actions 666*7c478bd9Sstevel@tonic-gate */ 667*7c478bd9Sstevel@tonic-gate #define ACTION_RETURN -1 /* return from interrupt */ 668*7c478bd9Sstevel@tonic-gate #define ACTION_FINSEL 0x00 /* finish selection */ 669*7c478bd9Sstevel@tonic-gate #define ACTION_RESEL 0x01 /* handle reselection */ 670*7c478bd9Sstevel@tonic-gate #define ACTION_PHASEMANAGE 0x02 /* manage phases */ 671*7c478bd9Sstevel@tonic-gate #define ACTION_FINISH 0x03 /* this command done */ 672*7c478bd9Sstevel@tonic-gate #define ACTION_FINRST 0x04 /* finish reset recovery */ 673*7c478bd9Sstevel@tonic-gate #define ACTION_SEARCH 0x05 /* search for new command to start */ 674*7c478bd9Sstevel@tonic-gate #define ACTION_ABORT_CURCMD 0x06 /* abort current command */ 675*7c478bd9Sstevel@tonic-gate #define ACTION_ABORT_ALLCMDS 0x07 /* abort all commands */ 676*7c478bd9Sstevel@tonic-gate #define ACTION_RESET 0x08 /* reset bus */ 677*7c478bd9Sstevel@tonic-gate #define ACTION_SELECT 0x09 /* handle selection */ 678*7c478bd9Sstevel@tonic-gate 679*7c478bd9Sstevel@tonic-gate /* 680*7c478bd9Sstevel@tonic-gate * Proxy command definitions. 681*7c478bd9Sstevel@tonic-gate * 682*7c478bd9Sstevel@tonic-gate * At certain times, we need to run a proxy command for a target 683*7c478bd9Sstevel@tonic-gate * (if only to select a target and send a message). 684*7c478bd9Sstevel@tonic-gate * 685*7c478bd9Sstevel@tonic-gate * We use the tail end of the cdb that is internal to the fas_cmd 686*7c478bd9Sstevel@tonic-gate * structure to store the proxy code, the proxy data (e.g., the 687*7c478bd9Sstevel@tonic-gate * message to send). 688*7c478bd9Sstevel@tonic-gate * 689*7c478bd9Sstevel@tonic-gate * We also store a boolean result code in this area so that the 690*7c478bd9Sstevel@tonic-gate * user of a proxy command knows whether it succeeded. 691*7c478bd9Sstevel@tonic-gate */ 692*7c478bd9Sstevel@tonic-gate 693*7c478bd9Sstevel@tonic-gate /* 694*7c478bd9Sstevel@tonic-gate * Offsets into the cmd_cdb[] array (in fas_cmd) for proxy data 695*7c478bd9Sstevel@tonic-gate */ 696*7c478bd9Sstevel@tonic-gate #define FAS_PROXY_TYPE CDB_GROUP0 697*7c478bd9Sstevel@tonic-gate #define FAS_PROXY_RESULT FAS_PROXY_TYPE+1 698*7c478bd9Sstevel@tonic-gate #define FAS_PROXY_DATA FAS_PROXY_RESULT+1 699*7c478bd9Sstevel@tonic-gate 700*7c478bd9Sstevel@tonic-gate /* 701*7c478bd9Sstevel@tonic-gate * Currently supported proxy types 702*7c478bd9Sstevel@tonic-gate */ 703*7c478bd9Sstevel@tonic-gate 704*7c478bd9Sstevel@tonic-gate #define FAS_PROXY_SNDMSG 1 705*7c478bd9Sstevel@tonic-gate 706*7c478bd9Sstevel@tonic-gate /* 707*7c478bd9Sstevel@tonic-gate * Reset actions 708*7c478bd9Sstevel@tonic-gate */ 709*7c478bd9Sstevel@tonic-gate #define FAS_RESET_FAS 0x1 /* reset FAS chip */ 710*7c478bd9Sstevel@tonic-gate #define FAS_RESET_DMA 0x2 /* reset DMA gate array */ 711*7c478bd9Sstevel@tonic-gate #define FAS_RESET_BRESET 0x4 /* reset SCSI bus */ 712*7c478bd9Sstevel@tonic-gate #define FAS_RESET_IGNORE_BRESET 0x8 /* ignore SCSI Bus RESET interrupt */ 713*7c478bd9Sstevel@tonic-gate /* while resetting bus. */ 714*7c478bd9Sstevel@tonic-gate #define FAS_RESET_SCSIBUS (FAS_RESET_BRESET|FAS_RESET_IGNORE_BRESET) 715*7c478bd9Sstevel@tonic-gate #define FAS_RESET_SOFTC 0x10 /* reset SOFTC structure */ 716*7c478bd9Sstevel@tonic-gate 717*7c478bd9Sstevel@tonic-gate #define FAS_RESET_HW (FAS_RESET_FAS|FAS_RESET_DMA|FAS_RESET_SCSIBUS) 718*7c478bd9Sstevel@tonic-gate #define FAS_RESET_ALL (FAS_RESET_HW|FAS_RESET_SOFTC) 719*7c478bd9Sstevel@tonic-gate 720*7c478bd9Sstevel@tonic-gate #define FAS_RESET_MSG 0x20 721*7c478bd9Sstevel@tonic-gate 722*7c478bd9Sstevel@tonic-gate #define FAS_RESET_SPIN_DELAY_USEC 20 723*7c478bd9Sstevel@tonic-gate #define FAS_RESET_SPIN_MAX_LOOP 1000 724*7c478bd9Sstevel@tonic-gate 725*7c478bd9Sstevel@tonic-gate /* 726*7c478bd9Sstevel@tonic-gate * f_softstate flags 727*7c478bd9Sstevel@tonic-gate */ 728*7c478bd9Sstevel@tonic-gate #define FAS_SS_DRAINING 0x02 729*7c478bd9Sstevel@tonic-gate #define FAS_SS_QUIESCED 0x04 730*7c478bd9Sstevel@tonic-gate 731*7c478bd9Sstevel@tonic-gate /* 732*7c478bd9Sstevel@tonic-gate * Debugging macros and defines 733*7c478bd9Sstevel@tonic-gate */ 734*7c478bd9Sstevel@tonic-gate #ifdef FASDEBUG 735*7c478bd9Sstevel@tonic-gate /*PRINTFLIKE2*/ 736*7c478bd9Sstevel@tonic-gate extern void fas_dprintf(struct fas *fas, const char *fmt, ...) 737*7c478bd9Sstevel@tonic-gate __KPRINTFLIKE(2); 738*7c478bd9Sstevel@tonic-gate 739*7c478bd9Sstevel@tonic-gate #define INFORMATIVE (fasdebug) 740*7c478bd9Sstevel@tonic-gate #define IDEBUGGING ((fasdebug) && \ 741*7c478bd9Sstevel@tonic-gate ((fas->f_instance == fasdebug_instance) || \ 742*7c478bd9Sstevel@tonic-gate (fasdebug_instance == -1))) 743*7c478bd9Sstevel@tonic-gate #define DDEBUGGING ((fasdebug > 1) && \ 744*7c478bd9Sstevel@tonic-gate ((fas->f_instance == fasdebug_instance) || \ 745*7c478bd9Sstevel@tonic-gate (fasdebug_instance == -1))) 746*7c478bd9Sstevel@tonic-gate 747*7c478bd9Sstevel@tonic-gate #define EDEBUGGING ((fasdebug > 2) && \ 748*7c478bd9Sstevel@tonic-gate ((fas->f_instance == fasdebug_instance) || \ 749*7c478bd9Sstevel@tonic-gate (fasdebug_instance == -1))) 750*7c478bd9Sstevel@tonic-gate 751*7c478bd9Sstevel@tonic-gate #define EPRINTF(str) if (EDEBUGGING) fas_dprintf(fas, str) 752*7c478bd9Sstevel@tonic-gate #define EPRINTF1(str, a) if (EDEBUGGING) fas_dprintf(fas, str, a) 753*7c478bd9Sstevel@tonic-gate #define EPRINTF2(str, a, b) if (EDEBUGGING) fas_dprintf(fas, str, a, b) 754*7c478bd9Sstevel@tonic-gate #define EPRINTF3(str, a, b, c) if (EDEBUGGING) fas_dprintf(fas, str, a, b, c) 755*7c478bd9Sstevel@tonic-gate #define EPRINTF4(str, a, b, c, d) \ 756*7c478bd9Sstevel@tonic-gate if (EDEBUGGING) fas_dprintf(fas, str, a, b, c, d) 757*7c478bd9Sstevel@tonic-gate #define EPRINTF5(str, a, b, c, d, e) \ 758*7c478bd9Sstevel@tonic-gate if (EDEBUGGING) fas_dprintf(fas, str, a, b, c, d, e) 759*7c478bd9Sstevel@tonic-gate #define EPRINTF6(str, a, b, c, d, e, f) \ 760*7c478bd9Sstevel@tonic-gate if (EDEBUGGING) fas_dprintf(fas, str, a, b, c, d, e, f) 761*7c478bd9Sstevel@tonic-gate 762*7c478bd9Sstevel@tonic-gate #define DPRINTF(str) if (DDEBUGGING) fas_dprintf(fas, str) 763*7c478bd9Sstevel@tonic-gate #define DPRINTF1(str, a) if (DDEBUGGING) fas_dprintf(fas, str, a) 764*7c478bd9Sstevel@tonic-gate #define DPRINTF2(str, a, b) if (DDEBUGGING) fas_dprintf(fas, str, a, b) 765*7c478bd9Sstevel@tonic-gate #define DPRINTF3(str, a, b, c) if (DDEBUGGING) fas_dprintf(fas, str, a, b, c) 766*7c478bd9Sstevel@tonic-gate #define DPRINTF4(str, a, b, c, d) \ 767*7c478bd9Sstevel@tonic-gate if (DDEBUGGING) fas_dprintf(fas, str, a, b, c, d) 768*7c478bd9Sstevel@tonic-gate #define DPRINTF5(str, a, b, c, d, e) \ 769*7c478bd9Sstevel@tonic-gate if (DDEBUGGING) fas_dprintf(fas, str, a, b, c, d, e) 770*7c478bd9Sstevel@tonic-gate #define DPRINTF6(str, a, b, c, d, e, f) \ 771*7c478bd9Sstevel@tonic-gate if (DDEBUGGING) fas_dprintf(fas, str, a, b, c, d, e, f) 772*7c478bd9Sstevel@tonic-gate 773*7c478bd9Sstevel@tonic-gate #define IPRINTF(str) if (IDEBUGGING) fas_dprintf(fas, str) 774*7c478bd9Sstevel@tonic-gate #define IPRINTF1(str, a) if (IDEBUGGING) fas_dprintf(fas, str, a) 775*7c478bd9Sstevel@tonic-gate #define IPRINTF2(str, a, b) if (IDEBUGGING) fas_dprintf(fas, str, a, b) 776*7c478bd9Sstevel@tonic-gate #define IPRINTF3(str, a, b, c) if (IDEBUGGING) fas_dprintf(fas, str, a, b, c) 777*7c478bd9Sstevel@tonic-gate #define IPRINTF4(str, a, b, c, d) \ 778*7c478bd9Sstevel@tonic-gate if (IDEBUGGING) fas_dprintf(fas, str, a, b, c, d) 779*7c478bd9Sstevel@tonic-gate #define IPRINTF5(str, a, b, c, d, e) \ 780*7c478bd9Sstevel@tonic-gate if (IDEBUGGING) fas_dprintf(fas, str, a, b, c, d, e) 781*7c478bd9Sstevel@tonic-gate #define IPRINTF6(str, a, b, c, d, e, f) \ 782*7c478bd9Sstevel@tonic-gate if (IDEBUGGING) fas_dprintf(fas, str, a, b, c, d, e, f) 783*7c478bd9Sstevel@tonic-gate 784*7c478bd9Sstevel@tonic-gate #else /* FASDEBUG */ 785*7c478bd9Sstevel@tonic-gate 786*7c478bd9Sstevel@tonic-gate #define EPRINTF(str) 787*7c478bd9Sstevel@tonic-gate #define EPRINTF1(str, a) 788*7c478bd9Sstevel@tonic-gate #define EPRINTF2(str, a, b) 789*7c478bd9Sstevel@tonic-gate #define EPRINTF3(str, a, b, c) 790*7c478bd9Sstevel@tonic-gate #define EPRINTF4(str, a, b, c, d) 791*7c478bd9Sstevel@tonic-gate #define EPRINTF5(str, a, b, c, d, e) 792*7c478bd9Sstevel@tonic-gate #define EPRINTF6(str, a, b, c, d, e, f) 793*7c478bd9Sstevel@tonic-gate #define DPRINTF(str) 794*7c478bd9Sstevel@tonic-gate #define DPRINTF1(str, a) 795*7c478bd9Sstevel@tonic-gate #define DPRINTF2(str, a, b) 796*7c478bd9Sstevel@tonic-gate #define DPRINTF3(str, a, b, c) 797*7c478bd9Sstevel@tonic-gate #define DPRINTF4(str, a, b, c, d) 798*7c478bd9Sstevel@tonic-gate #define DPRINTF5(str, a, b, c, d, e) 799*7c478bd9Sstevel@tonic-gate #define DPRINTF6(str, a, b, c, d, e, f) 800*7c478bd9Sstevel@tonic-gate #define IPRINTF(str) 801*7c478bd9Sstevel@tonic-gate #define IPRINTF1(str, a) 802*7c478bd9Sstevel@tonic-gate #define IPRINTF2(str, a, b) 803*7c478bd9Sstevel@tonic-gate #define IPRINTF3(str, a, b, c) 804*7c478bd9Sstevel@tonic-gate #define IPRINTF4(str, a, b, c, d) 805*7c478bd9Sstevel@tonic-gate #define IPRINTF5(str, a, b, c, d, e) 806*7c478bd9Sstevel@tonic-gate #define IPRINTF6(str, a, b, c, d, e, f) 807*7c478bd9Sstevel@tonic-gate 808*7c478bd9Sstevel@tonic-gate #endif /* FASDEBUG */ 809*7c478bd9Sstevel@tonic-gate 810*7c478bd9Sstevel@tonic-gate /* 811*7c478bd9Sstevel@tonic-gate * Shorthand macros and defines 812*7c478bd9Sstevel@tonic-gate */ 813*7c478bd9Sstevel@tonic-gate 814*7c478bd9Sstevel@tonic-gate /* 815*7c478bd9Sstevel@tonic-gate * Short hand defines 816*7c478bd9Sstevel@tonic-gate */ 817*7c478bd9Sstevel@tonic-gate #define ALL_TARGETS 0xffff 818*7c478bd9Sstevel@tonic-gate 819*7c478bd9Sstevel@tonic-gate #define MAX_THROTTLE 254 /* 1 tag used for non-tagged cmds, 1 rsvd */ 820*7c478bd9Sstevel@tonic-gate #define HOLD_THROTTLE 0 821*7c478bd9Sstevel@tonic-gate #define DRAIN_THROTTLE -1 822*7c478bd9Sstevel@tonic-gate #define QFULL_THROTTLE -2 823*7c478bd9Sstevel@tonic-gate 824*7c478bd9Sstevel@tonic-gate #define NODISC(tgt) (fas->f_nodisc & (1<<(tgt))) 825*7c478bd9Sstevel@tonic-gate #define NOTAG(tgt) (fas->f_notag & (1<<(tgt))) 826*7c478bd9Sstevel@tonic-gate #define TAGGED(tgt) ((fas->f_notag & (1<<(tgt))) == 0) 827*7c478bd9Sstevel@tonic-gate #define SYNC_KNOWN(tgt) (fas->f_sync_known & (1<<(tgt))) 828*7c478bd9Sstevel@tonic-gate 829*7c478bd9Sstevel@tonic-gate #define NEXTSLOT(slot, d) ((slot)+(d)) & ((N_SLOTS)-1) 830*7c478bd9Sstevel@tonic-gate #define MY_ID(fas) ((fas)->f_fasconf & FAS_CONF_BUSID) 831*7c478bd9Sstevel@tonic-gate #define INTPENDING(fas) (fas_dma_reg_read((fas), \ 832*7c478bd9Sstevel@tonic-gate &((fas)->f_dma->dma_csr))&DMA_INT_MASK) 833*7c478bd9Sstevel@tonic-gate 834*7c478bd9Sstevel@tonic-gate #define Tgt(sp) ((sp)->cmd_pkt->pkt_address.a_target) 835*7c478bd9Sstevel@tonic-gate #define Lun(sp) ((sp)->cmd_pkt->pkt_address.a_lun) 836*7c478bd9Sstevel@tonic-gate 837*7c478bd9Sstevel@tonic-gate #define New_state(fas, state)\ 838*7c478bd9Sstevel@tonic-gate (fas)->f_laststate = (fas)->f_state, (fas)->f_state = (state) 839*7c478bd9Sstevel@tonic-gate 840*7c478bd9Sstevel@tonic-gate #define CNUM (fas->f_instance) 841*7c478bd9Sstevel@tonic-gate #define TRUE 1 842*7c478bd9Sstevel@tonic-gate #define FALSE 0 843*7c478bd9Sstevel@tonic-gate #define UNDEFINED -1 844*7c478bd9Sstevel@tonic-gate #define INVALID_MSG 0x7f 845*7c478bd9Sstevel@tonic-gate 846*7c478bd9Sstevel@tonic-gate /* 847*7c478bd9Sstevel@tonic-gate * Default is to have 10 retries on receiving QFULL status and 848*7c478bd9Sstevel@tonic-gate * each retry to be after 100 ms. 849*7c478bd9Sstevel@tonic-gate */ 850*7c478bd9Sstevel@tonic-gate #define QFULL_RETRIES 10 851*7c478bd9Sstevel@tonic-gate #define QFULL_RETRY_INTERVAL 100 852*7c478bd9Sstevel@tonic-gate 853*7c478bd9Sstevel@tonic-gate /* 854*7c478bd9Sstevel@tonic-gate * FEPS chip revision 855*7c478bd9Sstevel@tonic-gate */ 856*7c478bd9Sstevel@tonic-gate #define FAS_HM_REV(fas) (fas)->f_hm_rev 857*7c478bd9Sstevel@tonic-gate 858*7c478bd9Sstevel@tonic-gate /* 859*7c478bd9Sstevel@tonic-gate * Some manifest miscellaneous constants 860*7c478bd9Sstevel@tonic-gate */ 861*7c478bd9Sstevel@tonic-gate 862*7c478bd9Sstevel@tonic-gate #define MEG (1000 * 1000) 863*7c478bd9Sstevel@tonic-gate #define FIVE_MEG (5 * MEG) 864*7c478bd9Sstevel@tonic-gate #define TEN_MEG (10 * MEG) 865*7c478bd9Sstevel@tonic-gate #define TWENTY_MEG (20 * MEG) 866*7c478bd9Sstevel@tonic-gate #define TWENTYFIVE_MEG (25 * MEG) 867*7c478bd9Sstevel@tonic-gate #define FORTY_MEG (40 * MEG) 868*7c478bd9Sstevel@tonic-gate #define FAS_FREQ_SLOP (25000) 869*7c478bd9Sstevel@tonic-gate 870*7c478bd9Sstevel@tonic-gate /* 871*7c478bd9Sstevel@tonic-gate * wide support 872*7c478bd9Sstevel@tonic-gate */ 873*7c478bd9Sstevel@tonic-gate #define FAS_XFER_WIDTH 1 874*7c478bd9Sstevel@tonic-gate 875*7c478bd9Sstevel@tonic-gate #define FAS_EMPTY_CALLBACKQ(fas) fas_empty_callbackQ(fas) 876*7c478bd9Sstevel@tonic-gate 877*7c478bd9Sstevel@tonic-gate #define FAS_CHECK_WAITQ_AND_FAS_MUTEX_EXIT(fas) \ 878*7c478bd9Sstevel@tonic-gate mutex_enter(&fas->f_waitQ_mutex); \ 879*7c478bd9Sstevel@tonic-gate if (fas->f_waitf) { \ 880*7c478bd9Sstevel@tonic-gate fas_empty_waitQ(fas); \ 881*7c478bd9Sstevel@tonic-gate } \ 882*7c478bd9Sstevel@tonic-gate mutex_exit(FAS_MUTEX(fas)); \ 883*7c478bd9Sstevel@tonic-gate mutex_exit(&fas->f_waitQ_mutex); 884*7c478bd9Sstevel@tonic-gate 885*7c478bd9Sstevel@tonic-gate /* 886*7c478bd9Sstevel@tonic-gate * flags for fas_accept_pkt 887*7c478bd9Sstevel@tonic-gate */ 888*7c478bd9Sstevel@tonic-gate #define NO_TRAN_BUSY 0 /* fas_accept_pkt may not bounce these pkts */ 889*7c478bd9Sstevel@tonic-gate #define TRAN_BUSY_OK 1 /* fas_accept_pkt may bounce these pkts */ 890*7c478bd9Sstevel@tonic-gate 891*7c478bd9Sstevel@tonic-gate /* 892*7c478bd9Sstevel@tonic-gate * reset delay tick 893*7c478bd9Sstevel@tonic-gate */ 894*7c478bd9Sstevel@tonic-gate #define FAS_WATCH_RESET_DELAY_TICK 50 /* specified in milli seconds */ 895*7c478bd9Sstevel@tonic-gate 896*7c478bd9Sstevel@tonic-gate /* 897*7c478bd9Sstevel@tonic-gate * 2 ms timeout on receiving tag on reconnect 898*7c478bd9Sstevel@tonic-gate */ 899*7c478bd9Sstevel@tonic-gate #define RECONNECT_TAG_RCV_TIMEOUT 2000 /* allow up to 2 ms */ 900*7c478bd9Sstevel@tonic-gate 901*7c478bd9Sstevel@tonic-gate 902*7c478bd9Sstevel@tonic-gate /* 903*7c478bd9Sstevel@tonic-gate * auto request sense 904*7c478bd9Sstevel@tonic-gate */ 905*7c478bd9Sstevel@tonic-gate #define RQ_MAKECOM_COMMON(pktp, flag, cmd) \ 906*7c478bd9Sstevel@tonic-gate (pktp)->pkt_flags = (flag), \ 907*7c478bd9Sstevel@tonic-gate ((union scsi_cdb *)(pktp)->pkt_cdbp)->scc_cmd = (cmd), \ 908*7c478bd9Sstevel@tonic-gate ((union scsi_cdb *)(pktp)->pkt_cdbp)->scc_lun = \ 909*7c478bd9Sstevel@tonic-gate (pktp)->pkt_address.a_lun 910*7c478bd9Sstevel@tonic-gate 911*7c478bd9Sstevel@tonic-gate #define RQ_MAKECOM_G0(pktp, flag, cmd, addr, cnt) \ 912*7c478bd9Sstevel@tonic-gate RQ_MAKECOM_COMMON((pktp), (flag), (cmd)), \ 913*7c478bd9Sstevel@tonic-gate FORMG0ADDR(((union scsi_cdb *)(pktp)->pkt_cdbp), (addr)), \ 914*7c478bd9Sstevel@tonic-gate FORMG0COUNT(((union scsi_cdb *)(pktp)->pkt_cdbp), (cnt)) 915*7c478bd9Sstevel@tonic-gate 916*7c478bd9Sstevel@tonic-gate #define NEW_TIMEOUT 1 917*7c478bd9Sstevel@tonic-gate 918*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 919*7c478bd9Sstevel@tonic-gate } 920*7c478bd9Sstevel@tonic-gate #endif 921*7c478bd9Sstevel@tonic-gate 922*7c478bd9Sstevel@tonic-gate #endif /* _SYS_SCSI_ADAPTERS_FASVAR_H */ 923