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