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);
658 struct scsi_ctrl_blk *scb;
662 if ((scb = host->first_avail) != NULL) {
664 printk("find scb at %p\n", scb);
666 if ((host->first_avail = scb->next) == NULL)
668 scb->next = NULL;
669 scb->status = SCB_RENT;
672 return scb;
765 static void initio_unlink_pend_scb(struct initio_host * host, struct scsi_ctrl_blk * scb)
770 printk("unlink pend SCB %p; ", scb);
775 if (scb == tmp) { /* Unlink this SCB */
835 static void initio_unlink_busy_scb(struct initio_host * host, struct scsi_ctrl_blk * scb)
840 printk("unlink busy SCB %p; ", scb);
845 if (scb == tmp) { /* Unlink this SCB */
1005 struct scsi_ctrl_blk *scb;
1009 if ((scb = host->active) != NULL) {
1010 initio_unlink_busy_scb(host, scb);
1011 scb->hastat = HOST_BAD_PHAS;
1012 scb->tastat = 0;
1013 initio_append_done_scb(host, scb);
1022 static void initio_exec_scb(struct initio_host * host, struct scsi_ctrl_blk * scb)
1026 scb->mode = 0;
1028 scb->sgidx = 0;
1029 scb->sgmax = scb->sglen;
1033 initio_append_pend_scb(host, scb); /* Append this SCB to Pending queue */
1073 struct scsi_ctrl_blk *scb;
1079 while ((scb = initio_find_done_scb(host)) != NULL) { /* find done entry */
1080 if (scb->tastat == INI_QUEUE_FULL) {
1081 host->max_tags[scb->target] =
1082 host->act_tags[scb->target] - 1;
1083 scb->tastat = 0;
1084 initio_append_pend_scb(host, scb);
1087 if (!(scb->mode & SCM_RSENS)) { /* not in auto req. sense mode */
1088 if (scb->tastat == 2) {
1092 if (scb->flags & SCF_SENSE) {
1094 len = scb->senselen;
1097 scb->buflen = scb->senselen;
1098 scb->bufptr = scb->senseptr;
1099 scb->flags &= ~(SCF_SG | SCF_DIR); /* for xfer_data_in */
1102 scb->mode = SCM_RSENS;
1103 scb->ident &= 0xBF; /* Disable Disconnect */
1104 scb->tagmsg = 0;
1105 scb->tastat = 0;
1106 scb->cdblen = 6;
1107 scb->cdb[0] = SCSICMD_RequestSense;
1108 scb->cdb[1] = 0;
1109 scb->cdb[2] = 0;
1110 scb->cdb[3] = 0;
1111 scb->cdb[4] = len;
1112 scb->cdb[5] = 0;
1113 initio_push_pend_scb(host, scb);
1119 if (scb->tastat == 2) { /* check contition status again after sending
1121 scb->hastat = HOST_BAD_PHAS;
1123 scb->tastat = 2;
1125 scb->flags |= SCF_DONE;
1126 if (scb->flags & SCF_POST) {
1128 (*scb->post) ((u8 *) host, (u8 *) scb);
1145 struct scsi_ctrl_blk *scb;
1171 if ((scb = host->active) != NULL)
1179 if ((scb = initio_find_first_pend_scb(host)) == NULL)
1183 outb((host->scsi_id << 4) | (scb->target & 0x0F),
1185 if (scb->opcode == ExecSCSI) {
1186 active_tc = &host->targets[scb->target];
1188 if (scb->tagmsg)
1195 initio_select_atn_stop(host, scb);
1198 initio_select_atn_stop(host, scb);
1200 if (scb->tagmsg)
1201 initio_select_atn3(host, scb);
1203 initio_select_atn(host, scb);
1206 if (scb->flags & SCF_POLL) {
1212 } else if (scb->opcode == BusDevRst) {
1213 initio_select_atn_stop(host, scb);
1214 scb->next_state = 8;
1215 if (scb->flags & SCF_POLL) {
1221 } else if (scb->opcode == AbortCmd) {
1222 if (initio_abort_srb(host, scb->srb) != 0) {
1223 initio_unlink_pend_scb(host, scb);
1224 initio_release_scb(host, scb);
1226 scb->opcode = BusDevRst;
1227 initio_select_atn_stop(host, scb);
1228 scb->next_state = 8;
1231 initio_unlink_pend_scb(host, scb);
1232 scb->hastat = 0x16; /* bad command */
1233 initio_append_done_scb(host, scb);
1296 struct scsi_ctrl_blk *scb = host->active;
1303 initio_unlink_pend_scb(host, scb);
1304 initio_append_busy_scb(host, scb);
1310 outb(scb->ident, host->addr + TUL_SFifo);
1312 if (scb->tagmsg) {
1313 outb(scb->tagmsg, host->addr + TUL_SFifo);
1314 outb(scb->tagid, host->addr + TUL_SFifo);
1351 struct scsi_ctrl_blk *scb = host->active;
1357 initio_unlink_pend_scb(host, scb);
1358 initio_append_busy_scb(host, scb);
1380 struct scsi_ctrl_blk *scb = host->active;
1390 for (i = 0; i < (int) scb->cdblen; i++)
1391 outb(scb->cdb[i], host->addr + TUL_SFifo);
1400 scb->next_state = 3;
1447 struct scsi_ctrl_blk *scb = host->active;
1452 if ((scb->flags & SCF_DIR) == SCF_NO_XF) {
1456 if (scb->buflen == 0)
1462 if ((scb->flags & SCF_DIR) != 0) /* if direction bit set then report data underrun */
1463 scb->hastat = HOST_DO_DU;
1469 scb->next_state = 0x4;
1476 scb->buflen = 0;
1477 scb->hastat = HOST_DO_DU;
1511 struct scsi_ctrl_blk *scb = host->active;
1524 scb->hastat = HOST_DO_DU;
1557 scb->buflen = 0;
1561 xcnt = (long) scb->buflen - cnt; /* xcnt== bytes already xferred */
1562 scb->buflen = (u32) cnt; /* cnt == bytes left to be xferred */
1563 if (scb->flags & SCF_SG) {
1567 sgp = &scb->sglist[scb->sgidx];
1568 for (i = scb->sgidx; i < scb->sgmax; sgp++, i++) {
1574 scb->bufptr += ((u32) (i - scb->sgidx) << 3);
1576 scb->sglen = (u8) (scb->sgmax - i);
1578 scb->sgidx = (u16) i;
1586 scb->bufptr += (u32) xcnt;
1600 struct scsi_ctrl_blk *scb = host->active;
1613 scb->next_state = 6;
1675 struct scsi_ctrl_blk *scb = host->active;
1677 if ((scb->flags & SCF_DIR) == SCF_DOUT)
1680 outl(scb->buflen, host->addr + TUL_SCnt0);
1683 if (scb->flags & SCF_SG) { /* S/G xfer */
1684 outl(((u32) scb->sglen) << 3, host->addr + TUL_XCntH);
1685 outl(scb->bufptr, host->addr + TUL_XAddH);
1688 outl(scb->buflen, host->addr + TUL_XCntH);
1689 outl(scb->bufptr, host->addr + TUL_XAddH);
1692 scb->next_state = 0x5;
1707 struct scsi_ctrl_blk *scb = host->active;
1709 if ((scb->flags & SCF_DIR) == SCF_DIN)
1712 outl(scb->buflen, host->addr + TUL_SCnt0);
1715 if (scb->flags & SCF_SG) { /* S/G xfer */
1716 outl(((u32) scb->sglen) << 3, host->addr + TUL_XCntH);
1717 outl(scb->bufptr, host->addr + TUL_XAddH);
1720 outl(scb->buflen, host->addr + TUL_XCntH);
1721 outl(scb->bufptr, host->addr + TUL_XAddH);
1725 scb->next_state = 0x5;
1731 struct scsi_ctrl_blk *scb = host->active;
1734 if ((scb->flags & SCF_DIR) != SCF_NO_DCHK)
1735 scb->hastat = HOST_DO_DU; /* over run */
1755 struct scsi_ctrl_blk *scb = host->active;
1758 if ((scb->flags & SCF_DIR) != SCF_NO_DCHK)
1759 scb->hastat = HOST_DO_DU; /* over run */
1780 struct scsi_ctrl_blk *scb = host->active;
1788 scb->tastat = inb(host->addr + TUL_SFifo);
1811 if ((scb->tastat & 0x18) == 0x10) /* No link support */
1819 if ((scb->tastat & 0x18) == 0x10)
1830 struct scsi_ctrl_blk *scb = host->active;
1832 if (scb != NULL) {
1833 if (scb->status & SCB_SELECT) { /* selection timeout */
1834 initio_unlink_pend_scb(host, scb);
1835 scb->hastat = HOST_SEL_TOUT;
1836 initio_append_done_scb(host, scb);
1838 initio_unlink_busy_scb(host, scb);
1839 scb->hastat = HOST_BUS_FREE;
1840 initio_append_done_scb(host, scb);
1864 struct scsi_ctrl_blk *scb;
1875 /* Abort all active & disconnected scb */
1876 while ((scb = initio_pop_busy_scb(host)) != NULL) {
1877 scb->hastat = HOST_BAD_PHAS;
1878 initio_append_done_scb(host, scb);
1900 struct scsi_ctrl_blk *scb;
1905 if ((scb = host->active) != NULL) {
1907 if (scb->status & SCB_SELECT) /* if waiting for selection complete */
1908 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 */
2815 struct scsi_ctrl_blk *scb, *tmp, *prev = NULL /* silence gcc */;
2857 if ((scb = kzalloc(i, GFP_DMA)) != NULL)
2861 if (!scb) {
2872 host->scb = scb;
2873 host->next_pending = scb;
2874 host->next_avail = scb;
2875 for (i = 0, tmp = scb; i < num_scb; i++, tmp++) {
2883 host->first_avail = scb;
2918 kfree(host->scb);