isc_cam.c (183397) | isc_cam.c (185289) |
---|---|
1/*- | 1/*- |
2 * Copyright (c) 2005-2007 Daniel Braniss <danny@cs.huji.ac.il> | 2 * Copyright (c) 2005-2008 Daniel Braniss <danny@cs.huji.ac.il> |
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 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright --- 10 unchanged lines hidden (view full) --- 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 */ 27 28#include <sys/cdefs.h> | 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 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright --- 10 unchanged lines hidden (view full) --- 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 */ 27 28#include <sys/cdefs.h> |
29__FBSDID("$FreeBSD: head/sys/dev/iscsi/initiator/isc_cam.c 183397 2008-09-27 08:51:18Z ed $"); | 29__FBSDID("$FreeBSD: head/sys/dev/iscsi/initiator/isc_cam.c 185289 2008-11-25 07:17:11Z scottl $"); |
30 31#include "opt_iscsi_initiator.h" 32 33#include <sys/param.h> 34#include <sys/kernel.h> 35#include <sys/callout.h> 36#if __FreeBSD_version >= 700000 37#include <sys/lock.h> --- 150 unchanged lines hidden (view full) --- 188 cpi->base_transfer_speed = 3300; 189 strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); 190 strncpy(cpi->hba_vid, "iSCSI", HBA_IDLEN); 191 strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); 192 cpi->unit_number = cam_sim_unit(sim); 193 cpi->ccb_h.status = CAM_REQ_CMP; 194} 195 | 30 31#include "opt_iscsi_initiator.h" 32 33#include <sys/param.h> 34#include <sys/kernel.h> 35#include <sys/callout.h> 36#if __FreeBSD_version >= 700000 37#include <sys/lock.h> --- 150 unchanged lines hidden (view full) --- 188 cpi->base_transfer_speed = 3300; 189 strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); 190 strncpy(cpi->hba_vid, "iSCSI", HBA_IDLEN); 191 strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); 192 cpi->unit_number = cam_sim_unit(sim); 193 cpi->ccb_h.status = CAM_REQ_CMP; 194} 195 |
196static __inline int 197_scsi_encap(struct cam_sim *sim, union ccb *ccb) 198{ 199 int ret; 200 201#if __FreeBSD_version < 700000 202 ret = scsi_encap(sim, ccb); 203#else 204 struct isc_softc *isp = (struct isc_softc *)cam_sim_softc(sim); 205 206 mtx_unlock(&isp->cam_mtx); 207 ret = scsi_encap(sim, ccb); 208 mtx_lock(&isp->cam_mtx); 209#endif 210 return ret; 211} 212 |
|
196static void 197ic_action(struct cam_sim *sim, union ccb *ccb) 198{ 199 struct ccb_hdr *ccb_h = &ccb->ccb_h; 200 struct isc_softc *isp = (struct isc_softc *)cam_sim_softc(sim); 201 isc_session_t *sp; 202 203 debug_called(8); --- 72 unchanged lines hidden (view full) --- 276 debug(4, "xpt_done.status=%d", ccb_h->status); 277 break; 278 } 279 if(ccb_h->target_lun == CAM_LUN_WILDCARD) { 280 debug(3, "target=%d: bad lun (-1)", ccb_h->target_id); 281 ccb_h->status = CAM_LUN_INVALID; 282 break; 283 } | 213static void 214ic_action(struct cam_sim *sim, union ccb *ccb) 215{ 216 struct ccb_hdr *ccb_h = &ccb->ccb_h; 217 struct isc_softc *isp = (struct isc_softc *)cam_sim_softc(sim); 218 isc_session_t *sp; 219 220 debug_called(8); --- 72 unchanged lines hidden (view full) --- 293 debug(4, "xpt_done.status=%d", ccb_h->status); 294 break; 295 } 296 if(ccb_h->target_lun == CAM_LUN_WILDCARD) { 297 debug(3, "target=%d: bad lun (-1)", ccb_h->target_id); 298 ccb_h->status = CAM_LUN_INVALID; 299 break; 300 } |
284#if __FreeBSD_version < 700000 285 if(scsi_encap(sim, ccb) != 0) | 301 if(_scsi_encap(sim, ccb) != 0) |
286 return; | 302 return; |
287#else 288 mtx_unlock(&isp->cam_mtx); 289 if(scsi_encap(sim, ccb) != 0) { 290 mtx_lock(&isp->cam_mtx); 291 return; 292 } 293 mtx_lock(&isp->cam_mtx); 294#endif | |
295 break; 296 } 297 298 case XPT_CALC_GEOMETRY: 299 { 300 struct ccb_calc_geometry *ccg; 301 302 ccg = &ccb->ccg; --- 88 unchanged lines hidden (view full) --- 391 if(sim == NULL) { 392 cam_simq_free(devq); 393#if __FreeBSD_version >= 700000 394 mtx_destroy(&isp->cam_mtx); 395#endif 396 return ENXIO; 397 } 398 CAM_LOCK(isp); | 303 break; 304 } 305 306 case XPT_CALC_GEOMETRY: 307 { 308 struct ccb_calc_geometry *ccg; 309 310 ccg = &ccb->ccg; --- 88 unchanged lines hidden (view full) --- 399 if(sim == NULL) { 400 cam_simq_free(devq); 401#if __FreeBSD_version >= 700000 402 mtx_destroy(&isp->cam_mtx); 403#endif 404 return ENXIO; 405 } 406 CAM_LOCK(isp); |
399 if(xpt_bus_register(sim, NULL, 0/*bus_number*/) != CAM_SUCCESS) | 407 if(xpt_bus_register(sim, 408#if __FreeBSD_version >= 700000 409 NULL, 410#endif 411 0/*bus_number*/) != CAM_SUCCESS) |
400 goto bad; 401 402 if(xpt_create_path(&path, xpt_periph, cam_sim_path(sim), 403 CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { 404 xpt_bus_deregister(cam_sim_path(sim)); 405 goto bad; 406 } 407 --- 17 unchanged lines hidden --- | 412 goto bad; 413 414 if(xpt_create_path(&path, xpt_periph, cam_sim_path(sim), 415 CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { 416 xpt_bus_deregister(cam_sim_path(sim)); 417 goto bad; 418 } 419 --- 17 unchanged lines hidden --- |