scsi_target.c (3b8f08459569bf0faa21473e5cec2491e95c9349) scsi_target.c (de2393124c0053d832da9e6de0f675e888ed61c7)
1/*-
2 * Generic SCSI Target Kernel Mode Driver
3 *
4 * Copyright (c) 2002 Nate Lawson.
5 * Copyright (c) 1998, 1999, 2001, 2002 Justin T. Gibbs.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 80 unchanged lines hidden (view full) ---

89 * Queue of CCBs that have been copied out to userland, but our
90 * userland daemon has not yet seen.
91 */
92 struct ccb_queue user_ccb_queue;
93
94 struct cam_periph *periph;
95 struct cam_path *path;
96 targ_state state;
1/*-
2 * Generic SCSI Target Kernel Mode Driver
3 *
4 * Copyright (c) 2002 Nate Lawson.
5 * Copyright (c) 1998, 1999, 2001, 2002 Justin T. Gibbs.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 80 unchanged lines hidden (view full) ---

89 * Queue of CCBs that have been copied out to userland, but our
90 * userland daemon has not yet seen.
91 */
92 struct ccb_queue user_ccb_queue;
93
94 struct cam_periph *periph;
95 struct cam_path *path;
96 targ_state state;
97 u_int maxio;
97 struct selinfo read_select;
98 struct devstat device_stats;
99};
100
101static d_open_t targopen;
102static d_read_t targread;
103static d_write_t targwrite;
104static d_ioctl_t targioctl;

--- 293 unchanged lines hidden (view full) ---

398 printf("pathinq failed, status %#x\n", status);
399 goto enable_fail;
400 }
401 if ((cpi.target_sprt & PIT_PROCESSOR) == 0) {
402 printf("controller does not support target mode\n");
403 status = CAM_FUNC_NOTAVAIL;
404 goto enable_fail;
405 }
98 struct selinfo read_select;
99 struct devstat device_stats;
100};
101
102static d_open_t targopen;
103static d_read_t targread;
104static d_write_t targwrite;
105static d_ioctl_t targioctl;

--- 293 unchanged lines hidden (view full) ---

399 printf("pathinq failed, status %#x\n", status);
400 goto enable_fail;
401 }
402 if ((cpi.target_sprt & PIT_PROCESSOR) == 0) {
403 printf("controller does not support target mode\n");
404 status = CAM_FUNC_NOTAVAIL;
405 goto enable_fail;
406 }
407 if (cpi.maxio == 0)
408 softc->maxio = DFLTPHYS; /* traditional default */
409 else if (cpi.maxio > MAXPHYS)
410 softc->maxio = MAXPHYS; /* for safety */
411 else
412 softc->maxio = cpi.maxio; /* real value */
406
407 /* Destroy any periph on our path if it is disabled */
408 periph = cam_periph_find(path, "targ");
409 if (periph != NULL) {
410 struct targ_softc *del_softc;
411
412 del_softc = (struct targ_softc *)periph->softc;
413 if ((del_softc->state & TARG_STATE_LUN_ENABLED) == 0) {

--- 306 unchanged lines hidden (view full) ---

720 * can find our mapping info.
721 */
722 ccb_h->cbfcnp = targdone;
723 ccb_h->targ_descr = descr;
724
725 if ((ccb_h->func_code == XPT_CONT_TARGET_IO) ||
726 (ccb_h->func_code == XPT_DEV_MATCH)) {
727
413
414 /* Destroy any periph on our path if it is disabled */
415 periph = cam_periph_find(path, "targ");
416 if (periph != NULL) {
417 struct targ_softc *del_softc;
418
419 del_softc = (struct targ_softc *)periph->softc;
420 if ((del_softc->state & TARG_STATE_LUN_ENABLED) == 0) {

--- 306 unchanged lines hidden (view full) ---

727 * can find our mapping info.
728 */
729 ccb_h->cbfcnp = targdone;
730 ccb_h->targ_descr = descr;
731
732 if ((ccb_h->func_code == XPT_CONT_TARGET_IO) ||
733 (ccb_h->func_code == XPT_DEV_MATCH)) {
734
728 error = cam_periph_mapmem(ccb, mapinfo);
735 error = cam_periph_mapmem(ccb, mapinfo, softc->maxio);
729
730 /*
731 * cam_periph_mapmem returned an error, we can't continue.
732 * Return the error to the user.
733 */
734 if (error) {
735 ccb_h->status = CAM_REQ_CMP_ERR;
736 mapinfo->num_bufs_used = 0;

--- 418 unchanged lines hidden ---
736
737 /*
738 * cam_periph_mapmem returned an error, we can't continue.
739 * Return the error to the user.
740 */
741 if (error) {
742 ccb_h->status = CAM_REQ_CMP_ERR;
743 mapinfo->num_bufs_used = 0;

--- 418 unchanged lines hidden ---