Lines Matching refs:scb

177 static void initio_select_atn(struct initio_host * host, struct scsi_ctrl_blk * scb);
178 static void initio_select_atn3(struct initio_host * host, struct scsi_ctrl_blk * scb);
179 static void initio_select_atn_stop(struct initio_host * host, struct scsi_ctrl_blk * scb);
688 struct scsi_ctrl_blk *scb; in initio_alloc_scb() local
692 if ((scb = host->first_avail) != NULL) { in initio_alloc_scb()
694 printk("find scb at %p\n", scb); in initio_alloc_scb()
696 if ((host->first_avail = scb->next) == NULL) in initio_alloc_scb()
698 scb->next = NULL; in initio_alloc_scb()
699 scb->status = SCB_RENT; in initio_alloc_scb()
702 return scb; in initio_alloc_scb()
795 static void initio_unlink_pend_scb(struct initio_host * host, struct scsi_ctrl_blk * scb) in initio_unlink_pend_scb() argument
800 printk("unlink pend SCB %p; ", scb); in initio_unlink_pend_scb()
805 if (scb == tmp) { /* Unlink this SCB */ in initio_unlink_pend_scb()
865 static void initio_unlink_busy_scb(struct initio_host * host, struct scsi_ctrl_blk * scb) in initio_unlink_busy_scb() argument
870 printk("unlink busy SCB %p; ", scb); in initio_unlink_busy_scb()
875 if (scb == tmp) { /* Unlink this SCB */ in initio_unlink_busy_scb()
1035 struct scsi_ctrl_blk *scb; in initio_bad_seq() local
1039 if ((scb = host->active) != NULL) { in initio_bad_seq()
1040 initio_unlink_busy_scb(host, scb); in initio_bad_seq()
1041 scb->hastat = HOST_BAD_PHAS; in initio_bad_seq()
1042 scb->tastat = 0; in initio_bad_seq()
1043 initio_append_done_scb(host, scb); in initio_bad_seq()
1052 static void initio_exec_scb(struct initio_host * host, struct scsi_ctrl_blk * scb) in initio_exec_scb() argument
1056 scb->mode = 0; in initio_exec_scb()
1058 scb->sgidx = 0; in initio_exec_scb()
1059 scb->sgmax = scb->sglen; in initio_exec_scb()
1063 initio_append_pend_scb(host, scb); /* Append this SCB to Pending queue */ in initio_exec_scb()
1103 struct scsi_ctrl_blk *scb; in tulip_main() local
1109 while ((scb = initio_find_done_scb(host)) != NULL) { /* find done entry */ in tulip_main()
1110 if (scb->tastat == INI_QUEUE_FULL) { in tulip_main()
1111 host->max_tags[scb->target] = in tulip_main()
1112 host->act_tags[scb->target] - 1; in tulip_main()
1113 scb->tastat = 0; in tulip_main()
1114 initio_append_pend_scb(host, scb); in tulip_main()
1117 if (!(scb->mode & SCM_RSENS)) { /* not in auto req. sense mode */ in tulip_main()
1118 if (scb->tastat == 2) { in tulip_main()
1122 if (scb->flags & SCF_SENSE) { in tulip_main()
1124 len = scb->senselen; in tulip_main()
1127 scb->buflen = scb->senselen; in tulip_main()
1128 scb->bufptr = scb->senseptr; in tulip_main()
1129 scb->flags &= ~(SCF_SG | SCF_DIR); /* for xfer_data_in */ in tulip_main()
1132 scb->mode = SCM_RSENS; in tulip_main()
1133 scb->ident &= 0xBF; /* Disable Disconnect */ in tulip_main()
1134 scb->tagmsg = 0; in tulip_main()
1135 scb->tastat = 0; in tulip_main()
1136 scb->cdblen = 6; in tulip_main()
1137 scb->cdb[0] = SCSICMD_RequestSense; in tulip_main()
1138 scb->cdb[1] = 0; in tulip_main()
1139 scb->cdb[2] = 0; in tulip_main()
1140 scb->cdb[3] = 0; in tulip_main()
1141 scb->cdb[4] = len; in tulip_main()
1142 scb->cdb[5] = 0; in tulip_main()
1143 initio_push_pend_scb(host, scb); in tulip_main()
1149 if (scb->tastat == 2) { /* check contition status again after sending in tulip_main()
1151 scb->hastat = HOST_BAD_PHAS; in tulip_main()
1153 scb->tastat = 2; in tulip_main()
1155 scb->flags |= SCF_DONE; in tulip_main()
1156 if (scb->flags & SCF_POST) { in tulip_main()
1158 (*scb->post) ((u8 *) host, (u8 *) scb); in tulip_main()
1175 struct scsi_ctrl_blk *scb; in tulip_scsi() local
1201 if ((scb = host->active) != NULL) in tulip_scsi()
1209 if ((scb = initio_find_first_pend_scb(host)) == NULL) in tulip_scsi()
1213 outb((host->scsi_id << 4) | (scb->target & 0x0F), in tulip_scsi()
1215 if (scb->opcode == ExecSCSI) { in tulip_scsi()
1216 active_tc = &host->targets[scb->target]; in tulip_scsi()
1218 if (scb->tagmsg) in tulip_scsi()
1225 initio_select_atn_stop(host, scb); in tulip_scsi()
1228 initio_select_atn_stop(host, scb); in tulip_scsi()
1230 if (scb->tagmsg) in tulip_scsi()
1231 initio_select_atn3(host, scb); in tulip_scsi()
1233 initio_select_atn(host, scb); in tulip_scsi()
1236 if (scb->flags & SCF_POLL) { in tulip_scsi()
1242 } else if (scb->opcode == BusDevRst) { in tulip_scsi()
1243 initio_select_atn_stop(host, scb); in tulip_scsi()
1244 scb->next_state = 8; in tulip_scsi()
1245 if (scb->flags & SCF_POLL) { in tulip_scsi()
1251 } else if (scb->opcode == AbortCmd) { in tulip_scsi()
1252 if (initio_abort_srb(host, scb->srb) != 0) { in tulip_scsi()
1253 initio_unlink_pend_scb(host, scb); in tulip_scsi()
1254 initio_release_scb(host, scb); in tulip_scsi()
1256 scb->opcode = BusDevRst; in tulip_scsi()
1257 initio_select_atn_stop(host, scb); in tulip_scsi()
1258 scb->next_state = 8; in tulip_scsi()
1261 initio_unlink_pend_scb(host, scb); in tulip_scsi()
1262 scb->hastat = 0x16; /* bad command */ in tulip_scsi()
1263 initio_append_done_scb(host, scb); in tulip_scsi()
1326 struct scsi_ctrl_blk *scb = host->active; in initio_state_1() local
1333 initio_unlink_pend_scb(host, scb); in initio_state_1()
1334 initio_append_busy_scb(host, scb); in initio_state_1()
1340 outb(scb->ident, host->addr + TUL_SFifo); in initio_state_1()
1342 if (scb->tagmsg) { in initio_state_1()
1343 outb(scb->tagmsg, host->addr + TUL_SFifo); in initio_state_1()
1344 outb(scb->tagid, host->addr + TUL_SFifo); in initio_state_1()
1381 struct scsi_ctrl_blk *scb = host->active; in initio_state_2() local
1387 initio_unlink_pend_scb(host, scb); in initio_state_2()
1388 initio_append_busy_scb(host, scb); in initio_state_2()
1410 struct scsi_ctrl_blk *scb = host->active; in initio_state_3() local
1420 for (i = 0; i < (int) scb->cdblen; i++) in initio_state_3()
1421 outb(scb->cdb[i], host->addr + TUL_SFifo); in initio_state_3()
1430 scb->next_state = 3; in initio_state_3()
1477 struct scsi_ctrl_blk *scb = host->active; in initio_state_4() local
1482 if ((scb->flags & SCF_DIR) == SCF_NO_XF) { in initio_state_4()
1486 if (scb->buflen == 0) in initio_state_4()
1492 if ((scb->flags & SCF_DIR) != 0) /* if direction bit set then report data underrun */ in initio_state_4()
1493 scb->hastat = HOST_DO_DU; in initio_state_4()
1499 scb->next_state = 0x4; in initio_state_4()
1506 scb->buflen = 0; in initio_state_4()
1507 scb->hastat = HOST_DO_DU; in initio_state_4()
1541 struct scsi_ctrl_blk *scb = host->active; in initio_state_5() local
1554 scb->hastat = HOST_DO_DU; in initio_state_5()
1587 scb->buflen = 0; in initio_state_5()
1591 xcnt = (long) scb->buflen - cnt; /* xcnt== bytes already xferred */ in initio_state_5()
1592 scb->buflen = (u32) cnt; /* cnt == bytes left to be xferred */ in initio_state_5()
1593 if (scb->flags & SCF_SG) { in initio_state_5()
1597 sgp = &scb->sglist[scb->sgidx]; in initio_state_5()
1598 for (i = scb->sgidx; i < scb->sgmax; sgp++, i++) { in initio_state_5()
1604 scb->bufptr += ((u32) (i - scb->sgidx) << 3); in initio_state_5()
1606 scb->sglen = (u8) (scb->sgmax - i); in initio_state_5()
1608 scb->sgidx = (u16) i; in initio_state_5()
1616 scb->bufptr += (u32) xcnt; in initio_state_5()
1630 struct scsi_ctrl_blk *scb = host->active; in initio_state_6() local
1643 scb->next_state = 6; in initio_state_6()
1705 struct scsi_ctrl_blk *scb = host->active; in initio_xfer_data_in() local
1707 if ((scb->flags & SCF_DIR) == SCF_DOUT) in initio_xfer_data_in()
1710 outl(scb->buflen, host->addr + TUL_SCnt0); in initio_xfer_data_in()
1713 if (scb->flags & SCF_SG) { /* S/G xfer */ in initio_xfer_data_in()
1714 outl(((u32) scb->sglen) << 3, host->addr + TUL_XCntH); in initio_xfer_data_in()
1715 outl(scb->bufptr, host->addr + TUL_XAddH); in initio_xfer_data_in()
1718 outl(scb->buflen, host->addr + TUL_XCntH); in initio_xfer_data_in()
1719 outl(scb->bufptr, host->addr + TUL_XAddH); in initio_xfer_data_in()
1722 scb->next_state = 0x5; in initio_xfer_data_in()
1737 struct scsi_ctrl_blk *scb = host->active; in initio_xfer_data_out() local
1739 if ((scb->flags & SCF_DIR) == SCF_DIN) in initio_xfer_data_out()
1742 outl(scb->buflen, host->addr + TUL_SCnt0); in initio_xfer_data_out()
1745 if (scb->flags & SCF_SG) { /* S/G xfer */ in initio_xfer_data_out()
1746 outl(((u32) scb->sglen) << 3, host->addr + TUL_XCntH); in initio_xfer_data_out()
1747 outl(scb->bufptr, host->addr + TUL_XAddH); in initio_xfer_data_out()
1750 outl(scb->buflen, host->addr + TUL_XCntH); in initio_xfer_data_out()
1751 outl(scb->bufptr, host->addr + TUL_XAddH); in initio_xfer_data_out()
1755 scb->next_state = 0x5; in initio_xfer_data_out()
1761 struct scsi_ctrl_blk *scb = host->active; in initio_xpad_in() local
1764 if ((scb->flags & SCF_DIR) != SCF_NO_DCHK) in initio_xpad_in()
1765 scb->hastat = HOST_DO_DU; /* over run */ in initio_xpad_in()
1785 struct scsi_ctrl_blk *scb = host->active; in initio_xpad_out() local
1788 if ((scb->flags & SCF_DIR) != SCF_NO_DCHK) in initio_xpad_out()
1789 scb->hastat = HOST_DO_DU; /* over run */ in initio_xpad_out()
1810 struct scsi_ctrl_blk *scb = host->active; in initio_status_msg() local
1818 scb->tastat = inb(host->addr + TUL_SFifo); in initio_status_msg()
1841 if ((scb->tastat & 0x18) == 0x10) /* No link support */ in initio_status_msg()
1849 if ((scb->tastat & 0x18) == 0x10) in initio_status_msg()
1860 struct scsi_ctrl_blk *scb = host->active; in int_initio_busfree() local
1862 if (scb != NULL) { in int_initio_busfree()
1863 if (scb->status & SCB_SELECT) { /* selection timeout */ in int_initio_busfree()
1864 initio_unlink_pend_scb(host, scb); in int_initio_busfree()
1865 scb->hastat = HOST_SEL_TOUT; in int_initio_busfree()
1866 initio_append_done_scb(host, scb); in int_initio_busfree()
1868 initio_unlink_busy_scb(host, scb); in int_initio_busfree()
1869 scb->hastat = HOST_BUS_FREE; in int_initio_busfree()
1870 initio_append_done_scb(host, scb); in int_initio_busfree()
1894 struct scsi_ctrl_blk *scb; in int_initio_scsi_rst() local
1906 while ((scb = initio_pop_busy_scb(host)) != NULL) { in int_initio_scsi_rst()
1907 scb->hastat = HOST_BAD_PHAS; in int_initio_scsi_rst()
1908 initio_append_done_scb(host, scb); in int_initio_scsi_rst()
1930 struct scsi_ctrl_blk *scb; in int_initio_resel() local
1935 if ((scb = host->active) != NULL) { in int_initio_resel()
1937 if (scb->status & SCB_SELECT) /* if waiting for selection complete */ in int_initio_resel()
1938 scb->status &= ~SCB_SELECT; in int_initio_resel()
1977 scb = host->scb + tag; in int_initio_resel()
1978 if (scb->target != tar || scb->lun != lun) { in int_initio_resel()
1981 if (scb->status != SCB_BUSY) { /* 03/24/95 */ in int_initio_resel()
1984 host->active = scb; in int_initio_resel()
1989 if ((scb = initio_find_busy_scb(host, tar | (lun << 8))) == NULL) { in int_initio_resel()
1992 host->active = scb; in int_initio_resel()
2011 struct scsi_ctrl_blk *scb; in int_initio_bad_seq() local
2016 while ((scb = initio_pop_busy_scb(host)) != NULL) { in int_initio_bad_seq()
2017 scb->hastat = HOST_BAD_PHAS; in int_initio_bad_seq()
2018 initio_append_done_scb(host, scb); in int_initio_bad_seq()
2309 struct scsi_ctrl_blk *scb; in initio_post_scsi_rst() local
2317 while ((scb = initio_pop_busy_scb(host)) != NULL) { in initio_post_scsi_rst()
2318 scb->hastat = HOST_BAD_PHAS; in initio_post_scsi_rst()
2319 initio_append_done_scb(host, scb); in initio_post_scsi_rst()
2335 static void initio_select_atn_stop(struct initio_host * host, struct scsi_ctrl_blk * scb) in initio_select_atn_stop() argument
2337 scb->status |= SCB_SELECT; in initio_select_atn_stop()
2338 scb->next_state = 0x1; in initio_select_atn_stop()
2339 host->active = scb; in initio_select_atn_stop()
2340 host->active_tc = &host->targets[scb->target]; in initio_select_atn_stop()
2345 static void initio_select_atn(struct initio_host * host, struct scsi_ctrl_blk * scb) in initio_select_atn() argument
2349 scb->status |= SCB_SELECT; in initio_select_atn()
2350 scb->next_state = 0x2; in initio_select_atn()
2352 outb(scb->ident, host->addr + TUL_SFifo); in initio_select_atn()
2353 for (i = 0; i < (int) scb->cdblen; i++) in initio_select_atn()
2354 outb(scb->cdb[i], host->addr + TUL_SFifo); in initio_select_atn()
2355 host->active_tc = &host->targets[scb->target]; in initio_select_atn()
2356 host->active = scb; in initio_select_atn()
2360 static void initio_select_atn3(struct initio_host * host, struct scsi_ctrl_blk * scb) in initio_select_atn3() argument
2364 scb->status |= SCB_SELECT; in initio_select_atn3()
2365 scb->next_state = 0x2; in initio_select_atn3()
2367 outb(scb->ident, host->addr + TUL_SFifo); in initio_select_atn3()
2368 outb(scb->tagmsg, host->addr + TUL_SFifo); in initio_select_atn3()
2369 outb(scb->tagid, host->addr + TUL_SFifo); in initio_select_atn3()
2370 for (i = 0; i < scb->cdblen; i++) in initio_select_atn3()
2371 outb(scb->cdb[i], host->addr + TUL_SFifo); in initio_select_atn3()
2372 host->active_tc = &host->targets[scb->target]; in initio_select_atn3()
2373 host->active = scb; in initio_select_atn3()
2386 struct scsi_ctrl_blk *scb = host->active; in initio_bus_device_reset() local
2394 initio_unlink_pend_scb(host, scb); in initio_bus_device_reset()
2395 initio_release_scb(host, scb); in initio_bus_device_reset()
2398 tar = scb->target; /* target */ in initio_bus_device_reset()
2847 struct scsi_ctrl_blk *scb, *tmp, *prev = NULL /* silence gcc */; in initio_probe_one() local
2889 if ((scb = kzalloc(i, GFP_DMA)) != NULL) in initio_probe_one()
2893 if (!scb) { in initio_probe_one()
2904 host->scb = scb; in initio_probe_one()
2905 host->next_pending = scb; in initio_probe_one()
2906 host->next_avail = scb; in initio_probe_one()
2907 for (i = 0, tmp = scb; i < num_scb; i++, tmp++) { in initio_probe_one()
2915 host->first_avail = scb; in initio_probe_one()
2950 kfree(host->scb); in initio_probe_one()