ide-scsi: cleanup ide_scsi_io_buffers()
[safe/jmp/linux-2.6] / drivers / scsi / lpfc / lpfc_mbox.c
index 8f42fbf..7a9be4c 100644 (file)
@@ -82,6 +82,24 @@ lpfc_read_nv(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
 }
 
 /**********************************************/
+/*  lpfc_config_async  Issue a                */
+/*  MBX_ASYNC_EVT_ENABLE mailbox command      */
+/**********************************************/
+void
+lpfc_config_async(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb,
+               uint32_t ring)
+{
+       MAILBOX_t *mb;
+
+       mb = &pmb->mb;
+       memset(pmb, 0, sizeof (LPFC_MBOXQ_t));
+       mb->mbxCommand = MBX_ASYNCEVT_ENABLE;
+       mb->un.varCfgAsyncEvent.ring = ring;
+       mb->mbxOwner = OWN_HOST;
+       return;
+}
+
+/**********************************************/
 /*  lpfc_heart_beat  Issue a HEART_BEAT       */
 /*                mailbox command             */
 /**********************************************/
@@ -270,16 +288,15 @@ lpfc_read_sparam(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb, int vpi)
 
        /* Get a buffer to hold the HBAs Service Parameters */
 
-       if (((mp = kmalloc(sizeof (struct lpfc_dmabuf), GFP_KERNEL)) == 0) ||
-           ((mp->virt = lpfc_mbuf_alloc(phba, 0, &(mp->phys))) == 0)) {
+       mp = kmalloc(sizeof (struct lpfc_dmabuf), GFP_KERNEL);
+       if (mp)
+               mp->virt = lpfc_mbuf_alloc(phba, 0, &mp->phys);
+       if (!mp || !mp->virt) {
                kfree(mp);
                mb->mbxCommand = MBX_READ_SPARM64;
                /* READ_SPARAM: no buffers */
-               lpfc_printf_log(phba,
-                               KERN_WARNING,
-                               LOG_MBOX,
-                               "%d:0301 READ_SPARAM: no buffers\n",
-                               phba->brd_no);
+               lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX,
+                               "0301 READ_SPARAM: no buffers\n");
                return (1);
        }
        INIT_LIST_HEAD(&mp->list);
@@ -372,15 +389,16 @@ lpfc_reg_login(struct lpfc_hba *phba, uint16_t vpi, uint32_t did,
        mb->mbxOwner = OWN_HOST;
 
        /* Get a buffer to hold NPorts Service Parameters */
-       if (((mp = kmalloc(sizeof (struct lpfc_dmabuf), GFP_KERNEL)) == NULL) ||
-           ((mp->virt = lpfc_mbuf_alloc(phba, 0, &(mp->phys))) == 0)) {
+       mp = kmalloc(sizeof (struct lpfc_dmabuf), GFP_KERNEL);
+       if (mp)
+               mp->virt = lpfc_mbuf_alloc(phba, 0, &mp->phys);
+       if (!mp || !mp->virt) {
                kfree(mp);
                mb->mbxCommand = MBX_REG_LOGIN64;
                /* REG_LOGIN: no buffers */
                lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX,
-                               "%d (%d):0302 REG_LOGIN: no buffers, DID x%x, "
-                               "flag x%x\n",
-                               phba->brd_no, vpi, did, flag);
+                               "0302 REG_LOGIN: no buffers, VPI:%d DID:x%x, "
+                               "flag x%x\n", vpi, did, flag);
                return (1);
        }
        INIT_LIST_HEAD(&mp->list);
@@ -564,7 +582,8 @@ lpfc_build_hbq_profile5(struct config_hbq_var *hbqmb,
 }
 
 void
-lpfc_config_hbq(struct lpfc_hba *phba, struct lpfc_hbq_init *hbq_desc,
+lpfc_config_hbq(struct lpfc_hba *phba, uint32_t id,
+                struct lpfc_hbq_init *hbq_desc,
                uint32_t hbq_entry_index, LPFC_MBOXQ_t *pmb)
 {
        int i;
@@ -572,6 +591,7 @@ lpfc_config_hbq(struct lpfc_hba *phba, struct lpfc_hbq_init *hbq_desc,
        struct config_hbq_var *hbqmb = &mb->un.varCfgHbq;
 
        memset(pmb, 0, sizeof (LPFC_MBOXQ_t));
+       hbqmb->hbqId = id;
        hbqmb->entry_count = hbq_desc->entry_count;   /* # entries in HBQ */
        hbqmb->recvNotify = hbq_desc->rn;             /* Receive
                                                       * Notification */
@@ -691,8 +711,8 @@ lpfc_config_port(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
 
        if (phba->sli_rev == 3 && phba->vpd.sli3Feat.cerbm) {
                mb->un.varCfgPort.cerbm = 1; /* Request HBQs */
-               mb->un.varCfgPort.max_hbq = 1; /* Requesting 2 HBQs */
-               if (phba->max_vpi && phba->cfg_npiv_enable &&
+               mb->un.varCfgPort.max_hbq = lpfc_sli_hbq_count();
+               if (phba->max_vpi && phba->cfg_enable_npiv &&
                    phba->vpd.sli3Feat.cmv) {
                        mb->un.varCfgPort.max_vpi = phba->max_vpi;
                        mb->un.varCfgPort.cmv = 1;
@@ -860,7 +880,7 @@ lpfc_mbox_get(struct lpfc_hba * phba)
 void
 lpfc_mbox_cmpl_put(struct lpfc_hba * phba, LPFC_MBOXQ_t * mbq)
 {
-       /* This function expects to be called from interupt context */
+       /* This function expects to be called from interrupt context */
        spin_lock(&phba->hbalock);
        list_add_tail(&mbq->list, &phba->sli.mboxq_cmpl);
        spin_unlock(&phba->hbalock);
@@ -876,7 +896,7 @@ lpfc_mbox_tmo_val(struct lpfc_hba *phba, int cmd)
        case MBX_DOWN_LOAD:     /* 0x1C */
        case MBX_DEL_LD_ENTRY:  /* 0x1D */
        case MBX_LOAD_AREA:     /* 0x81 */
-       case MBX_FLASH_WR_ULA:  /* 0x98 */
+       case MBX_WRITE_WWN:     /* 0x98 */
        case MBX_LOAD_EXP_ROM:  /* 0x9C */
                return LPFC_MBOX_TMO_FLASH_CMD;
        }