Lines Matching refs:cp
861 #define CCB_DONE_VALID(cp) (((u_long) cp) != CCB_DONE_EMPTY) argument
865 #define CCB_DONE_VALID(cp) \ argument
866 ((((u_long) cp) & 0xffffffff00000000ul) && \
867 (((u_long) cp) & 0xfffffffful) != CCB_DONE_EMPTY)
1382 struct ccb * cp; member
1573 #define CCB_PHYS(cp,lbl) (cp->p_ccb + offsetof(struct ccb, lbl)) argument
1905 static void ncr_complete (struct ncb *np, struct ccb *cp);
1907 static void ncr_free_ccb (struct ncb *np, struct ccb *cp);
1908 static void ncr_init_ccb (struct ncb *np, struct ccb *cp);
1923 static int ncr_prepare_nego(struct ncb *np, struct ccb *cp, u_char *msgptr);
1928 static int ncr_scatter (struct ncb *np, struct ccb *cp, struct scsi_cmnd *cmd);
1930 static void ncr_setsync (struct ncb *np, struct ccb *cp, u_char scntl3, u_char sxfer);
1932 static void ncr_setwide (struct ncb *np, struct ccb *cp, u_char wide, u_char ack);
1938 static void ncr_put_start_queue(struct ncb *np, struct ccb *cp);
3423 *p++ =NADDR (header.cp); in ncr_script_fill()
3639 static void ncr_print_msg(struct ccb *cp, char *label, u_char *msg) in ncr_print_msg() argument
3641 PRINT_ADDR(cp->cmd, "%s: ", label); in ncr_print_msg()
4023 static int ncr_prepare_nego(struct ncb *np, struct ccb *cp, u_char *msgptr) in ncr_prepare_nego() argument
4025 struct tcb *tp = &np->target[cp->target]; in ncr_prepare_nego()
4058 cp->nego_status = nego; in ncr_prepare_nego()
4061 tp->nego_cp = cp; in ncr_prepare_nego()
4063 ncr_print_msg(cp, nego == NS_WIDE ? in ncr_prepare_nego()
4087 struct ccb *cp; in ncr_queue_command() local
4142 if (np->settle_time || !(cp=ncr_get_ccb (np, cmd))) { in ncr_queue_command()
4146 cp->cmd = cmd; in ncr_queue_command()
4157 if (cp ->tag != NO_TAG || in ncr_queue_command()
4158 (cp != np->ccb && np->disc && !(tp->usrflag & UF_NODISC))) in ncr_queue_command()
4161 msgptr = cp->scsi_smsg; in ncr_queue_command()
4165 if (cp->tag != NO_TAG) { in ncr_queue_command()
4204 msgptr[msglen++] = (cp->tag << 1) + 1; in ncr_queue_command()
4216 segments = ncr_scatter(np, cp, cp->cmd); in ncr_queue_command()
4218 ncr_free_ccb(np, cp); in ncr_queue_command()
4223 cp->data_len = 0; in ncr_queue_command()
4236 cp->nego_status = 0; in ncr_queue_command()
4239 msglen += ncr_prepare_nego (np, cp, msgptr + msglen); in ncr_queue_command()
4248 if (!cp->data_len) in ncr_queue_command()
4269 cp->phys.header.wgoalp = cpu_to_scr(goalp); in ncr_queue_command()
4270 cp->phys.header.wlastp = cpu_to_scr(lastp); in ncr_queue_command()
4291 cp->phys.header.lastp = cpu_to_scr(lastp); in ncr_queue_command()
4292 cp->phys.header.goalp = cpu_to_scr(goalp); in ncr_queue_command()
4295 cp->phys.header.savep = in ncr_queue_command()
4298 cp->phys.header.savep= cpu_to_scr(lastp); in ncr_queue_command()
4304 cp->startp = cp->phys.header.savep; in ncr_queue_command()
4320 cp->start.schedule.l_paddr = cpu_to_scr(NCB_SCRIPT_PHYS (np, select)); in ncr_queue_command()
4321 cp->restart.schedule.l_paddr = cpu_to_scr(NCB_SCRIPT_PHYS (np, resel_dsa)); in ncr_queue_command()
4325 cp->phys.select.sel_id = sdev_id(sdev); in ncr_queue_command()
4326 cp->phys.select.sel_scntl3 = tp->wval; in ncr_queue_command()
4327 cp->phys.select.sel_sxfer = tp->sval; in ncr_queue_command()
4331 cp->phys.smsg.addr = cpu_to_scr(CCB_PHYS (cp, scsi_smsg)); in ncr_queue_command()
4332 cp->phys.smsg.size = cpu_to_scr(msglen); in ncr_queue_command()
4337 memcpy(cp->cdb_buf, cmd->cmnd, min_t(int, cmd->cmd_len, sizeof(cp->cdb_buf))); in ncr_queue_command()
4338 cp->phys.cmd.addr = cpu_to_scr(CCB_PHYS (cp, cdb_buf[0])); in ncr_queue_command()
4339 cp->phys.cmd.size = cpu_to_scr(cmd->cmd_len); in ncr_queue_command()
4344 cp->actualquirks = 0; in ncr_queue_command()
4345 cp->host_status = cp->nego_status ? HS_NEGOTIATE : HS_BUSY; in ncr_queue_command()
4346 cp->scsi_status = SAM_STAT_ILLEGAL; in ncr_queue_command()
4347 cp->parity_status = 0; in ncr_queue_command()
4349 cp->xerr_status = XE_OK; in ncr_queue_command()
4359 cp->magic = CCB_MAGIC; in ncr_queue_command()
4365 cp->auto_sense = 0; in ncr_queue_command()
4369 ncr_put_start_queue(np, cp); in ncr_queue_command()
4390 struct ccb *cp; in ncr_start_next_ccb() local
4400 cp = list_entry(qp, struct ccb, link_ccbq); in ncr_start_next_ccb()
4402 lp->jump_ccb[cp->tag == NO_TAG ? 0 : cp->tag] = in ncr_start_next_ccb()
4403 cpu_to_scr(CCB_PHYS (cp, restart)); in ncr_start_next_ccb()
4404 ncr_put_start_queue(np, cp); in ncr_start_next_ccb()
4408 static void ncr_put_start_queue(struct ncb *np, struct ccb *cp) in ncr_put_start_queue() argument
4421 np->scripth->tryloop [np->squeueput] = cpu_to_scr(CCB_PHYS (cp, start)); in ncr_put_start_queue()
4425 cp->queued = 1; in ncr_put_start_queue()
4550 struct ccb *cp; in ncr_detach() local
4610 while ((cp=np->ccb->link_ccb) != NULL) { in ncr_detach()
4611 np->ccb->link_ccb = cp->link_ccb; in ncr_detach()
4612 if (cp->host_status) { in ncr_detach()
4614 ncr_name(np), cp->host_status); in ncr_detach()
4617 printk("%s: freeing ccb (%lx)\n", ncr_name(np), (u_long) cp); in ncr_detach()
4619 m_free_dma(cp, sizeof(*cp), "CCB"); in ncr_detach()
4660 void ncr_complete (struct ncb *np, struct ccb *cp) in ncr_complete() argument
4670 if (!cp || cp->magic != CCB_MAGIC || !cp->cmd) in ncr_complete()
4678 printk ("CCB=%lx STAT=%x/%x\n", (unsigned long)cp, in ncr_complete()
4679 cp->host_status,cp->scsi_status); in ncr_complete()
4685 cmd = cp->cmd; in ncr_complete()
4686 cp->cmd = NULL; in ncr_complete()
4696 if (cp == tp->nego_cp) in ncr_complete()
4702 if (cp->auto_sense) { in ncr_complete()
4703 cp->scsi_status = cp->auto_sense; in ncr_complete()
4712 if (cp == lp->held_ccb) { in ncr_complete()
4722 if (cp->parity_status > 1) { in ncr_complete()
4723 PRINT_ADDR(cmd, "%d parity error(s).\n",cp->parity_status); in ncr_complete()
4730 if (cp->xerr_status != XE_OK) { in ncr_complete()
4731 switch (cp->xerr_status) { in ncr_complete()
4740 cp->xerr_status); in ncr_complete()
4743 if (cp->host_status==HS_COMPLETE) in ncr_complete()
4744 cp->host_status = HS_FAIL; in ncr_complete()
4751 if (cp->host_status != HS_COMPLETE || in ncr_complete()
4752 cp->scsi_status != SAM_STAT_GOOD) { in ncr_complete()
4755 cp->host_status, cp->scsi_status); in ncr_complete()
4763 if ( (cp->host_status == HS_COMPLETE) in ncr_complete()
4764 && (cp->scsi_status == SAM_STAT_GOOD || in ncr_complete()
4765 cp->scsi_status == SAM_STAT_CONDITION_MET)) { in ncr_complete()
4771 set_status_byte(cmd, cp->scsi_status); in ncr_complete()
4786 tp->bytes += cp->data_len; in ncr_complete()
4801 } else if ((cp->host_status == HS_COMPLETE) in ncr_complete()
4802 && (cp->scsi_status == SAM_STAT_CHECK_CONDITION)) { in ncr_complete()
4811 memcpy(cmd->sense_buffer, cp->sense_buf, in ncr_complete()
4813 sizeof(cp->sense_buf))); in ncr_complete()
4822 } else if ((cp->host_status == HS_COMPLETE) in ncr_complete()
4823 && (cp->scsi_status == SAM_STAT_RESERVATION_CONFLICT)) { in ncr_complete()
4829 } else if ((cp->host_status == HS_COMPLETE) in ncr_complete()
4830 && (cp->scsi_status == SAM_STAT_BUSY || in ncr_complete()
4831 cp->scsi_status == SAM_STAT_TASK_SET_FULL)) { in ncr_complete()
4836 set_status_byte(cmd, cp->scsi_status); in ncr_complete()
4838 } else if ((cp->host_status == HS_SEL_TIMEOUT) in ncr_complete()
4839 || (cp->host_status == HS_TIMEOUT)) { in ncr_complete()
4844 set_status_byte(cmd, cp->scsi_status); in ncr_complete()
4847 } else if (cp->host_status == HS_RESET) { in ncr_complete()
4852 set_status_byte(cmd, cp->scsi_status); in ncr_complete()
4855 } else if (cp->host_status == HS_ABORTED) { in ncr_complete()
4860 set_status_byte(cmd, cp->scsi_status); in ncr_complete()
4869 cp->host_status, cp->scsi_status, cp); in ncr_complete()
4871 set_status_byte(cmd, cp->scsi_status); in ncr_complete()
4886 if (cp->host_status==HS_COMPLETE) { in ncr_complete()
4887 switch (cp->scsi_status) { in ncr_complete()
4898 printk (" STAT: %x\n", cp->scsi_status); in ncr_complete()
4901 } else printk (" HOSTERROR: %x", cp->host_status); in ncr_complete()
4908 ncr_free_ccb (np, cp); in ncr_complete()
4942 static void ncr_ccb_skipped(struct ncb *np, struct ccb *cp) in ncr_ccb_skipped() argument
4944 struct tcb *tp = &np->target[cp->target]; in ncr_ccb_skipped()
4945 struct lcb *lp = tp->lp[cp->lun]; in ncr_ccb_skipped()
4947 if (lp && cp != np->ccb) { in ncr_ccb_skipped()
4948 cp->host_status &= ~HS_SKIPMASK; in ncr_ccb_skipped()
4949 cp->start.schedule.l_paddr = in ncr_ccb_skipped()
4951 list_move_tail(&cp->link_ccbq, &lp->skip_ccbq); in ncr_ccb_skipped()
4952 if (cp->queued) { in ncr_ccb_skipped()
4956 if (cp->queued) { in ncr_ccb_skipped()
4958 cp->queued = 0; in ncr_ccb_skipped()
4968 struct ccb *cp; in ncr_wakeup_done() local
4978 cp = np->ccb_done[j]; in ncr_wakeup_done()
4979 if (!CCB_DONE_VALID(cp)) in ncr_wakeup_done()
4989 if (cp->host_status & HS_DONEMASK) in ncr_wakeup_done()
4990 ncr_complete (np, cp); in ncr_wakeup_done()
4991 else if (cp->host_status & HS_SKIPMASK) in ncr_wakeup_done()
4992 ncr_ccb_skipped (np, cp); in ncr_wakeup_done()
4998 cp = np->ccb; in ncr_wakeup_done()
4999 while (cp) { in ncr_wakeup_done()
5000 if (cp->host_status & HS_DONEMASK) in ncr_wakeup_done()
5001 ncr_complete (np, cp); in ncr_wakeup_done()
5002 else if (cp->host_status & HS_SKIPMASK) in ncr_wakeup_done()
5003 ncr_ccb_skipped (np, cp); in ncr_wakeup_done()
5004 cp = cp->link_ccb; in ncr_wakeup_done()
5014 struct ccb *cp = np->ccb; in ncr_wakeup() local
5016 while (cp) { in ncr_wakeup()
5017 if (cp->host_status != HS_IDLE) { in ncr_wakeup()
5018 cp->host_status = code; in ncr_wakeup()
5019 ncr_complete (np, cp); in ncr_wakeup()
5021 cp = cp->link_ccb; in ncr_wakeup()
5326 struct ccb *cp; in ncr_set_sync_wide_status() local
5340 for (cp = np->ccb; cp; cp = cp->link_ccb) { in ncr_set_sync_wide_status()
5341 if (!cp->cmd) continue; in ncr_set_sync_wide_status()
5342 if (scmd_id(cp->cmd) != target) continue; in ncr_set_sync_wide_status()
5343 cp->phys.select.sel_scntl3 = tp->wval; in ncr_set_sync_wide_status()
5344 cp->phys.select.sel_sxfer = tp->sval; in ncr_set_sync_wide_status()
5355 static void ncr_setsync (struct ncb *np, struct ccb *cp, u_char scntl3, u_char sxfer) in ncr_setsync() argument
5357 struct scsi_cmnd *cmd = cp->cmd; in ncr_setsync()
5412 static void ncr_setwide (struct ncb *np, struct ccb *cp, u_char wide, u_char ack) in ncr_setwide() argument
5414 struct scsi_cmnd *cmd = cp->cmd; in ncr_setwide()
5914 struct ccb *cp; in ncr_int_sto() local
5922 cp = np->ccb; in ncr_int_sto()
5923 while (cp && (CCB_PHYS (cp, phys) != dsa)) in ncr_int_sto()
5924 cp = cp->link_ccb; in ncr_int_sto()
5926 if (cp) { in ncr_int_sto()
5927 cp-> host_status = HS_SEL_TIMEOUT; in ncr_int_sto()
5928 ncr_complete (np, cp); in ncr_int_sto()
6081 struct ccb *cp; in ncr_int_ma() local
6144 cp = np->header.cp; in ncr_int_ma()
6145 if (CCB_PHYS(cp, phys) != dsa) in ncr_int_ma()
6146 cp = NULL; in ncr_int_ma()
6148 cp = np->ccb; in ncr_int_ma()
6149 while (cp && (CCB_PHYS (cp, phys) != dsa)) in ncr_int_ma()
6150 cp = cp->link_ccb; in ncr_int_ma()
6169 else if (cp) { in ncr_int_ma()
6170 if (dsp == CCB_PHYS (cp, patch[2])) { in ncr_int_ma()
6171 vdsp = &cp->patch[0]; in ncr_int_ma()
6174 else if (dsp == CCB_PHYS (cp, patch[6])) { in ncr_int_ma()
6175 vdsp = &cp->patch[4]; in ncr_int_ma()
6186 cp, np->header.cp, in ncr_int_ma()
6197 if (!cp) { in ncr_int_ma()
6200 ncr_name (np), (u_long) np->header.cp); in ncr_int_ma()
6211 tblp = (u32 *) ((char*) &cp->phys + oadr); in ncr_int_ma()
6232 PRINT_ADDR(cp->cmd, "internal error: cmd=%02x != %02x=(vdsp[0] " in ncr_int_ma()
6244 if (cp != np->header.cp) { in ncr_int_ma()
6247 ncr_name (np), (u_long) cp, (u_long) np->header.cp); in ncr_int_ma()
6255 PRINT_ADDR(cp->cmd, "phase change %x-%x %d@%08x resid=%d.\n", in ncr_int_ma()
6266 newcmd = cp->patch; in ncr_int_ma()
6267 newtmp = CCB_PHYS (cp, patch); in ncr_int_ma()
6268 if (newtmp == scr_to_cpu(cp->phys.header.savep)) { in ncr_int_ma()
6269 newcmd = &cp->patch[4]; in ncr_int_ma()
6270 newtmp = CCB_PHYS (cp, patch[4]); in ncr_int_ma()
6283 PRINT_ADDR(cp->cmd, "newcmd[%d] %x %x %x %x.\n", in ncr_int_ma()
6284 (int) (newcmd - cp->patch), in ncr_int_ma()
6341 cp->host_status = HS_BUSY; in ncr_int_ma()
6366 static void ncr_sir_to_redo(struct ncb *np, int num, struct ccb *cp) in ncr_sir_to_redo() argument
6368 struct scsi_cmnd *cmd = cp->cmd; in ncr_sir_to_redo()
6390 if (cp2 == cp) in ncr_sir_to_redo()
6395 lp->held_ccb = cp; /* Requeue when this one completes */ in ncr_sir_to_redo()
6423 cp->phys.header.savep = cp->startp; in ncr_sir_to_redo()
6424 cp->host_status = HS_BUSY; in ncr_sir_to_redo()
6425 cp->scsi_status = SAM_STAT_ILLEGAL; in ncr_sir_to_redo()
6427 ncr_put_start_queue(np, cp); in ncr_sir_to_redo()
6437 if (cp->auto_sense) in ncr_sir_to_redo()
6447 cp->scsi_smsg2[0] = IDENTIFY(0, cmd->device->lun); in ncr_sir_to_redo()
6448 cp->phys.smsg.addr = cpu_to_scr(CCB_PHYS (cp, scsi_smsg2)); in ncr_sir_to_redo()
6449 cp->phys.smsg.size = cpu_to_scr(1); in ncr_sir_to_redo()
6454 cp->phys.cmd.addr = cpu_to_scr(CCB_PHYS (cp, sensecmd)); in ncr_sir_to_redo()
6455 cp->phys.cmd.size = cpu_to_scr(6); in ncr_sir_to_redo()
6460 cp->sensecmd[0] = 0x03; in ncr_sir_to_redo()
6461 cp->sensecmd[1] = (cmd->device->lun & 0x7) << 5; in ncr_sir_to_redo()
6462 cp->sensecmd[4] = sizeof(cp->sense_buf); in ncr_sir_to_redo()
6467 memset(cp->sense_buf, 0, sizeof(cp->sense_buf)); in ncr_sir_to_redo()
6468 cp->phys.sense.addr = cpu_to_scr(CCB_PHYS(cp,sense_buf[0])); in ncr_sir_to_redo()
6469 cp->phys.sense.size = cpu_to_scr(sizeof(cp->sense_buf)); in ncr_sir_to_redo()
6476 cp->phys.header.savep = startp; in ncr_sir_to_redo()
6477 cp->phys.header.goalp = startp + 24; in ncr_sir_to_redo()
6478 cp->phys.header.lastp = startp; in ncr_sir_to_redo()
6479 cp->phys.header.wgoalp = startp + 24; in ncr_sir_to_redo()
6480 cp->phys.header.wlastp = startp; in ncr_sir_to_redo()
6482 cp->host_status = HS_BUSY; in ncr_sir_to_redo()
6483 cp->scsi_status = SAM_STAT_ILLEGAL; in ncr_sir_to_redo()
6484 cp->auto_sense = s_status; in ncr_sir_to_redo()
6486 cp->start.schedule.l_paddr = in ncr_sir_to_redo()
6493 cp->start.schedule.l_paddr = in ncr_sir_to_redo()
6496 ncr_put_start_queue(np, cp); in ncr_sir_to_redo()
6522 struct ccb *cp=NULL; in ncr_int_sir() local
6569 cp = np->header.cp; in ncr_int_sir()
6570 if (!cp || CCB_PHYS (cp, phys) != dsa) in ncr_int_sir()
6572 ncr_sir_to_redo(np, num, cp); in ncr_int_sir()
6578 cp = np->ccb; in ncr_int_sir()
6579 while (cp && (CCB_PHYS (cp, phys) != dsa)) in ncr_int_sir()
6580 cp = cp->link_ccb; in ncr_int_sir()
6582 BUG_ON(!cp); in ncr_int_sir()
6583 BUG_ON(cp != np->header.cp); in ncr_int_sir()
6585 if (!cp || cp != np->header.cp) in ncr_int_sir()
6674 PRINT_ADDR(cp->cmd, "negotiation failed sir=%x " in ncr_int_sir()
6675 "status=%x.\n", num, cp->nego_status); in ncr_int_sir()
6682 switch (cp->nego_status) { in ncr_int_sir()
6687 ncr_setsync (np, cp, 0, 0xe0); in ncr_int_sir()
6692 ncr_setwide (np, cp, 0, 0); in ncr_int_sir()
6698 cp->nego_status = 0; in ncr_int_sir()
6703 ncr_print_msg(cp, "sync msgin", np->msgin); in ncr_int_sir()
6750 PRINT_ADDR(cp->cmd, "sync: per=%d scntl3=0x%x ofs=%d " in ncr_int_sir()
6756 switch (cp->nego_status) { in ncr_int_sir()
6764 ncr_setsync(np, cp, 0, 0xe0); in ncr_int_sir()
6770 ncr_setsync(np, cp, scntl3, (fak<<5)|ofs); in ncr_int_sir()
6777 ncr_setwide(np, cp, 0, 0); in ncr_int_sir()
6789 ncr_setsync(np, cp, scntl3, (fak<<5)|ofs); in ncr_int_sir()
6792 cp->nego_status = NS_SYNC; in ncr_int_sir()
6795 ncr_print_msg(cp, "sync msgout", np->msgout); in ncr_int_sir()
6811 ncr_print_msg(cp, "wide msgin", np->msgin); in ncr_int_sir()
6837 PRINT_ADDR(cp->cmd, "wide: wide=%d chg=%d.\n", wide, in ncr_int_sir()
6843 switch (cp->nego_status) { in ncr_int_sir()
6852 ncr_setwide(np, cp, 0, 1); in ncr_int_sir()
6857 ncr_setwide(np, cp, wide, 1); in ncr_int_sir()
6865 ncr_setsync(np, cp, 0, 0xe0); in ncr_int_sir()
6876 ncr_setwide(np, cp, wide, 1); in ncr_int_sir()
6881 cp->nego_status = NS_WIDE; in ncr_int_sir()
6884 ncr_print_msg(cp, "wide msgout", np->msgin); in ncr_int_sir()
6903 PRINT_ADDR(cp->cmd, "MESSAGE_REJECT received (%x:%x).\n", in ncr_int_sir()
6915 ncr_print_msg(cp, "MESSAGE_REJECT sent for", np->msgin); in ncr_int_sir()
6934 PRINT_ADDR(cp->cmd, "IGNORE_WIDE_RESIDUE received, but not yet " in ncr_int_sir()
6947 PRINT_ADDR(cp->cmd, "DISCONNECT received, but datapointer " in ncr_int_sir()
6976 struct ccb *cp = NULL; in ncr_get_ccb() local
7000 cp = list_entry(qp, struct ccb, link_ccbq); in ncr_get_ccb()
7001 if (cp->magic) { in ncr_get_ccb()
7003 "(@%p)\n", cp); in ncr_get_ccb()
7004 cp = NULL; in ncr_get_ccb()
7015 if (cp) { in ncr_get_ccb()
7026 if (!cp) in ncr_get_ccb()
7027 cp = np->ccb; in ncr_get_ccb()
7033 while (cp->magic) { in ncr_get_ccb()
7035 if (tsleep ((caddr_t)cp, PRIBIO|PCATCH, "ncr", 0)) in ncr_get_ccb()
7040 if (cp->magic) in ncr_get_ccb()
7043 cp->magic = 1; in ncr_get_ccb()
7060 cp->tag = tag; in ncr_get_ccb()
7061 cp->target = tn; in ncr_get_ccb()
7062 cp->lun = ln; in ncr_get_ccb()
7065 PRINT_ADDR(cmd, "ccb @%p using tag %d.\n", cp, tag); in ncr_get_ccb()
7068 return cp; in ncr_get_ccb()
7080 static void ncr_free_ccb (struct ncb *np, struct ccb *cp) in ncr_free_ccb() argument
7082 struct tcb *tp = &np->target[cp->target]; in ncr_free_ccb()
7083 struct lcb *lp = tp->lp[cp->lun]; in ncr_free_ccb()
7086 PRINT_ADDR(cp->cmd, "ccb @%p freeing tag %d.\n", cp, cp->tag); in ncr_free_ccb()
7095 if (cp->tag != NO_TAG) { in ncr_free_ccb()
7096 lp->cb_tags[lp->if_tag++] = cp->tag; in ncr_free_ccb()
7099 lp->tags_umap &= ~(((tagmap_t) 1) << cp->tag); in ncr_free_ccb()
7101 lp->jump_ccb[cp->tag] = in ncr_free_ccb()
7114 if (cp != np->ccb) in ncr_free_ccb()
7115 list_move(&cp->link_ccbq, &lp->free_ccbq); in ncr_free_ccb()
7117 if (cp->queued) { in ncr_free_ccb()
7121 cp -> host_status = HS_IDLE; in ncr_free_ccb()
7122 cp -> magic = 0; in ncr_free_ccb()
7123 if (cp->queued) { in ncr_free_ccb()
7125 cp->queued = 0; in ncr_free_ccb()
7129 if (cp == np->ccb) in ncr_free_ccb()
7130 wakeup ((caddr_t) cp); in ncr_free_ccb()
7142 static void ncr_init_ccb(struct ncb *np, struct ccb *cp) in ncr_init_ccb() argument
7149 cp->p_ccb = vtobus(cp); in ncr_init_ccb()
7150 cp->phys.header.cp = cp; in ncr_init_ccb()
7155 INIT_LIST_HEAD(&cp->link_ccbq); in ncr_init_ccb()
7163 cp->start.setup_dsa[0] = cpu_to_scr(copy_4); in ncr_init_ccb()
7164 cp->start.setup_dsa[1] = cpu_to_scr(CCB_PHYS(cp, start.p_phys)); in ncr_init_ccb()
7165 cp->start.setup_dsa[2] = cpu_to_scr(ncr_reg_bus_addr(nc_dsa)); in ncr_init_ccb()
7166 cp->start.schedule.l_cmd = cpu_to_scr(SCR_JUMP); in ncr_init_ccb()
7167 cp->start.p_phys = cpu_to_scr(CCB_PHYS(cp, phys)); in ncr_init_ccb()
7169 memcpy(&cp->restart, &cp->start, sizeof(cp->restart)); in ncr_init_ccb()
7171 cp->start.schedule.l_paddr = cpu_to_scr(NCB_SCRIPT_PHYS (np, idle)); in ncr_init_ccb()
7172 cp->restart.schedule.l_paddr = cpu_to_scr(NCB_SCRIPTH_PHYS (np, abort)); in ncr_init_ccb()
7185 struct ccb *cp = NULL; in ncr_alloc_ccb() local
7190 cp = m_calloc_dma(sizeof(struct ccb), "CCB"); in ncr_alloc_ccb()
7191 if (!cp) in ncr_alloc_ccb()
7199 memset(cp, 0, sizeof (*cp)); in ncr_alloc_ccb()
7200 ncr_init_ccb(np, cp); in ncr_alloc_ccb()
7206 cp->link_ccb = np->ccb->link_ccb; in ncr_alloc_ccb()
7207 np->ccb->link_ccb = cp; in ncr_alloc_ccb()
7209 list_add(&cp->link_ccbq, &lp->free_ccbq); in ncr_alloc_ccb()
7473 static int ncr_scatter(struct ncb *np, struct ccb *cp, struct scsi_cmnd *cmd) in ncr_scatter() argument
7478 cp->data_len = 0; in ncr_scatter()
7490 data = &cp->phys.data[MAX_SCATTER - use_sg]; in ncr_scatter()
7497 cp->data_len += len; in ncr_scatter()