1081
1087
/* Halt all the indiviual PEGs and other blocks of the ISP */
1082
1088
qla82xx_rom_lock(ha);
1084
/* mask all niu interrupts */
1090
/* disable all I2Q */
1091
qla82xx_wr_32(ha, QLA82XX_CRB_I2Q + 0x10, 0x0);
1092
qla82xx_wr_32(ha, QLA82XX_CRB_I2Q + 0x14, 0x0);
1093
qla82xx_wr_32(ha, QLA82XX_CRB_I2Q + 0x18, 0x0);
1094
qla82xx_wr_32(ha, QLA82XX_CRB_I2Q + 0x1c, 0x0);
1095
qla82xx_wr_32(ha, QLA82XX_CRB_I2Q + 0x20, 0x0);
1096
qla82xx_wr_32(ha, QLA82XX_CRB_I2Q + 0x24, 0x0);
1098
/* disable all niu interrupts */
1085
1099
qla82xx_wr_32(ha, QLA82XX_CRB_NIU + 0x40, 0xff);
1086
1100
/* disable xge rx/tx */
1087
1101
qla82xx_wr_32(ha, QLA82XX_CRB_NIU + 0x70000, 0x00);
1088
1102
/* disable xg1 rx/tx */
1089
1103
qla82xx_wr_32(ha, QLA82XX_CRB_NIU + 0x80000, 0x00);
1104
/* disable sideband mac */
1105
qla82xx_wr_32(ha, QLA82XX_CRB_NIU + 0x90000, 0x00);
1106
/* disable ap0 mac */
1107
qla82xx_wr_32(ha, QLA82XX_CRB_NIU + 0xa0000, 0x00);
1108
/* disable ap1 mac */
1109
qla82xx_wr_32(ha, QLA82XX_CRB_NIU + 0xb0000, 0x00);
1092
1112
val = qla82xx_rd_32(ha, QLA82XX_CRB_SRE + 0x1000);
1101
1121
qla82xx_wr_32(ha, QLA82XX_CRB_TIMER + 0x10, 0x0);
1102
1122
qla82xx_wr_32(ha, QLA82XX_CRB_TIMER + 0x18, 0x0);
1103
1123
qla82xx_wr_32(ha, QLA82XX_CRB_TIMER + 0x100, 0x0);
1124
qla82xx_wr_32(ha, QLA82XX_CRB_TIMER + 0x200, 0x0);
1105
1126
/* halt pegs */
1106
1127
qla82xx_wr_32(ha, QLA82XX_CRB_PEG_NET_0 + 0x3c, 1);
1108
1129
qla82xx_wr_32(ha, QLA82XX_CRB_PEG_NET_2 + 0x3c, 1);
1109
1130
qla82xx_wr_32(ha, QLA82XX_CRB_PEG_NET_3 + 0x3c, 1);
1110
1131
qla82xx_wr_32(ha, QLA82XX_CRB_PEG_NET_4 + 0x3c, 1);
1112
1134
/* big hammer */
1114
1135
if (test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags))
1115
1136
/* don't reset CAM block on reset */
1116
1137
qla82xx_wr_32(ha, QLA82XX_ROMUSB_GLB_SW_RESET, 0xfeffffff);
1129
1150
qla82xx_wr_32(ha, QLA82XX_CRB_QDR_NET + 0xe4, val);
1132
qla82xx_rd_32(ha, QLA82XX_PCIE_REG(PCIE_SEM2_UNLOCK));
1153
qla82xx_rom_unlock(ha);
1134
1155
/* Read the signature value from the flash.
1135
1156
* Offset 0: Contain signature (0xcafecafe)
2396
2417
if (qla82xx_fw_load_from_flash(ha) == QLA_SUCCESS) {
2397
2418
qla_printk(KERN_ERR, ha,
2398
"Firmware loaded successfully from flash\n");
2419
"Firmware loaded successfully from flash\n");
2399
2420
return QLA_SUCCESS;
2422
qla_printk(KERN_ERR, ha,
2423
"Firmware load from flash failed\n");
2402
2427
qla_printk(KERN_INFO, ha,
2403
2428
"Attempting to load firmware from blob\n");
3020
3045
if (qla82xx_write_disable_flash(ha) != 0)
3021
3046
qla_printk(KERN_WARNING, ha, "Write disable failed\n");
3023
qla82xx_rd_32(ha, QLA82XX_PCIE_REG(PCIE_SEM2_UNLOCK));
3048
qla82xx_rom_unlock(ha);
3528
3553
qla82xx_device_state_handler(scsi_qla_host_t *vha)
3530
3555
uint32_t dev_state;
3556
uint32_t old_dev_state;
3531
3557
int rval = QLA_SUCCESS;
3532
3558
unsigned long dev_init_timeout;
3533
3559
struct qla_hw_data *ha = vha->hw;
3535
3562
qla82xx_idc_lock(ha);
3536
3563
if (!vha->flags.init_done)
3537
3564
qla82xx_set_drv_active(vha);
3539
3566
dev_state = qla82xx_rd_32(ha, QLA82XX_CRB_DEV_STATE);
3567
old_dev_state = dev_state;
3540
3568
qla_printk(KERN_INFO, ha, "1:Device state is 0x%x = %s\n", dev_state,
3541
3569
dev_state < MAX_STATES ? qdev_state[dev_state] : "Unknown");
3555
3583
dev_state = qla82xx_rd_32(ha, QLA82XX_CRB_DEV_STATE);
3556
qla_printk(KERN_INFO, ha,
3557
"2:Device state is 0x%x = %s\n", dev_state,
3558
dev_state < MAX_STATES ?
3559
qdev_state[dev_state] : "Unknown");
3584
if (old_dev_state != dev_state) {
3586
old_dev_state = dev_state;
3588
if (loopcount < 5) {
3589
qla_printk(KERN_INFO, ha,
3590
"2:Device state is 0x%x = %s\n", dev_state,
3591
dev_state < MAX_STATES ?
3592
qdev_state[dev_state] : "Unknown");
3561
3595
switch (dev_state) {
3562
3596
case QLA82XX_DEV_READY:
3621
3657
if (dev_state == QLA82XX_DEV_NEED_RESET &&
3622
3658
!test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags)) {
3623
3659
qla_printk(KERN_WARNING, ha,
3624
"%s(): Adapter reset needed!\n", __func__);
3660
"scsi(%ld) %s: Adapter reset needed!\n",
3661
vha->host_no, __func__);
3625
3662
set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags);
3626
3663
qla2xxx_wake_dpc(vha);
3627
3664
} else if (dev_state == QLA82XX_DEV_NEED_QUIESCENT &&
3632
3669
set_bit(ISP_QUIESCE_NEEDED, &vha->dpc_flags);
3633
3670
qla2xxx_wake_dpc(vha);
3635
qla82xx_check_fw_alive(vha);
3636
3672
if (qla82xx_check_fw_alive(vha)) {
3637
3673
halt_status = qla82xx_rd_32(ha,
3638
3674
QLA82XX_PEG_HALT_STATUS1);
3675
qla_printk(KERN_INFO, ha,
3676
"scsi(%ld): %s, Dumping hw/fw registers:\n "
3677
" PEG_HALT_STATUS1: 0x%x, PEG_HALT_STATUS2: 0x%x,\n "
3678
" PEG_NET_0_PC: 0x%x, PEG_NET_1_PC: 0x%x,\n "
3679
" PEG_NET_2_PC: 0x%x, PEG_NET_3_PC: 0x%x,\n "
3680
" PEG_NET_4_PC: 0x%x\n",
3681
vha->host_no, __func__, halt_status,
3682
qla82xx_rd_32(ha, QLA82XX_PEG_HALT_STATUS2),
3684
QLA82XX_CRB_PEG_NET_0 + 0x3c),
3686
QLA82XX_CRB_PEG_NET_1 + 0x3c),
3688
QLA82XX_CRB_PEG_NET_2 + 0x3c),
3690
QLA82XX_CRB_PEG_NET_3 + 0x3c),
3692
QLA82XX_CRB_PEG_NET_4 + 0x3c));
3639
3693
if (halt_status & HALT_STATUS_UNRECOVERABLE) {
3640
3694
set_bit(ISP_UNRECOVERABLE,
3641
3695
&vha->dpc_flags);
3651
3705
if (ha->flags.mbox_busy) {
3652
3706
ha->flags.mbox_int = 1;
3653
3707
DEBUG2(qla_printk(KERN_ERR, ha,
3654
"Due to fw hung, doing premature "
3655
"completion of mbx command\n"));
3708
"scsi(%ld) Due to fw hung, doing "
3709
"premature completion of mbx "
3710
"command\n", vha->host_no));
3656
3711
if (test_bit(MBX_INTR_WAIT,
3657
3712
&ha->mbx_cmd_flags))
3658
3713
complete(&ha->mbx_intr_comp);