isp_freebsd.c (236427) | isp_freebsd.c (237537) |
---|---|
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 236427 2012-06-01 23:29:48Z mjacob $"); | 31__FBSDID("$FreeBSD: head/sys/dev/isp/isp_freebsd.c 237537 2012-06-24 17:30:54Z mjacob $"); |
32#include <dev/isp/isp_freebsd.h> 33#include <sys/unistd.h> 34#include <sys/kthread.h> 35#include <sys/conf.h> 36#include <sys/module.h> 37#include <sys/ioccom.h> 38#include <dev/isp/isp_ioctl.h> 39#include <sys/devicestat.h> --- 2165 unchanged lines hidden (view full) --- 2205 int cdbxlen; 2206 uint16_t lun, chan, nphdl = NIL_HANDLE; 2207 uint32_t did, sid; 2208 uint64_t wwn = INI_NONE; 2209 fcportdb_t *lp; 2210 tstate_t *tptr; 2211 struct ccb_accept_tio *atiop; 2212 atio_private_data_t *atp = NULL; | 32#include <dev/isp/isp_freebsd.h> 33#include <sys/unistd.h> 34#include <sys/kthread.h> 35#include <sys/conf.h> 36#include <sys/module.h> 37#include <sys/ioccom.h> 38#include <dev/isp/isp_ioctl.h> 39#include <sys/devicestat.h> --- 2165 unchanged lines hidden (view full) --- 2205 int cdbxlen; 2206 uint16_t lun, chan, nphdl = NIL_HANDLE; 2207 uint32_t did, sid; 2208 uint64_t wwn = INI_NONE; 2209 fcportdb_t *lp; 2210 tstate_t *tptr; 2211 struct ccb_accept_tio *atiop; 2212 atio_private_data_t *atp = NULL; |
2213 atio_private_data_t *oatp; |
|
2213 inot_private_data_t *ntp; 2214 2215 did = (aep->at_hdr.d_id[0] << 16) | (aep->at_hdr.d_id[1] << 8) | aep->at_hdr.d_id[2]; 2216 sid = (aep->at_hdr.s_id[0] << 16) | (aep->at_hdr.s_id[1] << 8) | aep->at_hdr.s_id[2]; 2217 lun = (aep->at_cmnd.fcp_cmnd_lun[0] << 8) | aep->at_cmnd.fcp_cmnd_lun[1]; 2218 2219 /* 2220 * Find the N-port handle, and Virtual Port Index for this command. --- 78 unchanged lines hidden (view full) --- 2299 isp_handle_platform_atio7(isp, (at7_entry_t *) ntp->rd.data); 2300 isp_put_ntpd(isp, tptr, ntp); 2301 /* 2302 * If a recursion caused the restart queue to start to fill again, 2303 * stop and splice the new list on top of the old list and restore 2304 * it and go to noresrc. 2305 */ 2306 if (tptr->restart_queue) { | 2214 inot_private_data_t *ntp; 2215 2216 did = (aep->at_hdr.d_id[0] << 16) | (aep->at_hdr.d_id[1] << 8) | aep->at_hdr.d_id[2]; 2217 sid = (aep->at_hdr.s_id[0] << 16) | (aep->at_hdr.s_id[1] << 8) | aep->at_hdr.s_id[2]; 2218 lun = (aep->at_cmnd.fcp_cmnd_lun[0] << 8) | aep->at_cmnd.fcp_cmnd_lun[1]; 2219 2220 /* 2221 * Find the N-port handle, and Virtual Port Index for this command. --- 78 unchanged lines hidden (view full) --- 2300 isp_handle_platform_atio7(isp, (at7_entry_t *) ntp->rd.data); 2301 isp_put_ntpd(isp, tptr, ntp); 2302 /* 2303 * If a recursion caused the restart queue to start to fill again, 2304 * stop and splice the new list on top of the old list and restore 2305 * it and go to noresrc. 2306 */ 2307 if (tptr->restart_queue) { |
2308 isp_prt(isp, ISP_LOGTDEBUG0, "%s: restart queue refilling", __func__); |
|
2307 if (restart_queue) { 2308 ntp = tptr->restart_queue; 2309 tptr->restart_queue = restart_queue; 2310 while (restart_queue->rd.nt.nt_hba) { 2311 restart_queue = restart_queue->rd.nt.nt_hba; 2312 } 2313 restart_queue->rd.nt.nt_hba = ntp; 2314 } --- 20 unchanged lines hidden (view full) --- 2335 goto noresrc; 2336 } 2337 2338 atp = isp_get_atpd(isp, tptr, 0); 2339 if (atp == NULL) { 2340 isp_prt(isp, ISP_LOGTDEBUG0, "[0x%x] out of atps", aep->at_rxid); 2341 goto noresrc; 2342 } | 2309 if (restart_queue) { 2310 ntp = tptr->restart_queue; 2311 tptr->restart_queue = restart_queue; 2312 while (restart_queue->rd.nt.nt_hba) { 2313 restart_queue = restart_queue->rd.nt.nt_hba; 2314 } 2315 restart_queue->rd.nt.nt_hba = ntp; 2316 } --- 20 unchanged lines hidden (view full) --- 2337 goto noresrc; 2338 } 2339 2340 atp = isp_get_atpd(isp, tptr, 0); 2341 if (atp == NULL) { 2342 isp_prt(isp, ISP_LOGTDEBUG0, "[0x%x] out of atps", aep->at_rxid); 2343 goto noresrc; 2344 } |
2343 if (isp_get_atpd(isp, tptr, aep->at_rxid)) { 2344 isp_prt(isp, ISP_LOGTDEBUG0, "[0x%x] tag wraparound in isp_handle_platforms_atio7 (N-Port Handle 0x%04x S_ID 0x%04x OX_ID 0x%04x)\n", 2345 aep->at_rxid, nphdl, sid, aep->at_hdr.ox_id); | 2345 oatp = isp_get_atpd(isp, tptr, aep->at_rxid); 2346 if (oatp) { 2347 isp_prt(isp, ISP_LOGTDEBUG0, "[0x%x] tag wraparound in isp_handle_platforms_atio7 (N-Port Handle 0x%04x S_ID 0x%04x OX_ID 0x%04x) oatp state %d\n", 2348 aep->at_rxid, nphdl, sid, aep->at_hdr.ox_id, oatp->state); |
2346 /* 2347 * It's not a "no resource" condition- but we can treat it like one 2348 */ 2349 goto noresrc; 2350 } | 2349 /* 2350 * It's not a "no resource" condition- but we can treat it like one 2351 */ 2352 goto noresrc; 2353 } |
2351 | |
2352 atp->tag = aep->at_rxid; 2353 atp->state = ATPD_STATE_ATIO; 2354 SLIST_REMOVE_HEAD(&tptr->atios, sim_links.sle); 2355 tptr->atio_count--; 2356 ISP_PATH_PRT(isp, ISP_LOGTDEBUG0, atiop->ccb_h.path, "Take FREE ATIO count now %d\n", tptr->atio_count); 2357 atiop->init_id = nphdl; 2358 atiop->ccb_h.target_id = FCPARAM(isp, chan)->isp_loopid; 2359 atiop->ccb_h.target_lun = lun; --- 29 unchanged lines hidden (view full) --- 2389 } 2390 atp->orig_datalen = aep->at_cmnd.cdb_dl.sf.fcp_cmnd_dl; 2391 atp->bytes_xfered = 0; 2392 atp->last_xframt = 0; 2393 atp->lun = lun; 2394 atp->nphdl = nphdl; 2395 atp->portid = sid; 2396 atp->oxid = aep->at_hdr.ox_id; | 2354 atp->tag = aep->at_rxid; 2355 atp->state = ATPD_STATE_ATIO; 2356 SLIST_REMOVE_HEAD(&tptr->atios, sim_links.sle); 2357 tptr->atio_count--; 2358 ISP_PATH_PRT(isp, ISP_LOGTDEBUG0, atiop->ccb_h.path, "Take FREE ATIO count now %d\n", tptr->atio_count); 2359 atiop->init_id = nphdl; 2360 atiop->ccb_h.target_id = FCPARAM(isp, chan)->isp_loopid; 2361 atiop->ccb_h.target_lun = lun; --- 29 unchanged lines hidden (view full) --- 2391 } 2392 atp->orig_datalen = aep->at_cmnd.cdb_dl.sf.fcp_cmnd_dl; 2393 atp->bytes_xfered = 0; 2394 atp->last_xframt = 0; 2395 atp->lun = lun; 2396 atp->nphdl = nphdl; 2397 atp->portid = sid; 2398 atp->oxid = aep->at_hdr.ox_id; |
2399 atp->rxid = aep->at_hdr.rx_id; |
|
2397 atp->cdb0 = atiop->cdb_io.cdb_bytes[0]; 2398 atp->tattr = aep->at_cmnd.fcp_cmnd_task_attribute & FCP_CMND_TASK_ATTR_MASK; 2399 atp->state = ATPD_STATE_CAM; 2400 ISP_PATH_PRT(isp, ISP_LOGTDEBUG0, tptr->owner, "ATIO7[%x] CDB=0x%x lun %d datalen %u\n", aep->at_rxid, atp->cdb0, lun, atp->orig_datalen); 2401 xpt_done((union ccb *)atiop); 2402 rls_lun_statep(isp, tptr); 2403 return; 2404noresrc: --- 3409 unchanged lines hidden --- | 2400 atp->cdb0 = atiop->cdb_io.cdb_bytes[0]; 2401 atp->tattr = aep->at_cmnd.fcp_cmnd_task_attribute & FCP_CMND_TASK_ATTR_MASK; 2402 atp->state = ATPD_STATE_CAM; 2403 ISP_PATH_PRT(isp, ISP_LOGTDEBUG0, tptr->owner, "ATIO7[%x] CDB=0x%x lun %d datalen %u\n", aep->at_rxid, atp->cdb0, lun, atp->orig_datalen); 2404 xpt_done((union ccb *)atiop); 2405 rls_lun_statep(isp, tptr); 2406 return; 2407noresrc: --- 3409 unchanged lines hidden --- |