Home | History | Annotate | Download | only in dev

Lines Matching defs:reqp

128 extern inline void nack_message(SC_REQ *reqp, u_char msg)
131 reqp->msgout = msg;
134 extern inline void finish_req(SC_REQ *reqp)
137 struct scsipi_xfer *xs = reqp->xs;
143 if (reqp->dr_flag & DRIVER_BOUNCING)
144 free_bounceb(reqp->bounceb);
147 if (dbg_target_mask & (1 << reqp->targ_id))
148 show_request(reqp, "DONE");
151 if (reqp->xs->error != 0)
152 show_request(reqp, "ERR_RET");
158 reqp->next = free_head;
159 free_head = reqp;
163 if (!(reqp->dr_flag & DRIVER_LINKCHK))
267 SC_REQ *reqp, *link, *tmp;
287 if ((reqp = free_head) == 0) {
292 free_head = reqp->next;
293 reqp->next = NULL;
299 reqp->dr_flag = (flags & XS_CTL_POLL) ? DRIVER_NOINT : 0;
300 reqp->phase = NR_PHASE;
301 reqp->msgout = MSG_NOOP;
302 reqp->status = SCSGOOD;
303 reqp->message = 0xff;
304 reqp->link = NULL;
305 reqp->xs = xs;
306 reqp->targ_id = xs->xs_periph->periph_target;
307 reqp->targ_lun = xs->xs_periph->periph_lun;
308 reqp->xdata_ptr = (u_char*)xs->data;
309 reqp->xdata_len = xs->datalen;
310 memcpy(&reqp->xcmd, xs->cmd, xs->cmdlen);
311 reqp->xcmd_len = xs->cmdlen;
312 reqp->xcmd.bytes[0] |= reqp->targ_lun << 5;
318 if (scsi_dmaok(reqp))
319 reqp->dr_flag |= DRIVER_DMAOK;
336 (reqp->xcmd.opcode == SCSI_REQUEST_SENSE)) {
337 reqp->next = issue_q;
338 issue_q = reqp;
342 if (!link && (tmp->targ_id == reqp->targ_id) &&
346 tmp->next = reqp;
348 if (link && (ncr_will_link & (1<<reqp->targ_id))) {
349 link->link = reqp;
364 if (!link && !(ncr_test_link & (1<<reqp->targ_id)) &&
365 (tmp = free_head) && !(reqp->dr_flag & DRIVER_NOINT)) {
368 (reqp->dr_flag & ~DRIVER_DMAOK) | DRIVER_LINKCHK;
372 tmp->xs = reqp->xs;
373 tmp->targ_id = reqp->targ_id;
374 tmp->targ_lun = reqp->targ_lun;
380 tmp->link = reqp;
393 if (dbg_target_mask & (1 << reqp->targ_id))
394 show_request(reqp,
395 (reqp->xcmd.opcode == SCSI_REQUEST_SENSE) ?
627 SC_REQ *reqp;
631 if ((reqp = connected) && (reqp->dr_flag & DRIVER_IN_DMA)) {
634 transfer_dma(reqp, reqp->phase, 0);
689 scsi_select(SC_REQ *reqp, int code)
699 sc = device_private(reqp->xs->xs_periph->periph_channel->chan_adapter->adapt_dev);
792 targ_bit = 1 << reqp->targ_id;
842 reqp->xs->error = code ? code : XS_SELTIMEOUT;
844 reqp->targ_id);
845 if (reqp->dr_flag & DRIVER_LINKCHK)
846 ncr_test_link &= ~(1<<reqp->targ_id);
847 finish_req(reqp);
854 DBG_SELPRINT ("Target %d responding to select.\n", reqp->targ_id);
865 reqp->phase = PH_CMD;
873 tmp[0] = MSG_IDENTIFY(reqp->targ_lun,
874 (reqp->dr_flag & DRIVER_NOINT) ? 0 : 1);
892 reqp->targ_id);
894 reqp->phase = PH_CMD;
899 reqp->targ_id);
914 reqp->xs->error = code ? code : XS_DRIVER_STUFFUP;
915 finish_req(reqp);
919 reqp->phase = PH_MSGOUT;
931 connected = reqp;
945 SC_REQ *reqp = connected;
969 busy &= ~(1 << reqp->targ_id);
971 reqp->xs->error = XS_TIMEOUT;
972 finish_req(reqp);
981 if (phase != reqp->phase) {
982 reqp->phase = phase;
983 DBG_INFPRINT(show_phase, reqp, phase);
989 if ((reqp->msgout == MSG_ABORT)
991 busy &= ~(1 << reqp->targ_id);
993 finish_req(reqp);
1002 ncr_tprint(reqp, "NOWRITE set -- write attempt aborted.");
1003 reqp->msgout = MSG_ABORT;
1011 if (reqp->xdata_ptr == reqp->xs->data) { /* XXX */
1012 if (reqp->dr_flag & DRIVER_BOUNCING)
1013 memcpy(reqp->bounceb, reqp->xdata_ptr, reqp->xdata_len);
1017 if (reqp->xdata_len <= 0) {
1022 ncr_tprint(reqp, "Target requests too much data\n");
1023 reqp->msgout = MSG_ABORT;
1029 if (reqp->dr_flag & DRIVER_DMAOK) {
1030 int poll = REAL_DMA_POLL|(reqp->dr_flag & DRIVER_NOINT);
1031 transfer_dma(reqp, phase, poll);
1039 len = reqp->xdata_len;
1041 if (transfer_pdma(&phase, reqp->xdata_ptr, &len) == 0)
1044 transfer_pio(&phase, reqp->xdata_ptr, &len, 0);
1046 reqp->xdata_ptr += reqp->xdata_len - len;
1047 reqp->xdata_len = len;
1056 reqp->message = tmp;
1057 return (handle_message(reqp, tmp));
1060 transfer_pio(&phase, &reqp->msgout, &len, 0);
1061 if (reqp->msgout == MSG_ABORT) {
1062 busy &= ~(1 << reqp->targ_id);
1064 if (!reqp->xs->error)
1065 reqp->xs->error = XS_DRIVER_STUFFUP;
1066 finish_req(reqp);
1070 reqp->msgout = MSG_NOOP;
1073 len = reqp->xcmd_len;
1074 transfer_pio(&phase, (u_char *)&reqp->xcmd, &len, 0);
1080 reqp->status = tmp;
1084 ncr_tprint(reqp, "Unknown phase\n");
1097 handle_message(SC_REQ *reqp, u_int msg)
1113 if (reqp->link == NULL) {
1114 ncr_tprint(reqp, "No link for linked command");
1115 nack_message(reqp, MSG_ABORT);
1120 if (!(reqp->dr_flag & DRIVER_AUTOSEN)) {
1121 reqp->xs->resid = reqp->xdata_len;
1122 reqp->xs->error = 0;
1126 if (check_autosense(reqp, 1) == -1)
1131 if (dbg_target_mask & (1 << reqp->targ_id))
1132 show_request(reqp->link, "LINK");
1134 connected = reqp->link;
1154 finish_req(reqp);
1161 busy &= ~(1 << reqp->targ_id);
1162 if (!(reqp->dr_flag & DRIVER_AUTOSEN)) {
1163 reqp->xs->resid = reqp->xdata_len;
1164 reqp->xs->error = 0;
1168 if (check_autosense(reqp, 0) == -1) {
1174 finish_req(reqp);
1184 if (dbg_target_mask & (1 << reqp->targ_id))
1185 show_request(reqp, "DISCON");
1189 reqp->next = discon_q;
1190 discon_q = reqp;
1204 nack_message(reqp, MSG_MESSAGE_REJECT);
1213 ncr_tprint(reqp,
1216 nack_message(reqp, MSG_MESSAGE_REJECT);
1403 transfer_dma(SC_REQ *reqp, u_int phase, int poll)
1434 reqp->dr_flag |= DRIVER_IN_DMA;
1439 scsi_dma_setup(reqp, phase, mbase);
1448 poll_edma(reqp);
1461 SC_REQ *reqp = connected;
1465 is_edma = get_dma_result(reqp, &bytes_left);
1474 ncr_tprint(reqp, "dma_ready: spurious call "
1492 bytes_done = reqp->dm_cur->dm_count - bytes_left;
1494 if ((reqp->dr_flag & DRIVER_BOUNCING) && (PH_IN(reqp->phase))) {
1501 memcpy(reqp->xdata_ptr, reqp->bouncerp, bytes_done);
1502 reqp->bouncerp += bytes_done;
1505 reqp->xdata_ptr = &reqp->xdata_ptr[bytes_done]; /* XXX */
1506 reqp->xdata_len -= bytes_done; /* XXX */
1507 if ((reqp->dm_cur->dm_count -= bytes_done) == 0)
1508 reqp->dm_cur++;
1509 else reqp->dm_cur->dm_addr += bytes_done;
1511 if (PH_IN(reqp->phase) && (dmstat & SC_PAR_ERR)) {
1512 if (!(ncr5380_no_parchk & (1 << reqp->targ_id))) {
1513 ncr_tprint(reqp, "parity error in data-phase\n");
1514 reqp->xs->error = XS_TIMEOUT;
1528 || (reqp->dm_cur > reqp->dm_last) || (reqp->xs->error)) {
1533 reqp->dr_flag &= ~DRIVER_IN_DMA;
1542 if (!reqp->xs->error)
1543 reqp->xs->error = XS_TIMEOUT;
1544 finish_req(reqp);
1549 if (reqp->xs->error != 0) {
1550 ncr_tprint(reqp, "dma-ready: code = %d\n", reqp->xs->error); /* LWP */
1551 reqp->msgout = MSG_ABORT;
1562 check_autosense(SC_REQ *reqp, int linked)
1572 if (reqp->dr_flag & DRIVER_LINKCHK) {
1574 ncr_will_link |= 1<<reqp->targ_id;
1575 else ncr_tprint(reqp, "Does not support linked commands\n");
1584 if (!(reqp->dr_flag & DRIVER_AUTOSEN)) {
1585 switch (reqp->status & SCSMASK) {
1587 memcpy(&reqp->xcmd, sense_cmd, sizeof(sense_cmd));
1588 reqp->xcmd_len = sizeof(sense_cmd);
1589 reqp->xdata_ptr = (u_char *)&reqp->xs->sense.scsi_sense;
1590 reqp->xdata_len = sizeof(reqp->xs->sense.scsi_sense);
1591 reqp->dr_flag |= DRIVER_AUTOSEN;
1592 reqp->dr_flag &= ~DRIVER_DMAOK;
1595 reqp->next = issue_q;
1596 issue_q = reqp;
1599 else reqp->xcmd.bytes[sizeof(sense_cmd)-2] |= 1;
1602 memset(reqp->xdata_ptr, 0, reqp->xdata_len);
1603 if (dbg_target_mask & (1 << reqp->targ_id))
1604 show_request(reqp, "AUTO-SENSE");
1609 reqp->xs->error = XS_BUSY;
1617 if ((reqp->status & SCSMASK) != SCSGOOD)
1618 reqp->xs->error = XS_DRIVER_STUFFUP; /* SC_E_AUTOSEN; */
1619 else reqp->xs->error = XS_SENSE;
1620 reqp->status = SCSCHKC;
1740 SC_REQ *reqp;
1746 if ((reqp = connected) && (reqp->dr_flag & DRIVER_IN_DMA)){
1747 reqp->dr_flag &= ~DRIVER_IN_DMA;
1764 scsi_dmaok(SC_REQ *reqp)
1775 req_len = reqp->xdata_len;
1776 req_addr = (void*)reqp->xdata_ptr;
1777 dm = reqp->dm_cur = reqp->dm_last = reqp->dm_chain;
1779 reqp->dr_flag &= ~DRIVER_BOUNCING;
1810 if (wrong_dma_range(reqp, dm)) {
1811 if (reqp->dr_flag & DRIVER_BOUNCING)
1816 if (++dm >= &reqp->dm_chain[MAXDMAIO]) {
1817 ncr_tprint(reqp,"dmaok: DMA chain too long!\n");
1826 if (wrong_dma_range(reqp, dm)) {
1827 if (reqp->dr_flag & DRIVER_BOUNCING)
1831 reqp->dm_last = dm;
1835 if ((reqp->bounceb = alloc_bounceb(reqp->xdata_len)) == NULL) {
1839 reqp->dr_flag &= ~DRIVER_BOUNCING;
1845 dm = reqp->dm_cur = reqp->dm_last = reqp->dm_chain;
1846 dm->dm_addr = kvtop(reqp->bounceb);
1847 dm->dm_count = reqp->xdata_len;
1848 reqp->bouncerp = reqp->bounceb;
1881 ncr_tprint(SC_REQ *reqp, const char *fmt, ...)
1886 scsipi_printaddr(reqp->xs->xs_periph);
1927 show_request(SC_REQ *reqp, const char *qtxt)
1930 qtxt, reqp->targ_id, reqp->xdata_ptr, reqp->xdata_len,
1931 reqp->xcmd.opcode, reqp->status, reqp->message,
1932 reqp->xs->error, reqp->xs->resid, reqp->dr_flag,
1933 reqp->link ? "L":"");
1934 if (reqp->status == SCSCHKC)
1935 show_data_sense(reqp->xs);