isp.c (285146) | isp.c (285154) |
---|---|
1/*- 2 * Copyright (c) 1997-2009 by Matthew Jacob 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * --- 33 unchanged lines hidden (view full) --- 42 */ 43#ifdef __NetBSD__ 44#include <sys/cdefs.h> 45__KERNEL_RCSID(0, "$NetBSD$"); 46#include <dev/ic/isp_netbsd.h> 47#endif 48#ifdef __FreeBSD__ 49#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1997-2009 by Matthew Jacob 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * --- 33 unchanged lines hidden (view full) --- 42 */ 43#ifdef __NetBSD__ 44#include <sys/cdefs.h> 45__KERNEL_RCSID(0, "$NetBSD$"); 46#include <dev/ic/isp_netbsd.h> 47#endif 48#ifdef __FreeBSD__ 49#include <sys/cdefs.h> |
50__FBSDID("$FreeBSD: head/sys/dev/isp/isp.c 285146 2015-07-04 18:38:46Z mav $"); | 50__FBSDID("$FreeBSD: head/sys/dev/isp/isp.c 285154 2015-07-05 02:09:46Z mav $"); |
51#include <dev/isp/isp_freebsd.h> 52#endif 53#ifdef __OpenBSD__ 54#include <dev/ic/isp_openbsd.h> 55#endif 56#ifdef __linux__ 57#include "isp_linux.h" 58#endif --- 2169 unchanged lines hidden (view full) --- 2228 fcparam *fcp = FCPARAM(isp, chan); 2229 fcportdb_t *lp; 2230 int i; 2231 2232 for (i = 0; i < MAX_FC_TARG; i++) { 2233 lp = &fcp->portdb[i]; 2234 if (lp->state == FC_PORTDB_STATE_NIL || lp->target_mode) 2235 continue; | 51#include <dev/isp/isp_freebsd.h> 52#endif 53#ifdef __OpenBSD__ 54#include <dev/ic/isp_openbsd.h> 55#endif 56#ifdef __linux__ 57#include "isp_linux.h" 58#endif --- 2169 unchanged lines hidden (view full) --- 2228 fcparam *fcp = FCPARAM(isp, chan); 2229 fcportdb_t *lp; 2230 int i; 2231 2232 for (i = 0; i < MAX_FC_TARG; i++) { 2233 lp = &fcp->portdb[i]; 2234 if (lp->state == FC_PORTDB_STATE_NIL || lp->target_mode) 2235 continue; |
2236 /* 2237 * It's up to the outer layers to clear isp_dev_map. 2238 */ | |
2239 lp->state = FC_PORTDB_STATE_NIL; 2240 isp_async(isp, ISPASYNC_DEV_GONE, chan, lp, 1); 2241 if (lp->autologin == 0) { 2242 (void) isp_plogx(isp, chan, lp->handle, 2243 lp->portid, 2244 PLOGX_FLG_CMD_LOGO | 2245 PLOGX_FLG_IMPLICIT | 2246 PLOGX_FLG_FREE_NPHDL, 0); --- 755 unchanged lines hidden (view full) --- 3002 dbidx); 3003 } 3004 continue; 3005 } 3006 3007 switch (lp->state) { 3008 case FC_PORTDB_STATE_PROBATIONAL: 3009 case FC_PORTDB_STATE_DEAD: | 2236 lp->state = FC_PORTDB_STATE_NIL; 2237 isp_async(isp, ISPASYNC_DEV_GONE, chan, lp, 1); 2238 if (lp->autologin == 0) { 2239 (void) isp_plogx(isp, chan, lp->handle, 2240 lp->portid, 2241 PLOGX_FLG_CMD_LOGO | 2242 PLOGX_FLG_IMPLICIT | 2243 PLOGX_FLG_FREE_NPHDL, 0); --- 755 unchanged lines hidden (view full) --- 2999 dbidx); 3000 } 3001 continue; 3002 } 3003 3004 switch (lp->state) { 3005 case FC_PORTDB_STATE_PROBATIONAL: 3006 case FC_PORTDB_STATE_DEAD: |
3010 /* 3011 * It's up to the outer layers to clear isp_dev_map. 3012 */ | |
3013 lp->state = FC_PORTDB_STATE_NIL; 3014 isp_async(isp, ISPASYNC_DEV_GONE, chan, lp, 0); 3015 if (lp->autologin == 0) { 3016 (void) isp_plogx(isp, chan, lp->handle, 3017 lp->portid, 3018 PLOGX_FLG_CMD_LOGO | 3019 PLOGX_FLG_IMPLICIT | 3020 PLOGX_FLG_FREE_NPHDL, 0); 3021 } else { 3022 lp->autologin = 0; 3023 } 3024 lp->new_prli_word3 = 0; 3025 lp->new_portid = 0; 3026 /* 3027 * Note that we might come out of this with our state 3028 * set to FC_PORTDB_STATE_ZOMBIE. 3029 */ 3030 break; 3031 case FC_PORTDB_STATE_NEW: | 3007 lp->state = FC_PORTDB_STATE_NIL; 3008 isp_async(isp, ISPASYNC_DEV_GONE, chan, lp, 0); 3009 if (lp->autologin == 0) { 3010 (void) isp_plogx(isp, chan, lp->handle, 3011 lp->portid, 3012 PLOGX_FLG_CMD_LOGO | 3013 PLOGX_FLG_IMPLICIT | 3014 PLOGX_FLG_FREE_NPHDL, 0); 3015 } else { 3016 lp->autologin = 0; 3017 } 3018 lp->new_prli_word3 = 0; 3019 lp->new_portid = 0; 3020 /* 3021 * Note that we might come out of this with our state 3022 * set to FC_PORTDB_STATE_ZOMBIE. 3023 */ 3024 break; 3025 case FC_PORTDB_STATE_NEW: |
3032 /* 3033 * It's up to the outer layers to assign a virtual 3034 * target id in isp_dev_map (if any). 3035 */ | |
3036 lp->portid = lp->new_portid; 3037 lp->prli_word3 = lp->new_prli_word3; 3038 lp->state = FC_PORTDB_STATE_VALID; 3039 isp_async(isp, ISPASYNC_DEV_ARRIVED, chan, lp); 3040 lp->new_prli_word3 = 0; 3041 lp->new_portid = 0; 3042 lp->announced = 0; 3043 break; --- 5 unchanged lines hidden (view full) --- 3049 isp_async(isp, ISPASYNC_DEV_CHANGED, chan, lp); 3050 lp->new_prli_word3 = 0; 3051 lp->new_portid = 0; 3052 lp->announced = 0; 3053 break; 3054 case FC_PORTDB_STATE_PENDING_VALID: 3055 lp->portid = lp->new_portid; 3056 lp->prli_word3 = lp->new_prli_word3; | 3026 lp->portid = lp->new_portid; 3027 lp->prli_word3 = lp->new_prli_word3; 3028 lp->state = FC_PORTDB_STATE_VALID; 3029 isp_async(isp, ISPASYNC_DEV_ARRIVED, chan, lp); 3030 lp->new_prli_word3 = 0; 3031 lp->new_portid = 0; 3032 lp->announced = 0; 3033 break; --- 5 unchanged lines hidden (view full) --- 3039 isp_async(isp, ISPASYNC_DEV_CHANGED, chan, lp); 3040 lp->new_prli_word3 = 0; 3041 lp->new_portid = 0; 3042 lp->announced = 0; 3043 break; 3044 case FC_PORTDB_STATE_PENDING_VALID: 3045 lp->portid = lp->new_portid; 3046 lp->prli_word3 = lp->new_prli_word3; |
3057 if (lp->dev_map_idx) { 3058 int t = lp->dev_map_idx - 1; 3059 fcp->isp_dev_map[t] = dbidx + 1; 3060 } | |
3061 lp->state = FC_PORTDB_STATE_VALID; 3062 isp_async(isp, ISPASYNC_DEV_STAYED, chan, lp); 3063 if (dbidx != FL_ID) { 3064 lp->new_prli_word3 = 0; 3065 lp->new_portid = 0; 3066 } 3067 lp->announced = 0; 3068 break; --- 1280 unchanged lines hidden (view full) --- 4349isp_start(XS_T *xs) 4350{ 4351 ispsoftc_t *isp; 4352 uint32_t handle, cdblen; 4353 uint8_t local[QENTRY_LEN]; 4354 ispreq_t *reqp; 4355 void *cdbp, *qep; 4356 uint16_t *tptr; | 3047 lp->state = FC_PORTDB_STATE_VALID; 3048 isp_async(isp, ISPASYNC_DEV_STAYED, chan, lp); 3049 if (dbidx != FL_ID) { 3050 lp->new_prli_word3 = 0; 3051 lp->new_portid = 0; 3052 } 3053 lp->announced = 0; 3054 break; --- 1280 unchanged lines hidden (view full) --- 4335isp_start(XS_T *xs) 4336{ 4337 ispsoftc_t *isp; 4338 uint32_t handle, cdblen; 4339 uint8_t local[QENTRY_LEN]; 4340 ispreq_t *reqp; 4341 void *cdbp, *qep; 4342 uint16_t *tptr; |
4357 int target, dmaresult, hdlidx = 0; | 4343 fcportdb_t *lp; 4344 int target, dmaresult; |
4358 4359 XS_INITERR(xs); 4360 isp = XS_ISP(xs); 4361 4362 /* 4363 * Now make sure we're running. 4364 */ 4365 --- 32 unchanged lines hidden (view full) --- 4398 4399 /* 4400 * Try again later. 4401 */ 4402 if (fcp->isp_fwstate != FW_READY || fcp->isp_loopstate != LOOP_READY) { 4403 return (CMD_RQLATER); 4404 } 4405 | 4345 4346 XS_INITERR(xs); 4347 isp = XS_ISP(xs); 4348 4349 /* 4350 * Now make sure we're running. 4351 */ 4352 --- 32 unchanged lines hidden (view full) --- 4385 4386 /* 4387 * Try again later. 4388 */ 4389 if (fcp->isp_fwstate != FW_READY || fcp->isp_loopstate != LOOP_READY) { 4390 return (CMD_RQLATER); 4391 } 4392 |
4406 if (XS_TGT(xs) >= MAX_FC_TARG) { 4407 isp_prt(isp, ISP_LOG_WARN1, "%d.%d.%d target too big", XS_CHANNEL(xs), target, XS_LUN(xs)); | 4393 isp_prt(isp, ISP_LOGDEBUG2, "XS_TGT(xs)=%d", target); 4394 lp = &fcp->portdb[target]; 4395 if (target < 0 || target >= MAX_FC_TARG || 4396 lp->dev_map_idx == 0) { |
4408 XS_SETERR(xs, HBA_SELTIMEOUT); 4409 return (CMD_COMPLETE); 4410 } | 4397 XS_SETERR(xs, HBA_SELTIMEOUT); 4398 return (CMD_COMPLETE); 4399 } |
4411 4412 hdlidx = fcp->isp_dev_map[XS_TGT(xs)] - 1; 4413 isp_prt(isp, ISP_LOGDEBUG2, "XS_TGT(xs)=%d- hdlidx value %d", XS_TGT(xs), hdlidx); 4414 if (hdlidx < 0 || hdlidx >= MAX_FC_TARG) { 4415 XS_SETERR(xs, HBA_SELTIMEOUT); 4416 return (CMD_COMPLETE); 4417 } 4418 if (fcp->portdb[hdlidx].state == FC_PORTDB_STATE_ZOMBIE) { | 4400 if (lp->state == FC_PORTDB_STATE_ZOMBIE) { |
4419 isp_prt(isp, ISP_LOGDEBUG1, "%d.%d.%d target zombie", XS_CHANNEL(xs), target, XS_LUN(xs)); 4420 return (CMD_RQLATER); 4421 } | 4401 isp_prt(isp, ISP_LOGDEBUG1, "%d.%d.%d target zombie", XS_CHANNEL(xs), target, XS_LUN(xs)); 4402 return (CMD_RQLATER); 4403 } |
4422 if (fcp->portdb[hdlidx].state != FC_PORTDB_STATE_VALID) { 4423 isp_prt(isp, ISP_LOGDEBUG1, "%d.%d.%d bad db port state 0x%x", XS_CHANNEL(xs), target, XS_LUN(xs), fcp->portdb[hdlidx].state); | 4404 if (lp->state != FC_PORTDB_STATE_VALID) { 4405 isp_prt(isp, ISP_LOGDEBUG1, "%d.%d.%d bad db port state 0x%x", XS_CHANNEL(xs), target, XS_LUN(xs), lp->state); |
4424 XS_SETERR(xs, HBA_SELTIMEOUT); 4425 return (CMD_COMPLETE); 4426 } | 4406 XS_SETERR(xs, HBA_SELTIMEOUT); 4407 return (CMD_COMPLETE); 4408 } |
4427 target = fcp->portdb[hdlidx].handle; 4428 fcp->portdb[hdlidx].dirty = 1; | 4409 lp->dirty = 1; |
4429 } else { 4430 sdparam *sdp = SDPARAM(isp, XS_CHANNEL(xs)); 4431 if ((sdp->role & ISP_ROLE_INITIATOR) == 0) { 4432 isp_prt(isp, ISP_LOGDEBUG1, "%d.%d.%d I am not an initiator", XS_CHANNEL(xs), target, XS_LUN(xs)); 4433 XS_SETERR(xs, HBA_SELTIMEOUT); 4434 return (CMD_COMPLETE); 4435 } 4436 if (sdp->update) { --- 125 unchanged lines hidden (view full) --- 4562 return (CMD_COMPLETE); 4563 } 4564 reqp->req_target = target | (XS_CHANNEL(xs) << 7); 4565 reqp->req_lun_trn = XS_LUN(xs); 4566 cdbp = reqp->req_cdb; 4567 reqp->req_cdblen = cdblen; 4568 } else if (IS_24XX(isp)) { 4569 ispreqt7_t *t7 = (ispreqt7_t *)local; | 4410 } else { 4411 sdparam *sdp = SDPARAM(isp, XS_CHANNEL(xs)); 4412 if ((sdp->role & ISP_ROLE_INITIATOR) == 0) { 4413 isp_prt(isp, ISP_LOGDEBUG1, "%d.%d.%d I am not an initiator", XS_CHANNEL(xs), target, XS_LUN(xs)); 4414 XS_SETERR(xs, HBA_SELTIMEOUT); 4415 return (CMD_COMPLETE); 4416 } 4417 if (sdp->update) { --- 125 unchanged lines hidden (view full) --- 4543 return (CMD_COMPLETE); 4544 } 4545 reqp->req_target = target | (XS_CHANNEL(xs) << 7); 4546 reqp->req_lun_trn = XS_LUN(xs); 4547 cdbp = reqp->req_cdb; 4548 reqp->req_cdblen = cdblen; 4549 } else if (IS_24XX(isp)) { 4550 ispreqt7_t *t7 = (ispreqt7_t *)local; |
4570 fcportdb_t *lp; | |
4571 4572 if (cdblen > sizeof (t7->req_cdb)) { 4573 isp_prt(isp, ISP_LOGERR, "Command Length %u too long for this chip", cdblen); 4574 XS_SETERR(xs, HBA_BOTCH); 4575 return (CMD_COMPLETE); 4576 } 4577 | 4551 4552 if (cdblen > sizeof (t7->req_cdb)) { 4553 isp_prt(isp, ISP_LOGERR, "Command Length %u too long for this chip", cdblen); 4554 XS_SETERR(xs, HBA_BOTCH); 4555 return (CMD_COMPLETE); 4556 } 4557 |
4578 lp = &FCPARAM(isp, XS_CHANNEL(xs))->portdb[hdlidx]; 4579 t7->req_nphdl = target; | 4558 t7->req_nphdl = lp->handle; |
4580 t7->req_tidlo = lp->portid; 4581 t7->req_tidhi = lp->portid >> 16; 4582 t7->req_vpidx = ISP_GET_VPIDX(isp, XS_CHANNEL(xs)); 4583 if (XS_LUN(xs) > 256) { 4584 t7->req_lun[0] = XS_LUN(xs) >> 8; 4585 t7->req_lun[0] |= 0x40; 4586 } 4587 t7->req_lun[1] = XS_LUN(xs); 4588 if (FCPARAM(isp, XS_CHANNEL(xs))->fctape_enabled && (lp->prli_word3 & PRLI_WD3_RETRY)) { 4589 if (FCP_NEXT_CRN(isp, &t7->req_crn, xs)) { 4590 isp_prt(isp, ISP_LOG_WARN1, "%d.%d.%d cannot generate next CRN", XS_CHANNEL(xs), target, XS_LUN(xs)); 4591 XS_SETERR(xs, HBA_BOTCH); 4592 return (CMD_EAGAIN); 4593 } 4594 } 4595 tptr = &t7->req_time; 4596 cdbp = t7->req_cdb; 4597 } else { 4598 ispreqt2_t *t2 = (ispreqt2_t *)local; | 4559 t7->req_tidlo = lp->portid; 4560 t7->req_tidhi = lp->portid >> 16; 4561 t7->req_vpidx = ISP_GET_VPIDX(isp, XS_CHANNEL(xs)); 4562 if (XS_LUN(xs) > 256) { 4563 t7->req_lun[0] = XS_LUN(xs) >> 8; 4564 t7->req_lun[0] |= 0x40; 4565 } 4566 t7->req_lun[1] = XS_LUN(xs); 4567 if (FCPARAM(isp, XS_CHANNEL(xs))->fctape_enabled && (lp->prli_word3 & PRLI_WD3_RETRY)) { 4568 if (FCP_NEXT_CRN(isp, &t7->req_crn, xs)) { 4569 isp_prt(isp, ISP_LOG_WARN1, "%d.%d.%d cannot generate next CRN", XS_CHANNEL(xs), target, XS_LUN(xs)); 4570 XS_SETERR(xs, HBA_BOTCH); 4571 return (CMD_EAGAIN); 4572 } 4573 } 4574 tptr = &t7->req_time; 4575 cdbp = t7->req_cdb; 4576 } else { 4577 ispreqt2_t *t2 = (ispreqt2_t *)local; |
4599 fcportdb_t *lp; | |
4600 4601 if (cdblen > sizeof t2->req_cdb) { 4602 isp_prt(isp, ISP_LOGERR, "Command Length %u too long for this chip", cdblen); 4603 XS_SETERR(xs, HBA_BOTCH); 4604 return (CMD_COMPLETE); 4605 } | 4578 4579 if (cdblen > sizeof t2->req_cdb) { 4580 isp_prt(isp, ISP_LOGERR, "Command Length %u too long for this chip", cdblen); 4581 XS_SETERR(xs, HBA_BOTCH); 4582 return (CMD_COMPLETE); 4583 } |
4606 lp = &FCPARAM(isp, XS_CHANNEL(xs))->portdb[hdlidx]; | |
4607 if (FCPARAM(isp, XS_CHANNEL(xs))->fctape_enabled && (lp->prli_word3 & PRLI_WD3_RETRY)) { 4608 if (FCP_NEXT_CRN(isp, &t2->req_crn, xs)) { 4609 isp_prt(isp, ISP_LOG_WARN1, "%d.%d.%d cannot generate next CRN", XS_CHANNEL(xs), target, XS_LUN(xs)); 4610 XS_SETERR(xs, HBA_BOTCH); 4611 return (CMD_EAGAIN); 4612 } 4613 } 4614 if (ISP_CAP_2KLOGIN(isp)) { 4615 ispreqt2e_t *t2e = (ispreqt2e_t *)local; | 4584 if (FCPARAM(isp, XS_CHANNEL(xs))->fctape_enabled && (lp->prli_word3 & PRLI_WD3_RETRY)) { 4585 if (FCP_NEXT_CRN(isp, &t2->req_crn, xs)) { 4586 isp_prt(isp, ISP_LOG_WARN1, "%d.%d.%d cannot generate next CRN", XS_CHANNEL(xs), target, XS_LUN(xs)); 4587 XS_SETERR(xs, HBA_BOTCH); 4588 return (CMD_EAGAIN); 4589 } 4590 } 4591 if (ISP_CAP_2KLOGIN(isp)) { 4592 ispreqt2e_t *t2e = (ispreqt2e_t *)local; |
4616 t2e->req_target = target; | 4593 t2e->req_target = lp->handle; |
4617 t2e->req_scclun = XS_LUN(xs); 4618 cdbp = t2e->req_cdb; 4619 } else if (ISP_CAP_SCCFW(isp)) { 4620 ispreqt2_t *t2 = (ispreqt2_t *)local; | 4594 t2e->req_scclun = XS_LUN(xs); 4595 cdbp = t2e->req_cdb; 4596 } else if (ISP_CAP_SCCFW(isp)) { 4597 ispreqt2_t *t2 = (ispreqt2_t *)local; |
4621 t2->req_target = target; | 4598 t2->req_target = lp->handle; |
4622 t2->req_scclun = XS_LUN(xs); 4623 cdbp = t2->req_cdb; 4624 } else { | 4599 t2->req_scclun = XS_LUN(xs); 4600 cdbp = t2->req_cdb; 4601 } else { |
4625 t2->req_target = target; | 4602 t2->req_target = lp->handle; |
4626 t2->req_lun_trn = XS_LUN(xs); 4627 cdbp = t2->req_cdb; 4628 } 4629 } 4630 ISP_MEMCPY(cdbp, XS_CDBP(xs), cdblen); 4631 4632 *tptr = XS_TIME(xs) / 1000; 4633 if (*tptr == 0 && XS_TIME(xs)) { --- 81 unchanged lines hidden (view full) --- 4715 tgt = va_arg(ap, int); 4716 va_end(ap); 4717 if (IS_24XX(isp)) { 4718 uint8_t local[QENTRY_LEN]; 4719 isp24xx_tmf_t *tmf; 4720 isp24xx_statusreq_t *sp; 4721 fcparam *fcp = FCPARAM(isp, chan); 4722 fcportdb_t *lp; | 4603 t2->req_lun_trn = XS_LUN(xs); 4604 cdbp = t2->req_cdb; 4605 } 4606 } 4607 ISP_MEMCPY(cdbp, XS_CDBP(xs), cdblen); 4608 4609 *tptr = XS_TIME(xs) / 1000; 4610 if (*tptr == 0 && XS_TIME(xs)) { --- 81 unchanged lines hidden (view full) --- 4692 tgt = va_arg(ap, int); 4693 va_end(ap); 4694 if (IS_24XX(isp)) { 4695 uint8_t local[QENTRY_LEN]; 4696 isp24xx_tmf_t *tmf; 4697 isp24xx_statusreq_t *sp; 4698 fcparam *fcp = FCPARAM(isp, chan); 4699 fcportdb_t *lp; |
4723 int hdlidx; | |
4724 | 4700 |
4725 hdlidx = fcp->isp_dev_map[tgt] - 1; 4726 if (hdlidx < 0 || hdlidx >= MAX_FC_TARG) { 4727 isp_prt(isp, ISP_LOGWARN, "Chan %d bad handle %d trying to reset target %d", chan, hdlidx, tgt); | 4701 if (tgt < 0 || tgt >= MAX_FC_TARG) { 4702 isp_prt(isp, ISP_LOGWARN, "Chan %d trying to reset bad target %d", chan, tgt); |
4728 break; 4729 } | 4703 break; 4704 } |
4730 lp = &fcp->portdb[hdlidx]; 4731 if (lp->state != FC_PORTDB_STATE_VALID) { 4732 isp_prt(isp, ISP_LOGWARN, "Chan %d handle %d for abort of target %d no longer valid", chan, hdlidx, tgt); | 4705 lp = &fcp->portdb[tgt]; 4706 if (lp->dev_map_idx == 0 || 4707 lp->state != FC_PORTDB_STATE_VALID) { 4708 isp_prt(isp, ISP_LOGWARN, "Chan %d abort of no longer valid target %d", chan, tgt); |
4733 break; 4734 } 4735 4736 tmf = (isp24xx_tmf_t *) local; 4737 ISP_MEMZERO(tmf, QENTRY_LEN); 4738 tmf->tmf_header.rqs_entry_type = RQSTYPE_TSK_MGMT; 4739 tmf->tmf_header.rqs_entry_count = 1; 4740 tmf->tmf_nphdl = lp->handle; --- 64 unchanged lines hidden (view full) --- 4805 if (handle == 0) { 4806 isp_prt(isp, ISP_LOGWARN, "cannot find handle for command to abort"); 4807 break; 4808 } 4809 if (IS_24XX(isp)) { 4810 isp24xx_abrt_t local, *ab = &local, *ab2; 4811 fcparam *fcp; 4812 fcportdb_t *lp; | 4709 break; 4710 } 4711 4712 tmf = (isp24xx_tmf_t *) local; 4713 ISP_MEMZERO(tmf, QENTRY_LEN); 4714 tmf->tmf_header.rqs_entry_type = RQSTYPE_TSK_MGMT; 4715 tmf->tmf_header.rqs_entry_count = 1; 4716 tmf->tmf_nphdl = lp->handle; --- 64 unchanged lines hidden (view full) --- 4781 if (handle == 0) { 4782 isp_prt(isp, ISP_LOGWARN, "cannot find handle for command to abort"); 4783 break; 4784 } 4785 if (IS_24XX(isp)) { 4786 isp24xx_abrt_t local, *ab = &local, *ab2; 4787 fcparam *fcp; 4788 fcportdb_t *lp; |
4813 int hdlidx; | |
4814 4815 fcp = FCPARAM(isp, chan); | 4789 4790 fcp = FCPARAM(isp, chan); |
4816 hdlidx = fcp->isp_dev_map[tgt] - 1; 4817 if (hdlidx < 0 || hdlidx >= MAX_FC_TARG) { 4818 isp_prt(isp, ISP_LOGWARN, "Chan %d bad handle %d trying to abort target %d", chan, hdlidx, tgt); | 4791 if (tgt < 0 || tgt >= MAX_FC_TARG) { 4792 isp_prt(isp, ISP_LOGWARN, "Chan %d trying to abort bad target %d", chan, tgt); |
4819 break; 4820 } | 4793 break; 4794 } |
4821 lp = &fcp->portdb[hdlidx]; 4822 if (lp->state != FC_PORTDB_STATE_VALID) { 4823 isp_prt(isp, ISP_LOGWARN, "Chan %d handle %d for abort of target %d no longer valid", chan, hdlidx, tgt); | 4795 lp = &fcp->portdb[tgt]; 4796 if (lp->dev_map_idx == 0 || 4797 lp->state != FC_PORTDB_STATE_VALID) { 4798 isp_prt(isp, ISP_LOGWARN, "Chan %d abort of no longer valid target %d", chan, tgt); |
4824 break; 4825 } 4826 isp_prt(isp, ISP_LOGALL, "Chan %d Abort Cmd for N-Port 0x%04x @ Port 0x%06x", chan, lp->handle, lp->portid); 4827 ISP_MEMZERO(ab, QENTRY_LEN); 4828 ab->abrt_header.rqs_entry_type = RQSTYPE_ABORT_IO; 4829 ab->abrt_header.rqs_entry_count = 1; 4830 ab->abrt_handle = lp->handle; 4831 ab->abrt_cmd_handle = handle; --- 23 unchanged lines hidden (view full) --- 4855 break; 4856 } 4857 MEMORYBARRIER(isp, SYNC_SFORCPU, QENTRY_LEN, QENTRY_LEN, chan); 4858 isp_get_24xx_abrt(isp, ab2, ab); 4859 FC_SCRATCH_RELEASE(isp, chan); 4860 if (ab->abrt_nphdl == ISP24XX_ABRT_OKAY) { 4861 return (0); 4862 } | 4799 break; 4800 } 4801 isp_prt(isp, ISP_LOGALL, "Chan %d Abort Cmd for N-Port 0x%04x @ Port 0x%06x", chan, lp->handle, lp->portid); 4802 ISP_MEMZERO(ab, QENTRY_LEN); 4803 ab->abrt_header.rqs_entry_type = RQSTYPE_ABORT_IO; 4804 ab->abrt_header.rqs_entry_count = 1; 4805 ab->abrt_handle = lp->handle; 4806 ab->abrt_cmd_handle = handle; --- 23 unchanged lines hidden (view full) --- 4830 break; 4831 } 4832 MEMORYBARRIER(isp, SYNC_SFORCPU, QENTRY_LEN, QENTRY_LEN, chan); 4833 isp_get_24xx_abrt(isp, ab2, ab); 4834 FC_SCRATCH_RELEASE(isp, chan); 4835 if (ab->abrt_nphdl == ISP24XX_ABRT_OKAY) { 4836 return (0); 4837 } |
4863 isp_prt(isp, ISP_LOGWARN, "Chan %d handle %d abort returned 0x%x", chan, hdlidx, ab->abrt_nphdl); | 4838 isp_prt(isp, ISP_LOGWARN, "Chan %d handle %d abort returned 0x%x", chan, tgt, ab->abrt_nphdl); |
4864 break; 4865 } else if (IS_FC(isp)) { 4866 if (ISP_CAP_SCCFW(isp)) { 4867 if (ISP_CAP_2KLOGIN(isp)) { 4868 mbs.param[1] = tgt; 4869 } else { 4870 mbs.param[1] = tgt << 8; 4871 } --- 3700 unchanged lines hidden --- | 4839 break; 4840 } else if (IS_FC(isp)) { 4841 if (ISP_CAP_SCCFW(isp)) { 4842 if (ISP_CAP_2KLOGIN(isp)) { 4843 mbs.param[1] = tgt; 4844 } else { 4845 mbs.param[1] = tgt << 8; 4846 } --- 3700 unchanged lines hidden --- |