xref: /freebsd/sys/cam/ctl/ctl_io.h (revision 5c831a5bd61576cacb48b39f8eeb47b92707a355)
1 /*-
2  * Copyright (c) 2003 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_io.h#5 $
32  * $FreeBSD$
33  */
34 /*
35  * CAM Target Layer data movement structures/interface.
36  *
37  * Author: Ken Merry <ken@FreeBSD.org>
38  */
39 
40 #ifndef	_CTL_IO_H_
41 #define	_CTL_IO_H_
42 
43 #define	CTL_MAX_CDBLEN	32
44 /*
45  * Uncomment this next line to enable printing out times for I/Os
46  * that take longer than CTL_TIME_IO_SECS seconds to get to the datamove
47  * and/or done stage.
48  */
49 #define	CTL_TIME_IO
50 #ifdef  CTL_TIME_IO
51 #define	CTL_TIME_IO_DEFAULT_SECS	90
52 #endif
53 
54 /*
55  * Uncomment this next line to enable the CTL I/O delay feature.  You
56  * can delay I/O at two different points -- datamove and done.  This is
57  * useful for diagnosing abort conditions (for hosts that send an abort on a
58  * timeout), and for determining how long a host's timeout is.
59  */
60 //#define	CTL_IO_DELAY
61 
62 typedef enum {
63 	CTL_STATUS_NONE,	/* No status */
64 	CTL_SUCCESS,		/* Transaction completed successfully */
65 	CTL_CMD_TIMEOUT,	/* Command timed out, shouldn't happen here */
66 	CTL_SEL_TIMEOUT,	/* Selection timeout, shouldn't happen here */
67 	CTL_ERROR,		/* General CTL error XXX expand on this? */
68 	CTL_SCSI_ERROR,		/* SCSI error, look at status byte/sense data */
69 	CTL_CMD_ABORTED,	/* Command aborted, don't return status */
70 	CTL_STATUS_MASK = 0xfff,/* Mask off any status flags */
71 	CTL_AUTOSENSE = 0x1000	/* Autosense performed */
72 } ctl_io_status;
73 
74 /*
75  * WARNING:  Keep the data in/out/none flags where they are.  They're used
76  * in conjunction with ctl_cmd_flags.  See comment above ctl_cmd_flags
77  * definition in ctl_private.h.
78  */
79 typedef enum {
80 	CTL_FLAG_NONE		= 0x00000000,	/* no flags */
81 	CTL_FLAG_DATA_IN	= 0x00000001,	/* DATA IN */
82 	CTL_FLAG_DATA_OUT	= 0x00000002,	/* DATA OUT */
83 	CTL_FLAG_DATA_NONE	= 0x00000003,	/* no data */
84 	CTL_FLAG_DATA_MASK	= 0x00000003,
85 	CTL_FLAG_DO_AUTOSENSE	= 0x00000020,	/* grab sense info */
86 	CTL_FLAG_USER_REQ	= 0x00000040,	/* request came from userland */
87 	CTL_FLAG_ALLOCATED	= 0x00000100,	/* data space allocated */
88 	CTL_FLAG_BLOCKED	= 0x00000200,	/* on the blocked queue */
89 	CTL_FLAG_ABORT_STATUS	= 0x00000400,	/* return TASK ABORTED status */
90 	CTL_FLAG_ABORT		= 0x00000800,	/* this I/O should be aborted */
91 	CTL_FLAG_DMA_INPROG	= 0x00001000,	/* DMA in progress */
92 	CTL_FLAG_DELAY_DONE	= 0x00004000,	/* delay injection done */
93 	CTL_FLAG_INT_COPY	= 0x00008000,	/* internal copy, no done call*/
94 	CTL_FLAG_SENT_2OTHER_SC	= 0x00010000,
95 	CTL_FLAG_FROM_OTHER_SC	= 0x00020000,
96 	CTL_FLAG_IS_WAS_ON_RTR  = 0x00040000,	/* Don't rerun cmd on failover*/
97 	CTL_FLAG_BUS_ADDR	= 0x00080000,	/* ctl_sglist contains BUS
98 						   addresses, not virtual ones*/
99 	CTL_FLAG_IO_CONT	= 0x00100000,	/* Continue I/O instead of
100 						   completing */
101 #if 0
102 	CTL_FLAG_ALREADY_DONE	= 0x00200000	/* I/O already completed */
103 #endif
104 	CTL_FLAG_NO_DATAMOVE	= 0x00400000,
105 	CTL_FLAG_DMA_QUEUED	= 0x00800000,	/* DMA queued but not started*/
106 	CTL_FLAG_STATUS_QUEUED	= 0x01000000,	/* Status queued but not sent*/
107 
108 	CTL_FLAG_FAILOVER	= 0x04000000,	/* Killed by a failover */
109 	CTL_FLAG_IO_ACTIVE	= 0x08000000,	/* I/O active on this SC */
110 	CTL_FLAG_STATUS_SENT	= 0x10000000,	/* Status sent by datamove */
111 	CTL_FLAG_SERSEQ_DONE	= 0x20000000	/* All storage I/O started */
112 } ctl_io_flags;
113 
114 
115 struct ctl_lba_len {
116 	uint64_t lba;
117 	uint32_t len;
118 };
119 
120 struct ctl_lba_len_flags {
121 	uint64_t lba;
122 	uint32_t len;
123 	uint32_t flags;
124 #define CTL_LLF_FUA	0x04000000
125 #define CTL_LLF_DPO	0x08000000
126 #define CTL_LLF_READ	0x10000000
127 #define CTL_LLF_WRITE	0x20000000
128 #define CTL_LLF_VERIFY	0x40000000
129 #define CTL_LLF_COMPARE	0x80000000
130 };
131 
132 struct ctl_ptr_len_flags {
133 	uint8_t		*ptr;
134 	uint32_t	len;
135 	uint32_t	flags;
136 };
137 
138 union ctl_priv {
139 	uint8_t		bytes[sizeof(uint64_t) * 2];
140 	uint64_t	integer;
141 	uint64_t	integers[2];
142 	void		*ptr;
143 	void		*ptrs[2];
144 };
145 
146 /*
147  * Number of CTL private areas.
148  */
149 #define	CTL_NUM_PRIV	6
150 
151 /*
152  * Which private area are we using for a particular piece of data?
153  */
154 #define	CTL_PRIV_LUN		0	/* CTL LUN pointer goes here */
155 #define	CTL_PRIV_LBA_LEN	1	/* Decoded LBA/len for read/write*/
156 #define	CTL_PRIV_MODEPAGE	1	/* Modepage info for config write */
157 #define	CTL_PRIV_BACKEND	2	/* Reserved for block, RAIDCore */
158 #define	CTL_PRIV_BACKEND_LUN	3	/* Backend LUN pointer */
159 #define	CTL_PRIV_FRONTEND	4	/* Frontend storage */
160 #define	CTL_PRIV_FRONTEND2	5	/* Another frontend storage */
161 
162 #define CTL_LUN(io)	((io)->io_hdr.ctl_private[CTL_PRIV_LUN].ptrs[0])
163 #define CTL_SOFTC(io)	((io)->io_hdr.ctl_private[CTL_PRIV_LUN].ptrs[1])
164 #define CTL_BACKEND_LUN(io)	((io)->io_hdr.ctl_private[CTL_PRIV_BACKEND_LUN].ptrs[0])
165 #define CTL_PORT(io)	(((struct ctl_softc *)CTL_SOFTC(io))->	\
166     ctl_ports[(io)->io_hdr.nexus.targ_port])
167 
168 #define CTL_INVALID_PORTNAME 0xFF
169 #define CTL_UNMAPPED_IID     0xFF
170 
171 struct ctl_sg_entry {
172 	void	*addr;
173 	size_t	len;
174 };
175 
176 typedef enum {
177 	CTL_IO_NONE,
178 	CTL_IO_SCSI,
179 	CTL_IO_TASK,
180 } ctl_io_type;
181 
182 struct ctl_nexus {
183 	uint32_t initid;		/* Initiator ID */
184 	uint32_t targ_port;		/* Target port, filled in by PORT */
185 	uint32_t targ_lun;		/* Destination lun */
186 	uint32_t targ_mapped_lun;	/* Destination lun CTL-wide */
187 };
188 
189 typedef enum {
190 	CTL_MSG_SERIALIZE,
191 	CTL_MSG_R2R,
192 	CTL_MSG_FINISH_IO,
193 	CTL_MSG_BAD_JUJU,
194 	CTL_MSG_MANAGE_TASKS,
195 	CTL_MSG_PERS_ACTION,
196 	CTL_MSG_DATAMOVE,
197 	CTL_MSG_DATAMOVE_DONE,
198 	CTL_MSG_UA,			/* Set/clear UA on secondary. */
199 	CTL_MSG_PORT_SYNC,		/* Information about port. */
200 	CTL_MSG_LUN_SYNC,		/* Information about LUN. */
201 	CTL_MSG_IID_SYNC,		/* Information about initiator. */
202 	CTL_MSG_LOGIN,			/* Information about HA peer. */
203 	CTL_MSG_MODE_SYNC,		/* Mode page current content. */
204 	CTL_MSG_FAILOVER		/* Fake, never sent though the wire */
205 } ctl_msg_type;
206 
207 struct ctl_scsiio;
208 
209 struct ctl_io_hdr {
210 	uint32_t	  version;	/* interface version XXX */
211 	ctl_io_type	  io_type;	/* task I/O, SCSI I/O, etc. */
212 	ctl_msg_type	  msg_type;
213 	struct ctl_nexus  nexus;	/* Initiator, port, target, lun */
214 	uint32_t	  iid_indx;	/* the index into the iid mapping */
215 	uint32_t	  flags;	/* transaction flags */
216 	uint32_t	  status;	/* transaction status */
217 	uint32_t	  port_status;	/* trans status, set by PORT, 0 = good*/
218 	uint32_t	  timeout;	/* timeout in ms */
219 	uint32_t	  retries;	/* retry count */
220 #ifdef CTL_IO_DELAY
221 	struct callout	  delay_callout;
222 #endif /* CTL_IO_DELAY */
223 #ifdef CTL_TIME_IO
224 	time_t		  start_time;	/* I/O start time */
225 	struct bintime	  start_bt;	/* Timer start ticks */
226 	struct bintime	  dma_start_bt;	/* DMA start ticks */
227 	struct bintime	  dma_bt;	/* DMA total ticks */
228 #endif /* CTL_TIME_IO */
229 	uint32_t	  num_dmas;	/* Number of DMAs */
230 	union ctl_io	  *original_sc;
231 	union ctl_io	  *serializing_sc;
232 	void		  *pool;	/* I/O pool */
233 	union ctl_priv	  ctl_private[CTL_NUM_PRIV];/* CTL private area */
234 	struct ctl_sg_entry *remote_sglist;
235 	struct ctl_sg_entry *local_sglist;
236 	STAILQ_ENTRY(ctl_io_hdr) links;	/* linked list pointer */
237 	TAILQ_ENTRY(ctl_io_hdr) ooa_links;
238 	TAILQ_ENTRY(ctl_io_hdr) blocked_links;
239 };
240 
241 typedef enum {
242 	CTL_TAG_UNTAGGED,
243 	CTL_TAG_SIMPLE,
244 	CTL_TAG_ORDERED,
245 	CTL_TAG_HEAD_OF_QUEUE,
246 	CTL_TAG_ACA
247 } ctl_tag_type;
248 
249 union ctl_io;
250 
251 /*
252  * SCSI passthrough I/O structure for the CAM Target Layer.  Note
253  * that some of these fields are here for completeness, but they aren't
254  * used in the CTL implementation.  e.g., timeout and retries won't be
255  * used.
256  *
257  * Note:  Make sure the io_hdr is *always* the first element in this
258  * structure.
259  */
260 struct ctl_scsiio {
261 	struct ctl_io_hdr io_hdr;	/* common to all I/O types */
262 
263 	/*
264 	 * The ext_* fields are generally intended for frontend use; CTL itself
265 	 * doesn't modify or use them.
266 	 */
267 	uint32_t   ext_sg_entries;	/* 0 = no S/G list, > 0 = num entries */
268 	uint8_t	   *ext_data_ptr;	/* data buffer or S/G list */
269 	uint32_t   ext_data_len;	/* Data transfer length */
270 	uint32_t   ext_data_filled;	/* Amount of data filled so far */
271 
272 	/*
273 	 * The number of scatter/gather entries in the list pointed to
274 	 * by kern_data_ptr.  0 means there is no list, just a data pointer.
275 	 */
276 	uint32_t   kern_sg_entries;
277 
278 	uint32_t   rem_sg_entries;	/* Unused. */
279 
280 	/*
281 	 * The data pointer or a pointer to the scatter/gather list.
282 	 */
283 	uint8_t    *kern_data_ptr;
284 
285 	/*
286 	 * Length of the data buffer or scatter/gather list.  It's also
287 	 * the length of this particular piece of the data transfer,
288 	 * ie. number of bytes expected to be transferred by the current
289 	 * invocation of frontend's datamove() callback.  It's always
290 	 * less than or equal to kern_total_len.
291 	 */
292 	uint32_t   kern_data_len;
293 
294 	/*
295 	 * Total length of data to be transferred during this particular
296 	 * SCSI command, as decoded from SCSI CDB.
297 	 */
298 	uint32_t   kern_total_len;
299 
300 	/*
301 	 * Amount of data left after the current data transfer.
302 	 */
303 	uint32_t   kern_data_resid;
304 
305 	/*
306 	 * Byte offset of this transfer, equal to the amount of data
307 	 * already transferred for this SCSI command during previous
308 	 * datamove() invocations.
309 	 */
310 	uint32_t   kern_rel_offset;
311 
312 	struct     scsi_sense_data sense_data;	/* sense data */
313 	uint8_t	   sense_len;		/* Returned sense length */
314 	uint8_t	   scsi_status;		/* SCSI status byte */
315 	uint8_t	   sense_residual;	/* Unused. */
316 	uint32_t   residual;		/* Unused */
317 	uint32_t   tag_num;		/* tag number */
318 	ctl_tag_type tag_type;		/* simple, ordered, head of queue,etc.*/
319 	uint8_t    cdb_len;		/* CDB length */
320 	uint8_t	   cdb[CTL_MAX_CDBLEN];	/* CDB */
321 	int	   (*be_move_done)(union ctl_io *io); /* called by fe */
322 	int        (*io_cont)(union ctl_io *io); /* to continue processing */
323 };
324 
325 typedef enum {
326 	CTL_TASK_ABORT_TASK,
327 	CTL_TASK_ABORT_TASK_SET,
328 	CTL_TASK_CLEAR_ACA,
329 	CTL_TASK_CLEAR_TASK_SET,
330 	CTL_TASK_I_T_NEXUS_RESET,
331 	CTL_TASK_LUN_RESET,
332 	CTL_TASK_TARGET_RESET,
333 	CTL_TASK_BUS_RESET,
334 	CTL_TASK_PORT_LOGIN,
335 	CTL_TASK_PORT_LOGOUT,
336 	CTL_TASK_QUERY_TASK,
337 	CTL_TASK_QUERY_TASK_SET,
338 	CTL_TASK_QUERY_ASYNC_EVENT
339 } ctl_task_type;
340 
341 typedef enum {
342 	CTL_TASK_FUNCTION_COMPLETE,
343 	CTL_TASK_FUNCTION_SUCCEEDED,
344 	CTL_TASK_FUNCTION_REJECTED,
345 	CTL_TASK_LUN_DOES_NOT_EXIST,
346 	CTL_TASK_FUNCTION_NOT_SUPPORTED
347 } ctl_task_status;
348 
349 /*
350  * Task management I/O structure.  Aborts, bus resets, etc., are sent using
351  * this structure.
352  *
353  * Note:  Make sure the io_hdr is *always* the first element in this
354  * structure.
355  */
356 struct ctl_taskio {
357 	struct ctl_io_hdr	io_hdr;      /* common to all I/O types */
358 	ctl_task_type		task_action; /* Target Reset, Abort, etc.  */
359 	uint32_t		tag_num;     /* tag number */
360 	ctl_tag_type		tag_type;    /* simple, ordered, etc. */
361 	uint8_t			task_status; /* Complete, Succeeded, etc. */
362 	uint8_t			task_resp[3];/* Response information */
363 };
364 
365 
366 /*
367  * HA link messages.
368  */
369 #define	CTL_HA_VERSION		3
370 
371 /*
372  * Used for CTL_MSG_LOGIN.
373  */
374 struct ctl_ha_msg_login {
375 	ctl_msg_type		msg_type;
376 	int			version;
377 	int			ha_mode;
378 	int			ha_id;
379 	int			max_luns;
380 	int			max_ports;
381 	int			max_init_per_port;
382 };
383 
384 typedef enum {
385 	CTL_PR_REG_KEY,
386 	CTL_PR_UNREG_KEY,
387 	CTL_PR_PREEMPT,
388 	CTL_PR_CLEAR,
389 	CTL_PR_RESERVE,
390 	CTL_PR_RELEASE
391 } ctl_pr_action;
392 
393 /*
394  * The PR info is specifically for sending Persistent Reserve actions
395  * to the other SC which it must also act on.
396  *
397  * Note:  Make sure the io_hdr is *always* the first element in this
398  * structure.
399  */
400 struct ctl_pr_info {
401 	ctl_pr_action		action;
402 	uint8_t			sa_res_key[8];
403 	uint8_t			res_type;
404 	uint32_t		residx;
405 };
406 
407 struct ctl_ha_msg_hdr {
408 	ctl_msg_type		msg_type;
409 	uint32_t		status;	     /* transaction status */
410 	union ctl_io		*original_sc;
411 	union ctl_io		*serializing_sc;
412 	struct ctl_nexus	nexus;	     /* Initiator, port, target, lun */
413 };
414 
415 #define	CTL_HA_MAX_SG_ENTRIES	16
416 #define	CTL_HA_DATAMOVE_SEGMENT	131072
417 
418 /*
419  * Used for CTL_MSG_PERS_ACTION.
420  */
421 struct ctl_ha_msg_pr {
422 	struct ctl_ha_msg_hdr	hdr;
423 	struct ctl_pr_info	pr_info;
424 };
425 
426 /*
427  * Used for CTL_MSG_UA.
428  */
429 struct ctl_ha_msg_ua {
430 	struct ctl_ha_msg_hdr	hdr;
431 	int			ua_all;
432 	int			ua_set;
433 	int			ua_type;
434 	uint8_t			ua_info[8];
435 };
436 
437 /*
438  * The S/G handling here is a little different than the standard ctl_scsiio
439  * structure, because we can't pass data by reference in between controllers.
440  * The S/G list in the ctl_scsiio struct is normally passed in the
441  * kern_data_ptr field.  So kern_sg_entries here will always be non-zero,
442  * even if there is only one entry.
443  *
444  * Used for CTL_MSG_DATAMOVE.
445  */
446 struct ctl_ha_msg_dt {
447 	struct ctl_ha_msg_hdr	hdr;
448 	ctl_io_flags		flags;  /* Only I/O flags are used here */
449 	uint32_t		sg_sequence;     /* S/G portion number  */
450 	uint8_t			sg_last;         /* last S/G batch = 1 */
451 	uint32_t		sent_sg_entries; /* previous S/G count */
452 	uint32_t		cur_sg_entries;  /* current S/G entries */
453 	uint32_t		kern_sg_entries; /* total S/G entries */
454 	uint32_t		kern_data_len;   /* Length of this S/G list */
455 	uint32_t		kern_total_len;  /* Total length of this
456 						    transaction */
457 	uint32_t		kern_data_resid; /* Length left to transfer
458 						    after this*/
459 	uint32_t		kern_rel_offset; /* Byte Offset of this
460 						    transfer */
461 	struct ctl_sg_entry	sg_list[CTL_HA_MAX_SG_ENTRIES];
462 };
463 
464 /*
465  * Used for CTL_MSG_SERIALIZE, CTL_MSG_FINISH_IO, CTL_MSG_BAD_JUJU,
466  * and CTL_MSG_DATAMOVE_DONE.
467  */
468 struct ctl_ha_msg_scsi {
469 	struct ctl_ha_msg_hdr	hdr;
470 	uint32_t		tag_num;     /* tag number */
471 	ctl_tag_type		tag_type;    /* simple, ordered, etc. */
472 	uint8_t			cdb[CTL_MAX_CDBLEN];	/* CDB */
473 	uint8_t			cdb_len;	/* CDB length */
474 	uint8_t			scsi_status; /* SCSI status byte */
475 	uint8_t			sense_len;   /* Returned sense length */
476 	uint32_t		port_status; /* trans status, set by FETD,
477 						0 = good*/
478 	uint32_t		kern_data_resid; /* for DATAMOVE_DONE */
479 	struct scsi_sense_data	sense_data;  /* sense data */
480 };
481 
482 /*
483  * Used for CTL_MSG_MANAGE_TASKS.
484  */
485 struct ctl_ha_msg_task {
486 	struct ctl_ha_msg_hdr	hdr;
487 	ctl_task_type		task_action; /* Target Reset, Abort, etc.  */
488 	uint32_t		tag_num;     /* tag number */
489 	ctl_tag_type		tag_type;    /* simple, ordered, etc. */
490 };
491 
492 /*
493  * Used for CTL_MSG_PORT_SYNC.
494  */
495 struct ctl_ha_msg_port {
496 	struct ctl_ha_msg_hdr	hdr;
497 	int			port_type;
498 	int			physical_port;
499 	int			virtual_port;
500 	int			status;
501 	int			name_len;
502 	int			lun_map_len;
503 	int			port_devid_len;
504 	int			target_devid_len;
505 	int			init_devid_len;
506 	uint8_t			data[];
507 };
508 
509 /*
510  * Used for CTL_MSG_LUN_SYNC.
511  */
512 struct ctl_ha_msg_lun {
513 	struct ctl_ha_msg_hdr	hdr;
514 	int			flags;
515 	unsigned int		pr_generation;
516 	uint32_t		pr_res_idx;
517 	uint8_t			pr_res_type;
518 	int			lun_devid_len;
519 	int			pr_key_count;
520 	uint8_t			data[];
521 };
522 
523 struct ctl_ha_msg_lun_pr_key {
524 	uint32_t		pr_iid;
525 	uint64_t		pr_key;
526 };
527 
528 /*
529  * Used for CTL_MSG_IID_SYNC.
530  */
531 struct ctl_ha_msg_iid {
532 	struct ctl_ha_msg_hdr	hdr;
533 	int			in_use;
534 	int			name_len;
535 	uint64_t		wwpn;
536 	uint8_t			data[];
537 };
538 
539 /*
540  * Used for CTL_MSG_MODE_SYNC.
541  */
542 struct ctl_ha_msg_mode {
543 	struct ctl_ha_msg_hdr	hdr;
544 	uint8_t			page_code;
545 	uint8_t			subpage;
546 	uint16_t		page_len;
547 	uint8_t			data[];
548 };
549 
550 union ctl_ha_msg {
551 	struct ctl_ha_msg_hdr	hdr;
552 	struct ctl_ha_msg_task	task;
553 	struct ctl_ha_msg_scsi	scsi;
554 	struct ctl_ha_msg_dt	dt;
555 	struct ctl_ha_msg_pr	pr;
556 	struct ctl_ha_msg_ua	ua;
557 	struct ctl_ha_msg_port	port;
558 	struct ctl_ha_msg_lun	lun;
559 	struct ctl_ha_msg_iid	iid;
560 	struct ctl_ha_msg_login	login;
561 	struct ctl_ha_msg_mode	mode;
562 };
563 
564 struct ctl_prio {
565 	struct ctl_io_hdr	io_hdr;
566 	struct ctl_ha_msg_pr	pr_msg;
567 };
568 
569 union ctl_io {
570 	struct ctl_io_hdr	io_hdr;	/* common to all I/O types */
571 	struct ctl_scsiio	scsiio;	/* Normal SCSI commands */
572 	struct ctl_taskio	taskio;	/* SCSI task management/reset */
573 	struct ctl_prio		presio;	/* update per. res info on other SC */
574 };
575 
576 #ifdef _KERNEL
577 
578 union ctl_io *ctl_alloc_io(void *pool_ref);
579 union ctl_io *ctl_alloc_io_nowait(void *pool_ref);
580 void ctl_free_io(union ctl_io *io);
581 void ctl_zero_io(union ctl_io *io);
582 
583 #endif /* _KERNEL */
584 
585 #endif	/* _CTL_IO_H_ */
586 
587 /*
588  * vim: ts=8
589  */
590