Lines Matching refs:lp

1202 	struct lcb *	lp[MAX_LUN];	/* The lcb's of this tcb	*/  member
1952 static void ncr_start_next_ccb (struct ncb *np, struct lcb * lp, int maxn);
4123 struct lcb *lp = tp->lp[sdev->lun]; in ncr_queue_command() local
4209 if (lp && time_after(jiffies, lp->tags_stime)) { in ncr_queue_command()
4210 if (lp->tags_smap) { in ncr_queue_command()
4217 lp->tags_stime = jiffies + 3*HZ; in ncr_queue_command()
4218 lp->tags_smap = lp->tags_umap; in ncr_queue_command()
4275 if ((!tp->widedone || !tp->period) && !tp->nego_cp && lp) { in ncr_queue_command()
4407 if (lp) in ncr_queue_command()
4408 ncr_start_next_ccb(np, lp, 2); in ncr_queue_command()
4428 static void ncr_start_next_ccb(struct ncb *np, struct lcb *lp, int maxn) in ncr_start_next_ccb() argument
4433 if (lp->held_ccb) in ncr_start_next_ccb()
4436 while (maxn-- && lp->queuedccbs < lp->queuedepth) { in ncr_start_next_ccb()
4437 qp = ncr_list_pop(&lp->wait_ccbq); in ncr_start_next_ccb()
4440 ++lp->queuedccbs; in ncr_start_next_ccb()
4442 list_add_tail(qp, &lp->busy_ccbq); in ncr_start_next_ccb()
4443 lp->jump_ccb[cp->tag == NO_TAG ? 0 : cp->tag] = in ncr_start_next_ccb()
4708 struct lcb *lp; in ncr_detach() local
4783 lp = tp->lp[lun]; in ncr_detach()
4784 if (lp) { in ncr_detach()
4786 printk("%s: freeing lp (%lx)\n", ncr_name(np), (u_long) lp); in ncr_detach()
4788 if (lp->jump_ccb != &lp->jump_ccb_0) in ncr_detach()
4789 m_free_dma(lp->jump_ccb,256,"JUMP_CCB"); in ncr_detach()
4790 m_free_dma(lp, sizeof(*lp), "LCB"); in ncr_detach()
4820 struct lcb *lp; in ncr_complete() local
4844 lp = tp->lp[cmd->device->lun]; in ncr_complete()
4867 if (lp && lp->held_ccb) { in ncr_complete()
4868 if (cp == lp->held_ccb) { in ncr_complete()
4869 list_splice_init(&lp->skip_ccbq, &lp->wait_ccbq); in ncr_complete()
4870 lp->held_ccb = NULL; in ncr_complete()
4937 if (!lp) in ncr_complete()
4947 if (lp && lp->usetags && lp->numtags < lp->maxtags) { in ncr_complete()
4948 ++lp->num_good; in ncr_complete()
4949 if (lp->num_good >= 1000) { in ncr_complete()
4950 lp->num_good = 0; in ncr_complete()
4951 ++lp->numtags; in ncr_complete()
5063 if (lp && lp->queuedccbs < lp->queuedepth && in ncr_complete()
5064 !list_empty(&lp->wait_ccbq)) in ncr_complete()
5065 ncr_start_next_ccb(np, lp, 2); in ncr_complete()
5095 struct lcb *lp = tp->lp[cp->lun]; in ncr_ccb_skipped() local
5097 if (lp && cp != np->ccb) { in ncr_ccb_skipped()
5101 list_move_tail(&cp->link_ccbq, &lp->skip_ccbq); in ncr_ccb_skipped()
5103 --lp->queuedccbs; in ncr_ccb_skipped()
5636 struct lcb *lp = tp->lp[ln]; in ncr_setup_tags() local
5642 if ((!tp) || (!lp) || !sdev) in ncr_setup_tags()
5648 if (!lp->scdev_depth) in ncr_setup_tags()
5656 maxdepth = lp->scdev_depth; in ncr_setup_tags()
5657 if (maxdepth > lp->maxnxs) maxdepth = lp->maxnxs; in ncr_setup_tags()
5658 if (lp->maxtags > maxdepth) lp->maxtags = maxdepth; in ncr_setup_tags()
5659 if (lp->numtags > maxdepth) lp->numtags = maxdepth; in ncr_setup_tags()
5666 if (sdev->tagged_supported && lp->numtags > 1) { in ncr_setup_tags()
5667 reqtags = lp->numtags; in ncr_setup_tags()
5675 lp->numtags = reqtags; in ncr_setup_tags()
5676 if (lp->numtags > lp->maxtags) in ncr_setup_tags()
5677 lp->maxtags = lp->numtags; in ncr_setup_tags()
5683 if (reqtags > 1 && lp->usetags) { /* Stay in tagged mode */ in ncr_setup_tags()
5684 if (lp->queuedepth == reqtags) /* Already announced */ in ncr_setup_tags()
5686 lp->queuedepth = reqtags; in ncr_setup_tags()
5688 else if (reqtags <= 1 && !lp->usetags) { /* Stay in untagged mode */ in ncr_setup_tags()
5689 lp->queuedepth = reqtags; in ncr_setup_tags()
5693 if (lp->busyccbs) /* If not yet safe, return */ in ncr_setup_tags()
5695 lp->queuedepth = reqtags; in ncr_setup_tags()
5696 lp->usetags = reqtags > 1 ? 1 : 0; in ncr_setup_tags()
5702 lp->jump_tag.l_paddr = lp->usetags? in ncr_setup_tags()
5710 if (lp->usetags) { in ncr_setup_tags()
6545 struct lcb *lp = tp->lp[cmd->device->lun]; in ncr_sir_to_redo() local
6559 if (lp) { in ncr_sir_to_redo()
6560 qp = lp->busy_ccbq.prev; in ncr_sir_to_redo()
6561 while (qp != &lp->busy_ccbq) { in ncr_sir_to_redo()
6570 lp->held_ccb = cp; /* Requeue when this one completes */ in ncr_sir_to_redo()
6571 disc_cnt = lp->queuedccbs - busy_cnt; in ncr_sir_to_redo()
6581 if (!lp) in ncr_sir_to_redo()
6587 if (disc_cnt < lp->numtags) { in ncr_sir_to_redo()
6588 lp->numtags = disc_cnt > 2 ? disc_cnt : 2; in ncr_sir_to_redo()
6589 lp->num_good = 0; in ncr_sir_to_redo()
6725 if (tp->lp[0]) { in ncr_int_sir()
6726 OUTL_DSP (scr_to_cpu(tp->lp[0]->jump_ccb[0])); in ncr_int_sir()
7148 struct lcb *lp = tp->lp[ln]; in ncr_get_ccb() local
7155 if (lp) { in ncr_get_ccb()
7160 if (lp->usetags && lp->busyccbs >= lp->maxnxs) in ncr_get_ccb()
7166 if (list_empty(&lp->free_ccbq)) in ncr_get_ccb()
7172 qp = ncr_list_pop(&lp->free_ccbq); in ncr_get_ccb()
7180 list_add_tail(qp, &lp->wait_ccbq); in ncr_get_ccb()
7181 ++lp->busyccbs; in ncr_get_ccb()
7190 if (lp->usetags) in ncr_get_ccb()
7191 tag = lp->cb_tags[lp->ia_tag]; in ncr_get_ccb()
7193 else if (lp->actccbs > 0) in ncr_get_ccb()
7222 if (lp) { in ncr_get_ccb()
7224 ++lp->ia_tag; in ncr_get_ccb()
7225 if (lp->ia_tag == MAX_TAGS) in ncr_get_ccb()
7226 lp->ia_tag = 0; in ncr_get_ccb()
7227 lp->tags_umap |= (((tagmap_t) 1) << tag); in ncr_get_ccb()
7257 struct lcb *lp = tp->lp[cp->lun]; in ncr_free_ccb() local
7268 if (lp) { in ncr_free_ccb()
7270 lp->cb_tags[lp->if_tag++] = cp->tag; in ncr_free_ccb()
7271 if (lp->if_tag == MAX_TAGS) in ncr_free_ccb()
7272 lp->if_tag = 0; in ncr_free_ccb()
7273 lp->tags_umap &= ~(((tagmap_t) 1) << cp->tag); in ncr_free_ccb()
7274 lp->tags_smap &= lp->tags_umap; in ncr_free_ccb()
7275 lp->jump_ccb[cp->tag] = in ncr_free_ccb()
7278 lp->jump_ccb[0] = in ncr_free_ccb()
7287 if (lp) { in ncr_free_ccb()
7289 list_move(&cp->link_ccbq, &lp->free_ccbq); in ncr_free_ccb()
7290 --lp->busyccbs; in ncr_free_ccb()
7292 --lp->queuedccbs; in ncr_free_ccb()
7358 struct lcb *lp = tp->lp[ln]; in ncr_alloc_ccb() local
7371 lp->actccbs++; in ncr_alloc_ccb()
7383 list_add(&cp->link_ccbq, &lp->free_ccbq); in ncr_alloc_ccb()
7494 struct lcb *lp = tp->lp[ln]; in ncr_alloc_lcb() local
7501 if (lp) in ncr_alloc_lcb()
7502 return lp; in ncr_alloc_lcb()
7507 lp = m_calloc_dma(sizeof(struct lcb), "LCB"); in ncr_alloc_lcb()
7508 if (!lp) in ncr_alloc_lcb()
7510 memset(lp, 0, sizeof(*lp)); in ncr_alloc_lcb()
7511 tp->lp[ln] = lp; in ncr_alloc_lcb()
7522 INIT_LIST_HEAD(&lp->free_ccbq); in ncr_alloc_lcb()
7523 INIT_LIST_HEAD(&lp->busy_ccbq); in ncr_alloc_lcb()
7524 INIT_LIST_HEAD(&lp->wait_ccbq); in ncr_alloc_lcb()
7525 INIT_LIST_HEAD(&lp->skip_ccbq); in ncr_alloc_lcb()
7531 lp->maxnxs = 1; in ncr_alloc_lcb()
7532 lp->jump_ccb = &lp->jump_ccb_0; in ncr_alloc_lcb()
7533 lp->p_jump_ccb = cpu_to_scr(vtobus(lp->jump_ccb)); in ncr_alloc_lcb()
7546 lp->jump_lcb.l_cmd = in ncr_alloc_lcb()
7548 lp->jump_lcb.l_paddr = tp->jump_lcb[lh].l_paddr; in ncr_alloc_lcb()
7550 lp->load_jump_ccb[0] = cpu_to_scr(copy_4); in ncr_alloc_lcb()
7551 lp->load_jump_ccb[1] = cpu_to_scr(vtobus (&lp->p_jump_ccb)); in ncr_alloc_lcb()
7552 lp->load_jump_ccb[2] = cpu_to_scr(ncr_reg_bus_addr(nc_temp)); in ncr_alloc_lcb()
7554 lp->jump_tag.l_cmd = cpu_to_scr(SCR_JUMP); in ncr_alloc_lcb()
7555 lp->jump_tag.l_paddr = cpu_to_scr(NCB_SCRIPT_PHYS (np, resel_notag)); in ncr_alloc_lcb()
7560 tp->jump_lcb[lh].l_paddr = cpu_to_scr(vtobus (&lp->jump_lcb)); in ncr_alloc_lcb()
7565 lp->busyccbs = 1; in ncr_alloc_lcb()
7566 lp->queuedccbs = 1; in ncr_alloc_lcb()
7567 lp->queuedepth = 1; in ncr_alloc_lcb()
7569 return lp; in ncr_alloc_lcb()
7585 struct lcb *lp = tp->lp[ln]; in ncr_setup_lcb() local
7588 if (!lp && !(lp = ncr_alloc_lcb(np, tn, ln))) in ncr_setup_lcb()
7595 if (sdev->tagged_supported && lp->jump_ccb == &lp->jump_ccb_0) { in ncr_setup_lcb()
7597 lp->jump_ccb = m_calloc_dma(256, "JUMP_CCB"); in ncr_setup_lcb()
7598 if (!lp->jump_ccb) { in ncr_setup_lcb()
7599 lp->jump_ccb = &lp->jump_ccb_0; in ncr_setup_lcb()
7602 lp->p_jump_ccb = cpu_to_scr(vtobus(lp->jump_ccb)); in ncr_setup_lcb()
7604 lp->jump_ccb[i] = in ncr_setup_lcb()
7607 lp->cb_tags[i] = i; in ncr_setup_lcb()
7608 lp->maxnxs = MAX_TAGS; in ncr_setup_lcb()
7609 lp->tags_stime = jiffies + 3*HZ; in ncr_setup_lcb()
7615 return lp; in ncr_setup_lcb()
7978 struct lcb *lp = tp->lp[device->lun]; local
8011 if (lp) {
8012 lp->numtags = lp->maxtags = numtags;
8013 lp->scdev_depth = depth_to_use;