isp_freebsd.c (84242) | isp_freebsd.c (87635) |
---|---|
1/* $FreeBSD: head/sys/dev/isp/isp_freebsd.c 84242 2001-10-01 03:48:42Z mjacob $ */ | 1/* $FreeBSD: head/sys/dev/isp/isp_freebsd.c 87635 2001-12-11 00:18:45Z mjacob $ */ |
2/* 3 * Platform (FreeBSD) dependent common attachment code for Qlogic adapters. 4 * 5 * Copyright (c) 1997, 1998, 1999, 2000, 2001 by Matthew Jacob 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: --- 914 unchanged lines hidden (view full) --- 924} 925 926static cam_status 927isp_target_start_ctio(struct ispsoftc *isp, union ccb *ccb) 928{ 929 void *qe; 930 struct ccb_scsiio *cso = &ccb->csio; 931 u_int16_t *hp, save_handle; | 2/* 3 * Platform (FreeBSD) dependent common attachment code for Qlogic adapters. 4 * 5 * Copyright (c) 1997, 1998, 1999, 2000, 2001 by Matthew Jacob 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: --- 914 unchanged lines hidden (view full) --- 924} 925 926static cam_status 927isp_target_start_ctio(struct ispsoftc *isp, union ccb *ccb) 928{ 929 void *qe; 930 struct ccb_scsiio *cso = &ccb->csio; 931 u_int16_t *hp, save_handle; |
932 u_int16_t iptr, optr; | 932 u_int16_t nxti, optr; 933 u_int8_t local[QENTRY_LEN]; |
933 934 | 934 935 |
935 if (isp_getrqentry(isp, &iptr, &optr, &qe)) { | 936 if (isp_getrqentry(isp, &nxti, &optr, &qe)) { |
936 xpt_print_path(ccb->ccb_h.path); 937 printf("Request Queue Overflow in isp_target_start_ctio\n"); 938 return (CAM_RESRC_UNAVAIL); 939 } | 937 xpt_print_path(ccb->ccb_h.path); 938 printf("Request Queue Overflow in isp_target_start_ctio\n"); 939 return (CAM_RESRC_UNAVAIL); 940 } |
940 bzero(qe, QENTRY_LEN); | 941 bzero(local, QENTRY_LEN); |
941 942 /* 943 * We're either moving data or completing a command here. 944 */ 945 946 if (IS_FC(isp)) { 947 atio_private_data_t *atp; | 942 943 /* 944 * We're either moving data or completing a command here. 945 */ 946 947 if (IS_FC(isp)) { 948 atio_private_data_t *atp; |
948 ct2_entry_t *cto = qe; | 949 ct2_entry_t *cto = (ct2_entry_t *) local; |
949 950 cto->ct_header.rqs_entry_type = RQSTYPE_CTIO2; 951 cto->ct_header.rqs_entry_count = 1; 952 cto->ct_iid = cso->init_id; 953 if ((FCPARAM(isp)->isp_fwattr & ISP_FW_ATTR_SCCLUN) == 0) { 954 cto->ct_lun = ccb->ccb_h.target_lun; 955 } 956 --- 46 unchanged lines hidden (view full) --- 1003 "CTIO2[%x] STATUS %x origd %u curd %u resid %u", 1004 cto->ct_rxid, cso->scsi_status, atp->orig_datalen, 1005 cso->dxfer_len, cto->ct_resid); 1006 cto->ct_flags |= CT2_CCINCR; 1007 } 1008 cto->ct_timeout = 10; 1009 hp = &cto->ct_syshandle; 1010 } else { | 950 951 cto->ct_header.rqs_entry_type = RQSTYPE_CTIO2; 952 cto->ct_header.rqs_entry_count = 1; 953 cto->ct_iid = cso->init_id; 954 if ((FCPARAM(isp)->isp_fwattr & ISP_FW_ATTR_SCCLUN) == 0) { 955 cto->ct_lun = ccb->ccb_h.target_lun; 956 } 957 --- 46 unchanged lines hidden (view full) --- 1004 "CTIO2[%x] STATUS %x origd %u curd %u resid %u", 1005 cto->ct_rxid, cso->scsi_status, atp->orig_datalen, 1006 cso->dxfer_len, cto->ct_resid); 1007 cto->ct_flags |= CT2_CCINCR; 1008 } 1009 cto->ct_timeout = 10; 1010 hp = &cto->ct_syshandle; 1011 } else { |
1011 ct_entry_t *cto = qe; | 1012 ct_entry_t *cto = (ct_entry_t *) local; |
1012 1013 cto->ct_header.rqs_entry_type = RQSTYPE_CTIO; 1014 cto->ct_header.rqs_entry_count = 1; 1015 cto->ct_iid = cso->init_id; 1016 cto->ct_iid |= XS_CHANNEL(ccb) << 7; 1017 cto->ct_tgt = ccb->ccb_h.target_id; 1018 cto->ct_lun = ccb->ccb_h.target_lun; 1019 cto->ct_fwhandle = AT_GET_HANDLE(cso->tag_id); --- 38 unchanged lines hidden (view full) --- 1058 * new things to play with. As with isp_start's usage of DMA setup, 1059 * any swizzling is done in the machine dependent layer. Because 1060 * of this, we put the request onto the queue area first in native 1061 * format. 1062 */ 1063 1064 save_handle = *hp; 1065 | 1013 1014 cto->ct_header.rqs_entry_type = RQSTYPE_CTIO; 1015 cto->ct_header.rqs_entry_count = 1; 1016 cto->ct_iid = cso->init_id; 1017 cto->ct_iid |= XS_CHANNEL(ccb) << 7; 1018 cto->ct_tgt = ccb->ccb_h.target_id; 1019 cto->ct_lun = ccb->ccb_h.target_lun; 1020 cto->ct_fwhandle = AT_GET_HANDLE(cso->tag_id); --- 38 unchanged lines hidden (view full) --- 1059 * new things to play with. As with isp_start's usage of DMA setup, 1060 * any swizzling is done in the machine dependent layer. Because 1061 * of this, we put the request onto the queue area first in native 1062 * format. 1063 */ 1064 1065 save_handle = *hp; 1066 |
1066 switch (ISP_DMASETUP(isp, cso, qe, &iptr, optr)) { | 1067 switch (ISP_DMASETUP(isp, cso, (ispreq_t *) local, &nxti, optr)) { |
1067 case CMD_QUEUED: | 1068 case CMD_QUEUED: |
1068 ISP_ADD_REQUEST(isp, iptr); | 1069 ISP_ADD_REQUEST(isp, nxti); |
1069 return (CAM_REQ_INPROG); 1070 1071 case CMD_EAGAIN: 1072 ccb->ccb_h.status = CAM_RESRC_UNAVAIL; 1073 isp_destroy_handle(isp, save_handle); 1074 return (CAM_RESRC_UNAVAIL); 1075 1076 default: --- 10 unchanged lines hidden (view full) --- 1087 splx(s); 1088} 1089 1090static void 1091isp_target_putback_atio(union ccb *ccb) 1092{ 1093 struct ispsoftc *isp; 1094 struct ccb_scsiio *cso; | 1070 return (CAM_REQ_INPROG); 1071 1072 case CMD_EAGAIN: 1073 ccb->ccb_h.status = CAM_RESRC_UNAVAIL; 1074 isp_destroy_handle(isp, save_handle); 1075 return (CAM_RESRC_UNAVAIL); 1076 1077 default: --- 10 unchanged lines hidden (view full) --- 1088 splx(s); 1089} 1090 1091static void 1092isp_target_putback_atio(union ccb *ccb) 1093{ 1094 struct ispsoftc *isp; 1095 struct ccb_scsiio *cso; |
1095 u_int16_t iptr, optr; | 1096 u_int16_t nxti, optr; |
1096 void *qe; 1097 1098 isp = XS_ISP(ccb); 1099 | 1097 void *qe; 1098 1099 isp = XS_ISP(ccb); 1100 |
1100 if (isp_getrqentry(isp, &iptr, &optr, &qe)) { | 1101 if (isp_getrqentry(isp, &nxti, &optr, &qe)) { |
1101 (void) timeout(isp_refire_putback_atio, ccb, 10); 1102 isp_prt(isp, ISP_LOGWARN, 1103 "isp_target_putback_atio: Request Queue Overflow"); 1104 return; 1105 } 1106 bzero(qe, QENTRY_LEN); 1107 cso = &ccb->csio; 1108 if (IS_FC(isp)) { | 1102 (void) timeout(isp_refire_putback_atio, ccb, 10); 1103 isp_prt(isp, ISP_LOGWARN, 1104 "isp_target_putback_atio: Request Queue Overflow"); 1105 return; 1106 } 1107 bzero(qe, QENTRY_LEN); 1108 cso = &ccb->csio; 1109 if (IS_FC(isp)) { |
1109 at2_entry_t *at = qe; | 1110 at2_entry_t local, *at = &local; 1111 MEMZERO(at, sizeof (at2_entry_t)); |
1110 at->at_header.rqs_entry_type = RQSTYPE_ATIO2; 1111 at->at_header.rqs_entry_count = 1; 1112 if ((FCPARAM(isp)->isp_fwattr & ISP_FW_ATTR_SCCLUN) != 0) { 1113 at->at_scclun = (uint16_t) ccb->ccb_h.target_lun; 1114 } else { 1115 at->at_lun = (uint8_t) ccb->ccb_h.target_lun; 1116 } 1117 at->at_status = CT_OK; 1118 at->at_rxid = cso->tag_id; | 1112 at->at_header.rqs_entry_type = RQSTYPE_ATIO2; 1113 at->at_header.rqs_entry_count = 1; 1114 if ((FCPARAM(isp)->isp_fwattr & ISP_FW_ATTR_SCCLUN) != 0) { 1115 at->at_scclun = (uint16_t) ccb->ccb_h.target_lun; 1116 } else { 1117 at->at_lun = (uint8_t) ccb->ccb_h.target_lun; 1118 } 1119 at->at_status = CT_OK; 1120 at->at_rxid = cso->tag_id; |
1119 ISP_SWIZ_ATIO2(isp, qe, qe); | 1121 isp_put_atio2(isp, at, qe); |
1120 } else { | 1122 } else { |
1121 at_entry_t *at = qe; | 1123 at_entry_t local, *at = &local; 1124 MEMZERO(at, sizeof (at_entry_t)); |
1122 at->at_header.rqs_entry_type = RQSTYPE_ATIO; 1123 at->at_header.rqs_entry_count = 1; 1124 at->at_iid = cso->init_id; 1125 at->at_iid |= XS_CHANNEL(ccb) << 7; 1126 at->at_tgt = cso->ccb_h.target_id; 1127 at->at_lun = cso->ccb_h.target_lun; 1128 at->at_status = CT_OK; 1129 at->at_tag_val = AT_GET_TAG(cso->tag_id); 1130 at->at_handle = AT_GET_HANDLE(cso->tag_id); | 1125 at->at_header.rqs_entry_type = RQSTYPE_ATIO; 1126 at->at_header.rqs_entry_count = 1; 1127 at->at_iid = cso->init_id; 1128 at->at_iid |= XS_CHANNEL(ccb) << 7; 1129 at->at_tgt = cso->ccb_h.target_id; 1130 at->at_lun = cso->ccb_h.target_lun; 1131 at->at_status = CT_OK; 1132 at->at_tag_val = AT_GET_TAG(cso->tag_id); 1133 at->at_handle = AT_GET_HANDLE(cso->tag_id); |
1131 ISP_SWIZ_ATIO(isp, qe, qe); | 1134 isp_put_atio(isp, at, qe); |
1132 } 1133 ISP_TDQE(isp, "isp_target_putback_atio", (int) optr, qe); | 1135 } 1136 ISP_TDQE(isp, "isp_target_putback_atio", (int) optr, qe); |
1134 ISP_ADD_REQUEST(isp, iptr); | 1137 ISP_ADD_REQUEST(isp, nxti); |
1135 isp_complete_ctio(ccb); 1136} 1137 1138static void 1139isp_complete_ctio(union ccb *ccb) 1140{ 1141 struct ispsoftc *isp = XS_ISP(ccb); 1142 if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_INPROG) { --- 518 unchanged lines hidden (view full) --- 1661 isp_destroy_handle(isp, handle); 1662 xpt_print_path(xs->ccb_h.path); 1663 isp_prt(isp, ISP_LOGWARN, 1664 "watchdog timeout for handle %x", handle); 1665 XS_SETERR(xs, CAM_CMD_TIMEOUT); 1666 XS_CMD_C_WDOG(xs); 1667 isp_done(xs); 1668 } else { | 1138 isp_complete_ctio(ccb); 1139} 1140 1141static void 1142isp_complete_ctio(union ccb *ccb) 1143{ 1144 struct ispsoftc *isp = XS_ISP(ccb); 1145 if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_INPROG) { --- 518 unchanged lines hidden (view full) --- 1664 isp_destroy_handle(isp, handle); 1665 xpt_print_path(xs->ccb_h.path); 1666 isp_prt(isp, ISP_LOGWARN, 1667 "watchdog timeout for handle %x", handle); 1668 XS_SETERR(xs, CAM_CMD_TIMEOUT); 1669 XS_CMD_C_WDOG(xs); 1670 isp_done(xs); 1671 } else { |
1669 u_int16_t iptr, optr; 1670 ispreq_t *mp; | 1672 u_int16_t nxti, optr; 1673 ispreq_t local, *mp= &local, *qe; |
1671 1672 XS_CMD_C_WDOG(xs); 1673 xs->ccb_h.timeout_ch = timeout(isp_watchdog, xs, hz); | 1674 1675 XS_CMD_C_WDOG(xs); 1676 xs->ccb_h.timeout_ch = timeout(isp_watchdog, xs, hz); |
1674 if (isp_getrqentry(isp, &iptr, &optr, (void **) &mp)) { | 1677 if (isp_getrqentry(isp, &nxti, &optr, (void **) &qe)) { |
1675 ISP_UNLOCK(isp); 1676 return; 1677 } 1678 XS_CMD_S_GRACE(xs); 1679 MEMZERO((void *) mp, sizeof (*mp)); 1680 mp->req_header.rqs_entry_count = 1; 1681 mp->req_header.rqs_entry_type = RQSTYPE_MARKER; 1682 mp->req_modifier = SYNC_ALL; 1683 mp->req_target = XS_CHANNEL(xs) << 7; | 1678 ISP_UNLOCK(isp); 1679 return; 1680 } 1681 XS_CMD_S_GRACE(xs); 1682 MEMZERO((void *) mp, sizeof (*mp)); 1683 mp->req_header.rqs_entry_count = 1; 1684 mp->req_header.rqs_entry_type = RQSTYPE_MARKER; 1685 mp->req_modifier = SYNC_ALL; 1686 mp->req_target = XS_CHANNEL(xs) << 7; |
1684 ISP_SWIZZLE_REQUEST(isp, mp); 1685 ISP_ADD_REQUEST(isp, iptr); | 1687 isp_put_request(isp, mp, qe); 1688 ISP_ADD_REQUEST(isp, nxti); |
1686 } 1687 } else { 1688 isp_prt(isp, ISP_LOGDEBUG2, "watchdog with no command"); 1689 } 1690 ISP_UNLOCK(isp); 1691} 1692 1693static int isp_ktmature = 0; --- 1174 unchanged lines hidden --- | 1689 } 1690 } else { 1691 isp_prt(isp, ISP_LOGDEBUG2, "watchdog with no command"); 1692 } 1693 ISP_UNLOCK(isp); 1694} 1695 1696static int isp_ktmature = 0; --- 1174 unchanged lines hidden --- |