1035 0x00, 0x54, 0x53, 0x52, 0x51, 0x50, 0x4f, 0x00, 0x00, 0x4e,
1036 0x4d, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4b,
1037 0x00, 0x4a, 0x49, 0x48, 0x00, 0x47, 0x46, 0x45, 0x44, 0x43,
1038 0x42, 0x00, 0x00, 0x41, 0x40, 0x3f, 0x3e, 0x3d, 0x3c, 0x00,
1039 0x00, 0x3b, 0x3a, 0x00, 0x39, 0x00, 0x00, 0x00, 0x38, 0x37,
1040 0x36, 0x00, 0x35, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00,
1041 0x00, 0x00, 0x00, 0x33, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00,
1042 0x00, 0x31, 0x30, 0x00, 0x00, 0x2f, 0x00, 0x2e, 0x2d, 0x2c,
1043 0x00, 0x00, 0x00, 0x2b, 0x00, 0x2a, 0x29, 0x28, 0x00, 0x27,
1044 0x26, 0x25, 0x24, 0x23, 0x22, 0x00, 0x00, 0x21, 0x20, 0x1f,
1045 0x1e, 0x1d, 0x1c, 0x00, 0x00, 0x1b, 0x1a, 0x00, 0x19, 0x00,
1046 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x17, 0x16, 0x15,
1047 0x00, 0x14, 0x13, 0x12, 0x11, 0x10, 0x0f, 0x00, 0x00, 0x0e,
1048 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x00, 0x00, 0x08, 0x07, 0x00,
1049 0x06, 0x00, 0x00, 0x00, 0x05, 0x04, 0x03, 0x00, 0x02, 0x00,
1050 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1051 };
1052
1053 static caddr_t pid = "SESS01 ";
1054
1055 #if !defined(lint)
1056
1057 _NOTE(MUTEX_PROTECTS_DATA(fcp_global_mutex,
1058 fcp_port::fcp_next fcp_watchdog_id))
1059
1060 _NOTE(DATA_READABLE_WITHOUT_LOCK(fcp_watchdog_time))
1061
1062 _NOTE(SCHEME_PROTECTS_DATA("Unshared",
1063 fcp_insert_eid
1064 fcp_remove_eid
1065 fcp_watchdog_time))
1066
1067 _NOTE(SCHEME_PROTECTS_DATA("Unshared",
1068 fcp_cb_ops
1069 fcp_ops
1070 callb_cpr))
1071
1072 #endif /* lint */
1073
1074 /*
1075 * This table is used to determine whether or not it's safe to copy in
1076 * the target node name for a lun. Since all luns behind the same target
1077 * have the same wwnn, only tagets that do not support multiple luns are
1078 * eligible to be enumerated under mpxio if they aren't page83 compliant.
1079 */
1080
1081 char *fcp_symmetric_disk_table[] = {
1082 "SEAGATE ST",
1083 "IBM DDYFT",
1084 "SUNW SUNWGS", /* Daktari enclosure */
1085 "SUN SENA", /* SES device */
1086 "SUN SESS01" /* VICOM SVE box */
1087 };
1088
1089 int fcp_symmetric_disk_table_size =
1090 sizeof (fcp_symmetric_disk_table)/sizeof (char *);
1091
1092 /*
1093 * This structure is bogus. scsi_hba_attach_setup() requires, as in the kernel
9811 */
9812 if ((manual_cfg = ddi_prop_get_int(DDI_DEV_T_ANY, pptr->port_dip,
9813 DDI_PROP_NOTPROM | DDI_PROP_DONTPASS,
9814 MANUAL_CFG_ONLY,
9815 -1)) != -1) {
9816 if (manual_cfg == 1) {
9817 char *pathname;
9818 pathname = kmem_zalloc(MAXPATHLEN, KM_SLEEP);
9819 (void) ddi_pathname(pptr->port_dip, pathname);
9820 cmn_err(CE_NOTE,
9821 "%s (%s%d) %s is enabled via %s.conf.",
9822 pathname,
9823 ddi_driver_name(pptr->port_dip),
9824 ddi_get_instance(pptr->port_dip),
9825 MANUAL_CFG_ONLY,
9826 ddi_driver_name(pptr->port_dip));
9827 fcp_enable_auto_configuration = 0;
9828 kmem_free(pathname, MAXPATHLEN);
9829 }
9830 }
9831 _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(pptr->port_link_cnt));
9832 pptr->port_link_cnt = 1;
9833 _NOTE(NOW_VISIBLE_TO_OTHER_THREADS(pptr->port_link_cnt));
9834 pptr->port_id = s_id;
9835 pptr->port_instance = instance;
9836 _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(pptr->port_state));
9837 pptr->port_state = FCP_STATE_INIT;
9838 if (pinfo->port_acc_attr == NULL) {
9839 /*
9840 * The corresponding FCA doesn't support DMA at all
9841 */
9842 pptr->port_state |= FCP_STATE_FCA_IS_NODMA;
9843 }
9844
9845 _NOTE(NOW_VISIBLE_TO_OTHER_THREADS(pptr->port_state));
9846
9847 if (!(pptr->port_state & FCP_STATE_FCA_IS_NODMA)) {
9848 /*
9849 * If FCA supports DMA in SCSI data phase, we need preallocate
9850 * dma cookie, so stash the cookie size
9851 */
9852 pptr->port_dmacookie_sz = sizeof (ddi_dma_cookie_t) *
9853 pptr->port_data_dma_attr.dma_attr_sgllen;
9854 }
9855
9856 /*
9857 * The two mutexes of fcp_port are initialized. The variable
9858 * mutex_initted is incremented to remember that fact. That variable
9859 * is checked when the routine fails and the mutexes have to be
9860 * destroyed.
9861 */
9862 mutex_init(&pptr->port_mutex, NULL, MUTEX_DRIVER, NULL);
9863 mutex_init(&pptr->port_pkt_mutex, NULL, MUTEX_DRIVER, NULL);
9864 mutex_initted++;
9865
9866 /*
14219 } else {
14220 fpkt->pkt_tran_flags = (FC_TRAN_CLASS3 | FC_TRAN_INTR);
14221 if (cmd->cmd_pkt->pkt_flags & FLAG_IMMEDIATE_CB) {
14222 fpkt->pkt_tran_flags |= FC_TRAN_IMMEDIATE_CB;
14223 }
14224 fpkt->pkt_comp = fcp_cmd_callback;
14225 }
14226
14227 mutex_enter(&pptr->port_mutex);
14228 if (pptr->port_state & FCP_STATE_SUSPENDED) {
14229 fpkt->pkt_tran_flags |= FC_TRAN_DUMPING;
14230 }
14231 mutex_exit(&pptr->port_mutex);
14232
14233 fpkt->pkt_cmd_fhdr.d_id = ptgt->tgt_d_id;
14234 fpkt->pkt_cmd_fhdr.s_id = pptr->port_id;
14235
14236 /*
14237 * Save a few kernel cycles here
14238 */
14239 #ifndef __lock_lint
14240 fpkt->pkt_fca_device = ptgt->tgt_fca_dev;
14241 #endif /* __lock_lint */
14242 }
14243
14244 static void
14245 fcp_post_callback(struct fcp_pkt *cmd)
14246 {
14247 scsi_hba_pkt_comp(cmd->cmd_pkt);
14248 }
14249
14250
14251 /*
14252 * called to do polled I/O by fcp_start()
14253 *
14254 * return a transport status value, i.e. TRAN_ACCECPT for success
14255 */
14256 static int
14257 fcp_dopoll(struct fcp_port *pptr, struct fcp_pkt *cmd)
14258 {
14259 int rval;
14260
14261 #ifdef DEBUG
|
1035 0x00, 0x54, 0x53, 0x52, 0x51, 0x50, 0x4f, 0x00, 0x00, 0x4e,
1036 0x4d, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4b,
1037 0x00, 0x4a, 0x49, 0x48, 0x00, 0x47, 0x46, 0x45, 0x44, 0x43,
1038 0x42, 0x00, 0x00, 0x41, 0x40, 0x3f, 0x3e, 0x3d, 0x3c, 0x00,
1039 0x00, 0x3b, 0x3a, 0x00, 0x39, 0x00, 0x00, 0x00, 0x38, 0x37,
1040 0x36, 0x00, 0x35, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00,
1041 0x00, 0x00, 0x00, 0x33, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00,
1042 0x00, 0x31, 0x30, 0x00, 0x00, 0x2f, 0x00, 0x2e, 0x2d, 0x2c,
1043 0x00, 0x00, 0x00, 0x2b, 0x00, 0x2a, 0x29, 0x28, 0x00, 0x27,
1044 0x26, 0x25, 0x24, 0x23, 0x22, 0x00, 0x00, 0x21, 0x20, 0x1f,
1045 0x1e, 0x1d, 0x1c, 0x00, 0x00, 0x1b, 0x1a, 0x00, 0x19, 0x00,
1046 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x17, 0x16, 0x15,
1047 0x00, 0x14, 0x13, 0x12, 0x11, 0x10, 0x0f, 0x00, 0x00, 0x0e,
1048 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x00, 0x00, 0x08, 0x07, 0x00,
1049 0x06, 0x00, 0x00, 0x00, 0x05, 0x04, 0x03, 0x00, 0x02, 0x00,
1050 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1051 };
1052
1053 static caddr_t pid = "SESS01 ";
1054
1055 /*
1056 * This table is used to determine whether or not it's safe to copy in
1057 * the target node name for a lun. Since all luns behind the same target
1058 * have the same wwnn, only tagets that do not support multiple luns are
1059 * eligible to be enumerated under mpxio if they aren't page83 compliant.
1060 */
1061
1062 char *fcp_symmetric_disk_table[] = {
1063 "SEAGATE ST",
1064 "IBM DDYFT",
1065 "SUNW SUNWGS", /* Daktari enclosure */
1066 "SUN SENA", /* SES device */
1067 "SUN SESS01" /* VICOM SVE box */
1068 };
1069
1070 int fcp_symmetric_disk_table_size =
1071 sizeof (fcp_symmetric_disk_table)/sizeof (char *);
1072
1073 /*
1074 * This structure is bogus. scsi_hba_attach_setup() requires, as in the kernel
9792 */
9793 if ((manual_cfg = ddi_prop_get_int(DDI_DEV_T_ANY, pptr->port_dip,
9794 DDI_PROP_NOTPROM | DDI_PROP_DONTPASS,
9795 MANUAL_CFG_ONLY,
9796 -1)) != -1) {
9797 if (manual_cfg == 1) {
9798 char *pathname;
9799 pathname = kmem_zalloc(MAXPATHLEN, KM_SLEEP);
9800 (void) ddi_pathname(pptr->port_dip, pathname);
9801 cmn_err(CE_NOTE,
9802 "%s (%s%d) %s is enabled via %s.conf.",
9803 pathname,
9804 ddi_driver_name(pptr->port_dip),
9805 ddi_get_instance(pptr->port_dip),
9806 MANUAL_CFG_ONLY,
9807 ddi_driver_name(pptr->port_dip));
9808 fcp_enable_auto_configuration = 0;
9809 kmem_free(pathname, MAXPATHLEN);
9810 }
9811 }
9812 pptr->port_link_cnt = 1;
9813 pptr->port_id = s_id;
9814 pptr->port_instance = instance;
9815 pptr->port_state = FCP_STATE_INIT;
9816 if (pinfo->port_acc_attr == NULL) {
9817 /*
9818 * The corresponding FCA doesn't support DMA at all
9819 */
9820 pptr->port_state |= FCP_STATE_FCA_IS_NODMA;
9821 }
9822
9823 if (!(pptr->port_state & FCP_STATE_FCA_IS_NODMA)) {
9824 /*
9825 * If FCA supports DMA in SCSI data phase, we need preallocate
9826 * dma cookie, so stash the cookie size
9827 */
9828 pptr->port_dmacookie_sz = sizeof (ddi_dma_cookie_t) *
9829 pptr->port_data_dma_attr.dma_attr_sgllen;
9830 }
9831
9832 /*
9833 * The two mutexes of fcp_port are initialized. The variable
9834 * mutex_initted is incremented to remember that fact. That variable
9835 * is checked when the routine fails and the mutexes have to be
9836 * destroyed.
9837 */
9838 mutex_init(&pptr->port_mutex, NULL, MUTEX_DRIVER, NULL);
9839 mutex_init(&pptr->port_pkt_mutex, NULL, MUTEX_DRIVER, NULL);
9840 mutex_initted++;
9841
9842 /*
14195 } else {
14196 fpkt->pkt_tran_flags = (FC_TRAN_CLASS3 | FC_TRAN_INTR);
14197 if (cmd->cmd_pkt->pkt_flags & FLAG_IMMEDIATE_CB) {
14198 fpkt->pkt_tran_flags |= FC_TRAN_IMMEDIATE_CB;
14199 }
14200 fpkt->pkt_comp = fcp_cmd_callback;
14201 }
14202
14203 mutex_enter(&pptr->port_mutex);
14204 if (pptr->port_state & FCP_STATE_SUSPENDED) {
14205 fpkt->pkt_tran_flags |= FC_TRAN_DUMPING;
14206 }
14207 mutex_exit(&pptr->port_mutex);
14208
14209 fpkt->pkt_cmd_fhdr.d_id = ptgt->tgt_d_id;
14210 fpkt->pkt_cmd_fhdr.s_id = pptr->port_id;
14211
14212 /*
14213 * Save a few kernel cycles here
14214 */
14215 fpkt->pkt_fca_device = ptgt->tgt_fca_dev;
14216 }
14217
14218 static void
14219 fcp_post_callback(struct fcp_pkt *cmd)
14220 {
14221 scsi_hba_pkt_comp(cmd->cmd_pkt);
14222 }
14223
14224
14225 /*
14226 * called to do polled I/O by fcp_start()
14227 *
14228 * return a transport status value, i.e. TRAN_ACCECPT for success
14229 */
14230 static int
14231 fcp_dopoll(struct fcp_port *pptr, struct fcp_pkt *cmd)
14232 {
14233 int rval;
14234
14235 #ifdef DEBUG
|