xref: /freebsd/sys/cam/ctl/ctl_private.h (revision a0ee8cc6)
1 /*-
2  * Copyright (c) 2003, 2004, 2005, 2008 Silicon Graphics International Corp.
3  * Copyright (c) 2014-2015 Alexander Motin <mav@FreeBSD.org>
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions, and the following disclaimer,
11  *    without modification.
12  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
13  *    substantially similar to the "NO WARRANTY" disclaimer below
14  *    ("Disclaimer") and any redistribution must be conditioned upon
15  *    including a substantially similar Disclaimer requirement for further
16  *    binary redistribution.
17  *
18  * NO WARRANTY
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
22  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
28  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGES.
30  *
31  * $Id: //depot/users/kenm/FreeBSD-test2/sys/cam/ctl/ctl_private.h#7 $
32  * $FreeBSD$
33  */
34 /*
35  * CAM Target Layer driver private data structures/definitions.
36  *
37  * Author: Ken Merry <ken@FreeBSD.org>
38  */
39 
40 #ifndef	_CTL_PRIVATE_H_
41 #define	_CTL_PRIVATE_H_
42 
43 #include <cam/scsi/scsi_all.h>
44 #include <cam/scsi/scsi_cd.h>
45 #include <cam/scsi/scsi_da.h>
46 
47 /*
48  * SCSI vendor and product names.
49  */
50 #define	CTL_VENDOR		"FREEBSD "
51 #define	CTL_DIRECT_PRODUCT	"CTLDISK         "
52 #define	CTL_PROCESSOR_PRODUCT	"CTLPROCESSOR    "
53 #define	CTL_CDROM_PRODUCT	"CTLCDROM        "
54 #define	CTL_UNKNOWN_PRODUCT	"CTLDEVICE       "
55 
56 #define CTL_POOL_ENTRIES_OTHER_SC   200
57 
58 struct ctl_io_pool {
59 	char				name[64];
60 	uint32_t			id;
61 	struct ctl_softc		*ctl_softc;
62 	struct uma_zone			*zone;
63 };
64 
65 typedef enum {
66 	CTL_SER_BLOCK,
67 	CTL_SER_BLOCKOPT,
68 	CTL_SER_EXTENT,
69 	CTL_SER_EXTENTOPT,
70 	CTL_SER_EXTENTSEQ,
71 	CTL_SER_PASS,
72 	CTL_SER_SKIP
73 } ctl_serialize_action;
74 
75 typedef enum {
76 	CTL_ACTION_BLOCK,
77 	CTL_ACTION_OVERLAP,
78 	CTL_ACTION_OVERLAP_TAG,
79 	CTL_ACTION_PASS,
80 	CTL_ACTION_SKIP,
81 	CTL_ACTION_ERROR
82 } ctl_action;
83 
84 /*
85  * WARNING:  Keep the bottom nibble here free, we OR in the data direction
86  * flags for each command.
87  *
88  * Note:  "OK_ON_NO_LUN"   == we don't have to have a lun configured
89  *        "OK_ON_BOTH"     == we have to have a lun configured
90  *        "SA5"            == command has 5-bit service action at byte 1
91  */
92 typedef enum {
93 	CTL_CMD_FLAG_NONE		= 0x0000,
94 	CTL_CMD_FLAG_NO_SENSE		= 0x0010,
95 	CTL_CMD_FLAG_ALLOW_ON_RESV	= 0x0020,
96 	CTL_CMD_FLAG_ALLOW_ON_PR_RESV	= 0x0040,
97 	CTL_CMD_FLAG_ALLOW_ON_PR_WRESV	= 0x0080,
98 	CTL_CMD_FLAG_OK_ON_PROC		= 0x0100,
99 	CTL_CMD_FLAG_OK_ON_DIRECT	= 0x0200,
100 	CTL_CMD_FLAG_OK_ON_CDROM	= 0x0400,
101 	CTL_CMD_FLAG_OK_ON_BOTH		= 0x0700,
102 	CTL_CMD_FLAG_OK_ON_NO_LUN	= 0x0800,
103 	CTL_CMD_FLAG_OK_ON_NO_MEDIA	= 0x1000,
104 	CTL_CMD_FLAG_OK_ON_STANDBY	= 0x2000,
105 	CTL_CMD_FLAG_OK_ON_UNAVAIL	= 0x4000,
106 	CTL_CMD_FLAG_SA5		= 0x8000,
107 	CTL_CMD_FLAG_RUN_HERE		= 0x10000
108 } ctl_cmd_flags;
109 
110 typedef enum {
111 	CTL_SERIDX_TUR	= 0,
112 	CTL_SERIDX_READ,
113 	CTL_SERIDX_WRITE,
114 	CTL_SERIDX_UNMAP,
115 	CTL_SERIDX_SYNC,
116 	CTL_SERIDX_MD_SNS,
117 	CTL_SERIDX_MD_SEL,
118 	CTL_SERIDX_RQ_SNS,
119 	CTL_SERIDX_INQ,
120 	CTL_SERIDX_RD_CAP,
121 	CTL_SERIDX_RES,
122 	CTL_SERIDX_LOG_SNS,
123 	CTL_SERIDX_FORMAT,
124 	CTL_SERIDX_START,
125 	/* TBD: others to be filled in as needed */
126 	CTL_SERIDX_COUNT, /* LAST, not a normal code, provides # codes */
127 	CTL_SERIDX_INVLD = CTL_SERIDX_COUNT
128 } ctl_seridx;
129 
130 typedef int	ctl_opfunc(struct ctl_scsiio *ctsio);
131 
132 struct ctl_cmd_entry {
133 	ctl_opfunc		*execute;
134 	ctl_seridx		seridx;
135 	ctl_cmd_flags		flags;
136 	ctl_lun_error_pattern	pattern;
137 	uint8_t			length;		/* CDB length */
138 	uint8_t			usage[15];	/* Mask of allowed CDB bits
139 						 * after the opcode byte. */
140 };
141 
142 typedef enum {
143 	CTL_LUN_NONE		= 0x000,
144 	CTL_LUN_CONTROL		= 0x001,
145 	CTL_LUN_RESERVED	= 0x002,
146 	CTL_LUN_INVALID		= 0x004,
147 	CTL_LUN_DISABLED	= 0x008,
148 	CTL_LUN_MALLOCED	= 0x010,
149 	CTL_LUN_STOPPED		= 0x020,
150 	CTL_LUN_NO_MEDIA	= 0x040,
151 	CTL_LUN_EJECTED		= 0x080,
152 	CTL_LUN_PR_RESERVED	= 0x100,
153 	CTL_LUN_PRIMARY_SC	= 0x200,
154 	CTL_LUN_SENSE_DESC	= 0x400,
155 	CTL_LUN_READONLY	= 0x800,
156 	CTL_LUN_PEER_SC_PRIMARY	= 0x1000,
157 	CTL_LUN_REMOVABLE	= 0x2000
158 } ctl_lun_flags;
159 
160 typedef enum {
161 	CTLBLOCK_FLAG_NONE	= 0x00,
162 	CTLBLOCK_FLAG_INVALID	= 0x01
163 } ctlblock_flags;
164 
165 union ctl_softcs {
166 	struct ctl_softc	*ctl_softc;
167 	struct ctlblock_softc	*ctlblock_softc;
168 };
169 
170 /*
171  * Mode page defaults.
172  */
173 #if 0
174 /*
175  * These values make Solaris trim off some of the capacity.
176  */
177 #define	CTL_DEFAULT_SECTORS_PER_TRACK	63
178 #define	CTL_DEFAULT_HEADS		255
179 /*
180  * These values seem to work okay.
181  */
182 #define	CTL_DEFAULT_SECTORS_PER_TRACK	63
183 #define	CTL_DEFAULT_HEADS		16
184 /*
185  * These values work reasonably well.
186  */
187 #define	CTL_DEFAULT_SECTORS_PER_TRACK	512
188 #define	CTL_DEFAULT_HEADS		64
189 #endif
190 
191 /*
192  * Solaris is somewhat picky about how many heads and sectors per track you
193  * have defined in mode pages 3 and 4.  These values seem to cause Solaris
194  * to get the capacity more or less right when you run the format tool.
195  * They still have problems when dealing with devices larger than 1TB,
196  * but there isn't anything we can do about that.
197  *
198  * For smaller LUN sizes, this ends up causing the number of cylinders to
199  * work out to 0.  Solaris actually recognizes that and comes up with its
200  * own bogus geometry to fit the actual capacity of the drive.  They really
201  * should just give up on geometry and stick to the read capacity
202  * information alone for modern disk drives.
203  *
204  * One thing worth mentioning about Solaris' mkfs command is that it
205  * doesn't like sectors per track values larger than 256.  512 seems to
206  * work okay for format, but causes problems when you try to make a
207  * filesystem.
208  *
209  * Another caveat about these values:  the product of these two values
210  * really should be a power of 2.  This is because of the simplistic
211  * shift-based calculation that we have to use on the i386 platform to
212  * calculate the number of cylinders here.  (If you use a divide, you end
213  * up calling __udivdi3(), which is a hardware FP call on the PC.  On the
214  * XScale, it is done in software, so you can do that from inside the
215  * kernel.)
216  *
217  * So for the current values (256 S/T, 128 H), we get 32768, which works
218  * very nicely for calculating cylinders.
219  *
220  * If you want to change these values so that their product is no longer a
221  * power of 2, re-visit the calculation in ctl_init_page_index().  You may
222  * need to make it a bit more complicated to get the number of cylinders
223  * right.
224  */
225 #define	CTL_DEFAULT_SECTORS_PER_TRACK	256
226 #define	CTL_DEFAULT_HEADS		128
227 
228 #define	CTL_DEFAULT_ROTATION_RATE	SVPD_NON_ROTATING
229 
230 struct ctl_page_index;
231 
232 typedef int	ctl_modesen_handler(struct ctl_scsiio *ctsio,
233 				    struct ctl_page_index *page_index,
234 				    int pc);
235 typedef int	ctl_modesel_handler(struct ctl_scsiio *ctsio,
236 				    struct ctl_page_index *page_index,
237 				    uint8_t *page_ptr);
238 
239 typedef enum {
240 	CTL_PAGE_FLAG_NONE	 = 0x00,
241 	CTL_PAGE_FLAG_DIRECT	 = 0x01,
242 	CTL_PAGE_FLAG_PROC	 = 0x02,
243 	CTL_PAGE_FLAG_CDROM	 = 0x04,
244 	CTL_PAGE_FLAG_ALL	 = 0x07
245 } ctl_page_flags;
246 
247 struct ctl_page_index {
248 	uint8_t			page_code;
249 	uint8_t			subpage;
250 	uint16_t		page_len;
251 	uint8_t			*page_data;
252 	ctl_page_flags		page_flags;
253 	ctl_modesen_handler	*sense_handler;
254 	ctl_modesel_handler	*select_handler;
255 };
256 
257 #define	CTL_PAGE_CURRENT	0x00
258 #define	CTL_PAGE_CHANGEABLE	0x01
259 #define	CTL_PAGE_DEFAULT	0x02
260 #define	CTL_PAGE_SAVED		0x03
261 
262 #define CTL_NUM_LBP_PARAMS	4
263 #define CTL_NUM_LBP_THRESH	4
264 #define CTL_LBP_EXPONENT	11	/* 2048 sectors */
265 #define CTL_LBP_PERIOD		10	/* 10 seconds */
266 #define CTL_LBP_UA_PERIOD	300	/* 5 minutes */
267 
268 struct ctl_logical_block_provisioning_page {
269 	struct scsi_logical_block_provisioning_page	main;
270 	struct scsi_logical_block_provisioning_page_descr descr[CTL_NUM_LBP_THRESH];
271 };
272 
273 static const struct ctl_page_index page_index_template[] = {
274 	{SMS_RW_ERROR_RECOVERY_PAGE, 0, sizeof(struct scsi_da_rw_recovery_page), NULL,
275 	 CTL_PAGE_FLAG_DIRECT | CTL_PAGE_FLAG_CDROM, NULL, NULL},
276 	{SMS_FORMAT_DEVICE_PAGE, 0, sizeof(struct scsi_format_page), NULL,
277 	 CTL_PAGE_FLAG_DIRECT, NULL, NULL},
278 	{SMS_RIGID_DISK_PAGE, 0, sizeof(struct scsi_rigid_disk_page), NULL,
279 	 CTL_PAGE_FLAG_DIRECT, NULL, NULL},
280 	{SMS_CACHING_PAGE, 0, sizeof(struct scsi_caching_page), NULL,
281 	 CTL_PAGE_FLAG_DIRECT | CTL_PAGE_FLAG_CDROM,
282 	 NULL, ctl_caching_sp_handler},
283 	{SMS_CONTROL_MODE_PAGE, 0, sizeof(struct scsi_control_page), NULL,
284 	 CTL_PAGE_FLAG_ALL, NULL, ctl_control_page_handler},
285 	{SMS_CONTROL_MODE_PAGE | SMPH_SPF, 0x01,
286 	 sizeof(struct scsi_control_ext_page), NULL,
287 	 CTL_PAGE_FLAG_ALL, NULL, NULL},
288 	{SMS_INFO_EXCEPTIONS_PAGE, 0, sizeof(struct scsi_info_exceptions_page), NULL,
289 	 CTL_PAGE_FLAG_ALL, NULL, NULL},
290 	{SMS_INFO_EXCEPTIONS_PAGE | SMPH_SPF, 0x02,
291 	 sizeof(struct ctl_logical_block_provisioning_page), NULL,
292 	 CTL_PAGE_FLAG_DIRECT, NULL, NULL},
293 	{SMS_CDDVD_CAPS_PAGE, 0,
294 	 sizeof(struct scsi_cddvd_capabilities_page), NULL,
295 	 CTL_PAGE_FLAG_CDROM, NULL, NULL},
296 	{SMS_VENDOR_SPECIFIC_PAGE | SMPH_SPF, DBGCNF_SUBPAGE_CODE,
297 	 sizeof(struct copan_debugconf_subpage), NULL, CTL_PAGE_FLAG_ALL,
298 	 ctl_debugconf_sp_sense_handler, ctl_debugconf_sp_select_handler},
299 };
300 
301 #define	CTL_NUM_MODE_PAGES sizeof(page_index_template)/   \
302 			   sizeof(page_index_template[0])
303 
304 struct ctl_mode_pages {
305 	struct scsi_da_rw_recovery_page	rw_er_page[4];
306 	struct scsi_format_page		format_page[4];
307 	struct scsi_rigid_disk_page	rigid_disk_page[4];
308 	struct scsi_caching_page	caching_page[4];
309 	struct scsi_control_page	control_page[4];
310 	struct scsi_control_ext_page	control_ext_page[4];
311 	struct scsi_info_exceptions_page ie_page[4];
312 	struct ctl_logical_block_provisioning_page lbp_page[4];
313 	struct scsi_cddvd_capabilities_page cddvd_page[4];
314 	struct copan_debugconf_subpage	debugconf_subpage[4];
315 	struct ctl_page_index		index[CTL_NUM_MODE_PAGES];
316 };
317 
318 static const struct ctl_page_index log_page_index_template[] = {
319 	{SLS_SUPPORTED_PAGES_PAGE, 0, 0, NULL,
320 	 CTL_PAGE_FLAG_ALL, NULL, NULL},
321 	{SLS_SUPPORTED_PAGES_PAGE, SLS_SUPPORTED_SUBPAGES_SUBPAGE, 0, NULL,
322 	 CTL_PAGE_FLAG_ALL, NULL, NULL},
323 	{SLS_LOGICAL_BLOCK_PROVISIONING, 0, 0, NULL,
324 	 CTL_PAGE_FLAG_DIRECT, ctl_lbp_log_sense_handler, NULL},
325 	{SLS_STAT_AND_PERF, 0, 0, NULL,
326 	 CTL_PAGE_FLAG_ALL, ctl_sap_log_sense_handler, NULL},
327 };
328 
329 #define	CTL_NUM_LOG_PAGES sizeof(log_page_index_template)/   \
330 			  sizeof(log_page_index_template[0])
331 
332 struct ctl_log_pages {
333 	uint8_t				pages_page[CTL_NUM_LOG_PAGES];
334 	uint8_t				subpages_page[CTL_NUM_LOG_PAGES * 2];
335 	uint8_t				lbp_page[12*CTL_NUM_LBP_PARAMS];
336 	struct stat_page {
337 		struct scsi_log_stat_and_perf sap;
338 		struct scsi_log_idle_time it;
339 		struct scsi_log_time_interval ti;
340 	} stat_page;
341 	struct ctl_page_index		index[CTL_NUM_LOG_PAGES];
342 };
343 
344 struct ctl_lun_delay_info {
345 	ctl_delay_type		datamove_type;
346 	uint32_t		datamove_delay;
347 	ctl_delay_type		done_type;
348 	uint32_t		done_delay;
349 };
350 
351 #define CTL_PR_ALL_REGISTRANTS  0xFFFFFFFF
352 #define CTL_PR_NO_RESERVATION   0xFFFFFFF0
353 
354 struct ctl_devid {
355 	int		len;
356 	uint8_t		data[];
357 };
358 
359 #define NUM_HA_SHELVES		2
360 
361 #define CTL_WRITE_BUFFER_SIZE	262144
362 
363 struct tpc_list;
364 struct ctl_lun {
365 	struct mtx			lun_lock;
366 	uint64_t			lun;
367 	ctl_lun_flags			flags;
368 	STAILQ_HEAD(,ctl_error_desc)	error_list;
369 	uint64_t			error_serial;
370 	struct ctl_softc		*ctl_softc;
371 	struct ctl_be_lun		*be_lun;
372 	struct ctl_backend_driver	*backend;
373 	struct ctl_lun_delay_info	delay_info;
374 #ifdef CTL_TIME_IO
375 	sbintime_t			idle_time;
376 	sbintime_t			last_busy;
377 #endif
378 	TAILQ_HEAD(ctl_ooaq, ctl_io_hdr)  ooa_queue;
379 	TAILQ_HEAD(ctl_blockq,ctl_io_hdr) blocked_queue;
380 	STAILQ_ENTRY(ctl_lun)		links;
381 #ifdef CTL_WITH_CA
382 	uint32_t			have_ca[CTL_MAX_INITIATORS >> 5];
383 	struct scsi_sense_data		pending_sense[CTL_MAX_INITIATORS];
384 #endif
385 	ctl_ua_type			*pending_ua[CTL_MAX_PORTS];
386 	uint8_t				ua_tpt_info[8];
387 	time_t				lasttpt;
388 	struct ctl_mode_pages		mode_pages;
389 	struct ctl_log_pages		log_pages;
390 	struct ctl_lun_io_stats		stats;
391 	uint32_t			res_idx;
392 	uint32_t			pr_generation;
393 	uint64_t			*pr_keys[CTL_MAX_PORTS];
394 	int				pr_key_count;
395 	uint32_t			pr_res_idx;
396 	uint8_t				pr_res_type;
397 	int				prevent_count;
398 	uint32_t			prevent[(CTL_MAX_INITIATORS+31)/32];
399 	uint8_t				*write_buffer;
400 	struct ctl_devid		*lun_devid;
401 	TAILQ_HEAD(tpc_lists, tpc_list) tpc_lists;
402 };
403 
404 typedef enum {
405 	CTL_FLAG_ACTIVE_SHELF	= 0x04
406 } ctl_gen_flags;
407 
408 #define CTL_MAX_THREADS		16
409 
410 struct ctl_thread {
411 	struct mtx_padalign queue_lock;
412 	struct ctl_softc	*ctl_softc;
413 	struct thread		*thread;
414 	STAILQ_HEAD(, ctl_io_hdr) incoming_queue;
415 	STAILQ_HEAD(, ctl_io_hdr) rtr_queue;
416 	STAILQ_HEAD(, ctl_io_hdr) done_queue;
417 	STAILQ_HEAD(, ctl_io_hdr) isc_queue;
418 };
419 
420 struct tpc_token;
421 struct ctl_softc {
422 	struct mtx ctl_lock;
423 	struct cdev *dev;
424 	int num_luns;
425 	ctl_gen_flags flags;
426 	ctl_ha_mode ha_mode;
427 	int ha_id;
428 	int is_single;
429 	ctl_ha_link_state ha_link;
430 	int port_min;
431 	int port_max;
432 	int port_cnt;
433 	int init_min;
434 	int init_max;
435 	struct sysctl_ctx_list sysctl_ctx;
436 	struct sysctl_oid *sysctl_tree;
437 	void *othersc_pool;
438 	struct proc *ctl_proc;
439 	uint32_t ctl_lun_mask[(CTL_MAX_LUNS + 31) / 32];
440 	struct ctl_lun *ctl_luns[CTL_MAX_LUNS];
441 	uint32_t ctl_port_mask[(CTL_MAX_PORTS + 31) / 32];
442 	STAILQ_HEAD(, ctl_lun) lun_list;
443 	STAILQ_HEAD(, ctl_be_lun) pending_lun_queue;
444 	uint32_t num_frontends;
445 	STAILQ_HEAD(, ctl_frontend) fe_list;
446 	uint32_t num_ports;
447 	STAILQ_HEAD(, ctl_port) port_list;
448 	struct ctl_port *ctl_ports[CTL_MAX_PORTS];
449 	uint32_t num_backends;
450 	STAILQ_HEAD(, ctl_backend_driver) be_list;
451 	struct uma_zone *io_zone;
452 	uint32_t cur_pool_id;
453 	struct ctl_thread threads[CTL_MAX_THREADS];
454 	TAILQ_HEAD(tpc_tokens, tpc_token) tpc_tokens;
455 	struct callout tpc_timeout;
456 	struct mtx tpc_lock;
457 };
458 
459 #ifdef _KERNEL
460 
461 extern const struct ctl_cmd_entry ctl_cmd_table[256];
462 
463 uint32_t ctl_get_initindex(struct ctl_nexus *nexus);
464 int ctl_lun_map_init(struct ctl_port *port);
465 int ctl_lun_map_deinit(struct ctl_port *port);
466 int ctl_lun_map_set(struct ctl_port *port, uint32_t plun, uint32_t glun);
467 int ctl_lun_map_unset(struct ctl_port *port, uint32_t plun);
468 uint32_t ctl_lun_map_from_port(struct ctl_port *port, uint32_t plun);
469 uint32_t ctl_lun_map_to_port(struct ctl_port *port, uint32_t glun);
470 int ctl_pool_create(struct ctl_softc *ctl_softc, const char *pool_name,
471 		    uint32_t total_ctl_io, void **npool);
472 void ctl_pool_free(struct ctl_io_pool *pool);
473 int ctl_scsi_release(struct ctl_scsiio *ctsio);
474 int ctl_scsi_reserve(struct ctl_scsiio *ctsio);
475 int ctl_start_stop(struct ctl_scsiio *ctsio);
476 int ctl_prevent_allow(struct ctl_scsiio *ctsio);
477 int ctl_sync_cache(struct ctl_scsiio *ctsio);
478 int ctl_format(struct ctl_scsiio *ctsio);
479 int ctl_read_buffer(struct ctl_scsiio *ctsio);
480 int ctl_write_buffer(struct ctl_scsiio *ctsio);
481 int ctl_write_same(struct ctl_scsiio *ctsio);
482 int ctl_unmap(struct ctl_scsiio *ctsio);
483 int ctl_mode_select(struct ctl_scsiio *ctsio);
484 int ctl_mode_sense(struct ctl_scsiio *ctsio);
485 int ctl_log_sense(struct ctl_scsiio *ctsio);
486 int ctl_read_capacity(struct ctl_scsiio *ctsio);
487 int ctl_read_capacity_16(struct ctl_scsiio *ctsio);
488 int ctl_read_defect(struct ctl_scsiio *ctsio);
489 int ctl_read_toc(struct ctl_scsiio *ctsio);
490 int ctl_read_write(struct ctl_scsiio *ctsio);
491 int ctl_cnw(struct ctl_scsiio *ctsio);
492 int ctl_report_luns(struct ctl_scsiio *ctsio);
493 int ctl_request_sense(struct ctl_scsiio *ctsio);
494 int ctl_tur(struct ctl_scsiio *ctsio);
495 int ctl_verify(struct ctl_scsiio *ctsio);
496 int ctl_inquiry(struct ctl_scsiio *ctsio);
497 int ctl_get_config(struct ctl_scsiio *ctsio);
498 int ctl_get_event_status(struct ctl_scsiio *ctsio);
499 int ctl_mechanism_status(struct ctl_scsiio *ctsio);
500 int ctl_persistent_reserve_in(struct ctl_scsiio *ctsio);
501 int ctl_persistent_reserve_out(struct ctl_scsiio *ctsio);
502 int ctl_report_tagret_port_groups(struct ctl_scsiio *ctsio);
503 int ctl_report_supported_opcodes(struct ctl_scsiio *ctsio);
504 int ctl_report_supported_tmf(struct ctl_scsiio *ctsio);
505 int ctl_report_timestamp(struct ctl_scsiio *ctsio);
506 int ctl_get_lba_status(struct ctl_scsiio *ctsio);
507 
508 void ctl_tpc_init(struct ctl_softc *softc);
509 void ctl_tpc_shutdown(struct ctl_softc *softc);
510 void ctl_tpc_lun_init(struct ctl_lun *lun);
511 void ctl_tpc_lun_shutdown(struct ctl_lun *lun);
512 int ctl_inquiry_evpd_tpc(struct ctl_scsiio *ctsio, int alloc_len);
513 int ctl_receive_copy_status_lid1(struct ctl_scsiio *ctsio);
514 int ctl_receive_copy_failure_details(struct ctl_scsiio *ctsio);
515 int ctl_receive_copy_status_lid4(struct ctl_scsiio *ctsio);
516 int ctl_receive_copy_operating_parameters(struct ctl_scsiio *ctsio);
517 int ctl_extended_copy_lid1(struct ctl_scsiio *ctsio);
518 int ctl_extended_copy_lid4(struct ctl_scsiio *ctsio);
519 int ctl_copy_operation_abort(struct ctl_scsiio *ctsio);
520 int ctl_populate_token(struct ctl_scsiio *ctsio);
521 int ctl_write_using_token(struct ctl_scsiio *ctsio);
522 int ctl_receive_rod_token_information(struct ctl_scsiio *ctsio);
523 int ctl_report_all_rod_tokens(struct ctl_scsiio *ctsio);
524 
525 #endif	/* _KERNEL */
526 
527 #endif	/* _CTL_PRIVATE_H_ */
528 
529 /*
530  * vim: ts=8
531  */
532