isp_target.c (160978) | isp_target.c (163899) |
---|---|
1/*- 2 * Machine and OS Independent Target Mode Code for the Qlogic SCSI/FC adapters. 3 * 4 * Copyright (c) 1997-2006 by Matthew Jacob 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 24 unchanged lines hidden (view full) --- 33 * Include header file appropriate for platform we're building on. 34 */ 35 36#ifdef __NetBSD__ 37#include <dev/ic/isp_netbsd.h> 38#endif 39#ifdef __FreeBSD__ 40#include <sys/cdefs.h> | 1/*- 2 * Machine and OS Independent Target Mode Code for the Qlogic SCSI/FC adapters. 3 * 4 * Copyright (c) 1997-2006 by Matthew Jacob 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 24 unchanged lines hidden (view full) --- 33 * Include header file appropriate for platform we're building on. 34 */ 35 36#ifdef __NetBSD__ 37#include <dev/ic/isp_netbsd.h> 38#endif 39#ifdef __FreeBSD__ 40#include <sys/cdefs.h> |
41__FBSDID("$FreeBSD: head/sys/dev/isp/isp_target.c 160978 2006-08-04 20:20:00Z mjacob $"); | 41__FBSDID("$FreeBSD: head/sys/dev/isp/isp_target.c 163899 2006-11-02 03:21:32Z mjacob $"); |
42#include <dev/isp/isp_freebsd.h> 43#endif 44#ifdef __OpenBSD__ 45#include <dev/ic/isp_openbsd.h> 46#endif 47#ifdef __linux__ 48#include "isp_linux.h" 49#endif 50 51#ifdef ISP_TARGET_MODE 52static const char atiocope[] = 53 "ATIO returned for lun %d because it was in the middle of Bus Device Reset " 54 "on bus %d"; 55static const char atior[] = | 42#include <dev/isp/isp_freebsd.h> 43#endif 44#ifdef __OpenBSD__ 45#include <dev/ic/isp_openbsd.h> 46#endif 47#ifdef __linux__ 48#include "isp_linux.h" 49#endif 50 51#ifdef ISP_TARGET_MODE 52static const char atiocope[] = 53 "ATIO returned for lun %d because it was in the middle of Bus Device Reset " 54 "on bus %d"; 55static const char atior[] = |
56 "ATIO returned on for lun %d on from IID %d because a Bus Reset occurred " 57 "on bus %d"; | 56 "ATIO returned on for lun %d on from loopid %d because a Bus Reset " 57 "occurred on bus %d"; |
58 59static void isp_got_msg(ispsoftc_t *, in_entry_t *); 60static void isp_got_msg_fc(ispsoftc_t *, in_fcentry_t *); | 58 59static void isp_got_msg(ispsoftc_t *, in_entry_t *); 60static void isp_got_msg_fc(ispsoftc_t *, in_fcentry_t *); |
61static void isp_got_tmf_24xx(ispsoftc_t *, at7_entry_t *); |
|
61static void isp_handle_atio(ispsoftc_t *, at_entry_t *); 62static void isp_handle_atio2(ispsoftc_t *, at2_entry_t *); 63static void isp_handle_ctio(ispsoftc_t *, ct_entry_t *); 64static void isp_handle_ctio2(ispsoftc_t *, ct2_entry_t *); | 62static void isp_handle_atio(ispsoftc_t *, at_entry_t *); 63static void isp_handle_atio2(ispsoftc_t *, at2_entry_t *); 64static void isp_handle_ctio(ispsoftc_t *, ct_entry_t *); 65static void isp_handle_ctio2(ispsoftc_t *, ct2_entry_t *); |
66static void isp_handle_ctio7(ispsoftc_t *, ct7_entry_t *); |
|
65 66/* 67 * The Qlogic driver gets an interrupt to look at response queue entries. 68 * Some of these are status completions for initiatior mode commands, but 69 * if target mode is enabled, we get a whole wad of response queue entries 70 * to be handled here. 71 * 72 * Basically the split into 3 main groups: Lun Enable/Modification responses, --- 32 unchanged lines hidden (view full) --- 105 * has already swizzled it into the platform dependent from canonical form. 106 * 107 * Because of the way this driver is designed, unfortunately most of the 108 * actual synchronization work has to be done in the platform specific 109 * code- we have no synchroniation primitives in the common code. 110 */ 111 112int | 67 68/* 69 * The Qlogic driver gets an interrupt to look at response queue entries. 70 * Some of these are status completions for initiatior mode commands, but 71 * if target mode is enabled, we get a whole wad of response queue entries 72 * to be handled here. 73 * 74 * Basically the split into 3 main groups: Lun Enable/Modification responses, --- 32 unchanged lines hidden (view full) --- 107 * has already swizzled it into the platform dependent from canonical form. 108 * 109 * Because of the way this driver is designed, unfortunately most of the 110 * actual synchronization work has to be done in the platform specific 111 * code- we have no synchroniation primitives in the common code. 112 */ 113 114int |
113isp_target_notify(ispsoftc_t *isp, void *vptr, uint16_t *optrp) | 115isp_target_notify(ispsoftc_t *isp, void *vptr, uint32_t *optrp) |
114{ | 116{ |
115 uint16_t status, seqid; | 117 uint16_t status; 118 uint32_t seqid; |
116 union { 117 at_entry_t *atiop; 118 at2_entry_t *at2iop; 119 at2e_entry_t *at2eiop; | 119 union { 120 at_entry_t *atiop; 121 at2_entry_t *at2iop; 122 at2e_entry_t *at2eiop; |
123 at7_entry_t *at7iop; |
|
120 ct_entry_t *ctiop; 121 ct2_entry_t *ct2iop; 122 ct2e_entry_t *ct2eiop; | 124 ct_entry_t *ctiop; 125 ct2_entry_t *ct2iop; 126 ct2e_entry_t *ct2eiop; |
127 ct7_entry_t *ct7iop; |
|
123 lun_entry_t *lunenp; 124 in_entry_t *inotp; 125 in_fcentry_t *inot_fcp; 126 in_fcentry_e_t *inote_fcp; | 128 lun_entry_t *lunenp; 129 in_entry_t *inotp; 130 in_fcentry_t *inot_fcp; 131 in_fcentry_e_t *inote_fcp; |
132 in_fcentry_24xx_t *inot_24xx; |
|
127 na_entry_t *nackp; 128 na_fcentry_t *nack_fcp; 129 na_fcentry_e_t *nacke_fcp; | 133 na_entry_t *nackp; 134 na_fcentry_t *nack_fcp; 135 na_fcentry_e_t *nacke_fcp; |
136 na_fcentry_24xx_t *nack_24xx; |
|
130 isphdr_t *hp; | 137 isphdr_t *hp; |
138 abts_t *abts; 139 abts_rsp_t *abts_rsp; 140 els_t *els; |
|
131 void * *vp; 132#define atiop unp.atiop 133#define at2iop unp.at2iop 134#define at2eiop unp.at2eiop | 141 void * *vp; 142#define atiop unp.atiop 143#define at2iop unp.at2iop 144#define at2eiop unp.at2eiop |
145#define at7iop unp.at7iop |
|
135#define ctiop unp.ctiop 136#define ct2iop unp.ct2iop 137#define ct2eiop unp.ct2eiop | 146#define ctiop unp.ctiop 147#define ct2iop unp.ct2iop 148#define ct2eiop unp.ct2eiop |
149#define ct7iop unp.ct7iop |
|
138#define lunenp unp.lunenp 139#define inotp unp.inotp 140#define inot_fcp unp.inot_fcp 141#define inote_fcp unp.inote_fcp | 150#define lunenp unp.lunenp 151#define inotp unp.inotp 152#define inot_fcp unp.inot_fcp 153#define inote_fcp unp.inote_fcp |
154#define inot_24xx unp.inot_24xx |
|
142#define nackp unp.nackp 143#define nack_fcp unp.nack_fcp 144#define nacke_fcp unp.nacke_fcp | 155#define nackp unp.nackp 156#define nack_fcp unp.nack_fcp 157#define nacke_fcp unp.nacke_fcp |
158#define nack_24xx unp.nack_24xx 159#define abts unp.abts 160#define abts_rsp unp.abts_rsp 161#define els unp.els |
|
145#define hdrp unp.hp 146 } unp; 147 uint8_t local[QENTRY_LEN]; | 162#define hdrp unp.hp 163 } unp; 164 uint8_t local[QENTRY_LEN]; |
148 int bus, type, rval = 1; | 165 int bus, type, level, rval = 1; |
149 150 type = isp_get_response_type(isp, (isphdr_t *)vptr); 151 unp.vp = vptr; 152 153 ISP_TDQE(isp, "isp_target_notify", (int) *optrp, vptr); 154 155 switch(type) { 156 case RQSTYPE_ATIO: | 166 167 type = isp_get_response_type(isp, (isphdr_t *)vptr); 168 unp.vp = vptr; 169 170 ISP_TDQE(isp, "isp_target_notify", (int) *optrp, vptr); 171 172 switch(type) { 173 case RQSTYPE_ATIO: |
157 isp_get_atio(isp, atiop, (at_entry_t *) local); 158 isp_handle_atio(isp, (at_entry_t *) local); | 174 if (IS_24XX(isp)) { 175 int len; 176 177 isp_get_atio7(isp, at7iop, (at7_entry_t *) local); 178 at7iop = (at7_entry_t *) local; 179 /* 180 * Check for and do something with commands whose IULEN 181 * extends past a singel queue entry. 182 */ 183 len = at7iop->at_ta_len & 0xfffff; 184 if (len > (QENTRY_LEN - 8)) { 185 len -= (QENTRY_LEN - 8); 186 isp_prt(isp, ISP_LOGINFO, 187 "long IU length (%d) ignored", len); 188 while (len > 0) { 189 *optrp = ISP_NXT_QENTRY(*optrp, 190 RESULT_QUEUE_LEN(isp)); 191 len -= QENTRY_LEN; 192 } 193 } 194 /* 195 * Check for a task management function 196 */ 197 if (at7iop->at_cmnd.fcp_cmnd_task_management) { 198 isp_got_tmf_24xx(isp, at7iop); 199 break; 200 } 201 /* 202 * Just go straight to outer layer for this one. 203 */ 204 (void) isp_async(isp, ISPASYNC_TARGET_ACTION, local); 205 } else { 206 isp_get_atio(isp, atiop, (at_entry_t *) local); 207 isp_handle_atio(isp, (at_entry_t *) local); 208 } |
159 break; | 209 break; |
210 |
|
160 case RQSTYPE_CTIO: 161 isp_get_ctio(isp, ctiop, (ct_entry_t *) local); 162 isp_handle_ctio(isp, (ct_entry_t *) local); 163 break; | 211 case RQSTYPE_CTIO: 212 isp_get_ctio(isp, ctiop, (ct_entry_t *) local); 213 isp_handle_ctio(isp, (ct_entry_t *) local); 214 break; |
215 |
|
164 case RQSTYPE_ATIO2: | 216 case RQSTYPE_ATIO2: |
165 if (IS_2KLOGIN(isp)) { | 217 if (FCPARAM(isp)->isp_2klogin) { |
166 isp_get_atio2e(isp, at2eiop, (at2e_entry_t *) local); 167 } else { 168 isp_get_atio2(isp, at2iop, (at2_entry_t *) local); | 218 isp_get_atio2e(isp, at2eiop, (at2e_entry_t *) local); 219 } else { 220 isp_get_atio2(isp, at2iop, (at2_entry_t *) local); |
169 } | 221 } |
170 isp_handle_atio2(isp, (at2_entry_t *) local); 171 break; | 222 isp_handle_atio2(isp, (at2_entry_t *) local); 223 break; |
224 |
|
172 case RQSTYPE_CTIO3: 173 case RQSTYPE_CTIO2: | 225 case RQSTYPE_CTIO3: 226 case RQSTYPE_CTIO2: |
174 if (IS_2KLOGIN(isp)) { | 227 if (FCPARAM(isp)->isp_2klogin) { |
175 isp_get_ctio2e(isp, ct2eiop, (ct2e_entry_t *) local); 176 } else { 177 isp_get_ctio2(isp, ct2iop, (ct2_entry_t *) local); | 228 isp_get_ctio2e(isp, ct2eiop, (ct2e_entry_t *) local); 229 } else { 230 isp_get_ctio2(isp, ct2iop, (ct2_entry_t *) local); |
178 } | 231 } |
179 isp_handle_ctio2(isp, (ct2_entry_t *) local); 180 break; | 232 isp_handle_ctio2(isp, (ct2_entry_t *) local); 233 break; |
234 235 case RQSTYPE_CTIO7: 236 isp_get_ctio7(isp, ct7iop, (ct7_entry_t *) local); 237 isp_handle_ctio7(isp, (ct7_entry_t *) local); 238 break; 239 |
|
181 case RQSTYPE_ENABLE_LUN: 182 case RQSTYPE_MODIFY_LUN: 183 isp_get_enable_lun(isp, lunenp, (lun_entry_t *) local); 184 (void) isp_async(isp, ISPASYNC_TARGET_ACTION, local); 185 break; 186 187 case RQSTYPE_NOTIFY: 188 /* 189 * Either the ISP received a SCSI message it can't 190 * handle, or it's returning an Immed. Notify entry 191 * we sent. We can send Immed. Notify entries to 192 * increment the firmware's resource count for them 193 * (we set this initially in the Enable Lun entry). 194 */ 195 bus = 0; | 240 case RQSTYPE_ENABLE_LUN: 241 case RQSTYPE_MODIFY_LUN: 242 isp_get_enable_lun(isp, lunenp, (lun_entry_t *) local); 243 (void) isp_async(isp, ISPASYNC_TARGET_ACTION, local); 244 break; 245 246 case RQSTYPE_NOTIFY: 247 /* 248 * Either the ISP received a SCSI message it can't 249 * handle, or it's returning an Immed. Notify entry 250 * we sent. We can send Immed. Notify entries to 251 * increment the firmware's resource count for them 252 * (we set this initially in the Enable Lun entry). 253 */ 254 bus = 0; |
196 if (IS_FC(isp)) { 197 if (IS_2KLOGIN(isp)) { | 255 if (IS_24XX(isp)) { 256 isp_get_notify_24xx(isp, inot_24xx, 257 (in_fcentry_24xx_t *)local); 258 inot_24xx = (in_fcentry_24xx_t *) local; 259 status = inot_24xx->in_status; 260 seqid = inot_24xx->in_rxid; 261 isp_prt(isp, ISP_LOGTDEBUG0, 262 "Immediate Notify status=0x%x seqid=0x%x", 263 status, seqid); 264 switch (status) { 265 case IN24XX_LIP_RESET: 266 case IN24XX_LINK_RESET: 267 case IN24XX_PORT_LOGOUT: 268 case IN24XX_PORT_CHANGED: 269 case IN24XX_LINK_FAILED: 270 case IN24XX_SRR_RCVD: 271 case IN24XX_ELS_RCVD: 272 (void) isp_async(isp, ISPASYNC_TARGET_ACTION, 273 &local); 274 break; 275 default: 276 isp_prt(isp, ISP_LOGINFO, 277 "isp_target_notify: unknown status (0x%x)", 278 status); 279 isp_notify_ack(isp, local); 280 break; 281 } 282 break; 283 } else if (IS_FC(isp)) { 284 if (FCPARAM(isp)->isp_2klogin) { |
198 isp_get_notify_fc_e(isp, inote_fcp, 199 (in_fcentry_e_t *)local); 200 } else { 201 isp_get_notify_fc(isp, inot_fcp, 202 (in_fcentry_t *)local); 203 } 204 inot_fcp = (in_fcentry_t *) local; 205 status = inot_fcp->in_status; --- 18 unchanged lines hidden (view full) --- 224 case IN_IDE_RECEIVED: 225 if (IS_FC(isp)) { 226 isp_got_msg_fc(isp, (in_fcentry_t *)local); 227 } else { 228 isp_got_msg(isp, (in_entry_t *)local); 229 } 230 break; 231 case IN_RSRC_UNAVAIL: | 285 isp_get_notify_fc_e(isp, inote_fcp, 286 (in_fcentry_e_t *)local); 287 } else { 288 isp_get_notify_fc(isp, inot_fcp, 289 (in_fcentry_t *)local); 290 } 291 inot_fcp = (in_fcentry_t *) local; 292 status = inot_fcp->in_status; --- 18 unchanged lines hidden (view full) --- 311 case IN_IDE_RECEIVED: 312 if (IS_FC(isp)) { 313 isp_got_msg_fc(isp, (in_fcentry_t *)local); 314 } else { 315 isp_got_msg(isp, (in_entry_t *)local); 316 } 317 break; 318 case IN_RSRC_UNAVAIL: |
232 isp_prt(isp, ISP_LOGWARN, "Firmware out of ATIOs"); | 319 isp_prt(isp, ISP_LOGINFO, "Firmware out of ATIOs"); |
233 isp_notify_ack(isp, local); 234 break; 235 case IN_RESET: | 320 isp_notify_ack(isp, local); 321 break; 322 case IN_RESET: |
236 (void) isp_target_async(isp, 0, ASYNC_BUS_RESET); | 323 { 324 /* 325 * We form the notify structure here because we need 326 * to mark it as needing a NOTIFY ACK on return. 327 */ 328 tmd_notify_t notify; 329 330 MEMZERO(¬ify, sizeof (tmd_notify_t)); 331 notify.nt_hba = isp; 332 notify.nt_iid = INI_ANY; 333 /* nt_tgt set in outer layers */ 334 notify.nt_lun = LUN_ANY; 335 notify.nt_tagval = TAG_ANY; 336 notify.nt_ncode = NT_BUS_RESET; 337 notify.nt_need_ack = 1; 338 (void) isp_async(isp, ISPASYNC_TARGET_NOTIFY, ¬ify); |
237 break; | 339 break; |
340 } |
|
238 case IN_PORT_LOGOUT: 239 case IN_ABORT_TASK: 240 case IN_PORT_CHANGED: 241 case IN_GLOBAL_LOGO: 242 (void) isp_async(isp, ISPASYNC_TARGET_ACTION, &local); 243 break; 244 default: | 341 case IN_PORT_LOGOUT: 342 case IN_ABORT_TASK: 343 case IN_PORT_CHANGED: 344 case IN_GLOBAL_LOGO: 345 (void) isp_async(isp, ISPASYNC_TARGET_ACTION, &local); 346 break; 347 default: |
245 isp_prt(isp, ISP_LOGERR, 246 "bad status (0x%x) in isp_target_notify", status); | 348 isp_prt(isp, ISP_LOGINFO, 349 "isp_target_notify: unknown status (0x%x)", 350 status); |
247 isp_notify_ack(isp, local); 248 break; 249 } 250 break; 251 252 case RQSTYPE_NOTIFY_ACK: 253 /* 254 * The ISP is acknowledging our acknowledgement of an 255 * Immediate Notify entry for some asynchronous event. 256 */ | 351 isp_notify_ack(isp, local); 352 break; 353 } 354 break; 355 356 case RQSTYPE_NOTIFY_ACK: 357 /* 358 * The ISP is acknowledging our acknowledgement of an 359 * Immediate Notify entry for some asynchronous event. 360 */ |
257 if (IS_FC(isp)) { 258 if (IS_2KLOGIN(isp)) { | 361 if (IS_24XX(isp)) { 362 isp_get_notify_ack_24xx(isp, nack_24xx, 363 (na_fcentry_24xx_t *) local); 364 nack_24xx = (na_fcentry_24xx_t *) local; 365 if (nack_24xx->na_status != NA_OK) { 366 level = ISP_LOGINFO; 367 } else { 368 level = ISP_LOGTDEBUG1; 369 } 370 isp_prt(isp, level, 371 "Notify Ack Status=0x%x; Subcode 0x%x seqid=0x%x", 372 nack_24xx->na_status, nack_24xx->na_status_subcode, 373 nack_24xx->na_rxid); 374 } else if (IS_FC(isp)) { 375 if (FCPARAM(isp)->isp_2klogin) { |
259 isp_get_notify_ack_fc_e(isp, nacke_fcp, 260 (na_fcentry_e_t *)local); 261 } else { 262 isp_get_notify_ack_fc(isp, nack_fcp, 263 (na_fcentry_t *)local); | 376 isp_get_notify_ack_fc_e(isp, nacke_fcp, 377 (na_fcentry_e_t *)local); 378 } else { 379 isp_get_notify_ack_fc(isp, nack_fcp, 380 (na_fcentry_t *)local); |
264 } | 381 } |
265 nack_fcp = (na_fcentry_t *)local; | 382 nack_fcp = (na_fcentry_t *)local; |
266 isp_prt(isp, ISP_LOGTDEBUG1, 267 "Notify Ack status=0x%x seqid 0x%x", | 383 if (nack_fcp->na_status != NA_OK) { 384 level = ISP_LOGINFO; 385 } else { 386 level = ISP_LOGTDEBUG1; 387 } 388 isp_prt(isp, level, 389 "Notify Ack Status=0x%x seqid 0x%x", |
268 nack_fcp->na_status, nack_fcp->na_seqid); 269 } else { 270 isp_get_notify_ack(isp, nackp, (na_entry_t *)local); 271 nackp = (na_entry_t *)local; | 390 nack_fcp->na_status, nack_fcp->na_seqid); 391 } else { 392 isp_get_notify_ack(isp, nackp, (na_entry_t *)local); 393 nackp = (na_entry_t *)local; |
272 isp_prt(isp, ISP_LOGTDEBUG1, | 394 if (nackp->na_status != NA_OK) { 395 level = ISP_LOGINFO; 396 } else { 397 level = ISP_LOGTDEBUG1; 398 } 399 isp_prt(isp, level, |
273 "Notify Ack event 0x%x status=0x%x seqid 0x%x", 274 nackp->na_event, nackp->na_status, nackp->na_seqid); 275 } 276 break; | 400 "Notify Ack event 0x%x status=0x%x seqid 0x%x", 401 nackp->na_event, nackp->na_status, nackp->na_seqid); 402 } 403 break; |
404 405 case RQSTYPE_ABTS_RCVD: 406 isp_get_abts(isp, abts, (abts_t *)local); 407 (void) isp_async(isp, ISPASYNC_TARGET_ACTION, &local); 408 break; 409 case RQSTYPE_ABTS_RSP: 410 isp_get_abts_rsp(isp, abts_rsp, (abts_rsp_t *)local); 411 abts_rsp = (abts_rsp_t *) local; 412 if (abts_rsp->abts_rsp_status) { 413 level = ISP_LOGINFO; 414 } else { 415 level = ISP_LOGTDEBUG0; 416 } 417 isp_prt(isp, level, 418 "ABTS RSP response[0x%x]: status=0x%x sub=(0x%x 0x%x)", 419 abts_rsp->abts_rsp_rxid_task, abts_rsp->abts_rsp_status, 420 abts_rsp->abts_rsp_payload.rsp.subcode1, 421 abts_rsp->abts_rsp_payload.rsp.subcode2); 422 break; |
|
277 default: 278 isp_prt(isp, ISP_LOGERR, 279 "Unknown entry type 0x%x in isp_target_notify", type); 280 rval = 0; 281 break; 282 } 283#undef atiop 284#undef at2iop 285#undef at2eiop | 423 default: 424 isp_prt(isp, ISP_LOGERR, 425 "Unknown entry type 0x%x in isp_target_notify", type); 426 rval = 0; 427 break; 428 } 429#undef atiop 430#undef at2iop 431#undef at2eiop |
432#undef at7iop |
|
286#undef ctiop 287#undef ct2iop 288#undef ct2eiop | 433#undef ctiop 434#undef ct2iop 435#undef ct2eiop |
436#undef ct7iop |
|
289#undef lunenp 290#undef inotp 291#undef inot_fcp 292#undef inote_fcp | 437#undef lunenp 438#undef inotp 439#undef inot_fcp 440#undef inote_fcp |
441#undef inot_24xx |
|
293#undef nackp 294#undef nack_fcp 295#undef nacke_fcp | 442#undef nackp 443#undef nack_fcp 444#undef nacke_fcp |
445#undef hack_24xx 446#undef abts 447#undef abts_rsp 448#undef els |
|
296#undef hdrp 297 return (rval); 298} 299 300 301/* 302 * Toggle (on/off) target mode for bus/target/lun 303 * 304 * The caller has checked for overlap and legality. 305 * 306 * Note that not all of bus, target or lun can be paid attention to. 307 * Note also that this action will not be complete until the f/w writes 308 * response entry. The caller is responsible for synchronizing this. 309 */ 310int 311isp_lun_cmd(ispsoftc_t *isp, int cmd, int bus, int tgt, int lun, 312 int cmd_cnt, int inot_cnt, uint32_t opaque) 313{ 314 lun_entry_t el; | 449#undef hdrp 450 return (rval); 451} 452 453 454/* 455 * Toggle (on/off) target mode for bus/target/lun 456 * 457 * The caller has checked for overlap and legality. 458 * 459 * Note that not all of bus, target or lun can be paid attention to. 460 * Note also that this action will not be complete until the f/w writes 461 * response entry. The caller is responsible for synchronizing this. 462 */ 463int 464isp_lun_cmd(ispsoftc_t *isp, int cmd, int bus, int tgt, int lun, 465 int cmd_cnt, int inot_cnt, uint32_t opaque) 466{ 467 lun_entry_t el; |
315 uint16_t nxti, optr; | 468 uint32_t nxti, optr; |
316 void *outp; 317 318 319 MEMZERO(&el, sizeof (el)); 320 if (IS_DUALBUS(isp)) { 321 el.le_rsvd = (bus & 0x1) << 7; 322 } 323 el.le_cmd_count = cmd_cnt; --- 15 unchanged lines hidden (view full) --- 339 el.le_ops = LUN_CCINCR | LUN_ININCR; 340 } 341 el.le_header.rqs_entry_type = cmd; 342 el.le_header.rqs_entry_count = 1; 343 el.le_reserved = opaque; 344 if (IS_SCSI(isp)) { 345 el.le_tgt = tgt; 346 el.le_lun = lun; | 469 void *outp; 470 471 472 MEMZERO(&el, sizeof (el)); 473 if (IS_DUALBUS(isp)) { 474 el.le_rsvd = (bus & 0x1) << 7; 475 } 476 el.le_cmd_count = cmd_cnt; --- 15 unchanged lines hidden (view full) --- 492 el.le_ops = LUN_CCINCR | LUN_ININCR; 493 } 494 el.le_header.rqs_entry_type = cmd; 495 el.le_header.rqs_entry_count = 1; 496 el.le_reserved = opaque; 497 if (IS_SCSI(isp)) { 498 el.le_tgt = tgt; 499 el.le_lun = lun; |
347 } else if ((FCPARAM(isp)->isp_fwattr & ISP_FW_ATTR_SCCLUN) == 0) { | 500 } else if (FCPARAM(isp)->isp_sccfw == 0) { |
348 el.le_lun = lun; 349 } 350 351 if (isp_getrqentry(isp, &nxti, &optr, &outp)) { 352 isp_prt(isp, ISP_LOGERR, 353 "Request Queue Overflow in isp_lun_cmd"); 354 return (-1); 355 } 356 ISP_TDQE(isp, "isp_lun_cmd", (int) optr, &el); 357 isp_put_enable_lun(isp, &el, outp); 358 ISP_ADD_REQUEST(isp, nxti); 359 return (0); 360} 361 362 363int 364isp_target_put_entry(ispsoftc_t *isp, void *ap) 365{ 366 void *outp; | 501 el.le_lun = lun; 502 } 503 504 if (isp_getrqentry(isp, &nxti, &optr, &outp)) { 505 isp_prt(isp, ISP_LOGERR, 506 "Request Queue Overflow in isp_lun_cmd"); 507 return (-1); 508 } 509 ISP_TDQE(isp, "isp_lun_cmd", (int) optr, &el); 510 isp_put_enable_lun(isp, &el, outp); 511 ISP_ADD_REQUEST(isp, nxti); 512 return (0); 513} 514 515 516int 517isp_target_put_entry(ispsoftc_t *isp, void *ap) 518{ 519 void *outp; |
367 uint16_t nxti, optr; | 520 uint32_t nxti, optr; |
368 uint8_t etype = ((isphdr_t *) ap)->rqs_entry_type; 369 370 if (isp_getrqentry(isp, &nxti, &optr, &outp)) { 371 isp_prt(isp, ISP_LOGWARN, 372 "Request Queue Overflow in isp_target_put_entry"); 373 return (-1); 374 } 375 switch (etype) { 376 case RQSTYPE_ATIO: 377 isp_put_atio(isp, (at_entry_t *) ap, (at_entry_t *) outp); 378 break; 379 case RQSTYPE_ATIO2: | 521 uint8_t etype = ((isphdr_t *) ap)->rqs_entry_type; 522 523 if (isp_getrqentry(isp, &nxti, &optr, &outp)) { 524 isp_prt(isp, ISP_LOGWARN, 525 "Request Queue Overflow in isp_target_put_entry"); 526 return (-1); 527 } 528 switch (etype) { 529 case RQSTYPE_ATIO: 530 isp_put_atio(isp, (at_entry_t *) ap, (at_entry_t *) outp); 531 break; 532 case RQSTYPE_ATIO2: |
380 if (IS_2KLOGIN(isp)) { 381 isp_put_atio2e(isp, (at2e_entry_t *) ap, (at2e_entry_t *) outp); 382 } else { 383 isp_put_atio2(isp, (at2_entry_t *) ap, (at2_entry_t *) outp); 384 } | 533 if (FCPARAM(isp)->isp_2klogin) { 534 isp_put_atio2e(isp, (at2e_entry_t *) ap, 535 (at2e_entry_t *) outp); 536 } else { 537 isp_put_atio2(isp, (at2_entry_t *) ap, 538 (at2_entry_t *) outp); 539 } |
385 break; 386 case RQSTYPE_CTIO: 387 isp_put_ctio(isp, (ct_entry_t *) ap, (ct_entry_t *) outp); 388 break; 389 case RQSTYPE_CTIO2: | 540 break; 541 case RQSTYPE_CTIO: 542 isp_put_ctio(isp, (ct_entry_t *) ap, (ct_entry_t *) outp); 543 break; 544 case RQSTYPE_CTIO2: |
390 if (IS_2KLOGIN(isp)) { 391 isp_put_ctio2e(isp, (ct2e_entry_t *) ap, (ct2e_entry_t *) outp); 392 } else { 393 isp_put_ctio2(isp, (ct2_entry_t *) ap, (ct2_entry_t *) outp); 394 } | 545 if (FCPARAM(isp)->isp_2klogin) { 546 isp_put_ctio2e(isp, (ct2e_entry_t *) ap, 547 (ct2e_entry_t *) outp); 548 } else { 549 isp_put_ctio2(isp, (ct2_entry_t *) ap, 550 (ct2_entry_t *) outp); 551 } |
395 break; | 552 break; |
553 case RQSTYPE_CTIO7: 554 isp_put_ctio7(isp, (ct7_entry_t *) ap, (ct7_entry_t *) outp); 555 break; |
|
396 default: 397 isp_prt(isp, ISP_LOGERR, 398 "Unknown type 0x%x in isp_put_entry", etype); 399 return (-1); 400 } | 556 default: 557 isp_prt(isp, ISP_LOGERR, 558 "Unknown type 0x%x in isp_put_entry", etype); 559 return (-1); 560 } |
401 | |
402 ISP_TDQE(isp, "isp_target_put_entry", (int) optr, ap); 403 ISP_ADD_REQUEST(isp, nxti); 404 return (0); 405} 406 407int 408isp_target_put_atio(ispsoftc_t *isp, void *arg) 409{ 410 union { 411 at_entry_t _atio; 412 at2_entry_t _atio2; 413 at2e_entry_t _atio2e; 414 } atun; 415 416 MEMZERO(&atun, sizeof atun); 417 if (IS_FC(isp)) { 418 at2_entry_t *aep = arg; 419 atun._atio2.at_header.rqs_entry_type = RQSTYPE_ATIO2; 420 atun._atio2.at_header.rqs_entry_count = 1; | 561 ISP_TDQE(isp, "isp_target_put_entry", (int) optr, ap); 562 ISP_ADD_REQUEST(isp, nxti); 563 return (0); 564} 565 566int 567isp_target_put_atio(ispsoftc_t *isp, void *arg) 568{ 569 union { 570 at_entry_t _atio; 571 at2_entry_t _atio2; 572 at2e_entry_t _atio2e; 573 } atun; 574 575 MEMZERO(&atun, sizeof atun); 576 if (IS_FC(isp)) { 577 at2_entry_t *aep = arg; 578 atun._atio2.at_header.rqs_entry_type = RQSTYPE_ATIO2; 579 atun._atio2.at_header.rqs_entry_count = 1; |
421 if (FCPARAM(isp)->isp_fwattr & ISP_FW_ATTR_SCCLUN) { 422 atun._atio2.at_scclun = (uint16_t) aep->at_scclun; | 580 if (FCPARAM(isp)->isp_sccfw) { 581 atun._atio2.at_scclun = aep->at_scclun; |
423 } else { 424 atun._atio2.at_lun = (uint8_t) aep->at_lun; 425 } | 582 } else { 583 atun._atio2.at_lun = (uint8_t) aep->at_lun; 584 } |
426 if (IS_2KLOGIN(isp)) { | 585 if (FCPARAM(isp)->isp_2klogin) { |
427 atun._atio2e.at_iid = ((at2e_entry_t *)aep)->at_iid; 428 } else { 429 atun._atio2.at_iid = aep->at_iid; 430 } 431 atun._atio2.at_rxid = aep->at_rxid; 432 atun._atio2.at_status = CT_OK; 433 } else { 434 at_entry_t *aep = arg; --- 25 unchanged lines hidden (view full) --- 460 * NB: inline SCSI sense reporting. As such, we lose this information. XXX. 461 * 462 * For both parallel && fibre channel, we use the feature that does 463 * an automatic resource autoreplenish so we don't have then later do 464 * put of an atio to replenish the f/w's resource count. 465 */ 466 467int | 586 atun._atio2e.at_iid = ((at2e_entry_t *)aep)->at_iid; 587 } else { 588 atun._atio2.at_iid = aep->at_iid; 589 } 590 atun._atio2.at_rxid = aep->at_rxid; 591 atun._atio2.at_status = CT_OK; 592 } else { 593 at_entry_t *aep = arg; --- 25 unchanged lines hidden (view full) --- 619 * NB: inline SCSI sense reporting. As such, we lose this information. XXX. 620 * 621 * For both parallel && fibre channel, we use the feature that does 622 * an automatic resource autoreplenish so we don't have then later do 623 * put of an atio to replenish the f/w's resource count. 624 */ 625 626int |
468isp_endcmd(ispsoftc_t *isp, void *arg, uint32_t code, uint16_t hdl) | 627isp_endcmd(ispsoftc_t *isp, void *arg, uint32_t code, uint32_t hdl) |
469{ 470 int sts; 471 union { 472 ct_entry_t _ctio; 473 ct2_entry_t _ctio2; 474 ct2e_entry_t _ctio2e; | 628{ 629 int sts; 630 union { 631 ct_entry_t _ctio; 632 ct2_entry_t _ctio2; 633 ct2e_entry_t _ctio2e; |
634 ct7_entry_t _ctio7; |
|
475 } un; 476 477 MEMZERO(&un, sizeof un); 478 sts = code & 0xff; 479 | 635 } un; 636 637 MEMZERO(&un, sizeof un); 638 sts = code & 0xff; 639 |
480 if (IS_FC(isp)) { | 640 if (IS_24XX(isp)) { 641 at7_entry_t *aep = arg; 642 ct7_entry_t *cto = &un._ctio7; 643 644 cto->ct_header.rqs_entry_type = RQSTYPE_CTIO7; 645 cto->ct_header.rqs_entry_count = 1; 646/* XXXX */ cto->ct_nphdl = aep->at_hdr.seq_id; 647 cto->ct_rxid = aep->at_rxid; 648 cto->ct_iid_lo = (aep->at_hdr.s_id[1] << 8) | 649 aep->at_hdr.s_id[2]; 650 cto->ct_iid_hi = aep->at_hdr.s_id[0]; 651 cto->ct_oxid = aep->at_hdr.ox_id; 652 cto->ct_scsi_status = sts; 653 cto->ct_flags = CT7_FLAG_MODE1 | CT7_NO_DATA | CT7_SENDSTATUS; 654 if (sts == SCSI_CHECK && (code & ECMD_SVALID)) { 655 cto->rsp.m1.ct_resplen = 16; 656 cto->rsp.m1.ct_resp[0] = 0xf0; 657 cto->rsp.m1.ct_resp[2] = (code >> 12) & 0xf; 658 cto->rsp.m1.ct_resp[7] = 8; 659 cto->rsp.m1.ct_resp[12] = (code >> 24) & 0xff; 660 cto->rsp.m1.ct_resp[13] = (code >> 16) & 0xff; 661 } 662 if (aep->at_cmnd.cdb_dl.sf.fcp_cmnd_dl) { 663 cto->ct_resid = aep->at_cmnd.cdb_dl.sf.fcp_cmnd_dl; 664 cto->ct_scsi_status |= CT2_DATA_UNDER; 665 } 666 cto->ct_syshandle = hdl; 667 } else if (IS_FC(isp)) { |
481 at2_entry_t *aep = arg; 482 ct2_entry_t *cto = &un._ctio2; 483 484 cto->ct_header.rqs_entry_type = RQSTYPE_CTIO2; 485 cto->ct_header.rqs_entry_count = 1; | 668 at2_entry_t *aep = arg; 669 ct2_entry_t *cto = &un._ctio2; 670 671 cto->ct_header.rqs_entry_type = RQSTYPE_CTIO2; 672 cto->ct_header.rqs_entry_count = 1; |
486 if ((FCPARAM(isp)->isp_fwattr & ISP_FW_ATTR_SCCLUN) == 0) { | 673 if (FCPARAM(isp)->isp_sccfw == 0) { |
487 cto->ct_lun = aep->at_lun; 488 } | 674 cto->ct_lun = aep->at_lun; 675 } |
489 if (IS_2KLOGIN(isp)) { | 676 if (FCPARAM(isp)->isp_2klogin) { |
490 un._ctio2e.ct_iid = ((at2e_entry_t *)aep)->at_iid; 491 } else { 492 cto->ct_iid = aep->at_iid; 493 } 494 cto->ct_rxid = aep->at_rxid; 495 cto->rsp.m1.ct_scsi_status = sts; 496 cto->ct_flags = CT2_SENDSTATUS | CT2_NO_DATA | CT2_FLAG_MODE1; 497 if (hdl == 0) { --- 62 unchanged lines hidden (view full) --- 560 case ASYNC_PTPMODE: 561 notify.nt_ncode = NT_LINK_UP; 562 (void) isp_async(isp, ISPASYNC_TARGET_NOTIFY, ¬ify); 563 break; 564 case ASYNC_LOOP_DOWN: 565 notify.nt_ncode = NT_LINK_DOWN; 566 (void) isp_async(isp, ISPASYNC_TARGET_NOTIFY, ¬ify); 567 break; | 677 un._ctio2e.ct_iid = ((at2e_entry_t *)aep)->at_iid; 678 } else { 679 cto->ct_iid = aep->at_iid; 680 } 681 cto->ct_rxid = aep->at_rxid; 682 cto->rsp.m1.ct_scsi_status = sts; 683 cto->ct_flags = CT2_SENDSTATUS | CT2_NO_DATA | CT2_FLAG_MODE1; 684 if (hdl == 0) { --- 62 unchanged lines hidden (view full) --- 747 case ASYNC_PTPMODE: 748 notify.nt_ncode = NT_LINK_UP; 749 (void) isp_async(isp, ISPASYNC_TARGET_NOTIFY, ¬ify); 750 break; 751 case ASYNC_LOOP_DOWN: 752 notify.nt_ncode = NT_LINK_DOWN; 753 (void) isp_async(isp, ISPASYNC_TARGET_NOTIFY, ¬ify); 754 break; |
755 case ASYNC_LIP_ERROR: |
|
568 case ASYNC_LIP_F8: 569 case ASYNC_LIP_OCCURRED: 570 case ASYNC_LOOP_RESET: 571 notify.nt_ncode = NT_LIP_RESET; 572 (void) isp_async(isp, ISPASYNC_TARGET_NOTIFY, ¬ify); 573 break; 574 case ASYNC_BUS_RESET: 575 case ASYNC_TIMEOUT_RESET: /* XXX: where does this come from ? */ 576 notify.nt_ncode = NT_BUS_RESET; 577 (void) isp_async(isp, ISPASYNC_TARGET_NOTIFY, ¬ify); 578 break; 579 case ASYNC_DEVICE_RESET: 580 notify.nt_ncode = NT_TARGET_RESET; 581 (void) isp_async(isp, ISPASYNC_TARGET_NOTIFY, ¬ify); 582 break; 583 case ASYNC_CTIO_DONE: 584 { 585 uint8_t storage[QENTRY_LEN]; 586 memset(storage, 0, QENTRY_LEN); | 756 case ASYNC_LIP_F8: 757 case ASYNC_LIP_OCCURRED: 758 case ASYNC_LOOP_RESET: 759 notify.nt_ncode = NT_LIP_RESET; 760 (void) isp_async(isp, ISPASYNC_TARGET_NOTIFY, ¬ify); 761 break; 762 case ASYNC_BUS_RESET: 763 case ASYNC_TIMEOUT_RESET: /* XXX: where does this come from ? */ 764 notify.nt_ncode = NT_BUS_RESET; 765 (void) isp_async(isp, ISPASYNC_TARGET_NOTIFY, ¬ify); 766 break; 767 case ASYNC_DEVICE_RESET: 768 notify.nt_ncode = NT_TARGET_RESET; 769 (void) isp_async(isp, ISPASYNC_TARGET_NOTIFY, ¬ify); 770 break; 771 case ASYNC_CTIO_DONE: 772 { 773 uint8_t storage[QENTRY_LEN]; 774 memset(storage, 0, QENTRY_LEN); |
587 if (IS_FC(isp)) { | 775 if (IS_24XX(isp)) { 776 ct7_entry_t *ct = (ct7_entry_t *) storage; 777 ct->ct_header.rqs_entry_type = RQSTYPE_CTIO7; 778 ct->ct_nphdl = CT7_OK; 779 ct->ct_syshandle = bus; 780 ct->ct_flags = CT7_SENDSTATUS|CT7_FASTPOST; 781 } else if (IS_FC(isp)) { |
588 /* This should also suffice for 2K login code */ 589 ct2_entry_t *ct = (ct2_entry_t *) storage; 590 ct->ct_header.rqs_entry_type = RQSTYPE_CTIO2; 591 ct->ct_status = CT_OK; 592 ct->ct_syshandle = bus; 593 ct->ct_flags = CT2_SENDSTATUS|CT2_FASTPOST; 594 } else { 595 ct_entry_t *ct = (ct_entry_t *) storage; 596 ct->ct_header.rqs_entry_type = RQSTYPE_CTIO; 597 ct->ct_status = CT_OK; 598 ct->ct_fwhandle = bus; 599 ct->ct_flags = CT_SENDSTATUS; 600 } 601 (void) isp_async(isp, ISPASYNC_TARGET_ACTION, storage); | 782 /* This should also suffice for 2K login code */ 783 ct2_entry_t *ct = (ct2_entry_t *) storage; 784 ct->ct_header.rqs_entry_type = RQSTYPE_CTIO2; 785 ct->ct_status = CT_OK; 786 ct->ct_syshandle = bus; 787 ct->ct_flags = CT2_SENDSTATUS|CT2_FASTPOST; 788 } else { 789 ct_entry_t *ct = (ct_entry_t *) storage; 790 ct->ct_header.rqs_entry_type = RQSTYPE_CTIO; 791 ct->ct_status = CT_OK; 792 ct->ct_fwhandle = bus; 793 ct->ct_flags = CT_SENDSTATUS; 794 } 795 (void) isp_async(isp, ISPASYNC_TARGET_ACTION, storage); |
602 return (0); | 796 break; |
603 } 604 default: 605 isp_prt(isp, ISP_LOGERR, 606 "isp_target_async: unknown event 0x%x", event); 607 if (isp->isp_state == ISP_RUNSTATE) { 608 isp_notify_ack(isp, NULL); 609 } 610 break; --- 63 unchanged lines hidden (view full) --- 674 675/* 676 * Synthesize a message from the task management flags in a FCP_CMND_IU. 677 */ 678static void 679isp_got_msg_fc(ispsoftc_t *isp, in_fcentry_t *inp) 680{ 681 tmd_notify_t nt; | 797 } 798 default: 799 isp_prt(isp, ISP_LOGERR, 800 "isp_target_async: unknown event 0x%x", event); 801 if (isp->isp_state == ISP_RUNSTATE) { 802 isp_notify_ack(isp, NULL); 803 } 804 break; --- 63 unchanged lines hidden (view full) --- 868 869/* 870 * Synthesize a message from the task management flags in a FCP_CMND_IU. 871 */ 872static void 873isp_got_msg_fc(ispsoftc_t *isp, in_fcentry_t *inp) 874{ 875 tmd_notify_t nt; |
682 static const char f1[] = "%s from loop id %d lun %d seq 0x%x"; | 876 static const char f1[] = "%s from N-port handle 0x%x lun %d seq 0x%x"; |
683 static const char f2[] = | 877 static const char f2[] = |
684 "unknown %s 0x%x lun %d loop id %d task flags 0x%x seq 0x%x\n"; | 878 "unknown %s 0x%x lun %d N-Port handle 0x%x task flags 0x%x seq 0x%x\n"; |
685 uint16_t seqid, loopid; 686 687 MEMZERO(&nt, sizeof (tmd_notify_t)); 688 nt.nt_hba = isp; | 879 uint16_t seqid, loopid; 880 881 MEMZERO(&nt, sizeof (tmd_notify_t)); 882 nt.nt_hba = isp; |
689 if (IS_2KLOGIN(isp)) { | 883 if (FCPARAM(isp)->isp_2klogin) { |
690 nt.nt_iid = ((in_fcentry_e_t *)inp)->in_iid; 691 loopid = ((in_fcentry_e_t *)inp)->in_iid; 692 seqid = ((in_fcentry_e_t *)inp)->in_seqid; 693 } else { 694 nt.nt_iid = inp->in_iid; 695 loopid = inp->in_iid; 696 seqid = inp->in_seqid; 697 } 698 /* nt_tgt set in outer layers */ | 884 nt.nt_iid = ((in_fcentry_e_t *)inp)->in_iid; 885 loopid = ((in_fcentry_e_t *)inp)->in_iid; 886 seqid = ((in_fcentry_e_t *)inp)->in_seqid; 887 } else { 888 nt.nt_iid = inp->in_iid; 889 loopid = inp->in_iid; 890 seqid = inp->in_seqid; 891 } 892 /* nt_tgt set in outer layers */ |
699 if (FCPARAM(isp)->isp_fwattr & ISP_FW_ATTR_SCCLUN) { | 893 if (FCPARAM(isp)->isp_sccfw) { |
700 nt.nt_lun = inp->in_scclun; 701 } else { 702 nt.nt_lun = inp->in_lun; 703 } 704 IN_FC_MAKE_TAGID(nt.nt_tagval, 0, seqid); | 894 nt.nt_lun = inp->in_scclun; 895 } else { 896 nt.nt_lun = inp->in_lun; 897 } 898 IN_FC_MAKE_TAGID(nt.nt_tagval, 0, seqid); |
899 nt.nt_need_ack = 1; |
|
705 nt.nt_lreserved = inp; 706 707 if (inp->in_status != IN_MSG_RECEIVED) { 708 isp_prt(isp, ISP_LOGINFO, f2, "immediate notify status", 709 inp->in_status, nt.nt_lun, loopid, inp->in_task_flags, 710 inp->in_seqid); 711 isp_notify_ack(isp, inp); 712 return; --- 23 unchanged lines hidden (view full) --- 736 isp_prt(isp, ISP_LOGWARN, f2, "task flag", inp->in_status, 737 nt.nt_lun, loopid, inp->in_task_flags, inp->in_seqid); 738 isp_notify_ack(isp, inp); 739 return; 740 } 741 (void) isp_async(isp, ISPASYNC_TARGET_NOTIFY, &nt); 742} 743 | 900 nt.nt_lreserved = inp; 901 902 if (inp->in_status != IN_MSG_RECEIVED) { 903 isp_prt(isp, ISP_LOGINFO, f2, "immediate notify status", 904 inp->in_status, nt.nt_lun, loopid, inp->in_task_flags, 905 inp->in_seqid); 906 isp_notify_ack(isp, inp); 907 return; --- 23 unchanged lines hidden (view full) --- 931 isp_prt(isp, ISP_LOGWARN, f2, "task flag", inp->in_status, 932 nt.nt_lun, loopid, inp->in_task_flags, inp->in_seqid); 933 isp_notify_ack(isp, inp); 934 return; 935 } 936 (void) isp_async(isp, ISPASYNC_TARGET_NOTIFY, &nt); 937} 938 |
939static void 940isp_got_tmf_24xx(ispsoftc_t *isp, at7_entry_t *aep) 941{ 942 tmd_notify_t nt; 943 static const char f1[] = "%s from PortID 0x%06x lun %d seq 0x%x"; 944 static const char f2[] = 945 "unknown Task Flag 0x%x lun %d PortID 0x%x tag 0x%x\n"; 946 uint32_t sid; 947 948 MEMZERO(&nt, sizeof (tmd_notify_t)); 949 nt.nt_hba = isp; 950 nt.nt_iid = INI_ANY; 951 nt.nt_lun = 952 (aep->at_cmnd.fcp_cmnd_lun[0] << 8) | 953 (aep->at_cmnd.fcp_cmnd_lun[1]); 954 nt.nt_tagval = aep->at_rxid; 955 nt.nt_lreserved = aep; 956 sid = 957 (aep->at_hdr.s_id[0] << 16) | 958 (aep->at_hdr.s_id[1] << 8) | 959 (aep->at_hdr.s_id[2]); 960 961 if (aep->at_cmnd.fcp_cmnd_task_management & 962 FCP_CMND_TMF_ABORT_TASK_SET) { 963 isp_prt(isp, ISP_LOGINFO, f1, "ABORT TASK SET", 964 sid, nt.nt_lun, nt.nt_tagval); 965 nt.nt_ncode = NT_ABORT_TASK_SET; 966 } else if (aep->at_cmnd.fcp_cmnd_task_management & 967 FCP_CMND_TMF_CLEAR_TASK_SET) { 968 isp_prt(isp, ISP_LOGINFO, f1, "CLEAR TASK SET", 969 sid, nt.nt_lun, nt.nt_tagval); 970 nt.nt_ncode = NT_CLEAR_TASK_SET; 971 } else if (aep->at_cmnd.fcp_cmnd_task_management & 972 FCP_CMND_TMF_LUN_RESET) { 973 isp_prt(isp, ISP_LOGINFO, f1, "LUN RESET", 974 sid, nt.nt_lun, nt.nt_tagval); 975 nt.nt_ncode = NT_LUN_RESET; 976 } else if (aep->at_cmnd.fcp_cmnd_task_management & 977 FCP_CMND_TMF_TGT_RESET) { 978 isp_prt(isp, ISP_LOGINFO, f1, "TARGET RESET", 979 sid, nt.nt_lun, nt.nt_tagval); 980 nt.nt_ncode = NT_TARGET_RESET; 981 nt.nt_lun = LUN_ANY; 982 } else if (aep->at_cmnd.fcp_cmnd_task_management & 983 FCP_CMND_TMF_CLEAR_ACA) { 984 isp_prt(isp, ISP_LOGINFO, f1, "CLEAR ACA", 985 sid, nt.nt_lun, nt.nt_tagval); 986 nt.nt_ncode = NT_CLEAR_ACA; 987 } else { 988 isp_prt(isp, ISP_LOGWARN, f2, 989 aep->at_cmnd.fcp_cmnd_task_management, 990 nt.nt_lun, sid, nt.nt_tagval); 991 isp_endcmd(isp, aep, 0, 0); 992 return; 993 } 994 (void) isp_async(isp, ISPASYNC_TARGET_NOTIFY, &nt); 995} 996 |
|
744void 745isp_notify_ack(ispsoftc_t *isp, void *arg) 746{ 747 char storage[QENTRY_LEN]; | 997void 998isp_notify_ack(ispsoftc_t *isp, void *arg) 999{ 1000 char storage[QENTRY_LEN]; |
748 uint16_t nxti, optr; | 1001 uint32_t nxti, optr; |
749 void *outp; 750 751 if (isp_getrqentry(isp, &nxti, &optr, &outp)) { 752 isp_prt(isp, ISP_LOGWARN, 753 "Request Queue Overflow For isp_notify_ack"); 754 return; 755 } 756 757 MEMZERO(storage, QENTRY_LEN); 758 | 1002 void *outp; 1003 1004 if (isp_getrqentry(isp, &nxti, &optr, &outp)) { 1005 isp_prt(isp, ISP_LOGWARN, 1006 "Request Queue Overflow For isp_notify_ack"); 1007 return; 1008 } 1009 1010 MEMZERO(storage, QENTRY_LEN); 1011 |
759 if (IS_FC(isp)) { | 1012 if (IS_24XX(isp) && arg != NULL && (((isphdr_t *)arg)->rqs_entry_type == RQSTYPE_ATIO)) { 1013 at7_entry_t *aep = arg; 1014 isp_endcmd(isp, aep, 0, 0); 1015 return; 1016 } else if (IS_24XX(isp) && arg != NULL && (((isphdr_t *)arg)->rqs_entry_type == RQSTYPE_ABTS_RSP)) { 1017 abts_rsp_t *abts_rsp = (abts_rsp_t *) storage; 1018 /* 1019 * The caller will have set response values as appropriate 1020 * in the ABTS structure just before calling us. 1021 */ 1022 MEMCPY(abts_rsp, arg, QENTRY_LEN); 1023 isp_put_abts_rsp(isp, abts_rsp, (abts_rsp_t *)outp); 1024 } else if (IS_24XX(isp)) { 1025 na_fcentry_24xx_t *na = (na_fcentry_24xx_t *) storage; 1026 if (arg) { 1027 in_fcentry_24xx_t *in = arg; 1028 na->na_nphdl = in->in_nphdl; 1029 na->na_status = in->in_status; 1030 na->na_status_subcode = in->in_status_subcode; 1031 na->na_rxid = in->in_rxid; 1032 na->na_oxid = in->in_oxid; 1033 if (in->in_status == IN24XX_SRR_RCVD) { 1034 na->na_srr_rxid = in->in_srr_rxid; 1035 na->na_srr_reloff_hi = in->in_srr_reloff_hi; 1036 na->na_srr_reloff_lo = in->in_srr_reloff_lo; 1037 na->na_srr_iu = in->in_srr_iu; 1038 na->na_srr_flags = 1; 1039 na->na_srr_reject_vunique = 0; 1040 na->na_srr_reject_explanation = 1; 1041 na->na_srr_reject_code = 1; 1042 } 1043 } 1044 na->na_header.rqs_entry_type = RQSTYPE_NOTIFY_ACK; 1045 na->na_header.rqs_entry_count = 1; 1046 isp_put_notify_24xx_ack(isp, na, (na_fcentry_24xx_t *)outp); 1047 } else if (IS_FC(isp)) { |
760 na_fcentry_t *na = (na_fcentry_t *) storage; 761 int iid = 0; 762 763 if (arg) { 764 in_fcentry_t *inp = arg; 765 MEMCPY(storage, arg, sizeof (isphdr_t)); | 1048 na_fcentry_t *na = (na_fcentry_t *) storage; 1049 int iid = 0; 1050 1051 if (arg) { 1052 in_fcentry_t *inp = arg; 1053 MEMCPY(storage, arg, sizeof (isphdr_t)); |
766 if (IS_2KLOGIN(isp)) { | 1054 if (FCPARAM(isp)->isp_2klogin) { |
767 ((na_fcentry_e_t *)na)->na_iid = 768 ((in_fcentry_e_t *)inp)->in_iid; 769 iid = ((na_fcentry_e_t *)na)->na_iid; 770 } else { 771 na->na_iid = inp->in_iid; 772 iid = na->na_iid; 773 } 774 na->na_task_flags = --- 8 unchanged lines hidden (view full) --- 783 na->na_flags |= NAFC_TVALID; 784 na->na_response = 0; /* XXX SUCCEEDED XXX */ 785 } 786 } else { 787 na->na_flags = NAFC_RST_CLRD; 788 } 789 na->na_header.rqs_entry_type = RQSTYPE_NOTIFY_ACK; 790 na->na_header.rqs_entry_count = 1; | 1055 ((na_fcentry_e_t *)na)->na_iid = 1056 ((in_fcentry_e_t *)inp)->in_iid; 1057 iid = ((na_fcentry_e_t *)na)->na_iid; 1058 } else { 1059 na->na_iid = inp->in_iid; 1060 iid = na->na_iid; 1061 } 1062 na->na_task_flags = --- 8 unchanged lines hidden (view full) --- 1071 na->na_flags |= NAFC_TVALID; 1072 na->na_response = 0; /* XXX SUCCEEDED XXX */ 1073 } 1074 } else { 1075 na->na_flags = NAFC_RST_CLRD; 1076 } 1077 na->na_header.rqs_entry_type = RQSTYPE_NOTIFY_ACK; 1078 na->na_header.rqs_entry_count = 1; |
791 if (IS_2KLOGIN(isp)) { | 1079 if (FCPARAM(isp)->isp_2klogin) { |
792 isp_put_notify_ack_fc_e(isp, (na_fcentry_e_t *) na, 793 (na_fcentry_e_t *)outp); 794 } else { 795 isp_put_notify_ack_fc(isp, na, (na_fcentry_t *)outp); 796 } | 1080 isp_put_notify_ack_fc_e(isp, (na_fcentry_e_t *) na, 1081 (na_fcentry_e_t *)outp); 1082 } else { 1083 isp_put_notify_ack_fc(isp, na, (na_fcentry_t *)outp); 1084 } |
797 isp_prt(isp, ISP_LOGTDEBUG0, "notify ack iid %u seqid %x flags " 798 "%x tflags %x response %x", iid, na->na_seqid, | 1085 isp_prt(isp, ISP_LOGTDEBUG0, "notify ack loopid %u seqid %x " 1086 "flags %x tflags %x response %x", iid, na->na_seqid, |
799 na->na_flags, na->na_task_flags, na->na_response); 800 } else { 801 na_entry_t *na = (na_entry_t *) storage; 802 if (arg) { 803 in_entry_t *inp = arg; 804 MEMCPY(storage, arg, sizeof (isphdr_t)); 805 na->na_iid = inp->in_iid; 806 na->na_lun = inp->in_lun; 807 na->na_tgt = inp->in_tgt; 808 na->na_seqid = inp->in_seqid; 809 if (inp->in_status == IN_RESET) { 810 na->na_event = NA_RST_CLRD; 811 } 812 } else { 813 na->na_event = NA_RST_CLRD; 814 } 815 na->na_header.rqs_entry_type = RQSTYPE_NOTIFY_ACK; 816 na->na_header.rqs_entry_count = 1; 817 isp_put_notify_ack(isp, na, (na_entry_t *)outp); | 1087 na->na_flags, na->na_task_flags, na->na_response); 1088 } else { 1089 na_entry_t *na = (na_entry_t *) storage; 1090 if (arg) { 1091 in_entry_t *inp = arg; 1092 MEMCPY(storage, arg, sizeof (isphdr_t)); 1093 na->na_iid = inp->in_iid; 1094 na->na_lun = inp->in_lun; 1095 na->na_tgt = inp->in_tgt; 1096 na->na_seqid = inp->in_seqid; 1097 if (inp->in_status == IN_RESET) { 1098 na->na_event = NA_RST_CLRD; 1099 } 1100 } else { 1101 na->na_event = NA_RST_CLRD; 1102 } 1103 na->na_header.rqs_entry_type = RQSTYPE_NOTIFY_ACK; 1104 na->na_header.rqs_entry_count = 1; 1105 isp_put_notify_ack(isp, na, (na_entry_t *)outp); |
818 isp_prt(isp, ISP_LOGTDEBUG0, "notify ack iid %u lun %u tgt %u " 819 "seqid %x event %x", na->na_iid, na->na_lun, na->na_tgt, | 1106 isp_prt(isp, ISP_LOGTDEBUG0, "notify ack loopid %u lun %u tgt " 1107 "%u seqid %x event %x", na->na_iid, na->na_lun, na->na_tgt, |
820 na->na_seqid, na->na_event); 821 } 822 ISP_TDQE(isp, "isp_notify_ack", (int) optr, storage); 823 ISP_ADD_REQUEST(isp, nxti); 824} 825 826static void 827isp_handle_atio(ispsoftc_t *isp, at_entry_t *aep) --- 64 unchanged lines hidden (view full) --- 892 */ 893 isp_prt(isp, ISP_LOGWARN, atior, lun, 894 GET_IID_VAL(aep->at_iid), GET_BUS_VAL(aep->at_iid)); 895 break; 896 897 898 default: 899 isp_prt(isp, ISP_LOGERR, | 1108 na->na_seqid, na->na_event); 1109 } 1110 ISP_TDQE(isp, "isp_notify_ack", (int) optr, storage); 1111 ISP_ADD_REQUEST(isp, nxti); 1112} 1113 1114static void 1115isp_handle_atio(ispsoftc_t *isp, at_entry_t *aep) --- 64 unchanged lines hidden (view full) --- 1180 */ 1181 isp_prt(isp, ISP_LOGWARN, atior, lun, 1182 GET_IID_VAL(aep->at_iid), GET_BUS_VAL(aep->at_iid)); 1183 break; 1184 1185 1186 default: 1187 isp_prt(isp, ISP_LOGERR, |
900 "Unknown ATIO status 0x%x from initiator %d for lun %d", | 1188 "Unknown ATIO status 0x%x from loopid %d for lun %d", |
901 aep->at_status, aep->at_iid, lun); 902 (void) isp_target_put_atio(isp, aep); 903 break; 904 } 905} 906 907static void 908isp_handle_atio2(ispsoftc_t *isp, at2_entry_t *aep) 909{ 910 int lun, iid; 911 | 1189 aep->at_status, aep->at_iid, lun); 1190 (void) isp_target_put_atio(isp, aep); 1191 break; 1192 } 1193} 1194 1195static void 1196isp_handle_atio2(ispsoftc_t *isp, at2_entry_t *aep) 1197{ 1198 int lun, iid; 1199 |
912 if (FCPARAM(isp)->isp_fwattr & ISP_FW_ATTR_SCCLUN) { | 1200 if (FCPARAM(isp)->isp_sccfw) { |
913 lun = aep->at_scclun; 914 } else { 915 lun = aep->at_lun; 916 } 917 | 1201 lun = aep->at_scclun; 1202 } else { 1203 lun = aep->at_lun; 1204 } 1205 |
918 if (IS_2KLOGIN(isp)) { | 1206 if (FCPARAM(isp)->isp_2klogin) { |
919 iid = ((at2e_entry_t *)aep)->at_iid; 920 } else { 921 iid = aep->at_iid; 922 } 923 924 /* 925 * The firmware status (except for the QLTM_SVALID bit) indicates 926 * why this ATIO was sent to us. --- 54 unchanged lines hidden (view full) --- 981 * up for us. 982 */ 983 isp_prt(isp, ISP_LOGERR, atior, lun, iid, 0); 984 break; 985 986 987 default: 988 isp_prt(isp, ISP_LOGERR, | 1207 iid = ((at2e_entry_t *)aep)->at_iid; 1208 } else { 1209 iid = aep->at_iid; 1210 } 1211 1212 /* 1213 * The firmware status (except for the QLTM_SVALID bit) indicates 1214 * why this ATIO was sent to us. --- 54 unchanged lines hidden (view full) --- 1269 * up for us. 1270 */ 1271 isp_prt(isp, ISP_LOGERR, atior, lun, iid, 0); 1272 break; 1273 1274 1275 default: 1276 isp_prt(isp, ISP_LOGERR, |
989 "Unknown ATIO2 status 0x%x from initiator %d for lun %d", | 1277 "Unknown ATIO2 status 0x%x from loopid %d for lun %d", |
990 aep->at_status, iid, lun); 991 (void) isp_target_put_atio(isp, aep); 992 break; 993 } 994} 995 996static void 997isp_handle_ctio(ispsoftc_t *isp, ct_entry_t *ct) 998{ 999 void *xs; 1000 int pl = ISP_LOGTDEBUG2; 1001 char *fmsg = NULL; 1002 1003 if (ct->ct_syshandle) { 1004 xs = isp_find_xs_tgt(isp, ct->ct_syshandle); | 1278 aep->at_status, iid, lun); 1279 (void) isp_target_put_atio(isp, aep); 1280 break; 1281 } 1282} 1283 1284static void 1285isp_handle_ctio(ispsoftc_t *isp, ct_entry_t *ct) 1286{ 1287 void *xs; 1288 int pl = ISP_LOGTDEBUG2; 1289 char *fmsg = NULL; 1290 1291 if (ct->ct_syshandle) { 1292 xs = isp_find_xs_tgt(isp, ct->ct_syshandle); |
1005 if (xs == NULL) | 1293 if (xs == NULL) { |
1006 pl = ISP_LOGALL; | 1294 pl = ISP_LOGALL; |
1295 } |
|
1007 } else { 1008 xs = NULL; 1009 } 1010 1011 switch(ct->ct_status & ~QLTM_SVALID) { 1012 case CT_OK: 1013 /* 1014 * There are generally 3 possibilities as to why we'd get --- 35 unchanged lines hidden (view full) --- 1050 /* 1051 * When an Abort message is received the firmware goes to 1052 * Bus Free and returns all outstanding CTIOs with the status 1053 * set, then sends us an Immediate Notify entry. 1054 */ 1055 if (fmsg == NULL) 1056 fmsg = "ABORT TAG message sent by Initiator"; 1057 | 1296 } else { 1297 xs = NULL; 1298 } 1299 1300 switch(ct->ct_status & ~QLTM_SVALID) { 1301 case CT_OK: 1302 /* 1303 * There are generally 3 possibilities as to why we'd get --- 35 unchanged lines hidden (view full) --- 1339 /* 1340 * When an Abort message is received the firmware goes to 1341 * Bus Free and returns all outstanding CTIOs with the status 1342 * set, then sends us an Immediate Notify entry. 1343 */ 1344 if (fmsg == NULL) 1345 fmsg = "ABORT TAG message sent by Initiator"; 1346 |
1058 isp_prt(isp, ISP_LOGWARN, "CTIO destroyed by %s", fmsg); | 1347 isp_prt(isp, ISP_LOGTDEBUG0, "CTIO destroyed by %s", fmsg); |
1059 break; 1060 1061 case CT_INVAL: 1062 /* 1063 * CTIO rejected by the firmware due to disabled lun. 1064 * "Cannot Happen". 1065 */ 1066 isp_prt(isp, ISP_LOGERR, --- 84 unchanged lines hidden (view full) --- 1151 */ 1152 (void) isp_async(isp, ISPASYNC_TARGET_ACTION, ct); 1153 } 1154} 1155 1156static void 1157isp_handle_ctio2(ispsoftc_t *isp, ct2_entry_t *ct) 1158{ | 1348 break; 1349 1350 case CT_INVAL: 1351 /* 1352 * CTIO rejected by the firmware due to disabled lun. 1353 * "Cannot Happen". 1354 */ 1355 isp_prt(isp, ISP_LOGERR, --- 84 unchanged lines hidden (view full) --- 1440 */ 1441 (void) isp_async(isp, ISPASYNC_TARGET_ACTION, ct); 1442 } 1443} 1444 1445static void 1446isp_handle_ctio2(ispsoftc_t *isp, ct2_entry_t *ct) 1447{ |
1159 XS_T *xs; | 1448 void *xs; |
1160 int pl = ISP_LOGTDEBUG2; 1161 char *fmsg = NULL; 1162 1163 if (ct->ct_syshandle) { 1164 xs = isp_find_xs_tgt(isp, ct->ct_syshandle); | 1449 int pl = ISP_LOGTDEBUG2; 1450 char *fmsg = NULL; 1451 1452 if (ct->ct_syshandle) { 1453 xs = isp_find_xs_tgt(isp, ct->ct_syshandle); |
1165 if (xs == NULL) | 1454 if (xs == NULL) { |
1166 pl = ISP_LOGALL; | 1455 pl = ISP_LOGALL; |
1456 } |
|
1167 } else { 1168 xs = NULL; 1169 } 1170 1171 switch(ct->ct_status & ~QLTM_SVALID) { 1172 case CT_BUS_ERROR: 1173 isp_prt(isp, ISP_LOGERR, "PCI DMA Bus Error"); 1174 /* FALL Through */ --- 13 unchanged lines hidden (view full) --- 1188 /* 1189 * Target Reset function received. 1190 * 1191 * The firmware generates an async mailbox interupt to 1192 * notify us of this and returns outstanding CTIOs with this 1193 * status. These CTIOs are handled in that same way as 1194 * CT_ABORTED ones, so just fall through here. 1195 */ | 1457 } else { 1458 xs = NULL; 1459 } 1460 1461 switch(ct->ct_status & ~QLTM_SVALID) { 1462 case CT_BUS_ERROR: 1463 isp_prt(isp, ISP_LOGERR, "PCI DMA Bus Error"); 1464 /* FALL Through */ --- 13 unchanged lines hidden (view full) --- 1478 /* 1479 * Target Reset function received. 1480 * 1481 * The firmware generates an async mailbox interupt to 1482 * notify us of this and returns outstanding CTIOs with this 1483 * status. These CTIOs are handled in that same way as 1484 * CT_ABORTED ones, so just fall through here. 1485 */ |
1196 fmsg = "TARGET RESET Task Management Function Received"; | 1486 fmsg = "TARGET RESET"; |
1197 /*FALLTHROUGH*/ 1198 case CT_RESET: 1199 if (fmsg == NULL) 1200 fmsg = "LIP Reset"; 1201 /*FALLTHROUGH*/ 1202 case CT_ABORTED: 1203 /* 1204 * When an Abort message is received the firmware goes to 1205 * Bus Free and returns all outstanding CTIOs with the status 1206 * set, then sends us an Immediate Notify entry. 1207 */ | 1487 /*FALLTHROUGH*/ 1488 case CT_RESET: 1489 if (fmsg == NULL) 1490 fmsg = "LIP Reset"; 1491 /*FALLTHROUGH*/ 1492 case CT_ABORTED: 1493 /* 1494 * When an Abort message is received the firmware goes to 1495 * Bus Free and returns all outstanding CTIOs with the status 1496 * set, then sends us an Immediate Notify entry. 1497 */ |
1208 if (fmsg == NULL) 1209 fmsg = "ABORT Task Management Function Received"; | 1498 if (fmsg == NULL) { 1499 fmsg = "ABORT"; 1500 } |
1210 | 1501 |
1211 isp_prt(isp, ISP_LOGERR, "CTIO2 destroyed by %s: RX_ID=0x%x", 1212 fmsg, ct->ct_rxid); | 1502 isp_prt(isp, ISP_LOGTDEBUG0, 1503 "CTIO2 destroyed by %s: RX_ID=0x%x", fmsg, ct->ct_rxid); |
1213 break; 1214 1215 case CT_INVAL: 1216 /* 1217 * CTIO rejected by the firmware - invalid data direction. 1218 */ 1219 isp_prt(isp, ISP_LOGERR, "CTIO2 had wrong data direction"); 1220 break; --- 9 unchanged lines hidden (view full) --- 1230 1231 case CT_ERR: 1232 fmsg = "Completed with Error"; 1233 /*FALLTHROUGH*/ 1234 case CT_LOGOUT: 1235 if (fmsg == NULL) 1236 fmsg = "Port Logout"; 1237 /*FALLTHROUGH*/ | 1504 break; 1505 1506 case CT_INVAL: 1507 /* 1508 * CTIO rejected by the firmware - invalid data direction. 1509 */ 1510 isp_prt(isp, ISP_LOGERR, "CTIO2 had wrong data direction"); 1511 break; --- 9 unchanged lines hidden (view full) --- 1521 1522 case CT_ERR: 1523 fmsg = "Completed with Error"; 1524 /*FALLTHROUGH*/ 1525 case CT_LOGOUT: 1526 if (fmsg == NULL) 1527 fmsg = "Port Logout"; 1528 /*FALLTHROUGH*/ |
1238 case CT_PORTNOTAVAIL: | 1529 case CT_PORTUNAVAIL: |
1239 if (fmsg == NULL) 1240 fmsg = "Port not available"; 1241 /*FALLTHROUGH*/ 1242 case CT_PORTCHANGED: 1243 if (fmsg == NULL) 1244 fmsg = "Port Changed"; 1245 /*FALLTHROUGH*/ 1246 case CT_NOACK: 1247 if (fmsg == NULL) 1248 fmsg = "unacknowledged Immediate Notify pending"; | 1530 if (fmsg == NULL) 1531 fmsg = "Port not available"; 1532 /*FALLTHROUGH*/ 1533 case CT_PORTCHANGED: 1534 if (fmsg == NULL) 1535 fmsg = "Port Changed"; 1536 /*FALLTHROUGH*/ 1537 case CT_NOACK: 1538 if (fmsg == NULL) 1539 fmsg = "unacknowledged Immediate Notify pending"; |
1249 isp_prt(isp, ISP_LOGERR, "CTIO returned by f/w- %s", fmsg); | 1540 isp_prt(isp, ISP_LOGWARN, "CTIO returned by f/w- %s", fmsg); |
1250 break; 1251 1252 case CT_INVRXID: 1253 /* 1254 * CTIO rejected by the firmware because an invalid RX_ID. 1255 * Just print a message. 1256 */ | 1541 break; 1542 1543 case CT_INVRXID: 1544 /* 1545 * CTIO rejected by the firmware because an invalid RX_ID. 1546 * Just print a message. 1547 */ |
1257 isp_prt(isp, ISP_LOGERR, | 1548 isp_prt(isp, ISP_LOGWARN, |
1258 "CTIO2 completed with Invalid RX_ID 0x%x", ct->ct_rxid); 1259 break; 1260 1261 default: 1262 isp_prt(isp, ISP_LOGERR, "Unknown CTIO2 status 0x%x", 1263 ct->ct_status & ~QLTM_SVALID); 1264 break; 1265 } --- 41 unchanged lines hidden (view full) --- 1307 isp_prt(isp, pl, "data CTIO complete"); 1308 } 1309 (void) isp_async(isp, ISPASYNC_TARGET_ACTION, ct); 1310 /* 1311 * The platform layer will destroy the handle if appropriate. 1312 */ 1313 } 1314} | 1549 "CTIO2 completed with Invalid RX_ID 0x%x", ct->ct_rxid); 1550 break; 1551 1552 default: 1553 isp_prt(isp, ISP_LOGERR, "Unknown CTIO2 status 0x%x", 1554 ct->ct_status & ~QLTM_SVALID); 1555 break; 1556 } --- 41 unchanged lines hidden (view full) --- 1598 isp_prt(isp, pl, "data CTIO complete"); 1599 } 1600 (void) isp_async(isp, ISPASYNC_TARGET_ACTION, ct); 1601 /* 1602 * The platform layer will destroy the handle if appropriate. 1603 */ 1604 } 1605} |
1606 1607static void 1608isp_handle_ctio7(ispsoftc_t *isp, ct7_entry_t *ct) 1609{ 1610 void *xs; 1611 int pl = ISP_LOGTDEBUG2; 1612 char *fmsg = NULL; 1613 1614 if (ct->ct_syshandle) { 1615 xs = isp_find_xs_tgt(isp, ct->ct_syshandle); 1616 if (xs == NULL) { 1617 pl = ISP_LOGALL; 1618 } 1619 } else { 1620 xs = NULL; 1621 } 1622 1623 switch(ct->ct_nphdl) { 1624 case CT7_BUS_ERROR: 1625 isp_prt(isp, ISP_LOGERR, "PCI DMA Bus Error"); 1626 /* FALL Through */ 1627 case CT7_DATA_OVER: 1628 case CT7_DATA_UNDER: 1629 case CT7_OK: 1630 /* 1631 * There are generally 2 possibilities as to why we'd get 1632 * this condition: 1633 * We sent or received data. 1634 * We sent status & command complete. 1635 */ 1636 1637 break; 1638 1639 case CT7_RESET: 1640 if (fmsg == NULL) { 1641 fmsg = "LIP Reset"; 1642 } 1643 /*FALLTHROUGH*/ 1644 case CT7_ABORTED: 1645 /* 1646 * When an Abort message is received the firmware goes to 1647 * Bus Free and returns all outstanding CTIOs with the status 1648 * set, then sends us an Immediate Notify entry. 1649 */ 1650 if (fmsg == NULL) { 1651 fmsg = "ABORT"; 1652 } 1653 isp_prt(isp, ISP_LOGTDEBUG0, 1654 "CTIO7 destroyed by %s: RX_ID=0x%x", fmsg, ct->ct_rxid); 1655 break; 1656 1657 case CT7_TIMEOUT: 1658 if (fmsg == NULL) { 1659 fmsg = "command"; 1660 } 1661 isp_prt(isp, ISP_LOGERR, "Firmware timed out on %s", fmsg); 1662 break; 1663 1664 case CT7_ERR: 1665 fmsg = "Completed with Error"; 1666 /*FALLTHROUGH*/ 1667 case CT7_LOGOUT: 1668 if (fmsg == NULL) { 1669 fmsg = "Port Logout"; 1670 } 1671 /*FALLTHROUGH*/ 1672 case CT7_PORTUNAVAIL: 1673 if (fmsg == NULL) { 1674 fmsg = "Port not available"; 1675 } 1676 /*FALLTHROUGH*/ 1677 case CT7_PORTCHANGED: 1678 if (fmsg == NULL) { 1679 fmsg = "Port Changed"; 1680 } 1681 isp_prt(isp, ISP_LOGWARN, "CTIO returned by f/w- %s", fmsg); 1682 break; 1683 1684 case CT7_INVRXID: 1685 /* 1686 * CTIO rejected by the firmware because an invalid RX_ID. 1687 * Just print a message. 1688 */ 1689 isp_prt(isp, ISP_LOGWARN, 1690 "CTIO7 completed with Invalid RX_ID 0x%x", ct->ct_rxid); 1691 break; 1692 1693 case CT7_REASSY_ERR: 1694 isp_prt(isp, ISP_LOGWARN, "reassembly error"); 1695 break; 1696 1697 case CT7_SRR: 1698 isp_prt(isp, ISP_LOGWARN, "SRR received"); 1699 break; 1700 1701 default: 1702 isp_prt(isp, ISP_LOGERR, "Unknown CTIO7 status 0x%x", 1703 ct->ct_nphdl); 1704 break; 1705 } 1706 1707 if (xs == NULL) { 1708 /* 1709 * There may be more than one CTIO for a data transfer, 1710 * or this may be a status CTIO we're not monitoring. 1711 * 1712 * The assumption is that they'll all be returned in the 1713 * order we got them. 1714 */ 1715 if (ct->ct_syshandle == 0) { 1716 if (ct->ct_flags & CT7_TERMINATE) { 1717 isp_prt(isp, ISP_LOGINFO, 1718 "termination of 0x%x complete", 1719 ct->ct_rxid); 1720 } else if ((ct->ct_flags & CT7_SENDSTATUS) == 0) { 1721 isp_prt(isp, pl, 1722 "intermediate CTIO completed ok"); 1723 } else { 1724 isp_prt(isp, pl, 1725 "unmonitored CTIO completed ok"); 1726 } 1727 } else { 1728 isp_prt(isp, pl, 1729 "NO xs for CTIO (handle 0x%x) status 0x%x", 1730 ct->ct_syshandle, ct->ct_nphdl); 1731 } 1732 } else { 1733 if ((ct->ct_flags & CT2_DATAMASK) != CT2_NO_DATA) { 1734 ISP_DMAFREE(isp, xs, ct->ct_syshandle); 1735 } 1736 if (ct->ct_flags & CT2_SENDSTATUS) { 1737 /* 1738 * Sent status and command complete. 1739 * 1740 * We're now really done with this command, so we 1741 * punt to the platform dependent layers because 1742 * only there can we do the appropriate command 1743 * complete thread synchronization. 1744 */ 1745 isp_prt(isp, pl, "status CTIO complete"); 1746 } else { 1747 /* 1748 * Final CTIO completed. Release DMA resources and 1749 * notify platform dependent layers. 1750 */ 1751 isp_prt(isp, pl, "data CTIO complete"); 1752 } 1753 (void) isp_async(isp, ISPASYNC_TARGET_ACTION, ct); 1754 /* 1755 * The platform layer will destroy the handle if appropriate. 1756 */ 1757 } 1758} |
|
1315#endif | 1759#endif |