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