186d7f5d3SJohn Marino /* 286d7f5d3SJohn Marino * Ioctl definitions for the SCSI Target Driver 386d7f5d3SJohn Marino * 486d7f5d3SJohn Marino * Copyright (c) 2002 Nate Lawson. 586d7f5d3SJohn Marino * Copyright (c) 1998 Justin T. Gibbs. 686d7f5d3SJohn Marino * All rights reserved. 786d7f5d3SJohn Marino * 886d7f5d3SJohn Marino * Redistribution and use in source and binary forms, with or without 986d7f5d3SJohn Marino * modification, are permitted provided that the following conditions 1086d7f5d3SJohn Marino * are met: 1186d7f5d3SJohn Marino * 1. Redistributions of source code must retain the above copyright 1286d7f5d3SJohn Marino * notice, this list of conditions, and the following disclaimer, 1386d7f5d3SJohn Marino * without modification, immediately at the beginning of the file. 1486d7f5d3SJohn Marino * 2. The name of the author may not be used to endorse or promote products 1586d7f5d3SJohn Marino * derived from this software without specific prior written permission. 1686d7f5d3SJohn Marino * 1786d7f5d3SJohn Marino * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1886d7f5d3SJohn Marino * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1986d7f5d3SJohn Marino * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2086d7f5d3SJohn Marino * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 2186d7f5d3SJohn Marino * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2286d7f5d3SJohn Marino * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2386d7f5d3SJohn Marino * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2486d7f5d3SJohn Marino * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2586d7f5d3SJohn Marino * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2686d7f5d3SJohn Marino * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2786d7f5d3SJohn Marino * SUCH DAMAGE. 2886d7f5d3SJohn Marino * 2986d7f5d3SJohn Marino * $FreeBSD: src/sys/cam/scsi/scsi_targetio.h,v 1.5.2.3 2003/02/18 22:07:10 njl Exp $ 3086d7f5d3SJohn Marino * $DragonFly: src/sys/bus/cam/scsi/scsi_targetio.h,v 1.3 2003/08/07 21:16:45 dillon Exp $ 3186d7f5d3SJohn Marino */ 3286d7f5d3SJohn Marino 3386d7f5d3SJohn Marino #ifndef _CAM_SCSI_SCSI_TARGETIO_H_ 3486d7f5d3SJohn Marino #define _CAM_SCSI_SCSI_TARGETIO_H_ 3586d7f5d3SJohn Marino #ifndef _KERNEL 3686d7f5d3SJohn Marino #include <sys/types.h> 3786d7f5d3SJohn Marino #endif 3886d7f5d3SJohn Marino #include <sys/ioccom.h> 3986d7f5d3SJohn Marino 4086d7f5d3SJohn Marino #include "../cam.h" 4186d7f5d3SJohn Marino #include "../cam_ccb.h" 4286d7f5d3SJohn Marino 4386d7f5d3SJohn Marino /* 4486d7f5d3SJohn Marino * CCBs (ATIO, CTIO, INOT, REL_SIMQ) are sent to the kernel driver 4586d7f5d3SJohn Marino * by writing one or more pointers. The user receives notification 4686d7f5d3SJohn Marino * of CCB completion through poll/select/kqueue and then calls 4786d7f5d3SJohn Marino * read(2) which outputs pointers to the completed CCBs. 4886d7f5d3SJohn Marino */ 4986d7f5d3SJohn Marino 5086d7f5d3SJohn Marino /* 5186d7f5d3SJohn Marino * Enable and disable a target mode instance. For enabling, the path_id, 5286d7f5d3SJohn Marino * target_id, and lun_id fields must be set. The grp6/7_len fields 5386d7f5d3SJohn Marino * specify the length of vendor-specific CDBs the target expects and 5486d7f5d3SJohn Marino * should normally be set to 0. On successful completion 5586d7f5d3SJohn Marino * of enable, the specified target instance will answer selection. 5686d7f5d3SJohn Marino * Disable causes the target instance to abort any outstanding commands 5786d7f5d3SJohn Marino * and stop accepting new ones. The aborted CCBs will be returned to 5886d7f5d3SJohn Marino * the user via read(2) or discarded if the user closes the device. 5986d7f5d3SJohn Marino * The user can then re-enable the device for a new path. 6086d7f5d3SJohn Marino */ 6186d7f5d3SJohn Marino struct ioc_enable_lun { 6286d7f5d3SJohn Marino path_id_t path_id; 6386d7f5d3SJohn Marino target_id_t target_id; 6486d7f5d3SJohn Marino lun_id_t lun_id; 6586d7f5d3SJohn Marino int grp6_len; 6686d7f5d3SJohn Marino int grp7_len; 6786d7f5d3SJohn Marino }; 6886d7f5d3SJohn Marino #define TARGIOCENABLE _IOW('C', 5, struct ioc_enable_lun) 6986d7f5d3SJohn Marino #define TARGIOCDISABLE _IO('C', 6) 7086d7f5d3SJohn Marino 7186d7f5d3SJohn Marino /* 7286d7f5d3SJohn Marino * Set/clear debugging for this target mode instance 7386d7f5d3SJohn Marino */ 7486d7f5d3SJohn Marino #define TARGIOCDEBUG _IOW('C', 7, int) 7586d7f5d3SJohn Marino 7686d7f5d3SJohn Marino TAILQ_HEAD(ccb_queue, ccb_hdr); 7786d7f5d3SJohn Marino 7886d7f5d3SJohn Marino #endif /* _CAM_SCSI_SCSI_TARGETIO_H_ */ 79