Lines Matching refs:target

145 typedef	int	xpt_targetfunc_t (struct cam_et *target, void *arg);
244 static void xpt_acquire_target(struct cam_et *target);
245 static void xpt_release_target(struct cam_et *target);
251 xpt_find_device(struct cam_et *target, lun_id_t lun_id);
282 static int xptdevicetraverse(struct cam_et *target,
301 struct cam_et *target,
305 struct cam_et *target,
454 * Create a path using the bus, target, and lun the
487 * Create a path using the bus, target, and lun the
681 periph->path->target->target_id;
817 if (ccb->ccb_h.path->target->target_id == CAM_TARGET_WILDCARD &&
820 else if (ccb->ccb_h.path->target->target_id != CAM_TARGET_WILDCARD &&
823 else if (ccb->ccb_h.path->target->target_id != CAM_TARGET_WILDCARD &&
1001 mtx_lock(&device->target->bus->eb_mtx);
1004 mtx_unlock(&device->target->bus->eb_mtx);
1018 mtx_lock(&device->target->bus->eb_mtx);
1021 mtx_unlock(&device->target->bus->eb_mtx);
1036 printf("%s%d at %s%d bus %d scbus%d target %d lun %jx\n",
1042 path->target->target_id,
1087 printf("%s%d at %s%d bus %d scbus%d target %d lun %jx\n",
1093 path->target->target_id,
1402 && (cur_pattern->path_id != device->target->bus->path_id))
1406 && (cur_pattern->target_id != device->target->target_id))
1531 * For the target and lun id's, we have to make sure the
1532 * target and lun pointers aren't NULL. The xpt peripheral
1533 * has a wildcard target and device.
1536 && ((periph->path->target == NULL)
1537 ||(cur_pattern->target_id != periph->path->target->target_id)))
1579 struct cam_et *target;
1591 && (cdm->pos.cookie.target != NULL))
1649 * If there is a target generation recorded, check it to
1650 * make sure the target list hasn't changed.
1656 && (cdm->pos.cookie.target != NULL)) {
1663 target = (struct cam_et *)cdm->pos.cookie.target;
1664 target->refcount++;
1666 target = NULL;
1669 return (xpttargettraverse(bus, target, xptedttargetfunc, arg));
1673 xptedttargetfunc(struct cam_et *target, void *arg)
1680 bus = target->bus;
1690 && (cdm->pos.cookie.target == target)
1694 target->generation) {
1705 return (xptdevicetraverse(target, device, xptedtdevicefunc, arg));
1717 bus = device->target->bus;
1757 cdm->pos.cookie.bus = device->target->bus;
1760 cdm->pos.cookie.target = device->target;
1762 device->target->bus->generation;
1765 device->target->generation;
1773 device->target->bus->path_id;
1775 device->target->target_id;
1812 && (cdm->pos.cookie.target == device->target)
1874 cdm->pos.cookie.target = periph->path->target;
1879 periph->path->target->generation;
1893 periph->path->target->target_id;
2053 * The transport layer peripheral doesn't have a target or
2056 if (periph->path->target)
2058 periph->path->target->target_id;
2157 struct cam_et *target, *next_target;
2162 target = start_target;
2165 target = TAILQ_FIRST(&bus->et_entries);
2166 if (target == NULL) {
2170 target->refcount++;
2173 for (; target != NULL; target = next_target) {
2174 retval = tr_func(target, arg);
2176 xpt_release_target(target);
2180 next_target = TAILQ_NEXT(target, links);
2184 xpt_release_target(target);
2190 xptdevicetraverse(struct cam_et *target, struct cam_ed *start_device,
2198 bus = target->bus;
2203 device = TAILQ_FIRST(&target->ed_entries);
2239 bus = device->target->bus;
2369 xptdeftargetfunc(struct cam_et *target, void *arg)
2380 return(tr_func(target, tr_config->tr_arg));
2382 return(xptdevicetraverse(target, NULL, xptdefdevicefunc, arg));
2459 * devices only for target mode, device instances
2468 device->target->bus->path_id,
2469 device->target->target_id,
2732 struct cam_et *tar = path->target;
2823 * then devices/luns on a target, and then peripherals on a
2829 * user is looking for something on a particular bus/target
3150 * target device has space for more transactions.
3415 if (path->target)
3416 ccb_h->target_id = path->target->target_id;
3474 struct cam_et *target;
3479 target = NULL; /* Wildcarded */
3492 target = xpt_find_target(bus, target_id);
3493 if (target == NULL) {
3501 target = new_target;
3505 if (target != NULL) {
3506 device = xpt_find_device(target, lun_id);
3513 target,
3531 new_path->target = target;
3537 if (target != NULL)
3538 xpt_release_target(target);
3565 if (path->target != NULL)
3566 xpt_acquire_target(path->target);
3579 if (path->target != NULL) {
3580 xpt_release_target(path->target);
3581 path->target = NULL;
3618 if (path->target)
3619 *target_ref = path->target->refcount;
3648 if (path1->target != path2->target) {
3649 if (path1->target->target_id == CAM_TARGET_WILDCARD) {
3652 } else if (path2->target->target_id == CAM_TARGET_WILDCARD)
3674 if (path->bus != dev->target->bus) {
3677 else if (dev->target->bus->path_id == CAM_BUS_WILDCARD)
3682 if (path->target != dev->target) {
3683 if (path->target->target_id == CAM_TARGET_WILDCARD) {
3686 } else if (dev->target->target_id == CAM_TARGET_WILDCARD)
3723 if (path->target != NULL)
3724 printf("%d:", path->target->target_id);
3745 device->target->target_id,
3783 if (path->target != NULL)
3784 sbuf_printf(&sb, "%d:", path->target->target_id);
3808 if (path->target != NULL)
3809 return (path->target->target_id);
4154 (device->target->target_id == CAM_TARGET_WILDCARD &&
4155 path->target->target_id != CAM_TARGET_WILDCARD) ||
4156 (device->target->bus->path_id == CAM_BUS_WILDCARD &&
4157 path->target->bus->path_id != CAM_BUS_WILDCARD)) {
4164 (*(device->target->bus->xport->ops->async))(async_code,
4165 device->target->bus, device->target, device, async_arg);
4177 xpt_async_process_tgt(struct cam_et *target, void *arg)
4182 if (path->target != target
4183 && path->target->target_id != CAM_TARGET_WILDCARD
4184 && target->target_id != CAM_TARGET_WILDCARD)
4189 microtime(&target->last_reset);
4192 return (xptdevicetraverse(target, NULL, xpt_async_process_dev, ccb));
4325 struct cam_et *target, struct cam_ed *device,
4332 if (target->target_id == CAM_TARGET_WILDCARD
4646 ("destroying bus, but target list is not empty"));
4655 struct cam_et *cur_target, *target;
4659 target = (struct cam_et *)malloc(sizeof(*target), M_CAMXPT,
4661 if (target == NULL)
4664 TAILQ_INIT(&target->ed_entries);
4665 target->bus = bus;
4666 target->target_id = target_id;
4667 target->refcount = 1;
4668 target->generation = 0;
4669 target->luns = NULL;
4670 mtx_init(&target->luns_mtx, "CAM LUNs lock", NULL, MTX_DEF);
4671 timevalclear(&target->last_reset);
4678 /* Insertion sort into our bus's target list */
4683 TAILQ_INSERT_BEFORE(cur_target, target, links);
4685 TAILQ_INSERT_TAIL(&bus->et_entries, target, links);
4688 return (target);
4692 xpt_acquire_target(struct cam_et *target)
4694 struct cam_eb *bus = target->bus;
4697 target->refcount++;
4702 xpt_release_target(struct cam_et *target)
4704 struct cam_eb *bus = target->bus;
4707 if (--target->refcount > 0) {
4711 TAILQ_REMOVE(&bus->et_entries, target, links);
4714 KASSERT(TAILQ_EMPTY(&target->ed_entries),
4715 ("destroying target, but device list is not empty"));
4717 mtx_destroy(&target->luns_mtx);
4718 if (target->luns)
4719 free(target->luns, M_CAMXPT);
4720 free(target, M_CAMXPT);
4724 xpt_alloc_device_default(struct cam_eb *bus, struct cam_et *target,
4729 device = xpt_alloc_device(bus, target, lun_id);
4749 xpt_alloc_device(struct cam_eb *bus, struct cam_et *target, lun_id_t lun_id)
4770 device->target = target;
4792 target->refcount++;
4794 cur_device = TAILQ_FIRST(&target->ed_entries);
4800 TAILQ_INSERT_TAIL(&target->ed_entries, device, links);
4801 target->generation++;
4808 struct cam_eb *bus = device->target->bus;
4818 struct cam_eb *bus = device->target->bus;
4827 TAILQ_REMOVE(&device->target->ed_entries, device,links);
4828 device->target->generation++;
4845 xpt_release_target(device->target);
4899 struct cam_et *target;
4902 for (target = TAILQ_FIRST(&bus->et_entries);
4903 target != NULL;
4904 target = TAILQ_NEXT(target, links)) {
4905 if (target->target_id == target_id) {
4906 target->refcount++;
4910 return (target);
4914 xpt_find_device(struct cam_et *target, lun_id_t lun_id)
4918 mtx_assert(&target->bus->eb_mtx, MA_OWNED);
4919 for (device = TAILQ_FIRST(&target->ed_entries);
5007 " target %d:%d:%d, debugging disabled\n",