Lines Matching refs:scb
161 static void initio_select_atn(struct initio_host * host, struct scsi_ctrl_blk * scb);
162 static void initio_select_atn3(struct initio_host * host, struct scsi_ctrl_blk * scb);
163 static void initio_select_atn_stop(struct initio_host * host, struct scsi_ctrl_blk * scb);
672 struct scsi_ctrl_blk *scb; in initio_alloc_scb() local
676 if ((scb = host->first_avail) != NULL) { in initio_alloc_scb()
678 printk("find scb at %p\n", scb); in initio_alloc_scb()
680 if ((host->first_avail = scb->next) == NULL) in initio_alloc_scb()
682 scb->next = NULL; in initio_alloc_scb()
683 scb->status = SCB_RENT; in initio_alloc_scb()
686 return scb; in initio_alloc_scb()
779 static void initio_unlink_pend_scb(struct initio_host * host, struct scsi_ctrl_blk * scb) in initio_unlink_pend_scb() argument
784 printk("unlink pend SCB %p; ", scb); in initio_unlink_pend_scb()
789 if (scb == tmp) { /* Unlink this SCB */ in initio_unlink_pend_scb()
849 static void initio_unlink_busy_scb(struct initio_host * host, struct scsi_ctrl_blk * scb) in initio_unlink_busy_scb() argument
854 printk("unlink busy SCB %p; ", scb); in initio_unlink_busy_scb()
859 if (scb == tmp) { /* Unlink this SCB */ in initio_unlink_busy_scb()
1019 struct scsi_ctrl_blk *scb; in initio_bad_seq() local
1023 if ((scb = host->active) != NULL) { in initio_bad_seq()
1024 initio_unlink_busy_scb(host, scb); in initio_bad_seq()
1025 scb->hastat = HOST_BAD_PHAS; in initio_bad_seq()
1026 scb->tastat = 0; in initio_bad_seq()
1027 initio_append_done_scb(host, scb); in initio_bad_seq()
1036 static void initio_exec_scb(struct initio_host * host, struct scsi_ctrl_blk * scb) in initio_exec_scb() argument
1040 scb->mode = 0; in initio_exec_scb()
1042 scb->sgidx = 0; in initio_exec_scb()
1043 scb->sgmax = scb->sglen; in initio_exec_scb()
1047 initio_append_pend_scb(host, scb); /* Append this SCB to Pending queue */ in initio_exec_scb()
1087 struct scsi_ctrl_blk *scb; in tulip_main() local
1093 while ((scb = initio_find_done_scb(host)) != NULL) { /* find done entry */ in tulip_main()
1094 if (scb->tastat == INI_QUEUE_FULL) { in tulip_main()
1095 host->max_tags[scb->target] = in tulip_main()
1096 host->act_tags[scb->target] - 1; in tulip_main()
1097 scb->tastat = 0; in tulip_main()
1098 initio_append_pend_scb(host, scb); in tulip_main()
1101 if (!(scb->mode & SCM_RSENS)) { /* not in auto req. sense mode */ in tulip_main()
1102 if (scb->tastat == 2) { in tulip_main()
1106 if (scb->flags & SCF_SENSE) { in tulip_main()
1108 len = scb->senselen; in tulip_main()
1111 scb->buflen = scb->senselen; in tulip_main()
1112 scb->bufptr = scb->senseptr; in tulip_main()
1113 scb->flags &= ~(SCF_SG | SCF_DIR); /* for xfer_data_in */ in tulip_main()
1116 scb->mode = SCM_RSENS; in tulip_main()
1117 scb->ident &= 0xBF; /* Disable Disconnect */ in tulip_main()
1118 scb->tagmsg = 0; in tulip_main()
1119 scb->tastat = 0; in tulip_main()
1120 scb->cdblen = 6; in tulip_main()
1121 scb->cdb[0] = SCSICMD_RequestSense; in tulip_main()
1122 scb->cdb[1] = 0; in tulip_main()
1123 scb->cdb[2] = 0; in tulip_main()
1124 scb->cdb[3] = 0; in tulip_main()
1125 scb->cdb[4] = len; in tulip_main()
1126 scb->cdb[5] = 0; in tulip_main()
1127 initio_push_pend_scb(host, scb); in tulip_main()
1133 if (scb->tastat == 2) { /* check contition status again after sending in tulip_main()
1135 scb->hastat = HOST_BAD_PHAS; in tulip_main()
1137 scb->tastat = 2; in tulip_main()
1139 scb->flags |= SCF_DONE; in tulip_main()
1140 if (scb->flags & SCF_POST) { in tulip_main()
1142 (*scb->post) ((u8 *) host, (u8 *) scb); in tulip_main()
1159 struct scsi_ctrl_blk *scb; in tulip_scsi() local
1185 if ((scb = host->active) != NULL) in tulip_scsi()
1193 if ((scb = initio_find_first_pend_scb(host)) == NULL) in tulip_scsi()
1197 outb((host->scsi_id << 4) | (scb->target & 0x0F), in tulip_scsi()
1199 if (scb->opcode == ExecSCSI) { in tulip_scsi()
1200 active_tc = &host->targets[scb->target]; in tulip_scsi()
1202 if (scb->tagmsg) in tulip_scsi()
1209 initio_select_atn_stop(host, scb); in tulip_scsi()
1212 initio_select_atn_stop(host, scb); in tulip_scsi()
1214 if (scb->tagmsg) in tulip_scsi()
1215 initio_select_atn3(host, scb); in tulip_scsi()
1217 initio_select_atn(host, scb); in tulip_scsi()
1220 if (scb->flags & SCF_POLL) { in tulip_scsi()
1226 } else if (scb->opcode == BusDevRst) { in tulip_scsi()
1227 initio_select_atn_stop(host, scb); in tulip_scsi()
1228 scb->next_state = 8; in tulip_scsi()
1229 if (scb->flags & SCF_POLL) { in tulip_scsi()
1235 } else if (scb->opcode == AbortCmd) { in tulip_scsi()
1236 if (initio_abort_srb(host, scb->srb) != 0) { in tulip_scsi()
1237 initio_unlink_pend_scb(host, scb); in tulip_scsi()
1238 initio_release_scb(host, scb); in tulip_scsi()
1240 scb->opcode = BusDevRst; in tulip_scsi()
1241 initio_select_atn_stop(host, scb); in tulip_scsi()
1242 scb->next_state = 8; in tulip_scsi()
1245 initio_unlink_pend_scb(host, scb); in tulip_scsi()
1246 scb->hastat = 0x16; /* bad command */ in tulip_scsi()
1247 initio_append_done_scb(host, scb); in tulip_scsi()
1310 struct scsi_ctrl_blk *scb = host->active; in initio_state_1() local
1317 initio_unlink_pend_scb(host, scb); in initio_state_1()
1318 initio_append_busy_scb(host, scb); in initio_state_1()
1324 outb(scb->ident, host->addr + TUL_SFifo); in initio_state_1()
1326 if (scb->tagmsg) { in initio_state_1()
1327 outb(scb->tagmsg, host->addr + TUL_SFifo); in initio_state_1()
1328 outb(scb->tagid, host->addr + TUL_SFifo); in initio_state_1()
1365 struct scsi_ctrl_blk *scb = host->active; in initio_state_2() local
1371 initio_unlink_pend_scb(host, scb); in initio_state_2()
1372 initio_append_busy_scb(host, scb); in initio_state_2()
1394 struct scsi_ctrl_blk *scb = host->active; in initio_state_3() local
1404 for (i = 0; i < (int) scb->cdblen; i++) in initio_state_3()
1405 outb(scb->cdb[i], host->addr + TUL_SFifo); in initio_state_3()
1414 scb->next_state = 3; in initio_state_3()
1461 struct scsi_ctrl_blk *scb = host->active; in initio_state_4() local
1466 if ((scb->flags & SCF_DIR) == SCF_NO_XF) { in initio_state_4()
1470 if (scb->buflen == 0) in initio_state_4()
1476 if ((scb->flags & SCF_DIR) != 0) /* if direction bit set then report data underrun */ in initio_state_4()
1477 scb->hastat = HOST_DO_DU; in initio_state_4()
1483 scb->next_state = 0x4; in initio_state_4()
1490 scb->buflen = 0; in initio_state_4()
1491 scb->hastat = HOST_DO_DU; in initio_state_4()
1525 struct scsi_ctrl_blk *scb = host->active; in initio_state_5() local
1538 scb->hastat = HOST_DO_DU; in initio_state_5()
1571 scb->buflen = 0; in initio_state_5()
1575 xcnt = (long) scb->buflen - cnt; /* xcnt== bytes already xferred */ in initio_state_5()
1576 scb->buflen = (u32) cnt; /* cnt == bytes left to be xferred */ in initio_state_5()
1577 if (scb->flags & SCF_SG) { in initio_state_5()
1581 sgp = &scb->sglist[scb->sgidx]; in initio_state_5()
1582 for (i = scb->sgidx; i < scb->sgmax; sgp++, i++) { in initio_state_5()
1588 scb->bufptr += ((u32) (i - scb->sgidx) << 3); in initio_state_5()
1590 scb->sglen = (u8) (scb->sgmax - i); in initio_state_5()
1592 scb->sgidx = (u16) i; in initio_state_5()
1600 scb->bufptr += (u32) xcnt; in initio_state_5()
1614 struct scsi_ctrl_blk *scb = host->active; in initio_state_6() local
1627 scb->next_state = 6; in initio_state_6()
1689 struct scsi_ctrl_blk *scb = host->active; in initio_xfer_data_in() local
1691 if ((scb->flags & SCF_DIR) == SCF_DOUT) in initio_xfer_data_in()
1694 outl(scb->buflen, host->addr + TUL_SCnt0); in initio_xfer_data_in()
1697 if (scb->flags & SCF_SG) { /* S/G xfer */ in initio_xfer_data_in()
1698 outl(((u32) scb->sglen) << 3, host->addr + TUL_XCntH); in initio_xfer_data_in()
1699 outl(scb->bufptr, host->addr + TUL_XAddH); in initio_xfer_data_in()
1702 outl(scb->buflen, host->addr + TUL_XCntH); in initio_xfer_data_in()
1703 outl(scb->bufptr, host->addr + TUL_XAddH); in initio_xfer_data_in()
1706 scb->next_state = 0x5; in initio_xfer_data_in()
1721 struct scsi_ctrl_blk *scb = host->active; in initio_xfer_data_out() local
1723 if ((scb->flags & SCF_DIR) == SCF_DIN) in initio_xfer_data_out()
1726 outl(scb->buflen, host->addr + TUL_SCnt0); in initio_xfer_data_out()
1729 if (scb->flags & SCF_SG) { /* S/G xfer */ in initio_xfer_data_out()
1730 outl(((u32) scb->sglen) << 3, host->addr + TUL_XCntH); in initio_xfer_data_out()
1731 outl(scb->bufptr, host->addr + TUL_XAddH); in initio_xfer_data_out()
1734 outl(scb->buflen, host->addr + TUL_XCntH); in initio_xfer_data_out()
1735 outl(scb->bufptr, host->addr + TUL_XAddH); in initio_xfer_data_out()
1739 scb->next_state = 0x5; in initio_xfer_data_out()
1745 struct scsi_ctrl_blk *scb = host->active; in initio_xpad_in() local
1748 if ((scb->flags & SCF_DIR) != SCF_NO_DCHK) in initio_xpad_in()
1749 scb->hastat = HOST_DO_DU; /* over run */ in initio_xpad_in()
1769 struct scsi_ctrl_blk *scb = host->active; in initio_xpad_out() local
1772 if ((scb->flags & SCF_DIR) != SCF_NO_DCHK) in initio_xpad_out()
1773 scb->hastat = HOST_DO_DU; /* over run */ in initio_xpad_out()
1794 struct scsi_ctrl_blk *scb = host->active; in initio_status_msg() local
1802 scb->tastat = inb(host->addr + TUL_SFifo); in initio_status_msg()
1825 if ((scb->tastat & 0x18) == 0x10) /* No link support */ in initio_status_msg()
1833 if ((scb->tastat & 0x18) == 0x10) in initio_status_msg()
1844 struct scsi_ctrl_blk *scb = host->active; in int_initio_busfree() local
1846 if (scb != NULL) { in int_initio_busfree()
1847 if (scb->status & SCB_SELECT) { /* selection timeout */ in int_initio_busfree()
1848 initio_unlink_pend_scb(host, scb); in int_initio_busfree()
1849 scb->hastat = HOST_SEL_TOUT; in int_initio_busfree()
1850 initio_append_done_scb(host, scb); in int_initio_busfree()
1852 initio_unlink_busy_scb(host, scb); in int_initio_busfree()
1853 scb->hastat = HOST_BUS_FREE; in int_initio_busfree()
1854 initio_append_done_scb(host, scb); in int_initio_busfree()
1878 struct scsi_ctrl_blk *scb; in int_initio_scsi_rst() local
1890 while ((scb = initio_pop_busy_scb(host)) != NULL) { in int_initio_scsi_rst()
1891 scb->hastat = HOST_BAD_PHAS; in int_initio_scsi_rst()
1892 initio_append_done_scb(host, scb); in int_initio_scsi_rst()
1914 struct scsi_ctrl_blk *scb; in int_initio_resel() local
1919 if ((scb = host->active) != NULL) { in int_initio_resel()
1921 if (scb->status & SCB_SELECT) /* if waiting for selection complete */ in int_initio_resel()
1922 scb->status &= ~SCB_SELECT; in int_initio_resel()
1961 scb = host->scb + tag; in int_initio_resel()
1962 if (scb->target != tar || scb->lun != lun) { in int_initio_resel()
1965 if (scb->status != SCB_BUSY) { /* 03/24/95 */ in int_initio_resel()
1968 host->active = scb; in int_initio_resel()
1973 if ((scb = initio_find_busy_scb(host, tar | (lun << 8))) == NULL) { in int_initio_resel()
1976 host->active = scb; in int_initio_resel()
1995 struct scsi_ctrl_blk *scb; in int_initio_bad_seq() local
2000 while ((scb = initio_pop_busy_scb(host)) != NULL) { in int_initio_bad_seq()
2001 scb->hastat = HOST_BAD_PHAS; in int_initio_bad_seq()
2002 initio_append_done_scb(host, scb); in int_initio_bad_seq()
2293 struct scsi_ctrl_blk *scb; in initio_post_scsi_rst() local
2301 while ((scb = initio_pop_busy_scb(host)) != NULL) { in initio_post_scsi_rst()
2302 scb->hastat = HOST_BAD_PHAS; in initio_post_scsi_rst()
2303 initio_append_done_scb(host, scb); in initio_post_scsi_rst()
2319 static void initio_select_atn_stop(struct initio_host * host, struct scsi_ctrl_blk * scb) in initio_select_atn_stop() argument
2321 scb->status |= SCB_SELECT; in initio_select_atn_stop()
2322 scb->next_state = 0x1; in initio_select_atn_stop()
2323 host->active = scb; in initio_select_atn_stop()
2324 host->active_tc = &host->targets[scb->target]; in initio_select_atn_stop()
2329 static void initio_select_atn(struct initio_host * host, struct scsi_ctrl_blk * scb) in initio_select_atn() argument
2333 scb->status |= SCB_SELECT; in initio_select_atn()
2334 scb->next_state = 0x2; in initio_select_atn()
2336 outb(scb->ident, host->addr + TUL_SFifo); in initio_select_atn()
2337 for (i = 0; i < (int) scb->cdblen; i++) in initio_select_atn()
2338 outb(scb->cdb[i], host->addr + TUL_SFifo); in initio_select_atn()
2339 host->active_tc = &host->targets[scb->target]; in initio_select_atn()
2340 host->active = scb; in initio_select_atn()
2344 static void initio_select_atn3(struct initio_host * host, struct scsi_ctrl_blk * scb) in initio_select_atn3() argument
2348 scb->status |= SCB_SELECT; in initio_select_atn3()
2349 scb->next_state = 0x2; in initio_select_atn3()
2351 outb(scb->ident, host->addr + TUL_SFifo); in initio_select_atn3()
2352 outb(scb->tagmsg, host->addr + TUL_SFifo); in initio_select_atn3()
2353 outb(scb->tagid, host->addr + TUL_SFifo); in initio_select_atn3()
2354 for (i = 0; i < scb->cdblen; i++) in initio_select_atn3()
2355 outb(scb->cdb[i], host->addr + TUL_SFifo); in initio_select_atn3()
2356 host->active_tc = &host->targets[scb->target]; in initio_select_atn3()
2357 host->active = scb; in initio_select_atn3()
2370 struct scsi_ctrl_blk *scb = host->active; in initio_bus_device_reset() local
2378 initio_unlink_pend_scb(host, scb); in initio_bus_device_reset()
2379 initio_release_scb(host, scb); in initio_bus_device_reset()
2382 tar = scb->target; /* target */ in initio_bus_device_reset()
2830 struct scsi_ctrl_blk *scb, *tmp, *prev = NULL /* silence gcc */; in initio_probe_one() local
2872 if ((scb = kzalloc(i, GFP_DMA)) != NULL) in initio_probe_one()
2876 if (!scb) { in initio_probe_one()
2887 host->scb = scb; in initio_probe_one()
2888 host->next_pending = scb; in initio_probe_one()
2889 host->next_avail = scb; in initio_probe_one()
2890 for (i = 0, tmp = scb; i < num_scb; i++, tmp++) { in initio_probe_one()
2898 host->first_avail = scb; in initio_probe_one()
2933 kfree(host->scb); in initio_probe_one()