Lines Matching refs:scb

147 static void initio_select_atn(struct initio_host * host, struct scsi_ctrl_blk * scb);
148 static void initio_select_atn3(struct initio_host * host, struct scsi_ctrl_blk * scb);
149 static void initio_select_atn_stop(struct initio_host * host, struct scsi_ctrl_blk * scb);
657 struct scsi_ctrl_blk *scb;
661 if ((scb = host->first_avail) != NULL) {
663 printk("find scb at %p\n", scb);
665 if ((host->first_avail = scb->next) == NULL)
667 scb->next = NULL;
668 scb->status = SCB_RENT;
671 return scb;
764 static void initio_unlink_pend_scb(struct initio_host * host, struct scsi_ctrl_blk * scb)
769 printk("unlink pend SCB %p; ", scb);
774 if (scb == tmp) { /* Unlink this SCB */
834 static void initio_unlink_busy_scb(struct initio_host * host, struct scsi_ctrl_blk * scb)
839 printk("unlink busy SCB %p; ", scb);
844 if (scb == tmp) { /* Unlink this SCB */
1003 struct scsi_ctrl_blk *scb;
1007 if ((scb = host->active) != NULL) {
1008 initio_unlink_busy_scb(host, scb);
1009 scb->hastat = HOST_BAD_PHAS;
1010 scb->tastat = 0;
1011 initio_append_done_scb(host, scb);
1020 static void initio_exec_scb(struct initio_host * host, struct scsi_ctrl_blk * scb)
1024 scb->mode = 0;
1026 scb->sgidx = 0;
1027 scb->sgmax = scb->sglen;
1031 initio_append_pend_scb(host, scb); /* Append this SCB to Pending queue */
1071 struct scsi_ctrl_blk *scb;
1077 while ((scb = initio_find_done_scb(host)) != NULL) { /* find done entry */
1078 if (scb->tastat == INI_QUEUE_FULL) {
1079 host->max_tags[scb->target] =
1080 host->act_tags[scb->target] - 1;
1081 scb->tastat = 0;
1082 initio_append_pend_scb(host, scb);
1085 if (!(scb->mode & SCM_RSENS)) { /* not in auto req. sense mode */
1086 if (scb->tastat == 2) {
1090 if (scb->flags & SCF_SENSE) {
1092 len = scb->senselen;
1095 scb->buflen = scb->senselen;
1096 scb->bufptr = scb->senseptr;
1097 scb->flags &= ~(SCF_SG | SCF_DIR); /* for xfer_data_in */
1100 scb->mode = SCM_RSENS;
1101 scb->ident &= 0xBF; /* Disable Disconnect */
1102 scb->tagmsg = 0;
1103 scb->tastat = 0;
1104 scb->cdblen = 6;
1105 scb->cdb[0] = SCSICMD_RequestSense;
1106 scb->cdb[1] = 0;
1107 scb->cdb[2] = 0;
1108 scb->cdb[3] = 0;
1109 scb->cdb[4] = len;
1110 scb->cdb[5] = 0;
1111 initio_push_pend_scb(host, scb);
1117 if (scb->tastat == 2) { /* check contition status again after sending
1119 scb->hastat = HOST_BAD_PHAS;
1121 scb->tastat = 2;
1123 scb->flags |= SCF_DONE;
1124 if (scb->flags & SCF_POST) {
1126 (*scb->post) ((u8 *) host, (u8 *) scb);
1143 struct scsi_ctrl_blk *scb;
1177 if ((scb = initio_find_first_pend_scb(host)) == NULL)
1181 outb((host->scsi_id << 4) | (scb->target & 0x0F),
1183 if (scb->opcode == ExecSCSI) {
1184 active_tc = &host->targets[scb->target];
1186 if (scb->tagmsg)
1193 initio_select_atn_stop(host, scb);
1196 initio_select_atn_stop(host, scb);
1198 if (scb->tagmsg)
1199 initio_select_atn3(host, scb);
1201 initio_select_atn(host, scb);
1204 if (scb->flags & SCF_POLL) {
1210 } else if (scb->opcode == BusDevRst) {
1211 initio_select_atn_stop(host, scb);
1212 scb->next_state = 8;
1213 if (scb->flags & SCF_POLL) {
1219 } else if (scb->opcode == AbortCmd) {
1220 if (initio_abort_srb(host, scb->srb) != 0) {
1221 initio_unlink_pend_scb(host, scb);
1222 initio_release_scb(host, scb);
1224 scb->opcode = BusDevRst;
1225 initio_select_atn_stop(host, scb);
1226 scb->next_state = 8;
1229 initio_unlink_pend_scb(host, scb);
1230 scb->hastat = 0x16; /* bad command */
1231 initio_append_done_scb(host, scb);
1294 struct scsi_ctrl_blk *scb = host->active;
1301 initio_unlink_pend_scb(host, scb);
1302 initio_append_busy_scb(host, scb);
1308 outb(scb->ident, host->addr + TUL_SFifo);
1310 if (scb->tagmsg) {
1311 outb(scb->tagmsg, host->addr + TUL_SFifo);
1312 outb(scb->tagid, host->addr + TUL_SFifo);
1349 struct scsi_ctrl_blk *scb = host->active;
1355 initio_unlink_pend_scb(host, scb);
1356 initio_append_busy_scb(host, scb);
1378 struct scsi_ctrl_blk *scb = host->active;
1388 for (i = 0; i < (int) scb->cdblen; i++)
1389 outb(scb->cdb[i], host->addr + TUL_SFifo);
1398 scb->next_state = 3;
1445 struct scsi_ctrl_blk *scb = host->active;
1450 if ((scb->flags & SCF_DIR) == SCF_NO_XF) {
1454 if (scb->buflen == 0)
1460 if ((scb->flags & SCF_DIR) != 0) /* if direction bit set then report data underrun */
1461 scb->hastat = HOST_DO_DU;
1467 scb->next_state = 0x4;
1474 scb->buflen = 0;
1475 scb->hastat = HOST_DO_DU;
1509 struct scsi_ctrl_blk *scb = host->active;
1522 scb->hastat = HOST_DO_DU;
1555 scb->buflen = 0;
1559 xcnt = (long) scb->buflen - cnt; /* xcnt== bytes already xferred */
1560 scb->buflen = (u32) cnt; /* cnt == bytes left to be xferred */
1561 if (scb->flags & SCF_SG) {
1565 sgp = &scb->sglist[scb->sgidx];
1566 for (i = scb->sgidx; i < scb->sgmax; sgp++, i++) {
1572 scb->bufptr += ((u32) (i - scb->sgidx) << 3);
1574 scb->sglen = (u8) (scb->sgmax - i);
1576 scb->sgidx = (u16) i;
1584 scb->bufptr += (u32) xcnt;
1598 struct scsi_ctrl_blk *scb = host->active;
1611 scb->next_state = 6;
1673 struct scsi_ctrl_blk *scb = host->active;
1675 if ((scb->flags & SCF_DIR) == SCF_DOUT)
1678 outl(scb->buflen, host->addr + TUL_SCnt0);
1681 if (scb->flags & SCF_SG) { /* S/G xfer */
1682 outl(((u32) scb->sglen) << 3, host->addr + TUL_XCntH);
1683 outl(scb->bufptr, host->addr + TUL_XAddH);
1686 outl(scb->buflen, host->addr + TUL_XCntH);
1687 outl(scb->bufptr, host->addr + TUL_XAddH);
1690 scb->next_state = 0x5;
1705 struct scsi_ctrl_blk *scb = host->active;
1707 if ((scb->flags & SCF_DIR) == SCF_DIN)
1710 outl(scb->buflen, host->addr + TUL_SCnt0);
1713 if (scb->flags & SCF_SG) { /* S/G xfer */
1714 outl(((u32) scb->sglen) << 3, host->addr + TUL_XCntH);
1715 outl(scb->bufptr, host->addr + TUL_XAddH);
1718 outl(scb->buflen, host->addr + TUL_XCntH);
1719 outl(scb->bufptr, host->addr + TUL_XAddH);
1723 scb->next_state = 0x5;
1729 struct scsi_ctrl_blk *scb = host->active;
1732 if ((scb->flags & SCF_DIR) != SCF_NO_DCHK)
1733 scb->hastat = HOST_DO_DU; /* over run */
1753 struct scsi_ctrl_blk *scb = host->active;
1756 if ((scb->flags & SCF_DIR) != SCF_NO_DCHK)
1757 scb->hastat = HOST_DO_DU; /* over run */
1778 struct scsi_ctrl_blk *scb = host->active;
1786 scb->tastat = inb(host->addr + TUL_SFifo);
1809 if ((scb->tastat & 0x18) == 0x10) /* No link support */
1818 if ((scb->tastat & 0x18) == 0x10)
1829 struct scsi_ctrl_blk *scb = host->active;
1831 if (scb != NULL) {
1832 if (scb->status & SCB_SELECT) { /* selection timeout */
1833 initio_unlink_pend_scb(host, scb);
1834 scb->hastat = HOST_SEL_TOUT;
1835 initio_append_done_scb(host, scb);
1837 initio_unlink_busy_scb(host, scb);
1838 scb->hastat = HOST_BUS_FREE;
1839 initio_append_done_scb(host, scb);
1863 struct scsi_ctrl_blk *scb;
1874 /* Abort all active & disconnected scb */
1875 while ((scb = initio_pop_busy_scb(host)) != NULL) {
1876 scb->hastat = HOST_BAD_PHAS;
1877 initio_append_done_scb(host, scb);
1899 struct scsi_ctrl_blk *scb;
1904 if ((scb = host->active) != NULL) {
1906 if (scb->status & SCB_SELECT) /* if waiting for selection complete */
1907 scb->status &= ~SCB_SELECT;
1947 scb = host->scb + tag;
1948 if (scb->target != tar || scb->lun != lun) {
1951 if (scb->status != SCB_BUSY) { /* 03/24/95 */
1954 host->active = scb;
1959 if ((scb = initio_find_busy_scb(host, tar | (lun << 8))) == NULL) {
1962 host->active = scb;
1981 struct scsi_ctrl_blk *scb;
1986 while ((scb = initio_pop_busy_scb(host)) != NULL) {
1987 scb->hastat = HOST_BAD_PHAS;
1988 initio_append_done_scb(host, scb);
2279 struct scsi_ctrl_blk *scb;
2287 while ((scb = initio_pop_busy_scb(host)) != NULL) {
2288 scb->hastat = HOST_BAD_PHAS;
2289 initio_append_done_scb(host, scb);
2305 static void initio_select_atn_stop(struct initio_host * host, struct scsi_ctrl_blk * scb)
2307 scb->status |= SCB_SELECT;
2308 scb->next_state = 0x1;
2309 host->active = scb;
2310 host->active_tc = &host->targets[scb->target];
2315 static void initio_select_atn(struct initio_host * host, struct scsi_ctrl_blk * scb)
2319 scb->status |= SCB_SELECT;
2320 scb->next_state = 0x2;
2322 outb(scb->ident, host->addr + TUL_SFifo);
2323 for (i = 0; i < (int) scb->cdblen; i++)
2324 outb(scb->cdb[i], host->addr + TUL_SFifo);
2325 host->active_tc = &host->targets[scb->target];
2326 host->active = scb;
2330 static void initio_select_atn3(struct initio_host * host, struct scsi_ctrl_blk * scb)
2334 scb->status |= SCB_SELECT;
2335 scb->next_state = 0x2;
2337 outb(scb->ident, host->addr + TUL_SFifo);
2338 outb(scb->tagmsg, host->addr + TUL_SFifo);
2339 outb(scb->tagid, host->addr + TUL_SFifo);
2340 for (i = 0; i < scb->cdblen; i++)
2341 outb(scb->cdb[i], host->addr + TUL_SFifo);
2342 host->active_tc = &host->targets[scb->target];
2343 host->active = scb;
2356 struct scsi_ctrl_blk *scb = host->active;
2364 initio_unlink_pend_scb(host, scb);
2365 initio_release_scb(host, scb);
2368 tar = scb->target; /* target */
2810 struct scsi_ctrl_blk *scb, *tmp, *prev = NULL /* silence gcc */;
2852 scb = kzalloc(i, GFP_KERNEL);
2853 if (scb)
2857 if (!scb) {
2868 host->scb = scb;
2869 host->next_pending = scb;
2870 host->next_avail = scb;
2871 for (i = 0, tmp = scb; i < num_scb; i++, tmp++) {
2879 host->first_avail = scb;
2914 kfree(host->scb);