FreeBSD kernel CAM code
scsi_ctl.c
Go to the documentation of this file.
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2008, 2009 Silicon Graphics International Corp.
5 * Copyright (c) 2014-2015 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/scsi_ctl.c#4 $
34 */
35/*
36 * Peripheral driver interface between CAM and CTL (CAM Target Layer).
37 *
38 * Author: Ken Merry <ken@FreeBSD.org>
39 */
40
41#include <sys/cdefs.h>
42__FBSDID("$FreeBSD$");
43
44#include <sys/param.h>
45#include <sys/queue.h>
46#include <sys/systm.h>
47#include <sys/kernel.h>
48#include <sys/lock.h>
49#include <sys/mutex.h>
50#include <sys/condvar.h>
51#include <sys/malloc.h>
52#include <sys/bus.h>
53#include <sys/endian.h>
54#include <sys/sbuf.h>
55#include <sys/sysctl.h>
56#include <sys/types.h>
57#include <sys/systm.h>
58#include <sys/taskqueue.h>
59#include <machine/bus.h>
60
61#include <cam/cam.h>
62#include <cam/cam_ccb.h>
63#include <cam/cam_periph.h>
64#include <cam/cam_queue.h>
65#include <cam/cam_xpt_periph.h>
66#include <cam/cam_debug.h>
67#include <cam/cam_sim.h>
68#include <cam/cam_xpt.h>
69
70#include <cam/scsi/scsi_all.h>
72
73#include <cam/ctl/ctl_io.h>
74#include <cam/ctl/ctl.h>
76#include <cam/ctl/ctl_util.h>
77#include <cam/ctl/ctl_error.h>
78
80 struct ctl_port port;
83 uint32_t hba_misc;
84 u_int maxio;
85 struct cam_sim *sim;
87 struct mtx lun_softc_mtx;
88 STAILQ_HEAD(, ctlfe_lun_softc) lun_softc_list;
89 STAILQ_ENTRY(ctlfe_softc) links;
90};
91
92STAILQ_HEAD(, ctlfe_softc) ctlfe_softc_list;
93struct mtx ctlfe_list_mtx;
94static char ctlfe_mtx_desc[] = "ctlfelist";
95
96typedef enum {
97 CTLFE_LUN_NONE = 0x00,
98 CTLFE_LUN_WILDCARD = 0x01
100
105 int ctios_sent; /* Number of active CTIOs */
106 int refcount; /* Number of active xpt_action() */
107 int atios_alloced; /* Number of ATIOs not freed */
108 int inots_alloced; /* Number of INOTs not freed */
109 struct task refdrain_task;
110 STAILQ_HEAD(, ccb_hdr) work_queue;
111 LIST_HEAD(, ccb_hdr) atio_list; /* List of ATIOs queued to SIM. */
112 LIST_HEAD(, ccb_hdr) inot_list; /* List of INOTs queued to SIM. */
113 STAILQ_ENTRY(ctlfe_lun_softc) links;
114};
115
116typedef enum {
120
125 /*
126 * XXX KDM struct bus_dma_segment is 8 bytes on i386, and 16
127 * bytes on amd64. So with 32 elements, this is 256 bytes on
128 * i386 and 512 bytes on amd64.
129 */
130#define CTLFE_MAX_SEGS 32
131 bus_dma_segment_t cam_sglist[CTLFE_MAX_SEGS];
132};
133
134/*
135 * When we register the adapter/bus, request that this many ctl_ios be
136 * allocated. This should be the maximum supported by the adapter, but we
137 * currently don't have a way to get that back from the path inquiry.
138 * XXX KDM add that to the path inquiry.
139 */
140#define CTLFE_REQ_CTL_IO 4096
141/*
142 * Number of Accept Target I/O CCBs to allocate and queue down to the
143 * adapter per LUN.
144 * XXX KDM should this be controlled by CTL?
145 */
146#define CTLFE_ATIO_PER_LUN 1024
147/*
148 * Number of Immediate Notify CCBs (used for aborts, resets, etc.) to
149 * allocate and queue down to the adapter per LUN.
150 * XXX KDM should this be controlled by CTL?
151 */
152#define CTLFE_IN_PER_LUN 1024
153
154/*
155 * Timeout (in seconds) on CTIO CCB doing DMA or sending status
156 */
157#define CTLFE_TIMEOUT 5
158
159/*
160 * Turn this on to enable extra debugging prints.
161 */
162#if 0
163#define CTLFE_DEBUG
164#endif
165
166MALLOC_DEFINE(M_CTLFE, "CAM CTL FE", "CAM CTL FE interface");
167
168#define io_ptr ppriv_ptr0
169
170/* This is only used in the CTIO */
171#define ccb_atio ppriv_ptr1
172
173#define PRIV_CCB(io) ((io)->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptrs[0])
174#define PRIV_INFO(io) ((io)->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptrs[1])
175
176static int ctlfeinitialize(void);
177static int ctlfeshutdown(void);
180static void ctlfeasync(void *callback_arg, uint32_t code,
181 struct cam_path *path, void *arg);
186static void ctlfedone(struct cam_periph *periph,
187 union ccb *done_ccb);
188
189static void ctlfe_onoffline(void *arg, int online);
190static void ctlfe_online(void *arg);
191static void ctlfe_offline(void *arg);
192static int ctlfe_lun_enable(void *arg, int lun_id);
193static int ctlfe_lun_disable(void *arg, int lun_id);
194static void ctlfe_dump_sim(struct cam_sim *sim);
195static void ctlfe_dump_queue(struct ctlfe_lun_softc *softc);
196static void ctlfe_datamove(union ctl_io *io);
197static void ctlfe_done(union ctl_io *io);
198static void ctlfe_dump(void);
199static void ctlfe_free_ccb(struct cam_periph *periph,
200 union ccb *ccb);
201static void ctlfe_requeue_ccb(struct cam_periph *periph,
202 union ccb *ccb, int unlock);
203
205{
206 ctlfeperiphinit, "ctl",
207 TAILQ_HEAD_INITIALIZER(ctlfe_driver.units), /*generation*/ 0,
210};
211
213{
214 .name = "camtgt",
215 .init = ctlfeinitialize,
216 .fe_dump = ctlfe_dump,
217 .shutdown = ctlfeshutdown,
218};
220
221static int
223{
224
225 STAILQ_INIT(&ctlfe_softc_list);
226 mtx_init(&ctlfe_list_mtx, ctlfe_mtx_desc, NULL, MTX_DEF);
228 return (0);
229}
230
231static int
233{
234 int error;
235
237 if (error != 0)
238 return (error);
239 mtx_destroy(&ctlfe_list_mtx);
240 return (0);
241}
242
243static void
244ctlfeperiphinit(void)
245{
246 cam_status status;
247
249 AC_CONTRACT, ctlfeasync, NULL, NULL);
250 if (status != CAM_REQ_CMP) {
251 printf("ctl: Failed to attach async callback due to CAM "
252 "status 0x%x!\n", status);
253 }
254}
255
256static int
258{
259
260 /* XXX: It would be good to tear down active ports here. */
261 if (!TAILQ_EMPTY(&ctlfe_driver.units))
262 return (EBUSY);
263 xpt_register_async(0, ctlfeasync, NULL, NULL);
264 return (0);
265}
266
267static void
268ctlfeasync(void *callback_arg, uint32_t code, struct cam_path *path, void *arg)
269{
270 struct ctlfe_softc *softc;
271
272#ifdef CTLFEDEBUG
273 printf("%s: entered\n", __func__);
274#endif
275
276 mtx_lock(&ctlfe_list_mtx);
277 STAILQ_FOREACH(softc, &ctlfe_softc_list, links) {
278 if (softc->path_id == xpt_path_path_id(path))
279 break;
280 }
281 mtx_unlock(&ctlfe_list_mtx);
282
283 /*
284 * When a new path gets registered, and it is capable of target
285 * mode, go ahead and attach. Later on, we may need to be more
286 * selective, but for now this will be sufficient.
287 */
288 switch (code) {
289 case AC_PATH_REGISTERED: {
290 struct ctl_port *port;
291 struct ccb_pathinq *cpi;
292 int retval;
293
294 cpi = (struct ccb_pathinq *)arg;
295
296 /* Don't attach if it doesn't support target mode */
297 if ((cpi->target_sprt & PIT_PROCESSOR) == 0) {
298#ifdef CTLFEDEBUG
299 printf("%s: SIM %s%d doesn't support target mode\n",
300 __func__, cpi->dev_name, cpi->unit_number);
301#endif
302 break;
303 }
304
305 if (softc != NULL) {
306#ifdef CTLFEDEBUG
307 printf("%s: CTL port for CAM path %u already exists\n",
308 __func__, xpt_path_path_id(path));
309#endif
310 break;
311 }
312
313 /*
314 * We're in an interrupt context here, so we have to
315 * use M_NOWAIT. Of course this means trouble if we
316 * can't allocate memory.
317 */
318 softc = malloc(sizeof(*softc), M_CTLFE, M_NOWAIT | M_ZERO);
319 if (softc == NULL) {
320 printf("%s: unable to malloc %zd bytes for softc\n",
321 __func__, sizeof(*softc));
322 return;
323 }
324
325 softc->path_id = cpi->ccb_h.path_id;
326 softc->target_id = cpi->initiator_id;
327 softc->sim = xpt_path_sim(path);
328 softc->hba_misc = cpi->hba_misc;
329 if (cpi->maxio != 0)
330 softc->maxio = cpi->maxio;
331 else
332 softc->maxio = DFLTPHYS;
333 mtx_init(&softc->lun_softc_mtx, "LUN softc mtx", NULL, MTX_DEF);
334 STAILQ_INIT(&softc->lun_softc_list);
335
336 port = &softc->port;
337 port->frontend = &ctlfe_frontend;
338
339 /*
340 * XXX KDM should we be more accurate here ?
341 */
342 if (cpi->transport == XPORT_FC)
343 port->port_type = CTL_PORT_FC;
344 else if (cpi->transport == XPORT_SAS)
345 port->port_type = CTL_PORT_SAS;
346 else
347 port->port_type = CTL_PORT_SCSI;
348
349 /* XXX KDM what should the real number be here? */
351 snprintf(softc->port_name, sizeof(softc->port_name),
352 "%s%d", cpi->dev_name, cpi->unit_number);
353 /*
354 * XXX KDM it would be nice to allocate storage in the
355 * frontend structure itself.
356 */
357 port->port_name = softc->port_name;
358 port->physical_port = cpi->bus_id;
359 port->virtual_port = 0;
362 port->onoff_arg = softc;
365 port->targ_lun_arg = softc;
367 port->fe_done = ctlfe_done;
368 port->targ_port = -1;
369
370 retval = ctl_port_register(port);
371 if (retval != 0) {
372 printf("%s: ctl_port_register() failed with "
373 "error %d!\n", __func__, retval);
374 mtx_destroy(&softc->lun_softc_mtx);
375 free(softc, M_CTLFE);
376 break;
377 } else {
378 mtx_lock(&ctlfe_list_mtx);
379 STAILQ_INSERT_TAIL(&ctlfe_softc_list, softc, links);
380 mtx_unlock(&ctlfe_list_mtx);
381 }
382
383 break;
384 }
386 if (softc != NULL) {
387 /*
388 * XXX KDM are we certain at this point that there
389 * are no outstanding commands for this frontend?
390 */
391 mtx_lock(&ctlfe_list_mtx);
392 STAILQ_REMOVE(&ctlfe_softc_list, softc, ctlfe_softc,
393 links);
394 mtx_unlock(&ctlfe_list_mtx);
395 ctl_port_deregister(&softc->port);
396 mtx_destroy(&softc->lun_softc_mtx);
397 free(softc, M_CTLFE);
398 }
399 break;
400 }
401 case AC_CONTRACT: {
402 struct ac_contract *ac;
403
404 ac = (struct ac_contract *)arg;
405
406 switch (ac->contract_number) {
407 case AC_CONTRACT_DEV_CHG: {
408 struct ac_device_changed *dev_chg;
409 int retval;
410
411 dev_chg = (struct ac_device_changed *)ac->contract_data;
412
413 printf("%s: WWPN %#jx port 0x%06x path %u target %u %s\n",
414 __func__, dev_chg->wwpn, dev_chg->port,
415 xpt_path_path_id(path), dev_chg->target,
416 (dev_chg->arrived == 0) ? "left" : "arrived");
417
418 if (softc == NULL) {
419 printf("%s: CTL port for CAM path %u not "
420 "found!\n", __func__,
421 xpt_path_path_id(path));
422 break;
423 }
424 if (dev_chg->arrived != 0) {
425 retval = ctl_add_initiator(&softc->port,
426 dev_chg->target, dev_chg->wwpn, NULL);
427 } else {
428 retval = ctl_remove_initiator(&softc->port,
429 dev_chg->target);
430 }
431
432 if (retval < 0) {
433 printf("%s: could not %s port %d iid %u "
434 "WWPN %#jx!\n", __func__,
435 (dev_chg->arrived != 0) ? "add" :
436 "remove", softc->port.targ_port,
437 dev_chg->target,
438 (uintmax_t)dev_chg->wwpn);
439 }
440 break;
441 }
442 default:
443 printf("%s: unsupported contract number %ju\n",
444 __func__, (uintmax_t)ac->contract_number);
445 break;
446 }
447 break;
448 }
449 default:
450 break;
451 }
452}
453
454static cam_status
455ctlferegister(struct cam_periph *periph, void *arg)
456{
457 struct ctlfe_softc *bus_softc;
458 struct ctlfe_lun_softc *softc;
459 union ccb ccb;
460 cam_status status;
461 int i, acstatus;
462
463 softc = (struct ctlfe_lun_softc *)arg;
464 bus_softc = softc->parent_softc;
465
466 STAILQ_INIT(&softc->work_queue);
467 LIST_INIT(&softc->atio_list);
468 LIST_INIT(&softc->inot_list);
469 softc->periph = periph;
470 periph->softc = softc;
471
472 /* Increase device openings to maximum for the SIM. */
473 if (bus_softc->sim->max_tagged_dev_openings >
474 bus_softc->sim->max_dev_openings) {
476 /*relsim_flags*/RELSIM_ADJUST_OPENINGS,
477 /*openings*/bus_softc->sim->max_tagged_dev_openings,
478 /*timeout*/0,
479 /*getcount_only*/1);
480 }
481
482 memset(&ccb, 0, sizeof(ccb));
485 ccb.cel.grp6_len = 0;
486 ccb.cel.grp7_len = 0;
487 ccb.cel.enable = 1;
488 xpt_action(&ccb);
489 status = (ccb.ccb_h.status & CAM_STATUS_MASK);
490 if (status != CAM_REQ_CMP) {
491 xpt_print(periph->path, "%s: Enable LUN failed, status 0x%x\n",
492 __func__, ccb.ccb_h.status);
493 return (status);
494 }
495
496 status = CAM_REQ_CMP;
497
498 for (i = 0; i < CTLFE_ATIO_PER_LUN; i++) {
499 union ccb *new_ccb;
500 union ctl_io *new_io;
501 struct ctlfe_cmd_info *cmd_info;
502
503 new_ccb = (union ccb *)malloc(sizeof(*new_ccb), M_CTLFE,
504 M_ZERO|M_NOWAIT);
505 if (new_ccb == NULL) {
506 status = CAM_RESRC_UNAVAIL;
507 break;
508 }
509 new_io = ctl_alloc_io_nowait(bus_softc->port.ctl_pool_ref);
510 if (new_io == NULL) {
511 free(new_ccb, M_CTLFE);
512 status = CAM_RESRC_UNAVAIL;
513 break;
514 }
515 cmd_info = malloc(sizeof(*cmd_info), M_CTLFE,
516 M_ZERO | M_NOWAIT);
517 if (cmd_info == NULL) {
518 ctl_free_io(new_io);
519 free(new_ccb, M_CTLFE);
520 status = CAM_RESRC_UNAVAIL;
521 break;
522 }
523 PRIV_INFO(new_io) = cmd_info;
524 softc->atios_alloced++;
525 new_ccb->ccb_h.io_ptr = new_io;
526 LIST_INSERT_HEAD(&softc->atio_list, &new_ccb->ccb_h, periph_links.le);
527
528 xpt_setup_ccb(&new_ccb->ccb_h, periph->path, CAM_PRIORITY_NONE);
530 new_ccb->ccb_h.cbfcnp = ctlfedone;
531 new_ccb->ccb_h.flags |= CAM_UNLOCKED;
532 xpt_action(new_ccb);
533 status = new_ccb->ccb_h.status;
534 if ((status & CAM_STATUS_MASK) != CAM_REQ_INPROG) {
535 free(cmd_info, M_CTLFE);
536 ctl_free_io(new_io);
537 free(new_ccb, M_CTLFE);
538 break;
539 }
540 }
541
542 acstatus = cam_periph_acquire(periph);
543 if (acstatus != 0) {
544 xpt_print(periph->path, "%s: could not acquire reference "
545 "count, status = %#x\n", __func__, acstatus);
546 return (CAM_REQ_CMP_ERR);
547 }
548
549 if (i == 0) {
550 xpt_print(periph->path, "%s: could not allocate ATIO CCBs, "
551 "status 0x%x\n", __func__, status);
552 return (CAM_REQ_CMP_ERR);
553 }
554
555 for (i = 0; i < CTLFE_IN_PER_LUN; i++) {
556 union ccb *new_ccb;
557 union ctl_io *new_io;
558
559 new_ccb = (union ccb *)malloc(sizeof(*new_ccb), M_CTLFE,
560 M_ZERO|M_NOWAIT);
561 if (new_ccb == NULL) {
562 status = CAM_RESRC_UNAVAIL;
563 break;
564 }
565 new_io = ctl_alloc_io_nowait(bus_softc->port.ctl_pool_ref);
566 if (new_io == NULL) {
567 free(new_ccb, M_CTLFE);
568 status = CAM_RESRC_UNAVAIL;
569 break;
570 }
571 softc->inots_alloced++;
572 new_ccb->ccb_h.io_ptr = new_io;
573 LIST_INSERT_HEAD(&softc->inot_list, &new_ccb->ccb_h, periph_links.le);
574
575 xpt_setup_ccb(&new_ccb->ccb_h, periph->path, CAM_PRIORITY_NONE);
577 new_ccb->ccb_h.cbfcnp = ctlfedone;
578 new_ccb->ccb_h.flags |= CAM_UNLOCKED;
579 xpt_action(new_ccb);
580 status = new_ccb->ccb_h.status;
581 if ((status & CAM_STATUS_MASK) != CAM_REQ_INPROG) {
582 /*
583 * Note that we don't free the CCB here. If the
584 * status is not CAM_REQ_INPROG, then we're
585 * probably talking to a SIM that says it is
586 * target-capable but doesn't support the
587 * XPT_IMMEDIATE_NOTIFY CCB. i.e. it supports the
588 * older API. In that case, it'll call xpt_done()
589 * on the CCB, and we need to free it in our done
590 * routine as a result.
591 */
592 break;
593 }
594 }
595 if ((i == 0)
596 || (status != CAM_REQ_INPROG)) {
597 xpt_print(periph->path, "%s: could not allocate immediate "
598 "notify CCBs, status 0x%x\n", __func__, status);
599 return (CAM_REQ_CMP_ERR);
600 }
601 mtx_lock(&bus_softc->lun_softc_mtx);
602 STAILQ_INSERT_TAIL(&bus_softc->lun_softc_list, softc, links);
603 mtx_unlock(&bus_softc->lun_softc_mtx);
604 return (CAM_REQ_CMP);
605}
606
607static void
609{
610 struct ctlfe_lun_softc *softc = (struct ctlfe_lun_softc *)periph->softc;
611 struct ctlfe_softc *bus_softc;
612 union ccb ccb;
613 struct ccb_hdr *hdr;
614 cam_status status;
615
616 /* Abort all ATIOs and INOTs queued to SIM. */
617 memset(&ccb, 0, sizeof(ccb));
620 LIST_FOREACH(hdr, &softc->atio_list, periph_links.le) {
621 ccb.cab.abort_ccb = (union ccb *)hdr;
622 xpt_action(&ccb);
623 }
624 LIST_FOREACH(hdr, &softc->inot_list, periph_links.le) {
625 ccb.cab.abort_ccb = (union ccb *)hdr;
626 xpt_action(&ccb);
627 }
628
629 /* Disable the LUN in SIM. */
631 ccb.cel.grp6_len = 0;
632 ccb.cel.grp7_len = 0;
633 ccb.cel.enable = 0;
634 xpt_action(&ccb);
635 status = (ccb.ccb_h.status & CAM_STATUS_MASK);
636 if (status != CAM_REQ_CMP) {
637 xpt_print(periph->path, "%s: Disable LUN failed, status 0x%x\n",
638 __func__, ccb.ccb_h.status);
639 /*
640 * XXX KDM what do we do now?
641 */
642 }
643
644 bus_softc = softc->parent_softc;
645 mtx_lock(&bus_softc->lun_softc_mtx);
646 STAILQ_REMOVE(&bus_softc->lun_softc_list, softc, ctlfe_lun_softc, links);
647 mtx_unlock(&bus_softc->lun_softc_mtx);
648}
649
650static void
652{
653 struct ctlfe_lun_softc *softc;
654
655 softc = (struct ctlfe_lun_softc *)periph->softc;
656
657 KASSERT(softc->ctios_sent == 0, ("%s: ctios_sent %d != 0",
658 __func__, softc->ctios_sent));
659 KASSERT(softc->refcount == 0, ("%s: refcount %d != 0",
660 __func__, softc->refcount));
661 KASSERT(softc->atios_alloced == 0, ("%s: atios_alloced %d != 0",
662 __func__, softc->atios_alloced));
663 KASSERT(softc->inots_alloced == 0, ("%s: inots_alloced %d != 0",
664 __func__, softc->inots_alloced));
665
666 free(softc, M_CTLFE);
667}
668
669static void
670ctlfedata(struct ctlfe_lun_softc *softc, union ctl_io *io,
671 ccb_flags *flags, uint8_t **data_ptr, uint32_t *dxfer_len,
672 u_int16_t *sglist_cnt)
673{
674 struct ctlfe_softc *bus_softc;
675 struct ctlfe_cmd_info *cmd_info;
676 struct ctl_sg_entry *ctl_sglist;
677 bus_dma_segment_t *cam_sglist;
678 size_t off;
679 int i, idx;
680
681 cmd_info = PRIV_INFO(io);
682 bus_softc = softc->parent_softc;
683
684 /*
685 * Set the direction, relative to the initiator.
686 */
687 *flags &= ~CAM_DIR_MASK;
689 *flags |= CAM_DIR_IN;
690 else
691 *flags |= CAM_DIR_OUT;
692
693 *flags &= ~CAM_DATA_MASK;
694 idx = cmd_info->cur_transfer_index;
695 off = cmd_info->cur_transfer_off;
696 cmd_info->flags &= ~CTLFE_CMD_PIECEWISE;
697 if (io->scsiio.kern_sg_entries == 0) { /* No S/G list. */
698
699 /* One time shift for SRR offset. */
700 off += io->scsiio.ext_data_filled;
701 io->scsiio.ext_data_filled = 0;
702
703 *data_ptr = io->scsiio.kern_data_ptr + off;
704 if (io->scsiio.kern_data_len - off <= bus_softc->maxio) {
705 *dxfer_len = io->scsiio.kern_data_len - off;
706 } else {
707 *dxfer_len = bus_softc->maxio;
708 cmd_info->cur_transfer_off += bus_softc->maxio;
709 cmd_info->flags |= CTLFE_CMD_PIECEWISE;
710 }
711 *sglist_cnt = 0;
712
714 *flags |= CAM_DATA_PADDR;
715 else
716 *flags |= CAM_DATA_VADDR;
717 } else { /* S/G list with physical or virtual pointers. */
718 ctl_sglist = (struct ctl_sg_entry *)io->scsiio.kern_data_ptr;
719
720 /* One time shift for SRR offset. */
721 while (io->scsiio.ext_data_filled >= ctl_sglist[idx].len - off) {
722 io->scsiio.ext_data_filled -= ctl_sglist[idx].len - off;
723 idx++;
724 off = 0;
725 }
726 off += io->scsiio.ext_data_filled;
727 io->scsiio.ext_data_filled = 0;
728
729 cam_sglist = cmd_info->cam_sglist;
730 *dxfer_len = 0;
731 for (i = 0; i < io->scsiio.kern_sg_entries - idx; i++) {
732 cam_sglist[i].ds_addr = (bus_addr_t)(uintptr_t)ctl_sglist[i + idx].addr + off;
733 if (ctl_sglist[i + idx].len - off <= bus_softc->maxio - *dxfer_len) {
734 cam_sglist[i].ds_len = ctl_sglist[idx + i].len - off;
735 *dxfer_len += cam_sglist[i].ds_len;
736 } else {
737 cam_sglist[i].ds_len = bus_softc->maxio - *dxfer_len;
738 cmd_info->cur_transfer_index = idx + i;
739 cmd_info->cur_transfer_off = cam_sglist[i].ds_len + off;
740 cmd_info->flags |= CTLFE_CMD_PIECEWISE;
741 *dxfer_len += cam_sglist[i].ds_len;
742 if (ctl_sglist[i].len != 0)
743 i++;
744 break;
745 }
746 if (i == (CTLFE_MAX_SEGS - 1) &&
747 idx + i < (io->scsiio.kern_sg_entries - 1)) {
748 cmd_info->cur_transfer_index = idx + i + 1;
749 cmd_info->cur_transfer_off = 0;
750 cmd_info->flags |= CTLFE_CMD_PIECEWISE;
751 i++;
752 break;
753 }
754 off = 0;
755 }
756 *sglist_cnt = i;
758 *flags |= CAM_DATA_SG_PADDR;
759 else
760 *flags |= CAM_DATA_SG;
761 *data_ptr = (uint8_t *)cam_sglist;
762 }
763}
764
765static void
766ctlfestart(struct cam_periph *periph, union ccb *start_ccb)
767{
768 struct ctlfe_lun_softc *softc;
769 struct ctlfe_cmd_info *cmd_info;
770 struct ccb_hdr *ccb_h;
771 struct ccb_accept_tio *atio;
772 struct ccb_scsiio *csio;
773 uint8_t *data_ptr;
774 uint32_t dxfer_len;
775 ccb_flags flags;
776 union ctl_io *io;
777 uint8_t scsi_status;
778
779 softc = (struct ctlfe_lun_softc *)periph->softc;
780
781next:
782 /* Take the ATIO off the work queue */
783 ccb_h = STAILQ_FIRST(&softc->work_queue);
784 if (ccb_h == NULL) {
785 xpt_release_ccb(start_ccb);
786 return;
787 }
788 STAILQ_REMOVE_HEAD(&softc->work_queue, periph_links.stqe);
789 atio = (struct ccb_accept_tio *)ccb_h;
790 io = (union ctl_io *)ccb_h->io_ptr;
791 csio = &start_ccb->csio;
792
793 flags = atio->ccb_h.flags &
795 cmd_info = PRIV_INFO(io);
796 cmd_info->cur_transfer_index = 0;
797 cmd_info->cur_transfer_off = 0;
798 cmd_info->flags = 0;
799
800 if (io->io_hdr.flags & CTL_FLAG_DMA_QUEUED) {
801 /*
802 * Datamove call, we need to setup the S/G list.
803 */
804 ctlfedata(softc, io, &flags, &data_ptr, &dxfer_len,
805 &csio->sglist_cnt);
806 } else {
807 /*
808 * We're done, send status back.
809 */
810 if ((io->io_hdr.flags & CTL_FLAG_ABORT) &&
811 (io->io_hdr.flags & CTL_FLAG_ABORT_STATUS) == 0) {
812 io->io_hdr.flags &= ~CTL_FLAG_STATUS_QUEUED;
813
814 /* Tell the SIM that we've aborted this ATIO */
815#ifdef CTLFEDEBUG
816 printf("%s: tag %04x abort\n", __func__, atio->tag_id);
817#endif
818 KASSERT(atio->ccb_h.func_code == XPT_ACCEPT_TARGET_IO,
819 ("func_code %#x is not ATIO", atio->ccb_h.func_code));
820 start_ccb->ccb_h.func_code = XPT_ABORT;
821 start_ccb->cab.abort_ccb = (union ccb *)atio;
822 xpt_action(start_ccb);
823
824 ctlfe_requeue_ccb(periph, (union ccb *)atio,
825 /* unlock */0);
826
827 /* XPT_ABORT is not queued, so we can take next I/O. */
828 goto next;
829 }
830 data_ptr = NULL;
831 dxfer_len = 0;
832 csio->sglist_cnt = 0;
833 }
834 scsi_status = 0;
835 if ((io->io_hdr.flags & CTL_FLAG_STATUS_QUEUED) &&
836 (cmd_info->flags & CTLFE_CMD_PIECEWISE) == 0 &&
837 ((io->io_hdr.flags & CTL_FLAG_DMA_QUEUED) == 0 ||
838 io->io_hdr.status == CTL_SUCCESS)) {
839 flags |= CAM_SEND_STATUS;
840 scsi_status = io->scsiio.scsi_status;
842#ifdef CTLFEDEBUG
843 printf("%s: tag %04x status %x\n", __func__,
844 atio->tag_id, io->io_hdr.status);
845#endif
846 if (csio->sense_len != 0) {
848 flags |= CAM_SEND_SENSE;
849 }
850 }
851
852#ifdef CTLFEDEBUG
853 printf("%s: %s: tag %04x flags %x ptr %p len %u\n", __func__,
854 (flags & CAM_SEND_STATUS) ? "done" : "datamove",
855 atio->tag_id, flags, data_ptr, dxfer_len);
856#endif
857
858 /*
859 * Valid combinations:
860 * - CAM_SEND_STATUS, CAM_DATA_SG = 0, dxfer_len = 0,
861 * sglist_cnt = 0
862 * - CAM_SEND_STATUS = 0, CAM_DATA_SG = 0, dxfer_len != 0,
863 * sglist_cnt = 0
864 * - CAM_SEND_STATUS = 0, CAM_DATA_SG, dxfer_len != 0,
865 * sglist_cnt != 0
866 */
867#ifdef CTLFEDEBUG
868 if (((flags & CAM_SEND_STATUS)
869 && (((flags & CAM_DATA_SG) != 0)
870 || (dxfer_len != 0)
871 || (csio->sglist_cnt != 0)))
872 || (((flags & CAM_SEND_STATUS) == 0)
873 && (dxfer_len == 0))
874 || ((flags & CAM_DATA_SG)
875 && (csio->sglist_cnt == 0))
876 || (((flags & CAM_DATA_SG) == 0)
877 && (csio->sglist_cnt != 0))) {
878 printf("%s: tag %04x cdb %02x flags %#x dxfer_len "
879 "%d sg %u\n", __func__, atio->tag_id,
880 atio_cdb_ptr(atio)[0], flags, dxfer_len,
882 printf("%s: tag %04x io status %#x\n", __func__,
883 atio->tag_id, io->io_hdr.status);
884 }
885#endif
887 /*retries*/ 2,
888 ctlfedone,
889 flags,
891 atio->tag_id,
892 atio->init_id,
893 scsi_status,
894 /*data_ptr*/ data_ptr,
895 /*dxfer_len*/ dxfer_len,
896 /*timeout*/ CTLFE_TIMEOUT * 1000);
897 start_ccb->ccb_h.flags |= CAM_UNLOCKED;
898 start_ccb->ccb_h.ccb_atio = atio;
902
903 softc->ctios_sent++;
904 softc->refcount++;
905 cam_periph_unlock(periph);
906 xpt_action(start_ccb);
907 cam_periph_lock(periph);
908 softc->refcount--;
909
910 /*
911 * If we still have work to do, ask for another CCB.
912 */
913 if (!STAILQ_EMPTY(&softc->work_queue))
915}
916
917static void
918ctlfe_drain(void *context, int pending)
919{
920 struct cam_periph *periph = context;
921 struct ctlfe_lun_softc *softc = periph->softc;
922
924 while (softc->refcount != 0) {
925 cam_periph_sleep(periph, &softc->refcount, PRIBIO,
926 "ctlfe_drain", 1);
927 }
930}
931
932static void
934{
935 struct ctlfe_lun_softc *softc;
936 union ctl_io *io;
937 struct ctlfe_cmd_info *cmd_info;
938
939 softc = (struct ctlfe_lun_softc *)periph->softc;
940 io = ccb->ccb_h.io_ptr;
941
942 switch (ccb->ccb_h.func_code) {
944 softc->atios_alloced--;
945 cmd_info = PRIV_INFO(io);
946 free(cmd_info, M_CTLFE);
947 break;
950 softc->inots_alloced--;
951 break;
952 default:
953 break;
954 }
955
956 ctl_free_io(io);
957 free(ccb, M_CTLFE);
958
959 KASSERT(softc->atios_alloced >= 0, ("%s: atios_alloced %d < 0",
960 __func__, softc->atios_alloced));
961 KASSERT(softc->inots_alloced >= 0, ("%s: inots_alloced %d < 0",
962 __func__, softc->inots_alloced));
963
964 /*
965 * If we have received all of our CCBs, we can release our
966 * reference on the peripheral driver. It will probably go away
967 * now.
968 */
969 if (softc->atios_alloced == 0 && softc->inots_alloced == 0) {
970 if (softc->refcount == 0) {
972 } else {
973 TASK_INIT(&softc->refdrain_task, 0, ctlfe_drain, periph);
974 taskqueue_enqueue(taskqueue_thread,
975 &softc->refdrain_task);
976 }
977 }
978}
979
980/*
981 * Send the ATIO/INOT back to the SIM, or free it if periph was invalidated.
982 */
983static void
984ctlfe_requeue_ccb(struct cam_periph *periph, union ccb *ccb, int unlock)
985{
986 struct ctlfe_lun_softc *softc;
987 struct mtx *mtx;
988
989 if (periph->flags & CAM_PERIPH_INVALID) {
990 mtx = cam_periph_mtx(periph);
991 ctlfe_free_ccb(periph, ccb);
992 if (unlock)
993 mtx_unlock(mtx);
994 return;
995 }
996 softc = (struct ctlfe_lun_softc *)periph->softc;
998 LIST_INSERT_HEAD(&softc->atio_list, &ccb->ccb_h, periph_links.le);
999 else
1000 LIST_INSERT_HEAD(&softc->inot_list, &ccb->ccb_h, periph_links.le);
1001 if (unlock)
1003
1004 /*
1005 * For a wildcard attachment, commands can come in with a specific
1006 * target/lun. Reset the target and LUN fields back to the wildcard
1007 * values before we send them back down to the SIM.
1008 */
1010 ccb->ccb_h.flags);
1011
1012 xpt_action(ccb);
1013}
1014
1015static int
1016ctlfe_adjust_cdb(struct ccb_accept_tio *atio, uint32_t offset)
1017{
1018 uint64_t lba;
1019 uint32_t num_blocks, nbc;
1020 uint8_t *cmdbyt = atio_cdb_ptr(atio);
1021
1022 nbc = offset >> 9; /* ASSUMING 512 BYTE BLOCKS */
1023
1024 switch (cmdbyt[0]) {
1025 case READ_6:
1026 case WRITE_6:
1027 {
1028 struct scsi_rw_6 *cdb = (struct scsi_rw_6 *)cmdbyt;
1029 lba = scsi_3btoul(cdb->addr);
1030 lba &= 0x1fffff;
1031 num_blocks = cdb->length;
1032 if (num_blocks == 0)
1033 num_blocks = 256;
1034 lba += nbc;
1035 num_blocks -= nbc;
1036 scsi_ulto3b(lba, cdb->addr);
1037 cdb->length = num_blocks;
1038 break;
1039 }
1040 case READ_10:
1041 case WRITE_10:
1042 {
1043 struct scsi_rw_10 *cdb = (struct scsi_rw_10 *)cmdbyt;
1044 lba = scsi_4btoul(cdb->addr);
1045 num_blocks = scsi_2btoul(cdb->length);
1046 lba += nbc;
1047 num_blocks -= nbc;
1048 scsi_ulto4b(lba, cdb->addr);
1049 scsi_ulto2b(num_blocks, cdb->length);
1050 break;
1051 }
1052 case READ_12:
1053 case WRITE_12:
1054 {
1055 struct scsi_rw_12 *cdb = (struct scsi_rw_12 *)cmdbyt;
1056 lba = scsi_4btoul(cdb->addr);
1057 num_blocks = scsi_4btoul(cdb->length);
1058 lba += nbc;
1059 num_blocks -= nbc;
1060 scsi_ulto4b(lba, cdb->addr);
1061 scsi_ulto4b(num_blocks, cdb->length);
1062 break;
1063 }
1064 case READ_16:
1065 case WRITE_16:
1066 {
1067 struct scsi_rw_16 *cdb = (struct scsi_rw_16 *)cmdbyt;
1068 lba = scsi_8btou64(cdb->addr);
1069 num_blocks = scsi_4btoul(cdb->length);
1070 lba += nbc;
1071 num_blocks -= nbc;
1072 scsi_u64to8b(lba, cdb->addr);
1073 scsi_ulto4b(num_blocks, cdb->length);
1074 break;
1075 }
1076 default:
1077 return -1;
1078 }
1079 return (0);
1080}
1081
1082static void
1083ctlfedone(struct cam_periph *periph, union ccb *done_ccb)
1084{
1085 struct ctlfe_lun_softc *softc;
1086 struct ctlfe_softc *bus_softc;
1087 struct ctlfe_cmd_info *cmd_info;
1088 struct ccb_accept_tio *atio = NULL;
1089 union ctl_io *io = NULL;
1090 struct mtx *mtx;
1091 cam_status status;
1092
1093 KASSERT((done_ccb->ccb_h.flags & CAM_UNLOCKED) != 0,
1094 ("CCB in ctlfedone() without CAM_UNLOCKED flag"));
1095#ifdef CTLFE_DEBUG
1096 printf("%s: entered, func_code = %#x\n", __func__,
1097 done_ccb->ccb_h.func_code);
1098#endif
1099
1100 /*
1101 * At this point CTL has no known use case for device queue freezes.
1102 * In case some SIM think different -- drop its freeze right here.
1103 */
1104 if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) {
1105 cam_release_devq(periph->path,
1106 /*relsim_flags*/0,
1107 /*reduction*/0,
1108 /*timeout*/0,
1109 /*getcount_only*/0);
1110 done_ccb->ccb_h.status &= ~CAM_DEV_QFRZN;
1111 }
1112
1113 softc = (struct ctlfe_lun_softc *)periph->softc;
1114 bus_softc = softc->parent_softc;
1115 mtx = cam_periph_mtx(periph);
1116 mtx_lock(mtx);
1117
1118 switch (done_ccb->ccb_h.func_code) {
1119 case XPT_ACCEPT_TARGET_IO: {
1120 LIST_REMOVE(&done_ccb->ccb_h, periph_links.le);
1121 atio = &done_ccb->atio;
1122 status = atio->ccb_h.status & CAM_STATUS_MASK;
1123 if (status != CAM_CDB_RECVD) {
1124 ctlfe_free_ccb(periph, done_ccb);
1125 goto out;
1126 }
1127
1128 resubmit:
1129 /*
1130 * Allocate a ctl_io, pass it to CTL, and wait for the
1131 * datamove or done.
1132 */
1133 mtx_unlock(mtx);
1134 io = done_ccb->ccb_h.io_ptr;
1135 cmd_info = PRIV_INFO(io);
1136 ctl_zero_io(io);
1137
1138 /* Save pointers on both sides */
1139 PRIV_CCB(io) = done_ccb;
1140 PRIV_INFO(io) = cmd_info;
1141 done_ccb->ccb_h.io_ptr = io;
1142
1143 /*
1144 * Only SCSI I/O comes down this path, resets, etc. come
1145 * down the immediate notify path below.
1146 */
1148 io->io_hdr.nexus.initid = atio->init_id;
1149 io->io_hdr.nexus.targ_port = bus_softc->port.targ_port;
1150 if (bus_softc->hba_misc & PIM_EXTLUNS) {
1153 } else {
1154 io->io_hdr.nexus.targ_lun = atio->ccb_h.target_lun;
1155 }
1156 io->scsiio.priority = atio->priority;
1157 io->scsiio.tag_num = atio->tag_id;
1158 switch (atio->tag_action) {
1161 break;
1162 case MSG_SIMPLE_TASK:
1164 break;
1167 break;
1168 case MSG_ORDERED_TASK:
1170 break;
1171 case MSG_ACA_TASK:
1173 break;
1174 default:
1176 printf("%s: unhandled tag type %#x!!\n", __func__,
1177 atio->tag_action);
1178 break;
1179 }
1180 if (atio->cdb_len > sizeof(io->scsiio.cdb)) {
1181 printf("%s: WARNING: CDB len %d > ctl_io space %zd\n",
1182 __func__, atio->cdb_len, sizeof(io->scsiio.cdb));
1183 }
1184 io->scsiio.cdb_len = min(atio->cdb_len, sizeof(io->scsiio.cdb));
1185 bcopy(atio_cdb_ptr(atio), io->scsiio.cdb, io->scsiio.cdb_len);
1186
1187#ifdef CTLFEDEBUG
1188 printf("%s: %u:%u:%u: tag %04x CDB %02x\n", __func__,
1189 io->io_hdr.nexus.initid,
1191 io->io_hdr.nexus.targ_lun,
1192 io->scsiio.tag_num, io->scsiio.cdb[0]);
1193#endif
1194
1195 ctl_queue(io);
1196 return;
1197 }
1198 case XPT_CONT_TARGET_IO: {
1199 int srr = 0;
1200 uint32_t srr_off = 0;
1201
1202 atio = (struct ccb_accept_tio *)done_ccb->ccb_h.ccb_atio;
1203 io = (union ctl_io *)atio->ccb_h.io_ptr;
1204
1205 softc->ctios_sent--;
1206#ifdef CTLFEDEBUG
1207 printf("%s: got XPT_CONT_TARGET_IO tag %#x flags %#x\n",
1208 __func__, atio->tag_id, done_ccb->ccb_h.flags);
1209#endif
1210 /*
1211 * Handle SRR case were the data pointer is pushed back hack
1212 */
1213 if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_MESSAGE_RECV
1214 && done_ccb->csio.msg_ptr != NULL
1215 && done_ccb->csio.msg_ptr[0] == MSG_EXTENDED
1216 && done_ccb->csio.msg_ptr[1] == 5
1217 && done_ccb->csio.msg_ptr[2] == 0) {
1218 srr = 1;
1219 srr_off =
1220 (done_ccb->csio.msg_ptr[3] << 24)
1221 | (done_ccb->csio.msg_ptr[4] << 16)
1222 | (done_ccb->csio.msg_ptr[5] << 8)
1223 | (done_ccb->csio.msg_ptr[6]);
1224 }
1225
1226 /*
1227 * If we have an SRR and we're still sending data, we
1228 * should be able to adjust offsets and cycle again.
1229 * It is possible only if offset is from this datamove.
1230 */
1231 if (srr && (io->io_hdr.flags & CTL_FLAG_DMA_INPROG) &&
1232 srr_off >= io->scsiio.kern_rel_offset &&
1233 srr_off < io->scsiio.kern_rel_offset +
1234 io->scsiio.kern_data_len) {
1237 io->scsiio.kern_data_len - srr_off;
1238 io->scsiio.ext_data_filled = srr_off;
1241 xpt_release_ccb(done_ccb);
1242 STAILQ_INSERT_HEAD(&softc->work_queue, &atio->ccb_h,
1243 periph_links.stqe);
1245 break;
1246 }
1247
1248 /*
1249 * If status was being sent, the back end data is now history.
1250 * Hack it up and resubmit a new command with the CDB adjusted.
1251 * If the SIM does the right thing, all of the resid math
1252 * should work.
1253 */
1254 if (srr && (io->io_hdr.flags & CTL_FLAG_DMA_INPROG) == 0) {
1255 xpt_release_ccb(done_ccb);
1256 if (ctlfe_adjust_cdb(atio, srr_off) == 0) {
1257 done_ccb = (union ccb *)atio;
1258 goto resubmit;
1259 }
1260 /*
1261 * Fall through to doom....
1262 */
1263 }
1264
1265 if ((done_ccb->ccb_h.flags & CAM_SEND_STATUS) &&
1266 (done_ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP)
1268
1269 /*
1270 * If we were sending status back to the initiator, free up
1271 * resources. If we were doing a datamove, call the
1272 * datamove done routine.
1273 */
1274 if ((io->io_hdr.flags & CTL_FLAG_DMA_INPROG) == 0) {
1275 /*
1276 * If we asked to send sense data but it wasn't sent,
1277 * queue the I/O back to CTL for later REQUEST SENSE.
1278 */
1279 if ((done_ccb->ccb_h.flags & CAM_SEND_SENSE) != 0 &&
1280 (done_ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP &&
1281 (done_ccb->ccb_h.status & CAM_SENT_SENSE) == 0 &&
1282 (io = ctl_alloc_io_nowait(bus_softc->port.ctl_pool_ref)) != NULL) {
1283 PRIV_INFO(io) = PRIV_INFO(
1284 (union ctl_io *)atio->ccb_h.io_ptr);
1285 ctl_queue_sense(atio->ccb_h.io_ptr);
1286 atio->ccb_h.io_ptr = io;
1287 }
1288
1289 /* Abort ATIO if CTIO sending status has failed. */
1290 if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) !=
1291 CAM_REQ_CMP) {
1292 done_ccb->ccb_h.func_code = XPT_ABORT;
1293 done_ccb->cab.abort_ccb = (union ccb *)atio;
1294 xpt_action(done_ccb);
1295 }
1296
1297 xpt_release_ccb(done_ccb);
1298 ctlfe_requeue_ccb(periph, (union ccb *)atio,
1299 /* unlock */1);
1300 return;
1301 } else {
1302 struct ctlfe_cmd_info *cmd_info;
1303 struct ccb_scsiio *csio;
1304
1305 csio = &done_ccb->csio;
1306 cmd_info = PRIV_INFO(io);
1307
1308 io->io_hdr.flags &= ~CTL_FLAG_DMA_INPROG;
1309
1310 /*
1311 * Translate CAM status to CTL status. Success
1312 * does not change the overall, ctl_io status. In
1313 * that case we just set port_status to 0. If we
1314 * have a failure, though, set a data phase error
1315 * for the overall ctl_io.
1316 */
1317 switch (done_ccb->ccb_h.status & CAM_STATUS_MASK) {
1318 case CAM_REQ_CMP:
1319 io->scsiio.kern_data_resid -=
1320 csio->dxfer_len - csio->resid;
1321 io->io_hdr.port_status = 0;
1322 break;
1323 default:
1324 /*
1325 * XXX KDM we probably need to figure out a
1326 * standard set of errors that the SIM
1327 * drivers should return in the event of a
1328 * data transfer failure. A data phase
1329 * error will at least point the user to a
1330 * data transfer error of some sort.
1331 * Hopefully the SIM printed out some
1332 * additional information to give the user
1333 * a clue what happened.
1334 */
1335 io->io_hdr.port_status = 0xbad1;
1337 /*
1338 * XXX KDM figure out residual.
1339 */
1340 break;
1341 }
1342 /*
1343 * If we had to break this S/G list into multiple
1344 * pieces, figure out where we are in the list, and
1345 * continue sending pieces if necessary.
1346 */
1347 if ((cmd_info->flags & CTLFE_CMD_PIECEWISE) &&
1348 io->io_hdr.port_status == 0 && csio->resid == 0) {
1349 ccb_flags flags;
1350 uint8_t *data_ptr;
1351 uint32_t dxfer_len;
1352
1353 flags = atio->ccb_h.flags &
1356
1357 ctlfedata(softc, io, &flags, &data_ptr,
1358 &dxfer_len, &csio->sglist_cnt);
1359
1360 if (((flags & CAM_SEND_STATUS) == 0)
1361 && (dxfer_len == 0)) {
1362 printf("%s: tag %04x no status or "
1363 "len cdb = %02x\n", __func__,
1364 atio->tag_id,
1365 atio_cdb_ptr(atio)[0]);
1366 printf("%s: tag %04x io status %#x\n",
1367 __func__, atio->tag_id,
1368 io->io_hdr.status);
1369 }
1370
1371 cam_fill_ctio(csio,
1372 /*retries*/ 2,
1373 ctlfedone,
1374 flags,
1375 (flags & CAM_TAG_ACTION_VALID) ?
1376 MSG_SIMPLE_Q_TAG : 0,
1377 atio->tag_id,
1378 atio->init_id,
1379 0,
1380 /*data_ptr*/ data_ptr,
1381 /*dxfer_len*/ dxfer_len,
1382 CTLFE_TIMEOUT * 1000);
1383
1384 csio->ccb_h.flags |= CAM_UNLOCKED;
1385 csio->resid = 0;
1386 csio->ccb_h.ccb_atio = atio;
1388 softc->ctios_sent++;
1389 mtx_unlock(mtx);
1390 xpt_action((union ccb *)csio);
1391 } else {
1392 /*
1393 * Release the CTIO. The ATIO will be sent back
1394 * down to the SIM once we send status.
1395 */
1396 xpt_release_ccb(done_ccb);
1397 mtx_unlock(mtx);
1398
1399 ctl_datamove_done(io, false);
1400 }
1401 return;
1402 }
1403 break;
1404 }
1405 case XPT_IMMEDIATE_NOTIFY: {
1406 union ctl_io *io;
1407 struct ccb_immediate_notify *inot;
1408 int send_ctl_io;
1409
1410 LIST_REMOVE(&done_ccb->ccb_h, periph_links.le);
1411 inot = &done_ccb->cin1;
1412 io = done_ccb->ccb_h.io_ptr;
1413 ctl_zero_io(io);
1414
1415 send_ctl_io = 1;
1416
1418 PRIV_CCB(io) = done_ccb;
1419 inot->ccb_h.io_ptr = io;
1420 io->io_hdr.nexus.initid = inot->initiator_id;
1421 io->io_hdr.nexus.targ_port = bus_softc->port.targ_port;
1422 if (bus_softc->hba_misc & PIM_EXTLUNS) {
1425 } else {
1426 io->io_hdr.nexus.targ_lun = inot->ccb_h.target_lun;
1427 }
1428 /* XXX KDM should this be the tag_id? */
1429 io->taskio.tag_num = inot->seq_id;
1430
1431 status = inot->ccb_h.status & CAM_STATUS_MASK;
1432 switch (status) {
1433 case CAM_SCSI_BUS_RESET:
1435 break;
1436 case CAM_BDR_SENT:
1438 break;
1439 case CAM_MESSAGE_RECV:
1440 switch (inot->arg) {
1441 case MSG_ABORT_TASK_SET:
1442 io->taskio.task_action =
1444 break;
1445 case MSG_TARGET_RESET:
1447 break;
1448 case MSG_ABORT_TASK:
1450 break;
1453 break;
1454 case MSG_CLEAR_TASK_SET:
1455 io->taskio.task_action =
1457 break;
1458 case MSG_CLEAR_ACA:
1460 break;
1461 case MSG_QUERY_TASK:
1463 break;
1464 case MSG_QUERY_TASK_SET:
1465 io->taskio.task_action =
1467 break;
1469 io->taskio.task_action =
1471 break;
1472 case MSG_NOOP:
1473 send_ctl_io = 0;
1474 break;
1475 default:
1476 xpt_print(periph->path,
1477 "%s: unsupported INOT message 0x%x\n",
1478 __func__, inot->arg);
1479 send_ctl_io = 0;
1480 break;
1481 }
1482 break;
1483 default:
1484 xpt_print(periph->path,
1485 "%s: unsupported INOT status 0x%x\n",
1486 __func__, status);
1487 /* FALLTHROUGH */
1488 case CAM_REQ_ABORTED:
1489 case CAM_REQ_INVALID:
1490 case CAM_DEV_NOT_THERE:
1491 case CAM_PROVIDE_FAIL:
1492 ctlfe_free_ccb(periph, done_ccb);
1493 goto out;
1494 }
1495 mtx_unlock(mtx);
1496 if (send_ctl_io != 0) {
1497 ctl_queue(io);
1498 } else {
1499 done_ccb->ccb_h.status = CAM_REQ_INPROG;
1501 xpt_action(done_ccb);
1502 }
1503 return;
1504 }
1506 /* Queue this back down to the SIM as an immediate notify. */
1507 done_ccb->ccb_h.status = CAM_REQ_INPROG;
1509 ctlfe_requeue_ccb(periph, done_ccb, /* unlock */1);
1510 return;
1511 case XPT_SET_SIM_KNOB:
1512 case XPT_GET_SIM_KNOB:
1514 break;
1515 default:
1516 panic("%s: unexpected CCB type %#x", __func__,
1517 done_ccb->ccb_h.func_code);
1518 break;
1519 }
1520
1521out:
1522 mtx_unlock(mtx);
1523}
1524
1525static void
1526ctlfe_onoffline(void *arg, int online)
1527{
1528 struct ctlfe_softc *bus_softc = arg;
1529 union ccb *ccb;
1530 cam_status status;
1531 struct cam_path *path;
1532 int set_wwnn = 0;
1533
1534 status = xpt_create_path(&path, /*periph*/ NULL, bus_softc->path_id,
1536 if (status != CAM_REQ_CMP) {
1537 printf("%s: unable to create path!\n", __func__);
1538 return;
1539 }
1540 ccb = xpt_alloc_ccb();
1543 xpt_action(ccb);
1544
1545 /* Check whether we should change WWNs. */
1546 if (online != 0) {
1548 printf("%s: %s current WWNN %#jx\n", __func__,
1549 bus_softc->port_name,
1551 printf("%s: %s current WWPN %#jx\n", __func__,
1552 bus_softc->port_name,
1554
1555 /*
1556 * If the user has specified a WWNN/WWPN, send them
1557 * down to the SIM. Otherwise, record what the SIM
1558 * has reported.
1559 */
1560 if (bus_softc->port.wwnn != 0 && bus_softc->port.wwnn
1563 bus_softc->port.wwnn;
1564 set_wwnn = 1;
1565 } else {
1566 ctl_port_set_wwns(&bus_softc->port,
1567 true, ccb->knob.xport_specific.fc.wwnn,
1568 false, 0);
1569 }
1570 if (bus_softc->port.wwpn != 0 && bus_softc->port.wwpn
1573 bus_softc->port.wwpn;
1574 set_wwnn = 1;
1575 } else {
1576 ctl_port_set_wwns(&bus_softc->port,
1577 false, 0,
1578 true, ccb->knob.xport_specific.fc.wwpn);
1579 }
1580 } else {
1581 printf("%s: %s has no valid WWNN/WWPN\n", __func__,
1582 bus_softc->port_name);
1583 if (bus_softc->port.wwnn != 0) {
1585 bus_softc->port.wwnn;
1586 set_wwnn = 1;
1587 }
1588 if (bus_softc->port.wwpn != 0) {
1590 bus_softc->port.wwpn;
1591 set_wwnn = 1;
1592 }
1593 }
1594 }
1595 if (set_wwnn) {
1598 xpt_action(ccb);
1600 printf("%s: %s (path id %d) failed set WWNs: %#x\n",
1601 __func__, bus_softc->port_name, bus_softc->path_id,
1602 ccb->ccb_h.status);
1603 } else {
1604 printf("%s: %s new WWNN %#jx\n", __func__,
1605 bus_softc->port_name,
1607 printf("%s: %s new WWPN %#jx\n", __func__,
1608 bus_softc->port_name,
1610 }
1611 }
1612
1613 /* Check whether we should change role. */
1615 ((online != 0) ^
1616 ((ccb->knob.xport_specific.fc.role & KNOB_ROLE_TARGET) != 0)) != 0) {
1619 if (online)
1621 else
1622 ccb->knob.xport_specific.fc.role &= ~KNOB_ROLE_TARGET;
1623 xpt_action(ccb);
1625 printf("%s: %s (path id %d) failed %s target role: %#x\n",
1626 __func__, bus_softc->port_name, bus_softc->path_id,
1627 online ? "enable" : "disable", ccb->ccb_h.status);
1628 } else {
1629 printf("%s: %s (path id %d) target role %s succeeded\n",
1630 __func__, bus_softc->port_name, bus_softc->path_id,
1631 online ? "enable" : "disable");
1632 }
1633 }
1634
1635 xpt_free_path(path);
1637}
1638
1639static void
1641{
1642 struct ctlfe_softc *bus_softc;
1643 struct cam_path *path;
1644 cam_status status;
1645 struct ctlfe_lun_softc *lun_softc;
1646 struct cam_periph *periph;
1647
1648 bus_softc = (struct ctlfe_softc *)arg;
1649
1650 /*
1651 * Create the wildcard LUN before bringing the port online.
1652 */
1653 status = xpt_create_path(&path, /*periph*/ NULL,
1654 bus_softc->path_id, CAM_TARGET_WILDCARD,
1656 if (status != CAM_REQ_CMP) {
1657 printf("%s: unable to create path for wildcard periph\n",
1658 __func__);
1659 return;
1660 }
1661
1662 lun_softc = malloc(sizeof(*lun_softc), M_CTLFE, M_WAITOK | M_ZERO);
1663
1664 xpt_path_lock(path);
1665 periph = cam_periph_find(path, "ctl");
1666 if (periph != NULL) {
1667 /* We've already got a periph, no need to alloc a new one. */
1668 xpt_path_unlock(path);
1669 xpt_free_path(path);
1670 free(lun_softc, M_CTLFE);
1671 return;
1672 }
1673 lun_softc->parent_softc = bus_softc;
1674 lun_softc->flags |= CTLFE_LUN_WILDCARD;
1675
1679 ctlfestart,
1680 "ctl",
1682 path,
1683 ctlfeasync,
1684 0,
1685 lun_softc);
1686
1687 if ((status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
1688 const struct cam_status_entry *entry;
1689
1690 entry = cam_fetch_status_entry(status);
1691 printf("%s: CAM error %s (%#x) returned from "
1692 "cam_periph_alloc()\n", __func__, (entry != NULL) ?
1693 entry->status_text : "Unknown", status);
1694 free(lun_softc, M_CTLFE);
1695 }
1696
1697 xpt_path_unlock(path);
1698 ctlfe_onoffline(arg, /*online*/ 1);
1699 xpt_free_path(path);
1700}
1701
1702static void
1704{
1705 struct ctlfe_softc *bus_softc;
1706 struct cam_path *path;
1707 cam_status status;
1708 struct cam_periph *periph;
1709
1710 bus_softc = (struct ctlfe_softc *)arg;
1711
1712 ctlfe_onoffline(arg, /*online*/ 0);
1713
1714 /*
1715 * Disable the wildcard LUN for this port now that we have taken
1716 * the port offline.
1717 */
1718 status = xpt_create_path(&path, /*periph*/ NULL,
1719 bus_softc->path_id, CAM_TARGET_WILDCARD,
1721 if (status != CAM_REQ_CMP) {
1722 printf("%s: unable to create path for wildcard periph\n",
1723 __func__);
1724 return;
1725 }
1726 xpt_path_lock(path);
1727 if ((periph = cam_periph_find(path, "ctl")) != NULL)
1728 cam_periph_invalidate(periph);
1729 xpt_path_unlock(path);
1730 xpt_free_path(path);
1731}
1732
1733/*
1734 * This will get called to enable a LUN on every bus that is attached to
1735 * CTL. So we only need to create a path/periph for this particular bus.
1736 */
1737static int
1738ctlfe_lun_enable(void *arg, int lun_id)
1739{
1740 struct ctlfe_softc *bus_softc;
1741 struct ctlfe_lun_softc *softc;
1742 struct cam_path *path;
1743 struct cam_periph *periph;
1744 cam_status status;
1745
1746 bus_softc = (struct ctlfe_softc *)arg;
1747 if (bus_softc->hba_misc & PIM_EXTLUNS)
1748 lun_id = CAM_EXTLUN_BYTE_SWIZZLE(ctl_encode_lun(lun_id));
1749
1750 status = xpt_create_path(&path, /*periph*/ NULL,
1751 bus_softc->path_id, bus_softc->target_id, lun_id);
1752 /* XXX KDM need some way to return status to CTL here? */
1753 if (status != CAM_REQ_CMP) {
1754 printf("%s: could not create path, status %#x\n", __func__,
1755 status);
1756 return (1);
1757 }
1758
1759 softc = malloc(sizeof(*softc), M_CTLFE, M_WAITOK | M_ZERO);
1760 xpt_path_lock(path);
1761 periph = cam_periph_find(path, "ctl");
1762 if (periph != NULL) {
1763 /* We've already got a periph, no need to alloc a new one. */
1764 xpt_path_unlock(path);
1765 xpt_free_path(path);
1766 free(softc, M_CTLFE);
1767 return (0);
1768 }
1769 softc->parent_softc = bus_softc;
1770
1774 ctlfestart,
1775 "ctl",
1777 path,
1778 ctlfeasync,
1779 0,
1780 softc);
1781
1782 if ((status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
1783 const struct cam_status_entry *entry;
1784
1785 entry = cam_fetch_status_entry(status);
1786 printf("%s: CAM error %s (%#x) returned from "
1787 "cam_periph_alloc()\n", __func__, (entry != NULL) ?
1788 entry->status_text : "Unknown", status);
1789 free(softc, M_CTLFE);
1790 }
1791
1792 xpt_path_unlock(path);
1793 xpt_free_path(path);
1794 return (0);
1795}
1796
1797/*
1798 * This will get called when the user removes a LUN to disable that LUN
1799 * on every bus that is attached to CTL.
1800 */
1801static int
1802ctlfe_lun_disable(void *arg, int lun_id)
1803{
1804 struct ctlfe_softc *softc;
1805 struct ctlfe_lun_softc *lun_softc;
1806
1807 softc = (struct ctlfe_softc *)arg;
1808 if (softc->hba_misc & PIM_EXTLUNS)
1809 lun_id = CAM_EXTLUN_BYTE_SWIZZLE(ctl_encode_lun(lun_id));
1810
1811 mtx_lock(&softc->lun_softc_mtx);
1812 STAILQ_FOREACH(lun_softc, &softc->lun_softc_list, links) {
1813 struct cam_path *path;
1814
1815 path = lun_softc->periph->path;
1816
1817 if ((xpt_path_target_id(path) == softc->target_id)
1818 && (xpt_path_lun_id(path) == lun_id)) {
1819 break;
1820 }
1821 }
1822 if (lun_softc == NULL) {
1823 mtx_unlock(&softc->lun_softc_mtx);
1824 printf("%s: can't find lun %d\n", __func__, lun_id);
1825 return (1);
1826 }
1827 cam_periph_acquire(lun_softc->periph);
1828 mtx_unlock(&softc->lun_softc_mtx);
1829
1830 cam_periph_lock(lun_softc->periph);
1831 cam_periph_invalidate(lun_softc->periph);
1832 cam_periph_unlock(lun_softc->periph);
1833 cam_periph_release(lun_softc->periph);
1834 return (0);
1835}
1836
1837static void
1839{
1840
1841 printf("%s%d: max dev openings: %d, max tagged dev openings: %d\n",
1842 sim->sim_name, sim->unit_number, sim->max_dev_openings,
1844}
1845
1846/*
1847 * Assumes that the SIM lock is held.
1848 */
1849static void
1851{
1852 struct cam_periph *periph = softc->periph;
1853 struct ccb_hdr *hdr;
1854 struct ccb_getdevstats cgds;
1855 int num_items;
1856
1857 memset(&cgds, 0, sizeof(cgds));
1860 xpt_action((union ccb *)&cgds);
1861 if ((cgds.ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) {
1862 xpt_print(periph->path, "devq: openings %d, active %d, "
1863 "allocated %d, queued %d, held %d\n",
1864 cgds.dev_openings, cgds.dev_active, cgds.allocated,
1865 cgds.queued, cgds.held);
1866 }
1867
1868 num_items = 0;
1869
1870 STAILQ_FOREACH(hdr, &softc->work_queue, periph_links.stqe) {
1871 union ctl_io *io = hdr->io_ptr;
1872
1873 num_items++;
1874
1875 /*
1876 * Only regular SCSI I/O is put on the work
1877 * queue, so we can print sense here. There may be no
1878 * sense if it's no the queue for a DMA, but this serves to
1879 * print out the CCB as well.
1880 *
1881 * XXX KDM switch this over to scsi_sense_print() when
1882 * CTL is merged in with CAM.
1883 */
1884 ctl_io_error_print(io, NULL);
1885
1886 /*
1887 * Print DMA status if we are DMA_QUEUED.
1888 */
1889 if (io->io_hdr.flags & CTL_FLAG_DMA_QUEUED) {
1890 xpt_print(periph->path,
1891 "Total %u, Current %u, Resid %u\n",
1895 }
1896 }
1897
1898 xpt_print(periph->path, "%d requests waiting for CCBs\n", num_items);
1899 xpt_print(periph->path, "%d CTIOs outstanding\n", softc->ctios_sent);
1900}
1901
1902/*
1903 * Datamove/done routine called by CTL. Put ourselves on the queue to
1904 * receive a CCB from CAM so we can queue the continue I/O request down
1905 * to the adapter.
1906 */
1907static void
1909{
1910 union ccb *ccb;
1911 struct cam_periph *periph;
1912 struct ctlfe_lun_softc *softc;
1913
1914 KASSERT(io->io_hdr.io_type == CTL_IO_SCSI,
1915 ("%s: unexpected I/O type %x", __func__, io->io_hdr.io_type));
1916
1917 io->scsiio.ext_data_filled = 0;
1918 ccb = PRIV_CCB(io);
1921 softc = (struct ctlfe_lun_softc *)periph->softc;
1925 STAILQ_INSERT_TAIL(&softc->work_queue, &ccb->ccb_h,
1926 periph_links.stqe);
1929}
1930
1931static void
1933{
1934 union ccb *ccb;
1935 struct cam_periph *periph;
1936 struct ctlfe_lun_softc *softc;
1937
1938 ccb = PRIV_CCB(io);
1941 softc = (struct ctlfe_lun_softc *)periph->softc;
1942
1943 if (io->io_hdr.io_type == CTL_IO_TASK) {
1944 /*
1945 * Send the notify acknowledge down to the SIM, to let it
1946 * know we processed the task management command.
1947 */
1950 switch (io->taskio.task_status) {
1953 break;
1957 break;
1961 break;
1965 break;
1969 break;
1970 }
1971 ccb->cna2.arg |= scsi_3btoul(io->taskio.task_resp) << 8;
1972 xpt_action(ccb);
1973 } else if (io->io_hdr.flags & CTL_FLAG_STATUS_SENT) {
1974 ctlfe_requeue_ccb(periph, ccb, /* unlock */1);
1975 return;
1976 } else {
1978 STAILQ_INSERT_TAIL(&softc->work_queue, &ccb->ccb_h,
1979 periph_links.stqe);
1981 }
1982
1984}
1985
1986static void
1988{
1989 struct ctlfe_softc *bus_softc;
1990 struct ctlfe_lun_softc *lun_softc;
1991
1992 STAILQ_FOREACH(bus_softc, &ctlfe_softc_list, links) {
1993 ctlfe_dump_sim(bus_softc->sim);
1994 STAILQ_FOREACH(lun_softc, &bus_softc->lun_softc_list, links)
1995 ctlfe_dump_queue(lun_softc);
1996 }
1997}
const struct cam_status_entry * cam_fetch_status_entry(cam_status status)
Definition: cam.c:292
#define CAM_TARGET_WILDCARD
Definition: cam.h:48
#define CAM_EXTLUN_BYTE_SWIZZLE(lun)
Definition: cam.h:51
#define CAM_LUN_WILDCARD
Definition: cam.h:49
#define CAM_PRIORITY_NORMAL
Definition: cam.h:92
#define CAM_PRIORITY_NONE
Definition: cam.h:93
u_int path_id_t
Definition: cam.h:42
cam_status
Definition: cam.h:132
@ CAM_SCSI_BUS_RESET
Definition: cam.h:176
@ CAM_REQ_INVALID
Definition: cam.h:152
@ CAM_REQ_INPROG
Definition: cam.h:134
@ CAM_PROVIDE_FAIL
Definition: cam.h:200
@ CAM_REQ_CMP
Definition: cam.h:137
@ CAM_DEV_NOT_THERE
Definition: cam.h:158
@ CAM_RESRC_UNAVAIL
Definition: cam.h:247
@ CAM_MESSAGE_RECV
Definition: cam.h:253
@ CAM_REQ_CMP_ERR
Definition: cam.h:146
@ CAM_STATUS_MASK
Definition: cam.h:302
@ CAM_SENT_SENSE
Definition: cam.h:309
@ CAM_REQ_ABORTED
Definition: cam.h:140
@ CAM_CDB_RECVD
Definition: cam.h:274
@ CAM_BDR_SENT
Definition: cam.h:203
@ CAM_DEV_QFRZN
Definition: cam.h:287
u_int target_id_t
Definition: cam.h:43
@ AC_CONTRACT
Definition: cam_ccb.h:869
@ AC_PATH_DEREGISTERED
Definition: cam_ccb.h:875
@ AC_PATH_REGISTERED
Definition: cam_ccb.h:876
#define RELSIM_ADJUST_OPENINGS
Definition: cam_ccb.h:840
@ PIM_EXTLUNS
Definition: cam_ccb.h:618
#define CAM_RSP_TMF_FAILED
Definition: cam_ccb.h:1247
#define CAM_RSP_TMF_SUCCEEDED
Definition: cam_ccb.h:1248
@ PIT_PROCESSOR
Definition: cam_ccb.h:608
@ XPORT_SAS
Definition: cam_ccb.h:297
@ XPORT_FC
Definition: cam_ccb.h:292
ccb_flags
Definition: cam_ccb.h:68
@ CAM_DIR_IN
Definition: cam_ccb.h:79
@ CAM_SEND_STATUS
Definition: cam_ccb.h:117
@ CAM_DATA_PADDR
Definition: cam_ccb.h:84
@ CAM_DIS_DISCONNECT
Definition: cam_ccb.h:98
@ CAM_DIR_MASK
Definition: cam_ccb.h:82
@ CAM_DATA_VADDR
Definition: cam_ccb.h:83
@ CAM_UNLOCKED
Definition: cam_ccb.h:119
@ CAM_DATA_SG_PADDR
Definition: cam_ccb.h:86
@ CAM_SEND_SENSE
Definition: cam_ccb.h:114
@ CAM_DIR_OUT
Definition: cam_ccb.h:80
@ CAM_TAG_ACTION_VALID
Definition: cam_ccb.h:96
@ CAM_DATA_SG
Definition: cam_ccb.h:85
#define AC_CONTRACT_DEV_CHG
Definition: cam_ccb.h:898
#define CAM_RSP_TMF_INCORRECT_LUN
Definition: cam_ccb.h:1249
#define CAM_RSP_TMF_REJECTED
Definition: cam_ccb.h:1246
@ XPT_GDEV_STATS
Definition: cam_ccb.h:164
@ XPT_ACCEPT_TARGET_IO
Definition: cam_ccb.h:241
@ XPT_SET_SIM_KNOB
Definition: cam_ccb.h:204
@ XPT_IMMEDIATE_NOTIFY
Definition: cam_ccb.h:249
@ XPT_GET_SIM_KNOB
Definition: cam_ccb.h:209
@ XPT_ABORT
Definition: cam_ccb.h:172
@ XPT_GET_SIM_KNOB_OLD
Definition: cam_ccb.h:202
@ XPT_EN_LUN
Definition: cam_ccb.h:237
@ XPT_NOTIFY_ACKNOWLEDGE
Definition: cam_ccb.h:251
@ XPT_CONT_TARGET_IO
Definition: cam_ccb.h:243
static __inline void cam_fill_ctio(struct ccb_scsiio *csio, u_int32_t retries, void(*cbfcnp)(struct cam_periph *, union ccb *), u_int32_t flags, u_int tag_action, u_int tag_id, u_int init_id, u_int scsi_status, u_int8_t *data_ptr, u_int32_t dxfer_len, u_int32_t timeout)
Definition: cam_ccb.h:1414
#define CAM_TAG_ACTION_NONE
Definition: cam_ccb.h:772
#define KNOB_VALID_ROLE
Definition: cam_ccb.h:1148
#define CAM_RSP_TMF_COMPLETE
Definition: cam_ccb.h:1245
#define KNOB_ROLE_TARGET
Definition: cam_ccb.h:1152
#define DEV_IDLEN
Definition: cam_ccb.h:54
static __inline uint8_t * atio_cdb_ptr(struct ccb_accept_tio *ccb)
Definition: cam_ccb.h:830
#define KNOB_VALID_ADDRESS
Definition: cam_ccb.h:1147
void cam_periph_release_locked(struct cam_periph *periph)
Definition: cam_periph.c:453
int periphdriver_unregister(void *data)
Definition: cam_periph.c:152
struct cam_periph * cam_periph_find(struct cam_path *path, char *name)
Definition: cam_periph.c:340
u_int32_t cam_release_devq(struct cam_path *path, u_int32_t relsim_flags, u_int32_t openings, u_int32_t arg, int getcount_only)
Definition: cam_periph.c:1342
void periphdriver_register(void *data)
Definition: cam_periph.c:115
int cam_periph_acquire(struct cam_periph *periph)
Definition: cam_periph.c:413
void cam_periph_release(struct cam_periph *periph)
Definition: cam_periph.c:465
void cam_periph_invalidate(struct cam_periph *periph)
Definition: cam_periph.c:655
cam_status cam_periph_alloc(periph_ctor_t *periph_ctor, periph_oninv_t *periph_oninvalidate, periph_dtor_t *periph_dtor, periph_start_t *periph_start, char *name, cam_periph_type type, struct cam_path *path, ac_callback_t *ac_callback, ac_code code, void *arg)
Definition: cam_periph.c:197
cam_status periph_ctor_t(struct cam_periph *periph, void *arg)
Definition: cam_periph.h:115
#define CAM_PERIPH_INVALID
Definition: cam_periph.h:133
void periph_oninv_t(struct cam_periph *periph)
Definition: cam_periph.h:117
#define cam_periph_lock(periph)
Definition: cam_periph.h:224
#define CAM_PERIPH_DRV_EARLY
Definition: cam_periph.h:99
#define cam_periph_unlock(periph)
Definition: cam_periph.h:227
int() periph_deinit_t(void)
Definition: cam_periph.h:91
static __inline struct mtx * cam_periph_mtx(struct cam_periph *periph)
Definition: cam_periph.h:213
void periph_dtor_t(struct cam_periph *periph)
Definition: cam_periph.h:118
void periph_start_t(struct cam_periph *periph, union ccb *start_ccb)
Definition: cam_periph.h:113
#define cam_periph_sleep(periph, chan, priority, wmesg, timo)
Definition: cam_periph.h:233
@ CAM_PERIPH_BIO
Definition: cam_periph.h:104
void() periph_init_t(void)
Definition: cam_periph.h:85
LIST_HEAD(ccb_hdr_list, ccb_hdr)
union ccb * xpt_alloc_ccb(void)
Definition: cam_xpt.c:4612
void xpt_schedule(struct cam_periph *periph, u_int32_t new_priority)
Definition: cam_xpt.c:3243
cam_status xpt_create_path(struct cam_path **new_path_ptr, struct cam_periph *perph, path_id_t path_id, target_id_t target_id, lun_id_t lun_id)
Definition: cam_xpt.c:3527
void xpt_setup_ccb_flags(struct ccb_hdr *ccb_h, struct cam_path *path, u_int32_t priority, u_int32_t flags)
Definition: cam_xpt.c:3496
void xpt_print(struct cam_path *path, const char *fmt,...)
Definition: cam_xpt.c:3814
path_id_t xpt_path_path_id(struct cam_path *path)
Definition: cam_xpt.c:3880
void xpt_setup_ccb(struct ccb_hdr *ccb_h, struct cam_path *path, u_int32_t priority)
Definition: cam_xpt.c:3520
void xpt_action(union ccb *start_ccb)
Definition: cam_xpt.c:2601
cam_status xpt_register_async(int event, ac_callback_t *cbfunc, void *cbarg, struct cam_path *path)
Definition: cam_xpt.c:5213
lun_id_t xpt_path_lun_id(struct cam_path *path)
Definition: cam_xpt.c:3895
struct cam_sim * xpt_path_sim(struct cam_path *path)
Definition: cam_xpt.c:3904
void xpt_free_path(struct cam_path *path)
Definition: cam_xpt.c:3672
struct cam_periph * xpt_path_periph(struct cam_path *path)
Definition: cam_xpt.c:3911
void xpt_release_ccb(union ccb *free_ccb)
Definition: cam_xpt.c:3924
target_id_t xpt_path_target_id(struct cam_path *path)
Definition: cam_xpt.c:3886
void xpt_free_ccb(union ccb *free_ccb)
Definition: cam_xpt.c:4630
#define xpt_path_unlock(path)
Definition: cam_xpt.h:129
#define xpt_path_lock(path)
Definition: cam_xpt.h:128
uint32_t ctl_decode_lun(uint64_t encoded)
Definition: ctl.c:3749
void ctl_free_io(union ctl_io *io)
Definition: ctl.c:3991
union ctl_io * ctl_alloc_io_nowait(void *pool_ref)
Definition: ctl.c:3976
int ctl_remove_initiator(struct ctl_port *port, int iid)
Definition: ctl.c:2145
int ctl_add_initiator(struct ctl_port *port, int iid, uint64_t wwpn, char *name)
Definition: ctl.c:2174
void ctl_datamove_done(union ctl_io *io, bool samethr)
Definition: ctl.c:12530
int ctl_queue_sense(union ctl_io *io)
Definition: ctl.c:13218
int ctl_queue(union ctl_io *io)
Definition: ctl.c:13270
uint64_t ctl_encode_lun(uint32_t decoded)
Definition: ctl.c:3795
void ctl_zero_io(union ctl_io *io)
Definition: ctl.c:4003
@ CTL_PORT_SCSI
Definition: ctl.h:53
@ CTL_PORT_FC
Definition: ctl.h:52
@ CTL_PORT_SAS
Definition: ctl.h:57
void ctl_set_data_phase_error(struct ctl_scsiio *ctsio)
Definition: ctl_error.c:917
int ctl_port_deregister(struct ctl_port *port)
Definition: ctl_frontend.c:227
void ctl_port_set_wwns(struct ctl_port *port, int wwnn_valid, uint64_t wwnn, int wwpn_valid, uint64_t wwpn)
Definition: ctl_frontend.c:263
int ctl_port_register(struct ctl_port *port)
Definition: ctl_frontend.c:148
@ CTL_IO_SCSI
Definition: ctl_io.h:191
@ CTL_IO_TASK
Definition: ctl_io.h:192
@ CTL_TAG_HEAD_OF_QUEUE
Definition: ctl_io.h:257
@ CTL_TAG_UNTAGGED
Definition: ctl_io.h:254
@ CTL_TAG_SIMPLE
Definition: ctl_io.h:255
@ CTL_TAG_ORDERED
Definition: ctl_io.h:256
@ CTL_TAG_ACA
Definition: ctl_io.h:258
@ CTL_TASK_LUN_RESET
Definition: ctl_io.h:348
@ CTL_TASK_QUERY_ASYNC_EVENT
Definition: ctl_io.h:355
@ CTL_TASK_BUS_RESET
Definition: ctl_io.h:350
@ CTL_TASK_QUERY_TASK_SET
Definition: ctl_io.h:354
@ CTL_TASK_CLEAR_ACA
Definition: ctl_io.h:345
@ CTL_TASK_ABORT_TASK
Definition: ctl_io.h:343
@ CTL_TASK_CLEAR_TASK_SET
Definition: ctl_io.h:346
@ CTL_TASK_TARGET_RESET
Definition: ctl_io.h:349
@ CTL_TASK_ABORT_TASK_SET
Definition: ctl_io.h:344
@ CTL_TASK_QUERY_TASK
Definition: ctl_io.h:353
@ CTL_SUCCESS
Definition: ctl_io.h:70
@ CTL_STATUS_NONE
Definition: ctl_io.h:69
@ CTL_STATUS_MASK
Definition: ctl_io.h:76
@ CTL_FLAG_STATUS_QUEUED
Definition: ctl_io.h:111
@ CTL_FLAG_DMA_INPROG
Definition: ctl_io.h:96
@ CTL_FLAG_ABORT
Definition: ctl_io.h:95
@ CTL_FLAG_DATA_MASK
Definition: ctl_io.h:90
@ CTL_FLAG_DMA_QUEUED
Definition: ctl_io.h:110
@ CTL_FLAG_BUS_ADDR
Definition: ctl_io.h:102
@ CTL_FLAG_STATUS_SENT
Definition: ctl_io.h:115
@ CTL_FLAG_DATA_IN
Definition: ctl_io.h:87
@ CTL_FLAG_ABORT_STATUS
Definition: ctl_io.h:94
@ CTL_TASK_LUN_DOES_NOT_EXIST
Definition: ctl_io.h:362
@ CTL_TASK_FUNCTION_REJECTED
Definition: ctl_io.h:361
@ CTL_TASK_FUNCTION_SUCCEEDED
Definition: ctl_io.h:360
@ CTL_TASK_FUNCTION_NOT_SUPPORTED
Definition: ctl_io.h:363
@ CTL_TASK_FUNCTION_COMPLETE
Definition: ctl_io.h:359
void ctl_io_error_print(union ctl_io *io, struct scsi_inquiry_data *inq_data)
Definition: ctl_util.c:845
union ccb * ccb
Definition: mmc_sim_if.m:53
#define READ_6
Definition: scsi_all.h:2083
#define WRITE_16
Definition: scsi_all.h:2123
#define WRITE_6
Definition: scsi_all.h:2084
static __inline uint32_t scsi_3btoul(const uint8_t *bytes)
Definition: scsi_all.h:4425
static __inline uint64_t scsi_8btou64(const uint8_t *bytes)
Definition: scsi_all.h:4459
static __inline uint32_t scsi_2btoul(const uint8_t *bytes)
Definition: scsi_all.h:4415
static __inline void scsi_ulto2b(u_int32_t val, u_int8_t *bytes)
Definition: scsi_all.h:4374
static __inline uint32_t scsi_4btoul(const uint8_t *bytes)
Definition: scsi_all.h:4447
#define WRITE_12
Definition: scsi_all.h:2140
static __inline void scsi_ulto4b(u_int32_t val, u_int8_t *bytes)
Definition: scsi_all.h:4391
static __inline void scsi_u64to8b(u_int64_t val, u_int8_t *bytes)
Definition: scsi_all.h:4401
#define WRITE_10
Definition: scsi_all.h:2097
#define READ_16
Definition: scsi_all.h:2121
static __inline void scsi_ulto3b(u_int32_t val, u_int8_t *bytes)
Definition: scsi_all.h:4382
#define READ_10
Definition: scsi_all.h:2096
#define READ_12
Definition: scsi_all.h:2139
#define PRIV_CCB(io)
Definition: scsi_ctl.c:173
static int ctlfeinitialize(void)
Definition: scsi_ctl.c:222
static void ctlfe_offline(void *arg)
Definition: scsi_ctl.c:1703
CTL_FRONTEND_DECLARE(ctlfe, ctlfe_frontend)
#define CTLFE_MAX_SEGS
Definition: scsi_ctl.c:130
static void ctlfe_done(union ctl_io *io)
Definition: scsi_ctl.c:1932
static struct ctl_frontend ctlfe_frontend
Definition: scsi_ctl.c:212
static void ctlfe_datamove(union ctl_io *io)
Definition: scsi_ctl.c:1908
static void ctlfe_free_ccb(struct cam_periph *periph, union ccb *ccb)
Definition: scsi_ctl.c:933
#define PRIV_INFO(io)
Definition: scsi_ctl.c:174
MALLOC_DEFINE(M_CTLFE, "CAM CTL FE", "CAM CTL FE interface")
static void ctlfe_onoffline(void *arg, int online)
Definition: scsi_ctl.c:1526
static periph_deinit_t ctlfeperiphdeinit
Definition: scsi_ctl.c:179
static void ctlfe_online(void *arg)
Definition: scsi_ctl.c:1640
static periph_oninv_t ctlfeoninvalidate
Definition: scsi_ctl.c:183
static void ctlfedata(struct ctlfe_lun_softc *softc, union ctl_io *io, ccb_flags *flags, uint8_t **data_ptr, uint32_t *dxfer_len, u_int16_t *sglist_cnt)
Definition: scsi_ctl.c:670
static int ctlfe_lun_enable(void *arg, int lun_id)
Definition: scsi_ctl.c:1738
static periph_start_t ctlfestart
Definition: scsi_ctl.c:185
static void ctlfe_drain(void *context, int pending)
Definition: scsi_ctl.c:918
STAILQ_HEAD(ctlfe_softc)
Definition: scsi_ctl.c:92
ctlfe_lun_flags
Definition: scsi_ctl.c:99
static void ctlfedone(struct cam_periph *periph, union ccb *done_ccb)
Definition: scsi_ctl.c:1083
static periph_ctor_t ctlferegister
Definition: scsi_ctl.c:182
static void ctlfe_requeue_ccb(struct cam_periph *periph, union ccb *ccb, int unlock)
Definition: scsi_ctl.c:984
__FBSDID("$FreeBSD$")
static periph_init_t ctlfeperiphinit
Definition: scsi_ctl.c:178
static struct periph_driver ctlfe_driver
Definition: scsi_ctl.c:204
static void ctlfeasync(void *callback_arg, uint32_t code, struct cam_path *path, void *arg)
Definition: scsi_ctl.c:268
#define CTLFE_IN_PER_LUN
Definition: scsi_ctl.c:152
#define CTLFE_REQ_CTL_IO
Definition: scsi_ctl.c:140
ctlfe_cmd_flags
Definition: scsi_ctl.c:116
@ CTLFE_CMD_NONE
Definition: scsi_ctl.c:117
@ CTLFE_CMD_PIECEWISE
Definition: scsi_ctl.c:118
#define CTLFE_TIMEOUT
Definition: scsi_ctl.c:157
static void ctlfe_dump_sim(struct cam_sim *sim)
Definition: scsi_ctl.c:1838
static periph_dtor_t ctlfecleanup
Definition: scsi_ctl.c:184
static void ctlfe_dump(void)
Definition: scsi_ctl.c:1987
static int ctlfe_lun_disable(void *arg, int lun_id)
Definition: scsi_ctl.c:1802
static int ctlfe_adjust_cdb(struct ccb_accept_tio *atio, uint32_t offset)
Definition: scsi_ctl.c:1016
static int ctlfeshutdown(void)
Definition: scsi_ctl.c:232
#define CTLFE_ATIO_PER_LUN
Definition: scsi_ctl.c:146
static void ctlfe_dump_queue(struct ctlfe_lun_softc *softc)
Definition: scsi_ctl.c:1850
#define MSG_HEAD_OF_QUEUE_TASK
Definition: scsi_message.h:38
#define MSG_QUERY_TASK
Definition: scsi_message.h:73
#define MSG_ABORT_TASK_SET
Definition: scsi_message.h:15
#define MSG_SIMPLE_TASK
Definition: scsi_message.h:36
#define MSG_TARGET_RESET
Definition: scsi_message.h:22
#define MSG_QUERY_TASK_SET
Definition: scsi_message.h:74
#define MSG_QUERY_ASYNC_EVENT
Definition: scsi_message.h:75
#define MSG_CLEAR_TASK_SET
Definition: scsi_message.h:26
#define MSG_EXTENDED
Definition: scsi_message.h:9
#define MSG_ACA_TASK
Definition: scsi_message.h:42
#define MSG_ORDERED_TASK
Definition: scsi_message.h:40
#define MSG_NOOP
Definition: scsi_message.h:17
#define MSG_LOGICAL_UNIT_RESET
Definition: scsi_message.h:31
#define MSG_CLEAR_ACA
Definition: scsi_message.h:30
#define MSG_ABORT_TASK
Definition: scsi_message.h:24
#define MSG_SIMPLE_Q_TAG
Definition: scsi_message.h:35
u_int64_t contract_number
Definition: cam_ccb.h:894
u_int8_t contract_data[AC_CONTRACT_DATA_MAX]
Definition: cam_ccb.h:895
u_int8_t arrived
Definition: cam_ccb.h:903
target_id_t target
Definition: cam_ccb.h:902
u_int64_t wwpn
Definition: cam_ccb.h:900
u_int32_t port
Definition: cam_ccb.h:901
void * softc
Definition: cam_periph.h:125
struct cam_path * path
Definition: cam_periph.h:124
u_int32_t flags
Definition: cam_periph.h:129
u_int32_t unit_number
Definition: cam_sim.h:99
int max_tagged_dev_openings
Definition: cam_sim.h:101
int max_dev_openings
Definition: cam_sim.h:102
const char * sim_name
Definition: cam_sim.h:94
Definition: cam.h:357
const char * status_text
Definition: cam.h:359
union ccb * abort_ccb
Definition: cam_ccb.h:925
u_int8_t cdb_len
Definition: cam_ccb.h:820
struct ccb_hdr ccb_h
Definition: cam_ccb.h:818
u_int init_id
Definition: cam_ccb.h:825
u_int tag_id
Definition: cam_ccb.h:824
u_int8_t tag_action
Definition: cam_ccb.h:821
uint8_t priority
Definition: cam_ccb.h:823
u_int8_t enable
Definition: cam_ccb.h:1208
u_int16_t grp7_len
Definition: cam_ccb.h:1207
u_int16_t grp6_len
Definition: cam_ccb.h:1206
struct ccb_hdr ccb_h
Definition: cam_ccb.h:391
int dev_openings
Definition: cam_ccb.h:392
u_int32_t flags
Definition: cam_ccb.h:368
path_id_t path_id
Definition: cam_ccb.h:365
struct cam_path * path
Definition: cam_ccb.h:364
xpt_opcode func_code
Definition: cam_ccb.h:362
lun_id_t target_lun
Definition: cam_ccb.h:367
u_int32_t status
Definition: cam_ccb.h:363
void(* cbfcnp)(struct cam_periph *, union ccb *)
Definition: cam_ccb.h:360
struct ccb_hdr ccb_h
Definition: cam_ccb.h:1227
u_int32_t unit_number
Definition: cam_ccb.h:677
char dev_name[DEV_IDLEN]
Definition: cam_ccb.h:676
u_int32_t hba_misc
Definition: cam_ccb.h:665
u_int16_t target_sprt
Definition: cam_ccb.h:664
struct ccb_hdr ccb_h
Definition: cam_ccb.h:661
cam_xport transport
Definition: cam_ccb.h:682
target_id_t initiator_id
Definition: cam_ccb.h:673
u_int maxio
Definition: cam_ccb.h:691
u_int32_t bus_id
Definition: cam_ccb.h:678
struct ccb_hdr ccb_h
Definition: cam_ccb.h:750
struct scsi_sense_data sense_data
Definition: cam_ccb.h:756
u_int8_t * data_ptr
Definition: cam_ccb.h:753
u_int8_t sense_len
Definition: cam_ccb.h:757
u_int8_t * msg_ptr
Definition: cam_ccb.h:764
u_int32_t dxfer_len
Definition: cam_ccb.h:754
u_int16_t sglist_cnt
Definition: cam_ccb.h:759
u_int32_t resid
Definition: cam_ccb.h:762
union ccb_sim_knob::@5 xport_specific
u_int valid
Definition: cam_ccb.h:1178
struct ccb_sim_knob_settings_fc fc
Definition: cam_ccb.h:1180
char name[CTL_DRIVER_NAME_LEN]
Definition: ctl_frontend.h:252
ctl_io_type io_type
Definition: ctl_io.h:224
struct ctl_nexus nexus
Definition: ctl_io.h:226
uint32_t status
Definition: ctl_io.h:229
uint32_t flags
Definition: ctl_io.h:228
uint32_t port_status
Definition: ctl_io.h:230
uint32_t targ_lun
Definition: ctl_io.h:198
uint32_t targ_port
Definition: ctl_io.h:197
uint32_t initid
Definition: ctl_io.h:196
char * port_name
Definition: ctl_frontend.h:220
void * targ_lun_arg
Definition: ctl_frontend.h:231
uint64_t wwnn
Definition: ctl_frontend.h:238
ctl_port_type port_type
Definition: ctl_frontend.h:218
int32_t targ_port
Definition: ctl_frontend.h:234
int num_requested_ctl_io
Definition: ctl_frontend.h:219
struct ctl_frontend * frontend
Definition: ctl_frontend.h:217
port_func_t port_offline
Definition: ctl_frontend.h:224
lun_func_t lun_enable
Definition: ctl_frontend.h:227
lun_func_t lun_disable
Definition: ctl_frontend.h:228
void(* fe_datamove)(union ctl_io *io)
Definition: ctl_frontend.h:232
void * ctl_pool_ref
Definition: ctl_frontend.h:235
void * onoff_arg
Definition: ctl_frontend.h:226
int physical_port
Definition: ctl_frontend.h:221
port_func_t port_online
Definition: ctl_frontend.h:223
void(* fe_done)(union ctl_io *io)
Definition: ctl_frontend.h:233
int virtual_port
Definition: ctl_frontend.h:222
uint64_t wwpn
Definition: ctl_frontend.h:239
uint32_t kern_total_len
Definition: ctl_io.h:312
uint32_t kern_sg_entries
Definition: ctl_io.h:290
struct scsi_sense_data sense_data
Definition: ctl_io.h:326
uint32_t kern_data_len
Definition: ctl_io.h:306
uint8_t priority
Definition: ctl_io.h:330
struct ctl_io_hdr io_hdr
Definition: ctl_io.h:275
uint8_t scsi_status
Definition: ctl_io.h:328
uint32_t ext_data_filled
Definition: ctl_io.h:284
uint8_t cdb[CTL_MAX_CDBLEN]
Definition: ctl_io.h:335
uint8_t cdb_len
Definition: ctl_io.h:334
uint32_t tag_num
Definition: ctl_io.h:332
ctl_tag_type tag_type
Definition: ctl_io.h:333
uint32_t kern_data_resid
Definition: ctl_io.h:317
uint32_t kern_rel_offset
Definition: ctl_io.h:324
uint8_t * kern_data_ptr
Definition: ctl_io.h:297
uint8_t sense_len
Definition: ctl_io.h:327
Definition: ctl_io.h:184
void * addr
Definition: ctl_io.h:185
size_t len
Definition: ctl_io.h:186
ctl_task_type task_action
Definition: ctl_io.h:375
uint8_t task_status
Definition: ctl_io.h:378
uint32_t tag_num
Definition: ctl_io.h:376
uint8_t task_resp[3]
Definition: ctl_io.h:379
size_t cur_transfer_off
Definition: scsi_ctl.c:123
bus_dma_segment_t cam_sglist[CTLFE_MAX_SEGS]
Definition: scsi_ctl.c:131
ctlfe_cmd_flags flags
Definition: scsi_ctl.c:124
int cur_transfer_index
Definition: scsi_ctl.c:122
struct ctlfe_softc * parent_softc
Definition: scsi_ctl.c:102
ctlfe_lun_flags flags
Definition: scsi_ctl.c:104
struct cam_periph * periph
Definition: scsi_ctl.c:103
struct task refdrain_task
Definition: scsi_ctl.c:109
target_id_t target_id
Definition: scsi_ctl.c:82
struct cam_sim * sim
Definition: scsi_ctl.c:85
struct mtx lun_softc_mtx
Definition: scsi_ctl.c:87
u_int maxio
Definition: scsi_ctl.c:84
char port_name[DEV_IDLEN]
Definition: scsi_ctl.c:86
path_id_t path_id
Definition: scsi_ctl.c:81
struct ctl_port port
Definition: scsi_ctl.c:80
uint32_t hba_misc
Definition: scsi_ctl.c:83
u_int8_t length[2]
Definition: scsi_all.h:1288
u_int8_t addr[4]
Definition: scsi_all.h:1286
u_int8_t addr[4]
Definition: scsi_all.h:1299
u_int8_t length[4]
Definition: scsi_all.h:1300
u_int8_t addr[8]
Definition: scsi_all.h:1312
u_int8_t length[4]
Definition: scsi_all.h:1313
u_int8_t addr[3]
Definition: scsi_all.h:1270
u_int8_t length
Definition: scsi_all.h:1273
Definition: cam_ccb.h:1345
struct ccb_notify_acknowledge cna2
Definition: cam_ccb.h:1370
struct ccb_immediate_notify cin1
Definition: cam_ccb.h:1369
struct ccb_accept_tio atio
Definition: cam_ccb.h:1364
struct ccb_sim_knob knob
Definition: cam_ccb.h:1359
struct ccb_abort cab
Definition: cam_ccb.h:1360
struct ccb_hdr ccb_h
Definition: cam_ccb.h:1346
struct ccb_scsiio csio
Definition: cam_ccb.h:1347
struct ccb_en_lun cel
Definition: cam_ccb.h:1366
Definition: ctl_io.h:586
struct ctl_taskio taskio
Definition: ctl_io.h:589
struct ctl_scsiio scsiio
Definition: ctl_io.h:588
struct ctl_io_hdr io_hdr
Definition: ctl_io.h:587