isp_freebsd.c (239143) | isp_freebsd.c (239218) |
---|---|
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 239143 2012-08-08 18:24:33Z mjacob $"); | 31__FBSDID("$FreeBSD: head/sys/dev/isp/isp_freebsd.c 239218 2012-08-12 20:45:47Z 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> --- 734 unchanged lines hidden (view full) --- 774 isp->isp_osinfo.pcmd_free = ((struct isp_pcmd *)ISP_PCMD(ccb))->next; 775 return (0); 776} 777 778static ISP_INLINE void 779isp_free_pcmd(ispsoftc_t *isp, union ccb *ccb) 780{ 781 if (ISP_PCMD(ccb)) { | 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> --- 734 unchanged lines hidden (view full) --- 774 isp->isp_osinfo.pcmd_free = ((struct isp_pcmd *)ISP_PCMD(ccb))->next; 775 return (0); 776} 777 778static ISP_INLINE void 779isp_free_pcmd(ispsoftc_t *isp, union ccb *ccb) 780{ 781 if (ISP_PCMD(ccb)) { |
782 memset(ISP_PCMD(ccb), 0, sizeof (struct isp_pcmd)); 783 ((struct isp_pcmd *)ISP_PCMD(ccb))->next = isp->isp_osinfo.pcmd_free; | 782#ifdef ISP_TARGET_MODE 783 PISP_PCMD(ccb)->datalen = 0; 784 PISP_PCMD(ccb)->totslen = 0; 785 PISP_PCMD(ccb)->cumslen = 0; 786 PISP_PCMD(ccb)->crn = 0; 787#endif 788 PISP_PCMD(ccb)->next = isp->isp_osinfo.pcmd_free; |
784 isp->isp_osinfo.pcmd_free = ISP_PCMD(ccb); 785 ISP_PCMD(ccb) = NULL; 786 } 787} 788 789/* 790 * Put the target mode functions here, because some are inlines 791 */ --- 5529 unchanged lines hidden (view full) --- 6321 bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, BUS_DMASYNC_POSTWRITE); 6322 } 6323 bus_dmamap_unload(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap); 6324} 6325 6326int 6327isp_fcp_next_crn(ispsoftc_t *isp, uint8_t *crnp, XS_T *cmd) 6328{ | 789 isp->isp_osinfo.pcmd_free = ISP_PCMD(ccb); 790 ISP_PCMD(ccb) = NULL; 791 } 792} 793 794/* 795 * Put the target mode functions here, because some are inlines 796 */ --- 5529 unchanged lines hidden (view full) --- 6326 bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, BUS_DMASYNC_POSTWRITE); 6327 } 6328 bus_dmamap_unload(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap); 6329} 6330 6331int 6332isp_fcp_next_crn(ispsoftc_t *isp, uint8_t *crnp, XS_T *cmd) 6333{ |
6329 uint32_t chan = XS_CHANNEL(cmd); 6330 uint32_t tgt = XS_TGT(cmd); 6331 uint32_t lun = XS_LUN(cmd); 6332 struct isp_fc *fc = &isp->isp_osinfo.pc.fc[chan]; 6333 int idx = NEXUS_HASH(tgt, lun); 6334 struct isp_nexus *nxp = fc->nexus_hash[idx]; | 6334 uint32_t chan, tgt, lun; 6335 struct isp_fc *fc; 6336 struct isp_nexus *nxp; 6337 int idx; |
6335 | 6338 |
6339 if (isp->isp_type < ISP_HA_FC_2300) 6340 return (0); 6341 6342 chan = XS_CHANNEL(cmd); 6343 tgt = XS_TGT(cmd); 6344 lun = XS_LUN(cmd); 6345 fc = &isp->isp_osinfo.pc.fc[chan]; 6346 idx = NEXUS_HASH(tgt, lun); 6347 nxp = fc->nexus_hash[idx]; 6348 |
|
6336 while (nxp) { 6337 if (nxp->tgt == tgt && nxp->lun == lun) 6338 break; 6339 nxp = nxp->next; 6340 } 6341 if (nxp == NULL) { 6342 nxp = fc->nexus_free_list; 6343 if (nxp == NULL) { --- 52 unchanged lines hidden --- | 6349 while (nxp) { 6350 if (nxp->tgt == tgt && nxp->lun == lun) 6351 break; 6352 nxp = nxp->next; 6353 } 6354 if (nxp == NULL) { 6355 nxp = fc->nexus_free_list; 6356 if (nxp == NULL) { --- 52 unchanged lines hidden --- |