1/*- |
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> |
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 |
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 |
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 } |
301 if(_scsi_encap(sim, ccb) != 0) |
302 return; |
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); |
407 if(xpt_bus_register(sim, 408#if __FreeBSD_version >= 700000 409 NULL, 410#endif 411 0/*bus_number*/) != CAM_SUCCESS) |
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 --- |