11 #include <linux/slab.h>
42 static int qla25xx_init_queues(
struct qla_hw_data *);
62 spin_unlock_irqrestore(&ha->hardware_lock, flags);
99 qla2x00_async_iocb_timeout(
void *
data)
105 "Async-%s timeout - hdl=%x portid=%02x%02x%02x.\n",
107 fcport->
d_id.
b.al_pa);
123 qla2x00_async_login_sp_done(
void *data,
void *
ptr,
int res)
153 lio->
timeout = qla2x00_async_iocb_timeout;
154 sp->
done = qla2x00_async_login_sp_done;
163 "Async-login - hdl=%x, loopid=%x portid=%02x%02x%02x "
176 qla2x00_async_logout_sp_done(
void *data,
void *ptr,
int res)
205 lio->
timeout = qla2x00_async_iocb_timeout;
206 sp->
done = qla2x00_async_logout_sp_done;
212 "Async-logout - hdl=%x loop-id=%x portid=%02x%02x%02x.\n",
224 qla2x00_async_adisc_sp_done(
void *data,
void *ptr,
int res)
254 lio->
timeout = qla2x00_async_iocb_timeout;
255 sp->
done = qla2x00_async_adisc_sp_done;
263 "Async-adisc - hdl=%x loopid=%x portid=%02x%02x%02x.\n",
275 qla2x00_async_tm_cmd_done(
void *data,
void *ptr,
int res)
285 flags = iocb->
u.
tmf.flags;
290 vha->
hw->rsp_q_map[0], sp->
fcport->loop_id, lun,
295 "TM IOCB failed (%x).\n", rval);
320 tcf->
u.
tmf.flags = tm_flags;
323 tcf->
timeout = qla2x00_async_iocb_timeout;
324 sp->
done = qla2x00_async_tm_cmd_done;
331 "Async-tmf hdl=%x loop-id=%x portid=%02x%02x%02x.\n",
437 uint32_t idc_major_ver, idc_minor_ver;
451 "Error while setting DRV-Presence.\n");
466 if (ha->
flags.nic_core_reset_owner) {
479 "Failing load, idc_major_ver=%d, expected_major_ver=%d.\n",
490 if (ha->
flags.nic_core_reset_owner) {
491 memset(config, 0,
sizeof(config));
523 vha->
flags.online = 0;
524 ha->
flags.chip_reset_done = 0;
525 vha->
flags.reset_active = 0;
526 ha->
flags.pci_channel_io_perm_failure = 0;
527 ha->
flags.eeh_busy = 0;
528 ha->
flags.thermal_supported = 1;
533 vha->
flags.management_server_logged_in = 0;
542 "Configuring PCI space...\n");
543 rval = ha->
isp_ops->pci_config(vha);
546 "Unable to configure PCI space.\n");
555 "Unable to validate FLASH data.\n");
561 "Configure NVRAM parameters...\n");
563 ha->
isp_ops->nvram_config(vha);
565 if (ha->
flags.disable_serdes) {
569 "%02x%02x%02x%02x%02x%02x%02x%02x (via NVRAM).\n",
578 "Verifying loaded RISC code...\n");
581 rval = ha->
isp_ops->chip_diag(vha);
584 rval = qla2x00_setup_chip(vha);
590 ha->
cs84xx = qla84xx_get_chip(vha);
593 "Unable to configure ISP84XX.\n");
598 if (qla_ini_mode_enabled(vha))
599 rval = qla2x00_init_rings(vha);
601 ha->
flags.chip_reset_done = 1;
605 rval = qla84xx_init_chip(vha);
608 "Unable to initialize ISP84XX.\n");
618 "Error in initializing NIC Core f/w.\n");
653 spin_unlock_irqrestore(&ha->hardware_lock, flags);
668 unsigned long flags = 0;
695 for (cnt = 0; cnt < 30000; cnt++) {
718 for (cnt = 0; cnt < 30000; cnt++) {
725 spin_unlock_irqrestore(&ha->hardware_lock, flags);
735 spin_unlock_irqrestore(&ha->hardware_lock, flags);
750 unsigned long flags = 0;
769 if (pci_is_pcie(ha->
pdev))
779 spin_unlock_irqrestore(&ha->hardware_lock, flags);
805 if (pci_is_pcie(ha->
pdev))
832 if (ha->
flags.disable_risc_code_load) {
840 &area, &domain, &topo, &sw_cap);
846 "**** Load RISC code ****.\n");
860 unsigned long flags = 0;
869 ha->
isp_ops->disable_intrs(ha);
883 for (cnt = 0; cnt < 30000; cnt++) {
920 for (cnt = 0; cnt < 3000; cnt++) {
954 for (cnt = 30000;
cnt; cnt--) {
973 for (cnt = 0; cnt < 30000; cnt++) {
992 spin_unlock_irqrestore(&ha->hardware_lock, flags);
1020 unsigned long flags = 0;
1025 static int abts_cnt;
1031 for (cnt = 0; cnt < 30000; cnt++) {
1045 for (cnt = 10000 ; cnt &&
d2; cnt--) {
1062 if (++abts_cnt < 5) {
1071 vha->
flags.online = 0;
1086 for (cnt = 6000000 ; cnt &&
d2; cnt--) {
1092 spin_unlock_irqrestore(&ha->hardware_lock, flags);
1095 ha->
isp_ops->enable_intrs(ha);
1109 if (pci_channel_offline(ha->
pdev) &&
1110 ha->
flags.pci_channel_io_perm_failure) {
1114 ha->
isp_ops->disable_intrs(ha);
1117 qla24xx_reset_risc(vha);
1132 unsigned long flags = 0;
1154 data = qla2x00_debounce_register(®->
ctrl_status);
1162 goto chip_diag_failed;
1165 "Reset register cleared by chip reset.\n");
1173 data = qla2x00_debounce_register(
MAILBOX_REG(ha, reg, 0));
1174 for (cnt = 6000000; cnt && (data ==
MBS_BUSY); cnt--) {
1183 goto chip_diag_failed;
1191 mb[4] = qla2x00_debounce_register(
MAILBOX_REG(ha, reg, 4));
1195 "Wrong product ID = 0x%x,0x%x,0x%x.\n",
1196 mb[1], mb[2], mb[3]);
1198 goto chip_diag_failed;
1222 spin_unlock_irqrestore(&ha->hardware_lock, flags);
1228 "Failed mailbox send register test.\n");
1237 "Chip diagnostics **** FAILED ****.\n");
1239 spin_unlock_irqrestore(&ha->hardware_lock, flags);
1265 "Failed mailbox send register test.\n");
1279 eft_size, fce_size, mq_size;
1288 "Firmware dump already allocated.\n");
1293 fixed_size = mem_size = eft_size = fce_size = mq_size = 0;
1323 if (ha->
tgt.atio_q_length)
1333 "Unable to allocate (%d KB) for FCE.\n",
1343 "Unable to initialize FCE (%d).\n", rval);
1346 ha->
flags.fce_enabled = 0;
1350 "Allocate (%d KB) for FCE...\n",
FCE_SIZE / 1024);
1353 ha->
flags.fce_enabled = 1;
1362 "Unable to allocate (%d KB) for EFT.\n",
1371 "Unable to initialize EFT (%d).\n", rval);
1377 "Allocated (%d KB) EFT ...\n",
EFT_SIZE / 1024);
1388 dump_size += fixed_size + mem_size + req_q_size + rsp_q_size + eft_size;
1390 dump_size += mq_size + fce_size;
1395 "Unable to allocate (%d KB) for firmware dump.\n",
1414 "Allocated (%d KB) for firmware dump.\n", dump_size / 1024);
1417 ha->
fw_dump->signature[0] =
'Q';
1418 ha->
fw_dump->signature[1] =
'L';
1419 ha->
fw_dump->signature[2] =
'G';
1420 ha->
fw_dump->signature[3] =
'C';
1439 #define MPS_MASK 0xe0
1450 "Unable to acquire semaphore.\n");
1454 pci_read_config_word(vha->
hw->pdev, 0x54, &dc);
1462 if (dc == (dw & MPS_MASK))
1476 "Unable to release semaphore.\n");
1496 unsigned long flags;
1500 rval = ha->
isp_ops->load_risc(vha, &srisc_address);
1503 goto enable_82xx_npiv;
1513 spin_unlock_irqrestore(&ha->hardware_lock, flags);
1516 qla81xx_mpi_sync(vha);
1519 rval = ha->
isp_ops->load_risc(vha, &srisc_address);
1522 "Verifying Checksum of loaded RISC code.\n");
1528 "Starting firmware.\n");
1541 ha->
flags.npiv_supported = 0;
1544 ha->
flags.npiv_supported = 1;
1561 "ISP Firmware failed checksum.\n");
1577 spin_unlock_irqrestore(&ha->hardware_lock, flags);
1581 goto skip_fac_check;
1588 ha->
flags.fac_supported = 1;
1592 "Unsupported FAC firmware (%d.%02d.%02d).\n",
1597 ha->
flags.fac_supported = 0;
1605 "Setup chip ****FAILED****.\n");
1630 for (cnt = 0; cnt < rsp->
length; cnt++) {
1645 uint16_t swing, emphasis, tx_sens, rx_sens;
1656 "Serial link options.\n");
1673 ha->
fw_options[10] = (emphasis << 14) | (swing << 8);
1677 ha->
fw_options[10] |= (tx_sens << 4) | rx_sens;
1691 ha->
fw_options[11] = (emphasis << 14) | (swing << 8);
1695 ha->
fw_options[11] |= (tx_sens << 4) | rx_sens;
1707 if (ha->
flags.enable_led_scheme)
1737 "Unable to update Serial Link options (%x).\n", rval);
1798 if (ha->
flags.msix_enabled) {
1801 "Registering vector 0x%x for base que.\n",
1816 (ha->
flags.msix_enabled)) {
1819 ha->
flags.disable_msix_handshake = 1;
1821 "MSIX Handshake Disable Mode turned on.\n");
1857 unsigned long flags = 0;
1895 ha->
tgt.atio_ring_ptr = ha->
tgt.atio_ring;
1896 ha->
tgt.atio_ring_index = 0;
1900 ha->
isp_ops->config_rings(vha);
1902 spin_unlock_irqrestore(&ha->hardware_lock, flags);
1905 ha->
isp_ops->update_fw_options(vha);
1909 if (ha->
flags.npiv_supported) {
1917 mid_init_cb->
init_cb.execution_throttle =
1924 "Init Firmware **** FAILED ****.\n");
1927 "Init Firmware -- success.\n");
1943 unsigned long wtime,
mtime, cs84xx_time;
1959 wait_time = min_wait;
1969 if (!vha->
flags.init_done)
1971 "Waiting for LIP to complete.\n");
1981 "fw_state=%x 84xx=%x.\n", state[0],
1986 "Sending verify iocb.\n");
1989 rval = qla84xx_init_chip(vha);
1993 "Init chip failed.\n");
1998 cs84xx_time =
jiffies - cs84xx_time;
1999 wtime += cs84xx_time;
2000 mtime += cs84xx_time;
2002 "Increasing wait time by %ld. "
2003 "New time %ld.\n", cs84xx_time,
2008 "F/W Ready - OK.\n");
2026 "Cable is unplugged...\n");
2035 ha->
flags.isp82xx_fw_hung)
2047 "fw_state=%x (%x, %x, %x, %x) " "curr time=%lx.\n", state[0],
2048 state[1], state[2], state[3], state[4], jiffies);
2052 "Firmware ready **** FAILED ****.\n");
2081 char connect_type[22];
2083 unsigned long flags;
2087 &loop_id, &al_pa, &area, &domain, &topo, &sw_cap);
2093 "Loop is in a transition state.\n");
2096 "Unable to get host loop ID.\n");
2104 "Cannot get topology - retrying.\n");
2119 strcpy(connect_type,
"(Loop)");
2126 strcpy(connect_type,
"(FL_Port)");
2133 strcpy(connect_type,
"(N_Port-to-N_Port)");
2141 strcpy(connect_type,
"(F_Port)");
2146 "HBA in unknown topology %x, using NL.\n", topo);
2148 strcpy(connect_type,
"(Loop)");
2154 vha->
d_id.
b.domain = domain;
2155 vha->
d_id.
b.area = area;
2156 vha->
d_id.
b.al_pa = al_pa;
2162 if (!vha->
flags.init_done)
2164 "Topology - %s, Host Loop address 0x%x.\n",
2169 "%s FAILED\n", __func__);
2172 "%s success\n", __func__);
2193 if (*en != 0x20 && *en != 0x00)
2198 index = (ha->
pdev->subsystem_device & 0xff);
2203 qla2x00_model_name[index * 2 + 1],
2206 index = (ha->
pdev->subsystem_device & 0xff);
2211 qla2x00_model_name[index * 2]);
2213 qla2x00_model_name[index * 2 + 1],
2283 for (cnt = 0, chksum = 0; cnt < ha->
nvram_size; cnt++)
2287 "Contents of NVRAM.\n");
2292 if (chksum || nv->
id[0] !=
'I' || nv->
id[1] !=
'S' ||
2296 "Inconsistent NVRAM "
2297 "detected: checksum=0x%x id=%c version=0x%x.\n",
2301 "functioning (yet invalid -- WWPN) defaults.\n");
2337 qla2xxx_nvram_wwn_from_ofw(vha, nv);
2353 #if defined(CONFIG_IA64_GENERIC) || defined(CONFIG_IA64_SGI_SN2)
2418 *dptr1++ = *dptr2++;
2424 *dptr1++ = *dptr2++;
2455 ha->
flags.disable_risc_code_load = 0;
2460 ha->
flags.disable_serdes = 0;
2541 vha->
flags.process_response_queue = 1;
2544 if (!vha->
flags.init_done) {
2552 vha->
flags.process_response_queue = 0;
2557 "ZIO mode %d enabled; timer delay (%d us).\n",
2562 vha->
flags.process_response_queue = 1;
2568 "NVRAM configuration failed.\n");
2574 qla2x00_rport_del(
void *data)
2579 unsigned long flags;
2584 spin_unlock_irqrestore(fcport->
vha->host->host_lock, flags);
2607 fcport = kzalloc(
sizeof(
fc_port_t), flags);
2638 unsigned long flags, save_flags;
2644 rval = qla2x00_configure_hba(vha);
2647 "Unable to configure HBA.\n");
2654 "Configure loop -- dpc flags = 0x%lx.\n", flags);
2680 }
else if (!vha->
flags.online ||
2690 "Loop resync needed, failing.\n");
2693 rval = qla2x00_configure_local_loop(vha);
2699 "Needs RSCN update and loop transition.\n");
2703 rval = qla2x00_configure_fabric(vha);
2719 "%s *** FAILED ***.\n", __func__);
2722 "%s: exiting normally.\n", __func__);
2773 goto cleanup_allocation;
2776 "Entries in ID list (%d).\n", entries);
2783 if (new_fcport ==
NULL) {
2785 "Memory allocation failed for fcport.\n");
2787 goto cleanup_allocation;
2800 "Marking port lost loop_id=0x%04x.\n",
2822 if ((domain & 0xf0) == 0xf0)
2826 if (area && domain &&
2827 (area != vha->
d_id.
b.area || domain != vha->
d_id.
b.domain))
2844 "Failed to retrieve fcport information "
2845 "-- get_port_database=%x, loop_id=0x%04x.\n",
2848 "Scheduling resync.\n");
2877 fcport = new_fcport;
2879 if (new_fcport ==
NULL) {
2881 "Failed to allocate memory for fcport.\n");
2883 goto cleanup_allocation;
2901 "Configure local loop error exit: rval=%x.\n", rval);
2929 "Unable to adjust iIDMA "
2930 "%02x%02x%02x%02x%02x%02x%02x%02x -- %04x %x %04x "
2939 "iIDMA adjusted to %s GB/s "
2940 "on %02x%02x%02x%02x%02x%02x%02x%02x.\n", link_speed,
2953 unsigned long flags;
2955 qla2x00_rport_del(fcport);
2957 rport_ids.node_name = wwn_to_u64(fcport->
node_name);
2958 rport_ids.port_name = wwn_to_u64(fcport->
port_name);
2959 rport_ids.port_id = fcport->
d_id.
b.domain << 16 |
2960 fcport->
d_id.
b.area << 8 | fcport->
d_id.
b.al_pa;
2965 "Unable to allocate fc remote port.\n");
2976 spin_unlock_irqrestore(fcport->
vha->host->host_lock, flags);
3010 qla2x00_iidma_fcport(vha, fcport);
3012 qla2x00_reg_remote_port(vha, fcport);
3013 qla2x00_set_fcport_state(fcport,
FCS_ONLINE);
3047 "MBX_GET_PORT_NAME failed, No FL Port.\n");
3065 rval = ha->
isp_ops->fabric_login(vha, loop_id, 0xff, 0xff,
3073 "Failed SNS login: loop_id=%x mb[0]=%x mb[1]=%x mb[2]=%x "
3074 "mb[6]=%x mb[7]=%x.\n", loop_id, mb[0], mb[1],
3075 mb[2], mb[6], mb[7]);
3083 "Register FC-4 TYPE failed.\n");
3088 "Register FC-4 Features failed.\n");
3093 "Register Node Name failed.\n");
3097 "Register Symobilic Node Name failed.\n");
3101 rval = qla2x00_find_all_fabric_devs(vha, &new_fcports);
3106 list_splice_tail_init(&new_fcports, &vha->
vp_fcports);
3127 ha->
isp_ops->fabric_logout(vha,
3129 fcport->
d_id.
b.domain,
3130 fcport->
d_id.
b.area,
3131 fcport->
d_id.
b.al_pa);
3141 fcport->
loop_id = next_loopid;
3152 qla2x00_fabric_dev_login(vha, fcport, &next_loopid);
3158 "Configure fabric error exit rval=%d.\n", rval);
3183 fc_port_t *fcport, *new_fcport, *fcptemp;
3188 int first_dev, last_dev;
3204 "GID_PT allocations failed, fallback on GA_NXT.\n");
3226 if (new_fcport ==
NULL) {
3228 "Failed to allocate memory for fcport.\n");
3239 if (qla2x00_is_reserved_id(vha, loop_id))
3265 if (swl[swl_idx].
d_id.b.rsvd_1 != 0) {
3275 "SNS scan failed -- assuming "
3276 "zero-entry result.\n");
3278 new_fcports,
list) {
3291 }
else if (new_fcport->
d_id.
b24 == wrap.
b24) {
3293 "Device wrap (%02x%02x%02x).\n",
3294 new_fcport->
d_id.
b.domain,
3295 new_fcport->
d_id.
b.area,
3296 new_fcport->
d_id.
b.al_pa);
3307 unsigned long flags;
3323 if (((new_fcport->
d_id.
b24 & 0xffff00) ==
3329 if ((new_fcport->
d_id.
b.domain & 0xf0) == 0xf0)
3368 qla2x00_clear_loop_id(fcport);
3388 fcport->
d_id.
b.al_pa);
3389 qla2x00_clear_loop_id(fcport);
3401 nxt_d_id.b24 = new_fcport->
d_id.
b24;
3403 if (new_fcport ==
NULL) {
3405 "Memory allocation failed for fcport.\n");
3409 new_fcport->
d_id.
b24 = nxt_d_id.b24;
3436 unsigned long flags = 0;
3445 qla2x00_is_reserved_id(vha, dev->
loop_id)) {
3455 "Assigning new loopid=%x, portid=%x.\n",
3459 "No loop_id's available, portid=%x.\n",
3513 fcport->
d_id.
b.al_pa);
3555 "Trying Fabric Login w/loop id 0x%04x for port "
3580 "Fabric Login: port in use - next loop "
3581 "id=0x%04x, port id= %02x%02x%02x.\n",
3591 *next_loopid = tmp_loopid;
3597 *next_loopid = (fcport->
loop_id + 1);
3600 if (mb[1] &
BIT_0) {
3604 if (mb[1] &
BIT_1) {
3638 *next_loopid = fcport->
loop_id;
3641 fcport->
d_id.
b.al_pa);
3651 "Failed=%x port_id=%02x%02x%02x loop_id=%x "
3652 "jiffies=%lx.\n", mb[0], fcport->
d_id.
b.domain,
3656 *next_loopid = fcport->
loop_id;
3659 fcport->
d_id.
b.al_pa);
3660 qla2x00_clear_loop_id(fcport);
3690 memset(mb, 0,
sizeof(mb));
3722 if (vha->
hw->flags.cpu_affinity_enabled)
3723 req = vha->
hw->req_q_map[0];
3729 if (vha->
flags.online) {
3730 if (!(rval = qla2x00_fw_ready(vha))) {
3742 qla2x00_configure_loop(vha);
3756 "%s *** FAILED ***.\n", __func__);
3798 unsigned long flags;
3809 qla2x00_rport_del(fcport);
3824 uint32_t drv_presence, drv_presence_mask;
3825 uint32_t dev_part_info1, dev_part_info2, class_type;
3827 uint16_t fcoe_other_function = 0xffff,
i;
3833 for (
i = 0;
i < 8;
i++) {
3834 class_type = ((dev_part_info1 >> (
i * 4)) & class_type_mask);
3837 fcoe_other_function =
i;
3841 if (fcoe_other_function == 0xffff) {
3842 for (
i = 0;
i < 8;
i++) {
3843 class_type = ((dev_part_info2 >> (
i * 4)) &
3847 fcoe_other_function =
i + 8;
3856 drv_presence_mask = ~((1 << (ha->
portnum)) |
3857 ((fcoe_other_function == 0xffff) ?
3858 0 : (1 << (fcoe_other_function))));
3863 if (!(drv_presence & drv_presence_mask) &&
3864 (ha->
portnum < fcoe_other_function)) {
3866 "This host is Reset owner.\n");
3867 ha->
flags.nic_core_reset_owner = 1;
3880 drv_ack |= (1 << ha->
portnum);
3908 drv_ack &= ~(1 << ha->
portnum);
3930 switch (dev_state) {
3932 return "COLD/RE-INIT";
3934 return "INITIALIZING";
3938 return "NEED RESET";
3940 return "NEED QUIESCENT";
3955 uint32_t idc_audit_reg = 0, duration_secs = 0;
3957 switch (audit_type) {
3960 idc_audit_reg = (ha->
portnum) |
3968 idc_audit_reg = (ha->
portnum) |
3975 "Invalid audit type specified.\n");
3990 "NIC Core reset has been disabled. idc-control=0x%x\n",
4065 if (drv_presence & (1 << ha->
portnum))
4078 "Entered %s().\n", __func__);
4082 "Device in unrecoverable FAILED state.\n");
4090 "Function=0x%x has been removed from IDC participation.\n",
4108 ha->
flags.nic_core_hung = 0;
4129 "This board is not MCTP capable\n");
4139 "Failed to allocate memory for mctp dump\n");
4144 #define MCTP_DUMP_STR_ADDR 0x00000000
4149 "Failed to capture mctp dump\n");
4152 "Mctp dump capture for host (%ld/%p).\n",
4157 if (!ha->
flags.nic_core_reset_hdlr_active && !ha->
portnum) {
4158 ha->
flags.nic_core_reset_hdlr_active = 1;
4163 "Failed to restart nic firmware\n");
4166 "Restarted NIC firmware successfully.\n");
4167 ha->
flags.nic_core_reset_hdlr_active = 0;
4189 "Quiescing I/O - ha=%p.\n", ha);
4211 unsigned long flags;
4218 vha->
flags.online = 0;
4219 ha->
flags.chip_reset_done = 0;
4224 "Performing ISP error recovery - ha=%p.\n", ha);
4271 if (!ha->
flags.eeh_busy) {
4276 "Done chip reset cleanup.\n");
4281 vha->
flags.online = 0;
4307 unsigned long flags;
4309 if (vha->
flags.online) {
4314 "Clearing fcoe driver presence.\n");
4317 "Error while clearing DRV-Presence.\n");
4321 ha->
flags.pci_channel_io_perm_failure)) {
4329 ha->
isp_ops->nvram_config(vha);
4331 if (!qla2x00_restart_isp(vha)) {
4342 vha->
flags.online = 1;
4344 ha->
isp_ops->enable_intrs(ha);
4352 ha->
flags.fce_enabled = 1;
4360 "Unable to reinitialize FCE "
4362 ha->
flags.fce_enabled = 0;
4372 "Unable to reinitialize EFT "
4377 vha->
flags.online = 1;
4381 "ISP error recover failed - "
4382 "board disabled.\n");
4387 ha->
isp_ops->reset_adapter(vha);
4388 vha->
flags.online = 0;
4395 "ISP abort - retry remaining %d.\n",
4402 "ISP error recovery - retrying (%d) "
4430 "Setting back fcoe driver presence.\n");
4433 "Error while setting DRV-Presence.\n");
4461 unsigned long flags;
4464 if (qla2x00_isp_firmware(vha)) {
4465 vha->
flags.online = 0;
4466 status = ha->
isp_ops->chip_diag(vha);
4468 status = qla2x00_setup_chip(vha);
4471 if (!status && !(status = qla2x00_init_rings(vha))) {
4473 ha->
flags.chip_reset_done = 1;
4475 qla25xx_init_queues(ha);
4477 status = qla2x00_fw_ready(vha);
4480 "Start configure loop status = %d.\n", status);
4485 vha->
flags.online = 1;
4492 if (qla_tgt_mode_enabled(vha))
4494 spin_unlock_irqrestore(&ha->hardware_lock, flags);
4500 qla2x00_configure_loop(vha);
4513 "Configure loop done, status = 0x%x.\n", status);
4534 "%s Rsp que: %d init failed.\n",
4538 "%s Rsp que: %d inited.\n",
4550 "%s Req que: %d init failed.\n",
4554 "%s Req que: %d inited.\n",
4571 unsigned long flags = 0;
4575 vha->
flags.online = 0;
4576 ha->
isp_ops->disable_intrs(ha);
4583 spin_unlock_irqrestore(&ha->hardware_lock, flags);
4589 unsigned long flags = 0;
4596 vha->
flags.online = 0;
4597 ha->
isp_ops->disable_intrs(ha);
4604 spin_unlock_irqrestore(&ha->hardware_lock, flags);
4607 ha->
isp_ops->enable_intrs(ha);
4619 struct device_node *dp = pci_device_to_OF_node(pdev);
4671 for (cnt = 0, chksum = 0; cnt < ha->
nvram_size >> 2; cnt++)
4675 "Contents of NVRAM\n");
4680 if (chksum || nv->
id[0] !=
'I' || nv->
id[1] !=
'S' || nv->
id[2] !=
'P'
4681 || nv->
id[3] !=
' ' ||
4685 "Inconsistent NVRAM detected: checksum=0x%x id=%c "
4688 "Falling back to functioning (yet invalid -- WWPN) "
4717 qla24xx_nvram_wwn_from_ofw(vha, nv);
4736 if (!qla_ini_mode_enabled(vha)) {
4753 *dptr1++ = *dptr2++;
4764 *dptr1++ = *dptr2++;
4791 ha->
flags.disable_risc_code_load = 0;
4792 ha->
flags.enable_lip_reset = 0;
4793 ha->
flags.enable_lip_full_login =
4795 ha->
flags.enable_target_reset =
4797 ha->
flags.enable_led_scheme = 0;
4866 if (!vha->
flags.init_done) {
4874 vha->
flags.process_response_queue = 0;
4879 "ZIO mode %d enabled; timer delay (%d us).\n",
4885 vha->
flags.process_response_queue = 1;
4890 "NVRAM configuration failed.\n");
4900 int segments, fragment;
4909 "FW: Loading firmware from flash (%x).\n", faddr);
4919 for (i = 0; i < 4; i++)
4921 if ((dcode[0] == 0xffffffff && dcode[1] == 0xffffffff &&
4922 dcode[2] == 0xffffffff && dcode[3] == 0xffffffff) ||
4923 (dcode[0] == 0 && dcode[1] == 0 && dcode[2] == 0 &&
4926 "Unable to verify the integrity of flash firmware "
4929 "Firmware data: %08x %08x %08x %08x.\n",
4930 dcode[0], dcode[1], dcode[2], dcode[3]);
4940 *srisc_addr = *srisc_addr == 0 ? risc_addr : *srisc_addr;
4946 if (dlen > risc_size)
4950 "Loading risc segment@ risc addr %x "
4951 "number of dwords 0x%x offset 0x%x.\n",
4952 risc_addr, dlen, faddr);
4955 for (i = 0; i <
dlen; i++)
4956 dcode[i] =
swab32(dcode[i]);
4962 "Failed to load segment %d of firmware.\n",
4980 #define QLA_FW_URL "ftp://ftp.qlogic.com/outgoing/linux/firmware/"
4988 uint32_t risc_addr, risc_size, fwclen, wlen, *
seg;
4997 "Fimware image unavailable.\n");
4999 "Firmware images can be retrieved from: "QLA_FW_URL ".\n");
5013 "Unable to verify integrity of firmware image (%Zd).\n",
5015 goto fail_fw_integrity;
5017 for (i = 0; i < 4; i++)
5019 if ((wcode[0] == 0xffff && wcode[1] == 0xffff && wcode[2] == 0xffff &&
5020 wcode[3] == 0xffff) || (wcode[0] == 0 && wcode[1] == 0 &&
5021 wcode[2] == 0 && wcode[3] == 0)) {
5023 "Unable to verify integrity of firmware image.\n");
5025 "Firmware data: %04x %04x %04x %04x.\n",
5026 wcode[0], wcode[1], wcode[2], wcode[3]);
5027 goto fail_fw_integrity;
5033 *srisc_addr = *srisc_addr == 0 ? *seg : *srisc_addr;
5037 fwclen += risc_size *
sizeof(
uint16_t);
5038 if (blob->
fw->size < fwclen) {
5040 "Unable to verify integrity of firmware image "
5041 "(%Zd).\n", blob->
fw->size);
5042 goto fail_fw_integrity;
5048 if (wlen > risc_size)
5051 "Loading risc segment@ risc addr %x number of "
5052 "words 0x%x.\n", risc_addr, wlen);
5054 for (i = 0; i < wlen; i++)
5055 wcode[i] =
swab16(fwcode[i]);
5061 "Failed to load segment %d of firmware.\n",
5085 int segments, fragment;
5099 "Fimware image unavailable.\n");
5101 "Firmware images can be retrieved from: "
5108 "FW: Loading via request-firmware.\n");
5121 "Unable to verify integrity of firmware image (%Zd).\n",
5123 goto fail_fw_integrity;
5125 for (i = 0; i < 4; i++)
5127 if ((dcode[0] == 0xffffffff && dcode[1] == 0xffffffff &&
5128 dcode[2] == 0xffffffff && dcode[3] == 0xffffffff) ||
5129 (dcode[0] == 0 && dcode[1] == 0 && dcode[2] == 0 &&
5132 "Unable to verify integrity of firmware image (%Zd).\n",
5135 "Firmware data: %08x %08x %08x %08x.\n",
5136 dcode[0], dcode[1], dcode[2], dcode[3]);
5137 goto fail_fw_integrity;
5142 *srisc_addr = *srisc_addr == 0 ? risc_addr : *srisc_addr;
5146 fwclen += risc_size *
sizeof(
uint32_t);
5147 if (blob->
fw->size < fwclen) {
5149 "Unable to verify integrity of firmware image "
5150 "(%Zd).\n", blob->
fw->size);
5152 goto fail_fw_integrity;
5158 if (dlen > risc_size)
5162 "Loading risc segment@ risc addr %x "
5163 "number of dwords 0x%x.\n", risc_addr, dlen);
5165 for (i = 0; i <
dlen; i++)
5166 dcode[i] =
swab32(fwcode[i]);
5172 "Failed to load segment %d of firmware.\n",
5205 rval = qla24xx_load_risc_blob(vha, srisc_addr);
5209 return qla24xx_load_risc_flash(vha, srisc_addr,
5210 vha->
hw->flt_region_fw);
5228 rval = qla24xx_load_risc_flash(vha, srisc_addr, ha->
flt_region_fw);
5233 rval = qla24xx_load_risc_blob(vha, srisc_addr);
5238 "Attempting to fallback to golden firmware.\n");
5244 ha->
flags.running_gold_fw = 1;
5254 if (ha->
flags.pci_channel_io_perm_failure)
5270 "Attempting retry of stop-firmware command.\n");
5289 rval = qla2x00_fw_ready(base_vha);
5290 if (ha->
flags.cpu_affinity_enabled)
5301 vha->
flags.management_server_logged_in = 0;
5304 rval2 = ha->
isp_ops->fabric_login(vha,
NPH_SNS, 0xff, 0xff, 0xfc, mb,
5309 "Failed SNS login: loop_id=%x, rval2=%d\n",
5313 "Failed SNS login: loop_id=%x mb[0]=%x mb[1]=%x "
5314 "mb[2]=%x mb[6]=%x mb[7]=%x.\n",
5315 NPH_SNS, mb[0], mb[1], mb[2], mb[6], mb[7]);
5343 if (cs84xx->
bus == ha->
pdev->bus) {
5344 kref_get(&cs84xx->
kref);
5349 cs84xx = kzalloc(
sizeof(*cs84xx),
GFP_KERNEL);
5353 kref_init(&cs84xx->
kref);
5365 __qla84xx_chip_release(
struct kref *
kref)
5381 kref_put(&ha->
cs84xx->kref, __qla84xx_chip_release);
5432 for (cnt = 0, chksum = 0; cnt < ha->
nvram_size >> 2; cnt++)
5436 "Contents of NVRAM:\n");
5441 if (chksum || nv->
id[0] !=
'I' || nv->
id[1] !=
'S' || nv->
id[2] !=
'P'
5442 || nv->
id[3] !=
' ' ||
5446 "Inconsistent NVRAM detected: checksum=0x%x id=%c "
5447 "version=0x%x.\n", chksum, nv->
id[0],
5450 "Falling back to functioning (yet invalid -- WWPN) "
5513 *dptr1++ = *dptr2++;
5523 *dptr1++ = *dptr2++;
5562 ha->
flags.disable_risc_code_load = 0;
5563 ha->
flags.enable_lip_reset = 0;
5564 ha->
flags.enable_lip_full_login =
5566 ha->
flags.enable_target_reset =
5568 ha->
flags.enable_led_scheme = 0;
5638 if (!vha->
flags.init_done) {
5646 vha->
flags.process_response_queue = 0;
5651 "ZIO mode %d enabled; timer delay (%d us).\n",
5658 vha->
flags.process_response_queue = 1;
5663 "NVRAM configuration failed.\n");
5677 unsigned long flags;
5679 status = qla2x00_init_rings(vha);
5682 ha->
flags.chip_reset_done = 1;
5684 status = qla2x00_fw_ready(vha);
5687 "Start configure loop, status =%d.\n", status);
5692 vha->
flags.online = 1;
5697 qla2x00_configure_loop(vha);
5710 "Configure loop done, status = 0x%x.\n", status);
5724 vha->
flags.online = 1;
5726 ha->
isp_ops->enable_intrs(ha);
5735 ha->
flags.fce_enabled = 1;
5743 "Unable to reinitialize FCE (%d).\n",
5745 ha->
flags.fce_enabled = 0;
5755 "Unable to reinitialize EFT (%d).\n",
5763 "qla82xx_restart_isp succeeded.\n");
5781 "qla82xx_restart_isp **** FAILED ****.\n");
5837 for (i = 0; i <
entries; i++) {
5838 pid_match = wwn_match = 0;
5851 else if (pid1 == pid2)
5861 else if (pid1 == pid2)
5868 wwn2 = wwn_to_u64(pri_entry->
src_wwpn);
5871 else if (wwn1 == wwn2)
5878 wwn2 = wwn_to_u64(pri_entry->
dst_wwpn);
5881 else if (wwn1 == wwn2)
5885 if (pid_match == 2 || wwn_match == 2) {
5888 priority = pri_entry->
tag;
5923 priority = qla24xx_get_fcp_prio(vha, fcport);
5936 "Updated FCP_CMND priority - value=%d loop_id=%d "
5937 "port_id=%02x%02x%02x.\n", priority,
5943 "Unable to update FCP_CMND priority - ret=0x%x for "
5944 "loop_id=%d port_id=%02x%02x%02x.\n", ret, fcport->
loop_id,
5946 fcport->
d_id.
b.al_pa);