Lines Matching refs:reqp
131 nack_message(SC_REQ *reqp, u_char msg) in nack_message() argument
135 reqp->msgout = msg; in nack_message()
139 finish_req(SC_REQ *reqp) in finish_req() argument
142 struct scsipi_xfer *xs = reqp->xs; in finish_req()
148 if (reqp->dr_flag & DRIVER_BOUNCING) in finish_req()
149 free_bounceb(reqp->bounceb); in finish_req()
152 if (dbg_target_mask & (1 << reqp->targ_id)) in finish_req()
153 show_request(reqp, "DONE"); in finish_req()
156 if ((dbg_target_mask & (1 << reqp->targ_id)) && (reqp->xs->error != 0)) in finish_req()
157 show_request(reqp, "ERR_RET"); in finish_req()
163 reqp->next = free_head; in finish_req()
164 free_head = reqp; in finish_req()
167 if ((reqp->dr_flag & DRIVER_LINKCHK) == 0) in finish_req()
271 SC_REQ *reqp, *link, *tmp; in ncr5380_scsi_request() local
294 if ((reqp = free_head) == 0) { in ncr5380_scsi_request()
300 free_head = reqp->next; in ncr5380_scsi_request()
301 reqp->next = NULL; in ncr5380_scsi_request()
307 reqp->dr_flag = (flags & XS_CTL_POLL) ? DRIVER_NOINT : 0; in ncr5380_scsi_request()
308 reqp->phase = NR_PHASE; in ncr5380_scsi_request()
309 reqp->msgout = MSG_NOOP; in ncr5380_scsi_request()
310 reqp->status = SCSGOOD; in ncr5380_scsi_request()
311 reqp->message = 0xff; in ncr5380_scsi_request()
312 reqp->link = NULL; in ncr5380_scsi_request()
313 reqp->xs = xs; in ncr5380_scsi_request()
314 reqp->targ_id = xs->xs_periph->periph_target; in ncr5380_scsi_request()
315 reqp->targ_lun = xs->xs_periph->periph_lun; in ncr5380_scsi_request()
316 reqp->xdata_ptr = (u_char*)xs->data; in ncr5380_scsi_request()
317 reqp->xdata_len = xs->datalen; in ncr5380_scsi_request()
318 memcpy(&reqp->xcmd, xs->cmd, xs->cmdlen); in ncr5380_scsi_request()
319 reqp->xcmd_len = xs->cmdlen; in ncr5380_scsi_request()
320 reqp->xcmd.bytes[0] |= reqp->targ_lun << 5; in ncr5380_scsi_request()
326 if (scsi_dmaok(reqp)) in ncr5380_scsi_request()
327 reqp->dr_flag |= DRIVER_DMAOK; in ncr5380_scsi_request()
343 (reqp->xcmd.opcode == SCSI_REQUEST_SENSE)) { in ncr5380_scsi_request()
344 reqp->next = issue_q; in ncr5380_scsi_request()
345 issue_q = reqp; in ncr5380_scsi_request()
349 if (!link && (tmp->targ_id == reqp->targ_id) && in ncr5380_scsi_request()
353 tmp->next = reqp; in ncr5380_scsi_request()
355 if (link && (ncr_will_link & (1<<reqp->targ_id))) { in ncr5380_scsi_request()
356 link->link = reqp; in ncr5380_scsi_request()
371 if (!link && (ncr_test_link & (1 << reqp->targ_id)) == 0 && in ncr5380_scsi_request()
372 (tmp = free_head) && (reqp->dr_flag & DRIVER_NOINT) == 0) { in ncr5380_scsi_request()
374 tmp->dr_flag = (reqp->dr_flag & ~DRIVER_DMAOK) | in ncr5380_scsi_request()
379 tmp->xs = reqp->xs; in ncr5380_scsi_request()
380 tmp->targ_id = reqp->targ_id; in ncr5380_scsi_request()
381 tmp->targ_lun = reqp->targ_lun; in ncr5380_scsi_request()
387 tmp->link = reqp; in ncr5380_scsi_request()
400 if (dbg_target_mask & (1 << reqp->targ_id)) in ncr5380_scsi_request()
401 show_request(reqp, in ncr5380_scsi_request()
402 (reqp->xcmd.opcode == SCSI_REQUEST_SENSE) ? in ncr5380_scsi_request()
642 SC_REQ *reqp; in ncr_dma_intr() local
646 if ((reqp = connected) && (reqp->dr_flag & DRIVER_IN_DMA)) { in ncr_dma_intr()
649 transfer_dma(reqp, reqp->phase, 0); in ncr_dma_intr()
708 scsi_select(SC_REQ *reqp, int code) in scsi_select() argument
719 reqp->xs->xs_periph->periph_channel->chan_adapter->adapt_dev); in scsi_select()
812 targ_bit = 1 << reqp->targ_id; in scsi_select()
862 reqp->xs->error = code ? code : XS_SELTIMEOUT; in scsi_select()
864 reqp->targ_id); in scsi_select()
865 if (reqp->dr_flag & DRIVER_LINKCHK) in scsi_select()
866 ncr_test_link &= ~(1<<reqp->targ_id); in scsi_select()
867 finish_req(reqp); in scsi_select()
874 DBG_SELPRINT ("Target %d responding to select.\n", reqp->targ_id); in scsi_select()
885 reqp->phase = PH_CMD; in scsi_select()
893 tmp[0] = MSG_IDENTIFY(reqp->targ_lun, in scsi_select()
894 (reqp->dr_flag & DRIVER_NOINT) ? 0 : 1); in scsi_select()
912 reqp->targ_id); in scsi_select()
914 reqp->phase = PH_CMD; in scsi_select()
919 reqp->targ_id); in scsi_select()
935 reqp->xs->error = code ? code : XS_DRIVER_STUFFUP; in scsi_select()
936 finish_req(reqp); in scsi_select()
940 reqp->phase = PH_MSGOUT; in scsi_select()
952 connected = reqp; in scsi_select()
966 SC_REQ *reqp = connected; in information_transfer() local
990 busy &= ~(1 << reqp->targ_id); in information_transfer()
992 reqp->xs->error = XS_TIMEOUT; in information_transfer()
993 finish_req(reqp); in information_transfer()
1002 if (phase != reqp->phase) { in information_transfer()
1003 reqp->phase = phase; in information_transfer()
1005 if (dbg_target_mask & (1 << reqp->targ_id)) in information_transfer()
1006 DBG_INFPRINT(show_phase, reqp, phase); in information_transfer()
1012 if ((reqp->msgout == MSG_ABORT) && in information_transfer()
1014 busy &= ~(1 << reqp->targ_id); in information_transfer()
1016 reqp->xs->error = XS_TIMEOUT; in information_transfer()
1017 finish_req(reqp); in information_transfer()
1026 ncr_tprint(reqp, "NOWRITE set -- write attempt aborted."); in information_transfer()
1027 reqp->msgout = MSG_ABORT; in information_transfer()
1035 if (reqp->xdata_ptr == reqp->xs->data) { /* XXX */ in information_transfer()
1036 if (reqp->dr_flag & DRIVER_BOUNCING) in information_transfer()
1037 memcpy(reqp->bounceb, reqp->xdata_ptr, in information_transfer()
1038 reqp->xdata_len); in information_transfer()
1042 if (reqp->xdata_len <= 0) { in information_transfer()
1047 ncr_tprint(reqp, "Target requests too much data\n"); in information_transfer()
1048 reqp->msgout = MSG_ABORT; in information_transfer()
1054 if (reqp->dr_flag & DRIVER_DMAOK) { in information_transfer()
1055 int poll = REAL_DMA_POLL|(reqp->dr_flag & DRIVER_NOINT); in information_transfer()
1056 transfer_dma(reqp, phase, poll); in information_transfer()
1063 len = reqp->xdata_len; in information_transfer()
1065 if (transfer_pdma(&phase, reqp->xdata_ptr, &len) == 0) in information_transfer()
1068 transfer_pio(&phase, reqp->xdata_ptr, &len, 0); in information_transfer()
1070 reqp->xdata_ptr += reqp->xdata_len - len; in information_transfer()
1071 reqp->xdata_len = len; in information_transfer()
1080 reqp->message = tmp; in information_transfer()
1081 return handle_message(reqp, tmp); in information_transfer()
1084 transfer_pio(&phase, &reqp->msgout, &len, 0); in information_transfer()
1085 if (reqp->msgout == MSG_ABORT) { in information_transfer()
1086 busy &= ~(1 << reqp->targ_id); in information_transfer()
1088 if (!reqp->xs->error) in information_transfer()
1089 reqp->xs->error = XS_DRIVER_STUFFUP; in information_transfer()
1090 finish_req(reqp); in information_transfer()
1094 reqp->msgout = MSG_NOOP; in information_transfer()
1097 len = reqp->xcmd_len; in information_transfer()
1098 transfer_pio(&phase, (uint8_t *)&reqp->xcmd, &len, 0); in information_transfer()
1104 reqp->status = tmp; in information_transfer()
1108 ncr_tprint(reqp, "Unknown phase\n"); in information_transfer()
1121 handle_message(SC_REQ *reqp, u_int msg) in handle_message() argument
1137 if (reqp->link == NULL) { in handle_message()
1138 ncr_tprint(reqp, "No link for linked command"); in handle_message()
1139 nack_message(reqp, MSG_ABORT); in handle_message()
1144 if ((reqp->dr_flag & DRIVER_AUTOSEN) == 0) { in handle_message()
1145 reqp->xs->resid = reqp->xdata_len; in handle_message()
1146 reqp->xs->error = 0; in handle_message()
1150 if (check_autosense(reqp, 1) == -1) in handle_message()
1155 if (dbg_target_mask & (1 << reqp->targ_id)) in handle_message()
1156 show_request(reqp->link, "LINK"); in handle_message()
1158 connected = reqp->link; in handle_message()
1178 finish_req(reqp); in handle_message()
1185 busy &= ~(1 << reqp->targ_id); in handle_message()
1186 if ((reqp->dr_flag & DRIVER_AUTOSEN) == 0) { in handle_message()
1187 reqp->xs->resid = reqp->xdata_len; in handle_message()
1188 reqp->xs->error = 0; in handle_message()
1192 if (check_autosense(reqp, 0) == -1) { in handle_message()
1198 finish_req(reqp); in handle_message()
1208 if (dbg_target_mask & (1 << reqp->targ_id)) in handle_message()
1209 show_request(reqp, "DISCON"); in handle_message()
1213 reqp->next = discon_q; in handle_message()
1214 discon_q = reqp; in handle_message()
1228 nack_message(reqp, MSG_MESSAGE_REJECT); in handle_message()
1237 ncr_tprint(reqp, "Unknown message %x. Rejecting.\n", in handle_message()
1239 nack_message(reqp, MSG_MESSAGE_REJECT); in handle_message()
1434 transfer_dma(SC_REQ *reqp, u_int phase, int poll) in transfer_dma() argument
1465 reqp->dr_flag |= DRIVER_IN_DMA; in transfer_dma()
1470 scsi_dma_setup(reqp, phase, mbase); in transfer_dma()
1479 poll_edma(reqp); in transfer_dma()
1492 SC_REQ *reqp = connected; in dma_ready() local
1496 is_edma = get_dma_result(reqp, &bytes_left); in dma_ready()
1506 ncr_tprint(reqp, "dma_ready: spurious call " in dma_ready()
1524 bytes_done = reqp->dm_cur->dm_count - bytes_left; in dma_ready()
1526 if ((reqp->dr_flag & DRIVER_BOUNCING) && (PH_IN(reqp->phase))) { in dma_ready()
1533 memcpy(reqp->xdata_ptr, reqp->bouncerp, bytes_done); in dma_ready()
1534 reqp->bouncerp += bytes_done; in dma_ready()
1537 reqp->xdata_ptr = &reqp->xdata_ptr[bytes_done]; /* XXX */ in dma_ready()
1538 reqp->xdata_len -= bytes_done; /* XXX */ in dma_ready()
1539 if ((reqp->dm_cur->dm_count -= bytes_done) == 0) in dma_ready()
1540 reqp->dm_cur++; in dma_ready()
1542 reqp->dm_cur->dm_addr += bytes_done; in dma_ready()
1544 if (PH_IN(reqp->phase) && (dmstat & SC_PAR_ERR)) { in dma_ready()
1545 if ((ncr5380_no_parchk & (1 << reqp->targ_id)) == 0) { in dma_ready()
1546 ncr_tprint(reqp, "parity error in data-phase\n"); in dma_ready()
1547 reqp->xs->error = XS_TIMEOUT; in dma_ready()
1561 (reqp->dm_cur > reqp->dm_last) || reqp->xs->error != 0) { in dma_ready()
1566 reqp->dr_flag &= ~DRIVER_IN_DMA; in dma_ready()
1575 if (reqp->xs->error == 0) in dma_ready()
1576 reqp->xs->error = XS_TIMEOUT; in dma_ready()
1577 finish_req(reqp); in dma_ready()
1582 if (reqp->xs->error != 0) { in dma_ready()
1583 ncr_tprint(reqp, "dma-ready: code = %d\n", in dma_ready()
1584 reqp->xs->error); /* LWP */ in dma_ready()
1585 reqp->msgout = MSG_ABORT; in dma_ready()
1596 check_autosense(SC_REQ *reqp, int linked) in check_autosense() argument
1606 if (reqp->dr_flag & DRIVER_LINKCHK) { in check_autosense()
1608 ncr_will_link |= 1<<reqp->targ_id; in check_autosense()
1610 ncr_tprint(reqp, "Does not support linked commands\n"); in check_autosense()
1619 if ((reqp->dr_flag & DRIVER_AUTOSEN) == 0) { in check_autosense()
1620 switch (reqp->status & SCSMASK) { in check_autosense()
1622 memcpy(&reqp->xcmd, sense_cmd, sizeof(sense_cmd)); in check_autosense()
1623 reqp->xcmd_len = sizeof(sense_cmd); in check_autosense()
1624 reqp->xdata_ptr = (u_char *)&reqp->xs->sense.scsi_sense; in check_autosense()
1625 reqp->xdata_len = sizeof(reqp->xs->sense.scsi_sense); in check_autosense()
1626 reqp->dr_flag |= DRIVER_AUTOSEN; in check_autosense()
1627 reqp->dr_flag &= ~DRIVER_DMAOK; in check_autosense()
1630 reqp->next = issue_q; in check_autosense()
1631 issue_q = reqp; in check_autosense()
1634 reqp->xcmd.bytes[sizeof(sense_cmd)-2] |= 1; in check_autosense()
1637 memset(reqp->xdata_ptr, 0, reqp->xdata_len); in check_autosense()
1638 if (dbg_target_mask & (1 << reqp->targ_id)) in check_autosense()
1639 show_request(reqp, "AUTO-SENSE"); in check_autosense()
1644 reqp->xs->error = XS_BUSY; in check_autosense()
1651 if ((reqp->status & SCSMASK) != SCSGOOD) in check_autosense()
1652 reqp->xs->error = XS_DRIVER_STUFFUP; /* SC_E_AUTOSEN; */ in check_autosense()
1654 reqp->xs->error = XS_SENSE; in check_autosense()
1655 reqp->status = SCSCHKC; in check_autosense()
1780 SC_REQ *reqp; in check_intr() local
1786 if ((reqp = connected) && (reqp->dr_flag & DRIVER_IN_DMA)){ in check_intr()
1787 reqp->dr_flag &= ~DRIVER_IN_DMA; in check_intr()
1804 scsi_dmaok(SC_REQ *reqp) in scsi_dmaok() argument
1821 req_len = reqp->xdata_len; in scsi_dmaok()
1822 req_addr = (uint8_t *)reqp->xdata_ptr; in scsi_dmaok()
1823 dm = reqp->dm_cur = reqp->dm_last = reqp->dm_chain; in scsi_dmaok()
1825 reqp->dr_flag &= ~DRIVER_BOUNCING; in scsi_dmaok()
1867 if (wrong_dma_range(reqp, dm)) { in scsi_dmaok()
1868 if (reqp->dr_flag & DRIVER_BOUNCING) in scsi_dmaok()
1873 if (++dm >= &reqp->dm_chain[MAXDMAIO]) { in scsi_dmaok()
1874 ncr_tprint(reqp, in scsi_dmaok()
1884 if (wrong_dma_range(reqp, dm)) { in scsi_dmaok()
1885 if (reqp->dr_flag & DRIVER_BOUNCING) in scsi_dmaok()
1889 reqp->dm_last = dm; in scsi_dmaok()
1893 if ((reqp->bounceb = alloc_bounceb(reqp->xdata_len)) == NULL) { in scsi_dmaok()
1897 reqp->dr_flag &= ~DRIVER_BOUNCING; in scsi_dmaok()
1903 dm = reqp->dm_cur = reqp->dm_last = reqp->dm_chain; in scsi_dmaok()
1904 dm->dm_addr = kvtop(reqp->bounceb); in scsi_dmaok()
1905 dm->dm_count = reqp->xdata_len; in scsi_dmaok()
1906 reqp->bouncerp = reqp->bounceb; in scsi_dmaok()
1939 ncr_tprint(SC_REQ *reqp, const char *fmt, ...) in ncr_tprint() argument
1944 scsipi_printaddr(reqp->xs->xs_periph); in ncr_tprint()
1973 show_phase(SC_REQ *reqp, int phase) in show_phase() argument
1976 printf("INFTRANS: %d Phase = %s\n", reqp->targ_id, phase_names[phase]); in show_phase()
1999 show_request(SC_REQ *reqp, const char *qtxt) in show_request() argument
2004 qtxt, reqp->targ_id, reqp->xdata_ptr, reqp->xdata_len, in show_request()
2005 reqp->xcmd.opcode, reqp->status, reqp->message, in show_request()
2006 reqp->xs->error, reqp->xs->resid, reqp->dr_flag, in show_request()
2007 reqp->link ? "L":""); in show_request()
2008 if (reqp->status == SCSCHKC) in show_request()
2009 show_data_sense(reqp->xs); in show_request()