1229997Sken/*-
2229997Sken * Copyright (c) 2003, 2004, 2005, 2008 Silicon Graphics International Corp.
3229997Sken * All rights reserved.
4229997Sken *
5229997Sken * Redistribution and use in source and binary forms, with or without
6229997Sken * modification, are permitted provided that the following conditions
7229997Sken * are met:
8229997Sken * 1. Redistributions of source code must retain the above copyright
9229997Sken *    notice, this list of conditions, and the following disclaimer,
10229997Sken *    without modification.
11229997Sken * 2. Redistributions in binary form must reproduce at minimum a disclaimer
12229997Sken *    substantially similar to the "NO WARRANTY" disclaimer below
13229997Sken *    ("Disclaimer") and any redistribution must be conditioned upon
14229997Sken *    including a substantially similar Disclaimer requirement for further
15229997Sken *    binary redistribution.
16229997Sken *
17229997Sken * NO WARRANTY
18229997Sken * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19229997Sken * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20229997Sken * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
21229997Sken * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22229997Sken * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23229997Sken * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24229997Sken * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25229997Sken * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26229997Sken * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
27229997Sken * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28229997Sken * POSSIBILITY OF SUCH DAMAGES.
29229997Sken *
30229997Sken * $Id: //depot/users/kenm/FreeBSD-test2/sys/cam/ctl/ctl_private.h#7 $
31229997Sken * $FreeBSD$
32229997Sken */
33229997Sken/*
34229997Sken * CAM Target Layer driver private data structures/definitions.
35229997Sken *
36229997Sken * Author: Ken Merry <ken@FreeBSD.org>
37229997Sken */
38229997Sken
39229997Sken#ifndef	_CTL_PRIVATE_H_
40229997Sken#define	_CTL_PRIVATE_H_
41229997Sken
42229997Sken/*
43229997Sken * SCSI vendor and product names.
44229997Sken */
45229997Sken#define	CTL_VENDOR		"FREEBSD "
46229997Sken#define	CTL_DIRECT_PRODUCT	"CTLDISK         "
47229997Sken#define	CTL_PROCESSOR_PRODUCT	"CTLPROCESSOR    "
48229997Sken#define	CTL_UNKNOWN_PRODUCT	"CTLDEVICE       "
49229997Sken
50229997Skenstruct ctl_fe_ioctl_startstop_info {
51229997Sken	struct cv			sem;
52229997Sken	struct ctl_hard_startstop_info	hs_info;
53229997Sken};
54229997Sken
55229997Skenstruct ctl_fe_ioctl_bbrread_info {
56229997Sken	struct cv			sem;
57229997Sken	struct ctl_bbrread_info		*bbr_info;
58229997Sken	int				wakeup_done;
59229997Sken	struct mtx			*lock;
60229997Sken};
61229997Sken
62229997Skentypedef enum {
63229997Sken	CTL_IOCTL_INPROG,
64229997Sken	CTL_IOCTL_DATAMOVE,
65229997Sken	CTL_IOCTL_DONE
66229997Sken} ctl_fe_ioctl_state;
67229997Sken
68229997Skenstruct ctl_fe_ioctl_params {
69229997Sken	struct cv		sem;
70229997Sken	struct mtx		ioctl_mtx;
71229997Sken	ctl_fe_ioctl_state	state;
72229997Sken};
73229997Sken
74229997Sken#define	CTL_POOL_ENTRIES_INTERNAL	200
75229997Sken#define	CTL_POOL_ENTRIES_EMERGENCY	300
76229997Sken#define CTL_POOL_ENTRIES_OTHER_SC   200
77229997Sken
78229997Skentypedef enum {
79229997Sken	CTL_POOL_INTERNAL,
80229997Sken	CTL_POOL_FETD,
81229997Sken	CTL_POOL_EMERGENCY,
82229997Sken	CTL_POOL_IOCTL,
83229997Sken	CTL_POOL_4OTHERSC
84229997Sken} ctl_pool_type;
85229997Sken
86229997Skentypedef enum {
87229997Sken	CTL_POOL_FLAG_NONE	= 0x00,
88229997Sken	CTL_POOL_FLAG_INVALID	= 0x01
89229997Sken} ctl_pool_flags;
90229997Sken
91229997Skenstruct ctl_io_pool {
92229997Sken	ctl_pool_type			type;
93229997Sken	ctl_pool_flags			flags;
94229997Sken	uint32_t			id;
95229997Sken	struct ctl_softc		*ctl_softc;
96229997Sken	uint32_t			refcount;
97229997Sken	uint64_t			total_allocated;
98229997Sken	uint64_t			total_freed;
99229997Sken	int32_t				total_ctl_io;
100229997Sken	int32_t				free_ctl_io;
101229997Sken	STAILQ_HEAD(, ctl_io_hdr)	free_queue;
102229997Sken	STAILQ_ENTRY(ctl_io_pool)	links;
103229997Sken};
104229997Sken
105229997Skentypedef enum {
106229997Sken	CTL_IOCTL_FLAG_NONE	= 0x00,
107229997Sken	CTL_IOCTL_FLAG_ENABLED	= 0x01
108229997Sken} ctl_ioctl_flags;
109229997Sken
110229997Skenstruct ctl_ioctl_info {
111229997Sken	ctl_ioctl_flags		flags;
112229997Sken	uint32_t		cur_tag_num;
113229997Sken	struct ctl_frontend	fe;
114229997Sken	char			port_name[24];
115229997Sken};
116229997Sken
117229997Skentypedef enum {
118229997Sken	CTL_SER_BLOCK,
119229997Sken	CTL_SER_EXTENT,
120229997Sken	CTL_SER_PASS,
121229997Sken	CTL_SER_SKIP
122229997Sken} ctl_serialize_action;
123229997Sken
124229997Skentypedef enum {
125229997Sken	CTL_ACTION_BLOCK,
126229997Sken	CTL_ACTION_OVERLAP,
127229997Sken	CTL_ACTION_OVERLAP_TAG,
128229997Sken	CTL_ACTION_PASS,
129229997Sken	CTL_ACTION_SKIP,
130229997Sken	CTL_ACTION_ERROR
131229997Sken} ctl_action;
132229997Sken
133229997Sken/*
134229997Sken * WARNING:  Keep the bottom nibble here free, we OR in the data direction
135229997Sken * flags for each command.
136229997Sken *
137229997Sken * Note:  "OK_ON_ALL_LUNS" == we don't have to have a lun configured
138229997Sken *        "OK_ON_BOTH"     == we have to have a lun configured
139229997Sken */
140229997Skentypedef enum {
141229997Sken	CTL_CMD_FLAG_NONE		= 0x0000,
142229997Sken	CTL_CMD_FLAG_NO_SENSE		= 0x0010,
143229997Sken	CTL_CMD_FLAG_OK_ON_ALL_LUNS	= 0x0020,
144229997Sken	CTL_CMD_FLAG_ALLOW_ON_RESV	= 0x0040,
145229997Sken	CTL_CMD_FLAG_OK_ON_PROC		= 0x0100,
146229997Sken	CTL_CMD_FLAG_OK_ON_SLUN		= 0x0200,
147229997Sken	CTL_CMD_FLAG_OK_ON_BOTH		= 0x0300,
148229997Sken	CTL_CMD_FLAG_OK_ON_STOPPED	= 0x0400,
149229997Sken	CTL_CMD_FLAG_OK_ON_INOPERABLE	= 0x0800,
150229997Sken	CTL_CMD_FLAG_OK_ON_OFFLINE	= 0x1000,
151229997Sken	CTL_CMD_FLAG_OK_ON_SECONDARY	= 0x2000,
152229997Sken	CTL_CMD_FLAG_ALLOW_ON_PR_RESV   = 0x4000
153229997Sken} ctl_cmd_flags;
154229997Sken
155229997Skentypedef enum {
156229997Sken	CTL_SERIDX_TUR	= 0,
157229997Sken	CTL_SERIDX_READ,
158229997Sken	CTL_SERIDX_WRITE,
159229997Sken	CTL_SERIDX_MD_SNS,
160229997Sken	CTL_SERIDX_MD_SEL,
161229997Sken	CTL_SERIDX_RQ_SNS,
162229997Sken	CTL_SERIDX_INQ,
163229997Sken	CTL_SERIDX_RD_CAP,
164229997Sken	CTL_SERIDX_RESV,
165229997Sken	CTL_SERIDX_REL,
166229997Sken	CTL_SERIDX_LOG_SNS,
167229997Sken	CTL_SERIDX_FORMAT,
168229997Sken	CTL_SERIDX_START,
169229997Sken	CTL_SERIDX_PRES_IN,
170229997Sken	CTL_SERIDX_PRES_OUT,
171229997Sken	CTL_SERIDX_MAIN_IN,
172229997Sken	/* TBD: others to be filled in as needed */
173229997Sken	CTL_SERIDX_COUNT, /* LAST, not a normal code, provides # codes */
174229997Sken	CTL_SERIDX_INVLD = CTL_SERIDX_COUNT
175229997Sken} ctl_seridx;
176229997Sken
177229997Skentypedef int	ctl_opfunc(struct ctl_scsiio *ctsio);
178229997Sken
179229997Skenstruct ctl_cmd_entry {
180229997Sken	ctl_opfunc		*execute;
181229997Sken	ctl_seridx		seridx;
182229997Sken	ctl_cmd_flags		flags;
183229997Sken	ctl_lun_error_pattern	pattern;
184229997Sken};
185229997Sken
186229997Skentypedef enum {
187229997Sken	CTL_LUN_NONE		= 0x000,
188229997Sken	CTL_LUN_CONTROL		= 0x001,
189229997Sken	CTL_LUN_RESERVED	= 0x002,
190229997Sken	CTL_LUN_INVALID		= 0x004,
191229997Sken	CTL_LUN_DISABLED	= 0x008,
192229997Sken	CTL_LUN_MALLOCED	= 0x010,
193229997Sken	CTL_LUN_STOPPED		= 0x020,
194229997Sken	CTL_LUN_INOPERABLE	= 0x040,
195229997Sken	CTL_LUN_OFFLINE		= 0x080,
196229997Sken	CTL_LUN_PR_RESERVED	= 0x100,
197229997Sken	CTL_LUN_PRIMARY_SC	= 0x200,
198229997Sken	CTL_LUN_SENSE_DESC	= 0x400
199229997Sken} ctl_lun_flags;
200229997Sken
201229997Skentypedef enum {
202229997Sken	CTLBLOCK_FLAG_NONE	= 0x00,
203229997Sken	CTLBLOCK_FLAG_INVALID	= 0x01
204229997Sken} ctlblock_flags;
205229997Sken
206229997Skenunion ctl_softcs {
207229997Sken	struct ctl_softc	*ctl_softc;
208229997Sken	struct ctlblock_softc	*ctlblock_softc;
209229997Sken};
210229997Sken
211229997Sken/*
212229997Sken * Mode page defaults.
213229997Sken */
214229997Sken#if 0
215229997Sken/*
216229997Sken * These values make Solaris trim off some of the capacity.
217229997Sken */
218229997Sken#define	CTL_DEFAULT_SECTORS_PER_TRACK	63
219229997Sken#define	CTL_DEFAULT_HEADS		255
220229997Sken/*
221229997Sken * These values seem to work okay.
222229997Sken */
223229997Sken#define	CTL_DEFAULT_SECTORS_PER_TRACK	63
224229997Sken#define	CTL_DEFAULT_HEADS		16
225229997Sken/*
226229997Sken * These values work reasonably well.
227229997Sken */
228229997Sken#define	CTL_DEFAULT_SECTORS_PER_TRACK	512
229229997Sken#define	CTL_DEFAULT_HEADS		64
230229997Sken#endif
231229997Sken
232229997Sken/*
233229997Sken * Solaris is somewhat picky about how many heads and sectors per track you
234229997Sken * have defined in mode pages 3 and 4.  These values seem to cause Solaris
235229997Sken * to get the capacity more or less right when you run the format tool.
236229997Sken * They still have problems when dealing with devices larger than 1TB,
237229997Sken * but there isn't anything we can do about that.
238229997Sken *
239229997Sken * For smaller LUN sizes, this ends up causing the number of cylinders to
240229997Sken * work out to 0.  Solaris actually recognizes that and comes up with its
241229997Sken * own bogus geometry to fit the actual capacity of the drive.  They really
242229997Sken * should just give up on geometry and stick to the read capacity
243229997Sken * information alone for modern disk drives.
244229997Sken *
245229997Sken * One thing worth mentioning about Solaris' mkfs command is that it
246229997Sken * doesn't like sectors per track values larger than 256.  512 seems to
247229997Sken * work okay for format, but causes problems when you try to make a
248229997Sken * filesystem.
249229997Sken *
250229997Sken * Another caveat about these values:  the product of these two values
251229997Sken * really should be a power of 2.  This is because of the simplistic
252229997Sken * shift-based calculation that we have to use on the i386 platform to
253229997Sken * calculate the number of cylinders here.  (If you use a divide, you end
254229997Sken * up calling __udivdi3(), which is a hardware FP call on the PC.  On the
255229997Sken * XScale, it is done in software, so you can do that from inside the
256229997Sken * kernel.)
257229997Sken *
258229997Sken * So for the current values (256 S/T, 128 H), we get 32768, which works
259229997Sken * very nicely for calculating cylinders.
260229997Sken *
261229997Sken * If you want to change these values so that their product is no longer a
262229997Sken * power of 2, re-visit the calculation in ctl_init_page_index().  You may
263229997Sken * need to make it a bit more complicated to get the number of cylinders
264229997Sken * right.
265229997Sken */
266229997Sken#define	CTL_DEFAULT_SECTORS_PER_TRACK	256
267229997Sken#define	CTL_DEFAULT_HEADS		128
268229997Sken
269229997Sken#define	CTL_DEFAULT_ROTATION_RATE	10000
270229997Sken
271229997Skenstruct ctl_page_index;
272229997Sken
273229997Skentypedef int	ctl_modesen_handler(struct ctl_scsiio *ctsio,
274229997Sken				    struct ctl_page_index *page_index,
275229997Sken				    int pc);
276229997Skentypedef int	ctl_modesel_handler(struct ctl_scsiio *ctsio,
277229997Sken				    struct ctl_page_index *page_index,
278229997Sken				    uint8_t *page_ptr);
279229997Sken
280229997Skentypedef enum {
281229997Sken	CTL_PAGE_FLAG_NONE	 = 0x00,
282229997Sken	CTL_PAGE_FLAG_DISK_ONLY	 = 0x01
283229997Sken} ctl_page_flags;
284229997Sken
285229997Skenstruct ctl_page_index {
286229997Sken	uint8_t			page_code;
287229997Sken	uint8_t			subpage;
288229997Sken	uint16_t		page_len;
289229997Sken	uint8_t			*page_data;
290229997Sken	ctl_page_flags		page_flags;
291229997Sken	ctl_modesen_handler	*sense_handler;
292229997Sken	ctl_modesel_handler	*select_handler;
293229997Sken};
294229997Sken
295229997Sken#define	CTL_PAGE_CURRENT	0x00
296229997Sken#define	CTL_PAGE_CHANGEABLE	0x01
297229997Sken#define	CTL_PAGE_DEFAULT	0x02
298229997Sken#define	CTL_PAGE_SAVED		0x03
299229997Sken
300232074Sdimstatic const struct ctl_page_index page_index_template[] = {
301229997Sken	{SMS_FORMAT_DEVICE_PAGE, 0, sizeof(struct scsi_format_page), NULL,
302229997Sken	 CTL_PAGE_FLAG_DISK_ONLY, NULL, NULL},
303229997Sken	{SMS_RIGID_DISK_PAGE, 0, sizeof(struct scsi_rigid_disk_page), NULL,
304229997Sken	 CTL_PAGE_FLAG_DISK_ONLY, NULL, NULL},
305229997Sken	{SMS_CACHING_PAGE, 0, sizeof(struct scsi_caching_page), NULL,
306229997Sken	 CTL_PAGE_FLAG_DISK_ONLY, NULL, NULL},
307229997Sken	{SMS_CONTROL_MODE_PAGE, 0, sizeof(struct scsi_control_page), NULL,
308229997Sken	 CTL_PAGE_FLAG_NONE, NULL, ctl_control_page_handler},
309229997Sken   	{SMS_VENDOR_SPECIFIC_PAGE | SMPH_SPF, PWR_SUBPAGE_CODE,
310229997Sken	 sizeof(struct copan_power_subpage), NULL, CTL_PAGE_FLAG_NONE,
311229997Sken	 ctl_power_sp_sense_handler, ctl_power_sp_handler},
312229997Sken	{SMS_VENDOR_SPECIFIC_PAGE | SMPH_SPF, APS_SUBPAGE_CODE,
313229997Sken	 sizeof(struct copan_aps_subpage), NULL, CTL_PAGE_FLAG_NONE,
314229997Sken	 NULL, ctl_aps_sp_handler},
315229997Sken	{SMS_VENDOR_SPECIFIC_PAGE | SMPH_SPF, DBGCNF_SUBPAGE_CODE,
316229997Sken	 sizeof(struct copan_debugconf_subpage), NULL, CTL_PAGE_FLAG_NONE,
317229997Sken	 ctl_debugconf_sp_sense_handler, ctl_debugconf_sp_select_handler},
318229997Sken};
319229997Sken
320229997Sken#define	CTL_NUM_MODE_PAGES sizeof(page_index_template)/   \
321229997Sken			   sizeof(page_index_template[0])
322229997Sken
323229997Skenstruct ctl_mode_pages {
324229997Sken	struct scsi_format_page		format_page[4];
325229997Sken	struct scsi_rigid_disk_page	rigid_disk_page[4];
326229997Sken	struct scsi_caching_page	caching_page[4];
327229997Sken	struct scsi_control_page	control_page[4];
328229997Sken	struct copan_power_subpage	power_subpage[4];
329229997Sken	struct copan_aps_subpage	aps_subpage[4];
330229997Sken	struct copan_debugconf_subpage	debugconf_subpage[4];
331229997Sken	struct ctl_page_index		index[CTL_NUM_MODE_PAGES];
332229997Sken};
333229997Sken
334229997Skenstruct ctl_pending_sense {
335229997Sken	ctl_ua_type		ua_pending;
336229997Sken	struct scsi_sense_data	sense;
337229997Sken};
338229997Sken
339229997Skenstruct ctl_lun_delay_info {
340229997Sken	ctl_delay_type		datamove_type;
341229997Sken	uint32_t		datamove_delay;
342229997Sken	ctl_delay_type		done_type;
343229997Sken	uint32_t		done_delay;
344229997Sken};
345229997Sken
346229997Skentypedef enum {
347229997Sken	CTL_ERR_INJ_NONE	= 0x00,
348229997Sken	CTL_ERR_INJ_ABORTED	= 0x01
349229997Sken} ctl_err_inject_flags;
350229997Sken
351229997Skentypedef enum {
352229997Sken	CTL_PR_FLAG_NONE	= 0x00,
353229997Sken	CTL_PR_FLAG_REGISTERED	= 0x01,
354229997Sken	CTL_PR_FLAG_ACTIVE_RES	= 0x02
355229997Sken} ctl_per_res_flags;
356229997Sken
357229997Skenstruct ctl_per_res_info {
358229997Sken	struct scsi_per_res_key res_key;
359229997Sken	uint8_t  registered;
360229997Sken};
361229997Sken
362229997Sken#define CTL_PR_ALL_REGISTRANTS  0xFFFF
363229997Sken#define CTL_PR_NO_RESERVATION   0xFFF0
364229997Sken
365229997Sken/*
366229997Sken * For report target port groups.
367229997Sken */
368229997Sken#define NUM_TARGET_PORT_GROUPS	2
369229997Sken#define NUM_PORTS_PER_GRP	2
370229997Sken
371229997Skenstruct ctl_lun {
372229997Sken	struct mtx			lun_lock;
373229997Sken	struct ctl_id			target;
374229997Sken	uint64_t			lun;
375229997Sken	ctl_lun_flags			flags;
376229997Sken	STAILQ_HEAD(,ctl_error_desc)	error_list;
377229997Sken	uint64_t			error_serial;
378229997Sken	struct ctl_softc		*ctl_softc;
379229997Sken	struct ctl_be_lun		*be_lun;
380229997Sken	struct ctl_backend_driver	*backend;
381229997Sken	int				io_count;
382229997Sken	struct ctl_lun_delay_info	delay_info;
383229997Sken	int				sync_interval;
384229997Sken	int				sync_count;
385229997Sken	TAILQ_HEAD(ctl_ooaq, ctl_io_hdr)  ooa_queue;
386229997Sken	TAILQ_HEAD(ctl_blockq,ctl_io_hdr) blocked_queue;
387229997Sken	STAILQ_ENTRY(ctl_lun)		links;
388229997Sken	STAILQ_ENTRY(ctl_lun)		run_links;
389229997Sken	struct ctl_nexus		rsv_nexus;
390229997Sken	uint32_t			have_ca[CTL_MAX_INITIATORS >> 5];
391229997Sken	struct ctl_pending_sense	pending_sense[CTL_MAX_INITIATORS];
392229997Sken	struct ctl_mode_pages		mode_pages;
393229997Sken	struct ctl_lun_io_stats		stats;
394229997Sken	struct ctl_per_res_info		per_res[2*CTL_MAX_INITIATORS];
395229997Sken	unsigned int			PRGeneration;
396229997Sken	int				pr_key_count;
397229997Sken	uint16_t        		pr_res_idx;
398229997Sken	uint8_t				res_type;
399229997Sken	uint8_t				write_buffer[524288];
400229997Sken};
401229997Sken
402229997Skentypedef enum {
403229997Sken	CTL_FLAG_TASK_PENDING	= 0x01,
404229997Sken	CTL_FLAG_REAL_SYNC	= 0x02,
405229997Sken	CTL_FLAG_MASTER_SHELF	= 0x04
406229997Sken} ctl_gen_flags;
407229997Sken
408229997Skenstruct ctl_wwpn_iid {
409229997Sken	int in_use;
410229997Sken	uint64_t wwpn;
411229997Sken	uint32_t iid;
412229997Sken	int32_t port;
413229997Sken};
414229997Sken
415229997Skenstruct ctl_softc {
416229997Sken	struct mtx ctl_lock;
417229997Sken	struct cdev *dev;
418229997Sken	int open_count;
419229997Sken	struct ctl_id target;
420229997Sken	int num_disks;
421229997Sken	int num_luns;
422229997Sken	ctl_gen_flags flags;
423229997Sken	ctl_ha_mode ha_mode;
424233963Sken	int inquiry_pq_no_lun;
425233963Sken	struct sysctl_ctx_list sysctl_ctx;
426233963Sken	struct sysctl_oid *sysctl_tree;
427229997Sken	struct ctl_ioctl_info ioctl_info;
428229997Sken	struct ctl_lun lun;
429229997Sken	struct ctl_io_pool *internal_pool;
430229997Sken	struct ctl_io_pool *emergency_pool;
431229997Sken	struct ctl_io_pool *othersc_pool;
432229997Sken	struct proc *work_thread;
433229997Sken	int targ_online;
434229997Sken	uint32_t ctl_lun_mask[CTL_MAX_LUNS >> 5];
435229997Sken	struct ctl_lun *ctl_luns[CTL_MAX_LUNS];
436229997Sken	struct ctl_wwpn_iid wwpn_iid[CTL_MAX_PORTS][CTL_MAX_INIT_PER_PORT];
437229997Sken	uint32_t ctl_port_mask;
438229997Sken	uint64_t aps_locked_lun;
439229997Sken	STAILQ_HEAD(, ctl_lun) lun_list;
440229997Sken	STAILQ_HEAD(, ctl_be_lun) pending_lun_queue;
441229997Sken	STAILQ_HEAD(, ctl_io_hdr) task_queue;
442229997Sken	STAILQ_HEAD(, ctl_io_hdr) incoming_queue;
443229997Sken	STAILQ_HEAD(, ctl_io_hdr) rtr_queue;
444229997Sken	STAILQ_HEAD(, ctl_io_hdr) done_queue;
445229997Sken	STAILQ_HEAD(, ctl_io_hdr) isc_queue;
446229997Sken	uint32_t num_frontends;
447229997Sken	STAILQ_HEAD(, ctl_frontend) fe_list;
448229997Sken	struct ctl_frontend *ctl_ports[CTL_MAX_PORTS];
449229997Sken	uint32_t num_backends;
450229997Sken	STAILQ_HEAD(, ctl_backend_driver) be_list;
451229997Sken	uint32_t num_pools;
452229997Sken	uint32_t cur_pool_id;
453229997Sken	STAILQ_HEAD(, ctl_io_pool) io_pools;
454229997Sken	time_t last_print_jiffies;
455229997Sken	uint32_t skipped_prints;
456229997Sken};
457229997Sken
458229997Sken#ifdef _KERNEL
459229997Sken
460229997Skenextern struct ctl_cmd_entry ctl_cmd_table[];
461229997Sken
462229997Skenuint32_t ctl_get_initindex(struct ctl_nexus *nexus);
463229997Skenint ctl_pool_create(struct ctl_softc *ctl_softc, ctl_pool_type pool_type,
464229997Sken		    uint32_t total_ctl_io, struct ctl_io_pool **npool);
465229997Skenint ctl_pool_acquire(struct ctl_io_pool *pool);
466229997Skenint ctl_pool_invalidate(struct ctl_io_pool *pool);
467229997Skenint ctl_pool_release(struct ctl_io_pool *pool);
468229997Skenvoid ctl_pool_free(struct ctl_softc *ctl_softc, struct ctl_io_pool *pool);
469229997Skenint ctl_scsi_release(struct ctl_scsiio *ctsio);
470229997Skenint ctl_scsi_reserve(struct ctl_scsiio *ctsio);
471229997Skenint ctl_start_stop(struct ctl_scsiio *ctsio);
472229997Skenint ctl_sync_cache(struct ctl_scsiio *ctsio);
473229997Skenint ctl_format(struct ctl_scsiio *ctsio);
474229997Skenint ctl_write_buffer(struct ctl_scsiio *ctsio);
475229997Skenint ctl_mode_select(struct ctl_scsiio *ctsio);
476229997Skenint ctl_mode_sense(struct ctl_scsiio *ctsio);
477229997Skenint ctl_read_capacity(struct ctl_scsiio *ctsio);
478229997Skenint ctl_service_action_in(struct ctl_scsiio *ctsio);
479229997Skenint ctl_read_write(struct ctl_scsiio *ctsio);
480229997Skenint ctl_report_luns(struct ctl_scsiio *ctsio);
481229997Skenint ctl_request_sense(struct ctl_scsiio *ctsio);
482229997Skenint ctl_tur(struct ctl_scsiio *ctsio);
483229997Skenint ctl_inquiry(struct ctl_scsiio *ctsio);
484229997Skenint ctl_persistent_reserve_in(struct ctl_scsiio *ctsio);
485229997Skenint ctl_persistent_reserve_out(struct ctl_scsiio *ctsio);
486229997Skenint ctl_maintenance_in(struct ctl_scsiio *ctsio);
487229997Skenvoid ctl_done_lock(union ctl_io *io, int have_lock);
488229997Skenint ctl_isc(struct ctl_scsiio *ctsio);
489229997Sken
490229997Sken#endif	/* _KERNEL */
491229997Sken
492229997Sken#endif	/* _CTL_PRIVATE_H_ */
493229997Sken
494229997Sken/*
495229997Sken * vim: ts=8
496229997Sken */
497