]> err.no Git - linux-2.6/blobdiff - drivers/scsi/lpfc/lpfc_sli.c
ALSA: wm8750: add missing VREF output
[linux-2.6] / drivers / scsi / lpfc / lpfc_sli.c
index 70a0a9eab21106a70cba3bef3589a1ee3261db29..50fe07646738cc20043de2d56452063f64673296 100644 (file)
@@ -219,7 +219,7 @@ lpfc_sli_iocb_cmd_type(uint8_t iocb_cmnd)
        case CMD_IOCB_LOGENTRY_CN:
        case CMD_IOCB_LOGENTRY_ASYNC_CN:
                printk("%s - Unhandled SLI-3 Command x%x\n",
-                               __FUNCTION__, iocb_cmnd);
+                               __func__, iocb_cmnd);
                type = LPFC_UNKNOWN_IOCB;
                break;
        default:
@@ -324,9 +324,7 @@ lpfc_sli_next_iocb_slot (struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
                        phba->work_ha |= HA_ERATT;
                        phba->work_hs = HS_FFER3;
 
-                       /* hbalock should already be held */
-                       if (phba->work_wait)
-                               lpfc_worker_wake_up(phba);
+                       lpfc_worker_wake_up(phba);
 
                        return NULL;
                }
@@ -1309,9 +1307,7 @@ lpfc_sli_rsp_pointers_error(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
        phba->work_ha |= HA_ERATT;
        phba->work_hs = HS_FFER3;
 
-       /* hbalock should already be held */
-       if (phba->work_wait)
-               lpfc_worker_wake_up(phba);
+       lpfc_worker_wake_up(phba);
 
        return;
 }
@@ -1719,7 +1715,7 @@ lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba,
                rspiocbp = __lpfc_sli_get_iocbq(phba);
                if (rspiocbp == NULL) {
                        printk(KERN_ERR "%s: out of buffers! Failing "
-                              "completion.\n", __FUNCTION__);
+                              "completion.\n", __func__);
                        break;
                }
 
@@ -2611,12 +2607,9 @@ lpfc_mbox_timeout(unsigned long ptr)
                phba->pport->work_port_events |= WORKER_MBOX_TMO;
        spin_unlock_irqrestore(&phba->pport->work_port_lock, iflag);
 
-       if (!tmo_posted) {
-               spin_lock_irqsave(&phba->hbalock, iflag);
-               if (phba->work_wait)
-                       lpfc_worker_wake_up(phba);
-               spin_unlock_irqrestore(&phba->hbalock, iflag);
-       }
+       if (!tmo_posted)
+               lpfc_worker_wake_up(phba);
+       return;
 }
 
 void
