Lines Matching refs:bus
150 typedef int xpt_busfunc_t (struct cam_eb *bus, void *arg);
242 static void xpt_acquire_bus(struct cam_eb *bus);
243 static void xpt_release_bus(struct cam_eb *bus);
248 xpt_alloc_target(struct cam_eb *bus, target_id_t target_id);
254 xpt_find_target(struct cam_eb *bus, target_id_t target_id);
269 u_int num_patterns, struct cam_eb *bus);
286 static int xpttargettraverse(struct cam_eb *bus,
307 struct cam_eb *bus,
311 static struct cam_ed * xpt_alloc_device_default(struct cam_eb *bus,
417 struct cam_eb *bus; in xptdoioctl() local
428 bus = xpt_find_bus(inccb->ccb_h.path_id); in xptdoioctl()
429 if (bus == NULL) in xptdoioctl()
437 xpt_release_bus(bus); in xptdoioctl()
444 xpt_release_bus(bus); in xptdoioctl()
575 xpt_release_bus(bus); in xptdoioctl()
689 periph->path->bus->path_id; in xptdoioctl()
1014 mtx_lock(&device->target->bus->eb_mtx); in xpt_add_periph()
1017 mtx_unlock(&device->target->bus->eb_mtx); in xpt_add_periph()
1031 mtx_lock(&device->target->bus->eb_mtx); in xpt_remove_periph()
1034 mtx_unlock(&device->target->bus->eb_mtx); in xpt_remove_periph()
1063 path->bus->sim->sim_name, in xpt_announce_periph_sbuf()
1064 path->bus->sim->unit_number, in xpt_announce_periph_sbuf()
1065 path->bus->sim->bus_id, in xpt_announce_periph_sbuf()
1066 path->bus->path_id, in xpt_announce_periph_sbuf()
1083 path->bus->xport->ops->announce_sbuf(periph, sb); in xpt_announce_periph_sbuf()
1137 path->bus->sim->sim_name, in xpt_denounce_periph_sbuf()
1138 path->bus->sim->unit_number, in xpt_denounce_periph_sbuf()
1139 path->bus->sim->bus_id, in xpt_denounce_periph_sbuf()
1140 path->bus->path_id, in xpt_denounce_periph_sbuf()
1280 struct cam_eb *bus) in xptbusmatch() argument
1290 if (bus == NULL) in xptbusmatch()
1314 dp->path_id != bus->path_id) in xptbusmatch()
1318 pp->path_id != bus->path_id) in xptbusmatch()
1329 && (cur_pattern->path_id != bus->path_id)) in xptbusmatch()
1333 && (cur_pattern->bus_id != bus->sim->bus_id)) in xptbusmatch()
1337 && (cur_pattern->unit_number != bus->sim->unit_number)) in xptbusmatch()
1341 && (strncmp(cur_pattern->dev_name, bus->sim->sim_name, in xptbusmatch()
1432 && (cur_pattern->path_id != device->target->bus->path_id)) in xptdevicematch()
1535 && (cur_pattern->path_id != periph->path->bus->path_id)) in xptperiphmatch()
1584 xptedtbusfunc(struct cam_eb *bus, void *arg) in xptedtbusfunc() argument
1597 && (cdm->pos.cookie.bus == bus) in xptedtbusfunc()
1602 retval = xptbusmatch(cdm->patterns, cdm->num_patterns, bus); in xptedtbusfunc()
1631 cdm->pos.cookie.bus = bus; in xptedtbusfunc()
1640 cdm->matches[j].result.bus_result.path_id = bus->path_id; in xptedtbusfunc()
1641 cdm->matches[j].result.bus_result.bus_id = bus->sim->bus_id; in xptedtbusfunc()
1643 bus->sim->unit_number; in xptedtbusfunc()
1645 bus->sim->sim_name, in xptedtbusfunc()
1660 mtx_lock(&bus->eb_mtx); in xptedtbusfunc()
1662 && (cdm->pos.cookie.bus == bus) in xptedtbusfunc()
1666 bus->generation)) { in xptedtbusfunc()
1667 mtx_unlock(&bus->eb_mtx); in xptedtbusfunc()
1675 mtx_unlock(&bus->eb_mtx); in xptedtbusfunc()
1677 return (xpttargettraverse(bus, target, xptedttargetfunc, arg)); in xptedtbusfunc()
1684 struct cam_eb *bus; in xptedttargetfunc() local
1688 bus = target->bus; in xptedttargetfunc()
1694 mtx_lock(&bus->eb_mtx); in xptedttargetfunc()
1696 && (cdm->pos.cookie.bus == bus) in xptedttargetfunc()
1703 mtx_unlock(&bus->eb_mtx); in xptedttargetfunc()
1711 mtx_unlock(&bus->eb_mtx); in xptedttargetfunc()
1719 struct cam_eb *bus; in xptedtdevicefunc() local
1725 bus = device->target->bus; in xptedtdevicefunc()
1765 cdm->pos.cookie.bus = device->target->bus; in xptedtdevicefunc()
1770 device->target->bus->generation; in xptedtdevicefunc()
1781 device->target->bus->path_id; in xptedtdevicefunc()
1816 mtx_lock(&bus->eb_mtx); in xptedtdevicefunc()
1818 && (cdm->pos.cookie.bus == bus) in xptedtdevicefunc()
1827 mtx_unlock(&bus->eb_mtx); in xptedtdevicefunc()
1836 mtx_unlock(&bus->eb_mtx); in xptedtdevicefunc()
1879 cdm->pos.cookie.bus = periph->path->bus; in xptedtperiphfunc()
1884 periph->path->bus->generation; in xptedtperiphfunc()
1899 periph->path->bus->path_id; in xptedtperiphfunc()
1917 struct cam_eb *bus; in xptedtmatch() local
1928 && (cdm->pos.cookie.bus != NULL)) { in xptedtmatch()
1935 bus = (struct cam_eb *)cdm->pos.cookie.bus; in xptedtmatch()
1936 bus->refcount++; in xptedtmatch()
1938 bus = NULL; in xptedtmatch()
1941 ret = xptbustraverse(bus, xptedtbusfunc, cdm); in xptedtmatch()
2058 periph->path->bus->path_id; in xptplistperiphfunc()
2129 struct cam_eb *bus, *next_bus; in xptbustraverse() local
2134 bus = start_bus; in xptbustraverse()
2137 bus = TAILQ_FIRST(&xsoftc.xpt_busses); in xptbustraverse()
2138 if (bus == NULL) { in xptbustraverse()
2142 bus->refcount++; in xptbustraverse()
2145 for (; bus != NULL; bus = next_bus) { in xptbustraverse()
2146 retval = tr_func(bus, arg); in xptbustraverse()
2148 xpt_release_bus(bus); in xptbustraverse()
2152 next_bus = TAILQ_NEXT(bus, links); in xptbustraverse()
2156 xpt_release_bus(bus); in xptbustraverse()
2162 xpttargettraverse(struct cam_eb *bus, struct cam_et *start_target, in xpttargettraverse() argument
2172 mtx_lock(&bus->eb_mtx); in xpttargettraverse()
2173 target = TAILQ_FIRST(&bus->et_entries); in xpttargettraverse()
2175 mtx_unlock(&bus->eb_mtx); in xpttargettraverse()
2179 mtx_unlock(&bus->eb_mtx); in xpttargettraverse()
2187 mtx_lock(&bus->eb_mtx); in xpttargettraverse()
2191 mtx_unlock(&bus->eb_mtx); in xpttargettraverse()
2201 struct cam_eb *bus; in xptdevicetraverse() local
2206 bus = target->bus; in xptdevicetraverse()
2210 mtx_lock(&bus->eb_mtx); in xptdevicetraverse()
2213 mtx_unlock(&bus->eb_mtx); in xptdevicetraverse()
2217 mtx_unlock(&bus->eb_mtx); in xptdevicetraverse()
2227 mtx_lock(&bus->eb_mtx); in xptdevicetraverse()
2231 mtx_unlock(&bus->eb_mtx); in xptdevicetraverse()
2241 struct cam_eb *bus; in xptperiphtraverse() local
2247 bus = device->target->bus; in xptperiphtraverse()
2252 mtx_lock(&bus->eb_mtx); in xptperiphtraverse()
2257 mtx_unlock(&bus->eb_mtx); in xptperiphtraverse()
2262 mtx_unlock(&bus->eb_mtx); in xptperiphtraverse()
2272 mtx_lock(&bus->eb_mtx); in xptperiphtraverse()
2279 mtx_unlock(&bus->eb_mtx); in xptperiphtraverse()
2360 xptdefbusfunc(struct cam_eb *bus, void *arg) in xptdefbusfunc() argument
2371 return(tr_func(bus, tr_config->tr_arg)); in xptdefbusfunc()
2373 return(xpttargettraverse(bus, NULL, xptdeftargetfunc, arg)); in xptdefbusfunc()
2476 device->target->bus->path_id, in xptsetasyncfunc()
2489 xptsetasyncbusfunc(struct cam_eb *bus, void *arg) in xptsetasyncbusfunc() argument
2496 bus->path_id, in xptsetasyncbusfunc()
2528 (*(start_ccb->ccb_h.path->bus->xport->ops->action))(start_ccb); in xpt_action()
2594 devq = path->bus->sim->devq; in xpt_action_default()
2682 sim = path->bus->sim; in xpt_action_default()
2698 start_ccb->cpis.last_reset = path->bus->last_reset; in xpt_action_default()
2729 struct cam_eb *bus = path->bus; in xpt_action_default() local
2731 struct cam_devq *devq = bus->sim->devq; in xpt_action_default()
2742 if (timevalcmp(&tar->last_reset, &bus->last_reset, <)) in xpt_action_default()
2743 cgds->last_reset = bus->last_reset; in xpt_action_default()
2916 cur_entry->event_lock = (path->bus->sim->mtx && in xpt_action_default()
2917 mtx_owned(path->bus->sim->mtx)) ? 1 : 0; in xpt_action_default()
3107 sim = start_ccb->ccb_h.path->bus->sim; in xpt_poll_setup()
3136 KASSERT(cam_sim_pollable(start_ccb->ccb_h.path->bus->sim), in xpt_pollwait()
3139 xpt_sim_poll(start_ccb->ccb_h.path->bus->sim); in xpt_pollwait()
3422 ccb_h->path_id = path->bus->path_id; in xpt_setup_ccb_flags()
3481 struct cam_eb *bus; in xpt_compile_path() local
3494 bus = xpt_find_bus(path_id); in xpt_compile_path()
3495 if (bus == NULL) { in xpt_compile_path()
3499 mtx_lock(&bus->eb_mtx); in xpt_compile_path()
3500 target = xpt_find_target(bus, target_id); in xpt_compile_path()
3505 new_target = xpt_alloc_target(bus, target_id); in xpt_compile_path()
3520 (*(bus->xport->ops->alloc_device))(bus, in xpt_compile_path()
3530 mtx_unlock(&bus->eb_mtx); in xpt_compile_path()
3538 new_path->bus = bus; in xpt_compile_path()
3547 if (bus != NULL) in xpt_compile_path()
3548 xpt_release_bus(bus); in xpt_compile_path()
3562 if (path->bus != NULL) in xpt_clone_path()
3563 xpt_acquire_bus(path->bus); in xpt_clone_path()
3584 if (path->bus != NULL) { in xpt_release_path()
3585 xpt_release_bus(path->bus); in xpt_release_path()
3586 path->bus = NULL; in xpt_release_path()
3606 if (path->bus) in xpt_path_counts()
3607 *bus_ref = path->bus->refcount; in xpt_path_counts()
3641 if (path1->bus != path2->bus) { in xpt_path_comp()
3642 if (path1->bus->path_id == CAM_BUS_WILDCARD) in xpt_path_comp()
3644 else if (path2->bus->path_id == CAM_BUS_WILDCARD) in xpt_path_comp()
3675 if (path->bus != dev->target->bus) { in xpt_path_comp_dev()
3676 if (path->bus->path_id == CAM_BUS_WILDCARD) in xpt_path_comp_dev()
3678 else if (dev->target->bus->path_id == CAM_BUS_WILDCARD) in xpt_path_comp_dev()
3775 if (path->bus != NULL) in xpt_path_sbuf()
3776 sbuf_printf(sb, "%s%d:%d:", path->bus->sim->sim_name, in xpt_path_sbuf()
3777 path->bus->sim->unit_number, in xpt_path_sbuf()
3778 path->bus->sim->bus_id); in xpt_path_sbuf()
3798 return(path->bus->path_id); in xpt_path_path_id()
3823 return (path->bus->sim); in xpt_path_sim()
3881 xpt_bus_register(struct cam_sim *sim, device_t parent, uint32_t bus) in xpt_bus_register() argument
3889 sim->bus_id = bus; in xpt_bus_register()
4002 xpt_release_bus(bus_path.bus); in xpt_bus_deregister()
4011 struct cam_eb *bus; in xptnextfreepathid() local
4017 bus = TAILQ_FIRST(&xsoftc.xpt_busses); in xptnextfreepathid()
4020 while (bus != NULL && bus->path_id <= pathid) { in xptnextfreepathid()
4021 if (bus->path_id == pathid) in xptnextfreepathid()
4023 bus = TAILQ_NEXT(bus, links); in xptnextfreepathid()
4158 (device->target->bus->path_id == CAM_BUS_WILDCARD && in xpt_async_process_dev()
4159 path->target->bus->path_id != CAM_BUS_WILDCARD)) { in xpt_async_process_dev()
4166 (*(device->target->bus->xport->ops->async))(async_code, in xpt_async_process_dev()
4167 device->target->bus, device->target, device, async_arg); in xpt_async_process_dev()
4200 struct cam_eb *bus; in xpt_async_process() local
4210 bus = path->bus; in xpt_async_process()
4214 microtime(&bus->last_reset); in xpt_async_process()
4217 xpttargettraverse(bus, NULL, xpt_async_process_tgt, ccb); in xpt_async_process()
4223 if (bus != xpt_periph->path->bus) { in xpt_async_process()
4232 xpt_release_simq(path->bus->sim, TRUE); in xpt_async_process()
4321 xpt_freeze_simq(path->bus->sim, 1); in xpt_async()
4326 xpt_dev_async_default(uint32_t async_code, struct cam_eb *bus, in xpt_dev_async_default() argument
4637 xpt_acquire_bus(struct cam_eb *bus) in xpt_acquire_bus() argument
4641 bus->refcount++; in xpt_acquire_bus()
4646 xpt_release_bus(struct cam_eb *bus) in xpt_release_bus() argument
4650 KASSERT(bus->refcount >= 1, ("bus->refcount >= 1")); in xpt_release_bus()
4651 if (--bus->refcount > 0) { in xpt_release_bus()
4655 TAILQ_REMOVE(&xsoftc.xpt_busses, bus, links); in xpt_release_bus()
4658 KASSERT(TAILQ_EMPTY(&bus->et_entries), in xpt_release_bus()
4660 cam_sim_release(bus->sim); in xpt_release_bus()
4661 mtx_destroy(&bus->eb_mtx); in xpt_release_bus()
4662 free(bus, M_CAMXPT); in xpt_release_bus()
4666 xpt_alloc_target(struct cam_eb *bus, target_id_t target_id) in xpt_alloc_target() argument
4671 mtx_assert(&bus->eb_mtx, MA_OWNED); in xpt_alloc_target()
4678 target->bus = bus; in xpt_alloc_target()
4689 bus->refcount++; in xpt_alloc_target()
4692 cur_target = TAILQ_FIRST(&bus->et_entries); in xpt_alloc_target()
4698 TAILQ_INSERT_TAIL(&bus->et_entries, target, links); in xpt_alloc_target()
4700 bus->generation++; in xpt_alloc_target()
4707 struct cam_eb *bus = target->bus; in xpt_acquire_target() local
4709 mtx_lock(&bus->eb_mtx); in xpt_acquire_target()
4711 mtx_unlock(&bus->eb_mtx); in xpt_acquire_target()
4717 struct cam_eb *bus = target->bus; in xpt_release_target() local
4719 mtx_lock(&bus->eb_mtx); in xpt_release_target()
4721 mtx_unlock(&bus->eb_mtx); in xpt_release_target()
4724 TAILQ_REMOVE(&bus->et_entries, target, links); in xpt_release_target()
4725 bus->generation++; in xpt_release_target()
4726 mtx_unlock(&bus->eb_mtx); in xpt_release_target()
4729 xpt_release_bus(bus); in xpt_release_target()
4737 xpt_alloc_device_default(struct cam_eb *bus, struct cam_et *target, in xpt_alloc_device_default() argument
4742 device = xpt_alloc_device(bus, target, lun_id); in xpt_alloc_device_default()
4762 xpt_alloc_device(struct cam_eb *bus, struct cam_et *target, lun_id_t lun_id) in xpt_alloc_device() argument
4768 mtx_assert(&bus->eb_mtx, MA_OWNED); in xpt_alloc_device()
4770 devq = bus->sim->devq; in xpt_alloc_device()
4785 device->sim = bus->sim; in xpt_alloc_device()
4787 bus->sim->max_dev_openings) != 0) { in xpt_alloc_device()
4821 struct cam_eb *bus = device->target->bus; in xpt_acquire_device() local
4823 mtx_lock(&bus->eb_mtx); in xpt_acquire_device()
4825 mtx_unlock(&bus->eb_mtx); in xpt_acquire_device()
4831 struct cam_eb *bus = device->target->bus; in xpt_release_device() local
4834 mtx_lock(&bus->eb_mtx); in xpt_release_device()
4836 mtx_unlock(&bus->eb_mtx); in xpt_release_device()
4842 mtx_unlock(&bus->eb_mtx); in xpt_release_device()
4845 devq = bus->sim->devq; in xpt_release_device()
4898 struct cam_eb *bus; in xpt_find_bus() local
4901 for (bus = TAILQ_FIRST(&xsoftc.xpt_busses); in xpt_find_bus()
4902 bus != NULL; in xpt_find_bus()
4903 bus = TAILQ_NEXT(bus, links)) { in xpt_find_bus()
4904 if (bus->path_id == path_id) { in xpt_find_bus()
4905 bus->refcount++; in xpt_find_bus()
4910 return (bus); in xpt_find_bus()
4914 xpt_find_target(struct cam_eb *bus, target_id_t target_id) in xpt_find_target() argument
4918 mtx_assert(&bus->eb_mtx, MA_OWNED); in xpt_find_target()
4919 for (target = TAILQ_FIRST(&bus->et_entries); in xpt_find_target()
4935 mtx_assert(&target->bus->eb_mtx, MA_OWNED); in xpt_find_device()
4956 sim = path->bus->sim; in xpt_start_tags()
4986 sim = path->bus->sim; in xpt_stop_tags()
5307 if (ccb_h->path->bus) in xpt_done_process()
5308 sim = ccb_h->path->bus->sim; in xpt_done_process()
5475 return (path->bus->parent_dev); in xpt_path_sim_device()