isp_freebsd.c (291013) | isp_freebsd.c (291080) |
---|---|
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 * 1. Redistributions of source code must retain the above copyright --- 14 unchanged lines hidden (view full) --- 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27/* 28 * Platform (FreeBSD) dependent common attachment code for Qlogic adapters. 29 */ 30#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 * 1. Redistributions of source code must retain the above copyright --- 14 unchanged lines hidden (view full) --- 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27/* 28 * Platform (FreeBSD) dependent common attachment code for Qlogic adapters. 29 */ 30#include <sys/cdefs.h> |
31__FBSDID("$FreeBSD: head/sys/dev/isp/isp_freebsd.c 291013 2015-11-18 11:14:59Z mav $"); | 31__FBSDID("$FreeBSD: head/sys/dev/isp/isp_freebsd.c 291080 2015-11-19 17:43:47Z mav $"); |
32 33#include <dev/isp/isp_freebsd.h> 34#include <sys/unistd.h> 35#include <sys/kthread.h> 36#include <sys/conf.h> 37#include <sys/module.h> 38#include <sys/ioccom.h> 39#include <dev/isp/isp_ioctl.h> --- 2544 unchanged lines hidden (view full) --- 2584 isp_prt(isp, ISP_LOGTDEBUG0, "%s: [RX_ID 0x%x] D_ID 0x%06x found on Chan %d for S_ID 0x%06x", __func__, aep->at_rxid, did, chan, sid); 2585 } else { 2586 chan = 0; 2587 } 2588 2589 /* 2590 * Find the PDB entry for this initiator 2591 */ | 32 33#include <dev/isp/isp_freebsd.h> 34#include <sys/unistd.h> 35#include <sys/kthread.h> 36#include <sys/conf.h> 37#include <sys/module.h> 38#include <sys/ioccom.h> 39#include <dev/isp/isp_ioctl.h> --- 2544 unchanged lines hidden (view full) --- 2584 isp_prt(isp, ISP_LOGTDEBUG0, "%s: [RX_ID 0x%x] D_ID 0x%06x found on Chan %d for S_ID 0x%06x", __func__, aep->at_rxid, did, chan, sid); 2585 } else { 2586 chan = 0; 2587 } 2588 2589 /* 2590 * Find the PDB entry for this initiator 2591 */ |
2592 if (isp_find_pdb_by_sid(isp, chan, sid, &lp) == 0) { | 2592 if (isp_find_pdb_by_portid(isp, chan, sid, &lp) == 0) { |
2593 /* 2594 * If we're not in the port database terminate the exchange. 2595 */ 2596 isp_prt(isp, ISP_LOGTINFO, "%s: [RX_ID 0x%x] D_ID 0x%06x found on Chan %d for S_ID 0x%06x wasn't in PDB already", 2597 __func__, aep->at_rxid, did, chan, sid); 2598 isp_dump_portdb(isp, chan); 2599 isp_endcmd(isp, aep, NIL_HANDLE, chan, ECMD_TERMINATE, 0); 2600 return; --- 716 unchanged lines hidden (view full) --- 3317 if (IS_24XX(isp) && mp->nt_lreserved && ((isphdr_t *)mp->nt_lreserved)->rqs_entry_type == RQSTYPE_ATIO) { 3318 ct7_entry_t local, *cto = &local; 3319 at7_entry_t *aep = (at7_entry_t *)mp->nt_lreserved; 3320 fcportdb_t *lp; 3321 uint32_t sid; 3322 uint16_t nphdl; 3323 3324 sid = (aep->at_hdr.s_id[0] << 16) | (aep->at_hdr.s_id[1] << 8) | aep->at_hdr.s_id[2]; | 2593 /* 2594 * If we're not in the port database terminate the exchange. 2595 */ 2596 isp_prt(isp, ISP_LOGTINFO, "%s: [RX_ID 0x%x] D_ID 0x%06x found on Chan %d for S_ID 0x%06x wasn't in PDB already", 2597 __func__, aep->at_rxid, did, chan, sid); 2598 isp_dump_portdb(isp, chan); 2599 isp_endcmd(isp, aep, NIL_HANDLE, chan, ECMD_TERMINATE, 0); 2600 return; --- 716 unchanged lines hidden (view full) --- 3317 if (IS_24XX(isp) && mp->nt_lreserved && ((isphdr_t *)mp->nt_lreserved)->rqs_entry_type == RQSTYPE_ATIO) { 3318 ct7_entry_t local, *cto = &local; 3319 at7_entry_t *aep = (at7_entry_t *)mp->nt_lreserved; 3320 fcportdb_t *lp; 3321 uint32_t sid; 3322 uint16_t nphdl; 3323 3324 sid = (aep->at_hdr.s_id[0] << 16) | (aep->at_hdr.s_id[1] << 8) | aep->at_hdr.s_id[2]; |
3325 if (isp_find_pdb_by_sid(isp, mp->nt_channel, sid, &lp)) { | 3325 if (isp_find_pdb_by_portid(isp, mp->nt_channel, sid, &lp)) { |
3326 nphdl = lp->handle; 3327 } else { 3328 nphdl = NIL_HANDLE; 3329 } 3330 ISP_MEMZERO(&local, sizeof (local)); 3331 cto->ct_header.rqs_entry_type = RQSTYPE_CTIO7; 3332 cto->ct_header.rqs_entry_count = 1; 3333 cto->ct_nphdl = nphdl; --- 107 unchanged lines hidden (view full) --- 3441 } 3442 } 3443 inot = (struct ccb_immediate_notify *) SLIST_FIRST(&tptr->inots); 3444 if (inot == NULL) { 3445 isp_prt(isp, ISP_LOGWARN, "%s: out of immediate notify structures for chan %d lun %#jx", __func__, notify->nt_channel, (uintmax_t)lun); 3446 goto bad; 3447 } 3448 | 3326 nphdl = lp->handle; 3327 } else { 3328 nphdl = NIL_HANDLE; 3329 } 3330 ISP_MEMZERO(&local, sizeof (local)); 3331 cto->ct_header.rqs_entry_type = RQSTYPE_CTIO7; 3332 cto->ct_header.rqs_entry_count = 1; 3333 cto->ct_nphdl = nphdl; --- 107 unchanged lines hidden (view full) --- 3441 } 3442 } 3443 inot = (struct ccb_immediate_notify *) SLIST_FIRST(&tptr->inots); 3444 if (inot == NULL) { 3445 isp_prt(isp, ISP_LOGWARN, "%s: out of immediate notify structures for chan %d lun %#jx", __func__, notify->nt_channel, (uintmax_t)lun); 3446 goto bad; 3447 } 3448 |
3449 if (isp_find_pdb_by_sid(isp, notify->nt_channel, notify->nt_sid, &lp) == 0 && | 3449 if (isp_find_pdb_by_portid(isp, notify->nt_channel, notify->nt_sid, &lp) == 0 && |
3450 isp_find_pdb_by_handle(isp, notify->nt_channel, notify->nt_nphdl, &lp) == 0) { 3451 inot->initiator_id = CAM_TARGET_WILDCARD; 3452 } else { 3453 inot->initiator_id = FC_PORTDB_TGT(isp, notify->nt_channel, lp); 3454 } 3455 inot->seq_id = notify->nt_tagval; 3456 inot->tag_id = notify->nt_tagval >> 32; 3457 --- 1503 unchanged lines hidden (view full) --- 4961 } 4962 break; 4963 } 4964 isp_prt(isp, ISP_LOGCONFIG, prom, bus, tgt, lp->port_wwn, lp->portid, lp->handle, buf, "gone"); 4965 break; 4966 case ISPASYNC_CHANGE_NOTIFY: 4967 { 4968 char *msg; | 3450 isp_find_pdb_by_handle(isp, notify->nt_channel, notify->nt_nphdl, &lp) == 0) { 3451 inot->initiator_id = CAM_TARGET_WILDCARD; 3452 } else { 3453 inot->initiator_id = FC_PORTDB_TGT(isp, notify->nt_channel, lp); 3454 } 3455 inot->seq_id = notify->nt_tagval; 3456 inot->tag_id = notify->nt_tagval >> 32; 3457 --- 1503 unchanged lines hidden (view full) --- 4961 } 4962 break; 4963 } 4964 isp_prt(isp, ISP_LOGCONFIG, prom, bus, tgt, lp->port_wwn, lp->portid, lp->handle, buf, "gone"); 4965 break; 4966 case ISPASYNC_CHANGE_NOTIFY: 4967 { 4968 char *msg; |
4969 int evt, nphdl, nlstate, reason; | 4969 int evt, nphdl, nlstate, portid, reason; |
4970 4971 va_start(ap, cmd); 4972 bus = va_arg(ap, int); 4973 evt = va_arg(ap, int); | 4970 4971 va_start(ap, cmd); 4972 bus = va_arg(ap, int); 4973 evt = va_arg(ap, int); |
4974 if (IS_24XX(isp) && evt == ISPASYNC_CHANGE_PDB) { | 4974 if (evt == ISPASYNC_CHANGE_PDB) { |
4975 nphdl = va_arg(ap, int); 4976 nlstate = va_arg(ap, int); 4977 reason = va_arg(ap, int); | 4975 nphdl = va_arg(ap, int); 4976 nlstate = va_arg(ap, int); 4977 reason = va_arg(ap, int); |
4978 } else if (evt == ISPASYNC_CHANGE_SNS) { 4979 portid = va_arg(ap, int); |
|
4978 } else { 4979 nphdl = NIL_HANDLE; 4980 nlstate = reason = 0; 4981 } 4982 va_end(ap); 4983 fc = ISP_FC_PC(isp, bus); 4984 4985 if (evt == ISPASYNC_CHANGE_PDB) { 4986 msg = "Port Database Changed"; | 4980 } else { 4981 nphdl = NIL_HANDLE; 4982 nlstate = reason = 0; 4983 } 4984 va_end(ap); 4985 fc = ISP_FC_PC(isp, bus); 4986 4987 if (evt == ISPASYNC_CHANGE_PDB) { 4988 msg = "Port Database Changed"; |
4989 isp_prt(isp, ISP_LOGINFO, 4990 "Chan %d %s (nphdl 0x%x state 0x%x reason 0x%x)", 4991 bus, msg, nphdl, nlstate, reason); |
|
4987 } else if (evt == ISPASYNC_CHANGE_SNS) { 4988 msg = "Name Server Database Changed"; | 4992 } else if (evt == ISPASYNC_CHANGE_SNS) { 4993 msg = "Name Server Database Changed"; |
4994 isp_prt(isp, ISP_LOGINFO, "Chan %d %s (PortID 0x%06x)", 4995 bus, msg, portid); |
|
4989 } else { 4990 msg = "Other Change Notify"; | 4996 } else { 4997 msg = "Other Change Notify"; |
4998 isp_prt(isp, ISP_LOGINFO, "Chan %d %s", bus, msg); |
|
4991 } 4992 4993 /* 4994 * If the loop down timer is running, cancel it. 4995 */ 4996 if (fc->ready && callout_active(&fc->ldt)) { 4997 isp_prt(isp, ISP_LOG_SANCFG|ISP_LOGDEBUG0, "Stopping Loop Down Timer @ %lu", (unsigned long) time_uptime); 4998 callout_stop(&fc->ldt); 4999 } | 4999 } 5000 5001 /* 5002 * If the loop down timer is running, cancel it. 5003 */ 5004 if (fc->ready && callout_active(&fc->ldt)) { 5005 isp_prt(isp, ISP_LOG_SANCFG|ISP_LOGDEBUG0, "Stopping Loop Down Timer @ %lu", (unsigned long) time_uptime); 5006 callout_stop(&fc->ldt); 5007 } |
5000 isp_prt(isp, ISP_LOGINFO, "Chan %d %s", bus, msg); | |
5001 if (FCPARAM(isp, bus)->role & ISP_ROLE_INITIATOR) { 5002 isp_freeze_loopdown(isp, bus, msg); 5003 } 5004 wakeup(fc); 5005 break; 5006 } 5007#ifdef ISP_TARGET_MODE 5008 case ISPASYNC_TARGET_NOTIFY: --- 572 unchanged lines hidden --- | 5008 if (FCPARAM(isp, bus)->role & ISP_ROLE_INITIATOR) { 5009 isp_freeze_loopdown(isp, bus, msg); 5010 } 5011 wakeup(fc); 5012 break; 5013 } 5014#ifdef ISP_TARGET_MODE 5015 case ISPASYNC_TARGET_NOTIFY: --- 572 unchanged lines hidden --- |