@@ -3374,8 +3367,12 @@ lpfc_sli_host_down(struct lpfc_vport *vport)
        for (i = 0; i < psli->num_rings; i++) {
                pring = &psli->ring[i];
                prev_pring_flag = pring->flag;
-               if (pring->ringno == LPFC_ELS_RING) /* Only slow rings */
+               /* Only slow rings */
+               if (pring->ringno == LPFC_ELS_RING) {
                        pring->flag |= LPFC_DEFERRED_RING_EVENT;
+                       /* Set the lpfc data pending flag */
+                       set_bit(LPFC_DATA_READY, &phba->data_flags);
+               }
                /*
                 * Error everything on the txq since these iocbs have not been
                 * given to the FW yet.
@@ -3434,8 +3431,12 @@ lpfc_sli_hba_down(struct lpfc_hba *phba)
        spin_lock_irqsave(&phba->hbalock, flags);
        for (i = 0; i < psli->num_rings; i++) {
                pring = &psli->ring[i];
-               if (pring->ringno == LPFC_ELS_RING) /* Only slow rings */
+               /* Only slow rings */
+               if (pring->ringno == LPFC_ELS_RING) {
                        pring->flag |= LPFC_DEFERRED_RING_EVENT;
+                       /* Set the lpfc data pending flag */
+                       set_bit(LPFC_DATA_READY, &phba->data_flags);
+               }
 
                /*
                 * Error everything on the txq since these iocbs have not been
@@ -3762,7 +3763,6 @@ lpfc_sli_validate_fcp_iocb(struct lpfc_iocbq *iocbq, struct lpfc_vport *vport,
                           lpfc_ctx_cmd ctx_cmd)
 {
        struct lpfc_scsi_buf *lpfc_cmd;
-       struct scsi_cmnd *cmnd;
        int rc = 1;
 
        if (!(iocbq->iocb_flag &  LPFC_IO_FCP))
@@ -3772,19 +3772,20 @@ lpfc_sli_validate_fcp_iocb(struct lpfc_iocbq *iocbq, struct lpfc_vport *vport,
                return rc;
 
        lpfc_cmd = container_of(iocbq, struct lpfc_scsi_buf, cur_iocbq);
-       cmnd = lpfc_cmd->pCmd;
 
-       if (cmnd == NULL)
+       if (lpfc_cmd->pCmd == NULL)
                return rc;
 
        switch (ctx_cmd) {
        case LPFC_CTX_LUN:
-               if ((cmnd->device->id == tgt_id) &&
-                   (cmnd->device->lun == lun_id))
+               if ((lpfc_cmd->rdata->pnode) &&
+                   (lpfc_cmd->rdata->pnode->nlp_sid == tgt_id) &&
+                   (scsilun_to_int(&lpfc_cmd->fcp_cmnd->fcp_lun) == lun_id))
                        rc = 0;
                break;
        case LPFC_CTX_TGT:
-               if (cmnd->device->id == tgt_id)
+               if ((lpfc_cmd->rdata->pnode) &&
+                   (lpfc_cmd->rdata->pnode->nlp_sid == tgt_id))
                        rc = 0;
                break;
        case LPFC_CTX_HOST:
@@ -3792,7 +3793,7 @@ lpfc_sli_validate_fcp_iocb(struct lpfc_iocbq *iocbq, struct lpfc_vport *vport,
                break;
        default:
                printk(KERN_ERR "%s: Unknown context cmd type, value %d\n",
-                       __FUNCTION__, ctx_cmd);
+                       __func__, ctx_cmd);
                break;
        }
 
@@ -3994,6 +3995,7 @@ lpfc_sli_issue_mbox_wait(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq,
        if (pmboxq->context1)
                return MBX_NOT_FINISHED;
 
+       pmboxq->mbox_flag &= ~LPFC_MBX_WAKE;
        /* setup wake call as IOCB callback */
        pmboxq->mbox_cmpl = lpfc_sli_wake_mbox_wait;
        /* setup context field to pass wait_queue pointer to wake function  */
@@ -4159,7 +4161,7 @@ lpfc_intr_handler(int irq, void *dev_id)
                                                "pwork:x%x hawork:x%x wait:x%x",
                                                phba->work_ha, work_ha_copy,
                                                (uint32_t)((unsigned long)
-                                               phba->work_wait));
+                                               &phba->work_waitq));
 
                                        control &=
                                            ~(HC_R0INT_ENA << LPFC_ELS_RING);
@@ -4172,7 +4174,7 @@ lpfc_intr_handler(int irq, void *dev_id)
                                                "x%x hawork:x%x wait:x%x",
                                                phba->work_ha, work_ha_copy,
                                                (uint32_t)((unsigned long)
-                                               phba->work_wait));
+                                               &phba->work_waitq));
                                }
                                spin_unlock(&phba->hbalock);
                        }
@@ -4297,9 +4299,8 @@ send_current_mbox:
 
                spin_lock(&phba->hbalock);
                phba->work_ha |= work_ha_copy;
-               if (phba->work_wait)
-                       lpfc_worker_wake_up(phba);
                spin_unlock(&phba->hbalock);
+               lpfc_worker_wake_up(phba);
        }
 
        ha_copy &= ~(phba->work_ha_mask);