2 * QLogic iSCSI HBA Driver
3 * Copyright (c) 2003-2006 QLogic Corporation
5 * See LICENSE.qla4xxx for copyright and licensing details.
11 * QLogic ISP4xxx Hardware Support Function Prototypes.
14 static void ql4xxx_set_mac_number(struct scsi_qla_host
*ha
)
20 /* Get the function number */
21 spin_lock_irqsave(&ha
->hardware_lock
, flags
);
22 value
= readw(&ha
->reg
->ctrl_status
);
23 spin_unlock_irqrestore(&ha
->hardware_lock
, flags
);
25 func_number
= (uint8_t) ((value
>> 4) & 0x30);
26 switch (value
& ISP_CONTROL_FN_MASK
) {
27 case ISP_CONTROL_FN0_SCSI
:
30 case ISP_CONTROL_FN1_SCSI
:
34 DEBUG2(printk("scsi%ld: %s: Invalid function number, "
35 "ispControlStatus = 0x%x\n", ha
->host_no
,
39 DEBUG2(printk("scsi%ld: %s: mac_index %d.\n", ha
->host_no
, __func__
,
44 * qla4xxx_free_ddb - deallocate ddb
45 * @ha: pointer to host adapter structure.
46 * @ddb_entry: pointer to device database entry
48 * This routine deallocates and unlinks the specified ddb_entry from the
51 void qla4xxx_free_ddb(struct scsi_qla_host
*ha
, struct ddb_entry
*ddb_entry
)
53 /* Remove device entry from list */
54 list_del_init(&ddb_entry
->list
);
56 /* Remove device pointer from index mapping arrays */
57 ha
->fw_ddb_index_map
[ddb_entry
->fw_ddb_index
] =
58 (struct ddb_entry
*) INVALID_ENTRY
;
61 /* Free memory and scsi-ml struct for device entry */
62 qla4xxx_destroy_sess(ddb_entry
);
66 * qla4xxx_free_ddb_list - deallocate all ddbs
67 * @ha: pointer to host adapter structure.
69 * This routine deallocates and removes all devices on the sppecified adapter.
71 void qla4xxx_free_ddb_list(struct scsi_qla_host
*ha
)
73 struct list_head
*ptr
;
74 struct ddb_entry
*ddb_entry
;
76 while (!list_empty(&ha
->ddb_list
)) {
77 ptr
= ha
->ddb_list
.next
;
78 /* Free memory for device entry and remove */
79 ddb_entry
= list_entry(ptr
, struct ddb_entry
, list
);
80 qla4xxx_free_ddb(ha
, ddb_entry
);
85 * qla4xxx_init_rings - initialize hw queues
86 * @ha: pointer to host adapter structure.
88 * This routine initializes the internal queues for the specified adapter.
89 * The QLA4010 requires us to restart the queues at index 0.
90 * The QLA4000 doesn't care, so just default to QLA4010's requirement.
92 int qla4xxx_init_rings(struct scsi_qla_host
*ha
)
94 unsigned long flags
= 0;
96 /* Initialize request queue. */
97 spin_lock_irqsave(&ha
->hardware_lock
, flags
);
100 ha
->request_ptr
= &ha
->request_ring
[ha
->request_in
];
101 ha
->req_q_count
= REQUEST_QUEUE_DEPTH
;
103 /* Initialize response queue. */
105 ha
->response_out
= 0;
106 ha
->response_ptr
= &ha
->response_ring
[ha
->response_out
];
109 * Initialize DMA Shadow registers. The firmware is really supposed to
110 * take care of this, but on some uniprocessor systems, the shadow
111 * registers aren't cleared-- causing the interrupt_handler to think
112 * there are responses to be processed when there aren't.
114 ha
->shadow_regs
->req_q_out
= __constant_cpu_to_le32(0);
115 ha
->shadow_regs
->rsp_q_in
= __constant_cpu_to_le32(0);
118 writel(0, &ha
->reg
->req_q_in
);
119 writel(0, &ha
->reg
->rsp_q_out
);
120 readl(&ha
->reg
->rsp_q_out
);
122 spin_unlock_irqrestore(&ha
->hardware_lock
, flags
);
128 * qla4xxx_validate_mac_address - validate adapter MAC address(es)
129 * @ha: pointer to host adapter structure.
132 static int qla4xxx_validate_mac_address(struct scsi_qla_host
*ha
)
134 struct flash_sys_info
*sys_info
;
135 dma_addr_t sys_info_dma
;
136 int status
= QLA_ERROR
;
138 sys_info
= dma_alloc_coherent(&ha
->pdev
->dev
, sizeof(*sys_info
),
139 &sys_info_dma
, GFP_KERNEL
);
140 if (sys_info
== NULL
) {
141 DEBUG2(printk("scsi%ld: %s: Unable to allocate dma buffer.\n",
142 ha
->host_no
, __func__
));
144 goto exit_validate_mac_no_free
;
146 memset(sys_info
, 0, sizeof(*sys_info
));
148 /* Get flash sys info */
149 if (qla4xxx_get_flash(ha
, sys_info_dma
, FLASH_OFFSET_SYS_INFO
,
150 sizeof(*sys_info
)) != QLA_SUCCESS
) {
151 DEBUG2(printk("scsi%ld: %s: get_flash FLASH_OFFSET_SYS_INFO "
152 "failed\n", ha
->host_no
, __func__
));
154 goto exit_validate_mac
;
157 /* Save M.A.C. address & serial_number */
158 memcpy(ha
->my_mac
, &sys_info
->physAddr
[0].address
[0],
159 min(sizeof(ha
->my_mac
),
160 sizeof(sys_info
->physAddr
[0].address
)));
161 memcpy(ha
->serial_number
, &sys_info
->acSerialNumber
,
162 min(sizeof(ha
->serial_number
),
163 sizeof(sys_info
->acSerialNumber
)));
165 status
= QLA_SUCCESS
;
168 dma_free_coherent(&ha
->pdev
->dev
, sizeof(*sys_info
), sys_info
,
171 exit_validate_mac_no_free
:
176 * qla4xxx_init_local_data - initialize adapter specific local data
177 * @ha: pointer to host adapter structure.
180 static int qla4xxx_init_local_data(struct scsi_qla_host
*ha
)
182 /* Initilize aen queue */
183 ha
->aen_q_count
= MAX_AEN_ENTRIES
;
185 return qla4xxx_get_firmware_status(ha
);
188 static int qla4xxx_fw_ready(struct scsi_qla_host
*ha
)
190 uint32_t timeout_count
;
193 DEBUG2(dev_info(&ha
->pdev
->dev
, "Waiting for Firmware Ready..\n"));
194 for (timeout_count
= ADAPTER_INIT_TOV
; timeout_count
> 0;
196 if (test_and_clear_bit(DPC_GET_DHCP_IP_ADDR
, &ha
->dpc_flags
))
197 qla4xxx_get_dhcp_ip_address(ha
);
199 /* Get firmware state. */
200 if (qla4xxx_get_firmware_state(ha
) != QLA_SUCCESS
) {
201 DEBUG2(printk("scsi%ld: %s: unable to get firmware "
202 "state\n", ha
->host_no
, __func__
));
207 if (ha
->firmware_state
& FW_STATE_ERROR
) {
208 DEBUG2(printk("scsi%ld: %s: an unrecoverable error has"
209 " occurred\n", ha
->host_no
, __func__
));
213 if (ha
->firmware_state
& FW_STATE_CONFIG_WAIT
) {
215 * The firmware has not yet been issued an Initialize
216 * Firmware command, so issue it now.
218 if (qla4xxx_initialize_fw_cb(ha
) == QLA_ERROR
)
221 /* Go back and test for ready state - no wait. */
225 if (ha
->firmware_state
== FW_STATE_READY
) {
226 DEBUG2(dev_info(&ha
->pdev
->dev
, "Firmware Ready..\n"));
227 /* The firmware is ready to process SCSI commands. */
228 DEBUG2(dev_info(&ha
->pdev
->dev
,
229 "scsi%ld: %s: MEDIA TYPE - %s\n",
231 __func__
, (ha
->addl_fw_state
&
232 FW_ADDSTATE_OPTICAL_MEDIA
)
233 != 0 ? "OPTICAL" : "COPPER"));
234 DEBUG2(dev_info(&ha
->pdev
->dev
,
235 "scsi%ld: %s: DHCP STATE Enabled "
237 ha
->host_no
, __func__
,
239 FW_ADDSTATE_DHCP_ENABLED
) != 0 ?
241 DEBUG2(dev_info(&ha
->pdev
->dev
,
242 "scsi%ld: %s: LINK %s\n",
243 ha
->host_no
, __func__
,
245 FW_ADDSTATE_LINK_UP
) != 0 ?
247 DEBUG2(dev_info(&ha
->pdev
->dev
,
248 "scsi%ld: %s: iSNS Service "
250 ha
->host_no
, __func__
,
252 FW_ADDSTATE_ISNS_SVC_ENABLED
) != 0 ?
258 DEBUG2(printk("scsi%ld: %s: waiting on fw, state=%x:%x - "
259 "seconds expired= %d\n", ha
->host_no
, __func__
,
260 ha
->firmware_state
, ha
->addl_fw_state
,
265 if (timeout_count
<= 0)
266 DEBUG2(printk("scsi%ld: %s: FW Initialization timed out!\n",
267 ha
->host_no
, __func__
));
269 if (ha
->firmware_state
& FW_STATE_DHCP_IN_PROGRESS
) {
270 DEBUG2(printk("scsi%ld: %s: FW is reporting its waiting to"
271 " grab an IP address from DHCP server\n",
272 ha
->host_no
, __func__
));
280 * qla4xxx_init_firmware - initializes the firmware.
281 * @ha: pointer to host adapter structure.
284 static int qla4xxx_init_firmware(struct scsi_qla_host
*ha
)
286 int status
= QLA_ERROR
;
288 dev_info(&ha
->pdev
->dev
, "Initializing firmware..\n");
289 if (qla4xxx_initialize_fw_cb(ha
) == QLA_ERROR
) {
290 DEBUG2(printk("scsi%ld: %s: Failed to initialize firmware "
291 "control block\n", ha
->host_no
, __func__
));
294 if (!qla4xxx_fw_ready(ha
))
297 set_bit(AF_ONLINE
, &ha
->flags
);
298 return qla4xxx_get_firmware_status(ha
);
301 static struct ddb_entry
* qla4xxx_get_ddb_entry(struct scsi_qla_host
*ha
,
302 uint32_t fw_ddb_index
)
304 struct dev_db_entry
*fw_ddb_entry
= NULL
;
305 dma_addr_t fw_ddb_entry_dma
;
306 struct ddb_entry
*ddb_entry
= NULL
;
308 uint32_t device_state
;
310 /* Make sure the dma buffer is valid */
311 fw_ddb_entry
= dma_alloc_coherent(&ha
->pdev
->dev
,
312 sizeof(*fw_ddb_entry
),
313 &fw_ddb_entry_dma
, GFP_KERNEL
);
314 if (fw_ddb_entry
== NULL
) {
315 DEBUG2(printk("scsi%ld: %s: Unable to allocate dma buffer.\n",
316 ha
->host_no
, __func__
));
320 if (qla4xxx_get_fwddb_entry(ha
, fw_ddb_index
, fw_ddb_entry
,
321 fw_ddb_entry_dma
, NULL
, NULL
,
322 &device_state
, NULL
, NULL
, NULL
) ==
324 DEBUG2(printk("scsi%ld: %s: failed get_ddb_entry for "
325 "fw_ddb_index %d\n", ha
->host_no
, __func__
,
330 /* Allocate DDB if not already allocated. */
331 DEBUG2(printk("scsi%ld: %s: Looking for ddb[%d]\n", ha
->host_no
,
332 __func__
, fw_ddb_index
));
333 list_for_each_entry(ddb_entry
, &ha
->ddb_list
, list
) {
334 if (memcmp(ddb_entry
->iscsi_name
, fw_ddb_entry
->iscsiName
,
335 ISCSI_NAME_SIZE
) == 0) {
342 DEBUG2(printk("scsi%ld: %s: ddb[%d] not found - allocating "
343 "new ddb\n", ha
->host_no
, __func__
,
345 ddb_entry
= qla4xxx_alloc_ddb(ha
, fw_ddb_index
);
348 /* if not found allocate new ddb */
349 dma_free_coherent(&ha
->pdev
->dev
, sizeof(*fw_ddb_entry
), fw_ddb_entry
,
356 * qla4xxx_update_ddb_entry - update driver's internal ddb
357 * @ha: pointer to host adapter structure.
358 * @ddb_entry: pointer to device database structure to be filled
359 * @fw_ddb_index: index of the ddb entry in fw ddb table
361 * This routine updates the driver's internal device database entry
362 * with information retrieved from the firmware's device database
363 * entry for the specified device. The ddb_entry->fw_ddb_index field
364 * must be initialized prior to calling this routine
367 int qla4xxx_update_ddb_entry(struct scsi_qla_host
*ha
,
368 struct ddb_entry
*ddb_entry
,
369 uint32_t fw_ddb_index
)
371 struct dev_db_entry
*fw_ddb_entry
= NULL
;
372 dma_addr_t fw_ddb_entry_dma
;
373 int status
= QLA_ERROR
;
375 if (ddb_entry
== NULL
) {
376 DEBUG2(printk("scsi%ld: %s: ddb_entry is NULL\n", ha
->host_no
,
378 goto exit_update_ddb
;
381 /* Make sure the dma buffer is valid */
382 fw_ddb_entry
= dma_alloc_coherent(&ha
->pdev
->dev
,
383 sizeof(*fw_ddb_entry
),
384 &fw_ddb_entry_dma
, GFP_KERNEL
);
385 if (fw_ddb_entry
== NULL
) {
386 DEBUG2(printk("scsi%ld: %s: Unable to allocate dma buffer.\n",
387 ha
->host_no
, __func__
));
389 goto exit_update_ddb
;
392 if (qla4xxx_get_fwddb_entry(ha
, fw_ddb_index
, fw_ddb_entry
,
393 fw_ddb_entry_dma
, NULL
, NULL
,
394 &ddb_entry
->fw_ddb_device_state
, NULL
,
395 &ddb_entry
->tcp_source_port_num
,
396 &ddb_entry
->connection_id
) ==
398 DEBUG2(printk("scsi%ld: %s: failed get_ddb_entry for "
399 "fw_ddb_index %d\n", ha
->host_no
, __func__
,
402 goto exit_update_ddb
;
405 status
= QLA_SUCCESS
;
406 ddb_entry
->target_session_id
= le16_to_cpu(fw_ddb_entry
->TSID
);
407 ddb_entry
->task_mgmt_timeout
=
408 le16_to_cpu(fw_ddb_entry
->taskMngmntTimeout
);
409 ddb_entry
->CmdSn
= 0;
410 ddb_entry
->exe_throttle
= le16_to_cpu(fw_ddb_entry
->exeThrottle
);
411 ddb_entry
->default_relogin_timeout
=
412 le16_to_cpu(fw_ddb_entry
->taskMngmntTimeout
);
413 ddb_entry
->default_time2wait
= le16_to_cpu(fw_ddb_entry
->minTime2Wait
);
415 /* Update index in case it changed */
416 ddb_entry
->fw_ddb_index
= fw_ddb_index
;
417 ha
->fw_ddb_index_map
[fw_ddb_index
] = ddb_entry
;
419 ddb_entry
->port
= le16_to_cpu(fw_ddb_entry
->portNumber
);
420 ddb_entry
->tpgt
= le32_to_cpu(fw_ddb_entry
->TargetPortalGroup
);
421 memcpy(&ddb_entry
->iscsi_name
[0], &fw_ddb_entry
->iscsiName
[0],
422 min(sizeof(ddb_entry
->iscsi_name
),
423 sizeof(fw_ddb_entry
->iscsiName
)));
424 memcpy(&ddb_entry
->ip_addr
[0], &fw_ddb_entry
->ipAddr
[0],
425 min(sizeof(ddb_entry
->ip_addr
), sizeof(fw_ddb_entry
->ipAddr
)));
427 DEBUG2(printk("scsi%ld: %s: ddb[%d] - State= %x status= %d.\n",
428 ha
->host_no
, __func__
, fw_ddb_index
,
429 ddb_entry
->fw_ddb_device_state
, status
));
433 dma_free_coherent(&ha
->pdev
->dev
, sizeof(*fw_ddb_entry
),
434 fw_ddb_entry
, fw_ddb_entry_dma
);
440 * qla4xxx_alloc_ddb - allocate device database entry
441 * @ha: Pointer to host adapter structure.
442 * @fw_ddb_index: Firmware's device database index
444 * This routine allocates a ddb_entry, ititializes some values, and
445 * inserts it into the ddb list.
447 struct ddb_entry
* qla4xxx_alloc_ddb(struct scsi_qla_host
*ha
,
448 uint32_t fw_ddb_index
)
450 struct ddb_entry
*ddb_entry
;
452 DEBUG2(printk("scsi%ld: %s: fw_ddb_index [%d]\n", ha
->host_no
,
453 __func__
, fw_ddb_index
));
455 ddb_entry
= qla4xxx_alloc_sess(ha
);
456 if (ddb_entry
== NULL
) {
457 DEBUG2(printk("scsi%ld: %s: Unable to allocate memory "
458 "to add fw_ddb_index [%d]\n",
459 ha
->host_no
, __func__
, fw_ddb_index
));
463 ddb_entry
->fw_ddb_index
= fw_ddb_index
;
464 atomic_set(&ddb_entry
->port_down_timer
, ha
->port_down_retry_count
);
465 atomic_set(&ddb_entry
->retry_relogin_timer
, INVALID_ENTRY
);
466 atomic_set(&ddb_entry
->relogin_timer
, 0);
467 atomic_set(&ddb_entry
->relogin_retry_count
, 0);
468 atomic_set(&ddb_entry
->state
, DDB_STATE_ONLINE
);
469 list_add_tail(&ddb_entry
->list
, &ha
->ddb_list
);
470 ha
->fw_ddb_index_map
[fw_ddb_index
] = ddb_entry
;
477 * qla4xxx_configure_ddbs - builds driver ddb list
478 * @ha: Pointer to host adapter structure.
480 * This routine searches for all valid firmware ddb entries and builds
481 * an internal ddb list. Ddbs that are considered valid are those with
482 * a device state of SESSION_ACTIVE.
484 static int qla4xxx_build_ddb_list(struct scsi_qla_host
*ha
)
486 int status
= QLA_SUCCESS
;
487 uint32_t fw_ddb_index
= 0;
488 uint32_t next_fw_ddb_index
= 0;
490 uint32_t conn_err
, err_code
;
491 struct ddb_entry
*ddb_entry
;
493 dev_info(&ha
->pdev
->dev
, "Initializing DDBs ...\n");
494 for (fw_ddb_index
= 0; fw_ddb_index
< MAX_DDB_ENTRIES
;
495 fw_ddb_index
= next_fw_ddb_index
) {
496 /* First, let's see if a device exists here */
497 if (qla4xxx_get_fwddb_entry(ha
, fw_ddb_index
, NULL
, 0, NULL
,
498 &next_fw_ddb_index
, &ddb_state
,
499 &conn_err
, NULL
, NULL
) ==
501 DEBUG2(printk("scsi%ld: %s: get_ddb_entry, "
502 "fw_ddb_index %d failed", ha
->host_no
,
503 __func__
, fw_ddb_index
));
507 DEBUG2(printk("scsi%ld: %s: Getting DDB[%d] ddbstate=0x%x, "
508 "next_fw_ddb_index=%d.\n", ha
->host_no
, __func__
,
509 fw_ddb_index
, ddb_state
, next_fw_ddb_index
));
511 /* Issue relogin, if necessary. */
512 if (ddb_state
== DDB_DS_SESSION_FAILED
||
513 ddb_state
== DDB_DS_NO_CONNECTION_ACTIVE
) {
514 /* Try and login to device */
515 DEBUG2(printk("scsi%ld: %s: Login to DDB[%d]\n",
516 ha
->host_no
, __func__
, fw_ddb_index
));
517 err_code
= ((conn_err
& 0x00ff0000) >> 16);
518 if (err_code
== 0x1c || err_code
== 0x06) {
519 DEBUG2(printk("scsi%ld: %s send target "
521 "or access denied failure\n",
522 ha
->host_no
, __func__
));
524 qla4xxx_set_ddb_entry(ha
, fw_ddb_index
, 0);
527 if (ddb_state
!= DDB_DS_SESSION_ACTIVE
)
530 * if fw_ddb with session active state found,
533 DEBUG2(printk("scsi%ld: %s: DDB[%d] added to list\n",
534 ha
->host_no
, __func__
, fw_ddb_index
));
536 /* Add DDB to internal our ddb list. */
537 ddb_entry
= qla4xxx_get_ddb_entry(ha
, fw_ddb_index
);
538 if (ddb_entry
== NULL
) {
539 DEBUG2(printk("scsi%ld: %s: Unable to allocate memory "
540 "for device at fw_ddb_index %d\n",
541 ha
->host_no
, __func__
, fw_ddb_index
));
544 /* Fill in the device structure */
545 if (qla4xxx_update_ddb_entry(ha
, ddb_entry
, fw_ddb_index
) ==
547 ha
->fw_ddb_index_map
[fw_ddb_index
] =
548 (struct ddb_entry
*)INVALID_ENTRY
;
551 DEBUG2(printk("scsi%ld: %s: update_ddb_entry failed "
552 "for fw_ddb_index %d.\n",
553 ha
->host_no
, __func__
, fw_ddb_index
));
558 /* We know we've reached the last device when
559 * next_fw_ddb_index is 0 */
560 if (next_fw_ddb_index
== 0)
564 dev_info(&ha
->pdev
->dev
, "DDB list done..\n");
569 struct qla4_relog_scan
{
573 uint32_t fw_ddb_index
;
574 uint32_t next_fw_ddb_index
;
575 uint32_t fw_ddb_device_state
;
578 static int qla4_test_rdy(struct scsi_qla_host
*ha
, struct qla4_relog_scan
*rs
)
580 struct ddb_entry
*ddb_entry
;
583 * Don't want to do a relogin if connection
586 rs
->err_code
= ((rs
->conn_err
& 0x00ff0000) >> 16);
587 if (rs
->err_code
== 0x1c || rs
->err_code
== 0x06) {
589 "scsi%ld: %s send target"
591 "access denied failure\n",
592 ha
->host_no
, __func__
));
594 /* We either have a device that is in
595 * the process of relogging in or a
596 * device that is waiting to be
600 ddb_entry
= qla4xxx_lookup_ddb_by_fw_index(ha
,
602 if (ddb_entry
== NULL
)
605 if (ddb_entry
->dev_scan_wait_to_start_relogin
!= 0
606 && time_after_eq(jiffies
,
608 dev_scan_wait_to_start_relogin
))
610 ddb_entry
->dev_scan_wait_to_start_relogin
= 0;
611 qla4xxx_set_ddb_entry(ha
, rs
->fw_ddb_index
, 0);
617 static int qla4_scan_for_relogin(struct scsi_qla_host
*ha
,
618 struct qla4_relog_scan
*rs
)
623 * ----------------- */
624 for (rs
->fw_ddb_index
= 0; rs
->fw_ddb_index
< MAX_DDB_ENTRIES
;
625 rs
->fw_ddb_index
= rs
->next_fw_ddb_index
) {
626 if (qla4xxx_get_fwddb_entry(ha
, rs
->fw_ddb_index
, NULL
, 0,
627 NULL
, &rs
->next_fw_ddb_index
,
628 &rs
->fw_ddb_device_state
,
629 &rs
->conn_err
, NULL
, NULL
)
633 if (rs
->fw_ddb_device_state
== DDB_DS_LOGIN_IN_PROCESS
)
636 if (rs
->fw_ddb_device_state
== DDB_DS_SESSION_FAILED
||
637 rs
->fw_ddb_device_state
== DDB_DS_NO_CONNECTION_ACTIVE
) {
638 error
= qla4_test_rdy(ha
, rs
);
643 /* We know we've reached the last device when
644 * next_fw_ddb_index is 0 */
645 if (rs
->next_fw_ddb_index
== 0)
652 * qla4xxx_devices_ready - wait for target devices to be logged in
653 * @ha: pointer to adapter structure
655 * This routine waits up to ql4xdiscoverywait seconds
656 * F/W database during driver load time.
658 static int qla4xxx_devices_ready(struct scsi_qla_host
*ha
)
661 unsigned long discovery_wtime
;
662 struct qla4_relog_scan rs
;
664 discovery_wtime
= jiffies
+ (ql4xdiscoverywait
* HZ
);
666 DEBUG(printk("Waiting (%d) for devices ...\n", ql4xdiscoverywait
));
669 qla4xxx_get_firmware_state(ha
);
670 if (test_and_clear_bit(DPC_AEN
, &ha
->dpc_flags
)) {
671 /* Set time-between-relogin timer */
672 qla4xxx_process_aen(ha
, RELOGIN_DDB_CHANGED_AENS
);
675 /* if no relogins active or needed, halt discvery wait */
678 error
= qla4_scan_for_relogin(ha
, &rs
);
681 DEBUG2(printk("scsi%ld: %s: Delay halted. Devices "
682 "Ready.\n", ha
->host_no
, __func__
));
687 } while (!time_after_eq(jiffies
, discovery_wtime
));
689 DEBUG3(qla4xxx_get_conn_event_log(ha
));
694 static void qla4xxx_flush_AENS(struct scsi_qla_host
*ha
)
698 /* Flush the 0x8014 AEN from the firmware as a result of
699 * Auto connect. We are basically doing get_firmware_ddb()
700 * to determine whether we need to log back in or not.
701 * Trying to do a set ddb before we have processed 0x8014
702 * will result in another set_ddb() for the same ddb. In other
703 * words there will be stale entries in the aen_q.
705 wtime
= jiffies
+ (2 * HZ
);
707 if (qla4xxx_get_firmware_state(ha
) == QLA_SUCCESS
)
708 if (ha
->firmware_state
& (BIT_2
| BIT_0
))
711 if (test_and_clear_bit(DPC_AEN
, &ha
->dpc_flags
))
712 qla4xxx_process_aen(ha
, FLUSH_DDB_CHANGED_AENS
);
715 } while (!time_after_eq(jiffies
, wtime
));
719 static int qla4xxx_initialize_ddb_list(struct scsi_qla_host
*ha
)
721 uint16_t fw_ddb_index
;
722 int status
= QLA_SUCCESS
;
724 /* free the ddb list if is not empty */
725 if (!list_empty(&ha
->ddb_list
))
726 qla4xxx_free_ddb_list(ha
);
728 for (fw_ddb_index
= 0; fw_ddb_index
< MAX_DDB_ENTRIES
; fw_ddb_index
++)
729 ha
->fw_ddb_index_map
[fw_ddb_index
] =
730 (struct ddb_entry
*)INVALID_ENTRY
;
734 qla4xxx_flush_AENS(ha
);
737 * First perform device discovery for active
738 * fw ddb indexes and build
741 if ((status
= qla4xxx_build_ddb_list(ha
)) == QLA_ERROR
)
744 /* Wait for an AEN */
745 qla4xxx_devices_ready(ha
);
748 * Targets can come online after the inital discovery, so processing
749 * the aens here will catch them.
751 if (test_and_clear_bit(DPC_AEN
, &ha
->dpc_flags
))
752 qla4xxx_process_aen(ha
, PROCESS_ALL_AENS
);
758 * qla4xxx_update_ddb_list - update the driver ddb list
759 * @ha: pointer to host adapter structure.
761 * This routine obtains device information from the F/W database after
762 * firmware or adapter resets. The device table is preserved.
764 int qla4xxx_reinitialize_ddb_list(struct scsi_qla_host
*ha
)
766 int status
= QLA_SUCCESS
;
767 struct ddb_entry
*ddb_entry
, *detemp
;
769 /* Update the device information for all devices. */
770 list_for_each_entry_safe(ddb_entry
, detemp
, &ha
->ddb_list
, list
) {
771 qla4xxx_update_ddb_entry(ha
, ddb_entry
,
772 ddb_entry
->fw_ddb_index
);
773 if (ddb_entry
->fw_ddb_device_state
== DDB_DS_SESSION_ACTIVE
) {
774 atomic_set(&ddb_entry
->state
, DDB_STATE_ONLINE
);
775 DEBUG2(printk ("scsi%ld: %s: ddb index [%d] marked "
776 "ONLINE\n", ha
->host_no
, __func__
,
777 ddb_entry
->fw_ddb_index
));
778 } else if (atomic_read(&ddb_entry
->state
) == DDB_STATE_ONLINE
)
779 qla4xxx_mark_device_missing(ha
, ddb_entry
);
785 * qla4xxx_relogin_device - re-establish session
786 * @ha: Pointer to host adapter structure.
787 * @ddb_entry: Pointer to device database entry
789 * This routine does a session relogin with the specified device.
790 * The ddb entry must be assigned prior to making this call.
792 int qla4xxx_relogin_device(struct scsi_qla_host
*ha
,
793 struct ddb_entry
* ddb_entry
)
795 uint16_t relogin_timer
;
797 relogin_timer
= max(ddb_entry
->default_relogin_timeout
,
798 (uint16_t)RELOGIN_TOV
);
799 atomic_set(&ddb_entry
->relogin_timer
, relogin_timer
);
801 DEBUG2(printk("scsi%ld: Relogin index [%d]. TOV=%d\n", ha
->host_no
,
802 ddb_entry
->fw_ddb_index
, relogin_timer
));
804 qla4xxx_set_ddb_entry(ha
, ddb_entry
->fw_ddb_index
, 0);
810 * qla4010_get_topcat_presence - check if it is QLA4040 TopCat Chip
811 * @ha: Pointer to host adapter structure.
814 static int qla4010_get_topcat_presence(struct scsi_qla_host
*ha
)
819 if (ql4xxx_lock_nvram(ha
) != QLA_SUCCESS
)
821 spin_lock_irqsave(&ha
->hardware_lock
, flags
);
822 topcat
= rd_nvram_word(ha
, offsetof(struct eeprom_data
,
824 spin_unlock_irqrestore(&ha
->hardware_lock
, flags
);
826 if ((topcat
& TOPCAT_MASK
) == TOPCAT_PRESENT
)
827 set_bit(AF_TOPCAT_CHIP_PRESENT
, &ha
->flags
);
829 clear_bit(AF_TOPCAT_CHIP_PRESENT
, &ha
->flags
);
830 ql4xxx_unlock_nvram(ha
);
835 static int qla4xxx_config_nvram(struct scsi_qla_host
*ha
)
838 union external_hw_config_reg extHwConfig
;
840 DEBUG2(printk("scsi%ld: %s: Get EEProm parameters \n", ha
->host_no
,
842 if (ql4xxx_lock_flash(ha
) != QLA_SUCCESS
)
844 if (ql4xxx_lock_nvram(ha
) != QLA_SUCCESS
) {
845 ql4xxx_unlock_flash(ha
);
849 /* Get EEPRom Parameters from NVRAM and validate */
850 dev_info(&ha
->pdev
->dev
, "Configuring NVRAM ...\n");
851 if (qla4xxx_is_nvram_configuration_valid(ha
) == QLA_SUCCESS
) {
852 spin_lock_irqsave(&ha
->hardware_lock
, flags
);
853 extHwConfig
.Asuint32_t
=
854 rd_nvram_word(ha
, eeprom_ext_hw_conf_offset(ha
));
855 spin_unlock_irqrestore(&ha
->hardware_lock
, flags
);
858 * QLogic adapters should always have a valid NVRAM.
859 * If not valid, do not load.
861 dev_warn(&ha
->pdev
->dev
,
862 "scsi%ld: %s: EEProm checksum invalid. "
863 "Please update your EEPROM\n", ha
->host_no
,
868 extHwConfig
.Asuint32_t
= 0x1912;
869 else if (is_qla4022(ha
))
870 extHwConfig
.Asuint32_t
= 0x0023;
872 DEBUG(printk("scsi%ld: %s: Setting extHwConfig to 0xFFFF%04x\n",
873 ha
->host_no
, __func__
, extHwConfig
.Asuint32_t
));
875 spin_lock_irqsave(&ha
->hardware_lock
, flags
);
876 writel((0xFFFF << 16) | extHwConfig
.Asuint32_t
, isp_ext_hw_conf(ha
));
877 readl(isp_ext_hw_conf(ha
));
878 spin_unlock_irqrestore(&ha
->hardware_lock
, flags
);
880 ql4xxx_unlock_nvram(ha
);
881 ql4xxx_unlock_flash(ha
);
883 return (QLA_SUCCESS
);
886 static void qla4x00_pci_config(struct scsi_qla_host
*ha
)
890 dev_info(&ha
->pdev
->dev
, "Configuring PCI space...\n");
892 pci_set_master(ha
->pdev
);
894 if (pci_set_mwi(ha
->pdev
))
895 mwi
= PCI_COMMAND_INVALIDATE
;
897 * We want to respect framework's setting of PCI configuration space
898 * command register and also want to make sure that all bits of
899 * interest to us are properly set in command register.
901 pci_read_config_word(ha
->pdev
, PCI_COMMAND
, &w
);
902 w
|= mwi
| (PCI_COMMAND_PARITY
| PCI_COMMAND_SERR
);
903 w
&= ~PCI_COMMAND_INTX_DISABLE
;
904 pci_write_config_word(ha
->pdev
, PCI_COMMAND
, w
);
907 static int qla4xxx_start_firmware_from_flash(struct scsi_qla_host
*ha
)
909 int status
= QLA_ERROR
;
910 uint32_t max_wait_time
;
912 uint32_t mbox_status
;
914 dev_info(&ha
->pdev
->dev
, "Starting firmware ...\n");
917 * Start firmware from flash ROM
919 * WORKAROUND: Stuff a non-constant value that the firmware can
920 * use as a seed for a random number generator in MB7 prior to
921 * setting BOOT_ENABLE. Fixes problem where the TCP
922 * connections use the same TCP ports after each reboot,
923 * causing some connections to not get re-established.
925 DEBUG(printk("scsi%d: %s: Start firmware from flash ROM\n",
926 ha
->host_no
, __func__
));
928 spin_lock_irqsave(&ha
->hardware_lock
, flags
);
929 writel(jiffies
, &ha
->reg
->mailbox
[7]);
931 writel(set_rmask(NVR_WRITE_ENABLE
),
932 &ha
->reg
->u1
.isp4022
.nvram
);
934 writel(set_rmask(CSR_BOOT_ENABLE
), &ha
->reg
->ctrl_status
);
935 readl(&ha
->reg
->ctrl_status
);
936 spin_unlock_irqrestore(&ha
->hardware_lock
, flags
);
938 /* Wait for firmware to come UP. */
939 max_wait_time
= FIRMWARE_UP_TOV
* 4;
941 uint32_t ctrl_status
;
943 spin_lock_irqsave(&ha
->hardware_lock
, flags
);
944 ctrl_status
= readw(&ha
->reg
->ctrl_status
);
945 mbox_status
= readw(&ha
->reg
->mailbox
[0]);
946 spin_unlock_irqrestore(&ha
->hardware_lock
, flags
);
948 if (ctrl_status
& set_rmask(CSR_SCSI_PROCESSOR_INTR
))
950 if (mbox_status
== MBOX_STS_COMMAND_COMPLETE
)
953 DEBUG2(printk("scsi%ld: %s: Waiting for boot firmware to "
954 "complete... ctrl_sts=0x%x, remaining=%d\n",
955 ha
->host_no
, __func__
, ctrl_status
,
959 } while ((max_wait_time
--));
961 if (mbox_status
== MBOX_STS_COMMAND_COMPLETE
) {
962 DEBUG(printk("scsi%ld: %s: Firmware has started\n",
963 ha
->host_no
, __func__
));
965 spin_lock_irqsave(&ha
->hardware_lock
, flags
);
966 writel(set_rmask(CSR_SCSI_PROCESSOR_INTR
),
967 &ha
->reg
->ctrl_status
);
968 readl(&ha
->reg
->ctrl_status
);
969 spin_unlock_irqrestore(&ha
->hardware_lock
, flags
);
971 status
= QLA_SUCCESS
;
973 printk(KERN_INFO
"scsi%ld: %s: Boot firmware failed "
974 "- mbox status 0x%x\n", ha
->host_no
, __func__
,
981 static int ql4xxx_lock_drvr_wait(struct scsi_qla_host
*a
)
983 #define QL4_LOCK_DRVR_WAIT 300
984 #define QL4_LOCK_DRVR_SLEEP 100
986 int drvr_wait
= QL4_LOCK_DRVR_WAIT
;
988 if (ql4xxx_lock_drvr(a
) == 0) {
989 msleep(QL4_LOCK_DRVR_SLEEP
);
991 DEBUG2(printk("scsi%ld: %s: Waiting for "
992 "Global Init Semaphore...n",
996 drvr_wait
-= QL4_LOCK_DRVR_SLEEP
;
998 DEBUG2(printk("scsi%ld: %s: Global Init Semaphore "
999 "acquired.n", a
->host_no
, __func__
));
1007 * qla4xxx_start_firmware - starts qla4xxx firmware
1008 * @ha: Pointer to host adapter structure.
1010 * This routine performs the neccessary steps to start the firmware for
1011 * the QLA4010 adapter.
1013 static int qla4xxx_start_firmware(struct scsi_qla_host
*ha
)
1015 unsigned long flags
= 0;
1016 uint32_t mbox_status
;
1017 int status
= QLA_ERROR
;
1019 int config_chip
= 0;
1021 if (is_qla4010(ha
)){
1022 if (qla4010_get_topcat_presence(ha
) != QLA_SUCCESS
)
1027 ql4xxx_set_mac_number(ha
);
1029 if (ql4xxx_lock_drvr_wait(ha
) != QLA_SUCCESS
)
1032 spin_lock_irqsave(&ha
->hardware_lock
, flags
);
1034 DEBUG2(printk("scsi%ld: %s: port_ctrl = 0x%08X\n", ha
->host_no
,
1035 __func__
, readw(isp_port_ctrl(ha
))));
1036 DEBUG(printk("scsi%ld: %s: port_status = 0x%08X\n", ha
->host_no
,
1037 __func__
, readw(isp_port_status(ha
))));
1039 /* Is Hardware already initialized? */
1040 if ((readw(isp_port_ctrl(ha
)) & 0x8000) != 0) {
1041 DEBUG(printk("scsi%ld: %s: Hardware has already been "
1042 "initialized\n", ha
->host_no
, __func__
));
1044 /* Receive firmware boot acknowledgement */
1045 mbox_status
= readw(&ha
->reg
->mailbox
[0]);
1047 DEBUG2(printk("scsi%ld: %s: H/W Config complete - mbox[0]= "
1048 "0x%x\n", ha
->host_no
, __func__
, mbox_status
));
1050 /* Is firmware already booted? */
1051 if (mbox_status
== 0) {
1052 /* F/W not running, must be config by net driver */
1056 writel(set_rmask(CSR_SCSI_PROCESSOR_INTR
),
1057 &ha
->reg
->ctrl_status
);
1058 readl(&ha
->reg
->ctrl_status
);
1059 spin_unlock_irqrestore(&ha
->hardware_lock
, flags
);
1060 if (qla4xxx_get_firmware_state(ha
) == QLA_SUCCESS
) {
1061 DEBUG2(printk("scsi%ld: %s: Get firmware "
1062 "state -- state = 0x%x\n",
1064 __func__
, ha
->firmware_state
));
1065 /* F/W is running */
1066 if (ha
->firmware_state
&
1067 FW_STATE_CONFIG_WAIT
) {
1068 DEBUG2(printk("scsi%ld: %s: Firmware "
1069 "in known state -- "
1071 "boot, state = 0x%x\n",
1072 ha
->host_no
, __func__
,
1073 ha
->firmware_state
));
1078 DEBUG2(printk("scsi%ld: %s: Firmware in "
1079 "unknown state -- resetting,"
1081 "0x%x\n", ha
->host_no
, __func__
,
1082 ha
->firmware_state
));
1084 spin_lock_irqsave(&ha
->hardware_lock
, flags
);
1087 DEBUG(printk("scsi%ld: %s: H/W initialization hasn't been "
1088 "started - resetting\n", ha
->host_no
, __func__
));
1090 spin_unlock_irqrestore(&ha
->hardware_lock
, flags
);
1092 DEBUG(printk("scsi%ld: %s: Flags soft_rest=%d, config= %d\n ",
1093 ha
->host_no
, __func__
, soft_reset
, config_chip
));
1095 DEBUG(printk("scsi%ld: %s: Issue Soft Reset\n", ha
->host_no
,
1097 status
= qla4xxx_soft_reset(ha
);
1098 if (status
== QLA_ERROR
) {
1099 DEBUG(printk("scsi%d: %s: Soft Reset failed!\n",
1100 ha
->host_no
, __func__
));
1101 ql4xxx_unlock_drvr(ha
);
1106 /* Reset clears the semaphore, so aquire again */
1107 if (ql4xxx_lock_drvr_wait(ha
) != QLA_SUCCESS
)
1112 if ((status
= qla4xxx_config_nvram(ha
)) == QLA_SUCCESS
)
1113 status
= qla4xxx_start_firmware_from_flash(ha
);
1116 ql4xxx_unlock_drvr(ha
);
1117 if (status
== QLA_SUCCESS
) {
1118 qla4xxx_get_fw_version(ha
);
1119 if (test_and_clear_bit(AF_GET_CRASH_RECORD
, &ha
->flags
))
1120 qla4xxx_get_crash_record(ha
);
1122 DEBUG(printk("scsi%ld: %s: Firmware has NOT started\n",
1123 ha
->host_no
, __func__
));
1130 * qla4xxx_initialize_adapter - initiailizes hba
1131 * @ha: Pointer to host adapter structure.
1132 * @renew_ddb_list: Indicates what to do with the adapter's ddb list
1133 * after adapter recovery has completed.
1134 * 0=preserve ddb list, 1=destroy and rebuild ddb list
1136 * This routine parforms all of the steps necessary to initialize the adapter.
1139 int qla4xxx_initialize_adapter(struct scsi_qla_host
*ha
,
1140 uint8_t renew_ddb_list
)
1142 int status
= QLA_ERROR
;
1143 int8_t ip_address
[IP_ADDR_LEN
] = {0} ;
1145 ha
->eeprom_cmd_data
= 0;
1147 qla4x00_pci_config(ha
);
1149 qla4xxx_disable_intrs(ha
);
1151 /* Initialize the Host adapter request/response queues and firmware */
1152 if (qla4xxx_start_firmware(ha
) == QLA_ERROR
)
1155 if (qla4xxx_validate_mac_address(ha
) == QLA_ERROR
)
1158 if (qla4xxx_init_local_data(ha
) == QLA_ERROR
)
1161 status
= qla4xxx_init_firmware(ha
);
1162 if (status
== QLA_ERROR
)
1166 * FW is waiting to get an IP address from DHCP server: Skip building
1167 * the ddb_list and wait for DHCP lease acquired aen to come in
1168 * followed by 0x8014 aen" to trigger the tgt discovery process.
1170 if (ha
->firmware_state
& FW_STATE_DHCP_IN_PROGRESS
)
1173 /* Skip device discovery if ip and subnet is zero */
1174 if (memcmp(ha
->ip_address
, ip_address
, IP_ADDR_LEN
) == 0 ||
1175 memcmp(ha
->subnet_mask
, ip_address
, IP_ADDR_LEN
) == 0)
1178 if (renew_ddb_list
== PRESERVE_DDB_LIST
) {
1180 * We want to preserve lun states (i.e. suspended, etc.)
1181 * for recovery initiated by the driver. So just update
1182 * the device states for the existing ddb_list.
1184 qla4xxx_reinitialize_ddb_list(ha
);
1185 } else if (renew_ddb_list
== REBUILD_DDB_LIST
) {
1187 * We want to build the ddb_list from scratch during
1188 * driver initialization and recovery initiated by the
1189 * INT_HBA_RESET IOCTL.
1191 status
= qla4xxx_initialize_ddb_list(ha
);
1192 if (status
== QLA_ERROR
) {
1193 DEBUG2(printk("%s(%ld) Error occurred during build"
1194 "ddb list\n", __func__
, ha
->host_no
));
1199 if (!ha
->tot_ddbs
) {
1200 DEBUG2(printk("scsi%ld: Failed to initialize devices or none "
1201 "present in Firmware device database\n",
1211 * qla4xxx_add_device_dynamically - ddb addition due to an AEN
1212 * @ha: Pointer to host adapter structure.
1213 * @fw_ddb_index: Firmware's device database index
1215 * This routine processes adds a device as a result of an 8014h AEN.
1217 static void qla4xxx_add_device_dynamically(struct scsi_qla_host
*ha
,
1218 uint32_t fw_ddb_index
)
1220 struct ddb_entry
* ddb_entry
;
1222 /* First allocate a device structure */
1223 ddb_entry
= qla4xxx_get_ddb_entry(ha
, fw_ddb_index
);
1224 if (ddb_entry
== NULL
) {
1225 DEBUG2(printk(KERN_WARNING
1226 "scsi%ld: Unable to allocate memory to add "
1227 "fw_ddb_index %d\n", ha
->host_no
, fw_ddb_index
));
1231 if (qla4xxx_update_ddb_entry(ha
, ddb_entry
, fw_ddb_index
) ==
1233 ha
->fw_ddb_index_map
[fw_ddb_index
] =
1234 (struct ddb_entry
*)INVALID_ENTRY
;
1235 DEBUG2(printk(KERN_WARNING
1236 "scsi%ld: failed to add new device at index "
1237 "[%d]\n Unable to retrieve fw ddb entry\n",
1238 ha
->host_no
, fw_ddb_index
));
1239 qla4xxx_free_ddb(ha
, ddb_entry
);
1243 if (qla4xxx_add_sess(ddb_entry
)) {
1244 DEBUG2(printk(KERN_WARNING
1245 "scsi%ld: failed to add new device at index "
1246 "[%d]\n Unable to add connection and session\n",
1247 ha
->host_no
, fw_ddb_index
));
1248 qla4xxx_free_ddb(ha
, ddb_entry
);
1253 * qla4xxx_process_ddb_changed - process ddb state change
1254 * @ha - Pointer to host adapter structure.
1255 * @fw_ddb_index - Firmware's device database index
1256 * @state - Device state
1258 * This routine processes a Decive Database Changed AEN Event.
1260 int qla4xxx_process_ddb_changed(struct scsi_qla_host
*ha
,
1261 uint32_t fw_ddb_index
, uint32_t state
)
1263 struct ddb_entry
* ddb_entry
;
1264 uint32_t old_fw_ddb_device_state
;
1266 /* check for out of range index */
1267 if (fw_ddb_index
>= MAX_DDB_ENTRIES
)
1270 /* Get the corresponging ddb entry */
1271 ddb_entry
= qla4xxx_lookup_ddb_by_fw_index(ha
, fw_ddb_index
);
1272 /* Device does not currently exist in our database. */
1273 if (ddb_entry
== NULL
) {
1274 if (state
== DDB_DS_SESSION_ACTIVE
)
1275 qla4xxx_add_device_dynamically(ha
, fw_ddb_index
);
1279 /* Device already exists in our database. */
1280 old_fw_ddb_device_state
= ddb_entry
->fw_ddb_device_state
;
1281 DEBUG2(printk("scsi%ld: %s DDB - old state= 0x%x, new state=0x%x for "
1282 "index [%d]\n", ha
->host_no
, __func__
,
1283 ddb_entry
->fw_ddb_device_state
, state
, fw_ddb_index
));
1284 if (old_fw_ddb_device_state
== state
&&
1285 state
== DDB_DS_SESSION_ACTIVE
) {
1286 /* Do nothing, state not changed. */
1290 ddb_entry
->fw_ddb_device_state
= state
;
1291 /* Device is back online. */
1292 if (ddb_entry
->fw_ddb_device_state
== DDB_DS_SESSION_ACTIVE
) {
1293 atomic_set(&ddb_entry
->port_down_timer
,
1294 ha
->port_down_retry_count
);
1295 atomic_set(&ddb_entry
->state
, DDB_STATE_ONLINE
);
1296 atomic_set(&ddb_entry
->relogin_retry_count
, 0);
1297 atomic_set(&ddb_entry
->relogin_timer
, 0);
1298 clear_bit(DF_RELOGIN
, &ddb_entry
->flags
);
1299 clear_bit(DF_NO_RELOGIN
, &ddb_entry
->flags
);
1300 iscsi_if_create_session_done(ddb_entry
->conn
);
1302 * Change the lun state to READY in case the lun TIMEOUT before
1303 * the device came back.
1306 /* Device went away, try to relogin. */
1307 /* Mark device missing */
1308 if (atomic_read(&ddb_entry
->state
) == DDB_STATE_ONLINE
)
1309 qla4xxx_mark_device_missing(ha
, ddb_entry
);
1311 * Relogin if device state changed to a not active state.
1312 * However, do not relogin if this aen is a result of an IOCTL
1313 * logout (DF_NO_RELOGIN) or if this is a discovered device.
1315 if (ddb_entry
->fw_ddb_device_state
== DDB_DS_SESSION_FAILED
&&
1316 !test_bit(DF_RELOGIN
, &ddb_entry
->flags
) &&
1317 !test_bit(DF_NO_RELOGIN
, &ddb_entry
->flags
) &&
1318 !test_bit(DF_ISNS_DISCOVERED
, &ddb_entry
->flags
)) {
1320 * This triggers a relogin. After the relogin_timer
1321 * expires, the relogin gets scheduled. We must wait a
1322 * minimum amount of time since receiving an 0x8014 AEN
1323 * with failed device_state or a logout response before
1324 * we can issue another relogin.
1326 /* Firmware padds this timeout: (time2wait +1).
1327 * Driver retry to login should be longer than F/W.
1328 * Otherwise F/W will fail
1329 * set_ddb() mbx cmd with 0x4005 since it still
1330 * counting down its time2wait.
1332 atomic_set(&ddb_entry
->relogin_timer
, 0);
1333 atomic_set(&ddb_entry
->retry_relogin_timer
,
1334 ddb_entry
->default_time2wait
+ 4);