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