2632
2633 /* Check for panic situation */
2634 cp = (CHANNEL *)sbp->channel;
2635
2636 if (ddi_in_panic()) {
2637 in_panic = 1;
2638 /*
2639 * In panic situations there will be one thread with
2640 * no interrrupts (hard or soft) and no timers
2641 */
2642
2643 /*
2644 * We must manually poll everything in this thread
2645 * to keep the driver going.
2646 */
2647
2648 /* Keep polling the chip until our IO is completed */
2649 /* Driver's timer will not function during panics. */
2650 /* Therefore, timer checks must be performed manually. */
2651 (void) drv_getparm(LBOLT, &time);
2652 timeout = time + drv_usectohz(1000000);
2653 while (!(sbp->pkt_flags & PACKET_COMPLETED)) {
2654 EMLXS_SLI_POLL_INTR(hba);
2655 (void) drv_getparm(LBOLT, &time);
2656
2657 /* Trigger timer checks periodically */
2658 if (time >= timeout) {
2659 emlxs_timer_checks(hba);
2660 timeout = time + drv_usectohz(1000000);
2661 }
2662 }
2663 } else {
2664 /* Wait for IO completion */
2665 /* The driver's timer will detect */
2666 /* any timeout and abort the I/O. */
2667 mutex_enter(&EMLXS_PKT_LOCK);
2668 while (!(sbp->pkt_flags & PACKET_COMPLETED)) {
2669 cv_wait(&EMLXS_PKT_CV, &EMLXS_PKT_LOCK);
2670 }
2671 mutex_exit(&EMLXS_PKT_LOCK);
2672 }
2673
2674 /* Check for fcp reset pkt */
2675 if (sbp->pkt_flags & PACKET_FCP_RESET) {
2676 if (sbp->pkt_flags & PACKET_FCP_TGT_RESET) {
2677 /* Flush the IO's on the chipq */
2678 (void) emlxs_chipq_node_flush(port,
2679 &hba->chan[hba->channel_fcp],
2680 sbp->node, sbp);
3747 /* Now wait for the pkt to complete */
3748 if (!(sbp->pkt_flags & PACKET_COMPLETED)) {
3749 /* Set thread timeout */
3750 pkt_timeout = emlxs_timeout(hba, 30);
3751
3752 /* Check for panic situation */
3753 if (ddi_in_panic()) {
3754
3755 /*
3756 * In panic situations there will be one thread with no
3757 * interrrupts (hard or soft) and no timers
3758 */
3759
3760 /*
3761 * We must manually poll everything in this thread
3762 * to keep the driver going.
3763 */
3764
3765 /* Keep polling the chip until our IO is completed */
3766 (void) drv_getparm(LBOLT, &time);
3767 timer = time + drv_usectohz(1000000);
3768 while ((time < pkt_timeout) &&
3769 !(sbp->pkt_flags & PACKET_COMPLETED)) {
3770 EMLXS_SLI_POLL_INTR(hba);
3771 (void) drv_getparm(LBOLT, &time);
3772
3773 /* Trigger timer checks periodically */
3774 if (time >= timer) {
3775 emlxs_timer_checks(hba);
3776 timer = time + drv_usectohz(1000000);
3777 }
3778 }
3779 } else {
3780 /* Wait for IO completion or pkt_timeout */
3781 mutex_enter(&EMLXS_PKT_LOCK);
3782 pkt_ret = 0;
3783 while ((pkt_ret != -1) &&
3784 !(sbp->pkt_flags & PACKET_COMPLETED)) {
3785 pkt_ret =
3786 cv_timedwait(&EMLXS_PKT_CV,
3787 &EMLXS_PKT_LOCK, pkt_timeout);
3788 }
3789 mutex_exit(&EMLXS_PKT_LOCK);
3790 }
3791
3792 /* Check if pkt_timeout occured. This is not good. */
3793 /* Something happened to our IO. */
3794 if (!(sbp->pkt_flags & PACKET_COMPLETED)) {
3795 /* Force the completion now */
3796 goto force_it;
4029
4030 if (cmd == EMLXS_DFC_RESET_ALL) {
4031 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sfs_debug_msg,
4032 "Resetting Adapter (All Firmware Reset).");
4033
4034 emlxs_sli4_hba_reset_all(hba, 0);
4035 } else {
4036 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sfs_debug_msg,
4037 "Resetting Adapter "
4038 "(All Firmware Reset, Force Dump).");
4039
4040 emlxs_sli4_hba_reset_all(hba, 1);
4041 }
4042
4043 mutex_enter(&EMLXS_PORT_LOCK);
4044 hba->reset_state &= ~FC_PORT_RESET_INP;
4045 hba->reset_request &= ~(FC_PORT_RESET | FC_LINK_RESET);
4046 mutex_exit(&EMLXS_PORT_LOCK);
4047
4048 /* Wait for the timer thread to detect the error condition */
4049 delay(drv_usectohz(1000000));
4050
4051 /* Wait for the HBA to re-initialize */
4052 i = 0;
4053 mutex_enter(&EMLXS_PORT_LOCK);
4054 while (!(hba->flag & FC_ONLINE_MODE) && (i++ < 30)) {
4055 mutex_exit(&EMLXS_PORT_LOCK);
4056 delay(drv_usectohz(1000000));
4057 mutex_enter(&EMLXS_PORT_LOCK);
4058 }
4059
4060 if (!(hba->flag & FC_ONLINE_MODE)) {
4061 rval = FC_FAILURE;
4062 }
4063
4064 mutex_exit(&EMLXS_PORT_LOCK);
4065
4066 return (rval);
4067
4068 default:
4069 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sfs_debug_msg,
4070 "reset: Unknown command. cmd=%x", cmd);
4071
4072 break;
4073 }
4074
4075 return (FC_FAILURE);
4076
|
2632
2633 /* Check for panic situation */
2634 cp = (CHANNEL *)sbp->channel;
2635
2636 if (ddi_in_panic()) {
2637 in_panic = 1;
2638 /*
2639 * In panic situations there will be one thread with
2640 * no interrrupts (hard or soft) and no timers
2641 */
2642
2643 /*
2644 * We must manually poll everything in this thread
2645 * to keep the driver going.
2646 */
2647
2648 /* Keep polling the chip until our IO is completed */
2649 /* Driver's timer will not function during panics. */
2650 /* Therefore, timer checks must be performed manually. */
2651 (void) drv_getparm(LBOLT, &time);
2652 timeout = time + drv_sectohz(1);
2653 while (!(sbp->pkt_flags & PACKET_COMPLETED)) {
2654 EMLXS_SLI_POLL_INTR(hba);
2655 (void) drv_getparm(LBOLT, &time);
2656
2657 /* Trigger timer checks periodically */
2658 if (time >= timeout) {
2659 emlxs_timer_checks(hba);
2660 timeout = time + drv_sectohz(1);
2661 }
2662 }
2663 } else {
2664 /* Wait for IO completion */
2665 /* The driver's timer will detect */
2666 /* any timeout and abort the I/O. */
2667 mutex_enter(&EMLXS_PKT_LOCK);
2668 while (!(sbp->pkt_flags & PACKET_COMPLETED)) {
2669 cv_wait(&EMLXS_PKT_CV, &EMLXS_PKT_LOCK);
2670 }
2671 mutex_exit(&EMLXS_PKT_LOCK);
2672 }
2673
2674 /* Check for fcp reset pkt */
2675 if (sbp->pkt_flags & PACKET_FCP_RESET) {
2676 if (sbp->pkt_flags & PACKET_FCP_TGT_RESET) {
2677 /* Flush the IO's on the chipq */
2678 (void) emlxs_chipq_node_flush(port,
2679 &hba->chan[hba->channel_fcp],
2680 sbp->node, sbp);
3747 /* Now wait for the pkt to complete */
3748 if (!(sbp->pkt_flags & PACKET_COMPLETED)) {
3749 /* Set thread timeout */
3750 pkt_timeout = emlxs_timeout(hba, 30);
3751
3752 /* Check for panic situation */
3753 if (ddi_in_panic()) {
3754
3755 /*
3756 * In panic situations there will be one thread with no
3757 * interrrupts (hard or soft) and no timers
3758 */
3759
3760 /*
3761 * We must manually poll everything in this thread
3762 * to keep the driver going.
3763 */
3764
3765 /* Keep polling the chip until our IO is completed */
3766 (void) drv_getparm(LBOLT, &time);
3767 timer = time + drv_sectohz(1);
3768 while ((time < pkt_timeout) &&
3769 !(sbp->pkt_flags & PACKET_COMPLETED)) {
3770 EMLXS_SLI_POLL_INTR(hba);
3771 (void) drv_getparm(LBOLT, &time);
3772
3773 /* Trigger timer checks periodically */
3774 if (time >= timer) {
3775 emlxs_timer_checks(hba);
3776 timer = time + drv_sectohz(1);
3777 }
3778 }
3779 } else {
3780 /* Wait for IO completion or pkt_timeout */
3781 mutex_enter(&EMLXS_PKT_LOCK);
3782 pkt_ret = 0;
3783 while ((pkt_ret != -1) &&
3784 !(sbp->pkt_flags & PACKET_COMPLETED)) {
3785 pkt_ret =
3786 cv_timedwait(&EMLXS_PKT_CV,
3787 &EMLXS_PKT_LOCK, pkt_timeout);
3788 }
3789 mutex_exit(&EMLXS_PKT_LOCK);
3790 }
3791
3792 /* Check if pkt_timeout occured. This is not good. */
3793 /* Something happened to our IO. */
3794 if (!(sbp->pkt_flags & PACKET_COMPLETED)) {
3795 /* Force the completion now */
3796 goto force_it;
4029
4030 if (cmd == EMLXS_DFC_RESET_ALL) {
4031 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sfs_debug_msg,
4032 "Resetting Adapter (All Firmware Reset).");
4033
4034 emlxs_sli4_hba_reset_all(hba, 0);
4035 } else {
4036 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sfs_debug_msg,
4037 "Resetting Adapter "
4038 "(All Firmware Reset, Force Dump).");
4039
4040 emlxs_sli4_hba_reset_all(hba, 1);
4041 }
4042
4043 mutex_enter(&EMLXS_PORT_LOCK);
4044 hba->reset_state &= ~FC_PORT_RESET_INP;
4045 hba->reset_request &= ~(FC_PORT_RESET | FC_LINK_RESET);
4046 mutex_exit(&EMLXS_PORT_LOCK);
4047
4048 /* Wait for the timer thread to detect the error condition */
4049 delay(drv_sectohz(1));
4050
4051 /* Wait for the HBA to re-initialize */
4052 i = 0;
4053 mutex_enter(&EMLXS_PORT_LOCK);
4054 while (!(hba->flag & FC_ONLINE_MODE) && (i++ < 30)) {
4055 mutex_exit(&EMLXS_PORT_LOCK);
4056 delay(drv_sectohz(1));
4057 mutex_enter(&EMLXS_PORT_LOCK);
4058 }
4059
4060 if (!(hba->flag & FC_ONLINE_MODE)) {
4061 rval = FC_FAILURE;
4062 }
4063
4064 mutex_exit(&EMLXS_PORT_LOCK);
4065
4066 return (rval);
4067
4068 default:
4069 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sfs_debug_msg,
4070 "reset: Unknown command. cmd=%x", cmd);
4071
4072 break;
4073 }
4074
4075 return (FC_FAILURE);
4076
|