Deleted Added
full compact
scsi_targetio.h (80576) scsi_targetio.h (107178)
1/*
1/*
2 * Ioctl definitions for the Target Mode SCSI Proccessor Target driver for CAM.
2 * Ioctl definitions for the SCSI Target Driver
3 *
3 *
4 * Copyright (c) 2002 Nate Lawson.
4 * Copyright (c) 1998 Justin T. Gibbs.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions, and the following disclaimer,

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

20 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
5 * Copyright (c) 1998 Justin T. Gibbs.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions, and the following disclaimer,

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

21 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
28 * $FreeBSD: head/sys/cam/scsi/scsi_targetio.h 80576 2001-07-30 00:27:54Z mjacob $
29 * $FreeBSD: head/sys/cam/scsi/scsi_targetio.h 107178 2002-11-22 22:55:51Z njl $
29 */
30
31#ifndef _CAM_SCSI_SCSI_TARGETIO_H_
32#define _CAM_SCSI_SCSI_TARGETIO_H_
33#ifndef _KERNEL
34#include <sys/types.h>
35#endif
36#include <sys/ioccom.h>
37
38#include <cam/cam.h>
39#include <cam/cam_ccb.h>
40
30 */
31
32#ifndef _CAM_SCSI_SCSI_TARGETIO_H_
33#define _CAM_SCSI_SCSI_TARGETIO_H_
34#ifndef _KERNEL
35#include <sys/types.h>
36#endif
37#include <sys/ioccom.h>
38
39#include <cam/cam.h>
40#include <cam/cam_ccb.h>
41
41TAILQ_HEAD(ccb_queue, ccb_hdr);
42
43/* Determine and clear exception state in the driver */
44typedef enum {
45 TARG_EXCEPT_NONE = 0x00,
46 TARG_EXCEPT_DEVICE_INVALID = 0x01,
47 TARG_EXCEPT_BDR_RECEIVED = 0x02,
48 TARG_EXCEPT_BUS_RESET_SEEN = 0x04,
49 TARG_EXCEPT_ABORT_SEEN = 0x08,
50 TARG_EXCEPT_ABORT_TAG_SEEN = 0x10,
51 TARG_EXCEPT_UNKNOWN_ATIO = 0x80
52} targ_exception;
53
54#define TARGIOCFETCHEXCEPTION _IOR('C', 1, targ_exception)
55#define TARGIOCCLEAREXCEPTION _IOW('C', 2, targ_exception)
56
57/*
42/*
58 * Retreive an Accept Target I/O CCB for a command that is not handled
59 * directly by the kernel target driver.
43 * CCBs (ATIO, CTIO, INOT, REL_SIMQ) are sent to the kernel driver
44 * by writing one or more pointers. The user receives notification
45 * of CCB completion through poll/select/kqueue and then calls
46 * read(2) which outputs pointers to the completed CCBs.
60 */
47 */
61#define TARGIOCFETCHATIO _IOR('C', 3, struct ccb_accept_tio)
62
63/*
48
49/*
64 * Used for responding to incoming ATIO requests. XPT_CONTINUE_TARG_IO
65 * operations are the norm, but ccb types for manipulating the device
66 * queue, etc. can also be used if error handling is to be performed by the
67 * user land process.
50 * Enable and disable a target mode instance. For enabling, the path_id,
51 * target_id, and lun_id fields must be set. The grp6/7_len fields
52 * specify the length of vendor-specific CDBs the target expects and
53 * should normally be set to 0. On successful completion
54 * of enable, the specified target instance will answer selection.
55 * Disable causes the target instance to abort any outstanding commands
56 * and stop accepting new ones. The aborted CCBs will be returned to
57 * the user via read(2) or discarded if the user closes the device.
58 * The user can then re-enable the device for a new path.
68 */
59 */
69#define TARGIOCCOMMAND _IOWR('C', 4, union ccb)
70
71
72typedef enum {
73 UA_NONE = 0x00,
74 UA_POWER_ON = 0x01,
75 UA_BUS_RESET = 0x02,
76 UA_BDR = 0x04
77} ua_types;
78
79typedef enum {
80 CA_NONE = 0x00,
81 CA_UNIT_ATTN = 0x01,
82 CA_CMD_SENSE = 0x02
83} ca_types;
84
85struct initiator_state {
86 ua_types pending_ua;
87 ca_types pending_ca;
88 struct scsi_sense_data sense_data;
89 struct ccb_queue held_queue;
90};
91
92struct ioc_initiator_state {
93 u_int initiator_id;
94 struct initiator_state istate;
95};
96
97/*
98 * Get and Set Contingent Allegiance and Unit Attention state
99 * presented by the target driver. This is usually used to
100 * properly report and error condition in response to an incoming
101 * ATIO request handled by the userland process.
102 *
103 * The initiator_id must be properly initialized in the ioc_initiator_state
104 * structure before calling TARGIOCGETISTATE.
105 */
106#define TARGIOCGETISTATE _IOWR('C', 6, struct ioc_initiator_state)
107#define TARGIOCSETISTATE _IOW('C', 5, struct ioc_initiator_state)
108
109struct old_ioc_alloc_unit {
60struct ioc_enable_lun {
110 path_id_t path_id;
111 target_id_t target_id;
112 lun_id_t lun_id;
61 path_id_t path_id;
62 target_id_t target_id;
63 lun_id_t lun_id;
113 u_int unit;
64 int grp6_len;
65 int grp7_len;
114};
66};
67#define TARGIOCENABLE _IOW('C', 5, struct ioc_enable_lun)
68#define TARGIOCDISABLE _IO('C', 6)
115
69
116struct ioc_alloc_unit {
117 path_id_t path_id;
118 target_id_t target_id;
119 lun_id_t lun_id;
120 u_int unit;
121 struct scsi_inquiry_data *inquiry_data;
122};
123
124/*
70/*
125 * Allocate and Free a target mode instance. For allocation, the path_id,
126 * target_id, and lun_id fields must be set. On successful completion
127 * of the ioctl, the unit field will indicate the unit number of the
128 * newly created instance. For de-allocation, all fields must match
129 * an instance in the inactive (i.e. closed) state.
130 */
131#define OTARGCTLIOALLOCUNIT _IOWR('C', 7, struct old_ioc_alloc_unit)
132#define OTARGCTLIOFREEUNIT _IOW('C', 8, struct old_ioc_alloc_unit)
133#define TARGCTLIOALLOCUNIT _IOWR('C', 7, struct ioc_alloc_unit)
134#define TARGCTLIOFREEUNIT _IOW('C', 8, struct ioc_alloc_unit)
135
136/*
137 * Set/clear debugging for this target mode instance
138 */
71 * Set/clear debugging for this target mode instance
72 */
139#define TARGIODEBUG _IOW('C', 9, int)
73#define TARGIOCDEBUG _IOW('C', 7, int)
140
74
75TAILQ_HEAD(ccb_queue, ccb_hdr);
76
141#endif /* _CAM_SCSI_SCSI_TARGETIO_H_ */
77#endif /* _CAM_SCSI_SCSI_TARGETIO_H_ */