Lines Matching refs:sc
52 extern int tws_cam_attach(struct tws_softc *sc);
53 extern void tws_cam_detach(struct tws_softc *sc);
54 extern int tws_init_ctlr(struct tws_softc *sc);
55 extern boolean tws_ctlr_ready(struct tws_softc *sc);
56 extern void tws_turn_off_interrupts(struct tws_softc *sc);
57 extern void tws_q_insert_tail(struct tws_softc *sc, struct tws_request *req,
59 extern struct tws_request *tws_q_remove_request(struct tws_softc *sc,
61 extern struct tws_request *tws_q_remove_head(struct tws_softc *sc,
63 extern boolean tws_get_response(struct tws_softc *sc, u_int16_t *req_id);
64 extern boolean tws_ctlr_reset(struct tws_softc *sc);
68 struct tws_request *tws_get_request(struct tws_softc *sc, u_int16_t type);
69 int tws_init_connect(struct tws_softc *sc, u_int16_t mc);
70 void tws_send_event(struct tws_softc *sc, u_int8_t event);
71 uint8_t tws_get_state(struct tws_softc *sc);
81 static int tws_init(struct tws_softc *sc);
85 static int tws_init_reqs(struct tws_softc *sc, u_int32_t dma_mem_size);
86 static int tws_init_aen_q(struct tws_softc *sc);
87 static int tws_init_trace_q(struct tws_softc *sc);
88 static int tws_setup_irq(struct tws_softc *sc);
89 int tws_setup_intr(struct tws_softc *sc, int irqs);
90 int tws_teardown_intr(struct tws_softc *sc);
113 struct tws_softc *sc = dev->si_drv1; in tws_open() local
115 if ( sc ) in tws_open()
116 TWS_TRACE_DEBUG(sc, "entry", dev, oflags); in tws_open()
123 struct tws_softc *sc = dev->si_drv1; in tws_close() local
125 if ( sc ) in tws_close()
126 TWS_TRACE_DEBUG(sc, "entry", dev, fflag); in tws_close()
133 struct tws_softc *sc = dev->si_drv1; in tws_read() local
135 if ( sc ) in tws_read()
136 TWS_TRACE_DEBUG(sc, "entry", dev, ioflag); in tws_read()
143 struct tws_softc *sc = dev->si_drv1; in tws_write() local
145 if ( sc ) in tws_write()
146 TWS_TRACE_DEBUG(sc, "entry", dev, ioflag); in tws_write()
180 struct tws_softc *sc = device_get_softc(dev); in tws_attach() local
186 sc->tws_dev = dev; in tws_attach()
187 sc->device_id = pci_get_device(dev); in tws_attach()
188 sc->subvendor_id = pci_get_subvendor(dev); in tws_attach()
189 sc->subdevice_id = pci_get_subdevice(dev); in tws_attach()
192 mtx_init( &sc->q_lock, "tws_q_lock", NULL, MTX_DEF); in tws_attach()
193 mtx_init( &sc->sim_lock, "tws_sim_lock", NULL, MTX_DEF); in tws_attach()
194 mtx_init( &sc->gen_lock, "tws_gen_lock", NULL, MTX_DEF); in tws_attach()
195 mtx_init( &sc->io_lock, "tws_io_lock", NULL, MTX_DEF | MTX_RECURSE); in tws_attach()
196 callout_init(&sc->stats_timer, 1); in tws_attach()
198 if ( tws_init_trace_q(sc) == FAILURE ) in tws_attach()
201 mtx_lock(&sc->gen_lock); in tws_attach()
202 tws_send_event(sc, TWS_INIT_START); in tws_attach()
203 mtx_unlock(&sc->gen_lock); in tws_attach()
206 TWS_TRACE(sc, "BIG endian", 0, 0); in tws_attach()
209 sysctl_ctx_init(&sc->tws_clist); in tws_attach()
210 sc->tws_oidp = SYSCTL_ADD_NODE(&sc->tws_clist, in tws_attach()
213 if ( sc->tws_oidp == NULL ) { in tws_attach()
214 tws_log(sc, SYSCTL_TREE_NODE_ADD); in tws_attach()
217 SYSCTL_ADD_STRING(&sc->tws_clist, SYSCTL_CHILDREN(sc->tws_oidp), in tws_attach()
224 TWS_TRACE_DEBUG(sc, "bar0 ", bar, 0); in tws_attach()
227 TWS_TRACE_DEBUG(sc, "bar1 ", bar, 0); in tws_attach()
234 sc->mfa_base = (u_int64_t)pci_read_config(dev, TWS_PCI_BAR2, 4); in tws_attach()
235 sc->mfa_base = sc->mfa_base & ~TWS_BIT2; in tws_attach()
236 TWS_TRACE_DEBUG(sc, "bar2 ", sc->mfa_base, 0); in tws_attach()
240 sc->reg_res_id = TWS_PCI_BAR1; /* BAR1 offset */ in tws_attach()
241 if ((sc->reg_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, in tws_attach()
242 &(sc->reg_res_id), RF_ACTIVE)) in tws_attach()
244 tws_log(sc, ALLOC_MEMORY_RES); in tws_attach()
247 sc->bus_tag = rman_get_bustag(sc->reg_res); in tws_attach()
248 sc->bus_handle = rman_get_bushandle(sc->reg_res); in tws_attach()
252 sc->mfa_res_id = TWS_PCI_BAR2; /* BAR2 offset */ in tws_attach()
253 if ((sc->mfa_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, in tws_attach()
254 &(sc->mfa_res_id), RF_ACTIVE)) in tws_attach()
256 tws_log(sc, ALLOC_MEMORY_RES); in tws_attach()
259 sc->bus_mfa_tag = rman_get_bustag(sc->mfa_res); in tws_attach()
260 sc->bus_mfa_handle = rman_get_bushandle(sc->mfa_res); in tws_attach()
264 sc->intr_type = TWS_INTx; /* default */ in tws_attach()
267 sc->intr_type = TWS_MSI; in tws_attach()
268 if ( tws_setup_irq(sc) == FAILURE ) { in tws_attach()
269 tws_log(sc, ALLOC_MEMORY_RES); in tws_attach()
279 sc->tws_cdev = make_dev(&tws_cdevsw, device_get_unit(dev), in tws_attach()
282 sc->tws_cdev->si_drv1 = sc; in tws_attach()
284 if ( tws_init(sc) == FAILURE ) { in tws_attach()
285 tws_log(sc, TWS_INIT_FAILURE); in tws_attach()
288 if ( tws_init_ctlr(sc) == FAILURE ) { in tws_attach()
289 tws_log(sc, TWS_CTLR_INIT_FAILURE); in tws_attach()
292 if ((error = tws_cam_attach(sc))) { in tws_attach()
293 tws_log(sc, TWS_CAM_ATTACH); in tws_attach()
297 mtx_lock(&sc->gen_lock); in tws_attach()
298 tws_send_event(sc, TWS_INIT_COMPLETE); in tws_attach()
299 mtx_unlock(&sc->gen_lock); in tws_attach()
301 TWS_TRACE_DEBUG(sc, "attached successfully", 0, sc->device_id); in tws_attach()
305 tws_teardown_intr(sc); in tws_attach()
306 destroy_dev(sc->tws_cdev); in tws_attach()
307 if (sc->dma_mem_phys) in tws_attach()
308 bus_dmamap_unload(sc->cmd_tag, sc->cmd_map); in tws_attach()
309 if (sc->dma_mem) in tws_attach()
310 bus_dmamem_free(sc->cmd_tag, sc->dma_mem, sc->cmd_map); in tws_attach()
311 if (sc->cmd_tag) in tws_attach()
312 bus_dma_tag_destroy(sc->cmd_tag); in tws_attach()
314 for(i=0;i<sc->irqs;i++) { in tws_attach()
315 if ( sc->irq_res[i] ){ in tws_attach()
316 if (bus_release_resource(sc->tws_dev, in tws_attach()
317 SYS_RES_IRQ, sc->irq_res_id[i], sc->irq_res[i])) in tws_attach()
318 TWS_TRACE(sc, "bus irq res", 0, 0); in tws_attach()
324 if ( sc->mfa_res ){ in tws_attach()
325 if (bus_release_resource(sc->tws_dev, in tws_attach()
326 SYS_RES_MEMORY, sc->mfa_res_id, sc->mfa_res)) in tws_attach()
327 TWS_TRACE(sc, "bus release ", 0, sc->mfa_res_id); in tws_attach()
329 if ( sc->reg_res ){ in tws_attach()
330 if (bus_release_resource(sc->tws_dev, in tws_attach()
331 SYS_RES_MEMORY, sc->reg_res_id, sc->reg_res)) in tws_attach()
332 TWS_TRACE(sc, "bus release2 ", 0, sc->reg_res_id); in tws_attach()
335 mtx_destroy(&sc->q_lock); in tws_attach()
336 mtx_destroy(&sc->sim_lock); in tws_attach()
337 mtx_destroy(&sc->gen_lock); in tws_attach()
338 mtx_destroy(&sc->io_lock); in tws_attach()
339 sysctl_ctx_free(&sc->tws_clist); in tws_attach()
348 struct tws_softc *sc = device_get_softc(dev); in tws_detach() local
352 TWS_TRACE_DEBUG(sc, "entry", 0, 0); in tws_detach()
354 mtx_lock(&sc->gen_lock); in tws_detach()
355 tws_send_event(sc, TWS_UNINIT_START); in tws_detach()
356 mtx_unlock(&sc->gen_lock); in tws_detach()
359 tws_turn_off_interrupts(sc); in tws_detach()
361 tws_write_reg(sc, TWS_I2O0_HOBDBC, ~0, 4); in tws_detach()
362 reg = tws_read_reg(sc, TWS_I2O0_HIMASK, 4); in tws_detach()
363 TWS_TRACE_DEBUG(sc, "turn-off-intr", reg, 0); in tws_detach()
364 sc->obfl_q_overrun = false; in tws_detach()
365 tws_init_connect(sc, 1); in tws_detach()
369 tws_teardown_intr(sc); in tws_detach()
372 for(i=0;i<sc->irqs;i++) { in tws_detach()
373 if ( sc->irq_res[i] ){ in tws_detach()
374 if (bus_release_resource(sc->tws_dev, in tws_detach()
375 SYS_RES_IRQ, sc->irq_res_id[i], sc->irq_res[i])) in tws_detach()
376 TWS_TRACE(sc, "bus release irq resource", in tws_detach()
377 i, sc->irq_res_id[i]); in tws_detach()
380 if ( sc->intr_type == TWS_MSI ) { in tws_detach()
381 pci_release_msi(sc->tws_dev); in tws_detach()
384 tws_cam_detach(sc); in tws_detach()
386 if (sc->dma_mem_phys) in tws_detach()
387 bus_dmamap_unload(sc->cmd_tag, sc->cmd_map); in tws_detach()
388 if (sc->dma_mem) in tws_detach()
389 bus_dmamem_free(sc->cmd_tag, sc->dma_mem, sc->cmd_map); in tws_detach()
390 if (sc->cmd_tag) in tws_detach()
391 bus_dma_tag_destroy(sc->cmd_tag); in tws_detach()
394 if ( sc->mfa_res ){ in tws_detach()
395 if (bus_release_resource(sc->tws_dev, in tws_detach()
396 SYS_RES_MEMORY, sc->mfa_res_id, sc->mfa_res)) in tws_detach()
397 TWS_TRACE(sc, "bus release mem resource", 0, sc->mfa_res_id); in tws_detach()
399 if ( sc->reg_res ){ in tws_detach()
400 if (bus_release_resource(sc->tws_dev, in tws_detach()
401 SYS_RES_MEMORY, sc->reg_res_id, sc->reg_res)) in tws_detach()
402 TWS_TRACE(sc, "bus release mem resource", 0, sc->reg_res_id); in tws_detach()
406 if (sc->reqs[i].dma_map) in tws_detach()
407 bus_dmamap_destroy(sc->data_tag, sc->reqs[i].dma_map); in tws_detach()
408 callout_drain(&sc->reqs[i].timeout); in tws_detach()
411 callout_drain(&sc->stats_timer); in tws_detach()
412 free(sc->reqs, M_TWS); in tws_detach()
413 free(sc->sense_bufs, M_TWS); in tws_detach()
414 xpt_free_ccb(sc->scan_ccb); in tws_detach()
415 if (sc->ioctl_data_mem) in tws_detach()
416 bus_dmamem_free(sc->data_tag, sc->ioctl_data_mem, sc->ioctl_data_map); in tws_detach()
417 if (sc->data_tag) in tws_detach()
418 bus_dma_tag_destroy(sc->data_tag); in tws_detach()
419 free(sc->aen_q.q, M_TWS); in tws_detach()
420 free(sc->trace_q.q, M_TWS); in tws_detach()
421 mtx_destroy(&sc->q_lock); in tws_detach()
422 mtx_destroy(&sc->sim_lock); in tws_detach()
423 mtx_destroy(&sc->gen_lock); in tws_detach()
424 mtx_destroy(&sc->io_lock); in tws_detach()
425 destroy_dev(sc->tws_cdev); in tws_detach()
426 sysctl_ctx_free(&sc->tws_clist); in tws_detach()
431 tws_setup_intr(struct tws_softc *sc, int irqs) in tws_setup_intr() argument
436 if (!(sc->intr_handle[i])) { in tws_setup_intr()
437 if ((error = bus_setup_intr(sc->tws_dev, sc->irq_res[i], in tws_setup_intr()
440 tws_intr, sc, &sc->intr_handle[i]))) { in tws_setup_intr()
441 tws_log(sc, SETUP_INTR_RES); in tws_setup_intr()
451 tws_teardown_intr(struct tws_softc *sc) in tws_teardown_intr() argument
455 for(i=0;i<sc->irqs;i++) { in tws_teardown_intr()
456 if (sc->intr_handle[i]) { in tws_teardown_intr()
457 bus_teardown_intr(sc->tws_dev, in tws_teardown_intr()
458 sc->irq_res[i], sc->intr_handle[i]); in tws_teardown_intr()
459 sc->intr_handle[i] = NULL; in tws_teardown_intr()
466 tws_setup_irq(struct tws_softc *sc) in tws_setup_irq() argument
470 switch(sc->intr_type) { in tws_setup_irq()
472 sc->irqs = 1; in tws_setup_irq()
473 sc->irq_res_id[0] = 0; in tws_setup_irq()
474 sc->irq_res[0] = bus_alloc_resource_any(sc->tws_dev, SYS_RES_IRQ, in tws_setup_irq()
475 &sc->irq_res_id[0], RF_SHAREABLE | RF_ACTIVE); in tws_setup_irq()
476 if ( ! sc->irq_res[0] ) in tws_setup_irq()
478 if ( tws_setup_intr(sc, sc->irqs) == FAILURE ) in tws_setup_irq()
480 device_printf(sc->tws_dev, "Using legacy INTx\n"); in tws_setup_irq()
483 sc->irqs = 1; in tws_setup_irq()
484 sc->irq_res_id[0] = 1; in tws_setup_irq()
486 if (pci_alloc_msi(sc->tws_dev, &messages) != 0 ) { in tws_setup_irq()
487 TWS_TRACE(sc, "pci alloc msi fail", 0, messages); in tws_setup_irq()
490 sc->irq_res[0] = bus_alloc_resource_any(sc->tws_dev, SYS_RES_IRQ, in tws_setup_irq()
491 &sc->irq_res_id[0], RF_SHAREABLE | RF_ACTIVE); in tws_setup_irq()
493 if ( !sc->irq_res[0] ) in tws_setup_irq()
495 if ( tws_setup_intr(sc, sc->irqs) == FAILURE ) in tws_setup_irq()
497 device_printf(sc->tws_dev, "Using MSI\n"); in tws_setup_irq()
505 tws_init(struct tws_softc *sc) in tws_init() argument
512 sc->seq_id = 0; in tws_init()
517 sc->is64bit = (sizeof(bus_addr_t) == 8) ? true : false; in tws_init()
518 max_sg_elements = (sc->is64bit && !tws_use_32bit_sgls) ? in tws_init()
523 if ( bus_dma_tag_create(bus_get_dma_tag(sc->tws_dev), /* PCI parent */ in tws_init()
534 &sc->parent_tag /* tag */ in tws_init()
536 TWS_TRACE_DEBUG(sc, "DMA parent tag Create fail", max_sg_elements, in tws_init()
537 sc->is64bit); in tws_init()
544 if ( bus_dma_tag_create(sc->parent_tag, /* parent */ in tws_init()
555 &sc->cmd_tag /* tag */ in tws_init()
557 TWS_TRACE_DEBUG(sc, "DMA cmd tag Create fail", max_sg_elements, sc->is64bit); in tws_init()
561 if (bus_dmamem_alloc(sc->cmd_tag, &sc->dma_mem, in tws_init()
562 BUS_DMA_NOWAIT, &sc->cmd_map)) { in tws_init()
563 TWS_TRACE_DEBUG(sc, "DMA mem alloc fail", max_sg_elements, sc->is64bit); in tws_init()
568 sc->dma_mem_phys=0; in tws_init()
569 bus_dmamap_load(sc->cmd_tag, sc->cmd_map, sc->dma_mem, in tws_init()
571 &sc->dma_mem_phys, 0); in tws_init()
577 if (bus_dma_tag_create(sc->parent_tag, /* parent */ in tws_init()
588 &sc->io_lock, /* lockfuncarg */ in tws_init()
589 &sc->data_tag /* tag */)) { in tws_init()
590 TWS_TRACE_DEBUG(sc, "DMA cmd tag Create fail", max_sg_elements, sc->is64bit); in tws_init()
594 sc->reqs = malloc(sizeof(struct tws_request) * tws_queue_depth, M_TWS, in tws_init()
596 sc->sense_bufs = malloc(sizeof(struct tws_sense) * tws_queue_depth, M_TWS, in tws_init()
598 sc->scan_ccb = xpt_alloc_ccb(); in tws_init()
599 if (bus_dmamem_alloc(sc->data_tag, (void **)&sc->ioctl_data_mem, in tws_init()
600 (BUS_DMA_NOWAIT | BUS_DMA_ZERO), &sc->ioctl_data_map)) { in tws_init()
601 device_printf(sc->tws_dev, "Cannot allocate ioctl data mem\n"); in tws_init()
605 if ( !tws_ctlr_ready(sc) ) in tws_init()
606 if( !tws_ctlr_reset(sc) ) in tws_init()
609 bzero(&sc->stats, sizeof(struct tws_stats)); in tws_init()
610 tws_init_qs(sc); in tws_init()
611 tws_turn_off_interrupts(sc); in tws_init()
621 reg = tws_read_reg(sc, TWS_I2O0_CTL, 4); in tws_init()
622 TWS_TRACE_DEBUG(sc, "i20 ctl", reg, TWS_I2O0_CTL); in tws_init()
623 tws_write_reg(sc, TWS_I2O0_CTL, reg | TWS_BIT1, 4); in tws_init()
627 TWS_TRACE_DEBUG(sc, "dma_mem_phys", sc->dma_mem_phys, TWS_I2O0_CTL); in tws_init()
628 if ( tws_init_reqs(sc, dma_mem_size) == FAILURE ) in tws_init()
630 if ( tws_init_aen_q(sc) == FAILURE ) in tws_init()
638 tws_init_aen_q(struct tws_softc *sc) in tws_init_aen_q() argument
640 sc->aen_q.head=0; in tws_init_aen_q()
641 sc->aen_q.tail=0; in tws_init_aen_q()
642 sc->aen_q.depth=256; in tws_init_aen_q()
643 sc->aen_q.overflow=0; in tws_init_aen_q()
644 sc->aen_q.q = malloc(sizeof(struct tws_event_packet)*sc->aen_q.depth, in tws_init_aen_q()
650 tws_init_trace_q(struct tws_softc *sc) in tws_init_trace_q() argument
652 sc->trace_q.head=0; in tws_init_trace_q()
653 sc->trace_q.tail=0; in tws_init_trace_q()
654 sc->trace_q.depth=256; in tws_init_trace_q()
655 sc->trace_q.overflow=0; in tws_init_trace_q()
656 sc->trace_q.q = malloc(sizeof(struct tws_trace_rec)*sc->trace_q.depth, in tws_init_trace_q()
662 tws_init_reqs(struct tws_softc *sc, u_int32_t dma_mem_size) in tws_init_reqs() argument
666 cmd_buf = (struct tws_command_packet *)sc->dma_mem; in tws_init_reqs()
670 TWS_TRACE_DEBUG(sc, "phy cmd", sc->dma_mem_phys, 0); in tws_init_reqs()
671 mtx_lock(&sc->q_lock); in tws_init_reqs()
674 if (bus_dmamap_create(sc->data_tag, 0, &sc->reqs[i].dma_map)) { in tws_init_reqs()
676 mtx_unlock(&sc->q_lock); in tws_init_reqs()
679 sc->reqs[i].cmd_pkt = &cmd_buf[i]; in tws_init_reqs()
681 sc->sense_bufs[i].hdr = &cmd_buf[i].hdr ; in tws_init_reqs()
682 sc->sense_bufs[i].hdr_pkt_phy = sc->dma_mem_phys + in tws_init_reqs()
685 sc->reqs[i].cmd_pkt_phy = sc->dma_mem_phys + in tws_init_reqs()
688 sc->reqs[i].request_id = i; in tws_init_reqs()
689 sc->reqs[i].sc = sc; in tws_init_reqs()
691 sc->reqs[i].cmd_pkt->hdr.header_desc.size_header = 128; in tws_init_reqs()
693 callout_init(&sc->reqs[i].timeout, 1); in tws_init_reqs()
694 sc->reqs[i].state = TWS_REQ_STATE_FREE; in tws_init_reqs()
696 tws_q_insert_tail(sc, &sc->reqs[i], TWS_FREE_Q); in tws_init_reqs()
698 mtx_unlock(&sc->q_lock); in tws_init_reqs()
713 tws_send_event(struct tws_softc *sc, u_int8_t event) in tws_send_event() argument
715 mtx_assert(&sc->gen_lock, MA_OWNED); in tws_send_event()
716 TWS_TRACE_DEBUG(sc, "received event ", 0, event); in tws_send_event()
719 sc->tws_state = TWS_INIT; in tws_send_event()
723 if (sc->tws_state != TWS_INIT) { in tws_send_event()
724 … device_printf(sc->tws_dev, "invalid state transition %d => TWS_ONLINE\n", sc->tws_state); in tws_send_event()
726 sc->tws_state = TWS_ONLINE; in tws_send_event()
732 if (sc->tws_state != TWS_RESET) { in tws_send_event()
733 sc->tws_prev_state = sc->tws_state; in tws_send_event()
734 sc->tws_state = TWS_RESET; in tws_send_event()
739 if (sc->tws_state != TWS_RESET) { in tws_send_event()
740 …device_printf(sc->tws_dev, "invalid state transition %d => %d (previous state)\n", sc->tws_state, … in tws_send_event()
742 sc->tws_state = sc->tws_prev_state; in tws_send_event()
747 if (sc->tws_state != TWS_ONLINE) { in tws_send_event()
748 … device_printf(sc->tws_dev, "invalid state transition %d => TWS_OFFLINE\n", sc->tws_state); in tws_send_event()
750 sc->tws_state = TWS_OFFLINE; in tws_send_event()
755 if ((sc->tws_state != TWS_ONLINE) && (sc->tws_state != TWS_OFFLINE)) { in tws_send_event()
756 … device_printf(sc->tws_dev, "invalid state transition %d => TWS_UNINIT\n", sc->tws_state); in tws_send_event()
758 sc->tws_state = TWS_UNINIT; in tws_send_event()
766 tws_get_state(struct tws_softc *sc) in tws_get_state() argument
769 return((u_int8_t)sc->tws_state); in tws_get_state()
779 struct tws_softc *sc = device_get_softc(dev); in tws_shutdown() local
781 TWS_TRACE_DEBUG(sc, "entry", 0, 0); in tws_shutdown()
783 tws_turn_off_interrupts(sc); in tws_shutdown()
784 tws_init_connect(sc, 1); in tws_shutdown()
795 struct tws_softc *sc = device_get_softc(dev); in tws_suspend() local
797 if ( sc ) in tws_suspend()
798 TWS_TRACE_DEBUG(sc, "entry", 0, 0); in tws_suspend()
809 struct tws_softc *sc = device_get_softc(dev); in tws_resume() local
811 if ( sc ) in tws_resume()
812 TWS_TRACE_DEBUG(sc, "entry", 0, 0); in tws_resume()
817 tws_get_request(struct tws_softc *sc, u_int16_t type) in tws_get_request() argument
819 struct mtx *my_mutex = ((type == TWS_REQ_TYPE_SCSI_IO) ? &sc->q_lock : &sc->gen_lock); in tws_get_request()
825 r = tws_q_remove_head(sc, TWS_FREE_Q); in tws_get_request()
827 if ( sc->reqs[type].state == TWS_REQ_STATE_FREE ) { in tws_get_request()
828 r = &sc->reqs[type]; in tws_get_request()
856 struct tws_softc *sc = req->sc; in tws_release_request() local
858 TWS_TRACE_DEBUG(sc, "entry", sc, 0); in tws_release_request()
859 mtx_lock(&sc->q_lock); in tws_release_request()
860 tws_q_insert_tail(sc, req, TWS_FREE_Q); in tws_release_request()
861 mtx_unlock(&sc->q_lock); in tws_release_request()