20 for (i = 1; i < in_count; i++)
34 intr_status =
readl(&ha->
reg->ctrl_status);
42 ha->
isp_ops->interrupt_service_routine(ha, intr_status);
65 unsigned long flags = 0;
69 if (!mbx_cmd || !mbx_sts) {
71 "pointer\n", ha->
host_no, __func__));
78 "prematurely completing mbx cmd as "
79 "adapter removal detected\n",
85 if ((is_aer_supported(ha)) &&
88 "timeout MBX Exiting.\n", ha->
host_no, __func__));
95 while (wait_count--) {
111 if (is_qla80XX(ha)) {
114 "scsi%ld: %s: prematurely completing mbx cmd as firmware recovery detected\n",
124 "scsi%ld: %s: H/W is in failed state, do not send any mailbox commands\n",
133 for (i = 0; i < outCount; i++)
137 ha->
isp_ops->queue_mailbox_command(ha, mbx_cmd, inCount);
139 spin_unlock_irqrestore(&ha->hardware_lock, flags);
179 ha->
isp_ops->process_mailbox_interrupt(ha, outCount);
180 spin_unlock_irqrestore(&ha->hardware_lock, flags);
187 if (is_qla80XX(ha) &&
190 "scsi%ld: %s: prematurely completing mbx cmd as "
191 "firmware recovery detected\n",
195 DEBUG2(
printk(
"scsi%ld: Mailbox Cmd 0x%08X timed out ...,"
196 " Scheduling Adapter Reset\n", ha->
host_no,
201 if (is_qla8022(ha)) {
203 "disabling pause transmit on port 0 & 1.\n");
207 }
else if (is_qla8032(ha)) {
220 for (i = 0; i < outCount; i++)
235 ha->
host_no, __func__, mbx_cmd[0]));
241 "sts = %08X ****\n", ha->
host_no, __func__,
242 mbx_cmd[0], mbx_sts[0]));
245 spin_unlock_irqrestore(&ha->hardware_lock, flags);
271 memset(&mbox_cmd, 0,
sizeof(mbox_cmd));
272 memset(&mbox_sts, 0,
sizeof(mbox_sts));
276 mbox_cmd[2] =
LSDW(phys_addr);
277 mbox_cmd[3] =
MSDW(phys_addr);
285 "scsi%ld: %s: Cmd = %08X, mbx[0] = 0x%04x, mbx[1] = 0x%04x\n",
286 ha->
host_no, __func__, mbox_cmd[0],
287 mbox_sts[0], mbox_sts[1]));
302 memset(&mbox_cmd, 0,
sizeof(mbox_cmd));
303 memset(&mbox_sts, 0,
sizeof(mbox_sts));
313 "%s: sts[0]=0x%04x, template size=0x%04x, size_cm_02=0x%04x, size_cm_04=0x%04x, size_cm_08=0x%04x, size_cm_10=0x%04x, size_cm_FF=0x%04x, version=0x%04x\n",
314 __func__, mbox_sts[0], mbox_sts[1],
315 mbox_sts[2], mbox_sts[3], mbox_sts[4],
316 mbox_sts[5], mbox_sts[6], mbox_sts[7]));
321 "%s: Error sts[0]=0x%04x, mbx[1]=0x%04x\n",
322 __func__, mbox_sts[0], mbox_sts[1]);
339 "recovery, doing premature completion of "
340 "mbx cmd\n", ha->
host_no, __func__);
345 "recovery, doing premature completion of "
346 "polling mbx cmd\n", ha->
host_no, __func__);
363 mbox_cmd[2] =
LSDW(init_fw_cb_dma);
364 mbox_cmd[3] =
MSDW(init_fw_cb_dma);
371 "MBOX_CMD_INITIALIZE_FIRMWARE"
372 " failed w/ status %04X\n",
373 ha->
host_no, __func__, mbox_sts[0]));
384 memset(mbox_sts, 0,
sizeof(mbox_sts[0]) * MBOX_REG_COUNT);
386 mbox_cmd[2] =
LSDW(init_fw_cb_dma);
387 mbox_cmd[3] =
MSDW(init_fw_cb_dma);
393 "MBOX_CMD_GET_INIT_FW_CTRL_BLOCK"
394 " failed w/ status %04X\n",
395 ha->
host_no, __func__, mbox_sts[0]));
432 if (is_ipv6_enabled(ha)) {
440 ha->
ip_config.ipv6_default_router_state =
442 ha->
ip_config.ipv6_link_local_addr.in6_u.u6_addr8[0] = 0xFE;
443 ha->
ip_config.ipv6_link_local_addr.in6_u.u6_addr8[1] = 0x80;
475 "scsi%ld: %s: Failed to get init_fw_ctrl_blk\n",
493 qla4xxx_update_local_ip(ha, init_fw_cb);
513 if (init_fw_cb ==
NULL) {
516 goto exit_init_fw_cb_no_free;
521 memset(&mbox_cmd, 0,
sizeof(mbox_cmd));
522 memset(&mbox_sts, 0,
sizeof(mbox_sts));
528 init_fw_cb, init_fw_cb_dma);
529 goto exit_init_fw_cb;
564 if (qla4xxx_set_ifcb(ha, &mbox_cmd[0], &mbox_sts[0], init_fw_cb_dma)
567 "scsi%ld: %s: Failed to set init_fw_ctrl_blk\n",
569 goto exit_init_fw_cb;
574 DEBUG2(
printk(
"scsi%ld: %s: Failed to update local ifcb\n",
576 goto exit_init_fw_cb;
582 init_fw_cb, init_fw_cb_dma);
583 exit_init_fw_cb_no_free:
601 if (init_fw_cb ==
NULL) {
602 printk(
"scsi%ld: %s: Unable to alloc init_cb\n", ha->
host_no,
611 DEBUG2(
printk(
"scsi%ld: %s: Failed to get init_fw_ctrl_blk\n",
615 init_fw_cb, init_fw_cb_dma);
620 qla4xxx_update_local_ip(ha, init_fw_cb);
622 init_fw_cb, init_fw_cb_dma);
637 memset(&mbox_cmd, 0,
sizeof(mbox_cmd));
638 memset(&mbox_sts, 0,
sizeof(mbox_sts));
644 DEBUG2(
printk(
"scsi%ld: %s: MBOX_CMD_GET_FW_STATE failed w/ "
645 "status %04X\n", ha->
host_no, __func__,
668 memset(&mbox_cmd, 0,
sizeof(mbox_cmd));
669 memset(&mbox_sts, 0,
sizeof(mbox_sts));
675 DEBUG2(
printk(
"scsi%ld: %s: MBOX_CMD_GET_FW_STATUS failed w/ "
676 "status %04X\n", ha->
host_no, __func__,
715 ha->
host_no, __func__, fw_ddb_index));
718 memset(&mbox_cmd, 0,
sizeof(mbox_cmd));
719 memset(&mbox_sts, 0,
sizeof(mbox_sts));
724 mbox_cmd[1] = (
uint32_t) fw_ddb_index;
725 mbox_cmd[2] =
LSDW(fw_ddb_entry_dma);
726 mbox_cmd[3] =
MSDW(fw_ddb_entry_dma);
731 DEBUG2(
printk(
"scsi%ld: %s: MBOX_CMD_GET_DATABASE_ENTRY failed"
732 " with status 0x%04X\n", ha->
host_no, __func__,
736 if (fw_ddb_index != mbox_sts[1]) {
737 DEBUG2(
printk(
"scsi%ld: %s: ddb mismatch [%d] != [%d].\n",
738 ha->
host_no, __func__, fw_ddb_index,
746 "Next %d State %04x ConnErr %08x %pI6 "
747 ":%04d \"%s\"\n", __func__, fw_ddb_index,
748 mbox_sts[0], mbox_sts[2], mbox_sts[3],
749 mbox_sts[4], mbox_sts[5],
755 "Next %d State %04x ConnErr %08x %pI4 "
756 ":%04d \"%s\"\n", __func__, fw_ddb_index,
757 mbox_sts[0], mbox_sts[2], mbox_sts[3],
758 mbox_sts[4], mbox_sts[5],
764 if (num_valid_ddb_entries)
765 *num_valid_ddb_entries = mbox_sts[2];
767 *next_ddb_index = mbox_sts[3];
768 if (fw_ddb_device_state)
769 *fw_ddb_device_state = mbox_sts[4];
779 *conn_err_detail = mbox_sts[5];
780 if (tcp_source_port_num)
781 *tcp_source_port_num = (
uint16_t) (mbox_sts[6] >> 16);
783 *connection_id = (
uint16_t) mbox_sts[6] & 0x00FF;
796 memset(&mbox_cmd, 0,
sizeof(mbox_cmd));
797 memset(&mbox_sts, 0,
sizeof(mbox_sts));
800 mbox_cmd[1] = fw_ddb_index;
805 "%s: status = %d mbx0 = 0x%x mbx1 = 0x%x\n",
806 __func__, status, mbox_sts[0], mbox_sts[1]));
830 memset(&mbox_cmd, 0,
sizeof(mbox_cmd));
831 memset(&mbox_sts, 0,
sizeof(mbox_sts));
834 mbox_cmd[1] = (
uint32_t) fw_ddb_index;
835 mbox_cmd[2] =
LSDW(fw_ddb_entry_dma);
836 mbox_cmd[3] =
MSDW(fw_ddb_entry_dma);
842 *mbx_sts = mbox_sts[0];
843 DEBUG2(
printk(
"scsi%ld: %s: status=%d mbx0=0x%x mbx4=0x%x\n",
844 ha->
host_no, __func__, status, mbox_sts[0], mbox_sts[4]);)
856 memset(&mbox_cmd, 0,
sizeof(mbox_cmd));
857 memset(&mbox_sts, 0,
sizeof(mbox_sts));
867 "%s: MBOX_CMD_CONN_CLOSE_SESS_LOGOUT "
868 "failed sts %04X %04X", __func__,
869 mbox_sts[0], mbox_sts[1]));
889 memset(&mbox_cmd, 0,
sizeof(mbox_cmd));
890 memset(&mbox_sts, 0,
sizeof(mbox_cmd));
897 DEBUG2(
printk(
"scsi%ld: %s: ERROR: Unable to retrieve size!\n",
899 goto exit_get_crash_record;
901 crash_record_size = mbox_sts[4];
902 if (crash_record_size == 0) {
903 DEBUG2(
printk(
"scsi%ld: %s: ERROR: Crash record size is 0!\n",
905 goto exit_get_crash_record;
911 if (crash_record ==
NULL)
912 goto exit_get_crash_record;
915 memset(&mbox_cmd, 0,
sizeof(mbox_cmd));
916 memset(&mbox_sts, 0,
sizeof(mbox_cmd));
919 mbox_cmd[2] =
LSDW(crash_record_dma);
920 mbox_cmd[3] =
MSDW(crash_record_dma);
921 mbox_cmd[4] = crash_record_size;
925 goto exit_get_crash_record;
929 exit_get_crash_record:
932 crash_record, crash_record_dma);
951 memset(&mbox_cmd, 0,
sizeof(mbox_cmd));
952 memset(&mbox_sts, 0,
sizeof(mbox_cmd));
959 goto exit_get_event_log;
961 event_log_size = mbox_sts[4];
962 if (event_log_size == 0)
963 goto exit_get_event_log;
968 if (event_log ==
NULL)
969 goto exit_get_event_log;
972 memset(&mbox_cmd, 0,
sizeof(mbox_cmd));
973 memset(&mbox_sts, 0,
sizeof(mbox_cmd));
976 mbox_cmd[2] =
LSDW(event_log_dma);
977 mbox_cmd[3] =
MSDW(event_log_dma);
981 DEBUG2(
printk(
"scsi%ld: %s: ERROR: Unable to retrieve event "
982 "log!\n", ha->
host_no, __func__));
983 goto exit_get_event_log;
987 num_valid_entries = mbox_sts[1];
989 max_event_log_entries = event_log_size /
992 if (num_valid_entries > max_event_log_entries)
993 oldest_entry = num_valid_entries % max_event_log_entries;
995 DEBUG3(
printk(
"scsi%ld: Connection Event Log Dump (%d entries):\n",
996 ha->
host_no, num_valid_entries));
999 if (oldest_entry == 0) {
1001 for (i=0; i < num_valid_entries; i++) {
1003 (i*
sizeof(*event_log)),
1004 sizeof(*event_log));
1010 for (i=oldest_entry; i < max_event_log_entries; i++) {
1012 (i*
sizeof(*event_log)),
1013 sizeof(*event_log));
1015 for (i=0; i < oldest_entry; i++) {
1017 (i*
sizeof(*event_log)),
1018 sizeof(*event_log));
1044 unsigned long flags = 0;
1051 memset(&mbox_cmd, 0,
sizeof(mbox_cmd));
1052 memset(&mbox_sts, 0,
sizeof(mbox_sts));
1056 spin_unlock_irqrestore(&ha->hardware_lock, flags);
1063 mbox_cmd[1] = srb->
ddb->fw_ddb_index;
1064 mbox_cmd[2] =
index;
1074 "mbx0=%04X, mb1=%04X, mb2=%04X, mb3=%04X, mb4=%04X\n",
1076 mbox_sts[1], mbox_sts[2], mbox_sts[3], mbox_sts[4]));
1106 memset(&mbox_cmd, 0,
sizeof(mbox_cmd));
1107 memset(&mbox_sts, 0,
sizeof(mbox_sts));
1111 mbox_cmd[2] = lun << 8;
1146 memset(&mbox_cmd, 0,
sizeof(mbox_cmd));
1147 memset(&mbox_sts, 0,
sizeof(mbox_sts));
1168 memset(&mbox_cmd, 0,
sizeof(mbox_cmd));
1169 memset(&mbox_sts, 0,
sizeof(mbox_sts));
1172 mbox_cmd[1] =
LSDW(dma_addr);
1173 mbox_cmd[2] =
MSDW(dma_addr);
1179 DEBUG2(
printk(
"scsi%ld: %s: MBOX_CMD_READ_FLASH, failed w/ "
1180 "status %04X %04X, offset %08x, len %08x\n", ha->
host_no,
1181 __func__, mbox_sts[0], mbox_sts[1], offset, len));
1208 "for about_fw\n", __func__));
1213 memset(&mbox_cmd, 0,
sizeof(mbox_cmd));
1214 memset(&mbox_sts, 0,
sizeof(mbox_sts));
1217 mbox_cmd[2] =
LSDW(about_fw_dma);
1218 mbox_cmd[3] =
MSDW(about_fw_dma);
1222 &mbox_cmd[0], &mbox_sts[0]);
1225 "failed w/ status %04X\n", __func__,
1245 about_fw, about_fw_dma);
1255 memset(&mbox_cmd, 0,
sizeof(mbox_cmd));
1256 memset(&mbox_sts, 0,
sizeof(mbox_sts));
1260 mbox_cmd[2] =
LSDW(dma_addr);
1261 mbox_cmd[3] =
MSDW(dma_addr);
1266 ha->
host_no, __func__, mbox_sts[0]));
1279 memset(&mbox_cmd, 0,
sizeof(mbox_cmd));
1280 memset(&mbox_sts, 0,
sizeof(mbox_sts));
1283 mbox_cmd[1] = ddb_index;
1289 __func__, mbox_sts[0]));
1292 *mbx_sts = mbox_sts[0];
1302 memset(&mbox_cmd, 0,
sizeof(mbox_cmd));
1303 memset(&mbox_sts, 0,
sizeof(mbox_sts));
1306 mbox_cmd[1] = ddb_index;
1312 __func__, mbox_sts[0]));
1325 memset(&mbox_cmd, 0,
sizeof(mbox_cmd));
1326 memset(&mbox_sts, 0,
sizeof(mbox_sts));
1329 mbox_cmd[1] =
LSDW(dma_addr);
1330 mbox_cmd[2] =
MSDW(dma_addr);
1338 "failed w/ status %04X, mbx1 %04X\n",
1339 __func__, mbox_sts[0], mbox_sts[1]));
1352 memset(fw_ddb_entry, 0,
sizeof(*fw_ddb_entry));
1354 dev_db_start_offset += (ddb_index *
sizeof(*fw_ddb_entry));
1357 if (dev_db_start_offset > dev_db_end_offset) {
1359 "%s:Invalid DDB index %d", __func__,
1361 goto exit_bootdb_failed;
1367 "failed\n", ha->
host_no, __func__);
1368 goto exit_bootdb_failed;
1388 if (chap_table ==
NULL) {
1394 memset(chap_table, 0, chap_size);
1404 offset += (ha->
hw.flt_chap_size / 2);
1405 offset += (idx * chap_size);
1431 static int qla4xxx_set_chap(
struct scsi_qla_host *ha,
char *username,
1441 if (chap_table ==
NULL) {
1486 char *password,
int bidi,
uint16_t *chap_index)
1489 int free_index = -1;
1490 int found_index = 0;
1491 int max_chap_entries = 0;
1495 max_chap_entries = (ha->
hw.flt_chap_size / 2) /
1505 if (!username || !password) {
1511 for (i = 0; i < max_chap_entries; i++) {
1539 if (!found_index && free_index != -1) {
1540 rval = qla4xxx_set_chap(ha, username, password,
1543 *chap_index = free_index;
1564 memset(&mbox_cmd, 0,
sizeof(mbox_cmd));
1565 memset(&mbox_sts, 0,
sizeof(mbox_sts));
1568 mbox_cmd[1] = fw_ddb_index;
1569 mbox_cmd[2] = connection_id;
1575 "option %04x failed w/ status %04X %04X\n",
1576 __func__, option, mbox_sts[0], mbox_sts[1]));
1587 memset(&mbox_cmd, 0,
sizeof(mbox_cmd));
1588 memset(&mbox_sts, 0,
sizeof(mbox_sts));
1595 "failed w/ status %04X %04X %04X", __func__,
1596 mbox_sts[0], mbox_sts[1], mbox_sts[2]));
1608 memset(&mbox_cmd, 0,
sizeof(mbox_cmd));
1609 memset(&mbox_sts, 0,
sizeof(mbox_sts));
1612 mbox_cmd[1] = acb_type;
1613 mbox_cmd[2] =
LSDW(acb_dma);
1614 mbox_cmd[3] =
MSDW(acb_dma);
1620 "failed w/ status %04X\n", __func__,
1632 memset(mbox_sts, 0,
sizeof(mbox_sts[0]) * MBOX_REG_COUNT);
1635 mbox_cmd[2] =
LSDW(acb_dma);
1636 mbox_cmd[3] =
MSDW(acb_dma);
1642 "failed w/ status %04X\n", __func__,
1670 if (!fw_ddb_entry) {
1672 "%s: Unable to allocate dma buffer.\n",
1675 goto exit_set_param_no_free;
1686 status = qla4xxx_get_default_ddb(ha, options, fw_ddb_entry_dma);
1689 goto exit_set_param;
1696 fw_ddb_entry->
isid[5], fw_ddb_entry->
isid[4],
1697 fw_ddb_entry->
isid[3], fw_ddb_entry->
isid[2],
1698 fw_ddb_entry->
isid[1], fw_ddb_entry->
isid[0]));
1722 "%s: Destination Address [%pI4]: index [%d]\n",
1723 __func__, fw_ddb_entry->
ip_addr,
1732 "%s: Destination Address [%pI6]: index [%d]\n",
1733 __func__, fw_ddb_entry->
ip_addr,
1737 "%s: Failed to get IP Address\n",
1740 goto exit_set_param;
1746 iscsi_opts |=
BIT_7;
1752 goto exit_set_param;
1761 iscsi_opts |=
BIT_4;
1767 goto exit_set_param;
1803 fw_ddb_entry_dma, mbx_sts);
1809 fw_ddb_entry, fw_ddb_entry_dma);
1810 exit_set_param_no_free:
1822 memset(mbox_sts, 0,
sizeof(mbox_sts[0]) * MBOX_REG_COUNT);
1824 mbox_cmd[1] = fw_ddb_index;
1825 mbox_cmd[2] =
LSDW(stats_dma);
1826 mbox_cmd[3] =
MSDW(stats_dma);
1827 mbox_cmd[4] = stats_size;
1832 "%s: MBOX_CMD_GET_MANAGEMENT_DATA "
1833 "failed w/ status %04X\n", __func__,
1846 memset(&mbox_cmd, 0,
sizeof(mbox_cmd));
1847 memset(&mbox_sts, 0,
sizeof(mbox_sts));
1849 mbox_cmd[1] = acb_idx;
1850 mbox_cmd[2] = ip_idx;
1855 "MBOX_CMD_GET_IP_ADDR_STATE failed w/ "
1856 "status %04X\n", __func__, mbox_sts[0]));
1858 memcpy(sts, mbox_sts,
sizeof(mbox_sts));
1869 memset(&mbox_cmd, 0,
sizeof(mbox_cmd));
1870 memset(&mbox_sts, 0,
sizeof(mbox_sts));
1873 mbox_cmd[1] =
LSDW(nvram_dma);
1874 mbox_cmd[2] =
MSDW(nvram_dma);
1882 "status %04X\n", ha->
host_no, __func__,
1895 memset(&mbox_cmd, 0,
sizeof(mbox_cmd));
1896 memset(&mbox_sts, 0,
sizeof(mbox_sts));
1899 mbox_cmd[1] =
LSDW(nvram_dma);
1900 mbox_cmd[2] =
MSDW(nvram_dma);
1908 "status %04X\n", ha->
host_no, __func__,
1922 memset(&mbox_cmd, 0,
sizeof(mbox_cmd));
1923 memset(&mbox_sts, 0,
sizeof(mbox_sts));
1926 mbox_cmd[3] = region;
1927 mbox_cmd[4] = field0;
1928 mbox_cmd[5] = field1;
1934 "status %04X\n", ha->
host_no, __func__,
1951 memset(&mbox_cmd, 0,
sizeof(mbox_cmd));
1952 memset(&mbox_sts, 0,
sizeof(mbox_sts));
1963 goto exit_set_param;
1970 __func__, mbox_sts[0]);
1988 memset(&mbox_cmd, 0,
sizeof(mbox_cmd));
1989 memset(&mbox_sts, 0,
sizeof(mbox_sts));
1992 mbox_cmd[1] = ha->
idc_info.request_desc;
1998 mbox_cmd, mbox_sts);