8 #include <linux/slab.h>
26 static char qla4xxx_version_str[40];
36 static int ql4xdisablesysfsboot = 1;
39 " Set to disable exporting boot targets to sysfs.\n"
40 "\t\t 0 - Export boot targets\n"
41 "\t\t 1 - Do not export boot targets (Default)");
46 " Don't reset the HBA for driver recovery.\n"
47 "\t\t 0 - It will reset HBA (Default)\n"
48 "\t\t 1 - It will NOT reset HBA");
53 " Option to enable extended error logging.\n"
54 "\t\t 0 - no logging (Default)\n"
55 "\t\t 2 - debug logging");
60 " Set to enable MSI or MSI-X interrupt mechanism.\n"
61 "\t\t 0 = enable INTx interrupt mechanism.\n"
62 "\t\t 1 = enable MSI-X interrupt mechanism (Default).\n"
63 "\t\t 2 = enable MSI interrupt mechanism.");
65 #define QL4_DEF_QDEPTH 32
69 " Maximum queue depth to report for target devices.\n"
72 static int ql4xqfulltracking = 1;
75 " Enable or disable dynamic tracking and adjustment of\n"
76 "\t\t scsi device queue depth.\n"
78 "\t\t 1 - Enable. (Default)");
83 " Target Session Recovery Timeout.\n"
84 "\t\t Default: 120 sec.");
89 " Set the Minidump driver capture mask level.\n"
90 "\t\t Default is 0x1F.\n"
91 "\t\t Can be set to 0x3, 0x7, 0xF, 0x1F, 0x3F, 0x7F");
96 " Set to enable minidump.\n"
97 "\t\t 0 - disable minidump\n"
98 "\t\t 1 - enable minidump (Default)");
100 static int qla4xxx_wait_for_hba_online(
struct scsi_qla_host *ha);
104 static void qla4xxx_config_dma_addressing(
struct scsi_qla_host *ha);
117 static int qla4xxx_get_iface_param(
struct iscsi_iface *iface,
120 static enum blk_eh_timer_return qla4xxx_eh_cmd_timed_out(
struct scsi_cmnd *
sc);
139 static void qla4xxx_task_work(
struct work_struct *wdata);
141 static int qla4xxx_task_xmit(
struct iscsi_task *);
142 static void qla4xxx_task_cleanup(
struct iscsi_task *);
144 static void qla4xxx_conn_get_stats(
struct iscsi_cls_conn *cls_conn,
158 static int qla4xxx_eh_device_reset(
struct scsi_cmnd *
cmd);
159 static int qla4xxx_eh_target_reset(
struct scsi_cmnd *
cmd);
160 static int qla4xxx_eh_host_reset(
struct scsi_cmnd *
cmd);
163 static void qla4xxx_slave_destroy(
struct scsi_device *sdev);
166 static int qla4xxx_change_queue_depth(
struct scsi_device *sdev,
int qdepth,
176 .queuecommand = qla4xxx_queuecommand,
178 .eh_abort_handler = qla4xxx_eh_abort,
179 .eh_device_reset_handler = qla4xxx_eh_device_reset,
180 .eh_target_reset_handler = qla4xxx_eh_target_reset,
181 .eh_host_reset_handler = qla4xxx_eh_host_reset,
182 .eh_timed_out = qla4xxx_eh_cmd_timed_out,
184 .slave_configure = qla4xxx_slave_configure,
185 .slave_alloc = qla4xxx_slave_alloc,
186 .slave_destroy = qla4xxx_slave_destroy,
187 .change_queue_depth = qla4xxx_change_queue_depth,
194 .max_sectors = 0xFFFF,
196 .host_reset = qla4xxx_host_reset,
207 .attr_is_visible = qla4_attr_is_visible,
208 .create_session = qla4xxx_session_create,
209 .destroy_session = qla4xxx_session_destroy,
210 .start_conn = qla4xxx_conn_start,
211 .create_conn = qla4xxx_conn_create,
212 .bind_conn = qla4xxx_conn_bind,
214 .destroy_conn = qla4xxx_conn_destroy,
216 .get_conn_param = qla4xxx_conn_get_param,
217 .get_session_param = qla4xxx_session_get_param,
218 .get_ep_param = qla4xxx_get_ep_param,
219 .ep_connect = qla4xxx_ep_connect,
220 .ep_poll = qla4xxx_ep_poll,
221 .ep_disconnect = qla4xxx_ep_disconnect,
222 .get_stats = qla4xxx_conn_get_stats,
224 .xmit_task = qla4xxx_task_xmit,
225 .cleanup_task = qla4xxx_task_cleanup,
226 .alloc_pdu = qla4xxx_alloc_pdu,
228 .get_host_param = qla4xxx_host_get_param,
229 .set_iface_param = qla4xxx_iface_set_param,
230 .get_iface_param = qla4xxx_get_iface_param,
232 .send_ping = qla4xxx_send_ping,
233 .get_chap = qla4xxx_get_chap_list,
234 .delete_chap = qla4xxx_delete_chap,
257 "dest: %pI4\n", __func__,
272 if ((iface_num == 0) || (iface_num == 1)) {
274 "src: %pI6 dest: %pI6\n", __func__,
282 "not supported\n", __func__, iface_num);
293 if (iface_num == 0) {
297 "dest: %pI6\n", __func__,
300 }
else if (iface_num == 1) {
304 "dest: %pI6\n", __func__,
321 switch (param_type) {
390 int max_chap_entries = 0;
391 int valid_chap_entries = 0;
395 max_chap_entries = (ha->
hw.flt_chap_size / 2) /
401 __func__, *num_entries, chap_tbl_idx);
405 goto exit_get_chap_list;
410 for (
i = chap_tbl_idx;
i < max_chap_entries;
i++) {
431 valid_chap_entries++;
432 if (valid_chap_entries == *num_entries)
441 __func__, valid_chap_entries);
442 *num_entries = valid_chap_entries;
446 static int __qla4xxx_is_chap_active(
struct device *
dev,
void *
data)
455 goto exit_is_chap_active;
462 goto exit_is_chap_active;
471 static int qla4xxx_is_chap_active(
struct Scsi_Host *shost,
477 __qla4xxx_is_chap_active);
487 int max_chap_entries = 0;
493 if (chap_table ==
NULL)
499 max_chap_entries = (ha->
hw.flt_chap_size / 2) /
504 if (chap_tbl_idx > max_chap_entries) {
506 goto exit_delete_chap;
511 ret = qla4xxx_is_chap_active(shost, chap_tbl_idx);
514 "delete from flash\n", chap_tbl_idx);
516 goto exit_delete_chap;
528 offset += (ha->
hw.flt_chap_size / 2);
529 offset += (chap_tbl_idx * chap_size);
535 goto exit_delete_chap;
543 goto exit_delete_chap;
567 static int qla4xxx_get_iface_param(
struct iscsi_iface *iface,
569 int param,
char *buf)
593 "enabled" :
"disabled");
598 "enabled" :
"disabled");
617 &ha->
ip_config.ipv6_default_router_addr);
656 "enabled" :
"disabled");
661 "enabled" :
"disabled");
734 ha = to_qla_host(qla_ep->
host);
774 static void qla4xxx_conn_get_stats(
struct iscsi_cls_conn *cls_conn,
779 struct ddb_entry *ddb_entry;
793 stats_size =
PAGE_ALIGN(
sizeof(
struct ql_iscsi_stats));
797 if (!ql_iscsi_stats) {
799 "Unable to allocate memory for iscsi stats\n");
807 "Unable to retrieve iscsi stats\n");
842 static enum blk_eh_timer_return qla4xxx_eh_cmd_timed_out(
struct scsi_cmnd *
sc)
847 enum blk_eh_timer_return ret = BLK_EH_NOT_HANDLED;
854 ret = BLK_EH_RESET_TIMER;
855 spin_unlock_irqrestore(&session->
lock, flags);
860 static void qla4xxx_set_port_speed(
struct Scsi_Host *shost)
885 static void qla4xxx_set_port_state(
struct Scsi_Host *shost)
897 static int qla4xxx_host_get_param(
struct Scsi_Host *shost,
914 qla4xxx_set_port_state(shost);
918 qla4xxx_set_port_speed(shost);
928 static void qla4xxx_create_ipv4_iface(
struct scsi_qla_host *ha)
935 &qla4xxx_iscsi_transport,
942 static void qla4xxx_create_ipv6_iface(
struct scsi_qla_host *ha)
947 &qla4xxx_iscsi_transport,
957 &qla4xxx_iscsi_transport,
968 qla4xxx_create_ipv4_iface(ha);
971 qla4xxx_create_ipv6_iface(ha);
974 static void qla4xxx_destroy_ipv4_iface(
struct scsi_qla_host *ha)
982 static void qla4xxx_destroy_ipv6_iface(
struct scsi_qla_host *ha)
996 qla4xxx_destroy_ipv4_iface(ha);
997 qla4xxx_destroy_ipv6_iface(ha);
1008 switch (iface_param->
param) {
1053 if (iface_param->
value[0] ==
1057 else if (iface_param->
value[0] ==
1063 "IPv6 linklocal addr\n");
1078 qla4xxx_create_ipv6_iface(ha);
1083 qla4xxx_destroy_ipv6_iface(ha);
1114 iface_param->
param);
1123 switch (iface_param->
param) {
1150 qla4xxx_create_ipv4_iface(ha);
1155 qla4xxx_destroy_ipv4_iface(ha);
1182 iface_param->
param);
1232 memset(&mbox_cmd, 0,
sizeof(mbox_cmd));
1233 memset(&mbox_sts, 0,
sizeof(mbox_sts));
1238 goto exit_init_fw_cb;
1242 iface_param = nla_data(attr);
1251 qla4xxx_set_ipv4(ha, iface_param, init_fw_cb);
1265 qla4xxx_set_ipv6(ha, iface_param, init_fw_cb);
1290 goto exit_init_fw_cb;
1298 goto exit_init_fw_cb;
1304 qla4xxx_initcb_to_acb(init_fw_cb);
1306 rval =
qla4xxx_set_acb(ha, &mbox_cmd[0], &mbox_sts[0], init_fw_cb_dma);
1311 goto exit_init_fw_cb;
1320 init_fw_cb, init_fw_cb_dma);
1329 struct ddb_entry *ddb_entry = sess->
dd_data;
1342 len =
sprintf(buf,
"%hu\n", idx);
1351 len =
sprintf(buf,
"%hu\n", idx);
1360 static int qla4xxx_conn_get_param(
struct iscsi_cls_conn *cls_conn,
1376 dst_addr, param, buf);
1396 "Free DDB index not available\n"));
1398 goto exit_get_ddb_index;
1405 "Found a free DDB index at %d\n", tmp_ddb_index));
1410 "DDB index = %d not available trying next\n",
1415 "Free FW DDB not available\n"));
1418 *ddb_index = tmp_ddb_index;
1424 static int qla4xxx_match_ipaddress(
struct scsi_qla_host *ha,
1425 struct ddb_entry *ddb_entry,
1426 char *existing_ipaddr,
1440 ret =
sprintf(formatted_ipaddr,
"%pI6", dst_ipaddr);
1448 ret =
sprintf(formatted_ipaddr,
"%pI4", dst_ipaddr);
1451 if (
strcmp(existing_ipaddr, formatted_ipaddr))
1458 static int qla4xxx_match_fwdb_session(
struct scsi_qla_host *ha,
1461 int idx = 0, max_ddbs, rval;
1465 struct ddb_entry *ddb_entry;
1478 for (idx = 0; idx < max_ddbs; idx++) {
1479 ddb_entry = qla4xxx_lookup_ddb_by_fw_index(ha, idx);
1480 if (ddb_entry ==
NULL)
1486 existing_sess = ddb_entry->
sess->dd_data;
1487 existing_conn = ddb_entry->
conn->dd_data;
1495 "IQN = %s User IQN = %s\n",
1500 "IP = %s User IP = %s\n",
1505 "Port = %d User Port = %d\n",
1511 rval = qla4xxx_match_ipaddress(ha, ddb_entry,
1521 if (idx == max_ddbs)
1525 "Match found in fwdb sessions\n"));
1537 struct ddb_entry *ddb_entry;
1551 ha = to_qla_host(qla_ep->
host);
1558 cmds_max,
sizeof(
struct ddb_entry),
1560 initial_cmdsn, ddb_index);
1569 ddb_entry->
sess = cls_sess;
1582 struct ddb_entry *ddb_entry;
1584 unsigned long flags, wtime;
1597 if (!fw_ddb_entry) {
1599 "%s: Unable to allocate dma buffer\n", __func__);
1600 goto destroy_session;
1606 fw_ddb_entry, fw_ddb_entry_dma,
1610 goto destroy_session;
1614 goto destroy_session;
1624 spin_unlock_irqrestore(&ha->hardware_lock, flags);
1630 fw_ddb_entry, fw_ddb_entry_dma);
1638 struct ddb_entry *ddb_entry;
1648 ddb_entry->
conn = cls_conn;
1658 struct qla_conn *qla_conn;
1676 struct ddb_entry *ddb_entry;
1693 ret = qla4xxx_match_fwdb_session(ha, cls_conn);
1696 "Session already exist in FW.\n");
1698 goto exit_conn_start;
1703 if (!fw_ddb_entry) {
1705 "%s: Unable to allocate dma buffer\n", __func__);
1707 goto exit_conn_start;
1721 goto exit_set_param;
1726 goto exit_conn_start;
1734 goto exit_conn_start;
1749 fw_ddb_entry, fw_ddb_entry_dma);
1753 static void qla4xxx_conn_destroy(
struct iscsi_cls_conn *cls_conn)
1758 struct ddb_entry *ddb_entry;
1771 static void qla4xxx_task_work(
struct work_struct *wdata)
1786 task = task_data->
task;
1787 sts = &task_data->
sts;
1804 data_len = task_data->
resp_len - hdr_len;
1819 struct ddb_entry *ddb_entry;
1823 sess = task->
conn->session;
1831 "%s: SCSI Commands not implemented\n", __func__);
1846 __func__, task->
conn->max_recv_dlength, hdr_len));
1854 goto exit_alloc_pdu;
1862 goto exit_alloc_pdu;
1881 static void qla4xxx_task_cleanup(
struct iscsi_task *task)
1885 struct ddb_entry *ddb_entry;
1890 sess = task->
conn->session;
1901 __func__, task->
conn->max_recv_dlength, hdr_len));
1910 static int qla4xxx_task_xmit(
struct iscsi_task *task)
1914 struct ddb_entry *ddb_entry = sess->
dd_data;
1925 static void qla4xxx_copy_fwddb_param(
struct scsi_qla_host *ha,
1932 struct ddb_entry *ddb_entry;
1981 (
char *)ip_addr, buflen);
1987 struct ddb_entry *ddb_entry)
1997 if (!fw_ddb_entry) {
1999 "%s: Unable to allocate dma buffer\n", __func__);
2000 goto exit_session_conn_fwddb_param;
2004 fw_ddb_entry_dma,
NULL,
NULL, &ddb_state,
2007 "get_ddb_entry for fw_ddb_index %d\n",
2010 goto exit_session_conn_fwddb_param;
2013 cls_sess = ddb_entry->
sess;
2015 cls_conn = ddb_entry->
conn;
2018 qla4xxx_copy_fwddb_param(ha, fw_ddb_entry, cls_sess, cls_conn);
2020 exit_session_conn_fwddb_param:
2023 fw_ddb_entry, fw_ddb_entry_dma);
2027 struct ddb_entry *ddb_entry)
2039 if (!fw_ddb_entry) {
2041 "%s: Unable to allocate dma buffer\n", __func__);
2042 goto exit_session_conn_param;
2046 fw_ddb_entry_dma,
NULL,
NULL, &ddb_state,
2049 "get_ddb_entry for fw_ddb_index %d\n",
2052 goto exit_session_conn_param;
2055 cls_sess = ddb_entry->
sess;
2058 cls_conn = ddb_entry->
conn;
2102 exit_session_conn_param:
2105 fw_ddb_entry, fw_ddb_entry_dma);
2115 DEBUG(
printk(
"scsi: %s: Starting timer thread for adapter %d\n",
2116 __func__, ha->
host->host_no));
2155 struct ddb_entry *ddb_entry,
2166 srb->
ddb = ddb_entry;
2169 CMD_SP(cmd) = (
void *)srb;
2174 static void qla4xxx_srb_free_dma(
struct scsi_qla_host *ha,
struct srb *srb)
2191 qla4xxx_srb_free_dma(ha, srb);
2214 struct ddb_entry *ddb_entry = cmd->
device->hostdata;
2224 goto qc_fail_command;
2229 goto qc_fail_command;
2235 goto qc_fail_command;
2248 srb = qla4xxx_get_new_srb(ha, ddb_entry, cmd);
2254 goto qc_host_busy_free_sp;
2258 qc_host_busy_free_sp:
2259 qla4xxx_srb_free_dma(ha, srb);
2315 if (is_qla8022(ha)) {
2319 }
else if (is_qla8032(ha)) {
2323 }
else if (ha->
reg) {
2342 unsigned long align;
2354 "Memory Allocation failed - queues.\n");
2356 goto mem_alloc_error_exit;
2391 "Memory Allocation failed - SRB Pool.\n");
2393 goto mem_alloc_error_exit;
2401 "%s: chap_dma_pool allocation failed..\n", __func__);
2402 goto mem_alloc_error_exit;
2410 "%s: fw_ddb_dma_pool allocation failed..\n",
2412 goto mem_alloc_error_exit;
2417 mem_alloc_error_exit:
2418 qla4xxx_mem_free(ha);
2440 " exceeds maximum allowed. Hardware has been shut"
2441 " down.\n", temp_val);
2446 " degrees C exceeds operating range."
2447 " Immediate action needed.\n", temp_val);
2451 " now %d degrees C in normal range.\n",
2464 static int qla4_8xxx_check_fw_alive(
struct scsi_qla_host *ha)
2469 fw_heartbeat_counter = qla4_8xxx_rd_direct(ha,
2472 if (fw_heartbeat_counter == 0xffffffff) {
2474 "state, QLA82XX_PEG_ALIVE_COUNTER is 0xffffffff\n",
2494 static void qla4_8xxx_process_fw_error(
struct scsi_qla_host *ha)
2497 int halt_status_unrecoverable = 0;
2501 if (is_qla8022(ha)) {
2509 ql4_printk(
KERN_ERR, ha,
"%s: Firmware aborted with error code 0x00006700. Device is being reset\n",
2512 halt_status_unrecoverable = 1;
2513 }
else if (is_qla8032(ha)) {
2518 halt_status_unrecoverable = 1;
2525 if (halt_status_unrecoverable) {
2552 if (qla4_8xxx_check_temp(ha)) {
2553 if (is_qla8022(ha)) {
2563 if (is_qla8032(ha) ||
2566 "NEED RESET!\n", __func__);
2578 if (qla4_8xxx_check_fw_alive(ha))
2579 qla4_8xxx_process_fw_error(ha);
2587 struct ddb_entry *ddb_entry;
2608 "%s: index [%d] login device\n",
2626 "%s: index[%d] relogin timed out-retrying"
2627 " relogin (%d), retry (%d)\n", __func__,
2658 if (!pci_channel_offline(ha->
pdev))
2664 if (is_qla40XX(ha)) {
2692 " - dpc flags = 0x%lx\n",
2713 unsigned long flags;
2724 for (index = 0; index < ha->
host->can_queue; index++) {
2725 cmd = scsi_host_find_tag(ha->
host, index);
2735 spin_unlock_irqrestore(&ha->hardware_lock, flags);
2738 if (index == ha->
host->can_queue)
2751 unsigned long flags = 0;
2764 ctrl_status =
readw(&ha->
reg->ctrl_status);
2766 writel(set_rmask(CSR_SCSI_RESET_INTR), &ha->
reg->ctrl_status);
2772 spin_unlock_irqrestore(&ha->hardware_lock, flags);
2783 unsigned long flags = 0;
2796 ctrl_status =
readw(&ha->
reg->ctrl_status);
2797 spin_unlock_irqrestore(&ha->hardware_lock, flags);
2803 }
while ((--max_wait_time));
2807 "scsi%ld: Network Reset Intr not cleared by "
2808 "Network function, clearing it now!\n",
2811 writel(set_rmask(CSR_NET_RESET_INTR), &ha->
reg->ctrl_status);
2813 spin_unlock_irqrestore(&ha->hardware_lock, flags);
2820 ctrl_status =
readw(&ha->
reg->ctrl_status);
2821 spin_unlock_irqrestore(&ha->hardware_lock, flags);
2829 }
while ((--max_wait_time));
2836 ctrl_status =
readw(&ha->
reg->ctrl_status);
2838 writel(set_rmask(CSR_SCSI_RESET_INTR), &ha->
reg->ctrl_status);
2841 spin_unlock_irqrestore(&ha->hardware_lock, flags);
2849 if (max_wait_time == 0) {
2854 spin_unlock_irqrestore(&ha->hardware_lock, flags);
2859 ctrl_status =
readw(&ha->
reg->ctrl_status);
2860 spin_unlock_irqrestore(&ha->hardware_lock, flags);
2868 }
while ((--max_wait_time));
2888 unsigned long flags;
2891 for (i = 0; i < ha->
host->can_queue; i++) {
2898 spin_unlock_irqrestore(&ha->hardware_lock, flags);
2916 struct ddb_entry *ddb_entry;
2933 static int qla4xxx_recover_adapter(
struct scsi_qla_host *ha)
2949 if (is_qla8032(ha) &&
2966 goto recover_ha_init_adapter;
2971 if (is_qla80XX(ha) && !reset_chip &&
2975 "scsi%ld: %s - Performing stop_firmware...\n",
2977 status = ha->
isp_ops->reset_firmware(ha);
2980 qla4xxx_cmd_wait(ha);
2981 ha->
isp_ops->disable_intrs(ha);
2983 qla4xxx_abort_active_cmds(ha,
DID_RESET << 16);
2996 if (is_qla40XX(ha) || reset_chip) {
3008 if (qla4_8xxx_check_fw_alive(ha)) {
3018 qla4xxx_cmd_wait(ha);
3021 qla4xxx_abort_active_cmds(ha,
DID_RESET << 16);
3023 "scsi%ld: %s - Performing chip reset..\n",
3025 status = ha->
isp_ops->reset_chip(ha);
3031 recover_ha_init_adapter:
3037 if (is_qla40XX(ha) && (ha->
mac_index == 3))
3055 if (is_qla80XX(ha)) {
3057 dev_state = qla4_8xxx_rd_direct(ha,
3062 "recover adapter. H/W is in Failed "
3063 "state\n", __func__);
3078 "(%d) more times\n", ha->
host_no,
3087 "retry remaining %d\n",
3097 "failed - board disabled\n",
3117 ha->
isp_ops->enable_intrs(ha);
3123 status ==
QLA_ERROR ?
"FAILED" :
"SUCCEEDED"));
3131 struct ddb_entry *ddb_entry;
3140 " unblock session\n", ha->
host_no, __func__,
3158 struct ddb_entry *ddb_entry;
3165 " unblock session\n", ha->
host_no, __func__,
3173 " start scan\n", ha->
host_no, __func__,
3183 struct ddb_entry *ddb_entry;
3191 " unblock user space session\n", ha->
host_no, __func__,
3200 "scsi%ld: %s: ddb[%d] session [%d] already logged in\n",
3209 static void qla4xxx_relogin_all_devices(
struct scsi_qla_host *ha)
3218 struct ddb_entry *ddb_entry;
3230 "scsi%ld: Relogin index [%d]. TOV=%d\n", ha->
host_no,
3239 struct ddb_entry *ddb_entry;
3252 "relogin issued\n"));
3253 qla4xxx_relogin_flash_ddb(cls_sess);
3274 INIT_LIST_HEAD(&e->list);
3282 unsigned long flags;
3286 spin_unlock_irqrestore(&ha->
work_lock, flags);
3300 e->
u.
aen.code = aen_code;
3304 qla4xxx_post_work(ha, e);
3324 qla4xxx_post_work(ha, e);
3332 unsigned long flags;
3337 spin_unlock_irqrestore(&ha->
work_lock, flags);
3340 list_del_init(&e->
list);
3345 &qla4xxx_iscsi_transport,
3352 &qla4xxx_iscsi_transport,
3355 e->
u.
ping.data_size,
3360 "supported", e->
type);
3384 "flags = 0x%08lx, dpc_flags = 0x%08lx\n",
3398 qla4xxx_do_work(ha);
3400 if (is_qla80XX(ha)) {
3402 if (is_qla8032(ha)) {
3436 goto dpc_post_reset_ha;
3440 qla4xxx_recover_adapter(ha);
3445 while ((
readw(&ha->
reg->ctrl_status) &
3447 if (--wait_time == 0)
3453 "bit not cleared-- resetting\n",
3455 qla4xxx_abort_active_cmds(ha,
DID_RESET << 16);
3458 status = qla4xxx_recover_adapter(ha);
3462 ha->
isp_ops->enable_intrs(ha);
3476 if (adapter_up(ha) &&
3498 qla4xxx_relogin_all_devices(ha);
3513 ha->
isp_ops->disable_intrs(ha);
3516 if (is_qla40XX(ha)) {
3518 &ha->
reg->ctrl_status);
3520 }
else if (is_qla8022(ha)) {
3523 }
else if (is_qla8032(ha)) {
3530 qla4xxx_stop_timer(ha);
3541 ha->
isp_ops->reset_firmware(ha);
3543 if (is_qla80XX(ha)) {
3554 qla4xxx_mem_free(ha);
3560 unsigned long mem_base, mem_len, db_base, db_len;
3566 "scsi(%ld) Failed to reserve PIO regions (%s) "
3567 "status=%d\n", ha->
host_no, pci_name(pdev), status);
3568 goto iospace_error_exit;
3579 __func__, mem_base, mem_len));
3585 "cannot remap MMIO (%s), aborting\n", pci_name(pdev));
3587 goto iospace_error_exit;
3593 if (is_qla8022(ha)) {
3596 (ha->
pdev->devfn << 11));
3599 }
else if (is_qla8032(ha)) {
3621 unsigned long pio, pio_len, pio_flags;
3622 unsigned long mmio, mmio_len, mmio_flags;
3630 "Invalid PCI I/O region size\n");
3645 "region #0 not an MMIO resource, aborting\n");
3647 goto iospace_error_exit;
3652 "Invalid PCI mem region size, aborting\n");
3653 goto iospace_error_exit;
3658 "Failed to reserve PIO/MMIO regions\n");
3660 goto iospace_error_exit;
3668 "cannot remap MMIO, aborting\n");
3670 goto iospace_error_exit;
3682 .disable_intrs = qla4xxx_disable_intrs,
3683 .enable_intrs = qla4xxx_enable_intrs,
3784 static ssize_t qla4xxx_show_boot_eth_info(
void *data,
int type,
char *buf)
3808 static umode_t qla4xxx_eth_get_attr_visibility(
void *data,
int type)
3825 static ssize_t qla4xxx_show_boot_ini_info(
void *data,
int type,
char *buf)
3842 static umode_t qla4xxx_ini_get_attr_visibility(
void *data,
int type)
3870 if (boot_sess->
conn_list[0].dest_ipaddr.ip_type == 0x1)
3882 boot_conn->
chap.target_chap_name_length,
3883 (
char *)&boot_conn->
chap.target_chap_name);
3887 boot_conn->
chap.target_secret_length,
3888 (
char *)&boot_conn->
chap.target_secret);
3892 boot_conn->
chap.intr_chap_name_length,
3893 (
char *)&boot_conn->
chap.intr_chap_name);
3897 boot_conn->
chap.intr_secret_length,
3898 (
char *)&boot_conn->
chap.intr_secret);
3913 static ssize_t qla4xxx_show_boot_tgt_pri_info(
void *data,
int type,
char *buf)
3918 return qla4xxx_show_boot_tgt_info(boot_sess, type, buf);
3921 static ssize_t qla4xxx_show_boot_tgt_sec_info(
void *data,
int type,
char *buf)
3926 return qla4xxx_show_boot_tgt_info(boot_sess, type, buf);
3929 static umode_t qla4xxx_tgt_get_attr_visibility(
void *data,
int type)
3952 static void qla4xxx_boot_release(
void *data)
3967 size_t size = 13 *
sizeof(
uint8_t);
3973 __func__, ha->
pdev->device, func_num);
3975 if (is_qla40XX(ha)) {
3976 if (func_num == 1) {
3980 }
else if (func_num == 3) {
3986 goto exit_boot_info;
3991 if (!(val & 0x07)) {
3993 "options : 0x%x\n", __func__, val));
3995 goto exit_boot_info;
4001 ddb_index[0] = (val & 0x7f);
4006 ddb_index[1] = (val & 0x7f);
4008 }
else if (is_qla8022(ha)) {
4013 "%s: Unable to allocate dma buffer\n",
4016 goto exit_boot_info;
4025 goto exit_boot_info_free;
4032 " failed\n", ha->
host_no, __func__));
4034 goto exit_boot_info_free;
4037 if (!(buf[1] & 0x07)) {
4039 " : 0x%x\n", buf[1]));
4041 goto exit_boot_info_free;
4046 ddb_index[0] = buf[2] & 0x7f;
4049 if (buf[11] & BIT_7)
4050 ddb_index[1] = buf[11] & 0x7f;
4053 goto exit_boot_info;
4057 " target ID %d\n", __func__, ddb_index[0],
4060 exit_boot_info_free:
4079 static int qla4xxx_get_bidi_chap(
struct scsi_qla_host *ha,
char *username,
4083 int max_chap_entries = 0;
4087 max_chap_entries = (ha->
hw.flt_chap_size / 2) /
4098 for (i = 0; i < max_chap_entries; i++) {
4105 if (chap_table->
flags & BIT_7)
4122 static int qla4xxx_get_boot_target(
struct scsi_qla_host *ha,
4135 if (!fw_ddb_entry) {
4137 "%s: Unable to allocate dma buffer.\n",
4144 fw_ddb_entry_dma, ddb_index)) {
4146 "index [%d]\n", __func__, ddb_index));
4148 goto exit_boot_target;
4157 if (options & DDB_OPT_IPV6_DEVICE) {
4177 (
char *)&boot_conn->
chap.target_secret,
4182 goto exit_boot_target;
4193 ret = qla4xxx_get_bidi_chap(ha,
4194 (
char *)&boot_conn->
chap.intr_chap_name,
4195 (
char *)&boot_conn->
chap.intr_secret);
4200 goto exit_boot_target;
4209 fw_ddb_entry, fw_ddb_entry_dma);
4219 memset(ddb_index, 0,
sizeof(ddb_index));
4220 ddb_index[0] = 0xffff;
4221 ddb_index[1] = 0xffff;
4222 ret = get_fw_boot_info(ha, ddb_index);
4225 "%s: No boot target configured.\n", __func__));
4229 if (ql4xdisablesysfsboot)
4232 if (ddb_index[0] == 0xffff)
4235 rval = qla4xxx_get_boot_target(ha, &(ha->
boot_tgt.boot_pri_sess),
4239 "configured\n", __func__));
4244 if (ddb_index[1] == 0xffff)
4245 goto exit_get_boot_info;
4247 rval = qla4xxx_get_boot_target(ha, &(ha->
boot_tgt.boot_sec_sess),
4251 " configured\n", __func__));
4259 static int qla4xxx_setup_boot_info(
struct scsi_qla_host *ha)
4266 if (ql4xdisablesysfsboot) {
4268 "%s: syfsboot disabled - driver will trigger login "
4269 "and publish session for discovery .\n", __func__);
4281 qla4xxx_show_boot_tgt_pri_info,
4282 qla4xxx_tgt_get_attr_visibility,
4283 qla4xxx_boot_release);
4290 qla4xxx_show_boot_tgt_sec_info,
4291 qla4xxx_tgt_get_attr_visibility,
4292 qla4xxx_boot_release);
4299 qla4xxx_show_boot_ini_info,
4300 qla4xxx_ini_get_attr_visibility,
4301 qla4xxx_boot_release);
4308 qla4xxx_show_boot_eth_info,
4309 qla4xxx_eth_get_attr_visibility,
4310 qla4xxx_boot_release);
4334 static void qla4xxx_create_chap_list(
struct scsi_qla_host *ha)
4348 chap_size = ha->
hw.flt_chap_size / 2;
4352 if (!chap_flash_data) {
4361 offset += chap_size;
4366 goto exit_chap_list;
4372 goto exit_chap_list;
4379 chap_flash_data, chap_dma);
4382 static void qla4xxx_get_param_ddb(
struct ddb_entry *ddb_entry,
4393 cls_sess = ddb_entry->
sess;
4395 cls_conn = ddb_entry->
conn;
4404 static void qla4xxx_convert_param_ddb(
struct dev_db_entry *fw_ddb_entry,
4415 if (options & DDB_OPT_IPV6_DEVICE)
4422 if (flash_isid ==
NULL)
4424 sizeof(tddb->
isid));
4429 static int qla4xxx_compare_tuple_ddb(
struct scsi_qla_host *ha,
4440 if (old_tddb->
port != new_tddb->
port)
4449 if (is_isid_compare) {
4451 "%02x%02x%02x] New ISID [%02x%02x%02x%02x%02x%02x]\n",
4452 __func__, old_tddb->
isid[5], old_tddb->
isid[4],
4453 old_tddb->
isid[3], old_tddb->
isid[2], old_tddb->
isid[1],
4454 old_tddb->
isid[0], new_tddb->
isid[5], new_tddb->
isid[4],
4455 new_tddb->
isid[3], new_tddb->
isid[2], new_tddb->
isid[1],
4456 new_tddb->
isid[0]));
4459 sizeof(old_tddb->
isid)))
4464 "Match Found, fw[%d,%d,%s,%s], [%d,%d,%s,%s]",
4472 static int qla4xxx_is_session_exists(
struct scsi_qla_host *ha,
4475 struct ddb_entry *ddb_entry;
4481 fw_tddb =
vzalloc(
sizeof(*fw_tddb));
4484 "Memory Allocation failed.\n"));
4489 tmp_tddb =
vzalloc(
sizeof(*tmp_tddb));
4492 "Memory Allocation failed.\n"));
4497 qla4xxx_convert_param_ddb(fw_ddb_entry, fw_tddb,
NULL);
4500 ddb_entry = qla4xxx_lookup_ddb_by_fw_index(ha, idx);
4501 if (ddb_entry ==
NULL)
4504 qla4xxx_get_param_ddb(ddb_entry, tmp_tddb);
4505 if (!qla4xxx_compare_tuple_ddb(ha, fw_tddb, tmp_tddb,
false)) {
4533 fw_ddb_entry = &nt_ddb_idx->
fw_ddb;
4536 sizeof(nt_ddb_idx->
fw_ddb.isid)) == 0) {
4559 base_value = fw_ddb_entry->
isid[1] & 0x1f;
4560 for (i = 0; i < 8; i++) {
4561 fw_ddb_entry->
isid[1] = (base_value | (i << 5));
4562 if (qla4xxx_check_existing_isid(list_nt, fw_ddb_entry->
isid))
4566 if (!qla4xxx_check_existing_isid(list_nt, fw_ddb_entry->
isid))
4581 static int qla4xxx_should_update_isid(
struct scsi_qla_host *ha,
4587 if (old_tddb->
port == new_tddb->
port)
4596 sizeof(old_tddb->
isid)))
4615 static int qla4xxx_is_flash_ddb_exists(
struct scsi_qla_host *ha,
4624 fw_tddb =
vzalloc(
sizeof(*fw_tddb));
4627 "Memory Allocation failed.\n"));
4632 tmp_tddb =
vzalloc(
sizeof(*tmp_tddb));
4635 "Memory Allocation failed.\n"));
4640 qla4xxx_convert_param_ddb(fw_ddb_entry, fw_tddb,
NULL);
4643 qla4xxx_convert_param_ddb(&nt_ddb_idx->
fw_ddb, tmp_tddb,
4645 ret = qla4xxx_compare_tuple_ddb(ha, fw_tddb, tmp_tddb,
true);
4652 qla4xxx_convert_param_ddb(&nt_ddb_idx->
fw_ddb, tmp_tddb,
NULL);
4654 ret = qla4xxx_should_update_isid(ha, tmp_tddb, fw_tddb);
4656 rval = qla4xxx_update_isid(ha, list_nt, fw_ddb_entry);
4674 static void qla4xxx_free_ddb_list(
struct list_head *list_ddb)
4679 list_del_init(&ddb_idx->
list);
4694 dst_addr =
vmalloc(
sizeof(*dst_addr));
4698 if (fw_ddb_entry->
options & DDB_OPT_IPV6_DEVICE) {
4713 ep = qla4xxx_ep_connect(ha->
host, dst_addr, 0);
4720 if (ql4xdisablesysfsboot)
4727 static void qla4xxx_setup_flash_ddb_entry(
struct scsi_qla_host *ha,
4728 struct ddb_entry *ddb_entry)
4750 static void qla4xxx_wait_for_ip_configuration(
struct scsi_qla_host *ha)
4756 unsigned long wtime;
4762 if (ip_idx[idx] == -1)
4775 "Waiting for IP state for idx = %d, state = 0x%x\n",
4776 ip_idx[idx], ip_state));
4786 if ((ip_idx[0] == -1) &&
4787 (ip_idx[1] == -1) &&
4788 (ip_idx[2] == -1) &&
4810 if (fw_ddb_entry ==
NULL) {
4819 for (idx = 0; idx < max_ddbs; idx = next_idx) {
4821 NULL, &next_idx, &state,
4822 &conn_err,
NULL, &conn_id);
4828 goto continue_next_st;
4832 goto continue_next_st;
4834 st_ddb_idx =
vzalloc(fw_idx_size);
4859 static void qla4xxx_remove_failed_ddb(
struct scsi_qla_host *ha,
4876 list_del_init(&ddb_idx->
list);
4882 static int qla4xxx_sess_conn_setup(
struct scsi_qla_host *ha,
4895 struct ddb_entry *ddb_entry =
NULL;
4901 cmds_max,
sizeof(
struct ddb_entry),
4913 module_put(qla4xxx_iscsi_transport.
owner);
4916 ddb_entry->
sess = cls_sess;
4922 qla4xxx_setup_flash_ddb_entry(ha, ddb_entry);
4931 ddb_entry->
conn = cls_conn;
4934 ep = qla4xxx_get_ep_fwdb(ha, fw_ddb_entry);
4936 ep->
conn = cls_conn;
4945 qla4xxx_copy_fwddb_param(ha, fw_ddb_entry, cls_sess, cls_conn);
4963 struct list_head *list_nt,
int is_reset)
4977 if (fw_ddb_entry ==
NULL) {
4985 for (idx = 0; idx < max_ddbs; idx = next_idx) {
4987 NULL, &next_idx, &state,
4988 &conn_err,
NULL, &conn_id);
4992 if (qla4xxx_verify_boot_idx(ha, idx) !=
QLA_SUCCESS)
4993 goto continue_next_nt;
4997 goto continue_next_nt;
5001 goto continue_next_nt;
5004 "Adding DDB to session = 0x%x\n", idx));
5006 nt_ddb_idx =
vmalloc(fw_idx_size);
5017 &fw_ddb_entry->
isid[0],
5020 ret = qla4xxx_is_flash_ddb_exists(ha, list_nt,
5025 goto continue_next_nt;
5034 if (qla4xxx_is_session_exists(ha, fw_ddb_entry) ==
5036 goto continue_next_nt;
5039 ret = qla4xxx_sess_conn_setup(ha, fw_ddb_entry, is_reset);
5068 unsigned long wtime;
5076 INIT_LIST_HEAD(&list_st);
5077 INIT_LIST_HEAD(&list_nt);
5079 qla4xxx_build_st_list(ha, &list_st);
5084 qla4xxx_wait_for_ip_configuration(ha);
5097 "Default time to wait for build ddb %d\n", tmo));
5101 if (list_empty(&list_st))
5104 qla4xxx_remove_failed_ddb(ha, &list_st);
5109 qla4xxx_free_ddb_list(&list_st);
5111 qla4xxx_build_nt_list(ha, &list_nt, is_reset);
5113 qla4xxx_free_ddb_list(&list_nt);
5144 "qla4xxx: Couldn't allocate host from scsi layer!\n");
5145 goto probe_disable_device;
5149 ha = to_qla_host(host);
5150 memset(ha, 0,
sizeof(*ha));
5161 if (is_qla8022(ha)) {
5162 ha->
isp_ops = &qla4_82xx_isp_ops;
5167 nx_legacy_intr = &legacy_intr[ha->
func_num];
5173 }
else if (is_qla8032(ha)) {
5174 ha->
isp_ops = &qla4_83xx_isp_ops;
5177 ha->
isp_ops = &qla4xxx_isp_ops;
5180 if (is_qla80XX(ha)) {
5188 ret = ha->
isp_ops->iospace_config(ha);
5190 goto probe_failed_ioconfig;
5195 qla4xxx_config_dma_addressing(ha);
5212 if (qla4xxx_mem_alloc(ha)) {
5214 "[ERROR] Failed to allocate memory for adapter\n");
5228 ret = scsi_init_shared_tag_map(host,
MAX_SRBS);
5231 "%s: scsi_init_shared_tag_map failed\n", __func__);
5235 pci_set_drvdata(pdev, ha);
5237 ret = scsi_add_host(host, &pdev->
dev);
5244 if (is_qla8032(ha)) {
5265 goto skip_retry_init;
5270 if (is_qla80XX(ha)) {
5272 dev_state = qla4_8xxx_rd_direct(ha,
5277 "initialize adapter. H/W is in failed state\n",
5282 DEBUG2(
printk(
"scsi: %s: retrying adapter initialization "
5283 "(%d)\n", __func__, init_retry_count));
5310 "qla4xxx_dpc\n", __func__));
5334 if (is_qla40XX(ha)) {
5338 "interrupt %d already in use.\n", pdev->
irq);
5344 ha->
isp_ops->enable_intrs(ha);
5347 qla4xxx_start_timer(ha, qla4xxx_timer, 1);
5354 " QLogic iSCSI HBA Driver version: %s\n"
5355 " QLogic ISP%04x @ %s, host#=%ld, fw=%02d.%02d.%02d.%02d\n",
5356 qla4xxx_version_str, ha->
pdev->device, pci_name(ha->
pdev),
5364 if (qla4xxx_setup_boot_info(ha))
5366 "%s: No iSCSI boot target configured\n", __func__);
5372 qla4xxx_create_chap_list(ha);
5374 qla4xxx_create_ifaces(ha);
5381 qla4xxx_free_adapter(ha);
5383 probe_failed_ioconfig:
5387 probe_disable_device:
5401 static void qla4xxx_prevent_other_port_reinit(
struct scsi_qla_host *ha)
5419 other_ha = pci_get_drvdata(other_pdev);
5423 "Prevent %s reinit\n", __func__,
5424 dev_name(&other_ha->
pdev->dev)));
5431 static void qla4xxx_destroy_fw_ddb_session(
struct scsi_qla_host *ha)
5433 struct ddb_entry *ddb_entry;
5439 ddb_entry = qla4xxx_lookup_ddb_by_fw_index(ha, idx);
5440 if ((ddb_entry !=
NULL) &&
5456 try_module_get(qla4xxx_iscsi_transport.
owner);
5475 if (!pci_is_enabled(pdev))
5478 ha = pci_get_drvdata(pdev);
5481 qla4xxx_prevent_other_port_reinit(ha);
5484 qla4xxx_destroy_ifaces(ha);
5486 if ((!ql4xdisablesysfsboot) && ha->
boot_kset)
5489 qla4xxx_destroy_fw_ddb_session(ha);
5494 qla4xxx_free_adapter(ha);
5500 pci_set_drvdata(pdev,
NULL);
5510 static void qla4xxx_config_dma_addressing(
struct scsi_qla_host *ha)
5518 "Failed to set 64 bit PCI consistent mask; "
5520 retval = pci_set_consistent_dma_mask(ha->
pdev,
5527 static int qla4xxx_slave_alloc(
struct scsi_device *sdev)
5531 struct ddb_entry *
ddb;
5541 if (ql4xmaxqdepth != 0 && ql4xmaxqdepth <= 0xffffU)
5542 queue_depth = ql4xmaxqdepth;
5544 scsi_activate_tcq(sdev, queue_depth);
5548 static int qla4xxx_slave_configure(
struct scsi_device *sdev)
5554 static void qla4xxx_slave_destroy(
struct scsi_device *sdev)
5556 scsi_deactivate_tcq(sdev, 1);
5559 static int qla4xxx_change_queue_depth(
struct scsi_device *sdev,
int qdepth,
5562 if (!ql4xqfulltracking)
5578 struct srb *srb =
NULL;
5581 cmd = scsi_host_find_tag(ha->
host, index);
5585 srb = (
struct srb *)
CMD_SP(cmd);
5594 srb->
cmd->host_scribble =
5595 (
unsigned char *)(
unsigned long)
MAX_SRBS;
5608 static int qla4xxx_eh_wait_on_command(
struct scsi_qla_host *ha,
5628 rp = (
struct srb *)
CMD_SP(cmd);
5635 }
while (max_wait_time--);
5644 static int qla4xxx_wait_for_hba_online(
struct scsi_qla_host *ha)
5646 unsigned long wait_online;
5669 static int qla4xxx_eh_wait_for_commands(
struct scsi_qla_host *ha,
5681 for (cnt = 0; cnt < ha->
host->can_queue; cnt++) {
5682 cmd = scsi_host_find_tag(ha->
host, cnt);
5684 (!sdev || sdev == cmd->
device)) {
5685 if (!qla4xxx_eh_wait_on_command(ha, cmd)) {
5701 static int qla4xxx_eh_abort(
struct scsi_cmnd *cmd)
5704 unsigned int id = cmd->
device->id;
5706 unsigned long flags;
5707 struct srb *srb =
NULL;
5712 "scsi%ld:%d:%d: Abort command issued cmd=%p\n",
5716 srb = (
struct srb *)
CMD_SP(cmd);
5718 spin_unlock_irqrestore(&ha->hardware_lock, flags);
5722 spin_unlock_irqrestore(&ha->hardware_lock, flags);
5725 DEBUG3(
printk(
"scsi%ld:%d:%d: Abort_task mbx failed.\n",
5729 DEBUG3(
printk(
"scsi%ld:%d:%d: Abort_task mbx success.\n",
5738 if (!qla4xxx_eh_wait_on_command(ha, cmd)) {
5739 DEBUG2(
printk(
"scsi%ld:%d:%d: Abort handler timed out\n",
5746 "scsi%ld:%d:%d: Abort command - %s\n",
5747 ha->
host_no,
id, lun, (ret ==
SUCCESS) ?
"succeeded" :
"failed");
5759 static int qla4xxx_eh_device_reset(
struct scsi_cmnd *cmd)
5762 struct ddb_entry *ddb_entry = cmd->
device->hostdata;
5774 "scsi%ld:%d:%d:%d: DEVICE RESET ISSUED.\n", ha->
host_no,
5778 "scsi%ld: DEVICE_RESET cmd=%p jiffies = 0x%lx, to=%x,"
5779 "dpc_flags=%lx, status=%x allowed=%d\n", ha->
host_no,
5780 cmd, jiffies, cmd->
request->timeout /
HZ,
5787 goto eh_dev_reset_done;
5793 "DEVICE RESET FAILED - waiting for "
5795 goto eh_dev_reset_done;
5801 goto eh_dev_reset_done;
5804 "scsi(%ld:%d:%d:%d): DEVICE RESET SUCCEEDED.\n",
5821 static int qla4xxx_eh_target_reset(
struct scsi_cmnd *cmd)
5824 struct ddb_entry *ddb_entry = cmd->
device->hostdata;
5835 "WARM TARGET RESET ISSUED.\n");
5838 "scsi%ld: TARGET_DEVICE_RESET cmd=%p jiffies = 0x%lx, "
5839 "to=%x,dpc_flags=%lx, status=%x allowed=%d\n",
5846 "WARM TARGET RESET FAILED.\n");
5853 "WARM TARGET DEVICE RESET FAILED - "
5854 "waiting for commands.\n");
5862 "WARM TARGET DEVICE RESET FAILED - "
5863 "marker iocb failed.\n");
5868 "WARM TARGET RESET SUCCEEDED.\n");
5879 static int qla4xxx_is_eh_active(
struct Scsi_Host *shost)
5893 static int qla4xxx_eh_host_reset(
struct scsi_cmnd *cmd)
5895 int return_status =
FAILED;
5898 ha = to_qla_host(cmd->
device->host);
5914 if (qla4xxx_is_eh_active(cmd->
device->host))
5915 qla4xxx_abort_active_cmds(ha,
DID_ABORT << 16);
5921 "scsi(%ld:%d:%d:%d): HOST RESET ISSUED.\n", ha->
host_no,
5924 if (qla4xxx_wait_for_hba_online(ha) !=
QLA_SUCCESS) {
5925 DEBUG2(
printk(
"scsi%ld:%d: %s: Unable to reset host. Adapter "
5943 return_status ==
FAILED ?
"FAILED" :
"SUCCEEDED");
5945 return return_status;
5964 goto exit_port_reset;
6008 goto exit_host_reset;
6011 rval = qla4xxx_wait_for_hba_online(ha);
6014 "adapter\n", __func__));
6016 goto exit_host_reset;
6020 goto recover_adapter;
6022 switch (reset_type) {
6033 rval = qla4xxx_context_reset(ha);
6034 goto exit_host_reset;
6041 rval = qla4xxx_recover_adapter(ha);
6073 ha->
host_no, __func__, state);
6075 if (!is_aer_supported(ha))
6088 qla4xxx_abort_active_cmds(ha,
DID_RESET << 16);
6105 qla4xxx_pci_mmio_enabled(
struct pci_dev *pdev)
6109 if (!is_aer_supported(ha))
6137 "func %x\n", ha->
host_no, __func__, fn);
6150 "func in enabled state%x\n", ha->
host_no,
6164 "0x%x is the owner\n", ha->
host_no, __func__,
6180 goto exit_error_recovery;
6188 "FAILED\n", ha->
host_no, __func__);
6196 "READY\n", ha->
host_no, __func__);
6207 "reserve interrupt %d already in use.\n",
6211 ha->
isp_ops->enable_intrs(ha);
6217 "the reset owner\n", ha->
host_no, __func__,
6227 " reserve interrupt %d already in"
6228 " use.\n", ha->
pdev->irq);
6231 ha->
isp_ops->enable_intrs(ha);
6240 exit_error_recovery:
6246 qla4xxx_pci_slot_reset(
struct pci_dev *pdev)
6255 if (!is_aer_supported(ha))
6273 "device after reset\n", ha->
host_no, __func__);
6274 goto exit_slot_reset;
6277 ha->
isp_ops->disable_intrs(ha);
6279 if (is_qla80XX(ha)) {
6280 if (qla4_8xxx_error_recovery(ha) ==
QLA_SUCCESS) {
6282 goto exit_slot_reset;
6284 goto exit_slot_reset;
6289 "device after reset\n", ha->
host_no, __func__, ret);
6294 qla4xxx_pci_resume(
struct pci_dev *pdev)
6302 ret = qla4xxx_wait_for_hba_online(ha);
6305 "resume I/O from slot/link_reset\n", ha->
host_no,
6314 .error_detected = qla4xxx_pci_error_detected,
6315 .mmio_enabled = qla4xxx_pci_mmio_enabled,
6316 .slot_reset = qla4xxx_pci_slot_reset,
6317 .resume = qla4xxx_pci_resume,
6355 static struct pci_driver qla4xxx_pci_driver = {
6357 .id_table = qla4xxx_pci_tbl,
6358 .probe = qla4xxx_probe_adapter,
6359 .remove = qla4xxx_remove_adapter,
6360 .err_handler = &qla4xxx_err_handler,
6363 static int __init qla4xxx_module_init(
void)
6370 if (srb_cachep ==
NULL) {
6372 "%s: Unable to allocate SRB cache..."
6381 strcat(qla4xxx_version_str,
"-debug");
6383 qla4xxx_scsi_transport =
6385 if (!qla4xxx_scsi_transport){
6387 goto release_srb_cache;
6390 ret = pci_register_driver(&qla4xxx_pci_driver);
6392 goto unregister_transport;
6397 unregister_transport:
6405 static void __exit qla4xxx_module_exit(
void)